phaseScalarTransport: Improved interface and documentation

This function now looks up an alphaPhi field by default and exits with
an error if the field cannot be found. In order to solve for alphaPhi a
new 'solveAlphaPhi' switch has to be set.

The documentation has been updated to reflect the fact that the VoF
solvers now store all the alphaPhi fluxes necessary for a in-phase
equation to be constructed.

The phaseScalarTransport function has been added to the damBreakLaminar
tutorial.
This commit is contained in:
Will Bainbridge
2023-12-06 12:39:34 +00:00
parent e1d6448fcf
commit 2bc91ecff0
11 changed files with 370 additions and 43 deletions

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 volScalarField;
location "0";
object tracer.air;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [];
internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
wall
{
type zeroGradient;
}
atmosphere
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}
}
// ************************************************************************* //

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 volScalarField;
location "0";
object tracer.water;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [];
internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
wall
{
type zeroGradient;
}
atmosphere
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -6,10 +6,12 @@ cd ${0%/*} || exit 1 # Run from this directory
cleanVoFCase
rm -rf 0 system
find 0 -type f -not -name tracer.* -delete
find constant -type f -not \( \
-name fvModels -or -name momentumTransport \
\) -delete
rm -f system/blockMeshDict
#------------------------------------------------------------------------------

View File

@ -9,10 +9,6 @@ isTest "$@" && path=.. || path=$FOAM_TUTORIALS/incompressibleVoF
cp -rn $path/damBreak/0 $path/damBreak/constant $path/damBreak/system .
rm -f 0/alpha.water
# Increase the number of limiter iterations
runApplication foamDictionary system/fvSolution \
-entry solvers/"alpha.water.*"/nLimiterIter -set 5
# Run
runApplication blockMesh
runApplication setFields

View File

@ -16,12 +16,5 @@ FoamFile
simulationType laminar;
RAS
{
model kEpsilon;
turbulence on;
printCoeffs on;
}
// ************************************************************************* //

View File

@ -0,0 +1,62 @@
/*--------------------------------*- 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 1;
deltaT 0.001;
writeControl adjustableRunTime;
writeInterval 0.05;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep yes;
maxCo 1;
maxAlphaCo 1;
maxDeltaT 1;
functions
{
#includeFunc phaseScalarTransport(field=tracer.water)
#includeFunc phaseScalarTransport(field=tracer.air, residualAlpha=1e-6)
}
// ************************************************************************* //

View File

@ -0,0 +1,58 @@
/*--------------------------------*- 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(phi,k) Gauss upwind;
div(phi,epsilon) Gauss upwind;
div(phi,omega) Gauss upwind;
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
div(alphaPhi,tracer) Gauss vanLeer;
}
laplacianSchemes
{
default Gauss linear uncorrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default uncorrected;
}
// ************************************************************************* //

View File

@ -0,0 +1,90 @@
/*--------------------------------*- 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 5;
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-8;
relTol 0;
}
"pcorr.*"
{
solver PCG;
preconditioner DIC;
tolerance 1e-5;
relTol 0;
}
p_rgh
{
solver PCG;
preconditioner DIC;
tolerance 1e-07;
relTol 0.05;
}
p_rghFinal
{
$p_rgh;
relTol 0;
}
"(U|k|epsilon|omega).*"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-06;
relTol 0;
minIter 1;
}
"tracer.*"
{
solver PBiCGStab;
preconditioner DILU;
tolerance 1e-06;
relTol 0;
}
}
PIMPLE
{
momentumPredictor no;
nOuterCorrectors 1;
nCorrectors 3;
nNonOrthogonalCorrectors 0;
}
relaxationFactors
{
equations
{
".*" 1;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*--------------------------------*- 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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defaultFieldValues
(
volScalarFieldValue alpha.water 0
volScalarFieldValue tracer.water 0
volScalarFieldValue tracer.air 0
);
regions
(
boxToCell
{
box (0 0 -1) (0.1461 0.292 1);
fieldValues
(
volScalarFieldValue alpha.water 1
);
}
boxToCell
{
box (0 0 -1) (0.1461 0.146 1);
fieldValues
(
volScalarFieldValue tracer.water 1
);
}
boxToCell
{
box (0 0.292 -1) (0.1461 0.438 1);
fieldValues
(
volScalarFieldValue tracer.air 1
);
}
);
// ************************************************************************* //