Ready for compilation

This commit is contained in:
Hrvoje Jasak 2010-08-26 15:22:03 +01:00
parent 773cdd6f3e
commit 5226480f2c
512 changed files with 14647 additions and 9847 deletions

View file

@ -41,25 +41,24 @@ Description
int main(int argc, char *argv[])
{
#include "setRootCase.H"
# include "setRootCase.H"
#include "createTime.H"
#include "createMeshNoClear.H"
#include "readTransportProperties.H"
#include "createFields.H"
#include "readTurbulenceProperties.H"
#include "initContinuityErrs.H"
# include "createTime.H"
# include "createMeshNoClear.H"
# include "readTransportProperties.H"
# include "createFields.H"
# include "readTurbulenceProperties.H"
# include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< nl << "Starting time loop" << endl;
for (runTime++; !runTime.end(); runTime++)
while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;
# include "readPISOControls.H"
#include "readPISOControls.H"
force.internalField() = ReImSum
(
@ -69,7 +68,7 @@ int main(int argc, char *argv[])
)
);
# include "globalProperties.H"
#include "globalProperties.H"
fvVectorMatrix UEqn
(
@ -122,7 +121,7 @@ int main(int argc, char *argv[])
Info<< "End\n" << endl;
return(0);
return 0;
}

View file

@ -48,7 +48,7 @@ int main(int argc, char *argv[])
Info<< "\nCalculating temperature distribution\n" << endl;
for (runTime++; !runTime.end(); runTime++)
while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;
@ -71,7 +71,7 @@ int main(int argc, char *argv[])
Info<< "End\n" << endl;
return(0);
return 0;
}

View file

@ -111,7 +111,7 @@ int main(int argc, char *argv[])
U.write();
phi.write();
if (args.options().found("writep"))
if (args.optionFound("writep"))
{
p.write();
}
@ -122,7 +122,7 @@ int main(int argc, char *argv[])
Info<< "End\n" << endl;
return(0);
return 0;
}

View file

@ -50,7 +50,7 @@ int main(int argc, char *argv[])
# include "CourantNo.H"
for (runTime++; !runTime.end(); runTime++)
while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;
@ -71,7 +71,7 @@ int main(int argc, char *argv[])
Info<< "End\n" << endl;
return(0);
return 0;
}

View file

@ -8,8 +8,9 @@ EXE_INC = \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/turbulenceModels/RAS/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
@ -22,8 +23,9 @@ EXE_LIBS = \
-lmeshTools \
-lcompressibleRASModels \
-lbasicThermophysicalModels \
-lcombustionThermophysicalModels \
-lreactionThermophysicalModels \
-lspecie \
-llaminarFlameSpeedModels \
-lfiniteVolume \
-ldynamicFvMesh
-ldynamicFvMesh \
-llduSolvers

View file

@ -26,8 +26,8 @@ Application
PDRFoam
Description
Compressible premixed/partially-premixed combustion solver with turbulence
modelling.
Solver for compressible premixed/partially-premixed combustion with
turbulence modelling.
Combusting RANS code using the b-Xi two-equation model.
Xi may be obtained by either the solution of the Xi transport
@ -36,7 +36,7 @@ Description
to be appropriate by comparison with the results from the
spectral model.
Strain effects are encorporated directly into the Xi equation
Strain effects are incorporated directly into the Xi equation
but not in the algebraic approximation. Further work need to be
done on this issue, particularly regarding the enhanced removal rate
caused by flame compression. Analysis using results of the spectral
@ -75,15 +75,14 @@ int main(int argc, char *argv[])
# include "createTime.H"
# include "createMesh.H"
# include "readCombustionProperties.H"
# include "readEnvironmentalProperties.H"
# include "readGravitationalAcceleration.H"
# include "createFields.H"
# include "readPISOControls.H"
# include "initContinuityErrs.H"
# include "readTimeControls.H"
# include "CourantNo.H"
# include "setInitialDeltaT.H"
scalar StCoNum = 0.0;
scalar StCoNum = 0.0;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -130,7 +129,7 @@ scalar StCoNum = 0.0;
Info<< "\n end\n";
return(0);
return 0;
}

View file

@ -77,14 +77,14 @@ int main(int argc, char *argv[])
# include "createTime.H"
# include "createDynamicFvMesh.H"
# include "readCombustionProperties.H"
# include "readEnvironmentalProperties.H"
# include "readGravitationalAcceleration.H"
# include "createFields.H"
# include "readPISOControls.H"
# include "initContinuityErrs.H"
# include "readTimeControls.H"
# include "setInitialDeltaT.H"
scalar StCoNum = 0.0;
scalar StCoNum = 0.0;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -119,9 +119,10 @@ scalar StCoNum = 0.0;
fvc::makeAbsolute(phi, rho, U);
// Test : disable refinement for some cells
PackedList<1>& protectedCell =
PackedBoolList& protectedCell =
refCast<dynamicRefineFvMesh>(mesh).protectedCell();
if (protectedCell.size() == 0)
if (protectedCell.empty())
{
protectedCell.setSize(mesh.nCells());
protectedCell = 0;
@ -194,7 +195,7 @@ scalar StCoNum = 0.0;
Info<< "\n end\n";
return(0);
return 0;
}

View file

@ -25,10 +25,11 @@ License
\*---------------------------------------------------------------------------*/
#include "PDRkEpsilon.H"
#include "wallFvPatch.H"
#include "PDRDragModel.H"
#include "addToRunTimeSelectionTable.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -50,7 +51,7 @@ PDRkEpsilon::PDRkEpsilon
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel
)
:
RASModel(typeName, rho, U, phi, thermophysicalModel),
@ -82,29 +83,29 @@ PDRkEpsilon::PDRkEpsilon
1.92
)
),
alphak_
sigmak_
(
dimensioned<scalar>::lookupOrAddToDict
(
"alphak",
"sigmak",
coeffDict_,
1.0
)
),
alphaEps_
sigmaEps_
(
dimensioned<scalar>::lookupOrAddToDict
(
"alphaEps",
"sigmaEps",
coeffDict_,
0.76923
1.3
)
),
alphah_
Prt_
(
dimensioned<scalar>::lookupOrAddToDict
(
"alphah",
"Prt",
coeffDict_,
1.0
)
@ -147,9 +148,26 @@ PDRkEpsilon::PDRkEpsilon
IOobject::NO_WRITE
),
Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_)
),
alphat_
(
IOobject
(
"alphat",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
autoCreateAlphat("alphat", mesh_)
)
{
# include "wallViscosityI.H"
mut_ = Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_);
mut_.correctBoundaryConditions();
alphat_ = mut_/Prt_;
alphat_.correctBoundaryConditions();
printCoeffs();
}
@ -214,9 +232,9 @@ bool PDRkEpsilon::read()
Cmu_.readIfPresent(coeffDict_);
C1_.readIfPresent(coeffDict_);
C2_.readIfPresent(coeffDict_);
alphak_.readIfPresent(coeffDict_);
alphaEps_.readIfPresent(coeffDict_);
alphah_.readIfPresent(coeffDict_);
sigmak_.readIfPresent(coeffDict());
sigmaEps_.readIfPresent(coeffDict());
Prt_.readIfPresent(coeffDict());
return true;
}
@ -233,7 +251,12 @@ void PDRkEpsilon::correct()
{
// Re-calculate viscosity
mut_ = rho_*Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
# include "wallViscosityI.H"
mut_.correctBoundaryConditions();
// Re-calculate thermal diffusivity
alphat_ = mut_/Prt_;
alphat_.correctBoundaryConditions();
return;
}
@ -250,6 +273,9 @@ void PDRkEpsilon::correct()
volScalarField G = 2*mut_*(tgradU() && dev(symm(tgradU())));
tgradU.clear();
// Update espsilon and G at the wall
epsilon_.boundaryField().updateCoeffs();
// Add the blockage generation term so that it is included consistently
// in both the k and epsilon equations
const volScalarField& betav = U_.db().lookupObject<volScalarField>("betav");
@ -259,8 +285,6 @@ void PDRkEpsilon::correct()
volScalarField GR = drag.Gk();
# include "wallFunctionsI.H"
// Dissipation equation
tmp<fvScalarMatrix> epsEqn
(
@ -273,10 +297,10 @@ void PDRkEpsilon::correct()
- fvm::Sp(C2_*betav*rho_*epsilon_/k_, epsilon_)
);
# include "wallDissipationI.H"
epsEqn().relax();
epsEqn().boundaryManipulate(epsilon_.boundaryField());
solve(epsEqn);
bound(epsilon_, epsilon0_);
@ -298,12 +322,13 @@ void PDRkEpsilon::correct()
solve(kEqn);
bound(k_, k0_);
// Re-calculate viscosity
mut_ = rho_*Cmu_*sqr(k_)/epsilon_;
mut_.correctBoundaryConditions();
# include "wallViscosityI.H"
// Re-calculate thermal diffusivity
alphat_ = mut_/Prt_;
alphat_.correctBoundaryConditions();
}

View file

@ -29,6 +29,20 @@ Description
Standard k-epsilon turbulence model with additional source terms
corresponding to PDR basic drag model (\link basic.H \endlink)
The default model coefficients correspond to the following:
@verbatim
kEpsilonCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
C3 -0.33; // only for compressible
sigmak 1.0; // only for compressible
sigmaEps 1.3;
Prt 1.0; // only for compressible
}
@endverbatim
The turbulence source term \f$ G_{R} \f$ appears in the
\f$ \kappa-\epsilon \f$ equation for the generation of turbulence due to
interaction with unresolved obstacles.
@ -68,16 +82,21 @@ class PDRkEpsilon
{
// Private data
// Model coefficients
dimensionedScalar Cmu_;
dimensionedScalar C1_;
dimensionedScalar C2_;
dimensionedScalar alphak_;
dimensionedScalar alphaEps_;
dimensionedScalar alphah_;
dimensionedScalar sigmak_;
dimensionedScalar sigmaEps_;
dimensionedScalar Prt_;
// Fields
volScalarField k_;
volScalarField epsilon_;
volScalarField mut_;
volScalarField alphat_;
public:
@ -85,6 +104,7 @@ public:
//- Runtime type information
TypeName("PDRkEpsilon");
// Constructors
//- Construct from components
@ -93,11 +113,11 @@ public:
const volScalarField& rho,
const volVectorField& U,
const surfaceScalarField& phi,
basicThermo& thermophysicalModel
const basicThermo& thermophysicalModel
);
// Destructor
//- Destructor
virtual ~PDRkEpsilon()
{}
@ -114,7 +134,7 @@ public:
{
return tmp<volScalarField>
(
new volScalarField("DkEff", alphak_*mut_ + mu())
new volScalarField("DkEff", mut_/sigmak_ + mu())
);
}
@ -123,7 +143,7 @@ public:
{
return tmp<volScalarField>
(
new volScalarField("DepsilonEff", alphaEps_*mut_ + mu())
new volScalarField("DepsilonEff", mut_/sigmaEps_ + mu())
);
}
@ -132,7 +152,7 @@ public:
{
return tmp<volScalarField>
(
new volScalarField("alphaEff", alphah_*mut_ + alpha())
new volScalarField("alphaEff", alphat_ + alpha())
);
}

View file

@ -31,22 +31,24 @@ Description
\*---------------------------------------------------------------------------*/
{
scalar meanStCoNum = 0.0;
scalar meanStCoNum = 0.0;
if (mesh.nInternalFaces())
{
if (mesh.nInternalFaces())
{
surfaceScalarField SfUfbyDelta =
mesh.surfaceInterpolation::deltaCoeffs()
*mag(phiSt/fvc::interpolate(rho));
StCoNum = max(SfUfbyDelta/mesh.magSf())
.value()*runTime.deltaT().value();
StCoNum =
max(SfUfbyDelta/mesh.magSf()).value()
*runTime.deltaT().value();
meanStCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
.value()*runTime.deltaT().value();
}
meanStCoNum =
(sum(SfUfbyDelta)/sum(mesh.magSf())).value()
*runTime.deltaT().value();
}
Info<< "St courant Number mean: " << meanStCoNum
Info<< "St courant Number mean: " << meanStCoNum
<< " max: " << StCoNum << endl;
}

View file

@ -28,8 +28,8 @@ Class
Description
Simple SCOPEBlendXiEq model for XiEq based on SCOPEXiEqs correlation
with a linear correction function to give a plausible profile for XiEq.
See \link SCOPELaminarFlameSpeed.H \endlink for details on the SCOPE laminar
flame speed model.
See @link SCOPELaminarFlameSpeed.H @endlink for details on the SCOPE
laminar flame speed model.
SourceFiles
SCOPEBlend.C

View file

@ -26,10 +26,9 @@ Class
Foam::XiEqModels::instability
Description
This is the equilibrium level of the flame wrinkling generated by
inestability. It is a constant (default 2.5). It is used in
\link XiModel.H \endlink.
instability. It is a constant (default 2.5). It is used in
@link XiModel.H @endlink.
SourceFiles
instability.C

View file

@ -25,7 +25,7 @@ if (ign.ignited())
// Unburnt gas density
// ~~~~~~~~~~~~~~~~~~~
volScalarField rhou = thermo->rhou();
volScalarField rhou = thermo.rhou();
// Calculate flame normal etc.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -1,10 +1,11 @@
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<hhuCombustionThermo> thermo
autoPtr<hhuCombustionThermo> pThermo
(
hhuCombustionThermo::New(mesh)
);
combustionMixture& composition = thermo->composition();
hhuCombustionThermo& thermo = pThermo();
basicMultiComponentMixture& composition = thermo.composition();
volScalarField rho
(
@ -16,13 +17,13 @@
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
thermo->rho()
thermo.rho()
);
volScalarField& p = thermo->p();
const volScalarField& psi = thermo->psi();
volScalarField& h = thermo->h();
volScalarField& hu = thermo->hu();
volScalarField& p = thermo.p();
const volScalarField& psi = thermo.psi();
volScalarField& h = thermo.h();
volScalarField& hu = thermo.hu();
volScalarField& b = composition.Y("b");
Info<< "min(b) = " << min(b).value() << endl;
@ -54,7 +55,7 @@
rho,
U,
phi,
thermo()
thermo
)
);

View file

@ -8,5 +8,5 @@
betav*DpDt
);
thermo->correct();
thermo.correct();
}

View file

@ -13,6 +13,6 @@ if (ign.ignited())
//+ fvm::Sp(fvc::div(muEff*fvc::grad(b)/(b + 0.001)), hu)
==
betav*DpDt*rho/thermo->rhou()
betav*DpDt*rho/thermo.rhou()
);
}

View file

@ -395,7 +395,7 @@ Foam::laminarFlameSpeedModels::SCOPE::Ma() const
(
"Ma",
mesh.time().timeName(),
mesh.db(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),

View file

@ -196,7 +196,6 @@ public:
// Destructor
~SCOPE();

View file

@ -1,4 +1,4 @@
rho = thermo->rho();
rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A();
U = invA & UEqn.H();
@ -8,7 +8,7 @@ if (transonic)
surfaceScalarField phid
(
"phid",
fvc::interpolate(thermo->psi())
fvc::interpolate(psi)
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)

View file

@ -1,19 +1,21 @@
EXE_INC = \
-I$(LIB_SRC)/engine/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/turbulenceModels/RAS \
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lengine \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lbasicThermophysicalModels \
-lreactionThermophysicalModels \
-lspecie \
-llaminarFlameSpeedModels \
-lfiniteVolume \
-lmeshTools \
-lcompressibleRASModels \
-lbasicThermophysicalModels \
-lcombustionThermophysicalModels \
-lspecie \
-llaminarFlameSpeedModels
-llduSolvers

View file

@ -7,6 +7,8 @@
rho*g
);
UEqn.relax();
if (momentumPredictor)
{
solve(UEqn == -fvc::grad(p));

View file

@ -26,8 +26,8 @@ Application
XiFoam
Description
Compressible premixed/partially-premixed combustion solver with turbulence
modelling.
Solver for compressible premixed/partially-premixed combustion with
turbulence modelling.
Combusting RANS code using the b-Xi two-equation model.
Xi may be obtained by either the solution of the Xi transport
@ -52,7 +52,7 @@ Description
#include "fvCFD.H"
#include "hhuCombustionThermo.H"
#include "compressible/RASModel/RASModel.H"
#include "turbulenceModel.H"
#include "laminarFlameSpeed.H"
#include "ignition.H"
#include "Switch.H"
@ -66,9 +66,8 @@ int main(int argc, char *argv[])
# include "createTime.H"
# include "createMesh.H"
# include "readCombustionProperties.H"
# include "readEnvironmentalProperties.H"
# include "readGravitationalAcceleration.H"
# include "createFields.H"
# include "readPISOControls.H"
# include "initContinuityErrs.H"
# include "readTimeControls.H"
# include "compressibleCourantNo.H"
@ -88,12 +87,12 @@ int main(int argc, char *argv[])
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
// --- Pressure-velocity PIMPLE corrector loop
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
{
# include "rhoEqn.H"
# include "UEqn.H"
// --- PISO loop
for (int corr=1; corr<=nCorr; corr++)
{
# include "ftEqn.H"
# include "bEqn.H"
# include "huEqn.H"
@ -104,12 +103,16 @@ int main(int argc, char *argv[])
hu == h;
}
// --- PISO loop
for (int corr=1; corr<=nCorr; corr++)
{
# include "pEqn.H"
}
turbulence->correct();
}
rho = thermo->rho();
rho = thermo.rho();
runTime.write();
@ -120,7 +123,7 @@ int main(int argc, char *argv[])
Info<< "End\n" << endl;
return(0);
return 0;
}

View file

@ -6,7 +6,7 @@ if (ign.ignited())
// Unburnt gas density
// ~~~~~~~~~~~~~~~~~~~
volScalarField rhou = thermo->rhou();
volScalarField rhou = thermo.rhou();
// Calculate flame normal etc.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -52,7 +52,7 @@ if (ign.ignited())
+ mvConvection->fvmDiv(phi, b)
+ fvm::div(phiSt, b, "div(phiSt,b)")
- fvm::Sp(fvc::div(phiSt), b)
- fvm::laplacian(turbulence->muEff(), b)
- fvm::laplacian(turbulence->alphaEff(), b)
);
@ -76,7 +76,7 @@ if (ign.ignited())
volScalarField epsilon = pow(uPrimeCoef, 3)*turbulence->epsilon();
volScalarField tauEta = sqrt(thermo->muu()/(rhou*epsilon));
volScalarField tauEta = sqrt(thermo.muu()/(rhou*epsilon));
volScalarField Reta = up/
(
@ -90,7 +90,7 @@ if (ign.ignited())
// ~~~~~~~~~~~~~~~~~
surfaceScalarField phiXi =
phiSt
- fvc::interpolate(fvc::laplacian(turbulence->muEff(), b)/mgb)*nf
- fvc::interpolate(fvc::laplacian(turbulence->alphaEff(), b)/mgb)*nf
+ fvc::interpolate(rho)*fvc::interpolate(Su*(1.0/Xi - Xi))*nf;
@ -134,7 +134,7 @@ if (ign.ignited())
(sigmas*SuInf*(Su0 - SuInf) + sqr(SuMin)*sigmaExt)
/(sqr(Su0 - SuInf) + sqr(SuMin));
solve
fvScalarMatrix SuEqn
(
fvm::ddt(rho, Su)
+ fvm::div(phi + phiXi, Su, "div(phiXi,Su)")
@ -144,6 +144,9 @@ if (ign.ignited())
- fvm::SuSp(rho*(sigmas + Rc), Su)
);
SuEqn.relax();
SuEqn.solve();
// Limit the maximum Su
// ~~~~~~~~~~~~~~~~~~~~
Su.min(SuMax);
@ -196,7 +199,7 @@ if (ign.ignited())
// Solve for the flame wrinkling
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
solve
fvScalarMatrix XiEqn
(
fvm::ddt(rho, Xi)
+ fvm::div(phi + phiXi, Xi, "div(phiXi,Xi)")
@ -215,6 +218,8 @@ if (ign.ignited())
)
);
XiEqn.relax();
XiEqn.solve();
// Correct boundedness of Xi
// ~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -1,10 +1,11 @@
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<hhuCombustionThermo> thermo
autoPtr<hhuCombustionThermo> pThermo
(
hhuCombustionThermo::New(mesh)
);
combustionMixture& composition = thermo->composition();
hhuCombustionThermo& thermo = pThermo();
basicMultiComponentMixture& composition = thermo.composition();
volScalarField rho
(
@ -16,18 +17,18 @@
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
thermo->rho()
thermo.rho()
);
volScalarField& p = thermo->p();
const volScalarField& psi = thermo->psi();
volScalarField& h = thermo->h();
volScalarField& hu = thermo->hu();
volScalarField& p = thermo.p();
const volScalarField& psi = thermo.psi();
volScalarField& h = thermo.h();
volScalarField& hu = thermo.hu();
volScalarField& b = composition.Y("b");
Info<< "min(b) = " << min(b).value() << endl;
const volScalarField& T = thermo->T();
const volScalarField& T = thermo.T();
Info<< "\nReading field U\n" << endl;
@ -48,14 +49,14 @@
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::RASModel> turbulence
autoPtr<compressible::turbulenceModel> turbulence
(
compressible::RASModel::New
compressible::turbulenceModel::New
(
rho,
U,
phi,
thermo()
thermo
)
);

View file

@ -17,6 +17,6 @@ if (composition.contains("ft"))
(
fvm::ddt(rho, ft)
+ mvConvection->fvmDiv(phi, ft)
- fvm::laplacian(turbulence->muEff(), ft)
- fvm::laplacian(turbulence->alphaEff(), ft)
);
}

View file

@ -1,5 +1,5 @@
{
solve
fvScalarMatrix hEqn
(
fvm::ddt(rho, h)
+ mvConvection->fvmDiv(phi, h)
@ -8,5 +8,8 @@
DpDt
);
thermo->correct();
hEqn.relax();
hEqn.solve();
thermo.correct();
}

View file

@ -13,6 +13,6 @@ if (ign.ignited())
//+ fvm::Sp(fvc::div(muEff*fvc::grad(b)/(b + 0.001)), hu)
==
DpDt*rho/thermo->rhou()
DpDt*rho/thermo.rhou()
);
}

View file

@ -1,4 +1,4 @@
rho = thermo->rho();
rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A();
U = rUA*UEqn.H();
@ -8,7 +8,7 @@ if (transonic)
surfaceScalarField phid
(
"phid",
fvc::interpolate(thermo->psi())
fvc::interpolate(psi)
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)

View file

@ -1,3 +0,0 @@
Xoodles.C
EXE = $(FOAM_APPBIN)/Xoodles

View file

@ -1,23 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/engine/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/turbulenceModels/LES \
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \
-I../XiFoam
EXE_LIBS = \
-lengine \
-lfiniteVolume \
-lmeshTools \
-lbasicThermophysicalModels \
-lcombustionThermophysicalModels \
-lspecie \
-lcompressibleLESModels \
-llaminarFlameSpeedModels

View file

@ -1,124 +0,0 @@
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<hhuCombustionThermo> thermo
(
hhuCombustionThermo::New(mesh)
);
combustionMixture& composition = thermo->composition();
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
thermo->rho()
);
volScalarField& p = thermo->p();
const volScalarField& psi = thermo->psi();
volScalarField& h = thermo->h();
volScalarField& hu = thermo->hu();
volScalarField& b = composition.Y("b");
Info<< "min(b) = " << min(b).value() << endl;
const volScalarField& T = thermo->T();
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::LESModel> turbulence
(
compressible::LESModel::New(rho, U, phi, thermo())
);
Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
Info<< "Creating field Xi\n" << endl;
volScalarField Xi
(
IOobject
(
"Xi",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Creating the unstrained laminar flame speed\n" << endl;
autoPtr<laminarFlameSpeed> unstrainedLaminarFlameSpeed
(
laminarFlameSpeed::New(thermo)
);
Info<< "Reading strained laminar flame speed field Su\n" << endl;
volScalarField Su
(
IOobject
(
"Su",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
dimensionedScalar SuMin = 0.01*Su.average();
dimensionedScalar SuMax = 4*Su.average();
Info<< "Calculating turbulent flame speed field St\n" << endl;
volScalarField St
(
IOobject
(
"St",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
Xi*Su
);
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
if (composition.contains("ft"))
{
fields.add(composition.Y("ft"));
}
fields.add(b);
fields.add(h);
fields.add(hu);

View file

@ -2,15 +2,17 @@ EXE_INC = \
-I../engineFoam \
-I../XiFoam \
-I$(LIB_SRC)/engine/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/turbulenceModels/RAS/compressible/lnInclude
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lengine \
-lfiniteVolume \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lbasicThermophysicalModels \
-lspecie
-lspecie \
-lfiniteVolume \
-llduSolvers

View file

@ -33,8 +33,8 @@ Description
#include "fvCFD.H"
#include "engineTime.H"
#include "engineMesh.H"
#include "basicThermo.H"
#include "RASModel.H"
#include "basicPsiThermo.H"
#include "turbulenceModel.H"
#include "OFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -94,7 +94,7 @@ int main(int argc, char *argv[])
Info<< "End\n" << endl;
return(0);
return 0;
}

View file

@ -1,9 +1,10 @@
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<basicThermo> thermo
autoPtr<basicPsiThermo> pThermo
(
basicThermo::New(mesh)
basicPsiThermo::New(mesh)
);
basicPsiThermo& thermo = pThermo();
volScalarField rho
(
@ -15,13 +16,13 @@
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
thermo->rho()
thermo.rho()
);
volScalarField& p = thermo->p();
const volScalarField& psi = thermo->psi();
volScalarField& h = thermo->h();
const volScalarField& T = thermo->T();
volScalarField& p = thermo.p();
const volScalarField& psi = thermo.psi();
volScalarField& h = thermo.h();
const volScalarField& T = thermo.T();
Info<< "\nReading field U\n" << endl;
@ -42,14 +43,14 @@
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::RASModel> turbulence
autoPtr<compressible::turbulenceModel> turbulence
(
compressible::RASModel::New
compressible::turbulenceModel::New
(
rho,
U,
phi,
thermo()
thermo
)
);

View file

@ -8,5 +8,5 @@
DpDt
);
thermo->correct();
thermo.correct();
}

View file

@ -1,25 +1,26 @@
EXE_INC = \
-I../engineFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/turbulenceModels/RAS \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/dieselSpray/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \
-I$(LIB_SRC)/../applications/solvers/combustion/XiFoam \
-I$(LIB_SRC)/../applications/solvers/reactionThermo/XiFoam \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude \
-I$(LIB_SRC)/engine/lnInclude
-I$(LIB_SRC)/engine/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
EXE_LIBS = \
-lengine \
-lcompressibleRASModels \
-lcombustionThermophysicalModels \
-lcompressibleLESModels \
-lreactionThermophysicalModels \
-lfiniteVolume \
-llagrangian \
-ldieselSpray \
@ -31,4 +32,5 @@ EXE_LIBS = \
-llaminarFlameSpeedModels \
-lchemistryModel \
-lODE \
-lpdf
-lpdf \
-llduSolvers

View file

@ -14,7 +14,7 @@ tmp<fv::convectionScheme<scalar> > mvConvection
label inertIndex = -1;
volScalarField Yt = 0.0*Y[0];
for(label i=0; i<Y.size(); i++)
for (label i = 0; i < Y.size(); i++)
{
if (Y[i].name() != inertSpecie)
{
@ -42,5 +42,4 @@ tmp<fv::convectionScheme<scalar> > mvConvection
Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].max(0.0);
}

View file

@ -1,13 +1,25 @@
Info<< nl << "Reading thermophysicalProperties" << endl;
autoPtr<hCombustionThermo> thermo
(
hCombustionThermo::New(mesh)
);
combustionMixture& composition = thermo->composition();
autoPtr<psiChemistryModel> pChemistry
(
psiChemistryModel::New(mesh)
);
psiChemistryModel& chemistry = pChemistry();
hsCombustionThermo& thermo = chemistry.thermo();
basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y();
word inertSpecie(thermo->lookup("inertSpecie"));
word inertSpecie(thermo.lookup("inertSpecie"));
if (!composition.contains(inertSpecie))
{
FatalErrorIn(args.executable())
<< "Specified inert specie '" << inertSpecie << "' not found in "
<< "species list. Available species:" << composition.species()
<< exit(FatalError);
}
volScalarField rho
(
@ -17,7 +29,7 @@ volScalarField rho
runTime.timeName(),
mesh
),
thermo->rho()
thermo.rho()
);
Info<< "Reading field U\n" << endl;
@ -35,10 +47,10 @@ volVectorField U
);
volScalarField& p = thermo->p();
const volScalarField& psi = thermo->psi();
const volScalarField& T = thermo->T();
volScalarField& h = thermo->h();
volScalarField& p = thermo.p();
const volScalarField& psi = thermo.psi();
const volScalarField& T = thermo.T();
volScalarField& hs = thermo.hs();
#include "compressibleCreatePhi.H"
@ -58,14 +70,14 @@ volScalarField kappa
);
Info << "Creating turbulence model.\n" << nl;
autoPtr<compressible::RASModel> turbulence
autoPtr<compressible::turbulenceModel> turbulence
(
compressible::RASModel::New
compressible::turbulenceModel::New
(
rho,
U,
phi,
thermo()
thermo
)
);
@ -73,31 +85,25 @@ Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
Info << "Constructing chemical mechanism" << endl;
chemistryModel chemistry
(
thermo(),
rho
);
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
for(label i=0; i<Y.size(); i++)
forAll(Y, i)
{
fields.add(Y[i]);
}
fields.add(h);
fields.add(hs);
volScalarField dQ
DimensionedField<scalar, volMesh> chemistrySh
(
IOobject
(
"dQ",
"chemistry::Sh",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimensionSet(1,-3,-1,0,0,0,0), 0.0)
dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0)
);

View file

@ -1,24 +1,21 @@
Info << "Constructing Spray" << endl;
pointMesh pMesh(mesh);
volPointInterpolation vpi(mesh, pMesh);
PtrList<specieProperties> gasProperties(Y.size());
PtrList<gasThermoPhysics> gasProperties(Y.size());
forAll(gasProperties, i)
{
gasProperties.set
(
i,
new specieProperties
new gasThermoPhysics
(
dynamic_cast<const reactingMixture&>(thermo()).speciesData()[i]
dynamic_cast<const reactingMixture<gasThermoPhysics>&>
(thermo).speciesData()[i]
)
);
}
spray dieselSpray
(
vpi,
U,
rho,
p,
@ -26,7 +23,7 @@ spray dieselSpray
composition,
gasProperties,
thermo,
environmentalProperties
g
);
scalar gasMass0 = fvc::domainIntegrate(rho).value();

View file

@ -23,10 +23,10 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
dieselFoam
dieselEngineFoam
Description
Diesel engine spray and combustion code.
Solver for diesel engine spray and combustion.
\*---------------------------------------------------------------------------*/
@ -34,13 +34,15 @@ Description
#include "engineTime.H"
#include "engineMesh.H"
#include "hCombustionThermo.H"
#include "compressible/RASModel/RASModel.H"
#include "turbulenceModel.H"
#include "spray.H"
#include "chemistryModel.H"
#include "psiChemistryModel.H"
#include "chemistrySolver.H"
#include "multivariateScheme.H"
#include "Switch.H"
#include "OFstream.H"
#include "volPointInterpolation.H"
#include "thermoPhysicsTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -50,7 +52,7 @@ int main(int argc, char *argv[])
# include "createEngineTime.H"
# include "createEngineMesh.H"
# include "createFields.H"
# include "readEnvironmentalProperties.H"
# include "readGravitationalAcceleration.H"
# include "readCombustionProperties.H"
# include "createSpray.H"
# include "initContinuityErrs.H"
@ -61,7 +63,7 @@ int main(int argc, char *argv[])
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info << "\nStarting time loop\n" << endl;
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
@ -75,11 +77,16 @@ int main(int argc, char *argv[])
Info<< "Crank angle = " << runTime.theta() << " CA-deg" << endl;
mesh.move();
vpi.updateMesh();
Check that this is unnecessary. HJ
// 1.6.x merge. HJ, 26/Aug/2010
const_cast<volPointInterpolation&>
(
volPointInterpolation::New(mesh)
).updateMesh();
dieselSpray.evolve();
Info << "Solving chemistry" << endl;
Info<< "Solving chemistry" << endl;
chemistry.solve
(
@ -97,13 +104,15 @@ int main(int argc, char *argv[])
kappa = (runTime.deltaT() + tc)/(runTime.deltaT() + tc + tk);
}
chemistrySh = kappa*chemistry.Sh()();
# include "rhoEqn.H"
# include "UEqn.H"
for (label ocorr=1; ocorr <= nOuterCorr; ocorr++)
{
# include "YEqn.H"
# include "hEqn.H"
# include "hsEqn.H"
// --- PISO loop
for (int corr=1; corr<=nCorr; corr++)
@ -117,9 +126,12 @@ int main(int argc, char *argv[])
# include "logSummary.H"
# include "spraySummary.H"
rho = thermo->rho();
rho = thermo.rho();
runTime.write();
if (runTime.write())
{
chemistry.dQ()().write();
}
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
@ -128,7 +140,7 @@ int main(int argc, char *argv[])
Info<< "End\n" << endl;
return(0);
return 0;
}

View file

@ -1,40 +0,0 @@
{
solve
(
fvm::ddt(rho, h)
+ mvConvection->fvmDiv(phi, h)
- fvm::laplacian(turbulence->alphaEff(), h)
==
DpDt
+ dieselSpray.heatTransferSource()
);
thermo->correct();
forAll(dQ, i)
{
dQ[i] = 0.0;
}
scalarField cp(dQ.size(), 0.0);
forAll(Y, i)
{
volScalarField RRi = chemistry.RR(i);
forAll(h, celli)
{
scalar Ti = T[celli];
cp[celli] += Y[i][celli]*chemistry.specieThermo()[i].Cp(Ti);
scalar hi = chemistry.specieThermo()[i].h(Ti);
scalar RR = RRi[celli];
dQ[celli] -= hi*RR;
}
}
forAll(dQ, celli)
{
dQ[celli] /= cp[celli];
}
}

View file

@ -0,0 +1,14 @@
{
solve
(
fvm::ddt(rho, hs)
+ mvConvection->fvmDiv(phi, hs)
- fvm::laplacian(turbulence->alphaEff(), hs)
==
DpDt
+ dieselSpray.heatTransferSource()().dimensionedInternalField()
+ chemistrySh
);
thermo.correct();
}

View file

@ -1,4 +1,4 @@
rho = thermo->rho();
rho = thermo.rho();
volScalarField A = UEqn.A();
U = UEqn.H()/A;
@ -8,7 +8,7 @@ if (transonic)
surfaceScalarField phid
(
"phid",
fvc::interpolate(thermo->psi())
fvc::interpolate(psi)
*((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U))
);

View file

@ -44,7 +44,7 @@ volScalarField Sevap
dimensionedScalar("zero", dimensionSet(1, -3, -1, 0, 0), 0.0)
);
for(label i=0; i<Y.size(); i++)
for (label i = 0; i < Y.size(); i++)
{
if (dieselSpray.isLiquidFuel()[i])
{

View file

@ -1,24 +1,24 @@
EXE_INC = \
-I../dieselEngineFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/turbulenceModels/RAS \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/dieselSpray/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \
-I$(LIB_SRC)/../applications/solvers/combustion/XiFoam \
-I$(LIB_SRC)/../applications/solvers/reactionThermo/XiFoam \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude
EXE_LIBS = \
-lcompressibleRASModels \
-lcombustionThermophysicalModels \
-lfiniteVolume \
-lcompressibleLESModels \
-lreactionThermophysicalModels \
-llagrangian \
-ldieselSpray \
-lliquids \
@ -29,4 +29,6 @@ EXE_LIBS = \
-llaminarFlameSpeedModels \
-lchemistryModel \
-lODE \
-lpdf
-lpdf \
-lfiniteVolume \
-llduSolvers

View file

@ -26,15 +26,15 @@ Application
dieselFoam
Description
Diesel spray and combustion code.
Solver for diesel spray and combustion.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "hCombustionThermo.H"
#include "compressible/RASModel/RASModel.H"
#include "turbulenceModel.H"
#include "spray.H"
#include "chemistryModel.H"
#include "psiChemistryModel.H"
#include "chemistrySolver.H"
#include "multivariateScheme.H"
@ -46,12 +46,11 @@ Description
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
# include "createFields.H"
# include "readEnvironmentalProperties.H"
# include "readGravitationalAcceleration.H"
# include "readCombustionProperties.H"
# include "createSpray.H"
# include "initContinuityErrs.H"
@ -59,11 +58,11 @@ int main(int argc, char *argv[])
# include "compressibleCourantNo.H"
# include "setInitialDeltaT.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info << "\nStarting time loop\n" << endl;
Info<< "\nStarting time loop\n" << endl;
while(runTime.run())
while (runTime.run())
{
# include "readPISOControls.H"
# include "compressibleCourantNo.H"
@ -94,13 +93,15 @@ int main(int argc, char *argv[])
kappa = (runTime.deltaT() + tc)/(runTime.deltaT()+tc+tk);
}
chemistrySh = kappa*chemistry.Sh()();
# include "rhoEqn.H"
# include "UEqn.H"
for (label ocorr=1; ocorr <= nOuterCorr; ocorr++)
{
# include "YEqn.H"
# include "hEqn.H"
# include "hsEqn.H"
// --- PISO loop
for (int corr=1; corr<=nCorr; corr++)
@ -113,9 +114,12 @@ int main(int argc, char *argv[])
# include "spraySummary.H"
rho = thermo->rho();
rho = thermo.rho();
runTime.write();
if (runTime.write())
{
chemistry.dQ()().write();
}
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
@ -124,7 +128,7 @@ int main(int argc, char *argv[])
Info<< "End\n" << endl;
return(0);
return 0;
}

View file

@ -1,4 +1,4 @@
rho = thermo->rho();
rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A();
U = rUA*UEqn.H();
@ -8,7 +8,7 @@ if (transonic)
surfaceScalarField phid
(
"phid",
fvc::interpolate(thermo->psi())
fvc::interpolate(psi)
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)

View file

@ -1,18 +1,20 @@
EXE_INC = \
-I../XiFoam \
-I$(LIB_SRC)/engine/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/turbulenceModels/RAS/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \
-I../XiFoam
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lengine \
-lfiniteVolume \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lbasicThermophysicalModels \
-lcombustionThermophysicalModels \
-lreactionThermophysicalModels \
-lspecie \
-llaminarFlameSpeedModels
-llaminarFlameSpeedModels \
-lfiniteVolume \
-llduSolvers

View file

@ -53,7 +53,7 @@ Description
#include "engineTime.H"
#include "engineMesh.H"
#include "hhuCombustionThermo.H"
#include "RASModel.H"
#include "turbulenceModel.H"
#include "laminarFlameSpeed.H"
#include "ignition.H"
#include "Switch.H"
@ -67,7 +67,6 @@ int main(int argc, char *argv[])
# include "createEngineTime.H"
# include "createEngineMesh.H"
# include "readPISOControls.H"
# include "readCombustionProperties.H"
# include "createFields.H"
# include "initContinuityErrs.H"
@ -117,7 +116,7 @@ int main(int argc, char *argv[])
# include "logSummary.H"
rho = thermo->rho();
rho = thermo.rho();
runTime.write();
@ -128,7 +127,7 @@ int main(int argc, char *argv[])
Info<< "End\n" << endl;
return(0);
return 0;
}

View file

@ -1,4 +1,4 @@
rho = thermo->rho();
rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A();
U = rUA*UEqn.H();
@ -8,7 +8,7 @@ if (transonic)
surfaceScalarField phid
(
"phid",
fvc::interpolate(thermo->psi())
fvc::interpolate(psi)
*((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U))
);

View file

@ -1,3 +1,3 @@
#include "readTimeControls.H"
# include "readTimeControls.H"
maxDeltaT = runTime.userTimeToTime(maxDeltaT);

View file

@ -0,0 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wclean libso combustionModels
wclean
# ----------------------------------------------------------------- end-of-file

View file

@ -0,0 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso combustionModels
wmake
# ----------------------------------------------------------------- end-of-file

View file

@ -0,0 +1,4 @@
fireFoam.C
EXE = $(FOAM_APPBIN)/fireFoam

View file

@ -0,0 +1,19 @@
EXE_INC = \
-I./combustionModels/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude
EXE_LIBS = \
-lcombustionModels \
-lspecie \
-lreactionThermophysicalModels \
-lbasicThermophysicalModels \
-lfiniteVolume \
-lcompressibleLESModels \
-lcompressibleRASModels \
-lradiation

View file

@ -0,0 +1,36 @@
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(phi, U)
+ turbulence->divDevRhoReff(U)
);
UEqn.relax();
if (oCorr == nOuterCorr - 1)
{
solve
(
UEqn
==
fvc::reconstruct
(
fvc::interpolate(rho)*(g & mesh.Sf())
- fvc::snGrad(p)*mesh.magSf()
),
mesh.solver("UFinal")
);
}
else
{
solve
(
UEqn
==
fvc::reconstruct
(
fvc::interpolate(rho)*(g & mesh.Sf())
- fvc::snGrad(p)*mesh.magSf()
)
);
}

View file

@ -0,0 +1,9 @@
combustionModel/combustionModel.C
combustionModel/newCombustionModel.C
infinitelyFastChemistry/infinitelyFastChemistry.C
noCombustion/noCombustion.C
LIB = $(FOAM_LIBBIN)/libcombustionModels

View file

@ -0,0 +1,9 @@
EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(FOAM_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(FOAM_SRC)/finiteVolume/lnInclude
LIB_LIBS = \
-lfiniteVolume

View file

@ -0,0 +1,109 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "combustionModel.H"
#include "fvm.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(combustionModel, 0);
defineRunTimeSelectionTable(combustionModel, dictionary);
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::combustionModel::combustionModel
(
const dictionary& combustionProperties,
const hsCombustionThermo& thermo,
const compressible::turbulenceModel& turbulence,
const surfaceScalarField& phi,
const volScalarField& rho
)
:
combustionModelCoeffs_
(
combustionProperties.subDict
(
word(combustionProperties.lookup("combustionModel")) + "Coeffs"
)
),
thermo_(thermo),
turbulence_(turbulence),
mesh_(phi.mesh()),
phi_(phi),
rho_(rho),
stoicRatio_(thermo.lookup("stoichiometricAirFuelMassRatio")),
s_(thermo.lookup("stoichiometricOxygenFuelMassRatio")),
qFuel_(thermo_.lookup("qFuel")),
composition_(thermo.composition())
{}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
Foam::combustionModel::~combustionModel()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::fvScalarMatrix>
Foam::combustionModel::combustionModel::R(volScalarField& fu) const
{
const basicMultiComponentMixture& composition = thermo_.composition();
const volScalarField& ft = composition.Y("ft");
volScalarField fres = composition.fres(ft, stoicRatio_.value());
volScalarField wFuelNorm = this->wFuelNorm()*pos(fu - fres);
return wFuelNorm*fres - fvm::Sp(wFuelNorm, fu);
}
Foam::tmp<Foam::volScalarField> Foam::combustionModel::combustionModel::dQ
(
const fvScalarMatrix& Rfu
) const
{
const basicMultiComponentMixture& composition = thermo_.composition();
const volScalarField& fu = composition.Y("fu");
return (-qFuel_)*(Rfu & fu);
}
bool Foam::combustionModel::read(const dictionary& combustionProperties)
{
combustionModelCoeffs_ = combustionProperties.subDict(type() + "Coeffs");
return true;
}
// ************************************************************************* //

View file

@ -0,0 +1,210 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::combustionModel
Description
Base class for all non-premixed combustion models.
SourceFiles
combustionModel.C
\*---------------------------------------------------------------------------*/
#ifndef combustionModel_H
#define combustionModel_H
#include "IOdictionary.H"
#include "hsCombustionThermo.H"
#include "turbulenceModel.H"
#include "multivariateSurfaceInterpolationScheme.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class combustionModel Declaration
\*---------------------------------------------------------------------------*/
class combustionModel
{
protected:
// Protected data
//- Dictionary of coefficients for the particular model
dictionary combustionModelCoeffs_;
//- Reference to the thermodynamic
const 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_;
//- Stoichiometric air-fuel mass ratio
dimensionedScalar stoicRatio_;
//- Stoichiometric oxygen-fuel mass ratio
dimensionedScalar s_;
//- Heat of combustion (J/Kg)
dimensionedScalar qFuel_;
private:
// Private Member Functions
//- Disallow copy construct
combustionModel(const combustionModel&);
//- Disallow default bitwise assignment
void operator=(const combustionModel&);
const basicMultiComponentMixture& composition_;
public:
//- Runtime type information
TypeName("combustionModel");
// Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
combustionModel,
dictionary,
(
const dictionary& combustionProperties,
const 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,
const hsCombustionThermo& thermo,
const compressible::turbulenceModel& turbulence,
const surfaceScalarField& phi,
const volScalarField& rho
);
// Constructors
//- Construct from components
combustionModel
(
const dictionary& combustionProperties,
const hsCombustionThermo& thermo,
const compressible::turbulenceModel& turbulence,
const surfaceScalarField& phi,
const volScalarField& rho
);
//- Destructor
virtual ~combustionModel();
// Member Functions
// Access functions
//- Access composition
const basicMultiComponentMixture& composition() const
{
return composition_;
}
//- Access combustion dictionary
const dictionary combustionModelCoeffs() const
{
return combustionModelCoeffs_;
}
//- Access heat of combustion
const dimensionedScalar qFuel() const
{
return qFuel_;
}
//- Return normalised consumption rate of (fu - fres)
virtual tmp<volScalarField> wFuelNorm() const = 0;
//- Fuel consumption rate matrix i.e. source-term for the fuel equation
virtual tmp<fvScalarMatrix> R(volScalarField& fu) const;
//- Heat-release rate calculated from the given
// fuel consumption rate matrix
virtual tmp<volScalarField> dQ(const fvScalarMatrix& Rfu) const;
//- Correct combustion rate
virtual void correct() = 0;
//- Update properties from given dictionary
virtual bool read(const dictionary& combustionProperties) = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,67 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "combustionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::combustionModel> Foam::combustionModel::New
(
const dictionary& combustionProperties,
const 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));
}
// ************************************************************************* //

View file

@ -0,0 +1,94 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "infinitelyFastChemistry.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace combustionModels
{
defineTypeNameAndDebug(infinitelyFastChemistry, 0);
addToRunTimeSelectionTable
(
combustionModel,
infinitelyFastChemistry,
dictionary
);
};
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::combustionModels::infinitelyFastChemistry::infinitelyFastChemistry
(
const dictionary& combustionProperties,
const hsCombustionThermo& thermo,
const compressible::turbulenceModel& turbulence,
const surfaceScalarField& phi,
const volScalarField& rho
)
:
combustionModel(combustionProperties, thermo, turbulence, phi, rho),
C_(readScalar(combustionModelCoeffs_.lookup("C")))
{}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
Foam::combustionModels::infinitelyFastChemistry::~infinitelyFastChemistry()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::combustionModels::infinitelyFastChemistry::correct()
{}
Foam::tmp<Foam::volScalarField>
Foam::combustionModels::infinitelyFastChemistry::wFuelNorm() const
{
return rho_/(mesh_.time().deltaT()*C_);
}
bool Foam::combustionModels::infinitelyFastChemistry::read
(
const dictionary& combustionProperties
)
{
combustionModel::read(combustionProperties);
combustionModelCoeffs_.lookup("C") >> C_ ;
return true;
}
// ************************************************************************* //

View file

@ -0,0 +1,119 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
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 "fvc.H"
#include "combustionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace combustionModels
{
/*---------------------------------------------------------------------------*\
Class infinitelyFastChemistry Declaration
\*---------------------------------------------------------------------------*/
class infinitelyFastChemistry
:
public combustionModel
{
// Private data
//- Model constant
scalar C_;
// 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& combustionProperties,
const hsCombustionThermo& thermo,
const compressible::turbulenceModel& turbulence,
const surfaceScalarField& phi,
const volScalarField& rho
);
// Destructor
virtual ~infinitelyFastChemistry();
// Member Functions
//- Update properties from given dictionary
virtual bool read(const dictionary& combustionProperties);
//- Correct combustion rate
virtual void correct();
//- Return normalised consumption rate of (fu - fres)
virtual tmp<volScalarField> wFuelNorm() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace combustionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,103 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#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& combustionProperties,
const hsCombustionThermo& thermo,
const compressible::turbulenceModel& turbulence,
const surfaceScalarField& phi,
const volScalarField& rho
)
:
combustionModel(combustionProperties, thermo, turbulence, phi, rho)
{}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
Foam::combustionModels::noCombustion::~noCombustion()
{}
void Foam::combustionModels::noCombustion::correct()
{}
Foam::tmp<Foam::volScalarField>
Foam::combustionModels::noCombustion::wFuelNorm() const
{
return tmp<Foam::volScalarField>
(
new volScalarField
(
IOobject
(
"wFuelNorm",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("wFuelNorm", dimMass/dimTime/pow3(dimLength), 0.0)
)
);
}
bool Foam::combustionModels::noCombustion::read
(
const dictionary& combustionProperties
)
{
return combustionModel::read(combustionProperties);
}
// ************************************************************************* //

View file

@ -0,0 +1,113 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::combustionModel::noCombustion
Description
No combustion
SourceFiles
noCombustion.C
\*---------------------------------------------------------------------------*/
#ifndef noCombustion_H
#define noCombustion_H
#include "combustionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace combustionModels
{
/*---------------------------------------------------------------------------*\
Class noCombustion Declaration
\*---------------------------------------------------------------------------*/
class noCombustion
:
public combustionModel
{
// Private data
// Private Member Functions
//- Disallow copy construct
noCombustion(const noCombustion&);
//- Disallow default bitwise assignment
void operator=(const noCombustion&);
public:
//- Runtime type information
TypeName("noCombustion");
// Constructors
//- Construct from components
noCombustion
(
const dictionary& combustionProperties,
const hsCombustionThermo& thermo,
const compressible::turbulenceModel& turbulence,
const surfaceScalarField& phi,
const volScalarField& rho
);
// Destructor
virtual ~noCombustion();
// Member Functions
//- Update properties from given dictionary
virtual bool read(const dictionary& combustionProperties);
//- Correct combustion rate
virtual void correct();
//- Return normalised consumption rate of (fu - fres)
virtual tmp<volScalarField> wFuelNorm() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace combustionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,130 @@
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<hsCombustionThermo> pThermo
(
hsCombustionThermo::New(mesh)
);
hsCombustionThermo& thermo = pThermo();
basicMultiComponentMixture& composition = thermo.composition();
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
thermo.rho()
);
dimensionedScalar stoicRatio
(
thermo.lookup("stoichiometricAirFuelMassRatio")
);
volScalarField& p = thermo.p();
volScalarField& hs = thermo.hs();
const volScalarField& psi = thermo.psi();
volScalarField& ft = composition.Y("ft");
volScalarField& fu = composition.Y("fu");
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::turbulenceModel> turbulence
(
compressible::turbulenceModel::New(rho, U, phi, thermo)
);
IOdictionary combustionProperties
(
IOobject
(
"combustionProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
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 =
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());
p += rho*gh;
thermo.correct();
dimensionedScalar initialMass = fvc::domainIntegrate(rho);
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
if (composition.contains("ft"))
{
fields.add(composition.Y("ft"));
}
if (composition.contains("fu"))
{
fields.add(composition.Y("fu"));
}
fields.add(hs);

View file

@ -0,0 +1,103 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
fireFoam
Description
Transient Solver for Fires and turbulent diffusion flames
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "hsCombustionThermo.H"
#include "turbulenceModel.H"
#include "combustionModel.H"
#include "radiationModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "readGravitationalAcceleration.H"
#include "initContinuityErrs.H"
#include "createFields.H"
#include "createRadiationModel.H"
#include "readTimeControls.H"
#include "compressibleCourantNo.H"
#include "setInitialDeltaT.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
#include "readPISOControls.H"
#include "readTimeControls.H"
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
#include "rhoEqn.H"
// --- Pressure-velocity PIMPLE corrector loop
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
{
#include "UEqn.H"
#include "ftEqn.H"
#include "fuhsEqn.H"
// --- PISO loop
for (int corr=0; corr<nCorr; corr++)
{
#include "pEqn.H"
}
}
turbulence->correct();
rho = thermo.rho();
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View file

@ -0,0 +1,25 @@
tmp<fv::convectionScheme<scalar> > mvConvection
(
fv::convectionScheme<scalar>::New
(
mesh,
fields,
phi,
mesh.divScheme("div(phi,ft_b_h)")
)
);
{
fvScalarMatrix ftEqn
(
fvm::ddt(rho, ft)
+ mvConvection->fvmDiv(phi, ft)
- fvm::laplacian(turbulence->alphaEff(), ft)
);
ftEqn.relax();
ftEqn.solve();
}
Info<< "max(ft) = " << max(ft).value() << endl;
Info<< "min(ft) = " << min(ft).value() << endl;

View file

@ -0,0 +1,47 @@
{
// Solve fuel equation
// ~~~~~~~~~~~~~~~~~~~
fvScalarMatrix R = combustion->R(fu);
{
fvScalarMatrix fuEqn
(
fvm::ddt(rho, fu)
+ mvConvection->fvmDiv(phi, fu)
- fvm::laplacian(turbulence->alphaEff(), fu)
==
R
);
fuEqn.relax();
fuEqn.solve();
}
Info<< "max(fu) = " << max(fu).value() << endl;
Info<< "min(fu) = " << min(fu).value() << endl;
// Solve sensible enthalpy equation
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
radiation->correct();
dQ = combustion->dQ(R);
{
fvScalarMatrix hsEqn
(
fvm::ddt(rho, hs)
+ mvConvection->fvmDiv(phi,hs)
- fvm::laplacian(turbulence->alphaEff(), hs)
==
DpDt
+ dQ
+ radiation->Shs(thermo)
);
hsEqn.relax();
hsEqn.solve();
}
thermo.correct();
combustion->correct();
}

View file

@ -0,0 +1,64 @@
bool closedVolume = false;
rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A();
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
U = rUA*UEqn.H();
surfaceScalarField phiU
(
fvc::interpolate(rho)
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
)
);
phi = phiU + rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf());
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
surfaceScalarField rhorUAf = fvc::interpolate(rho*rUA);
fvScalarMatrix pEqn
(
fvm::ddt(psi,p)
+ fvc::div(phi)
- fvm::laplacian(rhorUAf, p)
);
closedVolume = p.needReference();
if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
{
pEqn.solve(mesh.solver(p.name() + "Final"));
}
else
{
pEqn.solve(mesh.solver(p.name()));
}
if (nonOrth == nNonOrthCorr)
{
phi += pEqn.flux();
}
}
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
#include "rhoEqn.H"
#include "compressibleContinuityErrs.H"
U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf);
U.correctBoundaryConditions();
// For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity
if (closedVolume)
{
p +=
(initialMass - fvc::domainIntegrate(thermo.psi()*p))
/fvc::domainIntegrate(thermo.psi());
rho = thermo.rho();
}

View file

@ -1,18 +1,19 @@
EXE_INC = \
-I../XiFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/turbulenceModels/RAS \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude
-I$(LIB_SRC)/ODE/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lcompressibleRASModels \
-lcombustionThermophysicalModels \
-lfiniteVolume \
-lcompressibleLESModels \
-lreactionThermophysicalModels \
-lspecie \
-lbasicThermophysicalModels \
-lchemistryModel \
-lODE
-lODE \
-lfiniteVolume \
-llduSolvers

View file

@ -3,8 +3,12 @@
fvm::ddt(rho, U)
+ fvm::div(phi, U)
+ turbulence->divDevRhoReff(U)
==
rho*g
);
UEqn.relax();
if (momentumPredictor)
{
solve(UEqn == -fvc::grad(p));

View file

@ -13,7 +13,7 @@ tmp<fv::convectionScheme<scalar> > mvConvection
label inertIndex = -1;
volScalarField Yt = 0.0*Y[0];
for(label i=0; i<Y.size(); i++)
for (label i = 0; i < Y.size(); i++)
{
if (Y[i].name() != inertSpecie)
{

View file

@ -1,5 +1,5 @@
{
Info << "Solving chemistry" << endl;
Info<< "Solving chemistry" << endl;
chemistry.solve
(
@ -21,4 +21,6 @@
{
kappa = 1.0;
}
chemistrySh = kappa*chemistry.Sh()();
}

View file

@ -1,13 +1,16 @@
Info<< nl << "Reading thermophysicalProperties" << endl;
autoPtr<hCombustionThermo> thermo
autoPtr<psiChemistryModel> pChemistry
(
hCombustionThermo::New(mesh)
psiChemistryModel::New(mesh)
);
psiChemistryModel& chemistry = pChemistry();
combustionMixture& composition = thermo->composition();
hsCombustionThermo& thermo = chemistry.thermo();
basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y();
word inertSpecie(thermo->lookup("inertSpecie"));
word inertSpecie(thermo.lookup("inertSpecie"));
volScalarField rho
(
@ -17,7 +20,7 @@ volScalarField rho
runTime.timeName(),
mesh
),
thermo->rho()
thermo.rho()
);
Info<< "Reading field U\n" << endl;
@ -35,11 +38,10 @@ volVectorField U
);
volScalarField& p = thermo->p();
const volScalarField& psi = thermo->psi();
const volScalarField& T = thermo->T();
volScalarField& h = thermo->h();
volScalarField& p = thermo.p();
const volScalarField& psi = thermo.psi();
volScalarField& hs = thermo.hs();
const volScalarField& T = thermo.T();
#include "compressibleCreatePhi.H"
@ -58,14 +60,14 @@ volScalarField kappa
);
Info << "Creating turbulence model.\n" << nl;
autoPtr<compressible::RASModel> turbulence
autoPtr<compressible::turbulenceModel> turbulence
(
compressible::RASModel::New
compressible::turbulenceModel::New
(
rho,
U,
phi,
thermo()
thermo
)
);
@ -73,31 +75,24 @@ Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
Info << "Constructing chemical mechanism" << endl;
chemistryModel chemistry
(
thermo(),
rho
);
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
for(label i=0; i<Y.size(); i++)
forAll(Y, i)
{
fields.add(Y[i]);
}
fields.add(h);
fields.add(hs);
volScalarField dQ
DimensionedField<scalar, volMesh> chemistrySh
(
IOobject
(
"dQ",
"chemistry::Sh",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimensionSet(1,-3,-1,0,0,0,0), 0.0)
dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0)
);

View file

@ -0,0 +1,20 @@
{
fvScalarMatrix hsEqn
(
fvm::ddt(rho, hs)
+ mvConvection->fvmDiv(phi, hs)
- fvm::laplacian(turbulence->alphaEff(), hs)
// - fvm::laplacian(turbulence->muEff(), hs) // unit lewis no.
==
DpDt
+ chemistrySh
);
hsEqn.relax();
hsEqn.solve();
thermo.correct();
Info<< "T gas min/max = " << min(T).value() << ", "
<< max(T).value() << endl;
}

View file

@ -1,4 +1,4 @@
rho = thermo->rho();
rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A();
U = rUA*UEqn.H();
@ -8,7 +8,7 @@ if (transonic)
surfaceScalarField phid
(
"phid",
fvc::interpolate(thermo->psi())
fvc::interpolate(psi)
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
@ -35,8 +35,8 @@ if (transonic)
else
{
phi =
fvc::interpolate(rho)*
(
fvc::interpolate(rho)
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
);

View file

@ -26,14 +26,14 @@ Application
reactingFoam
Description
Chemical reaction code.
Solver for combustion with chemical reactions.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "hCombustionThermo.H"
#include "compressible/RASModel/RASModel.H"
#include "chemistryModel.H"
#include "turbulenceModel.H"
#include "psiChemistryModel.H"
#include "chemistrySolver.H"
#include "multivariateScheme.H"
@ -45,7 +45,7 @@ int main(int argc, char *argv[])
# include "createTime.H"
# include "createMesh.H"
# include "readChemistryProperties.H"
# include "readEnvironmentalProperties.H"
# include "readGravitationalAcceleration.H"
# include "createFields.H"
# include "initContinuityErrs.H"
# include "readTimeControls.H"
@ -68,14 +68,12 @@ int main(int argc, char *argv[])
# include "chemistry.H"
# include "rhoEqn.H"
# include "UEqn.H"
for (label ocorr=1; ocorr <= nOuterCorr; ocorr++)
{
# include "UEqn.H"
# include "YEqn.H"
# define Db turbulence->alphaEff()
# include "hEqn.H"
# include "hsEqn.H"
// --- PISO loop
for (int corr=1; corr<=nCorr; corr++)
@ -86,7 +84,10 @@ int main(int argc, char *argv[])
turbulence->correct();
rho = thermo->rho();
if (runTime.write())
{
chemistry.dQ()().write();
}
runTime.write();
@ -97,7 +98,7 @@ int main(int argc, char *argv[])
Info<< "End\n" << endl;
return(0);
return 0;
}

View file

@ -8,7 +8,8 @@ IOdictionary chemistryProperties
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
IOobject::NO_WRITE,
false
)
);

View file

@ -0,0 +1,3 @@
rhoReactingFoam.C
EXE = $(FOAM_APPBIN)/rhoReactingFoam

View file

@ -0,0 +1,18 @@
EXE_INC = \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lreactionThermophysicalModels \
-lspecie \
-lbasicThermophysicalModels \
-lchemistryModel \
-lODE \
-lfiniteVolume

View file

@ -1,12 +1,15 @@
// Solve the Momentum equation
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(phi, U)
+ turbulence->divDevRhoReff(U)
==
rho*g
);
UEqn.relax();
solve(UEqn == -fvc::grad(pd) - fvc::grad(rho)*gh);
if (momentumPredictor)
{
solve(UEqn == -fvc::grad(p));
}

View file

@ -0,0 +1,43 @@
tmp<fv::convectionScheme<scalar> > mvConvection
(
fv::convectionScheme<scalar>::New
(
mesh,
fields,
phi,
mesh.divScheme("div(phi,Yi_h)")
)
);
{
label inertIndex = -1;
volScalarField Yt = 0.0*Y[0];
for (label i=0; i<Y.size(); i++)
{
if (Y[i].name() != inertSpecie)
{
volScalarField& Yi = Y[i];
solve
(
fvm::ddt(rho, Yi)
+ mvConvection->fvmDiv(phi, Yi)
- fvm::laplacian(turbulence->muEff(), Yi)
==
kappa*chemistry.RR(i),
mesh.solver("Yi")
);
Yi.max(0.0);
Yt += Yi;
}
else
{
inertIndex = i;
}
}
Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].max(0.0);
}

View file

@ -0,0 +1,26 @@
{
Info<< "Solving chemistry" << endl;
chemistry.solve
(
runTime.value() - runTime.deltaT().value(),
runTime.deltaT().value()
);
// turbulent time scale
if (turbulentReaction)
{
volScalarField tk =
Cmix*sqrt(turbulence->muEff()/rho/turbulence->epsilon());
volScalarField tc = chemistry.tc();
// Chalmers PaSR model
kappa = (runTime.deltaT() + tc)/(runTime.deltaT() + tc + tk);
}
else
{
kappa = 1.0;
}
chemistrySh = kappa*chemistry.Sh()();
}

View file

@ -0,0 +1,99 @@
Info<< nl << "Reading thermophysicalProperties" << endl;
autoPtr<rhoChemistryModel> pChemistry
(
rhoChemistryModel::New(mesh)
);
rhoChemistryModel& chemistry = pChemistry();
hsReactionThermo& thermo = chemistry.thermo();
basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y();
word inertSpecie(thermo.lookup("inertSpecie"));
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh
),
thermo.rho()
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
volScalarField& p = thermo.p();
const volScalarField& psi = thermo.psi();
volScalarField& hs = thermo.hs();
const volScalarField& T = thermo.T();
#include "compressibleCreatePhi.H"
volScalarField kappa
(
IOobject
(
"kappa",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero", dimless, 0.0)
);
Info << "Creating turbulence model.\n" << nl;
autoPtr<compressible::turbulenceModel> turbulence
(
compressible::turbulenceModel::New
(
rho,
U,
phi,
thermo
)
);
Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
forAll(Y, i)
{
fields.add(Y[i]);
}
fields.add(hs);
DimensionedField<scalar, volMesh> chemistrySh
(
IOobject
(
"chemistry::Sh",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("chemistrySh", dimEnergy/dimTime/dimVolume, 0.0)
);

View file

@ -0,0 +1,19 @@
{
fvScalarMatrix hsEqn
(
fvm::ddt(rho, hs)
+ mvConvection->fvmDiv(phi, hs)
- fvm::laplacian(turbulence->alphaEff(), hs)
==
DpDt
+ chemistrySh
);
hsEqn.relax();
hsEqn.solve();
thermo.correct();
Info<< "T gas min/max = " << min(T).value() << ", "
<< max(T).value() << endl;
}

View file

@ -0,0 +1,93 @@
{
rho = thermo.rho();
// Thermodynamic density needs to be updated by psi*d(p) after the
// pressure solution - done in 2 parts. Part 1:
thermo.rho() -= psi*p;
volScalarField rUA = 1.0/UEqn.A();
U = rUA*UEqn.H();
if (transonic)
{
surfaceScalarField phiv =
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi);
phi = fvc::interpolate(rho)*phiv;
surfaceScalarField phid
(
"phid",
fvc::interpolate(thermo.psi())*phiv
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvc::ddt(rho) + fvc::div(phi)
+ correction(fvm::ddt(psi, p) + fvm::div(phid, p))
- fvm::laplacian(rho*rUA, p)
);
if (ocorr == nOuterCorr && corr == nCorr && nonOrth == nNonOrthCorr)
{
pEqn.solve(mesh.solver(p.name() + "Final"));
}
else
{
pEqn.solve();
}
if (nonOrth == nNonOrthCorr)
{
phi += pEqn.flux();
}
}
}
else
{
phi =
fvc::interpolate(rho)
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvc::ddt(rho) + psi*correction(fvm::ddt(p))
+ fvc::div(phi)
- fvm::laplacian(rho*rUA, p)
);
if (ocorr == nOuterCorr && corr == nCorr && nonOrth == nNonOrthCorr)
{
pEqn.solve(mesh.solver(p.name() + "Final"));
}
else
{
pEqn.solve();
}
if (nonOrth == nNonOrthCorr)
{
phi += pEqn.flux();
}
}
}
// Second part of thermodynamic density update
thermo.rho() += psi*p;
#include "rhoEqn.H"
#include "compressibleContinuityErrs.H"
U -= rUA*fvc::grad(p);
U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
}

View file

@ -0,0 +1,23 @@
Info<< "Reading chemistry properties\n" << endl;
IOdictionary chemistryProperties
(
IOobject
(
"chemistryProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
Switch turbulentReaction(chemistryProperties.lookup("turbulentReaction"));
dimensionedScalar Cmix("Cmix", dimless, 1.0);
if (turbulentReaction)
{
chemistryProperties.lookup("Cmix") >> Cmix;
}

View file

@ -0,0 +1,106 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
rhoReactingFoam
Description
Solver for combustion with chemical reactions using density based
thermodynamics package.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "hReactionThermo.H"
#include "turbulenceModel.H"
#include "rhoChemistryModel.H"
#include "chemistrySolver.H"
#include "multivariateScheme.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 "initContinuityErrs.H"
#include "readTimeControls.H"
#include "compressibleCourantNo.H"
#include "setInitialDeltaT.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
#include "readTimeControls.H"
#include "readPISOControls.H"
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
#include "chemistry.H"
#include "rhoEqn.H"
for (label ocorr=1; ocorr <= nOuterCorr; ocorr++)
{
#include "UEqn.H"
#include "YEqn.H"
#include "hsEqn.H"
// --- PISO loop
for (int corr=1; corr<=nCorr; corr++)
{
#include "pEqn.H"
}
}
turbulence->correct();
rho = thermo.rho();
if (runTime.write())
{
chemistry.dQ()().write();
}
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View file

@ -1,3 +0,0 @@
coodles.C
EXE = $(FOAM_APPBIN)/coodles

View file

@ -1,50 +0,0 @@
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<basicThermo> thermo
(
basicThermo::New(mesh)
);
volScalarField& p = thermo->p();
volScalarField& h = thermo->h();
const volScalarField& psi = thermo->psi();
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
thermo->rho()
);
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::LESModel> turbulence
(
compressible::LESModel::New(rho, U, phi, thermo())
);
Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View file

@ -1,5 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wclean libso BCs
wclean
# ----------------------------------------------------------------- end-of-file

View file

@ -1,5 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso BCs
wmake
# ----------------------------------------------------------------- end-of-file

View file

@ -82,8 +82,7 @@ smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
if
(
mag(accommodationCoeff_) < SMALL
||
mag(accommodationCoeff_) > 2.0
|| mag(accommodationCoeff_) > 2.0
)
{
FatalIOErrorIn
@ -96,8 +95,8 @@ smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
" const dictionary&"
")",
dict
) << "unphysical accommodationCoeff_ specified"
<< "(0 < accommodationCoeff_ <= 1)" << endl
) << "unphysical accommodationCoeff specified"
<< "(0 < accommodationCoeff <= 1)" << endl
<< exit(FatalError);
}
@ -113,15 +112,6 @@ smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
fvPatchField<scalar>::operator=(patchInternalField());
}
if (dict.found("gamma"))
{
gamma_ = readScalar(dict.lookup("gamma"));
}
else
{
gamma_ = 1.4;
}
refValue() = *this;
refGrad() = 0.0;
valueFraction() = 0.0;

View file

@ -8,5 +8,4 @@ EXE_LIBS = \
-lfiniteVolume \
-lbasicThermophysicalModels \
-lspecie \
-L$(FOAM_USER_LIBBIN) \
-lrhoCentralFoam

View file

@ -38,11 +38,11 @@ if (mesh.nInternalFaces())
surfaceScalarField amaxSfbyDelta =
mesh.surfaceInterpolation::deltaCoeffs()*amaxSf;
CoNum = max(amaxSfbyDelta/mesh.magSf())
.value()*runTime.deltaT().value();
CoNum = max(amaxSfbyDelta/mesh.magSf()).value()*runTime.deltaT().value();
meanCoNum = (sum(amaxSfbyDelta)/sum(mesh.magSf()))
.value()*runTime.deltaT().value();
meanCoNum =
(sum(amaxSfbyDelta)/sum(mesh.magSf())).value()
*runTime.deltaT().value();
}
Info<< "Mean and max Courant Numbers = "

View file

@ -1,15 +1,16 @@
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<basicThermo> thermo
autoPtr<basicPsiThermo> pThermo
(
basicThermo::New(mesh)
basicPsiThermo::New(mesh)
);
basicPsiThermo& thermo = pThermo();
volScalarField& p = thermo->p();
volScalarField& h = thermo->h();
const volScalarField& T = thermo->T();
const volScalarField& psi = thermo->psi();
const volScalarField& mu = thermo->mu();
volScalarField& p = thermo.p();
volScalarField& e = thermo.e();
const volScalarField& T = thermo.T();
const volScalarField& psi = thermo.psi();
const volScalarField& mu = thermo.mu();
bool inviscid(true);
if (max(mu.internalField()) > 0.0)
@ -42,7 +43,7 @@ volScalarField rho
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
thermo->rho(),
thermo.rho(),
rhoBoundaryTypes
);
@ -69,7 +70,7 @@ volScalarField rhoE
IOobject::NO_READ,
IOobject::NO_WRITE
),
rho*(h + 0.5*magSqr(U)) - p
rho*(e + 0.5*magSqr(U))
);
surfaceScalarField pos

View file

@ -3,10 +3,7 @@ wordList rhoBoundaryTypes = pbf.types();
forAll(rhoBoundaryTypes, patchi)
{
if
(
rhoBoundaryTypes[patchi] == "waveTransmissive"
)
if (rhoBoundaryTypes[patchi] == "waveTransmissive")
{
rhoBoundaryTypes[patchi] = zeroGradientFvPatchScalarField::typeName;
}

View file

@ -32,7 +32,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "basicThermo.H"
#include "basicPsiThermo.H"
#include "zeroGradientFvPatchFields.H"
#include "fixedRhoFvPatchScalarField.H"
@ -40,7 +40,6 @@ Description
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
@ -77,10 +76,10 @@ int main(int argc, char *argv[])
surfaceScalarField rPsi_neg =
fvc::interpolate(rPsi, neg, "reconstruct(T)");
surfaceScalarField h_pos =
fvc::interpolate(h, pos, "reconstruct(T)");
surfaceScalarField h_neg =
fvc::interpolate(h, neg, "reconstruct(T)");
surfaceScalarField e_pos =
fvc::interpolate(e, pos, "reconstruct(T)");
surfaceScalarField e_neg =
fvc::interpolate(e, neg, "reconstruct(T)");
surfaceVectorField U_pos = rhoU_pos/rho_pos;
surfaceVectorField U_neg = rhoU_neg/rho_neg;
@ -91,7 +90,7 @@ int main(int argc, char *argv[])
surfaceScalarField phiv_pos = U_pos & mesh.Sf();
surfaceScalarField phiv_neg = U_neg & mesh.Sf();
volScalarField c = sqrt(thermo->Cp()/thermo->Cv()*rPsi);
volScalarField c = sqrt(thermo.Cp()/thermo.Cv()*rPsi);
surfaceScalarField cSf_pos = fvc::interpolate(c, pos, "reconstruct(T)")*mesh.magSf();
surfaceScalarField cSf_neg = fvc::interpolate(c, neg, "reconstruct(T)")*mesh.magSf();
@ -102,14 +101,6 @@ int main(int argc, char *argv[])
surfaceScalarField amaxSf("amaxSf", max(mag(am), mag(ap)));
# include "compressibleCourantNo.H"
# include "readTimeControls.H"
# include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
surfaceScalarField aSf = am*a_pos;
if (fluxScheme == "Tadmor")
@ -126,6 +117,18 @@ int main(int argc, char *argv[])
surfaceScalarField aphiv_pos = phiv_pos - aSf;
surfaceScalarField aphiv_neg = phiv_neg + aSf;
// Reuse amaxSf for the maximum positive and negative fluxes
// estimated by the central scheme
amaxSf = max(mag(aphiv_pos), mag(aphiv_neg));
#include "compressibleCourantNo.H"
#include "readTimeControls.H"
#include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
surfaceScalarField phi("phi", aphiv_pos*rho_pos + aphiv_neg*rho_neg);
surfaceVectorField phiUp =
@ -133,8 +136,8 @@ int main(int argc, char *argv[])
+ (a_pos*p_pos + a_neg*p_neg)*mesh.Sf();
surfaceScalarField phiEp =
aphiv_pos*rho_pos*(h_pos + 0.5*magSqr(U_pos))
+ aphiv_neg*rho_neg*(h_neg + 0.5*magSqr(U_neg))
aphiv_pos*(rho_pos*(e_pos + 0.5*magSqr(U_pos)) + p_pos)
+ aphiv_neg*(rho_neg*(e_neg + 0.5*magSqr(U_neg)) + p_neg)
+ aSf*p_pos - aSf*p_neg;
volTensorField tauMC("tauMC", mu*dev2(fvc::grad(U)().T()));
@ -181,28 +184,27 @@ int main(int argc, char *argv[])
- fvc::div(sigmaDotU)
);
h = (rhoE + p)/rho - 0.5*magSqr(U);
h.correctBoundaryConditions();
thermo->correct();
e = rhoE/rho - 0.5*magSqr(U);
e.correctBoundaryConditions();
thermo.correct();
rhoE.boundaryField() =
rho.boundaryField()*
(
h.boundaryField() + 0.5*magSqr(U.boundaryField())
)
- p.boundaryField();
e.boundaryField() + 0.5*magSqr(U.boundaryField())
);
if (!inviscid)
{
volScalarField k("k", thermo->Cp()*mu/Pr);
volScalarField k("k", thermo.Cp()*mu/Pr);
solve
(
fvm::ddt(rho, h) - fvc::ddt(rho, h)
- fvm::laplacian(thermo->alpha(), h)
+ fvc::laplacian(thermo->alpha(), h)
fvm::ddt(rho, e) - fvc::ddt(rho, e)
- fvm::laplacian(thermo.alpha(), e)
+ fvc::laplacian(thermo.alpha(), e)
- fvc::laplacian(k, T)
);
thermo->correct();
rhoE = rho*(h + 0.5*magSqr(U)) - p;
thermo.correct();
rhoE = rho*(e + 0.5*magSqr(U));
}
p.dimensionedInternalField() =
@ -220,7 +222,7 @@ int main(int argc, char *argv[])
Info<< "End\n" << endl;
return(0);
return 0;
}
// ************************************************************************* //

View file

@ -1,12 +1,13 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels/RAS
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleRASModels
-lcompressibleRASModels \
-lcompressibleLESModels \
-lfiniteVolume \
-lmeshTools

Some files were not shown because too many files have changed in this diff Show more