precice / tutorials

Various tutorial cases for the coupling library preCICE with real solvers. These files are meant to be rendered on precice.org, so don't look at the README files here.
https://www.precice.org/
GNU Lesser General Public License v3.0
106 stars 110 forks source link

Restructure 2D/3D tutorials #82

Closed uekerman closed 3 years ago

uekerman commented 4 years ago

We currently have the following structure in subfolder FSI:

│   ├── 3D_Tube │   │   └── OpenFOAM-CalculiX │   ├── cylinderFlap │   │   ├── OpenFOAM-CalculiX │   │   ├── OpenFOAM-deal.II │   │   └── OpenFOAM-FEniCS │   ├── cylinderFlap_2D │   │   └── OpenFOAM-deal.II │   ├── flap_perp │   │   ├── OpenFOAM-CalculiX │   │   ├── OpenFOAM-deal.II │   │   ├── OpenFOAM-FEniCS │   │   └── SU2-CalculiX │   └── flap_perp_2D │   └── OpenFOAM-deal.II

Wouldn't this be better?

│ ├── 3D_Tube │ │ └── OpenFOAM-CalculiX │ ├── cylinderFlap │ │ ├── OpenFOAM-CalculiX │ │ ├── OpenFOAM-deal.II_2D │ │ ├── OpenFOAM-deal.II_3D │ │ └── OpenFOAM-FEniCS │ ├── flap_perp │ │ ├── OpenFOAM-CalculiX │ │ ├── OpenFOAM-deal.II_2D │ │ ├── OpenFOAM-deal.II_3D │ │ ├── OpenFOAM-FEniCS │ │ └── SU2-CalculiX

MakisH commented 4 years ago

The original motivation was that the setups are technically different and we currently have the system physics/setup/solvers. Keep in mind that e.g. flap_perp/OpenFOAM-FEniCS explicitly copies the fluid case from flap_perp/OpenFOAM-CalculiX and this system could in principle work for all the cases in the same setup/ level.

I think that mixing the 2D with the 3D case would cause more confusion than it would solve problems. In any case, the difference would be small for the user, but we would need to adapt again our system tests and documentation.

What motivation do you see for changing to this system?

I would prefer to close this and only see it in context of #28.

uekerman commented 4 years ago

To which extend is the OpenFOAM case different when coupling to dealii_2D or dealii_3D? I thought it's identical, so still the same setup.

Motivation would be simplify the structure, so one step towards #28 :smile: But maybe I don't see certain difficulties.

uekerman commented 4 years ago

For the user the naming scheme cylinderFlap and cylinderFlap_2D might be confusing as they are both "2D" setups.

MakisH commented 4 years ago

flap_perp and flap_perp_2d, as well as cylinderFlap and cylinderFlap_2d are almost identical, apart from the dimension of the interface in precice-config.xml and a few other minor details that should be the same.

Still, I don't see why the suggested system is simpler. I would rather merge the 2d and 3d cases, if we aim for simplicity.

uekerman commented 4 years ago

Still, I don't see why the suggested system is simpler. I would rather merge the 2d and 3d cases, if we aim for simplicity.

Maybe the best solution is to only keep the dealii_2D case and move it to flap_perp and instead add an OpenFOAM-dealii in 3D_Tube.

I see the systemtests / documentation issue. I did not intend this to be done immediately, but more as a discussion towards #28.

davidscn commented 4 years ago

What motivation do you see for changing to this system?

The motivation is also: If people coming from the deal.II side look in the tutorials repo, the 'more default' i.e. deal.II3D-OpenFOAM case is in the respective case folder. I would like to somehow emphasize, that the default tutorial is 2D, which is here currently separated.

The setup is nearly the same for both: Just the config changes (dimension and z-dead) and I reduced the problem size on the solid side.

MakisH commented 4 years ago

So, here are the differences between the 2D and the 3D variant of each case.

flap_perp

Click to reveal ```diff diff -r flap_perp/OpenFOAM-deal.II/Allclean flap_perp_2D/OpenFOAM-deal.II/Allclean 13a14 > rm -rfv 0 32c33 < cd .. --- > cd .. 36d36 < 52d51 < # Remove the preCICE address files 54c53 < rm -fv .*.address --- > rm -fv .${Participant1}-${Participant2}.address diff -r flap_perp/OpenFOAM-deal.II/Allrun flap_perp_2D/OpenFOAM-deal.II/Allrun 67a68 > Only in flap_perp/OpenFOAM-deal.II/Fluid: 0 diff -r flap_perp/OpenFOAM-deal.II/Fluid/system/blockMeshDict flap_perp_2D/OpenFOAM-deal.II/Fluid/system/blockMeshDict 21d20 < //w1 0.3; 38,49c37,48 < ($x0 $z0 0.3 ) // 12 < ($x1 $z0 0.3) // 13 < ($x2 $z0 0.3) // 14 < ($x3 $z0 0.3) // 15 < ($x0 $z1 0.3) // 16 < ($x1 $z1 0.3) // 17 < ($x2 $z1 0.3) // 18 < ($x3 $z1 0.3) // 19 < ($x0 $z2 0.3) // 20 < ($x1 $z2 0.3) // 21 < ($x2 $z2 0.3) // 22 < ($x3 $z2 0.3) // 23 --- > ($x0 $z0 1) // 12 > ($x1 $z0 1) // 13 > ($x2 $z0 1) // 14 > ($x3 $z0 1) // 15 > ($x0 $z1 1) // 16 > ($x1 $z1 1) // 17 > ($x2 $z1 1) // 18 > ($x3 $z1 1) // 19 > ($x0 $z2 1) // 20 > ($x1 $z2 1) // 21 > ($x2 $z2 1) // 22 > ($x3 $z2 1) // 23 Only in flap_perp_2D/OpenFOAM-deal.II/: .gitignore Only in flap_perp_2D/OpenFOAM-deal.II/: linear_elasticity diff -r flap_perp/OpenFOAM-deal.II/precice-config.xml flap_perp_2D/OpenFOAM-deal.II/precice-config.xml 9c9 < --- > 33,34c33 < < --- > 44,45c43 < < --- > diff -r flap_perp/OpenFOAM-deal.II/runFluid flap_perp_2D/OpenFOAM-deal.II/runFluid 2c2 < cd ${0%/*} || exit 1 # Run from this directory --- > cd ${0%/*} || exit 1 # Run from this directory 7,8c7 < # Run this script in one terminal and the execute the coupled_elasto_dynamics binary < # in another terminal. --- > # Run this script in one terminal and the execute the runSolid in another terminal. Only in flap_perp/OpenFOAM-deal.II/Solid/dealii_output: initial_grid.vtk Only in flap_perp_2D/OpenFOAM-deal.II/Solid/dealii_output: .keepme diff -r flap_perp/OpenFOAM-deal.II/Solid/linear_elasticity.prm flap_perp_2D/OpenFOAM-deal.II/Solid/linear_elasticity.prm 22c22 < set Polynomial degree = 2 --- > set Polynomial degree = 4 diff -r flap_perp/OpenFOAM-deal.II/Solid/nonlinear_elasticity.prm flap_perp_2D/OpenFOAM-deal.II/Solid/nonlinear_elasticity.prm 24c24 < set Polynomial degree = 2 --- > set Polynomial degree = 4 ```

cylinderFlap

Click to reveal ```diff diff -r cylinderFlap/OpenFOAM-deal.II/Allclean cylinderFlap_2D/OpenFOAM-deal.II/Allclean 36a37,39 > # Remove the log files > rm -fv ${Participant2}.log > 50d52 < # Remove the preCICE address files 52c54 < rm -fv .*.address --- > rm -fv .${Participant1}-${Participant2}.address diff -r cylinderFlap/OpenFOAM-deal.II/Fluid/system/blockMeshDict cylinderFlap_2D/OpenFOAM-deal.II/Fluid/system/blockMeshDict 13,14c13,14 < f -0.005; // z-front < b 0.005; // z-back --- > f -0.5; // z-front > b 0.5; // z-back diff -r cylinderFlap/OpenFOAM-deal.II/Fluid/system/controlDict cylinderFlap_2D/OpenFOAM-deal.II/Fluid/system/controlDict 14c14 < // application pimpleDyMFoam; // OpenFOAM v1712, OpenFOAM 5.x, or older --- > // application pimpleDyMFoam; // OpenFOAM v1712, OpenFOAM 5.x, or older 24c24 < deltaT 0.002; --- > deltaT 0.002 28c28 < writeInterval 100; --- > writeInterval 100.; Only in cylinderFlap_2D/OpenFOAM-deal.II/: .gitignore diff -r cylinderFlap/OpenFOAM-deal.II/precice-config.xml cylinderFlap_2D/OpenFOAM-deal.II/precice-config.xml 9c9 < --- > 43c43 < --- > diff -r cylinderFlap/OpenFOAM-deal.II/README.md cylinderFlap_2D/OpenFOAM-deal.II/README.md 1c1 < # Tutorial for an FSI simulation of a cylinder-flap scenario --- > # Tutorial for an FSI simulation of a cylinder-flap scenario 13c13 < ./Solid/coupled_elasto_dynamics ./Solid/parameters.prm --- > ./runSolid -nonlinear Only in cylinderFlap_2D/OpenFOAM-deal.II/: runSolid diff -r cylinderFlap/OpenFOAM-deal.II/Solid/linear_elasticity.prm cylinderFlap_2D/OpenFOAM-deal.II/Solid/linear_elasticity.prm 22c22 < set Polynomial degree = 2 --- > set Polynomial degree = 4 diff -r cylinderFlap/OpenFOAM-deal.II/Solid/nonlinear_elasticity.prm cylinderFlap_2D/OpenFOAM-deal.II/Solid/nonlinear_elasticity.prm 24c24 < set Polynomial degree = 2 --- > set Polynomial degree = 4 ```

I see that we need to do the following:

davidscn commented 4 years ago

Use the same Polynomial degree in both (which?)

I just reduced it for 3D to make the simulation faster. More accuracy is obviously obtained with a higher degree.

Use the same thickness for the OpenFOAM domains (0.3 should work for both, while 1 should cause issues in the 2D)

Why should 1 cause issues? Since we are working now with stress, it shouldn't matter any more.

After both cases are consistent and are working, move the important changes as comments in the precice-config.xml, assuming the 2D as default Delete the flap_perp_2D and cylinder_flap_2D directories Explain this in the README.md Update the documentation Update the system tests for flap_perp_2D --> flap_perp

So, the fastest way to get, what you propose is to delete the 3D case, move the 2D in the 'main' case folder (?) and add comments, how to deal with a quasi 3D case, right?

MakisH commented 4 years ago

Use the same Polynomial degree in both (which?)

I just reduced it for 3D to make the simulation faster. More accuracy is obviously obtained with a higher degree.

Then we can set it to 4 and leave this also as a comment.

Use the same thickness for the OpenFOAM domains (0.3 should work for both, while 1 should cause issues in the 2D)

Why should 1 cause issues? Since we are working now with stress, it shouldn't matter any more.

Right, I missed the Stress-Force change. Maybe this is something we should also clearly document as a difference from the other tutorials.

After both cases are consistent and are working, move the important changes as comments in the precice-config.xml, assuming the 2D as default Delete the flap_perp_2D and cylinder_flap_2D directories Explain this in the README.md Update the documentation Update the system tests for flap_perp_2D --> flap_perp

So, the fastest way to get, what you propose is to delete the 3D case, move the 2D in the 'main' case folder (?) and add comments, how to deal with a quasi 3D case, right?

Exactly!

MakisH commented 4 years ago

Related issue about missing README: https://github.com/precice/tutorials/issues/48

MakisH commented 4 years ago

Related to #28.

davidscn commented 3 years ago

@uekerman I think we can close this issue since #146 it, correct?

uekerman commented 3 years ago

Let's close it once we merge to develop.