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()
<< ") = "
<< 3.0/2.0*average(magSqr(U)).value() << endl;
{
Info<< "k(" << runTime.timeName() << ") = "
<< 3.0/2.0*average(magSqr(U)).value() << endl;
Info<< "epsilon("
<< runTime.timeName()
<< ") = "
<< (
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<< "epsilon(" << runTime.timeName() << ") = "
<< (0.5*nu*average(magSqr(twoSymm(fvc::grad(U))))).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
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -60,16 +60,7 @@ Foam::XiEqModels::SCOPEXiEq::SCOPEXiEq
),
MaModel
(
IOdictionary
(
IOobject
(
"combustionProperties",
Su.mesh().time().constant(),
Su.mesh(),
IOobject::MUST_READ
)
),
Su.mesh().lookupObject<IOdictionary>("combustionProperties"),
thermo
)
{}

View File

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

View File

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

View File

@ -137,6 +137,34 @@
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
(
IOobject

View File

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

View File

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

View File

@ -1,42 +1,15 @@
Info<< "\nReading transportProperties\n" << endl;
IOdictionary transportProperties
word contiuousPhaseName
(
IOobject
IOdictionary
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
);
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
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ
)
).lookup("contiuousPhaseName")
);
Info<< "Reading field U\n" << endl;
@ -92,6 +65,30 @@
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
(
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;
volVectorField U
(
@ -49,6 +16,25 @@
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
(
incompressible::turbulenceModel::New(U, phi, laminarTransport)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -957,6 +957,7 @@ void Foam::multiphaseMixtureThermo::solveAlphas
phasei,
new surfaceScalarField
(
phi_.name() + alpha.name(),
fvc::flux
(
phi_,

View File

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

View File

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

View File

@ -107,7 +107,7 @@ int main(int argc, char *argv[])
if (pimple.firstIter() || moveMeshOuterCorrectors)
{
// 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();

View File

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

View File

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

View File

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

View File

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