Add the OpenFOAM source tree
This commit is contained in:
9
applications/solvers/multiphase/interPhaseChangeFoam/Allwclean
Executable file
9
applications/solvers/multiphase/interPhaseChangeFoam/Allwclean
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
set -x
|
||||
|
||||
wclean libso phaseChangeTwoPhaseMixtures
|
||||
wclean
|
||||
wclean interPhaseChangeDyMFoam
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
9
applications/solvers/multiphase/interPhaseChangeFoam/Allwmake
Executable file
9
applications/solvers/multiphase/interPhaseChangeFoam/Allwmake
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
set -x
|
||||
|
||||
wmake libso phaseChangeTwoPhaseMixtures
|
||||
wmake
|
||||
wmake interPhaseChangeDyMFoam
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
@ -0,0 +1,3 @@
|
||||
interPhaseChangeFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/interPhaseChangeFoam
|
||||
@ -0,0 +1,25 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
|
||||
-IphaseChangeTwoPhaseMixtures/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/fvOptions/lnInclude\
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lphaseChangeTwoPhaseMixtures \
|
||||
-ltwoPhaseMixture \
|
||||
-linterfaceProperties \
|
||||
-ltwoPhaseProperties \
|
||||
-lincompressibleTransportModels \
|
||||
-lincompressibleTurbulenceModel \
|
||||
-lincompressibleRASModels \
|
||||
-lincompressibleLESModels \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lfvOptions \
|
||||
-lsampling
|
||||
26
applications/solvers/multiphase/interPhaseChangeFoam/UEqn.H
Normal file
26
applications/solvers/multiphase/interPhaseChangeFoam/UEqn.H
Normal file
@ -0,0 +1,26 @@
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(rho, U)
|
||||
+ fvm::div(rhoPhi, U)
|
||||
- fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), U)
|
||||
+ turbulence->divDevRhoReff(rho, U)
|
||||
);
|
||||
|
||||
UEqn.relax();
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve
|
||||
(
|
||||
UEqn
|
||||
==
|
||||
fvc::reconstruct
|
||||
(
|
||||
(
|
||||
interface.surfaceTensionForce()
|
||||
- ghf*fvc::snGrad(rho)
|
||||
- fvc::snGrad(p_rgh)
|
||||
) * mesh.magSf()
|
||||
)
|
||||
);
|
||||
}
|
||||
123
applications/solvers/multiphase/interPhaseChangeFoam/alphaEqn.H
Normal file
123
applications/solvers/multiphase/interPhaseChangeFoam/alphaEqn.H
Normal file
@ -0,0 +1,123 @@
|
||||
{
|
||||
word alphaScheme("div(phi,alpha)");
|
||||
word alpharScheme("div(phirb,alpha)");
|
||||
|
||||
surfaceScalarField phir("phir", phic*interface.nHatf());
|
||||
|
||||
Pair<tmp<volScalarField> > vDotAlphal =
|
||||
mixture->vDotAlphal();
|
||||
const volScalarField& vDotcAlphal = vDotAlphal[0]();
|
||||
const volScalarField& vDotvAlphal = vDotAlphal[1]();
|
||||
const volScalarField vDotvmcAlphal(vDotvAlphal - vDotcAlphal);
|
||||
|
||||
tmp<surfaceScalarField> tphiAlpha;
|
||||
|
||||
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) = " << min(alpha1).value()
|
||||
<< " Max(alpha1) = " << max(alpha1).value()
|
||||
<< endl;
|
||||
|
||||
tphiAlpha = alpha1Eqn.flux();
|
||||
}
|
||||
|
||||
volScalarField alpha10("alpha10", alpha1);
|
||||
|
||||
for (int aCorr=0; aCorr<nAlphaCorr; aCorr++)
|
||||
{
|
||||
tmp<surfaceScalarField> tphiAlphaCorr
|
||||
(
|
||||
fvc::flux
|
||||
(
|
||||
phi,
|
||||
alpha1,
|
||||
alphaScheme
|
||||
)
|
||||
+ fvc::flux
|
||||
(
|
||||
-fvc::flux(-phir, alpha2, alpharScheme),
|
||||
alpha1,
|
||||
alpharScheme
|
||||
)
|
||||
);
|
||||
|
||||
if (MULESCorr)
|
||||
{
|
||||
tphiAlphaCorr() -= tphiAlpha();
|
||||
|
||||
volScalarField alpha100("alpha100", alpha10);
|
||||
alpha10 = alpha1;
|
||||
|
||||
MULES::correct
|
||||
(
|
||||
geometricOneField(),
|
||||
alpha1,
|
||||
tphiAlpha(),
|
||||
tphiAlphaCorr(),
|
||||
vDotvmcAlphal,
|
||||
(
|
||||
divU*(alpha10 - alpha100)
|
||||
- vDotvmcAlphal*alpha10
|
||||
)(),
|
||||
1,
|
||||
0
|
||||
);
|
||||
|
||||
// Under-relax the correction for all but the 1st corrector
|
||||
if (aCorr == 0)
|
||||
{
|
||||
tphiAlpha() += tphiAlphaCorr();
|
||||
}
|
||||
else
|
||||
{
|
||||
alpha1 = 0.5*alpha1 + 0.5*alpha10;
|
||||
tphiAlpha() += 0.5*tphiAlphaCorr();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MULES::explicitSolve
|
||||
(
|
||||
geometricOneField(),
|
||||
alpha1,
|
||||
phi,
|
||||
tphiAlphaCorr(),
|
||||
vDotvmcAlphal,
|
||||
(divU*alpha1 + vDotcAlphal)(),
|
||||
1,
|
||||
0
|
||||
);
|
||||
|
||||
tphiAlpha = tphiAlphaCorr;
|
||||
}
|
||||
|
||||
alpha2 = 1.0 - alpha1;
|
||||
}
|
||||
|
||||
rhoPhi = tphiAlpha()*(rho1 - rho2) + phi*rho2;
|
||||
|
||||
Info<< "Liquid phase volume fraction = "
|
||||
<< alpha1.weightedAverage(mesh.V()).value()
|
||||
<< " Min(alpha1) = " << min(alpha1).value()
|
||||
<< " Max(alpha1) = " << max(alpha1).value()
|
||||
<< endl;
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
{
|
||||
surfaceScalarField phic(mag(phi/mesh.magSf()));
|
||||
phic = min(interface.cAlpha()*phic, max(phic));
|
||||
|
||||
volScalarField divU(fvc::div(phi));
|
||||
|
||||
if (nAlphaSubCycles > 1)
|
||||
{
|
||||
dimensionedScalar totalDeltaT = runTime.deltaT();
|
||||
surfaceScalarField rhoPhiSum("rhoPhiSum", rhoPhi);
|
||||
|
||||
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;
|
||||
}
|
||||
@ -0,0 +1,109 @@
|
||||
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> mixture =
|
||||
phaseChangeTwoPhaseMixture::New(U, phi);
|
||||
|
||||
volScalarField& alpha1(mixture->alpha1());
|
||||
volScalarField& alpha2(mixture->alpha2());
|
||||
|
||||
const dimensionedScalar& rho1 = mixture->rho1();
|
||||
const dimensionedScalar& rho2 = mixture->rho2();
|
||||
const dimensionedScalar& pSat = mixture->pSat();
|
||||
|
||||
|
||||
// Need to store rho for ddt(rho, U)
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT
|
||||
),
|
||||
alpha1*rho1 + alpha2*rho2,
|
||||
alpha1.boundaryField().types()
|
||||
);
|
||||
rho.oldTime();
|
||||
|
||||
|
||||
// Construct interface from alpha1 distribution
|
||||
interfaceProperties interface(alpha1, U, mixture());
|
||||
|
||||
// Construct incompressible turbulence model
|
||||
autoPtr<incompressible::turbulenceModel> turbulence
|
||||
(
|
||||
incompressible::turbulenceModel::New(U, phi, mixture())
|
||||
);
|
||||
|
||||
|
||||
Info<< "Calculating field g.h\n" << 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
|
||||
),
|
||||
p_rgh + rho*gh
|
||||
);
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell
|
||||
(
|
||||
p,
|
||||
p_rgh,
|
||||
mesh.solutionDict().subDict("PIMPLE"),
|
||||
pRefCell,
|
||||
pRefValue
|
||||
);
|
||||
|
||||
if (p_rgh.needReference())
|
||||
{
|
||||
p += dimensionedScalar
|
||||
(
|
||||
"p",
|
||||
p.dimensions(),
|
||||
pRefValue - getRefCellValue(p, pRefCell)
|
||||
);
|
||||
p_rgh = p - rho*gh;
|
||||
}
|
||||
|
||||
fv::IOoptionList fvOptions(mesh);
|
||||
@ -0,0 +1,3 @@
|
||||
interPhaseChangeDyMFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/interPhaseChangeDyMFoam
|
||||
@ -0,0 +1,31 @@
|
||||
EXE_INC = \
|
||||
-I.. \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
|
||||
-I../phaseChangeTwoPhaseMixtures/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/fvOptions/lnInclude\
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lphaseChangeTwoPhaseMixtures \
|
||||
-ltwoPhaseMixture \
|
||||
-linterfaceProperties \
|
||||
-ltwoPhaseProperties \
|
||||
-lincompressibleTransportModels \
|
||||
-lincompressibleTurbulenceModel \
|
||||
-lincompressibleRASModels \
|
||||
-lincompressibleLESModels \
|
||||
-lfiniteVolume \
|
||||
-ldynamicMesh \
|
||||
-ldynamicFvMesh \
|
||||
-ltopoChangerFvMesh \
|
||||
-lmeshTools \
|
||||
-lfvOptions \
|
||||
-lsampling
|
||||
@ -0,0 +1,189 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 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
|
||||
interPhaseChangeDyMFoam
|
||||
|
||||
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 "turbulenceModel.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "fvIOoptionList.H"
|
||||
#include "fixedFluxPressureFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createDynamicFvMesh.H"
|
||||
#include "readGravitationalAcceleration.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
#include "createFields.H"
|
||||
#include "readTimeControls.H"
|
||||
#include "createPcorrTypes.H"
|
||||
|
||||
volScalarField rAU
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rAU",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1.0)
|
||||
);
|
||||
|
||||
#include "createUf.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "../interFoam/interDyMFoam/readControls.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
// Store divU from the previous mesh for the correctPhi
|
||||
volScalarField divU(fvc::div(fvc::absolute(phi, U)));
|
||||
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
Info<< "Execution time for mesh.update() = "
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
|
||||
gh = g & mesh.C();
|
||||
ghf = g & mesh.Cf();
|
||||
}
|
||||
|
||||
if (mesh.changing() && correctPhi)
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
#define divUCorr -divU
|
||||
#include "../interFoam/interDyMFoam/correctPhi.H"
|
||||
|
||||
// Make the flux relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
}
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
}
|
||||
|
||||
#include "alphaControls.H"
|
||||
|
||||
surfaceScalarField rhoPhi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoPhi",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimMass/dimTime, 0)
|
||||
);
|
||||
|
||||
mixture->correct();
|
||||
|
||||
#include "alphaEqnSubCycle.H"
|
||||
interface.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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,89 @@
|
||||
{
|
||||
rAU = 1.0/UEqn.A();
|
||||
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
|
||||
|
||||
volVectorField HbyA("HbyA", U);
|
||||
HbyA = rAU*UEqn.H();
|
||||
|
||||
surfaceScalarField phiHbyA
|
||||
(
|
||||
"phiHbyA",
|
||||
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, Uf)
|
||||
);
|
||||
|
||||
if (p_rgh.needReference())
|
||||
{
|
||||
fvc::makeRelative(phiHbyA, U);
|
||||
adjustPhi(phiHbyA, U, p_rgh);
|
||||
fvc::makeAbsolute(phiHbyA, U);
|
||||
}
|
||||
|
||||
surfaceScalarField phig
|
||||
(
|
||||
(
|
||||
interface.surfaceTensionForce()
|
||||
- ghf*fvc::snGrad(rho)
|
||||
)*rAUf*mesh.magSf()
|
||||
);
|
||||
|
||||
phiHbyA += phig;
|
||||
|
||||
// Update the fixedFluxPressure BCs to ensure flux consistency
|
||||
setSnGrad<fixedFluxPressureFvPatchScalarField>
|
||||
(
|
||||
p_rgh.boundaryField(),
|
||||
(
|
||||
phiHbyA.boundaryField()
|
||||
- (mesh.Sf().boundaryField() & U.boundaryField())
|
||||
)/(mesh.magSf().boundaryField()*rAUf.boundaryField())
|
||||
);
|
||||
|
||||
Pair<tmp<volScalarField> > vDotP = mixture->vDotP();
|
||||
const volScalarField& vDotcP = vDotP[0]();
|
||||
const volScalarField& vDotvP = vDotP[1]();
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix p_rghEqn
|
||||
(
|
||||
fvc::div(phiHbyA) - fvm::laplacian(rAUf, p_rgh)
|
||||
- (vDotvP - vDotcP)*(pSat - rho*gh) + fvm::Sp(vDotvP - vDotcP, p_rgh)
|
||||
);
|
||||
|
||||
p_rghEqn.setReference(pRefCell, pRefValue);
|
||||
|
||||
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
|
||||
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
phi = phiHbyA + p_rghEqn.flux();
|
||||
|
||||
U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rAUf);
|
||||
U.correctBoundaryConditions();
|
||||
fvOptions.correct(U);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
Uf = fvc::interpolate(U);
|
||||
surfaceVectorField n(mesh.Sf()/mesh.magSf());
|
||||
Uf += n*(phi/mesh.magSf() - (n & Uf));
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,134 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 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.
|
||||
|
||||
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 "CMULES.H"
|
||||
#include "subCycle.H"
|
||||
#include "interfaceProperties.H"
|
||||
#include "phaseChangeTwoPhaseMixture.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "fvIOoptionList.H"
|
||||
#include "fixedFluxPressureFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
#include "readGravitationalAcceleration.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "createFields.H"
|
||||
#include "readTimeControls.H"
|
||||
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
#include "createPrghCorrTypes.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
#include "alphaControls.H"
|
||||
|
||||
surfaceScalarField rhoPhi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoPhi",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimMass/dimTime, 0)
|
||||
);
|
||||
|
||||
mixture->correct();
|
||||
|
||||
#include "alphaEqnSubCycle.H"
|
||||
interface.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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
74
applications/solvers/multiphase/interPhaseChangeFoam/pEqn.H
Normal file
74
applications/solvers/multiphase/interPhaseChangeFoam/pEqn.H
Normal file
@ -0,0 +1,74 @@
|
||||
{
|
||||
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
|
||||
|
||||
volVectorField HbyA("HbyA", U);
|
||||
HbyA = rAU*UEqn.H();
|
||||
|
||||
surfaceScalarField phiHbyA
|
||||
(
|
||||
"phiHbyA",
|
||||
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi)
|
||||
);
|
||||
adjustPhi(phiHbyA, U, p_rgh);
|
||||
|
||||
surfaceScalarField phig
|
||||
(
|
||||
(
|
||||
interface.surfaceTensionForce()
|
||||
- ghf*fvc::snGrad(rho)
|
||||
)*rAUf*mesh.magSf()
|
||||
);
|
||||
|
||||
phiHbyA += phig;
|
||||
|
||||
// Update the fixedFluxPressure BCs to ensure flux consistency
|
||||
setSnGrad<fixedFluxPressureFvPatchScalarField>
|
||||
(
|
||||
p_rgh.boundaryField(),
|
||||
(
|
||||
phiHbyA.boundaryField()
|
||||
- (mesh.Sf().boundaryField() & U.boundaryField())
|
||||
)/(mesh.magSf().boundaryField()*rAUf.boundaryField())
|
||||
);
|
||||
|
||||
Pair<tmp<volScalarField> > vDotP = mixture->vDotP();
|
||||
const volScalarField& vDotcP = vDotP[0]();
|
||||
const volScalarField& vDotvP = vDotP[1]();
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix p_rghEqn
|
||||
(
|
||||
fvc::div(phiHbyA) - fvm::laplacian(rAUf, p_rgh)
|
||||
- (vDotvP - vDotcP)*(pSat - rho*gh) + fvm::Sp(vDotvP - vDotcP, p_rgh)
|
||||
);
|
||||
|
||||
p_rghEqn.setReference(pRefCell, pRefValue);
|
||||
|
||||
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
|
||||
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
phi = phiHbyA + p_rghEqn.flux();
|
||||
|
||||
U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rAUf);
|
||||
U.correctBoundaryConditions();
|
||||
fvOptions.correct(U);
|
||||
}
|
||||
}
|
||||
|
||||
p == p_rgh + rho*gh;
|
||||
|
||||
if (p_rgh.needReference())
|
||||
{
|
||||
p += dimensionedScalar
|
||||
(
|
||||
"p",
|
||||
p.dimensions(),
|
||||
pRefValue - getRefCellValue(p, pRefCell)
|
||||
);
|
||||
p_rgh = p - rho*gh;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,124 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 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 "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
|
||||
)
|
||||
:
|
||||
phaseChangeTwoPhaseMixture(typeName, U, phi),
|
||||
|
||||
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,131 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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::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.
|
||||
\endverbatim
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
|
||||
//- 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 coefficients
|
||||
// to multiply (p - pSat)
|
||||
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,7 @@
|
||||
phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C
|
||||
phaseChangeTwoPhaseMixture/newPhaseChangeTwoPhaseMixture.C
|
||||
Kunz/Kunz.C
|
||||
Merkle/Merkle.C
|
||||
SchnerrSauer/SchnerrSauer.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libphaseChangeTwoPhaseMixtures
|
||||
@ -0,0 +1,11 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-ltwoPhaseMixture \
|
||||
-ltwoPhaseProperties \
|
||||
-lincompressibleTransportModels \
|
||||
-lfiniteVolume
|
||||
@ -0,0 +1,119 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 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 "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
|
||||
)
|
||||
:
|
||||
phaseChangeTwoPhaseMixture(typeName, U, phi),
|
||||
|
||||
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,125 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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::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.
|
||||
\endverbatim
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
|
||||
//- 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 coefficients
|
||||
// to multiply (p - pSat)
|
||||
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) 2011 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 "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
|
||||
)
|
||||
:
|
||||
phaseChangeTwoPhaseMixture(typeName, U, phi),
|
||||
|
||||
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*constant::mathematical::pi*n_)/3)
|
||||
*limitedAlpha1/(1.0 + alphaNuc() - limitedAlpha1),
|
||||
1.0/3.0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::dimensionedScalar
|
||||
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::alphaNuc() const
|
||||
{
|
||||
dimensionedScalar Vnuc = n_*constant::mathematical::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,138 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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::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.
|
||||
\endverbatim
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
|
||||
//- 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 coefficients
|
||||
// to multiply (p - pSat)
|
||||
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,79 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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 "phaseChangeTwoPhaseMixture.H"
|
||||
#include "incompressibleTwoPhaseMixture.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::phaseChangeTwoPhaseMixture>
|
||||
Foam::phaseChangeTwoPhaseMixture::New
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi
|
||||
)
|
||||
{
|
||||
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_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<phaseChangeTwoPhaseMixture>(cstrIter()(U, phi));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,92 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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 "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
|
||||
)
|
||||
:
|
||||
incompressibleTwoPhaseMixture(U, phi),
|
||||
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 (incompressibleTwoPhaseMixture::read())
|
||||
{
|
||||
phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
|
||||
lookup("pSat") >> pSat_;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,168 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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::phaseChangeTwoPhaseMixture
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
phaseChangeTwoPhaseMixture.C
|
||||
newPhaseChangeModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef phaseChangeTwoPhaseMixture_H
|
||||
#define phaseChangeTwoPhaseMixture_H
|
||||
|
||||
#include "incompressibleTwoPhaseMixture.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 incompressibleTwoPhaseMixture
|
||||
{
|
||||
|
||||
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
|
||||
),
|
||||
(U, phi)
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected phaseChange model
|
||||
static autoPtr<phaseChangeTwoPhaseMixture> New
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
phaseChangeTwoPhaseMixture
|
||||
(
|
||||
const word& type,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi
|
||||
);
|
||||
|
||||
|
||||
//- 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 coefficients
|
||||
// to multiply (p - pSat)
|
||||
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
|
||||
// coefficients to multiply (p - pSat)
|
||||
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