mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Add interPhaseChangeFoam solver
This commit is contained in:
@ -0,0 +1,8 @@
|
|||||||
|
interPhaseChangeFoam.C
|
||||||
|
phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C
|
||||||
|
phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/newPhaseChangeTwoPhaseMixture.C
|
||||||
|
phaseChangeTwoPhaseMixtures/Kunz/Kunz.C
|
||||||
|
phaseChangeTwoPhaseMixtures/Merkle/Merkle.C
|
||||||
|
phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/interPhaseChangeFoam
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/transportModels \
|
||||||
|
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||||
|
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||||
|
-I$(LIB_SRC)/LESmodels \
|
||||||
|
-I$(LIB_SRC)/LESmodels/LESdeltas/lnInclude \
|
||||||
|
-IphaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-linterfaceProperties \
|
||||||
|
-lincompressibleTransportModels \
|
||||||
|
-lincompressibleLESmodels \
|
||||||
|
-lfiniteVolume
|
||||||
32
applications/solvers/multiphase/interPhaseChangeFoam/UEqn.H
Normal file
32
applications/solvers/multiphase/interPhaseChangeFoam/UEqn.H
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
surfaceScalarField muf =
|
||||||
|
twoPhaseProperties->muf()
|
||||||
|
+ fvc::interpolate(rho*turbulence->nuSgs());
|
||||||
|
|
||||||
|
fvVectorMatrix UEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(rho, U)
|
||||||
|
+ fvm::div(rhoPhi, U)
|
||||||
|
- fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), U)
|
||||||
|
- fvm::laplacian(muf, U)
|
||||||
|
- (fvc::grad(U) & fvc::grad(muf))
|
||||||
|
//- fvc::div(muf*(fvc::interpolate(dev2(fvc::grad(U))) & mesh.Sf()))
|
||||||
|
);
|
||||||
|
|
||||||
|
UEqn.relax();
|
||||||
|
|
||||||
|
if (momentumPredictor)
|
||||||
|
{
|
||||||
|
solve
|
||||||
|
(
|
||||||
|
UEqn
|
||||||
|
==
|
||||||
|
fvc::reconstruct
|
||||||
|
(
|
||||||
|
(
|
||||||
|
fvc::interpolate(interface.sigmaK())*fvc::snGrad(gamma)
|
||||||
|
- ghf*fvc::snGrad(rho)
|
||||||
|
- fvc::snGrad(pd)
|
||||||
|
) * mesh.magSf()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
# include "continuityErrs.H"
|
||||||
|
|
||||||
|
wordList pcorrTypes(pd.boundaryField().types());
|
||||||
|
|
||||||
|
for (label i=0; i<pd.boundaryField().size(); i++)
|
||||||
|
{
|
||||||
|
if (pd.boundaryField()[i].fixesValue())
|
||||||
|
{
|
||||||
|
pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
volScalarField pcorr
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"pcorr",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("pcorr", pd.dimensions(), 0.0),
|
||||||
|
pcorrTypes
|
||||||
|
);
|
||||||
|
|
||||||
|
dimensionedScalar rUAf("(1|A(U))", dimTime/rho.dimensions(), 1.0);
|
||||||
|
|
||||||
|
adjustPhi(phi, U, pcorr);
|
||||||
|
|
||||||
|
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||||
|
{
|
||||||
|
fvScalarMatrix pcorrEqn
|
||||||
|
(
|
||||||
|
fvm::laplacian(rUAf, pcorr) == fvc::div(phi)
|
||||||
|
);
|
||||||
|
|
||||||
|
pcorrEqn.setReference(pdRefCell, pdRefValue);
|
||||||
|
pcorrEqn.solve();
|
||||||
|
|
||||||
|
if (nonOrth == nNonOrthCorr)
|
||||||
|
{
|
||||||
|
phi -= pcorrEqn.flux();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# include "continuityErrs.H"
|
||||||
|
}
|
||||||
@ -0,0 +1,98 @@
|
|||||||
|
Info<< "Reading field pd\n" << endl;
|
||||||
|
volScalarField pd
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"pd",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Reading field gamma\n" << endl;
|
||||||
|
volScalarField gamma
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"gamma",
|
||||||
|
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> twoPhaseProperties =
|
||||||
|
phaseChangeTwoPhaseMixture::New(U, phi, "gamma");
|
||||||
|
|
||||||
|
const dimensionedScalar& rho1 = twoPhaseProperties->rho1();
|
||||||
|
const dimensionedScalar& rho2 = twoPhaseProperties->rho2();
|
||||||
|
const dimensionedScalar& pSat = twoPhaseProperties->pSat();
|
||||||
|
|
||||||
|
// Need to store rho for ddt(rho, U)
|
||||||
|
volScalarField rho
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rho",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::READ_IF_PRESENT
|
||||||
|
),
|
||||||
|
gamma*rho1 + (scalar(1) - gamma)*rho2,
|
||||||
|
gamma.boundaryField().types()
|
||||||
|
);
|
||||||
|
rho.oldTime();
|
||||||
|
|
||||||
|
|
||||||
|
label pdRefCell = 0;
|
||||||
|
scalar pdRefValue = 0.0;
|
||||||
|
setRefCell(pd, mesh.solutionDict().subDict("PISO"), pdRefCell, pdRefValue);
|
||||||
|
|
||||||
|
Info<< "Calculating field g.h" << endl;
|
||||||
|
volScalarField gh("gh", g & mesh.C());
|
||||||
|
surfaceScalarField ghf("ghf", g & mesh.Cf());
|
||||||
|
|
||||||
|
volScalarField p
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"p",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
pd + rho*gh
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Construct interface from gamma distribution
|
||||||
|
interfaceProperties interface(gamma, U, twoPhaseProperties());
|
||||||
|
|
||||||
|
// Construct LES model
|
||||||
|
autoPtr<LESmodel> turbulence
|
||||||
|
(
|
||||||
|
LESmodel::New(U, phi, twoPhaseProperties())
|
||||||
|
);
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
{
|
||||||
|
word gammaScheme("div(phi,gamma)");
|
||||||
|
word gammarScheme("div(phirb,gamma)");
|
||||||
|
|
||||||
|
surfaceScalarField phir("phir", phic*interface.nHatf());
|
||||||
|
|
||||||
|
for (int gCorr=0; gCorr<nGammaCorr; gCorr++)
|
||||||
|
{
|
||||||
|
surfaceScalarField phiGamma =
|
||||||
|
fvc::flux
|
||||||
|
(
|
||||||
|
phi,
|
||||||
|
gamma,
|
||||||
|
gammaScheme
|
||||||
|
)
|
||||||
|
+ fvc::flux
|
||||||
|
(
|
||||||
|
-fvc::flux(-phir, scalar(1) - gamma, gammarScheme),
|
||||||
|
gamma,
|
||||||
|
gammarScheme
|
||||||
|
);
|
||||||
|
|
||||||
|
Pair<tmp<volScalarField> > vDotAlphal =
|
||||||
|
twoPhaseProperties->vDotAlphal();
|
||||||
|
const volScalarField& vDotcAlphal = vDotAlphal[0]();
|
||||||
|
const volScalarField& vDotvAlphal = vDotAlphal[1]();
|
||||||
|
|
||||||
|
volScalarField Sp
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Sp",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh
|
||||||
|
),
|
||||||
|
vDotvAlphal - vDotcAlphal
|
||||||
|
);
|
||||||
|
|
||||||
|
volScalarField Su
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"Su",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh
|
||||||
|
),
|
||||||
|
// Divergence term is handled explicitly to be
|
||||||
|
// consistent with the explicit transport solution
|
||||||
|
divU*gamma
|
||||||
|
+ vDotcAlphal
|
||||||
|
);
|
||||||
|
|
||||||
|
//MULES::explicitSolve(gamma, phi, phiGamma, 1, 0);
|
||||||
|
//MULES::explicitSolve(oneField(), gamma, phi, phiGamma, Sp, Su, 1, 0);
|
||||||
|
MULES::implicitSolve(oneField(), gamma, phi, phiGamma, Sp, Su, 1, 0);
|
||||||
|
|
||||||
|
rhoPhi +=
|
||||||
|
(runTime.deltaT()/totalDeltaT)
|
||||||
|
*(phiGamma*(rho1 - rho2) + phi*rho2);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "Liquid phase volume fraction = "
|
||||||
|
<< gamma.weightedAverage(mesh.V()).value()
|
||||||
|
<< " Min(gamma) = " << min(gamma).value()
|
||||||
|
<< " Max(gamma) = " << max(gamma).value()
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
surfaceScalarField rhoPhi
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rhoPhi",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("0", dimensionSet(1, 0, -1, 0, 0), 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
{
|
||||||
|
label nGammaCorr
|
||||||
|
(
|
||||||
|
readLabel(piso.lookup("nGammaCorr"))
|
||||||
|
);
|
||||||
|
|
||||||
|
label nGammaSubCycles
|
||||||
|
(
|
||||||
|
readLabel(piso.lookup("nGammaSubCycles"))
|
||||||
|
);
|
||||||
|
|
||||||
|
surfaceScalarField phic = mag(phi/mesh.magSf());
|
||||||
|
phic = min(interface.cGamma()*phic, max(phic));
|
||||||
|
|
||||||
|
volScalarField divU = fvc::div(phi);
|
||||||
|
|
||||||
|
dimensionedScalar totalDeltaT = runTime.deltaT();
|
||||||
|
|
||||||
|
if (nGammaSubCycles > 1)
|
||||||
|
{
|
||||||
|
for
|
||||||
|
(
|
||||||
|
subCycle<volScalarField> gammaSubCycle(gamma, nGammaSubCycles);
|
||||||
|
!(++gammaSubCycle).end();
|
||||||
|
)
|
||||||
|
{
|
||||||
|
# include "gammaEqn.H"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# include "gammaEqn.H"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nOuterCorr == 1)
|
||||||
|
{
|
||||||
|
interface.correct();
|
||||||
|
}
|
||||||
|
|
||||||
|
rho == gamma*rho1 + (scalar(1) - gamma)*rho2;
|
||||||
|
}
|
||||||
@ -0,0 +1,107 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Application
|
||||||
|
interPhaseChangeFoam
|
||||||
|
|
||||||
|
Description
|
||||||
|
Solver for 2 incompressible, isothermal immiscible fluids with phase-change.
|
||||||
|
Uses a VOF (volume of fluid) phase-fraction based interface capturing
|
||||||
|
approach. The momentum and other fluid properties are of the "mixture" and
|
||||||
|
a single momentum equation is solved.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fvCFD.H"
|
||||||
|
#include "MULES.H"
|
||||||
|
#include "subCycle.H"
|
||||||
|
#include "interfaceProperties.H"
|
||||||
|
#include "phaseChangeTwoPhaseMixture.H"
|
||||||
|
#include "incompressible/LESmodel/LESmodel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
|
||||||
|
# include "setRootCase.H"
|
||||||
|
# include "createTime.H"
|
||||||
|
# include "createMesh.H"
|
||||||
|
# include "readEnvironmentalProperties.H"
|
||||||
|
# include "readPISOControls.H"
|
||||||
|
# include "initContinuityErrs.H"
|
||||||
|
# include "createFields.H"
|
||||||
|
# include "readTimeControls.H"
|
||||||
|
# include "correctPhi.H"
|
||||||
|
# include "CourantNo.H"
|
||||||
|
# include "setInitialDeltaT.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
|
while (runTime.run())
|
||||||
|
{
|
||||||
|
# include "readPISOControls.H"
|
||||||
|
# include "readTimeControls.H"
|
||||||
|
# include "CourantNo.H"
|
||||||
|
# include "setDeltaT.H"
|
||||||
|
|
||||||
|
runTime++;
|
||||||
|
|
||||||
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
twoPhaseProperties->correct();
|
||||||
|
|
||||||
|
# include "gammaEqnSubCycle.H"
|
||||||
|
|
||||||
|
turbulence->correct();
|
||||||
|
|
||||||
|
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
||||||
|
{
|
||||||
|
#include "UEqn.H"
|
||||||
|
|
||||||
|
// --- PISO loop
|
||||||
|
for (int corr=0; corr<nCorr; corr++)
|
||||||
|
{
|
||||||
|
#include "pEqn.H"
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "continuityErrs.H"
|
||||||
|
}
|
||||||
|
|
||||||
|
runTime.write();
|
||||||
|
|
||||||
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||||
|
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||||
|
<< nl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
55
applications/solvers/multiphase/interPhaseChangeFoam/pEqn.H
Normal file
55
applications/solvers/multiphase/interPhaseChangeFoam/pEqn.H
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
volScalarField rUA = 1.0/UEqn.A();
|
||||||
|
surfaceScalarField rUAf = fvc::interpolate(rUA);
|
||||||
|
|
||||||
|
U = rUA*UEqn.H();
|
||||||
|
|
||||||
|
surfaceScalarField phiU
|
||||||
|
(
|
||||||
|
"phiU",
|
||||||
|
(fvc::interpolate(U) & mesh.Sf())
|
||||||
|
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||||
|
);
|
||||||
|
|
||||||
|
phi = phiU +
|
||||||
|
(
|
||||||
|
fvc::interpolate(interface.sigmaK())*fvc::snGrad(gamma)
|
||||||
|
- ghf*fvc::snGrad(rho)
|
||||||
|
)*rUAf*mesh.magSf();
|
||||||
|
|
||||||
|
adjustPhi(phi, U, pd);
|
||||||
|
|
||||||
|
Pair<tmp<volScalarField> > vDotP = twoPhaseProperties->vDotP();
|
||||||
|
const volScalarField& vDotcP = vDotP[0]();
|
||||||
|
const volScalarField& vDotvP = vDotP[1]();
|
||||||
|
|
||||||
|
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||||
|
{
|
||||||
|
fvScalarMatrix pdEqn
|
||||||
|
(
|
||||||
|
fvc::div(phi) - fvm::laplacian(rUAf, pd)
|
||||||
|
+ (vDotvP - vDotcP)*(rho*gh - pSat) + fvm::Sp(vDotvP - vDotcP, pd)
|
||||||
|
);
|
||||||
|
|
||||||
|
pdEqn.setReference(pdRefCell, pdRefValue);
|
||||||
|
|
||||||
|
if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
|
||||||
|
{
|
||||||
|
pdEqn.solve(mesh.solver(pd.name() + "Final"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pdEqn.solve(mesh.solver(pd.name()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nonOrth == nNonOrthCorr)
|
||||||
|
{
|
||||||
|
phi += pdEqn.flux();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
p = pd + rho*gh;
|
||||||
|
|
||||||
|
U += rUA*fvc::reconstruct((phi - phiU)/rUAf);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
|
}
|
||||||
@ -0,0 +1,126 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "Kunz.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace phaseChangeTwoPhaseMixtures
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(Kunz, 0);
|
||||||
|
addToRunTimeSelectionTable(phaseChangeTwoPhaseMixture, Kunz, components);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::phaseChangeTwoPhaseMixtures::Kunz::Kunz
|
||||||
|
(
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const word& alpha1Name
|
||||||
|
)
|
||||||
|
:
|
||||||
|
phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name),
|
||||||
|
|
||||||
|
UInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf")),
|
||||||
|
tInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf")),
|
||||||
|
Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")),
|
||||||
|
Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")),
|
||||||
|
|
||||||
|
p0_("0", pSat().dimensions(), 0.0),
|
||||||
|
|
||||||
|
mcCoeff_(Cc_*rho2()/tInf_),
|
||||||
|
mvCoeff_(Cv_*rho2()/(0.5*rho1()*sqr(UInf_)*tInf_))
|
||||||
|
{
|
||||||
|
correct();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Pair<Foam::tmp<Foam::volScalarField> >
|
||||||
|
Foam::phaseChangeTwoPhaseMixtures::Kunz::mDotAlphal() const
|
||||||
|
{
|
||||||
|
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
|
||||||
|
volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
|
||||||
|
|
||||||
|
return Pair<tmp<volScalarField> >
|
||||||
|
(
|
||||||
|
mcCoeff_*sqr(limitedAlpha1)
|
||||||
|
*max(p - pSat(), p0_)/max(p - pSat(), 0.01*pSat()),
|
||||||
|
|
||||||
|
mvCoeff_*min(p - pSat(), p0_)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Foam::Pair<Foam::tmp<Foam::volScalarField> >
|
||||||
|
Foam::phaseChangeTwoPhaseMixtures::Kunz::mDotP() const
|
||||||
|
{
|
||||||
|
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
|
||||||
|
volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
|
||||||
|
|
||||||
|
return Pair<tmp<volScalarField> >
|
||||||
|
(
|
||||||
|
mcCoeff_*sqr(limitedAlpha1)*(1.0 - limitedAlpha1)
|
||||||
|
*pos(p - pSat())/max(p - pSat(), 0.01*pSat()),
|
||||||
|
|
||||||
|
(-mvCoeff_)*limitedAlpha1*neg(p - pSat())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::phaseChangeTwoPhaseMixtures::Kunz::correct()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::phaseChangeTwoPhaseMixtures::Kunz::read()
|
||||||
|
{
|
||||||
|
if (phaseChangeTwoPhaseMixture::read())
|
||||||
|
{
|
||||||
|
phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
|
||||||
|
|
||||||
|
phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_;
|
||||||
|
phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_;
|
||||||
|
phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_;
|
||||||
|
phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_;
|
||||||
|
|
||||||
|
mcCoeff_ = Cc_*rho2()/tInf_;
|
||||||
|
mvCoeff_ = Cv_*rho2()/(0.5*rho1()*sqr(UInf_)*tInf_);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,135 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 Generac License as published by the
|
||||||
|
Free Software Foundation; either 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the ho it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the imarranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE.he GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy oNU General Public License
|
||||||
|
along with OpenFOAM; if not, write Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floorn, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::phaseChangeTwoPhaseMixtures::Kunz
|
||||||
|
|
||||||
|
Description
|
||||||
|
Kunz cavitation model slightly modified so that the condensation term
|
||||||
|
is switched off when the pressure is less than the saturation vapour
|
||||||
|
pressure. This change allows the condensation term to be formulated as
|
||||||
|
a coefficient multiplying (p - p_sat) so that it can be included as an
|
||||||
|
implicit term in the pressure equation.
|
||||||
|
|
||||||
|
Reference:
|
||||||
|
@verbatim
|
||||||
|
Kunz, R.F., Boger, D.A., Stinebring, D.R., Chyczewski, Lindau. J.W.,
|
||||||
|
Gibeling, H.J., Venkateswaran, S., Govindan, T.R.,
|
||||||
|
“A Preconditioned Implicit Method for Two-Phase Flows with Application
|
||||||
|
to Cavitation Prediction,”
|
||||||
|
Computers and Fluids,
|
||||||
|
29(8):849-875, 2000.
|
||||||
|
@verbatim
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
Kunz.C
|
||||||
|
|
||||||
|
\*--------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef Kunz_H
|
||||||
|
#define Kunz_H
|
||||||
|
|
||||||
|
#include "phaseChangeTwoPhaseMixture.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace phaseChangeTwoPhaseMixtures
|
||||||
|
{
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------*\
|
||||||
|
Class Kunz
|
||||||
|
\*--------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class Kunz
|
||||||
|
:
|
||||||
|
public phaseChangeTwoPhaseMixture
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
dimensionedScalar UInf_;
|
||||||
|
dimensionedScalar tInf_;
|
||||||
|
dimensionedScalar Cc_;
|
||||||
|
dimensionedScalar Cv_;
|
||||||
|
|
||||||
|
dimensionedScalar p0_;
|
||||||
|
|
||||||
|
dimensionedScalar mcCoeff_;
|
||||||
|
dimensionedScalar mvCoeff_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("Kunz");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- construct from components
|
||||||
|
Kunz
|
||||||
|
(
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const word& alpha1Name = "alpha1"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~Kunz()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// 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 an
|
||||||
|
// explicit term for the condensation rate and a coefficient to
|
||||||
|
// multiply (p - pSat) for the vaporisation rate
|
||||||
|
virtual Pair<tmp<volScalarField> > mDotP() const;
|
||||||
|
|
||||||
|
//- Correct the Kunz phaseChange model
|
||||||
|
virtual void correct();
|
||||||
|
|
||||||
|
//- Read the transportProperties dictionary and update
|
||||||
|
virtual bool read();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace phaseChangeTwoPhaseMixtures
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,75 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "Merkle.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace phaseChangeTwoPhaseMixtures
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(Merkle, 0);
|
||||||
|
addToRunTimeSelectionTable(phaseChangeTwoPhaseMixture, Merkle, components);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::phaseChangeTwoPhaseMixtures::Merkle::Merkle
|
||||||
|
(
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const word& alpha1Name
|
||||||
|
)
|
||||||
|
:
|
||||||
|
phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name),
|
||||||
|
|
||||||
|
UInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf")),
|
||||||
|
tInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf")),
|
||||||
|
Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")),
|
||||||
|
Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")),
|
||||||
|
|
||||||
|
p0_("0", pSat().dimensions(), 0.0),
|
||||||
|
|
||||||
|
mcCoeff_(Cc_/(0.5*sqr(UInf_)*tInf_)),
|
||||||
|
mvCoeff_(Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2()))
|
||||||
|
{
|
||||||
|
correct();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Pair<Foam::tmp<Foam::volScalarField> >
|
||||||
|
Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotAlphal() const
|
||||||
|
{
|
||||||
|
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
|
||||||
|
|
||||||
|
return Pair<tmp<volScalarField> >
|
||||||
|
(
|
||||||
|
mcCoeff_*max(p - pSat(), p0_),
|
||||||
@ -0,0 +1,121 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "Merkle.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace phaseChangeTwoPhaseMixtures
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(Merkle, 0);
|
||||||
|
addToRunTimeSelectionTable(phaseChangeTwoPhaseMixture, Merkle, components);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::phaseChangeTwoPhaseMixtures::Merkle::Merkle
|
||||||
|
(
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const word& alpha1Name
|
||||||
|
)
|
||||||
|
:
|
||||||
|
phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name),
|
||||||
|
|
||||||
|
UInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf")),
|
||||||
|
tInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf")),
|
||||||
|
Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")),
|
||||||
|
Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")),
|
||||||
|
|
||||||
|
p0_("0", pSat().dimensions(), 0.0),
|
||||||
|
|
||||||
|
mcCoeff_(Cc_/(0.5*sqr(UInf_)*tInf_)),
|
||||||
|
mvCoeff_(Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2()))
|
||||||
|
{
|
||||||
|
correct();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Pair<Foam::tmp<Foam::volScalarField> >
|
||||||
|
Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotAlphal() const
|
||||||
|
{
|
||||||
|
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
|
||||||
|
|
||||||
|
return Pair<tmp<volScalarField> >
|
||||||
|
(
|
||||||
|
mcCoeff_*max(p - pSat(), p0_),
|
||||||
|
mvCoeff_*min(p - pSat(), p0_)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Foam::Pair<Foam::tmp<Foam::volScalarField> >
|
||||||
|
Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotP() const
|
||||||
|
{
|
||||||
|
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
|
||||||
|
volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
|
||||||
|
|
||||||
|
return Pair<tmp<volScalarField> >
|
||||||
|
(
|
||||||
|
mcCoeff_*(1.0 - limitedAlpha1)*pos(p - pSat()),
|
||||||
|
(-mvCoeff_)*limitedAlpha1*neg(p - pSat())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::phaseChangeTwoPhaseMixtures::Merkle::correct()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::phaseChangeTwoPhaseMixtures::Merkle::read()
|
||||||
|
{
|
||||||
|
if (phaseChangeTwoPhaseMixture::read())
|
||||||
|
{
|
||||||
|
phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
|
||||||
|
|
||||||
|
phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_;
|
||||||
|
phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_;
|
||||||
|
phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_;
|
||||||
|
phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_;
|
||||||
|
|
||||||
|
mcCoeff_ = Cc_/(0.5*sqr(UInf_)*tInf_);
|
||||||
|
mvCoeff_ = Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,129 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========Merkle= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 Generac License as published by the
|
||||||
|
Free Software Foundation; either 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the ho it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the imarranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE.he GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy oNU General Public License
|
||||||
|
along with OpenFOAM; if not, write Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floorn, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::phaseChangeTwoPhaseMixtures::Merkle
|
||||||
|
|
||||||
|
Description
|
||||||
|
Merkle cavitation model.
|
||||||
|
|
||||||
|
Reference:
|
||||||
|
@verbatim
|
||||||
|
C. L. Merkle, J. Feng, and P. E. O. Buelow,
|
||||||
|
"Computational modeling of the dynamics of sheet cavitation",
|
||||||
|
in Proceedings Third International Symposium on Cavitation
|
||||||
|
Grenoble, France 1998.
|
||||||
|
@verbatim
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
Merkle.C
|
||||||
|
|
||||||
|
\*--------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef Merkle_H
|
||||||
|
#define Merkle_H
|
||||||
|
|
||||||
|
#include "phaseChangeTwoPhaseMixture.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace phaseChangeTwoPhaseMixtures
|
||||||
|
{
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------*\
|
||||||
|
Class Merkle
|
||||||
|
\*--------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class Merkle
|
||||||
|
:
|
||||||
|
public phaseChangeTwoPhaseMixture
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
dimensionedScalar UInf_;
|
||||||
|
dimensionedScalar tInf_;
|
||||||
|
dimensionedScalar Cc_;
|
||||||
|
dimensionedScalar Cv_;
|
||||||
|
|
||||||
|
dimensionedScalar p0_;
|
||||||
|
|
||||||
|
dimensionedScalar mcCoeff_;
|
||||||
|
dimensionedScalar mvCoeff_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("Merkle");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- construct from components
|
||||||
|
Merkle
|
||||||
|
(
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const word& alpha1Name = "alpha1"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~Merkle()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// 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 an
|
||||||
|
// explicit term for the condensation rate and a coefficient to
|
||||||
|
// multiply (p - pSat) for the vaporisation rate
|
||||||
|
virtual Pair<tmp<volScalarField> > mDotP() const;
|
||||||
|
|
||||||
|
//- Correct the Merkle phaseChange model
|
||||||
|
virtual void correct();
|
||||||
|
|
||||||
|
//- Read the transportProperties dictionary and update
|
||||||
|
virtual bool read();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace phaseChangeTwoPhaseMixtures
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,169 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "SchnerrSauer.H"
|
||||||
|
#include "mathematicalConstants.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace phaseChangeTwoPhaseMixtures
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(SchnerrSauer, 0);
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
phaseChangeTwoPhaseMixture,
|
||||||
|
SchnerrSauer,
|
||||||
|
components
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::SchnerrSauer
|
||||||
|
(
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const word& alpha1Name
|
||||||
|
)
|
||||||
|
:
|
||||||
|
phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name),
|
||||||
|
|
||||||
|
n_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("n")),
|
||||||
|
dNuc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc")),
|
||||||
|
Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")),
|
||||||
|
Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")),
|
||||||
|
|
||||||
|
p0_("0", pSat().dimensions(), 0.0)
|
||||||
|
{
|
||||||
|
correct();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField>
|
||||||
|
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::rRb
|
||||||
|
(
|
||||||
|
const volScalarField& limitedAlpha1
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return pow
|
||||||
|
(
|
||||||
|
((4*mathematicalConstant::pi*n_)/3)
|
||||||
|
*limitedAlpha1/(1.0 + alphaNuc() - limitedAlpha1),
|
||||||
|
1.0/3.0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::dimensionedScalar
|
||||||
|
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::alphaNuc() const
|
||||||
|
{
|
||||||
|
dimensionedScalar Vnuc = n_*mathematicalConstant::pi*pow3(dNuc_)/6;
|
||||||
|
return Vnuc/(1 + Vnuc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::volScalarField>
|
||||||
|
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::pCoeff
|
||||||
|
(
|
||||||
|
const volScalarField& p
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
|
||||||
|
volScalarField rho =
|
||||||
|
(limitedAlpha1*rho1() + (scalar(1) - limitedAlpha1)*rho2());
|
||||||
|
|
||||||
|
return
|
||||||
|
(3*rho1()*rho2())*sqrt(2/(3*rho1()))
|
||||||
|
*rRb(limitedAlpha1)/(rho*sqrt(mag(p - pSat()) + 0.01*pSat()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::Pair<Foam::tmp<Foam::volScalarField> >
|
||||||
|
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotAlphal() const
|
||||||
|
{
|
||||||
|
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
|
||||||
|
volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
|
||||||
|
|
||||||
|
volScalarField pCoeff = this->pCoeff(p);
|
||||||
|
|
||||||
|
return Pair<tmp<volScalarField> >
|
||||||
|
(
|
||||||
|
Cc_*limitedAlpha1*pCoeff*max(p - pSat(), p0_),
|
||||||
|
|
||||||
|
Cv_*(1.0 + alphaNuc() - limitedAlpha1)*pCoeff*min(p - pSat(), p0_)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::Pair<Foam::tmp<Foam::volScalarField> >
|
||||||
|
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotP() const
|
||||||
|
{
|
||||||
|
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
|
||||||
|
volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
|
||||||
|
|
||||||
|
volScalarField apCoeff = limitedAlpha1*pCoeff(p);
|
||||||
|
|
||||||
|
return Pair<tmp<volScalarField> >
|
||||||
|
(
|
||||||
|
Cc_*(1.0 - limitedAlpha1)*pos(p - pSat())*apCoeff,
|
||||||
|
|
||||||
|
(-Cv_)*(1.0 + alphaNuc() - limitedAlpha1)*neg(p - pSat())*apCoeff
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::correct()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::read()
|
||||||
|
{
|
||||||
|
if (phaseChangeTwoPhaseMixture::read())
|
||||||
|
{
|
||||||
|
phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
|
||||||
|
|
||||||
|
phaseChangeTwoPhaseMixtureCoeffs_.lookup("n") >> n_;
|
||||||
|
phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc") >> dNuc_;
|
||||||
|
phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_;
|
||||||
|
phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,142 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========Merkle= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 Generac License as published by the
|
||||||
|
Free Software Foundation; either 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the ho it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the imarranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE.he GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy oNU General Public License
|
||||||
|
along with OpenFOAM; if not, write Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floorn, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer
|
||||||
|
|
||||||
|
Description
|
||||||
|
SchnerrSauer cavitation model.
|
||||||
|
|
||||||
|
Reference:
|
||||||
|
@verbatim
|
||||||
|
Schnerr, G. H., And Sauer, J.,
|
||||||
|
"Physical and Numerical Modeling of Unsteady Cavitation Dynamics",
|
||||||
|
Proc. 4th International Conference on Multiphase Flow,
|
||||||
|
New Orleans, U.S.A., 2001.
|
||||||
|
@verbatim
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
SchnerrSauer.C
|
||||||
|
|
||||||
|
\*--------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef SchnerrSauer_H
|
||||||
|
#define SchnerrSauer_H
|
||||||
|
|
||||||
|
#include "phaseChangeTwoPhaseMixture.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace phaseChangeTwoPhaseMixtures
|
||||||
|
{
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------*\
|
||||||
|
Class SchnerrSauer
|
||||||
|
\*--------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class SchnerrSauer
|
||||||
|
:
|
||||||
|
public phaseChangeTwoPhaseMixture
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Bubble number density
|
||||||
|
dimensionedScalar n_;
|
||||||
|
|
||||||
|
//- Nucleation site diameter
|
||||||
|
dimensionedScalar dNuc_;
|
||||||
|
|
||||||
|
//- Condensation rate coefficient
|
||||||
|
dimensionedScalar Cc_;
|
||||||
|
|
||||||
|
//- Vapourisation rate coefficient
|
||||||
|
dimensionedScalar Cv_;
|
||||||
|
|
||||||
|
dimensionedScalar p0_;
|
||||||
|
|
||||||
|
//- Nucleation site volume-fraction
|
||||||
|
dimensionedScalar alphaNuc() const;
|
||||||
|
|
||||||
|
//- Reciprocal bubble radius
|
||||||
|
tmp<volScalarField>rRb(const volScalarField& limitedAlpha1) const;
|
||||||
|
|
||||||
|
//- Part of the condensation and vapourisation rates
|
||||||
|
tmp<volScalarField> pCoeff(const volScalarField& p) const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("SchnerrSauer");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- construct from components
|
||||||
|
SchnerrSauer
|
||||||
|
(
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const word& alpha1Name = "alpha1"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~SchnerrSauer()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// 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 an
|
||||||
|
// explicit term for the condensation rate and a coefficient to
|
||||||
|
// multiply (p - pSat) for the vaporisation rate
|
||||||
|
virtual Pair<tmp<volScalarField> > mDotP() const;
|
||||||
|
|
||||||
|
//- Correct the SchnerrSauer phaseChange model
|
||||||
|
virtual void correct();
|
||||||
|
|
||||||
|
//- Read the transportProperties dictionary and update
|
||||||
|
virtual bool read();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace phaseChangeTwoPhaseMixtures
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,81 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "phaseChangeTwoPhaseMixture.H"
|
||||||
|
#include "twoPhaseMixture.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::phaseChangeTwoPhaseMixture>
|
||||||
|
Foam::phaseChangeTwoPhaseMixture::New
|
||||||
|
(
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const word& alpha1Name
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IOdictionary transportPropertiesDict
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"transportProperties",
|
||||||
|
U.time().constant(),
|
||||||
|
U.db(),
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
word phaseChangeTwoPhaseMixtureTypeName
|
||||||
|
(
|
||||||
|
transportPropertiesDict.lookup("phaseChangeTwoPhaseMixture")
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Selecting phaseChange model "
|
||||||
|
<< phaseChangeTwoPhaseMixtureTypeName << endl;
|
||||||
|
|
||||||
|
componentsConstructorTable::iterator cstrIter =
|
||||||
|
componentsConstructorTablePtr_
|
||||||
|
->find(phaseChangeTwoPhaseMixtureTypeName);
|
||||||
|
|
||||||
|
if (cstrIter == componentsConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"phaseChangeTwoPhaseMixture::New"
|
||||||
|
) << "Unknown phaseChangeTwoPhaseMixture type "
|
||||||
|
<< phaseChangeTwoPhaseMixtureTypeName << endl << endl
|
||||||
|
<< "Valid phaseChangeTwoPhaseMixtures are : " << endl
|
||||||
|
<< componentsConstructorTablePtr_->toc()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<phaseChangeTwoPhaseMixture>(cstrIter()(U, phi, alpha1Name));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,94 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "phaseChangeTwoPhaseMixture.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(phaseChangeTwoPhaseMixture, 0);
|
||||||
|
defineRunTimeSelectionTable(phaseChangeTwoPhaseMixture, components);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::phaseChangeTwoPhaseMixture::phaseChangeTwoPhaseMixture
|
||||||
|
(
|
||||||
|
const word& type,
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const word& alpha1Name
|
||||||
|
)
|
||||||
|
:
|
||||||
|
twoPhaseMixture(U, phi, alpha1Name),
|
||||||
|
phaseChangeTwoPhaseMixtureCoeffs_(subDict(type + "Coeffs")),
|
||||||
|
pSat_(lookup("pSat"))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Pair<Foam::tmp<Foam::volScalarField> >
|
||||||
|
Foam::phaseChangeTwoPhaseMixture::vDotAlphal() const
|
||||||
|
{
|
||||||
|
volScalarField alphalCoeff = 1.0/rho1() - alpha1_*(1.0/rho1() - 1.0/rho2());
|
||||||
|
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]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::phaseChangeTwoPhaseMixture::read()
|
||||||
|
{
|
||||||
|
if (twoPhaseMixture::read())
|
||||||
|
{
|
||||||
|
phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
|
||||||
|
lookup("pSat") >> pSat_;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,175 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||||
|
\\/ 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 2 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, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::phaseChangeTwoPhaseMixture
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
phaseChangeTwoPhaseMixture.C
|
||||||
|
newPhaseChangeModel.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef phaseChangeTwoPhaseMixture_H
|
||||||
|
#define phaseChangeTwoPhaseMixture_H
|
||||||
|
|
||||||
|
#include "twoPhaseMixture.H"
|
||||||
|
#include "typeInfo.H"
|
||||||
|
#include "runTimeSelectionTables.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "dimensionedScalar.H"
|
||||||
|
#include "autoPtr.H"
|
||||||
|
#include "Pair.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class phaseChangeTwoPhaseMixture Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class phaseChangeTwoPhaseMixture
|
||||||
|
:
|
||||||
|
public twoPhaseMixture
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
dictionary phaseChangeTwoPhaseMixtureCoeffs_;
|
||||||
|
|
||||||
|
//- Saturation vapour pressure
|
||||||
|
dimensionedScalar pSat_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow copy construct
|
||||||
|
phaseChangeTwoPhaseMixture(const phaseChangeTwoPhaseMixture&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const phaseChangeTwoPhaseMixture&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("phaseChangeTwoPhaseMixture");
|
||||||
|
|
||||||
|
|
||||||
|
// Declare run-time constructor selection table
|
||||||
|
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
phaseChangeTwoPhaseMixture,
|
||||||
|
components,
|
||||||
|
(
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const word& alpha1Name
|
||||||
|
),
|
||||||
|
(U, phi, alpha1Name)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Selectors
|
||||||
|
|
||||||
|
//- Return a reference to the selected phaseChange model
|
||||||
|
static autoPtr<phaseChangeTwoPhaseMixture> New
|
||||||
|
(
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const word& alpha1Name
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
phaseChangeTwoPhaseMixture
|
||||||
|
(
|
||||||
|
const word& type,
|
||||||
|
const volVectorField& U,
|
||||||
|
const surfaceScalarField& phi,
|
||||||
|
const word& alpha1Name = "alpha1"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~phaseChangeTwoPhaseMixture()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return const-access to the saturation vapour pressure
|
||||||
|
const dimensionedScalar& pSat() const
|
||||||
|
{
|
||||||
|
return pSat_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- 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 = 0;
|
||||||
|
|
||||||
|
//- Return the mass condensation and vaporisation rates as an
|
||||||
|
// explicit term for the condensation rate and a coefficient to
|
||||||
|
// multiply (p - pSat) for the vaporisation rate
|
||||||
|
virtual Pair<tmp<volScalarField> > mDotP() const = 0;
|
||||||
|
|
||||||
|
//- Return the volumetric 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
|
||||||
|
Pair<tmp<volScalarField> > vDotAlphal() const;
|
||||||
|
|
||||||
|
//- Return the volumetric condensation and vaporisation rates as an
|
||||||
|
// explicit term for the condensation rate and a coefficient to
|
||||||
|
// multiply (p - pSat) for the vaporisation rate
|
||||||
|
Pair<tmp<volScalarField> > vDotP() const;
|
||||||
|
|
||||||
|
//- Correct the phaseChange model
|
||||||
|
virtual void correct() = 0;
|
||||||
|
|
||||||
|
//- Read the transportProperties dictionary and update
|
||||||
|
virtual bool read() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user