-
-
Notifications
You must be signed in to change notification settings - Fork 126
WIP: aste Replay Mode tutorial on elastic flap case #73
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
Closed
Closed
Changes from 19 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
2 changes: 1 addition & 1 deletion
2
CHT/heat_exchanger/buoyantSimpleFoam-CalculiX/precice-config.xml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?xml version="1.0" encoding='UTF-8'?> | ||
<?xml version="1.0"?> | ||
|
||
<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
13 changes: 13 additions & 0 deletions
13
FSI/cylinderFlap/OpenFOAM-FEniCS-bigdt/OpenFOAM-FEniCS/.gitignore
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,13 @@ | ||
Fluid | ||
!Fluid/0 | ||
!Fluid/0.orig | ||
!Fluid/constant | ||
!Fluid/system | ||
!Fluid/Fluid.foam | ||
!Fluid/precice-adapter-config.yml | ||
Solid | ||
!Solid/cyl-flap.py | ||
!Solid/precice-adapter-config-fsi-s.json | ||
*.log | ||
precice-fenics-events.json | ||
precice-Fluid-events.json | ||
BenjaminRodenberg marked this conversation as resolved.
Show resolved
Hide resolved
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -249,4 +249,3 @@ def avg(x_old, x_new, alpha): | |
plt.ylabel("Tip displacement") | ||
plt.show() | ||
|
||
|
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,5 @@ | ||
preCICE-output/ | ||
Solid-fenics* | ||
*.log | ||
vtk* | ||
Solid/FSI-S |
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,64 @@ | ||
#!/bin/sh | ||
cd ${0%/*} || exit 1 # Run from this directory | ||
|
||
echo "Cleaning..." | ||
|
||
# Source tutorial clean functions | ||
. $WM_PROJECT_DIR/bin/tools/CleanFunctions | ||
|
||
# Participant 1: Fluid | ||
Participant1="Fluid" | ||
cd ${Participant1} | ||
# Clean the case | ||
cleanCase | ||
rm -rfv 0 | ||
# Create an empty .foam file for ParaView | ||
# Note: ".foam" triggers the native OpenFOAM reader of ParaView. | ||
# Change to ".OpenFOAM" to use the OpenFOAM reader provided with OpenFOAM. | ||
touch ${Participant1}.foam | ||
cd .. | ||
# Remove the log files | ||
rm -fv ${Participant1}_blockMesh.log | ||
rm -fv ${Participant1}_checkMesh.log | ||
rm -fv ${Participant1}_potentialFoam.log | ||
rm -fv ${Participant1}_decomposePar.log | ||
rm -fv ${Participant1}.log | ||
rm -fv ${Participant1}_reconstructPar.log | ||
|
||
# Participant 2: Solid | ||
Participant2="Solid" | ||
cd ${Participant2} | ||
cd FSI-S | ||
# Clean the case | ||
rm -fv *.vtu | ||
rm -fv *.pvd | ||
rm -fv *.log | ||
cd .. | ||
cd .. | ||
# Remove the log files | ||
rm -fv spooles.out | ||
rm -fv ${Participant2}.log | ||
|
||
# Remove the precice-events-files | ||
rm -fv precice-fenics-events.json | ||
rm -fv precice-Fluid-events.json | ||
|
||
# Remove the preCICE-related log files | ||
echo "Deleting the preCICE log files..." | ||
rm -fv \ | ||
precice-*.log \ | ||
precice-postProcessingInfo.log | ||
|
||
# Output files for preCICE versions before 1.2: | ||
rm -fv \ | ||
iterations-${Participant1}.txt iterations-${Participant2}.txt \ | ||
convergence-${Participant1}.txt convergence-${Participant2}.txt \ | ||
Events-${Participant1}.log Events-${Participant2}.log \ | ||
EventTimings-${Participant1}.log EventTimings-${Participant2}.log | ||
|
||
# Remove the preCICE address files | ||
rm -rfv precice-run | ||
rm -fv .*.address | ||
|
||
echo "Cleaning complete!" | ||
#------------------------------------------------------------------------------ |
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,95 @@ | ||
## 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 substitutes one of the solvers and the simulation can be "replayed" using only one solver and aste with the prior results. | ||
richahert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
The base simulation for this tutorial is the OpenFOAM-FEniCS perpendicular flap tutorial. aste then substitutes OpenFOAM. | ||
richahert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## 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. | ||
richahert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## 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 that simulation. | ||
richahert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
To generate a vtk output in preCICE, add the following line to ```precice-config.xml``` after [line 41](https://github.com/precice/tutorials/blob/develop/FSI/flap_perp/OpenFOAM-FEniCS/precice-config.xml#L41) in the Solid participant: | ||
richahert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
```<export:vtk directory="preCICE-output" />``` | ||
richahert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Then, the simulation can be run in two terminals with ```bash ./runFluid``` and ```python3 Solid/perp_flap.py```. | ||
richahert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
The exports are in the ```preCICE-output``` directory. | ||
|
||
### Converting the output to aste format. | ||
|
||
Copy the ```preCICE-output``` folder to the root directory of the aste tutorial. | ||
richahert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
To convert the files to the correct format, open the ```preCICE-output``` folder and run | ||
|
||
```precice_to_aste.py -n 500 -f Forces0 --datadim 3``` | ||
|
||
### Replay of the simulation with aste | ||
|
||
#### The quick way to run | ||
Copy perp_flap.py from OpenFOAM-FEniCS/Solid to aste/Solid | ||
richahert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
run in two terminals ```python3 Solid/perp-flap.py``` and ```preciceMap -v -c precice-config.xml -p A --mesh preCICE-output/Solid-fenics --vectordata``` | ||
richahert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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 simulation has its own ```precice-config.xml``` and ```precice-adapter-config-fsi-s.json```. | ||
richahert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
However, these can be generated by modifiying the files from the OpenFOAM-FEniCS case. | ||
|
||
First, copy the files from the OpenFOAM-FEniCS tutorial into the respective directory of the aste-tutorial. | ||
|
||
For ```precice-adapter-config-fsi-s.json``` we remove the line ```"write_data_name": "Displacements0",``` because we don't write data to aste. | ||
richahert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Plus, we change to the ```read_data_name``` from ```Forces0``` to ```Data``` since aste works with the general data name ```Data```. | ||
richahert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
In ```precice-config.xml``` we need more changes: | ||
|
||
- Again, we rename ```Forces0``` to ```Data``` throughout the whole file. | ||
- We delete all lines where ```Displacements0``` occurs, since we are only coupling in the other direction. | ||
richahert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
Then, you substitute the Fluid meshes and the Fluid participant with aste: | ||
|
||
- Rename ```Fluid-Mesh-Faces``` to ```MeshA``` throughout the whole file. | ||
- Delete the ```mesh``` ```"Fluid-Mesh-Nodes"``` and all lines where ```"Fluid-Mesh-Nodes"``` occurs. | ||
- Rename the participant ```Fluid``` to ```A``` | ||
richahert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Last, you need to change the coupling scheme to an explicit scheme: | ||
|
||
- Change ```serial-implicit``` to ```serial-explicit```. | ||
richahert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- Explicit schemes don't iterate such that they don't need convergence measures, extrapolation or acceleration. Delete everything in the coulping scheme except for | ||
``` | ||
<participants first="A" second="fenics" /> | ||
<max-time value="5.0" /> | ||
<time-window-size value="1.e-2" /> | ||
<exchange data="Data" mesh="Solid" from="A" to="fenics" /> | ||
``` | ||
|
||
### Run | ||
|
||
Finally, run the tutorial in two shells with ```python3 Solid/perp-flap.py``` and ```preciceMap -v -c precice-config.xml -p A --mesh preCICE-output/Solid-fenics --vectordata```. | ||
richahert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### 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.*``` | ||
richahert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- Export the forces in the [Calculix-Openfoam-tutorial](https://github.com/precice/tutorials/tree/master/FSI/flap_perp/OpenFOAM-CalculiX) with the same geometry and feed them to FEniCS with aste. | ||
|
||
- If you are familiar with the OpenFOAM-Adapter you can also substitute FEniCS with aste such that aste writes previously exported displacements to OpenFOAM. | ||
|
||
|
||
|
||
|
||
BenjaminRodenberg marked this conversation as resolved.
Show resolved
Hide resolved
|
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.