interFoam: Added support for phase-change with cavitation models
The phase-change functionality in interPhaseChangeFoam has been generalised and
moved into the run-time selectable twoPhaseChange library included into
interFoam providing optional phase-change. The three cavitation models provided
in interPhaseChangeFoam are now included in the twoPhaseChange library and the
two interPhaseChangeFoam cavitation tutorials updated for interFoam.
interPhaseChangeFoam has been replaced by a user redirection script which prints
the following message:
The interPhaseChangeFoam solver has solver has been replaced by the more general
interFoam solver, which now supports phase-change using the new twoPhaseChange
models library.
To run with with phase-change create a constant/phaseChangeProperties dictionary
containing the phase-change model specification, e.g.
phaseChangeModel SchnerrSauer;
pSat 2300; // Saturation pressure
See the following cases for an example converted from interPhaseChangeFoam:
$FOAM_TUTORIALS/multiphase/interFoam/laminar/cavitatingBullet
$FOAM_TUTORIALS/multiphase/interFoam/RAS/propeller
This commit is contained in:
@ -1,41 +1,40 @@
|
|||||||
volScalarField::Internal Sp
|
tmp<volScalarField::Internal> Sp
|
||||||
(
|
(
|
||||||
IOobject
|
volScalarField::Internal::New
|
||||||
(
|
(
|
||||||
"Sp",
|
"Sp",
|
||||||
runTime.timeName(),
|
mesh,
|
||||||
mesh
|
dimensionedScalar(dgdt.dimensions(), 0)
|
||||||
),
|
)
|
||||||
mesh,
|
|
||||||
dimensionedScalar(dgdt.dimensions(), 0)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
volScalarField::Internal Su
|
tmp<volScalarField::Internal> Su
|
||||||
(
|
(
|
||||||
IOobject
|
volScalarField::Internal::New
|
||||||
(
|
(
|
||||||
"Su",
|
"Su",
|
||||||
runTime.timeName(),
|
mesh,
|
||||||
mesh
|
dimensionedScalar(dgdt.dimensions(), 0)
|
||||||
),
|
)
|
||||||
mesh,
|
|
||||||
dimensionedScalar(dgdt.dimensions(), 0)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
volScalarField::Internal& SpRef = Sp.ref();
|
||||||
|
volScalarField::Internal& SuRef = Su.ref();
|
||||||
|
|
||||||
forAll(dgdt, celli)
|
forAll(dgdt, celli)
|
||||||
{
|
{
|
||||||
if (dgdt[celli] > 0.0)
|
if (dgdt[celli] > 0.0)
|
||||||
{
|
{
|
||||||
Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
|
SpRef[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
|
||||||
Su[celli] += dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
|
SuRef[celli] += dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
|
||||||
}
|
}
|
||||||
else if (dgdt[celli] < 0.0)
|
else if (dgdt[celli] < 0.0)
|
||||||
{
|
{
|
||||||
Sp[celli] += dgdt[celli]/max(alpha1[celli], 1e-4);
|
SpRef[celli] += dgdt[celli]/max(alpha1[celli], 1e-4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
volScalarField::Internal divU
|
tmp<volScalarField> divU
|
||||||
(
|
(
|
||||||
mesh.moving()
|
mesh.moving()
|
||||||
? fvc::div(phiCN() + mesh.phi())
|
? fvc::div(phiCN() + mesh.phi())
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -77,11 +77,6 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
#include "readDyMControls.H"
|
#include "readDyMControls.H"
|
||||||
|
|
||||||
// Store divU from the previous mesh so that it can be mapped
|
|
||||||
// and used in correctPhi to ensure the corrected phi has the
|
|
||||||
// same divergence
|
|
||||||
volScalarField divU("divU0", fvc::div(fvc::absolute(phi, U)));
|
|
||||||
|
|
||||||
if (LTS)
|
if (LTS)
|
||||||
{
|
{
|
||||||
#include "setRDeltaT.H"
|
#include "setRDeltaT.H"
|
||||||
@ -102,6 +97,20 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||||
{
|
{
|
||||||
|
// Store divU from the previous mesh so that it can be mapped
|
||||||
|
// and used in correctPhi to ensure the corrected phi has the
|
||||||
|
// same divergence
|
||||||
|
tmp<volScalarField> divU;
|
||||||
|
|
||||||
|
if (correctPhi)
|
||||||
|
{
|
||||||
|
divU = volScalarField::New
|
||||||
|
(
|
||||||
|
"divU0",
|
||||||
|
fvc::div(fvc::absolute(phi, U))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
mesh.update();
|
mesh.update();
|
||||||
|
|
||||||
if (mesh.changing())
|
if (mesh.changing())
|
||||||
@ -130,9 +139,9 @@ int main(int argc, char *argv[])
|
|||||||
#include "meshCourantNo.H"
|
#include "meshCourantNo.H"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
divU = fvc::div(fvc::absolute(phi, U));
|
divU.clear();
|
||||||
|
}
|
||||||
|
|
||||||
#include "alphaControls.H"
|
#include "alphaControls.H"
|
||||||
#include "compressibleAlphaEqnSubCycle.H"
|
#include "compressibleAlphaEqnSubCycle.H"
|
||||||
|
|||||||
@ -3,8 +3,8 @@ CorrectPhi
|
|||||||
U,
|
U,
|
||||||
phi,
|
phi,
|
||||||
p,
|
p,
|
||||||
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1),
|
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||||
divU,
|
divU(),
|
||||||
pimple,
|
pimple,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|||||||
@ -7,3 +7,5 @@ volScalarField& p = mixture.p();
|
|||||||
volScalarField& T = mixture.T();
|
volScalarField& T = mixture.T();
|
||||||
const volScalarField& psi1 = mixture.thermo1().psi();
|
const volScalarField& psi1 = mixture.thermo1().psi();
|
||||||
const volScalarField& psi2 = mixture.thermo2().psi();
|
const volScalarField& psi2 = mixture.thermo2().psi();
|
||||||
|
|
||||||
|
tmp<volScalarField> rAU;
|
||||||
|
|||||||
@ -1,12 +1,20 @@
|
|||||||
{
|
{
|
||||||
volScalarField rAU("rAU", 1.0/UEqn.A());
|
if (correctPhi)
|
||||||
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
|
{
|
||||||
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
|
rAU.ref() = 1.0/UEqn.A();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rAU = 1.0/UEqn.A();
|
||||||
|
}
|
||||||
|
|
||||||
|
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU()));
|
||||||
|
volVectorField HbyA(constrainHbyA(rAU()*UEqn.H(), U, p_rgh));
|
||||||
surfaceScalarField phiHbyA
|
surfaceScalarField phiHbyA
|
||||||
(
|
(
|
||||||
"phiHbyA",
|
"phiHbyA",
|
||||||
fvc::flux(HbyA)
|
fvc::flux(HbyA)
|
||||||
+ MRF.zeroFilter(fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi, Uf))
|
+ MRF.zeroFilter(fvc::interpolate(rho*rAU())*fvc::ddtCorr(U, phi, Uf))
|
||||||
);
|
);
|
||||||
MRF.makeRelative(phiHbyA);
|
MRF.makeRelative(phiHbyA);
|
||||||
|
|
||||||
@ -138,7 +146,7 @@
|
|||||||
phi = phiHbyA + p_rghEqnIncomp.flux();
|
phi = phiHbyA + p_rghEqnIncomp.flux();
|
||||||
|
|
||||||
U = HbyA
|
U = HbyA
|
||||||
+ rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
|
+ rAU()*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
|
||||||
U.correctBoundaryConditions();
|
U.correctBoundaryConditions();
|
||||||
fvOptions.correct(U);
|
fvOptions.correct(U);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/twoPhaseModels/interfaceProperties/lnInclude \
|
-I$(LIB_SRC)/twoPhaseModels/interfaceProperties/lnInclude \
|
||||||
-I$(LIB_SRC)/twoPhaseModels/incompressibleTwoPhaseMixture/lnInclude \
|
-I$(LIB_SRC)/twoPhaseModels/incompressibleTwoPhaseMixture/lnInclude \
|
||||||
-I$(LIB_SRC)/twoPhaseModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude \
|
-I$(LIB_SRC)/twoPhaseModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude \
|
||||||
|
-I$(LIB_SRC)/twoPhaseModels/twoPhaseChange/lnInclude \
|
||||||
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
|
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
|
||||||
-I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \
|
-I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
@ -13,6 +14,7 @@ EXE_INC = \
|
|||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-limmiscibleIncompressibleTwoPhaseMixture \
|
-limmiscibleIncompressibleTwoPhaseMixture \
|
||||||
|
-ltwoPhaseChangeModels \
|
||||||
-lmomentumTransportModels \
|
-lmomentumTransportModels \
|
||||||
-lincompressibleMomentumTransportModels \
|
-lincompressibleMomentumTransportModels \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
|
|||||||
@ -6,7 +6,8 @@
|
|||||||
+ MRF.DDt(rho, U)
|
+ MRF.DDt(rho, U)
|
||||||
+ turbulence->divDevTau(rho, U)
|
+ turbulence->divDevTau(rho, U)
|
||||||
==
|
==
|
||||||
fvOptions(rho, U)
|
phaseChange.SU(rho, rhoPhi, U)
|
||||||
|
+ fvOptions(rho, U)
|
||||||
);
|
);
|
||||||
|
|
||||||
UEqn.relax();
|
UEqn.relax();
|
||||||
|
|||||||
@ -1,3 +1,19 @@
|
|||||||
zeroField Su;
|
// Phase change alpha1 source
|
||||||
zeroField Sp;
|
Pair<tmp<volScalarField::Internal>> phaseChangeS
|
||||||
zeroField divU;
|
(
|
||||||
|
phaseChange.Salpha(alpha1)
|
||||||
|
);
|
||||||
|
const tmp<volScalarField::Internal>& Su = phaseChangeS[0];
|
||||||
|
const tmp<volScalarField::Internal>& Sp = phaseChangeS[1];
|
||||||
|
|
||||||
|
tmp<volScalarField> divU;
|
||||||
|
|
||||||
|
if (Sp.valid())
|
||||||
|
{
|
||||||
|
divU =
|
||||||
|
(
|
||||||
|
mesh.moving()
|
||||||
|
? fvc::div(phiCN() + mesh.phi())
|
||||||
|
: fvc::div(phiCN())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@ -1,12 +1,28 @@
|
|||||||
CorrectPhi
|
if (divU.valid())
|
||||||
(
|
{
|
||||||
U,
|
CorrectPhi
|
||||||
phi,
|
(
|
||||||
p_rgh,
|
U,
|
||||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
phi,
|
||||||
geometricZeroField(),
|
p_rgh,
|
||||||
pimple,
|
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||||
true
|
divU(),
|
||||||
);
|
pimple,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CorrectPhi
|
||||||
|
(
|
||||||
|
U,
|
||||||
|
phi,
|
||||||
|
p_rgh,
|
||||||
|
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||||
|
geometricZeroField(),
|
||||||
|
pimple,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#include "continuityErrs.H"
|
#include "continuityErrs.H"
|
||||||
|
|||||||
@ -0,0 +1,2 @@
|
|||||||
|
twoPhaseChangeModel& phaseChange = phaseChangePtr();
|
||||||
|
tmp<volScalarField> rAU;
|
||||||
@ -34,6 +34,11 @@ volVectorField U
|
|||||||
Info<< "Reading transportProperties\n" << endl;
|
Info<< "Reading transportProperties\n" << endl;
|
||||||
immiscibleIncompressibleTwoPhaseMixture mixture(U, phi);
|
immiscibleIncompressibleTwoPhaseMixture mixture(U, phi);
|
||||||
|
|
||||||
|
autoPtr<twoPhaseChangeModel> phaseChangePtr
|
||||||
|
(
|
||||||
|
twoPhaseChangeModel::New(mixture)
|
||||||
|
);
|
||||||
|
|
||||||
volScalarField& alpha1(mixture.alpha1());
|
volScalarField& alpha1(mixture.alpha1());
|
||||||
volScalarField& alpha2(mixture.alpha2());
|
volScalarField& alpha2(mixture.alpha2());
|
||||||
|
|
||||||
@ -56,21 +61,6 @@ volScalarField rho
|
|||||||
rho.oldTime();
|
rho.oldTime();
|
||||||
|
|
||||||
|
|
||||||
// Mass flux
|
|
||||||
surfaceScalarField rhoPhi
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"rhoPhi",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
fvc::interpolate(rho)*phi
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Construct incompressible turbulence model
|
// Construct incompressible turbulence model
|
||||||
autoPtr<incompressible::momentumTransportModel> turbulence
|
autoPtr<incompressible::momentumTransportModel> turbulence
|
||||||
(
|
(
|
||||||
|
|||||||
@ -1,46 +1,49 @@
|
|||||||
tmp<volScalarField> rAU;
|
if
|
||||||
|
(
|
||||||
if (correctPhi)
|
!runTime.restart()
|
||||||
|
|| isType<twoPhaseChangeModels::noPhaseChange>(phaseChange)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
rAU = new volScalarField
|
if (correctPhi)
|
||||||
(
|
{
|
||||||
IOobject
|
rAU = new volScalarField
|
||||||
(
|
(
|
||||||
"rAU",
|
IOobject
|
||||||
runTime.timeName(),
|
(
|
||||||
|
"rAU",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::READ_IF_PRESENT,
|
dimensionedScalar(dimTime/dimDensity, 1)
|
||||||
IOobject::AUTO_WRITE
|
);
|
||||||
),
|
|
||||||
mesh,
|
|
||||||
dimensionedScalar(dimTime/dimDensity, 1)
|
|
||||||
);
|
|
||||||
|
|
||||||
CorrectPhi
|
CorrectPhi
|
||||||
(
|
(
|
||||||
U,
|
U,
|
||||||
phi,
|
phi,
|
||||||
p_rgh,
|
p_rgh,
|
||||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||||
geometricZeroField(),
|
geometricZeroField(),
|
||||||
pimple,
|
pimple,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
}
|
||||||
#include "continuityErrs.H"
|
else
|
||||||
|
{
|
||||||
|
CorrectPhi
|
||||||
|
(
|
||||||
|
U,
|
||||||
|
phi,
|
||||||
|
p_rgh,
|
||||||
|
dimensionedScalar(dimTime/rho.dimensions(), 1),
|
||||||
|
geometricZeroField(),
|
||||||
|
pimple,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
CorrectPhi
|
|
||||||
(
|
|
||||||
U,
|
|
||||||
phi,
|
|
||||||
p_rgh,
|
|
||||||
dimensionedScalar(dimTime/rho.dimensions(), 1),
|
|
||||||
geometricZeroField(),
|
|
||||||
pimple,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
#include "continuityErrs.H"
|
#include "continuityErrs.H"
|
||||||
}
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -40,6 +40,7 @@ Description
|
|||||||
#include "CrankNicolsonDdtScheme.H"
|
#include "CrankNicolsonDdtScheme.H"
|
||||||
#include "subCycle.H"
|
#include "subCycle.H"
|
||||||
#include "immiscibleIncompressibleTwoPhaseMixture.H"
|
#include "immiscibleIncompressibleTwoPhaseMixture.H"
|
||||||
|
#include "noPhaseChange.H"
|
||||||
#include "kinematicMomentumTransportModel.H"
|
#include "kinematicMomentumTransportModel.H"
|
||||||
#include "pimpleControl.H"
|
#include "pimpleControl.H"
|
||||||
#include "fvOptions.H"
|
#include "fvOptions.H"
|
||||||
@ -58,6 +59,7 @@ int main(int argc, char *argv[])
|
|||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
#include "createDyMControls.H"
|
#include "createDyMControls.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
|
#include "createFieldRefs.H"
|
||||||
#include "createAlphaFluxes.H"
|
#include "createAlphaFluxes.H"
|
||||||
#include "initCorrectPhi.H"
|
#include "initCorrectPhi.H"
|
||||||
#include "createUfIfPresent.H"
|
#include "createUfIfPresent.H"
|
||||||
@ -97,6 +99,24 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
||||||
{
|
{
|
||||||
|
// Store divU from the previous mesh so that it can be mapped
|
||||||
|
// and used in correctPhi to ensure the corrected phi has the
|
||||||
|
// same divergence
|
||||||
|
tmp<volScalarField> divU;
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
correctPhi
|
||||||
|
&& !isType<twoPhaseChangeModels::noPhaseChange>(phaseChange)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
divU = volScalarField::New
|
||||||
|
(
|
||||||
|
"divU0",
|
||||||
|
fvc::div(fvc::absolute(phi, U))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
mesh.update();
|
mesh.update();
|
||||||
|
|
||||||
if (mesh.changing())
|
if (mesh.changing())
|
||||||
@ -132,8 +152,22 @@ int main(int argc, char *argv[])
|
|||||||
#include "meshCourantNo.H"
|
#include "meshCourantNo.H"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
divU.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
surfaceScalarField rhoPhi
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rhoPhi",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar(dimMass/dimTime, 0)
|
||||||
|
);
|
||||||
|
|
||||||
#include "alphaControls.H"
|
#include "alphaControls.H"
|
||||||
#include "alphaEqnSubCycle.H"
|
#include "alphaEqnSubCycle.H"
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
|
MRF.correctBoundaryVelocity(U);
|
||||||
|
|
||||||
fvVectorMatrix UEqn
|
fvVectorMatrix UEqn
|
||||||
(
|
(
|
||||||
fvm::ddt(rho, U) + fvm::div(rhoPhi, U)
|
fvm::ddt(rho, U) + fvm::div(rhoPhi, U)
|
||||||
- fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), U)
|
+ MRF.DDt(rho, U)
|
||||||
+ turbulence->divDevTau(rho, U)
|
+ turbulence->divDevTau(rho, U)
|
||||||
==
|
==
|
||||||
fvOptions(rho, U)
|
fvOptions(rho, U)
|
||||||
@ -4,7 +4,7 @@ CorrectPhi
|
|||||||
phi,
|
phi,
|
||||||
p_rgh,
|
p_rgh,
|
||||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||||
divU,
|
geometricZeroField(),
|
||||||
pimple,
|
pimple,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@ -13,18 +13,16 @@ if (correctPhi)
|
|||||||
IOobject::AUTO_WRITE
|
IOobject::AUTO_WRITE
|
||||||
),
|
),
|
||||||
mesh,
|
mesh,
|
||||||
dimensionedScalar("rAU", dimTime/dimDensity, 1)
|
dimensionedScalar(dimTime/dimDensity, 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
volScalarField divU("divU0", fvc::div(fvc::absolute(phi, U)));
|
|
||||||
|
|
||||||
CorrectPhi
|
CorrectPhi
|
||||||
(
|
(
|
||||||
U,
|
U,
|
||||||
phi,
|
phi,
|
||||||
p_rgh,
|
p_rgh,
|
||||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||||
divU,
|
geometricZeroField(),
|
||||||
pimple,
|
pimple,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
@ -38,7 +36,7 @@ else
|
|||||||
U,
|
U,
|
||||||
phi,
|
phi,
|
||||||
p_rgh,
|
p_rgh,
|
||||||
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1),
|
dimensionedScalar(dimTime/rho.dimensions(), 1),
|
||||||
geometricZeroField(),
|
geometricZeroField(),
|
||||||
pimple,
|
pimple,
|
||||||
false
|
false
|
||||||
@ -14,8 +14,9 @@
|
|||||||
(
|
(
|
||||||
"phiHbyA",
|
"phiHbyA",
|
||||||
fvc::flux(HbyA)
|
fvc::flux(HbyA)
|
||||||
+ fvc::interpolate(rho*rAU())*fvc::ddtCorr(U, phi, Uf)
|
+ MRF.zeroFilter(fvc::interpolate(rho*rAU())*fvc::ddtCorr(U, phi, Uf))
|
||||||
);
|
);
|
||||||
|
MRF.makeRelative(phiHbyA);
|
||||||
|
|
||||||
if (p_rgh.needReference())
|
if (p_rgh.needReference())
|
||||||
{
|
{
|
||||||
@ -35,35 +36,33 @@
|
|||||||
phiHbyA += phig;
|
phiHbyA += phig;
|
||||||
|
|
||||||
// Update the pressure BCs to ensure flux consistency
|
// Update the pressure BCs to ensure flux consistency
|
||||||
constrainPressure(p_rgh, U, phiHbyA, rAUf);
|
constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF);
|
||||||
|
|
||||||
Pair<tmp<volScalarField>> vDotP = mixture.vDotP();
|
|
||||||
const volScalarField& vDotcP = vDotP[0]();
|
|
||||||
const volScalarField& vDotvP = vDotP[1]();
|
|
||||||
|
|
||||||
while (pimple.correctNonOrthogonal())
|
while (pimple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
fvc::div(phiHbyA) - fvm::laplacian(rAUf, p_rgh)
|
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA)
|
||||||
- (vDotvP - vDotcP)*(mixture.pSat() - rho*gh)
|
|
||||||
+ fvm::Sp(vDotvP - vDotcP, p_rgh)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
p_rghEqn.setReference(pRefCell, pRefValue);
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
|
|
||||||
p_rghEqn.solve();
|
p_rghEqn.solve();
|
||||||
|
|
||||||
if (pimple.finalNonOrthogonalIter())
|
if (pimple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi = phiHbyA + p_rghEqn.flux();
|
phi = phiHbyA - p_rghEqn.flux();
|
||||||
|
|
||||||
U = HbyA + rAU()*fvc::reconstruct((phig + p_rghEqn.flux())/rAUf);
|
p_rgh.relax();
|
||||||
|
|
||||||
|
U = HbyA + rAU()*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
|
||||||
U.correctBoundaryConditions();
|
U.correctBoundaryConditions();
|
||||||
fvOptions.correct(U);
|
fvOptions.correct(U);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
// Correct Uf if the mesh is moving
|
// Correct Uf if the mesh is moving
|
||||||
fvc::correctUf(Uf, U, phi);
|
fvc::correctUf(Uf, U, phi);
|
||||||
|
|
||||||
@ -38,11 +38,15 @@
|
|||||||
// Update the pressure BCs to ensure flux consistency
|
// Update the pressure BCs to ensure flux consistency
|
||||||
constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF);
|
constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF);
|
||||||
|
|
||||||
|
// Cache the phase change pressure source
|
||||||
|
fvScalarMatrix Sp_rgh(phaseChange.Sp_rgh(rho, gh, p_rgh));
|
||||||
|
|
||||||
while (pimple.correctNonOrthogonal())
|
while (pimple.correctNonOrthogonal())
|
||||||
{
|
{
|
||||||
fvScalarMatrix p_rghEqn
|
fvScalarMatrix p_rghEqn
|
||||||
(
|
(
|
||||||
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA)
|
fvc::div(phiHbyA) - fvm::laplacian(rAUf, p_rgh)
|
||||||
|
== Sp_rgh
|
||||||
);
|
);
|
||||||
|
|
||||||
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
@ -51,11 +55,11 @@
|
|||||||
|
|
||||||
if (pimple.finalNonOrthogonalIter())
|
if (pimple.finalNonOrthogonalIter())
|
||||||
{
|
{
|
||||||
phi = phiHbyA - p_rghEqn.flux();
|
phi = phiHbyA + p_rghEqn.flux();
|
||||||
|
|
||||||
p_rgh.relax();
|
p_rgh.relax();
|
||||||
|
|
||||||
U = HbyA + rAU()*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
|
U = HbyA + rAU()*fvc::reconstruct((phig + p_rghEqn.flux())/rAUf);
|
||||||
U.correctBoundaryConditions();
|
U.correctBoundaryConditions();
|
||||||
fvOptions.correct(U);
|
fvOptions.correct(U);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
cd ${0%/*} || exit 1 # Run from this directory
|
|
||||||
|
|
||||||
wclean libso phaseChangeTwoPhaseMixtures
|
|
||||||
wclean
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
cd ${0%/*} || exit 1 # Run from this directory
|
|
||||||
|
|
||||||
# Parse arguments for library compilation
|
|
||||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
|
||||||
|
|
||||||
wmake $targetType phaseChangeTwoPhaseMixtures
|
|
||||||
wmake $targetType
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
interPhaseChangeFoam.C
|
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/interPhaseChangeFoam
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
EXE_INC = \
|
|
||||||
-I. \
|
|
||||||
-I$(LIB_SRC)/transportModels/lnInclude \
|
|
||||||
-I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \
|
|
||||||
-I$(LIB_SRC)/twoPhaseModels/interfaceProperties/lnInclude \
|
|
||||||
-I$(LIB_SRC)/twoPhaseModels/incompressibleTwoPhaseMixture/lnInclude \
|
|
||||||
-I$(LIB_SRC)/twoPhaseModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude \
|
|
||||||
-IphaseChangeTwoPhaseMixtures/lnInclude \
|
|
||||||
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
|
|
||||||
-I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \
|
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
|
||||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude
|
|
||||||
|
|
||||||
EXE_LIBS = \
|
|
||||||
-lphaseChangeTwoPhaseMixtures \
|
|
||||||
-ltwoPhaseMixture \
|
|
||||||
-linterfaceProperties \
|
|
||||||
-ltwoPhaseProperties \
|
|
||||||
-lincompressibleTransportModels \
|
|
||||||
-lmomentumTransportModels \
|
|
||||||
-lincompressibleMomentumTransportModels \
|
|
||||||
-lfiniteVolume \
|
|
||||||
-ldynamicFvMesh \
|
|
||||||
-ltopoChangerFvMesh \
|
|
||||||
-lfvOptions \
|
|
||||||
-lmeshTools
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
const dictionary& alphaControls = mesh.solverDict(alpha1.name());
|
|
||||||
|
|
||||||
const label nAlphaCorr(alphaControls.lookup<label>("nAlphaCorr"));
|
|
||||||
|
|
||||||
const label nAlphaSubCycles(alphaControls.lookup<label>("nAlphaSubCycles"));
|
|
||||||
|
|
||||||
const bool MULESCorr(alphaControls.lookupOrDefault<Switch>("MULESCorr", false));
|
|
||||||
|
|
||||||
// Apply the compression correction from the previous iteration
|
|
||||||
// Improves efficiency for steady-simulations but can only be applied
|
|
||||||
// once the alpha field is reasonably steady, i.e. fully developed
|
|
||||||
// const bool alphaApplyPrevCorr
|
|
||||||
// (
|
|
||||||
// alphaControls.lookupOrDefault<Switch>("alphaApplyPrevCorr", false)
|
|
||||||
// );
|
|
||||||
@ -1,113 +0,0 @@
|
|||||||
{
|
|
||||||
#include "alphaScheme.H"
|
|
||||||
|
|
||||||
Pair<tmp<volScalarField>> vDotAlphal = mixture.vDotAlphal();
|
|
||||||
const volScalarField& vDotcAlphal = vDotAlphal[0]();
|
|
||||||
const volScalarField& vDotvAlphal = vDotAlphal[1]();
|
|
||||||
const volScalarField vDotvmcAlphal(vDotvAlphal - vDotcAlphal);
|
|
||||||
|
|
||||||
tmp<surfaceScalarField> talphaPhi;
|
|
||||||
|
|
||||||
if (MULESCorr)
|
|
||||||
{
|
|
||||||
fvScalarMatrix alpha1Eqn
|
|
||||||
(
|
|
||||||
fv::EulerDdtScheme<scalar>(mesh).fvmDdt(alpha1)
|
|
||||||
+ fv::gaussConvectionScheme<scalar>
|
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
phi,
|
|
||||||
upwind<scalar>(mesh, phi)
|
|
||||||
).fvmDiv(phi, alpha1)
|
|
||||||
- fvm::Sp(divU, alpha1)
|
|
||||||
==
|
|
||||||
fvm::Sp(vDotvmcAlphal, alpha1)
|
|
||||||
+ vDotcAlphal
|
|
||||||
);
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
talphaPhi = alpha1Eqn.flux();
|
|
||||||
}
|
|
||||||
|
|
||||||
volScalarField alpha10("alpha10", alpha1);
|
|
||||||
|
|
||||||
for (int aCorr=0; aCorr<nAlphaCorr; aCorr++)
|
|
||||||
{
|
|
||||||
tmp<surfaceScalarField> talphaPhiCorr
|
|
||||||
(
|
|
||||||
fvc::flux
|
|
||||||
(
|
|
||||||
phi,
|
|
||||||
alpha1,
|
|
||||||
compressionScheme.rewind()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (MULESCorr)
|
|
||||||
{
|
|
||||||
talphaPhiCorr.ref() -= talphaPhi();
|
|
||||||
|
|
||||||
volScalarField alpha100("alpha100", alpha10);
|
|
||||||
alpha10 = alpha1;
|
|
||||||
|
|
||||||
MULES::correct
|
|
||||||
(
|
|
||||||
geometricOneField(),
|
|
||||||
alpha1,
|
|
||||||
talphaPhi(),
|
|
||||||
talphaPhiCorr.ref(),
|
|
||||||
vDotvmcAlphal,
|
|
||||||
(
|
|
||||||
divU*(alpha10 - alpha100)
|
|
||||||
- vDotvmcAlphal*alpha10
|
|
||||||
)(),
|
|
||||||
oneField(),
|
|
||||||
zeroField()
|
|
||||||
);
|
|
||||||
|
|
||||||
// Under-relax the correction for all but the 1st corrector
|
|
||||||
if (aCorr == 0)
|
|
||||||
{
|
|
||||||
talphaPhi.ref() += talphaPhiCorr();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
alpha1 = 0.5*alpha1 + 0.5*alpha10;
|
|
||||||
talphaPhi.ref() += 0.5*talphaPhiCorr();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MULES::explicitSolve
|
|
||||||
(
|
|
||||||
geometricOneField(),
|
|
||||||
alpha1,
|
|
||||||
phi,
|
|
||||||
talphaPhiCorr.ref(),
|
|
||||||
vDotvmcAlphal,
|
|
||||||
(divU*alpha1 + vDotcAlphal)(),
|
|
||||||
oneField(),
|
|
||||||
zeroField()
|
|
||||||
);
|
|
||||||
|
|
||||||
talphaPhi = talphaPhiCorr;
|
|
||||||
}
|
|
||||||
|
|
||||||
alpha2 = 1.0 - alpha1;
|
|
||||||
}
|
|
||||||
|
|
||||||
rhoPhi = talphaPhi()*(rho1 - rho2) + phi*rho2;
|
|
||||||
|
|
||||||
Info<< "Liquid phase volume fraction = "
|
|
||||||
<< alpha1.weightedAverage(mesh.V()).value()
|
|
||||||
<< " Min(" << alpha1.name() << ") = " << min(alpha1).value()
|
|
||||||
<< " Max(" << alpha1.name() << ") = " << max(alpha1).value()
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
if (nAlphaSubCycles > 1)
|
|
||||||
{
|
|
||||||
dimensionedScalar totalDeltaT = runTime.deltaT();
|
|
||||||
surfaceScalarField rhoPhiSum
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"rhoPhiSum",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh
|
|
||||||
),
|
|
||||||
mesh,
|
|
||||||
dimensionedScalar(rhoPhi.dimensions(), 0)
|
|
||||||
);
|
|
||||||
|
|
||||||
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;
|
|
||||||
@ -1,112 +0,0 @@
|
|||||||
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<< "Creating phaseChangeTwoPhaseMixture\n" << endl;
|
|
||||||
autoPtr<phaseChangeTwoPhaseMixture> mixturePtr
|
|
||||||
(
|
|
||||||
phaseChangeTwoPhaseMixture::New(U, phi)
|
|
||||||
);
|
|
||||||
|
|
||||||
phaseChangeTwoPhaseMixture& mixture = mixturePtr();
|
|
||||||
|
|
||||||
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
|
|
||||||
),
|
|
||||||
alpha1*rho1 + alpha2*rho2
|
|
||||||
);
|
|
||||||
rho.oldTime();
|
|
||||||
|
|
||||||
|
|
||||||
// Construct incompressible turbulence model
|
|
||||||
autoPtr<incompressible::momentumTransportModel> turbulence
|
|
||||||
(
|
|
||||||
incompressible::momentumTransportModel::New(U, phi, mixture)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
#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,
|
|
||||||
pimple.dict(),
|
|
||||||
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());
|
|
||||||
|
|
||||||
#include "createFvOptions.H"
|
|
||||||
@ -1,175 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration | Website: https://openfoam.org
|
|
||||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
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
|
|
||||||
interPhaseChangeFoam
|
|
||||||
|
|
||||||
Description
|
|
||||||
Solver for 2 incompressible, isothermal immiscible fluids with phase-change
|
|
||||||
(e.g. cavitation). Uses a VOF (volume of fluid) phase-fraction based
|
|
||||||
interface capturing approach, with optional mesh motion and mesh topology
|
|
||||||
changes including adaptive re-meshing.
|
|
||||||
|
|
||||||
The momentum and other fluid properties are of the "mixture" and a
|
|
||||||
single momentum equation is solved.
|
|
||||||
|
|
||||||
The set of phase-change models provided are designed to simulate cavitation
|
|
||||||
but other mechanisms of phase-change are supported within this solver
|
|
||||||
framework.
|
|
||||||
|
|
||||||
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "fvCFD.H"
|
|
||||||
#include "dynamicFvMesh.H"
|
|
||||||
#include "CMULES.H"
|
|
||||||
#include "subCycle.H"
|
|
||||||
#include "interfaceProperties.H"
|
|
||||||
#include "phaseChangeTwoPhaseMixture.H"
|
|
||||||
#include "kinematicMomentumTransportModel.H"
|
|
||||||
#include "pimpleControl.H"
|
|
||||||
#include "fvOptions.H"
|
|
||||||
#include "CorrectPhi.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
#include "postProcess.H"
|
|
||||||
|
|
||||||
#include "setRootCaseLists.H"
|
|
||||||
#include "createTime.H"
|
|
||||||
#include "createDynamicFvMesh.H"
|
|
||||||
#include "createDyMControls.H"
|
|
||||||
#include "initContinuityErrs.H"
|
|
||||||
#include "createFields.H"
|
|
||||||
#include "initCorrectPhi.H"
|
|
||||||
#include "createUfIfPresent.H"
|
|
||||||
|
|
||||||
turbulence->validate();
|
|
||||||
|
|
||||||
#include "CourantNo.H"
|
|
||||||
#include "setInitialDeltaT.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
|
||||||
|
|
||||||
while (pimple.run(runTime))
|
|
||||||
{
|
|
||||||
#include "readDyMControls.H"
|
|
||||||
|
|
||||||
// Store divU from the previous mesh so that it can be mapped
|
|
||||||
// and used in correctPhi to ensure the corrected phi has the
|
|
||||||
// same divergence
|
|
||||||
volScalarField divU("divU0", fvc::div(fvc::absolute(phi, U)));
|
|
||||||
|
|
||||||
#include "CourantNo.H"
|
|
||||||
#include "alphaCourantNo.H"
|
|
||||||
#include "setDeltaT.H"
|
|
||||||
|
|
||||||
runTime++;
|
|
||||||
|
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
|
||||||
|
|
||||||
// --- Pressure-velocity PIMPLE corrector loop
|
|
||||||
while (pimple.loop())
|
|
||||||
{
|
|
||||||
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
|
|
||||||
{
|
|
||||||
mesh.update();
|
|
||||||
|
|
||||||
if (mesh.changing())
|
|
||||||
{
|
|
||||||
gh = (g & mesh.C()) - ghRef;
|
|
||||||
ghf = (g & mesh.Cf()) - ghRef;
|
|
||||||
|
|
||||||
if (correctPhi)
|
|
||||||
{
|
|
||||||
// Calculate absolute flux
|
|
||||||
// from the mapped surface velocity
|
|
||||||
phi = mesh.Sf() & Uf();
|
|
||||||
|
|
||||||
#include "correctPhi.H"
|
|
||||||
|
|
||||||
// Make the flux relative to the mesh motion
|
|
||||||
fvc::makeRelative(phi, U);
|
|
||||||
}
|
|
||||||
|
|
||||||
mixture.correct();
|
|
||||||
|
|
||||||
if (checkMeshCourantNo)
|
|
||||||
{
|
|
||||||
#include "meshCourantNo.H"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
divU = fvc::div(fvc::absolute(phi, U));
|
|
||||||
|
|
||||||
surfaceScalarField rhoPhi
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"rhoPhi",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh
|
|
||||||
),
|
|
||||||
mesh,
|
|
||||||
dimensionedScalar(dimMass/dimTime, 0)
|
|
||||||
);
|
|
||||||
|
|
||||||
#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();
|
|
||||||
|
|
||||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
|
||||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
|
||||||
<< nl << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
Info<< "End\n" << endl;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C
|
|
||||||
phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixtureNew.C
|
|
||||||
Kunz/Kunz.C
|
|
||||||
Merkle/Merkle.C
|
|
||||||
SchnerrSauer/SchnerrSauer.C
|
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libphaseChangeTwoPhaseMixtures
|
|
||||||
@ -1,6 +1,4 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I. \
|
|
||||||
-I../interFoam \
|
|
||||||
-ImultiphaseMixture/lnInclude \
|
-ImultiphaseMixture/lnInclude \
|
||||||
-I$(LIB_SRC)/transportModels/lnInclude \
|
-I$(LIB_SRC)/transportModels/lnInclude \
|
||||||
-I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \
|
-I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \
|
||||||
|
|||||||
33
applications/solvers/multiphase/multiphaseInterFoam/UEqn.H
Normal file
33
applications/solvers/multiphase/multiphaseInterFoam/UEqn.H
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
MRF.correctBoundaryVelocity(U);
|
||||||
|
|
||||||
|
fvVectorMatrix UEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(rho, U) + fvm::div(rhoPhi, U)
|
||||||
|
+ MRF.DDt(rho, U)
|
||||||
|
+ turbulence->divDevTau(rho, U)
|
||||||
|
==
|
||||||
|
fvOptions(rho, U)
|
||||||
|
);
|
||||||
|
|
||||||
|
UEqn.relax();
|
||||||
|
|
||||||
|
fvOptions.constrain(UEqn);
|
||||||
|
|
||||||
|
if (pimple.momentumPredictor())
|
||||||
|
{
|
||||||
|
solve
|
||||||
|
(
|
||||||
|
UEqn
|
||||||
|
==
|
||||||
|
fvc::reconstruct
|
||||||
|
(
|
||||||
|
(
|
||||||
|
mixture.surfaceTensionForce()
|
||||||
|
- ghf*fvc::snGrad(rho)
|
||||||
|
- fvc::snGrad(p_rgh)
|
||||||
|
) * mesh.magSf()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
fvOptions.correct(U);
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
CorrectPhi
|
||||||
|
(
|
||||||
|
U,
|
||||||
|
phi,
|
||||||
|
p_rgh,
|
||||||
|
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||||
|
geometricZeroField(),
|
||||||
|
pimple,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
#include "continuityErrs.H"
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
tmp<volScalarField> rAU;
|
||||||
|
|
||||||
|
if (correctPhi)
|
||||||
|
{
|
||||||
|
rAU = new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rAU",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar(dimTime/dimDensity, 1)
|
||||||
|
);
|
||||||
|
|
||||||
|
CorrectPhi
|
||||||
|
(
|
||||||
|
U,
|
||||||
|
phi,
|
||||||
|
p_rgh,
|
||||||
|
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||||
|
geometricZeroField(),
|
||||||
|
pimple,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
#include "continuityErrs.H"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CorrectPhi
|
||||||
|
(
|
||||||
|
U,
|
||||||
|
phi,
|
||||||
|
p_rgh,
|
||||||
|
dimensionedScalar(dimTime/rho.dimensions(), 1),
|
||||||
|
geometricZeroField(),
|
||||||
|
pimple,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
#include "continuityErrs.H"
|
||||||
|
}
|
||||||
89
applications/solvers/multiphase/multiphaseInterFoam/pEqn.H
Normal file
89
applications/solvers/multiphase/multiphaseInterFoam/pEqn.H
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
{
|
||||||
|
if (correctPhi)
|
||||||
|
{
|
||||||
|
rAU.ref() = 1.0/UEqn.A();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rAU = 1.0/UEqn.A();
|
||||||
|
}
|
||||||
|
|
||||||
|
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU()));
|
||||||
|
volVectorField HbyA(constrainHbyA(rAU()*UEqn.H(), U, p_rgh));
|
||||||
|
surfaceScalarField phiHbyA
|
||||||
|
(
|
||||||
|
"phiHbyA",
|
||||||
|
fvc::flux(HbyA)
|
||||||
|
+ MRF.zeroFilter(fvc::interpolate(rho*rAU())*fvc::ddtCorr(U, phi, Uf))
|
||||||
|
);
|
||||||
|
MRF.makeRelative(phiHbyA);
|
||||||
|
|
||||||
|
if (p_rgh.needReference())
|
||||||
|
{
|
||||||
|
fvc::makeRelative(phiHbyA, U);
|
||||||
|
adjustPhi(phiHbyA, U, p_rgh);
|
||||||
|
fvc::makeAbsolute(phiHbyA, U);
|
||||||
|
}
|
||||||
|
|
||||||
|
surfaceScalarField phig
|
||||||
|
(
|
||||||
|
(
|
||||||
|
mixture.surfaceTensionForce()
|
||||||
|
- ghf*fvc::snGrad(rho)
|
||||||
|
)*rAUf*mesh.magSf()
|
||||||
|
);
|
||||||
|
|
||||||
|
phiHbyA += phig;
|
||||||
|
|
||||||
|
// Update the pressure BCs to ensure flux consistency
|
||||||
|
constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF);
|
||||||
|
|
||||||
|
while (pimple.correctNonOrthogonal())
|
||||||
|
{
|
||||||
|
fvScalarMatrix p_rghEqn
|
||||||
|
(
|
||||||
|
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA)
|
||||||
|
);
|
||||||
|
|
||||||
|
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||||
|
|
||||||
|
p_rghEqn.solve();
|
||||||
|
|
||||||
|
if (pimple.finalNonOrthogonalIter())
|
||||||
|
{
|
||||||
|
phi = phiHbyA - p_rghEqn.flux();
|
||||||
|
|
||||||
|
p_rgh.relax();
|
||||||
|
|
||||||
|
U = HbyA + rAU()*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
|
fvOptions.correct(U);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
|
// Correct Uf if the mesh is moving
|
||||||
|
fvc::correctUf(Uf, U, phi);
|
||||||
|
|
||||||
|
// Make the fluxes relative to the mesh motion
|
||||||
|
fvc::makeRelative(phi, U);
|
||||||
|
|
||||||
|
p == p_rgh + rho*gh;
|
||||||
|
|
||||||
|
if (p_rgh.needReference())
|
||||||
|
{
|
||||||
|
p += dimensionedScalar
|
||||||
|
(
|
||||||
|
"p",
|
||||||
|
p.dimensions(),
|
||||||
|
pRefValue - getRefCellValue(p, pRefCell)
|
||||||
|
);
|
||||||
|
p_rgh = p - rho*gh;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!correctPhi)
|
||||||
|
{
|
||||||
|
rAU.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
54
bin/interPhaseChangeFoam
Executable file
54
bin/interPhaseChangeFoam
Executable file
@ -0,0 +1,54 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# ========= |
|
||||||
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
# \\ / O peration | Website: https://openfoam.org
|
||||||
|
# \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
|
||||||
|
# \\/ M anipulation |
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# 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/>.
|
||||||
|
#
|
||||||
|
# Script
|
||||||
|
# interPhaseChangeFoam
|
||||||
|
#
|
||||||
|
# Description
|
||||||
|
# Script to inform the user that interPhaseChangeFoam has been replaced
|
||||||
|
# by the more general interFoam solver.
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
The interPhaseChangeFoam solver has solver has been replaced by the more general
|
||||||
|
interFoam solver, which now supports phase-change using the new twoPhaseChange
|
||||||
|
models library.
|
||||||
|
|
||||||
|
To run with with phase-change create a constant/phaseChangeProperties dictionary
|
||||||
|
containing the phase-change model specification, e.g.
|
||||||
|
|
||||||
|
phaseChangeModel SchnerrSauer;
|
||||||
|
|
||||||
|
pSat 2300; // Saturation pressure
|
||||||
|
|
||||||
|
See the following cases for an example converted from interPhaseChangeFoam:
|
||||||
|
|
||||||
|
\$FOAM_TUTORIALS/multiphase/interFoam/laminar/cavitatingBullet
|
||||||
|
\$FOAM_TUTORIALS/multiphase/interFoam/RAS/propeller
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
@ -1986,31 +1986,6 @@ _interMixingFoam_ ()
|
|||||||
}
|
}
|
||||||
complete -o filenames -o nospace -F _interMixingFoam_ interMixingFoam
|
complete -o filenames -o nospace -F _interMixingFoam_ interMixingFoam
|
||||||
|
|
||||||
_interPhaseChangeFoam_ ()
|
|
||||||
{
|
|
||||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
|
||||||
local prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
||||||
local line=${COMP_LINE}
|
|
||||||
local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ")
|
|
||||||
|
|
||||||
opts="-case -doc -fileHandler -help -hostRoots -libs -listFunctionObjects -listFvOptions -listMomentumTransportModels -listScalarBCs -listSwitches -listVectorBCs -noFunctionObjects -parallel -postProcess -roots -srcDoc"
|
|
||||||
for o in $used ; do opts="${opts/$o/}" ; done
|
|
||||||
extra=""
|
|
||||||
|
|
||||||
[ "$COMP_CWORD" = 1 ] || \
|
|
||||||
case "$prev" in
|
|
||||||
-case)
|
|
||||||
opts="" ; extra="-d" ;;
|
|
||||||
-fileHandler)
|
|
||||||
opts="uncollated collated masterUncollated" ; extra="" ;;
|
|
||||||
-hostRoots|-libs|-roots)
|
|
||||||
opts="" ; extra="" ;;
|
|
||||||
*) ;;
|
|
||||||
esac
|
|
||||||
COMPREPLY=( $(compgen -W "${opts}" $extra -- ${cur}) )
|
|
||||||
}
|
|
||||||
complete -o filenames -o nospace -F _interPhaseChangeFoam_ interPhaseChangeFoam
|
|
||||||
|
|
||||||
_kivaToFoam_ ()
|
_kivaToFoam_ ()
|
||||||
{
|
{
|
||||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -371,12 +371,12 @@ inline void Foam::tmp<T>::operator=(const tmp<T>& t)
|
|||||||
{
|
{
|
||||||
type_ = t.type_;
|
type_ = t.type_;
|
||||||
|
|
||||||
if (!t.ptr_)
|
// if (!t.ptr_)
|
||||||
{
|
// {
|
||||||
FatalErrorInFunction
|
// FatalErrorInFunction
|
||||||
<< "Attempted assignment to a deallocated " << typeName()
|
// << "Attempted assignment to a deallocated " << typeName()
|
||||||
<< abort(FatalError);
|
// << abort(FatalError);
|
||||||
}
|
// }
|
||||||
|
|
||||||
ptr_ = t.ptr_;
|
ptr_ = t.ptr_;
|
||||||
t.ptr_ = 0;
|
t.ptr_ = 0;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -281,12 +281,12 @@ inline void Foam::tmpNrc<T>::operator=(const tmpNrc<T>& t)
|
|||||||
{
|
{
|
||||||
type_ = TMP;
|
type_ = TMP;
|
||||||
|
|
||||||
if (!t.ptr_)
|
// if (!t.ptr_)
|
||||||
{
|
// {
|
||||||
FatalErrorInFunction
|
// FatalErrorInFunction
|
||||||
<< "Attempted assignment to a deallocated " << typeName()
|
// << "Attempted assignment to a deallocated " << typeName()
|
||||||
<< abort(FatalError);
|
// << abort(FatalError);
|
||||||
}
|
// }
|
||||||
|
|
||||||
ptr_ = t.ptr_;
|
ptr_ = t.ptr_;
|
||||||
t.ptr_ = 0;
|
t.ptr_ = 0;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -256,4 +256,17 @@ Foam::fvm::SuSp
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::fvMatrix<Type>>
|
||||||
|
Foam::fvm::S
|
||||||
|
(
|
||||||
|
const Pair<tmp<volScalarField::Internal>>& s,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
tmp<fvMatrix<Type>> tfvm = fvm::Sp(s[1], vf) + s[0];
|
||||||
|
return tfvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -150,6 +150,16 @@ namespace fvm
|
|||||||
const zero&,
|
const zero&,
|
||||||
const GeometricField<Type, fvPatchField, volMesh>&
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Explict and implicit sources provided as a pair
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<fvMatrix<Type>> S
|
||||||
|
(
|
||||||
|
const Pair<tmp<volScalarField::Internal>>&,
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -9,5 +9,6 @@ wmake $targetType interfaceProperties
|
|||||||
wmake $targetType twoPhaseProperties
|
wmake $targetType twoPhaseProperties
|
||||||
wmake $targetType incompressibleTwoPhaseMixture
|
wmake $targetType incompressibleTwoPhaseMixture
|
||||||
wmake $targetType immiscibleIncompressibleTwoPhaseMixture
|
wmake $targetType immiscibleIncompressibleTwoPhaseMixture
|
||||||
|
wmake $targetType twoPhaseChange
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
9
src/twoPhaseModels/twoPhaseChange/Make/files
Normal file
9
src/twoPhaseModels/twoPhaseChange/Make/files
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
twoPhaseChangeModel/twoPhaseChangeModel.C
|
||||||
|
twoPhaseChangeModel/twoPhaseChangeModelNew.C
|
||||||
|
noPhaseChange/noPhaseChange.C
|
||||||
|
cavitation/cavitationModel/cavitationModel.C
|
||||||
|
cavitation/Kunz/Kunz.C
|
||||||
|
cavitation/Merkle/Merkle.C
|
||||||
|
cavitation/SchnerrSauer/SchnerrSauer.C
|
||||||
|
|
||||||
|
LIB = $(FOAM_LIBBIN)/libtwoPhaseChangeModels
|
||||||
@ -4,8 +4,10 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/twoPhaseModels/interfaceProperties/lnInclude \
|
-I$(LIB_SRC)/twoPhaseModels/interfaceProperties/lnInclude \
|
||||||
-I$(LIB_SRC)/twoPhaseModels/incompressibleTwoPhaseMixture/lnInclude \
|
-I$(LIB_SRC)/twoPhaseModels/incompressibleTwoPhaseMixture/lnInclude \
|
||||||
-I$(LIB_SRC)/twoPhaseModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude \
|
-I$(LIB_SRC)/twoPhaseModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-limmiscibleIncompressibleTwoPhaseMixture \
|
-limmiscibleIncompressibleTwoPhaseMixture \
|
||||||
|
-lmeshTools \
|
||||||
-lfiniteVolume
|
-lfiniteVolume
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -30,32 +30,31 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
namespace phaseChangeTwoPhaseMixtures
|
namespace twoPhaseChangeModels
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(Kunz, 0);
|
defineTypeNameAndDebug(Kunz, 0);
|
||||||
addToRunTimeSelectionTable(phaseChangeTwoPhaseMixture, Kunz, components);
|
addToRunTimeSelectionTable(cavitationModel, Kunz, dictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::phaseChangeTwoPhaseMixtures::Kunz::Kunz
|
Foam::twoPhaseChangeModels::Kunz::Kunz
|
||||||
(
|
(
|
||||||
const volVectorField& U,
|
const immiscibleIncompressibleTwoPhaseMixture& mixture
|
||||||
const surfaceScalarField& phi
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
phaseChangeTwoPhaseMixture(typeName, U, phi),
|
cavitationModel(typeName, mixture),
|
||||||
|
|
||||||
UInf_("UInf", dimVelocity, phaseChangeTwoPhaseMixtureCoeffs_),
|
UInf_("UInf", dimVelocity, twoPhaseChangeModelCoeffs_),
|
||||||
tInf_("tInf", dimTime, phaseChangeTwoPhaseMixtureCoeffs_),
|
tInf_("tInf", dimTime, twoPhaseChangeModelCoeffs_),
|
||||||
Cc_("Cc", dimless, phaseChangeTwoPhaseMixtureCoeffs_),
|
Cc_("Cc", dimless, twoPhaseChangeModelCoeffs_),
|
||||||
Cv_("Cv", dimless, phaseChangeTwoPhaseMixtureCoeffs_),
|
Cv_("Cv", dimless, twoPhaseChangeModelCoeffs_),
|
||||||
|
|
||||||
p0_("0", pSat().dimensions(), 0.0),
|
p0_("0", pSat().dimensions(), 0.0),
|
||||||
|
|
||||||
mcCoeff_(Cc_*rho2()/tInf_),
|
mcCoeff_(Cc_*mixture_.rho2()/tInf_),
|
||||||
mvCoeff_(Cv_*rho2()/(0.5*rho1()*sqr(UInf_)*tInf_))
|
mvCoeff_(Cv_*mixture_.rho2()/(0.5*mixture_.rho1()*sqr(UInf_)*tInf_))
|
||||||
{
|
{
|
||||||
correct();
|
correct();
|
||||||
}
|
}
|
||||||
@ -64,10 +63,15 @@ Foam::phaseChangeTwoPhaseMixtures::Kunz::Kunz
|
|||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
||||||
Foam::phaseChangeTwoPhaseMixtures::Kunz::mDotAlphal() const
|
Foam::twoPhaseChangeModels::Kunz::mDotAlphal() const
|
||||||
{
|
{
|
||||||
const volScalarField& p = alpha1().db().lookupObject<volScalarField>("p");
|
const volScalarField& p =
|
||||||
volScalarField limitedAlpha1(min(max(alpha1(), scalar(0)), scalar(1)));
|
mixture_.U().db().lookupObject<volScalarField>("p");
|
||||||
|
|
||||||
|
const volScalarField limitedAlpha1
|
||||||
|
(
|
||||||
|
min(max(mixture_.alpha1(), scalar(0)), scalar(1))
|
||||||
|
);
|
||||||
|
|
||||||
return Pair<tmp<volScalarField>>
|
return Pair<tmp<volScalarField>>
|
||||||
(
|
(
|
||||||
@ -80,10 +84,15 @@ Foam::phaseChangeTwoPhaseMixtures::Kunz::mDotAlphal() const
|
|||||||
|
|
||||||
|
|
||||||
Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
||||||
Foam::phaseChangeTwoPhaseMixtures::Kunz::mDotP() const
|
Foam::twoPhaseChangeModels::Kunz::mDotP() const
|
||||||
{
|
{
|
||||||
const volScalarField& p = alpha1().db().lookupObject<volScalarField>("p");
|
const volScalarField& p =
|
||||||
volScalarField limitedAlpha1(min(max(alpha1(), scalar(0)), scalar(1)));
|
mixture_.U().db().lookupObject<volScalarField>("p");
|
||||||
|
|
||||||
|
const volScalarField limitedAlpha1
|
||||||
|
(
|
||||||
|
min(max(mixture_.alpha1(), scalar(0)), scalar(1))
|
||||||
|
);
|
||||||
|
|
||||||
return Pair<tmp<volScalarField>>
|
return Pair<tmp<volScalarField>>
|
||||||
(
|
(
|
||||||
@ -95,25 +104,25 @@ Foam::phaseChangeTwoPhaseMixtures::Kunz::mDotP() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::phaseChangeTwoPhaseMixtures::Kunz::correct()
|
void Foam::twoPhaseChangeModels::Kunz::correct()
|
||||||
{
|
{
|
||||||
phaseChangeTwoPhaseMixture::correct();
|
cavitationModel::correct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::phaseChangeTwoPhaseMixtures::Kunz::read()
|
bool Foam::twoPhaseChangeModels::Kunz::read()
|
||||||
{
|
{
|
||||||
if (phaseChangeTwoPhaseMixture::read())
|
if (cavitationModel::read())
|
||||||
{
|
{
|
||||||
phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs");
|
twoPhaseChangeModelCoeffs_ = optionalSubDict(type() + "Coeffs");
|
||||||
|
|
||||||
phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_;
|
twoPhaseChangeModelCoeffs_.lookup("UInf") >> UInf_;
|
||||||
phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_;
|
twoPhaseChangeModelCoeffs_.lookup("tInf") >> tInf_;
|
||||||
phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_;
|
twoPhaseChangeModelCoeffs_.lookup("Cc") >> Cc_;
|
||||||
phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_;
|
twoPhaseChangeModelCoeffs_.lookup("Cv") >> Cv_;
|
||||||
|
|
||||||
mcCoeff_ = Cc_*rho2()/tInf_;
|
mcCoeff_ = Cc_*mixture_.rho2()/tInf_;
|
||||||
mvCoeff_ = Cv_*rho2()/(0.5*rho1()*sqr(UInf_)*tInf_);
|
mvCoeff_ = Cv_*mixture_.rho2()/(0.5*mixture_.rho1()*sqr(UInf_)*tInf_);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -22,7 +22,7 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::phaseChangeTwoPhaseMixtures::Kunz
|
Foam::twoPhaseChangeModels::Kunz
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Kunz cavitation model slightly modified so that the condensation term
|
Kunz cavitation model slightly modified so that the condensation term
|
||||||
@ -49,13 +49,13 @@ SourceFiles
|
|||||||
#ifndef Kunz_H
|
#ifndef Kunz_H
|
||||||
#define Kunz_H
|
#define Kunz_H
|
||||||
|
|
||||||
#include "phaseChangeTwoPhaseMixture.H"
|
#include "cavitationModel.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
namespace phaseChangeTwoPhaseMixtures
|
namespace twoPhaseChangeModels
|
||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -64,7 +64,7 @@ namespace phaseChangeTwoPhaseMixtures
|
|||||||
|
|
||||||
class Kunz
|
class Kunz
|
||||||
:
|
:
|
||||||
public phaseChangeTwoPhaseMixture
|
public cavitationModel
|
||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
@ -87,11 +87,10 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct for mixture
|
||||||
Kunz
|
Kunz
|
||||||
(
|
(
|
||||||
const volVectorField& U,
|
const immiscibleIncompressibleTwoPhaseMixture& mixture
|
||||||
const surfaceScalarField& phi
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -121,7 +120,7 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace phaseChangeTwoPhaseMixtures
|
} // End namespace twoPhaseChangeModels
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -30,32 +30,31 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
namespace phaseChangeTwoPhaseMixtures
|
namespace twoPhaseChangeModels
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(Merkle, 0);
|
defineTypeNameAndDebug(Merkle, 0);
|
||||||
addToRunTimeSelectionTable(phaseChangeTwoPhaseMixture, Merkle, components);
|
addToRunTimeSelectionTable(cavitationModel, Merkle, dictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::phaseChangeTwoPhaseMixtures::Merkle::Merkle
|
Foam::twoPhaseChangeModels::Merkle::Merkle
|
||||||
(
|
(
|
||||||
const volVectorField& U,
|
const immiscibleIncompressibleTwoPhaseMixture& mixture
|
||||||
const surfaceScalarField& phi
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
phaseChangeTwoPhaseMixture(typeName, U, phi),
|
cavitationModel(typeName, mixture),
|
||||||
|
|
||||||
UInf_("UInf", dimVelocity, phaseChangeTwoPhaseMixtureCoeffs_),
|
UInf_("UInf", dimVelocity, twoPhaseChangeModelCoeffs_),
|
||||||
tInf_("tInf", dimTime, phaseChangeTwoPhaseMixtureCoeffs_),
|
tInf_("tInf", dimTime, twoPhaseChangeModelCoeffs_),
|
||||||
Cc_("Cc", dimless, phaseChangeTwoPhaseMixtureCoeffs_),
|
Cc_("Cc", dimless, twoPhaseChangeModelCoeffs_),
|
||||||
Cv_("Cv", dimless, phaseChangeTwoPhaseMixtureCoeffs_),
|
Cv_("Cv", dimless, twoPhaseChangeModelCoeffs_),
|
||||||
|
|
||||||
p0_("0", pSat().dimensions(), 0.0),
|
p0_("0", pSat().dimensions(), 0.0),
|
||||||
|
|
||||||
mcCoeff_(Cc_/(0.5*sqr(UInf_)*tInf_)),
|
mcCoeff_(Cc_/(0.5*sqr(UInf_)*tInf_)),
|
||||||
mvCoeff_(Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2()))
|
mvCoeff_(Cv_*mixture_.rho1()/(0.5*sqr(UInf_)*tInf_*mixture_.rho2()))
|
||||||
{
|
{
|
||||||
correct();
|
correct();
|
||||||
}
|
}
|
||||||
@ -64,9 +63,10 @@ Foam::phaseChangeTwoPhaseMixtures::Merkle::Merkle
|
|||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
||||||
Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotAlphal() const
|
Foam::twoPhaseChangeModels::Merkle::mDotAlphal() const
|
||||||
{
|
{
|
||||||
const volScalarField& p = alpha1().db().lookupObject<volScalarField>("p");
|
const volScalarField& p =
|
||||||
|
mixture_.U().db().lookupObject<volScalarField>("p");
|
||||||
|
|
||||||
return Pair<tmp<volScalarField>>
|
return Pair<tmp<volScalarField>>
|
||||||
(
|
(
|
||||||
@ -77,10 +77,15 @@ Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotAlphal() const
|
|||||||
|
|
||||||
|
|
||||||
Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
||||||
Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotP() const
|
Foam::twoPhaseChangeModels::Merkle::mDotP() const
|
||||||
{
|
{
|
||||||
const volScalarField& p = alpha1().db().lookupObject<volScalarField>("p");
|
const volScalarField& p =
|
||||||
volScalarField limitedAlpha1(min(max(alpha1(), scalar(0)), scalar(1)));
|
mixture_.U().db().lookupObject<volScalarField>("p");
|
||||||
|
|
||||||
|
const volScalarField limitedAlpha1
|
||||||
|
(
|
||||||
|
min(max(mixture_.alpha1(), scalar(0)), scalar(1))
|
||||||
|
);
|
||||||
|
|
||||||
return Pair<tmp<volScalarField>>
|
return Pair<tmp<volScalarField>>
|
||||||
(
|
(
|
||||||
@ -90,25 +95,25 @@ Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotP() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::phaseChangeTwoPhaseMixtures::Merkle::correct()
|
void Foam::twoPhaseChangeModels::Merkle::correct()
|
||||||
{
|
{
|
||||||
phaseChangeTwoPhaseMixture::correct();
|
cavitationModel::correct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::phaseChangeTwoPhaseMixtures::Merkle::read()
|
bool Foam::twoPhaseChangeModels::Merkle::read()
|
||||||
{
|
{
|
||||||
if (phaseChangeTwoPhaseMixture::read())
|
if (cavitationModel::read())
|
||||||
{
|
{
|
||||||
phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs");
|
twoPhaseChangeModelCoeffs_ = optionalSubDict(type() + "Coeffs");
|
||||||
|
|
||||||
phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_;
|
twoPhaseChangeModelCoeffs_.lookup("UInf") >> UInf_;
|
||||||
phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_;
|
twoPhaseChangeModelCoeffs_.lookup("tInf") >> tInf_;
|
||||||
phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_;
|
twoPhaseChangeModelCoeffs_.lookup("Cc") >> Cc_;
|
||||||
phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_;
|
twoPhaseChangeModelCoeffs_.lookup("Cv") >> Cv_;
|
||||||
|
|
||||||
mcCoeff_ = Cc_/(0.5*sqr(UInf_)*tInf_);
|
mcCoeff_ = Cc_/(0.5*sqr(UInf_)*tInf_);
|
||||||
mvCoeff_ = Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2());
|
mvCoeff_ = Cv_*mixture_.rho1()/(0.5*sqr(UInf_)*tInf_*mixture_.rho2());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -22,7 +22,7 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::phaseChangeTwoPhaseMixtures::Merkle
|
Foam::twoPhaseChangeModels::Merkle
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Merkle cavitation model.
|
Merkle cavitation model.
|
||||||
@ -43,13 +43,13 @@ SourceFiles
|
|||||||
#ifndef Merkle_H
|
#ifndef Merkle_H
|
||||||
#define Merkle_H
|
#define Merkle_H
|
||||||
|
|
||||||
#include "phaseChangeTwoPhaseMixture.H"
|
#include "cavitationModel.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
namespace phaseChangeTwoPhaseMixtures
|
namespace twoPhaseChangeModels
|
||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -58,7 +58,7 @@ namespace phaseChangeTwoPhaseMixtures
|
|||||||
|
|
||||||
class Merkle
|
class Merkle
|
||||||
:
|
:
|
||||||
public phaseChangeTwoPhaseMixture
|
public cavitationModel
|
||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
@ -81,11 +81,10 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct for mixture
|
||||||
Merkle
|
Merkle
|
||||||
(
|
(
|
||||||
const volVectorField& U,
|
const immiscibleIncompressibleTwoPhaseMixture& mixture
|
||||||
const surfaceScalarField& phi
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -115,7 +114,7 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace phaseChangeTwoPhaseMixtures
|
} // End namespace twoPhaseChangeModels
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -31,14 +31,14 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
namespace phaseChangeTwoPhaseMixtures
|
namespace twoPhaseChangeModels
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(SchnerrSauer, 0);
|
defineTypeNameAndDebug(SchnerrSauer, 0);
|
||||||
addToRunTimeSelectionTable
|
addToRunTimeSelectionTable
|
||||||
(
|
(
|
||||||
phaseChangeTwoPhaseMixture,
|
cavitationModel,
|
||||||
SchnerrSauer,
|
SchnerrSauer,
|
||||||
components
|
dictionary
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,18 +46,17 @@ namespace phaseChangeTwoPhaseMixtures
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::SchnerrSauer
|
Foam::twoPhaseChangeModels::SchnerrSauer::SchnerrSauer
|
||||||
(
|
(
|
||||||
const volVectorField& U,
|
const immiscibleIncompressibleTwoPhaseMixture& mixture
|
||||||
const surfaceScalarField& phi
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
phaseChangeTwoPhaseMixture(typeName, U, phi),
|
cavitationModel(typeName, mixture),
|
||||||
|
|
||||||
n_("n", dimless/dimVolume, phaseChangeTwoPhaseMixtureCoeffs_),
|
n_("n", dimless/dimVolume, twoPhaseChangeModelCoeffs_),
|
||||||
dNuc_("dNuc", dimLength, phaseChangeTwoPhaseMixtureCoeffs_),
|
dNuc_("dNuc", dimLength, twoPhaseChangeModelCoeffs_),
|
||||||
Cc_("Cc", dimless, phaseChangeTwoPhaseMixtureCoeffs_),
|
Cc_("Cc", dimless, twoPhaseChangeModelCoeffs_),
|
||||||
Cv_("Cv", dimless, phaseChangeTwoPhaseMixtureCoeffs_),
|
Cv_("Cv", dimless, twoPhaseChangeModelCoeffs_),
|
||||||
|
|
||||||
p0_("0", pSat().dimensions(), 0.0)
|
p0_("0", pSat().dimensions(), 0.0)
|
||||||
{
|
{
|
||||||
@ -68,7 +67,7 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::SchnerrSauer
|
|||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::rRb
|
Foam::twoPhaseChangeModels::SchnerrSauer::rRb
|
||||||
(
|
(
|
||||||
const volScalarField& limitedAlpha1
|
const volScalarField& limitedAlpha1
|
||||||
) const
|
) const
|
||||||
@ -83,7 +82,7 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::rRb
|
|||||||
|
|
||||||
|
|
||||||
Foam::dimensionedScalar
|
Foam::dimensionedScalar
|
||||||
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::alphaNuc() const
|
Foam::twoPhaseChangeModels::SchnerrSauer::alphaNuc() const
|
||||||
{
|
{
|
||||||
dimensionedScalar Vnuc = n_*constant::mathematical::pi*pow3(dNuc_)/6;
|
dimensionedScalar Vnuc = n_*constant::mathematical::pi*pow3(dNuc_)/6;
|
||||||
return Vnuc/(1 + Vnuc);
|
return Vnuc/(1 + Vnuc);
|
||||||
@ -91,30 +90,40 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::alphaNuc() const
|
|||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::pCoeff
|
Foam::twoPhaseChangeModels::SchnerrSauer::pCoeff
|
||||||
(
|
(
|
||||||
const volScalarField& p
|
const volScalarField& p
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
volScalarField limitedAlpha1(min(max(alpha1(), scalar(0)), scalar(1)));
|
const volScalarField limitedAlpha1
|
||||||
volScalarField rho
|
|
||||||
(
|
(
|
||||||
limitedAlpha1*rho1() + (scalar(1) - limitedAlpha1)*rho2()
|
min(max(mixture_.alpha1(), scalar(0)), scalar(1))
|
||||||
|
);
|
||||||
|
|
||||||
|
const volScalarField rho
|
||||||
|
(
|
||||||
|
limitedAlpha1*mixture_.rho1()
|
||||||
|
+ (scalar(1) - limitedAlpha1)*mixture_.rho2()
|
||||||
);
|
);
|
||||||
|
|
||||||
return
|
return
|
||||||
(3*rho1()*rho2())*sqrt(2/(3*rho1()))
|
(3*mixture_.rho1()*mixture_.rho2())*sqrt(2/(3*mixture_.rho1()))
|
||||||
*rRb(limitedAlpha1)/(rho*sqrt(mag(p - pSat()) + 0.01*pSat()));
|
*rRb(limitedAlpha1)/(rho*sqrt(mag(p - pSat()) + 0.01*pSat()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
||||||
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotAlphal() const
|
Foam::twoPhaseChangeModels::SchnerrSauer::mDotAlphal() const
|
||||||
{
|
{
|
||||||
const volScalarField& p = alpha1().db().lookupObject<volScalarField>("p");
|
const volScalarField& p =
|
||||||
volScalarField pCoeff(this->pCoeff(p));
|
mixture_.U().db().lookupObject<volScalarField>("p");
|
||||||
|
|
||||||
volScalarField limitedAlpha1(min(max(alpha1(), scalar(0)), scalar(1)));
|
const volScalarField pCoeff(this->pCoeff(p));
|
||||||
|
|
||||||
|
const volScalarField limitedAlpha1
|
||||||
|
(
|
||||||
|
min(max(mixture_.alpha1(), scalar(0)), scalar(1))
|
||||||
|
);
|
||||||
|
|
||||||
return Pair<tmp<volScalarField>>
|
return Pair<tmp<volScalarField>>
|
||||||
(
|
(
|
||||||
@ -126,13 +135,19 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotAlphal() const
|
|||||||
|
|
||||||
|
|
||||||
Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
||||||
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotP() const
|
Foam::twoPhaseChangeModels::SchnerrSauer::mDotP() const
|
||||||
{
|
{
|
||||||
const volScalarField& p = alpha1().db().lookupObject<volScalarField>("p");
|
const volScalarField& p =
|
||||||
volScalarField pCoeff(this->pCoeff(p));
|
mixture_.U().db().lookupObject<volScalarField>("p");
|
||||||
|
|
||||||
volScalarField limitedAlpha1(min(max(alpha1(), scalar(0)), scalar(1)));
|
const volScalarField pCoeff(this->pCoeff(p));
|
||||||
volScalarField apCoeff(limitedAlpha1*pCoeff);
|
|
||||||
|
const volScalarField limitedAlpha1
|
||||||
|
(
|
||||||
|
min(max(mixture_.alpha1(), scalar(0)), scalar(1))
|
||||||
|
);
|
||||||
|
|
||||||
|
const volScalarField apCoeff(limitedAlpha1*pCoeff);
|
||||||
|
|
||||||
return Pair<tmp<volScalarField>>
|
return Pair<tmp<volScalarField>>
|
||||||
(
|
(
|
||||||
@ -143,22 +158,22 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotP() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::correct()
|
void Foam::twoPhaseChangeModels::SchnerrSauer::correct()
|
||||||
{
|
{
|
||||||
phaseChangeTwoPhaseMixture::correct();
|
cavitationModel::correct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::read()
|
bool Foam::twoPhaseChangeModels::SchnerrSauer::read()
|
||||||
{
|
{
|
||||||
if (phaseChangeTwoPhaseMixture::read())
|
if (cavitationModel::read())
|
||||||
{
|
{
|
||||||
phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs");
|
twoPhaseChangeModelCoeffs_ = optionalSubDict(type() + "Coeffs");
|
||||||
|
|
||||||
phaseChangeTwoPhaseMixtureCoeffs_.lookup("n") >> n_;
|
twoPhaseChangeModelCoeffs_.lookup("n") >> n_;
|
||||||
phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc") >> dNuc_;
|
twoPhaseChangeModelCoeffs_.lookup("dNuc") >> dNuc_;
|
||||||
phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_;
|
twoPhaseChangeModelCoeffs_.lookup("Cc") >> Cc_;
|
||||||
phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_;
|
twoPhaseChangeModelCoeffs_.lookup("Cv") >> Cv_;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -22,7 +22,7 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer
|
Foam::twoPhaseChangeModels::SchnerrSauer
|
||||||
|
|
||||||
Description
|
Description
|
||||||
SchnerrSauer cavitation model.
|
SchnerrSauer cavitation model.
|
||||||
@ -43,13 +43,13 @@ SourceFiles
|
|||||||
#ifndef SchnerrSauer_H
|
#ifndef SchnerrSauer_H
|
||||||
#define SchnerrSauer_H
|
#define SchnerrSauer_H
|
||||||
|
|
||||||
#include "phaseChangeTwoPhaseMixture.H"
|
#include "cavitationModel.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
namespace phaseChangeTwoPhaseMixtures
|
namespace twoPhaseChangeModels
|
||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -58,7 +58,7 @@ namespace phaseChangeTwoPhaseMixtures
|
|||||||
|
|
||||||
class SchnerrSauer
|
class SchnerrSauer
|
||||||
:
|
:
|
||||||
public phaseChangeTwoPhaseMixture
|
public cavitationModel
|
||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
@ -94,11 +94,10 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct for mixture
|
||||||
SchnerrSauer
|
SchnerrSauer
|
||||||
(
|
(
|
||||||
const volVectorField& U,
|
const immiscibleIncompressibleTwoPhaseMixture& mixture
|
||||||
const surfaceScalarField& phi
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -128,7 +127,7 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace phaseChangeTwoPhaseMixtures
|
} // End namespace twoPhaseChangeModels
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -0,0 +1,127 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration | Website: https://openfoam.org
|
||||||
|
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 "cavitationModel.H"
|
||||||
|
#include "fvcDdt.H"
|
||||||
|
#include "fvcDiv.H"
|
||||||
|
#include "fvmSup.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace twoPhaseChangeModels
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(cavitationModel, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::twoPhaseChangeModels::cavitationModel::cavitationModel
|
||||||
|
(
|
||||||
|
const word& type,
|
||||||
|
const immiscibleIncompressibleTwoPhaseMixture& mixture
|
||||||
|
)
|
||||||
|
:
|
||||||
|
twoPhaseChangeModel(type, mixture),
|
||||||
|
pSat_("pSat", dimPressure, lookup("pSat"))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Pair<Foam::tmp<Foam::volScalarField::Internal>>
|
||||||
|
Foam::twoPhaseChangeModels::cavitationModel::Salpha
|
||||||
|
(
|
||||||
|
volScalarField& alpha
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
volScalarField::Internal alphalCoeff
|
||||||
|
(
|
||||||
|
1.0/mixture_.rho1()
|
||||||
|
- mixture_.alpha1()()*(1.0/mixture_.rho1() - 1.0/mixture_.rho2())
|
||||||
|
);
|
||||||
|
Pair<tmp<volScalarField>> mDotAlphal = this->mDotAlphal();
|
||||||
|
|
||||||
|
const volScalarField::Internal vDotcAlphal(alphalCoeff*mDotAlphal[0]());
|
||||||
|
const volScalarField::Internal vDotvAlphal(alphalCoeff*mDotAlphal[1]());
|
||||||
|
|
||||||
|
return Pair<tmp<volScalarField::Internal>>
|
||||||
|
(
|
||||||
|
1.0*vDotcAlphal,
|
||||||
|
vDotvAlphal - vDotcAlphal
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::fvScalarMatrix>
|
||||||
|
Foam::twoPhaseChangeModels::cavitationModel::Sp_rgh
|
||||||
|
(
|
||||||
|
const volScalarField& rho,
|
||||||
|
const volScalarField& gh,
|
||||||
|
volScalarField& p_rgh
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
dimensionedScalar pCoeff(1.0/mixture_.rho1() - 1.0/mixture_.rho2());
|
||||||
|
Pair<tmp<volScalarField>> mDotP = this->mDotP();
|
||||||
|
|
||||||
|
const volScalarField vDotcP = pCoeff*mDotP[0];
|
||||||
|
const volScalarField vDotvP = pCoeff*mDotP[1];
|
||||||
|
|
||||||
|
return
|
||||||
|
(vDotvP - vDotcP)*(pSat() - rho*gh)
|
||||||
|
- fvm::Sp(vDotvP - vDotcP, p_rgh);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::fvVectorMatrix>
|
||||||
|
Foam::twoPhaseChangeModels::cavitationModel::SU
|
||||||
|
(
|
||||||
|
const volScalarField& rho,
|
||||||
|
const surfaceScalarField& rhoPhi,
|
||||||
|
volVectorField& U
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), U);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::twoPhaseChangeModels::cavitationModel::read()
|
||||||
|
{
|
||||||
|
if (twoPhaseChangeModel::read())
|
||||||
|
{
|
||||||
|
lookup("pSat") >> pSat_;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -22,45 +22,37 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::phaseChangeTwoPhaseMixture
|
Foam::twoPhaseChangeModels::cavitationModel
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
Abstract base class for cavitation models
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
phaseChangeTwoPhaseMixture.C
|
cavitationModel.C
|
||||||
phaseChangeModelNew.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef phaseChangeTwoPhaseMixture_H
|
#ifndef cavitationModel_H
|
||||||
#define phaseChangeTwoPhaseMixture_H
|
#define cavitationModel_H
|
||||||
|
|
||||||
#include "immiscibleIncompressibleTwoPhaseMixture.H"
|
#include "twoPhaseChangeModel.H"
|
||||||
#include "typeInfo.H"
|
|
||||||
#include "runTimeSelectionTables.H"
|
|
||||||
#include "volFields.H"
|
|
||||||
#include "dimensionedScalar.H"
|
|
||||||
#include "autoPtr.H"
|
|
||||||
#include "Pair.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
namespace twoPhaseChangeModels
|
||||||
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class phaseChangeTwoPhaseMixture Declaration
|
Class cavitationModel
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class phaseChangeTwoPhaseMixture
|
class cavitationModel
|
||||||
:
|
:
|
||||||
public immiscibleIncompressibleTwoPhaseMixture
|
public twoPhaseChangeModel
|
||||||
{
|
{
|
||||||
protected:
|
// Private data
|
||||||
|
|
||||||
// Protected data
|
|
||||||
|
|
||||||
dictionary phaseChangeTwoPhaseMixtureCoeffs_;
|
|
||||||
|
|
||||||
//- Saturation vapour pressure
|
//- Saturation vapour pressure
|
||||||
dimensionedScalar pSat_;
|
dimensionedScalar pSat_;
|
||||||
@ -69,50 +61,21 @@ protected:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("phaseChangeTwoPhaseMixture");
|
TypeName("cavitation");
|
||||||
|
|
||||||
|
|
||||||
// Declare run-time constructor selection table
|
|
||||||
|
|
||||||
declareRunTimeSelectionTable
|
|
||||||
(
|
|
||||||
autoPtr,
|
|
||||||
phaseChangeTwoPhaseMixture,
|
|
||||||
components,
|
|
||||||
(
|
|
||||||
const volVectorField& U,
|
|
||||||
const surfaceScalarField& phi
|
|
||||||
),
|
|
||||||
(U, phi)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct for mixture
|
||||||
phaseChangeTwoPhaseMixture
|
cavitationModel
|
||||||
(
|
(
|
||||||
const word& type,
|
const word& type,
|
||||||
const volVectorField& U,
|
const immiscibleIncompressibleTwoPhaseMixture& mixture
|
||||||
const surfaceScalarField& phi
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construction
|
|
||||||
phaseChangeTwoPhaseMixture(const phaseChangeTwoPhaseMixture&);
|
|
||||||
|
|
||||||
|
|
||||||
// Selectors
|
|
||||||
|
|
||||||
//- Return a reference to the selected phaseChange model
|
|
||||||
static autoPtr<phaseChangeTwoPhaseMixture> New
|
|
||||||
(
|
|
||||||
const volVectorField& U,
|
|
||||||
const surfaceScalarField& phi
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~phaseChangeTwoPhaseMixture()
|
virtual ~cavitationModel()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -133,31 +96,38 @@ public:
|
|||||||
// to multiply (p - pSat)
|
// to multiply (p - pSat)
|
||||||
virtual Pair<tmp<volScalarField>> mDotP() const = 0;
|
virtual Pair<tmp<volScalarField>> mDotP() const = 0;
|
||||||
|
|
||||||
//- Return the volumetric condensation and vaporisation rates as a
|
//- Return the cavitation explicit and implicit sources
|
||||||
// coefficient to multiply (1 - alphal) for the condensation rate
|
// for the phase-fraction equation
|
||||||
// and a coefficient to multiply alphal for the vaporisation rate
|
virtual Pair<tmp<volScalarField::Internal>> Salpha
|
||||||
Pair<tmp<volScalarField>> vDotAlphal() const;
|
(
|
||||||
|
volScalarField& alpha
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Return the volumetric condensation and vaporisation rates as
|
//- Return the cavitation source matrix
|
||||||
// coefficients to multiply (p - pSat)
|
// for the p_rgh pressure equation
|
||||||
Pair<tmp<volScalarField>> vDotP() const;
|
virtual tmp<fvScalarMatrix> Sp_rgh
|
||||||
|
(
|
||||||
|
const volScalarField& rho,
|
||||||
|
const volScalarField& gh,
|
||||||
|
volScalarField& p_rgh
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Correct the phaseChange model
|
//- Return the cavitation source matrix for the momentum equation
|
||||||
virtual void correct() = 0;
|
virtual tmp<fvVectorMatrix> SU
|
||||||
|
(
|
||||||
|
const volScalarField& rho,
|
||||||
|
const surfaceScalarField& rhoPhi,
|
||||||
|
volVectorField& U
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Read the transportProperties dictionary and update
|
//- Read the transportProperties dictionary and update
|
||||||
virtual bool read() = 0;
|
virtual bool read();
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const phaseChangeTwoPhaseMixture&) = delete;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace twoPhaseChangeModels
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
129
src/twoPhaseModels/twoPhaseChange/noPhaseChange/noPhaseChange.C
Normal file
129
src/twoPhaseModels/twoPhaseChange/noPhaseChange/noPhaseChange.C
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration | Website: https://openfoam.org
|
||||||
|
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 "noPhaseChange.H"
|
||||||
|
#include "fvScalarMatrix.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace twoPhaseChangeModels
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(noPhaseChange, 0);
|
||||||
|
addToRunTimeSelectionTable(twoPhaseChangeModel, noPhaseChange, dictionary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::twoPhaseChangeModels::noPhaseChange::noPhaseChange
|
||||||
|
(
|
||||||
|
const immiscibleIncompressibleTwoPhaseMixture& mixture
|
||||||
|
)
|
||||||
|
:
|
||||||
|
twoPhaseChangeModel(typeName, mixture)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
||||||
|
Foam::twoPhaseChangeModels::noPhaseChange::mDotAlphal() const
|
||||||
|
{
|
||||||
|
return Pair<tmp<volScalarField>>
|
||||||
|
(
|
||||||
|
volScalarField::null(),
|
||||||
|
volScalarField::null()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
||||||
|
Foam::twoPhaseChangeModels::noPhaseChange::mDotP() const
|
||||||
|
{
|
||||||
|
return Pair<tmp<volScalarField>>
|
||||||
|
(
|
||||||
|
volScalarField::null(),
|
||||||
|
volScalarField::null()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::Pair<Foam::tmp<Foam::volScalarField::Internal>>
|
||||||
|
Foam::twoPhaseChangeModels::noPhaseChange::Salpha
|
||||||
|
(
|
||||||
|
volScalarField& alpha
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return Pair<tmp<volScalarField::Internal>>
|
||||||
|
(
|
||||||
|
tmp<volScalarField::Internal>(nullptr),
|
||||||
|
tmp<volScalarField::Internal>(nullptr)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::fvScalarMatrix>
|
||||||
|
Foam::twoPhaseChangeModels::noPhaseChange::Sp_rgh
|
||||||
|
(
|
||||||
|
const volScalarField& rho,
|
||||||
|
const volScalarField& gh,
|
||||||
|
volScalarField& p_rgh
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvScalarMatrix>(new fvScalarMatrix(p_rgh, dimVolume/dimTime));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::fvVectorMatrix>
|
||||||
|
Foam::twoPhaseChangeModels::noPhaseChange::SU
|
||||||
|
(
|
||||||
|
const volScalarField& rho,
|
||||||
|
const surfaceScalarField& rhoPhi,
|
||||||
|
volVectorField& U
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvVectorMatrix>
|
||||||
|
(
|
||||||
|
new fvVectorMatrix(U, dimMass*dimVelocity/dimTime)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::twoPhaseChangeModels::noPhaseChange::correct()
|
||||||
|
{
|
||||||
|
twoPhaseChangeModel::correct();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::twoPhaseChangeModels::noPhaseChange::read()
|
||||||
|
{
|
||||||
|
return twoPhaseChangeModel::read();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
128
src/twoPhaseModels/twoPhaseChange/noPhaseChange/noPhaseChange.H
Normal file
128
src/twoPhaseModels/twoPhaseChange/noPhaseChange/noPhaseChange.H
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration | Website: https://openfoam.org
|
||||||
|
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::twoPhaseChangeModels::noPhaseChange
|
||||||
|
|
||||||
|
Description
|
||||||
|
Dummy phase change model for 'no phase change'
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
noPhaseChange.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef noPhaseChange_H
|
||||||
|
#define noPhaseChange_H
|
||||||
|
|
||||||
|
#include "twoPhaseChangeModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace twoPhaseChangeModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class noPhaseChange
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class noPhaseChange
|
||||||
|
:
|
||||||
|
public twoPhaseChangeModel
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("none");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct for mixture
|
||||||
|
noPhaseChange
|
||||||
|
(
|
||||||
|
const immiscibleIncompressibleTwoPhaseMixture& mixture
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~noPhaseChange()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return the mass condensation and vaporisation rates as a
|
||||||
|
// coefficient to multiply (1 - alphal) for the condensation rate
|
||||||
|
// and a coefficient to multiply alphal for the vaporisation rate
|
||||||
|
virtual Pair<tmp<volScalarField>> mDotAlphal() const;
|
||||||
|
|
||||||
|
//- Return the mass condensation and vaporisation rates as coefficients
|
||||||
|
// to multiply (p - pSat)
|
||||||
|
virtual Pair<tmp<volScalarField>> mDotP() const;
|
||||||
|
|
||||||
|
//- Return unallocated explicit and implicit sources
|
||||||
|
// for the phase-fraction equation
|
||||||
|
virtual Pair<tmp<volScalarField::Internal>> Salpha
|
||||||
|
(
|
||||||
|
volScalarField&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return the zero source matrix
|
||||||
|
// for the p_rgh pressure equation
|
||||||
|
virtual tmp<fvScalarMatrix> Sp_rgh
|
||||||
|
(
|
||||||
|
const volScalarField& rho,
|
||||||
|
const volScalarField& gh,
|
||||||
|
volScalarField& p_rgh
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return the zero source matrix for the momentum equation
|
||||||
|
virtual tmp<fvVectorMatrix> SU
|
||||||
|
(
|
||||||
|
const volScalarField& rho,
|
||||||
|
const surfaceScalarField& rhoPhi,
|
||||||
|
volVectorField& U
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Correct the noPhaseChange phaseChange model
|
||||||
|
virtual void correct();
|
||||||
|
|
||||||
|
//- Read the transportProperties dictionary and update
|
||||||
|
virtual bool read();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace twoPhaseChangeModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -23,69 +23,76 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "phaseChangeTwoPhaseMixture.H"
|
#include "twoPhaseChangeModel.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(phaseChangeTwoPhaseMixture, 0);
|
defineTypeNameAndDebug(twoPhaseChangeModel, 0);
|
||||||
defineRunTimeSelectionTable(phaseChangeTwoPhaseMixture, components);
|
defineRunTimeSelectionTable(twoPhaseChangeModel, dictionary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Foam::word Foam::twoPhaseChangeModel::phaseChangePropertiesName
|
||||||
|
(
|
||||||
|
"phaseChangeProperties"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::IOobject Foam::twoPhaseChangeModel::createIOobject
|
||||||
|
(
|
||||||
|
const immiscibleIncompressibleTwoPhaseMixture& mixture
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
IOobject io
|
||||||
|
(
|
||||||
|
phaseChangePropertiesName,
|
||||||
|
mixture.U().mesh().time().constant(),
|
||||||
|
mixture.U().mesh(),
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
);
|
||||||
|
|
||||||
|
if (io.typeHeaderOk<IOdictionary>(true))
|
||||||
|
{
|
||||||
|
io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
||||||
|
return io;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
io.readOpt() = IOobject::NO_READ;
|
||||||
|
return io;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::phaseChangeTwoPhaseMixture::phaseChangeTwoPhaseMixture
|
Foam::twoPhaseChangeModel::twoPhaseChangeModel
|
||||||
(
|
(
|
||||||
const word& type,
|
const word& type,
|
||||||
const volVectorField& U,
|
const immiscibleIncompressibleTwoPhaseMixture& mixture
|
||||||
const surfaceScalarField& phi
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
immiscibleIncompressibleTwoPhaseMixture(U, phi),
|
IOdictionary(createIOobject(mixture)),
|
||||||
phaseChangeTwoPhaseMixtureCoeffs_(optionalSubDict(type + "Coeffs")),
|
mixture_(mixture),
|
||||||
pSat_("pSat", dimPressure, lookup("pSat"))
|
twoPhaseChangeModelCoeffs_(optionalSubDict(type + "Coeffs"))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
void Foam::twoPhaseChangeModel::correct()
|
||||||
Foam::phaseChangeTwoPhaseMixture::vDotAlphal() const
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::twoPhaseChangeModel::read()
|
||||||
{
|
{
|
||||||
volScalarField alphalCoeff(1.0/rho1() - alpha1()*(1.0/rho1() - 1.0/rho2()));
|
if (regIOobject::read())
|
||||||
Pair<tmp<volScalarField>> mDotAlphal = this->mDotAlphal();
|
|
||||||
|
|
||||||
return Pair<tmp<volScalarField>>
|
|
||||||
(
|
|
||||||
alphalCoeff*mDotAlphal[0],
|
|
||||||
alphalCoeff*mDotAlphal[1]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
|
||||||
Foam::phaseChangeTwoPhaseMixture::vDotP() const
|
|
||||||
{
|
|
||||||
dimensionedScalar pCoeff(1.0/rho1() - 1.0/rho2());
|
|
||||||
Pair<tmp<volScalarField>> mDotP = this->mDotP();
|
|
||||||
|
|
||||||
return Pair<tmp<volScalarField>>(pCoeff*mDotP[0], pCoeff*mDotP[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::phaseChangeTwoPhaseMixture::correct()
|
|
||||||
{
|
|
||||||
immiscibleIncompressibleTwoPhaseMixture::correct();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Foam::phaseChangeTwoPhaseMixture::read()
|
|
||||||
{
|
|
||||||
if (immiscibleIncompressibleTwoPhaseMixture::read())
|
|
||||||
{
|
{
|
||||||
phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs");
|
twoPhaseChangeModelCoeffs_ = optionalSubDict(type() + "Coeffs");
|
||||||
lookup("pSat") >> pSat_;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -0,0 +1,173 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration | Website: https://openfoam.org
|
||||||
|
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::twoPhaseChangeModel
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
twoPhaseChangeModel.C
|
||||||
|
phaseChangeModelNew.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef twoPhaseChangeModel_H
|
||||||
|
#define twoPhaseChangeModel_H
|
||||||
|
|
||||||
|
#include "immiscibleIncompressibleTwoPhaseMixture.H"
|
||||||
|
#include "fvMatricesFwd.H"
|
||||||
|
#include "Pair.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class twoPhaseChangeModel Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class twoPhaseChangeModel
|
||||||
|
:
|
||||||
|
public IOdictionary
|
||||||
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Construct the base IO object
|
||||||
|
IOobject createIOobject
|
||||||
|
(
|
||||||
|
const immiscibleIncompressibleTwoPhaseMixture& mixture
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- Reference to the two-phase mixture
|
||||||
|
const immiscibleIncompressibleTwoPhaseMixture& mixture_;
|
||||||
|
|
||||||
|
//- Model coefficient dictionary
|
||||||
|
dictionary twoPhaseChangeModelCoeffs_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("phaseChangeModel");
|
||||||
|
|
||||||
|
//- Default phaseChangeProperties dictionary name
|
||||||
|
static const word phaseChangePropertiesName;
|
||||||
|
|
||||||
|
|
||||||
|
// Declare run-time constructor selection table
|
||||||
|
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
twoPhaseChangeModel,
|
||||||
|
dictionary,
|
||||||
|
(
|
||||||
|
const immiscibleIncompressibleTwoPhaseMixture& mixture
|
||||||
|
),
|
||||||
|
(mixture)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
twoPhaseChangeModel
|
||||||
|
(
|
||||||
|
const word& type,
|
||||||
|
const immiscibleIncompressibleTwoPhaseMixture& mixture
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construction
|
||||||
|
twoPhaseChangeModel(const twoPhaseChangeModel&);
|
||||||
|
|
||||||
|
|
||||||
|
// Selectors
|
||||||
|
|
||||||
|
//- Return a reference to the selected phaseChange model
|
||||||
|
static autoPtr<twoPhaseChangeModel> New
|
||||||
|
(
|
||||||
|
const immiscibleIncompressibleTwoPhaseMixture& mixture
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~twoPhaseChangeModel()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return the phase-change explicit and implicit sources
|
||||||
|
// for the phase-fraction equation
|
||||||
|
virtual Pair<tmp<volScalarField::Internal>> Salpha
|
||||||
|
(
|
||||||
|
volScalarField& alpha
|
||||||
|
) const = 0;
|
||||||
|
|
||||||
|
//- Return the phase-change source matrix
|
||||||
|
// for the p_rgh pressure equation
|
||||||
|
virtual tmp<fvScalarMatrix> Sp_rgh
|
||||||
|
(
|
||||||
|
const volScalarField& rho,
|
||||||
|
const volScalarField& gh,
|
||||||
|
volScalarField& p_rgh
|
||||||
|
) const = 0;
|
||||||
|
|
||||||
|
//- Return the phase-change source matrix for the momentum equation
|
||||||
|
virtual tmp<fvVectorMatrix> SU
|
||||||
|
(
|
||||||
|
const volScalarField& rho,
|
||||||
|
const surfaceScalarField& rhoPhi,
|
||||||
|
volVectorField& U
|
||||||
|
) const = 0;
|
||||||
|
|
||||||
|
//- Correct the phaseChange model
|
||||||
|
virtual void correct() = 0;
|
||||||
|
|
||||||
|
//- Read the transportProperties dictionary and update
|
||||||
|
virtual bool read() = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const twoPhaseChangeModel&) = delete;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -23,54 +23,60 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "phaseChangeTwoPhaseMixture.H"
|
#include "noPhaseChange.H"
|
||||||
#include "incompressibleTwoPhaseMixture.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::autoPtr<Foam::phaseChangeTwoPhaseMixture>
|
Foam::autoPtr<Foam::twoPhaseChangeModel> Foam::twoPhaseChangeModel::New
|
||||||
Foam::phaseChangeTwoPhaseMixture::New
|
|
||||||
(
|
(
|
||||||
const volVectorField& U,
|
const immiscibleIncompressibleTwoPhaseMixture& mixture
|
||||||
const surfaceScalarField& phi
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
IOdictionary transportPropertiesDict
|
IOobject twoPhaseChangeModelIO
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"transportProperties",
|
phaseChangePropertiesName,
|
||||||
U.time().constant(),
|
mixture.U().time().constant(),
|
||||||
U.db(),
|
mixture.U().db(),
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE,
|
IOobject::NO_WRITE,
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
word phaseChangeTwoPhaseMixtureTypeName
|
word modelType(twoPhaseChangeModels::noPhaseChange::typeName);
|
||||||
(
|
|
||||||
transportPropertiesDict.lookup("phaseChangeTwoPhaseMixture")
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< "Selecting phaseChange model "
|
if (twoPhaseChangeModelIO.typeHeaderOk<IOdictionary>(false))
|
||||||
<< phaseChangeTwoPhaseMixtureTypeName << endl;
|
{
|
||||||
|
IOdictionary(twoPhaseChangeModelIO).lookup
|
||||||
|
(
|
||||||
|
twoPhaseChangeModel::typeName
|
||||||
|
) >> modelType;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "No phase change: "
|
||||||
|
<< twoPhaseChangeModelIO.name()
|
||||||
|
<< " not found" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
componentsConstructorTable::iterator cstrIter =
|
Info<< "Selecting phaseChange model " << modelType << endl;
|
||||||
componentsConstructorTablePtr_
|
|
||||||
->find(phaseChangeTwoPhaseMixtureTypeName);
|
|
||||||
|
|
||||||
if (cstrIter == componentsConstructorTablePtr_->end())
|
dictionaryConstructorTable::iterator cstrIter =
|
||||||
|
dictionaryConstructorTablePtr_->find(modelType);
|
||||||
|
|
||||||
|
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Unknown phaseChangeTwoPhaseMixture type "
|
<< "Unknown " << twoPhaseChangeModel::typeName<< " type "
|
||||||
<< phaseChangeTwoPhaseMixtureTypeName << endl << endl
|
<< modelType << nl << nl
|
||||||
<< "Valid phaseChangeTwoPhaseMixtures are : " << endl
|
<< "Valid twoPhaseChangeModels are : " << endl
|
||||||
<< componentsConstructorTablePtr_->sortedToc()
|
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return autoPtr<phaseChangeTwoPhaseMixture>(cstrIter()(U, phi));
|
return autoPtr<twoPhaseChangeModel>(cstrIter()(mixture));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1,6 +1,7 @@
|
|||||||
twoPhaseMixture/twoPhaseMixture.C
|
twoPhaseMixture/twoPhaseMixture.C
|
||||||
|
|
||||||
interfaceCompression/interfaceCompression.C
|
interfaceCompression/interfaceCompression.C
|
||||||
|
noInterfaceCompression/noInterfaceCompression.C
|
||||||
|
|
||||||
MPLIC/MPLICface.C
|
MPLIC/MPLICface.C
|
||||||
MPLIC/MPLICcellStorage.C
|
MPLIC/MPLICcellStorage.C
|
||||||
|
|||||||
@ -66,10 +66,10 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "alphaSuSp.H"
|
||||||
|
|
||||||
if (MULESCorr)
|
if (MULESCorr)
|
||||||
{
|
{
|
||||||
#include "alphaSuSp.H"
|
|
||||||
|
|
||||||
fvScalarMatrix alpha1Eqn
|
fvScalarMatrix alpha1Eqn
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
@ -83,12 +83,13 @@
|
|||||||
phiCN,
|
phiCN,
|
||||||
upwind<scalar>(mesh, phiCN)
|
upwind<scalar>(mesh, phiCN)
|
||||||
).fvmDiv(phiCN, alpha1)
|
).fvmDiv(phiCN, alpha1)
|
||||||
// - fvm::Sp(fvc::ddt(dimensionedScalar(dimless, 1), mesh)
|
|
||||||
// + fvc::div(phiCN), alpha1)
|
|
||||||
==
|
|
||||||
Su + fvm::Sp(Sp + divU, alpha1)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (divU.valid())
|
||||||
|
{
|
||||||
|
alpha1Eqn -= Su() + fvm::Sp(Sp() + divU(), alpha1);
|
||||||
|
}
|
||||||
|
|
||||||
alpha1Eqn.solve();
|
alpha1Eqn.solve();
|
||||||
|
|
||||||
Info<< "Phase-1 volume fraction = "
|
Info<< "Phase-1 volume fraction = "
|
||||||
@ -126,8 +127,6 @@
|
|||||||
|
|
||||||
for (int aCorr=0; aCorr<nAlphaCorr; aCorr++)
|
for (int aCorr=0; aCorr<nAlphaCorr; aCorr++)
|
||||||
{
|
{
|
||||||
#include "alphaSuSp.H"
|
|
||||||
|
|
||||||
// Split operator
|
// Split operator
|
||||||
tmp<surfaceScalarField> talphaPhi1Un
|
tmp<surfaceScalarField> talphaPhi1Un
|
||||||
(
|
(
|
||||||
@ -144,17 +143,32 @@
|
|||||||
tmp<surfaceScalarField> talphaPhi1Corr(talphaPhi1Un() - alphaPhi10);
|
tmp<surfaceScalarField> talphaPhi1Corr(talphaPhi1Un() - alphaPhi10);
|
||||||
volScalarField alpha10("alpha10", alpha1);
|
volScalarField alpha10("alpha10", alpha1);
|
||||||
|
|
||||||
MULES::correct
|
if (divU.valid())
|
||||||
(
|
{
|
||||||
geometricOneField(),
|
MULES::correct
|
||||||
alpha1,
|
(
|
||||||
talphaPhi1Un(),
|
geometricOneField(),
|
||||||
talphaPhi1Corr.ref(),
|
alpha1,
|
||||||
Sp,
|
talphaPhi1Un(),
|
||||||
(-Sp*alpha1)(),
|
talphaPhi1Corr.ref(),
|
||||||
oneField(),
|
Sp(),
|
||||||
zeroField()
|
(-Sp()*alpha1)(),
|
||||||
);
|
oneField(),
|
||||||
|
zeroField()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MULES::correct
|
||||||
|
(
|
||||||
|
geometricOneField(),
|
||||||
|
alpha1,
|
||||||
|
talphaPhi1Un(),
|
||||||
|
talphaPhi1Corr.ref(),
|
||||||
|
oneField(),
|
||||||
|
zeroField()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Under-relax the correction for all but the 1st corrector
|
// Under-relax the correction for all but the 1st corrector
|
||||||
if (aCorr == 0)
|
if (aCorr == 0)
|
||||||
@ -171,17 +185,32 @@
|
|||||||
{
|
{
|
||||||
alphaPhi10 = talphaPhi1Un;
|
alphaPhi10 = talphaPhi1Un;
|
||||||
|
|
||||||
MULES::explicitSolve
|
if (divU.valid())
|
||||||
(
|
{
|
||||||
geometricOneField(),
|
MULES::explicitSolve
|
||||||
alpha1,
|
(
|
||||||
phiCN,
|
geometricOneField(),
|
||||||
alphaPhi10,
|
alpha1,
|
||||||
Sp,
|
phiCN,
|
||||||
(Su + divU*min(alpha1(), scalar(1)))(),
|
alphaPhi10,
|
||||||
oneField(),
|
Sp(),
|
||||||
zeroField()
|
(Su() + divU()*min(alpha1(), scalar(1)))(),
|
||||||
);
|
oneField(),
|
||||||
|
zeroField()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MULES::explicitSolve
|
||||||
|
(
|
||||||
|
geometricOneField(),
|
||||||
|
alpha1,
|
||||||
|
phiCN,
|
||||||
|
alphaPhi10,
|
||||||
|
oneField(),
|
||||||
|
zeroField()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
alpha2 = 1.0 - alpha1;
|
alpha2 = 1.0 - alpha1;
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
static const wordHashSet compressionSchemes
|
static const wordHashSet compressionSchemes
|
||||||
{
|
{
|
||||||
"interfaceCompression",
|
"interfaceCompression",
|
||||||
|
"noInterfaceCompression",
|
||||||
"PLIC",
|
"PLIC",
|
||||||
"PLICU",
|
"PLICU",
|
||||||
"MPLIC",
|
"MPLIC",
|
||||||
|
|||||||
@ -59,8 +59,8 @@
|
|||||||
rDeltaT.ref() = max
|
rDeltaT.ref() = max
|
||||||
(
|
(
|
||||||
1/dimensionedScalar(dimTime, maxDeltaT),
|
1/dimensionedScalar(dimTime, maxDeltaT),
|
||||||
fvc::surfaceSum(mag(rhoPhi))()()
|
fvc::surfaceSum(mag(phi))()()
|
||||||
/((2*maxCo)*mesh.V()*rho())
|
/((2*maxCo)*mesh.V())
|
||||||
);
|
);
|
||||||
|
|
||||||
if (maxAlphaCo < maxCo)
|
if (maxAlphaCo < maxCo)
|
||||||
|
|||||||
@ -0,0 +1,40 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration | Website: https://openfoam.org
|
||||||
|
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 "noInterfaceCompression.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(noInterfaceCompressionNew, 0);
|
||||||
|
|
||||||
|
surfaceInterpolationScheme<scalar>::
|
||||||
|
addMeshFluxConstructorToTable<noInterfaceCompressionNew>
|
||||||
|
addnoInterfaceCompressionScalarMeshFluxConstructorToTable_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,142 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration | Website: https://openfoam.org
|
||||||
|
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::noInterfaceCompression
|
||||||
|
|
||||||
|
Description
|
||||||
|
Wrapper scheme to allow VoF solvers to run efficiently without interface
|
||||||
|
compression, e.g. for cavitation simulations.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
\verbatim
|
||||||
|
divSchemes
|
||||||
|
{
|
||||||
|
.
|
||||||
|
.
|
||||||
|
div(phi,alpha) Gauss noInterfaceCompression vanLeer;
|
||||||
|
.
|
||||||
|
.
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::interfaceCompression
|
||||||
|
Foam::vanLeer
|
||||||
|
Foam::vanAlbada
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
noInterfaceCompression.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef noInterfaceCompression_H
|
||||||
|
#define noInterfaceCompression_H
|
||||||
|
|
||||||
|
#include "surfaceInterpolationScheme.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class noInterfaceCompression Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class noInterfaceCompressionNew
|
||||||
|
:
|
||||||
|
public surfaceInterpolationScheme<scalar>
|
||||||
|
{
|
||||||
|
// Private member data
|
||||||
|
|
||||||
|
const surfaceScalarField& phi_;
|
||||||
|
|
||||||
|
//- Base scheme to which the compression is applied
|
||||||
|
tmp<surfaceInterpolationScheme<scalar>> tScheme_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("noInterfaceCompression");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from faceFlux and Istream
|
||||||
|
noInterfaceCompressionNew
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const surfaceScalarField& faceFlux,
|
||||||
|
Istream& is
|
||||||
|
)
|
||||||
|
:
|
||||||
|
surfaceInterpolationScheme<scalar>(mesh),
|
||||||
|
phi_(faceFlux),
|
||||||
|
tScheme_
|
||||||
|
(
|
||||||
|
surfaceInterpolationScheme<scalar>::New(mesh, faceFlux, is)
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return the interpolation weighting factors
|
||||||
|
virtual tmp<surfaceScalarField> weights
|
||||||
|
(
|
||||||
|
const volScalarField&
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
NotImplemented;
|
||||||
|
|
||||||
|
return tmp<surfaceScalarField>(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return the face-interpolate of the given cell field
|
||||||
|
virtual tmp<surfaceScalarField> interpolate
|
||||||
|
(
|
||||||
|
const volScalarField& vf
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tScheme_().interpolate(vf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const noInterfaceCompressionNew&) = delete;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -5,7 +5,7 @@ cd ${0%/*} || exit 1 # Run from this directory
|
|||||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||||
|
|
||||||
# Mesh if necessary
|
# Mesh if necessary
|
||||||
if ! cloneMesh ../../../../multiphase/interPhaseChangeFoam/propeller .
|
if ! cloneMesh ../../../../multiphase/interFoam/RAS/propeller .
|
||||||
then
|
then
|
||||||
./Allmesh
|
./Allmesh
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -25,28 +25,34 @@ boundaryField
|
|||||||
{
|
{
|
||||||
type zeroGradient;
|
type zeroGradient;
|
||||||
}
|
}
|
||||||
|
|
||||||
rightWall
|
rightWall
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type zeroGradient;
|
||||||
}
|
}
|
||||||
|
|
||||||
lowerWall
|
lowerWall
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type zeroGradient;
|
||||||
}
|
}
|
||||||
|
|
||||||
atmosphere
|
atmosphere
|
||||||
{
|
{
|
||||||
type inletOutlet;
|
type inletOutlet;
|
||||||
inletValue uniform 0;
|
inletValue uniform 0;
|
||||||
value uniform 0;
|
value uniform 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultFaces
|
defaultFaces
|
||||||
{
|
{
|
||||||
type empty;
|
type empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
porous_half0
|
porous_half0
|
||||||
{
|
{
|
||||||
type cyclic;
|
type cyclic;
|
||||||
}
|
}
|
||||||
|
|
||||||
porous_half1
|
porous_half1
|
||||||
{
|
{
|
||||||
type cyclic;
|
type cyclic;
|
||||||
|
|||||||
@ -64,13 +64,7 @@ boundaryField
|
|||||||
}
|
}
|
||||||
porous_half1
|
porous_half1
|
||||||
{
|
{
|
||||||
type porousBafflePressure;
|
type cyclic;
|
||||||
patchType cyclic;
|
|
||||||
D 10;
|
|
||||||
I 5;
|
|
||||||
length 0.15;
|
|
||||||
jump uniform 0;
|
|
||||||
value uniform 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,33 +10,14 @@ FoamFile
|
|||||||
version 2.0;
|
version 2.0;
|
||||||
format ascii;
|
format ascii;
|
||||||
class dictionary;
|
class dictionary;
|
||||||
location "constant";
|
object phaseChangeProperties;
|
||||||
object transportProperties;
|
|
||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
phases (water vapour);
|
phaseChangeModel SchnerrSauer;
|
||||||
|
|
||||||
phaseChangeTwoPhaseMixture SchnerrSauer;
|
|
||||||
|
|
||||||
pSat 2300; // Saturation pressure
|
pSat 2300; // Saturation pressure
|
||||||
|
|
||||||
sigma 0.07;
|
|
||||||
|
|
||||||
water
|
|
||||||
{
|
|
||||||
transportModel Newtonian;
|
|
||||||
nu 9e-07;
|
|
||||||
rho 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
vapour
|
|
||||||
{
|
|
||||||
transportModel Newtonian;
|
|
||||||
nu 4.273e-04;
|
|
||||||
rho 0.02308;
|
|
||||||
}
|
|
||||||
|
|
||||||
KunzCoeffs
|
KunzCoeffs
|
||||||
{
|
{
|
||||||
UInf 20.0;
|
UInf 20.0;
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration | Website: https://openfoam.org
|
||||||
|
\\ / A nd | Version: dev
|
||||||
|
\\/ M anipulation |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
location "constant";
|
||||||
|
object transportProperties;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
phases (water vapour);
|
||||||
|
|
||||||
|
pSat 2300; // Saturation pressure
|
||||||
|
|
||||||
|
sigma 0.07;
|
||||||
|
|
||||||
|
water
|
||||||
|
{
|
||||||
|
transportModel Newtonian;
|
||||||
|
nu 9e-07;
|
||||||
|
rho 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
vapour
|
||||||
|
{
|
||||||
|
transportModel Newtonian;
|
||||||
|
nu 4.273e-04;
|
||||||
|
rho 0.02308;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -15,7 +15,7 @@ FoamFile
|
|||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
application interPhaseChangeFoam;
|
application interFoam;
|
||||||
|
|
||||||
startFrom startTime;
|
startFrom startTime;
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ divSchemes
|
|||||||
{
|
{
|
||||||
default none;
|
default none;
|
||||||
|
|
||||||
div(phi,alpha) Gauss interfaceCompression vanLeer 1;
|
div(phi,alpha) Gauss noInterfaceCompression vanLeer;
|
||||||
div(rhoPhi,U) Gauss linearUpwind grad(U);
|
div(rhoPhi,U) Gauss linearUpwind grad(U);
|
||||||
div(phi,k) Gauss upwind;
|
div(phi,k) Gauss upwind;
|
||||||
div(phi,epsilon) Gauss upwind;
|
div(phi,epsilon) Gauss upwind;
|
||||||
@ -10,38 +10,20 @@ FoamFile
|
|||||||
version 2.0;
|
version 2.0;
|
||||||
format ascii;
|
format ascii;
|
||||||
class dictionary;
|
class dictionary;
|
||||||
object transportProperties;
|
object phaseChangeProperties;
|
||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
phases (water vapour);
|
phaseChangeModel SchnerrSauer;
|
||||||
|
|
||||||
phaseChangeTwoPhaseMixture SchnerrSauer;
|
|
||||||
|
|
||||||
pSat 2300; // Saturation pressure
|
pSat 2300; // Saturation pressure
|
||||||
|
|
||||||
sigma 0.07;
|
|
||||||
|
|
||||||
water
|
|
||||||
{
|
|
||||||
transportModel Newtonian;
|
|
||||||
nu 9e-07;
|
|
||||||
rho 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
vapour
|
|
||||||
{
|
|
||||||
transportModel Newtonian;
|
|
||||||
nu 4.273e-04;
|
|
||||||
rho 0.02308;
|
|
||||||
}
|
|
||||||
|
|
||||||
KunzCoeffs
|
KunzCoeffs
|
||||||
{
|
{
|
||||||
UInf U20.0;
|
UInf 20.0;
|
||||||
tInf t0.005; // L = 0.1 m
|
tInf 0.005; // L = 0.1 m
|
||||||
Cc C1000;
|
Cc 1000;
|
||||||
Cv C1000;
|
Cv 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
MerkleCoeffs
|
MerkleCoeffs
|
||||||
@ -60,5 +42,4 @@ SchnerrSauerCoeffs
|
|||||||
Cv 1;
|
Cv 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration | Website: https://openfoam.org
|
||||||
|
\\ / A nd | Version: dev
|
||||||
|
\\/ M anipulation |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object transportProperties;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
phases (water vapour);
|
||||||
|
|
||||||
|
sigma 0.07;
|
||||||
|
|
||||||
|
water
|
||||||
|
{
|
||||||
|
transportModel Newtonian;
|
||||||
|
nu 9e-07;
|
||||||
|
rho 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
vapour
|
||||||
|
{
|
||||||
|
transportModel Newtonian;
|
||||||
|
nu 4.273e-04;
|
||||||
|
rho 0.02308;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -14,7 +14,7 @@ FoamFile
|
|||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
application interPhaseChangeFoam;
|
application interFoam;
|
||||||
|
|
||||||
startFrom latestTime;
|
startFrom latestTime;
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user