-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
WIP: aste Replay Mode tutorial on elastic flap case #73
Open
richahert
wants to merge
57
commits into
precice:develop
Choose a base branch
from
richahert:aste
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
36e9aca
commit so i can pull the master from upstream
richahert bcce54b
Merge remote-tracking branch 'upstream/master'
richahert c7cb07d
add readme
richahert d3cd8a0
create first Readme
richahert 91e0ea0
Merge remote-tracking branch 'upstream/master' into aste
richahert e4f848d
precice config for aste fsi
richahert 05bf42b
precice config for aste fsi
richahert 72df6ca
precice config for aste fsi
richahert d41a002
new precice config
richahert 06dd4db
Merge remote-tracking branch 'upstream/master'
richahert d08175e
Merge branch 'master' into aste
richahert 7f0ceb1
Add basic files for aste tutorial
richahert 83b3199
add gitignore, rename forced to data
richahert 0e687c2
adds in gitignore
richahert 82714d7
Add instructions. Extended way not finished yet.
richahert d14b8ff
add links and missing infos
richahert 4252031
Update README.md
richahert 09f2ce5
Merge remote-tracking branch 'upstream/develop' into aste
richahert 8079715
Merge remote-tracking branch 'upstream/develop' into aste
richahert dcd542c
revert changes
richahert 4664cbe
delete strange file
richahert e322513
remove file that is not relevant
richahert 9a8c315
Update FSI/flap_perp/ASTE/README.md
richahert af988d7
Update FSI/flap_perp/ASTE/README.md formatting
richahert b8db4f6
Apply suggestions from code review
richahert 1545b58
delete unnecessary comments
richahert 25ea047
revert changes to upstream develop
richahert b7acb41
revert to upstream/develop
richahert 85b5cbb
commit suggestion
richahert 50581d1
PEP8 formatting
richahert 0769086
revert to upstream
richahert b5a1212
remove profiling
richahert 1487550
formatting
richahert 06e174d
remove export
richahert 061c212
add solvername and some formatting
richahert 724efaf
-f flag was chaged to --tag or -t
richahert 86624c0
avoid from fenics import *
BenjaminRodenberg 4cc08c1
Wording and formatting
BenjaminRodenberg b8bb3ae
Remove perp-flap.py
BenjaminRodenberg 5b5c9bc
Merge branch 'aste' of github.com:richahert/tutorials into richahert_…
BenjaminRodenberg 5866b20
Clearify modifications of precice-config.xml
BenjaminRodenberg a7a3dd5
Remove unneeded --vectordata option
BenjaminRodenberg 302ff0f
Merge branch 'develop' into aste
BenjaminRodenberg a4c83f4
Migrating FSI/flap_perp/ASTE to the new tutorials structure
BenjaminRodenberg 2f412b0
Update obvious changes. Whitespaces etc.
BenjaminRodenberg c2e2437
Some more obvious changes.
BenjaminRodenberg 95be62b
Update configs to new naming scheme.
BenjaminRodenberg a9f7e1a
Update solver.
BenjaminRodenberg 36a76fd
Clean up the diff.
BenjaminRodenberg 0a71b77
Partially update to new tutorials structure
BenjaminRodenberg 330dce5
More cleaning up of the diff.
BenjaminRodenberg fdbd5f8
Fix md file formatting.
BenjaminRodenberg 4bf84b0
Fix ShellCheck.
BenjaminRodenberg 41d5e44
Fix dead links.
BenjaminRodenberg 77c91fc
Fix format.
BenjaminRodenberg e7764ac
Remove unnecessary clean script.
BenjaminRodenberg 2eefa05
Fix link.
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 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,5 @@ | ||
preCICE-output/ | ||
Solid-fenics* | ||
*.log | ||
vtk* | ||
Solid/FSI-S |
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,96 @@ | ||
# Tutorial for replay mode | ||
|
||
## Overview | ||
|
||
This tutorial is an example how the Artificial Solver Testing Environment (aste) can be used. The idea is that you run a coupled simulation with two regular solvers and save the coupling data in every timestep. Then, this data is converted to aste-format. Finally, aste replaces one of the solvers and the simulation can be "replayed" using only one solver and aste with the previously computed results. | ||
|
||
This tutorial uses the results from the [OpenFOAM-FEniCS perpendicular flap tutorial](https://github.com/precice/tutorials/tree/master/perpendicular-flap) as a basis. aste then replaces OpenFOAM. | ||
|
||
## Requirements | ||
|
||
To run this tutorial you need to install the following components: | ||
|
||
- [preCICE](https://github.com/precice/precice/wiki/Get-preCICE) | ||
- [aste](https://github.com/precice/aste/tree/develop) | ||
- [FEniCS](https://fenicsproject.org/) | ||
- [FEniCS-Adapter](https://github.com/precice/fenics-adapter) | ||
- OpenFOAM, e.g. [OpenFOAM 7](https://openfoam.org/version/7/) | ||
- [OpenFOAM Adapter](https://github.com/precice/openfoam-adapter/wiki/Building) matching the OpenFOAM version. | ||
|
||
Make sure to add `aste/build` to the `PATH` such that the python scripts and `preciceMap` can be found from anywhere on your system. | ||
|
||
## Step-by-Step explanations | ||
|
||
### Generating vtk output during a simulation | ||
|
||
The base case for this tutorial is the OpenFOAM-FEniCS perpendicular flap tutorial. So let's start in the the root-directory of the perpendicular flap case: [`tutorials/perpendicular-flap`](https://github.com/precice/tutorials/tree/master/perpendicular-flap). | ||
|
||
To generate vtk output in preCICE, add the statement `<export:vtk directory="preCICE-output" />` to the `precice-config.xml` in `tutorials/perpendicular-flap` in the Solid participant. The result should look the following way: | ||
|
||
```xml | ||
<participant name="Solid"> | ||
<use-mesh name="Solid-Mesh" provide="yes"/> | ||
<read-data name="Force" mesh="Solid-Mesh"/> | ||
<write-data name="Displacement" mesh="Solid-Mesh"/> | ||
<export:vtk directory="preCICE-output" /> | ||
</participant> | ||
``` | ||
|
||
Then, run the simulation as explained in the [`README.md`](https://github.com/precice/tutorials/blob/develop/perpendicular-flap/README.md) of the case. | ||
|
||
The exports can be found in the `preCICE-output` directory. | ||
|
||
### Converting the output to aste format | ||
|
||
Copy the `preCICE-output` folder to the root directory of the aste tutorial `tutorials/perpendicular-flap/fluid-aste`. | ||
To convert the files to the correct format, open the `preCICE-output` folder and run | ||
|
||
`precice_to_aste.py Solid-fenics -n 500 -t Forces0 --datadim 3` | ||
|
||
### Replay of the simulation with aste | ||
|
||
#### The quick way to run | ||
|
||
1. Open two terminals and navigate to `solid-fenics` and `fluid-aste`. | ||
1. Run `.../solid-fenics$ python3 solid.py` and `.../fluid-aste$ preciceMap -v -c ../precice-config-aste.xml -p Fluid --mesh preCICE-output/Solid-fenics` in two terminals. | ||
|
||
Read on if you want to know what to change in the configuration files starting from the OpenFOAM-FEniCS tutorial. | ||
|
||
#### The way to do it yourself | ||
|
||
The aste-FEniCS tutorial provides its own `precice-config.xml` and `precice-adapter-config-fsi-s.json` for getting started quickly. They are called `precice-config-aste.xml` and `precice-adapter-config-fsi-s-aste.json`. | ||
|
||
However, these can also be generated by modifiying the files from the original `perpendicular-flap` case. The main purpose of this tutorial is to explain how the replay mode with aste can be used for arbirtrary simulation setups. | ||
|
||
1. Copy the files `perpendicular-flap/precice-config.xml` and `perpendicular-flap/solid-fenics/precice-adapter-config-fsi-s.json` from the original `perpendicular-flap` tutorial into the respective directories. | ||
2. Remove the line `"write_data_name": "Displacement"` from `precice-adapter-config-fsi-s.json`, because we will not write any data to aste. | ||
3. Change the `read_data_name` from `Force` to `Data` since aste works with the general data name `Data`. | ||
4. In ```precice-config.xml``` we require some more changes: | ||
1. Rename `Force` to `Data` throughout the whole file. | ||
2. Delete all lines where `Displacement` occurs, since we are only coupling in one direction (from aste to FEniCS). | ||
5. Then we process the Fluid meshes to fake the Fluid participant using aste: | ||
1. Rename `Fluid-Mesh` to `MeshA` throughout the whole file. | ||
2. Delete the `mesh` `"Fluid-Mesh-Nodes"` and all lines where `"Fluid-Mesh-Nodes"` occurs. | ||
3. Rename the participant `Fluid` to `A` | ||
6. Change the coupling scheme to an explicit scheme: | ||
1. Change `serial-implicit` to `serial-explicit`. | ||
2. Explicit schemes don't iterate such that they don't need convergence measures, extrapolation or acceleration. Delete everything in the coulping scheme except for | ||
|
||
```xml | ||
<participants first="A" second="Solid" /> | ||
<max-time value="5.0" /> | ||
<time-window-size value="1.e-2" /> | ||
<exchange data="Data" mesh="Solid-Mesh" from="A" to="Solid" /> | ||
``` | ||
|
||
#### Run | ||
|
||
After applying these preparations, we are now able to run the tutorial in two terminals as described above. | ||
|
||
### Play Around | ||
|
||
If you want to explore more possibilities of the Replay-Mode here are some ideas: | ||
|
||
- Export the output at the Fluid participant. Instead of `preCICE-output/Solid-fenics.*` the files containing the forces will be `preCICE-output/Fluid-Mesh-Faces-Fluid.*` | ||
- Export the forces in the [Calculix-Openfoam-tutorial](https://github.com/precice/tutorials/tree/master/perpendicular-flap) with the same geometry and feed them to FEniCS with aste. | ||
- If you are familiar with the OpenFOAM-Adapter you can also replace FEniCS with aste such that aste writes previously exported displacements to OpenFOAM. |
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,50 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
|
||
<precice-configuration> | ||
|
||
<log enabled="true"> | ||
<sink type="stream" output="stdout" filter="%Severity% > debug" enabled="true" /> | ||
<sink type="file" output="filtered.log" filter= "(%Severity% > debug) or (%Severity% >= trace and %Module% contains SolverInterfaceImpl)" enabled="true" /> | ||
<sink type="file" output="debug.log" filter="" enabled="true"/> | ||
</log> | ||
|
||
<solver-interface dimensions="2"> | ||
|
||
<!-- Data fields that are exchanged between the solvers --> | ||
<data:vector name="Force" /> | ||
|
||
<!-- A common mesh that uses these data fields --> | ||
<mesh name="Fluid-Mesh" flip-normals="no"> | ||
<use-data name="Force" /> | ||
</mesh> | ||
|
||
<mesh name="Solid-Mesh" flip-normals="no"> | ||
<use-data name="Force" /> | ||
</mesh> | ||
|
||
<participant name="Fluid"> | ||
<use-mesh name="Fluid-Mesh" provide="yes" /> | ||
<use-mesh name="Solid-Mesh" provide="no" from="Solid" /> | ||
<write-data name="Force" mesh="Fluid-Mesh"/> | ||
<mapping:nearest-neighbor constraint="conservative" direction="write" from="Fluid-Mesh" to="Solid-Mesh" /> | ||
<export:vtk every-n-time-windows="1" directory="vtkFluid/" normals="0"/> | ||
</participant> | ||
|
||
<participant name="Solid"> | ||
<use-mesh name="Solid-Mesh" provide="yes" /> | ||
<read-data name="Force" mesh="Solid-Mesh" /> | ||
<export:vtk every-n-time-windows="1" directory="vtkSolid/" normals="0"/> | ||
</participant> | ||
|
||
<m2n:sockets from="Fluid" to="Solid" exchange-directory=".." /> | ||
|
||
<coupling-scheme:serial-explicit> | ||
<participants first="Fluid" second="Solid" /> | ||
<max-time value="5.0" /> | ||
<time-window-size value="1.e-2" /> | ||
<exchange data="Force" mesh="Solid-Mesh" from="Fluid" to="Solid" /> | ||
</coupling-scheme:serial-explicit> | ||
|
||
</solver-interface> | ||
|
||
</precice-configuration> |
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
8 changes: 8 additions & 0 deletions
8
perpendicular-flap/solid-fenics/precice-adapter-config-fsi-s-aste.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,8 @@ | ||
{ | ||
"participant_name": "Solid", | ||
"config_file_name": "../precice-config-aste.xml", | ||
"interface": { | ||
"coupling_mesh_name": "Solid-Mesh", | ||
"read_data_name": "Force" | ||
} | ||
} |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm currently getting stuck here. Where is the script
precice_to_aste.py
? I cannot find it in https://github.com/precice/aste/tree/develop. @fsimonis any idea?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BenjaminRodenberg https://github.com/precice/aste/pull/9/files