-
-
Notifications
You must be signed in to change notification settings - Fork 122
Split partitioned-heat-conduction case into complex and simple one #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
c05a2e8
Strip case of everything besides simple heat conduction setup.
BenjaminRodenberg c41013e
Adds precice-config.xml supporting parallel runs.
BenjaminRodenberg 71fcc28
Merge branch 'restructure' into i_137
BenjaminRodenberg 51eb727
Add documentation and nutils case.
BenjaminRodenberg 91510da
Add complex case. Based on ae77ae5d012e6652a4249bbecc820fbb2211ce23.
BenjaminRodenberg 1ca266d
Cleanup and Update to newest version of python bindings.
BenjaminRodenberg 0551635
Use scalar-valued flux.
BenjaminRodenberg f410eec
Apply new structure to complex case.
BenjaminRodenberg 6aacd46
Remove subcycling.
BenjaminRodenberg 77bf103
Simplify heat nutils to one mesh, make config consistent
uekerman 8dd4258
Fix names.
BenjaminRodenberg d2e726c
BCs working.
BenjaminRodenberg 0bcf866
Minor restructuring
BenjaminRodenberg 679fe8d
Fix initial condition and output.
BenjaminRodenberg f80f8fd
Mark nutils case as under construction. See #152.
BenjaminRodenberg 35dc013
Add link to Nutils
BenjaminRodenberg 1d01384
Update partitioned-heat-conduction-complex/precice-config.xml
BenjaminRodenberg 4acdad4
Update partitioned-heat-conduction-complex/precice-config.xml
BenjaminRodenberg 4afe280
Update partitioned-heat-conduction-complex/precice-config.xml
BenjaminRodenberg 97cf386
Update partitioned-heat-conduction-complex/precice-config.xml
BenjaminRodenberg e1d1411
Add note for website.
BenjaminRodenberg 75e68af
Provide more details and use x_c = 1
BenjaminRodenberg 2ad8b53
Cleanup for consistency with non-complex case.
BenjaminRodenberg 9db75e5
Fix formatting
BenjaminRodenberg 69c0c46
Cleanup w.r.t visualization
BenjaminRodenberg cf11057
Merge branch 'i_137' of github.com:precice/tutorials into i_137
BenjaminRodenberg bf765be
Add summary.
BenjaminRodenberg 9614c02
Remove FEniCS from setup.
BenjaminRodenberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
title: Partitioned heat conduction (complex setup) | ||
permalink: tutorials-partitioned-heat-conduction-complex.html | ||
keywords: FEniCS, Heat conduction | ||
summary: This tutorial is the advanced version of the `partitioned-heat-conduction` tutorial. More advanced features and geometries may be used. | ||
--- | ||
|
||
{% include important.html content="We have not yet ported the documentation of the preCICE tutorials from the preCICE wiki to here. Please go to the [preCICE wiki](https://github.com/precice/precice/wiki#2-getting-started---tutorials)" %} | ||
|
||
## Setup | ||
|
||
This case is an advanced version of `partitioned-heat-conduction`. Some advanced features offered by this case: | ||
|
||
* Geometries may be chosen arbitrarily. One possibility is to use a circle and a rectangular plate with a hole, but you can also provide your own geometry, if you want. | ||
* You may combine arbitrary mesh resolutions at the coupling interface. | ||
* Nearest projection mapping is used. | ||
* The Dirichlet and Neumann participants may be swapped arbitrarily. | ||
* The exchanged temperature is still scalar valued, but the heat flux is vector valued. | ||
* You can decide to use a time dependent heat flux and right-hand side to make the problem more challenging. | ||
|
||
## Available solvers and dependencies | ||
|
||
See `partitioned-heat-conduction`, only `fenics` is provided as a solver. | ||
|
||
## Running the simulation | ||
|
||
See `partitioned-heat-conduction`. The additional featured mentioned above can be activated via command line arguments. Please run `python3 fenics/heat.py --help` for a full list of provided arguments. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
partitioned-heat-conduction-complex/fenics/precice-adapter-config-D.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"participant_name": "Dirichlet", | ||
"config_file_name": "../precice-config.xml", | ||
"interface": { | ||
"coupling_mesh_name": "Dirichlet-Mesh", | ||
"write_data_name": "Flux", | ||
"read_data_name": "Temperature" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
partitioned-heat-conduction-complex/fenics/precice-adapter-config-N.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"participant_name": "Neumann", | ||
"config_file_name": "../precice-config.xml", | ||
"interface": { | ||
"coupling_mesh_name": "Neumann-Mesh", | ||
"write_data_name": "Temperature", | ||
"read_data_name": "Flux" | ||
} | ||
} |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?xml version="1.0"?> | ||
|
||
<precice-configuration> | ||
|
||
<log> | ||
<sink filter="%Severity% > debug and %Rank% = 0" format="---[precice] %ColorizedSeverity% %Message%" enabled="true"/> | ||
</log> | ||
|
||
<solver-interface dimensions="2"> | ||
|
||
<data:scalar name="Temperature"/> | ||
<data:vector name="Flux"/> | ||
|
||
<mesh name="Dirichlet-Mesh"> | ||
<use-data name="Temperature"/> | ||
<use-data name="Flux"/> | ||
</mesh> | ||
|
||
<mesh name="Neumann-Mesh"> | ||
<use-data name="Temperature"/> | ||
<use-data name="Flux"/> | ||
</mesh> | ||
|
||
<participant name="Dirichlet"> | ||
<use-mesh name="Dirichlet-Mesh" provide="yes"/> | ||
<use-mesh name="Neumann-Mesh" from="Neumann"/> | ||
<write-data name="Flux" mesh="Dirichlet-Mesh"/> | ||
<read-data name="Temperature" mesh="Dirichlet-Mesh"/> | ||
<mapping:nearest-projection direction="read" from="Neumann-Mesh" to="Dirichlet-Mesh" constraint="consistent" /> | ||
</participant> | ||
|
||
<participant name="Neumann"> | ||
<use-mesh name="Neumann-Mesh" provide="yes"/> | ||
<use-mesh name="Dirichlet-Mesh" from="Dirichlet"/> | ||
<write-data name="Temperature" mesh="Neumann-Mesh"/> | ||
<read-data name="Flux" mesh="Neumann-Mesh"/> | ||
<mapping:nearest-projection direction="read" from="Dirichlet-Mesh" to="Neumann-Mesh" constraint="consistent" /> | ||
</participant> | ||
|
||
<m2n:sockets from="Dirichlet" to="Neumann" exchange-directory=".."/> | ||
|
||
<coupling-scheme:serial-implicit> | ||
<participants first="Dirichlet" second="Neumann"/> | ||
<max-time value="1.0"/> | ||
<time-window-size value="0.1"/> | ||
<max-iterations value="100"/> | ||
<exchange data="Flux" mesh="Dirichlet-Mesh" from="Dirichlet" to="Neumann" /> | ||
<exchange data="Temperature" mesh="Neumann-Mesh" from="Neumann" to="Dirichlet" initialize="true"/> | ||
<relative-convergence-measure data="Flux" mesh="Dirichlet-Mesh" limit="1e-5"/> | ||
<relative-convergence-measure data="Temperature" mesh="Neumann-Mesh" limit="1e-5"/> | ||
<acceleration:IQN-ILS> | ||
<data name="Temperature" mesh="Neumann-Mesh"/> | ||
<initial-relaxation value="0.1"/> | ||
<max-used-iterations value="10"/> | ||
<time-windows-reused value="5"/> | ||
<filter type="QR2" limit="1e-3"/> | ||
</acceleration:IQN-ILS> | ||
</coupling-scheme:serial-implicit> | ||
|
||
</solver-interface> | ||
</precice-configuration> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,70 @@ | ||
--- | ||
title: Partitioned heat conduction | ||
permalink: tutorials-partitioned-heat-conduction.html | ||
keywords: | ||
summary: | ||
keywords: FEniCS, Nutils, Heat conduction | ||
summary: In this tutorial we solve a simple heat equation. The domain is partitioned and the coupling is established in a Dirichlet-Neumann fashion. | ||
--- | ||
|
||
{% include important.html content="We have not yet ported the documentation of the preCICE tutorials from the preCICE wiki to here. Please go to the [preCICE wiki](https://github.com/precice/precice/wiki#2-getting-started---tutorials)" %} | ||
|
||
## Setup | ||
|
||
In this tutorial we solve a partitioned heat equation. For information on the 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]. | ||
|
||
 | ||
|
||
Case setup from [3]. `D` denotes the Dirichlet participant and `N` denotes the Neumann participant. | ||
|
||
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 participant 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. | ||
|
||
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]. | ||
|
||
## Available solvers and dependencies | ||
|
||
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. | ||
|
||
* `fenics`, requires you to 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]. | ||
|
||
|
||
* :construction: This case is still under construction. See https://github.com/precice/tutorials/issues/152. :construction: `nutils`, requires you to install [Nutils](http://www.nutils.org/en/latest/). | ||
BenjaminRodenberg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Running the simulation | ||
|
||
For choosing whether you want to run the Dirichlet-kind and a Neumann-kind participant, please provide the following commandline input: | ||
|
||
* `-d` flag will enforce Dirichlet boundary conditions on the coupling interface. | ||
* `-n` flag will enforce Neumann boundary conditions on the coupling interface. | ||
|
||
For running the case, open two terminals and: | ||
|
||
``` | ||
cd fenics | ||
python3 heat.py -d | ||
``` | ||
|
||
and | ||
|
||
``` | ||
cd fenics | ||
python3 heat.py -n | ||
``` | ||
|
||
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, simply execute | ||
|
||
``` | ||
mpirun -n <N_PROC> python3 heat.py -d | ||
``` | ||
|
||
## Visualization | ||
|
||
Output is written into the folder `fenics/out`. You can visualize the content with paraview by opening the `*.pvd` files. The files `Dirichlet.pvd` and `Neumann.pvd` correspond to the numerical solution of the Dirichlet, respectively Neumann, problem, while the files with the prefix `ref` correspond to the analytical reference solution, the files with `error` show the error and the files with `ranks` the ranks of the solvers (if executed in parallel). | ||
|
||
 | ||
|
||
Visualization in paraview for `x_c = 1.5`. | ||
|
||
## References | ||
|
||
[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) | ||
[2] Azahar Monge and Philipp Birken. "Convergence Analysis of the Dirichlet-Neumann Iteration for Finite Element Discretizations." (2016). Proceedings in Applied Mathematics and Mechanics. [doi](https://doi.org/10.1002/pamm.201610355) | ||
[3] Benjamin Rüth, Benjamin Uekermann, Miriam Mehl, Philipp Birken, Azahar Monge, and Hans Joachim Bungartz. "Quasi-Newton waveform iteration for partitioned surface-coupled multiphysics applications." (2020). International Journal for Numerical Methods in Engineering. [doi](https://doi.org/10.1002/nme.6443) |
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
partitioned-heat-conduction/fenics-fenics/precice-adapter-config-D.json
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
partitioned-heat-conduction/fenics-fenics/precice-adapter-config-N.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.