mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -0,0 +1,3 @@
|
||||
buoyantBaffleSimpleFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/buoyantBaffleSimpleFoam
|
||||
@ -0,0 +1,19 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/cfdTools \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
||||
-I$(LIB_SRC)/regionModels/thermoBaffleModels/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lmeshTools \
|
||||
-lbasicThermophysicalModels \
|
||||
-lspecie \
|
||||
-lcompressibleTurbulenceModel \
|
||||
-lcompressibleRASModels \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lthermoBaffleModels
|
||||
@ -0,0 +1,25 @@
|
||||
// Solve the Momentum equation
|
||||
|
||||
tmp<fvVectorMatrix> UEqn
|
||||
(
|
||||
fvm::div(phi, U)
|
||||
+ turbulence->divDevRhoReff(U)
|
||||
);
|
||||
|
||||
UEqn().relax();
|
||||
|
||||
if (simple.momentumPredictor())
|
||||
{
|
||||
solve
|
||||
(
|
||||
UEqn()
|
||||
==
|
||||
fvc::reconstruct
|
||||
(
|
||||
(
|
||||
- ghf*fvc::snGrad(rho)
|
||||
- fvc::snGrad(p_rgh)
|
||||
)*mesh.magSf()
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2011 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
|
||||
buoyantBaffleSimpleFoam
|
||||
|
||||
Description
|
||||
Steady-state solver for buoyant, turbulent flow of compressible fluids
|
||||
using thermal baffles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "basicPsiThermo.H"
|
||||
#include "RASModel.H"
|
||||
#include "fixedGradientFvPatchFields.H"
|
||||
#include "simpleControl.H"
|
||||
#include "thermoBaffleModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
#include "readGravitationalAcceleration.H"
|
||||
#include "createFields.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
simpleControl simple(mesh);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (simple.loop())
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
p_rgh.storePrevIter();
|
||||
rho.storePrevIter();
|
||||
|
||||
// Pressure-velocity SIMPLE corrector
|
||||
{
|
||||
#include "UEqn.H"
|
||||
#include "hEqn.H"
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,94 @@
|
||||
Info<< "Reading thermophysical properties\n" << endl;
|
||||
|
||||
autoPtr<basicPsiThermo> pThermo
|
||||
(
|
||||
basicPsiThermo::New(mesh)
|
||||
);
|
||||
basicPsiThermo& thermo = pThermo();
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
thermo.rho()
|
||||
);
|
||||
|
||||
volScalarField& p = thermo.p();
|
||||
volScalarField& h = thermo.h();
|
||||
const volScalarField& psi = thermo.psi();
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
#include "compressibleCreatePhi.H"
|
||||
|
||||
Info<< "Creating turbulence model\n" << endl;
|
||||
autoPtr<compressible::RASModel> turbulence
|
||||
(
|
||||
compressible::RASModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
phi,
|
||||
thermo
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Info<< "Calculating field g.h\n" << endl;
|
||||
volScalarField gh("gh", g & mesh.C());
|
||||
surfaceScalarField ghf("ghf", g & mesh.Cf());
|
||||
|
||||
Info<< "Reading field p_rgh\n" << endl;
|
||||
volScalarField p_rgh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p_rgh",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
// Force p_rgh to be consistent with p
|
||||
p_rgh = p - rho*gh;
|
||||
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell
|
||||
(
|
||||
p,
|
||||
p_rgh,
|
||||
mesh.solutionDict().subDict("SIMPLE"),
|
||||
pRefCell,
|
||||
pRefValue
|
||||
);
|
||||
|
||||
autoPtr<regionModels::thermoBaffleModels::thermoBaffleModel> baffles
|
||||
(
|
||||
regionModels::thermoBaffleModels::thermoBaffleModel::New(mesh)
|
||||
);
|
||||
|
||||
dimensionedScalar initialMass = fvc::domainIntegrate(rho);
|
||||
dimensionedScalar totalVolume = sum(mesh.V());
|
||||
@ -0,0 +1,17 @@
|
||||
{
|
||||
fvScalarMatrix hEqn
|
||||
(
|
||||
fvm::div(phi, h)
|
||||
- fvm::Sp(fvc::div(phi), h)
|
||||
- fvm::laplacian(turbulence->alphaEff(), h)
|
||||
==
|
||||
fvc::div(phi/fvc::interpolate(rho)*fvc::interpolate(p))
|
||||
- p*fvc::div(phi/fvc::interpolate(rho))
|
||||
);
|
||||
|
||||
hEqn.relax();
|
||||
hEqn.solve();
|
||||
|
||||
baffles->evolve();
|
||||
thermo.correct();
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
{
|
||||
rho = thermo.rho();
|
||||
rho.relax();
|
||||
|
||||
volScalarField rAU(1.0/UEqn().A());
|
||||
surfaceScalarField rhorAUf("(rho*(1|A(U)))", fvc::interpolate(rho*rAU));
|
||||
|
||||
U = rAU*UEqn().H();
|
||||
UEqn.clear();
|
||||
|
||||
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
|
||||
bool closedVolume = adjustPhi(phi, U, p_rgh);
|
||||
|
||||
surfaceScalarField buoyancyPhi(rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf());
|
||||
phi -= buoyancyPhi;
|
||||
|
||||
for (int nonOrth=0; nonOrth<=simple.nNonOrthCorr(); nonOrth++)
|
||||
{
|
||||
fvScalarMatrix p_rghEqn
|
||||
(
|
||||
fvm::laplacian(rhorAUf, p_rgh) == fvc::div(phi)
|
||||
);
|
||||
|
||||
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||
p_rghEqn.solve();
|
||||
|
||||
if (nonOrth == simple.nNonOrthCorr())
|
||||
{
|
||||
// Calculate the conservative fluxes
|
||||
phi -= p_rghEqn.flux();
|
||||
|
||||
// Explicitly relax pressure for momentum corrector
|
||||
p_rgh.relax();
|
||||
|
||||
// Correct the momentum source with the pressure gradient flux
|
||||
// calculated from the relaxed pressure
|
||||
U -= rAU*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rhorAUf);
|
||||
U.correctBoundaryConditions();
|
||||
}
|
||||
}
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
p = p_rgh + rho*gh;
|
||||
|
||||
// For closed-volume cases adjust the pressure level
|
||||
// to obey overall mass continuity
|
||||
if (closedVolume)
|
||||
{
|
||||
p += (initialMass - fvc::domainIntegrate(psi*p))
|
||||
/fvc::domainIntegrate(psi);
|
||||
p_rgh = p - rho*gh;
|
||||
}
|
||||
|
||||
rho = thermo.rho();
|
||||
rho.relax();
|
||||
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value()
|
||||
<< endl;
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
reactingParcelFilmPyrolysisFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/reactingParcelFilmPyrolysisFoam
|
||||
@ -0,0 +1,51 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I${LIB_SRC}/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
||||
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solid/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solidChemistryModel/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/combustionModels/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
||||
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
|
||||
-I$(LIB_SRC)/regionModels/pyrolysisModels/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
||||
-I$(LIB_SRC)/ODE/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lcompressibleRASModels \
|
||||
-lcompressibleLESModels \
|
||||
-lspecie \
|
||||
-lbasicThermophysicalModels \
|
||||
-lsolidProperties \
|
||||
-lsolidMixtureProperties \
|
||||
-lthermophysicalFunctions \
|
||||
-lreactionThermophysicalModels \
|
||||
-lSLGThermo \
|
||||
-lchemistryModel \
|
||||
-lsolidChemistryModel \
|
||||
-lcombustionModels \
|
||||
-lregionModels \
|
||||
-lradiationModels \
|
||||
-lsurfaceFilmModels \
|
||||
-lpyrolysisModels \
|
||||
-llagrangianIntermediate \
|
||||
-lODE \
|
||||
-lsampling
|
||||
@ -0,0 +1,26 @@
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(rho, U)
|
||||
+ fvm::div(phi, U)
|
||||
+ turbulence->divDevRhoReff(U)
|
||||
==
|
||||
parcels.SU(U)
|
||||
);
|
||||
|
||||
UEqn.relax();
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve
|
||||
(
|
||||
UEqn
|
||||
==
|
||||
fvc::reconstruct
|
||||
(
|
||||
(
|
||||
- ghf*fvc::snGrad(rho)
|
||||
- fvc::snGrad(p_rgh)
|
||||
)*mesh.magSf()
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
tmp<fv::convectionScheme<scalar> > mvConvection
|
||||
(
|
||||
fv::convectionScheme<scalar>::New
|
||||
(
|
||||
mesh,
|
||||
fields,
|
||||
phi,
|
||||
mesh.divScheme("div(phi,Yi_hs)")
|
||||
)
|
||||
);
|
||||
{
|
||||
combustion->correct();
|
||||
dQ = combustion->dQ();
|
||||
label inertIndex = -1;
|
||||
volScalarField Yt = 0.0*Y[0];
|
||||
|
||||
forAll(Y, i)
|
||||
{
|
||||
if (Y[i].name() != inertSpecie)
|
||||
{
|
||||
volScalarField& Yi = Y[i];
|
||||
fvScalarMatrix R = combustion->R(Yi);
|
||||
|
||||
solve
|
||||
(
|
||||
fvm::ddt(rho, Yi)
|
||||
+ mvConvection->fvmDiv(phi, Yi)
|
||||
- fvm::laplacian(turbulence->alphaEff(), Yi)
|
||||
==
|
||||
parcels.SYi(i, Yi)
|
||||
+ surfaceFilm.Srho(i)
|
||||
+ R,
|
||||
mesh.solver("Yi")
|
||||
);
|
||||
|
||||
Yi.max(0.0);
|
||||
Yt += Yi;
|
||||
}
|
||||
else
|
||||
{
|
||||
inertIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
Y[inertIndex] = scalar(1) - Yt;
|
||||
Y[inertIndex].max(0.0);
|
||||
|
||||
fvScalarMatrix hsEqn
|
||||
(
|
||||
fvm::ddt(rho, hs)
|
||||
+ mvConvection->fvmDiv(phi, hs)
|
||||
- fvm::laplacian(turbulence->alphaEff(), hs)
|
||||
==
|
||||
DpDt
|
||||
+ dQ
|
||||
+ radiation->Shs(thermo)
|
||||
+ parcels.Sh(hs)
|
||||
+ surfaceFilm.Sh()
|
||||
);
|
||||
|
||||
hsEqn.relax();
|
||||
hsEqn.solve();
|
||||
|
||||
thermo.correct();
|
||||
|
||||
radiation->correct();
|
||||
|
||||
Info<< "min/max(T) = " << min(T).value() << ", " << max(T).value() << endl;
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
Info<< "\nConstructing reacting cloud" << endl;
|
||||
basicReactingCloud parcels
|
||||
(
|
||||
"reactingCloud1",
|
||||
rho,
|
||||
U,
|
||||
g,
|
||||
slgThermo
|
||||
);
|
||||
@ -0,0 +1,154 @@
|
||||
Info<< "Reading thermophysical properties\n" << endl;
|
||||
|
||||
autoPtr<hsCombustionThermo> pThermo
|
||||
(
|
||||
hsCombustionThermo::New(mesh)
|
||||
);
|
||||
hsCombustionThermo& thermo = pThermo();
|
||||
|
||||
SLGThermo slgThermo(mesh, thermo);
|
||||
|
||||
basicMultiComponentMixture& composition = thermo.composition();
|
||||
PtrList<volScalarField>& Y = composition.Y();
|
||||
|
||||
const word inertSpecie(thermo.lookup("inertSpecie"));
|
||||
|
||||
Info<< "Creating field rho\n" << endl;
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
thermo.rho()
|
||||
);
|
||||
|
||||
volScalarField& p = thermo.p();
|
||||
volScalarField& hs = thermo.hs();
|
||||
const volScalarField& T = thermo.T();
|
||||
const volScalarField& psi = thermo.psi();
|
||||
|
||||
Info<< "\nReading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
#include "compressibleCreatePhi.H"
|
||||
|
||||
Info<< "Creating turbulence model\n" << endl;
|
||||
autoPtr<compressible::turbulenceModel> turbulence
|
||||
(
|
||||
compressible::turbulenceModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
phi,
|
||||
thermo
|
||||
)
|
||||
);
|
||||
|
||||
IOdictionary combustionProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"combustionProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "Creating combustion model\n" << endl;
|
||||
autoPtr<combustionModel> combustion
|
||||
(
|
||||
combustionModel::combustionModel::New
|
||||
(
|
||||
combustionProperties,
|
||||
thermo,
|
||||
turbulence(),
|
||||
phi,
|
||||
rho
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField dQ
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"dQ",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("dQ", dimMass/pow3(dimTime)/dimLength, 0.0)
|
||||
);
|
||||
|
||||
Info<< "Creating field DpDt\n" << endl;
|
||||
volScalarField DpDt
|
||||
(
|
||||
"DpDt",
|
||||
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p)
|
||||
);
|
||||
|
||||
|
||||
Info<< "Calculating field g.h\n" << endl;
|
||||
volScalarField gh("gh", g & mesh.C());
|
||||
|
||||
surfaceScalarField ghf("gh", g & mesh.Cf());
|
||||
|
||||
volScalarField p_rgh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p_rgh",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
// Force p_rgh to be consistent with p
|
||||
p_rgh = p - rho*gh;
|
||||
|
||||
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
|
||||
|
||||
forAll(Y, i)
|
||||
{
|
||||
fields.add(Y[i]);
|
||||
}
|
||||
fields.add(hs);
|
||||
|
||||
IOdictionary additionalControlsDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"additionalControls",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
Switch solvePrimaryRegion
|
||||
(
|
||||
additionalControlsDict.lookup("solvePrimaryRegion")
|
||||
);
|
||||
@ -0,0 +1,6 @@
|
||||
Info<< "Creating pyrolysis model" << endl;
|
||||
|
||||
autoPtr<regionModels::pyrolysisModels::pyrolysisModel> pyrolysis
|
||||
(
|
||||
regionModels::pyrolysisModels::pyrolysisModel::New(mesh)
|
||||
);
|
||||
@ -0,0 +1,7 @@
|
||||
Info<< "\nConstructing surface film model" << endl;
|
||||
|
||||
typedef regionModels::surfaceFilmModels::surfaceFilmModel filmModelType;
|
||||
|
||||
autoPtr<filmModelType> tsurfaceFilm(filmModelType::New(mesh, g));
|
||||
filmModelType& surfaceFilm = tsurfaceFilm();
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
rho = thermo.rho();
|
||||
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
surfaceScalarField rhorAUf(rAU.name(), fvc::interpolate(rho*rAU));
|
||||
U = rAU*UEqn.H();
|
||||
|
||||
surfaceScalarField phiU
|
||||
(
|
||||
fvc::interpolate(rho)
|
||||
*(
|
||||
(fvc::interpolate(U) & mesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
|
||||
)
|
||||
);
|
||||
|
||||
phi = phiU - rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf();
|
||||
|
||||
for (int nonOrth=0; nonOrth<=pimple.nNonOrthCorr(); nonOrth++)
|
||||
{
|
||||
fvScalarMatrix p_rghEqn
|
||||
(
|
||||
fvc::ddt(psi, rho)*gh
|
||||
+ fvc::div(phi)
|
||||
+ fvm::ddt(psi, p_rgh)
|
||||
- fvm::laplacian(rhorAUf, p_rgh)
|
||||
==
|
||||
parcels.Srho()
|
||||
+ surfaceFilm.Srho()
|
||||
);
|
||||
|
||||
p_rghEqn.solve
|
||||
(
|
||||
mesh.solver(p_rgh.select(pimple.finalInnerIter(corr, nonOrth)))
|
||||
);
|
||||
|
||||
if (nonOrth == pimple.nNonOrthCorr())
|
||||
{
|
||||
phi += p_rghEqn.flux();
|
||||
}
|
||||
}
|
||||
|
||||
p = p_rgh + rho*gh;
|
||||
|
||||
#include "rhoEqn.H"
|
||||
#include "compressibleContinuityErrs.H"
|
||||
|
||||
U += rAU*fvc::reconstruct((phi - phiU)/rhorAUf);
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||
@ -0,0 +1,130 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 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
|
||||
reactingParcelFilmPyrolysisFoam
|
||||
|
||||
Description
|
||||
Transient PISO solver for compressible, laminar or turbulent flow with
|
||||
reacting Lagrangian parcels, surface film and pyrolysis modelling.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "basicReactingCloud.H"
|
||||
#include "surfaceFilmModel.H"
|
||||
#include "pyrolysisModel.H"
|
||||
#include "radiationModel.H"
|
||||
#include "SLGThermo.H"
|
||||
#include "hsCombustionThermo.H"
|
||||
#include "solidChemistryModel.H"
|
||||
#include "combustionModel.H"
|
||||
#include "pimpleControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
#include "readChemistryProperties.H"
|
||||
#include "readGravitationalAcceleration.H"
|
||||
#include "createFields.H"
|
||||
#include "createClouds.H"
|
||||
#include "createRadiationModel.H"
|
||||
#include "createSurfaceFilmModel.H"
|
||||
#include "createPyrolysisModel.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "readTimeControls.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
#include "readPyrolysisTimeControls.H"
|
||||
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "solidRegionDiffusionNo.H"
|
||||
#include "setMultiRegionDeltaT.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
parcels.evolve();
|
||||
|
||||
surfaceFilm.evolve();
|
||||
|
||||
pyrolysis->evolve();
|
||||
|
||||
if (solvePrimaryRegion)
|
||||
{
|
||||
#include "rhoEqn.H"
|
||||
|
||||
// --- PIMPLE loop
|
||||
for (pimple.start(); pimple.loop(); pimple++)
|
||||
{
|
||||
#include "UEqn.H"
|
||||
#include "YhsEqn.H"
|
||||
|
||||
// --- PISO loop
|
||||
for (int corr=1; corr<=pimple.nCorr(); corr++)
|
||||
{
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
if (pimple.turbCorr())
|
||||
{
|
||||
turbulence->correct();
|
||||
}
|
||||
}
|
||||
|
||||
rho = thermo.rho();
|
||||
}
|
||||
else
|
||||
{
|
||||
runTime.write();
|
||||
}
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End" << endl;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,23 @@
|
||||
Info<< "Reading chemistry properties\n" << endl;
|
||||
|
||||
IOdictionary chemistryProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"chemistryProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
Switch turbulentReaction(chemistryProperties.lookup("turbulentReaction"));
|
||||
|
||||
dimensionedScalar Cmix("Cmix", dimless, 1.0);
|
||||
|
||||
if (turbulentReaction)
|
||||
{
|
||||
chemistryProperties.lookup("Cmix") >> Cmix;
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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
|
||||
readPyrolysisTimeControls
|
||||
|
||||
Description
|
||||
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
scalar maxDi = pyrolysis->maxDiff();
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,43 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2011 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
|
||||
rhoEqn
|
||||
|
||||
Description
|
||||
Solve the continuity for density.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
{
|
||||
solve
|
||||
(
|
||||
fvm::ddt(rho)
|
||||
+ fvc::div(phi)
|
||||
==
|
||||
parcels.Srho(rho)
|
||||
+ surfaceFilm.Srho()
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,64 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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
|
||||
setMultiRegionDeltaT
|
||||
|
||||
Description
|
||||
Reset the timestep to maintain a constant maximum Courant numbers.
|
||||
Reduction of time-step is immediate, but increase is damped to avoid
|
||||
unstable oscillations.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
if (adjustTimeStep)
|
||||
{
|
||||
if (CoNum == -GREAT)
|
||||
{
|
||||
CoNum = SMALL;
|
||||
}
|
||||
|
||||
if (DiNum == -GREAT)
|
||||
{
|
||||
DiNum = SMALL;
|
||||
}
|
||||
|
||||
|
||||
const scalar TFactorFluid = maxCo/(CoNum + SMALL);
|
||||
const scalar TFactorSolid = maxDi/(DiNum + SMALL);
|
||||
const scalar TFactorFilm = maxCo/(surfaceFilm.CourantNumber() + SMALL);
|
||||
|
||||
const scalar dt0 = runTime.deltaTValue();
|
||||
|
||||
runTime.setDeltaT
|
||||
(
|
||||
min
|
||||
(
|
||||
dt0*min(min(TFactorFluid, min(TFactorFilm, TFactorSolid)), 1.2),
|
||||
maxDeltaT
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,2 @@
|
||||
scalar DiNum = pyrolysis->solidRegionDiffNo();
|
||||
|
||||
@ -4,10 +4,10 @@ makeType=${1:-libso}
|
||||
set -x
|
||||
|
||||
wmake $makeType regionModel
|
||||
#wmake $makeType pyrolysisModels
|
||||
wmake $makeType pyrolysisModels
|
||||
wmake $makeType surfaceFilmModels
|
||||
wmake $makeType thermoBaffleModels
|
||||
#wmake $makeType regionCoupling
|
||||
wmake $makeType regionCoupling
|
||||
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
15
src/regionModels/pyrolysisModels/Make/files
Normal file
15
src/regionModels/pyrolysisModels/Make/files
Normal file
@ -0,0 +1,15 @@
|
||||
/* derived patches */
|
||||
|
||||
derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.C
|
||||
derivedFvPatchFields/flowRateInletVelocityCoupled/flowRateInletVelocityCoupledFvPatchVectorField.C
|
||||
derivedFvPatchFields/totalFlowRateAdvectiveDiffusiveFvPatchScalarField/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C
|
||||
derivedFvPatchFields/turbulentTemperatureRadiativeCoupledMixed/turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.C
|
||||
|
||||
|
||||
/* Pyrolysis models */
|
||||
pyrolysisModel/pyrolysisModel.C
|
||||
pyrolysisModel/pyrolysisModelNew.C
|
||||
reactingOneDim/reactingOneDim.C
|
||||
noPyrolysis/noPyrolysis.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libpyrolysisModels
|
||||
25
src/regionModels/pyrolysisModels/Make/options
Normal file
25
src/regionModels/pyrolysisModels/Make/options
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solid/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solidChemistryModel/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
|
||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude
|
||||
|
||||
|
||||
EXE_LIBS = \
|
||||
-lregionModels \
|
||||
-lsolidChemistryModel \
|
||||
-lsolidThermo \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lcompressibleLESModels
|
||||
@ -0,0 +1,226 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2006-2011 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 "flowRateInletVelocityCoupledFvPatchVectorField.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "directMappedPatchBase.H"
|
||||
#include "mapDistribute.H"
|
||||
#include "regionProperties.H"
|
||||
#include "basicThermo.H"
|
||||
#include "surfaceFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::flowRateInletVelocityCoupledFvPatchVectorField::
|
||||
flowRateInletVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(p, iF),
|
||||
nbrPhiName_("none"),
|
||||
phiName_("phi"),
|
||||
rhoName_("rho")
|
||||
{}
|
||||
|
||||
|
||||
Foam::flowRateInletVelocityCoupledFvPatchVectorField::
|
||||
flowRateInletVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const flowRateInletVelocityCoupledFvPatchVectorField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
|
||||
nbrPhiName_(ptf.nbrPhiName_),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::flowRateInletVelocityCoupledFvPatchVectorField::
|
||||
flowRateInletVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(p, iF, dict),
|
||||
nbrPhiName_(dict.lookupOrDefault<word>("nbrPhi", "phi")),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
|
||||
{}
|
||||
|
||||
|
||||
Foam::flowRateInletVelocityCoupledFvPatchVectorField::
|
||||
flowRateInletVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const flowRateInletVelocityCoupledFvPatchVectorField& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf),
|
||||
nbrPhiName_(ptf.nbrPhiName_),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::flowRateInletVelocityCoupledFvPatchVectorField::
|
||||
flowRateInletVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const flowRateInletVelocityCoupledFvPatchVectorField& ptf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf, iF),
|
||||
nbrPhiName_(ptf.nbrPhiName_),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::flowRateInletVelocityCoupledFvPatchVectorField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the coupling information from the directMappedPatchBase
|
||||
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
|
||||
(
|
||||
patch().patch()
|
||||
);
|
||||
const polyMesh& nbrMesh = mpp.sampleMesh();
|
||||
const fvPatch& nbrPatch = refCast<const fvMesh>
|
||||
(
|
||||
nbrMesh
|
||||
).boundary()[mpp.samplePolyPatch().index()];
|
||||
|
||||
// Force recalculation of mapping and schedule
|
||||
const mapDistribute& distMap = mpp.map();
|
||||
|
||||
scalarList phi =
|
||||
nbrPatch.lookupPatchField<surfaceScalarField, scalar>(nbrPhiName_);
|
||||
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(), // what to send
|
||||
distMap.constructMap(), // what to receive
|
||||
phi
|
||||
);
|
||||
|
||||
const surfaceScalarField& phiName =
|
||||
db().lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
|
||||
// a simpler way of doing this would be nice
|
||||
//scalar avgU = -flowRate_/gSum(patch().magSf());
|
||||
scalarField U = -phi/patch().magSf();
|
||||
|
||||
vectorField n = patch().nf();
|
||||
|
||||
// const surfaceScalarField& phi =
|
||||
// db().lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
if (phiName.dimensions() == dimVelocity*dimArea)
|
||||
{
|
||||
// volumetric flow-rate
|
||||
operator==(n*U);
|
||||
}
|
||||
else if (phiName.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
||||
// mass flow-rate
|
||||
operator==(n*U/rhop);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
scalar phi = gSum(rhop*(*this) & patch().Sf());
|
||||
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||
<< patch().name() << ':'
|
||||
<< this->dimensionedInternalField().name() << " <- "
|
||||
<< nbrMesh.name() << ':'
|
||||
<< nbrPatch.name() << ':'
|
||||
<< this->dimensionedInternalField().name() << " :"
|
||||
<< " mass flux[Kg/s]:" << -phi
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"flowRateInletVelocityCoupledFvPatchVectorField::updateCoeffs()"
|
||||
) << "dimensions of " << phiName_ << " are incorrect" << nl
|
||||
<< " on patch " << this->patch().name()
|
||||
<< " of field " << this->dimensionedInternalField().name()
|
||||
<< " in file " << this->dimensionedInternalField().objectPath()
|
||||
<< nl << exit(FatalError);
|
||||
}
|
||||
|
||||
fixedValueFvPatchField<vector>::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void Foam::flowRateInletVelocityCoupledFvPatchVectorField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
fvPatchField<vector>::write(os);
|
||||
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
os.writeKeyword("nbrPhi") << nbrPhiName_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchVectorField,
|
||||
flowRateInletVelocityCoupledFvPatchVectorField
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,181 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2006-2011 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::flowRateInletVelocityCoupledFvPatchVectorField
|
||||
|
||||
Description
|
||||
Describes a volumetric/mass flow normal vector boundary condition by its
|
||||
magnitude as an integral over its area.
|
||||
|
||||
The inlet mass flux is taken from the neighbor region.
|
||||
|
||||
phi is used to determine if the flow is compressible or incompressible.
|
||||
|
||||
The basis of the patch (volumetric or mass) is determined by the
|
||||
dimensions of the flux, phi.
|
||||
The current density is used to correct the velocity when applying the
|
||||
mass basis.
|
||||
|
||||
Example of the boundary condition specification:
|
||||
@verbatim
|
||||
inlet
|
||||
{
|
||||
type flowRateInletVelocityCoupled;
|
||||
phi phi;
|
||||
rho rho;
|
||||
neigPhi neigPhiName_; // Volumetric/mass flow rate
|
||||
// [m3/s or kg/s]
|
||||
value uniform (0 0 0); // placeholder
|
||||
}
|
||||
@endverbatim
|
||||
|
||||
Note
|
||||
- The value is positive inwards
|
||||
- May not work correctly for transonic inlets
|
||||
- Strange behaviour with potentialFoam since the U equation is not solved
|
||||
|
||||
SourceFiles
|
||||
flowRateInletVelocityCoupledFvPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef flowRateInletVelocityCoupledFvPatchVectorField_H
|
||||
#define flowRateInletVelocityCoupledFvPatchVectorField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class flowRateInletVelocityFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class flowRateInletVelocityCoupledFvPatchVectorField
|
||||
:
|
||||
public fixedValueFvPatchVectorField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of the neighbor flux setting the inlet mass flux
|
||||
word nbrPhiName_;
|
||||
|
||||
//- Name of the local mass flux
|
||||
word phiName_;
|
||||
|
||||
//- Name of the density field used to normalize the mass flux
|
||||
word rhoName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("flowRateInletVelocityCoupled");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
flowRateInletVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
flowRateInletVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// flowRateInletVelocityCoupledFvPatchVectorField
|
||||
// onto a new patch
|
||||
flowRateInletVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const flowRateInletVelocityCoupledFvPatchVectorField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
flowRateInletVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const flowRateInletVelocityCoupledFvPatchVectorField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchVectorField> clone() const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new flowRateInletVelocityCoupledFvPatchVectorField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
flowRateInletVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const flowRateInletVelocityCoupledFvPatchVectorField&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchVectorField> clone
|
||||
(
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new flowRateInletVelocityCoupledFvPatchVectorField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,211 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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 "totalFlowRateAdvectiveDiffusiveFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "IOobjectList.H"
|
||||
#include "LESModel.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::
|
||||
totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<scalar>(p, iF),
|
||||
phiName_("phi"),
|
||||
rhoName_("none")
|
||||
{
|
||||
refValue() = 0.0;
|
||||
refGrad() = 0.0;
|
||||
valueFraction() = 0.0;
|
||||
}
|
||||
|
||||
|
||||
Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::
|
||||
totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<scalar>(p, iF),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "none"))
|
||||
{
|
||||
|
||||
refValue() = 1.0;
|
||||
refGrad() = 0.0;
|
||||
valueFraction() = 0.0;
|
||||
|
||||
if (dict.found("value"))
|
||||
{
|
||||
fvPatchField<scalar>::operator=
|
||||
(
|
||||
Field<scalar>("value", dict, p.size())
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
fvPatchField<scalar>::operator=(refValue());
|
||||
}
|
||||
}
|
||||
|
||||
Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::
|
||||
totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
(
|
||||
const totalFlowRateAdvectiveDiffusiveFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::
|
||||
totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
(
|
||||
const totalFlowRateAdvectiveDiffusiveFvPatchScalarField& tppsf
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<scalar>(tppsf),
|
||||
phiName_(tppsf.phiName_),
|
||||
rhoName_(tppsf.rhoName_)
|
||||
{}
|
||||
|
||||
Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::
|
||||
totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
(
|
||||
const totalFlowRateAdvectiveDiffusiveFvPatchScalarField& tppsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<scalar>(tppsf, iF),
|
||||
phiName_(tppsf.phiName_),
|
||||
rhoName_(tppsf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
scalarField::autoMap(m);
|
||||
}
|
||||
|
||||
|
||||
void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::rmap
|
||||
(
|
||||
const fvPatchScalarField& ptf,
|
||||
const labelList& addr
|
||||
)
|
||||
{
|
||||
mixedFvPatchField<scalar>::rmap(ptf, addr);
|
||||
}
|
||||
|
||||
void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
|
||||
if (this->updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const label patchI = patch().index();
|
||||
|
||||
const compressible::LESModel& turbulence =
|
||||
db().lookupObject<compressible::LESModel>
|
||||
(
|
||||
"LESProperties"
|
||||
);
|
||||
|
||||
const fvsPatchField<scalar>& phip =
|
||||
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
|
||||
|
||||
const scalarField alphap = turbulence.alphaEff()().boundaryField()[patchI];
|
||||
|
||||
refValue() = 1.0;
|
||||
refGrad() = 0.0;
|
||||
|
||||
valueFraction() =
|
||||
1.0
|
||||
/
|
||||
(
|
||||
1.0 +
|
||||
alphap*patch().deltaCoeffs()*patch().magSf()/max(mag(phip), SMALL)
|
||||
);
|
||||
|
||||
mixedFvPatchField<scalar>::updateCoeffs();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
scalar phi = gSum(-phip*(*this));// + alphap*snGrad());
|
||||
|
||||
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||
<< patch().name() << ':'
|
||||
<< this->dimensionedInternalField().name() << " :"
|
||||
<< " mass flux[Kg/s]:" << phi
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::
|
||||
write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
|
||||
this->writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,186 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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::totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
|
||||
Description
|
||||
Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
|
||||
SourceFiles
|
||||
totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef totalFlowRateAdvectiveDiffusiveFvPatchScalarField_H
|
||||
#define totalFlowRateAdvectiveDiffusiveFvPatchScalarField_H
|
||||
|
||||
#include "mixedFvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class totalFlowRateAdvectiveDiffusiveFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
:
|
||||
public mixedFvPatchField<scalar>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of the flux transporting the field
|
||||
word phiName_;
|
||||
|
||||
//- Name of the density field used to normalise the mass flux
|
||||
// if neccessary
|
||||
word rhoName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("totalFlowRateAdvectiveDiffusive");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
// onto a new patch
|
||||
totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
(
|
||||
const totalFlowRateAdvectiveDiffusiveFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
(
|
||||
const totalFlowRateAdvectiveDiffusiveFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchField<scalar> > clone() const
|
||||
{
|
||||
return tmp<fvPatchField<scalar> >
|
||||
(
|
||||
new
|
||||
totalFlowRateAdvectiveDiffusiveFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
(
|
||||
const totalFlowRateAdvectiveDiffusiveFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchField<scalar> > clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchField<scalar> >
|
||||
(
|
||||
new
|
||||
totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return reference to the name of the flux field
|
||||
word& phiName()
|
||||
{
|
||||
return phiName_;
|
||||
}
|
||||
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
virtual void autoMap
|
||||
(
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
virtual void rmap
|
||||
(
|
||||
const fvPatchScalarField&,
|
||||
const labelList&
|
||||
);
|
||||
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,327 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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 "turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "directMappedPatchBase.H"
|
||||
#include "mapDistribute.H"
|
||||
#include "basicThermo.H"
|
||||
#include "LESModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace LESModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
nbrFieldName_("undefined-nbrFieldName"),
|
||||
KName_("undefined-K")
|
||||
{
|
||||
this->refValue() = 0.0;
|
||||
this->refGrad() = 0.0;
|
||||
this->valueFraction() = 1.0;
|
||||
}
|
||||
|
||||
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
|
||||
(
|
||||
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(ptf, p, iF, mapper),
|
||||
nbrFieldName_(ptf.nbrFieldName_),
|
||||
KName_(ptf.KName_)
|
||||
{}
|
||||
|
||||
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
nbrFieldName_(dict.lookup("nbrFieldName")),
|
||||
KName_(dict.lookup("K"))
|
||||
{
|
||||
if (!isA<directMappedPatchBase>(this->patch().patch()))
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::"
|
||||
"turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2\n"
|
||||
"(\n"
|
||||
" const fvPatch& p,\n"
|
||||
" const DimensionedField<scalar, volMesh>& iF,\n"
|
||||
" const dictionary& dict\n"
|
||||
")\n"
|
||||
) << "\n patch type '" << p.type()
|
||||
<< "' not type '" << directMappedPatchBase::typeName << "'"
|
||||
<< "\n for patch " << p.name()
|
||||
<< " of field " << dimensionedInternalField().name()
|
||||
<< " in file " << dimensionedInternalField().objectPath()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
|
||||
|
||||
if (dict.found("refValue"))
|
||||
{
|
||||
// Full restart
|
||||
refValue() = scalarField("refValue", dict, p.size());
|
||||
refGrad() = scalarField("refGradient", dict, p.size());
|
||||
valueFraction() = scalarField("valueFraction", dict, p.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Start from user entered data. Assume fixedValue.
|
||||
refValue() = *this;
|
||||
refGrad() = 0.0;
|
||||
valueFraction() = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
|
||||
(
|
||||
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2& wtcsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(wtcsf, iF),
|
||||
nbrFieldName_(wtcsf.nbrFieldName_),
|
||||
KName_(wtcsf.KName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
tmp<scalarField>
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::K() const
|
||||
{
|
||||
const fvMesh& mesh = patch().boundaryMesh().mesh();
|
||||
|
||||
if (KName_ == "none")
|
||||
{
|
||||
const LESModel& model = db().lookupObject<LESModel>("LESProperties");
|
||||
|
||||
const basicThermo& thermo =
|
||||
db().lookupObject<basicThermo>("thermophysicalProperties");
|
||||
|
||||
return
|
||||
model.alphaEff()().boundaryField()[patch().index()]
|
||||
*thermo.Cp()().boundaryField()[patch().index()];
|
||||
}
|
||||
else if (mesh.objectRegistry::foundObject<volScalarField>(KName_))
|
||||
{
|
||||
return patch().lookupPatchField<volScalarField, scalar>(KName_);
|
||||
}
|
||||
else if (mesh.objectRegistry::foundObject<volSymmTensorField>(KName_))
|
||||
{
|
||||
const symmTensorField& KWall =
|
||||
patch().lookupPatchField<volSymmTensorField, scalar>(KName_);
|
||||
|
||||
vectorField n = patch().nf();
|
||||
|
||||
return n & KWall & n;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::K()"
|
||||
" const"
|
||||
) << "Did not find field " << KName_
|
||||
<< " on mesh " << mesh.name() << " patch " << patch().name()
|
||||
<< endl
|
||||
<< "Please set 'K' to 'none', a valid volScalarField"
|
||||
<< " or a valid volSymmTensorField." << exit(FatalError);
|
||||
|
||||
return scalarField(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the coupling information from the directMappedPatchBase
|
||||
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
|
||||
(
|
||||
patch().patch()
|
||||
);
|
||||
const polyMesh& nbrMesh = mpp.sampleMesh();
|
||||
const fvPatch& nbrPatch = refCast<const fvMesh>
|
||||
(
|
||||
nbrMesh
|
||||
).boundary()[mpp.samplePolyPatch().index()];
|
||||
|
||||
// Force recalculation of mapping and schedule
|
||||
const mapDistribute& distMap = mpp.map();
|
||||
|
||||
tmp<scalarField> intFld = patchInternalField();
|
||||
|
||||
|
||||
// Calculate the temperature by harmonic averaging
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2& nbrField =
|
||||
refCast
|
||||
<
|
||||
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
|
||||
>
|
||||
(
|
||||
nbrPatch.lookupPatchField<volScalarField, scalar>
|
||||
(
|
||||
nbrFieldName_
|
||||
)
|
||||
);
|
||||
|
||||
// Swap to obtain full local values of neighbour internal field
|
||||
scalarField nbrIntFld = nbrField.patchInternalField();
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(), // what to send
|
||||
distMap.constructMap(), // what to receive
|
||||
nbrIntFld
|
||||
);
|
||||
|
||||
// Swap to obtain full local values of neighbour K*delta
|
||||
scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs();
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(), // what to send
|
||||
distMap.constructMap(), // what to receive
|
||||
nbrKDelta
|
||||
);
|
||||
|
||||
tmp<scalarField> myKDelta = K()*patch().deltaCoeffs();
|
||||
|
||||
|
||||
// Both sides agree on
|
||||
// - temperature : (myKDelta*fld + nbrKDelta*nbrFld)/(myKDelta+nbrKDelta)
|
||||
// - gradient : (temperature-fld)*delta
|
||||
// We've got a degree of freedom in how to implement this in a mixed bc.
|
||||
// (what gradient, what fixedValue and mixing coefficient)
|
||||
// Two reasonable choices:
|
||||
// 1. specify above temperature on one side (preferentially the high side)
|
||||
// and above gradient on the other. So this will switch between pure
|
||||
// fixedvalue and pure fixedgradient
|
||||
// 2. specify gradient and temperature such that the equations are the
|
||||
// same on both sides. This leads to the choice of
|
||||
// - refGradient = zero gradient
|
||||
// - refValue = neighbour value
|
||||
// - mixFraction = nbrKDelta / (nbrKDelta + myKDelta())
|
||||
|
||||
|
||||
this->refValue() = nbrIntFld;
|
||||
|
||||
this->refGrad() = 0.0;
|
||||
|
||||
this->valueFraction() = nbrKDelta / (nbrKDelta + myKDelta());
|
||||
|
||||
mixedFvPatchScalarField::updateCoeffs();
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
scalar Q = gSum(K()*patch().magSf()*snGrad());
|
||||
|
||||
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||
<< patch().name() << ':'
|
||||
<< this->dimensionedInternalField().name() << " <- "
|
||||
<< nbrMesh.name() << ':'
|
||||
<< nbrPatch.name() << ':'
|
||||
<< this->dimensionedInternalField().name() << " :"
|
||||
<< " heat[W]:" << Q
|
||||
<< " walltemperature "
|
||||
<< " min:" << gMin(*this)
|
||||
<< " max:" << gMax(*this)
|
||||
<< " avg:" << gAverage(*this)
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
mixedFvPatchScalarField::write(os);
|
||||
os.writeKeyword("nbrFieldName")<< nbrFieldName_
|
||||
<< token::END_STATEMENT << nl;
|
||||
os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
} // End namespace LESModels
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,190 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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::compressible::LESModels
|
||||
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
|
||||
|
||||
Description
|
||||
Mixed boundary condition for temperature, to be used for heat-transfer
|
||||
on back-to-back baffles.
|
||||
|
||||
If my temperature is T1, neighbour is T2:
|
||||
|
||||
T1 > T2: my side becomes fixedValue T2 bc, other side becomes fixedGradient.
|
||||
|
||||
|
||||
Example usage:
|
||||
myInterfacePatchName
|
||||
{
|
||||
type compressible::turbulentTemperatureCoupledBaffleMixed;
|
||||
nbrFieldName T;
|
||||
K K; // or none
|
||||
value uniform 300;
|
||||
}
|
||||
|
||||
Needs to be on underlying directMapped(Wall)FvPatch.
|
||||
|
||||
Note: if K is "none" looks up RASModel and basicThermo, otherwise expects
|
||||
the solver to calculate a 'K' field.
|
||||
|
||||
Note: runs in parallel with arbitrary decomposition. Uses directMapped
|
||||
functionality to calculate exchange.
|
||||
|
||||
Note: lags interface data so both sides use same data.
|
||||
- problem: schedule to calculate average would interfere
|
||||
with standard processor swaps.
|
||||
- so: updateCoeffs sets both to same Twall. Only need to do
|
||||
this for last outer iteration but don't have access to this.
|
||||
|
||||
SourceFiles
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2_H
|
||||
#define turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2_H
|
||||
|
||||
#include "mixedFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace LESModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
|
||||
:
|
||||
public mixedFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of field on the neighbour region
|
||||
const word nbrFieldName_;
|
||||
|
||||
//- Name of thermal conductivity field
|
||||
const word KName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("compressible::turbulentTemperatureCoupledBaffleMixed2");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 onto a
|
||||
// new patch
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
|
||||
(
|
||||
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
|
||||
(
|
||||
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Get corresponding K field
|
||||
tmp<scalarField> K() const;
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace LESModels
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,539 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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 "turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "directMappedPatchBase.H"
|
||||
#include "mapDistribute.H"
|
||||
#include "regionProperties.H"
|
||||
#include "basicThermo.H"
|
||||
#include "LESModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
|
||||
template<>
|
||||
const char*
|
||||
NamedEnum
|
||||
<
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
|
||||
operationMode,
|
||||
4
|
||||
>::names[] =
|
||||
{
|
||||
"radiative_flux_from_neighbouring_region",
|
||||
"radiative_flux_from_this_region",
|
||||
"no_radiation_contribution",
|
||||
"unknown"
|
||||
};
|
||||
|
||||
const NamedEnum
|
||||
<
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
|
||||
operationMode,
|
||||
4
|
||||
>
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
|
||||
operationModeNames;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
neighbourFieldName_("undefined-neighbourFieldName"),
|
||||
neighbourFieldRadiativeName_("undefined-neigbourFieldRadiativeName"),
|
||||
fieldRadiativeName_("undefined-fieldRadiativeName"),
|
||||
KName_("undefined-K"),
|
||||
oldMode_(unknown)
|
||||
{
|
||||
this->refValue() = 0.0;
|
||||
this->refGrad() = 0.0;
|
||||
this->valueFraction() = 1.0;
|
||||
}
|
||||
|
||||
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
|
||||
(
|
||||
const turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(ptf, p, iF, mapper),
|
||||
neighbourFieldName_(ptf.neighbourFieldName_),
|
||||
neighbourFieldRadiativeName_(ptf.neighbourFieldRadiativeName_),
|
||||
fieldRadiativeName_(ptf.fieldRadiativeName_),
|
||||
KName_(ptf.KName_),
|
||||
oldMode_(ptf.oldMode_)
|
||||
{}
|
||||
|
||||
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
neighbourFieldName_(dict.lookup("neighbourFieldName")),
|
||||
neighbourFieldRadiativeName_(dict.lookup("neighbourFieldRadiativeName")),
|
||||
fieldRadiativeName_(dict.lookup("fieldRadiativeName")),
|
||||
KName_(dict.lookup("K")),
|
||||
oldMode_(unknown)
|
||||
{
|
||||
if (!isA<directMappedPatchBase>(this->patch().patch()))
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::"
|
||||
"turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField\n"
|
||||
"(\n"
|
||||
" const fvPatch& p,\n"
|
||||
" const DimensionedField<scalar, volMesh>& iF,\n"
|
||||
" const dictionary& dict\n"
|
||||
")\n"
|
||||
) << "\n patch type '" << p.type()
|
||||
<< "' not type '" << directMappedPatchBase::typeName << "'"
|
||||
<< "\n for patch " << p.name()
|
||||
<< " of field " << dimensionedInternalField().name()
|
||||
<< " in file " << dimensionedInternalField().objectPath()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
|
||||
|
||||
if (dict.found("refValue"))
|
||||
{
|
||||
// Full restart
|
||||
refValue() = scalarField("refValue", dict, p.size());
|
||||
refGrad() = scalarField("refGradient", dict, p.size());
|
||||
valueFraction() = scalarField("valueFraction", dict, p.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Start from user entered data. Assume fixedValue.
|
||||
refValue() = *this;
|
||||
refGrad() = 0.0;
|
||||
valueFraction() = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
|
||||
(
|
||||
const turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField&
|
||||
wtcsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(wtcsf, iF),
|
||||
neighbourFieldName_(wtcsf.neighbourFieldName_),
|
||||
neighbourFieldRadiativeName_(wtcsf.neighbourFieldRadiativeName_),
|
||||
fieldRadiativeName_(wtcsf.fieldRadiativeName_),
|
||||
KName_(wtcsf.KName_),
|
||||
oldMode_(wtcsf.oldMode_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
tmp<scalarField>
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::K() const
|
||||
{
|
||||
const fvMesh& mesh = patch().boundaryMesh().mesh();
|
||||
|
||||
if (KName_ == "none")
|
||||
{
|
||||
const compressible::LESModel& model =
|
||||
db().lookupObject<compressible::LESModel>("LESProperties");
|
||||
|
||||
const basicThermo& thermo =
|
||||
db().lookupObject<basicThermo>("thermophysicalProperties");
|
||||
|
||||
return
|
||||
model.alphaEff()().boundaryField()[patch().index()]
|
||||
*thermo.Cp()().boundaryField()[patch().index()];
|
||||
}
|
||||
else if (mesh.objectRegistry::foundObject<volScalarField>(KName_))
|
||||
{
|
||||
return patch().lookupPatchField<volScalarField, scalar>(KName_);
|
||||
}
|
||||
else if (mesh.objectRegistry::foundObject<volSymmTensorField>(KName_))
|
||||
{
|
||||
const symmTensorField& KWall =
|
||||
patch().lookupPatchField<volSymmTensorField, scalar>(KName_);
|
||||
|
||||
vectorField n = patch().nf();
|
||||
|
||||
return n & KWall & n;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::K()"
|
||||
" const"
|
||||
) << "Did not find field " << KName_
|
||||
<< " on mesh " << mesh.name() << " patch " << patch().name()
|
||||
<< endl
|
||||
<< "Please set 'K' to 'none', a valid volScalarField"
|
||||
<< " or a valid volSymmTensorField." << exit(FatalError);
|
||||
|
||||
return scalarField(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
|
||||
updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the coupling information from the directMappedPatchBase
|
||||
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
|
||||
(
|
||||
patch().patch()
|
||||
);
|
||||
const polyMesh& nbrMesh = mpp.sampleMesh();
|
||||
const fvPatch& nbrPatch = refCast<const fvMesh>
|
||||
(
|
||||
nbrMesh
|
||||
).boundary()[mpp.samplePolyPatch().index()];
|
||||
|
||||
// Force recalculation of mapping and schedule
|
||||
const mapDistribute& distMap = mpp.map();
|
||||
|
||||
scalarField intFld = patchInternalField();
|
||||
|
||||
const turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField&
|
||||
nbrField =
|
||||
refCast
|
||||
<
|
||||
const turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
|
||||
>
|
||||
(
|
||||
nbrPatch.lookupPatchField<volScalarField, scalar>
|
||||
(
|
||||
neighbourFieldName_
|
||||
)
|
||||
);
|
||||
|
||||
// Swap to obtain full local values of neighbour internal field
|
||||
scalarField nbrIntFld = nbrField.patchInternalField();
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(), // what to send
|
||||
distMap.constructMap(), // what to receive
|
||||
nbrIntFld
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||
<< patch().name() << ':'
|
||||
<< this->dimensionedInternalField().name() << " :"
|
||||
<< " internalT "
|
||||
<< " min:" << gMin(*this)
|
||||
<< " max:" << gMax(*this)
|
||||
<< " avg:" << gAverage(*this)
|
||||
<< endl;
|
||||
|
||||
Info<< nbrMesh.name() << ':'
|
||||
<< nbrPatch.name() << ':'
|
||||
<< this->dimensionedInternalField().name() << " :"
|
||||
<< " internalT "
|
||||
<< " min:" << gMin(nbrIntFld)
|
||||
<< " max:" << gMax(nbrIntFld)
|
||||
<< " avg:" << gAverage(nbrIntFld)
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Check how to operate
|
||||
operationMode mode = unknown;
|
||||
{
|
||||
if (neighbourFieldRadiativeName_ != "none")
|
||||
{
|
||||
if
|
||||
(
|
||||
nbrMesh.foundObject<volScalarField>
|
||||
(
|
||||
neighbourFieldRadiativeName_
|
||||
)
|
||||
)
|
||||
{
|
||||
mode = radFromNeighbour;
|
||||
}
|
||||
else
|
||||
{
|
||||
mode = noRad;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if
|
||||
(
|
||||
patch().boundaryMesh().mesh().foundObject<volScalarField>
|
||||
(
|
||||
fieldRadiativeName_
|
||||
)
|
||||
)
|
||||
{
|
||||
mode = radFromMe;
|
||||
}
|
||||
else
|
||||
{
|
||||
mode = noRad;
|
||||
}
|
||||
}
|
||||
|
||||
// Do some warnings if change of mode.
|
||||
if (mode != oldMode_)
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField"
|
||||
"::updateCoeffs()"
|
||||
) << "Switched from mode " << operationModeNames[oldMode_]
|
||||
<< " to mode " << operationModeNames[mode]
|
||||
<< endl;
|
||||
}
|
||||
oldMode_ = mode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Swap to obtain full local values of neighbour K*delta
|
||||
scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs();
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(), // what to send
|
||||
distMap.constructMap(), // what to receive
|
||||
nbrKDelta
|
||||
);
|
||||
|
||||
scalarField myKDelta = K()*patch().deltaCoeffs();
|
||||
|
||||
scalarField nbrConvFlux = nbrKDelta*(*this - nbrIntFld);
|
||||
|
||||
scalarField nbrTotalFlux = nbrConvFlux;
|
||||
scalarList nbrRadField(nbrPatch.size(), 0.0);
|
||||
scalarList myRadField(patch().size(), 0.0);
|
||||
|
||||
// solid
|
||||
if (mode == radFromNeighbour)
|
||||
{
|
||||
nbrRadField =
|
||||
nbrPatch.lookupPatchField<volScalarField, scalar>
|
||||
(
|
||||
neighbourFieldRadiativeName_
|
||||
);
|
||||
|
||||
// Note: the Qr radiative flux is positive outgoing.
|
||||
// For a hot solid radiating into a cold fluid Qr will be negative.
|
||||
|
||||
|
||||
// Swap to obtain full local values of neighbour radiative heat flux
|
||||
// field
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(), // what to send
|
||||
distMap.constructMap(), // what to receive
|
||||
nbrRadField
|
||||
);
|
||||
|
||||
nbrTotalFlux -= nbrRadField;
|
||||
|
||||
const scalarField Twall =
|
||||
(nbrRadField + myKDelta*intFld + nbrKDelta*nbrIntFld)
|
||||
/(myKDelta + nbrKDelta);
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
scalar Qr = gSum(nbrRadField*patch().magSf());
|
||||
|
||||
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||
<< patch().name() << ':'
|
||||
<< this->dimensionedInternalField().name() << " :" << nl
|
||||
<< " radiative heat [W] : " << Qr << nl
|
||||
<< " predicted wallT [K] : " << gAverage(Twall) << nl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
label nFixed = 0;
|
||||
|
||||
forAll(*this, i)
|
||||
{
|
||||
|
||||
this->refValue()[i] = Twall[i];
|
||||
this->refGrad()[i] = 0.0; // not used
|
||||
this->valueFraction()[i] = 1.0;
|
||||
nFixed++;
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Using " << nFixed << " fixedValue out of " << this->size()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
else if (mode == radFromMe) //fluid
|
||||
{
|
||||
const scalarField& myRadField =
|
||||
patch().lookupPatchField<volScalarField, scalar>
|
||||
(
|
||||
fieldRadiativeName_
|
||||
);
|
||||
|
||||
const scalarField Twall =
|
||||
(myRadField + myKDelta*intFld + nbrKDelta*nbrIntFld)
|
||||
/(myKDelta + nbrKDelta);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
scalar Qr = gSum(myRadField*patch().magSf());
|
||||
|
||||
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||
<< patch().name() << ':'
|
||||
<< this->dimensionedInternalField().name() << " :" << nl
|
||||
<< " radiative heat [W] : " << Qr << nl
|
||||
<< " predicted wallT [K] : " << gAverage(Twall) << nl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
this->refValue() = Twall;
|
||||
this->refGrad() = 0.0; // not used
|
||||
this->valueFraction() = 1.0;
|
||||
}
|
||||
else if (mode == noRad)
|
||||
{
|
||||
this->refValue() = nbrIntFld;
|
||||
this->refGrad() = 0.0;
|
||||
this->valueFraction() = nbrKDelta / (nbrKDelta + myKDelta);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField"
|
||||
"::updateCoeffs()"
|
||||
) << "Illegal mode " << operationModeNames[mode]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
mixedFvPatchScalarField::updateCoeffs();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
scalar Qc = gSum(nbrConvFlux*patch().magSf());
|
||||
scalar Qr = gSum(nbrRadField*patch().magSf());
|
||||
scalar Qt = gSum(nbrTotalFlux*patch().magSf());
|
||||
|
||||
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||
<< patch().name() << ':'
|
||||
<< this->dimensionedInternalField().name() << " <- "
|
||||
<< nbrMesh.name() << ':'
|
||||
<< nbrPatch.name() << ':'
|
||||
<< this->dimensionedInternalField().name() << " :" << nl
|
||||
<< " convective heat[W] : " << Qc << nl
|
||||
<< " radiative heat [W] : " << Qr << nl
|
||||
<< " total heat [W] : " << Qt << nl
|
||||
<< " walltemperature "
|
||||
<< " min:" << gMin(*this)
|
||||
<< " max:" << gMax(*this)
|
||||
<< " avg:" << gAverage(*this)
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
mixedFvPatchScalarField::write(os);
|
||||
os.writeKeyword("neighbourFieldName")<< neighbourFieldName_
|
||||
<< token::END_STATEMENT << nl;
|
||||
os.writeKeyword("neighbourFieldRadiativeName")<<
|
||||
neighbourFieldRadiativeName_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("fieldRadiativeName")<< fieldRadiativeName_
|
||||
<< token::END_STATEMENT << nl;
|
||||
os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
|
||||
// temperatureCoupledBase::write(os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,221 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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::
|
||||
compressible::
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
|
||||
|
||||
Description
|
||||
Mixed boundary condition for temperature, to be used for heat-transfer
|
||||
on back-to-back baffles.
|
||||
|
||||
If my temperature is T1, neighbour is T2:
|
||||
|
||||
T1 > T2: my side becomes fixedValue T2 bc, other side becomes fixedGradient.
|
||||
|
||||
|
||||
Example usage:
|
||||
myInterfacePatchName
|
||||
{
|
||||
type compressible::turbulentTemperatureRadiationCoupledMixedST;
|
||||
neighbourFieldName T;
|
||||
K lookup;
|
||||
KName K;
|
||||
|
||||
neighbourFieldRadiativeName Qr; // or none. Use on solid side
|
||||
fieldRadiativeName Qr; // fluid. Use on fluid side
|
||||
|
||||
value uniform 300;
|
||||
}
|
||||
|
||||
Needs to be on underlying directMapped(Wall)FvPatch.
|
||||
|
||||
Note: K : heat conduction at patch. Gets supplied how to lookup/calculate K:
|
||||
- 'lookup' : lookup volScalarField (or volSymmTensorField) with name
|
||||
- 'basicThermo' : use basicThermo and compressible::RASmodel to calculate K
|
||||
- 'solidThermo' : use basicSolidThermo K()
|
||||
- 'directionalSolidThermo' directionalK()
|
||||
|
||||
Note: runs in parallel with arbitrary decomposition. Uses directMapped
|
||||
functionality to calculate exchange.
|
||||
|
||||
Note: lags interface data so both sides use same data.
|
||||
- problem: schedule to calculate average would interfere
|
||||
with standard processor swaps.
|
||||
- so: updateCoeffs sets both to same Twall. Only need to do
|
||||
this for last outer iteration but don't have access to this.
|
||||
|
||||
SourceFiles
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField_H
|
||||
#define turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField_H
|
||||
|
||||
#include "mixedFvPatchFields.H"
|
||||
//#include "temperatureCoupledBase.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
|
||||
Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
|
||||
:
|
||||
public mixedFvPatchScalarField
|
||||
// public temperatureCoupledBase
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of field on the neighbour region
|
||||
const word neighbourFieldName_;
|
||||
|
||||
//- Name of the radiative heat flux in the neighbout region
|
||||
const word neighbourFieldRadiativeName_;
|
||||
|
||||
//- Name of the radiative heat flux in the my region
|
||||
const word fieldRadiativeName_;
|
||||
|
||||
//- Name of thermal conductivity field
|
||||
const word KName_;
|
||||
|
||||
//- how to obtain radiative flux
|
||||
enum operationMode
|
||||
{
|
||||
radFromNeighbour,
|
||||
radFromMe,
|
||||
noRad,
|
||||
unknown
|
||||
};
|
||||
static const NamedEnum<operationMode, 4> operationModeNames;
|
||||
|
||||
//- Previous iteration mode
|
||||
operationMode oldMode_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("compressible::turbulentTemperatureRadiationCoupledMixedST");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// turbulentTemperatureCoupledBaffleMixedFvPatchScalarField onto a
|
||||
// new patch
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
|
||||
(
|
||||
const
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
|
||||
(
|
||||
const
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new
|
||||
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Get corresponding K field
|
||||
tmp<scalarField> K() const;
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
147
src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.C
Normal file
147
src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.C
Normal file
@ -0,0 +1,147 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 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 "noPyrolysis.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace pyrolysisModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(noPyrolysis, 0);
|
||||
addToRunTimeSelectionTable(pyrolysisModel, noPyrolysis, mesh);
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool noPyrolysis::read()
|
||||
{
|
||||
if (pyrolysisModel::read())
|
||||
{
|
||||
// no additional info to read
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
noPyrolysis::noPyrolysis(const word& modelType, const fvMesh& mesh)
|
||||
:
|
||||
pyrolysisModel(mesh)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
noPyrolysis::~noPyrolysis()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
const volScalarField& noPyrolysis::rho() const
|
||||
{
|
||||
FatalErrorIn("const volScalarField& noPyrolysis::rho() const")
|
||||
<< "rho field not available for " << type() << abort(FatalError);
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
|
||||
const volScalarField& noPyrolysis::T() const
|
||||
{
|
||||
FatalErrorIn("const volScalarField& noPyrolysis::T() const")
|
||||
<< "T field not available for " << type() << abort(FatalError);
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
|
||||
const tmp<volScalarField> noPyrolysis::Cp() const
|
||||
{
|
||||
FatalErrorIn("const tmp<volScalarField>& noPyrolysis::Cp() const")
|
||||
<< "Cp field not available for " << type() << abort(FatalError);
|
||||
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"noPyrolysis::Cp",
|
||||
time().timeName(),
|
||||
primaryMesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
primaryMesh(),
|
||||
dimensionedScalar("zero", dimEnergy/dimVolume/dimTime, 0.0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
const volScalarField& noPyrolysis::kappa() const
|
||||
{
|
||||
FatalErrorIn("const volScalarField& noPyrolysis::kappa() const")
|
||||
<< "kappa field not available for " << type() << abort(FatalError);
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
|
||||
const volScalarField& noPyrolysis::K() const
|
||||
{
|
||||
FatalErrorIn("const volScalarField& noPyrolysis::K() const")
|
||||
<< "K field not available for " << type() << abort(FatalError);
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
|
||||
const surfaceScalarField& noPyrolysis::phiGas() const
|
||||
{
|
||||
FatalErrorIn("const volScalarField& noPyrolysis::phiGas() const")
|
||||
<< "phiGas field not available for " << type() << abort(FatalError);
|
||||
return surfaceScalarField::null();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace surfaceFilmModels
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
127
src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.H
Normal file
127
src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.H
Normal file
@ -0,0 +1,127 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 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::noPyrolysis
|
||||
|
||||
Description
|
||||
Dummy surface pyrolysis model for 'none'
|
||||
|
||||
SourceFiles
|
||||
noPyrolysis.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef noPyrolysis_H
|
||||
#define noPyrolysis_H
|
||||
|
||||
#include "pyrolysisModel.H"
|
||||
#include "volFieldsFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace pyrolysisModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class noPyrolysis Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class noPyrolysis
|
||||
:
|
||||
public pyrolysisModel
|
||||
{
|
||||
private:
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
noPyrolysis(const noPyrolysis&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const noPyrolysis&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Read control parameters from dictionary
|
||||
virtual bool read();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("none");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from type name and mesh
|
||||
noPyrolysis(const word& modelType, const fvMesh& mesh);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~noPyrolysis();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Fields
|
||||
|
||||
//- Return density [kg/m3]
|
||||
virtual const volScalarField& rho() const;
|
||||
|
||||
//- Return const temperature [K]
|
||||
virtual const volScalarField& T() const;
|
||||
|
||||
//- Return specific heat capacity [J/kg/K]
|
||||
virtual const tmp<volScalarField> Cp() const;
|
||||
|
||||
//- Return the region absorptivity [1/m]
|
||||
virtual const volScalarField& kappa() const;
|
||||
|
||||
//- Return the region thermal conductivity [W/m/k]
|
||||
virtual const volScalarField& K() const;
|
||||
|
||||
//- Return the total gas mass flux to primary region [kg/m2/s]
|
||||
virtual const surfaceScalarField& phiGas() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace pyrolysisModels
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
182
src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.C
Normal file
182
src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.C
Normal file
@ -0,0 +1,182 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 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 "pyrolysisModel.H"
|
||||
#include "fvMesh.H"
|
||||
#include "directMappedFieldFvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace pyrolysisModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(pyrolysisModel, 0);
|
||||
defineRunTimeSelectionTable(pyrolysisModel, mesh);
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
void pyrolysisModel::constructMeshObjects()
|
||||
{
|
||||
// construct filmDelta field if coupled to film model
|
||||
if (filmCoupled_)
|
||||
{
|
||||
filmDeltaPtr_.reset
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"filmDelta",
|
||||
time_.timeName(),
|
||||
regionMesh(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
regionMesh()
|
||||
)
|
||||
);
|
||||
|
||||
const volScalarField& filmDelta = filmDeltaPtr_();
|
||||
|
||||
bool foundCoupledPatch = false;
|
||||
forAll(filmDelta.boundaryField(), patchI)
|
||||
{
|
||||
const fvPatchField<scalar>& fvp = filmDelta.boundaryField()[patchI];
|
||||
if (isA<directMappedFieldFvPatchField<scalar> >(fvp))
|
||||
{
|
||||
foundCoupledPatch = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundCoupledPatch)
|
||||
{
|
||||
WarningIn("void pyrolysisModels::constructMeshObjects()")
|
||||
<< "filmCoupled flag set to true, but no "
|
||||
<< directMappedFieldFvPatchField<scalar>::typeName
|
||||
<< " patches found on " << filmDelta.name() << " field"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool pyrolysisModel::read()
|
||||
{
|
||||
if (regionModel1D::read())
|
||||
{
|
||||
filmCoupled_ = readBool(coeffs_.lookup("filmCoupled"));
|
||||
reactionDeltaMin_ =
|
||||
coeffs_.lookupOrDefault<scalar>("reactionDeltaMin", 0.0);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
pyrolysisModel::pyrolysisModel(const fvMesh& mesh)
|
||||
:
|
||||
regionModel1D(mesh),
|
||||
filmCoupled_(false),
|
||||
filmDeltaPtr_(NULL),
|
||||
reactionDeltaMin_(0.0)
|
||||
{}
|
||||
|
||||
|
||||
pyrolysisModel::pyrolysisModel(const word& modelType, const fvMesh& mesh)
|
||||
:
|
||||
regionModel1D(mesh, "pyrolysis", modelType),
|
||||
filmCoupled_(false),
|
||||
filmDeltaPtr_(NULL),
|
||||
reactionDeltaMin_(0.0)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
read();
|
||||
constructMeshObjects();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
pyrolysisModel::~pyrolysisModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
scalar pyrolysisModel::addMassSources
|
||||
(
|
||||
const label patchI,
|
||||
const label faceI
|
||||
)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
void pyrolysisModel::preEvolveRegion()
|
||||
{
|
||||
if (filmCoupled_)
|
||||
{
|
||||
filmDeltaPtr_->correctBoundaryConditions();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
scalar pyrolysisModel::solidRegionDiffNo() const
|
||||
{
|
||||
return VSMALL;
|
||||
}
|
||||
|
||||
|
||||
scalar pyrolysisModel::maxDiff() const
|
||||
{
|
||||
return GREAT;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace surfaceFilmModels
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
199
src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.H
Normal file
199
src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.H
Normal file
@ -0,0 +1,199 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 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::pyrolysisModel
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
pyrolysisModelI.H
|
||||
pyrolysisModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef pyrolysisModel_H
|
||||
#define pyrolysisModel_H
|
||||
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "solidChemistryModel.H"
|
||||
#include "basicSolidThermo.H"
|
||||
#include "regionModel1D.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class fvMesh;
|
||||
class Time;
|
||||
|
||||
namespace regionModels
|
||||
{
|
||||
namespace pyrolysisModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class pyrolysisModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class pyrolysisModel
|
||||
:
|
||||
public regionModel1D
|
||||
{
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Construct fields
|
||||
void constructMeshObjects();
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
pyrolysisModel(const pyrolysisModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const pyrolysisModel&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Data
|
||||
|
||||
//- Flag to indicate whether pyrolysis region coupled to a film region
|
||||
bool filmCoupled_;
|
||||
|
||||
//- Pointer to film thickness field
|
||||
autoPtr<volScalarField> filmDeltaPtr_;
|
||||
|
||||
//- Film height below which reactions can occur [m]
|
||||
scalar reactionDeltaMin_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Read control parameters from dictionary
|
||||
virtual bool read();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("pyrolysisModel");
|
||||
|
||||
|
||||
// Declare runtime constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
pyrolysisModel,
|
||||
mesh,
|
||||
(
|
||||
const word& modelType,
|
||||
const fvMesh& mesh
|
||||
),
|
||||
(modelType, mesh)
|
||||
);
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null from mesh
|
||||
pyrolysisModel(const fvMesh& mesh);
|
||||
|
||||
//- Construct from type name and mesh
|
||||
pyrolysisModel(const word& modelType, const fvMesh& mesh);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected surface film model
|
||||
static autoPtr<pyrolysisModel> New(const fvMesh& mesh);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~pyrolysisModel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
// Fields
|
||||
|
||||
//- Return density [kg/m3]
|
||||
virtual const volScalarField& rho() const = 0;
|
||||
|
||||
//- Return const temperature [K]
|
||||
virtual const volScalarField& T() const = 0;
|
||||
|
||||
//- Return specific heat capacity [J/kg/K]
|
||||
virtual const tmp<volScalarField> Cp() const = 0;
|
||||
|
||||
//- Return the region absorptivity [1/m]
|
||||
virtual const volScalarField& kappa() const = 0;
|
||||
|
||||
//- Return the region thermal conductivity [W/m/k]
|
||||
virtual const volScalarField& K() const = 0;
|
||||
|
||||
//- Return the total gas mass flux to primary region [kg/m2/s]
|
||||
virtual const surfaceScalarField& phiGas() const = 0;
|
||||
|
||||
// Sources
|
||||
|
||||
//- External hook to add mass to the primary region
|
||||
virtual scalar addMassSources
|
||||
(
|
||||
const label patchI,
|
||||
const label faceI
|
||||
);
|
||||
|
||||
|
||||
// Evolution
|
||||
|
||||
//- Pre-evolve region
|
||||
virtual void preEvolveRegion();
|
||||
|
||||
|
||||
// Helper function
|
||||
|
||||
//- Mean diffusion number of the solid region
|
||||
virtual scalar solidRegionDiffNo() const;
|
||||
|
||||
//- Return max diffusivity allowed in the solid
|
||||
virtual scalar maxDiff() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace pyrolysisModels
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,44 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 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 "pyrolysisModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::Switch&
|
||||
Foam::pyrolysisModels::pyrolysisModel::active() const
|
||||
{
|
||||
return active_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::dictionary&
|
||||
Foam::pyrolysisModels::pyrolysisModel::coeffs() const
|
||||
{
|
||||
return coeffs_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,84 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 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 "pyrolysisModel.H"
|
||||
#include "fvMesh.H"
|
||||
#include "Time.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace pyrolysisModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
autoPtr<pyrolysisModel> pyrolysisModel::New(const fvMesh& mesh)
|
||||
{
|
||||
// get model name, but do not register the dictionary
|
||||
const word modelType
|
||||
(
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pyrolysisProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
).lookup("pyrolysisModel")
|
||||
);
|
||||
|
||||
Info<< "Selecting pyrolysisModel " << modelType << endl;
|
||||
|
||||
meshConstructorTable::iterator cstrIter =
|
||||
meshConstructorTablePtr_->find(modelType);
|
||||
|
||||
if (cstrIter == meshConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn("pyrolysisModel::New(const fvMesh&)")
|
||||
<< "Unknown pyrolysisModel type " << modelType
|
||||
<< nl << nl << "Valid pyrolisisModel types are:" << nl
|
||||
<< meshConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<pyrolysisModel>(cstrIter()(modelType, mesh));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace surfaceFilmModels
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
609
src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C
Normal file
609
src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C
Normal file
@ -0,0 +1,609 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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 "reactingOneDim.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "directMappedPatchBase.H"
|
||||
#include "mapDistribute.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "surfaceInterpolate.H"
|
||||
#include "fvm.H"
|
||||
#include "fvcDiv.H"
|
||||
#include "fvcVolumeIntegrate.H"
|
||||
#include "fvMatrices.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace pyrolysisModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(reactingOneDim, 0);
|
||||
|
||||
addToRunTimeSelectionTable(pyrolysisModel, reactingOneDim, mesh);
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool reactingOneDim::read()
|
||||
{
|
||||
if (pyrolysisModel::read())
|
||||
{
|
||||
const dictionary& solution = this->solution().subDict("SIMPLE");
|
||||
solution.lookup("nNonOrthCorr") >> nNonOrthCorr_;
|
||||
time_.controlDict().lookup("maxDi") >> maxDiff_;
|
||||
|
||||
coeffs().lookup("radFluxName") >> primaryRadFluxName_;
|
||||
coeffs().lookup("minimumDelta") >> minimumDelta_;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void reactingOneDim::updateQr()
|
||||
{
|
||||
// Retrieve field from coupled region using mapped boundary conditions
|
||||
QrCoupled_.correctBoundaryConditions();
|
||||
|
||||
// Update local Qr from coupled Qr field
|
||||
Qr_ == dimensionedScalar("zero", Qr_.dimensions(), 0.0);
|
||||
forAll(intCoupledPatchIDs_, i)
|
||||
{
|
||||
const label patchI = intCoupledPatchIDs_[i];
|
||||
|
||||
scalarField& Qrp = Qr_.boundaryField()[patchI];
|
||||
|
||||
// Qr is negative going out the solid
|
||||
// If the surface is emitting the radiative flux is set to zero
|
||||
Qrp = max(Qrp, 0.0);
|
||||
}
|
||||
|
||||
// Propagate Qr through 1-D regions
|
||||
forAll(intCoupledPatchIDs_, i)
|
||||
{
|
||||
const label patchI = intCoupledPatchIDs_[i];
|
||||
|
||||
const scalarField& Qrp = Qr_.boundaryField()[patchI];
|
||||
const vectorField& Cf = regionMesh().Cf().boundaryField()[patchI];
|
||||
|
||||
forAll(Qrp, faceI)
|
||||
{
|
||||
const scalar Qr0 = Qrp[faceI];
|
||||
point Cf0 = Cf[faceI];
|
||||
const labelList& cells = boundaryFaceCells_[faceI];
|
||||
scalar kappaInt = 0.0;
|
||||
forAll(cells, k)
|
||||
{
|
||||
const label cellI = cells[k];
|
||||
const point& Cf1 = regionMesh().cellCentres()[cellI];
|
||||
const scalar delta = mag(Cf1 - Cf0);
|
||||
kappaInt += kappa_[cellI]*delta;
|
||||
Qr_[cellI] = Qr0*exp(-kappaInt);
|
||||
Cf0 = Cf1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Qr_.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
|
||||
void reactingOneDim::updatePhiGas()
|
||||
{
|
||||
phiHsGas_ == dimensionedScalar("zero", phiHsGas_.dimensions(), 0.0);
|
||||
phiGas_ == dimensionedScalar("zero", phiGas_.dimensions(), 0.0);
|
||||
|
||||
const speciesTable& gasTable = solidChemistry_->gasTable();
|
||||
|
||||
forAll(gasTable, gasI)
|
||||
{
|
||||
tmp<volScalarField> tHsiGas = solidChemistry_->gasHs(T_, gasI);
|
||||
tmp<volScalarField> tRRiGas = solidChemistry_->RRg(gasI);
|
||||
|
||||
const volScalarField& HsiGas = tHsiGas();
|
||||
const volScalarField& RRiGas = tRRiGas();
|
||||
|
||||
const surfaceScalarField HsiGasf = fvc::interpolate(HsiGas);
|
||||
const surfaceScalarField RRiGasf = fvc::interpolate(RRiGas);
|
||||
|
||||
forAll(intCoupledPatchIDs_, i)
|
||||
{
|
||||
const label patchI = intCoupledPatchIDs_[i];
|
||||
const scalarField& phiGasp = phiHsGas_.boundaryField()[patchI];
|
||||
|
||||
forAll(phiGasp, faceI)
|
||||
{
|
||||
const labelList& cells = boundaryFaceCells_[faceI];
|
||||
scalar massInt = 0.0;
|
||||
forAllReverse(cells, k)
|
||||
{
|
||||
const label cellI = cells[k];
|
||||
massInt += RRiGas[cellI]*regionMesh().V()[cellI];
|
||||
phiHsGas_[cellI] += massInt*HsiGas[cellI];
|
||||
}
|
||||
|
||||
phiGas_.boundaryField()[patchI][faceI] += massInt;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< " Gas : " << gasTable[gasI]
|
||||
<< " on patch : " << patchI
|
||||
<< " mass produced at face(local) : "
|
||||
<< faceI
|
||||
<< " is : " << massInt
|
||||
<< " [kg/s] " << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
tHsiGas().clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void reactingOneDim::updateFields()
|
||||
{
|
||||
updateQr();
|
||||
|
||||
updatePhiGas();
|
||||
}
|
||||
|
||||
|
||||
void reactingOneDim::updateMesh(const scalarField& mass0)
|
||||
{
|
||||
if (!moveMesh_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const scalarField newV = mass0/rho_;
|
||||
|
||||
Info<< "Initial/final volumes = " << gSum(regionMesh().V()) << ", "
|
||||
<< gSum(newV) << " [m3]" << endl;
|
||||
|
||||
// move the mesh
|
||||
const labelList moveMap = moveMesh(regionMesh().V() - newV, minimumDelta_);
|
||||
|
||||
// flag any cells that have not moved as non-reacting
|
||||
forAll(moveMap, i)
|
||||
{
|
||||
if (moveMap[i] == 0)
|
||||
{
|
||||
solidChemistry_->setCellReacting(i, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void reactingOneDim::solveContinuity()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "reactingOneDim::solveContinuity()" << endl;
|
||||
}
|
||||
|
||||
solve
|
||||
(
|
||||
fvm::ddt(rho_)
|
||||
==
|
||||
- solidChemistry_->RRg()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void reactingOneDim::solveSpeciesMass()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "reactingOneDim::solveSpeciesMass()" << endl;
|
||||
}
|
||||
|
||||
volScalarField Yt = 0.0*Ys_[0];
|
||||
|
||||
for (label i=0; i<Ys_.size()-1; i++)
|
||||
{
|
||||
volScalarField& Yi = Ys_[i];
|
||||
|
||||
fvScalarMatrix YiEqn
|
||||
(
|
||||
fvm::ddt(rho_, Yi)
|
||||
==
|
||||
solidChemistry_->RRs(i)
|
||||
);
|
||||
|
||||
if (moveMesh_)
|
||||
{
|
||||
surfaceScalarField phiRhoMesh =
|
||||
fvc::interpolate(Yi*rho_)*regionMesh().phi();
|
||||
|
||||
YiEqn -= fvc::div(phiRhoMesh);
|
||||
}
|
||||
|
||||
YiEqn.solve(regionMesh().solver("Yi"));
|
||||
Yi.max(0.0);
|
||||
Yt += Yi;
|
||||
}
|
||||
|
||||
Ys_[Ys_.size() - 1] = 1.0 - Yt;
|
||||
}
|
||||
|
||||
|
||||
void reactingOneDim::solveEnergy()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "reactingOneDim::solveEnergy()" << endl;
|
||||
}
|
||||
|
||||
const volScalarField rhoCp = rho_*solidThermo_.Cp();
|
||||
|
||||
const surfaceScalarField phiQr = fvc::interpolate(Qr_)*nMagSf();
|
||||
|
||||
const surfaceScalarField phiGas = fvc::interpolate(phiHsGas_);
|
||||
|
||||
fvScalarMatrix TEqn
|
||||
(
|
||||
fvm::ddt(rhoCp, T_)
|
||||
- fvm::laplacian(K_, T_)
|
||||
==
|
||||
chemistrySh_
|
||||
+ fvc::div(phiQr)
|
||||
+ fvc::div(phiGas)
|
||||
);
|
||||
|
||||
if (moveMesh_)
|
||||
{
|
||||
surfaceScalarField phiMesh =
|
||||
fvc::interpolate(rhoCp*T_)*regionMesh().phi();
|
||||
|
||||
TEqn -= fvc::div(phiMesh);
|
||||
}
|
||||
|
||||
TEqn.relax();
|
||||
TEqn.solve();
|
||||
|
||||
Info<< "pyrolysis min/max(T) = " << min(T_).value() << ", "
|
||||
<< max(T_).value() << endl;
|
||||
}
|
||||
|
||||
|
||||
void reactingOneDim::calculateMassTransfer()
|
||||
{
|
||||
totalGasMassFlux_ = 0;
|
||||
forAll(intCoupledPatchIDs_, i)
|
||||
{
|
||||
const label patchI = intCoupledPatchIDs_[i];
|
||||
totalGasMassFlux_ += gSum(phiGas_.boundaryField()[patchI]);
|
||||
}
|
||||
|
||||
if (infoOutput_)
|
||||
{
|
||||
totalHeatRR_ = fvc::domainIntegrate(chemistrySh_);
|
||||
|
||||
addedGasMass_ +=
|
||||
fvc::domainIntegrate(solidChemistry_->RRg())*time_.deltaT();
|
||||
lostSolidMass_ +=
|
||||
fvc::domainIntegrate(solidChemistry_->RRs())*time_.deltaT();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
reactingOneDim::reactingOneDim(const word& modelType, const fvMesh& mesh)
|
||||
:
|
||||
pyrolysisModel(modelType, mesh),
|
||||
solidChemistry_(solidChemistryModel::New(regionMesh())),
|
||||
solidThermo_(solidChemistry_->solidThermo()),
|
||||
kappa_(solidThermo_.kappa()),
|
||||
K_(solidThermo_.K()),
|
||||
rho_(solidThermo_.rho()),
|
||||
Ys_(solidThermo_.composition().Y()),
|
||||
T_(solidThermo_.T()),
|
||||
primaryRadFluxName_(coeffs().lookupOrDefault<word>("radFluxName", "Qr")),
|
||||
nNonOrthCorr_(-1),
|
||||
maxDiff_(10),
|
||||
minimumDelta_(1e-4),
|
||||
|
||||
phiGas_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phiGas",
|
||||
time().timeName(),
|
||||
regionMesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
regionMesh(),
|
||||
dimensionedScalar("zero", dimMass/dimTime, 0.0)
|
||||
),
|
||||
|
||||
phiHsGas_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phiHsGas",
|
||||
time().timeName(),
|
||||
regionMesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
regionMesh(),
|
||||
dimensionedScalar("zero", dimEnergy/dimTime, 0.0)
|
||||
),
|
||||
|
||||
chemistrySh_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"chemistrySh",
|
||||
time().timeName(),
|
||||
regionMesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
regionMesh(),
|
||||
dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0)
|
||||
),
|
||||
|
||||
QrCoupled_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
primaryRadFluxName_,
|
||||
time().timeName(),
|
||||
regionMesh(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
regionMesh()
|
||||
),
|
||||
|
||||
Qr_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"QrPyr",
|
||||
time().timeName(),
|
||||
regionMesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
regionMesh(),
|
||||
dimensionedScalar("zero", dimEnergy/dimArea/dimTime, 0.0),
|
||||
zeroGradientFvPatchVectorField::typeName
|
||||
),
|
||||
|
||||
lostSolidMass_(dimensionedScalar("zero", dimMass, 0.0)),
|
||||
addedGasMass_(dimensionedScalar("zero", dimMass, 0.0)),
|
||||
totalGasMassFlux_(0.0),
|
||||
totalHeatRR_(dimensionedScalar("zero", dimEnergy/dimTime, 0.0))
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
read();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
reactingOneDim::~reactingOneDim()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
scalar reactingOneDim::addMassSources(const label patchI, const label faceI)
|
||||
{
|
||||
label index = 0;
|
||||
forAll(primaryPatchIDs_, i)
|
||||
{
|
||||
if (primaryPatchIDs_[i] == patchI)
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const label localPatchId = intCoupledPatchIDs_[index];
|
||||
|
||||
const scalar massAdded = phiGas_.boundaryField()[localPatchId][faceI];
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "\nPyrolysis region: " << type() << "added mass : "
|
||||
<< massAdded << endl;
|
||||
}
|
||||
|
||||
return massAdded;
|
||||
}
|
||||
|
||||
|
||||
scalar reactingOneDim::solidRegionDiffNo() const
|
||||
{
|
||||
scalar DiNum = 0.0;
|
||||
scalar meanDiNum = 0.0;
|
||||
if (regionMesh().nInternalFaces() > 0)
|
||||
{
|
||||
surfaceScalarField KrhoCpbyDelta =
|
||||
regionMesh().surfaceInterpolation::deltaCoeffs()
|
||||
* fvc::interpolate(K_)
|
||||
/ fvc::interpolate(Cp()*rho_);
|
||||
|
||||
DiNum = max(KrhoCpbyDelta.internalField())*time_.deltaTValue();
|
||||
|
||||
meanDiNum = average(KrhoCpbyDelta.internalField())*time().deltaTValue();
|
||||
}
|
||||
|
||||
return DiNum;
|
||||
}
|
||||
|
||||
|
||||
scalar reactingOneDim::maxDiff() const
|
||||
{
|
||||
return maxDiff_;
|
||||
}
|
||||
|
||||
|
||||
const volScalarField& reactingOneDim::rho() const
|
||||
{
|
||||
return rho_;
|
||||
}
|
||||
|
||||
|
||||
const volScalarField& reactingOneDim::T() const
|
||||
{
|
||||
return T_;
|
||||
}
|
||||
|
||||
|
||||
const tmp<volScalarField> reactingOneDim::Cp() const
|
||||
{
|
||||
return solidThermo_.Cp();
|
||||
}
|
||||
|
||||
|
||||
const volScalarField& reactingOneDim::kappa() const
|
||||
{
|
||||
return kappa_;
|
||||
}
|
||||
|
||||
|
||||
const volScalarField& reactingOneDim::K() const
|
||||
{
|
||||
return K_;
|
||||
}
|
||||
|
||||
|
||||
const surfaceScalarField& reactingOneDim::phiGas() const
|
||||
{
|
||||
return phiGas_;
|
||||
}
|
||||
|
||||
|
||||
void reactingOneDim::preEvolveRegion()
|
||||
{
|
||||
pyrolysisModel::preEvolveRegion();
|
||||
|
||||
// Initialise all cells as able to react
|
||||
forAll(T_, cellI)
|
||||
{
|
||||
solidChemistry_->setCellReacting(cellI, true);
|
||||
}
|
||||
|
||||
// De-activate reactions if pyrolysis region coupled to (valid) film
|
||||
if (filmCoupled_)
|
||||
{
|
||||
const volScalarField& filmDelta = filmDeltaPtr_();
|
||||
|
||||
forAll(intCoupledPatchIDs_, i)
|
||||
{
|
||||
const label patchI = intCoupledPatchIDs_[i];
|
||||
const scalarField& filmDeltap = filmDelta.boundaryField()[patchI];
|
||||
|
||||
forAll(filmDeltap, faceI)
|
||||
{
|
||||
const scalar filmDelta0 = filmDeltap[faceI];
|
||||
if (filmDelta0 > reactionDeltaMin_)
|
||||
{
|
||||
const labelList& cells = boundaryFaceCells_[faceI];
|
||||
|
||||
// TODO: only limit cell adjacent to film?
|
||||
//solidChemistry_->setCellNoReacting(cells[0])
|
||||
|
||||
// Propagate flag through 1-D region
|
||||
forAll(cells, k)
|
||||
{
|
||||
solidChemistry_->setCellReacting(cells[k], false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void reactingOneDim::evolveRegion()
|
||||
{
|
||||
const scalarField mass0 = rho_*regionMesh().V();
|
||||
|
||||
solidChemistry_->solve
|
||||
(
|
||||
time().value() - time().deltaTValue(),
|
||||
time().deltaTValue()
|
||||
);
|
||||
|
||||
solveContinuity();
|
||||
|
||||
updateMesh(mass0);
|
||||
|
||||
chemistrySh_ = solidChemistry_->Sh()();
|
||||
|
||||
updateFields();
|
||||
|
||||
solveSpeciesMass();
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr_; nonOrth++)
|
||||
{
|
||||
solveEnergy();
|
||||
}
|
||||
|
||||
calculateMassTransfer();
|
||||
|
||||
solidThermo_.correct();
|
||||
}
|
||||
|
||||
|
||||
void reactingOneDim::info() const
|
||||
{
|
||||
Info<< "\nPyrolysis: " << type() << endl;
|
||||
|
||||
Info<< indent << "Total gas mass produced [kg] = "
|
||||
<< addedGasMass_.value() << nl
|
||||
<< indent << "Total solid mass lost [kg] = "
|
||||
<< lostSolidMass_.value() << nl
|
||||
<< indent << "Total pyrolysis gases [kg/s] = "
|
||||
<< totalGasMassFlux_ << nl
|
||||
<< indent << "Total heat release rate [J/s] = "
|
||||
<< totalHeatRR_.value() << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
} // End namespace regionModels
|
||||
} // End namespace pyrolysisModels
|
||||
|
||||
// ************************************************************************* //
|
||||
284
src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H
Normal file
284
src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H
Normal file
@ -0,0 +1,284 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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::reactingOneDim
|
||||
|
||||
Description
|
||||
Reacting, 1-D pyrolysis model
|
||||
|
||||
SourceFiles
|
||||
reactingOneDim.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef reactingOneDim_H
|
||||
#define reactingOneDim_H
|
||||
|
||||
#include "pyrolysisModel.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace pyrolysisModels
|
||||
{
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class reactingOneDim Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class reactingOneDim
|
||||
:
|
||||
public pyrolysisModel
|
||||
{
|
||||
private:
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
reactingOneDim(const reactingOneDim&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const reactingOneDim&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Reference to the solid chemistry model
|
||||
autoPtr<solidChemistryModel> solidChemistry_;
|
||||
|
||||
//- Reference to solid thermo
|
||||
basicSolidThermo& solidThermo_;
|
||||
|
||||
|
||||
// Reference to solid thermo properties
|
||||
|
||||
//- Absorption coefficient [1/m]
|
||||
const volScalarField& kappa_;
|
||||
|
||||
//- Thermal conductivity [W/m/K]
|
||||
const volScalarField& K_;
|
||||
|
||||
//- Density [kg/m3]
|
||||
volScalarField& rho_;
|
||||
|
||||
//- List of solid components
|
||||
PtrList<volScalarField>& Ys_;
|
||||
|
||||
// Non-const access to temperature
|
||||
volScalarField& T_;
|
||||
|
||||
|
||||
//- Name of the radiative flux in the primary region
|
||||
word primaryRadFluxName_;
|
||||
|
||||
|
||||
// Solution parameters
|
||||
|
||||
//- Number of non-orthogonal correctors
|
||||
label nNonOrthCorr_;
|
||||
|
||||
//- Maximum diffussivity
|
||||
scalar maxDiff_;
|
||||
|
||||
//- Minimum delta for combustion
|
||||
scalar minimumDelta_;
|
||||
|
||||
|
||||
// Fields
|
||||
|
||||
//- Total gas mass flux to the primary region [kg/m2/s]
|
||||
surfaceScalarField phiGas_;
|
||||
|
||||
//- Sensible enthalpy gas flux [J/m2/s]
|
||||
volScalarField phiHsGas_;
|
||||
|
||||
//- Heat release [J/s/m3]
|
||||
volScalarField chemistrySh_;
|
||||
|
||||
|
||||
// Source term fields
|
||||
|
||||
//- Coupled region radiative heat flux [W/m2]
|
||||
// Requires user to input mapping info for coupled patches
|
||||
volScalarField QrCoupled_;
|
||||
|
||||
//- In depth radiative heat flux [W/m2]
|
||||
volScalarField Qr_;
|
||||
|
||||
|
||||
// Checks
|
||||
|
||||
//- Cumulative lost mass of the condensed phase [kg]
|
||||
dimensionedScalar lostSolidMass_;
|
||||
|
||||
//- Cumulative mass generation of the gas phase [kg]
|
||||
dimensionedScalar addedGasMass_;
|
||||
|
||||
//- Total mass gas flux at the pyrolysing walls [kg/s]
|
||||
scalar totalGasMassFlux_;
|
||||
|
||||
//- Total heat release rate [J/s]
|
||||
dimensionedScalar totalHeatRR_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Read control parameters from dictionary
|
||||
bool read();
|
||||
|
||||
//- Update submodels
|
||||
void updateFields();
|
||||
|
||||
//- Update/move mesh based on change in mass
|
||||
void updateMesh(const scalarField& mass0);
|
||||
|
||||
//- Update radiative flux in pyrolysis region
|
||||
void updateQr();
|
||||
|
||||
//- Update enthalpy flux for pyrolysis gases
|
||||
void updatePhiGas();
|
||||
|
||||
//- Mass check
|
||||
void calculateMassTransfer();
|
||||
|
||||
|
||||
// Equations
|
||||
|
||||
//- Solve continuity equation
|
||||
void solveContinuity();
|
||||
|
||||
//- Solve energy
|
||||
void solveEnergy();
|
||||
|
||||
//- Solve solid species mass conservation
|
||||
void solveSpeciesMass();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("reactingOneDim");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from type name and mesh
|
||||
reactingOneDim(const word& modelType, const fvMesh& mesh);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~reactingOneDim();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Fields
|
||||
|
||||
//- Return density [kg/m3]
|
||||
virtual const volScalarField& rho() const;
|
||||
|
||||
//- Return const temperature [K]
|
||||
virtual const volScalarField& T() const;
|
||||
|
||||
//- Return specific heat capacity [J/kg/K]
|
||||
virtual const tmp<volScalarField> Cp() const;
|
||||
|
||||
//- Return the region absorptivity [1/m]
|
||||
virtual const volScalarField& kappa() const;
|
||||
|
||||
//- Return the region thermal conductivity [W/m/k]
|
||||
virtual const volScalarField& K() const;
|
||||
|
||||
//- Return the total gas mass flux to primary region [kg/m2/s]
|
||||
virtual const surfaceScalarField& phiGas() const;
|
||||
|
||||
|
||||
// Solution parameters
|
||||
|
||||
//- Return the number of non-orthogonal correctors
|
||||
inline label nNonOrthCorr() const;
|
||||
|
||||
//- Return max diffusivity allowed in the solid
|
||||
virtual scalar maxDiff() const;
|
||||
|
||||
|
||||
// Helper functions
|
||||
|
||||
//- External hook to add mass to the primary region
|
||||
virtual scalar addMassSources
|
||||
(
|
||||
const label patchI, // patchI on primary region
|
||||
const label faceI // faceI of patchI
|
||||
);
|
||||
|
||||
//- Mean diffusion number of the solid region
|
||||
virtual scalar solidRegionDiffNo() const;
|
||||
|
||||
|
||||
// Source fields (read/write access)
|
||||
|
||||
//- In depth radiative heat flux
|
||||
inline const volScalarField& Qr() const;
|
||||
|
||||
|
||||
// Evolution
|
||||
|
||||
//- Pre-evolve region
|
||||
virtual void preEvolveRegion();
|
||||
|
||||
//- Evolve the pyrolysis equations
|
||||
virtual void evolveRegion();
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Provide some feedback
|
||||
virtual void info() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace pyrolysisModels
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "reactingOneDimI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,44 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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 "reactingOneDim.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::label
|
||||
Foam::regionModels::pyrolysisModels::reactingOneDim::nNonOrthCorr() const
|
||||
{
|
||||
return nNonOrthCorr_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::volScalarField&
|
||||
Foam::regionModels::pyrolysisModels::reactingOneDim::Qr() const
|
||||
{
|
||||
return Qr_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
5
src/regionModels/regionCoupling/Make/files
Normal file
5
src/regionModels/regionCoupling/Make/files
Normal file
@ -0,0 +1,5 @@
|
||||
derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C
|
||||
derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.C
|
||||
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libregionCoupling
|
||||
29
src/regionModels/regionCoupling/Make/options
Normal file
29
src/regionModels/regionCoupling/Make/options
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solid/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solidChemistryModel/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
|
||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
||||
-I$(LIB_SRC)/regionModels/pyrolysisModels/lnInclude \
|
||||
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
|
||||
|
||||
|
||||
EXE_LIBS = \
|
||||
-lregionModels \
|
||||
-lpyrolysisModels \
|
||||
-lsurfaceFilmModels \
|
||||
-lsolidChemistryModel \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lcompressibleRASModels \
|
||||
-lcompressibleLESModels
|
||||
@ -0,0 +1,213 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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 "filmPyrolysisTemperatureCoupledFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "pyrolysisModel.H"
|
||||
#include "surfaceFilmModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
phiName_("phi"),
|
||||
rhoName_("rho"),
|
||||
deltaWet_(1e-6)
|
||||
{}
|
||||
|
||||
|
||||
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const filmPyrolysisTemperatureCoupledFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
deltaWet_(ptf.deltaWet_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
deltaWet_(dict.lookupOrDefault<scalar>("deltaWet", 1e-6))
|
||||
{
|
||||
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
|
||||
}
|
||||
|
||||
|
||||
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const filmPyrolysisTemperatureCoupledFvPatchScalarField& fptpsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(fptpsf),
|
||||
phiName_(fptpsf.phiName_),
|
||||
rhoName_(fptpsf.rhoName_),
|
||||
deltaWet_(fptpsf.deltaWet_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const filmPyrolysisTemperatureCoupledFvPatchScalarField& fptpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(fptpsf, iF),
|
||||
phiName_(fptpsf.phiName_),
|
||||
rhoName_(fptpsf.rhoName_),
|
||||
deltaWet_(fptpsf.deltaWet_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
typedef regionModels::surfaceFilmModels::surfaceFilmModel filmModelType;
|
||||
typedef regionModels::pyrolysisModels::pyrolysisModel pyrModelType;
|
||||
|
||||
bool filmOk =
|
||||
db().objectRegistry::foundObject<filmModelType>
|
||||
(
|
||||
"surfaceFilmProperties"
|
||||
);
|
||||
|
||||
|
||||
bool pyrOk =
|
||||
db().objectRegistry::foundObject<pyrModelType>
|
||||
(
|
||||
"pyrolysisProperties"
|
||||
);
|
||||
|
||||
if (!filmOk || !pyrOk)
|
||||
{
|
||||
// do nothing on construction - film model doesn't exist yet
|
||||
return;
|
||||
}
|
||||
|
||||
scalarField& Tp = *this;
|
||||
|
||||
const label patchI = patch().index();
|
||||
|
||||
// Retrieve film model
|
||||
const filmModelType& filmModel =
|
||||
db().lookupObject<filmModelType>("surfaceFilmProperties");
|
||||
|
||||
const label filmPatchI = filmModel.regionPatchID(patchI);
|
||||
|
||||
const mapDistribute& filmMap = filmModel.mappedPatches()[filmPatchI].map();
|
||||
|
||||
scalarField deltaFilm = filmModel.delta().boundaryField()[filmPatchI];
|
||||
filmMap.distribute(deltaFilm);
|
||||
|
||||
scalarField TFilm = filmModel.Ts().boundaryField()[filmPatchI];
|
||||
filmMap.distribute(TFilm);
|
||||
|
||||
|
||||
// Retrieve pyrolysis model
|
||||
const pyrModelType& pyrModel =
|
||||
db().lookupObject<pyrModelType>("pyrolysisProperties");
|
||||
|
||||
const label pyrPatchI = pyrModel.regionPatchID(patchI);
|
||||
|
||||
const mapDistribute& pyrMap = pyrModel.mappedPatches()[pyrPatchI].map();
|
||||
|
||||
scalarField TPyr = pyrModel.T().boundaryField()[pyrPatchI];
|
||||
pyrMap.distribute(TPyr);
|
||||
|
||||
|
||||
forAll(deltaFilm, i)
|
||||
{
|
||||
if (deltaFilm[i] > deltaWet_)
|
||||
{
|
||||
// temperature set by film
|
||||
Tp[i] = TFilm[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
// temperature set by pyrolysis model
|
||||
Tp[i] = TPyr[i];
|
||||
}
|
||||
}
|
||||
|
||||
fixedValueFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
os.writeKeyword("deltaWet") << deltaWet_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,183 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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::filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
|
||||
Description
|
||||
Temperature boundary condition for patches on the primary region:
|
||||
|
||||
- where the film height > height threshold value:
|
||||
apply film surface temperature values
|
||||
- else
|
||||
apply pyrolysis surface temperature values
|
||||
|
||||
SourceFiles
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef filmPyrolysisTemperatureCoupledFvPatchScalarField_H
|
||||
#define filmPyrolysisTemperatureCoupledFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class filmPyrolysisTemperatureCoupledFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of flux field
|
||||
word phiName_;
|
||||
|
||||
//- Name of density field
|
||||
word rhoName_;
|
||||
|
||||
//- Film height threshold beyond which it is considered 'wet'
|
||||
scalar deltaWet_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("filmPyrolysisTemperatureCoupled");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// filmPyrolysisTemperatureCoupledFvPatchScalarField onto a new patch
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const filmPyrolysisTemperatureCoupledFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const filmPyrolysisTemperatureCoupledFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new filmPyrolysisTemperatureCoupledFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const filmPyrolysisTemperatureCoupledFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new filmPyrolysisTemperatureCoupledFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the name of phi
|
||||
const word& phiName() const
|
||||
{
|
||||
return phiName_;
|
||||
}
|
||||
|
||||
//- Return reference to the name of phi to allow adjustment
|
||||
word& phiName()
|
||||
{
|
||||
return phiName_;
|
||||
}
|
||||
|
||||
//- Return the name of rho
|
||||
const word& rhoName() const
|
||||
{
|
||||
return rhoName_;
|
||||
}
|
||||
|
||||
//- Return reference to the name of rho to allow adjustment
|
||||
word& rhoName()
|
||||
{
|
||||
return rhoName_;
|
||||
}
|
||||
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,248 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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 "filmPyrolysisVelocityCoupledFvPatchVectorField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "pyrolysisModel.H"
|
||||
#include "surfaceFilmModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(p, iF),
|
||||
phiName_("phi"),
|
||||
rhoName_("rho"),
|
||||
deltaWet_(1e-6)
|
||||
{}
|
||||
|
||||
|
||||
Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const filmPyrolysisVelocityCoupledFvPatchVectorField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(ptf, p, iF, mapper),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
deltaWet_(ptf.deltaWet_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(p, iF),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
deltaWet_(dict.lookupOrDefault<scalar>("deltaWet", 1e-6))
|
||||
{
|
||||
fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
|
||||
}
|
||||
|
||||
|
||||
Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const filmPyrolysisVelocityCoupledFvPatchVectorField& fpvpvf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(fpvpvf),
|
||||
phiName_(fpvpvf.phiName_),
|
||||
rhoName_(fpvpvf.rhoName_),
|
||||
deltaWet_(fpvpvf.deltaWet_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const filmPyrolysisVelocityCoupledFvPatchVectorField& fpvpvf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(fpvpvf, iF),
|
||||
phiName_(fpvpvf.phiName_),
|
||||
rhoName_(fpvpvf.rhoName_),
|
||||
deltaWet_(fpvpvf.deltaWet_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
typedef regionModels::surfaceFilmModels::surfaceFilmModel filmModelType;
|
||||
typedef regionModels::pyrolysisModels::pyrolysisModel pyrModelType;
|
||||
|
||||
bool filmOk =
|
||||
db().objectRegistry::foundObject<filmModelType>
|
||||
(
|
||||
"surfaceFilmProperties"
|
||||
);
|
||||
|
||||
|
||||
bool pyrOk =
|
||||
db().objectRegistry::foundObject<pyrModelType>
|
||||
(
|
||||
"pyrolysisProperties"
|
||||
);
|
||||
|
||||
if (!filmOk || !pyrOk)
|
||||
{
|
||||
// do nothing on construction - film model doesn't exist yet
|
||||
return;
|
||||
}
|
||||
|
||||
vectorField& Up = *this;
|
||||
|
||||
const label patchI = patch().index();
|
||||
|
||||
// Retrieve film model
|
||||
const filmModelType& filmModel =
|
||||
db().objectRegistry::lookupObject<filmModelType>
|
||||
(
|
||||
"surfaceFilmProperties"
|
||||
);
|
||||
|
||||
const label filmPatchI = filmModel.regionPatchID(patchI);
|
||||
|
||||
const mapDistribute& filmMap = filmModel.mappedPatches()[filmPatchI].map();
|
||||
|
||||
scalarField deltaFilm = filmModel.delta().boundaryField()[filmPatchI];
|
||||
filmMap.distribute(deltaFilm);
|
||||
|
||||
vectorField UFilm = filmModel.Us().boundaryField()[filmPatchI];
|
||||
filmMap.distribute(UFilm);
|
||||
|
||||
|
||||
// Retrieve pyrolysis model
|
||||
const pyrModelType& pyrModel =
|
||||
db().objectRegistry::lookupObject<pyrModelType>
|
||||
(
|
||||
"pyrolysisProperties"
|
||||
);
|
||||
|
||||
const label pyrPatchI = pyrModel.regionPatchID(patchI);
|
||||
|
||||
const mapDistribute& pyrMap = pyrModel.mappedPatches()[pyrPatchI].map();
|
||||
|
||||
scalarField phiPyr = pyrModel.phiGas().boundaryField()[pyrPatchI];
|
||||
pyrMap.distribute(phiPyr);
|
||||
|
||||
|
||||
const surfaceScalarField& phi =
|
||||
db().lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
phiPyr /= rhop;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs()"
|
||||
) << "Unable to process flux field phi with dimensions "
|
||||
<< phi.dimensions() << nl
|
||||
<< " on patch " << patch().name()
|
||||
<< " of field " << dimensionedInternalField().name()
|
||||
<< " in file " << dimensionedInternalField().objectPath()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
const scalarField UAvePyr = -phiPyr/patch().magSf();
|
||||
const vectorField& nf = patch().nf();
|
||||
|
||||
forAll(deltaFilm, i)
|
||||
{
|
||||
if (deltaFilm[i] > deltaWet_)
|
||||
{
|
||||
// velocity set by film
|
||||
Up[i] = UFilm[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
// velocity set by pyrolysis model
|
||||
Up[i] = UAvePyr[i]*nf[i];
|
||||
}
|
||||
}
|
||||
|
||||
fixedValueFvPatchVectorField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
fvPatchVectorField::write(os);
|
||||
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
os.writeKeyword("deltaWet") << deltaWet_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchVectorField,
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,183 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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::filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
|
||||
Description
|
||||
Velocity boundary condition for patches on the primary region:
|
||||
|
||||
- where the film height > height threshold value:
|
||||
apply film surface velocity values
|
||||
- else
|
||||
apply pyrolysis out-gassing velocity values
|
||||
|
||||
SourceFiles
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef filmPyrolysisVelocityCoupledFvPatchVectorField_H
|
||||
#define filmPyrolysisVelocityCoupledFvPatchVectorField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class filmPyrolysisVelocityCoupledFvPatchVectorField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
:
|
||||
public fixedValueFvPatchVectorField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of flux field
|
||||
word phiName_;
|
||||
|
||||
//- Name of density field
|
||||
word rhoName_;
|
||||
|
||||
//- Film height threshold beyond which it is considered 'wet'
|
||||
scalar deltaWet_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("filmPyrolysisVelocityCoupled");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// filmPyrolysisVelocityCoupledFvPatchVectorField onto a new patch
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const filmPyrolysisVelocityCoupledFvPatchVectorField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const filmPyrolysisVelocityCoupledFvPatchVectorField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchVectorField> clone() const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new filmPyrolysisVelocityCoupledFvPatchVectorField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const filmPyrolysisVelocityCoupledFvPatchVectorField&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchVectorField> clone
|
||||
(
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new filmPyrolysisVelocityCoupledFvPatchVectorField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the name of phi
|
||||
const word& phiName() const
|
||||
{
|
||||
return phiName_;
|
||||
}
|
||||
|
||||
//- Return reference to the name of phi to allow adjustment
|
||||
word& phiName()
|
||||
{
|
||||
return phiName_;
|
||||
}
|
||||
|
||||
//- Return the name of rho
|
||||
const word& rhoName() const
|
||||
{
|
||||
return rhoName_;
|
||||
}
|
||||
|
||||
//- Return reference to the name of rho to allow adjustment
|
||||
word& rhoName()
|
||||
{
|
||||
return rhoName_;
|
||||
}
|
||||
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -18,6 +18,9 @@ wmake $makeType SLGThermo
|
||||
|
||||
# Should be combined with solids&solidMixture
|
||||
wmake $makeType basicSolidThermo
|
||||
wmake $makeType solidChemistryModel
|
||||
|
||||
wmake $makeType combustionModels
|
||||
|
||||
wmake $makeType radiationModels
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -33,7 +33,7 @@ template<class CompType, class ThermoType>
|
||||
Foam::ODEChemistryModel<CompType, ThermoType>::ODEChemistryModel
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& compTypeName,
|
||||
const word& ODEModelName,
|
||||
const word& thermoTypeName
|
||||
)
|
||||
:
|
||||
@ -56,16 +56,6 @@ Foam::ODEChemistryModel<CompType, ThermoType>::ODEChemistryModel
|
||||
nSpecie_(Y_.size()),
|
||||
nReaction_(reactions_.size()),
|
||||
|
||||
solver_
|
||||
(
|
||||
chemistrySolver<CompType, ThermoType>::New
|
||||
(
|
||||
*this,
|
||||
compTypeName,
|
||||
thermoTypeName
|
||||
)
|
||||
),
|
||||
|
||||
RR_(nSpecie_)
|
||||
{
|
||||
// create the fields for the chemistry sources
|
||||
@ -135,6 +125,88 @@ Foam::ODEChemistryModel<CompType, ThermoType>::omega
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::omegaI
|
||||
(
|
||||
const label index,
|
||||
const scalarField& c,
|
||||
const scalar T,
|
||||
const scalar p,
|
||||
scalar& pf,
|
||||
scalar& cf,
|
||||
label& lRef,
|
||||
scalar& pr,
|
||||
scalar& cr,
|
||||
label& rRef
|
||||
) const
|
||||
{
|
||||
|
||||
const Reaction<ThermoType>& R = reactions_[index];
|
||||
scalar w = omega(R, c, T, p, pf, cf, lRef, pr, cr, rRef);
|
||||
return(w);
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
void Foam::ODEChemistryModel<CompType, ThermoType>::updateConcsInReactionI
|
||||
(
|
||||
const label index,
|
||||
const scalar dt,
|
||||
const scalar omeg,
|
||||
scalarField& c
|
||||
) const
|
||||
{
|
||||
// update species
|
||||
const Reaction<ThermoType>& R = reactions_[index];
|
||||
forAll(R.lhs(), s)
|
||||
{
|
||||
label si = R.lhs()[s].index;
|
||||
scalar sl = R.lhs()[s].stoichCoeff;
|
||||
c[si] -= dt*sl*omeg;
|
||||
c[si] = max(0.0, c[si]);
|
||||
}
|
||||
|
||||
forAll(R.rhs(), s)
|
||||
{
|
||||
label si = R.rhs()[s].index;
|
||||
scalar sr = R.rhs()[s].stoichCoeff;
|
||||
c[si] += dt*sr*omeg;
|
||||
c[si] = max(0.0, c[si]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
void Foam::ODEChemistryModel<CompType, ThermoType>::updateRRInReactionI
|
||||
(
|
||||
const label index,
|
||||
const scalar pr,
|
||||
const scalar pf,
|
||||
const scalar corr,
|
||||
const label lRef,
|
||||
const label rRef,
|
||||
simpleMatrix<scalar>& RR
|
||||
) const
|
||||
{
|
||||
const Reaction<ThermoType>& R = reactions_[index];
|
||||
forAll(R.lhs(), s)
|
||||
{
|
||||
label si = R.lhs()[s].index;
|
||||
scalar sl = R.lhs()[s].stoichCoeff;
|
||||
RR[si][rRef] -= sl*pr*corr;
|
||||
RR[si][lRef] += sl*pf*corr;
|
||||
}
|
||||
|
||||
forAll(R.rhs(), s)
|
||||
{
|
||||
label si = R.rhs()[s].index;
|
||||
scalar sr = R.rhs()[s].stoichCoeff;
|
||||
RR[si][lRef] -= sr*pf*corr;
|
||||
RR[si][rRef] += sr*pr*corr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::omega
|
||||
(
|
||||
@ -731,7 +803,7 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
|
||||
// calculate the chemical source terms
|
||||
while (timeLeft > SMALL)
|
||||
{
|
||||
tauC = solver().solve(c, Ti, pi, t, dt);
|
||||
tauC = this->solve(c, Ti, pi, t, dt);
|
||||
t += dt;
|
||||
|
||||
// update the temperature
|
||||
@ -763,4 +835,30 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
|
||||
(
|
||||
scalarField &c,
|
||||
const scalar T,
|
||||
const scalar p,
|
||||
const scalar t0,
|
||||
const scalar dt
|
||||
) const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"ODEChemistryModel::solve"
|
||||
"("
|
||||
"scalarField&, "
|
||||
"const scalar, "
|
||||
"const scalar, "
|
||||
"const scalar, "
|
||||
"const scalar"
|
||||
")"
|
||||
);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,6 +41,7 @@ SourceFiles
|
||||
#include "Reaction.H"
|
||||
#include "ODE.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "simpleMatrix.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -50,9 +51,6 @@ namespace Foam
|
||||
// Forward declaration of classes
|
||||
class fvMesh;
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
class chemistrySolver;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ODEChemistryModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -65,6 +63,9 @@ class ODEChemistryModel
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy constructor
|
||||
ODEChemistryModel(const ODEChemistryModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const ODEChemistryModel&);
|
||||
|
||||
@ -88,9 +89,6 @@ protected:
|
||||
//- Number of reactions
|
||||
label nReaction_;
|
||||
|
||||
//- Chemistry solver
|
||||
autoPtr<chemistrySolver<CompType, ThermoType> > solver_;
|
||||
|
||||
//- List of reaction rate per specie [kg/m3/s]
|
||||
PtrList<scalarField> RR_;
|
||||
|
||||
@ -114,7 +112,7 @@ public:
|
||||
ODEChemistryModel
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& compTypeName,
|
||||
const word& ODEModelName,
|
||||
const word& thermoTypeName
|
||||
);
|
||||
|
||||
@ -137,9 +135,6 @@ public:
|
||||
//- The number of reactions
|
||||
inline label nReaction() const;
|
||||
|
||||
//- Return the chemisty solver
|
||||
inline const chemistrySolver<CompType, ThermoType>& solver() const;
|
||||
|
||||
//- dc/dt = omega, rate of change in concentration, for each species
|
||||
virtual tmp<scalarField> omega
|
||||
(
|
||||
@ -164,9 +159,48 @@ public:
|
||||
label& rRef
|
||||
) const;
|
||||
|
||||
|
||||
//- Return the reaction rate for iReaction and the reference
|
||||
// species and charateristic times
|
||||
virtual scalar omegaI
|
||||
(
|
||||
label iReaction,
|
||||
const scalarField& c,
|
||||
const scalar T,
|
||||
const scalar p,
|
||||
scalar& pf,
|
||||
scalar& cf,
|
||||
label& lRef,
|
||||
scalar& pr,
|
||||
scalar& cr,
|
||||
label& rRef
|
||||
) const;
|
||||
|
||||
//- Calculates the reaction rates
|
||||
virtual void calculate();
|
||||
|
||||
//- Update concentrations in reaction i given dt and reaction rate omega
|
||||
// used by sequential solver
|
||||
void updateConcsInReactionI
|
||||
(
|
||||
const label i,
|
||||
const scalar dt,
|
||||
const scalar omega,
|
||||
scalarField& c
|
||||
) const;
|
||||
|
||||
//- Update matrix RR for reaction i. Used by EulerImplicit
|
||||
void updateRRInReactionI
|
||||
(
|
||||
const label i,
|
||||
const scalar pr,
|
||||
const scalar pf,
|
||||
const scalar corr,
|
||||
const label lRef,
|
||||
const label rRef,
|
||||
simpleMatrix<scalar>& RR
|
||||
) const;
|
||||
|
||||
|
||||
// Chemistry model functions (overriding abstract functions in
|
||||
// basicChemistryModel.H)
|
||||
@ -207,6 +241,15 @@ public:
|
||||
scalarField& dcdt,
|
||||
scalarSquareMatrix& dfdc
|
||||
) const;
|
||||
|
||||
virtual scalar solve
|
||||
(
|
||||
scalarField &c,
|
||||
const scalar T,
|
||||
const scalar p,
|
||||
const scalar t0,
|
||||
const scalar dt
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -68,14 +68,6 @@ Foam::ODEChemistryModel<CompType, ThermoType>::nReaction() const
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
inline const Foam::chemistrySolver<CompType, ThermoType>&
|
||||
Foam::ODEChemistryModel<CompType, ThermoType>::solver() const
|
||||
{
|
||||
return solver_;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
inline Foam::tmp<Foam::volScalarField>
|
||||
Foam::ODEChemistryModel<CompType, ThermoType>::RR
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -21,9 +21,6 @@ License
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
InClass
|
||||
Foam::psiChemistryModel
|
||||
|
||||
Description
|
||||
Macros for instantiating chemistry models based on compressibility and
|
||||
transport types
|
||||
@ -44,21 +41,27 @@ namespace Foam
|
||||
|
||||
#define makeChemistryModel(SS, Comp, Thermo) \
|
||||
\
|
||||
typedef SS<Comp, Thermo> SS##Comp##Thermo; \
|
||||
typedef SS<Comp, Thermo> SS##Comp##Thermo; \
|
||||
\
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
( \
|
||||
SS##Comp##Thermo, \
|
||||
#SS"<"#Comp","#Thermo">", \
|
||||
0 \
|
||||
); \
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
( \
|
||||
SS##Comp##Thermo, \
|
||||
#SS"<"#Comp","#Thermo">", \
|
||||
0 \
|
||||
);
|
||||
|
||||
|
||||
#define makeSolidChemistryModel(SS, Comp, SThermo, GThermo) \
|
||||
\
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
Comp, \
|
||||
SS##Comp##Thermo, \
|
||||
fvMesh \
|
||||
);
|
||||
typedef SS<Comp, SThermo, GThermo> SS##Comp##SThermo##GThermo; \
|
||||
\
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
( \
|
||||
SS##Comp##SThermo##GThermo, \
|
||||
#SS"<"#Comp","#SThermo","#GThermo">", \
|
||||
0 \
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,24 +32,40 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
// get model name, but do not register the dictionary
|
||||
// otherwise it is registered in the database twice
|
||||
const word userModel
|
||||
IOdictionary chemistryPropertiesDict
|
||||
(
|
||||
IOdictionary
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"chemistryProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
).lookup("psiChemistryModel")
|
||||
"chemistryProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
const word solver(chemistryPropertiesDict.lookup("chemistrySolver"));
|
||||
|
||||
wordList models = fvMeshConstructorTablePtr_->sortedToc();
|
||||
wordHashSet validModels;
|
||||
forAll(models, i)
|
||||
{
|
||||
label delim = models[i].find('<');
|
||||
validModels.insert(models[i](0, delim));
|
||||
}
|
||||
|
||||
wordHashSet::iterator solverIter = validModels.find(solver);
|
||||
if (solverIter == validModels.end())
|
||||
{
|
||||
FatalErrorIn("psiChemistryModel::New(const fvMesh&)")
|
||||
<< "Valid chemistrySolver types are:" << validModels
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
const word userModel(chemistryPropertiesDict.lookup("psiChemistryModel"));
|
||||
|
||||
// construct chemistry model type name by inserting first template argument
|
||||
const label tempOpen = userModel.find('<');
|
||||
const label tempClose = userModel.find('>');
|
||||
@ -59,7 +75,7 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
|
||||
userModel(tempOpen + 1, tempClose - tempOpen - 1);
|
||||
|
||||
const word modelType =
|
||||
className + '<' + typeName + ',' + thermoTypeName + '>';
|
||||
solver + '<' + className + '<' + typeName + ',' + thermoTypeName + ">>";
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -77,7 +93,7 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
FatalErrorIn("psiChemistryModelBase::New(const mesh&)")
|
||||
FatalErrorIn("psiChemistryModel::New(const mesh&)")
|
||||
<< "Unknown psiChemistryModel type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid psiChemistryModel types are:" << nl
|
||||
@ -86,16 +102,22 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
|
||||
}
|
||||
else
|
||||
{
|
||||
wordList models = fvMeshConstructorTablePtr_->sortedToc();
|
||||
forAll(models, i)
|
||||
wordList allModels(fvMeshConstructorTablePtr_->sortedToc());
|
||||
wordHashSet models;
|
||||
forAll(allModels, i)
|
||||
{
|
||||
models[i] = models[i].replace(typeName + ',', "");
|
||||
const label tempOpen = allModels[i].find('<');
|
||||
const label tempClose = allModels[i].rfind('>');
|
||||
word modelName =
|
||||
allModels[i](tempOpen + 1, tempClose - tempOpen - 1);
|
||||
modelName = modelName.replace(typeName + ',', "");
|
||||
models.insert(modelName);
|
||||
}
|
||||
|
||||
FatalErrorIn("psiChemistryModelBase::New(const mesh&)")
|
||||
FatalErrorIn("psiChemistryModel::New(const mesh&)")
|
||||
<< "Unknown psiChemistryModel type " << userModel
|
||||
<< nl << nl << "Valid psiChemistryModel types are:" << nl
|
||||
<< models << nl << exit(FatalError);
|
||||
<< nl << nl << "Valid psiChemistryModel types are:"
|
||||
<< models << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,24 +32,40 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
// get model name, but do not register the dictionary
|
||||
// otherwise it is registered in the database twice
|
||||
const word userModel
|
||||
IOdictionary chemistryPropertiesDict
|
||||
(
|
||||
IOdictionary
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"chemistryProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
).lookup("rhoChemistryModel")
|
||||
"chemistryProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
const word solver(chemistryPropertiesDict.lookup("chemistrySolver"));
|
||||
|
||||
wordList models = fvMeshConstructorTablePtr_->sortedToc();
|
||||
wordHashSet validModels;
|
||||
forAll(models, i)
|
||||
{
|
||||
label delim = models[i].find('<');
|
||||
validModels.insert(models[i](0, delim));
|
||||
}
|
||||
|
||||
wordHashSet::iterator solverIter = validModels.find(solver);
|
||||
if (solverIter == validModels.end())
|
||||
{
|
||||
FatalErrorIn("rhoChemistryModel::New(const fvMesh&)")
|
||||
<< "Valid chemistrySolver types are:" << validModels
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
const word userModel(chemistryPropertiesDict.lookup("rhoChemistryModel"));
|
||||
|
||||
// construct chemistry model type name by inserting first template argument
|
||||
const label tempOpen = userModel.find('<');
|
||||
const label tempClose = userModel.find('>');
|
||||
@ -59,7 +75,7 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New
|
||||
userModel(tempOpen + 1, tempClose - tempOpen - 1);
|
||||
|
||||
const word modelType =
|
||||
className + '<' + typeName + ',' + thermoTypeName + '>';
|
||||
solver + '<' + className + '<' + typeName + ',' + thermoTypeName + ">>";
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -77,7 +93,7 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
FatalErrorIn("rhoChemistryModelBase::New(const mesh&)")
|
||||
FatalErrorIn("rhoChemistryModel::New(const mesh&)")
|
||||
<< "Unknown rhoChemistryModel type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid rhoChemistryModel types are:" << nl
|
||||
@ -86,18 +102,22 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New
|
||||
}
|
||||
else
|
||||
{
|
||||
wordList models = fvMeshConstructorTablePtr_->sortedToc();
|
||||
forAll(models, i)
|
||||
wordList allModels(fvMeshConstructorTablePtr_->sortedToc());
|
||||
wordHashSet models;
|
||||
forAll(allModels, i)
|
||||
{
|
||||
models[i] = models[i].replace(typeName + ',', "");
|
||||
const label tempOpen = allModels[i].find('<');
|
||||
const label tempClose = allModels[i].rfind('>');
|
||||
word modelName =
|
||||
allModels[i](tempOpen + 1, tempClose - tempOpen - 1);
|
||||
modelName = modelName.replace(typeName + ',', "");
|
||||
models.insert(modelName);
|
||||
}
|
||||
|
||||
FatalErrorIn("rhoChemistryModelBase::New(const mesh&)")
|
||||
<< "Unknown rhoChemistryModel type "
|
||||
<< userModel << nl << nl
|
||||
<< "Valid rhoChemistryModel types are:" << nl
|
||||
<< models << nl
|
||||
<< exit(FatalError);
|
||||
FatalErrorIn("rhoChemistryModel::New(const mesh&)")
|
||||
<< "Unknown rhoChemistryModel type " << userModel
|
||||
<< nl << nl << "Valid rhoChemistryModel types are:"
|
||||
<< models << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,15 +29,16 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::EulerImplicit<CompType, ThermoType>::EulerImplicit
|
||||
template<class ODEChemistryType>
|
||||
Foam::EulerImplicit<ODEChemistryType>::EulerImplicit
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
const fvMesh& mesh,
|
||||
const word& ODEModelName,
|
||||
const word& thermoType
|
||||
)
|
||||
:
|
||||
chemistrySolver<CompType, ThermoType>(model, modelName),
|
||||
coeffsDict_(model.subDict(modelName + "Coeffs")),
|
||||
chemistrySolver<ODEChemistryType>(mesh, ODEModelName, thermoType),
|
||||
coeffsDict_(this->subDict("EulerImplicitCoeffs")),
|
||||
cTauChem_(readScalar(coeffsDict_.lookup("cTauChem"))),
|
||||
eqRateLimiter_(coeffsDict_.lookup("equilibriumRateLimiter"))
|
||||
{}
|
||||
@ -45,15 +46,15 @@ Foam::EulerImplicit<CompType, ThermoType>::EulerImplicit
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::EulerImplicit<CompType, ThermoType>::~EulerImplicit()
|
||||
template<class ODEChemistryType>
|
||||
Foam::EulerImplicit<ODEChemistryType>::~EulerImplicit()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::scalar Foam::EulerImplicit<CompType, ThermoType>::solve
|
||||
template<class ODEChemistryType>
|
||||
Foam::scalar Foam::EulerImplicit<ODEChemistryType>::solve
|
||||
(
|
||||
scalarField &c,
|
||||
const scalar T,
|
||||
@ -62,7 +63,10 @@ Foam::scalar Foam::EulerImplicit<CompType, ThermoType>::solve
|
||||
const scalar dt
|
||||
) const
|
||||
{
|
||||
const label nSpecie = this->model_.nSpecie();
|
||||
scalar pf, cf, pr, cr;
|
||||
label lRef, rRef;
|
||||
|
||||
const label nSpecie = this->nSpecie();
|
||||
simpleMatrix<scalar> RR(nSpecie, 0, 0);
|
||||
|
||||
for (label i = 0; i < nSpecie; i++)
|
||||
@ -75,17 +79,9 @@ Foam::scalar Foam::EulerImplicit<CompType, ThermoType>::solve
|
||||
RR.source()[i] = c[i]/dt;
|
||||
}
|
||||
|
||||
forAll(this->model_.reactions(), i)
|
||||
forAll(this->reactions(), i)
|
||||
{
|
||||
const Reaction<ThermoType>& R = this->model_.reactions()[i];
|
||||
|
||||
scalar pf, cf, pr, cr;
|
||||
label lRef, rRef;
|
||||
|
||||
scalar omegai = this->model_.omega
|
||||
(
|
||||
R, c, T, p, pf, cf, lRef, pr, cr, rRef
|
||||
);
|
||||
scalar omegai = this->omegaI(i, c, T, p, pf, cf, lRef, pr, cr, rRef);
|
||||
|
||||
scalar corr = 1.0;
|
||||
if (eqRateLimiter_)
|
||||
@ -100,21 +96,7 @@ Foam::scalar Foam::EulerImplicit<CompType, ThermoType>::solve
|
||||
}
|
||||
}
|
||||
|
||||
forAll(R.lhs(), specieI)
|
||||
{
|
||||
const label id = R.lhs()[specieI].index;
|
||||
const scalar sc = R.lhs()[specieI].stoichCoeff;
|
||||
RR[id][rRef] -= sc*pr*corr;
|
||||
RR[id][lRef] += sc*pf*corr;
|
||||
}
|
||||
|
||||
forAll(R.rhs(), specieI)
|
||||
{
|
||||
const label id = R.rhs()[specieI].index;
|
||||
const scalar sc = R.rhs()[specieI].stoichCoeff;
|
||||
RR[id][lRef] -= sc*pf*corr;
|
||||
RR[id][rRef] += sc*pr*corr;
|
||||
}
|
||||
this->updateRRInReactionI(i, pr, pf, corr, lRef, rRef, RR);
|
||||
}
|
||||
|
||||
|
||||
@ -131,7 +113,7 @@ Foam::scalar Foam::EulerImplicit<CompType, ThermoType>::solve
|
||||
|
||||
// estimate the next time step
|
||||
scalar tMin = GREAT;
|
||||
const label nEqns = this->model_.nEqns();
|
||||
const label nEqns = this->nEqns();
|
||||
scalarField c1(nEqns, 0.0);
|
||||
|
||||
for (label i = 0; i < nSpecie; i++)
|
||||
@ -142,7 +124,7 @@ Foam::scalar Foam::EulerImplicit<CompType, ThermoType>::solve
|
||||
c1[nSpecie+1] = p;
|
||||
|
||||
scalarField dcdt(nEqns, 0.0);
|
||||
this->model_.derivatives(0.0, c1, dcdt);
|
||||
this->derivatives(0.0, c1, dcdt);
|
||||
|
||||
const scalar sumC = sum(c);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -42,18 +42,14 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
template<class CompType, class ThermoType>
|
||||
class EulerImplicit;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class EulerImplicit Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
template<class ODEChemistryType>
|
||||
class EulerImplicit
|
||||
:
|
||||
public chemistrySolver<CompType, ThermoType>
|
||||
public chemistrySolver<ODEChemistryType>
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -81,8 +77,9 @@ public:
|
||||
//- Construct from components
|
||||
EulerImplicit
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
const fvMesh& mesh,
|
||||
const word& ODEmodelName,
|
||||
const word& thermoType
|
||||
);
|
||||
|
||||
|
||||
@ -93,7 +90,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Update the concentrations and return the chemical time
|
||||
scalar solve
|
||||
virtual scalar solve
|
||||
(
|
||||
scalarField &c,
|
||||
const scalar T,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,22 +27,23 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::chemistrySolver<CompType, ThermoType>::chemistrySolver
|
||||
template<class ODEChemistryType>
|
||||
Foam::chemistrySolver<ODEChemistryType>::chemistrySolver
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
const fvMesh& mesh,
|
||||
const word& ODEModelName,
|
||||
const word& thermoType
|
||||
)
|
||||
:
|
||||
model_(model),
|
||||
name_(modelName)
|
||||
ODEChemistryType(mesh, ODEModelName, thermoType),
|
||||
name_(ODEModelName)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::chemistrySolver<CompType, ThermoType>::~chemistrySolver()
|
||||
template<class ODEChemistryType>
|
||||
Foam::chemistrySolver<ODEChemistryType>::~chemistrySolver()
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -46,24 +46,19 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
template<class CompType, class ThermoType>
|
||||
class chemistrySolver;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class chemistrySolver Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
template<class ODEChemistryType>
|
||||
class chemistrySolver
|
||||
:
|
||||
public ODEChemistryType
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Reference to the chemistry model
|
||||
ODEChemistryModel<CompType, ThermoType>& model_;
|
||||
|
||||
//- Name of the chemistry solver
|
||||
const word name_;
|
||||
|
||||
@ -81,10 +76,11 @@ public:
|
||||
chemistrySolver,
|
||||
dictionary,
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
const fvMesh& mesh,
|
||||
const word& ODEModelName,
|
||||
const word& thermoType
|
||||
),
|
||||
(model, modelName)
|
||||
(mesh, ODEModelName, thermoType)
|
||||
);
|
||||
|
||||
|
||||
@ -93,20 +89,12 @@ public:
|
||||
//- Construct from components
|
||||
chemistrySolver
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
const fvMesh& mesh,
|
||||
const word& ODEModelName,
|
||||
const word& thermoType
|
||||
);
|
||||
|
||||
|
||||
//- Selector
|
||||
static autoPtr<chemistrySolver> New
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& compTypeName,
|
||||
const word& thermoTypeName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~chemistrySolver();
|
||||
|
||||
@ -131,46 +119,60 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define makeChemistrySolver(Comp, Thermo) \
|
||||
\
|
||||
typedef chemistrySolver<Comp, Thermo> \
|
||||
chemistrySolver##Comp##Thermo; \
|
||||
#define makeChemistrySolver(ODEChem) \
|
||||
\
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
( \
|
||||
chemistrySolver##Comp##Thermo, \
|
||||
"chemistryModel<"#Comp","#Thermo">", \
|
||||
chemistrySolver<ODEChem>, \
|
||||
"chemistrySolver<"#ODEChem">", \
|
||||
0 \
|
||||
); \
|
||||
\
|
||||
defineTemplateRunTimeSelectionTable \
|
||||
( \
|
||||
chemistrySolver##Comp##Thermo, \
|
||||
dictionary \
|
||||
);
|
||||
|
||||
|
||||
#define makeChemistrySolverType(SS, Comp, Thermo) \
|
||||
|
||||
#define makeChemistrySolverType(SS, ODEChem, Comp, Thermo) \
|
||||
\
|
||||
typedef SS<Comp, Thermo> SS##Comp##Thermo; \
|
||||
typedef SS<ODEChem<Comp, Thermo> > SS##ODEChem##Comp##Thermo; \
|
||||
\
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
( \
|
||||
SS##Comp##Thermo, \
|
||||
#SS"<"#Comp","#Thermo">", \
|
||||
SS##ODEChem##Comp##Thermo, \
|
||||
#SS"<"#ODEChem"<"#Comp","#Thermo">>", \
|
||||
0 \
|
||||
); \
|
||||
\
|
||||
chemistrySolver<Comp, Thermo>:: \
|
||||
adddictionaryConstructorToTable<SS<Comp, Thermo> > \
|
||||
add##SS##Comp##Thermo##ConstructorToTable_;
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
Comp, \
|
||||
SS##ODEChem##Comp##Thermo, \
|
||||
fvMesh \
|
||||
);
|
||||
|
||||
|
||||
#define makeSolidChemistrySolverType(SS, ODEChem, Comp, SThermo, GThermo) \
|
||||
\
|
||||
typedef SS<ODEChem<Comp, SThermo, GThermo> > \
|
||||
SS##ODEChem##Comp##SThermo##GThermo; \
|
||||
\
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
( \
|
||||
SS##ODEChem##Comp##SThermo##GThermo, \
|
||||
#SS"<"#ODEChem"<"#Comp","#SThermo","#GThermo">>", \
|
||||
0 \
|
||||
); \
|
||||
\
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
Comp, \
|
||||
SS##ODEChem##Comp##SThermo##GThermo, \
|
||||
fvMesh \
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "chemistrySolver.C"
|
||||
# include "chemistrySolverNew.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -1,80 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 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 "chemistrySolver.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::autoPtr<Foam::chemistrySolver<CompType, ThermoType> >
|
||||
Foam::chemistrySolver<CompType, ThermoType>::New
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& compTypeName,
|
||||
const word& thermoTypeName
|
||||
)
|
||||
{
|
||||
const word modelName(model.lookup("chemistrySolver"));
|
||||
|
||||
const word chemistrySolverType =
|
||||
modelName + '<' + compTypeName + ',' + thermoTypeName + '>';
|
||||
|
||||
Info<< "Selecting chemistrySolver " << modelName << endl;
|
||||
|
||||
typename dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(chemistrySolverType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
wordList models = dictionaryConstructorTablePtr_->sortedToc();
|
||||
forAll(models, i)
|
||||
{
|
||||
models[i] = models[i].replace
|
||||
(
|
||||
'<' + compTypeName + ',' + thermoTypeName + '>',
|
||||
""
|
||||
);
|
||||
}
|
||||
|
||||
FatalErrorIn
|
||||
(
|
||||
"chemistrySolver::New"
|
||||
"("
|
||||
"const ODEChemistryModel&, "
|
||||
"const word&, "
|
||||
"const word&"
|
||||
")"
|
||||
) << "Unknown chemistrySolver type "
|
||||
<< modelName << nl << nl
|
||||
<< "Valid chemistrySolver types are:" << nl
|
||||
<< models << nl << exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<chemistrySolver<CompType, ThermoType> >
|
||||
(cstrIter()(model, modelName));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,83 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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 makeChemistrySolverTypes_H
|
||||
#define makeChemistrySolverTypes_H
|
||||
|
||||
#include "chemistrySolver.H"
|
||||
|
||||
#include "ODEChemistryModel.H"
|
||||
|
||||
#include "noChemistrySolver.H"
|
||||
#include "EulerImplicit.H"
|
||||
#include "ode.H"
|
||||
#include "sequential.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define makeChemistrySolverTypes(CompChemModel,Thermo) \
|
||||
\
|
||||
typedef ODEChemistryModel<CompChemModel, Thermo> CompChemModel##Thermo; \
|
||||
\
|
||||
makeChemistrySolver(CompChemModel##Thermo); \
|
||||
\
|
||||
makeChemistrySolverType \
|
||||
( \
|
||||
noChemistrySolver, \
|
||||
ODEChemistryModel, \
|
||||
CompChemModel, \
|
||||
Thermo \
|
||||
); \
|
||||
\
|
||||
makeChemistrySolverType \
|
||||
( \
|
||||
EulerImplicit, \
|
||||
ODEChemistryModel, \
|
||||
CompChemModel, \
|
||||
Thermo \
|
||||
); \
|
||||
\
|
||||
makeChemistrySolverType \
|
||||
( \
|
||||
ode, \
|
||||
ODEChemistryModel, \
|
||||
CompChemModel, \
|
||||
Thermo \
|
||||
); \
|
||||
\
|
||||
makeChemistrySolverType \
|
||||
( \
|
||||
sequential, \
|
||||
ODEChemistryModel, \
|
||||
CompChemModel, \
|
||||
Thermo \
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,85 +23,20 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "thermoPhysicsTypes.H"
|
||||
#include "chemistrySolver.H"
|
||||
#include "makeChemistrySolverTypes.H"
|
||||
|
||||
#include "thermoPhysicsTypes.H"
|
||||
#include "psiChemistryModel.H"
|
||||
#include "rhoChemistryModel.H"
|
||||
|
||||
#include "noChemistrySolver.H"
|
||||
|
||||
#include "EulerImplicit.H"
|
||||
#include "ode.H"
|
||||
#include "sequential.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makeChemistrySolver(psiChemistryModel, gasThermoPhysics)
|
||||
makeChemistrySolverType
|
||||
(
|
||||
noChemistrySolver,
|
||||
psiChemistryModel,
|
||||
gasThermoPhysics
|
||||
)
|
||||
makeChemistrySolverType(EulerImplicit, psiChemistryModel, gasThermoPhysics)
|
||||
makeChemistrySolverType(ode, psiChemistryModel, gasThermoPhysics)
|
||||
makeChemistrySolverType(sequential, psiChemistryModel, gasThermoPhysics)
|
||||
|
||||
makeChemistrySolver(psiChemistryModel, icoPoly8ThermoPhysics)
|
||||
makeChemistrySolverType
|
||||
(
|
||||
noChemistrySolver,
|
||||
psiChemistryModel,
|
||||
icoPoly8ThermoPhysics
|
||||
)
|
||||
makeChemistrySolverType
|
||||
(
|
||||
EulerImplicit,
|
||||
psiChemistryModel,
|
||||
icoPoly8ThermoPhysics
|
||||
)
|
||||
makeChemistrySolverType(ode, psiChemistryModel, icoPoly8ThermoPhysics)
|
||||
makeChemistrySolverType
|
||||
(
|
||||
sequential,
|
||||
psiChemistryModel,
|
||||
icoPoly8ThermoPhysics
|
||||
)
|
||||
|
||||
makeChemistrySolver(rhoChemistryModel, gasThermoPhysics)
|
||||
makeChemistrySolverType
|
||||
(
|
||||
noChemistrySolver,
|
||||
rhoChemistryModel,
|
||||
gasThermoPhysics
|
||||
)
|
||||
makeChemistrySolverType(EulerImplicit, rhoChemistryModel, gasThermoPhysics)
|
||||
makeChemistrySolverType(ode, rhoChemistryModel, gasThermoPhysics)
|
||||
makeChemistrySolverType(sequential, rhoChemistryModel, gasThermoPhysics)
|
||||
|
||||
makeChemistrySolver(rhoChemistryModel, icoPoly8ThermoPhysics)
|
||||
makeChemistrySolverType
|
||||
(
|
||||
noChemistrySolver,
|
||||
rhoChemistryModel,
|
||||
icoPoly8ThermoPhysics
|
||||
)
|
||||
makeChemistrySolverType
|
||||
(
|
||||
EulerImplicit,
|
||||
rhoChemistryModel,
|
||||
icoPoly8ThermoPhysics
|
||||
)
|
||||
makeChemistrySolverType(ode, rhoChemistryModel, icoPoly8ThermoPhysics)
|
||||
makeChemistrySolverType
|
||||
(
|
||||
sequential,
|
||||
rhoChemistryModel,
|
||||
icoPoly8ThermoPhysics
|
||||
)
|
||||
makeChemistrySolverTypes(psiChemistryModel, gasThermoPhysics);
|
||||
makeChemistrySolverTypes(psiChemistryModel, icoPoly8ThermoPhysics);
|
||||
makeChemistrySolverTypes(rhoChemistryModel, gasThermoPhysics);
|
||||
makeChemistrySolverTypes(rhoChemistryModel, icoPoly8ThermoPhysics);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,28 +28,29 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::noChemistrySolver<CompType, ThermoType>::noChemistrySolver
|
||||
template<class ODEChemistryType>
|
||||
Foam::noChemistrySolver<ODEChemistryType>::noChemistrySolver
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
const fvMesh& mesh,
|
||||
const word& ODEModelName,
|
||||
const word& thermoType
|
||||
)
|
||||
:
|
||||
chemistrySolver<CompType, ThermoType>(model, modelName)
|
||||
chemistrySolver<ODEChemistryType>(mesh, ODEModelName, thermoType)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::noChemistrySolver<CompType, ThermoType>::~noChemistrySolver()
|
||||
template<class ODEChemistryType>
|
||||
Foam::noChemistrySolver<ODEChemistryType>::~noChemistrySolver()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::scalar Foam::noChemistrySolver<CompType, ThermoType>::solve
|
||||
template<class ODEChemistryType>
|
||||
Foam::scalar Foam::noChemistrySolver<ODEChemistryType>::solve
|
||||
(
|
||||
scalarField&,
|
||||
const scalar,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,18 +43,14 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
template<class CompType, class ThermoType>
|
||||
class noChemistrySolver;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class noChemistrySolver Declaration
|
||||
Class noChemistrySolver Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
template<class ODEChemistryType>
|
||||
class noChemistrySolver
|
||||
:
|
||||
public chemistrySolver<CompType, ThermoType>
|
||||
public chemistrySolver<ODEChemistryType>
|
||||
{
|
||||
|
||||
public:
|
||||
@ -69,8 +65,9 @@ public:
|
||||
//- Construct from components
|
||||
noChemistrySolver
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
const fvMesh& mesh,
|
||||
const word& ODEModelName,
|
||||
const word& thermoType
|
||||
);
|
||||
|
||||
|
||||
@ -81,7 +78,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Update the concentrations and return the chemical time
|
||||
scalar solve
|
||||
virtual scalar solve
|
||||
(
|
||||
scalarField &c,
|
||||
const scalar T,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,32 +28,33 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::ode<CompType, ThermoType>::ode
|
||||
template<class ODEChemistryType>
|
||||
Foam::ode<ODEChemistryType>::ode
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
const fvMesh& mesh,
|
||||
const word& ODEModelName,
|
||||
const word& thermoType
|
||||
)
|
||||
:
|
||||
chemistrySolver<CompType, ThermoType>(model, modelName),
|
||||
coeffsDict_(model.subDict(modelName + "Coeffs")),
|
||||
solverName_(coeffsDict_.lookup("ODESolver")),
|
||||
odeSolver_(ODESolver::New(solverName_, model)),
|
||||
chemistrySolver<ODEChemistryType>(mesh, ODEModelName, thermoType),
|
||||
coeffsDict_(this->subDict("odeCoeffs")),
|
||||
solverName_(coeffsDict_.lookup("solver")),
|
||||
odeSolver_(ODESolver::New(solverName_, *this)),
|
||||
eps_(readScalar(coeffsDict_.lookup("eps")))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::ode<CompType, ThermoType>::~ode()
|
||||
template<class ODEChemistryType>
|
||||
Foam::ode<ODEChemistryType>::~ode()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::scalar Foam::ode<CompType, ThermoType>::solve
|
||||
template<class ODEChemistryType>
|
||||
Foam::scalar Foam::ode<ODEChemistryType>::solve
|
||||
(
|
||||
scalarField& c,
|
||||
const scalar T,
|
||||
@ -62,8 +63,8 @@ Foam::scalar Foam::ode<CompType, ThermoType>::solve
|
||||
const scalar dt
|
||||
) const
|
||||
{
|
||||
label nSpecie = this->model_.nSpecie();
|
||||
scalarField c1(this->model_.nEqns(), 0.0);
|
||||
label nSpecie = this->nSpecie();
|
||||
scalarField c1(this->nEqns(), 0.0);
|
||||
|
||||
// copy the concentration, T and P to the total solve-vector
|
||||
for (label i = 0; i < nSpecie; i++)
|
||||
@ -77,7 +78,7 @@ Foam::scalar Foam::ode<CompType, ThermoType>::solve
|
||||
|
||||
odeSolver_->solve
|
||||
(
|
||||
this->model_,
|
||||
*this,
|
||||
t0,
|
||||
t0 + dt,
|
||||
c1,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,18 +43,14 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
template<class CompType, class ThermoType>
|
||||
class ode;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ode Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
template<class ODEChemistryType>
|
||||
class ode
|
||||
:
|
||||
public chemistrySolver<CompType, ThermoType>
|
||||
public chemistrySolver<ODEChemistryType>
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -78,8 +74,9 @@ public:
|
||||
//- Construct from components
|
||||
ode
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
const fvMesh& mesh,
|
||||
const word& ODEModeNewlName,
|
||||
const word& thermoType
|
||||
);
|
||||
|
||||
|
||||
@ -89,7 +86,7 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
scalar solve
|
||||
virtual scalar solve
|
||||
(
|
||||
scalarField& c,
|
||||
const scalar T,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,15 +28,16 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::sequential<CompType, ThermoType>::sequential
|
||||
template<class ODEChemistryType>
|
||||
Foam::sequential<ODEChemistryType>::sequential
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
const fvMesh& mesh,
|
||||
const word& ODEModelName,
|
||||
const word& thermoType
|
||||
)
|
||||
:
|
||||
chemistrySolver<CompType, ThermoType>(model, modelName),
|
||||
coeffsDict_(model.subDict(modelName + "Coeffs")),
|
||||
chemistrySolver<ODEChemistryType>(mesh, ODEModelName, thermoType),
|
||||
coeffsDict_(this->subDict("sequentialCoeffs")),
|
||||
cTauChem_(readScalar(coeffsDict_.lookup("cTauChem"))),
|
||||
eqRateLimiter_(coeffsDict_.lookup("equilibriumRateLimiter"))
|
||||
{}
|
||||
@ -44,15 +45,15 @@ Foam::sequential<CompType, ThermoType>::sequential
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::sequential<CompType, ThermoType>::~sequential()
|
||||
template<class ODEChemistryType>
|
||||
Foam::sequential<ODEChemistryType>::~sequential()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::scalar Foam::sequential<CompType, ThermoType>::solve
|
||||
template<class ODEChemistryType>
|
||||
Foam::scalar Foam::sequential<ODEChemistryType>::solve
|
||||
(
|
||||
scalarField &c,
|
||||
const scalar T,
|
||||
@ -66,14 +67,9 @@ Foam::scalar Foam::sequential<CompType, ThermoType>::solve
|
||||
scalar pf, cf, pb, cb;
|
||||
label lRef, rRef;
|
||||
|
||||
forAll(this->model_.reactions(), i)
|
||||
forAll(this->reactions(), i)
|
||||
{
|
||||
const Reaction<ThermoType>& R = this->model_.reactions()[i];
|
||||
|
||||
scalar omega = this->model_.omega
|
||||
(
|
||||
R, c, T, p, pf, cf, lRef, pb, cb, rRef
|
||||
);
|
||||
scalar omega = this->omegaI(i, c, T, p, pf, cf, lRef, pb, cb, rRef);
|
||||
|
||||
if (eqRateLimiter_)
|
||||
{
|
||||
@ -89,23 +85,7 @@ Foam::scalar Foam::sequential<CompType, ThermoType>::solve
|
||||
|
||||
tChemInv = max(tChemInv, mag(omega));
|
||||
|
||||
|
||||
// update species
|
||||
forAll(R.lhs(), specieI)
|
||||
{
|
||||
const label id = R.lhs()[specieI].index;
|
||||
const scalar sc = R.lhs()[specieI].stoichCoeff;
|
||||
c[id] -= dt*sc*omega;
|
||||
c[id] = max(0.0, c[id]);
|
||||
}
|
||||
|
||||
forAll(R.rhs(), specieI)
|
||||
{
|
||||
const label id = R.rhs()[specieI].index;
|
||||
const scalar sc = R.rhs()[specieI].stoichCoeff;
|
||||
c[id] += dt*sc*omega;
|
||||
c[id] = max(0.0, c[id]);
|
||||
}
|
||||
this->updateConcsInReactionI(i, dt, omega, c);
|
||||
}
|
||||
|
||||
return cTauChem_/tChemInv;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -44,18 +44,14 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
template<class CompType, class ThermoType>
|
||||
class sequential;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class sequential Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
template<class ODEChemistryType>
|
||||
class sequential
|
||||
:
|
||||
public chemistrySolver<CompType, ThermoType>
|
||||
public chemistrySolver<ODEChemistryType>
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -83,8 +79,9 @@ public:
|
||||
//- Construct from components
|
||||
sequential
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
const fvMesh& mesh,
|
||||
const word& ODEModelName,
|
||||
const word& thermoType
|
||||
);
|
||||
|
||||
|
||||
@ -95,7 +92,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Update the concentrations and return the chemical time
|
||||
scalar solve
|
||||
virtual scalar solve
|
||||
(
|
||||
scalarField &c,
|
||||
const scalar T,
|
||||
|
||||
9
src/thermophysicalModels/combustionModels/Make/files
Normal file
9
src/thermophysicalModels/combustionModels/Make/files
Normal file
@ -0,0 +1,9 @@
|
||||
combustionModel/combustionModel.C
|
||||
combustionModel/combustionModelNew.C
|
||||
|
||||
infinitelyFastChemistry/infinitelyFastChemistry.C
|
||||
|
||||
noCombustion/noCombustion.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libcombustionModels
|
||||
|
||||
9
src/thermophysicalModels/combustionModels/Make/options
Normal file
9
src/thermophysicalModels/combustionModels/Make/options
Normal file
@ -0,0 +1,9 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume
|
||||
@ -0,0 +1,153 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
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 "combustionModel.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "fvScalarMatrix.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(combustionModel, 0);
|
||||
defineRunTimeSelectionTable(combustionModel, dictionary);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::combustionModel::combustionModel
|
||||
(
|
||||
const dictionary& combustionProps,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
)
|
||||
:
|
||||
coeffs_(dictionary::null),
|
||||
thermo_(thermo),
|
||||
turbulence_(turbulence),
|
||||
mesh_(phi.mesh()),
|
||||
phi_(phi),
|
||||
rho_(rho)
|
||||
{}
|
||||
|
||||
|
||||
Foam::combustionModel::combustionModel
|
||||
(
|
||||
const word& modelType,
|
||||
const dictionary& combustionProps,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
)
|
||||
:
|
||||
coeffs_(combustionProps.subDict(modelType + "Coeffs")),
|
||||
thermo_(thermo),
|
||||
turbulence_(turbulence),
|
||||
mesh_(phi.mesh()),
|
||||
phi_(phi),
|
||||
rho_(rho)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::combustionModel::~combustionModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::combustionModel::correct()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::fvScalarMatrix> Foam::combustionModel::R
|
||||
(
|
||||
volScalarField& Y
|
||||
) const
|
||||
{
|
||||
return tmp<fvScalarMatrix>
|
||||
(
|
||||
new fvScalarMatrix(Y, dimMass/dimTime*Y.dimensions())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::combustionModel::dQ() const
|
||||
{
|
||||
return tmp<Foam::volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"dQ",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("zero", dimEnergy/dimVolume/dimTime, 0.0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::combustionModel::wFuelNorm() const
|
||||
{
|
||||
return tmp<Foam::volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"wFuelNorm",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("zero", dimMass/dimTime/pow3(dimLength), 0.0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::combustionModel::read(const dictionary& combustionProps)
|
||||
{
|
||||
coeffs_ = combustionProps.subDict(type() + "Coeffs");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,201 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
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::combustionModel
|
||||
|
||||
Description
|
||||
Base class for all non-premixed combustion models based on single step
|
||||
chemistry
|
||||
|
||||
SourceFiles
|
||||
combustionModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef combustionModel_H
|
||||
#define combustionModel_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "hsCombustionThermo.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class combustionModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class combustionModel
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Dictionary of coefficients for the particular model
|
||||
dictionary coeffs_;
|
||||
|
||||
//- Reference to the thermodynamics
|
||||
hsCombustionThermo& thermo_;
|
||||
|
||||
//- Reference to the turbulence model
|
||||
const compressible::turbulenceModel& turbulence_;
|
||||
|
||||
//- Reference to the mesh database
|
||||
const fvMesh& mesh_;
|
||||
|
||||
//- Reference to mass-flux field
|
||||
const surfaceScalarField& phi_;
|
||||
|
||||
//- Reference to the density field
|
||||
const volScalarField& rho_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
combustionModel(const combustionModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const combustionModel&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("combustionModel");
|
||||
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
combustionModel,
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& combustionProperties,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
),
|
||||
(
|
||||
combustionProperties,
|
||||
thermo,
|
||||
turbulence,
|
||||
phi,
|
||||
rho
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected combustion model
|
||||
static autoPtr<combustionModel> New
|
||||
(
|
||||
const dictionary& combustionProperties,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null from components
|
||||
combustionModel
|
||||
(
|
||||
const dictionary& combustionProps,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
combustionModel
|
||||
(
|
||||
const word& modelType,
|
||||
const dictionary& combustionProperties,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~combustionModel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access functions
|
||||
|
||||
//- Access combustion dictionary
|
||||
const dictionary coeffs() const
|
||||
{
|
||||
return coeffs_;
|
||||
}
|
||||
|
||||
|
||||
// Evolution
|
||||
|
||||
//- Correct combustion rate
|
||||
virtual void correct();
|
||||
|
||||
//- Fuel consumption rate matrix, i.e. source term for fuel equation
|
||||
virtual tmp<fvScalarMatrix> R(volScalarField& Y) const;
|
||||
|
||||
//- Heat release rate calculated from fuel consumption rate matrix
|
||||
virtual tmp<volScalarField> dQ() const;
|
||||
|
||||
//- Return normalised consumption rate of (fu - fres)
|
||||
virtual tmp<Foam::volScalarField> wFuelNorm() const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& combustionProps);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,65 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
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 "combustionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::combustionModel> Foam::combustionModel::New
|
||||
(
|
||||
const dictionary& combustionProperties,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
)
|
||||
{
|
||||
word combustionModelTypeName = combustionProperties.lookup
|
||||
(
|
||||
"combustionModel"
|
||||
);
|
||||
|
||||
Info<< "Selecting combustion model " << combustionModelTypeName << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(combustionModelTypeName);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"combustionModel::New"
|
||||
) << "Unknown combustionModel type "
|
||||
<< combustionModelTypeName << endl << endl
|
||||
<< "Valid combustionModels are : " << endl
|
||||
<< dictionaryConstructorTablePtr_->toc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<combustionModel>
|
||||
(cstrIter()(combustionProperties, thermo, turbulence, phi, rho));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,151 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
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 "infinitelyFastChemistry.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvmSup.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace combustionModels
|
||||
{
|
||||
defineTypeNameAndDebug(infinitelyFastChemistry, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
combustionModel,
|
||||
infinitelyFastChemistry,
|
||||
dictionary
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::combustionModels::infinitelyFastChemistry::infinitelyFastChemistry
|
||||
(
|
||||
const dictionary& combustionProps,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
)
|
||||
:
|
||||
combustionModel(typeName, combustionProps, thermo, turbulence, phi, rho),
|
||||
C_(readScalar(coeffs_.lookup("C"))),
|
||||
singleMixture_
|
||||
(
|
||||
dynamic_cast<singleStepReactingMixture<gasThermoPhysics>&>(thermo)
|
||||
),
|
||||
wFuelNorm_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"wFuelNorm",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("zero", dimMass/pow3(dimLength)/dimTime, 0.0)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::combustionModels::infinitelyFastChemistry::~infinitelyFastChemistry()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::combustionModels::infinitelyFastChemistry::correct()
|
||||
{
|
||||
singleMixture_.fresCorrect();
|
||||
|
||||
const label fuelI = singleMixture_.fuelIndex();
|
||||
|
||||
const volScalarField& YFuel = thermo_.composition().Y()[fuelI];
|
||||
|
||||
const dimensionedScalar s = singleMixture_.s();
|
||||
|
||||
if (thermo_.composition().contains("O2"))
|
||||
{
|
||||
const volScalarField& YO2 = thermo_.composition().Y("O2");
|
||||
wFuelNorm_ == rho_/(mesh_.time().deltaT()*C_)*min(YFuel, YO2/s.value());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::fvScalarMatrix>
|
||||
Foam::combustionModels::infinitelyFastChemistry::R(volScalarField& Y) const
|
||||
{
|
||||
const label specieI = thermo_.composition().species()[Y.name()];
|
||||
|
||||
const label fNorm = singleMixture_.specieProd()[specieI];
|
||||
|
||||
const volScalarField fres = singleMixture_.fres(specieI);
|
||||
|
||||
const volScalarField wSpecie =
|
||||
wFuelNorm_*singleMixture_.specieStoichCoeffs()[specieI]
|
||||
/ max(fNorm*(Y - fres), 0.001);
|
||||
|
||||
return -fNorm*wSpecie*fres + fNorm*fvm::Sp(wSpecie, Y);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::combustionModels::infinitelyFastChemistry::dQ() const
|
||||
{
|
||||
const label fuelI = singleMixture_.fuelIndex();
|
||||
volScalarField& YFuel = thermo_.composition().Y(fuelI);
|
||||
|
||||
return -singleMixture_.qFuel()*(R(YFuel) & YFuel);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::combustionModels::infinitelyFastChemistry::wFuelNorm() const
|
||||
{
|
||||
return wFuelNorm_;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::combustionModels::infinitelyFastChemistry::read
|
||||
(
|
||||
const dictionary& combustionProps
|
||||
)
|
||||
{
|
||||
combustionModel::read(combustionProps);
|
||||
coeffs_.lookup("C") >> C_ ;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,135 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
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::combustionModels::infinitelyFastChemistry
|
||||
|
||||
Description
|
||||
Simple infinitely fast chemistry combustion model based on the principle
|
||||
mixed is burnt. Additional parameter C is used to distribute the heat
|
||||
release rate.in time
|
||||
|
||||
SourceFiles
|
||||
infinitelyFastChemistry.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef infinitelyFastChemistry_H
|
||||
#define infinitelyFastChemistry_H
|
||||
|
||||
#include "combustionModel.H"
|
||||
#include "singleStepReactingMixture.H"
|
||||
#include "thermoPhysicsTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace combustionModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class infinitelyFastChemistry Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class infinitelyFastChemistry
|
||||
:
|
||||
public combustionModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Model constant
|
||||
scalar C_;
|
||||
|
||||
//- Reference to singleStepReactingMixture mixture
|
||||
singleStepReactingMixture<gasThermoPhysics>& singleMixture_;
|
||||
|
||||
//- Normalised consumption rate of (fu - fres)
|
||||
volScalarField wFuelNorm_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
infinitelyFastChemistry(const infinitelyFastChemistry&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const infinitelyFastChemistry&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("infinitelyFastChemistry");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
infinitelyFastChemistry
|
||||
(
|
||||
const dictionary& combustionProps,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~infinitelyFastChemistry();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Evolution
|
||||
|
||||
//- Correct combustion rate
|
||||
virtual void correct();
|
||||
|
||||
//- Fuel consumption rate matrix, i.e. source term for fuel equation
|
||||
virtual tmp<fvScalarMatrix> R(volScalarField& Y) const;
|
||||
|
||||
//- Heat release rate calculated from fuel consumption rate matrix
|
||||
virtual tmp<volScalarField> dQ() const;
|
||||
|
||||
//- Return normalised consumption rate of (fu - fres)
|
||||
virtual tmp<volScalarField> wFuelNorm() const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& combustionProperties);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace combustionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,66 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
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 "noCombustion.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace combustionModels
|
||||
{
|
||||
defineTypeNameAndDebug(noCombustion, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
combustionModel,
|
||||
noCombustion,
|
||||
dictionary
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::combustionModels::noCombustion::noCombustion
|
||||
(
|
||||
const dictionary& combustionProps,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
)
|
||||
:
|
||||
combustionModel(combustionProps, thermo, turbulence, phi, rho)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::combustionModels::noCombustion::~noCombustion()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,96 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
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::combustionModel::noCombustion
|
||||
|
||||
Description
|
||||
Dummy combustion model for 'none' option
|
||||
|
||||
SourceFiles
|
||||
noCombustion.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef noCombustion_H
|
||||
#define noCombustion_H
|
||||
|
||||
#include "combustionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace combustionModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class noCombustion Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class noCombustion
|
||||
:
|
||||
public combustionModel
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
noCombustion(const noCombustion&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const noCombustion&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("none");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
noCombustion
|
||||
(
|
||||
const dictionary& combustionProperties,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~noCombustion();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace combustionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,6 +43,7 @@ License
|
||||
#include "dieselMixture.H"
|
||||
#include "multiComponentMixture.H"
|
||||
#include "reactingMixture.H"
|
||||
#include "singleStepReactingMixture.H"
|
||||
|
||||
#include "thermoPhysicsTypes.H"
|
||||
|
||||
@ -164,6 +165,14 @@ makeCombustionThermo
|
||||
|
||||
// Multi-component thermo
|
||||
|
||||
makeCombustionMixtureThermo
|
||||
(
|
||||
hCombustionThermo,
|
||||
hPsiMixtureThermo,
|
||||
multiComponentMixture,
|
||||
constGasThermoPhysics
|
||||
);
|
||||
|
||||
makeCombustionMixtureThermo
|
||||
(
|
||||
hCombustionThermo,
|
||||
@ -175,6 +184,14 @@ makeCombustionMixtureThermo
|
||||
|
||||
// Multi-component reaction thermo
|
||||
|
||||
makeCombustionMixtureThermo
|
||||
(
|
||||
hCombustionThermo,
|
||||
hPsiMixtureThermo,
|
||||
reactingMixture,
|
||||
constGasThermoPhysics
|
||||
);
|
||||
|
||||
makeCombustionMixtureThermo
|
||||
(
|
||||
hCombustionThermo,
|
||||
@ -183,6 +200,13 @@ makeCombustionMixtureThermo
|
||||
gasThermoPhysics
|
||||
);
|
||||
|
||||
makeCombustionMixtureThermo
|
||||
(
|
||||
hCombustionThermo,
|
||||
hPsiMixtureThermo,
|
||||
singleStepReactingMixture,
|
||||
gasThermoPhysics
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,6 +41,7 @@ License
|
||||
#include "homogeneousMixture.H"
|
||||
#include "inhomogeneousMixture.H"
|
||||
#include "veryInhomogeneousMixture.H"
|
||||
#include "singleStepReactingMixture.H"
|
||||
|
||||
#include "reactingMixture.H"
|
||||
#include "multiComponentMixture.H"
|
||||
@ -126,6 +127,14 @@ makeHsCombustionThermo
|
||||
|
||||
// Multi-component thermo
|
||||
|
||||
makeHsCombustionMixtureThermo
|
||||
(
|
||||
hsCombustionThermo,
|
||||
hsPsiMixtureThermo,
|
||||
multiComponentMixture,
|
||||
constGasThermoPhysics
|
||||
);
|
||||
|
||||
makeHsCombustionMixtureThermo
|
||||
(
|
||||
hsCombustionThermo,
|
||||
@ -137,6 +146,14 @@ makeHsCombustionMixtureThermo
|
||||
|
||||
// Multi-component reaction thermo
|
||||
|
||||
makeHsCombustionMixtureThermo
|
||||
(
|
||||
hsCombustionThermo,
|
||||
hsPsiMixtureThermo,
|
||||
reactingMixture,
|
||||
constGasThermoPhysics
|
||||
);
|
||||
|
||||
makeHsCombustionMixtureThermo
|
||||
(
|
||||
hsCombustionThermo,
|
||||
@ -145,6 +162,16 @@ makeHsCombustionMixtureThermo
|
||||
gasThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
makeHsCombustionMixtureThermo
|
||||
(
|
||||
hsCombustionThermo,
|
||||
hsPsiMixtureThermo,
|
||||
singleStepReactingMixture,
|
||||
gasThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -0,0 +1,259 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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 "singleStepReactingMixture.H"
|
||||
#include "fvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class ThermoType>
|
||||
void Foam::singleStepReactingMixture<ThermoType>::calculateqFuel()
|
||||
{
|
||||
const Reaction<ThermoType>& reaction = this->operator[](0);
|
||||
const scalar Wu = this->speciesData()[fuelIndex_].W();
|
||||
|
||||
forAll(reaction.lhs(), i)
|
||||
{
|
||||
const label specieI = reaction.lhs()[i].index;
|
||||
const scalar stoichCoeff = reaction.lhs()[i].stoichCoeff;
|
||||
specieStoichCoeffs_[specieI] = -stoichCoeff;
|
||||
qFuel_.value() += this->speciesData()[specieI].hc()*stoichCoeff/Wu;
|
||||
}
|
||||
|
||||
forAll(reaction.rhs(), i)
|
||||
{
|
||||
const label specieI = reaction.rhs()[i].index;
|
||||
const scalar stoichCoeff = reaction.rhs()[i].stoichCoeff;
|
||||
specieStoichCoeffs_[specieI] = stoichCoeff;
|
||||
qFuel_.value() -= this->speciesData()[specieI].hc()*stoichCoeff/Wu;
|
||||
specieProd_[specieI] = -1;
|
||||
}
|
||||
|
||||
Info << "Fuel heat of combustion :" << qFuel_.value() << endl;
|
||||
}
|
||||
|
||||
|
||||
template<class ThermoType>
|
||||
void Foam::singleStepReactingMixture<ThermoType>::massAndAirStoichRatios()
|
||||
{
|
||||
const label O2Index = this->species()["O2"];
|
||||
const scalar Wu = this->speciesData()[fuelIndex_].W();
|
||||
|
||||
stoicRatio_ =
|
||||
(this->speciesData()[inertIndex_].W()
|
||||
* specieStoichCoeffs_[inertIndex_]
|
||||
+ this->speciesData()[O2Index].W()
|
||||
* mag(specieStoichCoeffs_[O2Index]))
|
||||
/ (Wu*mag(specieStoichCoeffs_[fuelIndex_]));
|
||||
|
||||
s_ =
|
||||
(this->speciesData()[O2Index].W()
|
||||
* mag(specieStoichCoeffs_[O2Index]))
|
||||
/ (Wu*mag(specieStoichCoeffs_[fuelIndex_]));
|
||||
|
||||
Info << "stoichiometric air-fuel ratio :" << stoicRatio_.value() << endl;
|
||||
|
||||
Info << "stoichiometric oxygen-fuel ratio :" << s_.value() << endl;
|
||||
}
|
||||
|
||||
|
||||
template<class ThermoType>
|
||||
void Foam::singleStepReactingMixture<ThermoType>::calculateMaxProducts()
|
||||
{
|
||||
const Reaction<ThermoType>& reaction = this->operator[](0);
|
||||
|
||||
scalar Wm = 0.0;
|
||||
scalar totalMol = 0.0;
|
||||
forAll(reaction.rhs(), i)
|
||||
{
|
||||
label specieI = reaction.rhs()[i].index;
|
||||
totalMol += mag(specieStoichCoeffs_[specieI]);
|
||||
}
|
||||
|
||||
scalarList Xi(reaction.rhs().size());
|
||||
|
||||
forAll(reaction.rhs(), i)
|
||||
{
|
||||
const label specieI = reaction.rhs()[i].index;
|
||||
Xi[i] = mag(specieStoichCoeffs_[specieI])/totalMol;
|
||||
|
||||
Wm += Xi[i]*this->speciesData()[specieI].W();
|
||||
}
|
||||
|
||||
forAll(reaction.rhs(), i)
|
||||
{
|
||||
const label specieI = reaction.rhs()[i].index;
|
||||
Yprod0_[specieI] = this->speciesData()[specieI].W()/Wm*Xi[i];
|
||||
}
|
||||
|
||||
Info << "Max products: " << Yprod0_ << endl;
|
||||
|
||||
// Normalize the stoichiometric coeff to mass
|
||||
forAll(specieStoichCoeffs_, i)
|
||||
{
|
||||
specieStoichCoeffs_[i] =
|
||||
specieStoichCoeffs_[i]
|
||||
* this->speciesData()[i].W()
|
||||
/ (this->speciesData()[fuelIndex_].W()
|
||||
* mag(specieStoichCoeffs_[fuelIndex_]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class ThermoType>
|
||||
void Foam::singleStepReactingMixture<ThermoType>::fresCorrect()
|
||||
{
|
||||
const Reaction<ThermoType>& reaction = this->operator[](0);
|
||||
|
||||
label O2Index = this->species()["O2"];
|
||||
const volScalarField& YFuel = this->Y()[fuelIndex_];
|
||||
const volScalarField& YO2 = this->Y()[O2Index];
|
||||
|
||||
// reactants
|
||||
forAll(reaction.lhs(), i)
|
||||
{
|
||||
const label specieI = reaction.lhs()[i].index;
|
||||
if (specieI == fuelIndex_)
|
||||
{
|
||||
fres_[specieI] = max(YFuel - YO2/s_, 0.0);
|
||||
}
|
||||
else if (specieI == O2Index)
|
||||
{
|
||||
fres_[specieI] = max(YO2 - YFuel*s_, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// products
|
||||
forAll(reaction.rhs(), i)
|
||||
{
|
||||
const label specieI = reaction.rhs()[i].index;
|
||||
if (specieI != inertIndex_)
|
||||
{
|
||||
forAll(fres_[specieI], cellI)
|
||||
{
|
||||
if (fres_[fuelIndex_][cellI] > 0.0)
|
||||
{
|
||||
// rich mixture
|
||||
fres_[specieI][cellI] =
|
||||
Yprod0_[specieI]
|
||||
* (1.0 + YO2[cellI]/s_.value() - YFuel[cellI]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// lean mixture
|
||||
fres_[specieI][cellI] =
|
||||
Yprod0_[specieI]
|
||||
* (
|
||||
1.0
|
||||
- YO2[cellI]/s_.value()*stoicRatio_.value()
|
||||
+ YFuel[cellI]*stoicRatio_.value()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class ThermoType>
|
||||
Foam::singleStepReactingMixture<ThermoType>::singleStepReactingMixture
|
||||
(
|
||||
const dictionary& thermoDict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
reactingMixture<ThermoType>(thermoDict, mesh),
|
||||
stoicRatio_(dimensionedScalar("stoicRatio", dimless, 0.0)),
|
||||
s_(dimensionedScalar("s", dimless, 0.0)),
|
||||
qFuel_(dimensionedScalar("qFuel", sqr(dimVelocity), 0.0)),
|
||||
specieStoichCoeffs_(this->species_.size(), 0.0),
|
||||
Yprod0_(this->species_.size(), 0.0),
|
||||
fres_(Yprod0_.size()),
|
||||
inertIndex_(this->species()[thermoDict.lookup("inertSpecie")]),
|
||||
fuelIndex_(this->species()[thermoDict.lookup("fuel")]),
|
||||
specieProd_(Yprod0_.size(), 1)
|
||||
{
|
||||
if (this->size() == 1)
|
||||
{
|
||||
forAll(fres_, fresI)
|
||||
{
|
||||
IOobject header
|
||||
(
|
||||
"fres_" + this->species()[fresI],
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
);
|
||||
|
||||
fres_.set
|
||||
(
|
||||
fresI,
|
||||
new volScalarField
|
||||
(
|
||||
header,
|
||||
mesh,
|
||||
dimensionedScalar("fres" + name(fresI), dimless, 0.0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
calculateqFuel();
|
||||
|
||||
massAndAirStoichRatios();
|
||||
|
||||
calculateMaxProducts();
|
||||
|
||||
autoPtr<chemistryReader<ThermoType> >::clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"singleStepReactingMixture::<ThermoType>::singleStepReactingMixture"
|
||||
"("
|
||||
"const dictionary&, "
|
||||
"const fvMesh&"
|
||||
")"
|
||||
) << "Only one reaction required for single step reaction"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class ThermoType>
|
||||
void Foam::singleStepReactingMixture<ThermoType>::read
|
||||
(
|
||||
const dictionary& thermoDict
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,181 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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::singleStepReactingMixture
|
||||
|
||||
Description
|
||||
Single step reacting mixture
|
||||
|
||||
SourceFiles
|
||||
singleStepReactingMixture.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef singleStepReactingMixture_H
|
||||
#define singleStepReactingMixture_H
|
||||
|
||||
#include "chemistryReader.H"
|
||||
#include "reactingMixture.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class singleStepReactingMixture Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class ThermoType>
|
||||
class singleStepReactingMixture
|
||||
:
|
||||
public reactingMixture<ThermoType>
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Stoichiometric air-fuel mass ratio
|
||||
dimensionedScalar stoicRatio_;
|
||||
|
||||
//- Stoichiometric oxygen-fuel mass ratio
|
||||
dimensionedScalar s_;
|
||||
|
||||
//- Heat of combustion [J/Kg]
|
||||
dimensionedScalar qFuel_;
|
||||
|
||||
//- Stoichiometric coefficient for the reaction.
|
||||
scalarList specieStoichCoeffs_;
|
||||
|
||||
//- Mass concentrations at stoichiometric mixture for fres.
|
||||
scalarList Yprod0_;
|
||||
|
||||
//- List of components residual
|
||||
PtrList<volScalarField> fres_;
|
||||
|
||||
//- Inert specie index
|
||||
label inertIndex_;
|
||||
|
||||
//- Fuel specie index
|
||||
label fuelIndex_;
|
||||
|
||||
//- List to indicate if specie is produced/consumed
|
||||
List<int> specieProd_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
singleStepReactingMixture(const singleStepReactingMixture&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const singleStepReactingMixture&);
|
||||
|
||||
//- Calculate qFuel
|
||||
void calculateqFuel();
|
||||
|
||||
//- Calculate air/fuel and oxygen/fuel ratio
|
||||
void massAndAirStoichRatios();
|
||||
|
||||
//- Calculate maximum products at stoichiometric mixture
|
||||
void calculateMaxProducts();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- The type of thermo package this mixture is instantiated for
|
||||
typedef ThermoType thermoType;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary and mesh
|
||||
singleStepReactingMixture(const dictionary&, const fvMesh&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~singleStepReactingMixture()
|
||||
{}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Calculates the residual for all components
|
||||
void fresCorrect();
|
||||
|
||||
|
||||
// Access functions
|
||||
|
||||
//- Return the stoichiometric air-fuel mass ratio
|
||||
inline const dimensionedScalar stoicRatio() const;
|
||||
|
||||
//- Return the Stoichiometric oxygen-fuel mass ratio
|
||||
inline const dimensionedScalar s() const;
|
||||
|
||||
//- Return the heat of combustion [J/Kg]
|
||||
inline const dimensionedScalar qFuel() const;
|
||||
|
||||
//- Return the stoichiometric coefficient for the reaction
|
||||
inline const List<scalar>& specieStoichCoeffs() const;
|
||||
|
||||
//- Return the list of components residual
|
||||
inline tmp<volScalarField> fres(const label index) const;
|
||||
|
||||
//- Return the inert specie index
|
||||
inline label inertIndex() const;
|
||||
|
||||
//- Return the fuel specie index
|
||||
inline label fuelIndex() const;
|
||||
|
||||
//- Return the list to indicate if specie is produced/consumed
|
||||
inline const List<int>& specieProd() const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Read dictionary
|
||||
void read(const dictionary&);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "singleStepReactingMixtureI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "singleStepReactingMixture.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,97 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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 "singleStepReactingMixture.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class ThermoType>
|
||||
inline const Foam::dimensionedScalar
|
||||
Foam::singleStepReactingMixture<ThermoType>::stoicRatio() const
|
||||
{
|
||||
return stoicRatio_;
|
||||
}
|
||||
|
||||
|
||||
template<class ThermoType>
|
||||
inline const Foam::dimensionedScalar
|
||||
Foam::singleStepReactingMixture<ThermoType>::s() const
|
||||
{
|
||||
return s_;
|
||||
}
|
||||
|
||||
|
||||
template<class ThermoType>
|
||||
inline const Foam::dimensionedScalar
|
||||
Foam::singleStepReactingMixture<ThermoType>::qFuel() const
|
||||
{
|
||||
return qFuel_;
|
||||
}
|
||||
|
||||
|
||||
template<class ThermoType>
|
||||
inline const Foam::List<Foam::scalar>&
|
||||
Foam::singleStepReactingMixture<ThermoType>::specieStoichCoeffs() const
|
||||
{
|
||||
return specieStoichCoeffs_;
|
||||
}
|
||||
|
||||
|
||||
template<class ThermoType>
|
||||
inline Foam::tmp<Foam::volScalarField>
|
||||
Foam::singleStepReactingMixture<ThermoType>::fres
|
||||
(
|
||||
const label index
|
||||
) const
|
||||
{
|
||||
return fres_[index];
|
||||
}
|
||||
|
||||
|
||||
template<class ThermoType>
|
||||
inline Foam::label
|
||||
Foam::singleStepReactingMixture<ThermoType>::inertIndex() const
|
||||
{
|
||||
return inertIndex_;
|
||||
}
|
||||
|
||||
|
||||
template<class ThermoType>
|
||||
inline Foam::label
|
||||
Foam::singleStepReactingMixture<ThermoType>::fuelIndex() const
|
||||
{
|
||||
return fuelIndex_;
|
||||
}
|
||||
|
||||
|
||||
template<class ThermoType>
|
||||
inline const Foam::List<int>&
|
||||
Foam::singleStepReactingMixture<ThermoType>::specieProd() const
|
||||
{
|
||||
return specieProd_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,6 +43,7 @@ License
|
||||
#include "dieselMixture.H"
|
||||
#include "multiComponentMixture.H"
|
||||
#include "reactingMixture.H"
|
||||
#include "singleStepReactingMixture.H"
|
||||
|
||||
#include "thermoPhysicsTypes.H"
|
||||
|
||||
@ -127,6 +128,14 @@ makeReactionThermo
|
||||
|
||||
// Multi-component thermo
|
||||
|
||||
makeReactionMixtureThermo
|
||||
(
|
||||
hReactionThermo,
|
||||
hRhoMixtureThermo,
|
||||
multiComponentMixture,
|
||||
constGasThermoPhysics
|
||||
);
|
||||
|
||||
makeReactionMixtureThermo
|
||||
(
|
||||
hReactionThermo,
|
||||
@ -146,6 +155,14 @@ makeReactionMixtureThermo
|
||||
|
||||
// Multi-component reaction thermo
|
||||
|
||||
makeReactionMixtureThermo
|
||||
(
|
||||
hReactionThermo,
|
||||
hRhoMixtureThermo,
|
||||
reactingMixture,
|
||||
constGasThermoPhysics
|
||||
);
|
||||
|
||||
makeReactionMixtureThermo
|
||||
(
|
||||
hReactionThermo,
|
||||
@ -162,6 +179,14 @@ makeReactionMixtureThermo
|
||||
gasThermoPhysics
|
||||
);
|
||||
|
||||
makeReactionMixtureThermo
|
||||
(
|
||||
hReactionThermo,
|
||||
hRhoMixtureThermo,
|
||||
singleStepReactingMixture,
|
||||
gasThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,6 +43,7 @@ License
|
||||
#include "dieselMixture.H"
|
||||
#include "multiComponentMixture.H"
|
||||
#include "reactingMixture.H"
|
||||
#include "singleStepReactingMixture.H"
|
||||
|
||||
#include "thermoPhysicsTypes.H"
|
||||
|
||||
@ -127,6 +128,14 @@ makeHsReactionThermo
|
||||
|
||||
// Multi-component thermo
|
||||
|
||||
makeHsReactionMixtureThermo
|
||||
(
|
||||
hsReactionThermo,
|
||||
hsRhoMixtureThermo,
|
||||
multiComponentMixture,
|
||||
constGasThermoPhysics
|
||||
);
|
||||
|
||||
makeHsReactionMixtureThermo
|
||||
(
|
||||
hsReactionThermo,
|
||||
@ -146,6 +155,14 @@ makeHsReactionMixtureThermo
|
||||
|
||||
// Multi-component reaction thermo
|
||||
|
||||
makeHsReactionMixtureThermo
|
||||
(
|
||||
hsReactionThermo,
|
||||
hsRhoMixtureThermo,
|
||||
reactingMixture,
|
||||
constGasThermoPhysics
|
||||
);
|
||||
|
||||
makeHsReactionMixtureThermo
|
||||
(
|
||||
hsReactionThermo,
|
||||
@ -162,6 +179,14 @@ makeHsReactionMixtureThermo
|
||||
gasThermoPhysics
|
||||
);
|
||||
|
||||
makeHsReactionMixtureThermo
|
||||
(
|
||||
hsReactionThermo,
|
||||
hsRhoMixtureThermo,
|
||||
singleStepReactingMixture,
|
||||
gasThermoPhysics
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
8
src/thermophysicalModels/solidChemistryModel/Make/files
Normal file
8
src/thermophysicalModels/solidChemistryModel/Make/files
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
solidChemistryModel/solidChemistryModel.C
|
||||
solidChemistryModel/solidChemistryModelNew.C
|
||||
solidChemistryModel/solidChemistryModels.C
|
||||
|
||||
solidChemistrySolver/makeSolidChemistrySolvers.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libsolidChemistryModel
|
||||
15
src/thermophysicalModels/solidChemistryModel/Make/options
Normal file
15
src/thermophysicalModels/solidChemistryModel/Make/options
Normal file
@ -0,0 +1,15 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/ODE/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solid/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude
|
||||
|
||||
|
||||
LIB_LIBS = \
|
||||
-chemistryModel \
|
||||
-lfiniteVolume \
|
||||
-lODE
|
||||
@ -0,0 +1,812 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 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 "ODESolidChemistryModel.H"
|
||||
#include "reactingSolidMixture.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::
|
||||
ODESolidChemistryModel
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& compTypeName,
|
||||
const word& solidThermoName
|
||||
)
|
||||
:
|
||||
CompType(mesh, solidThermoName),
|
||||
ODE(),
|
||||
Ys_(this->solidThermo().composition().Y()),
|
||||
pyrolisisGases_
|
||||
(
|
||||
mesh.lookupObject<dictionary>
|
||||
("chemistryProperties").lookup("species")
|
||||
),
|
||||
reactions_
|
||||
(
|
||||
static_cast<const reactingSolidMixture<SolidThermo>& >
|
||||
(this->solidThermo().composition())
|
||||
),
|
||||
solidThermo_
|
||||
(
|
||||
static_cast<const reactingSolidMixture<SolidThermo>& >
|
||||
(this->solidThermo().composition()).solidData()
|
||||
),
|
||||
gasThermo_(pyrolisisGases_.size()),
|
||||
nGases_(pyrolisisGases_.size()),
|
||||
nSpecie_(Ys_.size() + nGases_),
|
||||
nSolids_(Ys_.size()),
|
||||
nReaction_(reactions_.size()),
|
||||
RRs_(nSolids_),
|
||||
RRg_(nGases_),
|
||||
Ys0_(nSolids_),
|
||||
cellCounter_(0),
|
||||
reactingCells_(mesh.nCells(), true)
|
||||
{
|
||||
// create the fields for the chemistry sources
|
||||
forAll(RRs_, fieldI)
|
||||
{
|
||||
RRs_.set
|
||||
(
|
||||
fieldI,
|
||||
new scalarField(mesh.nCells(), 0.0)
|
||||
);
|
||||
|
||||
|
||||
IOobject header
|
||||
(
|
||||
Ys_[fieldI].name() + "_0",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
// check if field exists and can be read
|
||||
if (header.headerOk())
|
||||
{
|
||||
Ys0_.set
|
||||
(
|
||||
fieldI,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
Ys_[fieldI].name() + "_0",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
volScalarField Y0Default
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Y0Default",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
Ys0_.set
|
||||
(
|
||||
fieldI,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
Ys_[fieldI].name() + "_0",
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
Y0Default
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Calculate inital values of Ysi0 = rho*delta*Yi
|
||||
Ys0_[fieldI].internalField() =
|
||||
//this->solidThermo().rho()*Ys_[fieldI]*mesh.V();
|
||||
this->solidThermo().rho()*max(Ys_[fieldI],0.001)*mesh.V();
|
||||
}
|
||||
|
||||
forAll(RRg_, fieldI)
|
||||
{
|
||||
RRg_.set(fieldI, new scalarField(mesh.nCells(), 0.0));
|
||||
}
|
||||
|
||||
dictionary thermoDict =
|
||||
mesh.lookupObject<dictionary>("chemistryProperties");
|
||||
|
||||
forAll(gasThermo_, gasI)
|
||||
{
|
||||
gasThermo_.set
|
||||
(
|
||||
gasI,
|
||||
new GasThermo(thermoDict.lookup(pyrolisisGases_[gasI]))
|
||||
);
|
||||
}
|
||||
|
||||
Info<< "ODESolidChemistryModel: Number of solids = " << nSolids_
|
||||
<< " and reactions = " << nReaction_ << endl;
|
||||
|
||||
Info<< "Number of gases from pyrolysis = " << nGases_ << endl;
|
||||
|
||||
forAll(reactions_, i)
|
||||
{
|
||||
Info<< indent << "Reaction " << i << nl << reactions_[i] << nl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::
|
||||
~ODESolidChemistryModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
Foam::scalarField Foam::
|
||||
ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega
|
||||
(
|
||||
const scalarField& c,
|
||||
const scalar T,
|
||||
const scalar p,
|
||||
const bool updateC0
|
||||
) const
|
||||
{
|
||||
scalar pf, cf, pr, cr;
|
||||
label lRef, rRef;
|
||||
|
||||
const label cellI = cellCounter_;
|
||||
|
||||
scalarField om(nEqns(), 0.0);
|
||||
|
||||
forAll(reactions_, i)
|
||||
{
|
||||
const solidReaction& R = reactions_[i];
|
||||
|
||||
scalar omegai = omega
|
||||
(
|
||||
R, c, T, 0.0, pf, cf, lRef, pr, cr, rRef
|
||||
);
|
||||
scalar rhoL = 0.0;
|
||||
forAll(R.slhs(), s)
|
||||
{
|
||||
label si = R.slhs()[s];
|
||||
om[si] -= omegai;
|
||||
rhoL = solidThermo_[si].rho(T);
|
||||
}
|
||||
scalar sr = 0.0;
|
||||
forAll(R.srhs(), s)
|
||||
{
|
||||
label si = R.srhs()[s];
|
||||
scalar rhoR = solidThermo_[si].rho(T);
|
||||
sr = rhoR/rhoL;
|
||||
om[si] += sr*omegai;
|
||||
|
||||
if (updateC0)
|
||||
{
|
||||
Ys0_[si][cellI] += sr*omegai;
|
||||
}
|
||||
}
|
||||
forAll(R.grhs(), g)
|
||||
{
|
||||
label gi = R.grhs()[g];
|
||||
om[gi + nSolids_] += (1.0 - sr)*omegai;
|
||||
}
|
||||
}
|
||||
|
||||
return om;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
Foam::scalar
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::omega
|
||||
(
|
||||
const solidReaction& R,
|
||||
const scalarField& c,
|
||||
const scalar T,
|
||||
const scalar p,
|
||||
scalar& pf,
|
||||
scalar& cf,
|
||||
label& lRef,
|
||||
scalar& pr,
|
||||
scalar& cr,
|
||||
label& rRef
|
||||
) const
|
||||
{
|
||||
scalarField c1(nSpecie_, 0.0);
|
||||
|
||||
label cellI = cellCounter_;
|
||||
|
||||
for (label i=0; i<nSpecie_; i++)
|
||||
{
|
||||
c1[i] = max(0.0, c[i]);
|
||||
}
|
||||
|
||||
scalar kf = R.kf(T, 0.0, c1);
|
||||
|
||||
scalar exponent = R.nReact();
|
||||
|
||||
const label Nl = R.slhs().size();
|
||||
|
||||
for (label s=0; s<Nl; s++)
|
||||
{
|
||||
label si = R.slhs()[s];
|
||||
|
||||
kf *=
|
||||
// pow(c1[si]/max(Ys0_[si][cellI], 0.001), exponent)
|
||||
pow(c1[si]/Ys0_[si][cellI], exponent)
|
||||
*(Ys0_[si][cellI]);
|
||||
}
|
||||
|
||||
return kf;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::derivatives
|
||||
(
|
||||
const scalar time,
|
||||
const scalarField &c,
|
||||
scalarField& dcdt
|
||||
) const
|
||||
{
|
||||
scalar T = c[nSpecie_];
|
||||
|
||||
dcdt = 0.0;
|
||||
|
||||
dcdt = omega(c, T, 0);
|
||||
|
||||
//Total mass concentration
|
||||
scalar cTot = 0.0;
|
||||
for (label i=0; i<nSolids_; i++)
|
||||
{
|
||||
cTot += c[i];
|
||||
}
|
||||
|
||||
scalar newCp = 0.0;
|
||||
scalar newhi = 0.0;
|
||||
for (label i=0; i<nSolids_; i++)
|
||||
{
|
||||
scalar dYidt = dcdt[i]/cTot;
|
||||
scalar Yi = c[i]/cTot;
|
||||
newCp += Yi*solidThermo_[i].Cp(T);
|
||||
//newhi += dYidt*solidThermo_[i].hf();
|
||||
newhi -= dYidt*solidThermo_[i].hf();
|
||||
}
|
||||
|
||||
scalar dTdt = newhi/newCp;
|
||||
scalar dtMag = min(500.0, mag(dTdt));
|
||||
dcdt[nSpecie_] = dTdt*dtMag/(mag(dTdt) + 1.0e-10);
|
||||
|
||||
// dp/dt = ...
|
||||
dcdt[nSpecie_ + 1] = 0.0;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::jacobian
|
||||
(
|
||||
const scalar t,
|
||||
const scalarField& c,
|
||||
scalarField& dcdt,
|
||||
scalarSquareMatrix& dfdc
|
||||
) const
|
||||
{
|
||||
scalar T = c[nSpecie_];
|
||||
|
||||
scalarField c2(nSpecie_, 0.0);
|
||||
|
||||
for (label i=0; i<nSolids_; i++)
|
||||
{
|
||||
c2[i] = max(c[i], 0.0);
|
||||
}
|
||||
|
||||
for (label i=0; i<nEqns(); i++)
|
||||
{
|
||||
for (label j=0; j<nEqns(); j++)
|
||||
{
|
||||
dfdc[i][j] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
// length of the first argument must be nSolids
|
||||
dcdt = omega(c2, T, 0.0);
|
||||
|
||||
for (label ri=0; ri<reactions_.size(); ri++)
|
||||
{
|
||||
const solidReaction& R = reactions_[ri];
|
||||
|
||||
scalar kf0 = R.kf(T, 0.0, c2);
|
||||
|
||||
forAll(R.slhs(), j)
|
||||
{
|
||||
label sj = R.slhs()[j];
|
||||
scalar kf = kf0;
|
||||
forAll(R.slhs(), i)
|
||||
{
|
||||
label si = R.slhs()[i];
|
||||
scalar exp = R.nReact();
|
||||
if (i == j)
|
||||
{
|
||||
if (exp < 1.0)
|
||||
{
|
||||
if (c2[si]>SMALL)
|
||||
{
|
||||
kf *= exp*pow(c2[si] + VSMALL, exp - 1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
kf = 0.0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
kf *= exp*pow(c2[si], exp - 1.0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Solid reactions have only elements on slhs"
|
||||
<< endl;
|
||||
kf = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
forAll(R.slhs(), i)
|
||||
{
|
||||
label si = R.slhs()[i];
|
||||
dfdc[si][sj] -= kf;
|
||||
}
|
||||
forAll(R.srhs(), i)
|
||||
{
|
||||
label si = R.srhs()[i];
|
||||
dfdc[si][sj] += kf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// calculate the dcdT elements numerically
|
||||
scalar delta = 1.0e-8;
|
||||
scalarField dcdT0 = omega(c2, T - delta, 0);
|
||||
scalarField dcdT1 = omega(c2, T + delta, 0);
|
||||
|
||||
for (label i=0; i<nEqns(); i++)
|
||||
{
|
||||
dfdc[i][nSpecie_] = 0.5*(dcdT1[i] - dcdT0[i])/delta;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::tc() const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"ODESolidChemistryModel::tc()"
|
||||
);
|
||||
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::Sh() const
|
||||
{
|
||||
tmp<volScalarField> tSh
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Sh",
|
||||
this->mesh_.time().timeName(),
|
||||
this->mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE,
|
||||
false
|
||||
),
|
||||
this->mesh_,
|
||||
dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
if (this->chemistry_)
|
||||
{
|
||||
scalarField& Sh = tSh();
|
||||
|
||||
forAll(Ys_, i)
|
||||
{
|
||||
forAll(Sh, cellI)
|
||||
{
|
||||
scalar hf = solidThermo_[i].hf();
|
||||
//Sh[cellI] += hf*RRs_[i][cellI];
|
||||
Sh[cellI] -= hf*RRs_[i][cellI];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tSh;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::dQ() const
|
||||
{
|
||||
tmp<volScalarField> tdQ
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"dQ",
|
||||
this->mesh_.time().timeName(),
|
||||
this->mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
this->mesh_,
|
||||
dimensionedScalar("dQ", dimEnergy/dimTime, 0.0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
if (this->chemistry_)
|
||||
{
|
||||
volScalarField& dQ = tdQ();
|
||||
dQ.dimensionedInternalField() = this->mesh_.V()*Sh()();
|
||||
}
|
||||
|
||||
return tdQ;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
Foam::label Foam::
|
||||
ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::nEqns() const
|
||||
{
|
||||
// nEqns = number of solids + gases + temperature + pressure
|
||||
return (nSpecie_ + 2);
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::
|
||||
calculate()
|
||||
{
|
||||
|
||||
const volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
this->time().timeName(),
|
||||
this->mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
this->solidThermo().rho()
|
||||
);
|
||||
|
||||
if (this->mesh().changing())
|
||||
{
|
||||
forAll(RRs_, i)
|
||||
{
|
||||
RRs_[i].setSize(rho.size());
|
||||
}
|
||||
forAll(RRg_, i)
|
||||
{
|
||||
RRg_[i].setSize(rho.size());
|
||||
}
|
||||
}
|
||||
|
||||
forAll(RRs_, i)
|
||||
{
|
||||
RRs_[i] = 0.0;
|
||||
}
|
||||
forAll(RRg_, i)
|
||||
{
|
||||
RRg_[i] = 0.0;
|
||||
}
|
||||
|
||||
if (this->chemistry_)
|
||||
{
|
||||
forAll(rho, celli)
|
||||
{
|
||||
cellCounter_ = celli;
|
||||
|
||||
const scalar delta = this->mesh().V()[celli];
|
||||
|
||||
if (reactingCells_[celli])
|
||||
{
|
||||
scalar rhoi = rho[celli];
|
||||
scalar Ti = this->solidThermo().T()[celli];
|
||||
|
||||
scalarField c(nSpecie_, 0.0);
|
||||
for (label i=0; i<nSolids_; i++)
|
||||
{
|
||||
c[i] = rhoi*Ys_[i][celli]*delta;
|
||||
}
|
||||
|
||||
const scalarField dcdt = omega(c, Ti, 0.0, true);
|
||||
|
||||
forAll(RRs_, i)
|
||||
{
|
||||
RRs_[i][celli] = dcdt[i]/delta;
|
||||
}
|
||||
|
||||
forAll(RRg_, i)
|
||||
{
|
||||
RRg_[i][celli] = dcdt[nSolids_ + i]/delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
Foam::scalar
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
|
||||
(
|
||||
const scalar t0,
|
||||
const scalar deltaT
|
||||
)
|
||||
{
|
||||
const volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
this->time().timeName(),
|
||||
this->mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
this->solidThermo().rho()
|
||||
);
|
||||
|
||||
if (this->mesh().changing())
|
||||
{
|
||||
forAll(RRs_, i)
|
||||
{
|
||||
RRs_[i].setSize(rho.size());
|
||||
}
|
||||
forAll(RRg_, i)
|
||||
{
|
||||
RRg_[i].setSize(rho.size());
|
||||
}
|
||||
}
|
||||
|
||||
forAll(RRs_, i)
|
||||
{
|
||||
RRs_[i] = 0.0;
|
||||
}
|
||||
forAll(RRg_, i)
|
||||
{
|
||||
RRg_[i] = 0.0;
|
||||
}
|
||||
|
||||
if (!this->chemistry_)
|
||||
{
|
||||
return GREAT;
|
||||
}
|
||||
|
||||
scalar deltaTMin = GREAT;
|
||||
|
||||
forAll(rho, celli)
|
||||
{
|
||||
if (reactingCells_[celli])
|
||||
{
|
||||
cellCounter_ = celli;
|
||||
|
||||
scalar rhoi = rho[celli];
|
||||
scalar Ti = this->solidThermo().T()[celli];
|
||||
|
||||
scalarField c(nSpecie_, 0.0);
|
||||
scalarField c0(nSpecie_, 0.0);
|
||||
scalarField dc(nSpecie_, 0.0);
|
||||
|
||||
scalar delta = this->mesh().V()[celli];
|
||||
|
||||
for (label i=0; i<nSolids_; i++)
|
||||
{
|
||||
c[i] = rhoi*Ys_[i][celli]*delta;
|
||||
}
|
||||
|
||||
c0 = c;
|
||||
|
||||
scalar t = t0;
|
||||
scalar tauC = this->deltaTChem_[celli];
|
||||
scalar dt = min(deltaT, tauC);
|
||||
scalar timeLeft = deltaT;
|
||||
|
||||
// calculate the chemical source terms
|
||||
while (timeLeft > SMALL)
|
||||
{
|
||||
tauC = this->solve(c, Ti, 0.0, t, dt);
|
||||
t += dt;
|
||||
|
||||
// update the temperature
|
||||
scalar cTot = 0.0;
|
||||
|
||||
//Total mass concentration
|
||||
for (label i=0; i<nSolids_; i++)
|
||||
{
|
||||
cTot += c[i];
|
||||
}
|
||||
|
||||
scalar newCp = 0.0;
|
||||
scalar newhi = 0.0;
|
||||
scalar invRho = 0.0;
|
||||
scalarList dcdt = (c - c0)/dt;
|
||||
|
||||
for (label i=0; i<nSolids_; i++)
|
||||
{
|
||||
scalar dYi = dcdt[i]/cTot;
|
||||
scalar Yi = c[i]/cTot;
|
||||
newCp += Yi*solidThermo_[i].Cp(Ti);
|
||||
//newhi += dYi*solidThermo_[i].hf();
|
||||
newhi -= dYi*solidThermo_[i].hf();
|
||||
invRho += Yi/solidThermo_[i].rho(Ti);
|
||||
}
|
||||
|
||||
scalar dTi = (newhi/newCp)*dt;
|
||||
|
||||
Ti += dTi;
|
||||
|
||||
timeLeft -= dt;
|
||||
this->deltaTChem_[celli] = tauC;
|
||||
dt = min(timeLeft, tauC);
|
||||
dt = max(dt, SMALL);
|
||||
}
|
||||
|
||||
deltaTMin = min(tauC, deltaTMin);
|
||||
dc = c - c0;
|
||||
|
||||
forAll(RRs_, i)
|
||||
{
|
||||
RRs_[i][celli] = dc[i]/(deltaT*delta);
|
||||
}
|
||||
|
||||
forAll(RRg_, i)
|
||||
{
|
||||
RRg_[i][celli] = dc[nSolids_ + i]/(deltaT*delta);
|
||||
}
|
||||
|
||||
// Update Ys0_
|
||||
dc = omega(c0, Ti, 0.0, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Don't allow the time-step to change more than a factor of 2
|
||||
deltaTMin = min(deltaTMin, 2*deltaT);
|
||||
|
||||
return deltaTMin;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo,class GasThermo>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::gasHs
|
||||
(
|
||||
const volScalarField& T,
|
||||
const label index
|
||||
) const
|
||||
{
|
||||
|
||||
tmp<volScalarField> tHs
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Hs_" + pyrolisisGases_[index],
|
||||
this->mesh_.time().timeName(),
|
||||
this->mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
this->mesh_,
|
||||
dimensionedScalar("zero", dimEnergy/dimMass, 0.0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& gasHs = tHs();
|
||||
|
||||
const GasThermo& mixture = gasThermo_[index];
|
||||
|
||||
forAll(gasHs.internalField(), cellI)
|
||||
{
|
||||
gasHs[cellI] = mixture.Hs(T[cellI]);
|
||||
}
|
||||
|
||||
return tHs;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo,class GasThermo>
|
||||
Foam::scalar
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
|
||||
(
|
||||
scalarField &c,
|
||||
const scalar T,
|
||||
const scalar p,
|
||||
const scalar t0,
|
||||
const scalar dt
|
||||
) const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"ODESolidChemistryModel::solve"
|
||||
"("
|
||||
"scalarField&, "
|
||||
"const scalar, "
|
||||
"const scalar, "
|
||||
"const scalar, "
|
||||
"const scalar"
|
||||
")"
|
||||
);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo,class GasThermo>
|
||||
void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::
|
||||
setCellReacting(const label cellI, const bool active)
|
||||
{
|
||||
reactingCells_[cellI] = active;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,290 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 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::ODESolidChemistryModel
|
||||
|
||||
Description
|
||||
Extends base chemistry model by adding a thermo package, and ODE functions.
|
||||
Introduces chemistry equation system and evaluation of chemical source
|
||||
terms.
|
||||
|
||||
SourceFiles
|
||||
ODESolidChemistryModelI.H
|
||||
ODESolidChemistryModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ODESolidChemistryModel_H
|
||||
#define ODESolidChemistryModel_H
|
||||
|
||||
#include "solidReaction.H"
|
||||
#include "ODE.H"
|
||||
#include "volFieldsFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class fvMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ODESolidChemistryModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
class ODESolidChemistryModel
|
||||
:
|
||||
public CompType,
|
||||
public ODE
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const ODESolidChemistryModel&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
//- Reference to solid mass fractions
|
||||
PtrList<volScalarField>& Ys_;
|
||||
|
||||
//- List of gas species present in reaction system
|
||||
speciesTable pyrolisisGases_;
|
||||
|
||||
//- Reactions
|
||||
const PtrList<solidReaction>& reactions_;
|
||||
|
||||
//- Thermodynamic data of solids
|
||||
const PtrList<SolidThermo>& solidThermo_;
|
||||
|
||||
//- Thermodynamic data of gases
|
||||
PtrList<GasThermo> gasThermo_;
|
||||
|
||||
//- Number of gas species
|
||||
label nGases_;
|
||||
|
||||
//- Number of components being solved by ODE
|
||||
label nSpecie_;
|
||||
|
||||
//- Number of solid components
|
||||
label nSolids_;
|
||||
|
||||
//- Number of solid reactions
|
||||
label nReaction_;
|
||||
|
||||
//- List of reaction rate per solid [kg/m3/s]
|
||||
PtrList<scalarField> RRs_;
|
||||
|
||||
//- List of reaction rate per gas [kg/m3/s]
|
||||
PtrList<scalarField> RRg_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Write access to source terms for solids
|
||||
inline PtrList<scalarField>& RRs();
|
||||
|
||||
//- Write access to source terms for gases
|
||||
inline PtrList<scalarField>& RRg();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
//- List of accumulative solid concentrations
|
||||
mutable PtrList<volScalarField> Ys0_;
|
||||
|
||||
//- Cell counter
|
||||
label cellCounter_;
|
||||
|
||||
//- List of active reacting cells
|
||||
List<bool> reactingCells_;
|
||||
|
||||
|
||||
// Private members
|
||||
|
||||
//- Set reacting status of cell, cellI
|
||||
void setCellReacting(const label cellI, const bool active);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("ODESolidChemistryModel");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
ODESolidChemistryModel
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& compTypeName,
|
||||
const word& SolidThermoName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~ODESolidChemistryModel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- The reactions
|
||||
inline const PtrList<solidReaction>& reactions() const;
|
||||
|
||||
//- Thermodynamic data of gases
|
||||
inline const PtrList<GasThermo>& gasThermo() const;
|
||||
|
||||
//- Gases table
|
||||
inline const speciesTable& gasTable() const;
|
||||
|
||||
//- The number of solids
|
||||
inline label nSpecie() const;
|
||||
|
||||
//- The number of solids
|
||||
inline label nGases() const;
|
||||
|
||||
//- The number of reactions
|
||||
inline label nReaction() const;
|
||||
|
||||
|
||||
//- dc/dt = omega, rate of change in concentration, for each species
|
||||
virtual scalarField omega
|
||||
(
|
||||
const scalarField& c,
|
||||
const scalar T,
|
||||
const scalar p,
|
||||
const bool updateC0 = false
|
||||
) const;
|
||||
|
||||
//- Return the reaction rate for reaction r and the reference
|
||||
// species and charateristic times
|
||||
virtual scalar omega
|
||||
(
|
||||
const solidReaction& r,
|
||||
const scalarField& c,
|
||||
const scalar T,
|
||||
const scalar p,
|
||||
scalar& pf,
|
||||
scalar& cf,
|
||||
label& lRef,
|
||||
scalar& pr,
|
||||
scalar& cr,
|
||||
label& rRef
|
||||
) const;
|
||||
|
||||
//- Calculates the reaction rates
|
||||
virtual void calculate();
|
||||
|
||||
|
||||
// Chemistry model functions
|
||||
|
||||
//- Return const access to the chemical source terms for solids
|
||||
inline tmp<volScalarField> RRs(const label i) const;
|
||||
|
||||
//- Return const access to the chemical source terms for gases
|
||||
inline tmp<volScalarField> RRg(const label i) const;
|
||||
|
||||
//- Return total gas source term
|
||||
inline tmp<volScalarField> RRg() const;
|
||||
|
||||
//- Return total solid source term
|
||||
inline tmp<volScalarField> RRs() const;
|
||||
|
||||
//- Return const access to the total source terms
|
||||
inline tmp<volScalarField> RR(const label i) const;
|
||||
|
||||
//- Return sensible enthalpy for gas i [J/Kg]
|
||||
virtual tmp<volScalarField> gasHs
|
||||
(
|
||||
const volScalarField& T,
|
||||
const label i
|
||||
) const;
|
||||
|
||||
//- Solve the reaction system for the given start time and time
|
||||
// step and return the characteristic time
|
||||
virtual scalar solve(const scalar t0, const scalar deltaT);
|
||||
|
||||
//- Return the chemical time scale
|
||||
virtual tmp<volScalarField> tc() const;
|
||||
|
||||
//- Return source for enthalpy equation [kg/m/s3]
|
||||
virtual tmp<volScalarField> Sh() const;
|
||||
|
||||
//- Return the heat release, i.e. enthalpy/sec [m2/s3]
|
||||
virtual tmp<volScalarField> dQ() const;
|
||||
|
||||
|
||||
// ODE functions (overriding abstract functions in ODE.H)
|
||||
|
||||
//- Number of ODE's to solve
|
||||
virtual label nEqns() const;
|
||||
|
||||
virtual void derivatives
|
||||
(
|
||||
const scalar t,
|
||||
const scalarField& c,
|
||||
scalarField& dcdt
|
||||
) const;
|
||||
|
||||
virtual void jacobian
|
||||
(
|
||||
const scalar t,
|
||||
const scalarField& c,
|
||||
scalarField& dcdt,
|
||||
scalarSquareMatrix& dfdc
|
||||
) const;
|
||||
|
||||
virtual scalar solve
|
||||
(
|
||||
scalarField &c,
|
||||
const scalar T,
|
||||
const scalar p,
|
||||
const scalar t0,
|
||||
const scalar dt
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
# include "ODESolidChemistryModelI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "ODESolidChemistryModel.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,237 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 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 "volFields.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
inline Foam::PtrList<Foam::scalarField>&
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs()
|
||||
{
|
||||
return RRs_;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
inline Foam::PtrList<Foam::scalarField>&
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg()
|
||||
{
|
||||
return RRg_;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
inline const Foam::PtrList<Foam::solidReaction>&
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo,GasThermo>::reactions() const
|
||||
{
|
||||
return reactions_;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
inline const Foam::PtrList<GasThermo>&
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::
|
||||
gasThermo() const
|
||||
{
|
||||
return gasThermo_;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
inline const Foam::speciesTable&
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::gasTable() const
|
||||
{
|
||||
return pyrolisisGases_;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
inline Foam::label
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::nSpecie() const
|
||||
{
|
||||
return nSpecie_;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
inline Foam::label
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::
|
||||
nReaction() const
|
||||
{
|
||||
return nReaction_;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
inline Foam::tmp<Foam::volScalarField>
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs
|
||||
(
|
||||
const label i
|
||||
) const
|
||||
{
|
||||
tmp<volScalarField> tRRs
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"RRs(" + Ys_[i].name() + ')',
|
||||
this->time().timeName(),
|
||||
this->mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
this->mesh(),
|
||||
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
if (this->chemistry_)
|
||||
{
|
||||
tRRs().internalField() = RRs_[i];
|
||||
tRRs().correctBoundaryConditions();
|
||||
}
|
||||
return tRRs;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
inline Foam::tmp<Foam::volScalarField>
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg
|
||||
(
|
||||
const label i
|
||||
) const
|
||||
{
|
||||
tmp<volScalarField> tRRg
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"RRg(" + this->pyrolisisGases_[i] + ')',
|
||||
this->time().timeName(),
|
||||
this->mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
this->mesh(),
|
||||
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
if (this->chemistry_)
|
||||
{
|
||||
tRRg().internalField() = RRg_[i];
|
||||
tRRg().correctBoundaryConditions();
|
||||
}
|
||||
return tRRg;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
inline Foam::tmp<Foam::volScalarField>
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg() const
|
||||
{
|
||||
tmp<volScalarField> tRRg
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"RRg",
|
||||
this->time().timeName(),
|
||||
this->mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
this->mesh(),
|
||||
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
if (this->chemistry_)
|
||||
{
|
||||
for (label i=0; i < nGases_; i++)
|
||||
{
|
||||
tRRg().internalField() += RRg_[i];
|
||||
}
|
||||
tRRg().correctBoundaryConditions();
|
||||
}
|
||||
return tRRg;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
inline Foam::tmp<Foam::volScalarField>
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs() const
|
||||
{
|
||||
tmp<volScalarField> tRRs
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"RRs",
|
||||
this->time().timeName(),
|
||||
this->mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
this->mesh(),
|
||||
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
)
|
||||
);
|
||||
|
||||
if (this->chemistry_)
|
||||
{
|
||||
for (label i=0; i < nSolids_; i++)
|
||||
{
|
||||
tRRs().internalField() += RRs_[i];
|
||||
}
|
||||
tRRs().correctBoundaryConditions();
|
||||
}
|
||||
return tRRs;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
inline Foam::tmp<Foam::volScalarField>
|
||||
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RR
|
||||
(
|
||||
const label i
|
||||
) const
|
||||
{
|
||||
notImplemented("ODESolidChemistryModel::RR(const label)");
|
||||
return (Foam::volScalarField::null());
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,57 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 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 "solidChemistryModel.H"
|
||||
#include "fvMesh.H"
|
||||
#include "Time.H"
|
||||
|
||||
/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(solidChemistryModel, 0);
|
||||
defineRunTimeSelectionTable(solidChemistryModel, fvMesh);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::solidChemistryModel::solidChemistryModel
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& solidThermoTypeName
|
||||
)
|
||||
:
|
||||
basicChemistryModel(mesh),
|
||||
solidThermo_(basicSolidThermo::New(mesh)) //, thermoTypeName))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::solidChemistryModel::~solidChemistryModel()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,168 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 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::solidChemistryModel
|
||||
|
||||
Description
|
||||
Chemistry model for solid thermodynamics
|
||||
|
||||
SourceFiles
|
||||
solidChemistryModelI.H
|
||||
solidChemistryModel.C
|
||||
newChemistrySolidModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef solidChemistryModel_H
|
||||
#define solidChemistryModel_H
|
||||
|
||||
#include "basicChemistryModel.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "basicSolidThermo.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class fvMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
class solidChemistryModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class solidChemistryModel
|
||||
:
|
||||
public basicChemistryModel
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Construct as copy (not implemented)
|
||||
solidChemistryModel(const solidChemistryModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const solidChemistryModel&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Solid thermo package
|
||||
autoPtr<basicSolidThermo> solidThermo_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("solidChemistryModel");
|
||||
|
||||
|
||||
//- Declare run-time constructor selection tables
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
solidChemistryModel,
|
||||
fvMesh,
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& compTypeName,
|
||||
const word& solidThermoTypeName
|
||||
),
|
||||
(mesh, compTypeName, solidThermoTypeName)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh and thermo type name
|
||||
solidChemistryModel
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& solidThermoTypeName
|
||||
);
|
||||
|
||||
|
||||
//- Selector
|
||||
static autoPtr<solidChemistryModel> New(const fvMesh& mesh);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~solidChemistryModel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return access to the solid thermo package
|
||||
inline basicSolidThermo& solidThermo();
|
||||
|
||||
//- Return const access to the solid thermo package
|
||||
inline const basicSolidThermo& solidThermo() const;
|
||||
|
||||
//- Return total gases mass source term [kg/m3/s]
|
||||
virtual tmp<volScalarField> RRg() const = 0;
|
||||
|
||||
//- Return total solids mass source term [kg/m3/s]
|
||||
virtual tmp<volScalarField> RRs() const = 0;
|
||||
|
||||
//- Return chemical source terms for solids [kg/m3/s]
|
||||
virtual tmp<volScalarField> RRs(const label i) const = 0;
|
||||
|
||||
//- Return chemical source terms for gases [kg/m3/s]
|
||||
virtual tmp<volScalarField> RRg(const label i) const = 0;
|
||||
|
||||
//- Return sensible enthalpy for gas i [J/Kg]
|
||||
virtual tmp<volScalarField> gasHs
|
||||
(
|
||||
const volScalarField& T,
|
||||
const label i
|
||||
) const = 0;
|
||||
|
||||
//- Return specie Table for gases
|
||||
virtual const speciesTable& gasTable() const = 0;
|
||||
|
||||
//- Set reacting status of cell, cellI
|
||||
virtual void setCellReacting(const label cellI, const bool active) = 0;
|
||||
|
||||
//- Calculates the reaction rates
|
||||
virtual void calculate() = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "solidChemistryModelI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,41 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 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 Foam::basicSolidThermo& Foam::solidChemistryModel::solidThermo()
|
||||
{
|
||||
return solidThermo_();
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::basicSolidThermo&
|
||||
Foam::solidChemistryModel::solidThermo() const
|
||||
{
|
||||
return solidThermo_();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,112 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 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 "solidChemistryModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::solidChemistryModel> Foam::solidChemistryModel::New
|
||||
(
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
IOdictionary chemistryPropertiesDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"chemistryProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
const word userModel(chemistryPropertiesDict.lookup("solidChemistryModel"));
|
||||
|
||||
const word ODEModelName(chemistryPropertiesDict.lookup("chemistrySolver"));
|
||||
const word gasThermoName(chemistryPropertiesDict.lookup("gasThermoModel"));
|
||||
|
||||
// construct chemistry model type name by inserting first template argument
|
||||
const label tempOpen = userModel.find('<');
|
||||
const label tempClose = userModel.find('>');
|
||||
|
||||
const word className = userModel(0, tempOpen);
|
||||
const word thermoTypeName =
|
||||
userModel(tempOpen + 1, tempClose - tempOpen - 1);
|
||||
|
||||
const word modelType =
|
||||
ODEModelName + '<' + className
|
||||
+ '<' + typeName + ',' + thermoTypeName + ',' + gasThermoName + ">>";
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Selecting solidChemistryModel " << modelType << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Selecting solidChemistryModel " << userModel + gasThermoName
|
||||
<< endl;
|
||||
}
|
||||
|
||||
fvMeshConstructorTable::iterator cstrIter =
|
||||
fvMeshConstructorTablePtr_->find(modelType);
|
||||
|
||||
if (cstrIter == fvMeshConstructorTablePtr_->end())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
FatalErrorIn("solidChemistryModel::New(const mesh&)")
|
||||
<< "Unknown solidChemistryModel type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid solidChemistryModel types are:" << nl
|
||||
<< fvMeshConstructorTablePtr_->sortedToc() << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
else
|
||||
{
|
||||
wordList models = fvMeshConstructorTablePtr_->sortedToc();
|
||||
forAll(models, i)
|
||||
{
|
||||
models[i] = models[i].replace(typeName + ',', "");
|
||||
}
|
||||
|
||||
FatalErrorIn("solidChemistryModel::New(const mesh&)")
|
||||
<< "Unknown solidChemistryModel type "
|
||||
<< userModel << nl << nl
|
||||
<< "Valid solidChemistryModel types are:" << nl
|
||||
<< models << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
return autoPtr<solidChemistryModel>
|
||||
(cstrIter()(mesh, ODEModelName, thermoTypeName));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,61 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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/>.
|
||||
|
||||
InClass
|
||||
Foam::solidChemistryModel
|
||||
|
||||
Description
|
||||
Creates solid chemistry model instances templated on the type of
|
||||
solid thermodynamics
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "makeChemistryModel.H"
|
||||
|
||||
#include "ODESolidChemistryModel.H"
|
||||
#include "solidChemistryModel.H"
|
||||
#include "solidThermoPhysicsTypes.H"
|
||||
#include "thermoPhysicsTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makeSolidChemistryModel
|
||||
(
|
||||
ODESolidChemistryModel,
|
||||
solidChemistryModel,
|
||||
constSolidThermoPhysics,
|
||||
gasThermoPhysics
|
||||
);
|
||||
|
||||
makeSolidChemistryModel
|
||||
(
|
||||
ODESolidChemistryModel,
|
||||
solidChemistryModel,
|
||||
expoSolidThermoPhysics,
|
||||
gasThermoPhysics
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,70 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2011 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/>.
|
||||
|
||||
Description
|
||||
Macros for instantiating solid chemistry models based on compressibility
|
||||
and transport types
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef makeSolidChemistrySolverType_H
|
||||
#define makeSolidChemistrySolverType_H
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define makeSolidChemistrySolverType(SS, ODEChem, Comp, SThermo, GThermo) \
|
||||
\
|
||||
typedef SS<ODEChem<Comp, SThermo, GThermo> > \
|
||||
SS##ODEChem##Comp##SThermo##GThermo; \
|
||||
\
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
( \
|
||||
SS##ODEChem##Comp##SThermo##GThermo, \
|
||||
#SS"<"#ODEChem"<"#Comp","#SThermo","#GThermo">>", \
|
||||
0 \
|
||||
); \
|
||||
\
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
Comp, \
|
||||
SS##ODEChem##Comp##SThermo##GThermo, \
|
||||
fvMesh \
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,73 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 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 "makeSolidChemistrySolverType.H"
|
||||
#include "solidThermoPhysicsTypes.H"
|
||||
#include "thermoPhysicsTypes.H"
|
||||
|
||||
#include "chemistrySolver.H"
|
||||
|
||||
#include "ODESolidChemistryModel.H"
|
||||
#include "solidChemistryModel.H"
|
||||
|
||||
#include "ode.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef ODESolidChemistryModel
|
||||
<solidChemistryModel, constSolidThermoPhysics, gasThermoPhysics>
|
||||
solidODEChemistryConstThermo;
|
||||
|
||||
makeChemistrySolver(solidODEChemistryConstThermo)
|
||||
|
||||
makeSolidChemistrySolverType
|
||||
(
|
||||
ode,
|
||||
ODESolidChemistryModel,
|
||||
solidChemistryModel,
|
||||
constSolidThermoPhysics,
|
||||
gasThermoPhysics
|
||||
)
|
||||
|
||||
typedef ODESolidChemistryModel
|
||||
<solidChemistryModel, expoSolidThermoPhysics, gasThermoPhysics>
|
||||
solidODEChemistryExpThermo;
|
||||
|
||||
makeChemistrySolver(solidODEChemistryExpThermo)
|
||||
|
||||
makeSolidChemistrySolverType
|
||||
(
|
||||
ode,
|
||||
ODESolidChemistryModel,
|
||||
solidChemistryModel,
|
||||
expoSolidThermoPhysics,
|
||||
gasThermoPhysics
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -25,7 +25,7 @@ chemistrySolver ode;
|
||||
|
||||
odeCoeffs
|
||||
{
|
||||
ODESolver SIBS;
|
||||
solver SIBS;
|
||||
eps 0.01;
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ chemistrySolver ode;
|
||||
|
||||
odeCoeffs
|
||||
{
|
||||
ODESolver SIBS;
|
||||
solver SIBS;
|
||||
eps 0.001;
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ chemistrySolver ode;
|
||||
|
||||
odeCoeffs
|
||||
{
|
||||
ODESolver SIBS;
|
||||
solver SIBS;
|
||||
eps 1e-03;
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ chemistrySolver ode;
|
||||
|
||||
odeCoeffs
|
||||
{
|
||||
ODESolver SIBS;
|
||||
solver SIBS;
|
||||
eps 1e-04;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user