Explicitly name derived fields to improve readability of diagnostic messages and avoid duplicate registration

This commit is contained in:
Henry
2015-02-12 09:59:52 +00:00
parent a89f6042ec
commit 5a2c5c8fdc
17 changed files with 120 additions and 168 deletions

View File

@ -1,20 +1,10 @@
Info<< "k(" {
<< runTime.timeName() Info<< "k(" << runTime.timeName() << ") = "
<< ") = " << 3.0/2.0*average(magSqr(U)).value() << endl;
<< 3.0/2.0*average(magSqr(U)).value() << endl;
Info<< "epsilon(" Info<< "epsilon(" << runTime.timeName() << ") = "
<< runTime.timeName() << (0.5*nu*average(magSqr(twoSymm(fvc::grad(U))))).value() << endl;
<< ") = "
<< (
0.5*nu*average
(
magSqr(fvc::grad(U) + fvc::grad(U)().T())
)
).value() << endl;
Info<< "U.f("
<< runTime.timeName()
<< ") = "
<< 181.0*average(U & force).value() << endl;
Info<< "U.f(" << runTime.timeName() << ") = "
<< 181.0*average(U & force).value() << endl;
}

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) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -60,16 +60,7 @@ Foam::XiEqModels::SCOPEXiEq::SCOPEXiEq
), ),
MaModel MaModel
( (
IOdictionary Su.mesh().lookupObject<IOdictionary>("combustionProperties"),
(
IOobject
(
"combustionProperties",
Su.mesh().time().constant(),
Su.mesh(),
IOobject::MUST_READ
)
),
thermo thermo
) )
{} {}

View File

@ -54,31 +54,7 @@ Foam::XiEqModel::XiEqModel
), ),
thermo_(thermo), thermo_(thermo),
turbulence_(turbulence), turbulence_(turbulence),
Su_(Su), Su_(Su)
Nv_
(
IOobject
(
"Nv",
Su.mesh().facesInstance(),
Su.mesh(),
IOobject::MUST_READ,
IOobject::NO_WRITE
),
Su.mesh()
),
nsv_
(
IOobject
(
"nsv",
Su.mesh().facesInstance(),
Su.mesh(),
IOobject::MUST_READ,
IOobject::NO_WRITE
),
Su.mesh()
)
{} {}
@ -100,8 +76,7 @@ bool Foam::XiEqModel::read(const dictionary& XiEqProperties)
void Foam::XiEqModel::writeFields() const void Foam::XiEqModel::writeFields() const
{ {
Nv_.write(); //***HGW It is not clear why B is written here
nsv_.write();
if (Su_.mesh().foundObject<volSymmTensorField>("B")) if (Su_.mesh().foundObject<volSymmTensorField>("B"))
{ {
const volSymmTensorField& B = const volSymmTensorField& B =
@ -110,13 +85,13 @@ void Foam::XiEqModel::writeFields() const
} }
} }
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::XiEqModel::calculateSchelkinEffect(const scalar uPrimeCoef) const Foam::XiEqModel::calculateSchelkinEffect(const scalar uPrimeCoef) const
{ {
const fvMesh& mesh = Su_.mesh(); const fvMesh& mesh = Su_.mesh();
const volVectorField& U = mesh.lookupObject<volVectorField>("U"); const volVectorField& U = mesh.lookupObject<volVectorField>("U");
const volSymmTensorField& CT = mesh.lookupObject<volSymmTensorField>("CT"); const volSymmTensorField& CT = mesh.lookupObject<volSymmTensorField>("CT");
const volScalarField& Nv = mesh.lookupObject<volScalarField>("Nv"); const volScalarField& Nv = mesh.lookupObject<volScalarField>("Nv");
const volSymmTensorField& nsv = const volSymmTensorField& nsv =
@ -184,11 +159,11 @@ Foam::XiEqModel::calculateSchelkinEffect(const scalar uPrimeCoef) const
const scalarField deltaUp(upLocal*(max(scalar(1.0), pow(nr, 0.5)) - 1.0)); const scalarField deltaUp(upLocal*(max(scalar(1.0), pow(nr, 0.5)) - 1.0));
//Re use tN // Re use tN
N.internalField() = upLocal*(max(scalar(1.0), pow(nr, 0.5)) - 1.0); N.internalField() = upLocal*(max(scalar(1.0), pow(nr, 0.5)) - 1.0);
return tN; return tN;
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -27,11 +27,11 @@ Class
Description Description
Base-class for all XiEq models used by the b-XiEq combustion model. Base-class for all XiEq models used by the b-XiEq combustion model.
The available models are : The available models are :
\link basicXiSubXiEq.H \endlink \link basicXiSubXiEq.H \endlink
\link Gulder.H \endlink \link Gulder.H \endlink
\link instabilityXiEq.H \endlink \link instabilityXiEq.H \endlink
\link SCOPEBlendXiEq.H \endlink \link SCOPEBlendXiEq.H \endlink
\link SCOPEXiEq.H \endlink \link SCOPEXiEq.H \endlink
SourceFiles SourceFiles
XiEqModel.C XiEqModel.C
@ -74,12 +74,6 @@ protected:
//- Laminar burning velocity //- Laminar burning velocity
const volScalarField& Su_; const volScalarField& Su_;
//- Volumetric obstacles number
volScalarField Nv_;
//
volSymmTensorField nsv_;
private: private:
@ -156,7 +150,6 @@ public:
return turbulence_.muEff(); return turbulence_.muEff();
} }
//- Return the sub-grid Schelkin effect //- Return the sub-grid Schelkin effect
tmp<volScalarField> calculateSchelkinEffect(const scalar) const; tmp<volScalarField> calculateSchelkinEffect(const scalar) const;

View File

@ -137,6 +137,34 @@
mesh mesh
); );
Info<< "Reading field Nv\n" << endl;
volScalarField Nv
(
IOobject
(
"Nv",
mesh.facesInstance(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh
);
Info<< "Reading field nsv\n" << endl;
volSymmTensorField nsv
(
IOobject
(
"nsv",
mesh.facesInstance(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh
);
IOdictionary PDRProperties IOdictionary PDRProperties
( (
IOobject IOobject

View File

@ -2,7 +2,7 @@ if (ign.ignited())
{ {
// progress variable // progress variable
// ~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~
volScalarField c(scalar(1) - b); volScalarField c("c", scalar(1) - b);
// Unburnt gas density // Unburnt gas density
// ~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~
@ -11,7 +11,7 @@ if (ign.ignited())
// Calculate flame normal etc. // Calculate flame normal etc.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
volVectorField n(fvc::grad(b)); volVectorField n("n", fvc::grad(b));
volScalarField mgb(mag(n)); volScalarField mgb(mag(n));

View File

@ -36,20 +36,7 @@
incompressible::RASModel::New(U, phi, laminarTransport) incompressible::RASModel::New(U, phi, laminarTransport)
); );
dimensionedVector Ubar(laminarTransport.lookup("Ubar"));
IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
dimensionedVector Ubar(transportProperties.lookup("Ubar"));
vector flowDirection = (Ubar/mag(Ubar)).value(); vector flowDirection = (Ubar/mag(Ubar)).value();
tensor flowMask = sqr(flowDirection); tensor flowMask = sqr(flowDirection);

View File

@ -1,42 +1,15 @@
Info<< "\nReading transportProperties\n" << endl; word contiuousPhaseName
IOdictionary transportProperties
( (
IOobject IOdictionary
( (
"transportProperties", IOobject
runTime.constant(), (
mesh, "transportProperties",
IOobject::MUST_READ_IF_MODIFIED, runTime.constant(),
IOobject::NO_WRITE, mesh,
false IOobject::MUST_READ
) )
); ).lookup("contiuousPhaseName")
word contiuousPhaseName(transportProperties.lookup("contiuousPhaseName"));
dimensionedScalar rhocValue
(
IOobject::groupName("rho", contiuousPhaseName),
dimDensity,
transportProperties.lookup
(
IOobject::groupName("rho", contiuousPhaseName)
)
);
volScalarField rhoc
(
IOobject
(
rhocValue.name(),
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
rhocValue
); );
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl;
@ -92,6 +65,30 @@
singlePhaseTransportModel continuousPhaseTransport(Uc, phic); singlePhaseTransportModel continuousPhaseTransport(Uc, phic);
dimensionedScalar rhocValue
(
IOobject::groupName("rho", contiuousPhaseName),
dimDensity,
continuousPhaseTransport.lookup
(
IOobject::groupName("rho", contiuousPhaseName)
)
);
volScalarField rhoc
(
IOobject
(
rhocValue.name(),
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
rhocValue
);
volScalarField muc volScalarField muc
( (
IOobject IOobject

View File

@ -1,36 +1,3 @@
Info<< "\nReading transportProperties\n" << endl;
IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
dimensionedScalar rhoInfValue
(
transportProperties.lookup("rhoInf")
);
volScalarField rhoInf
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
rhoInfValue
);
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl;
volVectorField U volVectorField U
( (
@ -49,6 +16,25 @@
singlePhaseTransportModel laminarTransport(U, phi); singlePhaseTransportModel laminarTransport(U, phi);
dimensionedScalar rhoInfValue
(
laminarTransport.lookup("rhoInf")
);
volScalarField rhoInf
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
rhoInfValue
);
autoPtr<incompressible::turbulenceModel> turbulence autoPtr<incompressible::turbulenceModel> turbulence
( (
incompressible::turbulenceModel::New(U, phi, laminarTransport) incompressible::turbulenceModel::New(U, phi, laminarTransport)

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) 2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -957,6 +957,7 @@ void Foam::multiphaseMixtureThermo::solveAlphas
phasei, phasei,
new surfaceScalarField new surfaceScalarField
( (
phi_.name() + alpha.name(),
fvc::flux fvc::flux
( (
phi_, phi_,

View File

@ -82,7 +82,7 @@
if (MULESCorr) if (MULESCorr)
{ {
tmp<surfaceScalarField> tphiAlphaCorr(tphiAlphaUn() - phiAlpha); tmp<surfaceScalarField> tphiAlphaCorr(tphiAlphaUn() - phiAlpha);
volScalarField alpha10(alpha1); volScalarField alpha10("alpha10", alpha1);
#ifdef LTSSOLVE #ifdef LTSSOLVE
MULES::LTScorrect MULES::LTScorrect

View File

@ -100,7 +100,7 @@
if (MULESCorr) if (MULESCorr)
{ {
tmp<surfaceScalarField> tphiAlphaCorr(tphiAlphaUn() - tphiAlpha()); tmp<surfaceScalarField> tphiAlphaCorr(tphiAlphaUn() - tphiAlpha());
volScalarField alpha10(alpha1); volScalarField alpha10("alpha10", alpha1);
#ifdef LTSSOLVE #ifdef LTSSOLVE
MULES::LTScorrect(alpha1, tphiAlphaUn(), tphiAlphaCorr(), 1, 0); MULES::LTScorrect(alpha1, tphiAlphaUn(), tphiAlphaCorr(), 1, 0);

View File

@ -107,7 +107,7 @@ int main(int argc, char *argv[])
if (pimple.firstIter() || moveMeshOuterCorrectors) if (pimple.firstIter() || moveMeshOuterCorrectors)
{ {
// Store divU from the previous mesh for the correctPhi // Store divU from the previous mesh for the correctPhi
volScalarField divU(fvc::div(fvc::absolute(phi, U))); volScalarField divU("divU0", fvc::div(fvc::absolute(phi, U)));
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();

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) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -112,10 +112,10 @@ Foam::Pair<Foam::tmp<Foam::volScalarField> >
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotAlphal() const Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotAlphal() const
{ {
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p"); const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
volScalarField pCoeff(this->pCoeff(p)); volScalarField pCoeff(this->pCoeff(p));
volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
return Pair<tmp<volScalarField> > return Pair<tmp<volScalarField> >
( (
Cc_*limitedAlpha1*pCoeff*max(p - pSat(), p0_), Cc_*limitedAlpha1*pCoeff*max(p - pSat(), p0_),
@ -129,9 +129,10 @@ Foam::Pair<Foam::tmp<Foam::volScalarField> >
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotP() const Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotP() const
{ {
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p"); const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1))); volScalarField pCoeff(this->pCoeff(p));
volScalarField apCoeff(limitedAlpha1*pCoeff(p)); volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
volScalarField apCoeff(limitedAlpha1*pCoeff);
return Pair<tmp<volScalarField> > return Pair<tmp<volScalarField> >
( (

View File

@ -3,6 +3,7 @@
surfaceScalarField phiAlpha surfaceScalarField phiAlpha
( (
phi.name() + alpha1.name(),
fvc::flux fvc::flux
( (
phi, phi,

View File

@ -79,12 +79,14 @@ int main(int argc, char *argv[])
volScalarField contErr1 volScalarField contErr1
( (
"contErr1",
fvc::ddt(alpha1, rho1) + fvc::div(alphaRhoPhi1) fvc::ddt(alpha1, rho1) + fvc::div(alphaRhoPhi1)
- (fvOptions(alpha1, rho1)&rho1) - (fvOptions(alpha1, rho1)&rho1)
); );
volScalarField contErr2 volScalarField contErr2
( (
"contErr2",
fvc::ddt(alpha2, rho2) + fvc::div(alphaRhoPhi2) fvc::ddt(alpha2, rho2) + fvc::div(alphaRhoPhi2)
- (fvOptions(alpha2, rho2)&rho2) - (fvOptions(alpha2, rho2)&rho2)
); );

View File

@ -47,8 +47,8 @@ divSchemes
hau limitedLinear 1; hau limitedLinear 1;
}; };
div(U) Gauss linear; div(U) Gauss linear;
div((Su*grad(b))) Gauss linear; div((Su*n)) Gauss linear;
div((U+((Su*Xi)*grad(b)))) Gauss linear; div((U+((Su*Xi)*n))) Gauss linear;
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
} }