mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Up to date icoReactingMultiphaseInterFoam solver and libs
Adding tutorials and other minor changes
This commit is contained in:
@ -1,9 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
set -x
|
||||
|
||||
wclean libso phasesSystem
|
||||
wclean libso meltingEvaporationModel
|
||||
wclean libso massTransferModels
|
||||
wclean libso CompressibleMultiPhaseTurbulenceModels
|
||||
wclean libso laserDTRM
|
||||
wclean
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
set -x
|
||||
|
||||
wmakeLnInclude meltingEvaporationModel
|
||||
wmake libso phasesSystem
|
||||
wmake libso meltingEvaporationModel
|
||||
wmake libso CompressibleMultiPhaseTurbulenceModels
|
||||
wmake libso laserDTRM
|
||||
targetType=libso
|
||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||
|
||||
wmakeLnInclude massTransferModels
|
||||
wmake phasesSystem
|
||||
wmake massTransferModels
|
||||
wmake CompressibleMultiPhaseTurbulenceModels
|
||||
wmake laserDTRM
|
||||
wmake
|
||||
|
||||
|
||||
|
||||
@ -28,7 +28,8 @@ EXE_LIBS = \
|
||||
-lfluidThermophysicalModels \
|
||||
-lIncompressibleMultiphaseSystems \
|
||||
-lCompressibleMultiPhaseTurbulenceModels \
|
||||
-lmeltingEvaporationModels \
|
||||
-lmassTransferModels \
|
||||
-lsolidThermo \
|
||||
-lsolidSpecie \
|
||||
-ltwoPhaseProperties
|
||||
-ltwoPhaseProperties \
|
||||
-llaserDTRM
|
||||
|
||||
@ -1,100 +1,35 @@
|
||||
{
|
||||
radiation->correct();
|
||||
rhoCp = rho*fluid.Cp();
|
||||
|
||||
tmp<volScalarField> texpSource
|
||||
const surfaceScalarField rhoCpPhi(fvc::interpolate(fluid.Cp())*rhoPhi);
|
||||
|
||||
const volScalarField kappaEff
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"texpSource",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("zero", dimTemperature/dimTime, 0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
)
|
||||
"kappaEff",
|
||||
fluid.kappa() + fluid.Cp()*turbulence->mut()/fluid.Prt()
|
||||
);
|
||||
volScalarField& expSource = texpSource.ref();
|
||||
|
||||
tmp<volScalarField> tkappaEff
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"kappaEff",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("zero", sqr(dimLength)/dimTime, 0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& kappaEff = tkappaEff.ref();
|
||||
|
||||
//const surfaceScalarField rhoTempPhi("phi", rhoPhi/fvc::interpolate(rho));
|
||||
|
||||
const surfaceScalarField rhoTempPhi("phi", fluid.phi());
|
||||
|
||||
const volScalarField divU(fvc::div(phi));
|
||||
|
||||
forAllIter(UPtrList<phaseModel>, fluid.phases(), iter)
|
||||
{
|
||||
phaseModel& phase = iter();
|
||||
const volScalarField& alpha = phase;
|
||||
const volScalarField DDtAlpha(fvc::DDt(phi, alpha));
|
||||
|
||||
const volScalarField invCpRho(1.0/phase.rho()/phase.Cp());
|
||||
|
||||
if (fluid.dpdt())
|
||||
{
|
||||
const volScalarField ddtp(fvc::ddt(p));
|
||||
expSource += (DDtAlpha*p + alpha*(p*divU + ddtp))*invCpRho;
|
||||
}
|
||||
else
|
||||
{
|
||||
expSource += (DDtAlpha*p + alpha*(p*divU))*invCpRho;
|
||||
}
|
||||
|
||||
kappaEff += alpha*phase.kappa()*invCpRho;
|
||||
|
||||
DebugVar(max(alpha*phase.kappa()));
|
||||
DebugVar(max(alpha*phase.Cp()));
|
||||
}
|
||||
|
||||
kappaEff += turbulence->nut()/fluid.Prt();
|
||||
|
||||
if (mesh.time().outputTime())
|
||||
{
|
||||
expSource.write();
|
||||
kappaEff.write();
|
||||
}
|
||||
|
||||
//dimensionedScalar S("S", dimEnergy/dimVolume/dimTime, 1.225e8);
|
||||
|
||||
fvScalarMatrix TEqn
|
||||
(
|
||||
fvm::ddt(T)
|
||||
+ fvm::div(rhoTempPhi, T)
|
||||
fvm::ddt(rhoCp, T)
|
||||
+ fvm::div(rhoCpPhi, T, "div(phi,T)")
|
||||
- fvm::Sp(fvc::ddt(rhoCp) + fvc::div(rhoCpPhi), T)
|
||||
- fvm::laplacian(kappaEff, T, "laplacian(kappa,T)")
|
||||
==
|
||||
fluid.heatTransfer(T)
|
||||
+ expSource
|
||||
+ radiation->ST(fluid.Cp()*rho, T)
|
||||
// + S/Cp/rho
|
||||
+ radiation->ST(T)
|
||||
+ fvOptions(rhoCp, T)
|
||||
);
|
||||
|
||||
TEqn.relax();
|
||||
|
||||
fvOptions.constrain(TEqn);
|
||||
|
||||
TEqn.solve();
|
||||
|
||||
fvOptions.correct(T);
|
||||
|
||||
fluid.correct();
|
||||
|
||||
Info<< "min/max(T) = "
|
||||
|
||||
@ -1,34 +1,33 @@
|
||||
fvVectorMatrix UEqn
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(rho, U)
|
||||
+ fvm::div(rhoPhi, U)
|
||||
//- fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), U)
|
||||
+ turbulence->divDevRhoReff(U)
|
||||
==
|
||||
fvOptions(rho, U)
|
||||
);
|
||||
|
||||
UEqn.relax();
|
||||
|
||||
fluid.addInterfacePorosity(UEqn);
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve
|
||||
(
|
||||
fvm::ddt(rho, U)
|
||||
+ fvm::div(rhoPhi, U)
|
||||
+ turbulence->divDevRhoReff(U)
|
||||
UEqn
|
||||
==
|
||||
fvOptions(rho, U)
|
||||
fvc::reconstruct
|
||||
(
|
||||
(
|
||||
fluid.surfaceTensionForce()
|
||||
- ghf*fvc::snGrad(rho)
|
||||
- fvc::snGrad(p_rgh)
|
||||
) * mesh.magSf()
|
||||
)
|
||||
);
|
||||
|
||||
UEqn.relax();
|
||||
|
||||
fluid.addInterfacePorosity(UEqn);
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
|
||||
|
||||
solve
|
||||
(
|
||||
UEqn
|
||||
==
|
||||
fvc::reconstruct
|
||||
(
|
||||
(
|
||||
fluid.surfaceTensionForce()
|
||||
- ghf*fvc::snGrad(rho)
|
||||
- fvc::snGrad(p_rgh)
|
||||
) * mesh.magSf()
|
||||
)
|
||||
);
|
||||
|
||||
fvOptions.correct(U);
|
||||
K = 0.5*magSqr(U);
|
||||
}
|
||||
fvOptions.correct(U);
|
||||
K = 0.5*magSqr(U);
|
||||
}
|
||||
|
||||
@ -1,75 +1,57 @@
|
||||
{
|
||||
// Semi-implicit mass transfer for species
|
||||
// Initilize dmdt for alpha Eq's for mass transfers driven by species
|
||||
autoPtr<phaseSystem::massTransferTable>
|
||||
massTransferPtr(fluid.massTransfer(T));
|
||||
|
||||
//phaseSystem::massTransferTable& massTransfer(massTransferPtr());
|
||||
|
||||
forAllIter(UPtrList<phaseModel>, fluid.phases(), iter)
|
||||
{
|
||||
phaseModel& phase = iter();
|
||||
PtrList<volScalarField>& Y = phase.Y();
|
||||
//const surfaceScalarField& alphaPhi = phase.alphaPhi();
|
||||
|
||||
if (!Y.empty())
|
||||
{
|
||||
const volScalarField& alpha = phase;
|
||||
//- Su phase source terms
|
||||
PtrList<volScalarField::Internal> Sus(Y.size());
|
||||
//- Sp phase source terms
|
||||
PtrList<volScalarField::Internal> Sps(Y.size());
|
||||
|
||||
label inertIndex = -1;
|
||||
volScalarField Yt(0.0*Y[0]);
|
||||
forAll(Sus, i)
|
||||
{
|
||||
Sus.set
|
||||
(
|
||||
i,
|
||||
new volScalarField::Internal
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Su" + phase.name(),
|
||||
mesh.time().timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("zero", dimless/dimTime, 0.0)
|
||||
)
|
||||
);
|
||||
Sps.set
|
||||
(
|
||||
i,
|
||||
new volScalarField::Internal
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Sp" + phase.name(),
|
||||
mesh.time().timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("zero", dimless/dimTime, 0.0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
forAll(Y, i)
|
||||
{
|
||||
tmp<fvScalarMatrix> YiEqn(phase.YiEqn(Y[i]));
|
||||
|
||||
if (YiEqn.valid())
|
||||
{
|
||||
YiEqn.ref() =
|
||||
(
|
||||
YiEqn()
|
||||
- fvm::laplacian
|
||||
(
|
||||
alpha*turbulence->nuEff(),
|
||||
Y[i]
|
||||
)
|
||||
==
|
||||
// (*massTransfer[Y[i].name()])(/phase.rho()
|
||||
fvc::ddt(alpha)
|
||||
*pos
|
||||
(
|
||||
fluid.dmdtYi(Y[i].name())
|
||||
- dimensionedScalar("zero", dimDensity/dimTime, 1e-3)
|
||||
)
|
||||
//fluid.dmdtYi(Y[i].name())/phase.rho()
|
||||
//explicit mass sources (P or T)
|
||||
);
|
||||
|
||||
YiEqn->relax();
|
||||
YiEqn->solve(mesh.solver("Yi"));
|
||||
Y[i].max(0.0);
|
||||
Y[i].min(1.0);
|
||||
Yt += Y[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
inertIndex = i;
|
||||
}
|
||||
|
||||
// if (mesh.time().outputTime())
|
||||
// {
|
||||
// volScalarField dmdtYi("dmdtYi", pos(fluid.dmdtYi(Y[i].name())));
|
||||
// dmdtYi.write();
|
||||
// }
|
||||
|
||||
Info << "Min/Max : " << min(Y[i]) << " " << max(Y[i]) << endl;
|
||||
Info<< "Max dmdtYi : "
|
||||
<< max(fluid.dmdtYi(Y[i].name())().internalField()) << endl;
|
||||
Info<< "Min dmdtYi : "
|
||||
<< min(fluid.dmdtYi(Y[i].name())().internalField()) << endl;
|
||||
// Calculate mass exchange for species consistent with
|
||||
// alpha's source terms.
|
||||
fluid.massSpeciesTransfer(phase, Sus[i], Sps[i], Y[i].name());
|
||||
}
|
||||
Y[inertIndex] = scalar(1) - Yt;
|
||||
Y[inertIndex].max(0.0);
|
||||
phase.solveYi(Sus, Sps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,8 +34,20 @@ scalar maxAlphaCo
|
||||
readScalar(runTime.controlDict().lookup("maxAlphaCo"))
|
||||
);
|
||||
|
||||
scalar maxAlphaDdt
|
||||
(
|
||||
runTime.controlDict().lookupOrDefault("maxAlphaDdt", GREAT)
|
||||
);
|
||||
|
||||
scalar maxDi
|
||||
(
|
||||
runTime.controlDict().lookupOrDefault<scalar>("maxDi", GREAT)
|
||||
);
|
||||
|
||||
scalar alphaCoNum = 0.0;
|
||||
scalar meanAlphaCoNum = 0.0;
|
||||
scalar ddtAlphaNum = 0.0;
|
||||
scalar DiNum = 0.0;
|
||||
|
||||
if (mesh.nInternalFaces())
|
||||
{
|
||||
@ -49,9 +61,17 @@ if (mesh.nInternalFaces())
|
||||
|
||||
meanAlphaCoNum =
|
||||
0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
|
||||
|
||||
ddtAlphaNum = fluid.ddtAlphaMax().value()*runTime.deltaTValue();
|
||||
|
||||
DiNum = fluid.maxDiffNo();
|
||||
}
|
||||
|
||||
Info<< "Interface Courant Number mean: " << meanAlphaCoNum
|
||||
<< " max: " << alphaCoNum << endl;
|
||||
|
||||
Info<< "Maximum ddtAlpha : " << ddtAlphaNum << endl;
|
||||
|
||||
Info<< "Maximum DiffNum : " << DiNum << endl;
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -28,8 +28,9 @@
|
||||
|
||||
|
||||
Info<< "Calculating field g.h\n" << endl;
|
||||
volScalarField gh("gh", g & mesh.C());
|
||||
surfaceScalarField ghf("ghf", g & mesh.Cf());
|
||||
#include "readGravitationalAcceleration.H"
|
||||
#include "readhRef.H"
|
||||
#include "gh.H"
|
||||
|
||||
volScalarField p
|
||||
(
|
||||
@ -41,7 +42,7 @@
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
p_rgh //+ rho*gh
|
||||
p_rgh
|
||||
);
|
||||
|
||||
Info<< "Creating multiphaseSystem\n" << endl;
|
||||
@ -49,7 +50,13 @@
|
||||
|
||||
multiphaseSystem& fluid = fluidPtr();
|
||||
|
||||
//volScalarField& e = fluid.he();
|
||||
if (!fluid.incompressible())
|
||||
{
|
||||
FatalError << "One or more phases are not incompressible. " << nl
|
||||
<< "This is a incompressible solver." << abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
volScalarField& T = fluid.T();
|
||||
|
||||
// Need to store rho for ddt(rho, U)
|
||||
@ -115,23 +122,22 @@
|
||||
(
|
||||
radiation::radiationModel::New(T)
|
||||
);
|
||||
/*
|
||||
Info<< "Calculating field kappaEff\n" << endl;
|
||||
volScalarField kappaEff
|
||||
|
||||
Info<< "Calculating field rhoCp\n" << endl;
|
||||
volScalarField rhoCp
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"kappaEff",
|
||||
"rhoCp",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
fluid.kappa()
|
||||
fluid.rho()*fluid.Cp()
|
||||
);
|
||||
rhoCp.oldTime();
|
||||
|
||||
kappaEff.correctBoundaryConditions();
|
||||
*/
|
||||
|
||||
Info<< "Creating field kinetic energy K\n" << endl;
|
||||
volScalarField K("K", 0.5*magSqr(U));
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,8 +29,7 @@ Group
|
||||
|
||||
Description
|
||||
Solver for n incompressible, non-isothermal immiscible fluids with
|
||||
phase-change (evaporation-condensation). Uses a VOF (volume of fluid)
|
||||
phase-fraction based interface capturing approach.
|
||||
phase-change. Uses a VOF (volume of fluid) phase-fraction based interface capturing approach.
|
||||
|
||||
The momentum, energy and other fluid properties are of the "mixture" and a
|
||||
single momentum equation is solved.
|
||||
@ -40,7 +39,6 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "CMULES.H"
|
||||
#include "subCycle.H"
|
||||
#include "multiphaseSystem.H"
|
||||
#include "turbulentFluidThermoModel.H"
|
||||
@ -50,6 +48,7 @@ Description
|
||||
#include "radiationModel.H"
|
||||
#include "HashPtrTable.H"
|
||||
#include "fvcDDt.H"
|
||||
#include "zeroField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -61,7 +60,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
#include "readGravitationalAcceleration.H"
|
||||
#include "createFields.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "createTimeControls.H"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,6 +28,7 @@ License
|
||||
#include "physicoChemicalConstants.H"
|
||||
|
||||
using namespace Foam::constant;
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::DTRMParticle::DTRMParticle
|
||||
@ -38,19 +39,40 @@ Foam::DTRMParticle::DTRMParticle
|
||||
const scalar I,
|
||||
const label cellI,
|
||||
const scalar dA,
|
||||
const label reflectedId,
|
||||
const scalar Imin,
|
||||
bool doCellFacePt
|
||||
const label transmissiveId
|
||||
)
|
||||
:
|
||||
particle(mesh, position, cellI, doCellFacePt),
|
||||
particle(mesh, position, cellI),
|
||||
p0_(position),
|
||||
p1_(targetPosition),
|
||||
I0_(I),
|
||||
I_(I),
|
||||
dA_(dA),
|
||||
reflectedId_(reflectedId),
|
||||
Imin_(Imin)
|
||||
transmissiveId_(transmissiveId)
|
||||
{}
|
||||
|
||||
|
||||
Foam::DTRMParticle::DTRMParticle
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const barycentric& coordinates,
|
||||
const label celli,
|
||||
const label tetFacei,
|
||||
const label tetPti,
|
||||
const vector& position,
|
||||
const vector& targetPosition,
|
||||
const scalar I,
|
||||
const scalar dA,
|
||||
const label transmissiveId
|
||||
)
|
||||
:
|
||||
particle(mesh, coordinates, celli, tetFacei, tetPti),
|
||||
p0_(position),
|
||||
p1_(targetPosition),
|
||||
I0_(I),
|
||||
I_(I),
|
||||
dA_(dA),
|
||||
transmissiveId_(transmissiveId)
|
||||
{}
|
||||
|
||||
|
||||
@ -62,14 +84,14 @@ Foam::DTRMParticle::DTRMParticle(const DTRMParticle& p)
|
||||
I0_(p.I0_),
|
||||
I_(p.I_),
|
||||
dA_(p.dA_),
|
||||
reflectedId_(p.reflectedId_),
|
||||
Imin_(p.Imin_)
|
||||
transmissiveId_(p.transmissiveId_)
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::DTRMParticle::move
|
||||
(
|
||||
Cloud<DTRMParticle>& spc,
|
||||
trackingData& td,
|
||||
const scalar trackTime
|
||||
)
|
||||
@ -77,106 +99,120 @@ bool Foam::DTRMParticle::move
|
||||
td.switchProcessor = false;
|
||||
td.keepParticle = true;
|
||||
|
||||
const polyBoundaryMesh& pbMesh = mesh_.boundaryMesh();
|
||||
|
||||
while (td.keepParticle && !td.switchProcessor)
|
||||
while (td.keepParticle && !td.switchProcessor && stepFraction() < 1)
|
||||
{
|
||||
point p0 = position();
|
||||
label cell0 = cell();
|
||||
//Cache old data of particle to use for reflected particle
|
||||
const point pos0 = position();
|
||||
const label cell0 = cell();
|
||||
|
||||
scalar dt = trackToFace(p1_, td);
|
||||
scalar f = 1 - stepFraction();
|
||||
const vector s = p1() - p0() - deviationFromMeshCentre();
|
||||
trackToAndHitFace(f*s, f, spc, td);
|
||||
|
||||
// Consider the cell between f0(start of tracking) and f1
|
||||
label celli = cell();
|
||||
const point p1 = position();
|
||||
vector dsv = p1 - pos0;
|
||||
scalar ds = mag(dsv);
|
||||
|
||||
const vector dsv = position() - p0;
|
||||
const scalar ds = mag(dsv);
|
||||
const label cell1 = cell();
|
||||
|
||||
//NOTE:
|
||||
// Under the new barocentric tracking alghorithm the newly
|
||||
// inserted particles are tracked to the nearest cell centre first,
|
||||
// then, given the direction, to a face. In both occasions the first call
|
||||
// to trackToAndHitFace returns ds = 0. In this case we do an extra
|
||||
// call to trackToAndHitFace to start the tracking.
|
||||
// This is a temporary fix until the tracking can handle it.
|
||||
if (ds == 0)
|
||||
{
|
||||
trackToAndHitFace(f*s, f, spc, td);
|
||||
dsv = p1 - position();
|
||||
ds = mag(dsv);
|
||||
}
|
||||
|
||||
// Boltzman constant
|
||||
const scalar sigma = physicoChemical::sigma.value();
|
||||
|
||||
label reflectedZoneId = td.relfectedCells()[cell1];
|
||||
|
||||
if
|
||||
(
|
||||
(!td.relfectedCells()[celli] > 0 && reflectedId_ == 0)
|
||||
|| reflectedId_ > 0
|
||||
(reflectedZoneId > -1)
|
||||
&& (
|
||||
(transmissiveId_ == -1)
|
||||
|| (transmissiveId_ != reflectedZoneId)
|
||||
)
|
||||
)
|
||||
{
|
||||
scalar a = td.aInterp().interpolate(position(), cell0);
|
||||
scalar e = td.eInterp().interpolate(position(), cell0);
|
||||
scalar E = td.EInterp().interpolate(position(), cell0);
|
||||
scalar T = td.TInterp().interpolate(position(), cell0);
|
||||
|
||||
const scalar I1 =
|
||||
(
|
||||
I_
|
||||
+ ds*(e*sigma*pow4(T)/mathematical::pi + E)
|
||||
) / (1 + ds*a);
|
||||
|
||||
td.Q(cell0) += (I_ - I1)*dA_;
|
||||
|
||||
I_ = I1;
|
||||
|
||||
if ((I_ <= 0.01*I0_) || (I_ < Imin_))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
scalar rho(0);
|
||||
|
||||
// Create a new reflected particle when the particles is not
|
||||
// transmissive and larger than an absolute I
|
||||
if (reflectedId_ == 0 && I_ > Imin_)
|
||||
if (I_ > 0.01*I0_ && ds > 0)
|
||||
{
|
||||
vector pDir = dsv/ds;
|
||||
|
||||
cellPointWeight cpw(mesh_, position(), celli, face());
|
||||
//vector nHat = td.nHatCells()[celli];
|
||||
cellPointWeight cpw(mesh(), position(), cell1, face());
|
||||
vector nHat = td.nHatInterp().interpolate(cpw);
|
||||
|
||||
nHat /= mag(nHat);
|
||||
nHat /= (mag(nHat) + ROOTSMALL);
|
||||
scalar cosTheta(-pDir & nHat);
|
||||
|
||||
// Only new incoming rays
|
||||
if (cosTheta > SMALL)
|
||||
{
|
||||
vector newDir = td.reflection().R(pDir, nHat);
|
||||
|
||||
//scalar theta = acos(-pDir & nHat);
|
||||
vector newDir =
|
||||
td.reflection()
|
||||
[
|
||||
td.relfectedCells()[cell1]
|
||||
].R(pDir, nHat);
|
||||
|
||||
// reflectivity
|
||||
rho = min(max(td.reflection().rho(cosTheta), 0.0), 0.98);
|
||||
rho =
|
||||
min
|
||||
(
|
||||
max
|
||||
(
|
||||
td.reflection()
|
||||
[
|
||||
td.relfectedCells()[cell1]
|
||||
].rho(cosTheta)
|
||||
, 0.0
|
||||
)
|
||||
, 0.98
|
||||
);
|
||||
|
||||
scalar delaM = sqrt(mesh_.cellVolumes()[cell0]);
|
||||
scalar delaM = cbrt(mesh().cellVolumes()[cell0]);
|
||||
|
||||
DTRMParticle* pPtr = new DTRMParticle
|
||||
(
|
||||
mesh_,
|
||||
position() - pDir*0.1*delaM,
|
||||
position() + newDir*mesh_.bounds().mag(),
|
||||
I_*rho,
|
||||
cell0,
|
||||
dA_,
|
||||
reflectedId_,
|
||||
Imin_,
|
||||
true
|
||||
);
|
||||
// Add to cloud
|
||||
td.cloud().addParticle(pPtr);
|
||||
const point insertP(position() - pDir*0.1*delaM);
|
||||
label cellI = mesh().findCell(insertP);
|
||||
|
||||
if (cellI > -1)
|
||||
{
|
||||
DTRMParticle* pPtr = new DTRMParticle
|
||||
(
|
||||
mesh(),
|
||||
insertP,
|
||||
insertP + newDir*mesh().bounds().mag(),
|
||||
I_*rho,
|
||||
cellI,
|
||||
dA_,
|
||||
-1
|
||||
);
|
||||
|
||||
// Add to cloud
|
||||
spc.addParticle(pPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
reflectedId_++;
|
||||
// Change transmissiveId of the particle
|
||||
transmissiveId_ = reflectedZoneId;
|
||||
|
||||
const point p0 = position();
|
||||
|
||||
// Try to locate this particle across the reflecting surface in
|
||||
// a pure phase face
|
||||
scalar dt = trackToFace(p1_, td);
|
||||
const scalar ds = mag(position() - p0);
|
||||
|
||||
scalar a = td.aInterp().interpolate(position(), celli);
|
||||
scalar e = td.eInterp().interpolate(position(), celli);
|
||||
scalar E = td.EInterp().interpolate(position(), celli);
|
||||
scalar T = td.TInterp().interpolate(position(), celli);
|
||||
const tetIndices tetIs = this->currentTetIndices();
|
||||
scalar a = td.aInterp().interpolate(this->coordinates(), tetIs);
|
||||
scalar e = td.eInterp().interpolate(this->coordinates(), tetIs);
|
||||
scalar E = td.EInterp().interpolate(this->coordinates(), tetIs);
|
||||
scalar T = td.TInterp().interpolate(this->coordinates(), tetIs);
|
||||
|
||||
// Left intensity after reflection
|
||||
const scalar Itran = I_*(1.0 - rho);
|
||||
@ -186,46 +222,51 @@ bool Foam::DTRMParticle::move
|
||||
+ ds*(e*sigma*pow4(T)/mathematical::pi + E)
|
||||
) / (1 + ds*a);
|
||||
|
||||
td.Q(celli) += (Itran - I1)*dA_;
|
||||
td.Q(cell1) += (Itran - max(I1, 0.0))*dA_;
|
||||
|
||||
I_ = I1;
|
||||
|
||||
if (I_ <= 0.01*I0_ || I_ < Imin_)
|
||||
if (I_ <= 0.01*I0_)
|
||||
{
|
||||
stepFraction() = 1.0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const tetIndices tetIs = this->currentTetIndices();
|
||||
scalar a = td.aInterp().interpolate(this->coordinates(), tetIs);
|
||||
scalar e = td.eInterp().interpolate(this->coordinates(), tetIs);
|
||||
scalar E = td.EInterp().interpolate(this->coordinates(), tetIs);
|
||||
scalar T = td.TInterp().interpolate(this->coordinates(), tetIs);
|
||||
|
||||
const scalar I1 =
|
||||
(
|
||||
I_
|
||||
+ ds*(e*sigma*pow4(T)/mathematical::pi + E)
|
||||
) / (1 + ds*a);
|
||||
|
||||
td.Q(cell1) += (I_ - max(I1, 0.0))*dA_;
|
||||
|
||||
I_ = I1;
|
||||
|
||||
if ((I_ <= 0.01*I0_))
|
||||
{
|
||||
stepFraction() = 1.0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (onBoundary() && td.keepParticle)
|
||||
{
|
||||
if (isA<processorPolyPatch>(pbMesh[patch(face())]))
|
||||
{
|
||||
td.switchProcessor = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return td.keepParticle;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::DTRMParticle::hitPatch
|
||||
(
|
||||
const polyPatch&,
|
||||
particle::TrackingData<Cloud<DTRMParticle>>&,
|
||||
const label,
|
||||
const scalar,
|
||||
const tetIndices&
|
||||
)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::DTRMParticle::hitProcessorPatch
|
||||
(
|
||||
const processorPolyPatch&,
|
||||
particle::TrackingData<Cloud<DTRMParticle>>& td
|
||||
Cloud<DTRMParticle>&,
|
||||
trackingData& td
|
||||
)
|
||||
{
|
||||
td.switchProcessor = true;
|
||||
@ -234,22 +275,21 @@ void Foam::DTRMParticle::hitProcessorPatch
|
||||
|
||||
void Foam::DTRMParticle::hitWallPatch
|
||||
(
|
||||
const wallPolyPatch& wpp,
|
||||
particle::TrackingData<Cloud<DTRMParticle>>& td,
|
||||
const tetIndices& tetIs
|
||||
Cloud<DTRMParticle>&,
|
||||
trackingData& td
|
||||
)
|
||||
{
|
||||
td.keepParticle = false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::DTRMParticle::hitPatch
|
||||
bool Foam::DTRMParticle::hitPatch
|
||||
(
|
||||
const polyPatch&,
|
||||
particle::TrackingData<Cloud<DTRMParticle>>& td
|
||||
Cloud<DTRMParticle>&,
|
||||
trackingData& td
|
||||
)
|
||||
{
|
||||
td.keepParticle = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,7 +43,6 @@ SourceFiles
|
||||
#include "reflectionModel.H"
|
||||
#include "interpolationCellPoint.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -65,6 +64,7 @@ class DTRMParticle
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
//- Size in bytes of the fields
|
||||
@ -85,11 +85,8 @@ private:
|
||||
//- Area of radiation
|
||||
scalar dA_;
|
||||
|
||||
//- Reflected index
|
||||
label reflectedId_;
|
||||
|
||||
//- Minimum radiation intensity to which the particle is tracked [W/m2]
|
||||
scalar Imin_;
|
||||
//- Trasnmissive index
|
||||
label transmissiveId_;
|
||||
|
||||
|
||||
public:
|
||||
@ -99,19 +96,23 @@ public:
|
||||
//- Class used to pass tracking data to the trackToFace function
|
||||
class trackingData
|
||||
:
|
||||
public particle::TrackingData<Cloud<DTRMParticle>>
|
||||
public particle::trackingData
|
||||
{
|
||||
|
||||
|
||||
// Interpolators for continuous phase fields
|
||||
|
||||
const interpolationCell<scalar>& aInterp_;
|
||||
const interpolationCell<scalar>& eInterp_;
|
||||
const interpolationCell<scalar>& EInterp_;
|
||||
const interpolationCell<scalar>& TInterp_;
|
||||
|
||||
const interpolationCellPoint<vector>& nHatInterp_;
|
||||
|
||||
//- Reflected cells
|
||||
const labelField& relfectedCells_;
|
||||
const reflectionModel& reflection_;
|
||||
|
||||
//- Ptr to reflectiom model
|
||||
UPtrList<reflectionModel> reflection_;
|
||||
|
||||
//- Heat source term
|
||||
volScalarField& Q_;
|
||||
@ -130,7 +131,7 @@ public:
|
||||
const interpolationCell<scalar>& TInterp,
|
||||
const interpolationCellPoint<vector>& nHatInterp,
|
||||
const labelField&,
|
||||
const reflectionModel&,
|
||||
const UPtrList<reflectionModel>&,
|
||||
volScalarField& Q
|
||||
);
|
||||
|
||||
@ -147,7 +148,7 @@ public:
|
||||
inline const interpolationCell<scalar>& TInterp() const;
|
||||
inline const interpolationCellPoint<vector>& nHatInterp() const;
|
||||
inline const labelField& relfectedCells() const;
|
||||
inline const reflectionModel& reflection() const;
|
||||
inline const UPtrList<reflectionModel>& reflection() const;
|
||||
|
||||
inline scalar& Q(label celli);
|
||||
|
||||
@ -163,7 +164,8 @@ public:
|
||||
+ " p1"
|
||||
+ " I0"
|
||||
+ " I"
|
||||
+ " dA";
|
||||
+ " dA"
|
||||
+ " transmissiveId";
|
||||
);
|
||||
|
||||
//- String representation of property types
|
||||
@ -173,7 +175,9 @@ public:
|
||||
"{point"
|
||||
+ " point"
|
||||
+ " scalar"
|
||||
+ " scalar}"
|
||||
+ " scalar"
|
||||
+ " scalar"
|
||||
+ " label}"
|
||||
);
|
||||
|
||||
|
||||
@ -190,9 +194,22 @@ public:
|
||||
const scalar I,
|
||||
const label cellI,
|
||||
const scalar dA,
|
||||
const label reflectedId,
|
||||
const scalar Imin,
|
||||
bool doCellFacePt = true
|
||||
const label transmissiveId
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
DTRMParticle
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const barycentric& coordinates,
|
||||
const label celli,
|
||||
const label tetFacei,
|
||||
const label tetPti,
|
||||
const vector& position,
|
||||
const vector& targetPosition,
|
||||
const scalar I,
|
||||
const scalar dA,
|
||||
const label transmissiveId
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
@ -200,18 +217,13 @@ public:
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& is,
|
||||
bool readFields = true
|
||||
bool readFields = true,
|
||||
bool newFormat = true
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
DTRMParticle(const DTRMParticle& p);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<particle> clone() const
|
||||
{
|
||||
return autoPtr<particle>(new DTRMParticle(*this));
|
||||
}
|
||||
|
||||
|
||||
//- Factory class to read-construct particles used for
|
||||
// parallel transfer
|
||||
@ -256,8 +268,6 @@ public:
|
||||
|
||||
// Edit
|
||||
|
||||
//- Return access to the initial position
|
||||
inline point& p0();
|
||||
|
||||
//- Return access to the target position
|
||||
inline point& p1();
|
||||
@ -274,55 +284,34 @@ public:
|
||||
//- Return access to reflectedId
|
||||
inline label& reflectedId();
|
||||
|
||||
//- Return access to initial tet face
|
||||
//inline label& tetFace0();
|
||||
|
||||
//- Return access to initial tet point
|
||||
//inline label& tetPt0();
|
||||
|
||||
//- Return access to initial proc Id
|
||||
//inline label& origProc0();
|
||||
|
||||
|
||||
// Tracking
|
||||
|
||||
//- Move
|
||||
bool move(trackingData&, const scalar);
|
||||
bool move(Cloud<DTRMParticle>& , trackingData&, const scalar);
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Overridable function to handle the particle hitting a patch
|
||||
// Executed before other patch-hitting functions
|
||||
bool hitPatch
|
||||
(
|
||||
const polyPatch&,
|
||||
particle::TrackingData<Cloud<DTRMParticle>>& td,
|
||||
const label patchi,
|
||||
const scalar trackFraction,
|
||||
const tetIndices& tetIs
|
||||
);
|
||||
|
||||
//- Overridable function to handle the particle hitting a processorPatch
|
||||
void hitProcessorPatch
|
||||
(
|
||||
const processorPolyPatch&,
|
||||
particle::TrackingData<Cloud<DTRMParticle>>& td
|
||||
Cloud<DTRMParticle>&,
|
||||
trackingData& td
|
||||
);
|
||||
|
||||
//- Overridable function to handle the particle hitting a wallPatch
|
||||
void hitWallPatch
|
||||
(
|
||||
const wallPolyPatch&,
|
||||
particle::TrackingData<Cloud<DTRMParticle>>& td,
|
||||
const tetIndices&
|
||||
Cloud<DTRMParticle>&,
|
||||
trackingData& td
|
||||
);
|
||||
|
||||
//- Overridable function to handle the particle hitting a polyPatch
|
||||
void hitPatch
|
||||
bool hitPatch
|
||||
(
|
||||
const polyPatch&,
|
||||
particle::TrackingData<Cloud<DTRMParticle>>& td
|
||||
Cloud<DTRMParticle>&,
|
||||
trackingData& td
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -34,11 +34,11 @@ inline Foam::DTRMParticle::trackingData::trackingData
|
||||
const interpolationCell<scalar>& TInterp,
|
||||
const interpolationCellPoint<vector>& nHatInterp,
|
||||
const labelField& relfectedCell,
|
||||
const reflectionModel& reflection,
|
||||
const UPtrList<reflectionModel>& reflection,
|
||||
volScalarField& Q
|
||||
)
|
||||
:
|
||||
particle::TrackingData<Cloud<DTRMParticle>>(spc),
|
||||
particle::trackingData(spc),
|
||||
aInterp_(aInterp),
|
||||
eInterp_(eInterp),
|
||||
EInterp_(EInterp),
|
||||
@ -92,7 +92,7 @@ Foam::DTRMParticle::trackingData::relfectedCells() const
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::reflectionModel&
|
||||
inline const Foam::UPtrList<Foam::radiation::reflectionModel>&
|
||||
Foam::DTRMParticle::trackingData::reflection() const
|
||||
{
|
||||
return reflection_;
|
||||
@ -141,18 +141,6 @@ inline Foam::scalar& Foam::DTRMParticle::dA()
|
||||
}
|
||||
|
||||
|
||||
inline Foam::point& Foam::DTRMParticle::p0()
|
||||
{
|
||||
return p0_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label& Foam::DTRMParticle::reflectedId()
|
||||
{
|
||||
return reflectedId_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::point& Foam::DTRMParticle::p1()
|
||||
{
|
||||
return p1_;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,27 +43,32 @@ Foam::DTRMParticle::DTRMParticle
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& is,
|
||||
bool readFields
|
||||
bool readFields,
|
||||
bool newFormat
|
||||
)
|
||||
:
|
||||
particle(mesh, is, readFields),
|
||||
p0_(position_),
|
||||
particle(mesh, is, readFields, newFormat),
|
||||
p0_(point::zero),
|
||||
p1_(point::zero),
|
||||
I0_(0),
|
||||
I_(0),
|
||||
dA_(0)
|
||||
dA_(0),
|
||||
transmissiveId_(-1)
|
||||
{
|
||||
if (readFields)
|
||||
{
|
||||
if (is.format() == IOstream::ASCII)
|
||||
{
|
||||
is >> p0_ >> p1_ >> I0_ >> I_ >> dA_;
|
||||
is >> p0_ >> p1_ >> I0_ >> I_ >> dA_ >> transmissiveId_;
|
||||
DebugVar(transmissiveId_);
|
||||
}
|
||||
else
|
||||
{
|
||||
is.read(reinterpret_cast<char*>(&p0_), sizeofFields_);
|
||||
}
|
||||
}
|
||||
|
||||
is.check(FUNCTION_NAME);
|
||||
}
|
||||
|
||||
|
||||
@ -76,7 +81,8 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const DTRMParticle& p)
|
||||
<< token::SPACE << p.p1_
|
||||
<< token::SPACE << p.I0_
|
||||
<< token::SPACE << p.I_
|
||||
<< token::SPACE << p.dA_;
|
||||
<< token::SPACE << p.dA_
|
||||
<< token::SPACE << p.transmissiveId_;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
EXE_INC = \
|
||||
-DFULLDEBUG -g -O0 \
|
||||
-I../phasesSystem/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -33,6 +33,7 @@ License
|
||||
#include "unitConversion.H"
|
||||
#include "interpolationCell.H"
|
||||
#include "interpolationCellPoint.H"
|
||||
#include "Random.H"
|
||||
|
||||
using namespace Foam::constant;
|
||||
|
||||
@ -124,19 +125,13 @@ Foam::tmp<Foam::volVectorField> Foam::radiation::laserDTRM::nHatfv
|
||||
const dimensionedScalar deltaN
|
||||
(
|
||||
"deltaN",
|
||||
1e-8/pow(average(mesh_.V()), 1.0/3.0)
|
||||
1e-7/pow(average(mesh_.V()), 1.0/3.0)
|
||||
);
|
||||
|
||||
const dimensionedScalar minAlpha
|
||||
const volVectorField gradAlphaf
|
||||
(
|
||||
"minAlpha", dimless, 1e-3
|
||||
);
|
||||
|
||||
volVectorField gradAlphaf
|
||||
(
|
||||
"gradAlphaf",
|
||||
(alpha2 + minAlpha)*fvc::grad(alpha1)
|
||||
- (alpha1 + minAlpha)*fvc::grad(alpha2)
|
||||
alpha2*fvc::grad(alpha1)
|
||||
- alpha1*fvc::grad(alpha2)
|
||||
);
|
||||
|
||||
// Face unit interface normal
|
||||
@ -144,15 +139,34 @@ Foam::tmp<Foam::volVectorField> Foam::radiation::laserDTRM::nHatfv
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>Foam::radiation::laserDTRM::nearInterface
|
||||
(
|
||||
const volScalarField& alpha1,
|
||||
const volScalarField& alpha2
|
||||
) const
|
||||
void Foam::radiation::laserDTRM::initialiseReflection()
|
||||
{
|
||||
return
|
||||
pos(alpha1 - 0.1)*pos(0.9 - alpha1)
|
||||
* pos(alpha2 - 0.1)*pos(0.9 - alpha2);
|
||||
if (found("reflectionModel"))
|
||||
{
|
||||
dictTable modelDicts(lookup("reflectionModel"));
|
||||
|
||||
forAllConstIter(dictTable, modelDicts, iter)
|
||||
{
|
||||
const phasePairKey& key = iter.key();
|
||||
|
||||
reflections_.insert
|
||||
(
|
||||
key,
|
||||
reflectionModel::New
|
||||
(
|
||||
*iter,
|
||||
mesh_
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (reflections_.size() > 0)
|
||||
{
|
||||
reflectionSwitch_ = true;
|
||||
}
|
||||
|
||||
reflectionSwitch_ = returnReduce(reflectionSwitch_, orOp<bool>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -175,9 +189,9 @@ void Foam::radiation::laserDTRM::initialise()
|
||||
// Find a vector on the area plane. Normal to laser direction
|
||||
vector rArea = vector::zero;
|
||||
scalar magr = 0.0;
|
||||
cachedRandom rnd(1234, -1);
|
||||
while (magr < VSMALL)
|
||||
{
|
||||
Random rnd(1234);
|
||||
vector v = rnd.sample01<vector>();
|
||||
rArea = v - (v & lDir)*lDir;
|
||||
magr = mag(rArea);
|
||||
@ -203,19 +217,6 @@ void Foam::radiation::laserDTRM::initialise()
|
||||
new interpolation2DTable<scalar>(*this)
|
||||
);
|
||||
|
||||
// Check dimensions ndr and ndTheta
|
||||
// if
|
||||
// (
|
||||
// (powerDistribution_->size() != ndTheta_)
|
||||
// || (powerDistribution_().first().second().size() != ndr_)
|
||||
// )
|
||||
// {
|
||||
// FatalErrorInFunction
|
||||
// << " The table dimensions should correspond with ndTheta "
|
||||
// << " and ndr "
|
||||
// << exit(FatalError);
|
||||
// }
|
||||
|
||||
break;
|
||||
}
|
||||
case pdUniform:
|
||||
@ -235,9 +236,6 @@ void Foam::radiation::laserDTRM::initialise()
|
||||
p1 = p0;
|
||||
if (mesh_.nGeometricD() == 3)
|
||||
{
|
||||
//scalar r0 = dr/2.0;
|
||||
//scalar r1Max0 = drMax/2.0;
|
||||
|
||||
for (label ri = 0; ri < ndr_; ri++)
|
||||
{
|
||||
scalar r1 = SMALL + dr*ri;
|
||||
@ -275,8 +273,6 @@ void Foam::radiation::laserDTRM::initialise()
|
||||
// calculate target point using new deviation rl
|
||||
p1 = lPosition + finalPos + (0.5*maxTrackLength_*lDir);
|
||||
|
||||
//scalar p = magSqr(p0 - lPosition);
|
||||
|
||||
scalar Ip = calculateIp(rP, thetaP);
|
||||
|
||||
scalar dAi = (sqr(r2) - sqr(r1))*(theta2 - theta1)/2.0;
|
||||
@ -290,7 +286,7 @@ void Foam::radiation::laserDTRM::initialise()
|
||||
{
|
||||
// Create a new particle
|
||||
DTRMParticle* pPtr = new DTRMParticle
|
||||
(mesh_, p0, p1, Ip, cellI, dAi, 0 , 0.01*Ip, true);
|
||||
(mesh_, p0, p1, Ip, cellI, dAi, -1);
|
||||
|
||||
// Add to cloud
|
||||
DTRMCloud_.addParticle(pPtr);
|
||||
@ -338,12 +334,12 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
|
||||
(
|
||||
Function1<point>::New("focalLaserPosition", *this)
|
||||
),
|
||||
|
||||
laserDirection_
|
||||
(
|
||||
Function1<vector>::New("laserDirection", *this)
|
||||
),
|
||||
|
||||
|
||||
focalLaserRadius_(readScalar(lookup("focalLaserRadius"))),
|
||||
qualityBeamLaser_
|
||||
(
|
||||
@ -354,11 +350,10 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
|
||||
laserPower_(Function1<scalar>::New("laserPower", *this)),
|
||||
powerDistribution_(),
|
||||
|
||||
reflection_(reflectionModel::New(*this, mesh_).ptr()),
|
||||
reflectionSwitch_(lookupOrDefault("reflection", false)),
|
||||
initialPhase_(lookupOrDefault("initialPhase", word::null)),
|
||||
alpha1_(lookupOrDefault("alpha1", word::null)),
|
||||
alpha2_(lookupOrDefault("alpha2", word::null)),
|
||||
reflectionSwitch_(false),
|
||||
|
||||
alphaCut_( lookupOrDefault<scalar>("alphaCut", 0.5)),
|
||||
|
||||
Qin_
|
||||
(
|
||||
IOobject
|
||||
@ -413,7 +408,7 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
|
||||
),
|
||||
Q_
|
||||
(
|
||||
IOobject
|
||||
IOobject
|
||||
(
|
||||
"Q",
|
||||
mesh_.time().timeName(),
|
||||
@ -425,6 +420,8 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
|
||||
dimensionedScalar("Q", dimPower/dimVolume, 0.0)
|
||||
)
|
||||
{
|
||||
initialiseReflection();
|
||||
|
||||
initialise();
|
||||
}
|
||||
|
||||
@ -462,11 +459,10 @@ Foam::radiation::laserDTRM::laserDTRM
|
||||
laserPower_(Function1<scalar>::New("laserPower", *this)),
|
||||
powerDistribution_(),
|
||||
|
||||
reflection_(reflectionModel::New(*this, mesh_).ptr()),
|
||||
reflectionSwitch_(dict.lookupOrDefault("reflection", false)),
|
||||
initialPhase_(lookupOrDefault("initialPhase", word::null)),
|
||||
alpha1_(lookupOrDefault("alpha1", word::null)),
|
||||
alpha2_(lookupOrDefault("alpha2", word::null)),
|
||||
reflectionSwitch_(false),
|
||||
|
||||
alphaCut_( lookupOrDefault<scalar>("alphaCut", 0.5)),
|
||||
|
||||
Qin_
|
||||
(
|
||||
IOobject
|
||||
@ -533,6 +529,7 @@ Foam::radiation::laserDTRM::laserDTRM
|
||||
dimensionedScalar("Q", dimPower/pow3(dimLength), 0.0)
|
||||
)
|
||||
{
|
||||
initialiseReflection();
|
||||
initialise();
|
||||
}
|
||||
|
||||
@ -573,25 +570,11 @@ void Foam::radiation::laserDTRM::calculate()
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("zero", dimless, 0)
|
||||
dimensionedScalar("zero", dimless, -1)
|
||||
)
|
||||
);
|
||||
volScalarField& reflectingCellsVol = treflectingCells.ref();
|
||||
|
||||
// Reset the fields
|
||||
Qin_ == dimensionedScalar("zero", Qin_.dimensions(), 0);
|
||||
Q_ == dimensionedScalar("zero", Q_.dimensions(), 0);
|
||||
|
||||
a_ = absorptionEmission_->a();
|
||||
e_ = absorptionEmission_->e();
|
||||
E_ = absorptionEmission_->E();
|
||||
|
||||
const interpolationCell<scalar> aInterp(a_);
|
||||
const interpolationCell<scalar> eInterp(e_);
|
||||
const interpolationCell<scalar> EInterp(E_);
|
||||
const interpolationCell<scalar> TInterp(T_);
|
||||
|
||||
labelField reflectingCells(mesh_.nCells(), 0);
|
||||
|
||||
tmp<volVectorField> tnHat
|
||||
(
|
||||
@ -611,54 +594,86 @@ void Foam::radiation::laserDTRM::calculate()
|
||||
);
|
||||
volVectorField& nHat = tnHat.ref();
|
||||
|
||||
|
||||
// Reset the fields
|
||||
Qin_ == dimensionedScalar("zero", Qin_.dimensions(), 0);
|
||||
Q_ == dimensionedScalar("zero", Q_.dimensions(), 0);
|
||||
|
||||
a_ = absorptionEmission_->a();
|
||||
e_ = absorptionEmission_->e();
|
||||
E_ = absorptionEmission_->E();
|
||||
|
||||
const interpolationCell<scalar> aInterp(a_);
|
||||
const interpolationCell<scalar> eInterp(e_);
|
||||
const interpolationCell<scalar> EInterp(E_);
|
||||
const interpolationCell<scalar> TInterp(T_);
|
||||
|
||||
labelField reflectingCells(mesh_.nCells(), -1);
|
||||
|
||||
autoPtr<interpolationCellPoint<vector>> nHatIntrPtr;
|
||||
|
||||
UPtrList<reflectionModel> reflactionUPtr;
|
||||
|
||||
if (reflectionSwitch_)
|
||||
{
|
||||
const volScalarField& initialPhase =
|
||||
mesh_.lookupObject<volScalarField>(initialPhase_);
|
||||
reflactionUPtr.resize(reflections_.size());
|
||||
|
||||
if (alpha1_ != word::null)
|
||||
label reflectionModelId(0);
|
||||
forAllIter(reflectionModelTable, reflections_, iter1)
|
||||
{
|
||||
const volScalarField& alpha1 =
|
||||
mesh_.lookupObject<volScalarField>(alpha1_);
|
||||
reflectionModel& model = iter1()();
|
||||
|
||||
nHat = nHatfv(initialPhase, alpha1);
|
||||
reflactionUPtr.set(reflectionModelId, &model);
|
||||
|
||||
forAll(alpha1, cellI)
|
||||
const word alpha1Name = "alpha." + iter1.key().first();
|
||||
const word alpha2Name = "alpha." + iter1.key().second();
|
||||
|
||||
const volScalarField& alphaFrom =
|
||||
mesh_.lookupObject<volScalarField>(alpha1Name);
|
||||
|
||||
const volScalarField& alphaTo =
|
||||
mesh_.lookupObject<volScalarField>(alpha2Name);
|
||||
|
||||
const volVectorField nHatPhase(nHatfv(alphaFrom, alphaTo));
|
||||
|
||||
const volScalarField gradAlphaf
|
||||
(
|
||||
fvc::grad(alphaFrom)
|
||||
& fvc::grad(alphaTo)
|
||||
);
|
||||
|
||||
const volScalarField nearInterface(pos(alphaTo - alphaCut_));
|
||||
|
||||
const volScalarField mask(nearInterface*gradAlphaf);
|
||||
|
||||
forAll(alphaFrom, cellI)
|
||||
{
|
||||
if ((alpha1[cellI] > 0.9) && (mag(nHat[cellI]) > 0.9))
|
||||
if
|
||||
(
|
||||
nearInterface[cellI]
|
||||
&& mag(nHatPhase[cellI]) > 0.99
|
||||
&& mask[cellI] < 0
|
||||
)
|
||||
{
|
||||
reflectingCells[cellI] = 1;
|
||||
reflectingCellsVol[cellI] = 1.0;
|
||||
reflectingCells[cellI] = reflectionModelId;
|
||||
reflectingCellsVol[cellI] = reflectionModelId;
|
||||
if (!mag(nHat[cellI]) > 0.0)
|
||||
{
|
||||
nHat[cellI] += nHatPhase[cellI];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
reflectionModelId++;
|
||||
}
|
||||
|
||||
if (alpha2_ != word::null)
|
||||
{
|
||||
const volScalarField& alpha2 =
|
||||
mesh_.lookupObject<volScalarField>(alpha2_);
|
||||
|
||||
nHat += nHatfv(initialPhase, alpha2);
|
||||
|
||||
forAll(alpha2, cellI)
|
||||
{
|
||||
if ((alpha2[cellI] > 0.9) && (mag(nHat[cellI]) > 0.9))
|
||||
{
|
||||
reflectingCells[cellI] = 1;
|
||||
reflectingCellsVol[cellI] = 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nHatIntrPtr.reset
|
||||
(
|
||||
new interpolationCellPoint<vector>(nHat)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
nHatIntrPtr.reset
|
||||
(
|
||||
new interpolationCellPoint<vector>(nHat)
|
||||
);
|
||||
|
||||
DTRMParticle::trackingData td
|
||||
(
|
||||
DTRMCloud_,
|
||||
@ -668,20 +683,22 @@ void Foam::radiation::laserDTRM::calculate()
|
||||
TInterp,
|
||||
nHatIntrPtr,
|
||||
reflectingCells,
|
||||
reflection_,
|
||||
reflactionUPtr,
|
||||
Q_
|
||||
);
|
||||
|
||||
Info << "Move particles..."
|
||||
<< returnReduce(DTRMCloud_.size(), sumOp<label>()) << endl;
|
||||
|
||||
DTRMCloud_.move(td, mesh_.time().deltaTValue());
|
||||
DTRMCloud_.move(DTRMCloud_, td, mesh_.time().deltaTValue());
|
||||
|
||||
// Normalize by cell volume
|
||||
Q_.primitiveFieldRef() /= mesh_.V();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Final number of particles..."
|
||||
<< returnReduce(DTRMCloud_.size(), sumOp<label>()) << endl;
|
||||
|
||||
OFstream osRef
|
||||
(
|
||||
@ -689,15 +706,41 @@ void Foam::radiation::laserDTRM::calculate()
|
||||
);
|
||||
label vertI = 0;
|
||||
|
||||
List<pointField> positions(Pstream::nProcs());
|
||||
List<pointField> p0(Pstream::nProcs());
|
||||
|
||||
DynamicList<point> positionsMyProc;
|
||||
DynamicList<point> p0MyProc;
|
||||
|
||||
forAllIter(Cloud<DTRMParticle>, DTRMCloud_, iter)
|
||||
{
|
||||
DTRMParticle& p = iter();
|
||||
meshTools::writeOBJ(osRef, p.position());
|
||||
vertI++;
|
||||
meshTools::writeOBJ(osRef, p.p0());
|
||||
vertI++;
|
||||
osRef << "l " << vertI-1 << ' ' << vertI << nl;
|
||||
positionsMyProc.append(p.position());
|
||||
p0MyProc.append(p.p0());
|
||||
}
|
||||
|
||||
positions[Pstream::myProcNo()].transfer(positionsMyProc);
|
||||
p0[Pstream::myProcNo()].transfer(p0MyProc);
|
||||
|
||||
Pstream::gatherList(positions);
|
||||
Pstream::scatterList(positions);
|
||||
Pstream::gatherList(p0);
|
||||
Pstream::scatterList(p0);
|
||||
|
||||
for (label proci = 0; proci < Pstream::nProcs(); proci++)
|
||||
{
|
||||
const pointField& pos = positions[proci];
|
||||
const pointField& pfinal = p0[proci];
|
||||
forAll (pos, i)
|
||||
{
|
||||
meshTools::writeOBJ(osRef, pos[i]);
|
||||
vertI++;
|
||||
meshTools::writeOBJ(osRef, pfinal[i]);
|
||||
vertI++;
|
||||
osRef << "l " << vertI-1 << ' ' << vertI << nl;
|
||||
}
|
||||
}
|
||||
|
||||
osRef.flush();
|
||||
|
||||
scalar totalQ = gSum(Q_.primitiveFieldRef()*mesh_.V());
|
||||
@ -706,6 +749,7 @@ void Foam::radiation::laserDTRM::calculate()
|
||||
if (mesh_.time().outputTime())
|
||||
{
|
||||
reflectingCellsVol.write();
|
||||
nHat.write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,14 +24,24 @@ License
|
||||
Class
|
||||
Foam::radiation::laserDTRM
|
||||
|
||||
Description
|
||||
Works well for combustion applications where optical thickness, tau is
|
||||
large, i.e. tau = a*L > 3 (L = distance between objects)
|
||||
Group
|
||||
grpRadiationModels
|
||||
|
||||
Assumes
|
||||
- all surfaces are diffuse
|
||||
- tends to over predict radiative fluxes from sources/sinks
|
||||
*** SOURCES NOT CURRENTLY INCLUDED ***
|
||||
Description
|
||||
Discrete Tray Radiation Method for collimated radiation flux.
|
||||
At the moment the particles are injected on a 2D disk in polar
|
||||
coordinates providing starting and finish locations.
|
||||
|
||||
The ray is considered planar (no area divergence is considered). This
|
||||
model was developed to represent a collimated laser beam.
|
||||
|
||||
The model is developed to work in a VOF framework, representing different
|
||||
phases.
|
||||
|
||||
Reflection models are possible to set up between phases.
|
||||
|
||||
Different options are available in order to specify the power distribution
|
||||
at the origin of the laser.
|
||||
|
||||
SourceFiles
|
||||
laserDTRM.C
|
||||
@ -50,6 +60,8 @@ SourceFiles
|
||||
#include "Function1.H"
|
||||
#include "interpolation2DTable.H"
|
||||
#include "labelField.H"
|
||||
#include "phasePairKey.H"
|
||||
#include "NamedEnum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -78,9 +90,25 @@ public:
|
||||
pdUniform
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
// Private types
|
||||
|
||||
typedef
|
||||
HashTable<dictionary, phasePairKey, phasePairKey::hash> dictTable;
|
||||
|
||||
|
||||
typedef
|
||||
HashTable
|
||||
<
|
||||
autoPtr<reflectionModel>,
|
||||
phasePairKey,
|
||||
phasePairKey::hash
|
||||
> reflectionModelTable;
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
|
||||
@ -104,6 +132,7 @@ private:
|
||||
//- Maximum tracking length for particles
|
||||
scalar maxTrackLength_;
|
||||
|
||||
|
||||
// Laser parameters
|
||||
|
||||
//- Focal laser position
|
||||
@ -138,19 +167,13 @@ private:
|
||||
// Reflection sub-model
|
||||
|
||||
//- Reflection model
|
||||
autoPtr<reflectionModel> reflection_;
|
||||
reflectionModelTable reflections_;
|
||||
|
||||
//- Reflection switch
|
||||
bool reflectionSwitch_;
|
||||
|
||||
//- Phase in which the particles are inserted
|
||||
word initialPhase_;
|
||||
|
||||
//- Phase name for absorbing medium 1
|
||||
word alpha1_;
|
||||
|
||||
//- Phase name for absorbing medium 2
|
||||
word alpha2_;
|
||||
//- Alpha value at which reflection is set
|
||||
scalar alphaCut_;
|
||||
|
||||
|
||||
// Fields
|
||||
@ -177,6 +200,9 @@ private:
|
||||
//- Initialise
|
||||
void initialise();
|
||||
|
||||
//- Initialise reflection model
|
||||
void initialiseReflection();
|
||||
|
||||
//- Calculate Intensity of the laser at p(t, theta) [W/m2]
|
||||
scalar calculateIp(scalar r, scalar theta);
|
||||
|
||||
@ -188,15 +214,6 @@ private:
|
||||
) const;
|
||||
|
||||
|
||||
//- Indicator of the proximity of the interface
|
||||
// Field values are 1 near and 0 away for the interface.
|
||||
tmp<volScalarField> nearInterface
|
||||
(
|
||||
const volScalarField& alpha1,
|
||||
const volScalarField& alpha2
|
||||
) const;
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
laserDTRM(const laserDTRM&);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -85,7 +85,8 @@ Foam::radiation::localDensityAbsorptionEmission::localDensityAbsorptionEmission
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::radiation::localDensityAbsorptionEmission::~localDensityAbsorptionEmission()
|
||||
Foam::radiation::localDensityAbsorptionEmission::
|
||||
~localDensityAbsorptionEmission()
|
||||
{}
|
||||
|
||||
|
||||
@ -109,11 +110,11 @@ Foam::radiation::localDensityAbsorptionEmission::aCont(const label bandI) const
|
||||
false
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("zero", dimless/dimLength, 0)
|
||||
dimensionedScalar("zero", inv(dimLength), 0)
|
||||
)
|
||||
);
|
||||
|
||||
scalarField& a = ta.ref().primitiveFieldRef();
|
||||
volScalarField& a = ta.ref();
|
||||
|
||||
forAll(alphaNames_, i)
|
||||
{
|
||||
@ -142,11 +143,11 @@ Foam::radiation::localDensityAbsorptionEmission::eCont(const label bandI) const
|
||||
false
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("zero", dimless/dimLength, 0)
|
||||
dimensionedScalar("zero", inv(dimLength), 0)
|
||||
)
|
||||
);
|
||||
|
||||
scalarField& e = te.ref().primitiveFieldRef();
|
||||
volScalarField& e = te.ref();
|
||||
|
||||
forAll(alphaNames_, i)
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -53,8 +53,7 @@ Foam::radiation::FresnelLaser::FresnelLaser
|
||||
)
|
||||
:
|
||||
reflectionModel(dict, mesh),
|
||||
coeffsDict_(dict.subDict(typeName + "Coeffs")),
|
||||
epsilon_(readScalar(coeffsDict_.lookup("epsilon")))
|
||||
epsilon_(readScalar(dict.lookup("epsilon")))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,10 +25,14 @@ Class
|
||||
Foam::radiation::FresnelLaser
|
||||
|
||||
Description
|
||||
Modified Fresnel FresnelLaser reflection model.
|
||||
|
||||
Modified Fresnel reflection model.
|
||||
|
||||
\verbatim
|
||||
Implementation of real-time multiple reflection and Fresnel absorption
|
||||
of FresnelLaser beam in keyhole.
|
||||
J. Phys. D: Appl. Phys. 39 (2006) 5372-5378
|
||||
\endverbatim
|
||||
|
||||
SourceFiles
|
||||
FresnelLaser.C
|
||||
@ -58,10 +62,6 @@ class FresnelLaser
|
||||
|
||||
// Private data
|
||||
|
||||
//- Coefficients dictionary
|
||||
dictionary coeffsDict_;
|
||||
|
||||
|
||||
//- Model constant
|
||||
scalar epsilon_;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,7 +36,7 @@ New
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
const word modelType(dict.lookup("reflectionModel"));
|
||||
const word modelType(dict.lookup("type"));
|
||||
|
||||
Info<< "Selecting reflectionModel " << modelType << endl;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -75,7 +75,7 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getSpecieMassFraction
|
||||
const multiComponentMixture<ThermoType>& mixture
|
||||
) const
|
||||
{
|
||||
const fvMesh& mesh = thermo_.p().mesh();
|
||||
const fvMesh& mesh = fromThermo_.p().mesh();
|
||||
|
||||
tmp<volScalarField> tY
|
||||
(
|
||||
@ -111,7 +111,7 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getSpecieMassFraction
|
||||
const pureMixture<ThermoType>& mixture
|
||||
) const
|
||||
{
|
||||
const fvMesh& mesh = thermo_.p().mesh();
|
||||
const fvMesh& mesh = fromThermo_.p().mesh();
|
||||
|
||||
tmp<volScalarField> tY
|
||||
(
|
||||
@ -143,7 +143,7 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::MwMixture
|
||||
const pureMixture<ThermoType>& mixture
|
||||
) const
|
||||
{
|
||||
const fvMesh& mesh = thermo_.p().mesh();
|
||||
const fvMesh& mesh = fromThermo_.p().mesh();
|
||||
|
||||
tmp<volScalarField> tM
|
||||
(
|
||||
@ -194,25 +194,25 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::InterfaceCompositionModel
|
||||
)
|
||||
:
|
||||
interfaceCompositionModel(dict, pair),
|
||||
thermo_
|
||||
fromThermo_
|
||||
(
|
||||
pair.phase1().mesh().lookupObject<Thermo>
|
||||
pair.from().mesh().lookupObject<Thermo>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
basicThermo::dictName,
|
||||
pair.dispersed().name()
|
||||
pair.from().name()
|
||||
)
|
||||
)
|
||||
),
|
||||
otherThermo_
|
||||
toThermo_
|
||||
(
|
||||
pair.phase2().mesh().lookupObject<OtherThermo>
|
||||
pair.to().mesh().lookupObject<OtherThermo>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
basicThermo::dictName,
|
||||
pair.continuous().name()
|
||||
pair.to().name()
|
||||
)
|
||||
)
|
||||
),
|
||||
@ -237,16 +237,16 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::D
|
||||
const word& speciesName
|
||||
) const
|
||||
{
|
||||
const typename Thermo::thermoType& localThermo =
|
||||
const typename Thermo::thermoType& fromThermo =
|
||||
getLocalThermo
|
||||
(
|
||||
speciesName,
|
||||
thermo_
|
||||
fromThermo_
|
||||
);
|
||||
|
||||
const volScalarField& p(thermo_.p());
|
||||
const volScalarField& p(fromThermo_.p());
|
||||
|
||||
const volScalarField& T(thermo_.T());
|
||||
const volScalarField& T(fromThermo_.T());
|
||||
|
||||
tmp<volScalarField> tmpD
|
||||
(
|
||||
@ -268,8 +268,8 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::D
|
||||
forAll(p, cellI)
|
||||
{
|
||||
D[cellI] =
|
||||
localThermo.alphah(p[cellI], T[cellI])
|
||||
/localThermo.rho(p[cellI], T[cellI]);
|
||||
fromThermo.alphah(p[cellI], T[cellI])
|
||||
/fromThermo.rho(p[cellI], T[cellI]);
|
||||
}
|
||||
|
||||
D /= Le_;
|
||||
@ -287,20 +287,20 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::L
|
||||
const volScalarField& Tf
|
||||
) const
|
||||
{
|
||||
const typename Thermo::thermoType& localThermo =
|
||||
const typename Thermo::thermoType& fromThermo =
|
||||
getLocalThermo
|
||||
(
|
||||
speciesName,
|
||||
thermo_
|
||||
fromThermo_
|
||||
);
|
||||
const typename OtherThermo::thermoType& otherLocalThermo =
|
||||
const typename OtherThermo::thermoType& toThermo =
|
||||
getLocalThermo
|
||||
(
|
||||
speciesName,
|
||||
otherThermo_
|
||||
toThermo_
|
||||
);
|
||||
|
||||
const volScalarField& p(thermo_.p());
|
||||
const volScalarField& p(fromThermo_.p());
|
||||
|
||||
tmp<volScalarField> tmpL
|
||||
(
|
||||
@ -320,12 +320,10 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::L
|
||||
|
||||
volScalarField& L = tmpL.ref();
|
||||
|
||||
// localThermo (dispersed)(from)
|
||||
// otherLocalThermo (continuous)(to)
|
||||
// to - from
|
||||
// from Thermo (from) to Thermo (to)
|
||||
forAll(p, cellI)
|
||||
{
|
||||
L[cellI] = localThermo.Hc() - otherLocalThermo.Hc();
|
||||
L[cellI] = fromThermo.Hc() - toThermo.Hc();
|
||||
}
|
||||
|
||||
L.correctBoundaryConditions();
|
||||
@ -334,47 +332,6 @@ Foam::InterfaceCompositionModel<Thermo, OtherThermo>::L
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::HcSource
|
||||
(
|
||||
const word& speciesName
|
||||
) const
|
||||
{
|
||||
const typename Thermo::thermoType& localThermo =
|
||||
getLocalThermo
|
||||
(
|
||||
speciesName,
|
||||
thermo_
|
||||
);
|
||||
|
||||
const volScalarField& p(thermo_.p());
|
||||
tmp<volScalarField> tmpL
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("L", pair_.name()),
|
||||
p.time().timeName(),
|
||||
p.mesh()
|
||||
),
|
||||
p.mesh(),
|
||||
dimensionedScalar("zero", dimEnergy/dimMass, 0)
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& Hc = tmpL.ref();
|
||||
|
||||
forAll(p, cellI)
|
||||
{
|
||||
Hc[cellI] = localThermo.Hc();
|
||||
}
|
||||
|
||||
return tmpL;
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::dY
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -49,7 +49,7 @@ template <class ThermoType> class pureMixture;
|
||||
template <class ThermoType> class multiComponentMixture;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class InterfaceCompositionModel Declaration
|
||||
Class InterfaceCompositionModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
@ -61,11 +61,11 @@ protected:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Thermo (dispersed)(from)
|
||||
const Thermo& thermo_;
|
||||
//- Thermo (from)
|
||||
const Thermo& fromThermo_;
|
||||
|
||||
//- Other Thermo (continuous)(to)
|
||||
const OtherThermo& otherThermo_;
|
||||
//- Other Thermo (to)
|
||||
const OtherThermo& toThermo_;
|
||||
|
||||
//- Lewis number
|
||||
const dimensionedScalar Le_;
|
||||
@ -128,11 +128,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
InterfaceCompositionModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
);
|
||||
InterfaceCompositionModel(const dictionary& dict, const phasePair& pair);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -167,13 +163,6 @@ public:
|
||||
const word& speciesName,
|
||||
const volScalarField& Tf
|
||||
) const;
|
||||
|
||||
//- Heat of formation (Hc) from source phase (thermo)
|
||||
virtual tmp<volScalarField> HcSource
|
||||
(
|
||||
const word& speciesName
|
||||
) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -183,7 +172,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Instantiation for multi-component (dispersed) to single-component (continuous)
|
||||
// Instantiation for multi-component (from) to single-component (to)
|
||||
#define makeInterfaceDispSpecieMixtureType(Type, Thermo, Comp, Mix, Phys, OtherThermo, OtherComp, OtherMix, OtherPhys)\
|
||||
\
|
||||
typedef Thermo<Comp, SpecieMixture<Mix<Phys> > > \
|
||||
@ -201,7 +190,7 @@ public:
|
||||
)
|
||||
|
||||
|
||||
// Instantiation for single-component (dispersed) to multi-component (continuous)
|
||||
// Instantiation for single-component (from) to multi-component (to)
|
||||
#define makeInterfaceContSpecieMixtureType(Type, Thermo, Comp, Mix, Phys, OtherThermo, OtherComp, OtherMix, OtherPhys)\
|
||||
\
|
||||
typedef Thermo<Comp, Mix<Phys> > \
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,7 +25,6 @@ License
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "thermoPhysicsTypes.H"
|
||||
@ -48,8 +47,7 @@ License
|
||||
#include "solidThermoPhysicsTypes.H"
|
||||
|
||||
#include "kineticGasEvaporation.H"
|
||||
#include "constantMelting.H"
|
||||
#include "constantSolidification.H"
|
||||
#include "Lee.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -66,7 +64,7 @@ namespace Foam
|
||||
>,
|
||||
sensibleEnthalpy
|
||||
>
|
||||
> constFluidHThermoPhysics;
|
||||
> constRhoHThermoPhysics;
|
||||
|
||||
|
||||
typedef
|
||||
@ -91,34 +89,32 @@ namespace Foam
|
||||
{
|
||||
using namespace meltingEvaporationModels;
|
||||
|
||||
//NOTE: First thermo (dispersed) and second otherThermo (continous)
|
||||
// in the phaseProperties: (dispersed to continous)
|
||||
//NOTE: First thermo (from) and second otherThermo (to)
|
||||
|
||||
// kineticGasEvaporation model definitions
|
||||
/*
|
||||
// multi-component dispersed phase and a pure continous phase
|
||||
makeInterfaceDispSpecieMixtureType
|
||||
(
|
||||
kineticGasEvaporation,
|
||||
heRhoThermo,
|
||||
rhoReactionThermo,
|
||||
multiComponentMixture,
|
||||
constIncompressibleGasHThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constFluidHThermoPhysics
|
||||
);
|
||||
*/
|
||||
|
||||
// pure dispersed phase to a multi-component continous phase
|
||||
// From pure liquid (rhoConst) to a multi-component gas incomp phase
|
||||
makeInterfaceContSpecieMixtureType
|
||||
(
|
||||
kineticGasEvaporation,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constFluidHThermoPhysics,
|
||||
constRhoHThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoReactionThermo,
|
||||
multiComponentMixture,
|
||||
constIncompressibleGasHThermoPhysics
|
||||
);
|
||||
|
||||
// From pure liquid (BoussinesqFluid) to a multi-component gas incomp phase
|
||||
makeInterfaceContSpecieMixtureType
|
||||
(
|
||||
kineticGasEvaporation,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
BoussinesqFluidEThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoReactionThermo,
|
||||
multiComponentMixture,
|
||||
@ -126,58 +122,88 @@ namespace Foam
|
||||
);
|
||||
|
||||
|
||||
// pure dispersed phase and pure continous phase with incompressible gas
|
||||
// From pure liquid (rhoConst) to pure gas (incompressible ideal gas)
|
||||
makeInterfacePureType
|
||||
(
|
||||
kineticGasEvaporation,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constIncompressibleGasHThermoPhysics,
|
||||
constRhoHThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constFluidHThermoPhysics
|
||||
constIncompressibleGasHThermoPhysics
|
||||
);
|
||||
|
||||
// pure dispersed phase and pure continous phase with rhoConst gas
|
||||
// From pure liquid (const rho) to pure gas (rhoConst) gas
|
||||
makeInterfacePureType
|
||||
(
|
||||
kineticGasEvaporation,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constFluidHThermoPhysics,
|
||||
constRhoHThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constFluidHThermoPhysics
|
||||
constRhoHThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
// constantMelting model definitions
|
||||
|
||||
// pure dispersed phase and a pure continous phase
|
||||
// From pure liquid (Boussinesq) to pure gas (incompressible ideal gas)
|
||||
makeInterfacePureType
|
||||
(
|
||||
constantMelting,
|
||||
kineticGasEvaporation,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constFluidHThermoPhysics,
|
||||
BoussinesqFluidEThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constFluidHThermoPhysics
|
||||
constIncompressibleGasHThermoPhysics
|
||||
);
|
||||
|
||||
// From pure liquid (Boussinesq) to pure gas (rho const)
|
||||
makeInterfacePureType
|
||||
(
|
||||
constantMelting,
|
||||
kineticGasEvaporation,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constFluidHThermoPhysics,
|
||||
BoussinesqFluidEThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constRhoHThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
// Lee model definitions
|
||||
|
||||
// From pure phase (rho const) to phase (rho const)
|
||||
makeInterfacePureType
|
||||
(
|
||||
Lee,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constRhoHThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constRhoHThermoPhysics
|
||||
);
|
||||
|
||||
// From pure phase (rho const) to phase (Boussinesq)
|
||||
makeInterfacePureType
|
||||
(
|
||||
Lee,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constRhoHThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
@ -185,9 +211,10 @@ namespace Foam
|
||||
);
|
||||
|
||||
|
||||
// From pure phase (solidThermo) to phase (Boussinesq)
|
||||
makeInterfacePureType
|
||||
(
|
||||
constantMelting,
|
||||
Lee,
|
||||
heSolidThermo,
|
||||
solidThermo,
|
||||
pureMixture,
|
||||
@ -198,66 +225,40 @@ namespace Foam
|
||||
BoussinesqFluidEThermoPhysics
|
||||
);
|
||||
|
||||
// From pure phase (solidThermo) to phase (rho const)
|
||||
makeInterfacePureType
|
||||
(
|
||||
constantMelting,
|
||||
Lee,
|
||||
heSolidThermo,
|
||||
solidThermo,
|
||||
pureMixture,
|
||||
hConstSolidThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constFluidHThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constIncompressibleGasHThermoPhysics
|
||||
constRhoHThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
// From pure phase (const rho) to multi phase (incomp ideal gas)
|
||||
makeInterfaceContSpecieMixtureType
|
||||
(
|
||||
constantMelting,
|
||||
Lee,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constFluidHThermoPhysics,
|
||||
constRhoHThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoReactionThermo,
|
||||
multiComponentMixture,
|
||||
constIncompressibleGasHThermoPhysics
|
||||
);
|
||||
|
||||
/*
|
||||
makeInterfaceDispSpecieMixtureType
|
||||
(
|
||||
constantMelting,
|
||||
heRhoThermo,
|
||||
rhoReactionThermo,
|
||||
multiComponentMixture,
|
||||
constIncompressibleGasHThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constFluidHThermoPhysics
|
||||
);
|
||||
*/
|
||||
// constantSolidification model definitions
|
||||
|
||||
// pure dispersed phase and a pure continous phase
|
||||
// From pure phase (Boussinesq) to phase (solidThermo)
|
||||
makeInterfacePureType
|
||||
(
|
||||
constantSolidification,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constFluidHThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constFluidHThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
makeInterfacePureType
|
||||
(
|
||||
constantSolidification,
|
||||
Lee,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
@ -268,65 +269,19 @@ namespace Foam
|
||||
hConstSolidThermoPhysics
|
||||
);
|
||||
|
||||
/*
|
||||
// saturatedEvaporation model definitions
|
||||
|
||||
// multi-component dispersed phase and a pure continous phase
|
||||
makeInterfaceDispSpecieMixtureType
|
||||
(
|
||||
saturatedEvaporation,
|
||||
heRhoThermo,
|
||||
rhoReactionThermo,
|
||||
multiComponentMixture,
|
||||
constIncompressibleGasHThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constFluidHThermoPhysics
|
||||
);
|
||||
|
||||
// pure dispersed phase and a multi-component continous phase
|
||||
makeInterfaceContSpecieMixtureType
|
||||
(
|
||||
saturatedEvaporation,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constFluidHThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoReactionThermo,
|
||||
multiComponentMixture,
|
||||
constIncompressibleGasHThermoPhysics
|
||||
);
|
||||
|
||||
// multi-component dispersed phase and a multi-componen continous phase
|
||||
makeSpecieInterfaceSpecieMixtures
|
||||
(
|
||||
saturatedEvaporation,
|
||||
heRhoThermo,
|
||||
rhoReactionThermo,
|
||||
multiComponentMixture,
|
||||
constIncompressibleGasHThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoReactionThermo,
|
||||
multiComponentMixture,
|
||||
constIncompressibleGasHThermoPhysics
|
||||
);
|
||||
|
||||
// pure dispersed phase and pure continous phase
|
||||
// From pure phase (rho const) to phase (solidThermo)
|
||||
makeInterfacePureType
|
||||
(
|
||||
saturatedEvaporation,
|
||||
Lee,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constIncompressibleGasHThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
constRhoHThermoPhysics,
|
||||
heSolidThermo,
|
||||
solidThermo,
|
||||
pureMixture,
|
||||
constIncompressibleGasHThermoPhysics
|
||||
hConstSolidThermoPhysics
|
||||
);
|
||||
*/
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -23,23 +23,23 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "constantSolidification.H"
|
||||
#include "Lee.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::meltingEvaporationModels::constantSolidification<Thermo, OtherThermo>
|
||||
::constantSolidification
|
||||
Foam::meltingEvaporationModels::Lee<Thermo, OtherThermo>::Lee
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
)
|
||||
:
|
||||
InterfaceCompositionModel<Thermo, OtherThermo>(dict, pair),
|
||||
C_("C", inv(dimTime)*inv(dimTemperature), dict.lookup("C")),
|
||||
Tactivate_("Tactivate", dimTemperature, dict.lookup("Tactivate"))
|
||||
C_("C", inv(dimTime), dict.lookup("C")),
|
||||
Tactivate_("Tactivate", dimTemperature, dict.lookup("Tactivate")),
|
||||
alphaMin_(dict.lookupOrDefault<scalar>("alphaMin", 0.0))
|
||||
{}
|
||||
|
||||
|
||||
@ -47,51 +47,41 @@ Foam::meltingEvaporationModels::constantSolidification<Thermo, OtherThermo>
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::meltingEvaporationModels::constantSolidification<Thermo, OtherThermo>
|
||||
::Kexp(label variable, const volScalarField& field) const
|
||||
Foam::meltingEvaporationModels::Lee<Thermo, OtherThermo>
|
||||
::Kexp(label variable, const volScalarField& refValue)
|
||||
{
|
||||
if (this->modelVariable_ == variable)
|
||||
{
|
||||
volScalarField limitedDispersed
|
||||
volScalarField from
|
||||
(
|
||||
min(max(this->pair().dispersed(), scalar(0)), scalar(1))
|
||||
min(max(this->pair().from(), scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
return
|
||||
(
|
||||
C_
|
||||
* limitedDispersed
|
||||
* this->pair().dispersed().rho()
|
||||
* (Tactivate_ - field.oldTime())
|
||||
* pos(Tactivate_ - field.oldTime())
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return tmp<volScalarField> ();
|
||||
}
|
||||
}
|
||||
if (sign(C_.value()) > 0)
|
||||
{
|
||||
return
|
||||
(
|
||||
C_
|
||||
* from
|
||||
* this->pair().from().rho()
|
||||
* (refValue.oldTime() - Tactivate_)
|
||||
* pos(from - alphaMin_)
|
||||
* pos(refValue.oldTime() - Tactivate_)/Tactivate_
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return
|
||||
(
|
||||
-C_
|
||||
* from
|
||||
* this->pair().from().rho()
|
||||
* pos(from - alphaMin_)
|
||||
* (Tactivate_ - refValue.oldTime())
|
||||
* pos(Tactivate_ - refValue.oldTime())/Tactivate_
|
||||
);
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::meltingEvaporationModels::constantSolidification<Thermo, OtherThermo>
|
||||
::Kimp(label variable, const volScalarField& field) const
|
||||
{
|
||||
if (this->modelVariable_ == variable)
|
||||
{
|
||||
volScalarField limitedDispersed
|
||||
(
|
||||
min(max(this->pair().dispersed(), scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
return
|
||||
(
|
||||
C_
|
||||
*limitedDispersed
|
||||
*this->pair().dispersed().rho()
|
||||
*pos(Tactivate_ - field.oldTime())
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -102,20 +92,11 @@ Foam::meltingEvaporationModels::constantSolidification<Thermo, OtherThermo>
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
const Foam::dimensionedScalar&
|
||||
Foam::meltingEvaporationModels::constantSolidification<Thermo, OtherThermo>
|
||||
Foam::meltingEvaporationModels::Lee<Thermo, OtherThermo>
|
||||
::Tactivate() const
|
||||
{
|
||||
return Tactivate_;
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::label
|
||||
Foam::meltingEvaporationModels::constantSolidification<Thermo, OtherThermo>
|
||||
::dSdVariable()
|
||||
{
|
||||
return label(-1);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -22,21 +22,71 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::phaseChangeTwoPhaseMixtures::constantSolidification
|
||||
Foam::phaseChangeTwoPhaseMixtures::Lee
|
||||
|
||||
Description
|
||||
Solidification model. Simple model driven by temperature as:
|
||||
Mass tranfer Lee model. Simple model driven by field value difference as:
|
||||
|
||||
mSol = C*rho*alpha*(T - Tsolification)
|
||||
\f[
|
||||
mDot = C \rho \alpha (\T - T_{activate})/T_{activate}
|
||||
\f]
|
||||
|
||||
where C is a model constant.
|
||||
|
||||
if C > 0:
|
||||
\f[
|
||||
mDot = C \rho \alpha*(\T - T_{activate})/T_{activate}
|
||||
\f]
|
||||
for \f[ T > T_{activate} \f]
|
||||
|
||||
and
|
||||
|
||||
\f[ mDot = 0.0 \f] for \f[ T < T_{activate} \f]
|
||||
|
||||
|
||||
if C < 0:
|
||||
\f[
|
||||
mDot = -C \rho \alpha (T_{activate} - \T)/T_{activate}
|
||||
\f]
|
||||
for \f[ T < T_{activate} \f]
|
||||
|
||||
and
|
||||
\f[ mDot = 0.0 \f] for \f[ T > T_{activate} \f]
|
||||
|
||||
Based on the reference:
|
||||
-# W. H. Lee. "A Pressure Iteration Scheme for Two-Phase Modeling".
|
||||
Technical Report LA-UR 79-975. Los Alamos Scientific Laboratory,
|
||||
Los Alamos, New Mexico. 1979.
|
||||
|
||||
Usage
|
||||
Example usage:
|
||||
\verbatim
|
||||
massTransferModel
|
||||
(
|
||||
(solid to liquid)
|
||||
{
|
||||
type Lee;
|
||||
C 40;
|
||||
Tactivate 302.78;
|
||||
}
|
||||
);
|
||||
\endverbatim
|
||||
|
||||
Where:
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
Tactivate | Activation temperature | yes
|
||||
C | Model constant | yes
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
constantSolidification.C
|
||||
Lee.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef constantSolidification_H
|
||||
#define constantSolidification_H
|
||||
#ifndef Lee_H
|
||||
#define Lee_H
|
||||
|
||||
#include "InterfaceCompositionModel.H"
|
||||
|
||||
@ -49,33 +99,36 @@ namespace meltingEvaporationModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class constantSolidification
|
||||
Class Lee
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
class constantSolidification
|
||||
class Lee
|
||||
:
|
||||
public InterfaceCompositionModel<Thermo, OtherThermo>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Condensation coefficient [1/s/K]
|
||||
//- Condensation coefficient [1/s]
|
||||
dimensionedScalar C_;
|
||||
|
||||
//- Phase transition temperature
|
||||
const dimensionedScalar Tactivate_;
|
||||
|
||||
//- Phase minimum value for activation
|
||||
scalar alphaMin_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("constantSolidification");
|
||||
TypeName("Lee");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
constantSolidification
|
||||
Lee
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
@ -83,7 +136,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~constantSolidification()
|
||||
virtual ~Lee()
|
||||
{}
|
||||
|
||||
|
||||
@ -94,22 +147,11 @@ public:
|
||||
(
|
||||
label variable,
|
||||
const volScalarField& field
|
||||
) const;
|
||||
|
||||
//- Semi implicit species mass transfer coefficient
|
||||
virtual tmp<volScalarField> Kimp
|
||||
(
|
||||
label variable,
|
||||
const volScalarField& field
|
||||
) const;
|
||||
);
|
||||
|
||||
//- Return T transition between phases
|
||||
virtual const dimensionedScalar& Tactivate() const;
|
||||
|
||||
//- Derivate sign of the source term:
|
||||
// d(Sk-i)/d(variable) > 0 or d(Si-k)/d(variable) < 0
|
||||
virtual label dSdVariable();
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -121,7 +163,7 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "constantSolidification.C"
|
||||
# include "Lee.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -0,0 +1,5 @@
|
||||
interfaceCompositionModel/interfaceCompositionModel.C
|
||||
interfaceCompositionModel/newInterfaceCompositionModel.C
|
||||
InterfaceCompositionModel/InterfaceCompositionModels.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libmassTransferModels
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,7 +27,6 @@ License
|
||||
#include "phaseModel.H"
|
||||
#include "phasePair.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -69,11 +68,18 @@ Foam::interfaceCompositionModel::interfaceCompositionModel
|
||||
const phasePair& pair
|
||||
)
|
||||
:
|
||||
modelVariable_(modelVariableNames.read(dict.lookup("variable"))),
|
||||
semiImplicit_(readBool(dict.lookup("semiImplicit"))),
|
||||
modelVariable_
|
||||
(
|
||||
modelVariableNames.lookupOrDefault
|
||||
(
|
||||
"variable",
|
||||
dict,
|
||||
modelVariable::T
|
||||
)
|
||||
),
|
||||
pair_(pair),
|
||||
speciesNames_(dict.lookup("species")),
|
||||
mesh_(pair_.dispersed().mesh())
|
||||
speciesName_(dict.lookupOrDefault<word>("species", "none")),
|
||||
mesh_(pair_.from().mesh())
|
||||
{}
|
||||
|
||||
|
||||
@ -85,9 +91,9 @@ Foam::interfaceCompositionModel::~interfaceCompositionModel()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::hashedWordList& Foam::interfaceCompositionModel::species() const
|
||||
const Foam::word Foam::interfaceCompositionModel::transferSpecie() const
|
||||
{
|
||||
return speciesNames_;
|
||||
return speciesName_;
|
||||
}
|
||||
|
||||
|
||||
@ -97,42 +103,9 @@ const Foam::phasePair& Foam::interfaceCompositionModel::pair() const
|
||||
}
|
||||
|
||||
|
||||
bool Foam::interfaceCompositionModel::transports
|
||||
(
|
||||
word& speciesName
|
||||
) const
|
||||
{
|
||||
if (this->speciesNames_.contains(speciesName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const Foam::word Foam::interfaceCompositionModel::variable() const
|
||||
{
|
||||
return modelVariableNames[modelVariable_];
|
||||
}
|
||||
|
||||
|
||||
bool Foam::interfaceCompositionModel::semiImplicit() const
|
||||
{
|
||||
return semiImplicit_;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::interfaceCompositionModel::KexpEnergy
|
||||
(
|
||||
label modelVariable,
|
||||
const volScalarField& field
|
||||
)
|
||||
const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<volScalarField>();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,9 +25,9 @@ Class
|
||||
Foam::interfaceCompositionModel
|
||||
|
||||
Description
|
||||
Generic base class for interface composition models. These models describe
|
||||
the composition in phase 1 of the supplied pair at the interface with phase
|
||||
2.
|
||||
Generic base class for interface models. Mass transer models are
|
||||
interface models between two thermos.
|
||||
Abstract class for mass transfer functions
|
||||
|
||||
SourceFiles
|
||||
interfaceCompositionModel.C
|
||||
@ -43,6 +43,7 @@ SourceFiles
|
||||
#include "dictionary.H"
|
||||
#include "hashedWordList.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "NamedEnum.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
@ -73,9 +74,6 @@ public:
|
||||
//- Enumeration for model variables
|
||||
modelVariable modelVariable_;
|
||||
|
||||
//- Semi-Implicit or Explicit model
|
||||
bool semiImplicit_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
@ -84,8 +82,8 @@ protected:
|
||||
//- Phase pair
|
||||
const phasePair& pair_;
|
||||
|
||||
//- Names of the transferring species
|
||||
const hashedWordList speciesNames_;
|
||||
//- Names of the transferring specie
|
||||
word speciesName_;
|
||||
|
||||
//- Reference to mesh
|
||||
const fvMesh& mesh_;
|
||||
@ -138,16 +136,12 @@ public:
|
||||
// Member Functions
|
||||
|
||||
|
||||
//- Return the transferring species names
|
||||
const hashedWordList& species() const;
|
||||
//- Return the transferring species name
|
||||
const word transferSpecie() const;
|
||||
|
||||
//- Return pair
|
||||
const phasePair& pair() const;
|
||||
|
||||
//- Returns whether the species is transported by the model and
|
||||
// provides the name of the diffused species
|
||||
bool transports(word& speciesName) const;
|
||||
|
||||
//- Interface mass fraction
|
||||
virtual tmp<volScalarField> Yf
|
||||
(
|
||||
@ -175,33 +169,12 @@ public:
|
||||
const volScalarField& Tf
|
||||
) const = 0;
|
||||
|
||||
//- Heat of formation (Hc) from source phase
|
||||
virtual tmp<volScalarField> HcSource
|
||||
(
|
||||
const word& speciesName
|
||||
) const = 0;
|
||||
|
||||
//- Explicit mass transfer coefficient
|
||||
virtual tmp<volScalarField> Kexp
|
||||
(
|
||||
label modelVariable,
|
||||
const volScalarField& field
|
||||
) const = 0;
|
||||
|
||||
//- Implicit mass transfer coefficient of the shape
|
||||
// Kimp*(variable - refValue)
|
||||
virtual tmp<volScalarField> Kimp
|
||||
(
|
||||
label modelVariable,
|
||||
const volScalarField& field
|
||||
) const = 0;
|
||||
|
||||
//- Explicit mass transfer for energy
|
||||
virtual tmp<volScalarField> KexpEnergy
|
||||
(
|
||||
label modelVariable,
|
||||
const volScalarField& field
|
||||
) const;
|
||||
) = 0;
|
||||
|
||||
//- Reference value
|
||||
virtual const dimensionedScalar& Tactivate() const = 0;
|
||||
@ -209,16 +182,6 @@ public:
|
||||
//- Returns the variable on which the model is based
|
||||
const word variable() const;
|
||||
|
||||
//- Returns type of model. false is fully Explicit
|
||||
// true is treated semiImplicit as :
|
||||
// Sk-i = Kimp()(variable - Tactivate) for positive k to i
|
||||
// Si-k = Kimp()(Tactivate - variable) for positive i to k
|
||||
bool semiImplicit() const;
|
||||
|
||||
//- Derivate sign of the source term:
|
||||
// d(Sk-i)/d(variable) > 0 or d(Si-k)/d(variable) < 0
|
||||
virtual label dSdVariable() = 0;
|
||||
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -0,0 +1,276 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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 "kineticGasEvaporation.H"
|
||||
#include "constants.H"
|
||||
#include "fvcGrad.H"
|
||||
#include "fvcSnGrad.H"
|
||||
#include "fvcDiv.H"
|
||||
#include "surfaceInterpolate.H"
|
||||
#include "fvcReconstruct.H"
|
||||
#include "fvm.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
|
||||
using namespace Foam::constant;
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>
|
||||
::kineticGasEvaporation
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
)
|
||||
:
|
||||
InterfaceCompositionModel<Thermo, OtherThermo>(dict, pair),
|
||||
C_("C", dimless, dict.lookup("C")),
|
||||
Tactivate_
|
||||
(
|
||||
"Tactivate",
|
||||
dimTemperature,
|
||||
dict.lookup("Tactivate")
|
||||
),
|
||||
Mv_
|
||||
(
|
||||
"Mv",
|
||||
dimMass/dimMoles,
|
||||
dict.lookupOrDefault<scalar>("Mv", -1)
|
||||
),
|
||||
alphaMax_(dict.lookupOrDefault<scalar>("alphaMax", 1.0)),
|
||||
alphaMin_(dict.lookupOrDefault<scalar>("alphaMin", 0.5)),
|
||||
alphaRestMax_(dict.lookupOrDefault<scalar>("alphaRestMax", 0.01))
|
||||
{
|
||||
if (this->transferSpecie() != "none")
|
||||
{
|
||||
word fullSpeciesName = this->transferSpecie();
|
||||
auto tempOpen = fullSpeciesName.find('.');
|
||||
const word speciesName(fullSpeciesName.substr(0, tempOpen));
|
||||
|
||||
// Get the "to" thermo
|
||||
const typename OtherThermo::thermoType& toThermo =
|
||||
this->getLocalThermo
|
||||
(
|
||||
speciesName,
|
||||
this->toThermo_
|
||||
);
|
||||
|
||||
// Convert from g/mol to Kg/mol
|
||||
Mv_.value() = toThermo.W()*1e-3;
|
||||
}
|
||||
|
||||
|
||||
if (Mv_.value() == -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< " Please provide the molar weight (Mv) of vapour [g/mol] "
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>
|
||||
::Kexp(label variable, const volScalarField& field)
|
||||
{
|
||||
if (this->modelVariable_ == variable)
|
||||
{
|
||||
const volScalarField& to = this->pair().to();
|
||||
|
||||
const volScalarField& from = this->pair().from();
|
||||
|
||||
const fvMesh& mesh = this->mesh_;
|
||||
|
||||
const volScalarField& T =
|
||||
mesh.lookupObject<volScalarField>("T").oldTime();
|
||||
|
||||
const dimensionedScalar HerztKnudsConst
|
||||
(
|
||||
sqrt
|
||||
(
|
||||
Mv_
|
||||
/2.0
|
||||
/constant::physicoChemical::R
|
||||
/mathematical::pi
|
||||
/pow3(Tactivate_)
|
||||
)
|
||||
);
|
||||
|
||||
word fullSpeciesName = this->transferSpecie();
|
||||
auto tempOpen = fullSpeciesName.find('.');
|
||||
const word speciesName(fullSpeciesName.substr(0, tempOpen));
|
||||
|
||||
tmp<volScalarField> L = this->L(speciesName, field);
|
||||
|
||||
const volVectorField gradFrom(fvc::grad(from));
|
||||
const volVectorField gradTo(fvc::grad(to));
|
||||
|
||||
const volScalarField areaDensity
|
||||
(
|
||||
"areaDensity", mag(gradFrom)
|
||||
);
|
||||
|
||||
const volScalarField gradAlphaf(gradFrom & gradTo);
|
||||
|
||||
volScalarField Tmask("Tmask", from*0.0);
|
||||
|
||||
forAll (Tmask, celli)
|
||||
{
|
||||
if (gradAlphaf[celli] < 0)
|
||||
{
|
||||
if (from[celli] > alphaMin_ && from[celli] < alphaMax_)
|
||||
{
|
||||
{
|
||||
scalar alphaRes = 1.0 - from[celli] - to[celli];
|
||||
if (alphaRes < alphaRestMax_)
|
||||
{
|
||||
Tmask[celli] = 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tmp<volScalarField> tRhom
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"trhom",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("zero", dimDensity, 0)
|
||||
)
|
||||
);
|
||||
volScalarField& rhom = tRhom.ref();
|
||||
|
||||
tmp<volScalarField> tTdelta
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"trhom",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("zero", dimTemperature, 0)
|
||||
)
|
||||
);
|
||||
volScalarField& tDelta = tTdelta.ref();
|
||||
|
||||
if (sign(C_.value()) > 0)
|
||||
{
|
||||
rhom =
|
||||
this->pair().to().rho()*this->pair().from().rho()
|
||||
/ (this->pair().from().rho() - this->pair().to().rho());
|
||||
|
||||
tDelta = max
|
||||
(
|
||||
(T*Tmask - Tactivate_),
|
||||
dimensionedScalar("T0", dimTemperature, 0.0)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
rhom =
|
||||
this->pair().to().rho()*this->pair().from().rho()
|
||||
/ (this->pair().to().rho() - this->pair().from().rho());
|
||||
|
||||
tDelta = max
|
||||
(
|
||||
Tmask*(Tactivate_ - T),
|
||||
dimensionedScalar("T0", dimTemperature, 0.0)
|
||||
);
|
||||
}
|
||||
|
||||
volScalarField massFluxEvap
|
||||
(
|
||||
"massFluxEvap",
|
||||
2*mag(C_)/(2 - mag(C_))
|
||||
* HerztKnudsConst
|
||||
* L()
|
||||
* rhom
|
||||
* tDelta
|
||||
);
|
||||
|
||||
// 'from' phase normalization
|
||||
// WIP: Normalization could be convinient for cases where the area were
|
||||
// the source term is calculated is uniform
|
||||
const dimensionedScalar Nl
|
||||
(
|
||||
gSum((areaDensity*mesh.V())())
|
||||
/(
|
||||
gSum
|
||||
(
|
||||
((areaDensity*from)*mesh.V())()
|
||||
)
|
||||
+ dimensionedScalar("SMALL", dimless, VSMALL)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
if (mesh.time().outputTime() && debug)
|
||||
{
|
||||
areaDensity.write();
|
||||
Tmask.write();
|
||||
volScalarField mKGasDot
|
||||
(
|
||||
"mKGasDot",
|
||||
massFluxEvap*areaDensity*Nl*from
|
||||
);
|
||||
mKGasDot.write();
|
||||
}
|
||||
|
||||
return massFluxEvap*areaDensity*Nl*from;
|
||||
}
|
||||
else
|
||||
{
|
||||
return tmp<volScalarField> ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
const Foam::dimensionedScalar&
|
||||
Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>
|
||||
::Tactivate() const
|
||||
{
|
||||
return Tactivate_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -25,7 +25,89 @@ Class
|
||||
Foam::phaseChangeTwoPhaseMixtures::kineticGasEvaporation
|
||||
|
||||
Description
|
||||
kineticGasEvaporation evaporation model.
|
||||
|
||||
Considering the Hertz Knudsen formula, which gives the evaporation-condensation
|
||||
flux based on the kinetic theory for flat interface:
|
||||
|
||||
\f[
|
||||
Flux = C sqrt(M/(2 \pi \R T_{activate}))(\p - pSat)
|
||||
\f]
|
||||
|
||||
where:
|
||||
\vartable
|
||||
Flux | mass flux rate [Kg/s/m2]
|
||||
M | molecular weight
|
||||
T_{activate} | saturation temperature
|
||||
C | accomodation coefficient
|
||||
R | universal gas constant
|
||||
pSat | saturation pressure
|
||||
\p | vapor partial pressure
|
||||
\endvartable
|
||||
|
||||
The Clapeyron-Clausius equation relates the pressure to the temperature
|
||||
for the saturation condition:
|
||||
|
||||
\f[
|
||||
dp/dT = - L / (T*(nuv - nul))
|
||||
\f]
|
||||
|
||||
where:
|
||||
\vartable
|
||||
L | latent heat
|
||||
nuv | inverse of the vapor density
|
||||
nul | inverse of the liquid density
|
||||
\endvartable
|
||||
|
||||
|
||||
Using the above relations:
|
||||
|
||||
\f[
|
||||
Flux =
|
||||
2 C/(2 - C)
|
||||
sqrt(M/(2 \pi \R T_{activate}))
|
||||
L (\rho_{v}*\rho_{l}/(\rho_{l} - \rho_{v}))
|
||||
(\T - T_{activate})/T_{activate}
|
||||
\f]
|
||||
|
||||
This assumes liquid and vapour are in equilibrium, then the accomodation
|
||||
coefficient are equivalent for the interface. This relation is known as the
|
||||
Hertz-Knudsen-Schrage.
|
||||
|
||||
Based on the reference:
|
||||
-# Van P. Carey, “Liquid-Vapor Phase Change Phenomena”, ISBN 0-89116836, 1992,
|
||||
pp. 112-121.
|
||||
|
||||
|
||||
Usage
|
||||
|
||||
Example usage:
|
||||
\verbatim
|
||||
massTransferModel
|
||||
(
|
||||
(liquid to gas)
|
||||
{
|
||||
type kineticGasEvaporation;
|
||||
species vapour.gas;
|
||||
C 0.1;
|
||||
alphaMin 0.0;
|
||||
alphaMax 0.2;
|
||||
Tactivate 373;
|
||||
}
|
||||
);
|
||||
\endverbatim
|
||||
|
||||
where:
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
C | Accomodation coefficient (C > 0 for evaporation, C < 0 for
|
||||
condensation) | yes
|
||||
alphaMin | Minimum value of alpha | no | 0.0
|
||||
alphaMax | Maximum values of alpha | no | 0.5
|
||||
Tactivate | Saturation temperature | yes
|
||||
species | Specie name on the other phase | yes
|
||||
\endtable
|
||||
|
||||
|
||||
|
||||
SourceFiles
|
||||
kineticGasEvaporation.C
|
||||
@ -37,7 +119,6 @@ SourceFiles
|
||||
|
||||
|
||||
#include "InterfaceCompositionModel.H"
|
||||
#include "saturationPressureModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
|
||||
|
||||
@ -69,23 +150,14 @@ class kineticGasEvaporation
|
||||
//- Molar weight of the vapour in the continous phase
|
||||
dimensionedScalar Mv_;
|
||||
|
||||
//- Pointer to saturation pressure model
|
||||
autoPtr<saturationPressureModel> saturationPressureModel_;
|
||||
//- 'To' phase maximum value for the mass transfer
|
||||
scalar alphaMax_;
|
||||
|
||||
//- Source
|
||||
mutable volScalarField phi0_;
|
||||
//- 'To' phase minumum value for the mass transfer
|
||||
scalar alphaMin_;
|
||||
|
||||
//- Spread source
|
||||
mutable volScalarField sPhi_;
|
||||
|
||||
//- Diffusivity for source term
|
||||
dimensionedScalar D_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Constant of propotionality between partial pressure and mass
|
||||
// fraction
|
||||
tmp<volScalarField> wRatio() const;
|
||||
//- Alpha maximum for the rest of phases
|
||||
scalar alphaRestMax_;
|
||||
|
||||
|
||||
public:
|
||||
@ -116,31 +188,11 @@ public:
|
||||
(
|
||||
label variable,
|
||||
const volScalarField& field
|
||||
) const;
|
||||
|
||||
//- Semi implicit species mass transfer coefficient
|
||||
virtual tmp<volScalarField> Kimp
|
||||
(
|
||||
label variable,
|
||||
const volScalarField& field
|
||||
) const;
|
||||
);
|
||||
|
||||
//- Return Tref
|
||||
virtual const dimensionedScalar& Tactivate() const;
|
||||
|
||||
|
||||
//- Explicit mass transfer for energy
|
||||
virtual tmp<volScalarField> KexpEnergy
|
||||
(
|
||||
label modelVariable,
|
||||
const volScalarField& field
|
||||
) const;
|
||||
|
||||
|
||||
//- Derivate sign of the source term:
|
||||
// d(Sk-i)/d(variable) > 0 or d(Si-k)/d(variable) < 0
|
||||
virtual label dSdVariable();
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
interfaceCompositionModel/interfaceCompositionModel.C
|
||||
interfaceCompositionModel/newInterfaceCompositionModel.C
|
||||
InterfaceCompositionModel/InterfaceCompositionModels.C
|
||||
|
||||
saturationPressureModels/saturationPressureModel/saturationPressureModel.C
|
||||
saturationPressureModels/saturationPressureModel/newSaturationPressureModel.C
|
||||
saturationPressureModels/ClausiusClapeyron/ClausiusClapeyron.C
|
||||
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libmeltingEvaporationModels
|
||||
@ -1,121 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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 "constantMelting.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::meltingEvaporationModels::constantMelting<Thermo, OtherThermo>::
|
||||
constantMelting
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
)
|
||||
:
|
||||
InterfaceCompositionModel<Thermo, OtherThermo>(dict, pair),
|
||||
C_("C", inv(dimTime)*inv(dimTemperature), dict.lookup("C")),
|
||||
Tactivate_("Tactivate", dimTemperature, dict.lookup("Tactivate"))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::meltingEvaporationModels::constantMelting<Thermo, OtherThermo>
|
||||
::Kexp(label variable, const volScalarField& field) const
|
||||
{
|
||||
|
||||
if (this->modelVariable_ == variable)
|
||||
{
|
||||
volScalarField limitedDispersed
|
||||
(
|
||||
min(max(this->pair().dispersed(), scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
return
|
||||
(
|
||||
C_
|
||||
* limitedDispersed
|
||||
* this->pair().dispersed().rho()
|
||||
* (field.oldTime() - Tactivate_)
|
||||
* pos(field.oldTime() - Tactivate_)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return tmp<volScalarField> ();
|
||||
}
|
||||
}
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::meltingEvaporationModels::constantMelting<Thermo, OtherThermo>
|
||||
::Kimp(label variable, const volScalarField& field) const
|
||||
{
|
||||
if (this->modelVariable_ == variable)
|
||||
{
|
||||
volScalarField limitedDispersed
|
||||
(
|
||||
min(max(this->pair().dispersed(), scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
return
|
||||
(
|
||||
C_
|
||||
* limitedDispersed
|
||||
* this->pair().dispersed().rho()
|
||||
* pos(field.oldTime() - Tactivate_)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return tmp<volScalarField> ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
const Foam::dimensionedScalar&
|
||||
Foam::meltingEvaporationModels::constantMelting<Thermo, OtherThermo>
|
||||
::Tactivate() const
|
||||
{
|
||||
return Tactivate_;
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::label
|
||||
Foam::meltingEvaporationModels::constantMelting<Thermo, OtherThermo>
|
||||
::dSdVariable()
|
||||
{
|
||||
return label(1);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,133 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::phaseChangeTwoPhaseMixtures::constantMelting
|
||||
|
||||
Description
|
||||
General mass transfer model based on temperature. It follows:
|
||||
|
||||
Ce*alpha*rho*(fieldValue - Tactivate)
|
||||
|
||||
or
|
||||
|
||||
Ci*alpha*rho*
|
||||
|
||||
|
||||
SourceFiles
|
||||
constantMelting.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef constantMelting_H
|
||||
#define constantMelting_H
|
||||
|
||||
#include "InterfaceCompositionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace meltingEvaporationModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class constantMelting
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
class constantMelting
|
||||
:
|
||||
public InterfaceCompositionModel<Thermo, OtherThermo>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Condensation coefficient [1/s/K]
|
||||
dimensionedScalar C_;
|
||||
|
||||
//- Phase transition temperature
|
||||
const dimensionedScalar Tactivate_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("constantMelting");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
constantMelting
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~constantMelting()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Explicit mass transfer coefficient
|
||||
virtual tmp<volScalarField> Kexp
|
||||
(
|
||||
label variable,
|
||||
const volScalarField& field
|
||||
) const;
|
||||
|
||||
//- Semi implicit species mass transfer coefficient
|
||||
virtual tmp<volScalarField> Kimp
|
||||
(
|
||||
label variable,
|
||||
const volScalarField& field
|
||||
) const;
|
||||
|
||||
//- Return T transition between phases
|
||||
virtual const dimensionedScalar& Tactivate() const;
|
||||
|
||||
//- Derivate sign of the source term:
|
||||
// d(Sk-i)/d(variable) > 0 or d(Si-k)/d(variable) < 0
|
||||
virtual label dSdVariable();
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace meltingEvaporationModel
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "constantMelting.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,419 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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 "kineticGasEvaporation.H"
|
||||
#include "constants.H"
|
||||
#include "fvcGrad.H"
|
||||
#include "fvcDiv.H"
|
||||
#include "surfaceInterpolate.H"
|
||||
#include "fvcReconstruct.H"
|
||||
#include "fvm.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
|
||||
using namespace Foam::constant;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>
|
||||
::kineticGasEvaporation
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
)
|
||||
:
|
||||
InterfaceCompositionModel<Thermo, OtherThermo>(dict, pair),
|
||||
C_("C", dimless, dict.lookup("C")),
|
||||
Tactivate_
|
||||
(
|
||||
"Tactivate",
|
||||
dimTemperature,
|
||||
dict.lookup("Tactivate")
|
||||
),
|
||||
Mv_
|
||||
(
|
||||
"Mv",
|
||||
dimMass/dimMoles,
|
||||
dict.lookupOrDefault<scalar>("Mv", -1)
|
||||
),
|
||||
saturationPressureModel_
|
||||
(
|
||||
saturationPressureModel::New
|
||||
(
|
||||
dict.subDict("saturationPressure")
|
||||
)
|
||||
),
|
||||
phi0_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phi0",
|
||||
this->mesh_.time().timeName(),
|
||||
this->mesh_,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
this->mesh_,
|
||||
dimensionedScalar("zero", dimMass/dimTime/dimVolume, 0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
),
|
||||
sPhi_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"sPhi",
|
||||
this->mesh_.time().timeName(),
|
||||
this->mesh_,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
this->mesh_,
|
||||
dimensionedScalar("zero", dimMass/dimTime/dimVolume, 0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
),
|
||||
D_
|
||||
(
|
||||
"D",
|
||||
dimArea/dimTime,
|
||||
dict.lookupOrDefault<scalar>("D", 1)
|
||||
)
|
||||
{
|
||||
word speciesName = this->species()[0];
|
||||
|
||||
// Get the continuous thermo
|
||||
const typename OtherThermo::thermoType& localThermo =
|
||||
this->getLocalThermo
|
||||
(
|
||||
speciesName,
|
||||
this->otherThermo_
|
||||
);
|
||||
|
||||
Mv_.value() = localThermo.W();
|
||||
|
||||
if (Mv_.value() == -1)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"meltingEvaporationModels::"
|
||||
"kineticGasEvaporation<Thermo, OtherThermo>::"
|
||||
"kineticGasEvaporation"
|
||||
"("
|
||||
"const dictionary& dict,"
|
||||
"const phasePair& pair"
|
||||
")"
|
||||
)
|
||||
<< " Please provide the molar weight (Mv) of vapour [g/mol] "
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>
|
||||
::Kexp(label variable, const volScalarField& field) const
|
||||
{
|
||||
|
||||
if (this->modelVariable_ == variable)
|
||||
{
|
||||
volScalarField limitedContinous
|
||||
(
|
||||
min(max(this->pair().continuous(), scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
volScalarField limitedDispersed
|
||||
(
|
||||
min(max(this->pair().dispersed(), scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
const fvMesh& mesh = this->mesh_;
|
||||
|
||||
|
||||
const volScalarField& T = mesh.lookupObject<volScalarField>("T");
|
||||
//const volScalarField& p = mesh.lookupObject<volScalarField>("p");
|
||||
|
||||
const dimensionedScalar HerztKnudsConst
|
||||
(
|
||||
sqrt
|
||||
(
|
||||
Mv_
|
||||
/2.0
|
||||
/constant::physicoChemical::R
|
||||
/mathematical::pi
|
||||
/pow3(Tactivate_)
|
||||
)
|
||||
);
|
||||
/*
|
||||
volScalarField pSat
|
||||
(
|
||||
"pSat",
|
||||
saturationPressureModel_->pSat(T)
|
||||
);
|
||||
*/
|
||||
/*
|
||||
volScalarField rhoMean
|
||||
(
|
||||
this->pair().continuous().rho()*this->pair().dispersed().rho()
|
||||
/ (this->pair().dispersed().rho() - this->pair().continuous().rho())
|
||||
);
|
||||
*/
|
||||
word species(this->species()[0]);
|
||||
|
||||
tmp<volScalarField> L = mag(this->L(species, field));
|
||||
|
||||
DebugVar(Mv_);
|
||||
//dimensionedScalar psat("psat", dimPressure, 1e5);
|
||||
//scalarField maxAreaDen(sqrt(3.0)*pow(mesh.V(), -1.0/3.0));
|
||||
//scalarField avergageDelta(pow(mesh.V(), 1.0/3.0));
|
||||
/*
|
||||
volScalarField areaDensity
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"areaDensity",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("zero", dimArea/dimVolume, 0.0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
*/
|
||||
volScalarField areaDensity
|
||||
(
|
||||
"areaDensity",
|
||||
mag(fvc::grad(limitedDispersed))
|
||||
);
|
||||
|
||||
/*
|
||||
volScalarField tempInterFace
|
||||
(
|
||||
"tempInterFace",
|
||||
pos(0.55 - limitedDispersed) * pos(limitedDispersed - 0.45)
|
||||
* pos(limitedContinous - 0.45) * pos(0.55 - limitedContinous)
|
||||
* T
|
||||
);
|
||||
*/
|
||||
dimensionedScalar dMgc = max(areaDensity);
|
||||
|
||||
|
||||
volScalarField Tave
|
||||
(
|
||||
"Tave", T*pos(areaDensity - 0.1*dMgc)
|
||||
);
|
||||
|
||||
const volScalarField massFluxEvap
|
||||
(
|
||||
"massFluxEvap",
|
||||
2*C_/(2 - C_)
|
||||
* HerztKnudsConst
|
||||
* L()
|
||||
* this->pair().continuous().rho()
|
||||
* max
|
||||
(
|
||||
(Tave - Tactivate_),
|
||||
dimensionedScalar("T0", dimTemperature, 0.0)
|
||||
)
|
||||
);
|
||||
|
||||
//scalar alphaC(0.9);
|
||||
//scalar alphaCMax(0.9);
|
||||
|
||||
|
||||
//.weightedAverage(mesh.V());
|
||||
/*
|
||||
volScalarField nearInterFace
|
||||
(
|
||||
"nearInterFace",
|
||||
pos(areaDensity - 0.1*dMgc)
|
||||
* pos(alphaC - limitedDispersed)
|
||||
* pos(limitedDispersed - (1 - alphaC))
|
||||
* pos(limitedContinous - (1 - alphaC))
|
||||
* pos(alphaC - limitedContinous)
|
||||
);
|
||||
|
||||
volScalarField farDispersedInterFace
|
||||
(
|
||||
pos(limitedDispersed - alphaC)
|
||||
);
|
||||
|
||||
volScalarField farContinousInterFace
|
||||
(
|
||||
pos(limitedContinous - alphaC)
|
||||
);
|
||||
|
||||
volScalarField farInterFace
|
||||
(
|
||||
"farInterFace", farDispersedInterFace + farContinousInterFace
|
||||
);
|
||||
*/
|
||||
dimensionedScalar mIntDotPhi0
|
||||
(
|
||||
"mIntDotPhi0",
|
||||
gSum((pos(areaDensity - 0.1*dMgc)*areaDensity*mesh.V())())
|
||||
/gSum
|
||||
(
|
||||
(pos(areaDensity - 0.1*dMgc)*limitedDispersed*areaDensity*mesh.V())()
|
||||
)
|
||||
);
|
||||
|
||||
DebugVar(mIntDotPhi0);
|
||||
|
||||
// Local density rate (kg/m3/s)
|
||||
phi0_ = massFluxEvap*areaDensity; //mIntDotPhi0*limitedDispersed
|
||||
|
||||
|
||||
dimensionedScalar mIntDot("mIntDot", gSum((phi0_*mesh.V())()));
|
||||
|
||||
DebugVar(mIntDot);
|
||||
|
||||
volScalarField sPhi("sPhi", phi0_);
|
||||
|
||||
phi0_ = 0.0*phi0_;
|
||||
|
||||
fvScalarMatrix sPhiEq
|
||||
(
|
||||
fvm::ddt(sPhi)
|
||||
- fvm::laplacian(D_, sPhi)
|
||||
);
|
||||
|
||||
sPhiEq.relax();
|
||||
sPhiEq.solve();
|
||||
|
||||
// Liquid normalization
|
||||
const dimensionedScalar Nl
|
||||
(
|
||||
gSum((sPhi*mesh.V())())
|
||||
/(
|
||||
gSum
|
||||
(
|
||||
(sPhi*mesh.V()*limitedDispersed)()
|
||||
)
|
||||
+ dimensionedScalar("SMALL", dimless, VSMALL)
|
||||
)
|
||||
);
|
||||
|
||||
// Vapour normalization
|
||||
const dimensionedScalar Nv
|
||||
(
|
||||
gSum((sPhi*mesh.V())())
|
||||
/(
|
||||
gSum
|
||||
(
|
||||
(sPhi*mesh.V()*limitedContinous)()
|
||||
)
|
||||
+ dimensionedScalar("SMALL", dimless, VSMALL)
|
||||
)
|
||||
);
|
||||
|
||||
// Spread density source
|
||||
sPhi_ =
|
||||
0.5*
|
||||
(
|
||||
limitedContinous*Nv*sPhi
|
||||
+ limitedDispersed*Nl*sPhi
|
||||
);
|
||||
|
||||
dimensionedScalar msPhiIntDot("msPhiIntDot", gSum((sPhi_*mesh.V())()));
|
||||
|
||||
DebugVar(msPhiIntDot);
|
||||
|
||||
if (this->pair().dispersed().mesh().time().outputTime())
|
||||
{
|
||||
massFluxEvap.write();
|
||||
areaDensity.write();
|
||||
Tave.write();
|
||||
}
|
||||
|
||||
return
|
||||
(
|
||||
0.5*
|
||||
(
|
||||
limitedContinous*Nv*sPhi
|
||||
+ limitedDispersed*Nl*sPhi
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return tmp<volScalarField> ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>
|
||||
::Kimp(label variable, const volScalarField& field) const
|
||||
{
|
||||
if (this->modelVariable_ == variable)
|
||||
{
|
||||
return tmp<volScalarField> ();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return tmp<volScalarField> ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
const Foam::dimensionedScalar&
|
||||
Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>
|
||||
::Tactivate() const
|
||||
{
|
||||
return Tactivate_;
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>
|
||||
::KexpEnergy
|
||||
(
|
||||
label modelVariable,
|
||||
const volScalarField& field
|
||||
)
|
||||
const
|
||||
{
|
||||
return dimensionedScalar("one", dimless, 1.0)*phi0_;
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::label
|
||||
Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>
|
||||
::dSdVariable()
|
||||
{
|
||||
return label(1);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,259 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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 "saturatedEvaporation.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::meltingEvaporationModels::saturatedEvaporation<Thermo, OtherThermo>::
|
||||
saturatedEvaporation
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
)
|
||||
:
|
||||
InterfaceCompositionModel<Thermo, OtherThermo>(dict, pair),
|
||||
C_("C", inv(dimTime), dict.lookup("C")),
|
||||
Tactivate_("Tactivate", dimTemperature, dict.lookup("Tactivate")),
|
||||
saturationPressureModel_
|
||||
(
|
||||
saturationPressureModel::New
|
||||
(
|
||||
dict.subDict("saturationPressure")
|
||||
)
|
||||
)
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::tmp<Foam::volScalarField> Foam::meltingEvaporationModels::
|
||||
saturatedEvaporation<Thermo, OtherThermo>::Yf
|
||||
(
|
||||
const word& speciesName,
|
||||
const volScalarField& Tf
|
||||
) const
|
||||
{
|
||||
const fvMesh& mesh = this->pair().dispersed().mesh();
|
||||
|
||||
tmp<volScalarField> twRatio
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"wRatio",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("wRatio", dimless, 1)
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& wRatio = twRatio();
|
||||
|
||||
// Get the continuous thermo
|
||||
const typename OtherThermo::thermoType& continuousThermo =
|
||||
this->getLocalThermo
|
||||
(
|
||||
speciesName,
|
||||
this->otherThermo_
|
||||
);
|
||||
|
||||
// // Get the dispersed thermo
|
||||
// const typename Thermo::thermoType& dispersedThermo =
|
||||
// this->getLocalThermo
|
||||
// (
|
||||
// speciesName,
|
||||
// this->thermo_
|
||||
// );
|
||||
|
||||
// If dispersed phase (liquid) is multicomponent
|
||||
{
|
||||
wRatio =
|
||||
this->MwMixture(this->thermo_)
|
||||
* this->getSpecieMassFraction(speciesName, this->thermo_)
|
||||
/ this->MwMixture(this->thermo_);
|
||||
}
|
||||
|
||||
// If continuous phase (vapour) is multicomponent
|
||||
{
|
||||
wRatio *=
|
||||
continuousThermo.W()
|
||||
/ this->MwMixture(this->otherThermo_);
|
||||
}
|
||||
|
||||
const volScalarField& p = this->pair().dispersed().thermo().p();
|
||||
|
||||
volScalarField Yf
|
||||
(
|
||||
"Yf",
|
||||
wRatio*saturationPressureModel_->pSat(Tf)/p
|
||||
);
|
||||
|
||||
volScalarField pSat
|
||||
(
|
||||
"pSat",
|
||||
saturationPressureModel_->pSat(Tf)
|
||||
);
|
||||
|
||||
if (this->pair().dispersed().mesh().time().outputTime())
|
||||
{
|
||||
Yf.write();
|
||||
pSat.write();
|
||||
}
|
||||
|
||||
return wRatio*saturationPressureModel_->pSat(Tf)/p;
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::meltingEvaporationModels::saturatedEvaporation<Thermo, OtherThermo>
|
||||
::Kexp(label variable, const volScalarField& field) const
|
||||
{
|
||||
if (this->modelVariable_ == variable)
|
||||
{
|
||||
volScalarField limitedDispersed
|
||||
(
|
||||
min(max(this->pair().dispersed(), scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
volScalarField limitedContinous
|
||||
(
|
||||
min(max(this->pair().continuous(), scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
volScalarField nearInterFace
|
||||
(
|
||||
"nearInterFace",
|
||||
pos(limitedDispersed - 0.1)*pos(0.9 - limitedDispersed)
|
||||
*pos(limitedContinous - 0.1)*pos(0.9 - limitedContinous)
|
||||
);
|
||||
|
||||
return
|
||||
(
|
||||
C_
|
||||
*nearInterFace
|
||||
*limitedDispersed
|
||||
*pos(field.oldTime() - Tactivate_)
|
||||
*this->pair().dispersed().rho()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return tmp<volScalarField> ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::meltingEvaporationModels::saturatedEvaporation<Thermo, OtherThermo>
|
||||
::Kimp(label variable, const volScalarField& field) const
|
||||
{
|
||||
if (this->modelVariable_ == variable)
|
||||
{
|
||||
/*
|
||||
volScalarField limitedDispersed
|
||||
(
|
||||
min(max(this->pair().dispersed(), scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
volScalarField limitedContinous
|
||||
(
|
||||
min(max(this->pair().continuous(), scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
volScalarField nearInterFace
|
||||
(
|
||||
"nearInterFace",
|
||||
pos(limitedDispersed - 0.1)*pos(0.9 - limitedDispersed)
|
||||
*pos(limitedContinous - 0.1)*pos(0.9 - limitedContinous)
|
||||
);
|
||||
|
||||
scalarField maxAreaDen(sqrt(3.0)*pow(mesh.V(), -1.0/3.0));
|
||||
|
||||
volScalarField areaDensity
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"areaDensity",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("zero", dimArea/dimVolume, 0.0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
|
||||
forAll (limitedDispersed, i)
|
||||
{
|
||||
if (limitedDispersed[i] < 0.5)
|
||||
{
|
||||
areaDensity[i] = 2.0*limitedDispersed[i]*maxAreaDen[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
areaDensity[i] = 2.0*(1.0 - limitedDispersed[i])*maxAreaDen[i];
|
||||
}
|
||||
}
|
||||
areaDensity.correctBoundaryConditions();
|
||||
|
||||
return
|
||||
(
|
||||
C_
|
||||
*nearInterFace
|
||||
*limitedDispersed
|
||||
*areaDensity
|
||||
*pos(field.oldTime() - Tactivate_)
|
||||
);
|
||||
*/
|
||||
return tmp<volScalarField> ();
|
||||
}
|
||||
else
|
||||
{
|
||||
return tmp<volScalarField> ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
const Foam::dimensionedScalar&
|
||||
Foam::meltingEvaporationModels::saturatedEvaporation<Thermo, OtherThermo>
|
||||
::Tactivate() const
|
||||
{
|
||||
return Tactivate_;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,150 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::phaseChangeTwoPhaseMixtures::saturatedEvaporation
|
||||
|
||||
Description
|
||||
Evaporation model based on the Saturated species concentration at the
|
||||
interface.
|
||||
|
||||
mEvap = C*rho*D*(Ysat - Yi)
|
||||
|
||||
SourceFiles
|
||||
saturatedEvaporation.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef saturatedEvaporation_H
|
||||
#define saturatedEvaporation_H
|
||||
|
||||
#include "saturationPressureModel.H"
|
||||
#include "InterfaceCompositionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace meltingEvaporationModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class saturatedEvaporation
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
class saturatedEvaporation
|
||||
:
|
||||
public InterfaceCompositionModel<Thermo, OtherThermo>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Model coefficient
|
||||
dimensionedScalar C_;
|
||||
|
||||
//- Vaporization minimum temperature
|
||||
const dimensionedScalar Tactivate_;
|
||||
|
||||
//- Saturated species name in both phases
|
||||
word saturatedName_;
|
||||
|
||||
//- Saturated species index in continous phase (receiving mass)
|
||||
label continuousSaturatedIndex_;
|
||||
|
||||
//- Saturated species index in dispersed phase (giving mass)
|
||||
label dispersedSaturatedIndex_;
|
||||
|
||||
//- Saturation pressure model
|
||||
autoPtr<saturationPressureModel> saturationPressureModel_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Constant of propotionality between partial pressure and mass
|
||||
// fraction
|
||||
tmp<volScalarField> wRatio() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("saturatedEvaporation");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
saturatedEvaporation(const dictionary& dict, const phasePair& pair);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~saturatedEvaporation()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Explicit mass transfer coefficient
|
||||
virtual tmp<volScalarField> Kexp
|
||||
(
|
||||
label variable,
|
||||
const volScalarField& field
|
||||
) const;
|
||||
|
||||
//- Semi implicit species mass transfer coefficient
|
||||
virtual tmp<volScalarField> Kimp
|
||||
(
|
||||
label variable,
|
||||
const volScalarField& field
|
||||
) const;
|
||||
|
||||
//- Interface mass fraction
|
||||
virtual tmp<volScalarField> Yf
|
||||
(
|
||||
const word& speciesName,
|
||||
const volScalarField& Tf
|
||||
) const;
|
||||
|
||||
//- Return T transition between phases
|
||||
virtual const dimensionedScalar& Tactivate() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace meltingEvaporationModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "saturatedEvaporation.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,121 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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 "ClausiusClapeyron.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "physicoChemicalConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace saturationPressureModels
|
||||
{
|
||||
defineTypeNameAndDebug(ClausiusClapeyron, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
saturationPressureModel,
|
||||
ClausiusClapeyron,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::saturationPressureModels::ClausiusClapeyron::ClausiusClapeyron
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
saturationPressureModel(),
|
||||
p0_("p0", dimPressure, dict.lookup("p0")),
|
||||
Tb_("Tb", dimTemperature, dict.lookup("Tb")),
|
||||
dHvm_
|
||||
(
|
||||
"dHvm",
|
||||
dimMass*sqr(dimLength)/sqr(dimTime)/dimMoles ,
|
||||
dict.lookup("dHvm")
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::saturationPressureModels::ClausiusClapeyron::~ClausiusClapeyron()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::saturationPressureModels::ClausiusClapeyron::pSat
|
||||
(
|
||||
const volScalarField& T
|
||||
) const
|
||||
{
|
||||
volScalarField invTc(1.0/Tb_ - 1.0/T);
|
||||
|
||||
return (p0_*exp(dHvm_*invTc/constant::physicoChemical::R));
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::saturationPressureModels::ClausiusClapeyron::pSatPrime
|
||||
(
|
||||
const volScalarField& T
|
||||
) const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pSatPrime",
|
||||
T.mesh().time().timeName(),
|
||||
T.mesh()
|
||||
),
|
||||
T.mesh(),
|
||||
dimensionedScalar("0", dimless, 0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::saturationPressureModels::ClausiusClapeyron::lnPSat
|
||||
(
|
||||
const volScalarField& T
|
||||
) const
|
||||
{
|
||||
volScalarField invTc(1.0/Tb_ - 1.0/T);
|
||||
|
||||
return
|
||||
log(p0_.value()) + dHvm_*invTc/constant::physicoChemical::R.value();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,104 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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::saturationPressureModels::ClausiusClapeyron
|
||||
|
||||
Description
|
||||
ClausiusClapeyron equation for the vapour pressure of steam.
|
||||
|
||||
SourceFiles
|
||||
ClausiusClapeyron.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ClausiusClapeyron_H
|
||||
#define ClausiusClapeyron_H
|
||||
|
||||
#include "saturationPressureModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace saturationPressureModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ClausiusClapeyron Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class ClausiusClapeyron
|
||||
:
|
||||
public saturationPressureModel
|
||||
{
|
||||
private:
|
||||
|
||||
//- Vapour pressure at temperature Tb
|
||||
dimensionedScalar p0_;
|
||||
|
||||
//- Temperature reference
|
||||
dimensionedScalar Tb_;
|
||||
|
||||
//- Change of molar enthaply of the vapour
|
||||
dimensionedScalar dHvm_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("ClausiusClapeyron");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from a dictionary
|
||||
ClausiusClapeyron(const dictionary& dict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~ClausiusClapeyron();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Saturation pressure
|
||||
virtual tmp<volScalarField> pSat(const volScalarField& T) const;
|
||||
|
||||
//- Saturation pressure derivetive w.r.t. temperature
|
||||
virtual tmp<volScalarField> pSatPrime(const volScalarField& T) const;
|
||||
|
||||
//- Natural log of the saturation pressure
|
||||
virtual tmp<volScalarField> lnPSat(const volScalarField& T) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace saturationPressureModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,57 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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 "saturationPressureModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::saturationPressureModel> Foam::saturationPressureModel::New
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
word saturationPressureModelType(dict.lookup("type"));
|
||||
|
||||
Info<< "Selecting saturationPressureModel: "
|
||||
<< saturationPressureModelType << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(saturationPressureModelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn("saturationPressureModel::New")
|
||||
<< "Unknown saturationPressureModelType type "
|
||||
<< saturationPressureModelType << endl << endl
|
||||
<< "Valid saturationPressureModel types are : " << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return cstrIter()(dict);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,49 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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 "saturationPressureModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(saturationPressureModel, 0);
|
||||
defineRunTimeSelectionTable(saturationPressureModel, dictionary);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::saturationPressureModel::saturationPressureModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::saturationPressureModel::~saturationPressureModel()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,127 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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::saturationPressureModel
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
saturationPressureModel.C
|
||||
newSaturationPressureModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef saturationPressureModel_H
|
||||
#define saturationPressureModel_H
|
||||
|
||||
#include "volFields.H"
|
||||
#include "dictionary.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class saturationPressureModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class saturationPressureModel
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
saturationPressureModel(const saturationPressureModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const saturationPressureModel&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("saturationPressureModel");
|
||||
|
||||
|
||||
//- Declare runtime construction
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
saturationPressureModel,
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& dict
|
||||
),
|
||||
(dict)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
saturationPressureModel();
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Select null constructed
|
||||
static autoPtr<saturationPressureModel> New(const dictionary& dict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~saturationPressureModel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Saturation pressure
|
||||
virtual tmp<volScalarField> pSat
|
||||
(
|
||||
const volScalarField& T
|
||||
) const = 0;
|
||||
|
||||
//- Saturation pressure derivetive w.r.t. temperature
|
||||
virtual tmp<volScalarField> pSatPrime
|
||||
(
|
||||
const volScalarField& T
|
||||
) const = 0;
|
||||
|
||||
//- Natural log of the saturation pressure
|
||||
virtual tmp<volScalarField> lnPSat
|
||||
(
|
||||
const volScalarField& T
|
||||
) const = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -86,11 +86,11 @@
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
phi = phiHbyA + p_rghEqn.flux();
|
||||
//phi = fluid.phiMixture();
|
||||
|
||||
p_rgh.relax();
|
||||
|
||||
U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rAUf);
|
||||
|
||||
U.correctBoundaryConditions();
|
||||
fvOptions.correct(U);
|
||||
K = 0.5*magSqr(U);
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
interfaceModels/surfaceTensionModels/surfaceTensionModel/surfaceTensionModel.C
|
||||
interfaceModels/surfaceTensionModels/surfaceTensionModel/newSurfaceTensionModel.C
|
||||
interfaceModels/surfaceTensionModels/constantSurfaceTensionCoefficient/constantSurfaceTensionCoefficient.C
|
||||
|
||||
interfaceModels/porousModels/porousModel/porousModel.C
|
||||
interfaceModels/porousModels/porousModel/newPorousModel.C
|
||||
interfaceModels/porousModels/VollerPrakash/VollerPrakash.C
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
EXE_INC = \
|
||||
-I../meltingEvaporationModel/lnInclude \
|
||||
-I../massTransferModels/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/fvOptions/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
\
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
@ -17,8 +16,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \
|
||||
-I$(LIB_SRC)/combustionModels/lnInclude \
|
||||
\
|
||||
-I../interfacialModels/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lcombustionModels
|
||||
|
||||
@ -0,0 +1,323 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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 "MassTransferPhaseSystem.H"
|
||||
|
||||
#include "HashPtrTable.H"
|
||||
|
||||
#include "fvcDiv.H"
|
||||
#include "fvmSup.H"
|
||||
#include "fvMatrix.H"
|
||||
#include "fundamentalConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasePhaseSystem>
|
||||
Foam::MassTransferPhaseSystem<BasePhaseSystem>::
|
||||
MassTransferPhaseSystem(const fvMesh& mesh)
|
||||
:
|
||||
BasePhaseSystem(mesh)
|
||||
{
|
||||
this->generatePairsAndSubModels("massTransferModel", massTransferModels_);
|
||||
|
||||
forAllConstIter(massTransferModelTable, massTransferModels_, iterModel)
|
||||
{
|
||||
if (!dmdt_.found(iterModel()->pair()))
|
||||
{
|
||||
dmdt_.set
|
||||
(
|
||||
iterModel()->pair(),
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("dmdt",iterModel()->pair().name()),
|
||||
this->mesh().time().timeName(),
|
||||
this->mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
this->mesh(),
|
||||
dimensionedScalar("zero", dimDensity/dimTime, 0)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasePhaseSystem>
|
||||
Foam::MassTransferPhaseSystem<BasePhaseSystem>::
|
||||
~MassTransferPhaseSystem()
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * //
|
||||
|
||||
template<class BasePhaseSystem>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::MassTransferPhaseSystem<BasePhaseSystem>::calculateL
|
||||
(
|
||||
const volScalarField& dmdtNetki,
|
||||
const phasePairKey& keyik,
|
||||
const phasePairKey& keyki,
|
||||
const volScalarField& T
|
||||
) const
|
||||
{
|
||||
tmp<volScalarField> tL
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"tL",
|
||||
this->mesh().time().timeName(),
|
||||
this->mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
this->mesh(),
|
||||
dimensionedScalar("zero", dimEnergy/dimMass, 0)
|
||||
)
|
||||
);
|
||||
volScalarField& L = tL.ref();
|
||||
|
||||
if (massTransferModels_.found(keyik))
|
||||
{
|
||||
const autoPtr<interfaceCompositionModel>& interfacePtr =
|
||||
massTransferModels_[keyik];
|
||||
|
||||
word speciesName = interfacePtr->transferSpecie();
|
||||
|
||||
auto tempOpen = speciesName.find('.');
|
||||
|
||||
//const word species(speciesName(0, tempOpen));
|
||||
const word species(speciesName.substr(0, tempOpen));
|
||||
|
||||
L -= neg(dmdtNetki)*interfacePtr->L(species, T);
|
||||
}
|
||||
|
||||
if (massTransferModels_.found(keyki))
|
||||
{
|
||||
const autoPtr<interfaceCompositionModel>& interfacePtr =
|
||||
massTransferModels_[keyki];
|
||||
|
||||
word speciesName = interfacePtr->transferSpecie();
|
||||
|
||||
auto tempOpen = speciesName.find('.');
|
||||
|
||||
const word species(speciesName.substr(0, tempOpen));
|
||||
|
||||
L += pos(dmdtNetki)*interfacePtr->L(species, T);
|
||||
}
|
||||
|
||||
return tL;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasePhaseSystem>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::MassTransferPhaseSystem<BasePhaseSystem>::dmdt
|
||||
(
|
||||
const phasePairKey& key
|
||||
) const
|
||||
{
|
||||
tmp<volScalarField> tdmdt
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"dmdt",
|
||||
this->mesh().time().timeName(),
|
||||
this->mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
this->mesh(),
|
||||
dimensionedScalar("zero", dimDensity/dimTime, 0)
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& dmdt = tdmdt.ref();
|
||||
|
||||
if (dmdt_.found(key))
|
||||
{
|
||||
dmdt = *dmdt_[key];
|
||||
}
|
||||
|
||||
return tdmdt;
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseSystem>
|
||||
Foam::tmp<Foam::fvScalarMatrix>
|
||||
Foam::MassTransferPhaseSystem<BasePhaseSystem>::heatTransfer
|
||||
(
|
||||
const volScalarField& T
|
||||
)
|
||||
{
|
||||
tmp<fvScalarMatrix> tEqnPtr
|
||||
(
|
||||
new fvScalarMatrix(T, dimEnergy/dimTime)
|
||||
);
|
||||
|
||||
fvScalarMatrix& eqn = tEqnPtr.ref();
|
||||
|
||||
forAllIter(phaseSystem::phaseModelTable, this->phaseModels_, iteri)
|
||||
{
|
||||
phaseModel& phasei = iteri()();
|
||||
|
||||
phaseSystem::phaseModelTable::iterator iterk = iteri;
|
||||
iterk++;
|
||||
for
|
||||
(
|
||||
;
|
||||
iterk != this->phaseModels_.end();
|
||||
++iterk
|
||||
)
|
||||
{
|
||||
if (iteri()().name() != iterk()().name())
|
||||
{
|
||||
phaseModel& phasek = iterk()();
|
||||
|
||||
// Phase i to phase k
|
||||
const phasePairKey keyik(phasei.name(), phasek.name(), true);
|
||||
|
||||
// Phase k to phase i
|
||||
const phasePairKey keyki(phasek.name(), phasei.name(), true);
|
||||
|
||||
// Net mass transfer from k to i phase
|
||||
tmp<volScalarField> tdmdtNetki
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"tdmdtYki",
|
||||
this->mesh().time().timeName(),
|
||||
this->mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
this->mesh(),
|
||||
dimensionedScalar
|
||||
(
|
||||
"zero",
|
||||
dimDensity/dimTime,
|
||||
0
|
||||
)
|
||||
)
|
||||
);
|
||||
volScalarField& dmdtNetki = tdmdtNetki.ref();
|
||||
|
||||
|
||||
if (massTransferModels_.found(keyik))
|
||||
{
|
||||
autoPtr<interfaceCompositionModel>& interfacePtr =
|
||||
massTransferModels_[keyik];
|
||||
|
||||
// Explicit temperature mass transfer rate
|
||||
tmp<volScalarField> Kexp =
|
||||
interfacePtr->Kexp
|
||||
(
|
||||
interfaceCompositionModel::T,
|
||||
T
|
||||
);
|
||||
|
||||
if (Kexp.valid())
|
||||
{
|
||||
dmdtNetki -= Kexp.ref();
|
||||
*dmdt_[keyik] = Kexp.ref();
|
||||
}
|
||||
}
|
||||
|
||||
// Looking for mass transfer in the other direction (k to i)
|
||||
if (massTransferModels_.found(keyki))
|
||||
{
|
||||
autoPtr<interfaceCompositionModel>& interfacePtr =
|
||||
massTransferModels_[keyki];
|
||||
|
||||
// Explicit temperature mass transfer rate
|
||||
const tmp<volScalarField> Kexp =
|
||||
interfacePtr->Kexp
|
||||
(
|
||||
interfaceCompositionModel::T,
|
||||
T
|
||||
);
|
||||
|
||||
if (Kexp.valid())
|
||||
{
|
||||
dmdtNetki += Kexp.ref();
|
||||
*dmdt_[keyki] = Kexp.ref();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
word keyikName(phasei.name() + phasek.name());
|
||||
word keykiName(phasek.name() + phasei.name());
|
||||
|
||||
eqn -=
|
||||
(
|
||||
dmdtNetki
|
||||
*(
|
||||
calculateL(dmdtNetki, keyik, keyki, T)
|
||||
- (phasek.Cp() - phasei.Cp())
|
||||
* constant::standard::Tstd
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
return tEqnPtr;
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseSystem>
|
||||
void Foam::MassTransferPhaseSystem<BasePhaseSystem>::massSpeciesTransfer
|
||||
(
|
||||
const phaseModel& phase,
|
||||
volScalarField::Internal& Su,
|
||||
volScalarField::Internal& Sp,
|
||||
const word speciesName
|
||||
)
|
||||
{
|
||||
// Fill the volumetric mass transfer for species
|
||||
forAllIter(massTransferModelTable, massTransferModels_, iter)
|
||||
{
|
||||
if (iter()->transferSpecie() == speciesName)
|
||||
{
|
||||
// Explicit source
|
||||
Su +=
|
||||
this->Su()[phase.name()]
|
||||
+ this->Sp()[phase.name()]*phase.oldTime();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,154 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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::MassTransferPhaseSystem
|
||||
|
||||
Description
|
||||
Class for mass transfer between phases
|
||||
|
||||
SourceFiles
|
||||
MassTransferPhaseSystem.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef MassTransferPhaseSystem_H
|
||||
#define MassTransferPhaseSystem_H
|
||||
|
||||
#include "phaseSystem.H"
|
||||
#include "HashPtrTable.H"
|
||||
#include "interfaceCompositionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class MassTransferPhaseSystem Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class BasePhaseSystem>
|
||||
class MassTransferPhaseSystem
|
||||
:
|
||||
public BasePhaseSystem
|
||||
{
|
||||
public:
|
||||
|
||||
// Public typedefs
|
||||
|
||||
typedef
|
||||
HashTable
|
||||
<
|
||||
autoPtr<interfaceCompositionModel>,
|
||||
phasePairKey,
|
||||
phasePairKey::hash
|
||||
>
|
||||
massTransferModelTable;
|
||||
|
||||
protected:
|
||||
|
||||
// Protected typedefs
|
||||
|
||||
typedef
|
||||
HashPtrTable
|
||||
<
|
||||
volScalarField,
|
||||
phasePairKey,
|
||||
phasePairKey::hash
|
||||
>
|
||||
dmdtTable;
|
||||
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Overall inter-phase mass transfer rates [Kg/s]
|
||||
dmdtTable dmdt_;
|
||||
|
||||
//- Mass transfer models
|
||||
massTransferModelTable massTransferModels_;
|
||||
|
||||
|
||||
// Protected memebers
|
||||
|
||||
//- Calculate L between phases
|
||||
tmp<volScalarField> calculateL
|
||||
(
|
||||
const volScalarField& dmdtNetki,
|
||||
const phasePairKey& keyik,
|
||||
const phasePairKey& keyki,
|
||||
const volScalarField& T
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from fvMesh
|
||||
MassTransferPhaseSystem(const fvMesh&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~MassTransferPhaseSystem();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return total interfacial mass flow rate
|
||||
tmp<volScalarField> dmdt(const phasePairKey& key) const;
|
||||
|
||||
|
||||
// Mass transfer functions
|
||||
|
||||
//- Return the heat transfer matrix and fill dmdt for phases
|
||||
virtual tmp<fvScalarMatrix> heatTransfer(const volScalarField& T);
|
||||
|
||||
|
||||
//- Calculate mass transfer for species
|
||||
virtual void massSpeciesTransfer
|
||||
(
|
||||
const phaseModel& phase,
|
||||
volScalarField::Internal& Su,
|
||||
volScalarField::Internal& Sp,
|
||||
const word speciesName
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "MassTransferPhaseSystem.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,200 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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::MeltingEvaporationPhaseSystem
|
||||
|
||||
Description
|
||||
Holds mass transfer models
|
||||
|
||||
SourceFiles
|
||||
MeltingEvaporationPhaseSystem.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef MeltingEvaporationPhaseSystem_H
|
||||
#define MeltingEvaporationPhaseSystem_H
|
||||
|
||||
#include "phaseSystem.H"
|
||||
#include "HashPtrTable.H"
|
||||
#include "interfaceCompositionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class MeltingEvaporationPhaseSystem Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class BasePhaseSystem>
|
||||
class MeltingEvaporationPhaseSystem
|
||||
:
|
||||
public BasePhaseSystem
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected typedefs
|
||||
|
||||
typedef
|
||||
HashTable
|
||||
<
|
||||
autoPtr<interfaceCompositionModel>,
|
||||
phasePairKey,
|
||||
phasePairKey::hash
|
||||
>
|
||||
meltingEvaporationModelTable;
|
||||
|
||||
|
||||
typedef
|
||||
HashPtrTable
|
||||
<
|
||||
volScalarField,
|
||||
Pair<word>,
|
||||
FixedList<word, 2>::Hash<>
|
||||
>
|
||||
dmdtYiTable;
|
||||
|
||||
|
||||
typedef
|
||||
HashTable
|
||||
<
|
||||
dmdtYiTable,
|
||||
phasePairKey,
|
||||
phasePairKey::hash
|
||||
>
|
||||
dmdtPhaseVarYiTable;
|
||||
|
||||
|
||||
typedef
|
||||
HashPtrTable
|
||||
<
|
||||
volScalarField,
|
||||
phasePairKey,
|
||||
phasePairKey::hash
|
||||
>
|
||||
dmdtTable;
|
||||
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Overall inter-phase mass transfer rates
|
||||
dmdtTable dmdt_;
|
||||
|
||||
//- Mass transfer models
|
||||
meltingEvaporationModelTable meltingEvaporationModels_;
|
||||
|
||||
//- Variable based inter-phase mass transfer rates
|
||||
dmdtPhaseVarYiTable dmdtYi_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from fvMesh
|
||||
MeltingEvaporationPhaseSystem(const fvMesh&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~MeltingEvaporationPhaseSystem();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Total mass transfer per variable
|
||||
|
||||
//- Return total interfacial mass flow rate
|
||||
virtual tmp<volScalarField> dmdt(const phasePairKey& key) const;
|
||||
|
||||
|
||||
//- Return species interfacial source mass rate per species
|
||||
// driven by pressure or temperature
|
||||
virtual tmp<volScalarField> dmdtYi
|
||||
(
|
||||
const word& phaseSpeciesName
|
||||
) const;
|
||||
|
||||
|
||||
//- Return total interfacial mass driven by modelVariable
|
||||
tmp<volScalarField> dmdtYi
|
||||
(
|
||||
const phasePairKey& key,
|
||||
word modelVar,
|
||||
word specieName
|
||||
) const;
|
||||
|
||||
|
||||
//- Return non-const reference total interfacial mass driven
|
||||
// by modelVariable
|
||||
volScalarField& dmdtYi
|
||||
(
|
||||
const phasePairKey& key,
|
||||
word modelVar,
|
||||
word specieName
|
||||
);
|
||||
|
||||
|
||||
// Explicit and Implicit mass transfer matrices
|
||||
|
||||
//- Return the heat transfer matrix
|
||||
virtual tmp<fvScalarMatrix> heatTransfer
|
||||
(
|
||||
const volScalarField& T
|
||||
);
|
||||
|
||||
//- Return semi-implicit mass transfer matrix for
|
||||
// multicomponent phases based on mass fractions
|
||||
virtual autoPtr<phaseSystem::massTransferTable> massTransfer
|
||||
(
|
||||
const volScalarField& T
|
||||
);
|
||||
|
||||
|
||||
//- Return phase inverse density
|
||||
virtual tmp<volScalarField> coeffs(const word& key) const;
|
||||
|
||||
//- Correct the phase properties other than the thermo and turbulence
|
||||
virtual void correct();
|
||||
|
||||
//- Read base phaseProperties dictionary
|
||||
virtual bool read();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "MeltingEvaporationPhaseSystem.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -49,11 +49,10 @@ namespace porousModels
|
||||
Foam::porousModels::VollerPrakash::VollerPrakash
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair,
|
||||
const bool registerObject
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
porousModel(dict, pair, registerObject),
|
||||
porousModel(dict, mesh),
|
||||
Cu_(readScalar(dict.lookup("Cu"))),
|
||||
solidPhase_(dict.lookup("solidPhase"))
|
||||
{}
|
||||
@ -71,10 +70,8 @@ Foam::porousModels::VollerPrakash::
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::porousModels::VollerPrakash::S() const
|
||||
{
|
||||
const fvMesh& mesh = this->pair_.phase1().mesh();
|
||||
|
||||
const volScalarField& solidAlpha =
|
||||
mesh.lookupObject<volScalarField>(solidPhase_);
|
||||
mesh_.lookupObject<volScalarField>(solidPhase_);
|
||||
|
||||
return Cu_*sqr(solidAlpha)/(pow3(1.0 - solidAlpha) + 1e-3);
|
||||
}
|
||||
|
||||
@ -25,7 +25,36 @@ Class
|
||||
Foam::VollerPrakash
|
||||
|
||||
Description
|
||||
Constant value surface tension model.
|
||||
Porous model to apply a porous media on a solid phase.
|
||||
|
||||
Based on the references:
|
||||
-# V.R. Voller and C. Prakash, A fixed grid numerical modelling
|
||||
methodology for convection-diffusion mushy phase-change problems,
|
||||
Int. J. Heat Mass Transfer 30(8):17091719, 1987.
|
||||
-# C.R. Swaminathan. and V.R. Voller, A general enthalpy model for
|
||||
modeling solidification processes, Metallurgical Transactions
|
||||
23B:651664, 1992.
|
||||
Usage
|
||||
Example usage:
|
||||
\verbatim
|
||||
interfacePorous
|
||||
(
|
||||
(solid and liquid)
|
||||
{
|
||||
type VollerPrakash;
|
||||
solidPhase alpha.solid;
|
||||
Cu 1e7;
|
||||
}
|
||||
);
|
||||
\endverbatim
|
||||
|
||||
Where:
|
||||
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
solidPhase | Solid phase name | yes
|
||||
Cu | Model constant | yes
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
VollerPrakash.C
|
||||
@ -73,8 +102,7 @@ public:
|
||||
VollerPrakash
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair,
|
||||
const bool registerObject
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,13 +32,13 @@ Foam::autoPtr<Foam::porousModel >
|
||||
Foam::porousModel::New
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
word porousModelType(dict.lookup("type"));
|
||||
|
||||
Info<< "Selecting porousModel for "
|
||||
<< pair << ": " << porousModelType << endl;
|
||||
<< ": " << porousModelType << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(porousModelType);
|
||||
@ -53,7 +53,7 @@ Foam::porousModel::New
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return cstrIter()(dict, pair, true);
|
||||
return cstrIter()(dict, mesh);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -40,23 +40,21 @@ namespace Foam
|
||||
Foam::porousModel::porousModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair,
|
||||
const bool registerObject
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
regIOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName(typeName, pair.name()),
|
||||
pair.phase1().mesh().time().timeName(),
|
||||
pair.phase1().mesh(),
|
||||
IOobject::groupName(typeName, dict.name()),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
registerObject
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
pair_(pair)
|
||||
mesh_(mesh)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class phasePair;
|
||||
class fvMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class porousModel Declaration
|
||||
@ -57,8 +57,8 @@ protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Phase pair
|
||||
const phasePair& pair_;
|
||||
//- Reference to mesh
|
||||
const fvMesh& mesh_;
|
||||
|
||||
|
||||
public:
|
||||
@ -75,10 +75,9 @@ public:
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair,
|
||||
const bool registerObject
|
||||
const fvMesh& mesh
|
||||
),
|
||||
(dict, pair, registerObject)
|
||||
(dict, mesh)
|
||||
);
|
||||
|
||||
|
||||
@ -88,8 +87,7 @@ public:
|
||||
porousModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair,
|
||||
const bool registerObject
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
@ -102,7 +100,7 @@ public:
|
||||
static autoPtr<porousModel> New
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -47,7 +47,7 @@ namespace Foam
|
||||
class phasePair;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class surfaceTensionModel Declaration
|
||||
Class surfaceTensionModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class surfaceTensionModel
|
||||
|
||||
@ -39,88 +39,6 @@ License
|
||||
#include "fvcDiv.H"
|
||||
#include "surfaceInterpolate.H"
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class BasePhaseModel>
|
||||
Foam::tmp<Foam::surfaceScalarField>
|
||||
Foam::MovingPhaseModel<BasePhaseModel>::generatePhi
|
||||
(
|
||||
const word& phiName,
|
||||
const volVectorField& U
|
||||
) const
|
||||
{
|
||||
IOobject phiHeader
|
||||
(
|
||||
phiName,
|
||||
U.mesh().time().timeName(),
|
||||
U.mesh(),
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
if (phiHeader.typeHeaderOk<surfaceScalarField>(true))
|
||||
{
|
||||
Info<< "Reading face flux field " << phiName << endl;
|
||||
|
||||
return
|
||||
tmp<surfaceScalarField>
|
||||
(
|
||||
new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
phiName,
|
||||
U.mesh().time().timeName(),
|
||||
U.mesh(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
U.mesh()
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Calculating face flux field " << phiName << endl;
|
||||
|
||||
wordList phiTypes
|
||||
(
|
||||
U.boundaryField().size(),
|
||||
calculatedFvPatchScalarField::typeName
|
||||
);
|
||||
|
||||
forAll(U.boundaryField(), i)
|
||||
{
|
||||
if
|
||||
(
|
||||
isA<fixedValueFvPatchVectorField>(U.boundaryField()[i])
|
||||
|| isA<slipFvPatchVectorField>(U.boundaryField()[i])
|
||||
|| isA<partialSlipFvPatchVectorField>(U.boundaryField()[i])
|
||||
)
|
||||
{
|
||||
phiTypes[i] = fixedValueFvPatchScalarField::typeName;
|
||||
}
|
||||
}
|
||||
|
||||
return tmp<surfaceScalarField>
|
||||
(
|
||||
new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
phiName,
|
||||
U.mesh().time().timeName(),
|
||||
U.mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
fvc::interpolate(U) & U.mesh().Sf(),
|
||||
phiTypes
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasePhaseModel>
|
||||
@ -133,15 +51,6 @@ Foam::MovingPhaseModel<BasePhaseModel>::MovingPhaseModel
|
||||
BasePhaseModel(fluid, phaseName),
|
||||
U_(fluid.mesh().lookupObject<volVectorField>("U")),
|
||||
phi_(fluid.mesh().lookupObject<surfaceScalarField>("phi")),
|
||||
/*
|
||||
(
|
||||
generatePhi
|
||||
(
|
||||
IOobject::groupName("phi", phaseModel::name()),
|
||||
U_
|
||||
)
|
||||
),
|
||||
*/
|
||||
alphaPhi_
|
||||
(
|
||||
IOobject
|
||||
@ -212,4 +121,24 @@ Foam::MovingPhaseModel<BasePhaseModel>::U() const
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel>
|
||||
Foam::tmp<Foam::surfaceScalarField> Foam::MovingPhaseModel<BasePhaseModel>::
|
||||
diffNo() const
|
||||
{
|
||||
return tmp<surfaceScalarField>
|
||||
(
|
||||
new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("diffNo", phaseModel::name()),
|
||||
U_.mesh().time().timeName(),
|
||||
U_.mesh()
|
||||
),
|
||||
U_.mesh(),
|
||||
dimensionedScalar("0", dimless, 0.0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -67,16 +67,6 @@ class MovingPhaseModel
|
||||
surfaceScalarField alphaPhi_;
|
||||
|
||||
|
||||
// Private static member functions
|
||||
|
||||
//- Generate the flux field
|
||||
tmp<surfaceScalarField> generatePhi
|
||||
(
|
||||
const word& phiName,
|
||||
const volVectorField& U
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
@ -116,6 +106,9 @@ public:
|
||||
//- Access const reference to U
|
||||
virtual tmp<volVectorField> U() const;
|
||||
|
||||
//- Diffusion number
|
||||
virtual tmp<surfaceScalarField> diffNo() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -26,14 +26,18 @@ License
|
||||
#include "MultiComponentPhaseModel.H"
|
||||
|
||||
#include "phaseSystem.H"
|
||||
|
||||
#include "multiphaseSystem.H"
|
||||
#include "fvmDdt.H"
|
||||
#include "fvmDiv.H"
|
||||
#include "fvmSup.H"
|
||||
#include "fvmLaplacian.H"
|
||||
#include "fvcDdt.H"
|
||||
#include "fvcDiv.H"
|
||||
#include "fvcDDt.H"
|
||||
#include "fvMatrix.H"
|
||||
#include "fvcFlux.H"
|
||||
#include "CMULES.H"
|
||||
#include "subCycle.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -46,12 +50,6 @@ MultiComponentPhaseModel
|
||||
)
|
||||
:
|
||||
BasePhaseModel(fluid, phaseName),
|
||||
residualAlpha_
|
||||
(
|
||||
"residualAlpha",
|
||||
dimless,
|
||||
fluid.mesh().solverDict("Yi").lookup("residualAlpha")
|
||||
),
|
||||
species_(),
|
||||
inertIndex_(-1)
|
||||
{
|
||||
@ -74,14 +72,34 @@ MultiComponentPhaseModel
|
||||
|
||||
species_ = thermoPtr_->composition().species();
|
||||
|
||||
if (thermoPtr_().found("inertSpecie"))
|
||||
inertIndex_ = species_[thermoPtr_().lookup("inertSpecie")];
|
||||
|
||||
X_.setSize(thermoPtr_->composition().species().size());
|
||||
|
||||
// Initiate X's using Y's to set BC's
|
||||
forAll(species_, i)
|
||||
{
|
||||
inertIndex_ =
|
||||
species_
|
||||
[
|
||||
thermoPtr_().lookup("inertSpecie")
|
||||
];
|
||||
X_.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("X" + species_[i], phaseName),
|
||||
fluid.mesh().time().timeName(),
|
||||
fluid.mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
Y()[i]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Init vol fractions from mass fractions
|
||||
calculateVolumeFractions();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -95,6 +113,58 @@ Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
void Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>
|
||||
::calculateVolumeFractions()
|
||||
{
|
||||
volScalarField Xtotal(0.0*X_[0]);
|
||||
const volScalarField W(thermo().W());
|
||||
|
||||
forAll(X_, i)
|
||||
{
|
||||
const dimensionedScalar Wi
|
||||
(
|
||||
"W",
|
||||
dimMass/dimMoles,
|
||||
thermo().composition().W(i)
|
||||
);
|
||||
|
||||
if (i != inertIndex_)
|
||||
{
|
||||
X_[i] = W*Y()[i]/Wi;
|
||||
Xtotal += X_[i];
|
||||
X_[i].correctBoundaryConditions();
|
||||
}
|
||||
}
|
||||
X_[inertIndex_] = 1.0 - Xtotal;
|
||||
X_[inertIndex_].correctBoundaryConditions();
|
||||
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
void Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>
|
||||
::calculateMassFractions()
|
||||
{
|
||||
volScalarField W(X_[0]*thermo().composition().W(0));
|
||||
for(label i=1; i< species_.size(); i++)
|
||||
{
|
||||
W += X_[i]*thermo().composition().W(i);
|
||||
}
|
||||
|
||||
forAll(Y(), i)
|
||||
{
|
||||
Y()[i] = X_[i]*thermo().composition().W(i)/W;
|
||||
|
||||
Info<< Y()[i].name() << " mass fraction = "
|
||||
<< " Min(Y) = " << min(Y()[i]).value()
|
||||
<< " Max(Y) = " << max(Y()[i]).value()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
const phaseThermo&
|
||||
Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::thermo() const
|
||||
@ -112,47 +182,219 @@ Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::thermo()
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
Foam::tmp<Foam::fvScalarMatrix>
|
||||
Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::YiEqn
|
||||
void Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::correct()
|
||||
{
|
||||
return thermo().correct();
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
void Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::solveYi
|
||||
(
|
||||
volScalarField& Yi
|
||||
PtrList<volScalarField::Internal>& Su,
|
||||
PtrList<volScalarField::Internal>& Sp
|
||||
)
|
||||
{
|
||||
if
|
||||
(
|
||||
(inertIndex_ != -1)
|
||||
&& (
|
||||
Yi.name()
|
||||
==
|
||||
IOobject::groupName
|
||||
(
|
||||
thermoPtr_->composition().species()[inertIndex_],
|
||||
this->name()
|
||||
)
|
||||
)
|
||||
)
|
||||
const volScalarField& alpha1 = *this;
|
||||
|
||||
const fvMesh& mesh = alpha1.mesh();
|
||||
|
||||
const dictionary& MULEScontrols = mesh.solverDict(alpha1.name());
|
||||
|
||||
scalar cAlpha(readScalar(MULEScontrols.lookup("cYi")));
|
||||
|
||||
PtrList<surfaceScalarField> phiYiCorrs(species_.size());
|
||||
const surfaceScalarField& phi = this->fluid().phi();
|
||||
|
||||
surfaceScalarField phic(mag((phi)/mesh.magSf()));
|
||||
|
||||
phic = min(cAlpha*phic, max(phic));
|
||||
|
||||
surfaceScalarField phir(0.0*phi);
|
||||
|
||||
forAllConstIter(phaseSystem::phaseModelTable,this->fluid().phases(),iter2)
|
||||
{
|
||||
return tmp<fvScalarMatrix>();
|
||||
const volScalarField& alpha2 = iter2();
|
||||
if (&alpha2 == &alpha1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
phir += phic*this->fluid().nHatf(alpha1, alpha2);
|
||||
}
|
||||
|
||||
const volScalarField& alpha = *this;
|
||||
const surfaceScalarField& alphaPhi = this->alphaPhi();
|
||||
// Do not compress interface at non-coupled boundary faces
|
||||
// (inlets, outlets etc.)
|
||||
surfaceScalarField::Boundary& phirBf = phir.boundaryFieldRef();
|
||||
forAll(phir.boundaryField(), patchi)
|
||||
{
|
||||
fvsPatchScalarField& phirp = phirBf[patchi];
|
||||
|
||||
// surfaceScalarField alphaRhoPhi
|
||||
// (
|
||||
// fvc::interpolate(alpha)*this->fluid().phi()
|
||||
// );
|
||||
if (!phirp.coupled())
|
||||
{
|
||||
phirp == 0;
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
tmp<fvScalarMatrix>
|
||||
(
|
||||
fvm::ddt(alpha, Yi)
|
||||
+ fvm::div(alphaPhi, Yi, "div(" + alphaPhi.name() + ",Yi)")
|
||||
// - fvm::Sp(fvc::div(alphaPhi), Yi)
|
||||
==
|
||||
fvc::ddt(residualAlpha_, Yi)
|
||||
- fvm::ddt(residualAlpha_, Yi)
|
||||
);
|
||||
word phirScheme("div(Yiphir," + alpha1.name() + ')');
|
||||
|
||||
forAll(X_, i)
|
||||
{
|
||||
if (inertIndex_ != i)
|
||||
{
|
||||
volScalarField& Yi = X_[i];
|
||||
|
||||
phiYiCorrs.set
|
||||
(
|
||||
i,
|
||||
new surfaceScalarField
|
||||
(
|
||||
"phi" + Yi.name() + "Corr",
|
||||
fvc::flux
|
||||
(
|
||||
phi,
|
||||
Yi,
|
||||
"div(phi," + Yi.name() + ')'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
surfaceScalarField& phiYiCorr = phiYiCorrs[i];
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phaseModelTable, this->fluid().phases(), iter2
|
||||
)
|
||||
{
|
||||
//const volScalarField& alpha2 = iter2()().oldTime();
|
||||
const volScalarField& alpha2 = iter2();
|
||||
|
||||
if (&alpha2 == &alpha1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
phiYiCorr += fvc::flux
|
||||
(
|
||||
-fvc::flux(-phir, alpha2, phirScheme),
|
||||
Yi,
|
||||
phirScheme
|
||||
);
|
||||
}
|
||||
|
||||
// Ensure that the flux at inflow BCs is preserved
|
||||
forAll(phiYiCorr.boundaryField(), patchi)
|
||||
{
|
||||
fvsPatchScalarField& phiYiCorrp =
|
||||
phiYiCorr.boundaryFieldRef()[patchi];
|
||||
|
||||
if (!phiYiCorrp.coupled())
|
||||
{
|
||||
const scalarField& phi1p = phi.boundaryField()[patchi];
|
||||
const scalarField& Yip = Yi.boundaryField()[patchi];
|
||||
|
||||
forAll(phiYiCorrp, facei)
|
||||
{
|
||||
if (phi1p[facei] < 0)
|
||||
{
|
||||
phiYiCorrp[facei] = Yip[facei]*phi1p[facei];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MULES::limit
|
||||
(
|
||||
1.0/mesh.time().deltaT().value(),
|
||||
geometricOneField(),
|
||||
Yi,
|
||||
phi,
|
||||
phiYiCorr,
|
||||
Sp[i],
|
||||
Su[i],
|
||||
1,
|
||||
0,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
volScalarField Yt(0.0*X_[0]);
|
||||
|
||||
scalar nYiSubCycles
|
||||
(
|
||||
MULEScontrols.lookupOrDefault<scalar>("nYiSubCycles", 1)
|
||||
);
|
||||
|
||||
forAll(X_, i)
|
||||
{
|
||||
if (inertIndex_ != i)
|
||||
{
|
||||
volScalarField& Yi = X_[i];
|
||||
|
||||
fvScalarMatrix YiEqn
|
||||
(
|
||||
fv::EulerDdtScheme<scalar>(mesh).fvmDdt(Yi)
|
||||
+ fv::gaussConvectionScheme<scalar>
|
||||
(
|
||||
mesh,
|
||||
phi,
|
||||
upwind<scalar>(mesh, phi)
|
||||
).fvmDiv(phi, Yi)
|
||||
==
|
||||
Su[i] + fvm::Sp(Sp[i], Yi)
|
||||
);
|
||||
|
||||
YiEqn.solve();
|
||||
|
||||
surfaceScalarField& phiYiCorr = phiYiCorrs[i];
|
||||
|
||||
// Add a bounded upwind U-mean flux
|
||||
phiYiCorr += YiEqn.flux();
|
||||
|
||||
if (nYiSubCycles > 1)
|
||||
{
|
||||
for
|
||||
(
|
||||
subCycle<volScalarField> YiSubCycle(Yi, nYiSubCycles);
|
||||
!(++YiSubCycle).end();
|
||||
)
|
||||
{
|
||||
MULES::explicitSolve
|
||||
(
|
||||
geometricOneField(),
|
||||
Yi,
|
||||
phi,
|
||||
phiYiCorr,
|
||||
Sp[i],
|
||||
Su[i],
|
||||
1,
|
||||
0
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MULES::explicitSolve
|
||||
(
|
||||
geometricOneField(),
|
||||
Yi,
|
||||
phi,
|
||||
phiYiCorr,
|
||||
Sp[i],
|
||||
Su[i],
|
||||
1,
|
||||
0
|
||||
);
|
||||
}
|
||||
Yt += Yi;
|
||||
}
|
||||
}
|
||||
|
||||
X_[inertIndex_] = scalar(1) - Yt;
|
||||
X_[inertIndex_].max(0.0);
|
||||
|
||||
calculateMassFractions();
|
||||
}
|
||||
|
||||
|
||||
@ -173,100 +415,10 @@ Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::Y()
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
Foam::dimensionedScalar
|
||||
Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::hf
|
||||
(
|
||||
label index
|
||||
) const
|
||||
Foam::label
|
||||
Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::inertIndex() const
|
||||
{
|
||||
return dimensionedScalar
|
||||
(
|
||||
"Hc",
|
||||
sqr(dimLength)/sqr(dimTime),
|
||||
thermoPtr_->composition().Hc(index)
|
||||
);
|
||||
return inertIndex_;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
void Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::
|
||||
correctMassFractions()
|
||||
{
|
||||
volScalarField Yt
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("Yt", this->name()),
|
||||
this->fluid().mesh().time().timeName(),
|
||||
this->fluid().mesh()
|
||||
),
|
||||
this->fluid().mesh(),
|
||||
dimensionedScalar("zero", dimless, 0)
|
||||
);
|
||||
|
||||
PtrList<volScalarField>& Yi = thermoPtr_->composition().Y();
|
||||
|
||||
forAll(Yi, i)
|
||||
{
|
||||
if (i != inertIndex_)
|
||||
{
|
||||
Yt += Yi[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (inertIndex_ != -1)
|
||||
{
|
||||
Yi[inertIndex_] = scalar(1) - Yt;
|
||||
Yi[inertIndex_].max(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(Yi, i)
|
||||
{
|
||||
Yi[i] /= Yt;
|
||||
Yi[i].max(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::mu() const
|
||||
{
|
||||
return thermoPtr_->mu();
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::mu
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return thermoPtr_->mu()().boundaryField()[patchI];
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::nu() const
|
||||
{
|
||||
return thermoPtr_->nu();
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::nu
|
||||
(
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return thermoPtr_->nu(patchI);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -60,9 +60,6 @@ protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Residual phase fraction
|
||||
dimensionedScalar residualAlpha_;
|
||||
|
||||
//- Species table
|
||||
hashedWordList species_;
|
||||
|
||||
@ -72,6 +69,19 @@ protected:
|
||||
//- Thermophysical model
|
||||
autoPtr<phaseThermo> thermoPtr_;
|
||||
|
||||
//- Ptr list of volumetric fractions for species
|
||||
PtrList<volScalarField> X_;
|
||||
|
||||
|
||||
// Protected functions
|
||||
|
||||
//- Transfor volume fraction into mass fractions
|
||||
void calculateMassFractions();
|
||||
|
||||
//- Transfor mass fraction into volume fractions
|
||||
void calculateVolumeFractions();
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -107,8 +117,15 @@ public:
|
||||
//- Access non-const thermo
|
||||
virtual phaseThermo& thermo();
|
||||
|
||||
//- Return the species fraction equation
|
||||
virtual tmp<fvScalarMatrix> YiEqn(volScalarField& Yi);
|
||||
//- Correct phase thermo
|
||||
virtual void correct();
|
||||
|
||||
//- Solve species fraction equation
|
||||
virtual void solveYi
|
||||
(
|
||||
PtrList<volScalarField::Internal>&,
|
||||
PtrList<volScalarField::Internal>&
|
||||
);
|
||||
|
||||
//- Constant access the species mass fractions
|
||||
virtual const PtrList<volScalarField>& Y() const;
|
||||
@ -116,26 +133,8 @@ public:
|
||||
//- Access the species mass fractions
|
||||
virtual PtrList<volScalarField>& Y();
|
||||
|
||||
//- Return heat of formation for species
|
||||
virtual dimensionedScalar hf(label index) const;
|
||||
|
||||
//- Correct the mass fractions
|
||||
//void correctMassFractions();
|
||||
|
||||
|
||||
// Transport
|
||||
|
||||
//- Return the laminar dynamic viscosity
|
||||
virtual tmp<volScalarField> mu() const;
|
||||
|
||||
//- Return the laminar dynamic viscosity on a patch
|
||||
virtual tmp<scalarField> mu(const label patchI) const;
|
||||
|
||||
//- Return the laminar kinematic viscosity
|
||||
virtual tmp<volScalarField> nu() const;
|
||||
|
||||
//- Return the laminar kinematic viscosity on a patch
|
||||
virtual tmp<scalarField> nu(const label patchI) const;
|
||||
//- Return inert species index
|
||||
label inertIndex() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -60,23 +60,22 @@ Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::~PurePhaseModel()
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
Foam::tmp<Foam::fvScalarMatrix>
|
||||
Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::YiEqn
|
||||
void Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::solveYi
|
||||
(
|
||||
volScalarField& Yi
|
||||
PtrList<Foam::volScalarField::Internal>&,
|
||||
PtrList<Foam::volScalarField::Internal>&
|
||||
)
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"template<class BasePhaseModel> "
|
||||
"Foam::tmp<Foam::fvScalarMatrix> "
|
||||
"Foam::PurePhaseModel<BasePhaseModel>::YiEqn"
|
||||
"(volScalarField& Yi) const"
|
||||
"Foam::PurePhaseModel<BasePhaseModel>::solveYi()"
|
||||
);
|
||||
return tmp<fvScalarMatrix>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
const Foam::PtrList<Foam::volScalarField>&
|
||||
Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::Y() const
|
||||
@ -107,42 +106,4 @@ thermo()
|
||||
return thermoPtr_();
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::mu() const
|
||||
{
|
||||
return thermoPtr_->mu();
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::mu
|
||||
(
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
return thermoPtr_->mu(patchi);
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::nu() const
|
||||
{
|
||||
return thermoPtr_->nu();
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::nu
|
||||
(
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
return thermoPtr_->nu(patchi);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -84,9 +84,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the species fraction equation
|
||||
virtual tmp<fvScalarMatrix> YiEqn(volScalarField& Yi);
|
||||
|
||||
// Thermo
|
||||
|
||||
//- Return the species mass fractions
|
||||
@ -95,23 +92,18 @@ public:
|
||||
//- Access the species mass fractions
|
||||
virtual PtrList<volScalarField>& Y();
|
||||
|
||||
//- Access to thermo
|
||||
//- Solve species fraction equation
|
||||
virtual void solveYi
|
||||
(
|
||||
PtrList<volScalarField::Internal>&,
|
||||
PtrList<volScalarField::Internal>&
|
||||
);
|
||||
|
||||
//- Access to const thermo
|
||||
virtual const phaseThermo& thermo() const;
|
||||
|
||||
//- Access non-const thermo
|
||||
virtual phaseThermo& thermo();
|
||||
|
||||
//- Return the laminar dynamic viscosity
|
||||
virtual tmp<volScalarField> mu() const;
|
||||
|
||||
//- Access the laminar dynamic viscosity
|
||||
virtual tmp<scalarField> mu(const label patchi) const;
|
||||
|
||||
//- Return the laminar kinematic viscosity
|
||||
virtual tmp<volScalarField> nu() const;
|
||||
|
||||
//- Access the laminar kinematic viscosity
|
||||
virtual tmp<scalarField> nu(const label patchi) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -27,14 +27,6 @@ License
|
||||
|
||||
#include "phaseSystem.H"
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "slipFvPatchFields.H"
|
||||
#include "partialSlipFvPatchFields.H"
|
||||
|
||||
#include "fvmDdt.H"
|
||||
#include "fvmDiv.H"
|
||||
|
||||
#include "fvmSup.H"
|
||||
#include "fvcDdt.H"
|
||||
#include "fvcDiv.H"
|
||||
#include "surfaceInterpolate.H"
|
||||
@ -173,4 +165,18 @@ Foam::StaticPhaseModel<BasePhaseModel>::U() const
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel>
|
||||
Foam::tmp<Foam::surfaceScalarField> Foam::StaticPhaseModel<BasePhaseModel>
|
||||
::diffNo() const
|
||||
{
|
||||
tmp<surfaceScalarField> tkapparhoCpbyDelta
|
||||
(
|
||||
sqr(U_.mesh().surfaceInterpolation::deltaCoeffs())
|
||||
*fvc::interpolate(this->kappa().ref())
|
||||
/fvc::interpolate((this->Cp()*this->rho())())
|
||||
);
|
||||
|
||||
return tkapparhoCpbyDelta;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -93,7 +93,7 @@ public:
|
||||
//- Access the volumetric flux
|
||||
virtual const surfaceScalarField& phi();
|
||||
|
||||
//- Constant access the volumetric flux of the phase. Return zero field
|
||||
//- Constant access the volumetric flux of the phase.
|
||||
virtual tmp<surfaceScalarField> alphaPhi() const;
|
||||
|
||||
//- Access the volumetric flux of the phase
|
||||
@ -102,6 +102,9 @@ public:
|
||||
//- Access const reference to U
|
||||
virtual tmp<volVectorField> U() const;
|
||||
|
||||
//- Maximum diffusion number
|
||||
virtual tmp<surfaceScalarField> diffNo() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -56,8 +56,7 @@ Foam::phaseModel::phaseModel
|
||||
dimensionedScalar("alpha", dimless, 0)
|
||||
),
|
||||
fluid_(fluid),
|
||||
name_(phaseName),
|
||||
alphaMax_(fluid.subDict(phaseName).lookupOrDefault("alphaMax", 1.0))
|
||||
name_(phaseName)
|
||||
{}
|
||||
|
||||
|
||||
@ -81,12 +80,6 @@ const Foam::phaseSystem& Foam::phaseModel::fluid() const
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::phaseModel::alphaMax() const
|
||||
{
|
||||
return alphaMax_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::phaseModel::correct()
|
||||
{
|
||||
thermo().correct();
|
||||
@ -265,7 +258,7 @@ Foam::tmp<Foam::scalarField> Foam::phaseModel::alphaEff
|
||||
return (thermo().alpha(patchI) + alphat);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseModel::mu() const
|
||||
{
|
||||
return thermo().mu();
|
||||
@ -280,16 +273,15 @@ Foam::tmp<Foam::scalarField> Foam::phaseModel::mu(const label patchi) const
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseModel::nu() const
|
||||
{
|
||||
return (thermo().mu()/thermo().rho());
|
||||
return thermo().nu();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::phaseModel::nu(const label patchi) const
|
||||
{
|
||||
return (thermo().mu(patchi)/thermo().rho(patchi));
|
||||
return thermo().nu(patchi);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
bool Foam::phaseModel::read()
|
||||
{
|
||||
|
||||
@ -24,6 +24,9 @@ License
|
||||
Class
|
||||
Foam::phaseModel
|
||||
|
||||
Description
|
||||
|
||||
|
||||
SourceFiles
|
||||
phaseModel.C
|
||||
newphaseModel.C
|
||||
@ -64,9 +67,6 @@ class phaseModel
|
||||
//- Name of phase
|
||||
word name_;
|
||||
|
||||
//- Optional maximum phase-fraction (e.g. packing limit)
|
||||
scalar alphaMax_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -89,11 +89,8 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
phaseModel
|
||||
(
|
||||
const phaseSystem& fluid,
|
||||
const word& phaseName
|
||||
);
|
||||
//- Construct from phaseSystem and phaseName
|
||||
phaseModel(const phaseSystem& fluid, const word& phaseName);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -117,96 +114,102 @@ public:
|
||||
//- Return the system to which this phase belongs
|
||||
const phaseSystem& fluid() const;
|
||||
|
||||
//- Return the other phase in a two-phase system
|
||||
const phaseModel& otherPhase() const;
|
||||
|
||||
//- Return the maximum phase-fraction (e.g. packing limit)
|
||||
scalar alphaMax() const;
|
||||
|
||||
//- Correct the phase properties
|
||||
//- Correct phase thermo
|
||||
virtual void correct();
|
||||
|
||||
//- Correct the turbulence
|
||||
virtual void correctTurbulence();
|
||||
|
||||
//- Return the species fraction equation
|
||||
virtual tmp<fvScalarMatrix> YiEqn(volScalarField& Yi) = 0;
|
||||
//- Solve species fraction equation
|
||||
virtual void solveYi
|
||||
(
|
||||
PtrList<volScalarField::Internal>& Su,
|
||||
PtrList<volScalarField::Internal>& Sp
|
||||
) = 0;
|
||||
|
||||
//- Read phase properties dictionary
|
||||
virtual bool read();
|
||||
|
||||
|
||||
// Thermo
|
||||
// Thermo
|
||||
|
||||
//- Access const to phase thermo
|
||||
virtual const rhoThermo& thermo() const = 0;
|
||||
//- Access const to phase thermo
|
||||
virtual const rhoThermo& thermo() const = 0;
|
||||
|
||||
//- Access to phase thermo
|
||||
virtual rhoThermo& thermo() = 0;
|
||||
//- Access to phase thermo
|
||||
virtual rhoThermo& thermo() = 0;
|
||||
|
||||
//- Return the phase density
|
||||
tmp<volScalarField> rho() const;
|
||||
//- Return the phase density
|
||||
tmp<volScalarField> rho() const;
|
||||
|
||||
//- Return phase density on a patch
|
||||
tmp<scalarField> rho(const label patchi) const;
|
||||
//- Return phase density on a patch
|
||||
tmp<scalarField> rho(const label patchi) const;
|
||||
|
||||
//- Chemical enthalpy for phase [J/kg]
|
||||
tmp<volScalarField> hc() const;
|
||||
//- Chemical enthalpy for phase [J/kg]
|
||||
tmp<volScalarField> hc() const;
|
||||
|
||||
//- Return phase Cp
|
||||
tmp<volScalarField> Cp() const;
|
||||
//- Return phase Cp
|
||||
tmp<volScalarField> Cp() const;
|
||||
|
||||
//- Heat capacity of the phase at constant pressure for patch [J/kg/K]
|
||||
tmp<scalarField> Cp
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
//- Heat capacity of the phase at constant pressure for patch
|
||||
// [J/kg/K]
|
||||
tmp<scalarField> Cp
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Return Cv of the phase
|
||||
tmp<volScalarField> Cv() const;
|
||||
//- Return Cv of the phase
|
||||
tmp<volScalarField> Cv() const;
|
||||
|
||||
//- Heat capacity at constant volume for phase for a patch [J/kg/K]
|
||||
tmp<scalarField> Cv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchI
|
||||
) const;
|
||||
//- Heat capacity at constant volume for phase for a patch [J/kg/K]
|
||||
tmp<scalarField> Cv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchI
|
||||
) const;
|
||||
|
||||
//- Gamma = Cp/Cv of phase[]
|
||||
tmp<volScalarField> gamma() const;
|
||||
//- Gamma = Cp/Cv of phase[]
|
||||
tmp<volScalarField> gamma() const;
|
||||
|
||||
//- Gamma = Cp/Cv for phase on patch []
|
||||
tmp<scalarField> gamma
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
//- Gamma = Cp/Cv for phase on patch []
|
||||
tmp<scalarField> gamma
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Heat capacity at constant pressure/volume for phase [J/kg/K]
|
||||
tmp<volScalarField> Cpv() const;
|
||||
//- Heat capacity at constant pressure/volume for phase [J/kg/K]
|
||||
tmp<volScalarField> Cpv() const;
|
||||
|
||||
//- Heat capacity at constant pressure/volume for phase at patch [J/kg/K]
|
||||
tmp<scalarField> Cpv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
//- Heat capacity at constant pressure/volume for phase at patch
|
||||
// [J/kg/K]
|
||||
tmp<scalarField> Cpv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Heat capacity ratio for phase []
|
||||
tmp<volScalarField> CpByCpv() const;
|
||||
//- Heat capacity ratio for phase []
|
||||
tmp<volScalarField> CpByCpv() const;
|
||||
|
||||
//- Heat capacity ratio for phase at patch []
|
||||
tmp<scalarField> CpByCpv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
//- Heat capacity ratio for phase at patch []
|
||||
tmp<scalarField> CpByCpv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Query each thermo for dpdt
|
||||
Switch dpdt() const
|
||||
{
|
||||
return thermo().dpdt();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -217,27 +220,16 @@ public:
|
||||
const volScalarField& alpha() const;
|
||||
|
||||
//- Thermal diffusivity for enthalpy of mixture for patch [kg/m/s]
|
||||
const scalarField& alpha
|
||||
(
|
||||
const label patchi
|
||||
) const;
|
||||
const scalarField& alpha(const label patchi) const;
|
||||
|
||||
//- Thermal diffusivity for temperature of phase [J/m/s/K]
|
||||
tmp<volScalarField> kappa() const;
|
||||
|
||||
//- Thermal diffusivity for temperature
|
||||
// of phase for patch [J/m/s/K]
|
||||
tmp<scalarField> kappa
|
||||
(
|
||||
const label patchi
|
||||
) const;
|
||||
//- Thermal diffusivity for temperature of phase for patch [J/m/s/K]
|
||||
tmp<scalarField> kappa(const label patchi) const;
|
||||
|
||||
//- Effective thermal diffusivity for temperature
|
||||
// of phase [J/m/s/K]
|
||||
tmp<volScalarField> kappaEff
|
||||
(
|
||||
const volScalarField&
|
||||
) const;
|
||||
//- Effective thermal diffusivity for temperature of phase [J/m/s/K]
|
||||
tmp<volScalarField> kappaEff(const volScalarField&) const;
|
||||
|
||||
//- Effective thermal diffusivity for temperature
|
||||
// of phase for patch [J/m/s/K]
|
||||
@ -248,10 +240,7 @@ public:
|
||||
) const;
|
||||
|
||||
//- Effective thermal diffusivity of phase [kg/m/s]
|
||||
tmp<volScalarField> alphaEff
|
||||
(
|
||||
const volScalarField& alphat
|
||||
) const;
|
||||
tmp<volScalarField> alphaEff(const volScalarField& alphat) const;
|
||||
|
||||
//- Effective thermal diffusivity of phase for patch [kg/m/s]
|
||||
tmp<scalarField> alphaEff
|
||||
@ -261,30 +250,33 @@ public:
|
||||
) const;
|
||||
|
||||
//- Return the mixture kinematic viscosity
|
||||
virtual tmp<volScalarField> nu() const = 0;
|
||||
virtual tmp<volScalarField> nu() const;
|
||||
|
||||
//- Return the mixture kinematic viscosity on patchi
|
||||
virtual tmp<scalarField> nu(const label patchi) const = 0;
|
||||
virtual tmp<scalarField> nu(const label patchi) const;
|
||||
|
||||
//- Return the mixture dymanic viscosity
|
||||
virtual tmp<volScalarField> mu() const = 0;
|
||||
virtual tmp<volScalarField> mu() const;
|
||||
|
||||
//- Return the mixture dymanic viscosity on patchi
|
||||
virtual tmp<scalarField> mu(const label patchi) const = 0;
|
||||
virtual tmp<scalarField> mu(const label patchi) const;
|
||||
|
||||
//- Diffusion number
|
||||
virtual tmp<surfaceScalarField> diffNo() const = 0;
|
||||
|
||||
|
||||
|
||||
// Species information
|
||||
// Species
|
||||
|
||||
//- Constant access the species mass fractions
|
||||
virtual const PtrList<volScalarField>& Y() const = 0;
|
||||
//- Constant access the species mass fractions
|
||||
virtual const PtrList<volScalarField>& Y() const = 0;
|
||||
|
||||
//- Access the species mass fractions
|
||||
virtual PtrList<volScalarField>& Y() = 0;
|
||||
//- Access the species mass fractions
|
||||
virtual PtrList<volScalarField>& Y() = 0;
|
||||
|
||||
|
||||
|
||||
// Momentum
|
||||
// Momentum
|
||||
|
||||
|
||||
//- Constant access the volumetric flux
|
||||
@ -303,27 +295,27 @@ public:
|
||||
virtual tmp<volVectorField> U() const = 0;
|
||||
|
||||
|
||||
// Turbulence
|
||||
// Turbulence (WIP: possible to add turbulent on each phase)
|
||||
|
||||
/*
|
||||
//- Return the turbulent dynamic viscosity
|
||||
virtual tmp<volScalarField> mut() const = 0;
|
||||
/*
|
||||
//- Return the turbulent dynamic viscosity
|
||||
virtual tmp<volScalarField> mut() const = 0;
|
||||
|
||||
//- Return the turbulent dynamic viscosity on a patch
|
||||
virtual tmp<scalarField> mut(const label patchI) const = 0;
|
||||
//- Return the turbulent dynamic viscosity on a patch
|
||||
virtual tmp<scalarField> mut(const label patchI) const = 0;
|
||||
|
||||
//- Return the turbulent kinematic viscosity
|
||||
virtual tmp<volScalarField> nut() const = 0;
|
||||
//- Return the turbulent kinematic viscosity
|
||||
virtual tmp<volScalarField> nut() const = 0;
|
||||
|
||||
//- Return the turbulent kinematic viscosity on a patch
|
||||
virtual tmp<scalarField> nut(const label patchI) const = 0;
|
||||
//- Return the turbulent kinematic viscosity on a patch
|
||||
virtual tmp<scalarField> nut(const label patchI) const = 0;
|
||||
|
||||
//- Return the kinetic pressure derivative w.r.t. volume fraction
|
||||
virtual tmp<volScalarField> pPrime() const = 0;
|
||||
//- Return the kinetic pressure derivative w.r.t. volume fraction
|
||||
virtual tmp<volScalarField> pPrime() const = 0;
|
||||
|
||||
//- Return the turbulent kinetic energy
|
||||
virtual tmp<volScalarField> k() const = 0;
|
||||
*/
|
||||
//- Return the turbulent kinetic energy
|
||||
virtual tmp<volScalarField> k() const = 0;
|
||||
*/
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,14 +29,14 @@ License
|
||||
|
||||
Foam::orderedPhasePair::orderedPhasePair
|
||||
(
|
||||
const phaseModel& dispersed,
|
||||
const phaseModel& continuous
|
||||
const phaseModel& from,
|
||||
const phaseModel& to
|
||||
)
|
||||
:
|
||||
phasePair
|
||||
(
|
||||
dispersed,
|
||||
continuous,
|
||||
from,
|
||||
to,
|
||||
true
|
||||
)
|
||||
{}
|
||||
@ -50,13 +50,13 @@ Foam::orderedPhasePair::~orderedPhasePair()
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::phaseModel& Foam::orderedPhasePair::dispersed() const
|
||||
const Foam::phaseModel& Foam::orderedPhasePair::from() const
|
||||
{
|
||||
return phase1();
|
||||
}
|
||||
|
||||
|
||||
const Foam::phaseModel& Foam::orderedPhasePair::continuous() const
|
||||
const Foam::phaseModel& Foam::orderedPhasePair::to() const
|
||||
{
|
||||
return phase2();
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,8 +41,6 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class aspectRatioModel;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class orderedPhasePair Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -51,12 +49,6 @@ class orderedPhasePair
|
||||
:
|
||||
public phasePair
|
||||
{
|
||||
// Private member functions
|
||||
|
||||
//- Set the aspect ratio model, if there is one
|
||||
void setAspectRatioModel(const dictTable aspectRatioTable);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
@ -64,8 +56,8 @@ public:
|
||||
//- Construct from two phases and gravity
|
||||
orderedPhasePair
|
||||
(
|
||||
const phaseModel& dispersed,
|
||||
const phaseModel& continuous
|
||||
const phaseModel& from,
|
||||
const phaseModel& to
|
||||
);
|
||||
|
||||
|
||||
@ -76,10 +68,10 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Dispersed phase
|
||||
virtual const phaseModel& dispersed() const;
|
||||
virtual const phaseModel& from() const;
|
||||
|
||||
//- Continuous phase
|
||||
virtual const phaseModel& continuous() const;
|
||||
virtual const phaseModel& to() const;
|
||||
|
||||
//- Pair name
|
||||
virtual word name() const;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,8 +38,7 @@ Foam::phasePair::phasePair
|
||||
:
|
||||
phasePairKey(phase1.name(), phase2.name(), ordered),
|
||||
phase1_(phase1),
|
||||
phase2_(phase2),
|
||||
g_(phase1.mesh().lookupObject<uniformDimensionedVectorField>("g"))
|
||||
phase2_(phase2)
|
||||
{}
|
||||
|
||||
|
||||
@ -51,20 +50,20 @@ Foam::phasePair::~phasePair()
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::phaseModel& Foam::phasePair::dispersed() const
|
||||
const Foam::phaseModel& Foam::phasePair::from() const
|
||||
{
|
||||
FatalErrorIn("Foam::phasePair::dispersed() const")
|
||||
<< "Requested dispersed phase from an unordered pair."
|
||||
FatalErrorIn("Foam::phasePair::from() const")
|
||||
<< "Requested from phase from an unordered pair."
|
||||
<< exit(FatalError);
|
||||
|
||||
return phase1_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::phaseModel& Foam::phasePair::continuous() const
|
||||
const Foam::phaseModel& Foam::phasePair::to() const
|
||||
{
|
||||
FatalErrorIn("Foam::phasePair::dispersed() const")
|
||||
<< "Requested continuous phase from an unordered pair."
|
||||
FatalErrorIn("Foam::phasePair::to() const")
|
||||
<< "Requested to phase from an unordered pair."
|
||||
<< exit(FatalError);
|
||||
|
||||
return phase1_;
|
||||
@ -79,34 +78,4 @@ Foam::word Foam::phasePair::name() const
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phasePair::rho() const
|
||||
{
|
||||
return phase1()*phase1().rho() + phase2()*phase2().rho();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phasePair::Pr() const
|
||||
{
|
||||
return
|
||||
continuous().nu()
|
||||
*continuous().Cp()
|
||||
*continuous().rho()
|
||||
/continuous().kappa();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phasePair::sigma() const
|
||||
{
|
||||
return
|
||||
phase1().mesh().lookupObject<surfaceTensionModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
surfaceTensionModel::typeName,
|
||||
phasePair::name()
|
||||
)
|
||||
).sigma();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -22,7 +22,9 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::phasePair
|
||||
Foam::phasePair description for mass transfer between a pair of
|
||||
phases. The direction of the mass transfer is from the phase
|
||||
'from' to the phasse 'to'.
|
||||
|
||||
Description
|
||||
|
||||
@ -53,16 +55,6 @@ class phasePair
|
||||
{
|
||||
public:
|
||||
|
||||
// Hash table types
|
||||
|
||||
//- Dictionary hash table
|
||||
typedef HashTable<dictionary, phasePairKey, phasePairKey::hash>
|
||||
dictTable;
|
||||
|
||||
//- Scalar hash table
|
||||
typedef HashTable<scalar, phasePairKey, phasePairKey::hash>
|
||||
scalarTable;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -74,15 +66,12 @@ private:
|
||||
//- Phase 2
|
||||
const phaseModel& phase2_;
|
||||
|
||||
//- Gravitational acceleration
|
||||
const uniformDimensionedVectorField& g_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from two phases and gravity
|
||||
//- Construct from two phases
|
||||
phasePair
|
||||
(
|
||||
const phaseModel& phase1,
|
||||
@ -97,23 +86,15 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Dispersed phase
|
||||
virtual const phaseModel& dispersed() const;
|
||||
//- From phase
|
||||
virtual const phaseModel& from() const;
|
||||
|
||||
//- Continuous phase
|
||||
virtual const phaseModel& continuous() const;
|
||||
//- To phase
|
||||
virtual const phaseModel& to() const;
|
||||
|
||||
//- Pair name
|
||||
virtual word name() const;
|
||||
|
||||
//- Average density
|
||||
tmp<volScalarField> rho() const;
|
||||
|
||||
//- Prandtl number
|
||||
tmp<volScalarField> Pr() const;
|
||||
|
||||
//- Surface tension coefficient
|
||||
tmp<volScalarField> sigma() const;
|
||||
|
||||
|
||||
// Access
|
||||
@ -124,8 +105,6 @@ public:
|
||||
// Phase 2
|
||||
inline const phaseModel& phase2() const;
|
||||
|
||||
// Gravitation acceleration
|
||||
inline const uniformDimensionedVectorField& g() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -37,10 +37,4 @@ inline const Foam::phaseModel& Foam::phasePair::phase2() const
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::uniformDimensionedVectorField& Foam::phasePair::g() const
|
||||
{
|
||||
return g_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -58,13 +58,13 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
// Construct null
|
||||
//- Construct null
|
||||
hash();
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
// Generate a hash from a phase pair key
|
||||
//- Generate a hash from a phase pair key
|
||||
label operator()(const phasePairKey& key) const;
|
||||
};
|
||||
|
||||
|
||||
@ -29,15 +29,18 @@ License
|
||||
#include "Time.H"
|
||||
#include "subCycle.H"
|
||||
#include "fvcMeshPhi.H"
|
||||
#include "MULES.H"
|
||||
|
||||
#include "surfaceInterpolate.H"
|
||||
#include "fvcGrad.H"
|
||||
#include "fvcSnGrad.H"
|
||||
#include "fvcDiv.H"
|
||||
#include "fvcDdt.H"
|
||||
#include "fvcFlux.H"
|
||||
#include "fvmDdt.H"
|
||||
#include "fvcAverage.H"
|
||||
#include "fvMatrix.H"
|
||||
#include "fvmSup.H"
|
||||
#include "CMULES.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -56,17 +59,11 @@ Foam::multiphaseSystem::multiphaseSystem
|
||||
)
|
||||
:
|
||||
phaseSystem(mesh),
|
||||
dmdtContinuityError_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"dmdtContinuityError",
|
||||
mesh.time().timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", inv(dimTime), 0)
|
||||
)
|
||||
cAlphas_(mesh.solverDict("alpha").lookup("cAlphas")),
|
||||
ddtAlphaMax_(0.0),
|
||||
limitedPhiAlphas_(phaseModels_.size()),
|
||||
Su_(phaseModels_.size()),
|
||||
Sp_(phaseModels_.size())
|
||||
{
|
||||
label phaseI = 0;
|
||||
phases_.setSize(phaseModels_.size());
|
||||
@ -75,6 +72,44 @@ Foam::multiphaseSystem::multiphaseSystem
|
||||
phaseModel& pm = const_cast<phaseModel&>(iter()());
|
||||
phases_.set(phaseI++, &pm);
|
||||
}
|
||||
|
||||
// Initiate Su and Sp
|
||||
forAllConstIter(HashTable<autoPtr<phaseModel> >, phaseModels_, iter)
|
||||
{
|
||||
phaseModel& pm = const_cast<phaseModel&>(iter()());
|
||||
|
||||
Su_.insert
|
||||
(
|
||||
pm.name(),
|
||||
volScalarField::Internal
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Su" + pm.name(),
|
||||
mesh_.time().timeName(),
|
||||
mesh_
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("Su", dimless/dimTime, 0.0)
|
||||
)
|
||||
);
|
||||
|
||||
Sp_.insert
|
||||
(
|
||||
pm.name(),
|
||||
volScalarField::Internal
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Sp" + pm.name(),
|
||||
mesh_.time().timeName(),
|
||||
mesh_
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("Sp", dimless/dimTime, 0.0)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -87,6 +122,155 @@ Foam::multiphaseSystem::~multiphaseSystem()
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::multiphaseSystem::calculateSuSp()
|
||||
{
|
||||
forAllIter(phaseSystem::phasePairTable, totalPhasePairs_, iter)
|
||||
{
|
||||
const phasePair& pair = iter()();
|
||||
|
||||
const phaseModel& phase1 = pair.phase1();
|
||||
const phaseModel& phase2 = pair.phase2();
|
||||
|
||||
const volScalarField& alpha1 = pair.phase1();
|
||||
const volScalarField& alpha2 = pair.phase2();
|
||||
|
||||
tmp<volScalarField> tCoeffs1 = this->coeffs(phase1.name());
|
||||
const volScalarField& coeffs1 = tCoeffs1();
|
||||
|
||||
tmp<volScalarField> tCoeffs2 = this->coeffs(phase2.name());
|
||||
const volScalarField& coeffs2 = tCoeffs2();
|
||||
|
||||
// Phase 1 to phase 2
|
||||
const phasePairKey key12
|
||||
(
|
||||
phase1.name(),
|
||||
phase2.name(),
|
||||
true
|
||||
);
|
||||
|
||||
|
||||
tmp<volScalarField> tdmdt12(this->dmdt(key12));
|
||||
const volScalarField& dmdt12 = tdmdt12();
|
||||
|
||||
// Phase 2 to phase 1
|
||||
const phasePairKey key21
|
||||
(
|
||||
phase2.name(),
|
||||
phase1.name(),
|
||||
true
|
||||
);
|
||||
|
||||
tmp<volScalarField> tdmdt21(this->dmdt(key21));
|
||||
const volScalarField& dmdt21 = tdmdt21();
|
||||
|
||||
volScalarField::Internal& SpPhase1 = Sp_[phase1.name()];
|
||||
|
||||
volScalarField::Internal& SuPhase1 = Su_[phase1.name()];
|
||||
|
||||
volScalarField::Internal& SpPhase2 = Sp_[phase2.name()];
|
||||
|
||||
volScalarField::Internal& SuPhase2 = Su_[phase2.name()];
|
||||
|
||||
const volScalarField dmdtNet(dmdt21 - dmdt12);
|
||||
|
||||
const volScalarField coeffs12(coeffs1 - coeffs2);
|
||||
|
||||
// NOTE: dmdtNet is distributed in terms =
|
||||
// Source for phase 1 =
|
||||
// dmdtNet/rho1
|
||||
// - alpha1*dmdtNet(1/rho1 - 1/rho2)
|
||||
|
||||
forAll(dmdtNet, celli)
|
||||
{
|
||||
scalar dmdt21 = dmdtNet[celli];
|
||||
scalar coeffs12Cell = coeffs12[celli];
|
||||
|
||||
scalar alpha1Limited = max(min(alpha1[celli], 1.0), 0.0);
|
||||
|
||||
// exp.
|
||||
SuPhase1[celli] += coeffs1[celli]*dmdt21;
|
||||
|
||||
if (dmdt21 > 0)
|
||||
{
|
||||
if (coeffs12Cell > 0)
|
||||
{
|
||||
// imp
|
||||
SpPhase1[celli] -= dmdt21*coeffs12Cell;
|
||||
}
|
||||
else if (coeffs12Cell < 0)
|
||||
{
|
||||
// exp
|
||||
SuPhase1[celli] -=
|
||||
dmdt21*coeffs12Cell*alpha1Limited;
|
||||
}
|
||||
}
|
||||
else if (dmdt21 < 0)
|
||||
{
|
||||
if (coeffs12Cell > 0)
|
||||
{
|
||||
// exp
|
||||
SuPhase1[celli] -=
|
||||
dmdt21*coeffs12Cell*alpha1Limited;
|
||||
}
|
||||
else if (coeffs12Cell < 0)
|
||||
{
|
||||
// imp
|
||||
SpPhase1[celli] -= dmdt21*coeffs12Cell;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
forAll(dmdtNet, celli)
|
||||
{
|
||||
scalar dmdt12 = -dmdtNet[celli];
|
||||
scalar coeffs21Cell = -coeffs12[celli];
|
||||
|
||||
scalar alpha2Limited = max(min(alpha2[celli], 1.0), 0.0);
|
||||
|
||||
// exp
|
||||
SuPhase2[celli] += coeffs2[celli]*dmdt12;
|
||||
|
||||
if (dmdt12 > 0)
|
||||
{
|
||||
if (coeffs21Cell > 0)
|
||||
{
|
||||
// imp
|
||||
SpPhase2[celli] -= dmdt12*coeffs21Cell;
|
||||
}
|
||||
else if (coeffs21Cell < 0)
|
||||
{
|
||||
// exp
|
||||
SuPhase2[celli] -=
|
||||
dmdt12*coeffs21Cell*alpha2Limited;
|
||||
}
|
||||
}
|
||||
else if (dmdt12 < 0)
|
||||
{
|
||||
if (coeffs21Cell > 0)
|
||||
{
|
||||
// exp
|
||||
SuPhase2[celli] -=
|
||||
coeffs21Cell*dmdt12*alpha2Limited;
|
||||
}
|
||||
else if (coeffs21Cell < 0)
|
||||
{
|
||||
// imp
|
||||
SpPhase2[celli] -= dmdt12*coeffs21Cell;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update ddtAlphaMax
|
||||
ddtAlphaMax_ =
|
||||
max
|
||||
(
|
||||
ddtAlphaMax_.value(),
|
||||
max(gMax((dmdt21*coeffs1)()), gMax((dmdt12*coeffs2)()))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::multiphaseSystem::solve()
|
||||
{
|
||||
const fvMesh& mesh = this->mesh();
|
||||
@ -94,8 +278,10 @@ void Foam::multiphaseSystem::solve()
|
||||
const dictionary& alphaControls = mesh.solverDict("alpha");
|
||||
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
|
||||
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr")));
|
||||
scalar cAlpha(readScalar(alphaControls.lookup("cAlpha")));
|
||||
scalar icAlpha(readScalar(alphaControls.lookup("icAlpha")));
|
||||
mesh.solverDict("alpha").lookup("cAlphas") >> cAlphas_;
|
||||
|
||||
// Reset ddtAlphaMax
|
||||
ddtAlphaMax_ = dimensionedScalar("zero", dimless, 0.0);
|
||||
|
||||
PtrList<surfaceScalarField> phiAlphaCorrs(phases_.size());
|
||||
|
||||
@ -103,20 +289,17 @@ void Foam::multiphaseSystem::solve()
|
||||
|
||||
surfaceScalarField phic(mag((phi)/mesh_.magSf()));
|
||||
|
||||
phic = min(cAlpha*phic, max(phic));
|
||||
|
||||
// Add the optional isotropic compression contribution
|
||||
if (icAlpha > 0)
|
||||
// Do not compress interface at non-coupled boundary faces
|
||||
// (inlets, outlets etc.)
|
||||
surfaceScalarField::Boundary& phicBf = phic.boundaryFieldRef();
|
||||
forAll(phic.boundaryField(), patchi)
|
||||
{
|
||||
phic *= (1.0 - icAlpha);
|
||||
phic += (cAlpha*icAlpha)*fvc::interpolate(mag(this->U()));
|
||||
}
|
||||
fvsPatchScalarField& phicp = phicBf[patchi];
|
||||
|
||||
forAllIter(UPtrList<phaseModel>, phases_, iter)
|
||||
{
|
||||
phaseModel& phase1 = iter();
|
||||
volScalarField& alpha1 = phase1;
|
||||
alpha1.correctBoundaryConditions();
|
||||
if (!phicp.coupled())
|
||||
{
|
||||
phicp == 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (int acorr=0; acorr<nAlphaCorr; acorr++)
|
||||
@ -154,6 +337,19 @@ void Foam::multiphaseSystem::solve()
|
||||
continue;
|
||||
}
|
||||
|
||||
const phasePairKey key12(phase1.name(), phase2.name());
|
||||
|
||||
if (!cAlphas_.found(key12))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Phase compression factor (cAlpha) not found for : "
|
||||
<< key12
|
||||
<< exit(FatalError);
|
||||
}
|
||||
scalar cAlpha = cAlphas_.find(key12)();
|
||||
|
||||
phic = min(cAlpha*phic, max(phic));
|
||||
|
||||
surfaceScalarField phir(phic*nHatf(alpha1, alpha2));
|
||||
|
||||
word phirScheme
|
||||
@ -163,7 +359,7 @@ void Foam::multiphaseSystem::solve()
|
||||
|
||||
phiAlphaCorr += fvc::flux
|
||||
(
|
||||
-fvc::flux(-phir, alpha2, phirScheme),
|
||||
-fvc::flux(-phir, alpha2, phirScheme),
|
||||
alpha1,
|
||||
phirScheme
|
||||
);
|
||||
@ -209,171 +405,7 @@ void Foam::multiphaseSystem::solve()
|
||||
|
||||
|
||||
// Fill Su and Sp
|
||||
forAllIter(phaseSystem::phasePairTable, totalPhasePairs_, iter)
|
||||
{
|
||||
const phasePair& pair = iter()();
|
||||
|
||||
const phaseModel& phase1 = pair.phase1();
|
||||
const phaseModel& phase2 = pair.phase2();
|
||||
|
||||
const volScalarField& alpha1 = pair.phase1();
|
||||
const volScalarField& alpha2 = pair.phase2();
|
||||
|
||||
tmp<volScalarField> tCoeffs1 = this->coeffs(phase1.name());
|
||||
const volScalarField& coeffs1 = tCoeffs1();
|
||||
|
||||
tmp<volScalarField> tCoeffs2 = this->coeffs(phase2.name());
|
||||
const volScalarField& coeffs2 = tCoeffs2();
|
||||
|
||||
// Phase 1 to phase 2
|
||||
const phasePairKey key12
|
||||
(
|
||||
phase1.name(),
|
||||
phase2.name(),
|
||||
true
|
||||
);
|
||||
|
||||
|
||||
tmp<volScalarField> tdmdt12(this->dmdt(key12));
|
||||
const volScalarField& dmdt12 = tdmdt12();
|
||||
|
||||
// Phase 2 to phase 1
|
||||
const phasePairKey key21
|
||||
(
|
||||
phase2.name(),
|
||||
phase1.name(),
|
||||
true
|
||||
);
|
||||
|
||||
tmp<volScalarField> tdmdt21(this->dmdt(key21));
|
||||
const volScalarField& dmdt21 = tdmdt21();
|
||||
|
||||
volScalarField::Internal& SpPhase1 =
|
||||
Sp_[phase1.name()];
|
||||
|
||||
volScalarField::Internal& SuPhase1 =
|
||||
Su_[phase1.name()];
|
||||
|
||||
volScalarField::Internal& SpPhase2 =
|
||||
Sp_[phase2.name()];
|
||||
|
||||
volScalarField::Internal& SuPhase2 =
|
||||
Su_[phase2.name()];
|
||||
|
||||
const volScalarField dmdtNet(dmdt21 - dmdt12);
|
||||
|
||||
const volScalarField coeffs12(coeffs1 - coeffs2);
|
||||
|
||||
//DebugVar(max(coeffs1.internalField()));
|
||||
//DebugVar(min(coeffs1.internalField()));
|
||||
|
||||
// NOTE: dmdtNet is distributed in terms =
|
||||
// Source for phase 1 =
|
||||
// dmdtNet/rho1
|
||||
// - alpha1*dmdtNet(1/rho1 - 1/rho2)
|
||||
|
||||
forAll(dmdtNet, celli)
|
||||
{
|
||||
scalar dmdt21 = dmdtNet[celli];
|
||||
scalar coeffs12Cell = coeffs12[celli];
|
||||
|
||||
scalar alpha1Limited = max(min(alpha1[celli], 1.0), 0.0);
|
||||
|
||||
// exp.
|
||||
SuPhase1[celli] += coeffs1[celli]*dmdt21;
|
||||
|
||||
if (dmdt21 > 0)
|
||||
{
|
||||
if (coeffs12Cell > 0)
|
||||
{
|
||||
// imp
|
||||
SpPhase1[celli] -= dmdt21*coeffs12Cell;
|
||||
}
|
||||
else if (coeffs12Cell < 0)
|
||||
{
|
||||
// exp
|
||||
SuPhase1[celli] -=
|
||||
dmdt21*coeffs12Cell*alpha1Limited;
|
||||
}
|
||||
}
|
||||
else if (dmdt21 < 0)
|
||||
{
|
||||
if (coeffs12Cell > 0)
|
||||
{
|
||||
// exp
|
||||
SuPhase1[celli] -=
|
||||
dmdt21*coeffs12Cell*alpha1Limited;
|
||||
}
|
||||
else if (coeffs12Cell < 0)
|
||||
{
|
||||
// imp
|
||||
SpPhase1[celli] -= dmdt21*coeffs12Cell;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
forAll(dmdtNet, celli)
|
||||
{
|
||||
scalar dmdt12 = -dmdtNet[celli];
|
||||
scalar coeffs21Cell = -coeffs12[celli];
|
||||
|
||||
scalar alpha2Limited = max(min(alpha2[celli], 1.0), 0.0);
|
||||
|
||||
// exp
|
||||
SuPhase2[celli] += coeffs2[celli]*dmdt12;
|
||||
|
||||
if (dmdt12 > 0)
|
||||
{
|
||||
if (coeffs21Cell > 0)
|
||||
{
|
||||
// imp
|
||||
SpPhase2[celli] -= dmdt12*coeffs21Cell;
|
||||
}
|
||||
else if (coeffs21Cell < 0)
|
||||
{
|
||||
// exp
|
||||
SuPhase2[celli] -=
|
||||
dmdt12*coeffs21Cell*alpha2Limited;
|
||||
}
|
||||
}
|
||||
else if (dmdt12 < 0)
|
||||
{
|
||||
if (coeffs21Cell > 0)
|
||||
{
|
||||
// exp
|
||||
SuPhase2[celli] -=
|
||||
coeffs21Cell*dmdt12*alpha2Limited;
|
||||
}
|
||||
else if (coeffs21Cell < 0)
|
||||
{
|
||||
// imp
|
||||
SpPhase2[celli] -= dmdt12*coeffs21Cell;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DebugVar(key12);
|
||||
DebugVar(key21);
|
||||
|
||||
DebugVar(max(dmdt21.internalField()));
|
||||
DebugVar(max(dmdt12.internalField()));
|
||||
|
||||
DebugVar(min(dmdt21.internalField()));
|
||||
DebugVar(min(dmdt12.internalField()));
|
||||
|
||||
//DebugVar(max(SpPhase2));
|
||||
//DebugVar(max(SpPhase1));
|
||||
|
||||
//DebugVar(min(SpPhase2));
|
||||
//DebugVar(min(SpPhase1));
|
||||
|
||||
//DebugVar(max(SuPhase2));
|
||||
//DebugVar(max(SuPhase1));
|
||||
|
||||
//DebugVar(min(SuPhase2));
|
||||
//DebugVar(min(SuPhase1));
|
||||
}
|
||||
|
||||
calculateSuSp();
|
||||
|
||||
// Limit phiAlphaCorr on each phase
|
||||
phasei = 0;
|
||||
@ -423,17 +455,30 @@ void Foam::multiphaseSystem::solve()
|
||||
phaseModel& phase = iter();
|
||||
volScalarField& alpha1 = phase;
|
||||
|
||||
const volScalarField::Internal& Su = Su_[phase.name()];
|
||||
|
||||
const volScalarField::Internal& Su =
|
||||
Su_[phase.name()];
|
||||
|
||||
const volScalarField::Internal& Sp =
|
||||
Sp_[phase.name()];
|
||||
const volScalarField::Internal& Sp = Sp_[phase.name()];
|
||||
|
||||
surfaceScalarField& phiAlpha = phiAlphaCorrs[phasei];
|
||||
|
||||
// Add a bounded upwind U-mean flux
|
||||
phiAlpha += upwind<scalar>(mesh_, phi).flux(alpha1);
|
||||
//phiAlpha += upwind<scalar>(mesh_, phi).flux(alpha1);
|
||||
fvScalarMatrix alpha1Eqn
|
||||
(
|
||||
fv::EulerDdtScheme<scalar>(mesh).fvmDdt(alpha1)
|
||||
+ fv::gaussConvectionScheme<scalar>
|
||||
(
|
||||
mesh,
|
||||
phi,
|
||||
upwind<scalar>(mesh, phi)
|
||||
).fvmDiv(phi, alpha1)
|
||||
==
|
||||
Su + fvm::Sp(Sp, alpha1)
|
||||
);
|
||||
|
||||
alpha1Eqn.solve();
|
||||
|
||||
phiAlpha += alpha1Eqn.flux();
|
||||
|
||||
if (nAlphaSubCycles > 1)
|
||||
{
|
||||
@ -447,8 +492,6 @@ void Foam::multiphaseSystem::solve()
|
||||
!(++alphaSubCycle).end();
|
||||
)
|
||||
{
|
||||
//surfaceScalarField phiAlphaCorrs0(phiAlphaCorrs[phasei]);
|
||||
|
||||
MULES::explicitSolve
|
||||
(
|
||||
geometricOneField(),
|
||||
@ -457,17 +500,17 @@ void Foam::multiphaseSystem::solve()
|
||||
phiAlpha,
|
||||
(alphaSubCycle.index()*Sp)(),
|
||||
(Su - (alphaSubCycle.index() - 1)*Sp*alpha1)(),
|
||||
phase.alphaMax(),
|
||||
1,
|
||||
0
|
||||
);
|
||||
|
||||
if (alphaSubCycle.index() == 1)
|
||||
{
|
||||
phase.alphaPhi() = phiAlpha;//phiAlphaCorrs0;
|
||||
phase.alphaPhi() = phiAlpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
phase.alphaPhi() += phiAlpha;//phiAlphaCorrs0;
|
||||
phase.alphaPhi() += phiAlpha;
|
||||
}
|
||||
}
|
||||
|
||||
@ -479,8 +522,6 @@ void Foam::multiphaseSystem::solve()
|
||||
phaseModel& phase = iter();
|
||||
volScalarField& alpha1 = phase;
|
||||
|
||||
//surfaceScalarField& phiAlpha = phiAlphaCorrs[phasei];
|
||||
|
||||
MULES::explicitSolve
|
||||
(
|
||||
geometricOneField(),
|
||||
@ -489,11 +530,10 @@ void Foam::multiphaseSystem::solve()
|
||||
phiAlpha,
|
||||
Sp,
|
||||
Su,
|
||||
phase.alphaMax(),
|
||||
1,
|
||||
0
|
||||
);
|
||||
|
||||
|
||||
phase.alphaPhi() = phiAlpha;
|
||||
}
|
||||
|
||||
@ -527,27 +567,6 @@ void Foam::multiphaseSystem::solve()
|
||||
rhoPhi_ +=
|
||||
fvc::interpolate(phase.rho())*phase.alphaPhi();
|
||||
|
||||
|
||||
Info<< alpha1.name() << " volume fraction = "
|
||||
<< alpha1.weightedAverage(mesh.V()).value()
|
||||
<< " Min(alpha) = " << min(alpha1).value()
|
||||
<< " Max(alpha) = " << max(alpha1).value()
|
||||
<< endl;
|
||||
|
||||
//DebugVar(max(alpha1.internalField()));
|
||||
//DebugVar(min(alpha1.internalField()));
|
||||
|
||||
volScalarField dAlphadt("dAlphadt", fvc::ddt(alpha1));
|
||||
|
||||
//DebugVar(max(dAlphadt.internalField()));
|
||||
//DebugVar(min(dAlphadt.internalField()));
|
||||
if (mesh.time().outputTime())
|
||||
{
|
||||
//volScalarField divrhoPhi("divrhoPhi", fvc::div(rhoPhi_));
|
||||
//divrhoPhi.write();
|
||||
//dAlphadt.write();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Info<< "Phase-sum volume fraction, min, max = "
|
||||
@ -555,23 +574,26 @@ void Foam::multiphaseSystem::solve()
|
||||
<< ' ' << min(sumAlpha).value()
|
||||
<< ' ' << max(sumAlpha).value()
|
||||
<< endl;
|
||||
|
||||
volScalarField sumCorr(1.0 - sumAlpha);
|
||||
|
||||
forAllIter(UPtrList<phaseModel>, phases_, iter)
|
||||
{
|
||||
phaseModel& phase = iter();
|
||||
volScalarField& alpha = phase;
|
||||
alpha += alpha*sumCorr;
|
||||
|
||||
Info<< alpha.name() << " volume fraction = "
|
||||
<< alpha.weightedAverage(mesh.V()).value()
|
||||
<< " Min(alpha) = " << min(alpha).value()
|
||||
<< " Max(alpha) = " << max(alpha).value()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const Foam::volScalarField& Foam::multiphaseSystem::dmdtContinuityError() const
|
||||
{
|
||||
return dmdtContinuityError_;
|
||||
}
|
||||
|
||||
|
||||
Foam::volScalarField& Foam::multiphaseSystem::dmdtContinuityError()
|
||||
{
|
||||
return dmdtContinuityError_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::UPtrList<Foam::phaseModel>& Foam::multiphaseSystem::phases() const
|
||||
{
|
||||
return phases_;
|
||||
@ -596,4 +618,51 @@ Foam::phaseModel& Foam::multiphaseSystem::phase(const label i)
|
||||
}
|
||||
|
||||
|
||||
Foam::dimensionedScalar Foam::multiphaseSystem::ddtAlphaMax() const
|
||||
{
|
||||
return ddtAlphaMax_;
|
||||
}
|
||||
|
||||
Foam::scalar Foam::multiphaseSystem::maxDiffNo() const
|
||||
{
|
||||
phaseModelTable::const_iterator phaseModelIter = phaseModels_.begin();
|
||||
tmp<surfaceScalarField> kapparhoCpbyDelta(phaseModelIter()->diffNo());
|
||||
|
||||
scalar DiNum =
|
||||
max(kapparhoCpbyDelta.ref()).value()*mesh_.time().deltaT().value();
|
||||
|
||||
++phaseModelIter;
|
||||
for (; phaseModelIter != phaseModels_.end(); ++ phaseModelIter)
|
||||
{
|
||||
kapparhoCpbyDelta = phaseModelIter()->diffNo();
|
||||
DiNum =
|
||||
max
|
||||
(
|
||||
DiNum,
|
||||
max(kapparhoCpbyDelta).value()*mesh_.time().deltaT().value()
|
||||
);
|
||||
}
|
||||
return DiNum;
|
||||
}
|
||||
|
||||
const Foam::multiphaseSystem::compressionFluxTable&
|
||||
Foam::multiphaseSystem::limitedPhiAlphas() const
|
||||
{
|
||||
return limitedPhiAlphas_;
|
||||
}
|
||||
|
||||
Foam::multiphaseSystem::SuSpTable& Foam::multiphaseSystem::Su()
|
||||
{
|
||||
return Su_;
|
||||
}
|
||||
|
||||
Foam::multiphaseSystem::SuSpTable& Foam::multiphaseSystem::Sp()
|
||||
{
|
||||
return Sp_;
|
||||
}
|
||||
|
||||
bool Foam::multiphaseSystem::read()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -37,6 +37,7 @@ SourceFiles
|
||||
|
||||
#include "phaseSystem.H"
|
||||
#include "UPtrList.H"
|
||||
#include "phasePairKey.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -53,14 +54,46 @@ class multiphaseSystem
|
||||
{
|
||||
protected:
|
||||
|
||||
typedef
|
||||
HashTable
|
||||
<
|
||||
volScalarField::Internal,
|
||||
word,
|
||||
word::hash
|
||||
>
|
||||
SuSpTable;
|
||||
|
||||
typedef HashTable<scalar, phasePairKey, phasePairKey::hash>
|
||||
scalarTable;
|
||||
|
||||
typedef HashTable<surfaceScalarField, word, word::hash>
|
||||
compressionFluxTable;
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Unallocated phase list
|
||||
UPtrList<phaseModel> phases_;
|
||||
|
||||
//- dmdt continuity error
|
||||
volScalarField dmdtContinuityError_;
|
||||
//- Table for compression factors between phases
|
||||
scalarTable cAlphas_;
|
||||
|
||||
//- Maximum volumen rate change
|
||||
dimensionedScalar ddtAlphaMax_;
|
||||
|
||||
//- Compression fluxed for phases
|
||||
compressionFluxTable limitedPhiAlphas_;
|
||||
|
||||
//- Su phase source terms
|
||||
SuSpTable Su_;
|
||||
|
||||
//- Sp phase source terms
|
||||
SuSpTable Sp_;
|
||||
|
||||
|
||||
// Protected members
|
||||
|
||||
//- Calculate Sp and Su
|
||||
void calculateSuSp();
|
||||
|
||||
public:
|
||||
|
||||
@ -105,12 +138,6 @@ public:
|
||||
// Access
|
||||
|
||||
|
||||
//- Constant access the dmdt continuity error
|
||||
const volScalarField& dmdtContinuityError() const;
|
||||
|
||||
//- Access the dmdt continuity error
|
||||
volScalarField& dmdtContinuityError();
|
||||
|
||||
//- Return phases
|
||||
const UPtrList<phaseModel>& phases() const;
|
||||
|
||||
@ -118,10 +145,29 @@ public:
|
||||
UPtrList<phaseModel>& phases();
|
||||
|
||||
//- Constant access phase model i
|
||||
virtual const phaseModel& phase(const label i) const;
|
||||
const phaseModel& phase(const label i) const;
|
||||
|
||||
//- Access phase model i
|
||||
virtual phaseModel& phase(const label i);
|
||||
phaseModel& phase(const label i);
|
||||
|
||||
//- Access to ddtAlphaMax
|
||||
dimensionedScalar ddtAlphaMax() const;
|
||||
|
||||
//- Maximum diffusion number
|
||||
scalar maxDiffNo() const;
|
||||
|
||||
//- Access to compression fluxes for phaes
|
||||
const compressionFluxTable& limitedPhiAlphas() const;
|
||||
|
||||
//- Access Su
|
||||
SuSpTable& Su();
|
||||
|
||||
//- Access Sp
|
||||
SuSpTable& Sp();
|
||||
|
||||
//- Read thermophysical properties dictionary
|
||||
virtual bool read();
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,25 +27,21 @@ License
|
||||
|
||||
#include "phaseSystem.H"
|
||||
#include "multiphaseSystem.H"
|
||||
#include "MeltingEvaporationPhaseSystem.H"
|
||||
#include "MassTransferPhaseSystem.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef
|
||||
MeltingEvaporationPhaseSystem
|
||||
<
|
||||
multiphaseSystem
|
||||
>
|
||||
meltingEvaporationMultiphaseSystem;
|
||||
MassTransferPhaseSystem<multiphaseSystem> massTransferMultiphaseSystem;
|
||||
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
multiphaseSystem,
|
||||
meltingEvaporationMultiphaseSystem,
|
||||
massTransferMultiphaseSystem,
|
||||
dictionary,
|
||||
meltingEvaporationMultiphaseSystem
|
||||
massTransferMultiphaseSystem
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,7 +38,7 @@ Foam::autoPtr<Foam::multiphaseSystem> Foam::multiphaseSystem::New
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
propertiesName,
|
||||
phasePropertiesName,
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
|
||||
@ -49,7 +49,7 @@ namespace Foam
|
||||
|
||||
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
|
||||
|
||||
const Foam::word Foam::phaseSystem::propertiesName("phaseProperties");
|
||||
const Foam::word Foam::phaseSystem::phasePropertiesName("phaseProperties");
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -104,10 +104,7 @@ Foam::tmp<Foam::surfaceScalarField> Foam::phaseSystem::generatePhi
|
||||
}
|
||||
|
||||
|
||||
void Foam::phaseSystem::generatePairs
|
||||
(
|
||||
const dictTable& modelDicts
|
||||
)
|
||||
void Foam::phaseSystem::generatePairs(const dictTable& modelDicts)
|
||||
{
|
||||
forAllConstIter(dictTable, modelDicts, iter)
|
||||
{
|
||||
@ -210,7 +207,7 @@ Foam::phaseSystem::phaseSystem
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
basicThermo(mesh, word::null, "phaseProperties"),
|
||||
basicThermo(mesh, word::null, phasePropertiesName),
|
||||
mesh_(mesh),
|
||||
phaseNames_(lookup("phases")),
|
||||
phi_
|
||||
@ -220,11 +217,11 @@ Foam::phaseSystem::phaseSystem
|
||||
"phi",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("rhoPhi", dimVolume/dimTime, 0.0)
|
||||
dimensionedScalar("zero", dimVolume/dimTime, 0.0)
|
||||
),
|
||||
rhoPhi_
|
||||
(
|
||||
@ -237,13 +234,11 @@ Foam::phaseSystem::phaseSystem
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("rhoPhi", dimMass/dimTime, 0.0)
|
||||
dimensionedScalar("zero", dimMass/dimTime, 0.0)
|
||||
),
|
||||
phaseModels_(generatePhaseModels(phaseNames_)),
|
||||
phasePairs_(),
|
||||
totalPhasePairs_(),
|
||||
Su_(phaseModels_.size()),
|
||||
Sp_(phaseModels_.size()),
|
||||
Prt_
|
||||
( dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
@ -251,60 +246,31 @@ Foam::phaseSystem::phaseSystem
|
||||
)
|
||||
)
|
||||
{
|
||||
rhoPhi_.setOriented();
|
||||
phi_.setOriented();
|
||||
|
||||
// sub models
|
||||
if (found("surfaceTension"))
|
||||
{
|
||||
generatePairsAndSubModels("surfaceTension", surfaceTensionModels_);
|
||||
generatePairsAndSubModels
|
||||
(
|
||||
"surfaceTension",
|
||||
mesh_,
|
||||
surfaceTensionModels_
|
||||
);
|
||||
}
|
||||
if (found("interfacePorous"))
|
||||
{
|
||||
generatePairsAndSubModels
|
||||
(
|
||||
"interfacePorous",
|
||||
mesh_,
|
||||
interfacePorousModelTable_
|
||||
);
|
||||
}
|
||||
|
||||
// Total phase pair
|
||||
generatePairsTable();
|
||||
|
||||
// Initiate Su and Sp
|
||||
forAllConstIter(HashTable<autoPtr<phaseModel> >, phaseModels_, iter)
|
||||
{
|
||||
phaseModel& pm = const_cast<phaseModel&>(iter()());
|
||||
|
||||
Su_.insert
|
||||
(
|
||||
pm.name(),
|
||||
volScalarField::Internal
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Su" + pm.name(),
|
||||
mesh_.time().timeName(),
|
||||
mesh_
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("Su", dimless/dimTime, 0.0)
|
||||
)
|
||||
);
|
||||
|
||||
Sp_.insert
|
||||
(
|
||||
pm.name(),
|
||||
volScalarField::Internal
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Sp" + pm.name(),
|
||||
mesh_.time().timeName(),
|
||||
mesh_
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("Sp", dimless/dimTime, 0.0)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -361,7 +327,6 @@ Foam::tmp<Foam::volScalarField> Foam::phaseSystem::hc() const
|
||||
phaseModelIter()()*phaseModelIter()->hc()
|
||||
);
|
||||
|
||||
|
||||
++phaseModelIter;
|
||||
for (; phaseModelIter != phaseModels_.end(); phaseModelIter++)
|
||||
{
|
||||
@ -482,26 +447,6 @@ Foam::tmp<Foam::scalarField> Foam::phaseSystem::Cp
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseSystem::rhoCv() const
|
||||
{
|
||||
phaseModelTable::const_iterator phaseModelIter = phaseModels_.begin();
|
||||
|
||||
tmp<volScalarField> tmpRhoCv
|
||||
(
|
||||
phaseModelIter()()*phaseModelIter()->rho()*phaseModelIter()->Cv()
|
||||
);
|
||||
|
||||
++phaseModelIter;
|
||||
for (; phaseModelIter != phaseModels_.end(); phaseModelIter++)
|
||||
{
|
||||
tmpRhoCv.ref() +=
|
||||
phaseModelIter()()*phaseModelIter()->rho()*phaseModelIter()->Cv();
|
||||
}
|
||||
|
||||
return tmpRhoCv;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseSystem::Cv() const
|
||||
{
|
||||
phaseModelTable::const_iterator phaseModelIter = phaseModels_.begin();
|
||||
@ -545,36 +490,6 @@ Foam::tmp<Foam::scalarField> Foam::phaseSystem::Cv
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::phaseSystem::rhoCv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
phaseModelTable::const_iterator phaseModelIter = phaseModels_.begin();
|
||||
|
||||
tmp<scalarField> tmpRhoCv
|
||||
(
|
||||
phaseModelIter()()
|
||||
*phaseModelIter()->rho(patchI)
|
||||
*phaseModelIter()->Cv(p, T, patchI)
|
||||
);
|
||||
|
||||
++phaseModelIter;
|
||||
for (; phaseModelIter != phaseModels_.end(); ++ phaseModelIter)
|
||||
{
|
||||
tmpRhoCv.ref() +=
|
||||
phaseModelIter()()
|
||||
*phaseModelIter()->rho(patchI)
|
||||
*phaseModelIter()->Cv(p, T, patchI);
|
||||
}
|
||||
|
||||
return tmpRhoCv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseSystem::gamma() const
|
||||
{
|
||||
phaseModelTable::const_iterator phaseModelIter = phaseModels_.begin();
|
||||
@ -676,7 +591,6 @@ Foam::tmp<Foam::volScalarField> Foam::phaseSystem::CpByCpv() const
|
||||
}
|
||||
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::phaseSystem::CpByCpv
|
||||
(
|
||||
const scalarField& p,
|
||||
@ -704,6 +618,13 @@ Foam::tmp<Foam::scalarField> Foam::phaseSystem::CpByCpv
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseSystem::W() const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<volScalarField>();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseSystem::kappa() const
|
||||
{
|
||||
phaseModelTable::const_iterator phaseModelIter = phaseModels_.begin();
|
||||
@ -931,7 +852,6 @@ Foam::surfaceScalarField& Foam::phaseSystem::rhoPhi()
|
||||
|
||||
void Foam::phaseSystem::correct()
|
||||
{
|
||||
// Correct phase thermos
|
||||
forAllIter(phaseModelTable, phaseModels_, phaseModelIter)
|
||||
{
|
||||
phaseModelIter()->correct();
|
||||
@ -948,28 +868,6 @@ void Foam::phaseSystem::correctTurbulence()
|
||||
}
|
||||
|
||||
|
||||
bool Foam::phaseSystem::read()
|
||||
{
|
||||
if (regIOobject::read())
|
||||
{
|
||||
bool readOK = true;
|
||||
|
||||
forAllIter(phaseModelTable, phaseModels_, phaseModelIter)
|
||||
{
|
||||
readOK &= phaseModelIter()->read();
|
||||
}
|
||||
|
||||
// models ...
|
||||
|
||||
return readOK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const Foam::phaseSystem::phaseModelTable& Foam::phaseSystem::phases() const
|
||||
{
|
||||
return phaseModels_;
|
||||
@ -995,7 +893,6 @@ Foam::phaseSystem::phasePairTable& Foam::phaseSystem::totalPhasePairs()
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Foam::phaseSystem::incompressible() const
|
||||
{
|
||||
bool incompressible = true;
|
||||
@ -1058,6 +955,7 @@ Foam::phaseSystem::surfaceTensionForce() const
|
||||
);
|
||||
|
||||
surfaceScalarField& stf = tstf.ref();
|
||||
stf.setOriented();
|
||||
|
||||
if (surfaceTensionModels_.size() > 0)
|
||||
{
|
||||
@ -1083,7 +981,7 @@ Foam::phaseSystem::surfaceTensionForce() const
|
||||
* fvc::interpolate(K(alpha1, alpha2))*
|
||||
(
|
||||
fvc::interpolate(alpha2)*fvc::snGrad(alpha1)
|
||||
- fvc::interpolate(alpha1)*fvc::snGrad(alpha2)
|
||||
- fvc::interpolate(alpha1)*fvc::snGrad(alpha2)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1121,76 +1019,6 @@ Foam::tmp<Foam::volVectorField> Foam::phaseSystem::U() const
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::surfaceScalarField> Foam::phaseSystem::phiMixture() const
|
||||
{
|
||||
tmp<surfaceScalarField> tstf
|
||||
(
|
||||
new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phiMixture",
|
||||
mesh_.time().timeName(),
|
||||
mesh_
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("phi", dimVolume/dimTime, 0.0)
|
||||
)
|
||||
);
|
||||
|
||||
surfaceScalarField& stf = tstf.ref();
|
||||
|
||||
forAllConstIter(phaseModelTable, phaseModels_, iter1)
|
||||
{
|
||||
stf += fvc::interpolate(iter1()())*iter1()->phi();
|
||||
}
|
||||
|
||||
return tstf;
|
||||
}
|
||||
|
||||
Foam::tmp<Foam::surfaceScalarField> Foam::phaseSystem::phig
|
||||
(
|
||||
const surfaceScalarField& ghf
|
||||
) const
|
||||
{
|
||||
tmp<surfaceScalarField> tstf
|
||||
(
|
||||
new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phig",
|
||||
mesh_.time().timeName(),
|
||||
mesh_
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar
|
||||
(
|
||||
"phig",
|
||||
dimMass/dimArea/sqr(dimTime),
|
||||
0.0
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
surfaceScalarField& stf = tstf.ref();
|
||||
|
||||
forAllConstIter(phaseModelTable, phaseModels_, iter1)
|
||||
{
|
||||
const volScalarField& alpha1 = iter1()();
|
||||
const surfaceScalarField alphaf(fvc::interpolate(alpha1));
|
||||
surfaceScalarField faceMask
|
||||
(
|
||||
localMin<scalar>(mesh_).interpolate(pos(alpha1 - 0.9))
|
||||
);
|
||||
// Limiting phig to almost pure phase
|
||||
stf += ghf*alphaf*fvc::snGrad(this->rho())*faceMask;
|
||||
}
|
||||
|
||||
return tstf;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::phaseSystem::surfaceTensionCoeff(const phasePairKey& key) const
|
||||
{
|
||||
@ -1198,6 +1026,15 @@ Foam::phaseSystem::surfaceTensionCoeff(const phasePairKey& key) const
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseSystem::coeffs
|
||||
(
|
||||
const word& key
|
||||
) const
|
||||
{
|
||||
return 1.0/(phaseModels_[key]->thermo().rho());
|
||||
}
|
||||
|
||||
|
||||
void Foam::phaseSystem::addInterfacePorosity(fvVectorMatrix& UEqn)
|
||||
{
|
||||
const scalarField& Vc = mesh_.V();
|
||||
@ -1234,12 +1071,6 @@ void Foam::phaseSystem::addInterfacePorosity(fvVectorMatrix& UEqn)
|
||||
interfacePorousModelTable_[keyik];
|
||||
|
||||
Udiag += Vc*interfacePtr->S();
|
||||
|
||||
if (mesh_.time().outputTime())
|
||||
{
|
||||
volScalarField S("S", interfacePtr->S());
|
||||
S.write();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1350,5 +1181,20 @@ Foam::tmp<Foam::surfaceScalarField> Foam::phaseSystem::nHatf
|
||||
return nHatfv(alpha1, alpha2) & mesh_.Sf();
|
||||
}
|
||||
|
||||
|
||||
bool Foam::phaseSystem::read()
|
||||
{
|
||||
if (regIOobject::read())
|
||||
{
|
||||
bool readOK = true;
|
||||
|
||||
return readOK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
|
||||
@ -25,7 +25,6 @@ Class
|
||||
Foam::phaseSystem
|
||||
|
||||
Description
|
||||
Class to represent a system of inmisible phases.
|
||||
|
||||
SourceFiles
|
||||
phaseSystem.C
|
||||
@ -67,14 +66,6 @@ class phaseSystem
|
||||
public:
|
||||
|
||||
// Public typedefs
|
||||
typedef
|
||||
HashPtrTable
|
||||
<
|
||||
fvScalarMatrix,
|
||||
word,
|
||||
string::hash
|
||||
>
|
||||
massTransferTable;
|
||||
|
||||
typedef
|
||||
HashTable
|
||||
@ -84,13 +75,14 @@ public:
|
||||
phasePairTable;
|
||||
|
||||
|
||||
typedef
|
||||
HashTable<autoPtr<phaseModel>, word, word::hash> phaseModelTable;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected typedefs
|
||||
|
||||
typedef
|
||||
HashTable<autoPtr<phaseModel>, word, word::hash> phaseModelTable;
|
||||
|
||||
typedef
|
||||
HashTable<dictionary, phasePairKey, phasePairKey::hash> dictTable;
|
||||
|
||||
@ -115,15 +107,6 @@ protected:
|
||||
interfacePorousModelTable;
|
||||
|
||||
|
||||
typedef
|
||||
HashTable
|
||||
<
|
||||
volScalarField::Internal,
|
||||
word,
|
||||
word::hash
|
||||
>
|
||||
SuSpTable;
|
||||
|
||||
|
||||
// Protected data
|
||||
|
||||
@ -142,19 +125,12 @@ protected:
|
||||
//- Phase models
|
||||
phaseModelTable phaseModels_;
|
||||
|
||||
//- Phase pairs. Used to hold references for sub-models only.
|
||||
// It accumulates phase pairs defined by sub-models
|
||||
//- Phase pairs
|
||||
phasePairTable phasePairs_;
|
||||
|
||||
//- Total ordered phase pairs in the system
|
||||
phasePairTable totalPhasePairs_;
|
||||
|
||||
//- Su phase source terms
|
||||
SuSpTable Su_;
|
||||
|
||||
//- Sp phase source terms
|
||||
SuSpTable Sp_;
|
||||
|
||||
//- Turbulent Prandt number
|
||||
dimensionedScalar Prt_;
|
||||
|
||||
@ -189,7 +165,7 @@ protected:
|
||||
//- Generate pair table
|
||||
void generatePairsTable();
|
||||
|
||||
//- Generate pairs and sub-model tables
|
||||
//- Generate pairs and sub-model tables using pair keys
|
||||
template<class modelType>
|
||||
void createSubModels
|
||||
(
|
||||
@ -202,6 +178,20 @@ protected:
|
||||
>& models
|
||||
);
|
||||
|
||||
//- Generate pairs and sub-model tables using mesh
|
||||
template<class modelType>
|
||||
void createSubModels
|
||||
(
|
||||
const dictTable& modelDicts,
|
||||
const fvMesh& mesh,
|
||||
HashTable
|
||||
<
|
||||
autoPtr<modelType>,
|
||||
phasePairKey,
|
||||
phasePairKey::hash
|
||||
>& models
|
||||
);
|
||||
|
||||
//- Generate pairs and sub-model tables
|
||||
template<class modelType>
|
||||
void generatePairsAndSubModels
|
||||
@ -215,6 +205,22 @@ protected:
|
||||
>& models
|
||||
);
|
||||
|
||||
|
||||
//- Generate pairs and per-phase sub-model tables with mesh ref
|
||||
template<class modelType>
|
||||
void generatePairsAndSubModels
|
||||
(
|
||||
const word& modelName,
|
||||
const fvMesh& mesh,
|
||||
HashTable
|
||||
<
|
||||
autoPtr<modelType>,
|
||||
phasePairKey,
|
||||
phasePairKey::hash
|
||||
>& models
|
||||
);
|
||||
|
||||
|
||||
//- Generate pairs and per-phase sub-model tables
|
||||
template<class modelType>
|
||||
void generatePairsAndSubModels
|
||||
@ -229,13 +235,15 @@ protected:
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("phaseSystem");
|
||||
|
||||
//- Default name of the phase properties dictionary
|
||||
static const word propertiesName;
|
||||
static const word phasePropertiesName;
|
||||
|
||||
|
||||
// Constructors
|
||||
@ -251,6 +259,7 @@ public:
|
||||
// Energy related thermo functionaliy functions
|
||||
|
||||
//- Return access to the inernal energy field [J/Kg]
|
||||
// NOTE: this mixture thermo is prepared to to work with T
|
||||
virtual volScalarField& he()
|
||||
{
|
||||
NotImplemented;
|
||||
@ -264,6 +273,7 @@ public:
|
||||
}
|
||||
|
||||
//- Return access to the inernal energy field [J/Kg]
|
||||
// NOTE: this mixture thermo is prepared to to work with T
|
||||
virtual const volScalarField& he() const
|
||||
{
|
||||
NotImplemented;
|
||||
@ -297,7 +307,7 @@ public:
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Chemical enthalpy oft he mixture [J/kg]
|
||||
//- Chemical enthalpy of the mixture [J/kg]
|
||||
virtual tmp<volScalarField> hc() const;
|
||||
|
||||
//- Temperature from enthalpy/internal energy for cell-set
|
||||
@ -305,7 +315,7 @@ public:
|
||||
(
|
||||
const scalarField& h,
|
||||
const scalarField& p,
|
||||
const scalarField& T0, // starting temperature
|
||||
const scalarField& T0,
|
||||
const labelList& cells
|
||||
) const;
|
||||
|
||||
@ -314,7 +324,7 @@ public:
|
||||
(
|
||||
const scalarField& h,
|
||||
const scalarField& p,
|
||||
const scalarField& T0, // starting temperature
|
||||
const scalarField& T0,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
@ -341,8 +351,6 @@ public:
|
||||
//- Return Cv of the mixture
|
||||
virtual tmp<volScalarField> Cv() const;
|
||||
|
||||
//- Return rho weighted Cv of the mixture
|
||||
tmp<volScalarField> rhoCv() const;
|
||||
|
||||
//- Heat capacity at constant volume for patch [J/kg/K]
|
||||
virtual tmp<scalarField> Cv
|
||||
@ -352,13 +360,6 @@ public:
|
||||
const label patchI
|
||||
) const;
|
||||
|
||||
//- Heat capacity rho weighted at constant volume for patch [J/kg/K]
|
||||
tmp<scalarField> rhoCv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchI
|
||||
) const;
|
||||
|
||||
//- Gamma = Cp/Cv []
|
||||
virtual tmp<volScalarField> gamma() const;
|
||||
@ -393,6 +394,9 @@ public:
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Molecular weight [kg/kmol] of the mixture
|
||||
virtual tmp<volScalarField> W() const;
|
||||
|
||||
|
||||
// Transport
|
||||
|
||||
@ -439,24 +443,23 @@ public:
|
||||
const dimensionedScalar& Prt() const;
|
||||
|
||||
|
||||
// Access to transport state variables
|
||||
// Access to transport state variables
|
||||
|
||||
//- Dynamic viscosity of mixture [kg/m/s]
|
||||
virtual tmp<volScalarField> mu() const;
|
||||
//- Dynamic viscosity of mixture [kg/m/s]
|
||||
virtual tmp<volScalarField> mu() const;
|
||||
|
||||
//- Dynamic viscosity of mixture for patch [kg/m/s]
|
||||
virtual tmp<scalarField> mu(const label patchi) const;
|
||||
//- Dynamic viscosity of mixture for patch [kg/m/s]
|
||||
virtual tmp<scalarField> mu(const label patchi) const;
|
||||
|
||||
//- Kinematic viscosity of mixture [m^2/s]
|
||||
virtual tmp<volScalarField> nu() const;
|
||||
//- Kinematic viscosity of mixture [m^2/s]
|
||||
virtual tmp<volScalarField> nu() const;
|
||||
|
||||
//- Kinematic viscosity of mixture for patch [m^2/s]
|
||||
virtual tmp<scalarField> nu(const label patchi) const;
|
||||
//- Kinematic viscosity of mixture for patch [m^2/s]
|
||||
virtual tmp<scalarField> nu(const label patchi) const;
|
||||
|
||||
|
||||
// Phase fluxes
|
||||
|
||||
|
||||
//- Constant access to the total flux
|
||||
const surfaceScalarField& phi() const;
|
||||
|
||||
@ -472,13 +475,6 @@ public:
|
||||
//- Mixture U
|
||||
tmp<volVectorField> U() const;
|
||||
|
||||
//- Mixture phi
|
||||
tmp<surfaceScalarField> phiMixture() const;
|
||||
|
||||
//- Calculate buoyant flux
|
||||
tmp<surfaceScalarField> phig(const surfaceScalarField& ghf) const;
|
||||
|
||||
|
||||
|
||||
// Surface tension
|
||||
|
||||
@ -492,50 +488,58 @@ public:
|
||||
) const;
|
||||
|
||||
|
||||
//- Return coefficients (1/rho)
|
||||
virtual tmp<volScalarField> coeffs(const word& key) const;
|
||||
|
||||
|
||||
// Interface porous between solid/fluid phases
|
||||
|
||||
//- Add interface porosity on phasePair
|
||||
void addInterfacePorosity(fvVectorMatrix& UEqn);
|
||||
|
||||
|
||||
// Interphase mass and heat transfer defined in specialized systems
|
||||
// Inter-Phase mass and heat transfe
|
||||
|
||||
//- Return interfacial source mass rate per phase pair
|
||||
virtual tmp<volScalarField> dmdt(const phasePairKey& key) const = 0;
|
||||
|
||||
|
||||
//- Return species interfacial source mass rate per species other
|
||||
// than the species driven models (i.e driven by pressure or temperature)
|
||||
virtual tmp<volScalarField> dmdtYi
|
||||
(
|
||||
const word& phaseSpeciesName
|
||||
) const = 0;
|
||||
|
||||
//- Return coefficients (1/rho)
|
||||
virtual tmp<volScalarField> coeffs(const word& key) const = 0;
|
||||
|
||||
//- Return the heat transfer matrices
|
||||
virtual tmp<fvScalarMatrix> heatTransfer
|
||||
(
|
||||
const volScalarField& T
|
||||
) = 0;
|
||||
|
||||
//- Return mass transfer table
|
||||
virtual autoPtr<massTransferTable> massTransfer
|
||||
//- Calculate mass transfer
|
||||
//virtual void massTransfer(const volScalarField& T) = 0;
|
||||
|
||||
//- Calculate mass transfer for species
|
||||
virtual void massSpeciesTransfer
|
||||
(
|
||||
const volScalarField& T
|
||||
const phaseModel& phase,
|
||||
volScalarField::Internal& Su,
|
||||
volScalarField::Internal& Sp,
|
||||
const word speciesName
|
||||
) = 0;
|
||||
|
||||
|
||||
// Solve phases and correct models
|
||||
|
||||
//- Solve for the phase fractions
|
||||
//- Solve for the phase transport equations
|
||||
virtual void solve() = 0;
|
||||
|
||||
//- Correct the thermo
|
||||
//- Correct the mixture thermos
|
||||
virtual void correct();
|
||||
|
||||
//- Return the name of the thermo physics
|
||||
virtual word thermoName() const
|
||||
{
|
||||
NotImplemented
|
||||
return word();
|
||||
}
|
||||
|
||||
//- Correct the turbulence
|
||||
// (NOTE: Each phase could help its own turbulence)
|
||||
virtual void correctTurbulence();
|
||||
|
||||
//- Read base phaseProperties dictionary
|
||||
@ -565,8 +569,8 @@ public:
|
||||
template <class modelType>
|
||||
const modelType& lookupSubModel
|
||||
(
|
||||
const phaseModel& dispersed,
|
||||
const phaseModel& continuous
|
||||
const phaseModel& from,
|
||||
const phaseModel& to
|
||||
) const;
|
||||
|
||||
|
||||
|
||||
@ -48,13 +48,42 @@ void Foam::phaseSystem::createSubModels
|
||||
modelType::New
|
||||
(
|
||||
*iter,
|
||||
phasePairs_[key]
|
||||
phasePairs_[key]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class modelType>
|
||||
void Foam::phaseSystem::createSubModels
|
||||
(
|
||||
const dictTable& modelDicts,
|
||||
const fvMesh& mesh,
|
||||
HashTable
|
||||
<
|
||||
autoPtr<modelType>,
|
||||
phasePairKey,
|
||||
phasePairKey::hash
|
||||
>& models
|
||||
)
|
||||
{
|
||||
forAllConstIter(dictTable, modelDicts, iter)
|
||||
{
|
||||
const phasePairKey& key = iter.key();
|
||||
|
||||
models.insert
|
||||
(
|
||||
key,
|
||||
modelType::New
|
||||
(
|
||||
*iter,
|
||||
mesh
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
template<class modelType>
|
||||
void Foam::phaseSystem::generatePairsAndSubModels
|
||||
(
|
||||
@ -77,6 +106,29 @@ void Foam::phaseSystem::generatePairsAndSubModels
|
||||
}
|
||||
|
||||
|
||||
template<class modelType>
|
||||
void Foam::phaseSystem::generatePairsAndSubModels
|
||||
(
|
||||
const word& modelName,
|
||||
const fvMesh& mesh,
|
||||
HashTable
|
||||
<
|
||||
autoPtr<modelType>,
|
||||
phasePairKey,
|
||||
phasePairKey::hash
|
||||
>& models
|
||||
)
|
||||
{
|
||||
|
||||
dictTable modelDicts(lookup(modelName));
|
||||
|
||||
generatePairs(modelDicts);
|
||||
|
||||
createSubModels(modelDicts, mesh, models);
|
||||
|
||||
}
|
||||
|
||||
|
||||
template<class modelType>
|
||||
void Foam::phaseSystem::generatePairsAndSubModels
|
||||
(
|
||||
@ -139,11 +191,11 @@ const modelType& Foam::phaseSystem::lookupSubModel(const phasePair& key) const
|
||||
template <class modelType>
|
||||
const modelType& Foam::phaseSystem::lookupSubModel
|
||||
(
|
||||
const phaseModel& dispersed,
|
||||
const phaseModel& continuous
|
||||
const phaseModel& from,
|
||||
const phaseModel& to
|
||||
) const
|
||||
{
|
||||
return lookupSubModel<modelType>(orderedPhasePair(dispersed, continuous));
|
||||
return lookupSubModel<modelType>(orderedPhasePair(from, to));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -34,7 +34,19 @@ Description
|
||||
if (adjustTimeStep)
|
||||
{
|
||||
scalar maxDeltaTFact =
|
||||
min(maxCo/(CoNum + SMALL), maxAlphaCo/(alphaCoNum + SMALL));
|
||||
min
|
||||
(
|
||||
maxCo/(CoNum + SMALL),
|
||||
min
|
||||
(
|
||||
maxAlphaCo/(alphaCoNum + SMALL),
|
||||
min
|
||||
(
|
||||
maxAlphaDdt/(ddtAlphaNum + SMALL),
|
||||
maxDi/(DiNum + SMALL)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||
|
||||
@ -46,7 +58,6 @@ if (adjustTimeStep)
|
||||
maxDeltaT
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "deltaT = " << runTime.deltaTValue() << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -95,18 +95,7 @@ Foam::tmp<Foam::Field<Type>> Foam::Function1Types::Constant<Type>::value
|
||||
|
||||
|
||||
template<class Type>
|
||||
<<<<<<< HEAD
|
||||
Foam::tmp<Foam::Field<Type>> Foam::Function1Types::Constant<Type>::integrate
|
||||
=======
|
||||
bool Foam::Function1Types::Constant<Type>::isConstant() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Type Foam::Function1Types::Constant<Type>::integrate
|
||||
>>>>>>> c61dc5e... ENH: adding thermo changes to handle multiphase T based thermos
|
||||
(
|
||||
const scalarField& x1,
|
||||
const scalarField& x2
|
||||
|
||||
@ -121,9 +121,6 @@ public:
|
||||
const scalarField& x2
|
||||
) const;
|
||||
|
||||
//- Return true for Constant type
|
||||
virtual bool isConstant() const;
|
||||
|
||||
//- Write in dictionary format
|
||||
virtual void writeData(Ostream& os) const;
|
||||
};
|
||||
|
||||
@ -157,13 +157,6 @@ Foam::FieldFunction1<Function1Type>::integrate
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
bool Foam::Function1<Type>::isConstant() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::Function1<Type>::writeData(Ostream& os) const
|
||||
{
|
||||
|
||||
@ -154,9 +154,6 @@ public:
|
||||
const scalarField& x2
|
||||
) const;
|
||||
|
||||
//- Return true for Constant type
|
||||
virtual bool isConstant() const;
|
||||
|
||||
|
||||
// I/O
|
||||
|
||||
|
||||
@ -119,12 +119,6 @@ Type Foam::TimeFunction1<Type>::integrate
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
bool Foam::TimeFunction1<Type>::isConstant() const
|
||||
{
|
||||
return entry_->isConstant();
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
|
||||
@ -121,8 +121,6 @@ public:
|
||||
//- Integrate between two (scalar) values
|
||||
virtual Type integrate(const scalar x1, const scalar x2) const;
|
||||
|
||||
//- Return true for Constant type
|
||||
virtual bool isConstant() const;
|
||||
|
||||
|
||||
// I/O
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -89,8 +89,7 @@ Foam::tabulated6DoFAcceleration::acceleration() const
|
||||
values_
|
||||
);
|
||||
|
||||
InfoInFunction
|
||||
<< "Time = " << t << " accelerations: " << avs << endl;
|
||||
Info << "Time = " << t << " accelerations: " << avs << endl;
|
||||
|
||||
return avs;
|
||||
}
|
||||
|
||||
@ -90,49 +90,9 @@ void Foam::heThermo<BasicThermo, MixtureType>::init
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
template<class BasicThermo, class MixtureType>
|
||||
Foam::volScalarField& Foam::heThermo<BasicThermo, MixtureType>::lookupOrConstruct
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& name
|
||||
)
|
||||
{
|
||||
if (!mesh.objectRegistry::foundObject<volScalarField>(name))
|
||||
{
|
||||
volScalarField* fPtr
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
name,
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimEnergy/dimMass,
|
||||
this->heBoundaryTypes(),
|
||||
this->heBoundaryBaseTypes()
|
||||
)
|
||||
);
|
||||
|
||||
// Transfer ownership of this object to the objectRegistry
|
||||
fPtr->store(fPtr);
|
||||
}
|
||||
|
||||
return const_cast<volScalarField&>
|
||||
(
|
||||
mesh.objectRegistry::lookupObject<volScalarField>(name)
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
template<class BasicThermo, class MixtureType>
|
||||
Foam::heThermo<BasicThermo, MixtureType>::heThermo
|
||||
(
|
||||
@ -161,19 +121,6 @@ Foam::heThermo<BasicThermo, MixtureType>::heThermo
|
||||
this->heBoundaryTypes(),
|
||||
this->heBoundaryBaseTypes()
|
||||
)
|
||||
/*
|
||||
he_
|
||||
(
|
||||
this->lookupOrConstruct
|
||||
(
|
||||
mesh,
|
||||
BasicThermo::phasePropertyName
|
||||
(
|
||||
MixtureType::thermoType::heName()
|
||||
)
|
||||
)
|
||||
)
|
||||
*/
|
||||
{
|
||||
init(this->p_, this->T_, he_);
|
||||
}
|
||||
@ -208,18 +155,8 @@ Foam::heThermo<BasicThermo, MixtureType>::heThermo
|
||||
this->heBoundaryTypes(),
|
||||
this->heBoundaryBaseTypes()
|
||||
)
|
||||
/*
|
||||
he_
|
||||
(
|
||||
this->lookupOrConstruct
|
||||
(
|
||||
mesh,
|
||||
MixtureType::thermoType::heName()
|
||||
)
|
||||
)
|
||||
*/
|
||||
{
|
||||
init();
|
||||
init(this->p_, this->T_, he_);
|
||||
}
|
||||
|
||||
|
||||
@ -252,19 +189,6 @@ Foam::heThermo<BasicThermo, MixtureType>::heThermo
|
||||
this->heBoundaryTypes(),
|
||||
this->heBoundaryBaseTypes()
|
||||
)
|
||||
/*
|
||||
he_
|
||||
(
|
||||
this->lookupOrConstruct
|
||||
(
|
||||
mesh,
|
||||
BasicThermo::phasePropertyName
|
||||
(
|
||||
MixtureType::thermoType::heName()
|
||||
)
|
||||
)
|
||||
)
|
||||
*/
|
||||
{
|
||||
init(this->p_, this->T_, he_);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user