From 523ce1f7be956fc2af16105f60c70abfc37e4fdb Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Thu, 28 Sep 2023 18:15:00 +0200 Subject: [PATCH 1/6] Add test running volume coupling tutorial. --- .github/workflows/run-tutorials.yml | 41 +++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/.github/workflows/run-tutorials.yml b/.github/workflows/run-tutorials.yml index 2ac02790..62d47647 100644 --- a/.github/workflows/run-tutorials.yml +++ b/.github/workflows/run-tutorials.yml @@ -7,15 +7,15 @@ on: pull_request: paths: - '**' - -jobs: + +jobs: run_ht_simple: - name: Run HT, simple + name: Run HT, simple (surface coupling with matching meshes) runs-on: ubuntu-latest container: precice/precice steps: - name: Checkout Repository - uses: actions/checkout@v2 + uses: actions/checkout@v2 - name: Install Dependencies & FEniCS run: | apt-get -qq update @@ -30,17 +30,17 @@ jobs: - name: Get tutorials run: git clone -b develop https://github.com/precice/tutorials.git - name: Run tutorial - run: | + run: | cd tutorials/partitioned-heat-conduction/fenics python3 heat.py -d & python3 heat.py -n - + run_ht_complex: - name: Run HT, complex + name: Run HT, complex (surface coupling with nearest projection) runs-on: ubuntu-latest container: precice/precice steps: - name: Checkout Repository - uses: actions/checkout@v2 + uses: actions/checkout@v2 - name: Install Dependencies & FEniCS run: | apt-get -qq update @@ -58,3 +58,28 @@ jobs: run: | cd tutorials/partitioned-heat-conduction-complex/fenics python3 heat.py -d -i complex & python3 heat.py -n -i complex + + run_channel_transport_reaction: + name: Run channel-transport-reaction (volume coupling with linear cell interpolation) + runs-on: ubuntu-latest + container: precice/precice + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Install Dependencies & FEniCS + run: | + apt-get -qq update + apt-get -qq install software-properties-common python3-dev python3-pip git apt-utils + add-apt-repository -y ppa:fenics-packages/fenics + apt-get -qq install --no-install-recommends fenics + rm -rf /var/lib/apt/lists/* + - name: Install adapter + run: pip3 install --user . + - name: Fix broken FEniCS installation (see https://fenicsproject.discourse.group/t/installing-python-package-with-fenics-dependency-breaks-fenics-installation/4476) + run: pip3 uninstall -y fenics-ufl + - name: Get tutorials + run: git clone -b develop https://github.com/precice/tutorials.git + - name: Run tutorial + run: | + cd tutorials/channel-transport-reaction + python3 chemical-fenics/run.sh & python3 fluid-fenics/run.sh \ No newline at end of file From 2af233406af79be69ef00f9c346a6ff57aeffd2e Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Thu, 28 Sep 2023 18:25:05 +0200 Subject: [PATCH 2/6] Add todos and reactivate code for volume coupling. --- fenicsprecice/fenicsprecice.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/fenicsprecice/fenicsprecice.py b/fenicsprecice/fenicsprecice.py index 09e77d77..2a500dd7 100644 --- a/fenicsprecice/fenicsprecice.py +++ b/fenicsprecice/fenicsprecice.py @@ -414,15 +414,17 @@ def initialize(self, coupling_subdomain, read_function_space=None, write_object= function_space, coupling_subdomain, self._owned_vertices.get_global_ids(), id_mapping) # Surface coupling over 1D edges + #TODO call set_mesh_edges, if using surface coupling. Otherwise does not make sense. self._participant.set_mesh_edges(self._config.get_coupling_mesh_name(), edge_vertex_ids) - # Code below does not work properly. Volume coupling does not integrate well with surface coupling in this state. See https://github.com/precice/fenics-adapter/issues/162. - # # Configure mesh connectivity (triangles from edges) for 2D simulations - # if self._fenics_dims == 2: - # vertices = get_coupling_triangles(function_space, coupling_subdomain, fenics_edge_ids, id_mapping) - # self._participant.set_mesh_triangles(self._config.get_coupling_mesh_name(), vertices) - # else: - # print("Mesh connectivity information is not written for 3D cases.") + # Configure mesh connectivity (triangles from edges) for 2D simulations + #TODO only enter code below, if using volume coupling. Otherwise does not make sense. + if self._fenics_dims == 2: + # Volume coupling over 2D triangles + vertices = get_coupling_triangles(function_space, coupling_subdomain, fenics_edge_ids, id_mapping) + self._participant.set_mesh_triangles(self._config.get_coupling_mesh_name(), vertices) + else: + print("Mesh connectivity information is not written for 3D cases.") if self._participant.requires_initial_data(): if not write_function: From b18fbe08d81dede9648782663eadeb1e23b79c80 Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Thu, 28 Sep 2023 18:30:15 +0200 Subject: [PATCH 3/6] Fix test. --- .github/workflows/run-tutorials.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tutorials.yml b/.github/workflows/run-tutorials.yml index 6f17c409..b785b9ee 100644 --- a/.github/workflows/run-tutorials.yml +++ b/.github/workflows/run-tutorials.yml @@ -82,4 +82,4 @@ jobs: - name: Run tutorial run: | cd tutorials/channel-transport-reaction - python3 chemical-fenics/run.sh & python3 fluid-fenics/run.sh + cd chemical-fenics && ./run.sh & cd .. && cd fluid-fenics && ./run.sh From 1b742f6dd4826e2f60c30abaaafa018cfb38a1a0 Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Thu, 28 Sep 2023 18:32:00 +0200 Subject: [PATCH 4/6] Fix format. --- fenicsprecice/fenicsprecice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fenicsprecice/fenicsprecice.py b/fenicsprecice/fenicsprecice.py index 2a500dd7..edf2b4b4 100644 --- a/fenicsprecice/fenicsprecice.py +++ b/fenicsprecice/fenicsprecice.py @@ -414,11 +414,11 @@ def initialize(self, coupling_subdomain, read_function_space=None, write_object= function_space, coupling_subdomain, self._owned_vertices.get_global_ids(), id_mapping) # Surface coupling over 1D edges - #TODO call set_mesh_edges, if using surface coupling. Otherwise does not make sense. + # TODO call set_mesh_edges, if using surface coupling. Otherwise does not make sense. self._participant.set_mesh_edges(self._config.get_coupling_mesh_name(), edge_vertex_ids) # Configure mesh connectivity (triangles from edges) for 2D simulations - #TODO only enter code below, if using volume coupling. Otherwise does not make sense. + # TODO only enter code below, if using volume coupling. Otherwise does not make sense. if self._fenics_dims == 2: # Volume coupling over 2D triangles vertices = get_coupling_triangles(function_space, coupling_subdomain, fenics_edge_ids, id_mapping) From 2de30a0128dc3e53db2c52c78e857299b61c6e93 Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Thu, 28 Sep 2023 18:50:28 +0200 Subject: [PATCH 5/6] Fix. --- .github/workflows/run-tutorials.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tutorials.yml b/.github/workflows/run-tutorials.yml index b785b9ee..b9852970 100644 --- a/.github/workflows/run-tutorials.yml +++ b/.github/workflows/run-tutorials.yml @@ -82,4 +82,4 @@ jobs: - name: Run tutorial run: | cd tutorials/channel-transport-reaction - cd chemical-fenics && ./run.sh & cd .. && cd fluid-fenics && ./run.sh + python3 fluid-fenics/fluid.py & python3 chemical-fenics/chemical-reaction-advection-diffusion.py \ No newline at end of file From 74cd610fda370db1194b38a94de62079a576118d Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Tue, 20 Aug 2024 11:12:38 +0200 Subject: [PATCH 6/6] Fix script. --- .github/workflows/run-tutorials.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tutorials.yml b/.github/workflows/run-tutorials.yml index 183c384d..cbc3189f 100644 --- a/.github/workflows/run-tutorials.yml +++ b/.github/workflows/run-tutorials.yml @@ -82,4 +82,4 @@ jobs: - name: Run tutorial run: | cd tutorials/channel-transport-reaction - cd fluid-fenics && ./run.py & cd chemical-fenics && ./run.py + cd fluid-fenics && ./run.sh & cd chemical-fenics && ./run.sh