prghCyclicPressure: New cyclic boundary condition for p_rgh

This boundary condition provides a cyclic condition for p_rgh. It applies
corrections to the value and gradient on both sides of the cyclic to
account for the non-cylicity of the gravitational force.

This condition is only needed when the cyclic patches have a transformation
and a normal component in the direction of gravity. If the cyclic patches
are orthogonal to the direction gravity, then a normal cyclic boundary
condition can be used instead.

Care must be taken when using this boundary condition that the simulation
is actually cyclic. The following constraints apply:

- Both cyclic patches must be oriented in the same way with respect to
  gravity. In practice this means that applicability is limited to cyclics
  with translational transformations.

- The model cannot have any dependence on the absolute value of the
  pressure field. The absolute value of the pressure, in reality, varies
  between each repetition of the geometry; it is not actually formally
  cyclic. Only the gradient of the pressure field can be truly cyclic. This
  model is therefore only valid if the absolute value of the pressure is
  arbitrary, and only the gradient has an effect on the solution. This is
  the case for incompressible multiphase solutions or incompressible
  Boussinesq-like models of density variation. It is not true if (for
  example) a compressible thermodynamic model is being used.

Specification is as follows. A "patchType" entry must be provided to
indicate that this condition overrides the underlying cyclic constraint,
and a "rhoInf" entry is needed (by the owner patch only) to specify the
density of the far-field environment. For example:

    cyclicA
    {
        type            prghCyclicPressure;
        patchType       cyclic;
        rhoInf          1; // [kg/m^3]
    }

    cyclicB
    {
        type            prghCyclicPressure;
        patchType       cyclic;
    }

A tutorial, incompressibleVoF/trayedPipe, has been added to demonstrate
usage of this boundary condition.
This commit is contained in:
Will Bainbridge
2024-03-07 11:56:24 +00:00
parent a424c3c684
commit fbfd35dfc4
21 changed files with 1169 additions and 0 deletions

View File

@ -0,0 +1,32 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
wall
{
type noSlip;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,32 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class volScalarField;
location "0";
object alpha.water;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [];
internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
wall
{
type zeroGradient;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class volScalarField;
location "0";
object p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
wall
{
type fixedFluxPressure;
value $internalField;
}
bottom
{
type prghCyclicPressure;
patchType cyclic;
rhoInf 1;
}
top
{
type prghCyclicPressure;
patchType cyclic;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,9 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanVoFCase
#------------------------------------------------------------------------------

View File

@ -0,0 +1,13 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication blockMesh
runApplication topoSet
runApplication createBaffles -overwrite
runApplication setFields
runApplication $(getApplication)
#------------------------------------------------------------------------------

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value (0 -9.81 0);
// ************************************************************************* //

View File

@ -0,0 +1,23 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class uniformDimensionedScalarField;
location "constant";
object hRef;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "$FOAM_CASE/system/blockMeshDict"
dimensions [0 1 0 0 0 0 0];
value #calc "$<scalar>{height}/2";
// ************************************************************************* //

View File

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "constant";
object momentumTransport;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;
// ************************************************************************* //

View File

@ -0,0 +1,22 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "constant";
object phaseProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
phases (water air);
sigma 0.07;
// ************************************************************************* //

View File

@ -0,0 +1,24 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "constant";
object physicalProperties.air;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
viscosityModel constant;
nu 1.48e-05;
rho 1;
// ************************************************************************* //

View File

@ -0,0 +1,24 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "constant";
object physicalProperties.water;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
viscosityModel constant;
nu 1e-06;
rho 1000;
// ************************************************************************* //

View File

@ -0,0 +1,89 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
height 0.045;
radius 0.015;
nCellsPerMetre 2666.67;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
halfThickness #calc "scalar(1)/$<scalar>nCellsPerMetre";
nCellsHeight #calc "round($<scalar>height*$<scalar>nCellsPerMetre)";
nCellsRadius #calc "round($<scalar>radius*$<scalar>nCellsPerMetre)";
convertToMeters 1;
vertices
(
(0 0 0) (0 $height 0)
($radius 0 #neg $halfThickness) ($radius $height #neg $halfThickness)
($radius 0 $halfThickness) ($radius $height $halfThickness)
);
blocks
(
hex (1 0 2 3 1 0 4 5) ($nCellsHeight $nCellsRadius 1) simpleGrading (1 1 1)
);
boundary
(
walls
{
type wall;
faces
(
(2 3 5 4)
);
}
bottom
{
type cyclic;
faces
(
(0 0 2 4)
);
neighbourPatch top;
}
top
{
type cyclic;
faces
(
(1 1 3 5)
);
neighbourPatch bottom;
}
wedgeBack
{
type wedge;
faces
(
(0 1 3 2)
);
}
wedgeFront
{
type wedge;
faces
(
(0 1 5 4)
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,57 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application foamRun;
solver incompressibleVoF;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 2;
deltaT 0.0001;
writeControl adjustableRunTime;
writeInterval 0.005;
purgeWrite 0;
writeFormat binary;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep yes;
maxCo 1;
maxAlphaCo 1;
maxDeltaT 1;
// ************************************************************************* //

View File

@ -0,0 +1,39 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object createBafflesDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
internalFacesOnly true;
baffles
{
wall
{
type faceZone;
zoneName baffles;
owner
{
name baffles;
type wall;
}
neighbour
{
$owner;
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
div(phi,alpha) Gauss interfaceCompression vanLeer 1;
div(rhoPhi,U) Gauss linearUpwind grad(U);
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear uncorrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default uncorrected;
}
// ************************************************************************* //

View File

@ -0,0 +1,74 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
"alpha.water.*"
{
nAlphaCorr 2;
nAlphaSubCycles 1;
MULESCorr yes;
nLimiterIter 3;
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-8;
relTol 0;
}
"pcorr.*"
{
solver PCG;
preconditioner DIC;
tolerance 1e-5;
relTol 0;
}
p_rgh
{
$pcorr;
tolerance 1e-7;
relTol 0.05;
}
p_rghFinal
{
$p_rgh;
relTol 0;
}
}
PIMPLE
{
momentumPredictor no;
nOuterCorrectors 1;
nCorrectors 3;
nNonOrthogonalCorrectors 0;
pRefPoint (0 0.015 0);
pRefValue 0;
}
relaxationFactors
{
equations
{
".*" 1;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
alphaMean 0.25;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "blockMeshDict"
defaultFieldValues
(
volScalarFieldValue alpha.water 0
);
regions
(
cylinderToCell
{
point1 (0 0 0);
point2 (0 $height 0);
radius #calc "$<scalar>radius*sqrt($<scalar>alphaMean)";
fieldValues
(
volScalarFieldValue alpha.water 1
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,128 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nBaffles 6;
baffleOverlap 0.4;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "blockMeshDict"
innerBaffleOuterRadius #calc "$<scalar>{radius}/(2 - $<scalar>baffleOverlap)";
outerBaffleInnerRadius #calc "$radius - $innerBaffleOuterRadius";
actions
(
// Create baffles along the length of the pipe, alternating the zone
// between "innerBaffles" and "outerBaffles"
#codeStream
{
code
#{
for (label i = 0; i < $<label>nBaffles; ++ i)
{
const scalar y =
scalar(2*i + 1)/(2*$<label>nBaffles)*$<scalar>height;
os <<
dictionary
(
"action", i<2 ? "new" : "add",
"type", "faceZoneSet",
"name", word(i%2 ? "inner" : "outer") + "Baffles",
"source", "planeToFaceZone",
"point", vector(0, y, 0),
"normal", vector(0, 1, 0)
);
}
#};
}
// Cut away the outer portion of the inner baffles
{
action new;
type faceSet;
name innerBaffles;
source zoneToFace;
zone innerBaffles;
}
{
action delete;
type faceSet;
name innerBaffles;
source cylinderAnnulusToFace;
point1 (0 0 0);
point2 (0 $height 0);
innerRadius $innerBaffleOuterRadius;
outerRadius $radius;
}
// Cut away the inner portion of the outer baffles
{
action new;
type faceSet;
name outerBaffles;
source zoneToFace;
zone outerBaffles;
}
{
action delete;
type faceSet;
name outerBaffles;
source cylinderToFace;
point1 (0 0 0);
point2 (0 $height 0);
radius $outerBaffleInnerRadius;
}
// Combine inner and outer baffles into a single zone
{
action new;
type faceZoneSet;
name baffles;
source setAndNormalToFaceZone;
set innerBaffles;
normal (0 1 0);
}
{
action add;
type faceZoneSet;
name baffles;
source setAndNormalToFaceZone;
set outerBaffles;
normal (0 1 0);
}
// Clean up
{
action remove;
type faceSet;
name innerBaffles;
}
{
action remove;
type faceSet;
name outerBaffles;
}
{
action remove;
type faceSet;
name baffles;
}
);
// ************************************************************************* //