-
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce partitioned heat equation scenario using waveform relaxation (
#30) * `heat.py` is modified such that waveform relaxation is used. * Adapter and preCICE configuration files are modified correspondingly.
- Loading branch information
1 parent
4d8226a
commit 116bac4
Showing
21 changed files
with
527 additions
and
67 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
venv | ||
.idea | ||
*.pyc | ||
out | ||
out* | ||
*.log | ||
*events.json |
This file contains 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,3 +1,36 @@ | ||
# Tutorial for a partitioned heat equation using FEniCS | ||
|
||
This tutorial is described in the [preCICE wiki](https://github.com/precice/precice/wiki/Tutorial-for-solving-the-heat-equation-in-a-partitioned-fashion-using-FEniCS). | ||
|
||
## Waveform relaxation (experimental) | ||
|
||
This branch of the tutorial uses the fenics-adapter waveform bindings. If you want to run this tutorial, you have to install the version of the FEniCS-adapter that can be found on [this branch](https://github.com/precice/fenics-adapter/tree/WaveformBindingsDraft). Further information on waveform relaxation in the FEniCS-adapter can be found in issue https://github.com/precice/fenics-adapter/issues/16 and milestone https://github.com/precice/fenics-adapter/milestone/2. | ||
|
||
### Setup description and how to run the examples | ||
|
||
For all setups linear interpolation in time is used for each (micro-)timestep. The commands for running the example cases are given. | ||
|
||
**WR11:** this case uses no subcycling such that `dt_neumann = dt_dirichlet = T_window` (dt for each solver equals window size). | ||
|
||
* ` python3 heat.py -d` | ||
* ` python3 heat.py -n` | ||
|
||
**WR12:** this case uses subcycling such that `2*dt_neumann = dt_dirichlet = T_window`. | ||
|
||
* ` python3 heat.py -d -wr 1 2` | ||
* ` python3 heat.py -n -wr 1 2` | ||
|
||
**WR22:** this case uses subcycling such that `2*dt_neumann = 2*dt_dirichlet = T_window`. | ||
|
||
* ` python3 heat.py -d -wr 2 1` | ||
* ` python3 heat.py -n -wr 2 1` | ||
|
||
### running the experiments | ||
|
||
In the folder `experiments` you can find experiments with different timestep size and waveform configuration. If you traverse down the folder structure, you will find preCICE and adapter config files for running the experiments. All the output will be generated in that folder. | ||
|
||
Example for running: | ||
|
||
`cd experiments/WR12/dT0.1` | ||
`python3 ../../../heat.py -d -wr 1 2 -dT 0.1` | ||
`python3 ../../../heat.py -n -wr 1 2 -dT 0.1` |
This file contains 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 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 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
12 changes: 12 additions & 0 deletions
12
HT/partitioned-heat/fenics-fenics/experiments/WR12/dT0.1/precice-adapter-config-D.json
This file contains 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,12 @@ | ||
{ | ||
"solver_name": "HeatDirichlet", | ||
"config_file_name": "precice-config.xml", | ||
"interface": { | ||
"coupling_mesh_name": "DirichletNodes", | ||
"write_data_name": "Flux", | ||
"read_data_name": "Temperature" | ||
}, | ||
"waveform": { | ||
"n_substeps": 1 | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
HT/partitioned-heat/fenics-fenics/experiments/WR12/dT0.1/precice-adapter-config-N.json
This file contains 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,12 @@ | ||
{ | ||
"solver_name": "HeatNeumann", | ||
"config_file_name": "precice-config.xml", | ||
"interface": { | ||
"coupling_mesh_name": "NeumannNodes", | ||
"write_data_name": "Temperature", | ||
"read_data_name": "Flux" | ||
}, | ||
"waveform": { | ||
"n_substeps": 2 | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
HT/partitioned-heat/fenics-fenics/experiments/WR12/dT0.1/precice-config.xml
This file contains 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,75 @@ | ||
<?xml version="1.0"?> | ||
|
||
<precice-configuration> | ||
|
||
<solver-interface dimensions="2"> | ||
|
||
<!-- Data fields that are exchanged between the solvers --> | ||
<data:scalar name="Temperature1"/> | ||
<data:scalar name="Temperature2"/> | ||
<data:scalar name="Flux1"/> | ||
|
||
<!-- A common mesh that uses these data fields --> | ||
<mesh name="DirichletNodes"> | ||
<use-data name="Temperature1"/> | ||
<use-data name="Temperature2"/> | ||
<use-data name="Flux1"/> | ||
</mesh> | ||
|
||
<mesh name="NeumannNodes"> | ||
<use-data name="Temperature1"/> | ||
<use-data name="Temperature2"/> | ||
<use-data name="Flux1"/> | ||
</mesh> | ||
|
||
<!-- Represents each solver using preCICE. In a coupled simulation, two participants have to be | ||
defined. The name of the participant has to match the name given on construction of the | ||
precice::SolverInterface object used by the participant. --> | ||
|
||
<participant name="HeatDirichlet"> | ||
<!-- Makes the named mesh available to the participant. Mesh is provided by the solver directly. --> | ||
<use-mesh name="DirichletNodes" provide="yes" /> | ||
<use-mesh name="NeumannNodes" from="HeatNeumann" /> | ||
<!-- Define input/output of the solver. --> | ||
<write-data name="Flux1" mesh="DirichletNodes"/> | ||
<read-data name="Temperature1" mesh="DirichletNodes"/> | ||
<read-data name="Temperature2" mesh="DirichletNodes"/> | ||
<mapping:nearest-projection direction="write" from="DirichletNodes" to="NeumannNodes" constraint="consistent" timing="initial"/> | ||
<mapping:nearest-projection direction="read" from="NeumannNodes" to="DirichletNodes" constraint="consistent" timing="initial"/> | ||
</participant> | ||
|
||
<participant name="HeatNeumann"> | ||
<use-mesh name="NeumannNodes" provide="yes"/> | ||
<write-data name="Temperature1" mesh="NeumannNodes"/> | ||
<write-data name="Temperature2" mesh="NeumannNodes"/> | ||
<read-data name="Flux1" mesh="NeumannNodes"/> | ||
</participant> | ||
|
||
<!-- Communication method, use TCP sockets, Change network to "ib0" on SuperMUC --> | ||
<m2n:sockets distribution-type="gather-scatter" from="HeatDirichlet" to="HeatNeumann" network="lo"/> | ||
|
||
<coupling-scheme:serial-implicit> | ||
<participants first="HeatDirichlet" second="HeatNeumann"/> | ||
<max-time value="10"/> | ||
<timestep-length value=".1" valid-digits="8"/> | ||
<max-iterations value="100"/> | ||
<exchange data="Flux1" mesh="NeumannNodes" from="HeatDirichlet" to="HeatNeumann" /> | ||
<exchange data="Temperature1" mesh="NeumannNodes" from="HeatNeumann" to="HeatDirichlet" initialize="true"/> | ||
<exchange data="Temperature2" mesh="NeumannNodes" from="HeatNeumann" to="HeatDirichlet" initialize="true"/> | ||
<relative-convergence-measure data="Flux1" mesh="NeumannNodes" limit="1e-12"/> | ||
<relative-convergence-measure data="Temperature1" mesh="NeumannNodes" limit="1e-12"/> | ||
<relative-convergence-measure data="Temperature2" mesh="NeumannNodes" limit="1e-12"/> | ||
<extrapolation-order value="0"/> | ||
<post-processing:IQN-ILS> | ||
<!--PostProc always done on the second participant--> | ||
<data name="Temperature1" mesh="NeumannNodes"/> | ||
<data name="Temperature2" mesh="NeumannNodes"/> | ||
<initial-relaxation value="1.0"/> | ||
<max-used-iterations value="50"/> | ||
<timesteps-reused value="0"/> | ||
<filter type="QR2" limit="1e-3"/> | ||
</post-processing:IQN-ILS> | ||
</coupling-scheme:serial-implicit> | ||
|
||
</solver-interface> | ||
</precice-configuration> |
Oops, something went wrong.