mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: update {fa,fv}Schemes for more recent dictionary/ITstream definitions
- can construct named empty dictionary directly. - removed some duplicate code
This commit is contained in:
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -42,12 +43,11 @@ Foam::tolerances::tolerances(const Time& t, const fileName& dictName)
|
|||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
relaxationFactors_(ITstream("relaxationFactors", tokenList())()),
|
|
||||||
solverTolerances_(ITstream("solverTolerances", tokenList())()),
|
// Named, but empty dictionaries
|
||||||
solverRelativeTolerances_
|
relaxationFactors_("relaxationFactors"),
|
||||||
(
|
solverTolerances_("solverTolerances"),
|
||||||
ITstream("solverRelativeTolerances", tokenList())()
|
solverRelativeTolerances_("solverRelativeTolerances")
|
||||||
)
|
|
||||||
{
|
{
|
||||||
read();
|
read();
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ bool Foam::tolerances::read()
|
|||||||
if (regIOobject::read())
|
if (regIOobject::read())
|
||||||
{
|
{
|
||||||
const word toleranceSetName(get<word>("toleranceSet"));
|
const word toleranceSetName(get<word>("toleranceSet"));
|
||||||
const dictionary& toleranceSet(subDict(toleranceSetName));
|
const dictionary& toleranceSet = subDict(toleranceSetName);
|
||||||
|
|
||||||
if (toleranceSet.found("relaxationFactors"))
|
if (toleranceSet.found("relaxationFactors"))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -39,21 +39,28 @@ int Foam::faSchemes::debug(Foam::debug::debugSwitch("faSchemes", 0));
|
|||||||
void Foam::faSchemes::clear()
|
void Foam::faSchemes::clear()
|
||||||
{
|
{
|
||||||
ddtSchemes_.clear();
|
ddtSchemes_.clear();
|
||||||
defaultDdtScheme_.clear();
|
ddtSchemeDefault_.clear();
|
||||||
|
|
||||||
d2dt2Schemes_.clear();
|
d2dt2Schemes_.clear();
|
||||||
defaultD2dt2Scheme_.clear();
|
d2dt2SchemeDefault_.clear();
|
||||||
|
|
||||||
interpolationSchemes_.clear();
|
interpolationSchemes_.clear();
|
||||||
defaultInterpolationScheme_.clear();
|
interpolationSchemeDefault_.clear();
|
||||||
|
|
||||||
divSchemes_.clear(); // optional
|
divSchemes_.clear(); // optional
|
||||||
defaultDivScheme_.clear();
|
divSchemeDefault_.clear();
|
||||||
|
|
||||||
gradSchemes_.clear(); // optional
|
gradSchemes_.clear(); // optional
|
||||||
defaultGradScheme_.clear();
|
gradSchemeDefault_.clear();
|
||||||
|
|
||||||
lnGradSchemes_.clear();
|
lnGradSchemes_.clear();
|
||||||
defaultLnGradScheme_.clear();
|
lnGradSchemeDefault_.clear();
|
||||||
|
|
||||||
laplacianSchemes_.clear(); // optional
|
laplacianSchemes_.clear(); // optional
|
||||||
defaultLaplacianScheme_.clear();
|
laplacianSchemeDefault_.clear();
|
||||||
|
|
||||||
fluxRequired_.clear();
|
fluxRequired_.clear();
|
||||||
defaultFluxRequired_ = false;
|
fluxRequiredDefault_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -74,8 +81,7 @@ void Foam::faSchemes::read(const dictionary& dict)
|
|||||||
&& word(ddtSchemes_.lookup("default")) != "none"
|
&& word(ddtSchemes_.lookup("default")) != "none"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
defaultDdtScheme_ = ddtSchemes_.lookup("default");
|
ddtSchemeDefault_ = ddtSchemes_.lookup("default");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -94,7 +100,7 @@ void Foam::faSchemes::read(const dictionary& dict)
|
|||||||
&& word(d2dt2Schemes_.lookup("default")) != "none"
|
&& word(d2dt2Schemes_.lookup("default")) != "none"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
defaultD2dt2Scheme_ = d2dt2Schemes_.lookup("default");
|
d2dt2SchemeDefault_ = d2dt2Schemes_.lookup("default");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -113,7 +119,7 @@ void Foam::faSchemes::read(const dictionary& dict)
|
|||||||
&& word(interpolationSchemes_.lookup("default")) != "none"
|
&& word(interpolationSchemes_.lookup("default")) != "none"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
defaultInterpolationScheme_ =
|
interpolationSchemeDefault_ =
|
||||||
interpolationSchemes_.lookup("default");
|
interpolationSchemes_.lookup("default");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +132,7 @@ void Foam::faSchemes::read(const dictionary& dict)
|
|||||||
&& word(divSchemes_.lookup("default")) != "none"
|
&& word(divSchemes_.lookup("default")) != "none"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
defaultDivScheme_ = divSchemes_.lookup("default");
|
divSchemeDefault_ = divSchemes_.lookup("default");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -138,7 +144,7 @@ void Foam::faSchemes::read(const dictionary& dict)
|
|||||||
&& word(gradSchemes_.lookup("default")) != "none"
|
&& word(gradSchemes_.lookup("default")) != "none"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
defaultGradScheme_ = gradSchemes_.lookup("default");
|
gradSchemeDefault_ = gradSchemes_.lookup("default");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -157,7 +163,7 @@ void Foam::faSchemes::read(const dictionary& dict)
|
|||||||
&& word(lnGradSchemes_.lookup("default")) != "none"
|
&& word(lnGradSchemes_.lookup("default")) != "none"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
defaultLnGradScheme_ = lnGradSchemes_.lookup("default");
|
lnGradSchemeDefault_ = lnGradSchemes_.lookup("default");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -169,7 +175,7 @@ void Foam::faSchemes::read(const dictionary& dict)
|
|||||||
&& word(laplacianSchemes_.lookup("default")) != "none"
|
&& word(laplacianSchemes_.lookup("default")) != "none"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
defaultLaplacianScheme_ = laplacianSchemes_.lookup("default");
|
laplacianSchemeDefault_ = laplacianSchemes_.lookup("default");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -183,17 +189,32 @@ void Foam::faSchemes::read(const dictionary& dict)
|
|||||||
&& fluxRequired_.get<word>("default") != "none"
|
&& fluxRequired_.get<word>("default") != "none"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
defaultFluxRequired_ = fluxRequired_.get<bool>("default");
|
fluxRequiredDefault_ = fluxRequired_.get<bool>("default");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::faSchemes::writeDicts(Ostream& os) const
|
||||||
|
{
|
||||||
|
// Write dictionaries
|
||||||
|
ddtSchemes_.writeEntry(os);
|
||||||
|
d2dt2Schemes_.writeEntry(os);
|
||||||
|
interpolationSchemes_.writeEntry(os);
|
||||||
|
divSchemes_.writeEntry(os);
|
||||||
|
gradSchemes_.writeEntry(os);
|
||||||
|
lnGradSchemes_.writeEntry(os);
|
||||||
|
laplacianSchemes_.writeEntry(os);
|
||||||
|
fluxRequired_.writeEntry(os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::faSchemes::faSchemes
|
Foam::faSchemes::faSchemes
|
||||||
(
|
(
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
|
const word& dictName,
|
||||||
const dictionary* fallback
|
const dictionary* fallback
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@ -201,7 +222,7 @@ Foam::faSchemes::faSchemes
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"faSchemes",
|
dictName,
|
||||||
obr.time().system(),
|
obr.time().system(),
|
||||||
obr,
|
obr,
|
||||||
(
|
(
|
||||||
@ -214,106 +235,76 @@ Foam::faSchemes::faSchemes
|
|||||||
),
|
),
|
||||||
fallback
|
fallback
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// Named, but empty dictionaries and default schemes
|
||||||
ddtSchemes_
|
ddtSchemes_
|
||||||
(
|
(
|
||||||
ITstream
|
objectPath() + ".ddtSchemes"
|
||||||
(
|
|
||||||
objectPath() + ".ddtSchemes",
|
|
||||||
tokenList()
|
|
||||||
)()
|
|
||||||
),
|
),
|
||||||
defaultDdtScheme_
|
ddtSchemeDefault_
|
||||||
(
|
(
|
||||||
ddtSchemes_.name() + ".default",
|
zero{},
|
||||||
tokenList()
|
ddtSchemes_.name() + ".default"
|
||||||
),
|
),
|
||||||
d2dt2Schemes_
|
d2dt2Schemes_
|
||||||
(
|
(
|
||||||
ITstream
|
objectPath() + ".d2dt2Schemes"
|
||||||
(
|
|
||||||
objectPath() + ".d2dt2Schemes",
|
|
||||||
tokenList()
|
|
||||||
)()
|
|
||||||
),
|
),
|
||||||
defaultD2dt2Scheme_
|
d2dt2SchemeDefault_
|
||||||
(
|
(
|
||||||
d2dt2Schemes_.name() + ".default",
|
zero{},
|
||||||
tokenList()
|
d2dt2Schemes_.name() + ".default"
|
||||||
),
|
),
|
||||||
interpolationSchemes_
|
interpolationSchemes_
|
||||||
(
|
(
|
||||||
ITstream
|
objectPath() + ".interpolationSchemes"
|
||||||
(
|
|
||||||
objectPath() + ".interpolationSchemes",
|
|
||||||
tokenList()
|
|
||||||
)()
|
|
||||||
),
|
),
|
||||||
defaultInterpolationScheme_
|
interpolationSchemeDefault_
|
||||||
(
|
(
|
||||||
interpolationSchemes_.name() + ".default",
|
zero{},
|
||||||
tokenList()
|
interpolationSchemes_.name() + ".default"
|
||||||
),
|
),
|
||||||
divSchemes_
|
divSchemes_
|
||||||
(
|
(
|
||||||
ITstream
|
objectPath() + ".divSchemes"
|
||||||
(
|
|
||||||
objectPath() + ".divSchemes",
|
|
||||||
tokenList()
|
|
||||||
)()
|
|
||||||
),
|
),
|
||||||
defaultDivScheme_
|
divSchemeDefault_
|
||||||
(
|
(
|
||||||
divSchemes_.name() + ".default",
|
zero{},
|
||||||
tokenList()
|
divSchemes_.name() + ".default"
|
||||||
),
|
),
|
||||||
gradSchemes_
|
gradSchemes_
|
||||||
(
|
(
|
||||||
ITstream
|
objectPath() + ".gradSchemes"
|
||||||
(
|
|
||||||
objectPath() + ".gradSchemes",
|
|
||||||
tokenList()
|
|
||||||
)()
|
|
||||||
),
|
),
|
||||||
defaultGradScheme_
|
gradSchemeDefault_
|
||||||
(
|
(
|
||||||
gradSchemes_.name() + ".default",
|
zero{},
|
||||||
tokenList()
|
gradSchemes_.name() + ".default"
|
||||||
),
|
),
|
||||||
lnGradSchemes_
|
lnGradSchemes_
|
||||||
(
|
(
|
||||||
ITstream
|
objectPath() + ".lnGradSchemes"
|
||||||
(
|
|
||||||
objectPath() + ".snGradSchemes",
|
|
||||||
tokenList()
|
|
||||||
)()
|
|
||||||
),
|
),
|
||||||
defaultLnGradScheme_
|
lnGradSchemeDefault_
|
||||||
(
|
(
|
||||||
lnGradSchemes_.name() + ".default",
|
zero{},
|
||||||
tokenList()
|
lnGradSchemes_.name() + ".default"
|
||||||
),
|
),
|
||||||
laplacianSchemes_
|
laplacianSchemes_
|
||||||
(
|
(
|
||||||
ITstream
|
objectPath() + ".laplacianSchemes"
|
||||||
(
|
|
||||||
objectPath() + ".laplacianSchemes",
|
|
||||||
tokenList()
|
|
||||||
)()
|
|
||||||
),
|
),
|
||||||
defaultLaplacianScheme_
|
laplacianSchemeDefault_
|
||||||
(
|
(
|
||||||
laplacianSchemes_.name() + ".default",
|
zero{},
|
||||||
tokenList()
|
laplacianSchemes_.name() + ".default"
|
||||||
),
|
),
|
||||||
fluxRequired_
|
fluxRequired_
|
||||||
(
|
(
|
||||||
ITstream
|
objectPath() + ".fluxRequired"
|
||||||
(
|
|
||||||
objectPath() + ".fluxRequired",
|
|
||||||
tokenList()
|
|
||||||
)()
|
|
||||||
),
|
),
|
||||||
defaultFluxRequired_(false)
|
fluxRequiredDefault_(false)
|
||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
@ -327,12 +318,6 @@ Foam::faSchemes::faSchemes
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::faSchemes::faSchemes(const objectRegistry& obr, const dictionary& dict)
|
|
||||||
:
|
|
||||||
faSchemes(obr, &dict)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::faSchemes::read()
|
bool Foam::faSchemes::read()
|
||||||
@ -364,147 +349,137 @@ const Foam::dictionary& Foam::faSchemes::schemesDict() const
|
|||||||
|
|
||||||
Foam::ITstream& Foam::faSchemes::ddtScheme(const word& name) const
|
Foam::ITstream& Foam::faSchemes::ddtScheme(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo<< "Lookup ddtScheme for " << name << endl;
|
||||||
{
|
|
||||||
Info<< "Lookup ddtScheme for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ddtSchemes_.found(name) || defaultDdtScheme_.empty())
|
if (ddtSchemes_.found(name) || ddtSchemeDefault_.empty())
|
||||||
{
|
{
|
||||||
return ddtSchemes_.lookup(name);
|
return ddtSchemes_.lookup(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const_cast<ITstream&>(defaultDdtScheme_).rewind();
|
// Default scheme
|
||||||
return const_cast<ITstream&>(defaultDdtScheme_);
|
ITstream& is = const_cast<ITstream&>(ddtSchemeDefault_);
|
||||||
|
is.rewind();
|
||||||
|
return is;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::ITstream& Foam::faSchemes::d2dt2Scheme(const word& name) const
|
Foam::ITstream& Foam::faSchemes::d2dt2Scheme(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo<< "Lookup d2dt2Scheme for " << name << endl;
|
||||||
{
|
|
||||||
Info<< "Lookup d2dt2Scheme for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (d2dt2Schemes_.found(name) || defaultD2dt2Scheme_.empty())
|
if (d2dt2Schemes_.found(name) || d2dt2SchemeDefault_.empty())
|
||||||
{
|
{
|
||||||
return d2dt2Schemes_.lookup(name);
|
return d2dt2Schemes_.lookup(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const_cast<ITstream&>(defaultD2dt2Scheme_).rewind();
|
// Default scheme
|
||||||
return const_cast<ITstream&>(defaultD2dt2Scheme_);
|
ITstream& is = const_cast<ITstream&>(d2dt2SchemeDefault_);
|
||||||
|
is.rewind();
|
||||||
|
return is;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::ITstream& Foam::faSchemes::interpolationScheme(const word& name) const
|
Foam::ITstream& Foam::faSchemes::interpolationScheme(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo<< "Lookup interpolationScheme for " << name << endl;
|
||||||
{
|
|
||||||
Info<< "Lookup interpolationScheme for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
interpolationSchemes_.found(name)
|
interpolationSchemes_.found(name)
|
||||||
|| defaultInterpolationScheme_.empty()
|
|| interpolationSchemeDefault_.empty()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return interpolationSchemes_.lookup(name);
|
return interpolationSchemes_.lookup(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const_cast<ITstream&>(defaultInterpolationScheme_).rewind();
|
// Default scheme
|
||||||
return const_cast<ITstream&>(defaultInterpolationScheme_);
|
ITstream& is = const_cast<ITstream&>(interpolationSchemeDefault_);
|
||||||
|
is.rewind();
|
||||||
|
return is;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::ITstream& Foam::faSchemes::divScheme(const word& name) const
|
Foam::ITstream& Foam::faSchemes::divScheme(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo<< "Lookup divScheme for " << name << endl;
|
||||||
{
|
|
||||||
Info<< "Lookup divScheme for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (divSchemes_.found(name) || defaultDivScheme_.empty())
|
if (divSchemes_.found(name) || divSchemeDefault_.empty())
|
||||||
{
|
{
|
||||||
return divSchemes_.lookup(name);
|
return divSchemes_.lookup(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const_cast<ITstream&>(defaultDivScheme_).rewind();
|
// Default scheme
|
||||||
return const_cast<ITstream&>(defaultDivScheme_);
|
ITstream& is = const_cast<ITstream&>(divSchemeDefault_);
|
||||||
|
is.rewind();
|
||||||
|
return is;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::ITstream& Foam::faSchemes::gradScheme(const word& name) const
|
Foam::ITstream& Foam::faSchemes::gradScheme(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo<< "Lookup gradScheme for " << name << endl;
|
||||||
{
|
|
||||||
Info<< "Lookup gradScheme for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gradSchemes_.found(name) || defaultGradScheme_.empty())
|
if (gradSchemes_.found(name) || gradSchemeDefault_.empty())
|
||||||
{
|
{
|
||||||
return gradSchemes_.lookup(name);
|
return gradSchemes_.lookup(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const_cast<ITstream&>(defaultGradScheme_).rewind();
|
// Default scheme
|
||||||
return const_cast<ITstream&>(defaultGradScheme_);
|
ITstream& is = const_cast<ITstream&>(gradSchemeDefault_);
|
||||||
|
is.rewind();
|
||||||
|
return is;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::ITstream& Foam::faSchemes::lnGradScheme(const word& name) const
|
Foam::ITstream& Foam::faSchemes::lnGradScheme(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo<< "Lookup lnGradScheme for " << name << endl;
|
||||||
{
|
|
||||||
Info<< "Lookup snGradScheme for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lnGradSchemes_.found(name) || defaultLnGradScheme_.empty())
|
if (lnGradSchemes_.found(name) || lnGradSchemeDefault_.empty())
|
||||||
{
|
{
|
||||||
return lnGradSchemes_.lookup(name);
|
return lnGradSchemes_.lookup(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const_cast<ITstream&>(defaultLnGradScheme_).rewind();
|
// Default scheme
|
||||||
return const_cast<ITstream&>(defaultLnGradScheme_);
|
ITstream& is = const_cast<ITstream&>(lnGradSchemeDefault_);
|
||||||
|
is.rewind();
|
||||||
|
return is;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::ITstream& Foam::faSchemes::laplacianScheme(const word& name) const
|
Foam::ITstream& Foam::faSchemes::laplacianScheme(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo<< "Lookup laplacianScheme for " << name << endl;
|
||||||
{
|
|
||||||
Info<< "Lookup laplacianScheme for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (laplacianSchemes_.found(name) || defaultLaplacianScheme_.empty())
|
if (laplacianSchemes_.found(name) || laplacianSchemeDefault_.empty())
|
||||||
{
|
{
|
||||||
return laplacianSchemes_.lookup(name);
|
return laplacianSchemes_.lookup(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const_cast<ITstream&>(defaultLaplacianScheme_).rewind();
|
// Default scheme
|
||||||
return const_cast<ITstream&>(defaultLaplacianScheme_);
|
ITstream& is = const_cast<ITstream&>(laplacianSchemeDefault_);
|
||||||
|
is.rewind();
|
||||||
|
return is;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::faSchemes::setFluxRequired(const word& name) const
|
void Foam::faSchemes::setFluxRequired(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo<< "Setting fluxRequired for " << name << endl;
|
||||||
{
|
|
||||||
Info<< "Setting fluxRequired for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
fluxRequired_.add(name, true, true);
|
fluxRequired_.add(name, true, true);
|
||||||
}
|
}
|
||||||
@ -512,49 +487,20 @@ void Foam::faSchemes::setFluxRequired(const word& name) const
|
|||||||
|
|
||||||
bool Foam::faSchemes::fluxRequired(const word& name) const
|
bool Foam::faSchemes::fluxRequired(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo<< "Lookup fluxRequired for " << name << endl;
|
||||||
{
|
|
||||||
Info<< "Lookup fluxRequired for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fluxRequired_.found(name))
|
if (fluxRequired_.found(name))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return fluxRequiredDefault_;
|
||||||
return defaultFluxRequired_;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::faSchemes::writeData(Ostream& os) const
|
bool Foam::faSchemes::writeData(Ostream& os) const
|
||||||
{
|
{
|
||||||
// Write dictionaries
|
this->writeDicts(os);
|
||||||
os << nl << "ddtSchemes";
|
|
||||||
ddtSchemes_.write(os, true);
|
|
||||||
|
|
||||||
os << nl << "d2dt2Schemes";
|
|
||||||
d2dt2Schemes_.write(os, true);
|
|
||||||
|
|
||||||
os << nl << "interpolationSchemes";
|
|
||||||
interpolationSchemes_.write(os, true);
|
|
||||||
|
|
||||||
os << nl << "divSchemes";
|
|
||||||
divSchemes_.write(os, true);
|
|
||||||
|
|
||||||
os << nl << "gradSchemes";
|
|
||||||
gradSchemes_.write(os, true);
|
|
||||||
|
|
||||||
os << nl << "lnGradSchemes";
|
|
||||||
lnGradSchemes_.write(os, true);
|
|
||||||
|
|
||||||
os << nl << "laplacianSchemes";
|
|
||||||
laplacianSchemes_.write(os, true);
|
|
||||||
|
|
||||||
os << nl << "fluxRequired";
|
|
||||||
fluxRequired_.write(os, true);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -58,28 +58,28 @@ class faSchemes
|
|||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
dictionary ddtSchemes_;
|
dictionary ddtSchemes_;
|
||||||
ITstream defaultDdtScheme_;
|
ITstream ddtSchemeDefault_;
|
||||||
|
|
||||||
dictionary d2dt2Schemes_;
|
dictionary d2dt2Schemes_;
|
||||||
ITstream defaultD2dt2Scheme_;
|
ITstream d2dt2SchemeDefault_;
|
||||||
|
|
||||||
dictionary interpolationSchemes_;
|
dictionary interpolationSchemes_;
|
||||||
ITstream defaultInterpolationScheme_;
|
ITstream interpolationSchemeDefault_;
|
||||||
|
|
||||||
dictionary divSchemes_;
|
dictionary divSchemes_;
|
||||||
ITstream defaultDivScheme_;
|
ITstream divSchemeDefault_;
|
||||||
|
|
||||||
dictionary gradSchemes_;
|
dictionary gradSchemes_;
|
||||||
ITstream defaultGradScheme_;
|
ITstream gradSchemeDefault_;
|
||||||
|
|
||||||
dictionary lnGradSchemes_;
|
dictionary lnGradSchemes_;
|
||||||
ITstream defaultLnGradScheme_;
|
ITstream lnGradSchemeDefault_;
|
||||||
|
|
||||||
dictionary laplacianSchemes_;
|
dictionary laplacianSchemes_;
|
||||||
ITstream defaultLaplacianScheme_;
|
ITstream laplacianSchemeDefault_;
|
||||||
|
|
||||||
mutable dictionary fluxRequired_;
|
mutable dictionary fluxRequired_;
|
||||||
bool defaultFluxRequired_;
|
bool fluxRequiredDefault_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
@ -90,6 +90,9 @@ class faSchemes
|
|||||||
//- Read settings from the dictionary
|
//- Read settings from the dictionary
|
||||||
void read(const dictionary&);
|
void read(const dictionary&);
|
||||||
|
|
||||||
|
//- Write dictionary (possibly modified) settings
|
||||||
|
void writeDicts(Ostream& os) const;
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
faSchemes(const faSchemes&) = delete;
|
faSchemes(const faSchemes&) = delete;
|
||||||
|
|
||||||
@ -97,6 +100,19 @@ class faSchemes
|
|||||||
void operator=(const faSchemes&) = delete;
|
void operator=(const faSchemes&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct for objectRegistry, system dictName, and optional
|
||||||
|
//- fallback dictionary content (for a NO_READ or missing file)
|
||||||
|
// A null dictionary pointer is treated like an empty dictionary.
|
||||||
|
faSchemes
|
||||||
|
(
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const word& dictName,
|
||||||
|
const dictionary* fallback
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Debug switch
|
//- Debug switch
|
||||||
@ -112,11 +128,17 @@ public:
|
|||||||
(
|
(
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
const dictionary* fallback = nullptr
|
const dictionary* fallback = nullptr
|
||||||
);
|
)
|
||||||
|
:
|
||||||
|
faSchemes(obr, "faSchemes", fallback)
|
||||||
|
{}
|
||||||
|
|
||||||
//- Construct for objectRegistry, and
|
//- Construct for objectRegistry, and
|
||||||
//- fallback dictionary content (for a NO_READ or missing file)
|
//- fallback dictionary content (for a NO_READ or missing file)
|
||||||
faSchemes(const objectRegistry& obr, const dictionary& dict);
|
faSchemes(const objectRegistry& obr, const dictionary& dict)
|
||||||
|
:
|
||||||
|
faSchemes(obr, "faSchemes", &dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -147,49 +169,49 @@ public:
|
|||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
//- Return access to ddt schemes
|
//- Return access to ddt schemes
|
||||||
dictionary& ddtSchemes()
|
dictionary& ddtSchemes() noexcept
|
||||||
{
|
{
|
||||||
return ddtSchemes_;
|
return ddtSchemes_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return access to d2dt2 schemes
|
//- Return access to d2dt2 schemes
|
||||||
dictionary& d2dt2Schemes()
|
dictionary& d2dt2Schemes() noexcept
|
||||||
{
|
{
|
||||||
return d2dt2Schemes_;
|
return d2dt2Schemes_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return access to interpolation schemes
|
//- Return access to interpolation schemes
|
||||||
dictionary& interpolationSchemes()
|
dictionary& interpolationSchemes() noexcept
|
||||||
{
|
{
|
||||||
return interpolationSchemes_;
|
return interpolationSchemes_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return access to div schemes
|
//- Return access to div schemes
|
||||||
dictionary& divSchemes()
|
dictionary& divSchemes() noexcept
|
||||||
{
|
{
|
||||||
return divSchemes_;
|
return divSchemes_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return access to grad schemes
|
//- Return access to grad schemes
|
||||||
dictionary& gradSchemes()
|
dictionary& gradSchemes() noexcept
|
||||||
{
|
{
|
||||||
return gradSchemes_;
|
return gradSchemes_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return access to lnGrad schemes
|
//- Return access to lnGrad schemes
|
||||||
dictionary& lnGradSchemes()
|
dictionary& lnGradSchemes() noexcept
|
||||||
{
|
{
|
||||||
return lnGradSchemes_;
|
return lnGradSchemes_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return access to laplacian schemes
|
//- Return access to laplacian schemes
|
||||||
dictionary& laplacianSchemes()
|
dictionary& laplacianSchemes() noexcept
|
||||||
{
|
{
|
||||||
return laplacianSchemes_;
|
return laplacianSchemes_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return access to flux required
|
//- Return access to flux required
|
||||||
dictionary& fluxRequired()
|
dictionary& fluxRequired() noexcept
|
||||||
{
|
{
|
||||||
return fluxRequired_;
|
return fluxRequired_;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,19 +40,26 @@ int Foam::fvSchemes::debug(Foam::debug::debugSwitch("fvSchemes", 0));
|
|||||||
void Foam::fvSchemes::clear()
|
void Foam::fvSchemes::clear()
|
||||||
{
|
{
|
||||||
ddtSchemes_.clear();
|
ddtSchemes_.clear();
|
||||||
defaultDdtScheme_.clear();
|
ddtSchemeDefault_.clear();
|
||||||
|
|
||||||
d2dt2Schemes_.clear();
|
d2dt2Schemes_.clear();
|
||||||
defaultD2dt2Scheme_.clear();
|
d2dt2SchemeDefault_.clear();
|
||||||
|
|
||||||
interpolationSchemes_.clear();
|
interpolationSchemes_.clear();
|
||||||
defaultInterpolationScheme_.clear();
|
interpolationSchemeDefault_.clear();
|
||||||
|
|
||||||
divSchemes_.clear();
|
divSchemes_.clear();
|
||||||
defaultDivScheme_.clear();
|
divSchemeDefault_.clear();
|
||||||
|
|
||||||
gradSchemes_.clear();
|
gradSchemes_.clear();
|
||||||
defaultGradScheme_.clear();
|
gradSchemeDefault_.clear();
|
||||||
|
|
||||||
snGradSchemes_.clear();
|
snGradSchemes_.clear();
|
||||||
defaultSnGradScheme_.clear();
|
snGradSchemeDefault_.clear();
|
||||||
|
|
||||||
laplacianSchemes_.clear();
|
laplacianSchemes_.clear();
|
||||||
defaultLaplacianScheme_.clear();
|
laplacianSchemeDefault_.clear();
|
||||||
|
|
||||||
// Do not clear fluxRequired settings
|
// Do not clear fluxRequired settings
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,10 +81,10 @@ void Foam::fvSchemes::read(const dictionary& dict)
|
|||||||
&& word(ddtSchemes_.lookup("default")) != "none"
|
&& word(ddtSchemes_.lookup("default")) != "none"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
defaultDdtScheme_ = ddtSchemes_.lookup("default");
|
ddtSchemeDefault_ = ddtSchemes_.lookup("default");
|
||||||
steady_ =
|
steady_ =
|
||||||
(
|
(
|
||||||
word(defaultDdtScheme_)
|
word(ddtSchemeDefault_)
|
||||||
== fv::steadyStateDdtScheme<scalar>::typeName
|
== fv::steadyStateDdtScheme<scalar>::typeName
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -98,7 +105,7 @@ void Foam::fvSchemes::read(const dictionary& dict)
|
|||||||
&& word(d2dt2Schemes_.lookup("default")) != "none"
|
&& word(d2dt2Schemes_.lookup("default")) != "none"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
defaultD2dt2Scheme_ = d2dt2Schemes_.lookup("default");
|
d2dt2SchemeDefault_ = d2dt2Schemes_.lookup("default");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -117,7 +124,7 @@ void Foam::fvSchemes::read(const dictionary& dict)
|
|||||||
&& word(interpolationSchemes_.lookup("default")) != "none"
|
&& word(interpolationSchemes_.lookup("default")) != "none"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
defaultInterpolationScheme_ =
|
interpolationSchemeDefault_ =
|
||||||
interpolationSchemes_.lookup("default");
|
interpolationSchemes_.lookup("default");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +137,7 @@ void Foam::fvSchemes::read(const dictionary& dict)
|
|||||||
&& word(divSchemes_.lookup("default")) != "none"
|
&& word(divSchemes_.lookup("default")) != "none"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
defaultDivScheme_ = divSchemes_.lookup("default");
|
divSchemeDefault_ = divSchemes_.lookup("default");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -142,7 +149,7 @@ void Foam::fvSchemes::read(const dictionary& dict)
|
|||||||
&& word(gradSchemes_.lookup("default")) != "none"
|
&& word(gradSchemes_.lookup("default")) != "none"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
defaultGradScheme_ = gradSchemes_.lookup("default");
|
gradSchemeDefault_ = gradSchemes_.lookup("default");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -161,7 +168,7 @@ void Foam::fvSchemes::read(const dictionary& dict)
|
|||||||
&& word(snGradSchemes_.lookup("default")) != "none"
|
&& word(snGradSchemes_.lookup("default")) != "none"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
defaultSnGradScheme_ = snGradSchemes_.lookup("default");
|
snGradSchemeDefault_ = snGradSchemes_.lookup("default");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -173,7 +180,7 @@ void Foam::fvSchemes::read(const dictionary& dict)
|
|||||||
&& word(laplacianSchemes_.lookup("default")) != "none"
|
&& word(laplacianSchemes_.lookup("default")) != "none"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
defaultLaplacianScheme_ = laplacianSchemes_.lookup("default");
|
laplacianSchemeDefault_ = laplacianSchemes_.lookup("default");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -187,17 +194,32 @@ void Foam::fvSchemes::read(const dictionary& dict)
|
|||||||
&& fluxRequired_.get<word>("default") != "none"
|
&& fluxRequired_.get<word>("default") != "none"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
defaultFluxRequired_ = fluxRequired_.get<bool>("default");
|
fluxRequiredDefault_ = fluxRequired_.get<bool>("default");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fvSchemes::writeDicts(Ostream& os) const
|
||||||
|
{
|
||||||
|
// Write dictionaries
|
||||||
|
ddtSchemes_.writeEntry(os);
|
||||||
|
d2dt2Schemes_.writeEntry(os);
|
||||||
|
interpolationSchemes_.writeEntry(os);
|
||||||
|
divSchemes_.writeEntry(os);
|
||||||
|
gradSchemes_.writeEntry(os);
|
||||||
|
snGradSchemes_.writeEntry(os);
|
||||||
|
laplacianSchemes_.writeEntry(os);
|
||||||
|
fluxRequired_.writeEntry(os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::fvSchemes::fvSchemes
|
Foam::fvSchemes::fvSchemes
|
||||||
(
|
(
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
|
const word& dictName,
|
||||||
const dictionary* fallback
|
const dictionary* fallback
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@ -205,7 +227,7 @@ Foam::fvSchemes::fvSchemes
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"fvSchemes",
|
dictName,
|
||||||
obr.time().system(),
|
obr.time().system(),
|
||||||
obr,
|
obr,
|
||||||
(
|
(
|
||||||
@ -218,106 +240,76 @@ Foam::fvSchemes::fvSchemes
|
|||||||
),
|
),
|
||||||
fallback
|
fallback
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// Named, but empty dictionaries and default schemes
|
||||||
ddtSchemes_
|
ddtSchemes_
|
||||||
(
|
(
|
||||||
ITstream
|
objectPath() + ".ddtSchemes"
|
||||||
(
|
|
||||||
objectPath() + ".ddtSchemes",
|
|
||||||
tokenList()
|
|
||||||
)()
|
|
||||||
),
|
),
|
||||||
defaultDdtScheme_
|
ddtSchemeDefault_
|
||||||
(
|
(
|
||||||
ddtSchemes_.name() + ".default",
|
zero{},
|
||||||
tokenList()
|
ddtSchemes_.name() + ".default"
|
||||||
),
|
),
|
||||||
d2dt2Schemes_
|
d2dt2Schemes_
|
||||||
(
|
(
|
||||||
ITstream
|
objectPath() + ".d2dt2Schemes"
|
||||||
(
|
|
||||||
objectPath() + ".d2dt2Schemes",
|
|
||||||
tokenList()
|
|
||||||
)()
|
|
||||||
),
|
),
|
||||||
defaultD2dt2Scheme_
|
d2dt2SchemeDefault_
|
||||||
(
|
(
|
||||||
d2dt2Schemes_.name() + ".default",
|
zero{},
|
||||||
tokenList()
|
d2dt2Schemes_.name() + ".default"
|
||||||
),
|
),
|
||||||
interpolationSchemes_
|
interpolationSchemes_
|
||||||
(
|
(
|
||||||
ITstream
|
objectPath() + ".interpolationSchemes"
|
||||||
(
|
|
||||||
objectPath() + ".interpolationSchemes",
|
|
||||||
tokenList()
|
|
||||||
)()
|
|
||||||
),
|
),
|
||||||
defaultInterpolationScheme_
|
interpolationSchemeDefault_
|
||||||
(
|
(
|
||||||
interpolationSchemes_.name() + ".default",
|
zero{},
|
||||||
tokenList()
|
interpolationSchemes_.name() + ".default"
|
||||||
),
|
),
|
||||||
divSchemes_
|
divSchemes_
|
||||||
(
|
(
|
||||||
ITstream
|
objectPath() + ".divSchemes"
|
||||||
(
|
|
||||||
objectPath() + ".divSchemes",
|
|
||||||
tokenList()
|
|
||||||
)()
|
|
||||||
),
|
),
|
||||||
defaultDivScheme_
|
divSchemeDefault_
|
||||||
(
|
(
|
||||||
divSchemes_.name() + ".default",
|
zero{},
|
||||||
tokenList()
|
divSchemes_.name() + ".default"
|
||||||
),
|
),
|
||||||
gradSchemes_
|
gradSchemes_
|
||||||
(
|
(
|
||||||
ITstream
|
objectPath() + ".gradSchemes"
|
||||||
(
|
|
||||||
objectPath() + ".gradSchemes",
|
|
||||||
tokenList()
|
|
||||||
)()
|
|
||||||
),
|
),
|
||||||
defaultGradScheme_
|
gradSchemeDefault_
|
||||||
(
|
(
|
||||||
gradSchemes_.name() + ".default",
|
zero{},
|
||||||
tokenList()
|
gradSchemes_.name() + ".default"
|
||||||
),
|
),
|
||||||
snGradSchemes_
|
snGradSchemes_
|
||||||
(
|
(
|
||||||
ITstream
|
objectPath() + ".snGradSchemes"
|
||||||
(
|
|
||||||
objectPath() + ".snGradSchemes",
|
|
||||||
tokenList()
|
|
||||||
)()
|
|
||||||
),
|
),
|
||||||
defaultSnGradScheme_
|
snGradSchemeDefault_
|
||||||
(
|
(
|
||||||
snGradSchemes_.name() + ".default",
|
zero{},
|
||||||
tokenList()
|
snGradSchemes_.name() + ".default"
|
||||||
),
|
),
|
||||||
laplacianSchemes_
|
laplacianSchemes_
|
||||||
(
|
(
|
||||||
ITstream
|
objectPath() + ".laplacianSchemes"
|
||||||
(
|
|
||||||
objectPath() + ".laplacianSchemes",
|
|
||||||
tokenList()
|
|
||||||
)()
|
|
||||||
),
|
),
|
||||||
defaultLaplacianScheme_
|
laplacianSchemeDefault_
|
||||||
(
|
(
|
||||||
laplacianSchemes_.name() + ".default",
|
zero{},
|
||||||
tokenList()
|
laplacianSchemes_.name() + ".default"
|
||||||
),
|
),
|
||||||
fluxRequired_
|
fluxRequired_
|
||||||
(
|
(
|
||||||
ITstream
|
objectPath() + ".fluxRequired"
|
||||||
(
|
|
||||||
objectPath() + ".fluxRequired",
|
|
||||||
tokenList()
|
|
||||||
)()
|
|
||||||
),
|
),
|
||||||
defaultFluxRequired_(false),
|
fluxRequiredDefault_(false),
|
||||||
steady_(false)
|
steady_(false)
|
||||||
{
|
{
|
||||||
if
|
if
|
||||||
@ -332,12 +324,6 @@ Foam::fvSchemes::fvSchemes
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::fvSchemes::fvSchemes(const objectRegistry& obr, const dictionary& dict)
|
|
||||||
:
|
|
||||||
fvSchemes(obr, &dict)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::fvSchemes::read()
|
bool Foam::fvSchemes::read()
|
||||||
@ -369,147 +355,137 @@ const Foam::dictionary& Foam::fvSchemes::schemesDict() const
|
|||||||
|
|
||||||
Foam::ITstream& Foam::fvSchemes::ddtScheme(const word& name) const
|
Foam::ITstream& Foam::fvSchemes::ddtScheme(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo<< "Lookup ddtScheme for " << name << endl;
|
||||||
{
|
|
||||||
Info<< "Lookup ddtScheme for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ddtSchemes_.found(name) || defaultDdtScheme_.empty())
|
if (ddtSchemes_.found(name) || ddtSchemeDefault_.empty())
|
||||||
{
|
{
|
||||||
return ddtSchemes_.lookup(name);
|
return ddtSchemes_.lookup(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const_cast<ITstream&>(defaultDdtScheme_).rewind();
|
// Default scheme
|
||||||
return const_cast<ITstream&>(defaultDdtScheme_);
|
ITstream& is = const_cast<ITstream&>(ddtSchemeDefault_);
|
||||||
|
is.rewind();
|
||||||
|
return is;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::ITstream& Foam::fvSchemes::d2dt2Scheme(const word& name) const
|
Foam::ITstream& Foam::fvSchemes::d2dt2Scheme(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo<< "Lookup d2dt2Scheme for " << name << endl;
|
||||||
{
|
|
||||||
Info<< "Lookup d2dt2Scheme for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (d2dt2Schemes_.found(name) || defaultD2dt2Scheme_.empty())
|
if (d2dt2Schemes_.found(name) || d2dt2SchemeDefault_.empty())
|
||||||
{
|
{
|
||||||
return d2dt2Schemes_.lookup(name);
|
return d2dt2Schemes_.lookup(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const_cast<ITstream&>(defaultD2dt2Scheme_).rewind();
|
// Default scheme
|
||||||
return const_cast<ITstream&>(defaultD2dt2Scheme_);
|
ITstream& is = const_cast<ITstream&>(d2dt2SchemeDefault_);
|
||||||
|
is.rewind();
|
||||||
|
return is;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::ITstream& Foam::fvSchemes::interpolationScheme(const word& name) const
|
Foam::ITstream& Foam::fvSchemes::interpolationScheme(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo<< "Lookup interpolationScheme for " << name << endl;
|
||||||
{
|
|
||||||
Info<< "Lookup interpolationScheme for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
interpolationSchemes_.found(name)
|
interpolationSchemes_.found(name)
|
||||||
|| defaultInterpolationScheme_.empty()
|
|| interpolationSchemeDefault_.empty()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return interpolationSchemes_.lookup(name);
|
return interpolationSchemes_.lookup(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const_cast<ITstream&>(defaultInterpolationScheme_).rewind();
|
// Default scheme
|
||||||
return const_cast<ITstream&>(defaultInterpolationScheme_);
|
ITstream& is = const_cast<ITstream&>(interpolationSchemeDefault_);
|
||||||
|
is.rewind();
|
||||||
|
return is;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::ITstream& Foam::fvSchemes::divScheme(const word& name) const
|
Foam::ITstream& Foam::fvSchemes::divScheme(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo<< "Lookup divScheme for " << name << endl;
|
||||||
{
|
|
||||||
Info<< "Lookup divScheme for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (divSchemes_.found(name) || defaultDivScheme_.empty())
|
if (divSchemes_.found(name) || divSchemeDefault_.empty())
|
||||||
{
|
{
|
||||||
return divSchemes_.lookup(name);
|
return divSchemes_.lookup(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const_cast<ITstream&>(defaultDivScheme_).rewind();
|
// Default scheme
|
||||||
return const_cast<ITstream&>(defaultDivScheme_);
|
ITstream& is = const_cast<ITstream&>(divSchemeDefault_);
|
||||||
|
is.rewind();
|
||||||
|
return is;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::ITstream& Foam::fvSchemes::gradScheme(const word& name) const
|
Foam::ITstream& Foam::fvSchemes::gradScheme(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo<< "Lookup gradScheme for " << name << endl;
|
||||||
{
|
|
||||||
Info<< "Lookup gradScheme for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gradSchemes_.found(name) || defaultGradScheme_.empty())
|
if (gradSchemes_.found(name) || gradSchemeDefault_.empty())
|
||||||
{
|
{
|
||||||
return gradSchemes_.lookup(name);
|
return gradSchemes_.lookup(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const_cast<ITstream&>(defaultGradScheme_).rewind();
|
// Default scheme
|
||||||
return const_cast<ITstream&>(defaultGradScheme_);
|
ITstream& is = const_cast<ITstream&>(gradSchemeDefault_);
|
||||||
|
is.rewind();
|
||||||
|
return is;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::ITstream& Foam::fvSchemes::snGradScheme(const word& name) const
|
Foam::ITstream& Foam::fvSchemes::snGradScheme(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo<< "Lookup snGradScheme for " << name << endl;
|
||||||
{
|
|
||||||
Info<< "Lookup snGradScheme for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (snGradSchemes_.found(name) || defaultSnGradScheme_.empty())
|
if (snGradSchemes_.found(name) || snGradSchemeDefault_.empty())
|
||||||
{
|
{
|
||||||
return snGradSchemes_.lookup(name);
|
return snGradSchemes_.lookup(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const_cast<ITstream&>(defaultSnGradScheme_).rewind();
|
// Default scheme
|
||||||
return const_cast<ITstream&>(defaultSnGradScheme_);
|
ITstream& is = const_cast<ITstream&>(snGradSchemeDefault_);
|
||||||
|
is.rewind();
|
||||||
|
return is;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::ITstream& Foam::fvSchemes::laplacianScheme(const word& name) const
|
Foam::ITstream& Foam::fvSchemes::laplacianScheme(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo<< "Lookup laplacianScheme for " << name << endl;
|
||||||
{
|
|
||||||
Info<< "Lookup laplacianScheme for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (laplacianSchemes_.found(name) || defaultLaplacianScheme_.empty())
|
if (laplacianSchemes_.found(name) || laplacianSchemeDefault_.empty())
|
||||||
{
|
{
|
||||||
return laplacianSchemes_.lookup(name);
|
return laplacianSchemes_.lookup(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const_cast<ITstream&>(defaultLaplacianScheme_).rewind();
|
// Default scheme
|
||||||
return const_cast<ITstream&>(defaultLaplacianScheme_);
|
ITstream& is = const_cast<ITstream&>(laplacianSchemeDefault_);
|
||||||
|
is.rewind();
|
||||||
|
return is;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::fvSchemes::setFluxRequired(const word& name) const
|
void Foam::fvSchemes::setFluxRequired(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo<< "Setting fluxRequired for " << name << endl;
|
||||||
{
|
|
||||||
Info<< "Setting fluxRequired for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
fluxRequired_.add(name, true, true);
|
fluxRequired_.add(name, true, true);
|
||||||
}
|
}
|
||||||
@ -517,17 +493,14 @@ void Foam::fvSchemes::setFluxRequired(const word& name) const
|
|||||||
|
|
||||||
bool Foam::fvSchemes::fluxRequired(const word& name) const
|
bool Foam::fvSchemes::fluxRequired(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInfo<< "Lookup fluxRequired for " << name << endl;
|
||||||
{
|
|
||||||
Info<< "Lookup fluxRequired for " << name << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fluxRequired_.found(name))
|
if (fluxRequired_.found(name))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return defaultFluxRequired_;
|
return fluxRequiredDefault_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -58,28 +58,28 @@ class fvSchemes
|
|||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
dictionary ddtSchemes_;
|
dictionary ddtSchemes_;
|
||||||
ITstream defaultDdtScheme_;
|
ITstream ddtSchemeDefault_;
|
||||||
|
|
||||||
dictionary d2dt2Schemes_;
|
dictionary d2dt2Schemes_;
|
||||||
ITstream defaultD2dt2Scheme_;
|
ITstream d2dt2SchemeDefault_;
|
||||||
|
|
||||||
dictionary interpolationSchemes_;
|
dictionary interpolationSchemes_;
|
||||||
ITstream defaultInterpolationScheme_;
|
ITstream interpolationSchemeDefault_;
|
||||||
|
|
||||||
dictionary divSchemes_;
|
dictionary divSchemes_;
|
||||||
ITstream defaultDivScheme_;
|
ITstream divSchemeDefault_;
|
||||||
|
|
||||||
dictionary gradSchemes_;
|
dictionary gradSchemes_;
|
||||||
ITstream defaultGradScheme_;
|
ITstream gradSchemeDefault_;
|
||||||
|
|
||||||
dictionary snGradSchemes_;
|
dictionary snGradSchemes_;
|
||||||
ITstream defaultSnGradScheme_;
|
ITstream snGradSchemeDefault_;
|
||||||
|
|
||||||
dictionary laplacianSchemes_;
|
dictionary laplacianSchemes_;
|
||||||
ITstream defaultLaplacianScheme_;
|
ITstream laplacianSchemeDefault_;
|
||||||
|
|
||||||
mutable dictionary fluxRequired_;
|
mutable dictionary fluxRequired_;
|
||||||
bool defaultFluxRequired_;
|
bool fluxRequiredDefault_;
|
||||||
|
|
||||||
//- Steady-state run indicator
|
//- Steady-state run indicator
|
||||||
// Set true if the default ddtScheme is steadyState
|
// Set true if the default ddtScheme is steadyState
|
||||||
@ -94,6 +94,9 @@ class fvSchemes
|
|||||||
//- Read settings from the dictionary
|
//- Read settings from the dictionary
|
||||||
void read(const dictionary&);
|
void read(const dictionary&);
|
||||||
|
|
||||||
|
//- Write dictionary (possibly modified) settings
|
||||||
|
void writeDicts(Ostream& os) const;
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
fvSchemes(const fvSchemes&) = delete;
|
fvSchemes(const fvSchemes&) = delete;
|
||||||
|
|
||||||
@ -101,6 +104,19 @@ class fvSchemes
|
|||||||
void operator=(const fvSchemes&) = delete;
|
void operator=(const fvSchemes&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct for objectRegistry, system dictName, and optional
|
||||||
|
//- fallback dictionary content (for a NO_READ or missing file)
|
||||||
|
// A null dictionary pointer is treated like an empty dictionary.
|
||||||
|
fvSchemes
|
||||||
|
(
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const word& dictName,
|
||||||
|
const dictionary* fallback
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Debug switch
|
//- Debug switch
|
||||||
@ -116,11 +132,17 @@ public:
|
|||||||
(
|
(
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
const dictionary* fallback = nullptr
|
const dictionary* fallback = nullptr
|
||||||
);
|
)
|
||||||
|
:
|
||||||
|
fvSchemes(obr, "fvSchemes", fallback)
|
||||||
|
{}
|
||||||
|
|
||||||
//- Construct for objectRegistry, and
|
//- Construct for objectRegistry, and
|
||||||
//- fallback dictionary content (for a NO_READ or missing file)
|
//- fallback dictionary content (for a NO_READ or missing file)
|
||||||
fvSchemes(const objectRegistry& obr, const dictionary& dict);
|
fvSchemes(const objectRegistry& obr, const dictionary& dict)
|
||||||
|
:
|
||||||
|
fvSchemes(obr, "fvSchemes", &dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -147,14 +169,14 @@ public:
|
|||||||
|
|
||||||
bool fluxRequired(const word& name) const;
|
bool fluxRequired(const word& name) const;
|
||||||
|
|
||||||
//- Return true if the default ddtScheme is steadyState
|
//- True if the default ddtScheme is steadyState
|
||||||
bool steady() const
|
bool steady() const noexcept
|
||||||
{
|
{
|
||||||
return steady_;
|
return steady_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if the default ddtScheme is not steadyState
|
//- True if the default ddtScheme is not steadyState
|
||||||
bool transient() const
|
bool transient() const noexcept
|
||||||
{
|
{
|
||||||
return !steady_;
|
return !steady_;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user