mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-icoReactingMultiphaseInterFoam-dev' into 'develop-pre-release'
Feature ico reacting multiphase inter foam dev See merge request Development/OpenFOAM-plus!204
This commit is contained in:
10
applications/solvers/multiphase/icoReactingMultiPhaseInterFoam/Allwclean
Executable file
10
applications/solvers/multiphase/icoReactingMultiPhaseInterFoam/Allwclean
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
wclean libso phasesSystem
|
||||
wclean libso massTransferModels
|
||||
wclean libso CompressibleMultiPhaseTurbulenceModels
|
||||
wclean libso laserDTRM
|
||||
wclean
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
15
applications/solvers/multiphase/icoReactingMultiPhaseInterFoam/Allwmake
Executable file
15
applications/solvers/multiphase/icoReactingMultiPhaseInterFoam/Allwmake
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
targetType=libso
|
||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||
|
||||
wmakeLnInclude massTransferModels
|
||||
wmake phasesSystem
|
||||
wmake massTransferModels
|
||||
wmake CompressibleMultiPhaseTurbulenceModels
|
||||
wmake laserDTRM
|
||||
wmake
|
||||
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
@ -0,0 +1,72 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "CompressibleTurbulenceModel.H"
|
||||
#include "compressibleTurbulenceModel.H"
|
||||
#include "multiphaseSystem.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "makeTurbulenceModel.H"
|
||||
|
||||
#include "ThermalDiffusivity.H"
|
||||
|
||||
#include "laminarModel.H"
|
||||
#include "RASModel.H"
|
||||
#include "LESModel.H"
|
||||
|
||||
makeBaseTurbulenceModel
|
||||
(
|
||||
geometricOneField,
|
||||
volScalarField,
|
||||
compressibleTurbulenceModel,
|
||||
CompressibleTurbulenceModel,
|
||||
ThermalDiffusivity,
|
||||
multiphaseSystem
|
||||
);
|
||||
|
||||
#define makeLaminarModel(Type) \
|
||||
makeTemplatedLaminarModel \
|
||||
(multiphaseSystemCompressibleTurbulenceModel, laminar, Type)
|
||||
|
||||
#define makeRASModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
(multiphaseSystemCompressibleTurbulenceModel, RAS, Type)
|
||||
|
||||
#define makeLESModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
(multiphaseSystemCompressibleTurbulenceModel, LES, Type)
|
||||
|
||||
#include "Stokes.H"
|
||||
makeLaminarModel(Stokes);
|
||||
|
||||
#include "kEpsilon.H"
|
||||
makeRASModel(kEpsilon);
|
||||
|
||||
#include "Smagorinsky.H"
|
||||
makeLESModel(Smagorinsky);
|
||||
|
||||
#include "kEqn.H"
|
||||
makeLESModel(kEqn);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,3 @@
|
||||
CompressibleMultiPhaseTurbulenceModels.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libCompressibleMultiPhaseTurbulenceModels
|
||||
@ -0,0 +1,11 @@
|
||||
EXE_INC = \
|
||||
-I../phasesSystem/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude
|
||||
@ -0,0 +1,3 @@
|
||||
icoReactingMultiphaseInterFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/icoReactingMultiphaseInterFoam
|
||||
@ -0,0 +1,35 @@
|
||||
|
||||
EXE_INC = \
|
||||
-I./phasesSystem/lnInclude \
|
||||
-I./CompressibleMultiPhaseTurbulenceModels/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/fvOptions/lnInclude\
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lturbulenceModels \
|
||||
-lcompressibleTurbulenceModels \
|
||||
-lcompressibleTransportModels \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lfvOptions \
|
||||
-lsampling \
|
||||
-lradiationModels \
|
||||
-lfluidThermophysicalModels \
|
||||
-lIncompressibleMultiphaseSystems \
|
||||
-lCompressibleMultiPhaseTurbulenceModels \
|
||||
-lmassTransferModels \
|
||||
-lsolidThermo \
|
||||
-lsolidSpecie \
|
||||
-ltwoPhaseProperties \
|
||||
-llaserDTRM
|
||||
@ -0,0 +1,37 @@
|
||||
{
|
||||
radiation->correct();
|
||||
rhoCp = rho*fluid.Cp();
|
||||
|
||||
const surfaceScalarField rhoCpPhi(fvc::interpolate(fluid.Cp())*rhoPhi);
|
||||
|
||||
const volScalarField kappaEff
|
||||
(
|
||||
"kappaEff",
|
||||
fluid.kappa() + fluid.Cp()*turbulence->mut()/fluid.Prt()
|
||||
);
|
||||
|
||||
fvScalarMatrix TEqn
|
||||
(
|
||||
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)
|
||||
+ radiation->ST(T)
|
||||
+ fvOptions(rhoCp, T)
|
||||
);
|
||||
|
||||
TEqn.relax();
|
||||
|
||||
fvOptions.constrain(TEqn);
|
||||
|
||||
TEqn.solve();
|
||||
|
||||
fvOptions.correct(T);
|
||||
|
||||
fluid.correct();
|
||||
|
||||
Info<< "min/max(T) = "
|
||||
<< min(T).value() << ", " << max(T).value() << endl;
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
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
|
||||
(
|
||||
UEqn
|
||||
==
|
||||
fvc::reconstruct
|
||||
(
|
||||
(
|
||||
fluid.surfaceTensionForce()
|
||||
- ghf*fvc::snGrad(rho)
|
||||
- fvc::snGrad(p_rgh)
|
||||
) * mesh.magSf()
|
||||
)
|
||||
);
|
||||
|
||||
fvOptions.correct(U);
|
||||
K = 0.5*magSqr(U);
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
{
|
||||
forAllIter(UPtrList<phaseModel>, fluid.phases(), iter)
|
||||
{
|
||||
phaseModel& phase = iter();
|
||||
PtrList<volScalarField>& Y = phase.Y();
|
||||
|
||||
if (!Y.empty())
|
||||
{
|
||||
//- Su phase source terms
|
||||
PtrList<volScalarField::Internal> Sus(Y.size());
|
||||
//- Sp phase source terms
|
||||
PtrList<volScalarField::Internal> Sps(Y.size());
|
||||
|
||||
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)
|
||||
{
|
||||
// Calculate mass exchange for species consistent with
|
||||
// alpha's source terms.
|
||||
fluid.massSpeciesTransfer(phase, Sus[i], Sps[i], Y[i].name());
|
||||
}
|
||||
phase.solveYi(Sus, Sps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,78 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Global
|
||||
alphaCourantNo
|
||||
|
||||
Description
|
||||
Calculates and outputs the mean and maximum Courant Numbers.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
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())
|
||||
{
|
||||
scalarField sumPhi
|
||||
(
|
||||
fluid.nearInterface()().internalField()
|
||||
*fvc::surfaceSum(mag(phi))().internalField()
|
||||
);
|
||||
|
||||
alphaCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
|
||||
|
||||
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;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,2 @@
|
||||
// Volumatric flux
|
||||
surfaceScalarField& phi = fluid.phi();
|
||||
@ -0,0 +1,155 @@
|
||||
Info<< "Reading field p_rgh\n" << endl;
|
||||
volScalarField p_rgh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p_rgh",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
// Note: construct T to be around before the thermos. The thermos will
|
||||
// not update T.
|
||||
Info<< "Reading field T\n" << endl;
|
||||
volScalarField T
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"T",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
Info<< "Calculating field g.h\n" << endl;
|
||||
#include "readGravitationalAcceleration.H"
|
||||
#include "readhRef.H"
|
||||
#include "gh.H"
|
||||
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
p_rgh
|
||||
);
|
||||
|
||||
|
||||
Info<< "Creating multiphaseSystem\n" << endl;
|
||||
autoPtr<multiphaseSystem> fluidPtr = multiphaseSystem::New(mesh);
|
||||
|
||||
multiphaseSystem& fluid = fluidPtr();
|
||||
|
||||
if (!fluid.incompressible())
|
||||
{
|
||||
FatalError << "One or more phases are not incompressible. " << nl
|
||||
<< "This is a incompressible solver." << abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
// Need to store rho for ddt(rho, U)
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
fluid.rho()
|
||||
);
|
||||
rho.oldTime();
|
||||
|
||||
// Update p using fluid.rho()
|
||||
p = p_rgh + rho*gh;
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell
|
||||
(
|
||||
p,
|
||||
p_rgh,
|
||||
pimple.dict(),
|
||||
pRefCell,
|
||||
pRefValue
|
||||
);
|
||||
|
||||
if (p_rgh.needReference())
|
||||
{
|
||||
p += dimensionedScalar
|
||||
(
|
||||
"p",
|
||||
p.dimensions(),
|
||||
pRefValue - getRefCellValue(p, pRefCell)
|
||||
);
|
||||
p_rgh = p - rho*gh;
|
||||
}
|
||||
|
||||
// Mass flux
|
||||
surfaceScalarField& rhoPhi = fluid.rhoPhi();
|
||||
|
||||
// Construct incompressible turbulence model
|
||||
autoPtr<CompressibleTurbulenceModel<multiphaseSystem> > turbulence
|
||||
(
|
||||
CompressibleTurbulenceModel<multiphaseSystem>::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
rhoPhi,
|
||||
fluid
|
||||
)
|
||||
);
|
||||
|
||||
// Creating radiation model
|
||||
autoPtr<radiation::radiationModel> radiation
|
||||
(
|
||||
radiation::radiationModel::New(T)
|
||||
);
|
||||
|
||||
Info<< "Calculating field rhoCp\n" << endl;
|
||||
volScalarField rhoCp
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoCp",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
fluid.rho()*fluid.Cp()
|
||||
);
|
||||
rhoCp.oldTime();
|
||||
|
||||
|
||||
Info<< "Creating field kinetic energy K\n" << endl;
|
||||
volScalarField K("K", 0.5*magSqr(U));
|
||||
@ -0,0 +1,126 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
Application
|
||||
icoReactingMultiphaseInterFoam
|
||||
|
||||
Group
|
||||
grpMultiphaseSolvers
|
||||
|
||||
Description
|
||||
Solver for n incompressible, non-isothermal immiscible fluids with
|
||||
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.
|
||||
|
||||
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "subCycle.H"
|
||||
#include "multiphaseSystem.H"
|
||||
#include "turbulentFluidThermoModel.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "fvOptions.H"
|
||||
#include "fixedFluxPressureFvPatchScalarField.H"
|
||||
#include "radiationModel.H"
|
||||
#include "HashPtrTable.H"
|
||||
#include "fvcDDt.H"
|
||||
#include "zeroField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "postProcess.H"
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
#include "createFields.H"
|
||||
#include "createFieldRefs.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "createTimeControls.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
turbulence->validate();
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
#include "CourantNo.H"
|
||||
#include "alphaCourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
fluid.solve();
|
||||
rho = fluid.rho();
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
solve(fvm::ddt(rho) + fvc::div(rhoPhi));
|
||||
#include "UEqn.H"
|
||||
#include "YEqns.H"
|
||||
#include "TEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
while (pimple.correct())
|
||||
{
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
if (pimple.turbCorr())
|
||||
{
|
||||
turbulence->correct();
|
||||
}
|
||||
}
|
||||
|
||||
rho = fluid.rho();
|
||||
|
||||
runTime.write();
|
||||
|
||||
runTime.printExecutionTime(Info);
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,296 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "DTRMParticle.H"
|
||||
#include "constants.H"
|
||||
#include "physicoChemicalConstants.H"
|
||||
|
||||
using namespace Foam::constant;
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::DTRMParticle::DTRMParticle
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const vector& position,
|
||||
const vector& targetPosition,
|
||||
const scalar I,
|
||||
const label cellI,
|
||||
const scalar dA,
|
||||
const label transmissiveId
|
||||
)
|
||||
:
|
||||
particle(mesh, position, cellI),
|
||||
p0_(position),
|
||||
p1_(targetPosition),
|
||||
I0_(I),
|
||||
I_(I),
|
||||
dA_(dA),
|
||||
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)
|
||||
{}
|
||||
|
||||
|
||||
Foam::DTRMParticle::DTRMParticle(const DTRMParticle& p)
|
||||
:
|
||||
particle(p),
|
||||
p0_(p.p0_),
|
||||
p1_(p.p1_),
|
||||
I0_(p.I0_),
|
||||
I_(p.I_),
|
||||
dA_(p.dA_),
|
||||
transmissiveId_(p.transmissiveId_)
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::DTRMParticle::move
|
||||
(
|
||||
Cloud<DTRMParticle>& spc,
|
||||
trackingData& td,
|
||||
const scalar trackTime
|
||||
)
|
||||
{
|
||||
td.switchProcessor = false;
|
||||
td.keepParticle = true;
|
||||
|
||||
while (td.keepParticle && !td.switchProcessor && stepFraction() < 1)
|
||||
{
|
||||
//Cache old data of particle to use for reflected particle
|
||||
const point pos0 = position();
|
||||
const label cell0 = cell();
|
||||
|
||||
scalar f = 1 - stepFraction();
|
||||
const vector s = p1() - p0() - deviationFromMeshCentre();
|
||||
trackToAndHitFace(f*s, f, spc, td);
|
||||
|
||||
const point p1 = position();
|
||||
vector dsv = p1 - pos0;
|
||||
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
|
||||
(
|
||||
(reflectedZoneId > -1)
|
||||
&& (
|
||||
(transmissiveId_ == -1)
|
||||
|| (transmissiveId_ != reflectedZoneId)
|
||||
)
|
||||
)
|
||||
{
|
||||
scalar rho(0);
|
||||
|
||||
// Create a new reflected particle when the particles is not
|
||||
// transmissive and larger than an absolute I
|
||||
if (I_ > 0.01*I0_ && ds > 0)
|
||||
{
|
||||
vector pDir = dsv/ds;
|
||||
|
||||
cellPointWeight cpw(mesh(), position(), cell1, face());
|
||||
vector nHat = td.nHatInterp().interpolate(cpw);
|
||||
|
||||
nHat /= (mag(nHat) + ROOTSMALL);
|
||||
scalar cosTheta(-pDir & nHat);
|
||||
|
||||
// Only new incoming rays
|
||||
if (cosTheta > SMALL)
|
||||
{
|
||||
vector newDir =
|
||||
td.reflection()
|
||||
[
|
||||
td.relfectedCells()[cell1]
|
||||
].R(pDir, nHat);
|
||||
|
||||
// reflectivity
|
||||
rho =
|
||||
min
|
||||
(
|
||||
max
|
||||
(
|
||||
td.reflection()
|
||||
[
|
||||
td.relfectedCells()[cell1]
|
||||
].rho(cosTheta)
|
||||
, 0.0
|
||||
)
|
||||
, 0.98
|
||||
);
|
||||
|
||||
scalar delaM = cbrt(mesh().cellVolumes()[cell0]);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Change transmissiveId of the particle
|
||||
transmissiveId_ = reflectedZoneId;
|
||||
|
||||
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);
|
||||
const scalar I1 =
|
||||
(
|
||||
Itran
|
||||
+ ds*(e*sigma*pow4(T)/mathematical::pi + E)
|
||||
) / (1 + ds*a);
|
||||
|
||||
td.Q(cell1) += (Itran - max(I1, 0.0))*dA_;
|
||||
|
||||
I_ = I1;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return td.keepParticle;
|
||||
}
|
||||
|
||||
|
||||
void Foam::DTRMParticle::hitProcessorPatch
|
||||
(
|
||||
Cloud<DTRMParticle>&,
|
||||
trackingData& td
|
||||
)
|
||||
{
|
||||
td.switchProcessor = true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::DTRMParticle::hitWallPatch
|
||||
(
|
||||
Cloud<DTRMParticle>&,
|
||||
trackingData& td
|
||||
)
|
||||
{
|
||||
td.keepParticle = false;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::DTRMParticle::hitPatch
|
||||
(
|
||||
Cloud<DTRMParticle>&,
|
||||
trackingData& td
|
||||
)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,324 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::DTRMParticle
|
||||
|
||||
Description
|
||||
Discrete Transfer Radiation Model (DTRM) particle
|
||||
|
||||
SourceFiles
|
||||
DTRMParticle.H
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef DTRMParticle_H
|
||||
#define DTRMParticle_H
|
||||
|
||||
#include "particle.H"
|
||||
#include "IOstream.H"
|
||||
#include "autoPtr.H"
|
||||
#include "interpolationCell.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "reflectionModel.H"
|
||||
#include "interpolationCellPoint.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class DTRMParticle;
|
||||
using namespace Foam::radiation;
|
||||
|
||||
// Forward declaration of friend functions
|
||||
Ostream& operator<<(Ostream&, const DTRMParticle&);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class DTRMParticle Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class DTRMParticle
|
||||
:
|
||||
public particle
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Size in bytes of the fields
|
||||
static const std::size_t sizeofFields_;
|
||||
|
||||
//- Initial position
|
||||
point p0_;
|
||||
|
||||
//- Target position
|
||||
point p1_;
|
||||
|
||||
//- Initial radiation intensity [W/m2]
|
||||
scalar I0_;
|
||||
|
||||
//- Radiation intensity [W/m2]
|
||||
scalar I_;
|
||||
|
||||
//- Area of radiation
|
||||
scalar dA_;
|
||||
|
||||
//- Trasnmissive index
|
||||
label transmissiveId_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
friend class Cloud<DTRMParticle>;
|
||||
|
||||
//- Class used to pass tracking data to the trackToFace function
|
||||
class trackingData
|
||||
:
|
||||
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_;
|
||||
|
||||
//- Ptr to reflectiom model
|
||||
UPtrList<reflectionModel> reflection_;
|
||||
|
||||
//- Heat source term
|
||||
volScalarField& Q_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
inline trackingData
|
||||
(
|
||||
Cloud<DTRMParticle>& spc,
|
||||
const interpolationCell<scalar>& aInterp,
|
||||
const interpolationCell<scalar>& eInterp,
|
||||
const interpolationCell<scalar>& EInterp,
|
||||
const interpolationCell<scalar>& TInterp,
|
||||
const interpolationCellPoint<vector>& nHatInterp,
|
||||
const labelField&,
|
||||
const UPtrList<reflectionModel>&,
|
||||
volScalarField& Q
|
||||
);
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
inline const interpolationCell<scalar>& aInterp() const;
|
||||
inline const interpolationCell<scalar>& eInterp() const;
|
||||
inline const interpolationCell<scalar>& EInterp() const;
|
||||
inline const interpolationCell<scalar>& TInterp() const;
|
||||
inline const interpolationCellPoint<vector>& nHatInterp() const;
|
||||
inline const labelField& relfectedCells() const;
|
||||
inline const UPtrList<reflectionModel>& reflection() const;
|
||||
|
||||
inline scalar& Q(label celli);
|
||||
};
|
||||
|
||||
// Static data members
|
||||
|
||||
//- String representation of properties
|
||||
AddToPropertyList
|
||||
(
|
||||
particle,
|
||||
" p0"
|
||||
+ " p1"
|
||||
+ " I0"
|
||||
+ " I"
|
||||
+ " dA"
|
||||
+ " transmissiveId";
|
||||
);
|
||||
|
||||
//- String representation of property types
|
||||
AddToPropertyTypes
|
||||
(
|
||||
particle,
|
||||
"{point"
|
||||
+ " point"
|
||||
+ " scalar"
|
||||
+ " scalar"
|
||||
+ " scalar"
|
||||
+ " label}"
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
|
||||
//- Construct from components, with searching for tetFace and
|
||||
// tetPt unless disabled by doCellFacePt = false.
|
||||
DTRMParticle
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const vector& position,
|
||||
const vector& targetPosition,
|
||||
const scalar I,
|
||||
const label cellI,
|
||||
const scalar dA,
|
||||
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
|
||||
DTRMParticle
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& is,
|
||||
bool readFields = true,
|
||||
bool newFormat = true
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
DTRMParticle(const DTRMParticle& p);
|
||||
|
||||
|
||||
//- Factory class to read-construct particles used for
|
||||
// parallel transfer
|
||||
class iNew
|
||||
{
|
||||
const polyMesh& mesh_;
|
||||
|
||||
public:
|
||||
|
||||
iNew(const polyMesh& mesh)
|
||||
:
|
||||
mesh_(mesh)
|
||||
{}
|
||||
|
||||
autoPtr<DTRMParticle> operator()(Istream& is) const
|
||||
{
|
||||
return autoPtr<DTRMParticle>
|
||||
(
|
||||
new DTRMParticle(mesh_, is, true)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
//- Return const access to the initial position
|
||||
inline const point& p0() const;
|
||||
|
||||
//- Return const access to the target position
|
||||
inline const point& p1() const;
|
||||
|
||||
//- Return const access to the initial intensity
|
||||
inline scalar I0() const;
|
||||
|
||||
//- Return const access to the current intensity
|
||||
inline scalar I() const;
|
||||
|
||||
//- Return const access dA
|
||||
inline scalar dA() const;
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Return access to the target position
|
||||
inline point& p1();
|
||||
|
||||
//- Return access to the initial intensity
|
||||
inline scalar& I0();
|
||||
|
||||
//- Return access to the current intensity
|
||||
inline scalar& I();
|
||||
|
||||
//- Return access to dA
|
||||
inline scalar& dA();
|
||||
|
||||
//- Return access to reflectedId
|
||||
inline label& reflectedId();
|
||||
|
||||
|
||||
// Tracking
|
||||
|
||||
//- Move
|
||||
bool move(Cloud<DTRMParticle>& , trackingData&, const scalar);
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Overridable function to handle the particle hitting a processorPatch
|
||||
void hitProcessorPatch
|
||||
(
|
||||
Cloud<DTRMParticle>&,
|
||||
trackingData& td
|
||||
);
|
||||
|
||||
//- Overridable function to handle the particle hitting a wallPatch
|
||||
void hitWallPatch
|
||||
(
|
||||
Cloud<DTRMParticle>&,
|
||||
trackingData& td
|
||||
);
|
||||
|
||||
bool hitPatch
|
||||
(
|
||||
Cloud<DTRMParticle>&,
|
||||
trackingData& td
|
||||
);
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<<(Ostream& os, const DTRMParticle& p);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "DTRMParticleI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,162 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::DTRMParticle::trackingData::trackingData
|
||||
(
|
||||
Cloud<DTRMParticle>& spc,
|
||||
const interpolationCell<scalar>& aInterp,
|
||||
const interpolationCell<scalar>& eInterp,
|
||||
const interpolationCell<scalar>& EInterp,
|
||||
const interpolationCell<scalar>& TInterp,
|
||||
const interpolationCellPoint<vector>& nHatInterp,
|
||||
const labelField& relfectedCell,
|
||||
const UPtrList<reflectionModel>& reflection,
|
||||
volScalarField& Q
|
||||
)
|
||||
:
|
||||
particle::trackingData(spc),
|
||||
aInterp_(aInterp),
|
||||
eInterp_(eInterp),
|
||||
EInterp_(EInterp),
|
||||
TInterp_(TInterp),
|
||||
nHatInterp_(nHatInterp),
|
||||
relfectedCells_(relfectedCell),
|
||||
reflection_(reflection),
|
||||
Q_(Q)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::interpolationCell<Foam::scalar>&
|
||||
Foam::DTRMParticle::trackingData::aInterp() const
|
||||
{
|
||||
return aInterp_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::interpolationCell<Foam::scalar>&
|
||||
Foam::DTRMParticle::trackingData::eInterp() const
|
||||
{
|
||||
return eInterp_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::interpolationCell<Foam::scalar>&
|
||||
Foam::DTRMParticle::trackingData::EInterp() const
|
||||
{
|
||||
return EInterp_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::interpolationCell<Foam::scalar>&
|
||||
Foam::DTRMParticle::trackingData::TInterp() const
|
||||
{
|
||||
return TInterp_;
|
||||
}
|
||||
|
||||
inline const Foam::interpolationCellPoint<Foam::vector>&
|
||||
Foam::DTRMParticle::trackingData::nHatInterp() const
|
||||
{
|
||||
return nHatInterp_;
|
||||
}
|
||||
|
||||
inline const Foam::labelField&
|
||||
Foam::DTRMParticle::trackingData::relfectedCells() const
|
||||
{
|
||||
return relfectedCells_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::UPtrList<Foam::radiation::reflectionModel>&
|
||||
Foam::DTRMParticle::trackingData::reflection() const
|
||||
{
|
||||
return reflection_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar& Foam::DTRMParticle::trackingData::Q(label celli)
|
||||
{
|
||||
return Q_[celli];
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::point& Foam::DTRMParticle::p0() const
|
||||
{
|
||||
return p0_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::point& Foam::DTRMParticle::p1() const
|
||||
{
|
||||
return p1_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::DTRMParticle::I0() const
|
||||
{
|
||||
return I0_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::DTRMParticle::I() const
|
||||
{
|
||||
return I_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::DTRMParticle::dA() const
|
||||
{
|
||||
return dA_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar& Foam::DTRMParticle::dA()
|
||||
{
|
||||
return dA_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::point& Foam::DTRMParticle::p1()
|
||||
{
|
||||
return p1_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar& Foam::DTRMParticle::I0()
|
||||
{
|
||||
return I0_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar& Foam::DTRMParticle::I()
|
||||
{
|
||||
return I_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,103 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "DTRMParticle.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
Foam::string Foam::DTRMParticle::propertyList_ =
|
||||
Foam::DTRMParticle::propertyList();
|
||||
|
||||
const std::size_t Foam::DTRMParticle::sizeofFields_
|
||||
(
|
||||
sizeof(DTRMParticle) - sizeof(particle)
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::DTRMParticle::DTRMParticle
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
Istream& is,
|
||||
bool readFields,
|
||||
bool newFormat
|
||||
)
|
||||
:
|
||||
particle(mesh, is, readFields, newFormat),
|
||||
p0_(point::zero),
|
||||
p1_(point::zero),
|
||||
I0_(0),
|
||||
I_(0),
|
||||
dA_(0),
|
||||
transmissiveId_(-1)
|
||||
{
|
||||
if (readFields)
|
||||
{
|
||||
if (is.format() == IOstream::ASCII)
|
||||
{
|
||||
is >> p0_ >> p1_ >> I0_ >> I_ >> dA_ >> transmissiveId_;
|
||||
}
|
||||
else
|
||||
{
|
||||
is.read(reinterpret_cast<char*>(&p0_), sizeofFields_);
|
||||
}
|
||||
}
|
||||
|
||||
is.check(FUNCTION_NAME);
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const DTRMParticle& p)
|
||||
{
|
||||
if (os.format() == IOstream::ASCII)
|
||||
{
|
||||
os << static_cast<const particle&>(p)
|
||||
<< token::SPACE << p.p0_
|
||||
<< token::SPACE << p.p1_
|
||||
<< token::SPACE << p.I0_
|
||||
<< token::SPACE << p.I_
|
||||
<< token::SPACE << p.dA_
|
||||
<< token::SPACE << p.transmissiveId_;
|
||||
}
|
||||
else
|
||||
{
|
||||
os << static_cast<const particle&>(p);
|
||||
os.write
|
||||
(
|
||||
reinterpret_cast<const char*>(&p.p0_),
|
||||
DTRMParticle::sizeofFields_
|
||||
);
|
||||
}
|
||||
|
||||
// Check state of Ostream
|
||||
os.check(FUNCTION_NAME);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,13 @@
|
||||
laserDTRM.C
|
||||
|
||||
DTRMParticle/DTRMParticle.C
|
||||
DTRMParticle/DTRMParticleIO.C
|
||||
localDensityAbsorptionEmission/localDensityAbsorptionEmission.C
|
||||
reflectionModel/reflectionModel/reflectionModel.C
|
||||
reflectionModel/reflectionModel/reflectionModelNew.C
|
||||
reflectionModel/noReflection/noReflection.C
|
||||
reflectionModel/FresnelLaser/FresnelLaser.C
|
||||
reflectionModel/Fresnel/Fresnel.C
|
||||
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/liblaserDTRM
|
||||
@ -0,0 +1,11 @@
|
||||
EXE_INC = \
|
||||
-I../phasesSystem/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lradiationModels \
|
||||
-llagrangian \
|
||||
-lfiniteVolume
|
||||
@ -0,0 +1,775 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "laserDTRM.H"
|
||||
#include "fvmLaplacian.H"
|
||||
#include "fvmSup.H"
|
||||
#include "absorptionEmissionModel.H"
|
||||
#include "scatterModel.H"
|
||||
#include "constants.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "unitConversion.H"
|
||||
#include "interpolationCell.H"
|
||||
#include "interpolationCellPoint.H"
|
||||
#include "Random.H"
|
||||
|
||||
using namespace Foam::constant;
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace radiation
|
||||
{
|
||||
defineTypeNameAndDebug(laserDTRM, 0);
|
||||
addToRadiationRunTimeSelectionTables(laserDTRM);
|
||||
}
|
||||
|
||||
defineTemplateTypeNameAndDebugWithName
|
||||
(
|
||||
Cloud<DTRMParticle>,
|
||||
"DTRMCloud",
|
||||
0
|
||||
);
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::radiation::laserDTRM::powerDistributionMode,
|
||||
3
|
||||
>::names[] =
|
||||
{
|
||||
"Gaussian",
|
||||
"manual",
|
||||
"uniform"
|
||||
};
|
||||
}
|
||||
|
||||
const Foam::NamedEnum
|
||||
<
|
||||
Foam::radiation::laserDTRM::powerDistributionMode,
|
||||
3
|
||||
> Foam::radiation::laserDTRM::powerDistypeNames_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::scalar Foam::radiation::laserDTRM::calculateIp(scalar r, scalar theta)
|
||||
{
|
||||
const scalar t = mesh_.time().value();
|
||||
const scalar power = laserPower_->value(t);
|
||||
switch(mode_)
|
||||
{
|
||||
case pdGaussian:
|
||||
{
|
||||
scalar I0 = power/(mathematical::twoPi*sqr(sigma_));
|
||||
|
||||
return I0*exp(-sqr(r)/2.0/sqr(sigma_));
|
||||
break;
|
||||
}
|
||||
case pdManual:
|
||||
{
|
||||
return power*powerDistribution_()(theta, r);
|
||||
break;
|
||||
}
|
||||
case pdUniform:
|
||||
{
|
||||
return power/(mathematical::pi*sqr(focalLaserRadius_));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unhandled type " << powerDistypeNames_
|
||||
<< abort(FatalError);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volVectorField> Foam::radiation::laserDTRM::nHatfv
|
||||
(
|
||||
const volScalarField& alpha1,
|
||||
const volScalarField& alpha2
|
||||
) const
|
||||
{
|
||||
const dimensionedScalar deltaN
|
||||
(
|
||||
"deltaN",
|
||||
1e-7/cbrt(average(mesh_.V()))
|
||||
);
|
||||
|
||||
const volVectorField gradAlphaf
|
||||
(
|
||||
alpha2*fvc::grad(alpha1)
|
||||
- alpha1*fvc::grad(alpha2)
|
||||
);
|
||||
|
||||
// Face unit interface normal
|
||||
return gradAlphaf/(mag(gradAlphaf)+ deltaN);
|
||||
}
|
||||
|
||||
|
||||
void Foam::radiation::laserDTRM::initialiseReflection()
|
||||
{
|
||||
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>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::radiation::laserDTRM::initialise()
|
||||
{
|
||||
// Initialise the DTRM particles
|
||||
DTRMCloud_.clear();
|
||||
|
||||
const scalar t = mesh_.time().value();
|
||||
const vector lPosition = focalLaserPosition_->value(t);
|
||||
vector lDir = laserDirection_->value(t);
|
||||
lDir /= mag(lDir);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info << "Laser position : " << lPosition << endl;
|
||||
Info << "Laser direction : " << lDir << endl;
|
||||
}
|
||||
|
||||
// Find a vector on the area plane. Normal to laser direction
|
||||
vector rArea = vector::zero;
|
||||
scalar magr = 0.0;
|
||||
while (magr < VSMALL)
|
||||
{
|
||||
Random rnd(1234);
|
||||
vector v = rnd.sample01<vector>();
|
||||
rArea = v - (v & lDir)*lDir;
|
||||
magr = mag(rArea);
|
||||
}
|
||||
rArea /= mag(rArea);
|
||||
|
||||
scalar dr = focalLaserRadius_/ndr_;
|
||||
scalar dTheta = mathematical::twoPi/ndTheta_;
|
||||
|
||||
nParticles_ = ndr_*ndTheta_;
|
||||
|
||||
switch (mode_)
|
||||
{
|
||||
case pdGaussian:
|
||||
{
|
||||
sigma_ = readScalar(lookup("sigma"));
|
||||
break;
|
||||
}
|
||||
case pdManual:
|
||||
{
|
||||
powerDistribution_.reset
|
||||
(
|
||||
new interpolation2DTable<scalar>(*this)
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
case pdUniform:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Target position
|
||||
point p1 = vector::zero;
|
||||
|
||||
// Seed DTRM particles
|
||||
// TODO: currently only applicable to 3-D cases
|
||||
point p0 = lPosition;
|
||||
scalar power(0.0);
|
||||
scalar area(0.0);
|
||||
p1 = p0;
|
||||
if (mesh_.nGeometricD() == 3)
|
||||
{
|
||||
for (label ri = 0; ri < ndr_; ri++)
|
||||
{
|
||||
scalar r1 = SMALL + dr*ri;
|
||||
|
||||
scalar r2 = r1 + dr;
|
||||
|
||||
scalar rP = ((r1 + r2)/2);
|
||||
|
||||
// local radius on disk
|
||||
vector localR = ((r1 + r2)/2)*rArea;
|
||||
|
||||
// local final radius on disk
|
||||
vector finalR = rP*rArea;
|
||||
|
||||
scalar theta0 = 0.0;//dTheta/2.0;
|
||||
for (label thetai = 0; thetai < ndTheta_; thetai++)
|
||||
{
|
||||
scalar theta1 = theta0 + SMALL + dTheta*thetai;
|
||||
|
||||
scalar theta2 = theta1 + dTheta;
|
||||
|
||||
scalar thetaP = (theta1 + theta2)/2.0;
|
||||
|
||||
quaternion Q(lDir, thetaP);
|
||||
|
||||
// Initial position on disk
|
||||
vector initialPos = (Q.R() & localR);
|
||||
|
||||
// Final position on disk
|
||||
vector finalPos = (Q.R() & finalR);
|
||||
|
||||
// Initial position
|
||||
p0 = lPosition + initialPos;
|
||||
|
||||
// calculate target point using new deviation rl
|
||||
p1 = lPosition + finalPos + (0.5*maxTrackLength_*lDir);
|
||||
|
||||
scalar Ip = calculateIp(rP, thetaP);
|
||||
|
||||
scalar dAi = (sqr(r2) - sqr(r1))*(theta2 - theta1)/2.0;
|
||||
|
||||
power += Ip*dAi;
|
||||
area += dAi;
|
||||
|
||||
label cellI = mesh_.findCell(p0);
|
||||
|
||||
if (cellI != -1)
|
||||
{
|
||||
// Create a new particle
|
||||
DTRMParticle* pPtr =
|
||||
new DTRMParticle(mesh_, p0, p1, Ip, cellI, dAi, -1);
|
||||
|
||||
// Add to cloud
|
||||
DTRMCloud_.addParticle(pPtr);
|
||||
}
|
||||
|
||||
if (returnReduce(cellI, maxOp<label>()) == -1)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Cannot find owner cell for particle at position " << p0
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Current functionality limited to 3-D cases"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
DebugInfo
|
||||
<< "Total Power in the laser : " << power << endl
|
||||
<< "Total Area in the laser : " << area << endl
|
||||
<< "Number of particles in the laser : "
|
||||
<< returnReduce(DTRMCloud_.size(), sumOp<label>()) << endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
|
||||
:
|
||||
radiationModel(typeName, T),
|
||||
mode_(powerDistypeNames_.read(lookup("mode"))),
|
||||
DTRMCloud_(mesh_, "DTRMCloud", IDLList<DTRMParticle>()),
|
||||
nParticles_(0),
|
||||
ndTheta_(readLabel(lookup("nTheta"))),
|
||||
ndr_(readLabel(lookup("nr"))),
|
||||
maxTrackLength_(mesh_.bounds().mag()),
|
||||
|
||||
focalLaserPosition_
|
||||
(
|
||||
Function1<point>::New("focalLaserPosition", *this)
|
||||
),
|
||||
|
||||
laserDirection_
|
||||
(
|
||||
Function1<vector>::New("laserDirection", *this)
|
||||
),
|
||||
|
||||
focalLaserRadius_(readScalar(lookup("focalLaserRadius"))),
|
||||
qualityBeamLaser_
|
||||
(
|
||||
lookupOrDefault<scalar>("qualityBeamLaser", 0.0)
|
||||
),
|
||||
|
||||
sigma_(0),
|
||||
laserPower_(Function1<scalar>::New("laserPower", *this)),
|
||||
powerDistribution_(),
|
||||
|
||||
reflectionSwitch_(false),
|
||||
|
||||
alphaCut_( lookupOrDefault<scalar>("alphaCut", 0.5)),
|
||||
|
||||
Qin_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Qin",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("Qin", dimPower/dimArea, 0.0)
|
||||
),
|
||||
a_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"a",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("a", dimless/dimLength, 0.0)
|
||||
),
|
||||
e_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"e",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("a", dimless/dimLength, 0.0)
|
||||
),
|
||||
E_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"E",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("E", dimMass/dimLength/pow3(dimTime), 0.0)
|
||||
),
|
||||
Q_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Q",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("Q", dimPower/dimVolume, 0.0)
|
||||
)
|
||||
{
|
||||
initialiseReflection();
|
||||
|
||||
initialise();
|
||||
}
|
||||
|
||||
|
||||
Foam::radiation::laserDTRM::laserDTRM
|
||||
(
|
||||
const dictionary& dict,
|
||||
const volScalarField& T
|
||||
)
|
||||
:
|
||||
radiationModel(typeName, dict, T),
|
||||
mode_(powerDistypeNames_.read(lookup("mode"))),
|
||||
DTRMCloud_(mesh_, "DTRMCloud", IDLList<DTRMParticle>()),
|
||||
nParticles_(0),
|
||||
ndTheta_(readLabel(lookup("nTheta"))),
|
||||
ndr_(readLabel(lookup("nr"))),
|
||||
maxTrackLength_(mesh_.bounds().mag()),
|
||||
|
||||
focalLaserPosition_
|
||||
(
|
||||
Function1<point>::New("focalLaserPosition", *this)
|
||||
),
|
||||
laserDirection_
|
||||
(
|
||||
Function1<vector>::New("laserDirection", *this)
|
||||
),
|
||||
|
||||
focalLaserRadius_(readScalar(lookup("focalLaserRadius"))),
|
||||
qualityBeamLaser_
|
||||
(
|
||||
lookupOrDefault<scalar>("qualityBeamLaser", 0.0)
|
||||
),
|
||||
|
||||
sigma_(0),
|
||||
laserPower_(Function1<scalar>::New("laserPower", *this)),
|
||||
powerDistribution_(),
|
||||
|
||||
reflectionSwitch_(false),
|
||||
|
||||
alphaCut_( lookupOrDefault<scalar>("alphaCut", 0.5)),
|
||||
|
||||
Qin_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Qin",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("Qin", dimPower/dimArea, 0.0)
|
||||
),
|
||||
a_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"a",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("a", dimless/dimLength, 0.0)
|
||||
),
|
||||
e_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"e",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("a", dimless/dimLength, 0.0)
|
||||
),
|
||||
E_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"E",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("E", dimMass/dimLength/pow3(dimTime), 0.0)
|
||||
),
|
||||
Q_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Q",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("Q", dimPower/pow3(dimLength), 0.0)
|
||||
)
|
||||
{
|
||||
initialiseReflection();
|
||||
initialise();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::radiation::laserDTRM::read()
|
||||
{
|
||||
if (radiationModel::read())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::radiation::laserDTRM::calculate()
|
||||
{
|
||||
tmp<volScalarField> treflectingCells
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"reflectingCellsVol",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("zero", dimless, -1)
|
||||
)
|
||||
);
|
||||
volScalarField& reflectingCellsVol = treflectingCells.ref();
|
||||
|
||||
|
||||
tmp<volVectorField> tnHat
|
||||
(
|
||||
new volVectorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"nHat",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedVector("zero", dimless, vector::zero)
|
||||
)
|
||||
);
|
||||
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_)
|
||||
{
|
||||
reflactionUPtr.resize(reflections_.size());
|
||||
|
||||
label reflectionModelId(0);
|
||||
forAllIter(reflectionModelTable, reflections_, iter1)
|
||||
{
|
||||
reflectionModel& model = iter1()();
|
||||
|
||||
reflactionUPtr.set(reflectionModelId, &model);
|
||||
|
||||
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
|
||||
(
|
||||
nearInterface[cellI]
|
||||
&& mag(nHatPhase[cellI]) > 0.99
|
||||
&& mask[cellI] < 0
|
||||
)
|
||||
{
|
||||
reflectingCells[cellI] = reflectionModelId;
|
||||
reflectingCellsVol[cellI] = reflectionModelId;
|
||||
if (mag(nHat[cellI]) == 0.0)
|
||||
{
|
||||
nHat[cellI] += nHatPhase[cellI];
|
||||
}
|
||||
}
|
||||
}
|
||||
reflectionModelId++;
|
||||
}
|
||||
}
|
||||
|
||||
nHatIntrPtr.reset
|
||||
(
|
||||
new interpolationCellPoint<vector>(nHat)
|
||||
);
|
||||
|
||||
DTRMParticle::trackingData td
|
||||
(
|
||||
DTRMCloud_,
|
||||
aInterp,
|
||||
eInterp,
|
||||
EInterp,
|
||||
TInterp,
|
||||
nHatIntrPtr,
|
||||
reflectingCells,
|
||||
reflactionUPtr,
|
||||
Q_
|
||||
);
|
||||
|
||||
Info<< "Move particles..."
|
||||
<< returnReduce(DTRMCloud_.size(), sumOp<label>()) << endl;
|
||||
|
||||
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(type() + ":particlePath.obj");
|
||||
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();
|
||||
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());
|
||||
Info << "Total energy absorbed [W]: " << totalQ << endl;
|
||||
|
||||
if (mesh_.time().outputTime())
|
||||
{
|
||||
reflectingCellsVol.write();
|
||||
nHat.write();
|
||||
}
|
||||
}
|
||||
|
||||
// Clear and initialise the cloud
|
||||
// NOTE: Possible to reset original particles, but this requires
|
||||
// data transfer for the cloud in differet processors.
|
||||
initialise();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::radiation::laserDTRM::Rp() const
|
||||
{
|
||||
return tmp<volScalarField>::New
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"zero",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar
|
||||
(
|
||||
"zero",
|
||||
dimPower/dimVolume/pow4(dimTemperature),
|
||||
0.0
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>>
|
||||
Foam::radiation::laserDTRM::Ru() const
|
||||
{
|
||||
return Q_.internalField();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,274 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::radiation::laserDTRM
|
||||
|
||||
Group
|
||||
grpRadiationModels
|
||||
|
||||
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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef radiationModellaserDTRM_H
|
||||
#define radiationModellaserDTRM_H
|
||||
|
||||
#include "radiationModel.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "Cloud.H"
|
||||
#include "DTRMParticle.H"
|
||||
#include "reflectionModel.H"
|
||||
#include "Function1.H"
|
||||
#include "interpolation2DTable.H"
|
||||
#include "labelField.H"
|
||||
#include "phasePairKey.H"
|
||||
#include "NamedEnum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace radiation
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class laserDTRM Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class laserDTRM
|
||||
:
|
||||
public radiationModel
|
||||
{
|
||||
public:
|
||||
|
||||
// Public enumeration
|
||||
|
||||
//- Modes of power distribution
|
||||
enum powerDistributionMode
|
||||
{
|
||||
pdGaussian,
|
||||
pdManual,
|
||||
pdUniform
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
// Private types
|
||||
|
||||
typedef
|
||||
HashTable<dictionary, phasePairKey, phasePairKey::hash> dictTable;
|
||||
|
||||
|
||||
typedef
|
||||
HashTable
|
||||
<
|
||||
autoPtr<reflectionModel>,
|
||||
phasePairKey,
|
||||
phasePairKey::hash
|
||||
> reflectionModelTable;
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
|
||||
static const NamedEnum<powerDistributionMode, 3> powerDistypeNames_;
|
||||
|
||||
//- Operating mode for power distribution
|
||||
powerDistributionMode mode_;
|
||||
|
||||
//- DTRM particle cloud
|
||||
Cloud<DTRMParticle> DTRMCloud_;
|
||||
|
||||
//- Number of particles
|
||||
label nParticles_;
|
||||
|
||||
//- Number of theta angles
|
||||
label ndTheta_;
|
||||
|
||||
//- Number of radials
|
||||
label ndr_;
|
||||
|
||||
//- Maximum tracking length for particles
|
||||
scalar maxTrackLength_;
|
||||
|
||||
|
||||
// Laser parameters
|
||||
|
||||
//- Focal laser position
|
||||
autoPtr<Function1<point>> focalLaserPosition_;
|
||||
|
||||
//- Direction
|
||||
autoPtr<Function1<vector>> laserDirection_;
|
||||
|
||||
//- Focal lase radius
|
||||
scalar focalLaserRadius_;
|
||||
|
||||
//- Quality beam laser (tan of the angle between the main direction
|
||||
// (laserDirection) and the spreading rays (0: flat, 1:fully)
|
||||
scalar qualityBeamLaser_;
|
||||
|
||||
|
||||
// Gaussian power distribution entries
|
||||
|
||||
//- Sigma deviation
|
||||
scalar sigma_;
|
||||
|
||||
//- Power
|
||||
autoPtr<Function1<scalar>> laserPower_;
|
||||
|
||||
|
||||
// Manual power distribution entries
|
||||
|
||||
//- Manual power distribution table. (theta, radius)
|
||||
autoPtr<interpolation2DTable<scalar>> powerDistribution_;
|
||||
|
||||
|
||||
// Reflection sub-model
|
||||
|
||||
//- Reflection model
|
||||
reflectionModelTable reflections_;
|
||||
|
||||
//- Reflection switch
|
||||
bool reflectionSwitch_;
|
||||
|
||||
//- Alpha value at which reflection is set
|
||||
scalar alphaCut_;
|
||||
|
||||
|
||||
// Fields
|
||||
|
||||
|
||||
//- Incident radiative heat flux [W/m2]
|
||||
volScalarField Qin_;
|
||||
|
||||
//- Absorption coefficient
|
||||
volScalarField a_;
|
||||
|
||||
//- Emission coefficient
|
||||
volScalarField e_;
|
||||
|
||||
//- Emission contribution
|
||||
volScalarField E_;
|
||||
|
||||
//- Volumetric heat source [W/m3]
|
||||
volScalarField Q_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- 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);
|
||||
|
||||
// Normal surface on the interface
|
||||
tmp<volVectorField> nHatfv
|
||||
(
|
||||
const volScalarField& alpha1,
|
||||
const volScalarField& alpha2
|
||||
) const;
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
laserDTRM(const laserDTRM&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const laserDTRM&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("laserDTRM");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
laserDTRM(const volScalarField& T);
|
||||
|
||||
//- Construct from components
|
||||
laserDTRM(const dictionary& dict, const volScalarField& T);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~laserDTRM() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Solve radiation equation(s)
|
||||
void calculate();
|
||||
|
||||
//- Read radiation properties dictionary
|
||||
bool read();
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
//- Source term component (for power of T^4)
|
||||
virtual tmp<volScalarField> Rp() const;
|
||||
|
||||
//- Source term component (constant)
|
||||
virtual tmp<DimensionedField<scalar, volMesh> > Ru() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace radiation
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,190 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "localDensityAbsorptionEmission.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace radiation
|
||||
{
|
||||
defineTypeNameAndDebug(localDensityAbsorptionEmission, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
absorptionEmissionModel,
|
||||
localDensityAbsorptionEmission,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
const Foam::volScalarField&
|
||||
Foam::radiation::localDensityAbsorptionEmission::alpha(word alphaName) const
|
||||
{
|
||||
if (!mesh_.foundObject<volScalarField>(alphaName))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unable to retrieve density field " << alphaName << " from "
|
||||
<< "database. Available objects:" << mesh_.sortedNames()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return mesh_.lookupObject<volScalarField>(alphaName);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::radiation::localDensityAbsorptionEmission::localDensityAbsorptionEmission
|
||||
(
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
absorptionEmissionModel(dict, mesh),
|
||||
coeffsDict_(dict.subDict(typeName + "Coeffs")),
|
||||
alphaNames_(coeffsDict_.lookup("alphaNames")),
|
||||
aCoeff_(coeffsDict_.lookup("aCoeff")),
|
||||
eCoeff_(coeffsDict_.lookup("eCoeff")),
|
||||
ECoeff_(coeffsDict_.lookup("ECoeff"))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::radiation::localDensityAbsorptionEmission::aCont(const label bandI) const
|
||||
{
|
||||
|
||||
tmp<volScalarField> ta
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"a",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("zero", inv(dimLength), 0)
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& a = ta.ref();
|
||||
|
||||
forAll(alphaNames_, i)
|
||||
{
|
||||
dimensionedScalar aPhase("a", dimless/dimLength, aCoeff_[i]);
|
||||
a += max(alpha(alphaNames_[i]), 0.0)*aPhase;
|
||||
}
|
||||
|
||||
return ta;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::radiation::localDensityAbsorptionEmission::eCont(const label bandI) const
|
||||
{
|
||||
tmp<volScalarField> te
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"e",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("zero", inv(dimLength), 0)
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& e = te.ref();
|
||||
|
||||
forAll(alphaNames_, i)
|
||||
{
|
||||
dimensionedScalar ePhase("e", dimless/dimLength, eCoeff_[i]);
|
||||
e += max(alpha(alphaNames_[i]), 0.0)*ePhase;
|
||||
}
|
||||
|
||||
return te;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::radiation::localDensityAbsorptionEmission::ECont(const label bandI) const
|
||||
{
|
||||
tmp<volScalarField> tE
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"E",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("zero", dimMass/dimLength/pow3(dimTime), 0.0)
|
||||
)
|
||||
);
|
||||
|
||||
scalarField& E = tE.ref().primitiveFieldRef();
|
||||
|
||||
forAll(alphaNames_, i)
|
||||
{
|
||||
dimensionedScalar EPhase
|
||||
(
|
||||
"E",
|
||||
dimMass/dimLength/pow3(dimTime),
|
||||
ECoeff_[i]
|
||||
);
|
||||
|
||||
E += max(alpha(alphaNames_[i]), 0.0)*EPhase;
|
||||
}
|
||||
|
||||
return tE;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,140 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::radiation::localDensityAbsorptionEmission
|
||||
|
||||
Description
|
||||
Constant radiation absorption and emission coefficients for continuous
|
||||
phase
|
||||
|
||||
SourceFiles
|
||||
localDensityAbsorptionEmission.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef radiation_localDensityAbsorptionEmission_H
|
||||
#define radiation_localDensityAbsorptionEmission_H
|
||||
|
||||
#include "absorptionEmissionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace radiation
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class localDensityAbsorptionEmission Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class localDensityAbsorptionEmission
|
||||
:
|
||||
public absorptionEmissionModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Absorption model dictionary
|
||||
dictionary coeffsDict_;
|
||||
|
||||
//- Name of phase fields
|
||||
List<word> alphaNames_;
|
||||
|
||||
//- Absorption coefficients
|
||||
List<scalar> aCoeff_;
|
||||
|
||||
//- Emission coefficients
|
||||
List<scalar> eCoeff_;
|
||||
|
||||
//- Emission contributions
|
||||
List<scalar> ECoeff_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Retrieve the phase field from the database
|
||||
const volScalarField& alpha(word) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("localDensityAbsorptionEmission");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
localDensityAbsorptionEmission
|
||||
(
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~localDensityAbsorptionEmission() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
// Absorption coefficient
|
||||
|
||||
//- Absorption coefficient for continuous phase
|
||||
tmp<volScalarField> aCont(const label bandI = 0) const;
|
||||
|
||||
|
||||
// Emission coefficient
|
||||
|
||||
//- Emission coefficient for continuous phase
|
||||
tmp<volScalarField> eCont(const label bandI = 0) const;
|
||||
|
||||
|
||||
// Emission contribution
|
||||
|
||||
//- Emission contribution for continuous phase
|
||||
tmp<volScalarField> ECont(const label bandI = 0) const;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
inline bool isGrey() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace radiation
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,136 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "Fresnel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace radiation
|
||||
{
|
||||
defineTypeNameAndDebug(Fresnel, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
reflectionModel,
|
||||
Fresnel,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::radiation::Fresnel::Fresnel
|
||||
(
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
reflectionModel(dict, mesh),
|
||||
coeffsDict_(dict.subDict(typeName + "Coeffs")),
|
||||
nk1_(coeffsDict_.lookup("nk1")),
|
||||
nk2_(coeffsDict_.lookup("nk2"))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::radiation::Fresnel::~Fresnel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::scalar Foam::radiation::Fresnel::rho
|
||||
(
|
||||
const scalar incidentAngle
|
||||
) const
|
||||
{
|
||||
// absorbing madium
|
||||
scalar n1 = sqr(nk1_[0]);
|
||||
//scalar k1 = sqr(nk1_[1]);
|
||||
|
||||
// dialectric
|
||||
scalar n2 = sqr(nk2_[0]);
|
||||
scalar k2 = sqr(nk2_[1]);
|
||||
|
||||
scalar sinTheta1 = sin(incidentAngle);
|
||||
|
||||
scalar sqrP =
|
||||
0.5*
|
||||
(
|
||||
sqrt
|
||||
(
|
||||
sqr(n2-k2-n1*sqr(sinTheta1)) + 4*n2*k2
|
||||
)
|
||||
+ (n2-k2-n1*sqr(sinTheta1))
|
||||
);
|
||||
|
||||
scalar sqrQ =
|
||||
0.5*
|
||||
(
|
||||
sqrt
|
||||
(
|
||||
sqr(n2-k2-n1*sqr(sinTheta1)) + 4*n2*k2
|
||||
)
|
||||
- (n2-k2-n1*sqr(sinTheta1))
|
||||
);
|
||||
|
||||
scalar cosTheta1 = cos(incidentAngle);
|
||||
scalar tanTheta1 = tan(incidentAngle);
|
||||
|
||||
scalar rhoP =
|
||||
(
|
||||
(sqr(sqrt(n1)*cosTheta1 - sqrt(sqrP)) + sqrQ)
|
||||
/
|
||||
(sqr(sqrt(n1)*cosTheta1 + sqrt(sqrP)) + sqrQ)
|
||||
);
|
||||
|
||||
scalar rhoN =
|
||||
(
|
||||
(sqr(sqrt(sqrP) - sqrt(n1)*sinTheta1*tanTheta1) + sqrQ)
|
||||
/
|
||||
(sqr(sqrt(sqrP) + sqrt(n1)*sinTheta1*tanTheta1) + sqrQ)
|
||||
)*rhoP;
|
||||
|
||||
return 0.5*(rhoP + rhoN);
|
||||
}
|
||||
|
||||
|
||||
Foam::vector Foam::radiation::Fresnel::R
|
||||
(
|
||||
const vector& i,
|
||||
const vector& n
|
||||
) const
|
||||
{
|
||||
return i + 2.0*(-i & n) * n;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,102 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::radiation::Fresnel
|
||||
|
||||
Description
|
||||
Genral Fresnel reflection model bewtween a dialectric and an absorbing
|
||||
medium.
|
||||
|
||||
Radiative heat transfer. Micheal Modest. 3dr Edition. Chapter 2.5
|
||||
|
||||
SourceFiles
|
||||
scatterModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef radiation_Fresnel_H
|
||||
#define radiation_Fresnel_H
|
||||
|
||||
#include "reflectionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace radiation
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class Fresnel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class Fresnel
|
||||
:
|
||||
public reflectionModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Coefficients dictionary
|
||||
dictionary coeffsDict_;
|
||||
|
||||
//- Complex index of refraction for medium 1
|
||||
Pair<scalar> nk1_;
|
||||
|
||||
//- Complex index of refraction for medium 2
|
||||
Pair<scalar> nk2_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("Fresnel");
|
||||
|
||||
//- Construct from components
|
||||
Fresnel(const dictionary& dict, const fvMesh& mesh);
|
||||
|
||||
//- Destructor
|
||||
virtual ~Fresnel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return reflected direction
|
||||
virtual vector R(const vector& incident, const vector& n) const;
|
||||
|
||||
//- Return reflectivity from medium1 to medium2 and a incident angle.
|
||||
// nk1 = (n1 - i k1) from medium 1.
|
||||
virtual scalar rho(const scalar incidentAngle) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace radiation
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,94 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "FresnelLaser.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace radiation
|
||||
{
|
||||
defineTypeNameAndDebug(FresnelLaser, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
reflectionModel,
|
||||
FresnelLaser,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::radiation::FresnelLaser::FresnelLaser
|
||||
(
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
reflectionModel(dict, mesh),
|
||||
epsilon_(readScalar(dict.lookup("epsilon")))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::scalar Foam::radiation::FresnelLaser::rho
|
||||
(
|
||||
const scalar cosTheta
|
||||
) const
|
||||
{
|
||||
//scalar cosTheta = cos(incidentAngle);
|
||||
|
||||
scalar rho =
|
||||
0.5
|
||||
* (
|
||||
(1 + sqr(1 - epsilon_*cosTheta))/(1 + sqr(1 + epsilon_*cosTheta))
|
||||
+
|
||||
(sqr(epsilon_) - 2*epsilon_*cosTheta + 2*sqr(cosTheta))
|
||||
/
|
||||
(sqr(epsilon_) + 2*epsilon_*cosTheta + 2*sqr(cosTheta))
|
||||
);
|
||||
|
||||
return rho;
|
||||
}
|
||||
|
||||
|
||||
Foam::vector Foam::radiation::FresnelLaser::R
|
||||
(
|
||||
const vector& i,
|
||||
const vector& n
|
||||
) const
|
||||
{
|
||||
return i + 2.0*(-i & n) * n;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,101 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::radiation::FresnelLaser
|
||||
|
||||
Description
|
||||
|
||||
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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef radiation_FresnelLaser_H
|
||||
#define radiation_FresnelLaser_H
|
||||
|
||||
#include "reflectionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace radiation
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class FresnelLaser Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class FresnelLaser
|
||||
:
|
||||
public reflectionModel
|
||||
{
|
||||
|
||||
// Private data
|
||||
|
||||
//- Model constant
|
||||
scalar epsilon_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("FresnelLaser");
|
||||
|
||||
//- Construct from components
|
||||
FresnelLaser(const dictionary& dict, const fvMesh& mesh);
|
||||
|
||||
//- Destructor
|
||||
virtual ~FresnelLaser() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return reflected direction
|
||||
virtual vector R(const vector& incident, const vector& n) const;
|
||||
|
||||
//- Return reflectivity from medium1 to medium2 and a incident angle.
|
||||
// nk1 = (n1 - i k1) from medium 1.
|
||||
virtual scalar rho(const scalar incidentAngle) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace radiation
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,74 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "noReflection.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace radiation
|
||||
{
|
||||
defineTypeNameAndDebug(noReflection, 0);
|
||||
addToRunTimeSelectionTable(reflectionModel, noReflection, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::radiation::noReflection::noReflection
|
||||
(
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
reflectionModel(dict, mesh)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::scalar Foam::radiation::noReflection::rho
|
||||
(
|
||||
const scalar incidentAngle
|
||||
) const
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
Foam::vector Foam::radiation::noReflection::R
|
||||
(
|
||||
const vector& incident,
|
||||
const vector& n
|
||||
) const
|
||||
{
|
||||
return (vector::zero);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,91 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::radiation::noReflection
|
||||
|
||||
Description
|
||||
Dummy scatter model for 'none'
|
||||
|
||||
SourceFiles
|
||||
scatterModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef radiation_noReflection_H
|
||||
#define radiation_noReflection_H
|
||||
|
||||
#include "reflectionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace radiation
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class noReflection Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class noReflection
|
||||
:
|
||||
public reflectionModel
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("none");
|
||||
|
||||
//- Construct from components
|
||||
noReflection(const dictionary& dict, const fvMesh& mesh);
|
||||
|
||||
//- Destructor
|
||||
virtual ~noReflection() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return reflectivity from medium1 to medium2 and a incident angle.
|
||||
virtual scalar rho
|
||||
(
|
||||
const scalar incidentAngle
|
||||
) const;
|
||||
|
||||
|
||||
//- Return reflected direction
|
||||
virtual vector R(const vector& incident, const vector& n) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace radiation
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,53 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "error.H"
|
||||
#include "reflectionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace radiation
|
||||
{
|
||||
defineTypeNameAndDebug(reflectionModel, 0);
|
||||
defineRunTimeSelectionTable(reflectionModel, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::radiation::reflectionModel::reflectionModel
|
||||
(
|
||||
const dictionary&,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
mesh_(mesh)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,121 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::radiation::reflectionModel
|
||||
|
||||
Description
|
||||
Base class for radiation scattering
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef radiation_reflectionModel_H
|
||||
#define radiation_reflectionModel_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "volFields.H"
|
||||
#include "Pair.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace radiation
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class reflectionModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class reflectionModel
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Reference to the fvMesh
|
||||
const fvMesh& mesh_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("reflectionModel");
|
||||
|
||||
// Declare runtime constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
reflectionModel,
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
),
|
||||
(dict, mesh)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
reflectionModel(const dictionary& dict, const fvMesh& mesh);
|
||||
|
||||
|
||||
// Selector
|
||||
|
||||
static autoPtr<reflectionModel> New
|
||||
(
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~reflectionModel() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return reflected direction
|
||||
virtual vector R(const vector& incident, const vector& n) const = 0;
|
||||
|
||||
//- Return reflectivity from medium1 to medium2 and a incident angle.
|
||||
virtual scalar rho(const scalar incidentAngle) const = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace radiation
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,58 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "error.H"
|
||||
#include "reflectionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::radiation::reflectionModel>
|
||||
Foam::radiation::reflectionModel::New
|
||||
(
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
const word modelType(dict.lookup("type"));
|
||||
|
||||
Info<< "Selecting reflectionModel " << modelType << endl;
|
||||
|
||||
const auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Unknown reflectionModel type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid reflectionModel types are :" << nl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
return autoPtr<reflectionModel>(cstrIter()(dict, mesh));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,345 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "InterfaceCompositionModel.H"
|
||||
#include "phaseModel.H"
|
||||
#include "phasePair.H"
|
||||
#include "pureMixture.H"
|
||||
#include "multiComponentMixture.H"
|
||||
#include "rhoThermo.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
template<class ThermoType>
|
||||
const typename Foam::multiComponentMixture<ThermoType>::thermoType&
|
||||
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getLocalThermo
|
||||
(
|
||||
const word& speciesName,
|
||||
const multiComponentMixture<ThermoType>& globalThermo
|
||||
) const
|
||||
{
|
||||
return
|
||||
globalThermo.getLocalThermo
|
||||
(
|
||||
globalThermo.species()
|
||||
[
|
||||
speciesName
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
template<class ThermoType>
|
||||
const typename Foam::pureMixture<ThermoType>::thermoType&
|
||||
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getLocalThermo
|
||||
(
|
||||
const word& speciesName,
|
||||
const pureMixture<ThermoType>& globalThermo
|
||||
) const
|
||||
{
|
||||
return globalThermo.cellMixture(0);
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
template<class ThermoType>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getSpecieMassFraction
|
||||
(
|
||||
const word& speciesName,
|
||||
const multiComponentMixture<ThermoType>& mixture
|
||||
) const
|
||||
{
|
||||
const fvMesh& mesh = fromThermo_.p().mesh();
|
||||
|
||||
tmp<volScalarField> tY
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"tY",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("zero", dimless, 0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& Ys = tY.ref();
|
||||
Ys = mixture.Y(speciesName);
|
||||
|
||||
return tY;
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
template<class ThermoType>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getSpecieMassFraction
|
||||
(
|
||||
const word& speciesName,
|
||||
const pureMixture<ThermoType>& mixture
|
||||
) const
|
||||
{
|
||||
const fvMesh& mesh = fromThermo_.p().mesh();
|
||||
|
||||
tmp<volScalarField> tY
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"tY",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("zero", dimless, 1),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
return tY;
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
template<class ThermoType>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::MwMixture
|
||||
(
|
||||
const pureMixture<ThermoType>& mixture
|
||||
) const
|
||||
{
|
||||
const fvMesh& mesh = fromThermo_.p().mesh();
|
||||
|
||||
tmp<volScalarField> tM
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"tM",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar
|
||||
(
|
||||
"Mw",
|
||||
dimMass/dimMoles,
|
||||
1e-3*mixture.cellMixture(0).W()
|
||||
),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
return tM;
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
template<class ThermoType>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::MwMixture
|
||||
(
|
||||
const multiComponentMixture<ThermoType>& mixture
|
||||
) const
|
||||
{
|
||||
return refCast<const basicSpecieMixture>(mixture).W();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::InterfaceCompositionModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
)
|
||||
:
|
||||
interfaceCompositionModel(dict, pair),
|
||||
fromThermo_
|
||||
(
|
||||
pair.from().mesh().lookupObject<Thermo>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
basicThermo::dictName,
|
||||
pair.from().name()
|
||||
)
|
||||
)
|
||||
),
|
||||
toThermo_
|
||||
(
|
||||
pair.to().mesh().lookupObject<OtherThermo>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
basicThermo::dictName,
|
||||
pair.to().name()
|
||||
)
|
||||
)
|
||||
),
|
||||
Le_("Le", dimless, dict.lookupOrDefault<scalar>("Le", 1.0))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::D
|
||||
(
|
||||
const word& speciesName
|
||||
) const
|
||||
{
|
||||
const typename Thermo::thermoType& fromThermo =
|
||||
getLocalThermo
|
||||
(
|
||||
speciesName,
|
||||
fromThermo_
|
||||
);
|
||||
|
||||
const volScalarField& p(fromThermo_.p());
|
||||
|
||||
const volScalarField& T(fromThermo_.T());
|
||||
|
||||
tmp<volScalarField> tmpD
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("D", pair_.name()),
|
||||
p.time().timeName(),
|
||||
p.mesh()
|
||||
),
|
||||
p.mesh(),
|
||||
dimensionedScalar("zero", dimArea/dimTime, 0)
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& D = tmpD.ref();
|
||||
|
||||
forAll(p, cellI)
|
||||
{
|
||||
D[cellI] =
|
||||
fromThermo.alphah(p[cellI], T[cellI])
|
||||
/fromThermo.rho(p[cellI], T[cellI]);
|
||||
}
|
||||
|
||||
D /= Le_;
|
||||
D.correctBoundaryConditions();
|
||||
|
||||
return tmpD;
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::L
|
||||
(
|
||||
const word& speciesName,
|
||||
const volScalarField& Tf
|
||||
) const
|
||||
{
|
||||
const typename Thermo::thermoType& fromThermo =
|
||||
getLocalThermo(speciesName, fromThermo_);
|
||||
const typename OtherThermo::thermoType& toThermo =
|
||||
getLocalThermo(speciesName, toThermo_);
|
||||
|
||||
const volScalarField& p(fromThermo_.p());
|
||||
|
||||
tmp<volScalarField> tmpL
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("L", pair_.name()),
|
||||
p.time().timeName(),
|
||||
p.mesh()
|
||||
),
|
||||
p.mesh(),
|
||||
dimensionedScalar("zero", dimEnergy/dimMass, 0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& L = tmpL.ref();
|
||||
|
||||
// from Thermo (from) to Thermo (to)
|
||||
forAll(p, cellI)
|
||||
{
|
||||
L[cellI] = fromThermo.Hc() - toThermo.Hc();
|
||||
}
|
||||
|
||||
L.correctBoundaryConditions();
|
||||
|
||||
return tmpL;
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::dY
|
||||
(
|
||||
const word& speciesName,
|
||||
const volScalarField& Tf
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<volScalarField>();
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::Yf
|
||||
(
|
||||
const word& speciesName,
|
||||
const volScalarField& Tf
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<volScalarField>();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,277 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::InterfaceCompositionModel
|
||||
|
||||
Description
|
||||
Base class for interface composition models, templated on the two
|
||||
thermodynamic models either side of the interface.
|
||||
|
||||
SourceFiles
|
||||
InterfaceCompositionModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef InterfaceCompositionModel_H
|
||||
#define InterfaceCompositionModel_H
|
||||
|
||||
#include "interfaceCompositionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class phaseModel;
|
||||
class phasePair;
|
||||
template <class ThermoType> class pureMixture;
|
||||
template <class ThermoType> class multiComponentMixture;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class InterfaceCompositionModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
class InterfaceCompositionModel
|
||||
:
|
||||
public interfaceCompositionModel
|
||||
{
|
||||
protected:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Thermo (from)
|
||||
const Thermo& fromThermo_;
|
||||
|
||||
//- Other Thermo (to)
|
||||
const OtherThermo& toThermo_;
|
||||
|
||||
//- Lewis number
|
||||
const dimensionedScalar Le_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Get a reference to the local thermo for a pure mixture
|
||||
template<class ThermoType>
|
||||
const typename pureMixture<ThermoType>::thermoType&
|
||||
getLocalThermo
|
||||
(
|
||||
const word& speciesName,
|
||||
const pureMixture<ThermoType>& globalThermo
|
||||
) const;
|
||||
|
||||
//- Get a reference to the local thermo for a multi component mixture
|
||||
template<class ThermoType>
|
||||
const typename multiComponentMixture<ThermoType>::thermoType&
|
||||
getLocalThermo
|
||||
(
|
||||
const word& speciesName,
|
||||
const multiComponentMixture<ThermoType>& globalThermo
|
||||
) const;
|
||||
|
||||
//- Return mass fraction for a pureMixture equal to one
|
||||
template<class ThermoType>
|
||||
tmp<volScalarField> getSpecieMassFraction
|
||||
(
|
||||
const word& speciesName,
|
||||
const pureMixture<ThermoType>& thermo
|
||||
) const;
|
||||
|
||||
//- Return mass fraction for speciesName
|
||||
template<class ThermoType>
|
||||
tmp<volScalarField> getSpecieMassFraction
|
||||
(
|
||||
const word& speciesName,
|
||||
const multiComponentMixture<ThermoType>& thermo
|
||||
) const;
|
||||
|
||||
//- Return moleculas weight of the mixture for pureMixture [Kg/mol]
|
||||
template<class ThermoType>
|
||||
tmp<volScalarField> MwMixture
|
||||
(
|
||||
const pureMixture<ThermoType>& thermo
|
||||
) const;
|
||||
|
||||
//- Return moleculas weight of the mixture for multiComponentMixture
|
||||
// [Kg/mol]
|
||||
template<class ThermoType>
|
||||
tmp<volScalarField> MwMixture
|
||||
(
|
||||
const multiComponentMixture<ThermoType>&
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Construct from components
|
||||
InterfaceCompositionModel(const dictionary& dict, const phasePair& pair);
|
||||
|
||||
//- Destructor
|
||||
~InterfaceCompositionModel() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Mass fraction difference between the interface and the field
|
||||
virtual tmp<volScalarField> dY
|
||||
(
|
||||
const word& speciesName,
|
||||
const volScalarField& Tf
|
||||
) const;
|
||||
|
||||
//- Reference mass fraction for specied based models
|
||||
virtual tmp<volScalarField> Yf
|
||||
(
|
||||
const word& speciesName,
|
||||
const volScalarField& Tf
|
||||
) const;
|
||||
|
||||
//- Mass diffusivity of the local thermo
|
||||
virtual tmp<volScalarField> D
|
||||
(
|
||||
const word& speciesName
|
||||
) const;
|
||||
|
||||
//- Latent heat (to - from)(thermo - otherThermo)
|
||||
virtual tmp<volScalarField> L
|
||||
(
|
||||
const word& speciesName,
|
||||
const volScalarField& Tf
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// 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> > > \
|
||||
Type##Thermo##Comp##Mix##Phys; \
|
||||
\
|
||||
typedef OtherThermo<OtherComp, OtherMix<OtherPhys> > \
|
||||
Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys; \
|
||||
\
|
||||
\
|
||||
addInterfaceCompositionToRunTimeSelectionTable \
|
||||
( \
|
||||
Type, \
|
||||
Type##Thermo##Comp##Mix##Phys, \
|
||||
Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys \
|
||||
)
|
||||
|
||||
|
||||
// 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> > \
|
||||
Type##Thermo##Comp##Mix##Phys; \
|
||||
\
|
||||
typedef OtherThermo<OtherComp, SpecieMixture<OtherMix<OtherPhys> > > \
|
||||
Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys; \
|
||||
\
|
||||
\
|
||||
addInterfaceCompositionToRunTimeSelectionTable \
|
||||
( \
|
||||
Type, \
|
||||
Type##Thermo##Comp##Mix##Phys, \
|
||||
Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys \
|
||||
)
|
||||
|
||||
|
||||
// Instantiation for single-component-single-component pairs
|
||||
#define makeInterfacePureType(Type, Thermo, Comp, Mix, Phys, OtherThermo, OtherComp, OtherMix, OtherPhys)\
|
||||
\
|
||||
typedef Thermo<Comp, Mix<Phys> > \
|
||||
Type##Thermo##Comp##Mix##Phys; \
|
||||
\
|
||||
typedef OtherThermo<OtherComp, OtherMix<OtherPhys> > \
|
||||
Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys; \
|
||||
\
|
||||
\
|
||||
addInterfaceCompositionToRunTimeSelectionTable \
|
||||
( \
|
||||
Type, \
|
||||
Type##Thermo##Comp##Mix##Phys, \
|
||||
Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys \
|
||||
)
|
||||
|
||||
|
||||
// Instantiation for multi-component-multi-component pairs
|
||||
#define makeSpecieInterfaceSpecieMixtures(Type, Thermo, Comp, Mix, Phys, OtherThermo, OtherComp, OtherMix, OtherPhys)\
|
||||
\
|
||||
typedef Thermo<Comp, SpecieMixture<Mix<Phys> > > \
|
||||
Type##Thermo##Comp##Mix##Phys; \
|
||||
\
|
||||
typedef OtherThermo<OtherComp, SpecieMixture<OtherMix<OtherPhys> > > \
|
||||
Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys; \
|
||||
\
|
||||
addInterfaceCompositionToRunTimeSelectionTable \
|
||||
( \
|
||||
Type, \
|
||||
Type##Thermo##Comp##Mix##Phys, \
|
||||
Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys \
|
||||
)
|
||||
|
||||
|
||||
// Addition to the run-time selection table
|
||||
#define addInterfaceCompositionToRunTimeSelectionTable(Type, Thermo, OtherThermo)\
|
||||
\
|
||||
typedef Type<Thermo, OtherThermo> \
|
||||
Type##Thermo##OtherThermo; \
|
||||
\
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
( \
|
||||
Type##Thermo##OtherThermo, \
|
||||
( \
|
||||
word(Type##Thermo##OtherThermo::typeName_()) + "<" \
|
||||
+ word(Thermo::typeName) + "," \
|
||||
+ word(OtherThermo::typeName) + ">" \
|
||||
).c_str(), \
|
||||
0 \
|
||||
); \
|
||||
\
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
interfaceCompositionModel, \
|
||||
Type##Thermo##OtherThermo, \
|
||||
dictionary \
|
||||
)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "InterfaceCompositionModel.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,289 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "thermoPhysicsTypes.H"
|
||||
|
||||
#include "rhoConst.H"
|
||||
#include "perfectFluid.H"
|
||||
#include "Boussinesq.H"
|
||||
|
||||
#include "pureMixture.H"
|
||||
#include "multiComponentMixture.H"
|
||||
#include "reactingMixture.H"
|
||||
#include "SpecieMixture.H"
|
||||
|
||||
#include "rhoThermo.H"
|
||||
#include "rhoReactionThermo.H"
|
||||
#include "heRhoThermo.H"
|
||||
|
||||
#include "solidThermo.H"
|
||||
#include "heSolidThermo.H"
|
||||
#include "solidThermoPhysicsTypes.H"
|
||||
|
||||
#include "kineticGasEvaporation.H"
|
||||
#include "Lee.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef
|
||||
constTransport
|
||||
<
|
||||
species::thermo
|
||||
<
|
||||
hConstThermo
|
||||
<
|
||||
rhoConst<specie>
|
||||
>,
|
||||
sensibleEnthalpy
|
||||
>
|
||||
> constRhoHThermoPhysics;
|
||||
|
||||
|
||||
typedef
|
||||
constTransport
|
||||
<
|
||||
species::thermo
|
||||
<
|
||||
hConstThermo
|
||||
<
|
||||
Boussinesq<specie>
|
||||
>,
|
||||
sensibleEnthalpy
|
||||
>
|
||||
> BoussinesqFluidEThermoPhysics;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
using namespace meltingEvaporationModels;
|
||||
|
||||
//NOTE: First thermo (from) and second otherThermo (to)
|
||||
|
||||
// kineticGasEvaporation model definitions
|
||||
|
||||
// From pure liquid (rhoConst) to a multi-component gas incomp phase
|
||||
makeInterfaceContSpecieMixtureType
|
||||
(
|
||||
kineticGasEvaporation,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
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,
|
||||
constIncompressibleGasHThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
// From pure liquid (rhoConst) to pure gas (incompressible ideal gas)
|
||||
makeInterfacePureType
|
||||
(
|
||||
kineticGasEvaporation,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constRhoHThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constIncompressibleGasHThermoPhysics
|
||||
);
|
||||
|
||||
// From pure liquid (const rho) to pure gas (rhoConst) gas
|
||||
makeInterfacePureType
|
||||
(
|
||||
kineticGasEvaporation,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constRhoHThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constRhoHThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
// From pure liquid (Boussinesq) to pure gas (incompressible ideal gas)
|
||||
makeInterfacePureType
|
||||
(
|
||||
kineticGasEvaporation,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
BoussinesqFluidEThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constIncompressibleGasHThermoPhysics
|
||||
);
|
||||
|
||||
// From pure liquid (Boussinesq) to pure gas (rho const)
|
||||
makeInterfacePureType
|
||||
(
|
||||
kineticGasEvaporation,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
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,
|
||||
BoussinesqFluidEThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
// From pure phase (solidThermo) to phase (Boussinesq)
|
||||
makeInterfacePureType
|
||||
(
|
||||
Lee,
|
||||
heSolidThermo,
|
||||
solidThermo,
|
||||
pureMixture,
|
||||
hConstSolidThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
BoussinesqFluidEThermoPhysics
|
||||
);
|
||||
|
||||
// From pure phase (solidThermo) to phase (rho const)
|
||||
makeInterfacePureType
|
||||
(
|
||||
Lee,
|
||||
heSolidThermo,
|
||||
solidThermo,
|
||||
pureMixture,
|
||||
hConstSolidThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constRhoHThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
// From pure phase (const rho) to multi phase (incomp ideal gas)
|
||||
makeInterfaceContSpecieMixtureType
|
||||
(
|
||||
Lee,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constRhoHThermoPhysics,
|
||||
heRhoThermo,
|
||||
rhoReactionThermo,
|
||||
multiComponentMixture,
|
||||
constIncompressibleGasHThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
// From pure phase (Boussinesq) to phase (solidThermo)
|
||||
makeInterfacePureType
|
||||
(
|
||||
Lee,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
BoussinesqFluidEThermoPhysics,
|
||||
heSolidThermo,
|
||||
solidThermo,
|
||||
pureMixture,
|
||||
hConstSolidThermoPhysics
|
||||
);
|
||||
|
||||
// From pure phase (rho const) to phase (solidThermo)
|
||||
makeInterfacePureType
|
||||
(
|
||||
Lee,
|
||||
heRhoThermo,
|
||||
rhoThermo,
|
||||
pureMixture,
|
||||
constRhoHThermoPhysics,
|
||||
heSolidThermo,
|
||||
solidThermo,
|
||||
pureMixture,
|
||||
hConstSolidThermoPhysics
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,104 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "Lee.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::meltingEvaporationModels::Lee<Thermo, OtherThermo>::Lee
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
)
|
||||
:
|
||||
InterfaceCompositionModel<Thermo, OtherThermo>(dict, pair),
|
||||
C_("C", inv(dimTime), dict.lookup("C")),
|
||||
Tactivate_("Tactivate", dimTemperature, dict.lookup("Tactivate")),
|
||||
alphaMin_(dict.lookupOrDefault<scalar>("alphaMin", 0.0))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::meltingEvaporationModels::Lee<Thermo, OtherThermo>::Kexp
|
||||
(
|
||||
label variable,
|
||||
const volScalarField& refValue
|
||||
)
|
||||
{
|
||||
if (this->modelVariable_ == variable)
|
||||
{
|
||||
volScalarField from
|
||||
(
|
||||
min(max(this->pair().from(), scalar(0)), scalar(1))
|
||||
);
|
||||
|
||||
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_
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return tmp<volScalarField> ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
const Foam::dimensionedScalar&
|
||||
Foam::meltingEvaporationModels::Lee<Thermo, OtherThermo>::Tactivate() const
|
||||
{
|
||||
return Tactivate_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,171 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::meltingEvaporationModels::Lee
|
||||
|
||||
Description
|
||||
Mass tranfer Lee model. Simple model driven by field value difference as:
|
||||
|
||||
\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
|
||||
Lee.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef meltingEvaporationModels_Lee_H
|
||||
#define meltingEvaporationModels_Lee_H
|
||||
|
||||
#include "InterfaceCompositionModel.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace meltingEvaporationModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class Lee
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
class Lee
|
||||
:
|
||||
public InterfaceCompositionModel<Thermo, OtherThermo>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Condensation coefficient [1/s]
|
||||
dimensionedScalar C_;
|
||||
|
||||
//- Phase transition temperature
|
||||
const dimensionedScalar Tactivate_;
|
||||
|
||||
//- Phase minimum value for activation
|
||||
scalar alphaMin_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("Lee");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
Lee
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~Lee() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Explicit mass transfer coefficient
|
||||
virtual tmp<volScalarField> Kexp
|
||||
(
|
||||
label variable,
|
||||
const volScalarField& field
|
||||
);
|
||||
|
||||
//- Return T transition between phases
|
||||
virtual const dimensionedScalar& Tactivate() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace meltingEvaporationModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "Lee.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,5 @@
|
||||
interfaceCompositionModel/interfaceCompositionModel.C
|
||||
interfaceCompositionModel/interfaceCompositionModelNew.C
|
||||
InterfaceCompositionModel/InterfaceCompositionModels.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libmassTransferModels
|
||||
@ -0,0 +1,15 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I../phasesSystem/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lsolidThermo \
|
||||
-lsolidSpecie
|
||||
@ -0,0 +1,104 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "interfaceCompositionModel.H"
|
||||
#include "phaseModel.H"
|
||||
#include "phasePair.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(interfaceCompositionModel, 0);
|
||||
defineRunTimeSelectionTable(interfaceCompositionModel, dictionary);
|
||||
}
|
||||
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::interfaceCompositionModel::modelVariable,
|
||||
3
|
||||
>::names[] =
|
||||
{
|
||||
"temperature",
|
||||
"pressure",
|
||||
"massFraction"
|
||||
};
|
||||
}
|
||||
|
||||
const Foam::NamedEnum
|
||||
<
|
||||
Foam::interfaceCompositionModel::modelVariable,
|
||||
3
|
||||
> Foam::interfaceCompositionModel::modelVariableNames;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::interfaceCompositionModel::interfaceCompositionModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
)
|
||||
:
|
||||
modelVariable_
|
||||
(
|
||||
modelVariableNames.lookupOrDefault
|
||||
(
|
||||
"variable",
|
||||
dict,
|
||||
modelVariable::T
|
||||
)
|
||||
),
|
||||
pair_(pair),
|
||||
speciesName_(dict.lookupOrDefault<word>("species", "none")),
|
||||
mesh_(pair_.from().mesh())
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::word Foam::interfaceCompositionModel::transferSpecie() const
|
||||
{
|
||||
return speciesName_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::phasePair& Foam::interfaceCompositionModel::pair() const
|
||||
{
|
||||
return pair_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::word Foam::interfaceCompositionModel::variable() const
|
||||
{
|
||||
return modelVariableNames[modelVariable_];
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,195 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::interfaceCompositionModel
|
||||
|
||||
Description
|
||||
Generic base class for interface models. Mass transer models are
|
||||
interface models between two thermos.
|
||||
Abstract class for mass transfer functions
|
||||
|
||||
SourceFiles
|
||||
interfaceCompositionModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef interfaceCompositionModel_H
|
||||
#define interfaceCompositionModel_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "volFields.H"
|
||||
#include "dictionary.H"
|
||||
#include "hashedWordList.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "NamedEnum.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class phaseModel;
|
||||
class phasePair;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class interfaceCompositionModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class interfaceCompositionModel
|
||||
{
|
||||
public:
|
||||
|
||||
// Public type
|
||||
|
||||
//- Enumeration for variable based mass transfer models
|
||||
enum modelVariable
|
||||
{
|
||||
T, /* temperature based */
|
||||
P, /* pressure based */
|
||||
Y /* mass fraction based */
|
||||
};
|
||||
|
||||
static const NamedEnum<modelVariable, 3> modelVariableNames;
|
||||
|
||||
//- Enumeration for model variables
|
||||
modelVariable modelVariable_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Phase pair
|
||||
const phasePair& pair_;
|
||||
|
||||
//- Names of the transferring specie
|
||||
word speciesName_;
|
||||
|
||||
//- Reference to mesh
|
||||
const fvMesh& mesh_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("interfaceCompositionModel");
|
||||
|
||||
|
||||
// Declare runtime construction
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
interfaceCompositionModel,
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
),
|
||||
(dict, pair)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from a dictionary and a phase pair
|
||||
interfaceCompositionModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~interfaceCompositionModel() = default;
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
static autoPtr<interfaceCompositionModel> New
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
//- Return the transferring species name
|
||||
const word transferSpecie() const;
|
||||
|
||||
//- Return pair
|
||||
const phasePair& pair() const;
|
||||
|
||||
//- Interface mass fraction
|
||||
virtual tmp<volScalarField> Yf
|
||||
(
|
||||
const word& speciesName,
|
||||
const volScalarField& Tf
|
||||
) const = 0;
|
||||
|
||||
//- Mass fraction difference between the interface and the field
|
||||
virtual tmp<volScalarField> dY
|
||||
(
|
||||
const word& speciesName,
|
||||
const volScalarField& Tf
|
||||
) const = 0;
|
||||
|
||||
//- Mass diffusivity
|
||||
virtual tmp<volScalarField> D
|
||||
(
|
||||
const word& speciesName
|
||||
) const = 0;
|
||||
|
||||
//- Latent heat (delta Hc)
|
||||
virtual tmp<volScalarField> L
|
||||
(
|
||||
const word& speciesName,
|
||||
const volScalarField& Tf
|
||||
) const = 0;
|
||||
|
||||
//- Explicit mass transfer coefficient
|
||||
virtual tmp<volScalarField> Kexp
|
||||
(
|
||||
label modelVariable,
|
||||
const volScalarField& field
|
||||
) = 0;
|
||||
|
||||
//- Reference value
|
||||
virtual const dimensionedScalar& Tactivate() const = 0;
|
||||
|
||||
//- Returns the variable on which the model is based
|
||||
const word variable() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,69 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "interfaceCompositionModel.H"
|
||||
#include "phasePair.H"
|
||||
#include "rhoThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::interfaceCompositionModel>
|
||||
Foam::interfaceCompositionModel::New
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
)
|
||||
{
|
||||
word interfaceCompositionModelType
|
||||
(
|
||||
word(dict.lookup("type"))
|
||||
+ "<"
|
||||
+ pair.phase1().thermo().type()
|
||||
+ ","
|
||||
+ pair.phase2().thermo().type()
|
||||
+ ">"
|
||||
);
|
||||
|
||||
Info<< "Selecting interfaceCompositionModel for "
|
||||
<< pair << ": " << interfaceCompositionModelType << endl;
|
||||
|
||||
const auto cstrIter =
|
||||
dictionaryConstructorTablePtr_->cfind(interfaceCompositionModelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown interfaceCompositionModelType type "
|
||||
<< interfaceCompositionModelType << nl << nl
|
||||
<< "Valid interfaceCompositionModel types are : " << nl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return cstrIter()(dict, pair);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,273 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,210 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::meltingEvaporationModels::kineticGasEvaporation
|
||||
|
||||
Description
|
||||
|
||||
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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef meltingEvaporationModels_kineticGasEvaporation_H
|
||||
#define meltingEvaporationModels_kineticGasEvaporation_H
|
||||
|
||||
|
||||
#include "InterfaceCompositionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class phasePair;
|
||||
|
||||
namespace meltingEvaporationModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class kineticGasEvaporation
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Thermo, class OtherThermo>
|
||||
class kineticGasEvaporation
|
||||
:
|
||||
public InterfaceCompositionModel<Thermo, OtherThermo>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Evaporation coefficient
|
||||
dimensionedScalar C_;
|
||||
|
||||
//- Activation temperature
|
||||
const dimensionedScalar Tactivate_;
|
||||
|
||||
//- Molar weight of the vapour in the continous phase
|
||||
dimensionedScalar Mv_;
|
||||
|
||||
//- 'To' phase maximum value for the mass transfer
|
||||
scalar alphaMax_;
|
||||
|
||||
//- 'To' phase minumum value for the mass transfer
|
||||
scalar alphaMin_;
|
||||
|
||||
//- Alpha maximum for the rest of phases
|
||||
scalar alphaRestMax_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("kineticGasEvaporation");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
kineticGasEvaporation
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~kineticGasEvaporation() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Explicit mass transfer coefficient
|
||||
virtual tmp<volScalarField> Kexp
|
||||
(
|
||||
label variable,
|
||||
const volScalarField& field
|
||||
);
|
||||
|
||||
//- Return Tactivate
|
||||
virtual const dimensionedScalar& Tactivate() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace meltingEvaporationModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "kineticGasEvaporation.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,112 @@
|
||||
{
|
||||
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
|
||||
|
||||
volVectorField HbyA("HbyA", U);
|
||||
HbyA = rAU*UEqn.H();
|
||||
|
||||
surfaceScalarField phiHbyA
|
||||
(
|
||||
"phiHbyA",
|
||||
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi)
|
||||
);
|
||||
adjustPhi(phiHbyA, U, p_rgh);
|
||||
|
||||
surfaceScalarField phig
|
||||
(
|
||||
(
|
||||
fluid.surfaceTensionForce()
|
||||
- ghf*fvc::snGrad(rho)
|
||||
)*rAUf*mesh.magSf()
|
||||
);
|
||||
|
||||
phiHbyA += phig;
|
||||
|
||||
// Update the fixedFluxPressure BCs to ensure flux consistency
|
||||
constrainPressure(p_rgh, U, phiHbyA, rAUf);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
|
||||
fvScalarMatrix p_rghEqn
|
||||
(
|
||||
fvc::div(phiHbyA)
|
||||
- fvm::laplacian(rAUf, p_rgh)
|
||||
);
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
phaseSystem::phasePairTable,
|
||||
fluid.totalPhasePairs(),
|
||||
iter
|
||||
)
|
||||
{
|
||||
const phasePair& pair = iter()();
|
||||
|
||||
const phaseModel& phase1 = pair.phase1();
|
||||
const phaseModel& phase2 = pair.phase2();
|
||||
|
||||
const phasePairKey key12
|
||||
(
|
||||
phase1.name(),
|
||||
phase2.name(),
|
||||
true
|
||||
);
|
||||
|
||||
// Mass transfer from phase2 to phase1
|
||||
tmp<volScalarField> tdmdt12(fluid.dmdt(key12));
|
||||
const volScalarField& dmdt12 = tdmdt12();
|
||||
|
||||
const phasePairKey key21
|
||||
(
|
||||
phase2.name(),
|
||||
phase1.name(),
|
||||
true
|
||||
);
|
||||
|
||||
// Mass transfer from phase1 to phase2
|
||||
tmp<volScalarField> tdmdt21(fluid.dmdt(key21));
|
||||
const volScalarField& dmdt21 = tdmdt21();
|
||||
|
||||
const volScalarField dmdtNet(dmdt21 - dmdt12);
|
||||
|
||||
p_rghEqn +=
|
||||
dmdtNet*
|
||||
(
|
||||
- fluid.coeffs(phase1.name())
|
||||
+ fluid.coeffs(phase2.name())
|
||||
);
|
||||
}
|
||||
|
||||
p_rghEqn.setReference(pRefCell, pRefValue);
|
||||
|
||||
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
|
||||
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
phi = phiHbyA + p_rghEqn.flux();
|
||||
|
||||
p_rgh.relax();
|
||||
|
||||
U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rAUf);
|
||||
|
||||
U.correctBoundaryConditions();
|
||||
fvOptions.correct(U);
|
||||
K = 0.5*magSqr(U);
|
||||
}
|
||||
}
|
||||
|
||||
p == p_rgh + rho*gh;
|
||||
|
||||
if (p_rgh.needReference())
|
||||
{
|
||||
p += dimensionedScalar
|
||||
(
|
||||
"p",
|
||||
p.dimensions(),
|
||||
pRefValue - getRefCellValue(p, pRefCell)
|
||||
);
|
||||
p_rgh = p - rho*gh;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
interfaceModels/porousModels/porousModel/porousModel.C
|
||||
interfaceModels/porousModels/porousModel/porousModelNew.C
|
||||
interfaceModels/porousModels/VollerPrakash/VollerPrakash.C
|
||||
|
||||
phasePair/phasePairKey/phasePairKey.C
|
||||
phasePair/phasePair/phasePair.C
|
||||
phasePair/orderedPhasePair/orderedPhasePair.C
|
||||
|
||||
phaseModel/phaseModel/phaseModel.C
|
||||
phaseModel/phaseModel/phaseModelNew.C
|
||||
phaseModel/phaseModel/phaseModels.C
|
||||
|
||||
phaseSystem/phaseSystem.C
|
||||
|
||||
phaseSystem/multiphaseSystem/multiphaseSystem.C
|
||||
phaseSystem/multiphaseSystem/multiphaseSystemNew.C
|
||||
phaseSystem/multiphaseSystem/multiphaseSystems.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libIncompressibleMultiphaseSystems
|
||||
@ -0,0 +1,22 @@
|
||||
EXE_INC = \
|
||||
-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 \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \
|
||||
-I$(LIB_SRC)/combustionModels/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lcombustionModels
|
||||
@ -0,0 +1,311 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * 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() = default;
|
||||
|
||||
|
||||
// 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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,73 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "VollerPrakash.H"
|
||||
#include "phasePair.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace porousModels
|
||||
{
|
||||
defineTypeNameAndDebug(VollerPrakash, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
porousModel,
|
||||
VollerPrakash,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::porousModels::VollerPrakash::VollerPrakash
|
||||
(
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
porousModel(dict, mesh),
|
||||
Cu_(readScalar(dict.lookup("Cu"))),
|
||||
solidPhase_(dict.lookup("solidPhase"))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::porousModels::VollerPrakash::S() const
|
||||
{
|
||||
const volScalarField& solidAlpha =
|
||||
mesh_.lookupObject<volScalarField>(solidPhase_);
|
||||
|
||||
return Cu_*sqr(solidAlpha)/(pow3(1.0 - solidAlpha) + 1e-3);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,129 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::porousModels::VollerPrakash
|
||||
|
||||
Description
|
||||
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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef porousModels_VollerPrakash_H
|
||||
#define porousModels_VollerPrakash_H
|
||||
|
||||
#include "porousModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace porousModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class VollerPrakash Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class VollerPrakash
|
||||
:
|
||||
public porousModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Constant surface tension value
|
||||
const scalar Cu_;
|
||||
|
||||
//- Solid phase name
|
||||
word solidPhase_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("VollerPrakash");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from a dictionary and a phase pair
|
||||
VollerPrakash
|
||||
(
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~VollerPrakash() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Aspect ratio
|
||||
virtual tmp<volScalarField> S() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace porousModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,69 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "porousModel.H"
|
||||
#include "phasePair.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(porousModel, 0);
|
||||
defineRunTimeSelectionTable(porousModel, dictionary);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::porousModel::porousModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
regIOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName(typeName, dict.name()),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
mesh_(mesh)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::porousModel::writeData(Ostream& os) const
|
||||
{
|
||||
return os.good();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,125 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::porousModel
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
porousModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef porousModel_H
|
||||
#define porousModel_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "volFields.H"
|
||||
#include "dictionary.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class fvMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class porousModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class porousModel
|
||||
:
|
||||
public regIOobject
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Reference to mesh
|
||||
const fvMesh& mesh_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("porousModel");
|
||||
|
||||
|
||||
// Declare runtime construction
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
porousModel,
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
),
|
||||
(dict, mesh)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from a dictionary and a phase pair
|
||||
porousModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~porousModel() = default;
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
static autoPtr<porousModel> New
|
||||
(
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Momemtum source
|
||||
virtual tmp<volScalarField> S() const = 0;
|
||||
|
||||
//- Dummy write for regIOobject
|
||||
bool writeData(Ostream& os) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,58 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "porousModel.H"
|
||||
#include "phasePair.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::porousModel> Foam::porousModel::New
|
||||
(
|
||||
const dictionary& dict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
word modelType(dict.lookup("type"));
|
||||
|
||||
Info<< "Selecting porousModel for "
|
||||
<< ": " << modelType << endl;
|
||||
|
||||
const auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown modelType type "
|
||||
<< modelType << endl << endl
|
||||
<< "Valid porousModel types are : " << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return cstrIter()(dict, mesh);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,84 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "constantSurfaceTensionCoefficient.H"
|
||||
#include "phasePair.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace surfaceTensionModels
|
||||
{
|
||||
defineTypeNameAndDebug(constantSurfaceTensionCoefficient, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
surfaceTensionModel,
|
||||
constantSurfaceTensionCoefficient,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::surfaceTensionModels::constantSurfaceTensionCoefficient::
|
||||
constantSurfaceTensionCoefficient
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair,
|
||||
const bool registerObject
|
||||
)
|
||||
:
|
||||
surfaceTensionModel(dict, pair, registerObject),
|
||||
sigma_("sigma", dimensionSet(1, 0, -2, 0, 0), dict.lookup("sigma"))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::surfaceTensionModels::constantSurfaceTensionCoefficient::sigma() const
|
||||
{
|
||||
const fvMesh& mesh(this->pair_.phase1().mesh());
|
||||
|
||||
return
|
||||
tmp<volScalarField>::New
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"zero",
|
||||
mesh.time().timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
sigma_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,98 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::surfaceTensionModels::constantSurfaceTensionCoefficient
|
||||
|
||||
Description
|
||||
Constant value surface tension model.
|
||||
|
||||
SourceFiles
|
||||
constantSurfaceTensionCoefficient.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef surfaceTensionModels_constantSurfaceTensionCoefficient_H
|
||||
#define surfaceTensionModels_constantSurfaceTensionCoefficient_H
|
||||
|
||||
#include "surfaceTensionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace surfaceTensionModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class constantSurfaceTensionCoefficient Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class constantSurfaceTensionCoefficient
|
||||
:
|
||||
public surfaceTensionModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Constant surface tension value
|
||||
const dimensionedScalar sigma_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("constant");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from a dictionary and a phase pair
|
||||
constantSurfaceTensionCoefficient
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair,
|
||||
const bool registerObject
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~constantSurfaceTensionCoefficient() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Aspect ratio
|
||||
virtual tmp<volScalarField> sigma() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace surfaceTensionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,71 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "surfaceTensionModel.H"
|
||||
#include "phasePair.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(surfaceTensionModel, 0);
|
||||
defineRunTimeSelectionTable(surfaceTensionModel, dictionary);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::surfaceTensionModel::surfaceTensionModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair,
|
||||
const bool registerObject
|
||||
)
|
||||
:
|
||||
regIOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName(typeName, pair.name()),
|
||||
pair.phase1().mesh().time().timeName(),
|
||||
pair.phase1().mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
registerObject
|
||||
)
|
||||
),
|
||||
pair_(pair)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::surfaceTensionModel::writeData(Ostream& os) const
|
||||
{
|
||||
return os.good();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,128 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::surfaceTensionModel
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
surfaceTensionModel.C
|
||||
surfaceTensionModelNew.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef surfaceTensionModel_H
|
||||
#define surfaceTensionModel_H
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "volFields.H"
|
||||
#include "dictionary.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class phasePair;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class surfaceTensionModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class surfaceTensionModel
|
||||
:
|
||||
public regIOobject
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Phase pair
|
||||
const phasePair& pair_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("surfaceTensionModel");
|
||||
|
||||
|
||||
// Declare runtime construction
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
surfaceTensionModel,
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair,
|
||||
const bool registerObject
|
||||
),
|
||||
(dict, pair, registerObject)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from a dictionary and a phase pair
|
||||
surfaceTensionModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair,
|
||||
const bool registerObject
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~surfaceTensionModel() = default;
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
static autoPtr<surfaceTensionModel> New
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Aspect ratio
|
||||
virtual tmp<volScalarField> sigma() const = 0;
|
||||
|
||||
//- Dummy write for regIOobject
|
||||
bool writeData(Ostream& os) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,58 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "surfaceTensionModel.H"
|
||||
#include "phasePair.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::surfaceTensionModel> Foam::surfaceTensionModel::New
|
||||
(
|
||||
const dictionary& dict,
|
||||
const phasePair& pair
|
||||
)
|
||||
{
|
||||
word modelType(dict.lookup("type"));
|
||||
|
||||
Info<< "Selecting surfaceTensionModel for "
|
||||
<< pair << ": " << modelType << endl;
|
||||
|
||||
const auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Unknown surfaceTensionModel type "
|
||||
<< surfaceTensionModelType << endl << endl
|
||||
<< "Valid modelType types are : " << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
return cstrIter()(dict, pair, true);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,135 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "MovingPhaseModel.H"
|
||||
|
||||
#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"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasePhaseModel>
|
||||
Foam::MovingPhaseModel<BasePhaseModel>::MovingPhaseModel
|
||||
(
|
||||
const phaseSystem& fluid,
|
||||
const word& phaseName
|
||||
)
|
||||
:
|
||||
BasePhaseModel(fluid, phaseName),
|
||||
U_(fluid.mesh().lookupObject<volVectorField>("U")),
|
||||
phi_(fluid.mesh().lookupObject<surfaceScalarField>("phi")),
|
||||
alphaPhi_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("alphaPhi", phaseModel::name()),
|
||||
fluid.mesh().time().timeName(),
|
||||
fluid.mesh()
|
||||
),
|
||||
fluid.mesh(),
|
||||
dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasePhaseModel>
|
||||
void Foam::MovingPhaseModel<BasePhaseModel>::correct()
|
||||
{
|
||||
BasePhaseModel::correct();
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel>
|
||||
Foam::tmp<Foam::surfaceScalarField>
|
||||
Foam::MovingPhaseModel<BasePhaseModel>::phi() const
|
||||
{
|
||||
return tmp<surfaceScalarField>(phi_);
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel>
|
||||
const Foam::surfaceScalarField&
|
||||
Foam::MovingPhaseModel<BasePhaseModel>::phi()
|
||||
{
|
||||
return phi_;
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel>
|
||||
Foam::tmp<Foam::surfaceScalarField>
|
||||
Foam::MovingPhaseModel<BasePhaseModel>::alphaPhi() const
|
||||
{
|
||||
return tmp<surfaceScalarField>(alphaPhi_);
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel>
|
||||
Foam::surfaceScalarField&
|
||||
Foam::MovingPhaseModel<BasePhaseModel>::alphaPhi()
|
||||
{
|
||||
return alphaPhi_;
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel>
|
||||
Foam::tmp<Foam::volVectorField>
|
||||
Foam::MovingPhaseModel<BasePhaseModel>::U() const
|
||||
{
|
||||
return tmp<volVectorField>(U_);
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel>
|
||||
Foam::tmp<Foam::surfaceScalarField> Foam::MovingPhaseModel<BasePhaseModel>::
|
||||
diffNo() const
|
||||
{
|
||||
return tmp<surfaceScalarField>::New
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("diffNo", phaseModel::name()),
|
||||
U_.mesh().time().timeName(),
|
||||
U_.mesh()
|
||||
),
|
||||
U_.mesh(),
|
||||
dimensionedScalar("0", dimless, 0.0)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,127 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::MovingPhaseModel
|
||||
|
||||
Description
|
||||
Class which represents a moving fluid phase. Holds the velocity, fluxes and
|
||||
turbulence model. Provides access to the turbulent quantities.
|
||||
|
||||
Possible future extensions include separating the turbulent fuctionality
|
||||
into another layer.
|
||||
|
||||
SourceFiles
|
||||
MovingPhaseModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef MovingPhaseModel_H
|
||||
#define MovingPhaseModel_H
|
||||
|
||||
#include "phaseModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class phaseModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class BasePhaseModel>
|
||||
class MovingPhaseModel
|
||||
:
|
||||
public BasePhaseModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to U
|
||||
const volVectorField& U_;
|
||||
|
||||
//- Reference to phi
|
||||
const surfaceScalarField& phi_;
|
||||
|
||||
//- Volumetric flux
|
||||
surfaceScalarField alphaPhi_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
MovingPhaseModel
|
||||
(
|
||||
const phaseSystem& fluid,
|
||||
const word& phaseName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~MovingPhaseModel() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Correct the phase properties other than the thermo and turbulence
|
||||
virtual void correct();
|
||||
|
||||
|
||||
// Momentum
|
||||
|
||||
//- Constant access the volumetric flux
|
||||
virtual tmp<surfaceScalarField> phi() const;
|
||||
|
||||
//- Access the volumetric flux
|
||||
virtual const surfaceScalarField& phi();
|
||||
|
||||
//- Constant access the volumetric flux of the phase
|
||||
virtual tmp<surfaceScalarField> alphaPhi() const;
|
||||
|
||||
//- Access the volumetric flux of the phase
|
||||
virtual surfaceScalarField& alphaPhi();
|
||||
|
||||
//- Access const reference to U
|
||||
virtual tmp<volVectorField> U() const;
|
||||
|
||||
//- Diffusion number
|
||||
virtual tmp<surfaceScalarField> diffNo() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "MovingPhaseModel.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,415 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "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 * * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::
|
||||
MultiComponentPhaseModel
|
||||
(
|
||||
const phaseSystem& fluid,
|
||||
const word& phaseName
|
||||
)
|
||||
:
|
||||
BasePhaseModel(fluid, phaseName),
|
||||
species_(),
|
||||
inertIndex_(-1)
|
||||
{
|
||||
thermoPtr_.set
|
||||
(
|
||||
phaseThermo::New
|
||||
(
|
||||
fluid.mesh(),
|
||||
phaseName,
|
||||
basicThermo::phasePropertyName(basicThermo::dictName, phaseName)
|
||||
).ptr()
|
||||
);
|
||||
|
||||
if (thermoPtr_->composition().species().size() == 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< " The selected thermo is pure. Use a multicomponent thermo."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
species_ = thermoPtr_->composition().species();
|
||||
|
||||
inertIndex_ = species_[thermoPtr_().lookup("inertSpecie")];
|
||||
|
||||
X_.setSize(thermoPtr_->composition().species().size());
|
||||
|
||||
// Initiate X's using Y's to set BC's
|
||||
forAll(species_, i)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * 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
|
||||
{
|
||||
return thermoPtr_();
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
phaseThermo&
|
||||
Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::thermo()
|
||||
{
|
||||
return thermoPtr_();
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
void Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::correct()
|
||||
{
|
||||
return thermo().correct();
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
void Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::solveYi
|
||||
(
|
||||
PtrList<volScalarField::Internal>& Su,
|
||||
PtrList<volScalarField::Internal>& Sp
|
||||
)
|
||||
{
|
||||
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)
|
||||
{
|
||||
const volScalarField& alpha2 = iter2();
|
||||
if (&alpha2 == &alpha1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
phir += phic*this->fluid().nHatf(alpha1, alpha2);
|
||||
}
|
||||
|
||||
// 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];
|
||||
|
||||
if (!phirp.coupled())
|
||||
{
|
||||
phirp == 0;
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
const Foam::PtrList<Foam::volScalarField>&
|
||||
Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::Y() const
|
||||
{
|
||||
return thermoPtr_->composition().Y();
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
Foam::PtrList<Foam::volScalarField>&
|
||||
Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::Y()
|
||||
{
|
||||
return thermoPtr_->composition().Y();
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
Foam::label
|
||||
Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::inertIndex() const
|
||||
{
|
||||
return inertIndex_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,153 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::MultiComponentPhaseModel
|
||||
|
||||
Description
|
||||
Class which represents a phase with multiple species. Returns the species'
|
||||
mass fractions, and their governing equations.
|
||||
|
||||
SourceFiles
|
||||
MultiComponentPhaseModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef MultiComponentPhaseModel_H
|
||||
#define MultiComponentPhaseModel_H
|
||||
|
||||
#include "phaseModel.H"
|
||||
#include "hashedWordList.H"
|
||||
#include "rhoReactionThermo.H"
|
||||
#include "basicThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class phaseModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
class MultiComponentPhaseModel
|
||||
:
|
||||
public BasePhaseModel
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Species table
|
||||
hashedWordList species_;
|
||||
|
||||
//- Inert species index
|
||||
label inertIndex_;
|
||||
|
||||
//- 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:
|
||||
|
||||
// Constructors
|
||||
|
||||
MultiComponentPhaseModel
|
||||
(
|
||||
const phaseSystem& fluid,
|
||||
const word& phaseName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~MultiComponentPhaseModel() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Species table
|
||||
const hashedWordList& species() const
|
||||
{
|
||||
return species_;
|
||||
}
|
||||
|
||||
|
||||
// Thermo
|
||||
|
||||
//- Access to thermo
|
||||
virtual const phaseThermo& thermo() const;
|
||||
|
||||
//- Access non-const thermo
|
||||
virtual phaseThermo& thermo();
|
||||
|
||||
//- 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;
|
||||
|
||||
//- Access the species mass fractions
|
||||
virtual PtrList<volScalarField>& Y();
|
||||
|
||||
//- Return inert species index
|
||||
label inertIndex() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "MultiComponentPhaseModel.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,97 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "PurePhaseModel.H"
|
||||
#include "phaseSystem.H"
|
||||
#include "basicThermo.H"
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::PurePhaseModel
|
||||
(
|
||||
const phaseSystem& fluid,
|
||||
const word& phaseName
|
||||
)
|
||||
:
|
||||
BasePhaseModel(fluid, phaseName)
|
||||
{
|
||||
thermoPtr_.set
|
||||
(
|
||||
phaseThermo::New
|
||||
(
|
||||
fluid.mesh(),
|
||||
phaseName,
|
||||
basicThermo::phasePropertyName(basicThermo::dictName, phaseName)
|
||||
).ptr()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
void Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::solveYi
|
||||
(
|
||||
PtrList<Foam::volScalarField::Internal>&,
|
||||
PtrList<Foam::volScalarField::Internal>&
|
||||
)
|
||||
{
|
||||
NotImplemented;
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
const Foam::PtrList<Foam::volScalarField>&
|
||||
Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::Y() const
|
||||
{
|
||||
return Y_;
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
Foam::PtrList<Foam::volScalarField>&
|
||||
Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::Y()
|
||||
{
|
||||
return Y_;
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
const phaseThermo& Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::
|
||||
thermo() const
|
||||
{
|
||||
return thermoPtr_();
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
phaseThermo& Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::thermo()
|
||||
{
|
||||
return thermoPtr_();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,124 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::PurePhaseModel
|
||||
|
||||
Description
|
||||
Class which represents pure phases, i.e. without any species. Returns an
|
||||
empty list of mass fractions.
|
||||
|
||||
SourceFiles
|
||||
PurePhaseModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef PurePhaseModel_H
|
||||
#define PurePhaseModel_H
|
||||
|
||||
#include "PtrList.H"
|
||||
#include "volFields.H"
|
||||
#include "fvMatricesFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class phaseSystem;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class PurePhaseModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class BasePhaseModel, class phaseThermo>
|
||||
class PurePhaseModel
|
||||
:
|
||||
public BasePhaseModel
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Empty mass fraction field list
|
||||
PtrList<volScalarField> Y_;
|
||||
|
||||
//- Empty thermophysical model Ptr
|
||||
autoPtr<phaseThermo> thermoPtr_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
PurePhaseModel
|
||||
(
|
||||
const phaseSystem& fluid,
|
||||
const word& phaseName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~PurePhaseModel() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Thermo
|
||||
|
||||
//- Return the species mass fractions
|
||||
virtual const PtrList<volScalarField>& Y() const;
|
||||
|
||||
//- Access the species mass fractions
|
||||
virtual PtrList<volScalarField>& Y();
|
||||
|
||||
//- 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();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "PurePhaseModel.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,173 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "StaticPhaseModel.H"
|
||||
|
||||
#include "phaseSystem.H"
|
||||
|
||||
#include "fvcDdt.H"
|
||||
#include "fvcDiv.H"
|
||||
#include "surfaceInterpolate.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasePhaseModel>
|
||||
Foam::StaticPhaseModel<BasePhaseModel>::StaticPhaseModel
|
||||
(
|
||||
const phaseSystem& fluid,
|
||||
const word& phaseName
|
||||
)
|
||||
:
|
||||
BasePhaseModel(fluid, phaseName),
|
||||
U_(fluid.mesh().lookupObject<volVectorField>("U")),
|
||||
phi_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("phi", phaseModel::name()),
|
||||
fluid.mesh().time().timeName(),
|
||||
fluid.mesh()
|
||||
),
|
||||
fluid.mesh(),
|
||||
dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0)
|
||||
),
|
||||
alphaPhi_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("alphaPhi", phaseModel::name()),
|
||||
fluid.mesh().time().timeName(),
|
||||
fluid.mesh()
|
||||
),
|
||||
fluid.mesh(),
|
||||
dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasePhaseModel>
|
||||
void Foam::StaticPhaseModel<BasePhaseModel>::correct()
|
||||
{
|
||||
BasePhaseModel::correct();
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel>
|
||||
Foam::tmp<Foam::surfaceScalarField>
|
||||
Foam::StaticPhaseModel<BasePhaseModel>::phi() const
|
||||
{
|
||||
return tmp<surfaceScalarField>::New
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("phi", phaseModel::name()),
|
||||
U_.mesh().time().timeName(),
|
||||
U_.mesh()
|
||||
),
|
||||
U_.mesh(),
|
||||
dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel>
|
||||
const Foam::surfaceScalarField&
|
||||
Foam::StaticPhaseModel<BasePhaseModel>::phi()
|
||||
{
|
||||
phi_ = dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0);
|
||||
return phi_;
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel>
|
||||
Foam::tmp<Foam::surfaceScalarField>
|
||||
Foam::StaticPhaseModel<BasePhaseModel>::alphaPhi() const
|
||||
{
|
||||
return tmp<surfaceScalarField>
|
||||
(
|
||||
new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("alphaPhi", phaseModel::name()),
|
||||
U_.mesh().time().timeName(),
|
||||
U_.mesh()
|
||||
),
|
||||
U_.mesh(),
|
||||
dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel>
|
||||
Foam::surfaceScalarField&
|
||||
Foam::StaticPhaseModel<BasePhaseModel>::alphaPhi()
|
||||
{
|
||||
alphaPhi_ = dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0);
|
||||
return alphaPhi_;
|
||||
}
|
||||
|
||||
|
||||
template<class BasePhaseModel>
|
||||
Foam::tmp<Foam::volVectorField>
|
||||
Foam::StaticPhaseModel<BasePhaseModel>::U() const
|
||||
{
|
||||
return tmp<volVectorField>
|
||||
(
|
||||
new volVectorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("U", phaseModel::name()),
|
||||
U_.mesh().time().timeName(),
|
||||
U_.mesh()
|
||||
),
|
||||
U_.mesh(),
|
||||
dimensionedVector("zero", dimVelocity, vector::zero)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,123 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::StaticPhaseModel
|
||||
|
||||
Description
|
||||
Class which represents a static fluid phase.
|
||||
|
||||
SourceFiles
|
||||
StaticPhaseModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef StaticPhaseModel_H
|
||||
#define StaticPhaseModel_H
|
||||
|
||||
#include "phaseModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class phaseModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class BasePhaseModel>
|
||||
class StaticPhaseModel
|
||||
:
|
||||
public BasePhaseModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to U
|
||||
const volVectorField& U_;
|
||||
|
||||
//- Flux
|
||||
surfaceScalarField phi_;
|
||||
|
||||
//- Volumetric flux
|
||||
surfaceScalarField alphaPhi_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
StaticPhaseModel
|
||||
(
|
||||
const phaseSystem& fluid,
|
||||
const word& phaseName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~StaticPhaseModel() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Correct the phase properties other than the thermo and turbulence
|
||||
virtual void correct();
|
||||
|
||||
|
||||
// Momentum
|
||||
|
||||
//- Constant access the volumetric flux. Return zero field
|
||||
virtual tmp<surfaceScalarField> phi() const;
|
||||
|
||||
//- Access the volumetric flux
|
||||
virtual const surfaceScalarField& phi();
|
||||
|
||||
//- Constant access the volumetric flux of the phase.
|
||||
virtual tmp<surfaceScalarField> alphaPhi() const;
|
||||
|
||||
//- Access the volumetric flux of the phase
|
||||
virtual surfaceScalarField& alphaPhi();
|
||||
|
||||
//- Access const reference to U
|
||||
virtual tmp<volVectorField> U() const;
|
||||
|
||||
//- Maximum diffusion number
|
||||
virtual tmp<surfaceScalarField> diffNo() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "StaticPhaseModel.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,62 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef makePhaseTypes_H
|
||||
#define makePhaseTypes_H
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define makePhaseTypes(MomemtumType, CompType, Phase, Thermo, Name) \
|
||||
\
|
||||
namespace Foam \
|
||||
{ \
|
||||
typedef Foam::MomemtumType \
|
||||
< \
|
||||
Foam::CompType \
|
||||
< \
|
||||
Foam::Phase, \
|
||||
Foam::Thermo \
|
||||
> \
|
||||
> \
|
||||
Name; \
|
||||
\
|
||||
addNamedToRunTimeSelectionTable \
|
||||
( \
|
||||
phaseModel, \
|
||||
Name, \
|
||||
phaseSystem, \
|
||||
Name \
|
||||
); \
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,286 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "phaseModel.H"
|
||||
#include "phaseSystem.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(phaseModel, 0);
|
||||
defineRunTimeSelectionTable(phaseModel, phaseSystem);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::phaseModel::phaseModel
|
||||
(
|
||||
const phaseSystem& fluid,
|
||||
const word& phaseName
|
||||
)
|
||||
:
|
||||
volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("alpha", phaseName),
|
||||
fluid.mesh().time().timeName(),
|
||||
fluid.mesh(),
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
fluid.mesh(),
|
||||
dimensionedScalar("alpha", dimless, 0)
|
||||
),
|
||||
fluid_(fluid),
|
||||
name_(phaseName)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::word& Foam::phaseModel::name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::phaseSystem& Foam::phaseModel::fluid() const
|
||||
{
|
||||
return fluid_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::phaseModel::correct()
|
||||
{
|
||||
thermo().correct();
|
||||
}
|
||||
|
||||
|
||||
void Foam::phaseModel::correctTurbulence()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseModel::rho() const
|
||||
{
|
||||
return thermo().rho();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::phaseModel::rho(const label patchI) const
|
||||
{
|
||||
return thermo().rho(patchI);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseModel::hc() const
|
||||
{
|
||||
return thermo().hc();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseModel::Cp() const
|
||||
{
|
||||
return thermo().Cp();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::phaseModel::Cp
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return (thermo().Cp(p, T, patchI));
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseModel::Cv() const
|
||||
{
|
||||
return thermo().Cv();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::phaseModel::Cv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return thermo().Cv(p, T, patchI);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseModel::gamma() const
|
||||
{
|
||||
return thermo().gamma();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::phaseModel::gamma
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return thermo().gamma(p, T, patchI);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseModel::Cpv() const
|
||||
{
|
||||
return thermo().Cpv();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::phaseModel::Cpv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return thermo().Cpv(p, T, patchI);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseModel::CpByCpv() const
|
||||
{
|
||||
return thermo().CpByCpv();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::phaseModel::CpByCpv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return thermo().CpByCpv(p, T, patchI);
|
||||
}
|
||||
|
||||
|
||||
const Foam::volScalarField& Foam::phaseModel::alpha() const
|
||||
{
|
||||
return thermo().alpha();
|
||||
}
|
||||
|
||||
|
||||
const Foam::scalarField& Foam::phaseModel::alpha(const label patchI) const
|
||||
{
|
||||
return thermo().alpha(patchI);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseModel::kappa() const
|
||||
{
|
||||
return thermo().kappa();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::phaseModel::kappa(const label patchI) const
|
||||
{
|
||||
return thermo().kappa(patchI);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>Foam::phaseModel::kappaEff
|
||||
(
|
||||
const volScalarField& kappat
|
||||
) const
|
||||
{
|
||||
tmp<volScalarField> kappaEff(kappa() + kappat);
|
||||
kappaEff.ref().rename("kappaEff" + name_);
|
||||
return kappaEff;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::phaseModel::kappaEff
|
||||
(
|
||||
const scalarField& kappat,
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return (kappa(patchI) + kappat);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseModel::alphaEff
|
||||
(
|
||||
const volScalarField& alphat
|
||||
) const
|
||||
{
|
||||
return (thermo().alpha() + alphat);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::phaseModel::alphaEff
|
||||
(
|
||||
const scalarField& alphat,
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
return (thermo().alpha(patchI) + alphat);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseModel::mu() const
|
||||
{
|
||||
return thermo().mu();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::phaseModel::mu(const label patchi) const
|
||||
{
|
||||
return thermo().mu(patchi);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseModel::nu() const
|
||||
{
|
||||
return thermo().nu();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::phaseModel::nu(const label patchi) const
|
||||
{
|
||||
return thermo().nu(patchi);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::phaseModel::read()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,325 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::phaseModel
|
||||
|
||||
Description
|
||||
|
||||
|
||||
SourceFiles
|
||||
phaseModel.C
|
||||
newphaseModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef phaseModel_H
|
||||
#define phaseModel_H
|
||||
|
||||
#include "dictionary.H"
|
||||
#include "dimensionedScalar.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "fvMatricesFwd.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "rhoThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class phaseSystem;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class phaseModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class phaseModel
|
||||
:
|
||||
public volScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to the phaseSystem to which this phase belongs
|
||||
const phaseSystem& fluid_;
|
||||
|
||||
//- Name of phase
|
||||
word name_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
ClassName("phaseModel");
|
||||
|
||||
// Declare runtime construction
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
phaseModel,
|
||||
phaseSystem,
|
||||
(
|
||||
const phaseSystem& fluid,
|
||||
const word& phaseName
|
||||
),
|
||||
(fluid, phaseName)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from phaseSystem and phaseName
|
||||
phaseModel(const phaseSystem& fluid, const word& phaseName);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~phaseModel() = default;
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
static autoPtr<phaseModel> New
|
||||
(
|
||||
const phaseSystem& fluid,
|
||||
const word& phaseName
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the name of this phase
|
||||
const word& name() const;
|
||||
|
||||
//- Return the system to which this phase belongs
|
||||
const phaseSystem& fluid() const;
|
||||
|
||||
//- Correct phase thermo
|
||||
virtual void correct();
|
||||
|
||||
//- Correct the turbulence
|
||||
virtual void correctTurbulence();
|
||||
|
||||
//- Solve species fraction equation
|
||||
virtual void solveYi
|
||||
(
|
||||
PtrList<volScalarField::Internal>& Su,
|
||||
PtrList<volScalarField::Internal>& Sp
|
||||
) = 0;
|
||||
|
||||
//- Read phase properties dictionary
|
||||
virtual bool read();
|
||||
|
||||
|
||||
// Thermo
|
||||
|
||||
//- Access const to phase thermo
|
||||
virtual const rhoThermo& thermo() const = 0;
|
||||
|
||||
//- Access to phase thermo
|
||||
virtual rhoThermo& thermo() = 0;
|
||||
|
||||
//- Return the phase density
|
||||
tmp<volScalarField> rho() const;
|
||||
|
||||
//- Return phase density on a patch
|
||||
tmp<scalarField> rho(const label patchi) const;
|
||||
|
||||
//- Chemical enthalpy for phase [J/kg]
|
||||
tmp<volScalarField> hc() 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;
|
||||
|
||||
//- 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;
|
||||
|
||||
//- 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;
|
||||
|
||||
//- 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 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;
|
||||
|
||||
//- Query each thermo for dpdt
|
||||
Switch dpdt() const
|
||||
{
|
||||
return thermo().dpdt();
|
||||
}
|
||||
|
||||
|
||||
// Transport
|
||||
|
||||
//- Thermal diffusivity for enthalpy of mixture [kg/m/s]
|
||||
const volScalarField& alpha() const;
|
||||
|
||||
//- Thermal diffusivity for enthalpy of mixture for patch [kg/m/s]
|
||||
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;
|
||||
|
||||
//- 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]
|
||||
tmp<scalarField> kappaEff
|
||||
(
|
||||
const scalarField& alphat,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Effective thermal diffusivity of phase [kg/m/s]
|
||||
tmp<volScalarField> alphaEff(const volScalarField& alphat) const;
|
||||
|
||||
//- Effective thermal diffusivity of phase for patch [kg/m/s]
|
||||
tmp<scalarField> alphaEff
|
||||
(
|
||||
const scalarField& alphat,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Return the mixture kinematic viscosity
|
||||
virtual tmp<volScalarField> nu() const;
|
||||
|
||||
//- Return the mixture kinematic viscosity on patchi
|
||||
virtual tmp<scalarField> nu(const label patchi) const;
|
||||
|
||||
//- Return the mixture dymanic viscosity
|
||||
virtual tmp<volScalarField> mu() const;
|
||||
|
||||
//- Return the mixture dymanic viscosity on patchi
|
||||
virtual tmp<scalarField> mu(const label patchi) const;
|
||||
|
||||
//- Diffusion number
|
||||
virtual tmp<surfaceScalarField> diffNo() const = 0;
|
||||
|
||||
|
||||
// Species
|
||||
|
||||
//- Constant access the species mass fractions
|
||||
virtual const PtrList<volScalarField>& Y() const = 0;
|
||||
|
||||
//- Access the species mass fractions
|
||||
virtual PtrList<volScalarField>& Y() = 0;
|
||||
|
||||
|
||||
// Momentum
|
||||
|
||||
//- Constant access the volumetric flux
|
||||
virtual tmp<surfaceScalarField> phi() const = 0;
|
||||
|
||||
//- Access the volumetric flux
|
||||
virtual const surfaceScalarField& phi() = 0;
|
||||
|
||||
//- Constant access the volumetric flux of the phase
|
||||
virtual tmp<surfaceScalarField> alphaPhi() const = 0;
|
||||
|
||||
//- Access the volumetric flux of the phase
|
||||
virtual surfaceScalarField& alphaPhi() = 0;
|
||||
|
||||
//- Access const reference to U
|
||||
virtual tmp<volVectorField> U() const = 0;
|
||||
|
||||
|
||||
// Turbulence (WIP: possible to add turbulence on each phase)
|
||||
|
||||
/*
|
||||
//- 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 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 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;
|
||||
*/
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,58 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "phaseModel.H"
|
||||
#include "phaseSystem.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::New
|
||||
(
|
||||
const phaseSystem& fluid,
|
||||
const word& phaseName
|
||||
)
|
||||
{
|
||||
word modelType(fluid.subDict(phaseName).lookup("type"));
|
||||
|
||||
Info<< "Selecting phaseModel for "
|
||||
<< phaseName << ": " << modelType << endl;
|
||||
|
||||
const auto cstrIter = phaseSystemConstructorTablePtr_->cfind(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown phaseModel type "
|
||||
<< modelType << endl << endl
|
||||
<< "Valid phaseModel types are : " << endl
|
||||
<< phaseSystemConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return cstrIter()(fluid, phaseName);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,76 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "makePhaseTypes.H"
|
||||
|
||||
#include "PurePhaseModel.H"
|
||||
#include "MultiComponentPhaseModel.H"
|
||||
#include "MovingPhaseModel.H"
|
||||
#include "StaticPhaseModel.H"
|
||||
|
||||
#include "rhoThermo.H"
|
||||
#include "solidThermo.H"
|
||||
#include "rhoReactionThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePhaseTypes
|
||||
(
|
||||
MovingPhaseModel,
|
||||
PurePhaseModel,
|
||||
phaseModel,
|
||||
rhoThermo,
|
||||
pureMovingPhaseModel // Name of the phase type
|
||||
);
|
||||
|
||||
makePhaseTypes
|
||||
(
|
||||
StaticPhaseModel,
|
||||
PurePhaseModel,
|
||||
phaseModel,
|
||||
rhoThermo,
|
||||
pureStaticPhaseModel
|
||||
);
|
||||
|
||||
makePhaseTypes
|
||||
(
|
||||
StaticPhaseModel,
|
||||
PurePhaseModel,
|
||||
phaseModel,
|
||||
solidThermo,
|
||||
pureStaticSolidPhaseModel
|
||||
);
|
||||
|
||||
makePhaseTypes
|
||||
(
|
||||
MovingPhaseModel,
|
||||
MultiComponentPhaseModel,
|
||||
phaseModel,
|
||||
rhoReactionThermo,
|
||||
multiComponentMovingPhaseModel
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,62 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "orderedPhasePair.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::orderedPhasePair::orderedPhasePair
|
||||
(
|
||||
const phaseModel& from,
|
||||
const phaseModel& to
|
||||
)
|
||||
:
|
||||
phasePair(from, to, true)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::phaseModel& Foam::orderedPhasePair::from() const
|
||||
{
|
||||
return phase1();
|
||||
}
|
||||
|
||||
|
||||
const Foam::phaseModel& Foam::orderedPhasePair::to() const
|
||||
{
|
||||
return phase2();
|
||||
}
|
||||
|
||||
|
||||
Foam::word Foam::orderedPhasePair::name() const
|
||||
{
|
||||
word namec(second());
|
||||
namec[0] = toupper(namec[0]);
|
||||
return first() + "To" + namec;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,89 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::orderedPhasePair
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
orderedPhasePair.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef orderedPhasePair_H
|
||||
#define orderedPhasePair_H
|
||||
|
||||
#include "phasePair.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class orderedPhasePair Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class orderedPhasePair
|
||||
:
|
||||
public phasePair
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from two phases and gravity
|
||||
orderedPhasePair
|
||||
(
|
||||
const phaseModel& from,
|
||||
const phaseModel& to
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~orderedPhasePair() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Dispersed phase
|
||||
virtual const phaseModel& from() const;
|
||||
|
||||
//- Continuous phase
|
||||
virtual const phaseModel& to() const;
|
||||
|
||||
//- Pair name
|
||||
virtual word name() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,75 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "phasePair.H"
|
||||
#include "surfaceTensionModel.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::phasePair::phasePair
|
||||
(
|
||||
const phaseModel& phase1,
|
||||
const phaseModel& phase2,
|
||||
const bool ordered
|
||||
)
|
||||
:
|
||||
phasePairKey(phase1.name(), phase2.name(), ordered),
|
||||
phase1_(phase1),
|
||||
phase2_(phase2)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::phaseModel& Foam::phasePair::from() const
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Requested from phase from an unordered pair."
|
||||
<< exit(FatalError);
|
||||
|
||||
return phase1_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::phaseModel& Foam::phasePair::to() const
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Requested to phase from an unordered pair."
|
||||
<< exit(FatalError);
|
||||
|
||||
return phase1_;
|
||||
}
|
||||
|
||||
|
||||
Foam::word Foam::phasePair::name() const
|
||||
{
|
||||
word name2(second());
|
||||
name2[0] = toupper(name2[0]);
|
||||
return first() + "And" + name2;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,116 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::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
|
||||
|
||||
SourceFiles
|
||||
phasePair.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef phasePair_H
|
||||
#define phasePair_H
|
||||
|
||||
#include "phaseModel.H"
|
||||
#include "phasePairKey.H"
|
||||
#include "uniformDimensionedFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class phasePair Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class phasePair
|
||||
:
|
||||
public phasePairKey
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Phase 1
|
||||
const phaseModel& phase1_;
|
||||
|
||||
//- Phase 2
|
||||
const phaseModel& phase2_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from two phases
|
||||
phasePair
|
||||
(
|
||||
const phaseModel& phase1,
|
||||
const phaseModel& phase2,
|
||||
const bool ordered = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~phasePair() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- From phase
|
||||
virtual const phaseModel& from() const;
|
||||
|
||||
//- To phase
|
||||
virtual const phaseModel& to() const;
|
||||
|
||||
//- Pair name
|
||||
virtual word name() const;
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
// Phase 1
|
||||
inline const phaseModel& phase1() const;
|
||||
|
||||
// Phase 2
|
||||
inline const phaseModel& phase2() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "phasePairI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,40 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::phaseModel& Foam::phasePair::phase1() const
|
||||
{
|
||||
return phase1_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::phaseModel& Foam::phasePair::phase2() const
|
||||
{
|
||||
return phase2_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,160 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "phasePairKey.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::phasePairKey::hash::hash()
|
||||
{}
|
||||
|
||||
|
||||
Foam::phasePairKey::phasePairKey()
|
||||
{}
|
||||
|
||||
|
||||
Foam::phasePairKey::phasePairKey
|
||||
(
|
||||
const word& name1,
|
||||
const word& name2,
|
||||
const bool ordered
|
||||
)
|
||||
:
|
||||
Pair<word>(name1, name2),
|
||||
ordered_(ordered)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::phasePairKey::ordered() const
|
||||
{
|
||||
return ordered_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::phasePairKey::hash::operator()
|
||||
(
|
||||
const phasePairKey& key
|
||||
) const
|
||||
{
|
||||
if (key.ordered_)
|
||||
{
|
||||
return
|
||||
word::hash()
|
||||
(
|
||||
key.first(),
|
||||
word::hash()(key.second())
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return
|
||||
word::hash()(key.first())
|
||||
+ word::hash()(key.second());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::operator==
|
||||
(
|
||||
const phasePairKey& a,
|
||||
const phasePairKey& b
|
||||
)
|
||||
{
|
||||
const label c = Pair<word>::compare(a,b);
|
||||
|
||||
return
|
||||
(a.ordered_ == b.ordered_)
|
||||
&& (
|
||||
(a.ordered_ && (c == 1))
|
||||
|| (!a.ordered_ && (c != 0))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::operator!=
|
||||
(
|
||||
const phasePairKey& a,
|
||||
const phasePairKey& b
|
||||
)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Istream& Foam::operator>>(Istream& is, phasePairKey& key)
|
||||
{
|
||||
const FixedList<word, 3> temp(is);
|
||||
|
||||
key.first() = temp[0];
|
||||
|
||||
if (temp[1] == "and")
|
||||
{
|
||||
key.ordered_ = false;
|
||||
}
|
||||
else if(temp[1] == "to")
|
||||
{
|
||||
key.ordered_ = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Phase pair type is not recognised. "
|
||||
<< temp
|
||||
<< "Use (phaseDispersed to phaseContinuous) for an ordered"
|
||||
<< "pair, or (phase1 and pase2) for an unordered pair."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
key.second() = temp[2];
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const phasePairKey& key)
|
||||
{
|
||||
os << token::BEGIN_LIST
|
||||
<< key.first()
|
||||
<< token::SPACE
|
||||
<< (key.ordered_ ? "to" : "and")
|
||||
<< token::SPACE
|
||||
<< key.second()
|
||||
<< token::END_LIST;
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,130 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::phasePairKey
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef phasePairKey_H
|
||||
#define phasePairKey_H
|
||||
|
||||
#include "Pair.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class phasePairKey Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class phasePairKey
|
||||
:
|
||||
public Pair<word>
|
||||
{
|
||||
public:
|
||||
|
||||
class hash
|
||||
:
|
||||
public Hash<phasePairKey>
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
hash();
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
//- Generate a hash from a phase pair key
|
||||
label operator()(const phasePairKey& key) const;
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Flag to indicate whether ordering is important
|
||||
bool ordered_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
phasePairKey();
|
||||
|
||||
//- Construct from names and the ordering flag
|
||||
phasePairKey
|
||||
(
|
||||
const word& name1,
|
||||
const word& name2,
|
||||
const bool ordered = false
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
virtual ~phasePairKey() = default;
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the ordered flag
|
||||
bool ordered() const;
|
||||
|
||||
|
||||
// Friend Operators
|
||||
|
||||
//- Test if keys are equal
|
||||
friend bool operator==(const phasePairKey& a, const phasePairKey& b);
|
||||
|
||||
//- Test if keys are unequal
|
||||
friend bool operator!=(const phasePairKey& a, const phasePairKey& b);
|
||||
|
||||
//- Read from stdin
|
||||
friend Istream& operator>>(Istream& is, phasePairKey& key);
|
||||
|
||||
//- Write to stdout
|
||||
friend Ostream& operator<<(Ostream& os, const phasePairKey& key);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,668 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "multiphaseSystem.H"
|
||||
|
||||
#include "fixedValueFvsPatchFields.H"
|
||||
#include "Time.H"
|
||||
#include "subCycle.H"
|
||||
#include "fvcMeshPhi.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 * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(multiphaseSystem, 0);
|
||||
defineRunTimeSelectionTable(multiphaseSystem, dictionary);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::multiphaseSystem::multiphaseSystem
|
||||
(
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
phaseSystem(mesh),
|
||||
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());
|
||||
forAllConstIter(HashTable<autoPtr<phaseModel> >, phaseModels_, iter)
|
||||
{
|
||||
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)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * 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();
|
||||
|
||||
const dictionary& alphaControls = mesh.solverDict("alpha");
|
||||
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
|
||||
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr")));
|
||||
mesh.solverDict("alpha").lookup("cAlphas") >> cAlphas_;
|
||||
|
||||
// Reset ddtAlphaMax
|
||||
ddtAlphaMax_ = dimensionedScalar("zero", dimless, 0.0);
|
||||
|
||||
PtrList<surfaceScalarField> phiAlphaCorrs(phases_.size());
|
||||
|
||||
const surfaceScalarField& phi = this->phi();
|
||||
|
||||
surfaceScalarField phic(mag((phi)/mesh_.magSf()));
|
||||
|
||||
// Do not compress interface at non-coupled boundary faces
|
||||
// (inlets, outlets etc.)
|
||||
surfaceScalarField::Boundary& phicBf = phic.boundaryFieldRef();
|
||||
forAll(phic.boundaryField(), patchi)
|
||||
{
|
||||
fvsPatchScalarField& phicp = phicBf[patchi];
|
||||
|
||||
if (!phicp.coupled())
|
||||
{
|
||||
phicp == 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (int acorr=0; acorr<nAlphaCorr; acorr++)
|
||||
{
|
||||
int phasei = 0;
|
||||
forAllIter(UPtrList<phaseModel>, phases_, iter)
|
||||
{
|
||||
phaseModel& phase1 = iter();
|
||||
const volScalarField& alpha1 = phase1;
|
||||
|
||||
phiAlphaCorrs.set
|
||||
(
|
||||
phasei,
|
||||
new surfaceScalarField
|
||||
(
|
||||
"phi" + alpha1.name() + "Corr",
|
||||
fvc::flux
|
||||
(
|
||||
phi,
|
||||
alpha1,
|
||||
"div(phi," + alpha1.name() + ')'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
surfaceScalarField& phiAlphaCorr = phiAlphaCorrs[phasei];
|
||||
|
||||
forAllIter(UPtrList<phaseModel>, phases_, iter2)
|
||||
{
|
||||
phaseModel& phase2 = iter2();
|
||||
const volScalarField& alpha2 = phase2;
|
||||
|
||||
if (&phase2 == &phase1)
|
||||
{
|
||||
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
|
||||
(
|
||||
"div(phir," + alpha2.name() + ',' + alpha1.name() + ')'
|
||||
);
|
||||
|
||||
phiAlphaCorr += fvc::flux
|
||||
(
|
||||
-fvc::flux(-phir, alpha2, phirScheme),
|
||||
alpha1,
|
||||
phirScheme
|
||||
);
|
||||
}
|
||||
|
||||
// Ensure that the flux at inflow BCs is preserved
|
||||
forAll(phiAlphaCorr.boundaryField(), patchi)
|
||||
{
|
||||
fvsPatchScalarField& phiAlphaCorrp =
|
||||
phiAlphaCorr.boundaryFieldRef()[patchi];
|
||||
|
||||
if (!phiAlphaCorrp.coupled())
|
||||
{
|
||||
const scalarField& phi1p = phi.boundaryField()[patchi];
|
||||
const scalarField& alpha1p =
|
||||
alpha1.boundaryField()[patchi];
|
||||
|
||||
forAll(phiAlphaCorrp, facei)
|
||||
{
|
||||
if (phi1p[facei] < 0)
|
||||
{
|
||||
phiAlphaCorrp[facei] = alpha1p[facei]*phi1p[facei];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
phasei++;
|
||||
}
|
||||
|
||||
// Set Su and Sp tp zero
|
||||
forAllIter(UPtrList<phaseModel>, phases_, iter)
|
||||
{
|
||||
phaseModel& phase = iter();
|
||||
Su_[phase.name()] = dimensionedScalar("Su", dimless/dimTime, 0.0);
|
||||
Sp_[phase.name()] = dimensionedScalar("Sp", dimless/dimTime, 0.0);
|
||||
|
||||
// Add alpha*div(U)
|
||||
const volScalarField& alpha = phase;
|
||||
Su_[phase.name()] +=
|
||||
fvc::div(phi)*min(max(alpha, scalar(0)), scalar(1));
|
||||
}
|
||||
|
||||
|
||||
// Fill Su and Sp
|
||||
calculateSuSp();
|
||||
|
||||
// Limit phiAlphaCorr on each phase
|
||||
phasei = 0;
|
||||
forAllIter(UPtrList<phaseModel>, phases_, iter)
|
||||
{
|
||||
phaseModel& phase = iter();
|
||||
volScalarField& alpha1 = phase;
|
||||
|
||||
surfaceScalarField& phiAlphaCorr = phiAlphaCorrs[phasei];
|
||||
|
||||
volScalarField::Internal& Su = Su_[phase.name()];
|
||||
volScalarField::Internal& Sp = Sp_[phase.name()];
|
||||
|
||||
MULES::limit
|
||||
(
|
||||
1.0/mesh_.time().deltaT().value(),
|
||||
geometricOneField(),
|
||||
alpha1,
|
||||
phi,
|
||||
phiAlphaCorr,
|
||||
Sp,
|
||||
Su,
|
||||
1,
|
||||
0,
|
||||
true
|
||||
);
|
||||
phasei ++;
|
||||
}
|
||||
|
||||
MULES::limitSum(phiAlphaCorrs);
|
||||
|
||||
volScalarField sumAlpha
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"sumAlpha",
|
||||
mesh_.time().timeName(),
|
||||
mesh_
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("sumAlpha", dimless, 0)
|
||||
);
|
||||
|
||||
phasei = 0;
|
||||
forAllIter(UPtrList<phaseModel>, phases_, iter)
|
||||
{
|
||||
phaseModel& phase = iter();
|
||||
volScalarField& alpha1 = phase;
|
||||
|
||||
const volScalarField::Internal& Su = Su_[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);
|
||||
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)
|
||||
{
|
||||
for
|
||||
(
|
||||
subCycle<volScalarField> alphaSubCycle
|
||||
(
|
||||
alpha1,
|
||||
nAlphaSubCycles
|
||||
);
|
||||
!(++alphaSubCycle).end();
|
||||
)
|
||||
{
|
||||
MULES::explicitSolve
|
||||
(
|
||||
geometricOneField(),
|
||||
alpha1,
|
||||
phi,
|
||||
phiAlpha,
|
||||
(alphaSubCycle.index()*Sp)(),
|
||||
(Su - (alphaSubCycle.index() - 1)*Sp*alpha1)(),
|
||||
1,
|
||||
0
|
||||
);
|
||||
|
||||
if (alphaSubCycle.index() == 1)
|
||||
{
|
||||
phase.alphaPhi() = phiAlpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
phase.alphaPhi() += phiAlpha;
|
||||
}
|
||||
}
|
||||
|
||||
phase.alphaPhi() /= nAlphaSubCycles;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
phaseModel& phase = iter();
|
||||
volScalarField& alpha1 = phase;
|
||||
|
||||
MULES::explicitSolve
|
||||
(
|
||||
geometricOneField(),
|
||||
alpha1,
|
||||
phi,
|
||||
phiAlpha,
|
||||
Sp,
|
||||
Su,
|
||||
1,
|
||||
0
|
||||
);
|
||||
|
||||
phase.alphaPhi() = phiAlpha;
|
||||
}
|
||||
|
||||
phasei++;
|
||||
}
|
||||
|
||||
if (acorr == nAlphaCorr - 1)
|
||||
{
|
||||
volScalarField sumAlpha
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"sumAlpha",
|
||||
mesh_.time().timeName(),
|
||||
mesh_
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("sumAlpha", dimless, 0)
|
||||
);
|
||||
|
||||
// Reset rhoPhi
|
||||
rhoPhi_ = dimensionedScalar("rhoPhi", dimMass/dimTime, 0.0);
|
||||
|
||||
forAllIter(UPtrList<phaseModel>, phases_, iter)
|
||||
{
|
||||
phaseModel& phase = iter();
|
||||
volScalarField& alpha1 = phase;
|
||||
sumAlpha += alpha1;
|
||||
|
||||
// Update rhoPhi
|
||||
rhoPhi_ +=
|
||||
fvc::interpolate(phase.rho())*phase.alphaPhi();
|
||||
|
||||
}
|
||||
|
||||
Info<< "Phase-sum volume fraction, min, max = "
|
||||
<< sumAlpha.weightedAverage(mesh_.V()).value()
|
||||
<< ' ' << 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::UPtrList<Foam::phaseModel>& Foam::multiphaseSystem::phases() const
|
||||
{
|
||||
return phases_;
|
||||
}
|
||||
|
||||
|
||||
Foam::UPtrList<Foam::phaseModel>& Foam::multiphaseSystem::phases()
|
||||
{
|
||||
return phases_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::phaseModel& Foam::multiphaseSystem::phase(const label i) const
|
||||
{
|
||||
return phases_[i];
|
||||
}
|
||||
|
||||
|
||||
Foam::phaseModel& Foam::multiphaseSystem::phase(const label i)
|
||||
{
|
||||
return phases_[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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,180 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::multiphaseSystem
|
||||
|
||||
Description
|
||||
Class which solves the volume fraction equations for multiple phases
|
||||
|
||||
SourceFiles
|
||||
multiphaseSystem.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef multiphaseSystem_H
|
||||
#define multiphaseSystem_H
|
||||
|
||||
#include "phaseSystem.H"
|
||||
#include "UPtrList.H"
|
||||
#include "phasePairKey.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class multiphaseSystem Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class multiphaseSystem
|
||||
:
|
||||
public phaseSystem
|
||||
{
|
||||
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_;
|
||||
|
||||
//- 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:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("multiphaseSystem");
|
||||
|
||||
// Declare runtime construction
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
multiphaseSystem,
|
||||
dictionary,
|
||||
(
|
||||
const fvMesh& mesh
|
||||
),
|
||||
(mesh)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from fvMesh
|
||||
multiphaseSystem(const fvMesh&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~multiphaseSystem() = default;
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
static autoPtr<multiphaseSystem> New(const fvMesh& mesh);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Solve for the phase fractions
|
||||
virtual void solve();
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
//- Return phases
|
||||
const UPtrList<phaseModel>& phases() const;
|
||||
|
||||
//- Return phases
|
||||
UPtrList<phaseModel>& phases();
|
||||
|
||||
//- Constant access phase model i
|
||||
const phaseModel& phase(const label i) const;
|
||||
|
||||
//- Access phase model 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();
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,70 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "multiphaseSystem.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::multiphaseSystem> Foam::multiphaseSystem::New
|
||||
(
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
const word multiphaseSystemType
|
||||
(
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
phasePropertiesName,
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
).lookup("type")
|
||||
);
|
||||
|
||||
Info<< "Selecting multiphaseSystem " << multiphaseSystemType << endl;
|
||||
|
||||
const auto cstrIter =
|
||||
dictionaryConstructorTablePtr_->cfind(multiphaseSystemType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown multiphaseSystemType type "
|
||||
<< multiphaseSystemType << endl
|
||||
<< "Valid multiphaseSystem types are : " << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<multiphaseSystem> (cstrIter()(mesh));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,49 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "addToRunTimeSelectionTable.H"
|
||||
|
||||
#include "phaseSystem.H"
|
||||
#include "multiphaseSystem.H"
|
||||
#include "MassTransferPhaseSystem.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef
|
||||
MassTransferPhaseSystem<multiphaseSystem> massTransferMultiphaseSystem;
|
||||
|
||||
addNamedToRunTimeSelectionTable
|
||||
(
|
||||
multiphaseSystem,
|
||||
massTransferMultiphaseSystem,
|
||||
dictionary,
|
||||
massTransferMultiphaseSystem
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,639 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::phaseSystem
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
phaseSystem.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef phaseSystem_H
|
||||
#define phaseSystem_H
|
||||
|
||||
#include "basicThermo.H"
|
||||
|
||||
#include "phaseModel.H"
|
||||
#include "phasePair.H"
|
||||
#include "orderedPhasePair.H"
|
||||
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "fvMatricesFwd.H"
|
||||
#include "compressibleTransportModel.H"
|
||||
#include "localMin.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class surfaceTensionModel;
|
||||
class porousModel;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class phaseSystem Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class phaseSystem
|
||||
:
|
||||
public basicThermo,
|
||||
public compressibleTransportModel
|
||||
{
|
||||
public:
|
||||
|
||||
// Public typedefs
|
||||
|
||||
typedef
|
||||
HashTable
|
||||
<
|
||||
autoPtr<phasePair>, phasePairKey, phasePairKey::hash
|
||||
>
|
||||
phasePairTable;
|
||||
|
||||
|
||||
typedef
|
||||
HashTable<autoPtr<phaseModel>, word, word::hash> phaseModelTable;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected typedefs
|
||||
|
||||
typedef
|
||||
HashTable<dictionary, phasePairKey, phasePairKey::hash> dictTable;
|
||||
|
||||
|
||||
typedef
|
||||
HashTable
|
||||
<
|
||||
autoPtr<surfaceTensionModel>,
|
||||
phasePairKey,
|
||||
phasePairKey::hash
|
||||
>
|
||||
surfaceTensionModelTable;
|
||||
|
||||
|
||||
typedef
|
||||
HashTable
|
||||
<
|
||||
autoPtr<porousModel>,
|
||||
phasePairKey,
|
||||
phasePairKey::hash
|
||||
>
|
||||
interfacePorousModelTable;
|
||||
|
||||
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Reference to the mesh
|
||||
const fvMesh& mesh_;
|
||||
|
||||
//- Phase names
|
||||
wordList phaseNames_;
|
||||
|
||||
//- Mixture total volumetric flux
|
||||
surfaceScalarField phi_;
|
||||
|
||||
//- Mixture total mass flux
|
||||
surfaceScalarField rhoPhi_;
|
||||
|
||||
//- Phase models
|
||||
phaseModelTable phaseModels_;
|
||||
|
||||
//- Phase pairs
|
||||
phasePairTable phasePairs_;
|
||||
|
||||
//- Total ordered phase pairs in the system
|
||||
phasePairTable totalPhasePairs_;
|
||||
|
||||
//- Turbulent Prandt number
|
||||
dimensionedScalar Prt_;
|
||||
|
||||
|
||||
// Sub Models
|
||||
|
||||
//- Surface tension models
|
||||
surfaceTensionModelTable surfaceTensionModels_;
|
||||
|
||||
//- Interface porous models
|
||||
interfacePorousModelTable interfacePorousModelTable_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
|
||||
//- Generate the phases
|
||||
HashTable<autoPtr<phaseModel> > generatePhaseModels
|
||||
(
|
||||
const wordList& names
|
||||
) const;
|
||||
|
||||
//- Generate the mixture flux
|
||||
tmp<surfaceScalarField> generatePhi
|
||||
(
|
||||
const HashTable<autoPtr<phaseModel> >& phaseModels
|
||||
) const;
|
||||
|
||||
//- Generate pairs
|
||||
void generatePairs(const dictTable& modelDicts);
|
||||
|
||||
//- Generate pair table
|
||||
void generatePairsTable();
|
||||
|
||||
//- Generate pairs and sub-model tables using pair keys
|
||||
template<class modelType>
|
||||
void createSubModels
|
||||
(
|
||||
const dictTable& modelDicts,
|
||||
HashTable
|
||||
<
|
||||
autoPtr<modelType>,
|
||||
phasePairKey,
|
||||
phasePairKey::hash
|
||||
>& 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
|
||||
(
|
||||
const word& modelName,
|
||||
HashTable
|
||||
<
|
||||
autoPtr<modelType>,
|
||||
phasePairKey,
|
||||
phasePairKey::hash
|
||||
>& 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
|
||||
(
|
||||
const word& modelName,
|
||||
HashTable
|
||||
<
|
||||
HashTable<autoPtr<modelType> >,
|
||||
phasePairKey,
|
||||
phasePairKey::hash
|
||||
>& models
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("phaseSystem");
|
||||
|
||||
//- Default name of the phase properties dictionary
|
||||
static const word phasePropertiesName;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from fvMesh
|
||||
phaseSystem(const fvMesh& mesh);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~phaseSystem();
|
||||
|
||||
|
||||
// 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;
|
||||
return
|
||||
(
|
||||
const_cast<volScalarField&>
|
||||
(
|
||||
volScalarField::null()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- 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;
|
||||
return
|
||||
(
|
||||
volScalarField::null()
|
||||
);
|
||||
}
|
||||
|
||||
//- Enthalpy/Internal energy
|
||||
// for given pressure and temperature [J/kg]
|
||||
virtual tmp<volScalarField> he
|
||||
(
|
||||
const volScalarField& p,
|
||||
const volScalarField& T
|
||||
) const;
|
||||
|
||||
//- Enthalpy/Internal energy for cell-set [J/kg]
|
||||
virtual tmp<scalarField> he
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const labelList& cells
|
||||
) const;
|
||||
|
||||
//- Enthalpy/Internal energy for patch [J/kg]
|
||||
virtual tmp<scalarField> he
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Chemical enthalpy of the mixture [J/kg]
|
||||
virtual tmp<volScalarField> hc() const;
|
||||
|
||||
//- Temperature from enthalpy/internal energy for cell-set
|
||||
virtual tmp<scalarField> THE
|
||||
(
|
||||
const scalarField& h,
|
||||
const scalarField& p,
|
||||
const scalarField& T0,
|
||||
const labelList& cells
|
||||
) const;
|
||||
|
||||
//- Temperature from enthalpy/internal energy for patch
|
||||
virtual tmp<scalarField> THE
|
||||
(
|
||||
const scalarField& h,
|
||||
const scalarField& p,
|
||||
const scalarField& T0,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
|
||||
// Thermo
|
||||
|
||||
//- Return the mixture density
|
||||
virtual tmp<volScalarField> rho() const;
|
||||
|
||||
//- Return the mixture density on a patch
|
||||
virtual tmp<scalarField> rho(const label patchi) const;
|
||||
|
||||
//- Return Cp of the mixture
|
||||
virtual tmp<volScalarField> Cp() const;
|
||||
|
||||
//- Heat capacity at constant pressure for patch [J/kg/K]
|
||||
virtual tmp<scalarField> Cp
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Return Cv of the mixture
|
||||
virtual tmp<volScalarField> Cv() const;
|
||||
|
||||
//- Heat capacity at constant volume for patch [J/kg/K]
|
||||
virtual tmp<scalarField> Cv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchI
|
||||
) const;
|
||||
|
||||
//- Gamma = Cp/Cv []
|
||||
virtual tmp<volScalarField> gamma() const;
|
||||
|
||||
//- Gamma = Cp/Cv for patch []
|
||||
virtual tmp<scalarField> gamma
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Heat capacity at constant pressure/volume [J/kg/K]
|
||||
virtual tmp<volScalarField> Cpv() const;
|
||||
|
||||
//- Heat capacity at constant pressure/volume for patch [J/kg/K]
|
||||
virtual tmp<scalarField> Cpv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Heat capacity ratio []
|
||||
virtual tmp<volScalarField> CpByCpv() const;
|
||||
|
||||
//- Heat capacity ratio for patch []
|
||||
virtual tmp<scalarField> CpByCpv
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Molecular weight [kg/kmol] of the mixture
|
||||
virtual tmp<volScalarField> W() const;
|
||||
|
||||
|
||||
// Transport
|
||||
|
||||
//- Thermal diffusivity for temperature of mixture [J/m/s/K]
|
||||
virtual tmp<volScalarField> kappa() const;
|
||||
|
||||
//- Thermal diffusivity for temperature
|
||||
// of mixture for patch [J/m/s/K]
|
||||
virtual tmp<scalarField> kappa
|
||||
(
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Effective thermal diffusivity for temperature
|
||||
// of mixture [J/m/s/K]
|
||||
virtual tmp<volScalarField> kappaEff
|
||||
(
|
||||
const volScalarField& kappat
|
||||
) const;
|
||||
|
||||
//- Effective thermal diffusivity for temperature
|
||||
// of mixture for patch [J/m/s/K]
|
||||
virtual tmp<scalarField> kappaEff
|
||||
(
|
||||
const scalarField& alphat,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Effective thermal diffusivity of mixture [kg/m/s]
|
||||
virtual tmp<volScalarField> alphaEff
|
||||
(
|
||||
const volScalarField& alphat
|
||||
) const;
|
||||
|
||||
//- Effective thermal diffusivity of mixture for patch [kg/m/s]
|
||||
virtual tmp<scalarField> alphaEff
|
||||
(
|
||||
const scalarField& alphat,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Return Prandt number
|
||||
const dimensionedScalar& Prt() const;
|
||||
|
||||
|
||||
// Access to transport state variables
|
||||
|
||||
//- 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;
|
||||
|
||||
//- 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;
|
||||
|
||||
|
||||
// Phase fluxes
|
||||
|
||||
//- Constant access to the total flux
|
||||
const surfaceScalarField& phi() const;
|
||||
|
||||
//- Access to the total mixture flux
|
||||
surfaceScalarField& phi();
|
||||
|
||||
//- Constant access to the mixture mass flux
|
||||
const surfaceScalarField& rhoPhi() const;
|
||||
|
||||
//- Access to the total mixture mass flux
|
||||
surfaceScalarField& rhoPhi();
|
||||
|
||||
//- Mixture U
|
||||
tmp<volVectorField> U() const;
|
||||
|
||||
|
||||
// Surface tension
|
||||
|
||||
//- Calculate surface tension of the mixture
|
||||
tmp<surfaceScalarField> surfaceTensionForce() const;
|
||||
|
||||
//- Return the surface tension coefficient
|
||||
virtual tmp<volScalarField> surfaceTensionCoeff
|
||||
(
|
||||
const phasePairKey& key
|
||||
) 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);
|
||||
|
||||
|
||||
// Inter-Phase mass and heat transfe
|
||||
|
||||
//- Return interfacial source mass rate per phase pair
|
||||
virtual tmp<volScalarField> dmdt(const phasePairKey& key) const = 0;
|
||||
|
||||
//- Return the heat transfer matrices
|
||||
virtual tmp<fvScalarMatrix> heatTransfer
|
||||
(
|
||||
const volScalarField& T
|
||||
) = 0;
|
||||
|
||||
//- Calculate mass transfer
|
||||
//virtual void massTransfer(const volScalarField& T) = 0;
|
||||
|
||||
//- Calculate mass transfer for species
|
||||
virtual void massSpeciesTransfer
|
||||
(
|
||||
const phaseModel& phase,
|
||||
volScalarField::Internal& Su,
|
||||
volScalarField::Internal& Sp,
|
||||
const word speciesName
|
||||
) = 0;
|
||||
|
||||
|
||||
// Solve phases and correct models
|
||||
|
||||
//- Solve for the phase transport equations
|
||||
virtual void solve() = 0;
|
||||
|
||||
//- 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
|
||||
virtual bool read();
|
||||
|
||||
|
||||
// Access to phases models
|
||||
|
||||
//- Constant access the total phase pairs
|
||||
const phasePairTable& totalPhasePairs() const;
|
||||
|
||||
//- Non-constant access the total phase pairs
|
||||
phasePairTable& totalPhasePairs();
|
||||
|
||||
//- Constant access the phases
|
||||
const phaseModelTable& phases() const;
|
||||
|
||||
//- Access the phases
|
||||
phaseModelTable& phases();
|
||||
|
||||
//- Access a sub model between a phase pair
|
||||
template <class modelType>
|
||||
const modelType& lookupSubModel(const phasePair& key) const;
|
||||
|
||||
//- Access a sub model between two phases
|
||||
template <class modelType>
|
||||
const modelType& lookupSubModel
|
||||
(
|
||||
const phaseModel& from,
|
||||
const phaseModel& to
|
||||
) const;
|
||||
|
||||
|
||||
// Query phase thermo information
|
||||
|
||||
//- Return true if the equation of state is incompressible for all
|
||||
// phases
|
||||
virtual bool incompressible() const;
|
||||
|
||||
//- Return true if a phase is incompressible
|
||||
virtual bool incompressible(const word) const;
|
||||
|
||||
//- Return true if the equation of state is isochoric for all phasses
|
||||
// i.e. rho = const
|
||||
virtual bool isochoric() const;
|
||||
|
||||
//- Return mesh
|
||||
const fvMesh& mesh() const;
|
||||
|
||||
|
||||
// Help functions for the interfaces
|
||||
|
||||
//- Interface normal surface vector
|
||||
tmp<surfaceVectorField> nHatfv
|
||||
(
|
||||
const volScalarField& alpha1,
|
||||
const volScalarField& alpha2
|
||||
) const;
|
||||
|
||||
|
||||
//- Interface normal volume vector
|
||||
tmp<surfaceScalarField> nHatf
|
||||
(
|
||||
const volScalarField& alpha1,
|
||||
const volScalarField& alpha2
|
||||
) const;
|
||||
|
||||
|
||||
//- Interface curvature
|
||||
tmp<volScalarField> K
|
||||
(
|
||||
const volScalarField& alpha1,
|
||||
const volScalarField& alpha2
|
||||
) const;
|
||||
|
||||
|
||||
//- Near Interface of alpha1 and alpha2
|
||||
tmp<volScalarField> nearInterface
|
||||
(
|
||||
const volScalarField& alpha1,
|
||||
const volScalarField& alpha2
|
||||
) const;
|
||||
|
||||
//- Near Interface of alpha'n
|
||||
tmp<volScalarField> nearInterface() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "phaseSystemTemplates.H"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,199 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class modelType>
|
||||
void Foam::phaseSystem::createSubModels
|
||||
(
|
||||
const dictTable& modelDicts,
|
||||
HashTable
|
||||
<
|
||||
autoPtr<modelType>,
|
||||
phasePairKey,
|
||||
phasePairKey::hash
|
||||
>& models
|
||||
)
|
||||
{
|
||||
forAllConstIter(dictTable, modelDicts, iter)
|
||||
{
|
||||
const phasePairKey& key = iter.key();
|
||||
|
||||
models.insert
|
||||
(
|
||||
key,
|
||||
modelType::New
|
||||
(
|
||||
*iter,
|
||||
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
|
||||
(
|
||||
const word& modelName,
|
||||
HashTable
|
||||
<
|
||||
autoPtr<modelType>,
|
||||
phasePairKey,
|
||||
phasePairKey::hash
|
||||
>& models
|
||||
)
|
||||
{
|
||||
dictTable modelDicts(lookup(modelName));
|
||||
|
||||
generatePairs(modelDicts);
|
||||
|
||||
createSubModels(modelDicts, models);
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
(
|
||||
const word& modelName,
|
||||
HashTable
|
||||
<
|
||||
HashTable<autoPtr<modelType> >,
|
||||
phasePairKey,
|
||||
phasePairKey::hash
|
||||
>& models
|
||||
)
|
||||
{
|
||||
typedef
|
||||
HashTable<autoPtr<modelType>, phasePairKey, phasePairKey::hash>
|
||||
modelTypeTable;
|
||||
|
||||
forAllConstIter(wordList, phaseNames_, phaseNameIter)
|
||||
{
|
||||
modelTypeTable tempModels;
|
||||
generatePairsAndSubModels
|
||||
(
|
||||
IOobject::groupName(modelName, *phaseNameIter),
|
||||
tempModels
|
||||
);
|
||||
|
||||
forAllConstIter(typename modelTypeTable, tempModels, tempModelIter)
|
||||
{
|
||||
const phasePairKey key(tempModelIter.key());
|
||||
|
||||
if (!models.found(key))
|
||||
{
|
||||
models.insert
|
||||
(
|
||||
key,
|
||||
HashTable<autoPtr<modelType> >()
|
||||
);
|
||||
}
|
||||
|
||||
models[tempModelIter.key()].insert
|
||||
(
|
||||
*phaseNameIter,
|
||||
*tempModelIter
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class modelType>
|
||||
const modelType& Foam::phaseSystem::lookupSubModel(const phasePair& key) const
|
||||
{
|
||||
return
|
||||
mesh().lookupObject<modelType>
|
||||
(
|
||||
IOobject::groupName(modelType::typeName, key.name())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template <class modelType>
|
||||
const modelType& Foam::phaseSystem::lookupSubModel
|
||||
(
|
||||
const phaseModel& from,
|
||||
const phaseModel& to
|
||||
) const
|
||||
{
|
||||
return lookupSubModel<modelType>(orderedPhasePair(from, to));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,65 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
Global
|
||||
setDeltaT
|
||||
|
||||
Description
|
||||
Reset the timestep to maintain a constant maximum courant Number.
|
||||
Reduction of time-step is immediate, but increase is damped to avoid
|
||||
unstable oscillations.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
if (adjustTimeStep)
|
||||
{
|
||||
scalar maxDeltaTFact =
|
||||
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);
|
||||
|
||||
runTime.setDeltaT
|
||||
(
|
||||
min
|
||||
(
|
||||
deltaTFact*runTime.deltaTValue(),
|
||||
maxDeltaT
|
||||
)
|
||||
);
|
||||
Info<< "deltaT = " << runTime.deltaTValue() << endl;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,4 +1,5 @@
|
||||
EXE_INC = -I$(OBJECTS_DIR)
|
||||
EXE_INC = \
|
||||
-I$(OBJECTS_DIR)
|
||||
|
||||
LIB_LIBS = \
|
||||
$(FOAM_LIBBIN)/libOSspecific.o \
|
||||
|
||||
@ -104,7 +104,6 @@ Foam::tmp<Foam::Field<Type>> Foam::Function1Types::Constant<Type>::integrate
|
||||
return (x2 - x1)*value_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::Function1Types::Constant<Type>::writeData(Ostream& os) const
|
||||
{
|
||||
|
||||
@ -0,0 +1,63 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "Constant.H"
|
||||
#include "PolynomialEntry.H"
|
||||
#include "Sine.H"
|
||||
#include "Square.H"
|
||||
#include "CSV.H"
|
||||
#include "Table.H"
|
||||
#include "TableFile.H"
|
||||
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define makeFunction1s(Type) \
|
||||
makeFunction1(Type); \
|
||||
makeFunction1Type(Constant, Type); \
|
||||
makeFunction1Type(Polynomial, Type); \
|
||||
makeFunction1Type(Sine, Type); \
|
||||
makeFunction1Type(Square, Type); \
|
||||
makeFunction1Type(CSV, Type); \
|
||||
makeFunction1Type(Table, Type); \
|
||||
makeFunction1Type(TableFile, Type);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makeFunction1(label);
|
||||
//makeFunction1Type(Constant, label);
|
||||
// Polynomial functions and interpolation do evaluate to label
|
||||
// Instead evaluate a scalar and convert to label as appropriate
|
||||
|
||||
makeFunction1s(scalar);
|
||||
makeFunction1s(vector);
|
||||
makeFunction1s(sphericalTensor);
|
||||
makeFunction1s(symmTensor);
|
||||
makeFunction1s(tensor);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -122,6 +122,7 @@ public:
|
||||
virtual Type integrate(const scalar x1, const scalar x2) const;
|
||||
|
||||
|
||||
|
||||
// I/O
|
||||
|
||||
//- Ostream Operator
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -167,6 +167,13 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
|
||||
|
||||
return thermo.kappa(patchi);
|
||||
}
|
||||
else if (mesh.foundObject<basicThermo>("phaseProperties"))
|
||||
{
|
||||
const basicThermo& thermo =
|
||||
mesh.lookupObject<basicThermo>("phaseProperties");
|
||||
|
||||
return thermo.kappa(patchi);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -10,7 +10,8 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude
|
||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -40,6 +40,7 @@ namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(basicThermo, 0);
|
||||
defineRunTimeSelectionTable(basicThermo, fvMesh);
|
||||
defineRunTimeSelectionTable(basicThermo, fvMeshDictPhase);
|
||||
}
|
||||
|
||||
const Foam::word Foam::basicThermo::dictName("thermophysicalProperties");
|
||||
@ -125,10 +126,16 @@ Foam::wordList Foam::basicThermo::heBoundaryTypes()
|
||||
Foam::volScalarField& Foam::basicThermo::lookupOrConstruct
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const char* name
|
||||
) const
|
||||
const word& name,
|
||||
bool& isOwner
|
||||
)
|
||||
{
|
||||
if (!mesh.objectRegistry::foundObject<volScalarField>(name))
|
||||
const volScalarField* p =
|
||||
mesh.objectRegistry::lookupObjectPtr<volScalarField>(name);
|
||||
|
||||
isOwner = !p;
|
||||
|
||||
if (!p)
|
||||
{
|
||||
volScalarField* fPtr
|
||||
(
|
||||
@ -148,12 +155,12 @@ Foam::volScalarField& Foam::basicThermo::lookupOrConstruct
|
||||
|
||||
// Transfer ownership of this object to the objectRegistry
|
||||
fPtr->store(fPtr);
|
||||
return *fPtr;
|
||||
}
|
||||
else
|
||||
{
|
||||
return const_cast<volScalarField&>(*p);
|
||||
}
|
||||
|
||||
return const_cast<volScalarField&>
|
||||
(
|
||||
mesh.objectRegistry::lookupObject<volScalarField>(name)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -186,20 +193,10 @@ Foam::basicThermo::basicThermo
|
||||
|
||||
phaseName_(phaseName),
|
||||
|
||||
p_(lookupOrConstruct(mesh, "p")),
|
||||
p_(lookupOrConstruct(mesh, "p", pOwner_)),
|
||||
|
||||
T_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
phasePropertyName("T"),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
),
|
||||
T_(lookupOrConstruct(mesh, phasePropertyName("T"), TOwner_)),
|
||||
TOwner_(lookupOrDefault<Switch>("updateT", TOwner_)),
|
||||
|
||||
alpha_
|
||||
(
|
||||
@ -246,20 +243,10 @@ Foam::basicThermo::basicThermo
|
||||
|
||||
phaseName_(phaseName),
|
||||
|
||||
p_(lookupOrConstruct(mesh, "p")),
|
||||
p_(lookupOrConstruct(mesh, "p", pOwner_)),
|
||||
|
||||
T_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
phasePropertyName("T"),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
),
|
||||
T_(lookupOrConstruct(mesh, phasePropertyName("T"), TOwner_)),
|
||||
TOwner_(lookupOrDefault<Switch>("updateT", TOwner_)),
|
||||
|
||||
alpha_
|
||||
(
|
||||
@ -268,6 +255,53 @@ Foam::basicThermo::basicThermo
|
||||
phasePropertyName("thermo:alpha"),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar
|
||||
(
|
||||
"zero",
|
||||
dimensionSet(1, -1, -1, 0, 0),
|
||||
Zero
|
||||
)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
Foam::basicThermo::basicThermo
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& phaseName,
|
||||
const word& dictionaryName
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
dictionaryName,
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
|
||||
phaseName_(phaseName),
|
||||
|
||||
p_(lookupOrConstruct(mesh, "p", pOwner_)),
|
||||
|
||||
T_(lookupOrConstruct(mesh, "T", TOwner_)),
|
||||
TOwner_(lookupOrDefault<Switch>("updateT", TOwner_)),
|
||||
|
||||
alpha_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"thermo:alpha",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
@ -278,8 +312,21 @@ Foam::basicThermo::basicThermo
|
||||
dimensionSet(1, -1, -1, 0, 0),
|
||||
Zero
|
||||
)
|
||||
)
|
||||
{}
|
||||
),
|
||||
|
||||
dpdt_(lookupOrDefault<Switch>("dpdt", true))
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Constructed shared thermo : mesh:" << mesh.name()
|
||||
<< " phase:" << phaseName
|
||||
<< " dictionary:" << dictionaryName
|
||||
<< " T:" << T_.name()
|
||||
<< " updateT:" << TOwner_
|
||||
<< " alphaName:" << alpha_.name()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -27,6 +27,14 @@ Class
|
||||
Description
|
||||
Abstract base-class for fluid and solid thermodynamic properties
|
||||
|
||||
An important concept is that the thermo can share an existing T
|
||||
(similar to p) in which case it will not try to update it. This gets
|
||||
triggered purely on construction order - the first one to register
|
||||
T is repsonsible for updating it. Note that the mechanism also means
|
||||
that if multiple thermos are running on the same mesh, only the first one
|
||||
will update the temperature. The behaviour can be overridden using the
|
||||
'updateT' dictionary entry.
|
||||
|
||||
SourceFiles
|
||||
basicThermo.C
|
||||
|
||||
@ -68,8 +76,12 @@ protected:
|
||||
//- Pressure [Pa]
|
||||
volScalarField& p_;
|
||||
|
||||
bool pOwner_;
|
||||
|
||||
//- Temperature [K]
|
||||
volScalarField T_;
|
||||
volScalarField& T_;
|
||||
|
||||
bool TOwner_;
|
||||
|
||||
//- Laminar thermal diffusivity [kg/m/s]
|
||||
volScalarField alpha_;
|
||||
@ -84,11 +96,12 @@ protected:
|
||||
basicThermo(const basicThermo&);
|
||||
|
||||
//- Look up or construct field
|
||||
volScalarField& lookupOrConstruct
|
||||
static volScalarField& lookupOrConstruct
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const char* name
|
||||
) const;
|
||||
const word&,
|
||||
bool& isOwner
|
||||
);
|
||||
|
||||
//- Lookup and check out field
|
||||
void lookupAndCheckout(const char* name) const;
|
||||
@ -119,6 +132,17 @@ public:
|
||||
);
|
||||
|
||||
|
||||
//- Declare run-time constructor selection table for dictionary based
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
basicThermo,
|
||||
fvMeshDictPhase,
|
||||
(const fvMesh& mesh, const word& phaseName, const word& dictName),
|
||||
(mesh, phaseName, dictName)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh and phase name
|
||||
@ -136,6 +160,15 @@ public:
|
||||
const word& phaseName
|
||||
);
|
||||
|
||||
//- Construct from mesh, phase name and explicit naming of the
|
||||
// dictionary (so it can be shared amongst phases).
|
||||
basicThermo
|
||||
(
|
||||
const fvMesh&,
|
||||
const word& phaseName,
|
||||
const word& dictionaryName
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
@ -175,6 +208,15 @@ public:
|
||||
const word& phaseName=word::null
|
||||
);
|
||||
|
||||
//- Generic New for each of the related thermodynamics packages
|
||||
template<class Thermo>
|
||||
static autoPtr<Thermo> New
|
||||
(
|
||||
const fvMesh&,
|
||||
const word& phaseName,
|
||||
const word& dictName
|
||||
);
|
||||
|
||||
//- Specialisation of the Generic New for basicThermo
|
||||
static autoPtr<basicThermo> New
|
||||
(
|
||||
@ -272,6 +314,12 @@ public:
|
||||
return dpdt_;
|
||||
}
|
||||
|
||||
//- Should T be updated
|
||||
Switch updateT() const
|
||||
{
|
||||
return TOwner_;
|
||||
}
|
||||
|
||||
|
||||
// Access to thermodynamic state variables
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -247,4 +247,37 @@ Foam::autoPtr<Thermo> Foam::basicThermo::New
|
||||
}
|
||||
|
||||
|
||||
template<class Thermo>
|
||||
Foam::autoPtr<Thermo> Foam::basicThermo::New
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& phaseName,
|
||||
const word& dictName
|
||||
)
|
||||
{
|
||||
IOdictionary thermoDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
dictName,
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
typename Thermo::fvMeshDictPhaseConstructorTable::iterator cstrIter =
|
||||
lookupThermo<Thermo, typename Thermo::fvMeshDictPhaseConstructorTable>
|
||||
(
|
||||
thermoDict,
|
||||
Thermo::fvMeshDictPhaseConstructorTablePtr_
|
||||
);
|
||||
|
||||
return autoPtr<Thermo>(cstrIter()(mesh, phaseName, dictName));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,6 +31,7 @@ namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(fluidThermo, 0);
|
||||
defineRunTimeSelectionTable(fluidThermo, fvMesh);
|
||||
defineRunTimeSelectionTable(fluidThermo, fvMeshDictPhase);
|
||||
}
|
||||
|
||||
|
||||
@ -54,6 +55,17 @@ Foam::fluidThermo::fluidThermo
|
||||
{}
|
||||
|
||||
|
||||
Foam::fluidThermo::fluidThermo
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& phaseName,
|
||||
const word& dictionaryName
|
||||
)
|
||||
:
|
||||
basicThermo(mesh, phaseName, dictionaryName)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::fluidThermo> Foam::fluidThermo::New
|
||||
@ -66,6 +78,17 @@ Foam::autoPtr<Foam::fluidThermo> Foam::fluidThermo::New
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::fluidThermo> Foam::fluidThermo::New
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& phaseName,
|
||||
const word& dictName
|
||||
)
|
||||
{
|
||||
return basicThermo::New<fluidThermo>(mesh, phaseName, dictName);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fluidThermo::~fluidThermo()
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -69,6 +69,17 @@ public:
|
||||
(mesh, phaseName)
|
||||
);
|
||||
|
||||
|
||||
//- Declare run-time constructor selection table for dictionary based
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
fluidThermo,
|
||||
fvMeshDictPhase,
|
||||
(const fvMesh& mesh, const word& phaseName, const word& dictName),
|
||||
(mesh, phaseName, dictName)
|
||||
);
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh and phase name
|
||||
@ -87,6 +98,15 @@ public:
|
||||
);
|
||||
|
||||
|
||||
//- Construct from mesh,dictionary,phase name with a single temperature
|
||||
fluidThermo
|
||||
(
|
||||
const fvMesh&,
|
||||
const word& phaseName,
|
||||
const word& dictionaryName
|
||||
);
|
||||
|
||||
|
||||
//- Selector
|
||||
static autoPtr<fluidThermo> New
|
||||
(
|
||||
@ -95,6 +115,15 @@ public:
|
||||
);
|
||||
|
||||
|
||||
//- Selector
|
||||
static autoPtr<fluidThermo> New
|
||||
(
|
||||
const fvMesh&,
|
||||
const word& phaseName,
|
||||
const word& dictName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~fluidThermo();
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user