Skip to content

Commit 30371ba

Browse files
authored
Add 3D case for partitioned heat conduction (#714)
1 parent b8d5b35 commit 30371ba

22 files changed

Lines changed: 787 additions & 4 deletions

changelog-entries/714.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Added a 3D partitioned heat conduction tutorial with FEniCSx [#714](https://github.com/precice/tutorials/pull/714)
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: 3D partitioned heat conduction
3+
permalink: tutorials-partitioned-heat-conduction-3d.html
4+
keywords: FEniCSx, Heat conduction
5+
summary: We solve a simple heat equation on a 3D domain. The domain is partitioned and the coupling is established in a Dirichlet-Neumann fashion.
6+
---
7+
8+
{% note %}
9+
Get the [case files of this tutorial](https://github.com/precice/tutorials/tree/develop/partitioned-heat-conduction-3d), as continuously rendered here, or see the [latest released version](https://github.com/precice/tutorials/tree/master/partitioned-heat-conduction-3d) (if there is already one). Read how in the [tutorials introduction](https://precice.org/tutorials.html).
10+
{% endnote %}
11+
12+
## Setup
13+
14+
We solve a partitioned heat equation. For information on the two dimensional non-partitioned case, please refer to [1, p.37ff]. In this tutorial the computational domain is partitioned and coupled via preCICE. The coupling roughly follows the approach described in [2].
15+
16+
![Case setup of partitioned-heat-conduction case](images/tutorials-partitioned-heat-conduction-3d-setup.png)
17+
18+
The computational domain can be seen in the picture above. To get a better overview of the domain, the domains of the participants are translated.
19+
The domain of the Neumann participant is the small box, and the Dirichlet participant's domain is the rest. In the simulation, the small box is fully contained in the Dirichlet domain. This means, the coupling interface consists of five sides of the box.
20+
21+
## Configuration
22+
23+
preCICE configuration (image generated using the [precice-config-visualizer](https://precice.org/tooling-config-visualization.html)):
24+
25+
![preCICE configuration visualization](images/tutorials-partitioned-heat-conduction-3d-precice-config.png)
26+
27+
## Available solvers and dependencies
28+
29+
You can either couple a solver with itself or different solvers with each other. In any case you will need to have preCICE and the python bindings installed on your system.
30+
31+
* FEniCSx. Install [FEniCS](https://fenicsproject.org/download/) and the [FEniCSx-adapter](https://github.com/precice/fenicsx-adapter). The code is adapted from the existing [fenics-tutorial](https://github.com/hplgit/fenics-tutorial/blob/master/pub/python/vol1/ft03_heat.py) from [1].
32+
33+
## Running the simulation
34+
35+
You can find the corresponding `run.sh` script for running the case in the folders corresponding to the participant you want to use:
36+
37+
```bash
38+
cd dirichlet-fenicsx
39+
./run.sh
40+
```
41+
42+
and
43+
44+
```bash
45+
cd neumann-fenicsx
46+
./run.sh
47+
```
48+
49+
## Visualization
50+
51+
Output is written into the folders of the FEniCSx solvers (`neumann-fenicsx/output-neumann.bp` and `dirichlet-fenicsx/output-dirichlet.bp`).
52+
53+
It is sufficient to import the folders to ParaView to get the visualization of the simulation.
54+
55+
## References
56+
57+
[1] Hans Petter Langtangen and Anders Logg. "Solving PDEs in Minutes-The FEniCS Tutorial Volume I." (2016). [pdf](https://fenicsproject.org/pub/tutorial/pdf/fenics-tutorial-vol1.pdf)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env sh
2+
set -e -u
3+
4+
# shellcheck disable=SC1091
5+
. ../tools/cleaning-tools.sh
6+
7+
clean_tutorial .
8+
clean_precice_logs .
9+
rm -fv ./*.log
10+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env sh
2+
set -e -u
3+
4+
. ../../tools/cleaning-tools.sh
5+
6+
clean_fenicsx .
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"participant_name": "Dirichlet",
3+
"precice_config_file_path": "../precice-config.xml",
4+
"interfaces": [
5+
{
6+
"mesh_name": "Dirichlet-Mesh",
7+
"write_data": [
8+
{
9+
"name": "Heat-Flux"
10+
}
11+
],
12+
"read_data": [
13+
{
14+
"name": "Temperature"
15+
}
16+
]
17+
}
18+
]
19+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
set -e -u
3+
4+
if [ ! -v PRECICE_TUTORIALS_NO_VENV ]
5+
then
6+
if [ ! -d ".venv" ]; then
7+
python3 -m venv --system-site-packages .venv
8+
source .venv/bin/activate
9+
pip install -r ../solver-fenicsx/requirements.txt
10+
else
11+
source .venv/bin/activate
12+
fi
13+
fi
14+
15+
python3 ../solver-fenicsx/heat.py Dirichlet --error-tol 10e-3
80 KB
Loading
26.2 KB
Loading
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Partitioned heat conduction 3D
2+
path: partitioned-heat-conduction-3d # relative to git repo
3+
url: https://precice.org/tutorials-partitioned-heat-conduction-3d.html
4+
5+
participants:
6+
- Dirichlet
7+
- Neumann
8+
9+
cases:
10+
dirichlet-fenicsx:
11+
participant: Dirichlet
12+
directory: ./dirichlet-fenicsx
13+
run: ./run.sh
14+
component: fenicsx-adapter
15+
16+
neumann-fenicsx:
17+
participant: Neumann
18+
directory: ./neumann-fenicsx
19+
run: ./run.sh
20+
component: fenicsx-adapter
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env sh
2+
set -e -u
3+
4+
. ../../tools/cleaning-tools.sh
5+
6+
clean_fenicsx .

0 commit comments

Comments
 (0)