merge with master + fix conflicts in tuts/mesh

This commit is contained in:
andy
2009-07-08 12:15:44 +01:00
1986 changed files with 135330 additions and 117875 deletions

3
.gitignore vendored
View File

@ -7,6 +7,7 @@
*.orig *.orig
*.bak *.bak
\#*\# \#*\#
.directory
# CVS recovered versions - anywhere # CVS recovered versions - anywhere
.#* .#*
@ -48,7 +49,9 @@ doc/[Dd]oxygen/man
# source packages - anywhere # source packages - anywhere
*.tar.bz2 *.tar.bz2
*.tar.gz *.tar.gz
*.tar
*.tgz *.tgz
*.gtgz
# ignore the persistent .build tag in the main directory # ignore the persistent .build tag in the main directory
/.build /.build

View File

@ -41,7 +41,6 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
@ -51,7 +50,7 @@ int main(int argc, char *argv[])
#include "readTurbulenceProperties.H" #include "readTurbulenceProperties.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< nl << "Starting time loop" << endl; Info<< nl << "Starting time loop" << endl;

View File

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

View File

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

View File

@ -36,7 +36,7 @@ Description
to be appropriate by comparison with the results from the to be appropriate by comparison with the results from the
spectral model. 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 but not in the algebraic approximation. Further work need to be
done on this issue, particularly regarding the enhanced removal rate done on this issue, particularly regarding the enhanced removal rate
caused by flame compression. Analysis using results of the spectral caused by flame compression. Analysis using results of the spectral
@ -77,7 +77,6 @@ int main(int argc, char *argv[])
#include "readCombustionProperties.H" #include "readCombustionProperties.H"
#include "readEnvironmentalProperties.H" #include "readEnvironmentalProperties.H"
#include "createFields.H" #include "createFields.H"
# include "readPISOControls.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
#include "readTimeControls.H" #include "readTimeControls.H"
#include "CourantNo.H" #include "CourantNo.H"
@ -85,7 +84,7 @@ int main(int argc, char *argv[])
scalar StCoNum = 0.0; scalar StCoNum = 0.0;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;

View File

@ -39,11 +39,13 @@ if (mesh.nInternalFaces())
mesh.surfaceInterpolation::deltaCoeffs() mesh.surfaceInterpolation::deltaCoeffs()
*mag(phiSt/fvc::interpolate(rho)); *mag(phiSt/fvc::interpolate(rho));
StCoNum = max(SfUfbyDelta/mesh.magSf()) StCoNum =
.value()*runTime.deltaT().value(); max(SfUfbyDelta/mesh.magSf()).value()
*runTime.deltaT().value();
meanStCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf())) meanStCoNum =
.value()*runTime.deltaT().value(); (sum(SfUfbyDelta)/sum(mesh.magSf())).value()
*runTime.deltaT().value();
} }
Info<< "St courant Number mean: " << meanStCoNum Info<< "St courant Number mean: " << meanStCoNum

View File

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

View File

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

View File

@ -8,5 +8,5 @@
betav*DpDt 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) //+ fvm::Sp(fvc::div(muEff*fvc::grad(b)/(b + 0.001)), hu)
== ==
betav*DpDt*rho/thermo->rhou() betav*DpDt*rho/thermo.rhou()
); );
} }

View File

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

View File

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

View File

@ -2,7 +2,7 @@ EXE_INC = \
-I$(LIB_SRC)/engine/lnInclude \ -I$(LIB_SRC)/engine/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \
@ -13,7 +13,7 @@ EXE_LIBS = \
-lcompressibleRASModels \ -lcompressibleRASModels \
-lcompressibleLESModels \ -lcompressibleLESModels \
-lbasicThermophysicalModels \ -lbasicThermophysicalModels \
-lcombustionThermophysicalModels \ -lreactionThermophysicalModels \
-lspecie \ -lspecie \
-llaminarFlameSpeedModels \ -llaminarFlameSpeedModels \
-lfiniteVolume \ -lfiniteVolume \

View File

@ -68,13 +68,12 @@ int main(int argc, char *argv[])
#include "readCombustionProperties.H" #include "readCombustionProperties.H"
#include "readEnvironmentalProperties.H" #include "readEnvironmentalProperties.H"
#include "createFields.H" #include "createFields.H"
# include "readPISOControls.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
#include "readTimeControls.H" #include "readTimeControls.H"
#include "compressibleCourantNo.H" #include "compressibleCourantNo.H"
#include "setInitialDeltaT.H" #include "setInitialDeltaT.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;
@ -109,7 +108,7 @@ int main(int argc, char *argv[])
turbulence->correct(); turbulence->correct();
rho = thermo->rho(); rho = thermo.rho();
runTime.write(); runTime.write();

View File

@ -6,7 +6,7 @@ if (ign.ignited())
// Unburnt gas density // Unburnt gas density
// ~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~
volScalarField rhou = thermo->rhou(); volScalarField rhou = thermo.rhou();
// Calculate flame normal etc. // Calculate flame normal etc.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -76,7 +76,7 @@ if (ign.ignited())
volScalarField epsilon = pow(uPrimeCoef, 3)*turbulence->epsilon(); volScalarField epsilon = pow(uPrimeCoef, 3)*turbulence->epsilon();
volScalarField tauEta = sqrt(thermo->muu()/(rhou*epsilon)); volScalarField tauEta = sqrt(thermo.muu()/(rhou*epsilon));
volScalarField Reta = up/ volScalarField Reta = up/
( (

View File

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

View File

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

View File

@ -4,7 +4,7 @@ EXE_INC = \
-I$(LIB_SRC)/engine/lnInclude \ -I$(LIB_SRC)/engine/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/finiteVolume/lnInclude -I$(LIB_SRC)/finiteVolume/lnInclude

View File

@ -33,7 +33,7 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "engineTime.H" #include "engineTime.H"
#include "engineMesh.H" #include "engineMesh.H"
#include "basicThermo.H" #include "basicPsiThermo.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "OFstream.H" #include "OFstream.H"
@ -52,7 +52,7 @@ int main(int argc, char *argv[])
#include "setInitialDeltaT.H" #include "setInitialDeltaT.H"
#include "startSummary.H" #include "startSummary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;

View File

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

View File

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

View File

@ -7,10 +7,10 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/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/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/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)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \
-I$(LIB_SRC)/engine/lnInclude \ -I$(LIB_SRC)/engine/lnInclude \
@ -20,7 +20,7 @@ EXE_LIBS = \
-lengine \ -lengine \
-lcompressibleRASModels \ -lcompressibleRASModels \
-lcompressibleLESModels \ -lcompressibleLESModels \
-lcombustionThermophysicalModels \ -lreactionThermophysicalModels \
-lfiniteVolume \ -lfiniteVolume \
-llagrangian \ -llagrangian \
-ldieselSpray \ -ldieselSpray \

View File

@ -42,5 +42,4 @@ tmp<fv::convectionScheme<scalar> > mvConvection
Y[inertIndex] = scalar(1) - Yt; Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].max(0.0); Y[inertIndex].max(0.0);
} }

View File

@ -1,13 +1,17 @@
Info<< nl << "Reading thermophysicalProperties" << endl; Info<< nl << "Reading thermophysicalProperties" << endl;
autoPtr<hCombustionThermo> thermo
(
hCombustionThermo::New(mesh)
);
combustionMixture& composition = thermo->composition(); autoPtr<psiChemistryModel> pChemistry
(
psiChemistryModel::New(mesh)
);
psiChemistryModel& chemistry = pChemistry();
hCombustionThermo& thermo = chemistry.thermo();
basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y(); PtrList<volScalarField>& Y = composition.Y();
word inertSpecie(thermo->lookup("inertSpecie")); word inertSpecie(thermo.lookup("inertSpecie"));
volScalarField rho volScalarField rho
( (
@ -17,7 +21,7 @@ volScalarField rho
runTime.timeName(), runTime.timeName(),
mesh mesh
), ),
thermo->rho() thermo.rho()
); );
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl;
@ -35,10 +39,10 @@ volVectorField U
); );
volScalarField& p = thermo->p(); volScalarField& p = thermo.p();
const volScalarField& psi = thermo->psi(); const volScalarField& psi = thermo.psi();
const volScalarField& T = thermo->T(); const volScalarField& T = thermo.T();
volScalarField& h = thermo->h(); volScalarField& h = thermo.h();
#include "compressibleCreatePhi.H" #include "compressibleCreatePhi.H"
@ -65,7 +69,7 @@ autoPtr<compressible::turbulenceModel> turbulence
rho, rho,
U, U,
phi, phi,
thermo() thermo
) )
); );
@ -73,31 +77,11 @@ Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt = volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
Info << "Constructing chemical mechanism" << endl;
chemistryModel chemistry
(
thermo(),
rho
);
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields; multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
for(label i=0; i<Y.size(); i++) forAll (Y, i)
{ {
fields.add(Y[i]); fields.add(Y[i]);
} }
fields.add(h); fields.add(h);
volScalarField dQ
(
IOobject
(
"dQ",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero", dimensionSet(1,-3,-1,0,0,0,0), 0.0)
);

View File

@ -1,14 +1,15 @@
Info << "Constructing Spray" << endl; Info << "Constructing Spray" << endl;
PtrList<specieProperties> gasProperties(Y.size()); PtrList<gasThermoPhysics> gasProperties(Y.size());
forAll(gasProperties, i) forAll(gasProperties, i)
{ {
gasProperties.set gasProperties.set
( (
i, i,
new specieProperties new gasThermoPhysics
( (
dynamic_cast<const reactingMixture&>(thermo()).speciesData()[i] dynamic_cast<const reactingMixture<gasThermoPhysics>&>
(thermo).speciesData()[i]
) )
); );
} }

View File

@ -36,12 +36,13 @@ Description
#include "hCombustionThermo.H" #include "hCombustionThermo.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "spray.H" #include "spray.H"
#include "chemistryModel.H" #include "psiChemistryModel.H"
#include "chemistrySolver.H" #include "chemistrySolver.H"
#include "multivariateScheme.H" #include "multivariateScheme.H"
#include "Switch.H" #include "Switch.H"
#include "OFstream.H" #include "OFstream.H"
#include "volPointInterpolation.H" #include "volPointInterpolation.H"
#include "thermoPhysicsTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +61,7 @@ int main(int argc, char *argv[])
#include "setInitialDeltaT.H" #include "setInitialDeltaT.H"
#include "startSummary.H" #include "startSummary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info << "\nStarting time loop\n" << endl; Info << "\nStarting time loop\n" << endl;
@ -121,7 +122,7 @@ int main(int argc, char *argv[])
#include "logSummary.H" #include "logSummary.H"
#include "spraySummary.H" #include "spraySummary.H"
rho = thermo->rho(); rho = thermo.rho();
runTime.write(); runTime.write();

View File

@ -9,32 +9,5 @@
+ dieselSpray.heatTransferSource() + dieselSpray.heatTransferSource()
); );
thermo->correct(); 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

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

View File

@ -8,17 +8,17 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/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/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/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)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude -I$(LIB_SRC)/ODE/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lcompressibleRASModels \ -lcompressibleRASModels \
-lcompressibleLESModels \ -lcompressibleLESModels \
-lcombustionThermophysicalModels \ -lreactionThermophysicalModels \
-llagrangian \ -llagrangian \
-ldieselSpray \ -ldieselSpray \
-lliquids \ -lliquids \

View File

@ -34,7 +34,7 @@ Description
#include "hCombustionThermo.H" #include "hCombustionThermo.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "spray.H" #include "spray.H"
#include "chemistryModel.H" #include "psiChemistryModel.H"
#include "chemistrySolver.H" #include "chemistrySolver.H"
#include "multivariateScheme.H" #include "multivariateScheme.H"
@ -46,7 +46,6 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createMesh.H" #include "createMesh.H"
@ -59,7 +58,7 @@ int main(int argc, char *argv[])
#include "compressibleCourantNo.H" #include "compressibleCourantNo.H"
#include "setInitialDeltaT.H" #include "setInitialDeltaT.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info << "\nStarting time loop\n" << endl; Info << "\nStarting time loop\n" << endl;
@ -113,7 +112,7 @@ int main(int argc, char *argv[])
#include "spraySummary.H" #include "spraySummary.H"
rho = thermo->rho(); rho = thermo.rho();
runTime.write(); runTime.write();

View File

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

View File

@ -3,7 +3,7 @@ EXE_INC = \
-I$(LIB_SRC)/engine/lnInclude \ -I$(LIB_SRC)/engine/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude -I$(LIB_SRC)/finiteVolume/lnInclude
@ -13,7 +13,7 @@ EXE_LIBS = \
-lcompressibleRASModels \ -lcompressibleRASModels \
-lcompressibleLESModels \ -lcompressibleLESModels \
-lbasicThermophysicalModels \ -lbasicThermophysicalModels \
-lcombustionThermophysicalModels \ -lreactionThermophysicalModels \
-lspecie \ -lspecie \
-llaminarFlameSpeedModels \ -llaminarFlameSpeedModels \
-lfiniteVolume -lfiniteVolume

View File

@ -67,7 +67,6 @@ int main(int argc, char *argv[])
#include "createEngineTime.H" #include "createEngineTime.H"
#include "createEngineMesh.H" #include "createEngineMesh.H"
# include "readPISOControls.H"
#include "readCombustionProperties.H" #include "readCombustionProperties.H"
#include "createFields.H" #include "createFields.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
@ -76,7 +75,7 @@ int main(int argc, char *argv[])
#include "setInitialDeltaT.H" #include "setInitialDeltaT.H"
#include "startSummary.H" #include "startSummary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info << "\nStarting time loop\n" << endl; Info << "\nStarting time loop\n" << endl;
@ -117,7 +116,7 @@ int main(int argc, char *argv[])
#include "logSummary.H" #include "logSummary.H"
rho = thermo->rho(); rho = thermo.rho();
runTime.write(); runTime.write();

View File

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

View File

@ -2,7 +2,7 @@ EXE_INC = \
-I../XiFoam \ -I../XiFoam \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -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/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \
@ -11,7 +11,7 @@ EXE_INC = \
EXE_LIBS = \ EXE_LIBS = \
-lcompressibleRASModels \ -lcompressibleRASModels \
-lcompressibleLESModels \ -lcompressibleLESModels \
-lcombustionThermophysicalModels \ -lreactionThermophysicalModels \
-lspecie \ -lspecie \
-lbasicThermophysicalModels \ -lbasicThermophysicalModels \
-lchemistryModel \ -lchemistryModel \

View File

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

View File

@ -33,7 +33,7 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "hCombustionThermo.H" #include "hCombustionThermo.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "chemistryModel.H" #include "psiChemistryModel.H"
#include "chemistrySolver.H" #include "chemistrySolver.H"
#include "multivariateScheme.H" #include "multivariateScheme.H"
@ -52,7 +52,7 @@ int main(int argc, char *argv[])
#include "compressibleCourantNo.H" #include "compressibleCourantNo.H"
#include "setInitialDeltaT.H" #include "setInitialDeltaT.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info << "\nStarting time loop\n" << endl; Info << "\nStarting time loop\n" << endl;
@ -86,7 +86,7 @@ int main(int argc, char *argv[])
turbulence->correct(); turbulence->correct();
rho = thermo->rho(); rho = thermo.rho();
runTime.write(); runTime.write();

View File

@ -8,7 +8,8 @@ IOdictionary chemistryProperties
runTime.constant(), runTime.constant(),
mesh, mesh,
IOobject::MUST_READ, 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,19 @@
EXE_INC = \
-I../XiFoam \
-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

@ -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,24 @@
{
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;
}
}

View File

@ -0,0 +1,85 @@
Info<< nl << "Reading thermophysicalProperties" << endl;
autoPtr<rhoChemistryModel> pChemistry
(
rhoChemistryModel::New(mesh)
);
rhoChemistryModel& chemistry = pChemistry();
hReactionThermo& 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& h = thermo.h();
#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(h);

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,102 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 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
Chemical reaction code 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 "readEnvironmentalProperties.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"
#include "UEqn.H"
for (label ocorr=1; ocorr <= nOuterCorr; ocorr++)
{
#include "YEqn.H"
#include "hEqn.H"
// --- PISO loop
for (int corr=1; 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

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

View File

@ -1,15 +1,16 @@
Info<< "Reading thermophysical properties\n" << endl; 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& p = thermo.p();
volScalarField& h = thermo->h(); volScalarField& h = thermo.h();
const volScalarField& T = thermo->T(); const volScalarField& T = thermo.T();
const volScalarField& psi = thermo->psi(); const volScalarField& psi = thermo.psi();
const volScalarField& mu = thermo->mu(); const volScalarField& mu = thermo.mu();
bool inviscid(true); bool inviscid(true);
if (max(mu.internalField()) > 0.0) if (max(mu.internalField()) > 0.0)
@ -42,7 +43,7 @@ volScalarField rho
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
thermo->rho(), thermo.rho(),
rhoBoundaryTypes rhoBoundaryTypes
); );

View File

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

View File

@ -32,7 +32,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "basicThermo.H" #include "basicPsiThermo.H"
#include "zeroGradientFvPatchFields.H" #include "zeroGradientFvPatchFields.H"
#include "fixedRhoFvPatchScalarField.H" #include "fixedRhoFvPatchScalarField.H"
@ -40,7 +40,6 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
@ -49,7 +48,7 @@ int main(int argc, char *argv[])
#include "readThermophysicalProperties.H" #include "readThermophysicalProperties.H"
#include "readTimeControls.H" #include "readTimeControls.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "readFluxScheme.H" #include "readFluxScheme.H"
@ -91,7 +90,7 @@ int main(int argc, char *argv[])
surfaceScalarField phiv_pos = U_pos & mesh.Sf(); surfaceScalarField phiv_pos = U_pos & mesh.Sf();
surfaceScalarField phiv_neg = U_neg & 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_pos = fvc::interpolate(c, pos, "reconstruct(T)")*mesh.magSf();
surfaceScalarField cSf_neg = fvc::interpolate(c, neg, "reconstruct(T)")*mesh.magSf(); surfaceScalarField cSf_neg = fvc::interpolate(c, neg, "reconstruct(T)")*mesh.magSf();
@ -183,7 +182,7 @@ int main(int argc, char *argv[])
h = (rhoE + p)/rho - 0.5*magSqr(U); h = (rhoE + p)/rho - 0.5*magSqr(U);
h.correctBoundaryConditions(); h.correctBoundaryConditions();
thermo->correct(); thermo.correct();
rhoE.boundaryField() = rhoE.boundaryField() =
rho.boundaryField()* rho.boundaryField()*
( (
@ -193,15 +192,15 @@ int main(int argc, char *argv[])
if (!inviscid) if (!inviscid)
{ {
volScalarField k("k", thermo->Cp()*mu/Pr); volScalarField k("k", thermo.Cp()*mu/Pr);
solve solve
( (
fvm::ddt(rho, h) - fvc::ddt(rho, h) fvm::ddt(rho, h) - fvc::ddt(rho, h)
- fvm::laplacian(thermo->alpha(), h) - fvm::laplacian(thermo.alpha(), h)
+ fvc::laplacian(thermo->alpha(), h) + fvc::laplacian(thermo.alpha(), h)
- fvc::laplacian(k, T) - fvc::laplacian(k, T)
); );
thermo->correct(); thermo.correct();
rhoE = rho*(h + 0.5*magSqr(U)) - p; rhoE = rho*(h + 0.5*magSqr(U)) - p;
} }

View File

@ -1,13 +1,14 @@
Info<< "Reading thermophysical properties\n" << endl; 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& p = thermo.p();
volScalarField& h = thermo->h(); volScalarField& h = thermo.h();
const volScalarField& psi = thermo->psi(); const volScalarField& psi = thermo.psi();
volScalarField rho volScalarField rho
( (
@ -19,7 +20,7 @@
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
thermo->rho() thermo.rho()
); );
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl;
@ -51,7 +52,7 @@
rho, rho,
U, U,
phi, phi,
thermo() thermo
) )
); );

View File

@ -19,5 +19,5 @@
hEqn.solve(); hEqn.solve();
} }
thermo->correct(); thermo.correct();
} }

View File

@ -1,4 +1,4 @@
rho = thermo->rho(); rho = thermo.rho();
volScalarField rUA = 1.0/UEqn().A(); volScalarField rUA = 1.0/UEqn().A();
U = rUA*UEqn().H(); U = rUA*UEqn().H();
@ -13,7 +13,7 @@ if (transonic)
surfaceScalarField phid surfaceScalarField phid
( (
"phid", "phid",
fvc::interpolate(thermo->psi()) fvc::interpolate(psi)
*( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rUA, rho, U, phi)
@ -58,8 +58,6 @@ else
//+ fvc::ddtPhiCorr(rUA, rho, U, phi) //+ fvc::ddtPhiCorr(rUA, rho, U, phi)
); );
//bool closedVolume = adjustPhi(phi, U, p);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
// Pressure corrector // Pressure corrector
@ -99,7 +97,7 @@ else
// Explicitly relax pressure for momentum corrector // Explicitly relax pressure for momentum corrector
p.relax(); p.relax();
rho = thermo->rho(); rho = thermo.rho();
rho.relax(); rho.relax();
Info<< "rho max/min : " << max(rho).value() Info<< "rho max/min : " << max(rho).value()
<< " " << min(rho).value() << endl; << " " << min(rho).value() << endl;
@ -117,7 +115,7 @@ bound(p, pMin);
/* /*
if (closedVolume) if (closedVolume)
{ {
p += (initialMass - fvc::domainIntegrate(thermo->psi()*p)) p += (initialMass - fvc::domainIntegrate(psi*p))
/fvc::domainIntegrate(thermo->psi()); /fvc::domainIntegrate(psi);
} }
*/ */

View File

@ -35,7 +35,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "basicThermo.H" #include "basicPsiThermo.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "bound.H" #include "bound.H"

View File

@ -1,13 +1,14 @@
Info<< "Reading thermophysical properties\n" << endl; 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& p = thermo.p();
volScalarField& h = thermo->h(); volScalarField& h = thermo.h();
const volScalarField& psi = thermo->psi(); const volScalarField& psi = thermo.psi();
volScalarField rho volScalarField rho
( (
@ -19,7 +20,7 @@
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
thermo->rho() thermo.rho()
); );
Info<< "\nReading field U\n" << endl; Info<< "\nReading field U\n" << endl;
@ -47,7 +48,7 @@
rho, rho,
U, U,
phi, phi,
thermo() thermo
) )
); );

View File

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

View File

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

View File

@ -31,7 +31,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "basicThermo.H" #include "basicPsiThermo.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -43,14 +43,13 @@ int main(int argc, char *argv[])
#include "createTime.H" #include "createTime.H"
#include "createMesh.H" #include "createMesh.H"
#include "createFields.H" #include "createFields.H"
#include "readPISOControls.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
#include "readTimeControls.H" #include "readTimeControls.H"
#include "compressibleCourantNo.H" #include "compressibleCourantNo.H"
#include "setInitialDeltaT.H" #include "setInitialDeltaT.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;
@ -77,7 +76,7 @@ int main(int argc, char *argv[])
turbulence->correct(); turbulence->correct();
rho = thermo->rho(); rho = thermo.rho();
runTime.write(); runTime.write();

View File

@ -1,9 +1,10 @@
Info<< "Reading thermophysical properties\n" << endl; Info<< "Reading thermophysical properties\n" << endl;
autoPtr<basicThermo> thermo autoPtr<basicPsiThermo> pThermo
( (
basicThermo::New(mesh) basicPsiThermo::New(mesh)
); );
basicPsiThermo& thermo = pThermo();
volScalarField rho volScalarField rho
( (
@ -15,11 +16,12 @@
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
thermo->rho() thermo.rho()
); );
volScalarField& p = thermo->p(); volScalarField& p = thermo.p();
volScalarField& h = thermo->h(); volScalarField& h = thermo.h();
const volScalarField& psi = thermo.psi();
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl;
@ -56,7 +58,7 @@
rho, rho,
U, U,
phi, phi,
thermo() thermo
) )
); );

View File

@ -14,5 +14,5 @@
eqnResidual = hEqn.solve().initialResidual(); eqnResidual = hEqn.solve().initialResidual();
maxResidual = max(eqnResidual, maxResidual); maxResidual = max(eqnResidual, maxResidual);
thermo->correct(); thermo.correct();
} }

View File

@ -65,10 +65,10 @@ bound(p, pMin);
// to obey overall mass continuity // to obey overall mass continuity
if (closedVolume) if (closedVolume)
{ {
p += (initialMass - fvc::domainIntegrate(thermo->psi()*p)) p += (initialMass - fvc::domainIntegrate(psi*p))
/fvc::domainIntegrate(thermo->psi()); /fvc::domainIntegrate(psi);
} }
rho = thermo->rho(); rho = thermo.rho();
rho.relax(); rho.relax();
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl; Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl;

View File

@ -27,12 +27,12 @@ Application
Description Description
Steady-state solver for turbulent flow of compressible fluids with Steady-state solver for turbulent flow of compressible fluids with
implicit or explicit porosity treatment RANS turbulence modelling, and implicit or explicit porosity treatment
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "basicThermo.H" #include "basicPsiThermo.H"
#include "RASModel.H" #include "RASModel.H"
#include "porousZones.H" #include "porousZones.H"
@ -40,14 +40,13 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createMesh.H" #include "createMesh.H"
#include "createFields.H" #include "createFields.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;

View File

@ -1,9 +1,10 @@
Info<< "Reading thermophysical properties\n" << endl; Info<< "Reading thermophysical properties\n" << endl;
autoPtr<basicThermo> thermo autoPtr<basicPsiThermo> pThermo
( (
basicThermo::New(mesh) basicPsiThermo::New(mesh)
); );
basicPsiThermo& thermo = pThermo();
volScalarField rho volScalarField rho
( (
@ -15,12 +16,12 @@
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
thermo->rho() thermo.rho()
); );
volScalarField& p = thermo->p(); volScalarField& p = thermo.p();
volScalarField& h = thermo->h(); volScalarField& h = thermo.h();
const volScalarField& psi = thermo.psi();
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl;
volVectorField U volVectorField U
@ -56,7 +57,7 @@
rho, rho,
U, U,
phi, phi,
thermo() thermo
) )
); );

View File

@ -14,5 +14,5 @@
eqnResidual = hEqn.solve().initialResidual(); eqnResidual = hEqn.solve().initialResidual();
maxResidual = max(eqnResidual, maxResidual); maxResidual = max(eqnResidual, maxResidual);
thermo->correct(); thermo.correct();
} }

View File

@ -1,4 +1,4 @@
rho = thermo->rho(); rho = thermo.rho();
volScalarField rUA = 1.0/UEqn().A(); volScalarField rUA = 1.0/UEqn().A();
U = rUA*UEqn().H(); U = rUA*UEqn().H();
@ -11,7 +11,7 @@ if (transonic)
surfaceScalarField phid surfaceScalarField phid
( (
"phid", "phid",
fvc::interpolate(thermo->psi())*(fvc::interpolate(U) & mesh.Sf()) fvc::interpolate(psi)*(fvc::interpolate(U) & mesh.Sf())
); );
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
@ -82,7 +82,7 @@ else
// Explicitly relax pressure for momentum corrector // Explicitly relax pressure for momentum corrector
p.relax(); p.relax();
rho = thermo->rho(); rho = thermo.rho();
rho.relax(); rho.relax();
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl; Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl;
@ -95,6 +95,6 @@ bound(p, pMin);
// to obey overall mass continuity // to obey overall mass continuity
if (closedVolume) if (closedVolume)
{ {
p += (initialMass - fvc::domainIntegrate(thermo->psi()*p)) p += (initialMass - fvc::domainIntegrate(psi*p))
/fvc::domainIntegrate(thermo->psi()); /fvc::domainIntegrate(psi);
} }

View File

@ -26,13 +26,13 @@ Application
rhoSimpleFoam rhoSimpleFoam
Description Description
Steady-state SIMPLE solver for laminar or turbulent flow of Steady-state SIMPLE solver for laminar or turbulent RANS flow of
compressible fluids. compressible fluids.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "basicThermo.H" #include "basicPsiThermo.H"
#include "RASModel.H" #include "RASModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -42,14 +42,13 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createMesh.H" #include "createMesh.H"
#include "readThermodynamicProperties.H" #include "readThermodynamicProperties.H"
#include "createFields.H" #include "createFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;

View File

@ -1,13 +1,14 @@
Info<< "Reading thermophysical properties\n" << endl; 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& p = thermo.p();
volScalarField& h = thermo->h(); volScalarField& e = thermo.e();
const volScalarField& psi = thermo->psi(); const volScalarField& psi = thermo.psi();
volScalarField rho volScalarField rho
( (
@ -17,7 +18,7 @@
runTime.timeName(), runTime.timeName(),
mesh mesh
), ),
thermo->rho() thermo.rho()
); );
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl;
@ -45,7 +46,7 @@
rho, rho,
U, U,
phi, phi,
thermo() thermo
) )
); );

View File

@ -32,7 +32,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "basicThermo.H" #include "basicPsiThermo.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "motionSolver.H" #include "motionSolver.H"
@ -72,7 +72,7 @@ int main(int argc, char *argv[])
solve(UEqn == -fvc::grad(p)); solve(UEqn == -fvc::grad(p));
#include "hEqn.H" #include "eEqn.H"
// --- PISO loop // --- PISO loop
@ -84,8 +84,8 @@ int main(int argc, char *argv[])
surfaceScalarField phid surfaceScalarField phid
( (
"phid", "phid",
fvc::interpolate(psi)* fvc::interpolate(psi)
( *(
(fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U) (fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U)
) )
); );

View File

@ -0,0 +1,8 @@
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(phi, U)
+ turbulence->divDevRhoReff(U)
);
solve(UEqn == -fvc::grad(p));

View File

@ -1,12 +0,0 @@
{
# include "rhoEqn.H"
}
{
scalar sumLocalContErr = (sum(mag(rho - psi*p))/sum(rho)).value();
scalar globalContErr = (sum(rho - psi*p)/sum(rho)).value();
cumulativeContErr += globalContErr;
Info<< "time step continuity errors : sum local = " << sumLocalContErr
<< ", global = " << globalContErr
<< ", cumulative = " << cumulativeContErr << endl;
}

View File

@ -1,13 +1,14 @@
Info<< "Reading thermophysical properties\n" << endl; 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& p = thermo.p();
volScalarField& h = thermo->h(); volScalarField& e = thermo.e();
const volScalarField& psi = thermo->psi(); const volScalarField& psi = thermo.psi();
volScalarField rho volScalarField rho
( (
@ -17,7 +18,7 @@
runTime.timeName(), runTime.timeName(),
mesh mesh
), ),
thermo->rho() thermo.rho()
); );
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl;
@ -45,10 +46,6 @@
rho, rho,
U, U,
phi, phi,
thermo() thermo
) )
); );
Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View File

@ -0,0 +1,12 @@
{
solve
(
fvm::ddt(rho, e)
+ fvm::div(phi, e)
- fvm::laplacian(turbulence->alphaEff(), e)
==
- p*fvc::div(phi/fvc::interpolate(rho))
);
thermo.correct();
}

View File

@ -1,12 +0,0 @@
{
solve
(
fvm::ddt(rho, h)
+ fvm::div(phi, h)
- fvm::laplacian(turbulence->alphaEff(), h)
==
DpDt
);
thermo->correct();
}

View File

@ -0,0 +1,37 @@
rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A();
U = rUA*UEqn.H();
surfaceScalarField phid
(
"phid",
fvc::interpolate(psi)
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(rho*rUA, p)
);
pEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi = pEqn.flux();
}
}
#include "rhoEqn.H"
#include "compressibleContinuityErrs.H"
U -= rUA*fvc::grad(p);
U.correctBoundaryConditions();

View File

@ -1,23 +0,0 @@
Info<< "Reading thermodynamicProperties\n" << endl;
IOdictionary thermodynamicProperties
(
IOobject
(
"thermodynamicProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
dimensionedScalar R
(
thermodynamicProperties.lookup("R")
);
dimensionedScalar Cv
(
thermodynamicProperties.lookup("Cv")
);

View File

@ -1,18 +0,0 @@
Info<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
dimensionedScalar mu
(
transportProperties.lookup("mu")
);

View File

@ -32,7 +32,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "basicThermo.H" #include "basicPsiThermo.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -58,64 +58,21 @@ int main(int argc, char *argv[])
#include "rhoEqn.H" #include "rhoEqn.H"
fvVectorMatrix UEqn #include "UEqn.H"
(
fvm::ddt(rho, U)
+ fvm::div(phi, U)
+ turbulence->divDevRhoReff(U)
);
solve(UEqn == -fvc::grad(p)); #include "eEqn.H"
#include "hEqn.H"
// --- PISO loop // --- PISO loop
for (int corr=0; corr<nCorr; corr++) for (int corr=0; corr<nCorr; corr++)
{ {
volScalarField rUA = 1.0/UEqn.A(); #include "pEqn.H"
U = rUA*UEqn.H();
surfaceScalarField phid
(
"phid",
fvc::interpolate(thermo->psi())
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(rho*rUA, p)
);
pEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi = pEqn.flux();
} }
}
#include "compressibleContinuityErrs.H"
U -= rUA*fvc::grad(p);
U.correctBoundaryConditions();
}
DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
turbulence->correct(); turbulence->correct();
rho = psi*p; rho = thermo.rho();
runTime.write(); runTime.write();

View File

@ -37,7 +37,6 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createMesh.H" #include "createMesh.H"
@ -46,7 +45,7 @@ int main(int argc, char *argv[])
#include "createFields.H" #include "createFields.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;
@ -79,8 +78,8 @@ int main(int argc, char *argv[])
surfaceScalarField phid surfaceScalarField phid
( (
"phid", "phid",
psi* psi
( *(
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rUA, rho, U, phi)
) )

View File

View File

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -14,5 +14,5 @@ IOdictionary mdEquilibrationDict
scalar targetTemperature = readScalar scalar targetTemperature = readScalar
( (
mdEquilibrationDict.lookup("equilibrationTargetTemperature") mdEquilibrationDict.lookup("targetTemperature")
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -36,14 +36,13 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createMesh.H" #include "createMesh.H"
#include "createFields.H" #include "createFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting iteration loop\n" << endl; Info<< "\nStarting iteration loop\n" << endl;

View File

@ -58,7 +58,6 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
@ -66,8 +65,7 @@ int main(int argc, char *argv[])
#include "createFields.H" #include "createFields.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< nl << "Starting time loop" << endl; Info<< nl << "Starting time loop" << endl;

View File

@ -38,14 +38,13 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createMesh.H" #include "createMesh.H"
#include "createFields.H" #include "createFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< nl << "Calculating value(price of comodities)" << endl; Info<< nl << "Calculating value(price of comodities)" << endl;

View File

@ -1,4 +1,5 @@
EXE_INC = \ EXE_INC = \
-I../buoyantBoussinesqSimpleFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/lnInclude \ -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/lnInclude \

View File

@ -2,7 +2,7 @@
volScalarField kappaEff volScalarField kappaEff
( (
"kappaEff", "kappaEff",
turbulence->nu() + turbulence->nut()/Prt turbulence->nu()/Pr + turbulence->nut()/Prt
); );
fvScalarMatrix TEqn fvScalarMatrix TEqn
@ -15,4 +15,6 @@
TEqn.relax(); TEqn.relax();
TEqn.solve(); TEqn.solve();
rhok = 1.0 - beta*(T - TRef);
} }

View File

@ -1,23 +1,26 @@
// Solve the momentum equation // Solve the momentum equation
tmp<fvVectorMatrix> UEqn fvVectorMatrix UEqn
( (
fvm::ddt(U) fvm::ddt(U)
+ fvm::div(phi, U) + fvm::div(phi, U)
+ turbulence->divDevReff(U) + turbulence->divDevReff(U)
); );
UEqn().relax(); UEqn.relax();
if (momentumPredictor)
{
solve solve
( (
UEqn() UEqn
== ==
-fvc::reconstruct fvc::reconstruct
( (
( (
fvc::snGrad(pd) fvc::interpolate(rhok)*(g & mesh.Sf())
- betaghf*fvc::snGrad(T) - fvc::snGrad(p)*mesh.magSf()
) * mesh.magSf() )
) )
); );
}

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,18 +30,18 @@ Description
Uses the Boussinesq approximation: Uses the Boussinesq approximation:
\f[ \f[
rho_{eff} = 1 - beta(T - T_{ref}) rho_{k} = 1 - beta(T - T_{ref})
\f] \f]
where: where:
\f$ rho_{eff} \f$ = the effective (driving) density \f$ rho_{k} \f$ = the effective (driving) kinematic density
beta = thermal expansion coefficient [1/K] beta = thermal expansion coefficient [1/K]
T = temperature [K] T = temperature [K]
\f$ T_{ref} \f$ = reference temperature [K] \f$ T_{ref} \f$ = reference temperature [K]
Valid when: Valid when:
\f[ \f[
rho_{eff} << 1 rho_{k} << 1
\f] \f]
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -54,7 +54,6 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createMesh.H" #include "createMesh.H"
@ -65,7 +64,7 @@ int main(int argc, char *argv[])
#include "CourantNo.H" #include "CourantNo.H"
#include "setInitialDeltaT.H" #include "setInitialDeltaT.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;
@ -79,20 +78,17 @@ int main(int argc, char *argv[])
#include "setDeltaT.H" #include "setDeltaT.H"
#include "UEqn.H" #include "UEqn.H"
#include "TEqn.H"
// --- PISO loop // --- PISO loop
for (int corr=0; corr<nCorr; corr++) for (int corr=0; corr<nCorr; corr++)
{ {
# include "TEqn.H" #include "pEqn.H"
# include "pdEqn.H"
} }
turbulence->correct(); turbulence->correct();
if (runTime.write()) runTime.write();
{
# include "writeAdditionalFields.H"
}
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s"

View File

@ -14,13 +14,12 @@
mesh mesh
); );
// kinematic pd Info<< "Reading field p\n" << endl;
Info<< "Reading field pd\n" << endl; volScalarField p
volScalarField pd
( (
IOobject IOobject
( (
"pd", "p",
runTime.timeName(), runTime.timeName(),
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
@ -53,15 +52,25 @@
incompressible::RASModel::New(U, phi, laminarTransport) incompressible::RASModel::New(U, phi, laminarTransport)
); );
Info<< "Calculating field beta*(g.h)\n" << endl; label pRefCell = 0;
surfaceScalarField betaghf("betagh", beta*(g & mesh.Cf())); scalar pRefValue = 0.0;
label pdRefCell = 0;
scalar pdRefValue = 0.0;
setRefCell setRefCell
( (
pd, p,
mesh.solutionDict().subDict("SIMPLE"), mesh.solutionDict().subDict("PISO"),
pdRefCell, pRefCell,
pdRefValue pRefValue
);
// Kinematic density for buoyancy force
volScalarField rhok
(
IOobject
(
"rhok",
runTime.timeName(),
mesh
),
1.0 - beta*(T - TRef)
); );

View File

@ -1,9 +1,8 @@
{ {
volScalarField rUA("rUA", 1.0/UEqn().A()); volScalarField rUA("rUA", 1.0/UEqn.A());
surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA)); surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA));
U = rUA*UEqn().H(); U = rUA*UEqn.H();
UEqn.clear();
surfaceScalarField phiU surfaceScalarField phiU
( (
@ -11,31 +10,31 @@
+ fvc::ddtPhiCorr(rUA, U, phi) + fvc::ddtPhiCorr(rUA, U, phi)
); );
phi = phiU + betaghf*fvc::snGrad(T)*rUAf*mesh.magSf(); phi = phiU + rUAf*fvc::interpolate(rhok)*(g & mesh.Sf());
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix pdEqn fvScalarMatrix pEqn
( (
fvm::laplacian(rUAf, pd) == fvc::div(phi) fvm::laplacian(rUAf, p) == fvc::div(phi)
); );
if (corr == nCorr-1 && nonOrth == nNonOrthCorr) if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
{ {
pdEqn.solve(mesh.solver(pd.name() + "Final")); pEqn.solve(mesh.solver(p.name() + "Final"));
} }
else else
{ {
pdEqn.solve(mesh.solver(pd.name())); pEqn.solve(mesh.solver(p.name()));
} }
if (nonOrth == nNonOrthCorr) if (nonOrth == nNonOrthCorr)
{ {
phi += pdEqn.flux(); phi -= pEqn.flux();
} }
} }
U -= rUA*fvc::reconstruct((phi - phiU)/rUAf); U += rUA*fvc::reconstruct((phi - phiU)/rUAf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
#include "continuityErrs.H" #include "continuityErrs.H"

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