Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
HPCAPPs
OpenFOAM-GPU-v2.0
Commits
ea17556c
Commit
ea17556c
authored
Mar 07, 2024
by
shunbo
Browse files
Initial commit
parents
Changes
798
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1660 additions
and
0 deletions
+1660
-0
applications/solvers/multiphase/MPPICInterFoam/Allwmake
applications/solvers/multiphase/MPPICInterFoam/Allwmake
+9
-0
applications/solvers/multiphase/MPPICInterFoam/MPPICInterFoam.C
...ations/solvers/multiphase/MPPICInterFoam/MPPICInterFoam.C
+185
-0
applications/solvers/multiphase/MPPICInterFoam/Make/files
applications/solvers/multiphase/MPPICInterFoam/Make/files
+3
-0
applications/solvers/multiphase/MPPICInterFoam/Make/options
applications/solvers/multiphase/MPPICInterFoam/Make/options
+44
-0
applications/solvers/multiphase/MPPICInterFoam/UEqn.H
applications/solvers/multiphase/MPPICInterFoam/UEqn.H
+50
-0
applications/solvers/multiphase/MPPICInterFoam/alphaEqn.H
applications/solvers/multiphase/MPPICInterFoam/alphaEqn.H
+266
-0
applications/solvers/multiphase/MPPICInterFoam/alphaEqnSubCycle.H
...ions/solvers/multiphase/MPPICInterFoam/alphaEqnSubCycle.H
+42
-0
applications/solvers/multiphase/MPPICInterFoam/compressibleTwoPhaseMixtureTurbulenceModels/Make/files
...am/compressibleTwoPhaseMixtureTurbulenceModels/Make/files
+3
-0
applications/solvers/multiphase/MPPICInterFoam/compressibleTwoPhaseMixtureTurbulenceModels/Make/options
.../compressibleTwoPhaseMixtureTurbulenceModels/Make/options
+25
-0
applications/solvers/multiphase/MPPICInterFoam/compressibleTwoPhaseMixtureTurbulenceModels/compressibleTwoPhaseMixtureTurbulenceModels.C
...lenceModels/compressibleTwoPhaseMixtureTurbulenceModels.C
+96
-0
applications/solvers/multiphase/MPPICInterFoam/continuityErrs.H
...ations/solvers/multiphase/MPPICInterFoam/continuityErrs.H
+50
-0
applications/solvers/multiphase/MPPICInterFoam/correctPhi.H
applications/solvers/multiphase/MPPICInterFoam/correctPhi.H
+11
-0
applications/solvers/multiphase/MPPICInterFoam/createFields.H
...ications/solvers/multiphase/MPPICInterFoam/createFields.H
+203
-0
applications/solvers/multiphase/MPPICInterFoam/pEqn.H
applications/solvers/multiphase/MPPICInterFoam/pEqn.H
+73
-0
applications/solvers/multiphase/VoF/alphaCourantNo.H
applications/solvers/multiphase/VoF/alphaCourantNo.H
+59
-0
applications/solvers/multiphase/VoF/alphaEqn.H
applications/solvers/multiphase/VoF/alphaEqn.H
+268
-0
applications/solvers/multiphase/VoF/alphaEqnSubCycle.H
applications/solvers/multiphase/VoF/alphaEqnSubCycle.H
+41
-0
applications/solvers/multiphase/VoF/createAlphaFluxes.H
applications/solvers/multiphase/VoF/createAlphaFluxes.H
+41
-0
applications/solvers/multiphase/VoF/setDeltaT.H
applications/solvers/multiphase/VoF/setDeltaT.H
+55
-0
applications/solvers/multiphase/VoF/setRDeltaT.H
applications/solvers/multiphase/VoF/setRDeltaT.H
+136
-0
No files found.
Too many changes to show.
To preserve performance only
798 of 798+
files are displayed.
Plain diff
Email patch
applications/solvers/multiphase/MPPICInterFoam/Allwmake
0 → 100644
View file @
ea17556c
#!/bin/sh
cd
"
${
0
%/*
}
"
||
exit
# Run from this directory
.
${
WM_PROJECT_DIR
:?
}
/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
wmake
$targetType
compressibleTwoPhaseMixtureTurbulenceModels
wmake
$targetType
#------------------------------------------------------------------------------
applications/solvers/multiphase/MPPICInterFoam/MPPICInterFoam.C
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
MPPICInterFoam
Description
Solver for two incompressible, isothermal immiscible fluids using a VOF
(volume of fluid) phase-fraction based interface capturing approach.
The momentum and other fluid properties are of the "mixture" and a single
momentum equation is solved.
It includes MRF and an MPPIC cloud.
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "CMULES.H"
#include "EulerDdtScheme.H"
#include "localEulerDdtScheme.H"
#include "CrankNicolsonDdtScheme.H"
#include "subCycle.H"
#include "immiscibleIncompressibleTwoPhaseMixture.H"
#include "PhaseCompressibleTurbulenceModel.H"
#include "pimpleControl.H"
#include "fvOptions.H"
#include "CorrectPhi.H"
#include "fvcSmooth.H"
#include "basicKinematicCloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Solver for two incompressible, isothermal immiscible fluids using"
" VOF phase-fraction based interface capturing.
\n
"
"Includes MRF and an MPPIC cloud."
);
#include "postProcess.H"
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
#include "createControl.H"
#include "createTimeControls.H"
#include "initContinuityErrs.H"
#include "createFields.H"
#include "createAlphaFluxes.H"
#include "createFvOptions.H"
#include "correctPhi.H"
turbulence
->
validate
();
if
(
!
LTS
)
{
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setInitialDeltaT.H"
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
"
\n
Starting time loop
\n
"
<<
endl
;
while
(
runTime
.
run
())
{
#include "readTimeControls.H"
if
(
LTS
)
{
#include "setRDeltaT.H"
}
else
{
#include "CourantNo.H"
#include "alphaCourantNo.H"
#include "setDeltaT.H"
}
++
runTime
;
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
Info
<<
"Evolving "
<<
kinematicCloud
.
name
()
<<
endl
;
kinematicCloud
.
evolve
();
// Update continuous phase volume fraction field
alphac
=
max
(
1
.
0
-
kinematicCloud
.
theta
(),
alphacMin
);
alphac
.
correctBoundaryConditions
();
Info
<<
"Continuous phase-1 volume fraction = "
<<
alphac
.
weightedAverage
(
mesh
.
Vsc
()).
value
()
<<
" Min(alphac) = "
<<
min
(
alphac
).
value
()
<<
" Max(alphac) = "
<<
max
(
alphac
).
value
()
<<
endl
;
alphacf
=
fvc
::
interpolate
(
alphac
);
alphaRhoPhic
=
alphacf
*
rhoPhi
;
alphaPhic
=
alphacf
*
phi
;
alphacRho
=
alphac
*
rho
;
fvVectorMatrix
cloudSU
(
kinematicCloud
.
SU
(
U
));
volVectorField
cloudVolSUSu
(
IOobject
(
"cloudVolSUSu"
,
runTime
.
timeName
(),
mesh
),
mesh
,
dimensionedVector
(
cloudSU
.
dimensions
()
/
dimVolume
,
Zero
),
zeroGradientFvPatchVectorField
::
typeName
);
cloudVolSUSu
.
primitiveFieldRef
()
=
-
cloudSU
.
source
()
/
mesh
.
V
();
cloudVolSUSu
.
correctBoundaryConditions
();
cloudSU
.
source
()
=
vector
::
zero
;
// --- Pressure-velocity PIMPLE corrector loop
while
(
pimple
.
loop
())
{
#include "alphaControls.H"
#include "alphaEqnSubCycle.H"
mixture
.
correct
();
#include "UEqn.H"
// --- Pressure corrector loop
while
(
pimple
.
correct
())
{
#include "pEqn.H"
}
if
(
pimple
.
turbCorr
())
{
turbulence
->
correct
();
}
}
runTime
.
write
();
runTime
.
printExecutionTime
(
Info
);
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/solvers/multiphase/MPPICInterFoam/Make/files
0 → 100644
View file @
ea17556c
MPPICInterFoam.C
EXE = $(FOAM_APPBIN)/MPPICInterFoam
applications/solvers/multiphase/MPPICInterFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-I../VoF \
-I$(FOAM_SOLVERS)/multiphase/interFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude \
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
-I$(LIB_SRC)/regionFaModels/lnInclude \
-I$(LIB_SRC)/faOptions/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
-llagrangian \
-llagrangianIntermediate \
-lthermophysicalProperties \
-lspecie \
-lincompressibleTransportModels \
-limmiscibleIncompressibleTwoPhaseMixture \
-linterfaceProperties \
-lturbulenceModels \
-lsampling \
-lregionModels \
-lsurfaceFilmModels \
-lcompressibleTwoPhaseMixtureTurbulenceModels
applications/solvers/multiphase/MPPICInterFoam/UEqn.H
0 → 100644
View file @
ea17556c
MRF
.
correctBoundaryVelocity
(
U
);
fvVectorMatrix
UEqn
(
fvm
::
ddt
(
alphacRho
,
U
)
+
MRF
.
DDt
(
alphacRho
,
U
)
-
fvm
::
Sp
(
fvc
::
ddt
(
rho
)
+
fvc
::
div
(
rhoPhi
),
U
)
+
fvm
::
div
(
rhoPhi
,
U
)
+
turbulence
->
divDevRhoReff
(
U
)
==
fvOptions
(
rho
,
U
)
+
cloudSU
);
UEqn
.
relax
();
fvOptions
.
constrain
(
UEqn
);
volScalarField
rAUc
(
1
.
0
/
UEqn
.
A
());
surfaceScalarField
rAUcf
(
fvc
::
interpolate
(
rAUc
));
surfaceScalarField
phicForces
(
(
fvc
::
interpolate
(
rAUc
*
cloudVolSUSu
)
&
mesh
.
Sf
())
);
if
(
pimple
.
momentumPredictor
())
{
solve
(
UEqn
==
fvc
::
reconstruct
(
phicForces
/
rAUcf
+
(
fvc
::
interpolate
(
mixture
.
sigmaK
()
)
*
fvc
::
snGrad
(
alpha1
)
-
ghf
*
fvc
::
snGrad
(
rho
)
-
fvc
::
snGrad
(
p_rgh
)
)
*
mesh
.
magSf
()
)
);
fvOptions
.
correct
(
U
);
}
applications/solvers/multiphase/MPPICInterFoam/alphaEqn.H
0 → 100644
View file @
ea17556c
{
word
alphaScheme
(
"div(phi,alpha)"
);
word
alpharScheme
(
"div(phirb,alpha)"
);
// Set the off-centering coefficient according to ddt scheme
scalar
ocCoeff
=
0
;
{
tmp
<
fv
::
ddtScheme
<
scalar
>>
tddtAlpha
(
fv
::
ddtScheme
<
scalar
>::
New
(
mesh
,
mesh
.
ddtScheme
(
"ddt(alpha)"
)
)
);
const
fv
::
ddtScheme
<
scalar
>&
ddtAlpha
=
tddtAlpha
();
if
(
isType
<
fv
::
EulerDdtScheme
<
scalar
>>
(
ddtAlpha
)
||
isType
<
fv
::
localEulerDdtScheme
<
scalar
>>
(
ddtAlpha
)
)
{
ocCoeff
=
0
;
}
else
if
(
isType
<
fv
::
CrankNicolsonDdtScheme
<
scalar
>>
(
ddtAlpha
))
{
if
(
nAlphaSubCycles
>
1
)
{
FatalErrorInFunction
<<
"Sub-cycling is not supported "
"with the CrankNicolson ddt scheme"
<<
exit
(
FatalError
);
}
if
(
alphaRestart
||
mesh
.
time
().
timeIndex
()
>
mesh
.
time
().
startTimeIndex
()
+
1
)
{
ocCoeff
=
refCast
<
const
fv
::
CrankNicolsonDdtScheme
<
scalar
>>
(
ddtAlpha
)
.
ocCoeff
();
}
}
else
{
FatalErrorInFunction
<<
"Only Euler and CrankNicolson ddt schemes are supported"
<<
exit
(
FatalError
);
}
}
// Set the time blending factor, 1 for Euler
scalar
cnCoeff
=
1
.
0
/
(
1
.
0
+
ocCoeff
);
// Standard face-flux compression coefficient
surfaceScalarField
phic
(
mixture
.
cAlpha
()
*
mag
(
alphaPhic
/
mesh
.
magSf
()));
// Add the optional isotropic compression contribution
if
(
icAlpha
>
0
)
{
phic
*=
(
1
.
0
-
icAlpha
);
phic
+=
(
mixture
.
cAlpha
()
*
icAlpha
)
*
fvc
::
interpolate
(
mag
(
U
));
}
// Add the optional shear compression contribution
if
(
scAlpha
>
0
)
{
phic
+=
scAlpha
*
mag
(
mesh
.
delta
()
&
fvc
::
interpolate
(
symm
(
fvc
::
grad
(
U
))));
}
surfaceScalarField
::
Boundary
&
phicBf
=
phic
.
boundaryFieldRef
();
// Do not compress interface at non-coupled boundary faces
// (inlets, outlets etc.)
forAll
(
phic
.
boundaryField
(),
patchi
)
{
fvsPatchScalarField
&
phicp
=
phicBf
[
patchi
];
if
(
!
phicp
.
coupled
())
{
phicp
==
0
;
}
}
tmp
<
surfaceScalarField
>
phiCN
(
alphaPhic
);
// Calculate the Crank-Nicolson off-centred volumetric flux
if
(
ocCoeff
>
0
)
{
phiCN
=
cnCoeff
*
alphaPhic
+
(
1
.
0
-
cnCoeff
)
*
alphaPhic
.
oldTime
();
}
if
(
MULESCorr
)
{
#include "alphaSuSp.H"
fvScalarMatrix
alpha1Eqn
(
(
LTS
?
fv
::
localEulerDdtScheme
<
scalar
>
(
mesh
).
fvmDdt
(
alphac
,
alpha1
)
:
fv
::
EulerDdtScheme
<
scalar
>
(
mesh
).
fvmDdt
(
alpha1
)
)
+
fv
::
gaussConvectionScheme
<
scalar
>
(
mesh
,
phiCN
,
upwind
<
scalar
>
(
mesh
,
phiCN
)
).
fvmDiv
(
phiCN
,
alpha1
)
-
fvm
::
Sp
(
fvc
::
ddt
(
alphac
)
+
fvc
::
div
(
phiCN
),
alpha1
)
==
Su
+
fvm
::
Sp
(
Sp
+
divU
,
alpha1
)
);
alpha1Eqn
.
solve
();
Info
<<
"Phase-1 volume fraction = "
<<
alpha1
.
weightedAverage
(
mesh
.
Vsc
()).
value
()
<<
" Min("
<<
alpha1
.
name
()
<<
") = "
<<
min
(
alpha1
).
value
()
<<
" Max("
<<
alpha1
.
name
()
<<
") = "
<<
max
(
alpha1
).
value
()
<<
endl
;
tmp
<
surfaceScalarField
>
talphaPhi1UD
(
alpha1Eqn
.
flux
());
alphaPhi10
=
talphaPhi1UD
();
if
(
alphaApplyPrevCorr
&&
talphaPhi1Corr0
.
valid
())
{
Info
<<
"Applying the previous iteration compression flux"
<<
endl
;
MULES
::
correct
(
alphac
,
alpha1
,
alphaPhi10
,
talphaPhi1Corr0
.
ref
(),
zeroField
(),
zeroField
(),
oneField
(),
zeroField
()
);
alphaPhi10
+=
talphaPhi1Corr0
();
}
// Cache the upwind-flux
talphaPhi1Corr0
=
talphaPhi1UD
;
alpha2
=
1
.
0
-
alpha1
;
mixture
.
correct
();
}
for
(
int
aCorr
=
0
;
aCorr
<
nAlphaCorr
;
aCorr
++
)
{
#include "alphaSuSp.H"
surfaceScalarField
phir
(
phic
*
mixture
.
nHatf
());
tmp
<
surfaceScalarField
>
talphaPhi1Un
(
fvc
::
flux
(
phiCN
(),
cnCoeff
*
alpha1
+
(
1
.
0
-
cnCoeff
)
*
alpha1
.
oldTime
(),
alphaScheme
)
+
fvc
::
flux
(
-
fvc
::
flux
(
-
phir
,
alpha2
,
alpharScheme
),
alpha1
,
alpharScheme
)
);
if
(
MULESCorr
)
{
tmp
<
surfaceScalarField
>
talphaPhi1Corr
(
talphaPhi1Un
()
-
alphaPhi10
);
volScalarField
alpha10
(
"alpha10"
,
alpha1
);
MULES
::
correct
(
alphac
,
alpha1
,
talphaPhi1Un
(),
talphaPhi1Corr
.
ref
(),
Sp
,
(
-
Sp
*
alpha1
)(),
oneField
(),
zeroField
()
);
// Under-relax the correction for all but the 1st corrector
if
(
aCorr
==
0
)
{
alphaPhi10
+=
talphaPhi1Corr
();
}
else
{
alpha1
=
0
.
5
*
alpha1
+
0
.
5
*
alpha10
;
alphaPhi10
+=
0
.
5
*
talphaPhi1Corr
();
}
}
else
{
alphaPhi10
=
talphaPhi1Un
;
MULES
::
explicitSolve
(
alphac
,
alpha1
,
phiCN
,
alphaPhi10
,
Sp
,
(
Su
+
divU
*
min
(
alpha1
(),
scalar
(
1
)))(),
oneField
(),
zeroField
()
);
}
alpha2
=
1
.
0
-
alpha1
;
mixture
.
correct
();
}
if
(
alphaApplyPrevCorr
&&
MULESCorr
)
{
talphaPhi1Corr0
=
alphaPhi10
-
talphaPhi1Corr0
;
talphaPhi1Corr0
.
ref
().
rename
(
"alphaPhi1Corr0"
);
}
else
{
talphaPhi1Corr0
.
clear
();
}
if
(
word
(
mesh
.
ddtScheme
(
"ddt(rho,U)"
))
==
fv
::
EulerDdtScheme
<
vector
>::
typeName
)
{
#include "rhofs.H"
rhoPhi
=
alphaPhi10
*
(
rho1f
-
rho2f
)
+
phiCN
*
rho2f
;
}
else
{
if
(
ocCoeff
>
0
)
{
// Calculate the end-of-time-step alpha flux
alphaPhi10
=
(
alphaPhi10
-
(
1
.
0
-
cnCoeff
)
*
alphaPhi10
.
oldTime
())
/
cnCoeff
;
}
// Calculate the end-of-time-step mass flux
#include "rhofs.H"
rhoPhi
=
alphaPhi10
*
(
rho1f
-
rho2f
)
+
alphaPhic
*
rho2f
;
}
Info
<<
"Phase-1 volume fraction = "
<<
alpha1
.
weightedAverage
(
mesh
.
Vsc
()).
value
()
<<
" Min("
<<
alpha1
.
name
()
<<
") = "
<<
min
(
alpha1
).
value
()
<<
" Max("
<<
alpha1
.
name
()
<<
") = "
<<
max
(
alpha1
).
value
()
<<
endl
;
}
applications/solvers/multiphase/MPPICInterFoam/alphaEqnSubCycle.H
0 → 100644
View file @
ea17556c
if
(
nAlphaSubCycles
>
1
)
{
dimensionedScalar
totalDeltaT
=
runTime
.
deltaT
();
surfaceScalarField
rhoPhiSum
(
IOobject
(
"rhoPhiSum"
,
runTime
.
timeName
(),
mesh
),
mesh
,
dimensionedScalar
(
rhoPhi
.
dimensions
(),
Zero
)
);
tmp
<
volScalarField
>
trSubDeltaT
;
if
(
LTS
)
{
trSubDeltaT
=
fv
::
localEulerDdt
::
localRSubDeltaT
(
mesh
,
nAlphaSubCycles
);
}
for
(
subCycle
<
volScalarField
>
alphaSubCycle
(
alpha1
,
nAlphaSubCycles
);
!
(
++
alphaSubCycle
).
end
();
)
{
#include "alphaEqn.H"
rhoPhiSum
+=
(
runTime
.
deltaT
()
/
totalDeltaT
)
*
rhoPhi
;
}
rhoPhi
=
rhoPhiSum
;
}
else
{
#include "alphaEqn.H"
}
rho
==
alpha1
*
rho1
+
alpha2
*
rho2
;
mu
=
mixture
.
mu
();
applications/solvers/multiphase/MPPICInterFoam/compressibleTwoPhaseMixtureTurbulenceModels/Make/files
0 → 100644
View file @
ea17556c
compressibleTwoPhaseMixtureTurbulenceModels.C
LIB = $(FOAM_LIBBIN)/libcompressibleTwoPhaseMixtureTurbulenceModels
applications/solvers/multiphase/MPPICInterFoam/compressibleTwoPhaseMixtureTurbulenceModels/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-lmeshTools \
-lincompressibleTransportModels \
-limmiscibleIncompressibleTwoPhaseMixture \
-linterfaceProperties \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels
applications/solvers/multiphase/MPPICInterFoam/compressibleTwoPhaseMixtureTurbulenceModels/compressibleTwoPhaseMixtureTurbulenceModels.C
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "PhaseCompressibleTurbulenceModel.H"
#include "immiscibleIncompressibleTwoPhaseMixture.H"
#include "addToRunTimeSelectionTable.H"
#include "makeTurbulenceModel.H"
#include "turbulentTransportModel.H"
#include "LESModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTurbulenceModelTypes
(
volScalarField
,
geometricOneField
,
incompressibleTurbulenceModel
,
PhaseCompressibleTurbulenceModel
,
immiscibleIncompressibleTwoPhaseMixture
);
makeBaseTurbulenceModel
(
volScalarField
,
volScalarField
,
compressibleTurbulenceModel
,
PhaseCompressibleTurbulenceModel
,
immiscibleIncompressibleTwoPhaseMixture
);
#define makeLaminarModel(Type) \
makeTemplatedTurbulenceModel \
( \
immiscibleIncompressibleTwoPhaseMixturePhaseCompressibleTurbulenceModel,\
laminar, \
Type \
)
#define makeRASModel(Type) \
makeTemplatedTurbulenceModel \
( \
immiscibleIncompressibleTwoPhaseMixturePhaseCompressibleTurbulenceModel,\
RAS, \
Type \
)
#define makeLESModel(Type) \
makeTemplatedTurbulenceModel \
( \
immiscibleIncompressibleTwoPhaseMixturePhaseCompressibleTurbulenceModel,\
LES, \
Type \
)
#include "Stokes.H"
makeLaminarModel
(
Stokes
);
#include "kEpsilon.H"
makeRASModel
(
kEpsilon
);
#include "Smagorinsky.H"
makeLESModel
(
Smagorinsky
);
#include "kEqn.H"
makeLESModel
(
kEqn
);
#include "kOmega.H"
makeRASModel
(
kOmega
);
// ************************************************************************* //
applications/solvers/multiphase/MPPICInterFoam/continuityErrs.H
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Global
continuityErrs
Description
Calculates and prints the continuity errors.
\*---------------------------------------------------------------------------*/
{
volScalarField
contErr
(
fvc
::
ddt
(
alphac
)
+
fvc
::
div
(
alphacf
*
phi
));
scalar
sumLocalContErr
=
runTime
.
deltaTValue
()
*
mag
(
contErr
)().
weightedAverage
(
mesh
.
V
()).
value
();
scalar
globalContErr
=
runTime
.
deltaTValue
()
*
contErr
.
weightedAverage
(
mesh
.
V
()).
value
();
cumulativeContErr
+=
globalContErr
;
Info
<<
"time step continuity errors : sum local = "
<<
sumLocalContErr
<<
", global = "
<<
globalContErr
<<
", cumulative = "
<<
cumulativeContErr
<<
endl
;
}
// ************************************************************************* //
applications/solvers/multiphase/MPPICInterFoam/correctPhi.H
0 → 100644
View file @
ea17556c
CorrectPhi
(
U
,
phi
,
p_rgh
,
dimensionedScalar
(
"rAUf"
,
dimTime
/
rho
.
dimensions
(),
1
),
geometricZeroField
(),
pimple
);
#include "continuityErrs.H"
applications/solvers/multiphase/MPPICInterFoam/createFields.H
0 → 100644
View file @
ea17556c
#include "createRDeltaT.H"
Info
<<
"Reading field p_rgh
\n
"
<<
endl
;
volScalarField
p_rgh
(
IOobject
(
"p_rgh"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
Info
<<
"Reading field U
\n
"
<<
endl
;
volVectorField
U
(
IOobject
(
"U"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
#include "createPhi.H"
Info
<<
"Reading transportProperties
\n
"
<<
endl
;
immiscibleIncompressibleTwoPhaseMixture
mixture
(
U
,
phi
);
volScalarField
&
alpha1
(
mixture
.
alpha1
());
volScalarField
&
alpha2
(
mixture
.
alpha2
());
const
dimensionedScalar
&
rho1
=
mixture
.
rho1
();
const
dimensionedScalar
&
rho2
=
mixture
.
rho2
();
// Need to store rho for ddt(rho, U)
volScalarField
rho
(
IOobject
(
"rho"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
READ_IF_PRESENT
,
IOobject
::
AUTO_WRITE
),
alpha1
*
rho1
+
alpha2
*
rho2
);
rho
.
oldTime
();
// Need to store mu as incompressibleTwoPhaseMixture does not store it
volScalarField
mu
(
IOobject
(
"mu"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
READ_IF_PRESENT
),
mixture
.
mu
(),
calculatedFvPatchScalarField
::
typeName
);
// Mass flux
surfaceScalarField
rhoPhi
(
IOobject
(
"rhoPhi"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
fvc
::
interpolate
(
rho
)
*
phi
);
#include "readGravitationalAcceleration.H"
#include "readhRef.H"
#include "gh.H"
volScalarField
p
(
IOobject
(
"p"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
p_rgh
+
rho
*
gh
);
label
pRefCell
=
0
;
scalar
pRefValue
=
0
.
0
;
setRefCell
(
p
,
p_rgh
,
mesh
.
solutionDict
().
subDict
(
"PIMPLE"
),
pRefCell
,
pRefValue
);
if
(
p_rgh
.
needReference
())
{
p
+=
dimensionedScalar
(
"p"
,
p
.
dimensions
(),
pRefValue
-
getRefCellValue
(
p
,
pRefCell
)
);
p_rgh
=
p
-
rho
*
gh
;
}
mesh
.
setFluxRequired
(
p_rgh
.
name
());
mesh
.
setFluxRequired
(
alpha1
.
name
());
// alphac must be constructed before the cloud
// so that the drag-models can find it
volScalarField
alphac
(
IOobject
(
"alphac"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
READ_IF_PRESENT
,
IOobject
::
AUTO_WRITE
),
mesh
,
dimensionedScalar
(
dimless
,
Zero
),
zeroGradientFvPatchScalarField
::
typeName
);
alphac
.
oldTime
();
volScalarField
alphacRho
(
alphac
*
rho
);
alphacRho
.
oldTime
();
Info
<<
"Constructing kinematicCloud "
<<
endl
;
basicKinematicCloud
kinematicCloud
(
"kinematicCloud"
,
rho
,
U
,
mu
,
g
);
// Particle fraction upper limit
scalar
alphacMin
(
1
.
0
-
(
kinematicCloud
.
particleProperties
().
subDict
(
"constantProperties"
)
.
get
<
scalar
>
(
"alphaMax"
)
)
);
// Update alphac from the particle locations
alphac
=
max
(
1
.
0
-
kinematicCloud
.
theta
(),
alphacMin
);
alphac
.
correctBoundaryConditions
();
surfaceScalarField
alphacf
(
"alphacf"
,
fvc
::
interpolate
(
alphac
));
// Phase mass flux
surfaceScalarField
alphaRhoPhic
(
"alphaRhoPhic"
,
alphacf
*
rhoPhi
);
// Volumetric phase flux
surfaceScalarField
alphaPhic
(
"alphaPhic"
,
alphacf
*
phi
);
autoPtr
<
PhaseCompressibleTurbulenceModel
<
immiscibleIncompressibleTwoPhaseMixture
>
>
turbulence
(
PhaseCompressibleTurbulenceModel
<
immiscibleIncompressibleTwoPhaseMixture
>::
New
(
alphac
,
rho
,
U
,
alphaRhoPhic
,
rhoPhi
,
mixture
)
);
#include "createMRF.H"
applications/solvers/multiphase/MPPICInterFoam/pEqn.H
0 → 100644
View file @
ea17556c
{
volVectorField
HbyA
(
constrainHbyA
(
rAUc
*
UEqn
.
H
(),
U
,
p_rgh
));
surfaceScalarField
phiHbyA
(
"phiHbyA"
,
fvc
::
flux
(
HbyA
)
+
alphacf
*
fvc
::
interpolate
(
rho
*
rAUc
)
*
fvc
::
ddtCorr
(
U
,
phi
)
);
MRF
.
makeRelative
(
phiHbyA
);
adjustPhi
(
phiHbyA
,
U
,
p_rgh
);
surfaceScalarField
phig
(
phicForces
+
(
fvc
::
interpolate
(
mixture
.
sigmaK
())
*
fvc
::
snGrad
(
alpha1
)
-
ghf
*
fvc
::
snGrad
(
rho
)
)
*
rAUcf
*
mesh
.
magSf
()
);
phiHbyA
+=
phig
;
// Update the pressure BCs to ensure flux consistency
constrainPressure
(
p_rgh
,
U
,
phiHbyA
,
rAUcf
,
MRF
);
while
(
pimple
.
correctNonOrthogonal
())
{
surfaceScalarField
Dp
(
"Dp"
,
alphacf
*
rAUcf
);
fvScalarMatrix
p_rghEqn
(
fvm
::
laplacian
(
Dp
,
p_rgh
)
==
fvc
::
ddt
(
alphac
)
+
fvc
::
div
(
alphacf
*
phiHbyA
)
);
p_rghEqn
.
setReference
(
pRefCell
,
getRefCellValue
(
p_rgh
,
pRefCell
));
p_rghEqn
.
solve
(
mesh
.
solver
(
p_rgh
.
select
(
pimple
.
finalInnerIter
())));
if
(
pimple
.
finalNonOrthogonalIter
())
{
phi
=
phiHbyA
-
p_rghEqn
.
flux
()
/
alphacf
;
p_rgh
.
relax
();
U
=
HbyA
+
rAUc
*
fvc
::
reconstruct
((
phig
-
p_rghEqn
.
flux
()
/
alphacf
)
/
rAUcf
);
U
.
correctBoundaryConditions
();
fvOptions
.
correct
(
U
);
}
}
#include "continuityErrs.H"
p
==
p_rgh
+
rho
*
gh
;
if
(
p_rgh
.
needReference
())
{
p
+=
dimensionedScalar
(
"p"
,
p
.
dimensions
(),
pRefValue
-
getRefCellValue
(
p
,
pRefCell
)
);
p_rgh
=
p
-
rho
*
gh
;
}
}
applications/solvers/multiphase/VoF/alphaCourantNo.H
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Global
alphaCourantNo
Description
Calculates and outputs the mean and maximum Courant Numbers.
\*---------------------------------------------------------------------------*/
scalar
maxAlphaCo
(
runTime
.
controlDict
().
get
<
scalar
>
(
"maxAlphaCo"
)
);
scalar
alphaCoNum
=
0
.
0
;
scalar
meanAlphaCoNum
=
0
.
0
;
if
(
mesh
.
nInternalFaces
())
{
scalarField
sumPhi
(
mixture
.
nearInterface
()().
primitiveField
()
*
fvc
::
surfaceSum
(
mag
(
phi
))().
primitiveField
()
);
alphaCoNum
=
0
.
5
*
gMax
(
sumPhi
/
mesh
.
V
().
field
())
*
runTime
.
deltaTValue
();
meanAlphaCoNum
=
0
.
5
*
(
gSum
(
sumPhi
)
/
gSum
(
mesh
.
V
().
field
()))
*
runTime
.
deltaTValue
();
}
Info
<<
"Interface Courant Number mean: "
<<
meanAlphaCoNum
<<
" max: "
<<
alphaCoNum
<<
endl
;
// ************************************************************************* //
applications/solvers/multiphase/VoF/alphaEqn.H
0 → 100644
View file @
ea17556c
{
word
alphaScheme
(
"div(phi,alpha)"
);
word
alpharScheme
(
"div(phirb,alpha)"
);
// Set the off-centering coefficient according to ddt scheme
scalar
ocCoeff
=
0
;
{
tmp
<
fv
::
ddtScheme
<
scalar
>>
tddtAlpha
(
fv
::
ddtScheme
<
scalar
>::
New
(
mesh
,
mesh
.
ddtScheme
(
"ddt(alpha)"
)
)
);
const
fv
::
ddtScheme
<
scalar
>&
ddtAlpha
=
tddtAlpha
();
if
(
isType
<
fv
::
EulerDdtScheme
<
scalar
>>
(
ddtAlpha
)
||
isType
<
fv
::
localEulerDdtScheme
<
scalar
>>
(
ddtAlpha
)
)
{
ocCoeff
=
0
;
}
else
if
(
isType
<
fv
::
CrankNicolsonDdtScheme
<
scalar
>>
(
ddtAlpha
))
{
if
(
nAlphaSubCycles
>
1
)
{
FatalErrorInFunction
<<
"Sub-cycling is not supported "
"with the CrankNicolson ddt scheme"
<<
exit
(
FatalError
);
}
if
(
alphaRestart
||
mesh
.
time
().
timeIndex
()
>
mesh
.
time
().
startTimeIndex
()
+
1
)
{
ocCoeff
=
refCast
<
const
fv
::
CrankNicolsonDdtScheme
<
scalar
>>
(
ddtAlpha
)
.
ocCoeff
();
}
}
else
{
FatalErrorInFunction
<<
"Only Euler and CrankNicolson ddt schemes are supported"
<<
exit
(
FatalError
);
}
}
// Set the time blending factor, 1 for Euler
scalar
cnCoeff
=
1
.
0
/
(
1
.
0
+
ocCoeff
);
// Standard face-flux compression coefficient
surfaceScalarField
phic
(
mixture
.
cAlpha
()
*
mag
(
phi
/
mesh
.
magSf
()));
// Add the optional isotropic compression contribution
if
(
icAlpha
>
0
)
{
phic
*=
(
1
.
0
-
icAlpha
);
phic
+=
(
mixture
.
cAlpha
()
*
icAlpha
)
*
fvc
::
interpolate
(
mag
(
U
));
}
// Add the optional shear compression contribution
if
(
scAlpha
>
0
)
{
phic
+=
scAlpha
*
mag
(
mesh
.
delta
()
&
fvc
::
interpolate
(
symm
(
fvc
::
grad
(
U
))));
}
surfaceScalarField
::
Boundary
&
phicBf
=
phic
.
boundaryFieldRef
();
// Do not compress interface at non-coupled boundary faces
// (inlets, outlets etc.)
forAll
(
phic
.
boundaryField
(),
patchi
)
{
fvsPatchScalarField
&
phicp
=
phicBf
[
patchi
];
if
(
!
phicp
.
coupled
())
{
phicp
==
0
;
}
}
tmp
<
surfaceScalarField
>
phiCN
(
phi
);
// Calculate the Crank-Nicolson off-centred volumetric flux
if
(
ocCoeff
>
0
)
{
phiCN
=
cnCoeff
*
phi
+
(
1
.
0
-
cnCoeff
)
*
phi
.
oldTime
();
}
if
(
MULESCorr
)
{
#include "alphaSuSp.H"
fvScalarMatrix
alpha1Eqn
(
(
LTS
?
fv
::
localEulerDdtScheme
<
scalar
>
(
mesh
).
fvmDdt
(
alpha1
)
:
fv
::
EulerDdtScheme
<
scalar
>
(
mesh
).
fvmDdt
(
alpha1
)
)
+
fv
::
gaussConvectionScheme
<
scalar
>
(
mesh
,
phiCN
,
upwind
<
scalar
>
(
mesh
,
phiCN
)
).
fvmDiv
(
phiCN
,
alpha1
)
// - fvm::Sp(fvc::ddt(dimensionedScalar("1", dimless, 1), mesh)
// + fvc::div(phiCN), alpha1)
==
Su
+
fvm
::
Sp
(
Sp
+
divU
,
alpha1
)
);
alpha1Eqn
.
solve
();
Info
<<
"Phase-1 volume fraction = "
<<
alpha1
.
weightedAverage
(
mesh
.
Vsc
()).
value
()
<<
" Min("
<<
alpha1
.
name
()
<<
") = "
<<
min
(
alpha1
).
value
()
<<
" Max("
<<
alpha1
.
name
()
<<
") = "
<<
max
(
alpha1
).
value
()
<<
endl
;
tmp
<
surfaceScalarField
>
talphaPhi1UD
(
alpha1Eqn
.
flux
());
alphaPhi10
=
talphaPhi1UD
();
if
(
alphaApplyPrevCorr
&&
talphaPhi1Corr0
.
valid
())
{
Info
<<
"Applying the previous iteration compression flux"
<<
endl
;
MULES
::
correct
(
geometricOneField
(),
alpha1
,
alphaPhi10
,
talphaPhi1Corr0
.
ref
(),
oneField
(),
zeroField
()
);
alphaPhi10
+=
talphaPhi1Corr0
();
}
// Cache the upwind-flux
talphaPhi1Corr0
=
talphaPhi1UD
;
alpha2
=
1
.
0
-
alpha1
;
mixture
.
correct
();
}
for
(
int
aCorr
=
0
;
aCorr
<
nAlphaCorr
;
aCorr
++
)
{
#include "alphaSuSp.H"
surfaceScalarField
phir
(
phic
*
mixture
.
nHatf
());
alphaPhiUn
=
fvc
::
flux
(
phi
,
alpha1
,
alphaScheme
)
+
fvc
::
flux
(
-
fvc
::
flux
(
-
phir
,
alpha2
,
alpharScheme
),
alpha1
,
alpharScheme
);
if
(
MULESCorr
)
{
tmp
<
surfaceScalarField
>
talphaPhi1Corr
(
alphaPhiUn
-
alphaPhi10
);
volScalarField
alpha10
(
"alpha10"
,
alpha1
);
MULES
::
correct
(
geometricOneField
(),
alpha1
,
alphaPhiUn
,
talphaPhi1Corr
.
ref
(),
Sp
,
(
-
Sp
*
alpha1
)(),
oneField
(),
zeroField
()
);
// Under-relax the correction for all but the 1st corrector
if
(
aCorr
==
0
)
{
alphaPhi10
+=
talphaPhi1Corr
();
}
else
{
alpha1
=
0
.
5
*
alpha1
+
0
.
5
*
alpha10
;
alphaPhi10
+=
0
.
5
*
talphaPhi1Corr
();
}
}
else
{
alphaPhi10
=
alphaPhiUn
;
MULES
::
explicitSolve
(
geometricOneField
(),
alpha1
,
phiCN
,
alphaPhi10
,
Sp
,
(
Su
+
divU
*
min
(
alpha1
(),
scalar
(
1
)))(),
oneField
(),
zeroField
()
);
}
alpha2
=
1
.
0
-
alpha1
;
mixture
.
correct
();
}
if
(
alphaApplyPrevCorr
&&
MULESCorr
)
{
talphaPhi1Corr0
=
alphaPhi10
-
talphaPhi1Corr0
;
talphaPhi1Corr0
.
ref
().
rename
(
"alphaPhi1Corr0"
);
}
else
{
talphaPhi1Corr0
.
clear
();
}
#include "rhofs.H"
if
(
word
(
mesh
.
ddtScheme
(
"ddt(rho,U)"
))
==
fv
::
EulerDdtScheme
<
vector
>::
typeName
||
word
(
mesh
.
ddtScheme
(
"ddt(rho,U)"
))
==
fv
::
localEulerDdtScheme
<
vector
>::
typeName
)
{
rhoPhi
=
alphaPhi10
*
(
rho1f
-
rho2f
)
+
phiCN
*
rho2f
;
}
else
{
if
(
ocCoeff
>
0
)
{
// Calculate the end-of-time-step alpha flux
alphaPhi10
=
(
alphaPhi10
-
(
1
.
0
-
cnCoeff
)
*
alphaPhi10
.
oldTime
())
/
cnCoeff
;
}
// Calculate the end-of-time-step mass flux
rhoPhi
=
alphaPhi10
*
(
rho1f
-
rho2f
)
+
phi
*
rho2f
;
}
Info
<<
"Phase-1 volume fraction = "
<<
alpha1
.
weightedAverage
(
mesh
.
Vsc
()).
value
()
<<
" Min("
<<
alpha1
.
name
()
<<
") = "
<<
min
(
alpha1
).
value
()
<<
" Max("
<<
alpha1
.
name
()
<<
") = "
<<
max
(
alpha1
).
value
()
<<
endl
;
}
applications/solvers/multiphase/VoF/alphaEqnSubCycle.H
0 → 100644
View file @
ea17556c
if
(
nAlphaSubCycles
>
1
)
{
dimensionedScalar
totalDeltaT
=
runTime
.
deltaT
();
surfaceScalarField
rhoPhiSum
(
IOobject
(
"rhoPhiSum"
,
runTime
.
timeName
(),
mesh
),
mesh
,
dimensionedScalar
(
rhoPhi
.
dimensions
(),
Zero
)
);
tmp
<
volScalarField
>
trSubDeltaT
;
if
(
LTS
)
{
trSubDeltaT
=
fv
::
localEulerDdt
::
localRSubDeltaT
(
mesh
,
nAlphaSubCycles
);
}
for
(
subCycle
<
volScalarField
>
alphaSubCycle
(
alpha1
,
nAlphaSubCycles
);
!
(
++
alphaSubCycle
).
end
();
)
{
#include "alphaEqn.H"
rhoPhiSum
+=
(
runTime
.
deltaT
()
/
totalDeltaT
)
*
rhoPhi
;
}
rhoPhi
=
rhoPhiSum
;
}
else
{
#include "alphaEqn.H"
}
rho
==
alpha1
*
rho1
+
alpha2
*
rho2
;
applications/solvers/multiphase/VoF/createAlphaFluxes.H
0 → 100644
View file @
ea17556c
IOobject
alphaPhi10Header
(
IOobject
::
groupName
(
"alphaPhi0"
,
alpha1
.
group
()),
runTime
.
timeName
(),
mesh
,
IOobject
::
READ_IF_PRESENT
,
IOobject
::
AUTO_WRITE
);
const
bool
alphaRestart
=
alphaPhi10Header
.
typeHeaderOk
<
surfaceScalarField
>
(
true
);
if
(
alphaRestart
)
{
Info
<<
"Restarting alpha"
<<
endl
;
}
// MULES flux from previous time-step
surfaceScalarField
alphaPhi10
(
alphaPhi10Header
,
phi
*
fvc
::
interpolate
(
alpha1
)
);
// MULES Correction
tmp
<
surfaceScalarField
>
talphaPhi1Corr0
;
// MULES compressed flux is registered in case scalarTransport FO needs it.
surfaceScalarField
alphaPhiUn
(
IOobject
(
"alphaPhiUn"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
mesh
,
dimensionedScalar
(
phi
.
dimensions
(),
Zero
)
);
applications/solvers/multiphase/VoF/setDeltaT.H
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Global
setDeltaT
Description
Reset the timestep to maintain a constant maximum courant Number.
Reduction of time-step is immediate, but increase is damped to avoid
unstable oscillations.
\*---------------------------------------------------------------------------*/
if
(
adjustTimeStep
)
{
scalar
maxDeltaTFact
=
min
(
maxCo
/
(
CoNum
+
SMALL
),
maxAlphaCo
/
(
alphaCoNum
+
SMALL
));
scalar
deltaTFact
=
min
(
min
(
maxDeltaTFact
,
1
.
0
+
0
.
1
*
maxDeltaTFact
),
1
.
2
);
runTime
.
setDeltaT
(
min
(
deltaTFact
*
runTime
.
deltaTValue
(),
maxDeltaT
)
);
Info
<<
"deltaT = "
<<
runTime
.
deltaTValue
()
<<
endl
;
}
// ************************************************************************* //
applications/solvers/multiphase/VoF/setRDeltaT.H
0 → 100644
View file @
ea17556c
{
volScalarField
&
rDeltaT
=
trDeltaT
.
ref
();
const
dictionary
&
pimpleDict
=
pimple
.
dict
();
scalar
maxCo
(
pimpleDict
.
getOrDefault
<
scalar
>
(
"maxCo"
,
0
.
9
)
);
scalar
maxAlphaCo
(
pimpleDict
.
getOrDefault
<
scalar
>
(
"maxAlphaCo"
,
0
.
2
)
);
scalar
rDeltaTSmoothingCoeff
(
pimpleDict
.
getOrDefault
<
scalar
>
(
"rDeltaTSmoothingCoeff"
,
0
.
1
)
);
label
nAlphaSpreadIter
(
pimpleDict
.
getOrDefault
<
label
>
(
"nAlphaSpreadIter"
,
1
)
);
scalar
alphaSpreadDiff
(
pimpleDict
.
getOrDefault
<
scalar
>
(
"alphaSpreadDiff"
,
0
.
2
)
);
scalar
alphaSpreadMax
(
pimpleDict
.
getOrDefault
<
scalar
>
(
"alphaSpreadMax"
,
0
.
99
)
);
scalar
alphaSpreadMin
(
pimpleDict
.
getOrDefault
<
scalar
>
(
"alphaSpreadMin"
,
0
.
01
)
);
label
nAlphaSweepIter
(
pimpleDict
.
getOrDefault
<
label
>
(
"nAlphaSweepIter"
,
5
)
);
scalar
rDeltaTDampingCoeff
(
pimpleDict
.
getOrDefault
<
scalar
>
(
"rDeltaTDampingCoeff"
,
1
.
0
)
);
scalar
maxDeltaT
(
pimpleDict
.
getOrDefault
<
scalar
>
(
"maxDeltaT"
,
GREAT
)
);
volScalarField
rDeltaT0
(
"rDeltaT0"
,
rDeltaT
);
// Set the reciprocal time-step from the local Courant number
rDeltaT
.
ref
()
=
max
(
1
/
dimensionedScalar
(
"maxDeltaT"
,
dimTime
,
maxDeltaT
),
fvc
::
surfaceSum
(
mag
(
rhoPhi
))()()
/
((
2
*
maxCo
)
*
mesh
.
V
()
*
rho
())
);
if
(
maxAlphaCo
<
maxCo
)
{
// Further limit the reciprocal time-step
// in the vicinity of the interface
volScalarField
alpha1Bar
(
fvc
::
average
(
alpha1
));
rDeltaT
.
ref
()
=
max
(
rDeltaT
(),
pos0
(
alpha1Bar
()
-
alphaSpreadMin
)
*
pos0
(
alphaSpreadMax
-
alpha1Bar
())
*
fvc
::
surfaceSum
(
mag
(
phi
))()()
/
((
2
*
maxAlphaCo
)
*
mesh
.
V
())
);
}
// Update tho boundary values of the reciprocal time-step
rDeltaT
.
correctBoundaryConditions
();
Info
<<
"Flow time scale min/max = "
<<
gMin
(
1
/
rDeltaT
.
primitiveField
())
<<
", "
<<
gMax
(
1
/
rDeltaT
.
primitiveField
())
<<
endl
;
if
(
rDeltaTSmoothingCoeff
<
1
.
0
)
{
fvc
::
smooth
(
rDeltaT
,
rDeltaTSmoothingCoeff
);
}
if
(
nAlphaSpreadIter
>
0
)
{
fvc
::
spread
(
rDeltaT
,
alpha1
,
nAlphaSpreadIter
,
alphaSpreadDiff
,
alphaSpreadMax
,
alphaSpreadMin
);
}
if
(
nAlphaSweepIter
>
0
)
{
fvc
::
sweep
(
rDeltaT
,
alpha1
,
nAlphaSweepIter
,
alphaSpreadDiff
);
}
Info
<<
"Smoothed flow time scale min/max = "
<<
gMin
(
1
/
rDeltaT
.
primitiveField
())
<<
", "
<<
gMax
(
1
/
rDeltaT
.
primitiveField
())
<<
endl
;
// Limit rate of change of time scale
// - reduce as much as required
// - only increase at a fraction of old time scale
if
(
rDeltaTDampingCoeff
<
1
.
0
&&
runTime
.
timeIndex
()
>
runTime
.
startTimeIndex
()
+
1
)
{
rDeltaT
=
max
(
rDeltaT
,
(
scalar
(
1
)
-
rDeltaTDampingCoeff
)
*
rDeltaT0
);
Info
<<
"Damped flow time scale min/max = "
<<
gMin
(
1
/
rDeltaT
.
primitiveField
())
<<
", "
<<
gMax
(
1
/
rDeltaT
.
primitiveField
())
<<
endl
;
}
}
Prev
1
…
31
32
33
34
35
36
37
38
39
40
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment