You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add partitioned-heat OpenFOAM participant with solver (#223)
* Rename Heat to Heat-Flux according to naming scheme
* Add initial field function for non-default initial conditions
* Add the OpenFOAM Neumann configuration
* Fix shell description for initial field
* Add modified solver version including non-zero RHS
* Format precice config according to our standard
* Rename 'Flux' to 'Heat-Flux' in precice-config.xml
* Remove license header and write some custom text
* Add non-saved modifications missing in the previous commit
* Add an additional Dirichlet participant
* Fix some typos and missing brackets
* Add value slot in groovyBC for paraFoam reader
* Add run and clean scripts and README description
* Move openfoam solver in dedicated directory on the top level
* Update documentation for updated structure
* Store generated executable in FOAM_USER_APPBIN
and adjust documentation as well as run scripts accordingly
* Add a comment on the heat transfer coefficient
* Fix duplicated 'in the' in controlDict
* Plug everything in one script to enable easy mesh modifications
* Adjust the documentation for updated workflows
* Apply suggestions from Makis review
Co-authored-by: Gerasimos Chourdakis <[email protected]>
* Remove OpenFOAM header from Temperature file
* Add a changelog entry
* Clean up cleaning files and add a solver cleaning script
Co-authored-by: Gerasimos Chourdakis <[email protected]>
- Added OpenFOAM solver as well as the participants (Dirichlet and Neumann) to our partiitoned-heat tutorial [#223](https://github.com/precice/tutorials/pull/223)
Copy file name to clipboardExpand all lines: partitioned-heat-conduction/README.md
+21-19
Original file line number
Diff line number
Diff line change
@@ -15,50 +15,52 @@ We solve a partitioned heat equation. For information on the non-partitioned cas
15
15
16
16
Case setup from [3]. `D` denotes the Dirichlet participant and `N` denotes the Neumann participant.
17
17
18
-
The heat equation is solved on a rectangular domain `Omega = [0,2] x [0,1]` with given Dirichlet boundary conditions. We split the domain at `x_c = 1` using a straight vertical line, the coupling interface. The left part of the domain will be referred to as the Dirichlet partition and the right part as the Neumann partition. To couple the two participants we use Dirichlet-Neumann coupling. Here, the Dirichlet participant receives Dirichlet boundary conditions (`Temperature`) at the coupling interface and solves the heat equation using these boundary conditions on the left part of the domain. Then the Dirichlet participant computes the resulting heat flux (`Flux`) from the solution and sends it to the Neumann participant. The Neumann participant uses the flux as a Neumann boundary condition to solve the heat equation on the right part of the domain. We then extract the temperature from the solution and send it back to the Dirichlet participant. This establishes the coupling between the two participants.
18
+
The heat equation is solved on a rectangular domain `Omega = [0,2] x [0,1]` with given Dirichlet boundary conditions. We split the domain at `x_c = 1` using a straight vertical line, the coupling interface. The left part of the domain will be referred to as the Dirichlet partition and the right part as the Neumann partition. To couple the two participants we use Dirichlet-Neumann coupling. Here, the Dirichlet participant receives Dirichlet boundary conditions (`Temperature`) at the coupling interface and solves the heat equation using these boundary conditions on the left part of the domain. Then the Dirichlet participant computes the resulting heat flux (`Heat-Flux`) from the solution and sends it to the Neumann participant. The Neumann participant uses the flux as a Neumann boundary condition to solve the heat equation on the right part of the domain. We then extract the temperature from the solution and send it back to the Dirichlet participant. This establishes the coupling between the two participants.
19
19
20
20
This simple case allows us to compare the solution for the partitioned case to a known analytical solution (method of manufactures solutions, see [1, p.37ff]). For more usage examples and details, please refer to [3, sect. 4.1].
21
21
22
22
## Available solvers and dependencies
23
23
24
-
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.
24
+
You can either couple a solver with itself or different solvers with each other. In any case you will need to have preCICE
25
25
26
26
* FEniCS. Install [FEniCS](https://fenicsproject.org/download/) and the [FEniCS-adapter](https://github.com/precice/fenics-adapter). The code is largely based on this [fenics-tutorial](https://github.com/hplgit/fenics-tutorial/blob/master/pub/python/vol1/ft03_heat.py) from [1].
* OpenFOAM. Install OpenFOAM and the [OpenFOAM adapter](https://www.precice.org/adapter-openfoam-overview.html). This tutorial uses a custom solver, which you can find in `tutorials/partitioned-heat-conduction/openfoam-solver` and build using `cd tutorials/partitioned-heat-conduction/openfoam-solver && wmake`. Have a look at the section below (Notes on the OpenFOAM case) for further information.
31
31
32
-
This tutorial is for FEniCS and Nutils. You can find the corresponding `run.sh` script in the folders `fenics` and `nutils`.
32
+
### Notes on the OpenFOAM case
33
33
34
-
For choosing whether you want to run the Dirichlet-kind and a Neumann-kind participant, please provide the following commandline input:
34
+
Running this tutorial with OpenFOAM is a bit of a challenge and requires some special considerations:
35
35
36
-
*`-d` flag will enforce Dirichlet boundary conditions on the coupling interface.
37
-
*`-n` flag will enforce Neumann boundary conditions on the coupling interface.
36
+
* First of all, OpenFOAM does not provide a Laplace solver with a non-zero right-hand side. Therefore, we provide a modified Laplace solver together with the tutorial, which needs to be compiled before running the tutorial. The solver can be compiled by executing `wmake` in the solver directory `./openfoam-solver/`. The generated executable will be stored in the `FOAM_USER_APPBIN` by default. Afterwards, the custom solver `heatTransfer` can be started from the respective OpenFOAM case directory, as usual.
38
37
39
-
For running the case, open two terminals run:
38
+
* The second challenge is given by the time- and space-dependent Dirichlet boundary conditions required for domain boundaries not belonging to the interface. For this purpose, a valid installation of `groovyBC` (part of `swak4Foam`) is required.
40
39
41
-
```bash
42
-
cd fenics
43
-
./run.sh -d
44
-
```
40
+
* The third challenge is given by the space-dependent initial conditions. We use `funkySetFields` (installed with OpenFOAM) to evaluate the initial condition. You can directly execute the `./run.sh` script, which calls the `setInitialField.sh` in order to evaluate the required initial condition and store it in the `0` directory. Note that `run.sh` deletes the `0` time directory and copies it again from `0.orig`. If you start modifying the initial or boundary conditions, make sure you modify the files located in the `0.orig` directory in combination with the default `run.sh` scripts.
45
41
46
-
and
42
+
## Running the simulation
47
43
48
-
```bash
49
-
cd fenics
50
-
./run.sh -n
51
-
```
44
+
You can find the corresponding `run.sh` script in each participant solver.
45
+
46
+
In case of `fenics` and `nutils` the Dirichlet-kind and a Neumann-kind participant are currently merged into a single participant directory. Therefore, please provide the following command line input argument:
52
47
53
-
If you want to use Nutils for one or both sides of the setup, just `cd nutils`. The FEniCS case also supports parallel runs. Here, you cannot use the `run.sh` script, but must simply execute
48
+
*`-d` flag will enforce Dirichlet boundary conditions on the coupling interface.
49
+
*`-n` flag will enforce Neumann boundary conditions on the coupling interface.
50
+
51
+
For running the case, a Dirichlet and a Neumann participant need to be executed, e.g., `./run.sh -d` and `./run.sh. -n`
52
+
53
+
The FEniCS case also supports parallel runs. Here, you cannot use the `run.sh` script, but must simply execute
54
54
55
55
```bash
56
56
mpirun -n <N_PROC> python3 heat.py -d
57
57
```
58
58
59
+
OpenFOAM supports parallel runs as usual. However, you need to execute the command manually by running: `mpirun -np <N_PROC> ./heatTransfer`.
60
+
59
61
### Note on the combination of Nutils & FEniCS
60
62
61
-
You can mix the Nutils and FEniCS solver, if you like. Note that the error for a pure FEniCS simulation is lower than for a mixed one. We did not yet study the origin of this error, but assume that this is due to the fact that Nutils uses Gauss points as coupling mesh and therefore entails extrapolation in the data mapping at the top and bottom corners.
63
+
You can mix the Nutils and FEniCS solver, if you like. Note that the error for a pure FEniCS simulation is lower than for a mixed one, because the FEniCS participants use the same coupling mesh, i.e., the mapping error becomes significantly smaller.
0 commit comments