tutorials
tutorials copied to clipboard
Adds breaking dam 2D test case
This PR adds a breaking dam 2D test case for multiphase flow of water/air mixture, where a body of water strikes a solid, deformable wall.
Thanks for adding this! Could you please add a README describing the case? Please also check the conventions here: https://precice.org/community-contribute-to-precice.html#contributing-tutorials
All changes added.
This pull request has been mentioned on preCICE Forum on Discourse. There might be relevant details there:
https://precice.discourse.group/t/can-i-use-precice-to-simulate-a-droplet-impacting-on-an-elastic-substrate/1372/2
This pull request has been mentioned on preCICE Forum on Discourse. There might be relevant details there:
https://precice.discourse.group/t/question-about-using-overset-mesh-in-fsi-two-way-coupling/1446/4
This pull request has been mentioned on preCICE Forum on Discourse. There might be relevant details there:
https://precice.discourse.group/t/mppicfoam-precice/1783/2
Ready for re-review @MakisH
- Updated to preCICE v3
- Removed the 3D case. Will open a separate draft PR (beyond this distribution)
- Changed the setup to have "z" in span-wise direction. This way, we can use 2D as preCICE mesh dimensions. To this end, I copied the perpendicular flap meshes for both solvers.
- I then had to increase the stiffness of the flap to make the case work.
Please:
- [ ] Double-check, fix, or clean the OpenFOAM input files. Not much that I changed here.
- [ ] Sanity-check on conventions
Does the case complete for you? For me, with OpenFOAM v2312 and CalculiX 2.20 (adapter release branch v2.20.1, ffeda14), it crashes at 0.765:
# OpenFOAM
---[preciceAdapter] [DEBUG] Advancing preCICE...
---[precice] Mapping "Force" for t=0.76 from "Fluid-Mesh-Faces" to "Solid-Mesh"
---[precice] Time window completed
---[precice] Mapping "Displacement" for t=0.76 from "Solid-Mesh" to "Fluid-Mesh-Nodes"
---[precice] iteration: 1 of 30 (min 1), time-window: 153 of 200, time: 0.76 of 5, time-window-size: 0.005, max-time-step-size: 0.005, ongoing: yes, time-window-complete: yes, write-iteration-checkpoint
---[preciceAdapter] [DEBUG] Writing a checkpoint...
---[preciceAdapter] [DEBUG] Stored time value t = 0.760000
---[preciceAdapter] [DEBUG] Storing mesh points...
---[preciceAdapter] [DEBUG] Stored mesh points.
---[preciceAdapter] [DEBUG] Writing a mesh checkpoint...
---[preciceAdapter] [DEBUG] Mesh checkpoint for time t = 0.760000 was stored.
---[preciceAdapter] [DEBUG] Writing a mesh volumes checkpoint...
---[preciceAdapter] [DEBUG] Mesh volumes checkpoint for time t = 0.760000 was stored.
---[preciceAdapter] [DEBUG] Checkpoint for time t = 0.760000 was stored.
---[preciceAdapter] The coupling timestep completed. Writing the updated results.
---[preciceAdapter] [DEBUG] Adjusting the solver's timestep...
---[preciceAdapter] [DEBUG] The solver's timestep is the same as the coupling timestep.
---[preciceAdapter] [DEBUG] Reading coupling data associated to the calculated time-step size...
---[preciceAdapter] [DEBUG] Reading coupling data...
Courant Number mean: 0.418021 max: 8.7707
Interface Courant Number mean: 0.0284273 max: 0.887563
Time = 0.765
PIMPLE: iteration 1
smoothSolver: Solving for cellDisplacementx, Initial residual = 2.18629e-06, Final residual = 1.47321e-17, No Iterations 3
smoothSolver: Solving for cellDisplacementy, Initial residual = 4.76784e-06, Final residual = 1.54271e-17, No Iterations 3
GAMGPCG: Solving for pcorr, Initial residual = 1, Final residual = 5.17327e-06, No Iterations 10
GAMGPCG: Solving for pcorr, Initial residual = 0.000977888, Final residual = 5.99934e-06, No Iterations 3
time step continuity errors : sum local = 3.08081e-06, global = -1.5166e-06, cumulative = 0.000259256
smoothSolver: Solving for alpha.water, Initial residual = 0.00564579, Final residual = 2.52774e-09, No Iterations 5
Phase-1 volume fraction = 0.249881 Min(alpha.water) = 0 Max(alpha.water) = 1.00042
MULES: Correcting alpha.water
Phase-1 volume fraction = 0.249881 Min(alpha.water) = -9.55032e-12 Max(alpha.water) = 1.04509
GAMG: Solving for p_rgh, Initial residual = 0.101253, Final residual = 0.00065681, No Iterations 2
GAMG: Solving for p_rgh, Initial residual = 0.0145071, Final residual = 0.000127839, No Iterations 6
time step continuity errors : sum local = 3.29035e-05, global = -8.71867e-06, cumulative = 0.000250537
GAMG: Solving for p_rgh, Initial residual = 0.0193277, Final residual = 0.000158367, No Iterations 3
GAMG: Solving for p_rgh, Initial residual = 0.00224158, Final residual = 1.20774e-05, No Iterations 5
time step continuity errors : sum local = 2.38379e-06, global = 8.09648e-07, cumulative = 0.000251347
GAMG: Solving for p_rgh, Initial residual = 0.00856695, Final residual = 5.22234e-05, No Iterations 3
GAMGPCG: Solving for p_rgh, Initial residual = 0.00079543, Final residual = 9.38001e-08, No Iterations 4
time step continuity errors : sum local = 1.7713e-08, global = -9.45258e-11, cumulative = 0.000251347
PIMPLE: iteration 2
smoothSolver: Solving for alpha.water, Initial residual = 0.00553318, Final residual = 4.51816e-09, No Iterations 4
Phase-1 volume fraction = 0.249881 Min(alpha.water) = 0 Max(alpha.water) = 1.00042
MULES: Correcting alpha.water
Phase-1 volume fraction = 0.24988 Min(alpha.water) = -9.82034e-12 Max(alpha.water) = 1.04396
GAMG: Solving for p_rgh, Initial residual = 0.0296482, Final residual = 0.000144842, No Iterations 3
GAMG: Solving for p_rgh, Initial residual = 0.00264593, Final residual = 2.31854e-05, No Iterations 3
time step continuity errors : sum local = 4.44448e-06, global = -1.86486e-06, cumulative = 0.000249482
GAMG: Solving for p_rgh, Initial residual = 0.0069784, Final residual = 4.82555e-05, No Iterations 3
GAMG: Solving for p_rgh, Initial residual = 0.00057744, Final residual = 3.37574e-06, No Iterations 5
time step continuity errors : sum local = 6.45389e-07, global = -3.36739e-08, cumulative = 0.000249448
GAMG: Solving for p_rgh, Initial residual = 0.00257638, Final residual = 9.29578e-06, No Iterations 3
GAMGPCG: Solving for p_rgh, Initial residual = 0.000215777, Final residual = 9.17326e-09, No Iterations 4
time step continuity errors : sum local = 1.7544e-09, global = -1.77701e-11, cumulative = 0.000249448
ExecutionTime = 104.18 s ClockTime = 156 s
---[preciceAdapter] [DEBUG] Writing coupling data...
---[preciceAdapter] [DEBUG] Advancing preCICE...
---[precice] Mapping "Force" for t=0.765 from "Fluid-Mesh-Faces" to "Solid-Mesh"
---[precice] ERROR: Receiving data from another participant (using sockets) failed with a system error: read: End of file. This often means that the other participant exited with an error (look there).
$ checkMesh
Time = 0.765
Checking geometry...
Overall domain bounding box (-3 0 0) (3 4 1)
Mesh has 2 geometric (non-empty/wedge) directions (1 1 0)
Mesh has 2 solution (non-empty) directions (1 1 0)
All edges aligned with or perpendicular to non-empty directions.
Boundary openness (-7.95327e-19 -5.40822e-17 5.71144e-16) OK.
Max cell openness = 2.2121e-16 OK.
Max aspect ratio = 3.72565 OK.
Minimum face area = 0.00187432. Maximum face area = 0.1513. Face area magnitudes OK.
Min volume = 0.00187432. Max volume = 0.019553. Total volume = 23.9004. Cell volumes OK.
Mesh non-orthogonality Max: 38.1361 average: 9.23919
Non-orthogonality check OK.
Face pyramids OK.
Max skewness = 1.72902 OK.
Coupled point location match (average 0) OK.
# CalculiX
average force= 174357.542877
time avg. forc= 2393.899088
largest residual force= 74606197.101613 in node 418 and dof 1
largest increment of disp= 3.726313e-01
largest correction to disp= 5.508240e-02 in node 1051 and dof 1
*ERROR: solution seems to diverge; please try
automatic incrementation; program stops
best solution and residuals are in the frd file
@uekerman I went ahead and fixed most of the trivial issues. Still open:
- [x] The simulation diverges for me. With your setup and the updated gravity, it diverges at 0.79. I tried making the flap stiffer, the fluid time step size smaller, but I could not achieve anything better, and it looks like we need a better solution.
- [x] This case currently is set up using two meshes, relying only on pointDisplacement in the OpenFOAM style (old-style tutorials). I will try merging to a single mesh, maybe this already helps.
- [x] We are using a fixed time step size for the flow simulation, which is generally a no-go for two-phase simulations. I don't know if subcycling works correctly, but it does not help (breaks earlier, the moment the water touches the pillar).
I switched the case to use one mesh, and this already helped a lot. The simulation now crashes later, at 0.945:
Maybe it is something with the outlet condition now.
By setting the upperWall
to zeroGradient
, the simulation completes (due to the max-time-windows
) at 1.0.
With the current setup, the simulation final crashes at 1.435:
I assume we are losing mass somewhere, so maybe we need to check the boundary conditions again. Maybe the zeroGradient
for the alpha.water
was not such a smart choice in the end.
For context, if I use the same solid-calculix
as with the perpendicular-flap, then the simulation crashes now at 0.79 with an abnormally deformed flap (shape change).
My last state https://github.com/precice/tutorials/pull/279/commits/9b97b9227520f49d2dcdba5c75fd061e75d26a69 does indeed crash, but only at t=1.485. CalculiX adapter: https://github.com/precice/calculix-adapter/commit/ffeda1403bc517ea6efc27dfb2724e4de5bcff40 (same as you) OpenFOAM: OpenFOAM-2212 OpenFOAM adapter: https://github.com/precice/openfoam-adapter/commit/b6e860ae79a35
For context, if I use the same solid-calculix as with the perpendicular-flap, then the simulation crashes now at 0.79 with an abnormally deformed flap (shape change).
That setup is indeed not stiff enough (i.e. the forces here are too high). (The fluid here is different from the one there)
Latest state here https://github.com/precice/tutorials/pull/279/commits/27d3fd7778206fe7976d1cabf197a166bc6e3ada crashes at t=1.24.
With the old alpha.water
(reverting https://github.com/precice/tutorials/pull/279/commits/a9cdff155f4001f6c30bf10bfb7962b72b1aa8d1), it crashes at t=0.91.
With a reduced water column height (1/2 height instead of 3/4 height) and a reduced timestep size (2e-3), I can run until t=5. Probably still sensitive, but good enough in my opinion.