From 4e308c20aee0c744f9963d0b21d06e9ce8845748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6hn?= Date: Fri, 4 Jul 2025 16:49:41 +0200 Subject: [PATCH 01/23] added tutorial for foam-extend --- quickstart/fluid-foam-extend/0/U | 51 ++++++++++++ quickstart/fluid-foam-extend/0/p | 49 +++++++++++ .../fluid-foam-extend/0/pointDisplacement | 50 +++++++++++ quickstart/fluid-foam-extend/clean.sh | 6 ++ .../constant/dynamicMeshDict | 21 +++++ .../constant/transportProperties | 12 +++ .../constant/turbulenceProperties | 9 ++ quickstart/fluid-foam-extend/run.sh | 13 +++ .../fluid-foam-extend/system/blockMeshDict | 1 + .../fluid-foam-extend/system/controlDict | 82 ++++++++++++++++++ .../fluid-foam-extend/system/decomposeParDict | 24 ++++++ quickstart/fluid-foam-extend/system/fvSchemes | 40 +++++++++ .../fluid-foam-extend/system/fvSolution | 83 +++++++++++++++++++ .../fluid-foam-extend/system/preciceDict | 39 +++++++++ 14 files changed, 480 insertions(+) create mode 100644 quickstart/fluid-foam-extend/0/U create mode 100644 quickstart/fluid-foam-extend/0/p create mode 100644 quickstart/fluid-foam-extend/0/pointDisplacement create mode 100755 quickstart/fluid-foam-extend/clean.sh create mode 100644 quickstart/fluid-foam-extend/constant/dynamicMeshDict create mode 100644 quickstart/fluid-foam-extend/constant/transportProperties create mode 100644 quickstart/fluid-foam-extend/constant/turbulenceProperties create mode 100755 quickstart/fluid-foam-extend/run.sh create mode 120000 quickstart/fluid-foam-extend/system/blockMeshDict create mode 100644 quickstart/fluid-foam-extend/system/controlDict create mode 100644 quickstart/fluid-foam-extend/system/decomposeParDict create mode 100644 quickstart/fluid-foam-extend/system/fvSchemes create mode 100644 quickstart/fluid-foam-extend/system/fvSolution create mode 100644 quickstart/fluid-foam-extend/system/preciceDict diff --git a/quickstart/fluid-foam-extend/0/U b/quickstart/fluid-foam-extend/0/U new file mode 100644 index 000000000..c51a21d1a --- /dev/null +++ b/quickstart/fluid-foam-extend/0/U @@ -0,0 +1,51 @@ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + + flap + { + type movingWallVelocity; + value uniform (0 0 0); + } + + top + { + type zeroGradient; + } + + bottom + { + type zeroGradient; + } + + inlet + { + type fixedValue; + value uniform (1 0 0); + } + + outlet + { + type zeroGradient; + } + + front + { + type empty; + } + back + { + type empty; + } +} diff --git a/quickstart/fluid-foam-extend/0/p b/quickstart/fluid-foam-extend/0/p new file mode 100644 index 000000000..9bf453010 --- /dev/null +++ b/quickstart/fluid-foam-extend/0/p @@ -0,0 +1,49 @@ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + flap + { + type zeroGradient; + } + + top + { + type zeroGradient; + } + + bottom + { + type zeroGradient; + } + + inlet + { + type zeroGradient; + } + + outlet + { + type fixedValue; + value uniform 0; + } + + front + { + type empty; + } + back + { + type empty; + } +} diff --git a/quickstart/fluid-foam-extend/0/pointDisplacement b/quickstart/fluid-foam-extend/0/pointDisplacement new file mode 100644 index 000000000..2589eba98 --- /dev/null +++ b/quickstart/fluid-foam-extend/0/pointDisplacement @@ -0,0 +1,50 @@ +FoamFile +{ + version 2.0; + format ascii; + class pointVectorField; + object pointDisplacement; +} + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type fixedValue; + value uniform (0 0 0); + } + + outlet + { + type fixedValue; + value uniform (0 0 0); + } + + flap + { + type fixedValue; + value $internalField; + } + + top + { + type slip; + } + + bottom + { + type slip; + } + front + { + type empty; + } + back + { + type empty; + } +} diff --git a/quickstart/fluid-foam-extend/clean.sh b/quickstart/fluid-foam-extend/clean.sh new file mode 100755 index 000000000..b64fc5101 --- /dev/null +++ b/quickstart/fluid-foam-extend/clean.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env sh +set -e -u + +. ../../tools/cleaning-tools.sh + +clean_openfoam . diff --git a/quickstart/fluid-foam-extend/constant/dynamicMeshDict b/quickstart/fluid-foam-extend/constant/dynamicMeshDict new file mode 100644 index 000000000..dbe3f0c4c --- /dev/null +++ b/quickstart/fluid-foam-extend/constant/dynamicMeshDict @@ -0,0 +1,21 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object dynamicMeshDict; +} + + +dynamicFvMesh dynamicMotionSolverFvMesh; + +motionSolverLibs ("libfvMotionSolver.so"); + +solver displacementLaplacian; +// OpenFOAM9 or newer: rename "solver" to "motionSolver" + +diffusivity uniform; + +displacementLaplacianCoeffs { + diffusivity quadratic inverseDistance (flap); +} diff --git a/quickstart/fluid-foam-extend/constant/transportProperties b/quickstart/fluid-foam-extend/constant/transportProperties new file mode 100644 index 000000000..374372283 --- /dev/null +++ b/quickstart/fluid-foam-extend/constant/transportProperties @@ -0,0 +1,12 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object transportProperties; +} + + transportModel Newtonian; + + nu nu [0 2 -1 0 0 0 0 ] 0.001; + pRef pRef [1 -1 -2 0 0 0 0 ] 0.0; diff --git a/quickstart/fluid-foam-extend/constant/turbulenceProperties b/quickstart/fluid-foam-extend/constant/turbulenceProperties new file mode 100644 index 000000000..246999591 --- /dev/null +++ b/quickstart/fluid-foam-extend/constant/turbulenceProperties @@ -0,0 +1,9 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object turbulenceProperties; +} + +simulationType laminar; diff --git a/quickstart/fluid-foam-extend/run.sh b/quickstart/fluid-foam-extend/run.sh new file mode 100755 index 000000000..95679d7d3 --- /dev/null +++ b/quickstart/fluid-foam-extend/run.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -e -u + +. ../../tools/log.sh +exec > >(tee --append "$LOGFILE") 2>&1 + +blockMesh + +../../tools/run-openfoam.sh "$@" + +. ../../tools/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs + +close_log diff --git a/quickstart/fluid-foam-extend/system/blockMeshDict b/quickstart/fluid-foam-extend/system/blockMeshDict new file mode 120000 index 000000000..423deca1b --- /dev/null +++ b/quickstart/fluid-foam-extend/system/blockMeshDict @@ -0,0 +1 @@ +constant/polyMesh/blockMeshDict \ No newline at end of file diff --git a/quickstart/fluid-foam-extend/system/controlDict b/quickstart/fluid-foam-extend/system/controlDict new file mode 100644 index 000000000..f7a45474f --- /dev/null +++ b/quickstart/fluid-foam-extend/system/controlDict @@ -0,0 +1,82 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | foam-extend: Open Source CFD | +| \\ / O peration | Version: 4.1 | +| \\ / A nd | Web: http://www.foam-extend.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//application pimpleFoam; // latest OpenFOAM +application pimpleDyMFoam; // OpenFOAM v1712, OpenFOAM 5.x, or older + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 2.5; + +deltaT 2.5e-2; + +writeControl adjustableRunTime; + +writeInterval 2.5e-2; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 10; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 8; + +runTimeModifiable true; + +adjustTimeStep no; + +maxCo 0.9; + +libs +( + "libforces.so" + "liblduSolvers.so" + "libpreciceAdapterFunctionObject.so" +); + +functions +{ + forces + { + type forces; + functionObjectLibs ( "libforces.so" ); + outputControl timeStep; + outputInterval 1; + patches (flap); + pName p; + UName U; + rhoName rhoInf; + log true; + rhoInf 10; + CofR (0 0 0); + } + + preCICE_Adapter + { + type preciceAdapterFunctionObject; + errors strict; // Available since OpenFOAM v2012 + } +} diff --git a/quickstart/fluid-foam-extend/system/decomposeParDict b/quickstart/fluid-foam-extend/system/decomposeParDict new file mode 100644 index 000000000..4a61fe0df --- /dev/null +++ b/quickstart/fluid-foam-extend/system/decomposeParDict @@ -0,0 +1,24 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location system; + object decomposeParDict; +} + +numberOfSubdomains 2; + +method hierarchical; +hierarchicalCoeffs +{ + n (2 1 1); + delta 0.001; + order xyz; +} + +distributed false; +roots +( +); + diff --git a/quickstart/fluid-foam-extend/system/fvSchemes b/quickstart/fluid-foam-extend/system/fvSchemes new file mode 100644 index 000000000..50827d70d --- /dev/null +++ b/quickstart/fluid-foam-extend/system/fvSchemes @@ -0,0 +1,40 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} + +ddtSchemes +{ + default backward; +} + +gradSchemes +{ + default cellLimited Gauss linear 1; +} + +divSchemes +{ + default none; + div(phi,U) Gauss linearUpwind grad(U); + div((nuEff*dev(T(grad(U))))) Gauss linear; +} + +interpolationSchemes +{ + default linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +snGradSchemes +{ + default corrected; +} diff --git a/quickstart/fluid-foam-extend/system/fvSolution b/quickstart/fluid-foam-extend/system/fvSolution new file mode 100644 index 000000000..92b1a22a4 --- /dev/null +++ b/quickstart/fluid-foam-extend/system/fvSolution @@ -0,0 +1,83 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} + +solvers +{ + p + { + solver GAMG; + tolerance 1e-6; + relTol 1e-4; + smoother DICGaussSeidel; + agglomerator faceAreaPair; + nCellsInCoarsestLevel 10; + mergeLevels 1; + } + + pFinal + { + $p; + tolerance 1e-07; + relTol 0; + } + + pcorr + { + solver GAMG; + tolerance 1e-5; + relTol 1e-3; + smoother GaussSeidel; + } + + pcorrFinal + { + $pcorr; + relTol 0; + } + + phi + { + $p; + } + + "(U|cellDisplacement)" + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-7; + relTol 1e-5; + } + + "(U|cellDisplacement)Final" + { + $U; + relTol 0; + } +} + +PIMPLE +{ + nOuterCorrectors 10; + nCorrectors 2; + nNonOrthogonalCorrectors 1; + tolerance 1.0e-8; + + correctPhi yes; + relTol 1e-4; + pisoTol 1e-6; + consistent true; + +} +PISO +{ + nNonOrthogonalCorrectors 1; +} +potentialFlow +{ + nNonOrthogonalCorrectors 1; +} diff --git a/quickstart/fluid-foam-extend/system/preciceDict b/quickstart/fluid-foam-extend/system/preciceDict new file mode 100644 index 000000000..589f37577 --- /dev/null +++ b/quickstart/fluid-foam-extend/system/preciceDict @@ -0,0 +1,39 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object preciceDict; +} + +preciceConfig ".."/"precice-config.xml"; + +participant Fluid; + +modules (FSI); + +interfaces +{ + Interface1 + { + mesh Fluid-Mesh; + patches (flap); + locations faceCenters; + + readData + ( + Displacement + ); + + writeData + ( + Force + ); + }; +}; + +FSI +{ + rho rho [1 -3 0 0 0 0 0] 1000; +} From 33776aee3cc6b1345354dadec68d610f0a456d1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6hn?= Date: Sat, 5 Jul 2025 17:41:30 +0200 Subject: [PATCH 02/23] Update quickstart/fluid-foam-extend/system/controlDict Co-authored-by: Gerasimos Chourdakis --- quickstart/fluid-foam-extend/system/controlDict | 8 -------- 1 file changed, 8 deletions(-) diff --git a/quickstart/fluid-foam-extend/system/controlDict b/quickstart/fluid-foam-extend/system/controlDict index f7a45474f..2b6a64548 100644 --- a/quickstart/fluid-foam-extend/system/controlDict +++ b/quickstart/fluid-foam-extend/system/controlDict @@ -1,10 +1,3 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | foam-extend: Open Source CFD | -| \\ / O peration | Version: 4.1 | -| \\ / A nd | Web: http://www.foam-extend.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ FoamFile { version 2.0; @@ -13,7 +6,6 @@ FoamFile location "system"; object controlDict; } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // //application pimpleFoam; // latest OpenFOAM application pimpleDyMFoam; // OpenFOAM v1712, OpenFOAM 5.x, or older From 24d8a431d6e875711c1ecccc0b1f491478d1350b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6hn?= Date: Sat, 5 Jul 2025 17:58:34 +0200 Subject: [PATCH 03/23] added missing variable --- quickstart/fluid-foam-extend/system/preciceDict | 1 + 1 file changed, 1 insertion(+) diff --git a/quickstart/fluid-foam-extend/system/preciceDict b/quickstart/fluid-foam-extend/system/preciceDict index 589f37577..f20f70838 100644 --- a/quickstart/fluid-foam-extend/system/preciceDict +++ b/quickstart/fluid-foam-extend/system/preciceDict @@ -36,4 +36,5 @@ interfaces FSI { rho rho [1 -3 0 0 0 0 0] 1000; + nu nu [0 2 -1 0 0 0 0] 0.001; } From 4fc127b4c6064a3ac0eb66d676b6fb9536bedc95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6hn?= Date: Tue, 5 Aug 2025 18:42:59 +0200 Subject: [PATCH 04/23] add blockMeshDict in right folder --- .../constant/polyMesh/blockMeshDict | 196 ++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 quickstart/fluid-foam-extend/constant/polyMesh/blockMeshDict diff --git a/quickstart/fluid-foam-extend/constant/polyMesh/blockMeshDict b/quickstart/fluid-foam-extend/constant/polyMesh/blockMeshDict new file mode 100644 index 000000000..a57ae0086 --- /dev/null +++ b/quickstart/fluid-foam-extend/constant/polyMesh/blockMeshDict @@ -0,0 +1,196 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} + +scale 1; + +b -0.1; // z-back +f 0.1; // z-front + +// Vertices +X1 -0.2; // pre rigid body +X2 0.0; // begin rigid body +X3 0.2; // end rigid body +X4 0.6; // wake + +Y1 -0.13; // distance to bottom +Y2 -0.01; // half body height +Y3 0.01; // half body height +Y4 0.12; // distance to top + +// Blocks +H1 12; +H2 14; +H3 20; + +V1 12; +V2 2; +V3 11; + +G3 4; + +vertices +( + // X1 layer back + ($X1 $Y1 $b) // 0 + ($X1 $Y2 $b) + ($X1 $Y3 $b) + ($X1 $Y4 $b) + + // X1 layer front + ($X1 $Y1 $f) // 4 + ($X1 $Y2 $f) + ($X1 $Y3 $f) + ($X1 $Y4 $f) + + // X2 layer back + ($X2 $Y1 $b) // 8 + ($X2 $Y2 $b) + ($X2 $Y3 $b) + ($X2 $Y4 $b) + + // X2 layer front + ($X2 $Y1 $f) // 12 + ($X2 $Y2 $f) + ($X2 $Y3 $f) + ($X2 $Y4 $f) + + // X3 layer back + ($X3 $Y1 $b) // 16 + ($X3 $Y2 $b) + ($X3 $Y3 $b) + ($X3 $Y4 $b) + + // X3 layer front + ($X3 $Y1 $f) // 20 + ($X3 $Y2 $f) + ($X3 $Y3 $f) + ($X3 $Y4 $f) + + // X4 layer back + ($X4 $Y1 $b) // 24 + ($X4 $Y2 $b) + ($X4 $Y3 $b) + ($X4 $Y4 $b) + + // X4 layer front + ($X4 $Y1 $f) // 28 + ($X4 $Y2 $f) + ($X4 $Y3 $f) + ($X4 $Y4 $f) + +); + +blocks +( + // Block 0-3 + hex ( 0 8 9 1 4 12 13 5) ($H1 $V1 1) simpleGrading (1 1 1) + hex ( 1 9 10 2 5 13 14 6) ($H1 $V2 1) simpleGrading (1 1 1) + hex ( 2 10 11 3 6 14 15 7) ($H1 $V3 1) simpleGrading (1 1 1) + + // Block 4-6 \5 + hex ( 8 16 17 9 12 20 21 13) ($H2 $V1 1) simpleGrading (1 1 1) + hex ( 10 18 19 11 14 22 23 15) ($H2 $V3 1) simpleGrading (1 1 1) + + // Block 7-9 + hex ( 16 24 25 17 20 28 29 21) ($H3 $V1 1) simpleGrading ($G3 1 1) + hex ( 17 25 26 18 21 29 30 22) ($H3 $V2 1) simpleGrading ($G3 1 1) + hex ( 18 26 27 19 22 30 31 23) ($H3 $V3 1) simpleGrading ($G3 1 1) + +); + + +boundary +( + back + { + type empty; + faces + ( + (0 8 9 1) + (1 9 10 2) + (2 10 11 3) + (8 16 17 9) + (10 18 19 11) + (16 24 25 17) + (17 25 26 18) + (18 26 27 19) + ); + } + + front + { + type empty; + faces + ( + (4 12 13 5) + (5 13 14 6) + (6 14 15 7) + (12 20 21 13) + (14 22 23 15) + (20 28 29 21) + (21 29 30 22) + (22 30 31 23) + ); + } + + inlet + { + type patch; + faces + ( + (0 4 5 1) + (1 5 6 2) + (2 6 7 3) + ); + } + + outlet + { + type patch; + faces + ( + (24 28 29 25) + (25 29 30 26) + (26 30 31 27) + ); + } + + flap + { + type wall; + faces + ( + (9 13 14 10) + (9 17 21 13) + (10 18 22 14) + (18 22 21 17) + ); + } + + bottom + { + type wall; + faces + ( + (0 8 12 4) + (8 16 20 12) + (16 24 28 20) + ); + } + + top + { + type wall; + faces + ( + (3 11 15 7) + (11 19 23 15) + (19 27 31 23) + ); + } +); From 85510a1f9c89c5c72b5ec7c666367f7b278bcb61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6hn?= Date: Tue, 5 Aug 2025 18:43:48 +0200 Subject: [PATCH 05/23] remove blockMeshDict from old location --- quickstart/fluid-foam-extend/system/blockMeshDict | 1 - 1 file changed, 1 deletion(-) delete mode 120000 quickstart/fluid-foam-extend/system/blockMeshDict diff --git a/quickstart/fluid-foam-extend/system/blockMeshDict b/quickstart/fluid-foam-extend/system/blockMeshDict deleted file mode 120000 index 423deca1b..000000000 --- a/quickstart/fluid-foam-extend/system/blockMeshDict +++ /dev/null @@ -1 +0,0 @@ -constant/polyMesh/blockMeshDict \ No newline at end of file From dbfdeb936c9bdbc259dbc26616a162c618e7cbb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6hn?= Date: Wed, 6 Aug 2025 16:06:41 +0200 Subject: [PATCH 06/23] fix path for preciceDict in quickstart for foam-extend --- quickstart/fluid-foam-extend/system/preciceDict | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstart/fluid-foam-extend/system/preciceDict b/quickstart/fluid-foam-extend/system/preciceDict index f20f70838..776af5eda 100644 --- a/quickstart/fluid-foam-extend/system/preciceDict +++ b/quickstart/fluid-foam-extend/system/preciceDict @@ -7,7 +7,7 @@ FoamFile object preciceDict; } -preciceConfig ".."/"precice-config.xml"; +preciceConfig "../precice-config.xml"; participant Fluid; From da485100b2f447e78bb707eb3defe333466dd14e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6hn?= Date: Wed, 6 Aug 2025 16:19:39 +0200 Subject: [PATCH 07/23] add missing keyword --- quickstart/fluid-foam-extend/system/fvSolution | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/quickstart/fluid-foam-extend/system/fvSolution b/quickstart/fluid-foam-extend/system/fvSolution index 92b1a22a4..d23c31e5a 100644 --- a/quickstart/fluid-foam-extend/system/fvSolution +++ b/quickstart/fluid-foam-extend/system/fvSolution @@ -81,3 +81,8 @@ potentialFlow { nNonOrthogonalCorrectors 1; } + +fieldBounds +{ + +} From 50ba26cb09d4b499dd27710128294c01f236455a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6hn?= Date: Wed, 6 Aug 2025 17:19:08 +0200 Subject: [PATCH 08/23] added missing keywords for foam-extend-5.0 --- quickstart/fluid-foam-extend/system/fvSolution | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/quickstart/fluid-foam-extend/system/fvSolution b/quickstart/fluid-foam-extend/system/fvSolution index d23c31e5a..f7146602c 100644 --- a/quickstart/fluid-foam-extend/system/fvSolution +++ b/quickstart/fluid-foam-extend/system/fvSolution @@ -84,5 +84,7 @@ potentialFlow fieldBounds { - + p -1e5 1e5; + U 100; } + From 49c1e05e194cd6a7c1137ceffa160620b9f34c0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6hn?= Date: Wed, 6 Aug 2025 21:27:01 +0200 Subject: [PATCH 09/23] add missing scheme --- quickstart/fluid-foam-extend/system/fvSchemes | 1 + 1 file changed, 1 insertion(+) diff --git a/quickstart/fluid-foam-extend/system/fvSchemes b/quickstart/fluid-foam-extend/system/fvSchemes index 50827d70d..46bb1e015 100644 --- a/quickstart/fluid-foam-extend/system/fvSchemes +++ b/quickstart/fluid-foam-extend/system/fvSchemes @@ -22,6 +22,7 @@ divSchemes default none; div(phi,U) Gauss linearUpwind grad(U); div((nuEff*dev(T(grad(U))))) Gauss linear; + div((nuEff*dev2(T(grad(U))))) Gauss linear; } interpolationSchemes From 2085c00359615969058134ebc7a9fd49d8d17671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6hn?= Date: Fri, 8 Aug 2025 14:07:19 +0200 Subject: [PATCH 10/23] add relaxationFactors for foam-extend-4.0 --- quickstart/fluid-foam-extend/system/fvSolution | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/quickstart/fluid-foam-extend/system/fvSolution b/quickstart/fluid-foam-extend/system/fvSolution index f7146602c..df0861fdf 100644 --- a/quickstart/fluid-foam-extend/system/fvSolution +++ b/quickstart/fluid-foam-extend/system/fvSolution @@ -82,6 +82,14 @@ potentialFlow nNonOrthogonalCorrectors 1; } +relaxationFactors +{ + U 0.7; + p 0.3; + k 0.6; + epsilon 0.6; +} + fieldBounds { p -1e5 1e5; From dacad277af03e6bafc6a3f321c9003efb5f0bad1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6hn?= Date: Fri, 8 Aug 2025 14:10:19 +0200 Subject: [PATCH 11/23] also add Ufinal for foam-extend-4.0 --- quickstart/fluid-foam-extend/system/fvSolution | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/quickstart/fluid-foam-extend/system/fvSolution b/quickstart/fluid-foam-extend/system/fvSolution index df0861fdf..52a2ad495 100644 --- a/quickstart/fluid-foam-extend/system/fvSolution +++ b/quickstart/fluid-foam-extend/system/fvSolution @@ -85,9 +85,7 @@ potentialFlow relaxationFactors { U 0.7; - p 0.3; - k 0.6; - epsilon 0.6; + Ufinal 1; } fieldBounds From af9e81355ac587ad939cfa959ad0737f4e8e9528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6hn?= Date: Fri, 8 Aug 2025 14:15:54 +0200 Subject: [PATCH 12/23] fix typo --- quickstart/fluid-foam-extend/system/fvSolution | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstart/fluid-foam-extend/system/fvSolution b/quickstart/fluid-foam-extend/system/fvSolution index 52a2ad495..e39f7594a 100644 --- a/quickstart/fluid-foam-extend/system/fvSolution +++ b/quickstart/fluid-foam-extend/system/fvSolution @@ -85,7 +85,7 @@ potentialFlow relaxationFactors { U 0.7; - Ufinal 1; + UFinal 1; } fieldBounds From c153c42a6f9f1a80ef834e9e0879168fcd886b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6hn?= Date: Mon, 8 Sep 2025 19:07:15 +0200 Subject: [PATCH 13/23] add changes to combine foam-extend and openfoam for the quickstart tutorial --- .../fluid-openfoam/constant/dynamicMeshDict | 2 + quickstart/fluid-openfoam/system/controlDict | 13 +++++- quickstart/fluid-openfoam/system/fvSchemes | 1 + quickstart/fluid-openfoam/system/fvSolution | 16 +++++++ quickstart/fluid-openfoam/system/preciceDict | 1 + tools/run-foam-extend.sh | 42 +++++++++++++++++++ 6 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 tools/run-foam-extend.sh diff --git a/quickstart/fluid-openfoam/constant/dynamicMeshDict b/quickstart/fluid-openfoam/constant/dynamicMeshDict index ec8a77f10..b224f9cd8 100644 --- a/quickstart/fluid-openfoam/constant/dynamicMeshDict +++ b/quickstart/fluid-openfoam/constant/dynamicMeshDict @@ -14,6 +14,8 @@ motionSolverLibs ("libfvMotionSolvers.so"); solver displacementLaplacian; // OpenFOAM9 or newer: rename "solver" to "motionSolver" +diffusivity uniform; + displacementLaplacianCoeffs { diffusivity quadratic inverseDistance (flap); } diff --git a/quickstart/fluid-openfoam/system/controlDict b/quickstart/fluid-openfoam/system/controlDict index a527b5781..14be2e5cd 100644 --- a/quickstart/fluid-openfoam/system/controlDict +++ b/quickstart/fluid-openfoam/system/controlDict @@ -3,13 +3,13 @@ FoamFile version 2.0; format ascii; class dictionary; + location "system"; object controlDict; } application pimpleFoam; // latest OpenFOAM // application pimpleDyMFoam; // OpenFOAM v1712, OpenFOAM 5.x, or older - startFrom startTime; startTime 0; @@ -36,14 +36,23 @@ timeFormat general; timePrecision 8; -libs ("libpreciceAdapterFunctionObject.so"); +libs +( + "libpreciceAdapterFunctionObject.so" +); functions { forces { type forces; libs ( "libforces.so" ); + functionObjectLibs ( "libforces.so" ); + outputControl timeStep; + outputInterval 1; patches (flap); + pName p; + UName U; + rhoName rhoInf; rho rhoInf; log true; rhoInf 10; diff --git a/quickstart/fluid-openfoam/system/fvSchemes b/quickstart/fluid-openfoam/system/fvSchemes index 2035cd05c..46bb1e015 100644 --- a/quickstart/fluid-openfoam/system/fvSchemes +++ b/quickstart/fluid-openfoam/system/fvSchemes @@ -21,6 +21,7 @@ divSchemes { default none; div(phi,U) Gauss linearUpwind grad(U); + div((nuEff*dev(T(grad(U))))) Gauss linear; div((nuEff*dev2(T(grad(U))))) Gauss linear; } diff --git a/quickstart/fluid-openfoam/system/fvSolution b/quickstart/fluid-openfoam/system/fvSolution index 813288c04..e39f7594a 100644 --- a/quickstart/fluid-openfoam/system/fvSolution +++ b/quickstart/fluid-openfoam/system/fvSolution @@ -14,6 +14,9 @@ solvers tolerance 1e-6; relTol 1e-4; smoother DICGaussSeidel; + agglomerator faceAreaPair; + nCellsInCoarsestLevel 10; + mergeLevels 1; } pFinal @@ -78,3 +81,16 @@ potentialFlow { nNonOrthogonalCorrectors 1; } + +relaxationFactors +{ + U 0.7; + UFinal 1; +} + +fieldBounds +{ + p -1e5 1e5; + U 100; +} + diff --git a/quickstart/fluid-openfoam/system/preciceDict b/quickstart/fluid-openfoam/system/preciceDict index c67f623a0..776af5eda 100644 --- a/quickstart/fluid-openfoam/system/preciceDict +++ b/quickstart/fluid-openfoam/system/preciceDict @@ -36,4 +36,5 @@ interfaces FSI { rho rho [1 -3 0 0 0 0 0] 1000; + nu nu [0 2 -1 0 0 0 0] 0.001; } diff --git a/tools/run-foam-extend.sh b/tools/run-foam-extend.sh new file mode 100644 index 000000000..f9ab0a2eb --- /dev/null +++ b/tools/run-foam-extend.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env sh +set -e # Not setting -u as it gets triggered by the OpenFOAM RunFunctions + +# Prepare an (intentionally empty) .foam file for the ParaView OpenFOAM reader +CASENAME="$(pwd | xargs basename)" +touch "$CASENAME.foam" + +# Modify code for foam-extend +mkdir constant/polyMesh +cp system/blockMeshDict constant/polyMesh +sed -i "s/noSlip;/noSlipWall;/g" 0/U +sed -i "s,application pimpleFoam;,//application pimpleFoam;,g" system/controlDict +sed -i "s,// application pimpleDyMFoam;,application pimpleDyMFoam;,g" system/controlDict +sed -i '41i\ \ \ \ "liblduSolvers.so"' system/controlDict +sed -i '41i\ \ \ \ "libforces.so"' system/controlDict +sed -i "s,writeCompression off,writeCompression uncompressed,g" system/controlDict + +sed -i "s/libfvMotionSolvers\./libfvMotionSolver\./g" constant/dynamicMeshDict + +# OpenFOAM run functions: getApplication, getNumberOfProcessors +# shellcheck disable=SC1090 # This is an OpenFOAM file which we don't need to check +. "${WM_PROJECT_DIR}/bin/tools/RunFunctions" +solver=$(getApplication) +if [ "${1:-}" = "-parallel" ]; then + procs=$(getNumberOfProcessors) + decomposePar -force + mpirun -np "${procs}" "${solver}" -parallel + reconstructPar +else + ${solver} +fi + +# Reverse code for OpenFOAM +rm -rf constant/polyMesh +sed -i "s/noSlipWall;/noSlip;/g" 0/U +sed -i "s,application pimpleDyMFoam;,// application pimpleDyMFoam;,g" system/controlDict +sed -i "s,//application pimpleFoam;,application pimpleFoam;,g" system/controlDict +sed -i '/ "liblduSolvers.so"/d' system/controlDict +sed -i '/ "libforces.so/d' system/controlDict +sed -i "s,writeCompression uncompressed,writeCompression off,g" system/controlDict + +sed -i "s/libfvMotionSolver\./libfvMotionSolvers\./g" constant/dynamicMeshDict From d911b726172d9169af07c2c3b47137357adbd302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6hn?= Date: Mon, 8 Sep 2025 19:15:26 +0200 Subject: [PATCH 14/23] make run-foam-extend.sh executable --- tools/run-foam-extend.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) mode change 100644 => 100755 tools/run-foam-extend.sh diff --git a/tools/run-foam-extend.sh b/tools/run-foam-extend.sh old mode 100644 new mode 100755 index f9ab0a2eb..5f562bbd0 --- a/tools/run-foam-extend.sh +++ b/tools/run-foam-extend.sh @@ -31,12 +31,12 @@ else fi # Reverse code for OpenFOAM -rm -rf constant/polyMesh -sed -i "s/noSlipWall;/noSlip;/g" 0/U -sed -i "s,application pimpleDyMFoam;,// application pimpleDyMFoam;,g" system/controlDict -sed -i "s,//application pimpleFoam;,application pimpleFoam;,g" system/controlDict -sed -i '/ "liblduSolvers.so"/d' system/controlDict -sed -i '/ "libforces.so/d' system/controlDict -sed -i "s,writeCompression uncompressed,writeCompression off,g" system/controlDict - -sed -i "s/libfvMotionSolver\./libfvMotionSolvers\./g" constant/dynamicMeshDict +#rm -rf constant/polyMesh +#sed -i "s/noSlipWall;/noSlip;/g" 0/U +#sed -i "s,application pimpleDyMFoam;,// application pimpleDyMFoam;,g" system/controlDict +#sed -i "s,//application pimpleFoam;,application pimpleFoam;,g" system/controlDict +#sed -i '/ "liblduSolvers.so"/d' system/controlDict +#sed -i '/ "libforces.so/d' system/controlDict +#sed -i "s,writeCompression uncompressed,writeCompression off,g" system/controlDict +# +#sed -i "s/libfvMotionSolver\./libfvMotionSolvers\./g" constant/dynamicMeshDict From f132044409baa1854296695ebf9891a6e31c1779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6hn?= Date: Mon, 8 Sep 2025 20:21:10 +0200 Subject: [PATCH 15/23] remove the too late creation of blockMeshDict for OpenFOAM --- tools/run-foam-extend.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/run-foam-extend.sh b/tools/run-foam-extend.sh index 5f562bbd0..edb75e8a6 100755 --- a/tools/run-foam-extend.sh +++ b/tools/run-foam-extend.sh @@ -6,8 +6,6 @@ CASENAME="$(pwd | xargs basename)" touch "$CASENAME.foam" # Modify code for foam-extend -mkdir constant/polyMesh -cp system/blockMeshDict constant/polyMesh sed -i "s/noSlip;/noSlipWall;/g" 0/U sed -i "s,application pimpleFoam;,//application pimpleFoam;,g" system/controlDict sed -i "s,// application pimpleDyMFoam;,application pimpleDyMFoam;,g" system/controlDict From 0306949afd5d07183b735a68315734979a96922d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6hn?= Date: Mon, 8 Sep 2025 21:20:36 +0200 Subject: [PATCH 16/23] adding missing values for foam-extend --- quickstart/fluid-openfoam/0/U | 2 ++ 1 file changed, 2 insertions(+) diff --git a/quickstart/fluid-openfoam/0/U b/quickstart/fluid-openfoam/0/U index ebf7eb904..4200c6ad4 100644 --- a/quickstart/fluid-openfoam/0/U +++ b/quickstart/fluid-openfoam/0/U @@ -22,11 +22,13 @@ boundaryField top { type noSlip; + value uniform (0 0 0); } bottom { type noSlip; + value uniform (0 0 0); } inlet From 6a02f4f4a876a59a25502bdfd38a75bfed45b4aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6hn?= Date: Mon, 8 Sep 2025 21:23:02 +0200 Subject: [PATCH 17/23] add fix to adjust to limited version of getApplications in foam-extend --- tools/run-foam-extend.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/run-foam-extend.sh b/tools/run-foam-extend.sh index edb75e8a6..e98613c3f 100755 --- a/tools/run-foam-extend.sh +++ b/tools/run-foam-extend.sh @@ -6,6 +6,7 @@ CASENAME="$(pwd | xargs basename)" touch "$CASENAME.foam" # Modify code for foam-extend +echo "modifying everything now" sed -i "s/noSlip;/noSlipWall;/g" 0/U sed -i "s,application pimpleFoam;,//application pimpleFoam;,g" system/controlDict sed -i "s,// application pimpleDyMFoam;,application pimpleDyMFoam;,g" system/controlDict @@ -18,7 +19,7 @@ sed -i "s/libfvMotionSolvers\./libfvMotionSolver\./g" constant/dynamicMeshDict # OpenFOAM run functions: getApplication, getNumberOfProcessors # shellcheck disable=SC1090 # This is an OpenFOAM file which we don't need to check . "${WM_PROJECT_DIR}/bin/tools/RunFunctions" -solver=$(getApplication) +solver=$(getApplication | cut -f 1 -d " " | sed '\~//~d') if [ "${1:-}" = "-parallel" ]; then procs=$(getNumberOfProcessors) decomposePar -force From 70824675d86f43ea5f495068bd50dc8adc4b1747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6hn?= Date: Mon, 8 Sep 2025 21:38:14 +0200 Subject: [PATCH 18/23] add changes before deleting folder --- quickstart/fluid-foam-extend/0/U | 4 +-- .../fluid-foam-extend/system/controlDict | 29 ++++++++++--------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/quickstart/fluid-foam-extend/0/U b/quickstart/fluid-foam-extend/0/U index c51a21d1a..cce100f80 100644 --- a/quickstart/fluid-foam-extend/0/U +++ b/quickstart/fluid-foam-extend/0/U @@ -21,12 +21,12 @@ boundaryField top { - type zeroGradient; + type noSlipWall; } bottom { - type zeroGradient; + type noSlipWall; } inlet diff --git a/quickstart/fluid-foam-extend/system/controlDict b/quickstart/fluid-foam-extend/system/controlDict index 2b6a64548..6f7dd34c1 100644 --- a/quickstart/fluid-foam-extend/system/controlDict +++ b/quickstart/fluid-foam-extend/system/controlDict @@ -10,31 +10,31 @@ FoamFile //application pimpleFoam; // latest OpenFOAM application pimpleDyMFoam; // OpenFOAM v1712, OpenFOAM 5.x, or older -startFrom startTime; +startFrom startTime; -startTime 0; +startTime 0; -stopAt endTime; +stopAt endTime; -endTime 2.5; +endTime 2.5; -deltaT 2.5e-2; +deltaT 2.5e-2; -writeControl adjustableRunTime; +writeControl adjustableRunTime; -writeInterval 2.5e-2; +writeInterval 2.5e-2; -purgeWrite 0; +purgeWrite 0; -writeFormat ascii; +writeFormat ascii; -writePrecision 10; +writePrecision 10; -writeCompression uncompressed; +writeCompression uncompressed; -timeFormat general; +timeFormat general; -timePrecision 8; +timePrecision 8; runTimeModifiable true; @@ -48,12 +48,12 @@ libs "liblduSolvers.so" "libpreciceAdapterFunctionObject.so" ); - functions { forces { type forces; + libs ( "libforces.so" ); functionObjectLibs ( "libforces.so" ); outputControl timeStep; outputInterval 1; @@ -61,6 +61,7 @@ functions pName p; UName U; rhoName rhoInf; + rho rhoInf; log true; rhoInf 10; CofR (0 0 0); From 02ddabbd774941981cf98fe766c69c8fb746dc4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20H=C3=B6hn?= Date: Mon, 8 Sep 2025 21:38:38 +0200 Subject: [PATCH 19/23] remove no longer required folder for foam-extend --- quickstart/fluid-foam-extend/0/U | 51 ----- quickstart/fluid-foam-extend/0/p | 49 ----- .../fluid-foam-extend/0/pointDisplacement | 50 ----- quickstart/fluid-foam-extend/clean.sh | 6 - .../constant/dynamicMeshDict | 21 -- .../constant/polyMesh/blockMeshDict | 196 ------------------ .../constant/transportProperties | 12 -- .../constant/turbulenceProperties | 9 - quickstart/fluid-foam-extend/run.sh | 13 -- .../fluid-foam-extend/system/controlDict | 75 ------- .../fluid-foam-extend/system/decomposeParDict | 24 --- quickstart/fluid-foam-extend/system/fvSchemes | 41 ---- .../fluid-foam-extend/system/fvSolution | 96 --------- .../fluid-foam-extend/system/preciceDict | 40 ---- 14 files changed, 683 deletions(-) delete mode 100644 quickstart/fluid-foam-extend/0/U delete mode 100644 quickstart/fluid-foam-extend/0/p delete mode 100644 quickstart/fluid-foam-extend/0/pointDisplacement delete mode 100755 quickstart/fluid-foam-extend/clean.sh delete mode 100644 quickstart/fluid-foam-extend/constant/dynamicMeshDict delete mode 100644 quickstart/fluid-foam-extend/constant/polyMesh/blockMeshDict delete mode 100644 quickstart/fluid-foam-extend/constant/transportProperties delete mode 100644 quickstart/fluid-foam-extend/constant/turbulenceProperties delete mode 100755 quickstart/fluid-foam-extend/run.sh delete mode 100644 quickstart/fluid-foam-extend/system/controlDict delete mode 100644 quickstart/fluid-foam-extend/system/decomposeParDict delete mode 100644 quickstart/fluid-foam-extend/system/fvSchemes delete mode 100644 quickstart/fluid-foam-extend/system/fvSolution delete mode 100644 quickstart/fluid-foam-extend/system/preciceDict diff --git a/quickstart/fluid-foam-extend/0/U b/quickstart/fluid-foam-extend/0/U deleted file mode 100644 index cce100f80..000000000 --- a/quickstart/fluid-foam-extend/0/U +++ /dev/null @@ -1,51 +0,0 @@ -FoamFile -{ - version 2.0; - format ascii; - class volVectorField; - object U; -} - -dimensions [0 1 -1 0 0 0 0]; - -internalField uniform (0 0 0); - -boundaryField -{ - - flap - { - type movingWallVelocity; - value uniform (0 0 0); - } - - top - { - type noSlipWall; - } - - bottom - { - type noSlipWall; - } - - inlet - { - type fixedValue; - value uniform (1 0 0); - } - - outlet - { - type zeroGradient; - } - - front - { - type empty; - } - back - { - type empty; - } -} diff --git a/quickstart/fluid-foam-extend/0/p b/quickstart/fluid-foam-extend/0/p deleted file mode 100644 index 9bf453010..000000000 --- a/quickstart/fluid-foam-extend/0/p +++ /dev/null @@ -1,49 +0,0 @@ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - object p; -} - -dimensions [0 2 -2 0 0 0 0]; - -internalField uniform 0; - -boundaryField -{ - flap - { - type zeroGradient; - } - - top - { - type zeroGradient; - } - - bottom - { - type zeroGradient; - } - - inlet - { - type zeroGradient; - } - - outlet - { - type fixedValue; - value uniform 0; - } - - front - { - type empty; - } - back - { - type empty; - } -} diff --git a/quickstart/fluid-foam-extend/0/pointDisplacement b/quickstart/fluid-foam-extend/0/pointDisplacement deleted file mode 100644 index 2589eba98..000000000 --- a/quickstart/fluid-foam-extend/0/pointDisplacement +++ /dev/null @@ -1,50 +0,0 @@ -FoamFile -{ - version 2.0; - format ascii; - class pointVectorField; - object pointDisplacement; -} - -dimensions [0 1 0 0 0 0 0]; - -internalField uniform (0 0 0); - -boundaryField -{ - inlet - { - type fixedValue; - value uniform (0 0 0); - } - - outlet - { - type fixedValue; - value uniform (0 0 0); - } - - flap - { - type fixedValue; - value $internalField; - } - - top - { - type slip; - } - - bottom - { - type slip; - } - front - { - type empty; - } - back - { - type empty; - } -} diff --git a/quickstart/fluid-foam-extend/clean.sh b/quickstart/fluid-foam-extend/clean.sh deleted file mode 100755 index b64fc5101..000000000 --- a/quickstart/fluid-foam-extend/clean.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env sh -set -e -u - -. ../../tools/cleaning-tools.sh - -clean_openfoam . diff --git a/quickstart/fluid-foam-extend/constant/dynamicMeshDict b/quickstart/fluid-foam-extend/constant/dynamicMeshDict deleted file mode 100644 index dbe3f0c4c..000000000 --- a/quickstart/fluid-foam-extend/constant/dynamicMeshDict +++ /dev/null @@ -1,21 +0,0 @@ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object dynamicMeshDict; -} - - -dynamicFvMesh dynamicMotionSolverFvMesh; - -motionSolverLibs ("libfvMotionSolver.so"); - -solver displacementLaplacian; -// OpenFOAM9 or newer: rename "solver" to "motionSolver" - -diffusivity uniform; - -displacementLaplacianCoeffs { - diffusivity quadratic inverseDistance (flap); -} diff --git a/quickstart/fluid-foam-extend/constant/polyMesh/blockMeshDict b/quickstart/fluid-foam-extend/constant/polyMesh/blockMeshDict deleted file mode 100644 index a57ae0086..000000000 --- a/quickstart/fluid-foam-extend/constant/polyMesh/blockMeshDict +++ /dev/null @@ -1,196 +0,0 @@ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object blockMeshDict; -} - -scale 1; - -b -0.1; // z-back -f 0.1; // z-front - -// Vertices -X1 -0.2; // pre rigid body -X2 0.0; // begin rigid body -X3 0.2; // end rigid body -X4 0.6; // wake - -Y1 -0.13; // distance to bottom -Y2 -0.01; // half body height -Y3 0.01; // half body height -Y4 0.12; // distance to top - -// Blocks -H1 12; -H2 14; -H3 20; - -V1 12; -V2 2; -V3 11; - -G3 4; - -vertices -( - // X1 layer back - ($X1 $Y1 $b) // 0 - ($X1 $Y2 $b) - ($X1 $Y3 $b) - ($X1 $Y4 $b) - - // X1 layer front - ($X1 $Y1 $f) // 4 - ($X1 $Y2 $f) - ($X1 $Y3 $f) - ($X1 $Y4 $f) - - // X2 layer back - ($X2 $Y1 $b) // 8 - ($X2 $Y2 $b) - ($X2 $Y3 $b) - ($X2 $Y4 $b) - - // X2 layer front - ($X2 $Y1 $f) // 12 - ($X2 $Y2 $f) - ($X2 $Y3 $f) - ($X2 $Y4 $f) - - // X3 layer back - ($X3 $Y1 $b) // 16 - ($X3 $Y2 $b) - ($X3 $Y3 $b) - ($X3 $Y4 $b) - - // X3 layer front - ($X3 $Y1 $f) // 20 - ($X3 $Y2 $f) - ($X3 $Y3 $f) - ($X3 $Y4 $f) - - // X4 layer back - ($X4 $Y1 $b) // 24 - ($X4 $Y2 $b) - ($X4 $Y3 $b) - ($X4 $Y4 $b) - - // X4 layer front - ($X4 $Y1 $f) // 28 - ($X4 $Y2 $f) - ($X4 $Y3 $f) - ($X4 $Y4 $f) - -); - -blocks -( - // Block 0-3 - hex ( 0 8 9 1 4 12 13 5) ($H1 $V1 1) simpleGrading (1 1 1) - hex ( 1 9 10 2 5 13 14 6) ($H1 $V2 1) simpleGrading (1 1 1) - hex ( 2 10 11 3 6 14 15 7) ($H1 $V3 1) simpleGrading (1 1 1) - - // Block 4-6 \5 - hex ( 8 16 17 9 12 20 21 13) ($H2 $V1 1) simpleGrading (1 1 1) - hex ( 10 18 19 11 14 22 23 15) ($H2 $V3 1) simpleGrading (1 1 1) - - // Block 7-9 - hex ( 16 24 25 17 20 28 29 21) ($H3 $V1 1) simpleGrading ($G3 1 1) - hex ( 17 25 26 18 21 29 30 22) ($H3 $V2 1) simpleGrading ($G3 1 1) - hex ( 18 26 27 19 22 30 31 23) ($H3 $V3 1) simpleGrading ($G3 1 1) - -); - - -boundary -( - back - { - type empty; - faces - ( - (0 8 9 1) - (1 9 10 2) - (2 10 11 3) - (8 16 17 9) - (10 18 19 11) - (16 24 25 17) - (17 25 26 18) - (18 26 27 19) - ); - } - - front - { - type empty; - faces - ( - (4 12 13 5) - (5 13 14 6) - (6 14 15 7) - (12 20 21 13) - (14 22 23 15) - (20 28 29 21) - (21 29 30 22) - (22 30 31 23) - ); - } - - inlet - { - type patch; - faces - ( - (0 4 5 1) - (1 5 6 2) - (2 6 7 3) - ); - } - - outlet - { - type patch; - faces - ( - (24 28 29 25) - (25 29 30 26) - (26 30 31 27) - ); - } - - flap - { - type wall; - faces - ( - (9 13 14 10) - (9 17 21 13) - (10 18 22 14) - (18 22 21 17) - ); - } - - bottom - { - type wall; - faces - ( - (0 8 12 4) - (8 16 20 12) - (16 24 28 20) - ); - } - - top - { - type wall; - faces - ( - (3 11 15 7) - (11 19 23 15) - (19 27 31 23) - ); - } -); diff --git a/quickstart/fluid-foam-extend/constant/transportProperties b/quickstart/fluid-foam-extend/constant/transportProperties deleted file mode 100644 index 374372283..000000000 --- a/quickstart/fluid-foam-extend/constant/transportProperties +++ /dev/null @@ -1,12 +0,0 @@ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object transportProperties; -} - - transportModel Newtonian; - - nu nu [0 2 -1 0 0 0 0 ] 0.001; - pRef pRef [1 -1 -2 0 0 0 0 ] 0.0; diff --git a/quickstart/fluid-foam-extend/constant/turbulenceProperties b/quickstart/fluid-foam-extend/constant/turbulenceProperties deleted file mode 100644 index 246999591..000000000 --- a/quickstart/fluid-foam-extend/constant/turbulenceProperties +++ /dev/null @@ -1,9 +0,0 @@ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object turbulenceProperties; -} - -simulationType laminar; diff --git a/quickstart/fluid-foam-extend/run.sh b/quickstart/fluid-foam-extend/run.sh deleted file mode 100755 index 95679d7d3..000000000 --- a/quickstart/fluid-foam-extend/run.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -set -e -u - -. ../../tools/log.sh -exec > >(tee --append "$LOGFILE") 2>&1 - -blockMesh - -../../tools/run-openfoam.sh "$@" - -. ../../tools/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs - -close_log diff --git a/quickstart/fluid-foam-extend/system/controlDict b/quickstart/fluid-foam-extend/system/controlDict deleted file mode 100644 index 6f7dd34c1..000000000 --- a/quickstart/fluid-foam-extend/system/controlDict +++ /dev/null @@ -1,75 +0,0 @@ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "system"; - object controlDict; -} - -//application pimpleFoam; // latest OpenFOAM -application pimpleDyMFoam; // OpenFOAM v1712, OpenFOAM 5.x, or older - -startFrom startTime; - -startTime 0; - -stopAt endTime; - -endTime 2.5; - -deltaT 2.5e-2; - -writeControl adjustableRunTime; - -writeInterval 2.5e-2; - -purgeWrite 0; - -writeFormat ascii; - -writePrecision 10; - -writeCompression uncompressed; - -timeFormat general; - -timePrecision 8; - -runTimeModifiable true; - -adjustTimeStep no; - -maxCo 0.9; - -libs -( - "libforces.so" - "liblduSolvers.so" - "libpreciceAdapterFunctionObject.so" -); -functions -{ - forces - { - type forces; - libs ( "libforces.so" ); - functionObjectLibs ( "libforces.so" ); - outputControl timeStep; - outputInterval 1; - patches (flap); - pName p; - UName U; - rhoName rhoInf; - rho rhoInf; - log true; - rhoInf 10; - CofR (0 0 0); - } - - preCICE_Adapter - { - type preciceAdapterFunctionObject; - errors strict; // Available since OpenFOAM v2012 - } -} diff --git a/quickstart/fluid-foam-extend/system/decomposeParDict b/quickstart/fluid-foam-extend/system/decomposeParDict deleted file mode 100644 index 4a61fe0df..000000000 --- a/quickstart/fluid-foam-extend/system/decomposeParDict +++ /dev/null @@ -1,24 +0,0 @@ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location system; - object decomposeParDict; -} - -numberOfSubdomains 2; - -method hierarchical; -hierarchicalCoeffs -{ - n (2 1 1); - delta 0.001; - order xyz; -} - -distributed false; -roots -( -); - diff --git a/quickstart/fluid-foam-extend/system/fvSchemes b/quickstart/fluid-foam-extend/system/fvSchemes deleted file mode 100644 index 46bb1e015..000000000 --- a/quickstart/fluid-foam-extend/system/fvSchemes +++ /dev/null @@ -1,41 +0,0 @@ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "system"; - object fvSchemes; -} - -ddtSchemes -{ - default backward; -} - -gradSchemes -{ - default cellLimited Gauss linear 1; -} - -divSchemes -{ - default none; - div(phi,U) Gauss linearUpwind grad(U); - div((nuEff*dev(T(grad(U))))) Gauss linear; - div((nuEff*dev2(T(grad(U))))) Gauss linear; -} - -interpolationSchemes -{ - default linear; -} - -laplacianSchemes -{ - default Gauss linear corrected; -} - -snGradSchemes -{ - default corrected; -} diff --git a/quickstart/fluid-foam-extend/system/fvSolution b/quickstart/fluid-foam-extend/system/fvSolution deleted file mode 100644 index e39f7594a..000000000 --- a/quickstart/fluid-foam-extend/system/fvSolution +++ /dev/null @@ -1,96 +0,0 @@ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - object fvSolution; -} - -solvers -{ - p - { - solver GAMG; - tolerance 1e-6; - relTol 1e-4; - smoother DICGaussSeidel; - agglomerator faceAreaPair; - nCellsInCoarsestLevel 10; - mergeLevels 1; - } - - pFinal - { - $p; - tolerance 1e-07; - relTol 0; - } - - pcorr - { - solver GAMG; - tolerance 1e-5; - relTol 1e-3; - smoother GaussSeidel; - } - - pcorrFinal - { - $pcorr; - relTol 0; - } - - phi - { - $p; - } - - "(U|cellDisplacement)" - { - solver smoothSolver; - smoother symGaussSeidel; - tolerance 1e-7; - relTol 1e-5; - } - - "(U|cellDisplacement)Final" - { - $U; - relTol 0; - } -} - -PIMPLE -{ - nOuterCorrectors 10; - nCorrectors 2; - nNonOrthogonalCorrectors 1; - tolerance 1.0e-8; - - correctPhi yes; - relTol 1e-4; - pisoTol 1e-6; - consistent true; - -} -PISO -{ - nNonOrthogonalCorrectors 1; -} -potentialFlow -{ - nNonOrthogonalCorrectors 1; -} - -relaxationFactors -{ - U 0.7; - UFinal 1; -} - -fieldBounds -{ - p -1e5 1e5; - U 100; -} - diff --git a/quickstart/fluid-foam-extend/system/preciceDict b/quickstart/fluid-foam-extend/system/preciceDict deleted file mode 100644 index 776af5eda..000000000 --- a/quickstart/fluid-foam-extend/system/preciceDict +++ /dev/null @@ -1,40 +0,0 @@ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "system"; - object preciceDict; -} - -preciceConfig "../precice-config.xml"; - -participant Fluid; - -modules (FSI); - -interfaces -{ - Interface1 - { - mesh Fluid-Mesh; - patches (flap); - locations faceCenters; - - readData - ( - Displacement - ); - - writeData - ( - Force - ); - }; -}; - -FSI -{ - rho rho [1 -3 0 0 0 0 0] 1000; - nu nu [0 2 -1 0 0 0 0] 0.001; -} From 6baea2208691faf58118995828067dbf81c88142 Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Sat, 13 Sep 2025 22:04:01 +0200 Subject: [PATCH 20/23] run-foam-extend.sh: Back up original files --- tools/run-foam-extend.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/run-foam-extend.sh b/tools/run-foam-extend.sh index e98613c3f..9e0aa0e95 100755 --- a/tools/run-foam-extend.sh +++ b/tools/run-foam-extend.sh @@ -5,6 +5,12 @@ set -e # Not setting -u as it gets triggered by the OpenFOAM RunFunctions CASENAME="$(pwd | xargs basename)" touch "$CASENAME.foam" +# Keep a backup of the files to modify +echo "backing up the original files (copies: 0/U.orig, system/controlDict.orig, constant/dynamicMeshDict.orig)" +cp 0/U 0/U.orig +cp system/controlDict system/controlDict.orig +cp constant/dynamicMeshDict constant/dynamicMeshDict.orig + # Modify code for foam-extend echo "modifying everything now" sed -i "s/noSlip;/noSlipWall;/g" 0/U From 3f11c0c97964f7ea55b000421596f5f85487323f Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Sat, 13 Sep 2025 22:13:15 +0200 Subject: [PATCH 21/23] Add comments in the controlDict --- quickstart/fluid-openfoam/system/controlDict | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/quickstart/fluid-openfoam/system/controlDict b/quickstart/fluid-openfoam/system/controlDict index 14be2e5cd..0237a4453 100644 --- a/quickstart/fluid-openfoam/system/controlDict +++ b/quickstart/fluid-openfoam/system/controlDict @@ -7,6 +7,10 @@ FoamFile object controlDict; } +// Note: This file is prepared to run with the latest supported version of OpenFOAM.com. +// The tutorials/tools/run-foam-extend.sh script can modify this and other files to run with foam-extend. +// The format of the file (e.g., linked libraries in one line each) is at parts important to the script. + application pimpleFoam; // latest OpenFOAM // application pimpleDyMFoam; // OpenFOAM v1712, OpenFOAM 5.x, or older @@ -46,16 +50,17 @@ functions { type forces; libs ( "libforces.so" ); + patches (flap); + rho rhoInf; + log true; + rhoInf 10; + // The following entries are only relevant to foam-extend functionObjectLibs ( "libforces.so" ); outputControl timeStep; outputInterval 1; - patches (flap); pName p; UName U; rhoName rhoInf; - rho rhoInf; - log true; - rhoInf 10; CofR (0 0 0); } From fea3aaa274931ecd94eaa3c7dd4baa19e841b085 Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Sat, 13 Sep 2025 22:19:31 +0200 Subject: [PATCH 22/23] Add comments for lines only relevant to foam-extend --- quickstart/fluid-openfoam/0/U | 1 + quickstart/fluid-openfoam/constant/dynamicMeshDict | 2 +- quickstart/fluid-openfoam/system/fvSchemes | 2 +- quickstart/fluid-openfoam/system/fvSolution | 2 ++ quickstart/fluid-openfoam/system/preciceDict | 2 +- 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/quickstart/fluid-openfoam/0/U b/quickstart/fluid-openfoam/0/U index 4200c6ad4..7d1ead131 100644 --- a/quickstart/fluid-openfoam/0/U +++ b/quickstart/fluid-openfoam/0/U @@ -23,6 +23,7 @@ boundaryField { type noSlip; value uniform (0 0 0); + // Note: Values in noSlip are only needed for foam-extend } bottom diff --git a/quickstart/fluid-openfoam/constant/dynamicMeshDict b/quickstart/fluid-openfoam/constant/dynamicMeshDict index b224f9cd8..eb04dd676 100644 --- a/quickstart/fluid-openfoam/constant/dynamicMeshDict +++ b/quickstart/fluid-openfoam/constant/dynamicMeshDict @@ -14,7 +14,7 @@ motionSolverLibs ("libfvMotionSolvers.so"); solver displacementLaplacian; // OpenFOAM9 or newer: rename "solver" to "motionSolver" -diffusivity uniform; +diffusivity uniform; // Only relevant to foam-extend displacementLaplacianCoeffs { diffusivity quadratic inverseDistance (flap); diff --git a/quickstart/fluid-openfoam/system/fvSchemes b/quickstart/fluid-openfoam/system/fvSchemes index 46bb1e015..02b56e6fc 100644 --- a/quickstart/fluid-openfoam/system/fvSchemes +++ b/quickstart/fluid-openfoam/system/fvSchemes @@ -21,7 +21,7 @@ divSchemes { default none; div(phi,U) Gauss linearUpwind grad(U); - div((nuEff*dev(T(grad(U))))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; // Only relevant to foam-extend div((nuEff*dev2(T(grad(U))))) Gauss linear; } diff --git a/quickstart/fluid-openfoam/system/fvSolution b/quickstart/fluid-openfoam/system/fvSolution index e39f7594a..9db2e2313 100644 --- a/quickstart/fluid-openfoam/system/fvSolution +++ b/quickstart/fluid-openfoam/system/fvSolution @@ -14,6 +14,7 @@ solvers tolerance 1e-6; relTol 1e-4; smoother DICGaussSeidel; + // The following entries are only relevant to foam-extend agglomerator faceAreaPair; nCellsInCoarsestLevel 10; mergeLevels 1; @@ -82,6 +83,7 @@ potentialFlow nNonOrthogonalCorrectors 1; } +// The relaxationFactors and fieldBounds are only relevant to foam-extend relaxationFactors { U 0.7; diff --git a/quickstart/fluid-openfoam/system/preciceDict b/quickstart/fluid-openfoam/system/preciceDict index 776af5eda..69e4bfdcc 100644 --- a/quickstart/fluid-openfoam/system/preciceDict +++ b/quickstart/fluid-openfoam/system/preciceDict @@ -36,5 +36,5 @@ interfaces FSI { rho rho [1 -3 0 0 0 0 0] 1000; - nu nu [0 2 -1 0 0 0 0] 0.001; + nu nu [0 2 -1 0 0 0 0] 0.001; // Only relevant to foam-extend } From 6f4053c724af6dfb396813168ae4ece9366255a3 Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Sat, 13 Sep 2025 22:30:26 +0200 Subject: [PATCH 23/23] Add a note in README.md --- quickstart/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/quickstart/README.md b/quickstart/README.md index cd6927202..fd9220e23 100644 --- a/quickstart/README.md +++ b/quickstart/README.md @@ -115,6 +115,12 @@ You can also run OpenFOAM in parallel: `./run.sh -parallel`. In serial, the simulation should take less than a minute to compute (simulated time: 2.5s). +{% note %} +While we recommend starting with the latest OpenFOAM version from openfoam.com, +this case can alternatively be executed with foam-extend. +For that, replace `run-openfoam.sh` with `run-foam-extend.sh` in the `run.sh` script. +{% endnote %} + ## Visualizing the results You can visualize the simulation results of the `Fluid` participant using ParaView and loading the (empty) file `fluid-openfoam/fluid-openfoam.foam`. The rigid body does not generate any readable output files, but the OpenFOAM data should be enough for now: click "play" in ParaView, the flap should already be moving! 🎉