Skip to content

added tutorial for foam-extend #654

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

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions quickstart/fluid-foam-extend/0/U
Original file line number Diff line number Diff line change
@@ -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;
}
}
49 changes: 49 additions & 0 deletions quickstart/fluid-foam-extend/0/p
Original file line number Diff line number Diff line change
@@ -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;
}
}
50 changes: 50 additions & 0 deletions quickstart/fluid-foam-extend/0/pointDisplacement
Original file line number Diff line number Diff line change
@@ -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;
}
}
6 changes: 6 additions & 0 deletions quickstart/fluid-foam-extend/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
set -e -u

. ../../tools/cleaning-tools.sh

clean_openfoam .
21 changes: 21 additions & 0 deletions quickstart/fluid-foam-extend/constant/dynamicMeshDict
Original file line number Diff line number Diff line change
@@ -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);
}
12 changes: 12 additions & 0 deletions quickstart/fluid-foam-extend/constant/transportProperties
Original file line number Diff line number Diff line change
@@ -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;
9 changes: 9 additions & 0 deletions quickstart/fluid-foam-extend/constant/turbulenceProperties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object turbulenceProperties;
}

simulationType laminar;
13 changes: 13 additions & 0 deletions quickstart/fluid-foam-extend/run.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions quickstart/fluid-foam-extend/system/blockMeshDict
74 changes: 74 additions & 0 deletions quickstart/fluid-foam-extend/system/controlDict
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For easier maintenance, it would be good if this file followed the same order and formatting as the one in fluid-openfoam, so that we can easily take a diff.

Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be needed.


adjustTimeStep no;

maxCo 0.9;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this explicitly needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, without it, it was not running.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I start to wonder if this only applies to the debug version for some reason.

Copy link
Member

@MakisH MakisH Jul 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But is this even a valid combination? If adjustTimeStep is disabled, what effect should maxCo have? We could still set one with a comment that it is not used and only there for compatibility reasons.


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
}
}
24 changes: 24 additions & 0 deletions quickstart/fluid-foam-extend/system/decomposeParDict
Original file line number Diff line number Diff line change
@@ -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
(
);

40 changes: 40 additions & 0 deletions quickstart/fluid-foam-extend/system/fvSchemes
Original file line number Diff line number Diff line change
@@ -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;
}
Loading