mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
GIT: Resolved merge conflict when merging develop branch
This commit is contained in:
@ -38,6 +38,9 @@ Description
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "CMULES.H"
|
||||
#include "EulerDdtScheme.H"
|
||||
#include "localEulerDdtScheme.H"
|
||||
#include "CrankNicolsonDdtScheme.H"
|
||||
#include "subCycle.H"
|
||||
|
||||
#include "immiscibleIncompressibleTwoPhaseMixture.H"
|
||||
@ -45,7 +48,7 @@ Description
|
||||
#include "pimpleControl.H"
|
||||
#include "fvOptions.H"
|
||||
#include "CorrectPhi.H"
|
||||
#include "fixedFluxPressureFvPatchScalarField.H"
|
||||
#include "fvcSmooth.H"
|
||||
|
||||
#include "basicKinematicMPPICCloud.H"
|
||||
|
||||
@ -59,16 +62,22 @@ int main(int argc, char *argv[])
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
#include "createControl.H"
|
||||
#include "createTimeControls.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "createFields.H"
|
||||
#include "createAlphaFluxes.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "createTimeControls.H"
|
||||
#include "correctPhi.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
turbulence->validate();
|
||||
|
||||
if (!LTS)
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
@ -76,9 +85,17 @@ int main(int argc, char *argv[])
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
#include "CourantNo.H"
|
||||
#include "alphaCourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
if (LTS)
|
||||
{
|
||||
#include "setRDeltaT.H"
|
||||
}
|
||||
else
|
||||
{
|
||||
#include "CourantNo.H"
|
||||
#include "alphaCourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
}
|
||||
|
||||
runTime++;
|
||||
|
||||
@ -133,6 +150,8 @@ int main(int argc, char *argv[])
|
||||
#include "alphaControls.H"
|
||||
#include "alphaEqnSubCycle.H"
|
||||
|
||||
mixture.correct();
|
||||
|
||||
#include "UEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
|
||||
@ -4,6 +4,7 @@ EXE_INC = \
|
||||
-I. \
|
||||
-I./IncompressibleTwoPhaseMixtureTurbulenceModels/lnInclude \
|
||||
-I$(interFoamPath) \
|
||||
-I../VoF \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/fvOptions/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
@ -31,7 +32,7 @@ EXE_LIBS = \
|
||||
-lmeshTools \
|
||||
-llagrangian \
|
||||
-llagrangianIntermediate \
|
||||
-lthermophysicalFunctions \
|
||||
-lthermophysicalProperties \
|
||||
-lspecie \
|
||||
-lincompressibleTransportModels \
|
||||
-limmiscibleIncompressibleTwoPhaseMixture \
|
||||
|
||||
@ -1,164 +0,0 @@
|
||||
{
|
||||
word alphaScheme("div(phi,alpha)");
|
||||
word alpharScheme("div(phirb,alpha)");
|
||||
|
||||
// Standard face-flux compression coefficient
|
||||
surfaceScalarField phic
|
||||
(
|
||||
mixture.cAlpha()*mag(alphaPhic/mesh.magSf())
|
||||
);
|
||||
|
||||
// Add the optional isotropic compression contribution
|
||||
if (icAlpha > 0)
|
||||
{
|
||||
phic *= (1.0 - icAlpha);
|
||||
phic += (mixture.cAlpha()*icAlpha)*fvc::interpolate(mag(U));
|
||||
}
|
||||
|
||||
// Do not compress interface at non-coupled boundary faces
|
||||
// (inlets, outlets etc.)
|
||||
surfaceScalarField::Boundary& phicBf = phic.boundaryFieldRef();
|
||||
forAll(phic.boundaryField(), patchi)
|
||||
{
|
||||
fvsPatchScalarField& phicp = phicBf[patchi];
|
||||
|
||||
if (!phicp.coupled())
|
||||
{
|
||||
phicp == 0;
|
||||
}
|
||||
}
|
||||
|
||||
tmp<surfaceScalarField> tphiAlpha;
|
||||
|
||||
if (MULESCorr)
|
||||
{
|
||||
fvScalarMatrix alpha1Eqn
|
||||
(
|
||||
fv::EulerDdtScheme<scalar>(mesh).fvmDdt(alphac, alpha1)
|
||||
+ fv::gaussConvectionScheme<scalar>
|
||||
(
|
||||
mesh,
|
||||
alphaPhic,
|
||||
upwind<scalar>(mesh, alphaPhic)
|
||||
).fvmDiv(alphaPhic, alpha1)
|
||||
- fvm::Sp(fvc::ddt(alphac) + fvc::div(alphaPhic), alpha1)
|
||||
);
|
||||
|
||||
alpha1Eqn.solve();
|
||||
|
||||
Info<< "Phase-1 volume fraction = "
|
||||
<< alpha1.weightedAverage(mesh.Vsc()).value()
|
||||
<< " Min(alpha1) = " << min(alpha1).value()
|
||||
<< " Max(alpha1) = " << max(alpha1).value()
|
||||
<< endl;
|
||||
|
||||
tmp<surfaceScalarField> tphiAlphaUD(alpha1Eqn.flux());
|
||||
alphaPhi = tphiAlphaUD();
|
||||
|
||||
if (alphaApplyPrevCorr && tphiAlphaCorr0.valid())
|
||||
{
|
||||
Info<< "Applying the previous iteration compression flux" << endl;
|
||||
|
||||
MULES::correct
|
||||
(
|
||||
alphac,
|
||||
alpha1,
|
||||
alphaPhi,
|
||||
tphiAlphaCorr0.ref(),
|
||||
zeroField(), zeroField(),
|
||||
1, 0
|
||||
);
|
||||
|
||||
alphaPhi += tphiAlphaCorr0();
|
||||
}
|
||||
|
||||
// Cache the upwind-flux
|
||||
tphiAlphaCorr0 = tphiAlphaUD;
|
||||
|
||||
alpha2 = 1.0 - alpha1;
|
||||
|
||||
mixture.correct();
|
||||
}
|
||||
|
||||
for (int aCorr=0; aCorr<nAlphaCorr; aCorr++)
|
||||
{
|
||||
surfaceScalarField phir(phic*mixture.nHatf());
|
||||
|
||||
tmp<surfaceScalarField> tphiAlphaUn
|
||||
(
|
||||
fvc::flux
|
||||
(
|
||||
alphaPhic,
|
||||
alpha1,
|
||||
alphaScheme
|
||||
)
|
||||
+ fvc::flux
|
||||
(
|
||||
-fvc::flux(-phir, alpha2, alpharScheme),
|
||||
alpha1,
|
||||
alpharScheme
|
||||
)
|
||||
);
|
||||
|
||||
if (MULESCorr)
|
||||
{
|
||||
tmp<surfaceScalarField> tphiAlphaCorr(tphiAlphaUn() - alphaPhi);
|
||||
volScalarField alpha10("alpha10", alpha1);
|
||||
|
||||
//MULES::correct(alpha1, tphiAlphaUn(), tphiAlphaCorr(), 1, 0);
|
||||
|
||||
MULES::correct
|
||||
(
|
||||
alphac,
|
||||
alpha1,
|
||||
tphiAlphaUn(),
|
||||
tphiAlphaCorr.ref(),
|
||||
zeroField(), zeroField(),
|
||||
1, 0
|
||||
);
|
||||
|
||||
// Under-relax the correction for all but the 1st corrector
|
||||
if (aCorr == 0)
|
||||
{
|
||||
alphaPhi += tphiAlphaCorr();
|
||||
}
|
||||
else
|
||||
{
|
||||
alpha1 = 0.5*alpha1 + 0.5*alpha10;
|
||||
alphaPhi += 0.5*tphiAlphaCorr();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alphaPhi = tphiAlphaUn;
|
||||
|
||||
MULES::explicitSolve
|
||||
(
|
||||
alphac,
|
||||
alpha1,
|
||||
alphaPhic,
|
||||
alphaPhi,
|
||||
zeroField(), zeroField(),
|
||||
1, 0
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
alpha2 = 1.0 - alpha1;
|
||||
|
||||
mixture.correct();
|
||||
}
|
||||
|
||||
rhoPhi = alphaPhi*(rho1 - rho2) + alphaPhic*rho2;
|
||||
|
||||
if (alphaApplyPrevCorr && MULESCorr)
|
||||
{
|
||||
tphiAlphaCorr0 = alphaPhi - tphiAlphaCorr0;
|
||||
}
|
||||
|
||||
Info<< "Phase-1 volume fraction = "
|
||||
<< alpha1.weightedAverage(mesh.Vsc()).value()
|
||||
<< " Min(alpha1) = " << min(alpha1).value()
|
||||
<< " Max(alpha1) = " << max(alpha1).value()
|
||||
<< endl;
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
if (nAlphaSubCycles > 1)
|
||||
{
|
||||
dimensionedScalar totalDeltaT = runTime.deltaT();
|
||||
surfaceScalarField rhoPhiSum
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoPhiSum",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", rhoPhi.dimensions(), 0)
|
||||
);
|
||||
|
||||
for
|
||||
(
|
||||
subCycle<volScalarField> alphaSubCycle(alpha1, nAlphaSubCycles);
|
||||
!(++alphaSubCycle).end();
|
||||
)
|
||||
{
|
||||
#include "alphaEqn.H"
|
||||
rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi;
|
||||
}
|
||||
|
||||
rhoPhi = rhoPhiSum;
|
||||
}
|
||||
else
|
||||
{
|
||||
#include "alphaEqn.H"
|
||||
}
|
||||
|
||||
rho == alpha1*rho1 + alpha2*rho2;
|
||||
mu = mixture.mu();
|
||||
@ -1,221 +1,204 @@
|
||||
Info<< "Reading field p_rgh\n" << endl;
|
||||
volScalarField p_rgh
|
||||
#include "createRDeltaT.H"
|
||||
|
||||
Info<< "Reading field p_rgh\n" << endl;
|
||||
volScalarField p_rgh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p_rgh",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
#include "createPhi.H"
|
||||
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
immiscibleIncompressibleTwoPhaseMixture mixture(U, phi);
|
||||
|
||||
volScalarField& alpha1(mixture.alpha1());
|
||||
volScalarField& alpha2(mixture.alpha2());
|
||||
|
||||
const dimensionedScalar& rho1 = mixture.rho1();
|
||||
const dimensionedScalar& rho2 = mixture.rho2();
|
||||
|
||||
// Need to store rho for ddt(rho, U)
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
alpha1*rho1 + alpha2*rho2
|
||||
);
|
||||
rho.oldTime();
|
||||
|
||||
// Need to store mu as incompressibleTwoPhaseMixture does not store it
|
||||
volScalarField mu
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"mu",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT
|
||||
),
|
||||
mixture.mu(),
|
||||
calculatedFvPatchScalarField::typeName
|
||||
);
|
||||
|
||||
|
||||
// Mass flux
|
||||
surfaceScalarField rhoPhi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoPhi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
fvc::interpolate(rho)*phi
|
||||
);
|
||||
|
||||
|
||||
#include "readGravitationalAcceleration.H"
|
||||
|
||||
#include "readhRef.H"
|
||||
#include "gh.H"
|
||||
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
p_rgh + rho*gh
|
||||
);
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell
|
||||
(
|
||||
p,
|
||||
p_rgh,
|
||||
mesh.solutionDict().subDict("PIMPLE"),
|
||||
pRefCell,
|
||||
pRefValue
|
||||
);
|
||||
|
||||
if (p_rgh.needReference())
|
||||
{
|
||||
p += dimensionedScalar
|
||||
(
|
||||
"p",
|
||||
p.dimensions(),
|
||||
pRefValue - getRefCellValue(p, pRefCell)
|
||||
);
|
||||
p_rgh = p - rho*gh;
|
||||
}
|
||||
|
||||
mesh.setFluxRequired(p_rgh.name());
|
||||
mesh.setFluxRequired(alpha1.name());
|
||||
|
||||
// MULES flux from previous time-step
|
||||
surfaceScalarField alphaPhi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"alphaPhi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
phi*fvc::interpolate(alpha1)
|
||||
);
|
||||
|
||||
|
||||
tmp<surfaceScalarField> tphiAlphaCorr0;
|
||||
|
||||
// alphac must be constructed before the cloud
|
||||
// so that the drag-models can find it
|
||||
volScalarField alphac
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"alphac",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
"p_rgh",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimless, 0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
alphac.oldTime();
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
volScalarField alphacRho(alphac*rho);
|
||||
alphacRho.oldTime();
|
||||
|
||||
Info<< "Constructing kinematicCloud " << endl;
|
||||
basicKinematicMPPICCloud kinematicCloud
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"kinematicCloud",
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
#include "createPhi.H"
|
||||
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
immiscibleIncompressibleTwoPhaseMixture mixture(U, phi);
|
||||
|
||||
volScalarField& alpha1(mixture.alpha1());
|
||||
volScalarField& alpha2(mixture.alpha2());
|
||||
|
||||
const dimensionedScalar& rho1 = mixture.rho1();
|
||||
const dimensionedScalar& rho2 = mixture.rho2();
|
||||
|
||||
// Need to store rho for ddt(rho, U)
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
alpha1*rho1 + alpha2*rho2
|
||||
);
|
||||
rho.oldTime();
|
||||
|
||||
// Need to store mu as incompressibleTwoPhaseMixture does not store it
|
||||
volScalarField mu
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"mu",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT
|
||||
),
|
||||
mixture.mu(),
|
||||
calculatedFvPatchScalarField::typeName
|
||||
);
|
||||
|
||||
|
||||
// Mass flux
|
||||
surfaceScalarField rhoPhi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoPhi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
fvc::interpolate(rho)*phi
|
||||
);
|
||||
|
||||
#include "readGravitationalAcceleration.H"
|
||||
#include "readhRef.H"
|
||||
#include "gh.H"
|
||||
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
p_rgh + rho*gh
|
||||
);
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell
|
||||
(
|
||||
p,
|
||||
p_rgh,
|
||||
mesh.solutionDict().subDict("PIMPLE"),
|
||||
pRefCell,
|
||||
pRefValue
|
||||
);
|
||||
|
||||
if (p_rgh.needReference())
|
||||
{
|
||||
p += dimensionedScalar
|
||||
(
|
||||
"p",
|
||||
p.dimensions(),
|
||||
pRefValue - getRefCellValue(p, pRefCell)
|
||||
);
|
||||
p_rgh = p - rho*gh;
|
||||
}
|
||||
|
||||
mesh.setFluxRequired(p_rgh.name());
|
||||
mesh.setFluxRequired(alpha1.name());
|
||||
|
||||
// alphac must be constructed before the cloud
|
||||
// so that the drag-models can find it
|
||||
volScalarField alphac
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"alphac",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimless, 0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
alphac.oldTime();
|
||||
|
||||
volScalarField alphacRho(alphac*rho);
|
||||
alphacRho.oldTime();
|
||||
|
||||
Info<< "Constructing kinematicCloud " << endl;
|
||||
basicKinematicMPPICCloud kinematicCloud
|
||||
(
|
||||
"kinematicCloud",
|
||||
rho,
|
||||
U,
|
||||
mu,
|
||||
g
|
||||
);
|
||||
|
||||
// Particle fraction upper limit
|
||||
scalar alphacMin
|
||||
(
|
||||
1.0
|
||||
- readScalar
|
||||
(
|
||||
kinematicCloud.particleProperties().subDict("constantProperties")
|
||||
.lookup("alphaMax")
|
||||
)
|
||||
);
|
||||
|
||||
// Update alphac from the particle locations
|
||||
alphac = max(1.0 - kinematicCloud.theta(), alphacMin);
|
||||
alphac.correctBoundaryConditions();
|
||||
|
||||
surfaceScalarField alphacf("alphacf", fvc::interpolate(alphac));
|
||||
|
||||
// Phase mass flux
|
||||
surfaceScalarField alphaRhoPhic("alphaRhoPhic", alphacf*rhoPhi);
|
||||
|
||||
// Volumetric phase flux
|
||||
surfaceScalarField alphaPhic("alphaPhic", alphacf*phi);
|
||||
|
||||
autoPtr
|
||||
<
|
||||
PhaseCompressibleTurbulenceModel
|
||||
<
|
||||
immiscibleIncompressibleTwoPhaseMixture
|
||||
>
|
||||
>turbulence
|
||||
(
|
||||
PhaseCompressibleTurbulenceModel
|
||||
<
|
||||
immiscibleIncompressibleTwoPhaseMixture
|
||||
>::New
|
||||
(
|
||||
alphac,
|
||||
rho,
|
||||
U,
|
||||
mu,
|
||||
g
|
||||
);
|
||||
alphaRhoPhic,
|
||||
rhoPhi,
|
||||
mixture
|
||||
)
|
||||
);
|
||||
|
||||
// Particle fraction upper limit
|
||||
scalar alphacMin
|
||||
(
|
||||
1.0
|
||||
- readScalar
|
||||
(
|
||||
kinematicCloud.particleProperties().subDict("constantProperties")
|
||||
.lookup("alphaMax")
|
||||
)
|
||||
);
|
||||
|
||||
// Update alphac from the particle locations
|
||||
alphac = max(1.0 - kinematicCloud.theta(), alphacMin);
|
||||
alphac.correctBoundaryConditions();
|
||||
|
||||
surfaceScalarField alphacf("alphacf", fvc::interpolate(alphac));
|
||||
|
||||
// Phase mass flux
|
||||
surfaceScalarField alphaRhoPhic("alphaRhoPhic", alphacf*rhoPhi);
|
||||
|
||||
// Volumetric phase flux
|
||||
surfaceScalarField alphaPhic("alphaPhic", alphacf*phi);
|
||||
|
||||
autoPtr
|
||||
<
|
||||
PhaseCompressibleTurbulenceModel
|
||||
<
|
||||
immiscibleIncompressibleTwoPhaseMixture
|
||||
>
|
||||
>turbulence
|
||||
(
|
||||
PhaseCompressibleTurbulenceModel
|
||||
<
|
||||
immiscibleIncompressibleTwoPhaseMixture
|
||||
>::New
|
||||
(
|
||||
alphac,
|
||||
rho,
|
||||
U,
|
||||
alphaRhoPhic,
|
||||
rhoPhi,
|
||||
mixture
|
||||
)
|
||||
);
|
||||
|
||||
#include "createMRF.H"
|
||||
#include "createMRF.H"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,46 +2,57 @@
|
||||
word alphaScheme("div(phi,alpha)");
|
||||
word alpharScheme("div(phirb,alpha)");
|
||||
|
||||
tmp<fv::ddtScheme<scalar>> ddtAlpha
|
||||
(
|
||||
fv::ddtScheme<scalar>::New
|
||||
(
|
||||
mesh,
|
||||
mesh.ddtScheme("ddt(alpha)")
|
||||
)
|
||||
);
|
||||
|
||||
// Set the off-centering coefficient according to ddt scheme
|
||||
scalar ocCoeff = 0;
|
||||
if
|
||||
(
|
||||
isType<fv::EulerDdtScheme<scalar>>(ddtAlpha())
|
||||
|| isType<fv::localEulerDdtScheme<scalar>>(ddtAlpha())
|
||||
)
|
||||
{
|
||||
ocCoeff = 0;
|
||||
}
|
||||
else if (isType<fv::CrankNicolsonDdtScheme<scalar>>(ddtAlpha()))
|
||||
{
|
||||
if (nAlphaSubCycles > 1)
|
||||
tmp<fv::ddtScheme<scalar>> tddtAlpha
|
||||
(
|
||||
fv::ddtScheme<scalar>::New
|
||||
(
|
||||
mesh,
|
||||
mesh.ddtScheme("ddt(alpha)")
|
||||
)
|
||||
);
|
||||
const fv::ddtScheme<scalar>& ddtAlpha = tddtAlpha();
|
||||
|
||||
if
|
||||
(
|
||||
isType<fv::EulerDdtScheme<scalar>>(ddtAlpha)
|
||||
|| isType<fv::localEulerDdtScheme<scalar>>(ddtAlpha)
|
||||
)
|
||||
{
|
||||
ocCoeff = 0;
|
||||
}
|
||||
else if (isType<fv::CrankNicolsonDdtScheme<scalar>>(ddtAlpha))
|
||||
{
|
||||
if (nAlphaSubCycles > 1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Sub-cycling is not supported "
|
||||
"with the CrankNicolson ddt scheme"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
alphaRestart
|
||||
|| mesh.time().timeIndex() > mesh.time().startTimeIndex() + 1
|
||||
)
|
||||
{
|
||||
ocCoeff =
|
||||
refCast<const fv::CrankNicolsonDdtScheme<scalar>>(ddtAlpha)
|
||||
.ocCoeff();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Sub-cycling is not supported "
|
||||
"with the CrankNicolson ddt scheme"
|
||||
<< "Only Euler and CrankNicolson ddt schemes are supported"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
ocCoeff =
|
||||
refCast<const fv::CrankNicolsonDdtScheme<scalar>>(ddtAlpha())
|
||||
.ocCoeff();
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Only Euler and CrankNicolson ddt schemes are supported"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Set the time blending factor, 1 for Euler
|
||||
scalar cnCoeff = 1.0/(1.0 + ocCoeff);
|
||||
|
||||
// Standard face-flux compression coefficient
|
||||
@ -79,6 +90,8 @@
|
||||
|
||||
if (MULESCorr)
|
||||
{
|
||||
#include "alphaSuSp.H"
|
||||
|
||||
fvScalarMatrix alpha1Eqn
|
||||
(
|
||||
(
|
||||
@ -92,6 +105,8 @@
|
||||
phiCN,
|
||||
upwind<scalar>(mesh, phiCN)
|
||||
).fvmDiv(phiCN, alpha1)
|
||||
==
|
||||
Su + fvm::Sp(Sp + divU, alpha1)
|
||||
);
|
||||
|
||||
alpha1Eqn.solve();
|
||||
@ -124,37 +139,42 @@
|
||||
|
||||
for (int aCorr=0; aCorr<nAlphaCorr; aCorr++)
|
||||
{
|
||||
#include "alphaSuSp.H"
|
||||
|
||||
surfaceScalarField phir(phic*mixture.nHatf());
|
||||
|
||||
alphaPhiUn =
|
||||
tmp<surfaceScalarField> talphaPhiUn
|
||||
(
|
||||
fvc::flux
|
||||
(
|
||||
fvc::flux
|
||||
(
|
||||
phi,
|
||||
alpha1,
|
||||
alphaScheme
|
||||
)
|
||||
+ fvc::flux
|
||||
(
|
||||
-fvc::flux(-phir, alpha2, alpharScheme),
|
||||
alpha1,
|
||||
alpharScheme
|
||||
)
|
||||
);
|
||||
|
||||
// Calculate the Crank-Nicolson off-centred alpha flux
|
||||
if (ocCoeff > 0)
|
||||
{
|
||||
alphaPhiUn =
|
||||
cnCoeff*alphaPhiUn + (1.0 - cnCoeff)*alphaPhi.oldTime();
|
||||
}
|
||||
phiCN(),
|
||||
cnCoeff*alpha1 + (1.0 - cnCoeff)*alpha1.oldTime(),
|
||||
alphaScheme
|
||||
)
|
||||
+ fvc::flux
|
||||
(
|
||||
-fvc::flux(-phir, alpha2, alpharScheme),
|
||||
alpha1,
|
||||
alpharScheme
|
||||
)
|
||||
);
|
||||
|
||||
if (MULESCorr)
|
||||
{
|
||||
tmp<surfaceScalarField> talphaPhiCorr(alphaPhiUn - alphaPhi);
|
||||
tmp<surfaceScalarField> talphaPhiCorr(talphaPhiUn() - alphaPhi);
|
||||
volScalarField alpha10("alpha10", alpha1);
|
||||
|
||||
MULES::correct(alpha1, alphaPhiUn, talphaPhiCorr.ref(), 1, 0);
|
||||
MULES::correct
|
||||
(
|
||||
geometricOneField(),
|
||||
alpha1,
|
||||
talphaPhiUn(),
|
||||
talphaPhiCorr.ref(),
|
||||
Sp,
|
||||
(-Sp*alpha1)(),
|
||||
1,
|
||||
0
|
||||
);
|
||||
|
||||
// Under-relax the correction for all but the 1st corrector
|
||||
if (aCorr == 0)
|
||||
@ -169,9 +189,19 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
alphaPhi = alphaPhiUn;
|
||||
alphaPhi = talphaPhiUn;
|
||||
|
||||
MULES::explicitSolve(alpha1, phiCN, alphaPhi, 1, 0);
|
||||
MULES::explicitSolve
|
||||
(
|
||||
geometricOneField(),
|
||||
alpha1,
|
||||
phiCN,
|
||||
alphaPhi,
|
||||
Sp,
|
||||
(Su + divU*min(alpha1(), scalar(1)))(),
|
||||
1,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
alpha2 = 1.0 - alpha1;
|
||||
@ -182,6 +212,11 @@
|
||||
if (alphaApplyPrevCorr && MULESCorr)
|
||||
{
|
||||
talphaPhiCorr0 = alphaPhi - talphaPhiCorr0;
|
||||
talphaPhiCorr0.ref().rename("alphaPhiCorr0");
|
||||
}
|
||||
else
|
||||
{
|
||||
talphaPhiCorr0.clear();
|
||||
}
|
||||
|
||||
if
|
||||
@ -190,7 +225,8 @@
|
||||
== fv::EulerDdtScheme<vector>::typeName
|
||||
)
|
||||
{
|
||||
rhoPhi = alphaPhi*(rho1 - rho2) + phiCN*rho2;
|
||||
#include "rhofs.H"
|
||||
rhoPhi = alphaPhi*(rho1f - rho2f) + phiCN*rho2f;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -201,7 +237,8 @@
|
||||
}
|
||||
|
||||
// Calculate the end-of-time-step mass flux
|
||||
rhoPhi = alphaPhi*(rho1 - rho2) + phi*rho2;
|
||||
#include "rhofs.H"
|
||||
rhoPhi = alphaPhi*(rho1f - rho2f) + phi*rho2f;
|
||||
}
|
||||
|
||||
Info<< "Phase-1 volume fraction = "
|
||||
20
applications/solvers/multiphase/VoF/createAlphaFluxes.H
Normal file
20
applications/solvers/multiphase/VoF/createAlphaFluxes.H
Normal file
@ -0,0 +1,20 @@
|
||||
IOobject alphaPhiHeader
|
||||
(
|
||||
"alphaPhi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
);
|
||||
|
||||
const bool alphaRestart = alphaPhiHeader.typeHeaderOk<surfaceScalarField>(true);
|
||||
|
||||
// MULES flux from previous time-step
|
||||
surfaceScalarField alphaPhi
|
||||
(
|
||||
alphaPhiHeader,
|
||||
phi*fvc::interpolate(alpha1)
|
||||
);
|
||||
|
||||
// MULES Correction
|
||||
tmp<surfaceScalarField> talphaPhiCorr0;
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,6 +2,7 @@
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
wclean libso twoPhaseMixtureThermo
|
||||
wclean libso surfaceTensionModels
|
||||
wclean
|
||||
wclean compressibleInterDyMFoam
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ cd ${0%/*} || exit 1 # Run from this directory
|
||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||
|
||||
wmake $targetType twoPhaseMixtureThermo
|
||||
wmake $targetType surfaceTensionModels
|
||||
|
||||
wmake $targetType
|
||||
wmake $targetType compressibleInterDyMFoam
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
EXE_INC = \
|
||||
-I. \
|
||||
-I../VoF \
|
||||
-ItwoPhaseMixtureThermo \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
@ -11,6 +13,7 @@ EXE_INC = \
|
||||
|
||||
EXE_LIBS = \
|
||||
-ltwoPhaseMixtureThermo \
|
||||
-ltwoPhaseSurfaceTension \
|
||||
-lcompressibleTransportModels \
|
||||
-lfluidThermophysicalModels \
|
||||
-lspecie \
|
||||
|
||||
@ -5,19 +5,25 @@
|
||||
+ fvm::div(rhoPhi, T)
|
||||
- fvm::laplacian(mixture.alphaEff(turbulence->mut()), T)
|
||||
+ (
|
||||
divU*p
|
||||
fvc::div(fvc::absolute(phi, U), p)
|
||||
+ fvc::ddt(rho, K) + fvc::div(rhoPhi, K)
|
||||
)
|
||||
*(
|
||||
alpha1/mixture.thermo1().Cv()
|
||||
+ alpha2/mixture.thermo2().Cv()
|
||||
)
|
||||
==
|
||||
fvOptions(rho, T)
|
||||
);
|
||||
|
||||
TEqn.relax();
|
||||
|
||||
fvOptions.constrain(TEqn);
|
||||
|
||||
TEqn.solve();
|
||||
|
||||
mixture.correct();
|
||||
fvOptions.correct(T);
|
||||
|
||||
Info<< "min(T) " << min(T).value() << endl;
|
||||
mixture.correctThermo();
|
||||
mixture.correct();
|
||||
}
|
||||
|
||||
@ -1,12 +1,16 @@
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(rho, U)
|
||||
+ fvm::div(rhoPhi, U)
|
||||
fvm::ddt(rho, U) + fvm::div(rhoPhi, U)
|
||||
+ MRF.DDt(rho, U)
|
||||
+ turbulence->divDevRhoReff(U)
|
||||
==
|
||||
fvOptions(rho, U)
|
||||
);
|
||||
|
||||
UEqn.relax();
|
||||
|
||||
fvOptions.constrain(UEqn);
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve
|
||||
@ -16,12 +20,14 @@
|
||||
fvc::reconstruct
|
||||
(
|
||||
(
|
||||
interface.surfaceTensionForce()
|
||||
mixture.surfaceTensionForce()
|
||||
- ghf*fvc::snGrad(rho)
|
||||
- fvc::snGrad(p_rgh)
|
||||
) * mesh.magSf()
|
||||
)
|
||||
);
|
||||
|
||||
fvOptions.correct(U);
|
||||
|
||||
K = 0.5*magSqr(U);
|
||||
}
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
const dictionary& alphaControls = mesh.solverDict(alpha1.name());
|
||||
|
||||
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr")));
|
||||
|
||||
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
|
||||
@ -1,88 +0,0 @@
|
||||
{
|
||||
word alphaScheme("div(phi,alpha)");
|
||||
word alpharScheme("div(phirb,alpha)");
|
||||
|
||||
surfaceScalarField phir(phic*interface.nHatf());
|
||||
|
||||
for (int gCorr=0; gCorr<nAlphaCorr; gCorr++)
|
||||
{
|
||||
volScalarField::Internal Sp
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Sp",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("Sp", dgdt.dimensions(), 0.0)
|
||||
);
|
||||
|
||||
volScalarField::Internal Su
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Su",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
// Divergence term is handled explicitly to be
|
||||
// consistent with the explicit transport solution
|
||||
divU*min(alpha1, scalar(1))
|
||||
);
|
||||
|
||||
forAll(dgdt, celli)
|
||||
{
|
||||
if (dgdt[celli] > 0.0 && alpha1[celli] > 0.0)
|
||||
{
|
||||
Sp[celli] -= dgdt[celli]*alpha1[celli];
|
||||
Su[celli] += dgdt[celli]*alpha1[celli];
|
||||
}
|
||||
else if (dgdt[celli] < 0.0 && alpha1[celli] < 1.0)
|
||||
{
|
||||
Sp[celli] += dgdt[celli]*(1.0 - alpha1[celli]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
surfaceScalarField alphaPhi1
|
||||
(
|
||||
fvc::flux
|
||||
(
|
||||
phi,
|
||||
alpha1,
|
||||
alphaScheme
|
||||
)
|
||||
+ fvc::flux
|
||||
(
|
||||
-fvc::flux(-phir, alpha2, alpharScheme),
|
||||
alpha1,
|
||||
alpharScheme
|
||||
)
|
||||
);
|
||||
|
||||
MULES::explicitSolve
|
||||
(
|
||||
geometricOneField(),
|
||||
alpha1,
|
||||
phi,
|
||||
alphaPhi1,
|
||||
Sp,
|
||||
Su,
|
||||
1,
|
||||
0
|
||||
);
|
||||
|
||||
surfaceScalarField rho1f(fvc::interpolate(rho1));
|
||||
surfaceScalarField rho2f(fvc::interpolate(rho2));
|
||||
rhoPhi = alphaPhi1*(rho1f - rho2f) + phi*rho2f;
|
||||
|
||||
alpha2 = scalar(1) - alpha1;
|
||||
}
|
||||
|
||||
Info<< "Liquid phase volume fraction = "
|
||||
<< alpha1.weightedAverage(mesh.V()).value()
|
||||
<< " Min(" << alpha1.name() << ") = " << min(alpha1).value()
|
||||
<< " Min(" << alpha2.name() << ") = " << min(alpha2).value()
|
||||
<< endl;
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
{
|
||||
#include "alphaControls.H"
|
||||
|
||||
surfaceScalarField phic(mag(phi/mesh.magSf()));
|
||||
phic = min(interface.cAlpha()*phic, max(phic));
|
||||
|
||||
volScalarField divU(fvc::div(fvc::absolute(phi, U)));
|
||||
|
||||
if (nAlphaSubCycles > 1)
|
||||
{
|
||||
dimensionedScalar totalDeltaT = runTime.deltaT();
|
||||
surfaceScalarField rhoPhiSum
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoPhiSum",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", rhoPhi.dimensions(), 0)
|
||||
);
|
||||
|
||||
for
|
||||
(
|
||||
subCycle<volScalarField> alphaSubCycle(alpha1, nAlphaSubCycles);
|
||||
!(++alphaSubCycle).end();
|
||||
)
|
||||
{
|
||||
#include "alphaEqns.H"
|
||||
rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi;
|
||||
}
|
||||
|
||||
rhoPhi = rhoPhiSum;
|
||||
}
|
||||
else
|
||||
{
|
||||
#include "alphaEqns.H"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
volScalarField::Internal Sp
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Sp",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("Sp", dgdt.dimensions(), 0)
|
||||
);
|
||||
|
||||
volScalarField::Internal Su
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Su",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("Su", dgdt.dimensions(), 0)
|
||||
);
|
||||
|
||||
forAll(dgdt, celli)
|
||||
{
|
||||
if (dgdt[celli] > 0.0 && alpha1[celli] > 0.0)
|
||||
{
|
||||
Sp[celli] -= dgdt[celli]*alpha1[celli];
|
||||
Su[celli] += dgdt[celli]*alpha1[celli];
|
||||
}
|
||||
else if (dgdt[celli] < 0.0 && alpha1[celli] < 1.0)
|
||||
{
|
||||
Sp[celli] += dgdt[celli]*(1.0 - alpha1[celli]);
|
||||
}
|
||||
}
|
||||
|
||||
volScalarField::Internal divU
|
||||
(
|
||||
mesh.moving()
|
||||
? fvc::div(phiCN() + mesh.phi())
|
||||
: fvc::div(phiCN())
|
||||
);
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
#include "alphaEqnSubCycle.H"
|
||||
}
|
||||
@ -1,5 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I. \
|
||||
-I.. \
|
||||
-I../../VoF \
|
||||
-I../twoPhaseMixtureThermo \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
@ -14,6 +16,7 @@ EXE_INC = \
|
||||
|
||||
EXE_LIBS = \
|
||||
-ltwoPhaseMixtureThermo \
|
||||
-ltwoPhaseSurfaceTension \
|
||||
-lcompressibleTransportModels \
|
||||
-lfluidThermophysicalModels \
|
||||
-lspecie \
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,9 +24,6 @@ License
|
||||
Application
|
||||
compressibleInterDyMFoam
|
||||
|
||||
Group
|
||||
grpMultiphaseSolvers grpMovingMeshSolvers
|
||||
|
||||
Description
|
||||
Solver for 2 compressible, non-isothermal immiscible fluids using a VOF
|
||||
(volume of fluid) phase-fraction based interface capturing approach,
|
||||
@ -42,14 +39,18 @@ Description
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "dynamicFvMesh.H"
|
||||
#include "MULES.H"
|
||||
#include "CMULES.H"
|
||||
#include "EulerDdtScheme.H"
|
||||
#include "localEulerDdtScheme.H"
|
||||
#include "CrankNicolsonDdtScheme.H"
|
||||
#include "subCycle.H"
|
||||
#include "interfaceProperties.H"
|
||||
#include "twoPhaseMixture.H"
|
||||
#include "twoPhaseMixtureThermo.H"
|
||||
#include "turbulentFluidThermoModel.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "fvOptions.H"
|
||||
#include "CorrectPhi.H"
|
||||
#include "fvcSmooth.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -63,6 +64,8 @@ int main(int argc, char *argv[])
|
||||
#include "initContinuityErrs.H"
|
||||
#include "createControl.H"
|
||||
#include "createFields.H"
|
||||
#include "createAlphaFluxes.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "createUf.H"
|
||||
#include "createControls.H"
|
||||
#include "CourantNo.H"
|
||||
@ -87,63 +90,66 @@ int main(int argc, char *argv[])
|
||||
// same divergence
|
||||
volScalarField divU("divU0", fvc::div(fvc::absolute(phi, U)));
|
||||
|
||||
if (LTS)
|
||||
{
|
||||
#include "setRDeltaT.H"
|
||||
}
|
||||
else
|
||||
{
|
||||
#include "CourantNo.H"
|
||||
#include "alphaCourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
// Do any mesh changes
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
Info<< "Execution time for mesh.update() = "
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
|
||||
gh = (g & mesh.C()) - ghRef;
|
||||
ghf = (g & mesh.Cf()) - ghRef;
|
||||
}
|
||||
|
||||
if ((correctPhi && mesh.changing()) || mesh.topoChanging())
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
// Note: temporary fix until mapped Uf is assessed
|
||||
Uf = fvc::interpolate(U);
|
||||
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
#include "correctPhi.H"
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
}
|
||||
}
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
runTime++;
|
||||
|
||||
turbulence->correct();
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
#include "alphaEqnsSubCycle.H"
|
||||
|
||||
// correct interface on first PIMPLE corrector
|
||||
if (pimple.corr() == 1)
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
interface.correct();
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
Info<< "Execution time for mesh.update() = "
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
|
||||
gh = (g & mesh.C()) - ghRef;
|
||||
ghf = (g & mesh.Cf()) - ghRef;
|
||||
}
|
||||
|
||||
if ((mesh.changing() && correctPhi) || mesh.topoChanging())
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
// Note: temporary fix until mapped Uf is assessed
|
||||
Uf = fvc::interpolate(U);
|
||||
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
#include "correctPhi.H"
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
mixture.correct();
|
||||
}
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
}
|
||||
|
||||
#include "alphaControls.H"
|
||||
#include "compressibleAlphaEqnSubCycle.H"
|
||||
|
||||
solve(fvm::ddt(rho) + fvc::div(rhoPhi));
|
||||
|
||||
#include "UEqn.H"
|
||||
@ -154,14 +160,13 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
if (pimple.turbCorr())
|
||||
{
|
||||
turbulence->correct();
|
||||
}
|
||||
}
|
||||
|
||||
rho = alpha1*rho1 + alpha2*rho2;
|
||||
|
||||
// Correct p_rgh for consistency with p and the updated densities
|
||||
p_rgh = p - rho*gh;
|
||||
p_rgh.correctBoundaryConditions();
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = "
|
||||
|
||||
@ -9,3 +9,8 @@ bool checkMeshCourantNo
|
||||
(
|
||||
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false)
|
||||
);
|
||||
|
||||
bool moveMeshOuterCorrectors
|
||||
(
|
||||
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false)
|
||||
);
|
||||
|
||||
@ -8,11 +8,12 @@
|
||||
fvc::flux(HbyA)
|
||||
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, Uf)
|
||||
);
|
||||
MRF.makeRelative(phiHbyA);
|
||||
|
||||
surfaceScalarField phig
|
||||
(
|
||||
(
|
||||
interface.surfaceTensionForce()
|
||||
mixture.surfaceTensionForce()
|
||||
- ghf*fvc::snGrad(rho)
|
||||
)*rAUf*mesh.magSf()
|
||||
);
|
||||
@ -20,7 +21,7 @@
|
||||
phiHbyA += phig;
|
||||
|
||||
// Update the pressure BCs to ensure flux consistency
|
||||
constrainPressure(p_rgh, U, phiHbyA, rAUf);
|
||||
constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF);
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phiHbyA, U);
|
||||
@ -92,6 +93,7 @@
|
||||
U = HbyA
|
||||
+ rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
|
||||
U.correctBoundaryConditions();
|
||||
fvOptions.correct(U);
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,7 +120,4 @@
|
||||
);
|
||||
|
||||
K = 0.5*magSqr(U);
|
||||
|
||||
Info<< "max(U) " << max(mag(U)).value() << endl;
|
||||
Info<< "min(p_rgh) " << min(p_rgh).value() << endl;
|
||||
}
|
||||
|
||||
@ -4,3 +4,6 @@ correctPhi = pimple.dict().lookupOrDefault<Switch>("correctPhi", true);
|
||||
|
||||
checkMeshCourantNo =
|
||||
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false);
|
||||
|
||||
moveMeshOuterCorrectors =
|
||||
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,14 +39,18 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "MULES.H"
|
||||
#include "CMULES.H"
|
||||
#include "EulerDdtScheme.H"
|
||||
#include "localEulerDdtScheme.H"
|
||||
#include "CrankNicolsonDdtScheme.H"
|
||||
#include "subCycle.H"
|
||||
#include "rhoThermo.H"
|
||||
#include "interfaceProperties.H"
|
||||
#include "twoPhaseMixture.H"
|
||||
#include "twoPhaseMixtureThermo.H"
|
||||
#include "turbulentFluidThermoModel.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "fvOptions.H"
|
||||
#include "fvcSmooth.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -60,8 +64,8 @@ int main(int argc, char *argv[])
|
||||
#include "createControl.H"
|
||||
#include "createTimeControls.H"
|
||||
#include "createFields.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
#include "createAlphaFluxes.H"
|
||||
#include "createFvOptions.H"
|
||||
|
||||
volScalarField& p = mixture.p();
|
||||
volScalarField& T = mixture.T();
|
||||
@ -70,6 +74,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
turbulence->validate();
|
||||
|
||||
if (!LTS)
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
@ -77,8 +88,17 @@ int main(int argc, char *argv[])
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
if (LTS)
|
||||
{
|
||||
#include "setRDeltaT.H"
|
||||
}
|
||||
else
|
||||
{
|
||||
#include "CourantNo.H"
|
||||
#include "alphaCourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
}
|
||||
|
||||
runTime++;
|
||||
|
||||
@ -87,18 +107,12 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
#include "alphaEqnsSubCycle.H"
|
||||
|
||||
// correct interface on first PIMPLE corrector
|
||||
if (pimple.corr() == 1)
|
||||
{
|
||||
interface.correct();
|
||||
}
|
||||
#include "alphaControls.H"
|
||||
#include "alphaEqnSubCycle.H"
|
||||
|
||||
solve(fvm::ddt(rho) + fvc::div(rhoPhi));
|
||||
|
||||
#include "UEqn.H"
|
||||
volScalarField divU(fvc::div(fvc::absolute(phi, U)));
|
||||
#include "TEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
#include "createRDeltaT.H"
|
||||
|
||||
Info<< "Reading field p_rgh\n" << endl;
|
||||
volScalarField p_rgh
|
||||
(
|
||||
@ -29,7 +31,7 @@ volVectorField U
|
||||
#include "createPhi.H"
|
||||
|
||||
Info<< "Constructing twoPhaseMixtureThermo\n" << endl;
|
||||
twoPhaseMixtureThermo mixture(mesh);
|
||||
twoPhaseMixtureThermo mixture(U, phi);
|
||||
|
||||
volScalarField& alpha1(mixture.alpha1());
|
||||
volScalarField& alpha2(mixture.alpha2());
|
||||
@ -61,6 +63,7 @@ dimensionedScalar pMin
|
||||
);
|
||||
|
||||
mesh.setFluxRequired(p_rgh.name());
|
||||
mesh.setFluxRequired(alpha1.name());
|
||||
|
||||
|
||||
#include "readGravitationalAcceleration.H"
|
||||
@ -89,9 +92,6 @@ volScalarField dgdt
|
||||
pos(alpha2)*fvc::div(phi)/max(alpha2, scalar(0.0001))
|
||||
);
|
||||
|
||||
// Construct interface from alpha1 distribution
|
||||
interfaceProperties interface(alpha1, U, mixture);
|
||||
|
||||
// Construct compressible turbulence model
|
||||
autoPtr<compressible::turbulenceModel> turbulence
|
||||
(
|
||||
@ -100,3 +100,5 @@ autoPtr<compressible::turbulenceModel> turbulence
|
||||
|
||||
Info<< "Creating field kinetic energy K\n" << endl;
|
||||
volScalarField K("K", 0.5*magSqr(U));
|
||||
|
||||
#include "createMRF.H"
|
||||
|
||||
@ -8,11 +8,12 @@
|
||||
fvc::flux(HbyA)
|
||||
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi)
|
||||
);
|
||||
MRF.makeRelative(phiHbyA);
|
||||
|
||||
surfaceScalarField phig
|
||||
(
|
||||
(
|
||||
interface.surfaceTensionForce()
|
||||
mixture.surfaceTensionForce()
|
||||
- ghf*fvc::snGrad(rho)
|
||||
)*rAUf*mesh.magSf()
|
||||
);
|
||||
@ -20,7 +21,7 @@
|
||||
phiHbyA += phig;
|
||||
|
||||
// Update the pressure BCs to ensure flux consistency
|
||||
constrainPressure(p_rgh, U, phiHbyA, rAUf);
|
||||
constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF);
|
||||
|
||||
tmp<fvScalarMatrix> p_rghEqnComp1;
|
||||
tmp<fvScalarMatrix> p_rghEqnComp2;
|
||||
@ -98,6 +99,7 @@
|
||||
U = HbyA
|
||||
+ rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
|
||||
U.correctBoundaryConditions();
|
||||
fvOptions.correct(U);
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,7 +114,4 @@
|
||||
p_rgh.correctBoundaryConditions();
|
||||
|
||||
K = 0.5*magSqr(U);
|
||||
|
||||
Info<< "max(U) " << max(mag(U)).value() << endl;
|
||||
Info<< "min(p_rgh) " << min(p_rgh).value() << endl;
|
||||
}
|
||||
|
||||
@ -0,0 +1,2 @@
|
||||
surfaceScalarField rho1f(fvc::interpolate(rho1));
|
||||
surfaceScalarField rho2f(fvc::interpolate(rho2));
|
||||
@ -0,0 +1,3 @@
|
||||
liquidProperties/liquidPropertiesSurfaceTension.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libtwoPhaseSurfaceTension
|
||||
@ -0,0 +1,15 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-linterfaceProperties \
|
||||
-lcompressibleTransportModels \
|
||||
-lfluidThermophysicalModels \
|
||||
-lspecie \
|
||||
-lthermophysicalProperties \
|
||||
-lfiniteVolume
|
||||
@ -0,0 +1,155 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 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 "liquidPropertiesSurfaceTension.H"
|
||||
#include "liquidThermo.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace surfaceTensionModels
|
||||
{
|
||||
defineTypeNameAndDebug(liquidProperties, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
surfaceTensionModel,
|
||||
liquidProperties,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::surfaceTensionModels::liquidProperties::liquidProperties
|
||||
(
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
surfaceTensionModel(mesh),
|
||||
phaseName_(dict.lookup("phase"))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::surfaceTensionModels::liquidProperties::~liquidProperties()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::surfaceTensionModels::liquidProperties::sigma() const
|
||||
{
|
||||
const heRhoThermopureMixtureliquidProperties& thermo =
|
||||
mesh_.lookupObject<heRhoThermopureMixtureliquidProperties>
|
||||
(
|
||||
IOobject::groupName(basicThermo::dictName, phaseName_)
|
||||
);
|
||||
|
||||
const Foam::liquidProperties& liquid = thermo.mixture().properties();
|
||||
|
||||
tmp<volScalarField> tsigma
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"sigma",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh_,
|
||||
dimSigma
|
||||
)
|
||||
);
|
||||
volScalarField& sigma = tsigma.ref();
|
||||
|
||||
const volScalarField& T = thermo.T();
|
||||
const volScalarField& p = thermo.p();
|
||||
|
||||
volScalarField::Internal& sigmai = sigma;
|
||||
const volScalarField::Internal& pi = p;
|
||||
const volScalarField::Internal& Ti = T;
|
||||
|
||||
forAll(sigmai, celli)
|
||||
{
|
||||
sigmai[celli] = liquid.sigma(pi[celli], Ti[celli]);
|
||||
}
|
||||
|
||||
volScalarField::Boundary& sigmaBf = sigma.boundaryFieldRef();
|
||||
const volScalarField::Boundary& pBf = p.boundaryField();
|
||||
const volScalarField::Boundary& TBf = T.boundaryField();
|
||||
|
||||
forAll(sigmaBf, patchi)
|
||||
{
|
||||
scalarField& sigmaPf = sigmaBf[patchi];
|
||||
const scalarField& pPf = pBf[patchi];
|
||||
const scalarField& TPf = TBf[patchi];
|
||||
|
||||
forAll(sigmaPf, facei)
|
||||
{
|
||||
sigmaPf[facei] = liquid.sigma(pPf[facei], TPf[facei]);
|
||||
}
|
||||
}
|
||||
|
||||
return tsigma;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::surfaceTensionModels::liquidProperties::readDict
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::surfaceTensionModels::liquidProperties::writeData
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
if (surfaceTensionModel::writeData(os))
|
||||
{
|
||||
return os.good();
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,123 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 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::surfaceTensionModels::liquidProperties
|
||||
|
||||
Description
|
||||
Temperature-dependent surface tension model in which the surface tension
|
||||
function provided by the phase Foam::liquidProperties class is used.
|
||||
|
||||
Usage
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
phase | Phase name | yes |
|
||||
\endtable
|
||||
|
||||
Example of the surface tension specification:
|
||||
\verbatim
|
||||
sigma
|
||||
{
|
||||
type liquidProperties;
|
||||
phase water;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
See also
|
||||
Foam::surfaceTensionModel
|
||||
|
||||
SourceFiles
|
||||
liquidPropertiesSurfaceTension.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef liquidPropertiesSurfaceTension_H
|
||||
#define liquidPropertiesSurfaceTension_H
|
||||
|
||||
#include "surfaceTensionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace surfaceTensionModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class liquidProperties Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class liquidProperties
|
||||
:
|
||||
public surfaceTensionModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of the liquid phase
|
||||
word phaseName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("liquidProperties");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary and mesh
|
||||
liquidProperties
|
||||
(
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~liquidProperties();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Surface tension coefficient
|
||||
virtual tmp<volScalarField> sigma() const;
|
||||
|
||||
//- Update surface tension coefficient from given dictionary
|
||||
virtual bool readDict(const dictionary& dict);
|
||||
|
||||
//- Write in dictionary format
|
||||
virtual bool writeData(Ostream& os) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace surfaceTensionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,6 +2,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
@ -9,4 +10,5 @@ LIB_LIBS = \
|
||||
-lfluidThermophysicalModels \
|
||||
-lspecie \
|
||||
-ltwoPhaseMixture \
|
||||
-linterfaceProperties \
|
||||
-lfiniteVolume
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -40,11 +40,13 @@ namespace Foam
|
||||
|
||||
Foam::twoPhaseMixtureThermo::twoPhaseMixtureThermo
|
||||
(
|
||||
const fvMesh& mesh
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi
|
||||
)
|
||||
:
|
||||
psiThermo(mesh, word::null),
|
||||
twoPhaseMixture(mesh, *this),
|
||||
psiThermo(U.mesh(), word::null),
|
||||
twoPhaseMixture(U.mesh(), *this),
|
||||
interfaceProperties(alpha1(), U, *this),
|
||||
thermo1_(nullptr),
|
||||
thermo2_(nullptr)
|
||||
{
|
||||
@ -58,8 +60,8 @@ Foam::twoPhaseMixtureThermo::twoPhaseMixtureThermo
|
||||
T2.write();
|
||||
}
|
||||
|
||||
thermo1_ = rhoThermo::New(mesh, phase1Name());
|
||||
thermo2_ = rhoThermo::New(mesh, phase2Name());
|
||||
thermo1_ = rhoThermo::New(U.mesh(), phase1Name());
|
||||
thermo2_ = rhoThermo::New(U.mesh(), phase2Name());
|
||||
|
||||
thermo1_->validate(phase1Name(), "e");
|
||||
thermo2_->validate(phase2Name(), "e");
|
||||
@ -76,17 +78,23 @@ Foam::twoPhaseMixtureThermo::~twoPhaseMixtureThermo()
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::twoPhaseMixtureThermo::correct()
|
||||
void Foam::twoPhaseMixtureThermo::correctThermo()
|
||||
{
|
||||
thermo1_->he() = thermo1_->he(p_, T_);
|
||||
thermo1_->correct();
|
||||
|
||||
thermo2_->he() = thermo2_->he(p_, T_);
|
||||
thermo2_->correct();
|
||||
}
|
||||
|
||||
|
||||
void Foam::twoPhaseMixtureThermo::correct()
|
||||
{
|
||||
psi_ = alpha1()*thermo1_->psi() + alpha2()*thermo2_->psi();
|
||||
mu_ = alpha1()*thermo1_->mu() + alpha2()*thermo2_->mu();
|
||||
alpha_ = alpha1()*thermo1_->alpha() + alpha2()*thermo2_->alpha();
|
||||
|
||||
interfaceProperties::correct();
|
||||
}
|
||||
|
||||
|
||||
@ -352,4 +360,17 @@ Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::alphaEff
|
||||
}
|
||||
|
||||
|
||||
bool Foam::twoPhaseMixtureThermo::read()
|
||||
{
|
||||
if (psiThermo::read())
|
||||
{
|
||||
return interfaceProperties::read();
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,6 +39,7 @@ SourceFiles
|
||||
#include "rhoThermo.H"
|
||||
#include "psiThermo.H"
|
||||
#include "twoPhaseMixture.H"
|
||||
#include "interfaceProperties.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -52,7 +53,8 @@ namespace Foam
|
||||
class twoPhaseMixtureThermo
|
||||
:
|
||||
public psiThermo,
|
||||
public twoPhaseMixture
|
||||
public twoPhaseMixture,
|
||||
public interfaceProperties
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -71,10 +73,11 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh
|
||||
//- Construct from components
|
||||
twoPhaseMixtureThermo
|
||||
(
|
||||
const fvMesh& mesh
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi
|
||||
);
|
||||
|
||||
|
||||
@ -104,7 +107,10 @@ public:
|
||||
return thermo2_();
|
||||
}
|
||||
|
||||
//- Update properties
|
||||
//- Correct the thermodynamics of each phase
|
||||
virtual void correctThermo();
|
||||
|
||||
//- Update mixture properties
|
||||
virtual void correct();
|
||||
|
||||
//- Return true if the equation of state is incompressible
|
||||
@ -279,6 +285,12 @@ public:
|
||||
const scalarField& alphat,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
|
||||
// IO
|
||||
|
||||
//- Read base transportProperties dictionary
|
||||
virtual bool read();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
EXE_INC = \
|
||||
-I. \
|
||||
-I../VoF \
|
||||
-I../interFoam \
|
||||
-ImultiphaseMixtureThermo/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||
|
||||
@ -44,7 +44,7 @@ Foam::autoPtr<Foam::mixtureViscosityModel> Foam::mixtureViscosityModel::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(modelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown mixtureViscosityModel type "
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -56,7 +56,7 @@ Foam::mixtureViscosityModels::plastic::plastic
|
||||
)
|
||||
:
|
||||
mixtureViscosityModel(name, viscosityProperties, U, phi),
|
||||
plasticCoeffs_(viscosityProperties.subDict(modelName + "Coeffs")),
|
||||
plasticCoeffs_(viscosityProperties.optionalSubDict(modelName + "Coeffs")),
|
||||
plasticViscosityCoeff_
|
||||
(
|
||||
"coeff",
|
||||
@ -117,7 +117,7 @@ bool Foam::mixtureViscosityModels::plastic::read
|
||||
{
|
||||
mixtureViscosityModel::read(viscosityProperties);
|
||||
|
||||
plasticCoeffs_ = viscosityProperties.subDict(typeName + "Coeffs");
|
||||
plasticCoeffs_ = viscosityProperties.optionalSubDict(typeName + "Coeffs");
|
||||
|
||||
plasticCoeffs_.lookup("k") >> plasticViscosityCoeff_;
|
||||
plasticCoeffs_.lookup("n") >> plasticViscosityExponent_;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -111,7 +111,7 @@ Foam::autoPtr<Foam::relativeVelocityModel> Foam::relativeVelocityModel::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(modelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown time scale model type " << modelType
|
||||
@ -126,7 +126,7 @@ Foam::autoPtr<Foam::relativeVelocityModel> Foam::relativeVelocityModel::New
|
||||
(
|
||||
cstrIter()
|
||||
(
|
||||
dict.subDict(modelType + "Coeffs"),
|
||||
dict.optionalSubDict(modelType + "Coeffs"),
|
||||
mixture
|
||||
)
|
||||
);
|
||||
|
||||
@ -63,7 +63,7 @@ Foam::temperaturePhaseChangeTwoPhaseMixture::New
|
||||
componentsConstructorTablePtr_
|
||||
->find(temperaturePhaseChangeTwoPhaseMixtureTypeName);
|
||||
|
||||
if (cstrIter == componentsConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown temperaturePhaseChangeTwoPhaseMixture type "
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
EXE_INC = \
|
||||
-I../VoF \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||
|
||||
3
applications/solvers/multiphase/interFoam/alphaSuSp.H
Normal file
3
applications/solvers/multiphase/interFoam/alphaSuSp.H
Normal file
@ -0,0 +1,3 @@
|
||||
zeroField Su;
|
||||
zeroField Sp;
|
||||
zeroField divU;
|
||||
@ -121,20 +121,6 @@ if (p_rgh.needReference())
|
||||
mesh.setFluxRequired(p_rgh.name());
|
||||
mesh.setFluxRequired(alpha1.name());
|
||||
|
||||
// MULES flux from previous time-step
|
||||
surfaceScalarField alphaPhi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"alphaPhi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
phi*fvc::interpolate(alpha1)
|
||||
);
|
||||
|
||||
// MULES compressed flux is registered in case scalarTransport FO needs it.
|
||||
surfaceScalarField alphaPhiUn
|
||||
(
|
||||
@ -150,7 +136,4 @@ surfaceScalarField alphaPhiUn
|
||||
dimensionedScalar("zero", phi.dimensions(), 0.0)
|
||||
);
|
||||
|
||||
// MULES Correction
|
||||
tmp<surfaceScalarField> talphaPhiCorr0;
|
||||
|
||||
#include "createMRF.H"
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I. \
|
||||
-I.. \
|
||||
-I../../VoF \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -47,7 +47,6 @@ Description
|
||||
#include "pimpleControl.H"
|
||||
#include "fvOptions.H"
|
||||
#include "CorrectPhi.H"
|
||||
#include "localEulerDdtScheme.H"
|
||||
#include "fvcSmooth.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -64,6 +63,7 @@ int main(int argc, char *argv[])
|
||||
#include "createTimeControls.H"
|
||||
#include "createDyMControls.H"
|
||||
#include "createFields.H"
|
||||
#include "createAlphaFluxes.H"
|
||||
#include "createFvOptions.H"
|
||||
|
||||
volScalarField rAU
|
||||
@ -128,6 +128,13 @@ int main(int argc, char *argv[])
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
|
||||
// Do not apply previous time-step mesh compression flux
|
||||
// if the mesh topology changed
|
||||
if (mesh.topoChanging())
|
||||
{
|
||||
talphaPhiCorr0.clear();
|
||||
}
|
||||
|
||||
gh = (g & mesh.C()) - ghRef;
|
||||
ghf = (g & mesh.Cf()) - ghRef;
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
phiHbyA += phig;
|
||||
|
||||
// Update the pressure BCs to ensure flux consistency
|
||||
constrainPressure(p_rgh, U, phiHbyA, rAUf);
|
||||
constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -51,7 +51,6 @@ Description
|
||||
#include "pimpleControl.H"
|
||||
#include "fvOptions.H"
|
||||
#include "CorrectPhi.H"
|
||||
#include "localEulerDdtScheme.H"
|
||||
#include "fvcSmooth.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -67,6 +66,7 @@ int main(int argc, char *argv[])
|
||||
#include "createTimeControls.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "createFields.H"
|
||||
#include "createAlphaFluxes.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "correctPhi.H"
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I. \
|
||||
-I.. \
|
||||
-I../../VoF \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
|
||||
-IimmiscibleIncompressibleThreePhaseMixture \
|
||||
-IincompressibleThreePhaseMixture \
|
||||
|
||||
@ -108,6 +108,11 @@
|
||||
);
|
||||
}
|
||||
|
||||
alphaPhi1 = alphaPhi1BD + lambda*alphaPhi1;
|
||||
|
||||
// Reset allLambda to 1.0
|
||||
allLambda = 1.0;
|
||||
|
||||
// Create the complete flux for alpha2
|
||||
surfaceScalarField alphaPhi2
|
||||
(
|
||||
@ -172,7 +177,6 @@
|
||||
}
|
||||
|
||||
// Construct the limited fluxes
|
||||
alphaPhi1 = alphaPhi1BD + lambda*alphaPhi1;
|
||||
alphaPhi2 = alphaPhi2BD + lambda*alphaPhi2;
|
||||
|
||||
// Solve for alpha1
|
||||
@ -19,7 +19,7 @@ if (nAlphaSubCycles > 1)
|
||||
!(++alphaSubCycle).end();
|
||||
)
|
||||
{
|
||||
#include "alphaEqns.H"
|
||||
#include "alphaEqn.H"
|
||||
rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi;
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ if (nAlphaSubCycles > 1)
|
||||
}
|
||||
else
|
||||
{
|
||||
#include "alphaEqns.H"
|
||||
#include "alphaEqn.H"
|
||||
}
|
||||
|
||||
{
|
||||
@ -40,7 +40,7 @@ const dimensionedScalar& rho1 = mixture.rho1();
|
||||
const dimensionedScalar& rho2 = mixture.rho2();
|
||||
const dimensionedScalar& rho3 = mixture.rho3();
|
||||
|
||||
dimensionedScalar D23(mixture.lookup("D23"));
|
||||
dimensionedScalar D23("D23", dimViscosity, mixture);
|
||||
|
||||
// Need to store rho for ddt(rho, U)
|
||||
volScalarField rho
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -96,7 +96,7 @@ int main(int argc, char *argv[])
|
||||
while (pimple.loop())
|
||||
{
|
||||
#include "alphaControls.H"
|
||||
#include "alphaEqnsSubCycle.H"
|
||||
#include "alphaEqnSubCycle.H"
|
||||
|
||||
mixture.correct();
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -168,8 +168,8 @@ Foam::threePhaseInterfaceProperties::threePhaseInterfaceProperties
|
||||
).lookup("cAlpha")
|
||||
)
|
||||
),
|
||||
sigma12_(mixture.lookup("sigma12")),
|
||||
sigma13_(mixture.lookup("sigma13")),
|
||||
sigma12_("sigma12", dimensionSet(1, 0, -2, 0, 0), mixture),
|
||||
sigma13_("sigma13", dimensionSet(1, 0, -2, 0, 0), mixture),
|
||||
|
||||
deltaN_
|
||||
(
|
||||
|
||||
2
applications/solvers/multiphase/interFoam/rhofs.H
Normal file
2
applications/solvers/multiphase/interFoam/rhofs.H
Normal file
@ -0,0 +1,2 @@
|
||||
const dimensionedScalar& rho1f(rho1);
|
||||
const dimensionedScalar& rho2f(rho2);
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -47,10 +47,10 @@ Foam::phaseChangeTwoPhaseMixtures::Kunz::Kunz
|
||||
:
|
||||
phaseChangeTwoPhaseMixture(typeName, U, phi),
|
||||
|
||||
UInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf")),
|
||||
tInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf")),
|
||||
Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")),
|
||||
Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")),
|
||||
UInf_("UInf", dimVelocity, phaseChangeTwoPhaseMixtureCoeffs_),
|
||||
tInf_("tInf", dimTime, phaseChangeTwoPhaseMixtureCoeffs_),
|
||||
Cc_("Cc", dimless, phaseChangeTwoPhaseMixtureCoeffs_),
|
||||
Cv_("Cv", dimless, phaseChangeTwoPhaseMixtureCoeffs_),
|
||||
|
||||
p0_("0", pSat().dimensions(), 0.0),
|
||||
|
||||
@ -102,7 +102,7 @@ bool Foam::phaseChangeTwoPhaseMixtures::Kunz::read()
|
||||
{
|
||||
if (phaseChangeTwoPhaseMixture::read())
|
||||
{
|
||||
phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
|
||||
phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs");
|
||||
|
||||
phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_;
|
||||
phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -47,10 +47,10 @@ Foam::phaseChangeTwoPhaseMixtures::Merkle::Merkle
|
||||
:
|
||||
phaseChangeTwoPhaseMixture(typeName, U, phi),
|
||||
|
||||
UInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf")),
|
||||
tInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf")),
|
||||
Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")),
|
||||
Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")),
|
||||
UInf_("UInf", dimVelocity, phaseChangeTwoPhaseMixtureCoeffs_),
|
||||
tInf_("tInf", dimTime, phaseChangeTwoPhaseMixtureCoeffs_),
|
||||
Cc_("Cc", dimless, phaseChangeTwoPhaseMixtureCoeffs_),
|
||||
Cv_("Cv", dimless, phaseChangeTwoPhaseMixtureCoeffs_),
|
||||
|
||||
p0_("0", pSat().dimensions(), 0.0),
|
||||
|
||||
@ -97,7 +97,7 @@ bool Foam::phaseChangeTwoPhaseMixtures::Merkle::read()
|
||||
{
|
||||
if (phaseChangeTwoPhaseMixture::read())
|
||||
{
|
||||
phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
|
||||
phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs");
|
||||
|
||||
phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_;
|
||||
phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -54,10 +54,10 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::SchnerrSauer
|
||||
:
|
||||
phaseChangeTwoPhaseMixture(typeName, U, phi),
|
||||
|
||||
n_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("n")),
|
||||
dNuc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc")),
|
||||
Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")),
|
||||
Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")),
|
||||
n_("n", dimless/dimVolume, phaseChangeTwoPhaseMixtureCoeffs_),
|
||||
dNuc_("dNuc", dimLength, phaseChangeTwoPhaseMixtureCoeffs_),
|
||||
Cc_("Cc", dimless, phaseChangeTwoPhaseMixtureCoeffs_),
|
||||
Cv_("Cv", dimless, phaseChangeTwoPhaseMixtureCoeffs_),
|
||||
|
||||
p0_("0", pSat().dimensions(), 0.0)
|
||||
{
|
||||
@ -151,7 +151,7 @@ bool Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::read()
|
||||
{
|
||||
if (phaseChangeTwoPhaseMixture::read())
|
||||
{
|
||||
phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
|
||||
phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs");
|
||||
|
||||
phaseChangeTwoPhaseMixtureCoeffs_.lookup("n") >> n_;
|
||||
phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc") >> dNuc_;
|
||||
|
||||
@ -60,7 +60,7 @@ Foam::phaseChangeTwoPhaseMixture::New
|
||||
componentsConstructorTablePtr_
|
||||
->find(phaseChangeTwoPhaseMixtureTypeName);
|
||||
|
||||
if (cstrIter == componentsConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown phaseChangeTwoPhaseMixture type "
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,7 +43,7 @@ Foam::phaseChangeTwoPhaseMixture::phaseChangeTwoPhaseMixture
|
||||
)
|
||||
:
|
||||
incompressibleTwoPhaseMixture(U, phi),
|
||||
phaseChangeTwoPhaseMixtureCoeffs_(subDict(type + "Coeffs")),
|
||||
phaseChangeTwoPhaseMixtureCoeffs_(optionalSubDict(type + "Coeffs")),
|
||||
pSat_("pSat", dimPressure, lookup("pSat"))
|
||||
{}
|
||||
|
||||
@ -77,7 +77,7 @@ bool Foam::phaseChangeTwoPhaseMixture::read()
|
||||
{
|
||||
if (incompressibleTwoPhaseMixture::read())
|
||||
{
|
||||
phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs");
|
||||
phaseChangeTwoPhaseMixtureCoeffs_ = optionalSubDict(type() + "Coeffs");
|
||||
lookup("pSat") >> pSat_;
|
||||
|
||||
return true;
|
||||
|
||||
@ -44,7 +44,7 @@ Foam::autoPtr<Foam::dragModel> Foam::dragModel::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(dragModelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown dragModelType type "
|
||||
|
||||
@ -48,7 +48,7 @@ Foam::autoPtr<Foam::heatTransferModel> Foam::heatTransferModel::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(heatTransferModelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown heatTransferModelType type "
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -46,7 +46,7 @@ Foam::autoPtr<Foam::diameterModel> Foam::diameterModel::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(diameterModelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown diameterModelType type "
|
||||
@ -56,7 +56,11 @@ Foam::autoPtr<Foam::diameterModel> Foam::diameterModel::New
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return cstrIter()(dict.subDict(diameterModelType + "Coeffs"), phase);
|
||||
return cstrIter()
|
||||
(
|
||||
dict.optionalSubDict(diameterModelType + "Coeffs"),
|
||||
phase
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -64,11 +64,8 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
|
||||
forAllIter(PtrDictionary<phaseModel>, phases_, iter)
|
||||
{
|
||||
phaseModel& phase1 = iter();
|
||||
volScalarField& alpha1 = phase1;
|
||||
|
||||
phase1.alphaPhi() =
|
||||
dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0);
|
||||
phaseModel& phase = iter();
|
||||
volScalarField& alpha1 = phase;
|
||||
|
||||
alphaPhiCorrs.set
|
||||
(
|
||||
@ -79,7 +76,7 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
fvc::flux
|
||||
(
|
||||
phi_,
|
||||
phase1,
|
||||
phase,
|
||||
"div(phi," + alpha1.name() + ')'
|
||||
)
|
||||
)
|
||||
@ -92,13 +89,13 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
phaseModel& phase2 = iter2();
|
||||
volScalarField& alpha2 = phase2;
|
||||
|
||||
if (&phase2 == &phase1) continue;
|
||||
if (&phase2 == &phase) continue;
|
||||
|
||||
surfaceScalarField phir(phase1.phi() - phase2.phi());
|
||||
surfaceScalarField phir(phase.phi() - phase2.phi());
|
||||
|
||||
scalarCoeffSymmTable::const_iterator cAlpha
|
||||
(
|
||||
cAlphas_.find(interfacePair(phase1, phase2))
|
||||
cAlphas_.find(interfacePair(phase, phase2))
|
||||
);
|
||||
|
||||
if (cAlpha != cAlphas_.end())
|
||||
@ -108,7 +105,7 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
(mag(phi_) + mag(phir))/mesh_.magSf()
|
||||
);
|
||||
|
||||
phir += min(cAlpha()*phic, max(phic))*nHatf(phase1, phase2);
|
||||
phir += min(cAlpha()*phic, max(phic))*nHatf(phase, phase2);
|
||||
}
|
||||
|
||||
word phirScheme
|
||||
@ -119,39 +116,18 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
alphaPhiCorr += fvc::flux
|
||||
(
|
||||
-fvc::flux(-phir, phase2, phirScheme),
|
||||
phase1,
|
||||
phase,
|
||||
phirScheme
|
||||
);
|
||||
}
|
||||
|
||||
surfaceScalarField::Boundary& alphaPhiCorrBf =
|
||||
alphaPhiCorr.boundaryFieldRef();
|
||||
|
||||
// Ensure that the flux at inflow BCs is preserved
|
||||
forAll(alphaPhiCorrBf, patchi)
|
||||
{
|
||||
fvsPatchScalarField& alphaPhiCorrp = alphaPhiCorrBf[patchi];
|
||||
|
||||
if (!alphaPhiCorrp.coupled())
|
||||
{
|
||||
const scalarField& phi1p = phase1.phi().boundaryField()[patchi];
|
||||
const scalarField& alpha1p = alpha1.boundaryField()[patchi];
|
||||
|
||||
forAll(alphaPhiCorrp, facei)
|
||||
{
|
||||
if (phi1p[facei] < 0)
|
||||
{
|
||||
alphaPhiCorrp[facei] = alpha1p[facei]*phi1p[facei];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
phase.correctInflowOutflow(alphaPhiCorr);
|
||||
|
||||
MULES::limit
|
||||
(
|
||||
1.0/mesh_.time().deltaT().value(),
|
||||
geometricOneField(),
|
||||
phase1,
|
||||
phase,
|
||||
phi_,
|
||||
alphaPhiCorr,
|
||||
zeroField(),
|
||||
@ -182,29 +158,30 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
|
||||
forAllIter(PtrDictionary<phaseModel>, phases_, iter)
|
||||
{
|
||||
phaseModel& phase1 = iter();
|
||||
phaseModel& phase = iter();
|
||||
|
||||
surfaceScalarField& alphaPhi = alphaPhiCorrs[phasei];
|
||||
alphaPhi += upwind<scalar>(mesh_, phi_).flux(phase1);
|
||||
alphaPhi += upwind<scalar>(mesh_, phi_).flux(phase);
|
||||
phase.correctInflowOutflow(alphaPhi);
|
||||
|
||||
MULES::explicitSolve
|
||||
(
|
||||
geometricOneField(),
|
||||
phase1,
|
||||
phase,
|
||||
alphaPhi,
|
||||
zeroField(),
|
||||
zeroField()
|
||||
);
|
||||
|
||||
phase1.alphaPhi() += alphaPhi;
|
||||
phase.alphaPhi() = alphaPhi;
|
||||
|
||||
Info<< phase1.name() << " volume fraction, min, max = "
|
||||
<< phase1.weightedAverage(mesh_.V()).value()
|
||||
<< ' ' << min(phase1).value()
|
||||
<< ' ' << max(phase1).value()
|
||||
Info<< phase.name() << " volume fraction, min, max = "
|
||||
<< phase.weightedAverage(mesh_.V()).value()
|
||||
<< ' ' << min(phase).value()
|
||||
<< ' ' << max(phase).value()
|
||||
<< endl;
|
||||
|
||||
sumAlpha += phase1;
|
||||
sumAlpha += phase;
|
||||
|
||||
phasei++;
|
||||
}
|
||||
@ -215,6 +192,15 @@ void Foam::multiphaseSystem::solveAlphas()
|
||||
<< ' ' << max(sumAlpha).value()
|
||||
<< endl;
|
||||
|
||||
// Correct the sum of the phase-fractions to avoid 'drift'
|
||||
volScalarField sumCorr(1.0 - sumAlpha);
|
||||
forAllIter(PtrDictionary<phaseModel>, phases_, iter)
|
||||
{
|
||||
phaseModel& phase = iter();
|
||||
volScalarField& alpha = phase;
|
||||
alpha += alpha*sumCorr;
|
||||
}
|
||||
|
||||
calcAlphas();
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -238,6 +238,24 @@ bool Foam::phaseModel::read(const dictionary& phaseDict)
|
||||
}
|
||||
|
||||
|
||||
void Foam::phaseModel::correctInflowOutflow(surfaceScalarField& alphaPhi) const
|
||||
{
|
||||
surfaceScalarField::Boundary& alphaPhiBf = alphaPhi.boundaryFieldRef();
|
||||
const volScalarField::Boundary& alphaBf = boundaryField();
|
||||
const surfaceScalarField::Boundary& phiBf = phi().boundaryField();
|
||||
|
||||
forAll(alphaPhiBf, patchi)
|
||||
{
|
||||
fvsPatchScalarField& alphaPhip = alphaPhiBf[patchi];
|
||||
|
||||
if (!alphaPhip.coupled())
|
||||
{
|
||||
alphaPhip = phiBf[patchi]*alphaBf[patchi];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseModel::d() const
|
||||
{
|
||||
return dPtr_().d();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -208,6 +208,9 @@ public:
|
||||
return alphaPhi_;
|
||||
}
|
||||
|
||||
//- Ensure that the flux at inflow/outflow BCs is preserved
|
||||
void correctInflowOutflow(surfaceScalarField& alphaPhi) const;
|
||||
|
||||
//- Correct the phase properties
|
||||
void correct();
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
EXE_INC = \
|
||||
-I. \
|
||||
-I../VoF \
|
||||
-I../interFoam \
|
||||
-ImultiphaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
EXE_INC = \
|
||||
-I.. \
|
||||
-I../../VoF \
|
||||
-I../../interFoam/interDyMFoam \
|
||||
-I../../interFoam \
|
||||
-I../multiphaseMixture/lnInclude \
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -684,6 +684,14 @@ void Foam::multiphaseMixture::solveAlphas
|
||||
<< ' ' << max(sumAlpha).value()
|
||||
<< endl;
|
||||
|
||||
// Correct the sum of the phase-fractions to avoid 'drift'
|
||||
volScalarField sumCorr(1.0 - sumAlpha);
|
||||
forAllIter(PtrDictionary<phase>, phases_, iter)
|
||||
{
|
||||
phase& alpha = iter();
|
||||
alpha += alpha*sumCorr;
|
||||
}
|
||||
|
||||
calcAlphas();
|
||||
}
|
||||
|
||||
|
||||
@ -2,10 +2,7 @@ EXE_INC = \
|
||||
-I../phaseSystems/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -86,9 +86,7 @@ Foam::interfaceCompositionModels::Saturated<Thermo, OtherThermo>::update
|
||||
(
|
||||
const volScalarField& Tf
|
||||
)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
|
||||
@ -52,7 +52,7 @@ Foam::interfaceCompositionModel::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(interfaceCompositionModelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown interfaceCompositionModelType type "
|
||||
|
||||
@ -42,7 +42,7 @@ Foam::autoPtr<Foam::massTransferModel> Foam::massTransferModel::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(massTransferModelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown massTransferModelType type "
|
||||
|
||||
@ -40,7 +40,7 @@ Foam::autoPtr<Foam::saturationModel> Foam::saturationModel::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(saturationModelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown saturationModelType type "
|
||||
|
||||
@ -43,7 +43,7 @@ Foam::surfaceTensionModel::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(surfaceTensionModelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown surfaceTensionModelType type "
|
||||
|
||||
@ -43,7 +43,7 @@ Foam::aspectRatioModel::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(aspectRatioModelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown aspectRatioModelType type "
|
||||
|
||||
@ -42,7 +42,7 @@ Foam::autoPtr<Foam::dragModel> Foam::dragModel::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(dragModelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown dragModelType type "
|
||||
|
||||
@ -42,7 +42,7 @@ Foam::autoPtr<Foam::heatTransferModel> Foam::heatTransferModel::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(heatTransferModelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown heatTransferModelType type "
|
||||
|
||||
@ -42,7 +42,7 @@ Foam::autoPtr<Foam::liftModel> Foam::liftModel::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(liftModelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown liftModelType type "
|
||||
|
||||
@ -43,7 +43,7 @@ Foam::swarmCorrection::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(swarmCorrectionType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown swarmCorrectionType type "
|
||||
|
||||
@ -43,7 +43,7 @@ Foam::turbulentDispersionModel::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(turbulentDispersionModelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown turbulentDispersionModelType type "
|
||||
|
||||
@ -42,7 +42,7 @@ Foam::autoPtr<Foam::virtualMassModel> Foam::virtualMassModel::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(virtualMassModelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown virtualMassModelType type "
|
||||
|
||||
@ -42,7 +42,7 @@ Foam::autoPtr<Foam::wallDampingModel> Foam::wallDampingModel::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(wallDampingModelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown wallDampingModelType type "
|
||||
|
||||
@ -42,7 +42,7 @@ Foam::autoPtr<Foam::wallLubricationModel> Foam::wallLubricationModel::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(wallLubricationModelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown wallLubricationModelType type "
|
||||
|
||||
@ -41,7 +41,7 @@ Foam::autoPtr<Foam::blendingMethod> Foam::blendingMethod::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(blendingMethodType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown blendingMethodType type "
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -375,6 +375,18 @@ void Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctThermo()
|
||||
volScalarField hef1(phase1.thermo().he(phase1.thermo().p(), Tf));
|
||||
volScalarField hef2(phase2.thermo().he(phase2.thermo().p(), Tf));
|
||||
|
||||
volScalarField L
|
||||
(
|
||||
min
|
||||
(
|
||||
(pos(iDmdt)*he2 + neg(iDmdt)*hef2)
|
||||
- (neg(iDmdt)*he1 + pos(iDmdt)*hef1),
|
||||
0.3*mag(hef2 - hef1)
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField iDmdtNew(iDmdt);
|
||||
|
||||
if (massTransfer_ )
|
||||
{
|
||||
volScalarField H1
|
||||
@ -389,28 +401,13 @@ void Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctThermo()
|
||||
|
||||
Tf = saturationModel_->Tsat(phase1.thermo().p());
|
||||
|
||||
scalar iDmdtRelax(this->mesh().fieldRelaxationFactor("iDmdt"));
|
||||
iDmdtNew =
|
||||
(H1*(Tf - T1) + H2*(Tf - T2))/L;
|
||||
|
||||
iDmdt =
|
||||
(1 - iDmdtRelax)*iDmdt
|
||||
+ iDmdtRelax*(H1*(Tf - T1) + H2*(Tf - T2))
|
||||
/min
|
||||
(
|
||||
(pos(iDmdt)*he2 + neg(iDmdt)*hef2)
|
||||
- (neg(iDmdt)*he1 + pos(iDmdt)*hef1),
|
||||
0.3*mag(hef2 - hef1)
|
||||
);
|
||||
|
||||
Info<< "iDmdt." << pair.name()
|
||||
<< ": min = " << min(iDmdt.primitiveField())
|
||||
<< ", mean = " << average(iDmdt.primitiveField())
|
||||
<< ", max = " << max(iDmdt.primitiveField())
|
||||
<< ", integral = " << fvc::domainIntegrate(iDmdt).value()
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
iDmdt == dimensionedScalar("0", dmdt.dimensions(), 0);
|
||||
iDmdtNew == dimensionedScalar("0",dmdt.dimensions(), 0);
|
||||
}
|
||||
|
||||
volScalarField H1(this->heatTransferModels_[pair][pair.first()]->K());
|
||||
@ -423,16 +420,7 @@ void Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctThermo()
|
||||
H2.boundaryFieldRef() =
|
||||
max(H2.boundaryField(), phase2.boundaryField()*HLimit);
|
||||
|
||||
volScalarField mDotL
|
||||
(
|
||||
iDmdt*
|
||||
(
|
||||
(pos(iDmdt)*he2 + neg(iDmdt)*hef2)
|
||||
- (neg(iDmdt)*he1 + pos(iDmdt)*hef1)
|
||||
)
|
||||
);
|
||||
|
||||
Tf = (H1*T1 + H2*T2 + mDotL)/(H1 + H2);
|
||||
Tf = (H1*T1 + H2*T2 + iDmdtNew*L)/(H1 + H2);
|
||||
|
||||
Info<< "Tf." << pair.name()
|
||||
<< ": min = " << min(Tf.primitiveField())
|
||||
@ -440,6 +428,19 @@ void Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctThermo()
|
||||
<< ", max = " << max(Tf.primitiveField())
|
||||
<< endl;
|
||||
|
||||
scalar iDmdtRelax(this->mesh().fieldRelaxationFactor("iDmdt"));
|
||||
iDmdt = (1 - iDmdtRelax)*iDmdt + iDmdtRelax*iDmdtNew;
|
||||
|
||||
if (massTransfer_ )
|
||||
{
|
||||
Info<< "iDmdt." << pair.name()
|
||||
<< ": min = " << min(iDmdt.primitiveField())
|
||||
<< ", mean = " << average(iDmdt.primitiveField())
|
||||
<< ", max = " << max(iDmdt.primitiveField())
|
||||
<< ", integral = " << fvc::domainIntegrate(iDmdt).value()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Accumulate dmdt contributions from boundaries
|
||||
volScalarField wDmdt
|
||||
(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -61,7 +61,7 @@ void Foam::diameterModel::correct()
|
||||
|
||||
bool Foam::diameterModel::read(const dictionary& phaseProperties)
|
||||
{
|
||||
diameterProperties_ = phaseProperties.subDict(type() + "Coeffs");
|
||||
diameterProperties_ = phaseProperties.optionalSubDict(type() + "Coeffs");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -46,7 +46,7 @@ Foam::autoPtr<Foam::diameterModel> Foam::diameterModel::New
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(diameterModelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown diameterModelType type "
|
||||
@ -56,7 +56,11 @@ Foam::autoPtr<Foam::diameterModel> Foam::diameterModel::New
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return cstrIter()(dict.subDict(diameterModelType + "Coeffs"), phase);
|
||||
return cstrIter()
|
||||
(
|
||||
dict.optionalSubDict(diameterModelType + "Coeffs"),
|
||||
phase
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ Foam::AnisothermalPhaseModel<BasePhaseModel>::heEqn()
|
||||
he
|
||||
)
|
||||
==
|
||||
this->Sh()
|
||||
this->Qdot()
|
||||
);
|
||||
|
||||
// Add the appropriate pressure-work term
|
||||
|
||||
@ -65,7 +65,7 @@ Foam::InertPhaseModel<BasePhaseModel>::R
|
||||
|
||||
template<class BasePhaseModel>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::InertPhaseModel<BasePhaseModel>::Sh() const
|
||||
Foam::InertPhaseModel<BasePhaseModel>::Qdot() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
@ -73,7 +73,7 @@ Foam::InertPhaseModel<BasePhaseModel>::Sh() const
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("Sh", this->name()),
|
||||
IOobject::groupName("Qdot", this->name()),
|
||||
this->mesh().time().timeName(),
|
||||
this->mesh()
|
||||
),
|
||||
|
||||
@ -78,8 +78,8 @@ public:
|
||||
volScalarField& Yi
|
||||
) const;
|
||||
|
||||
//- Return the reaction heat source
|
||||
virtual tmp<volScalarField> Sh() const;
|
||||
//- Return the heat release rate
|
||||
virtual tmp<volScalarField> Qdot() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -105,9 +105,9 @@ Foam::ReactingPhaseModel<BasePhaseModel, ReactionType>::R
|
||||
|
||||
template<class BasePhaseModel, class ReactionType>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::ReactingPhaseModel<BasePhaseModel, ReactionType>::Sh() const
|
||||
Foam::ReactingPhaseModel<BasePhaseModel, ReactionType>::Qdot() const
|
||||
{
|
||||
return reaction_->Sh();
|
||||
return reaction_->Qdot();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -87,8 +87,8 @@ public:
|
||||
volScalarField& Yi
|
||||
) const;
|
||||
|
||||
//- Return the reacton heat source
|
||||
virtual tmp<volScalarField> Sh() const;
|
||||
//- Return heat release rate
|
||||
virtual tmp<volScalarField> Qdot() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::New
|
||||
phaseSystemConstructorTable::iterator cstrIter =
|
||||
phaseSystemConstructorTablePtr_->find(phaseModelType);
|
||||
|
||||
if (cstrIter == phaseSystemConstructorTablePtr_->end())
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown phaseModelType type "
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -165,6 +165,24 @@ bool Foam::phaseModel::compressible() const
|
||||
}
|
||||
|
||||
|
||||
void Foam::phaseModel::correctInflowOutflow(surfaceScalarField& alphaPhi) const
|
||||
{
|
||||
surfaceScalarField::Boundary& alphaPhiBf = alphaPhi.boundaryFieldRef();
|
||||
const volScalarField::Boundary& alphaBf = boundaryField();
|
||||
const surfaceScalarField::Boundary& phiBf = phi()().boundaryField();
|
||||
|
||||
forAll(alphaPhiBf, patchi)
|
||||
{
|
||||
fvsPatchScalarField& alphaPhip = alphaPhiBf[patchi];
|
||||
|
||||
if (!alphaPhip.coupled())
|
||||
{
|
||||
alphaPhip = phiBf[patchi]*alphaBf[patchi];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const Foam::tmp<Foam::volScalarField>& Foam::phaseModel::divU() const
|
||||
{
|
||||
NotImplemented;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -283,6 +283,9 @@ public:
|
||||
//- Access the mass flux of the phase
|
||||
virtual surfaceScalarField& alphaRhoPhi() = 0;
|
||||
|
||||
//- Ensure that the flux at inflow/outflow BCs is preserved
|
||||
void correctInflowOutflow(surfaceScalarField& alphaPhi) const;
|
||||
|
||||
|
||||
// Transport
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -76,9 +76,7 @@ void Foam::phaseSystem::generatePairs
|
||||
|
||||
// pair already exists
|
||||
if (phasePairs_.found(key))
|
||||
{
|
||||
// do nothing ...
|
||||
}
|
||||
{}
|
||||
|
||||
// new ordered pair
|
||||
else if (key.ordered())
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -131,6 +131,22 @@ void Foam::phaseSystem::generatePairsAndSubModels
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (!phasePairs_.found(key))
|
||||
{
|
||||
phasePairs_.insert
|
||||
(
|
||||
key,
|
||||
autoPtr<phasePair>
|
||||
(
|
||||
new phasePair
|
||||
(
|
||||
phaseModels_[key.first()],
|
||||
phaseModels_[key.second()]
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -253,6 +253,14 @@ makeReactionMixtureThermo
|
||||
constRefRhoConstHThermoPhysics
|
||||
);
|
||||
|
||||
makeReactionMixtureThermo
|
||||
(
|
||||
rhoThermo,
|
||||
rhoReactionThermo,
|
||||
heRhoThermo,
|
||||
multiComponentMixture,
|
||||
constRefFluidHThermoPhysics
|
||||
);
|
||||
|
||||
makeReactionMixtureThermo
|
||||
(
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user