ENH: add intensity/mixingLength entries, printCoeffs in porousZone

This commit is contained in:
Mark Olesen
2010-06-09 10:29:04 +02:00
parent d5ec1d3cee
commit 56bcb231ac
2 changed files with 128 additions and 24 deletions

View File

@ -73,6 +73,8 @@ Foam::porousZone::porousZone
cellZoneID_(mesh_.cellZones().findZoneID(name)), cellZoneID_(mesh_.cellZones().findZoneID(name)),
coordSys_(dict, mesh), coordSys_(dict, mesh),
porosity_(1), porosity_(1),
intensity_(1e-2),
mixingLength_(1e-3),
C0_(0), C0_(0),
C1_(0), C1_(0),
D_("D", dimensionSet(0, -2, 0, 0, 0), tensor::zero), D_("D", dimensionSet(0, -2, 0, 0, 0), tensor::zero),
@ -95,21 +97,57 @@ Foam::porousZone::porousZone
// porosity // porosity
if (dict_.readIfPresent("porosity", porosity_)) if
(
dict_.readIfPresent("porosity", porosity_)
&& (porosity_ <= 0.0 || porosity_ > 1.0)
)
{ {
if (porosity_ <= 0.0 || porosity_ > 1.0) FatalIOErrorIn
{ (
FatalIOErrorIn "Foam::porousZone::porousZone"
( "(const fvMesh&, const word&, const dictionary&)",
"Foam::porousZone::porousZone" dict_
"(const fvMesh&, const word&, const dictionary&)", )
dict_ << "out-of-range porosity value " << porosity_
) << exit(FatalIOError);
<< "out-of-range porosity value " << porosity_
<< exit(FatalIOError);
}
} }
// turbulent intensity
if
(
dict_.readIfPresent("intensity", intensity_)
&& (intensity_ <= 0.0 || intensity_ > 1.0)
)
{
FatalIOErrorIn
(
"Foam::porousZone::porousZone"
"(const fvMesh&, const word&, const dictionary&)",
dict_
)
<< "out-of-range turbulent intensity value " << intensity_
<< exit(FatalIOError);
}
// turbulent length scale
if
(
dict_.readIfPresent("mixingLength", mixingLength_)
&& (mixingLength_ <= 0.0)
)
{
FatalIOErrorIn
(
"Foam::porousZone::porousZone"
"(const fvMesh&, const word&, const dictionary&)",
dict_
)
<< "out-of-range turbulent length scale " << mixingLength_
<< exit(FatalIOError);
}
// powerLaw coefficients // powerLaw coefficients
if (const dictionary* dictPtr = dict_.subDictPtr("powerLaw")) if (const dictionary* dictPtr = dict_.subDictPtr("powerLaw"))
{ {
@ -171,9 +209,6 @@ Foam::porousZone::porousZone
} }
} }
// provide some feedback for the user
// writeDict(Info, false);
// it is an error not to define anything // it is an error not to define anything
if if
( (
@ -191,6 +226,12 @@ Foam::porousZone::porousZone
"nor Darcy-Forchheimer law (d/f) specified" "nor Darcy-Forchheimer law (d/f) specified"
<< exit(FatalIOError); << exit(FatalIOError);
} }
// feedback for the user
if (dict.lookupOrDefault("printCoeffs", false))
{
writeDict(Info, false);
}
} }
@ -365,7 +406,8 @@ void Foam::porousZone::writeDict(Ostream& os, bool subDict) const
if (subDict) if (subDict)
{ {
os << indent << token::BEGIN_BLOCK << incrIndent << nl; os << indent << token::BEGIN_BLOCK << incrIndent << nl;
os.writeKeyword("name") << zoneName() << token::END_STATEMENT << nl; os.writeKeyword("name")
<< zoneName() << token::END_STATEMENT << nl;
} }
else else
{ {
@ -375,40 +417,53 @@ void Foam::porousZone::writeDict(Ostream& os, bool subDict) const
if (dict_.found("note")) if (dict_.found("note"))
{ {
os.writeKeyword("note") << string(dict_.lookup("note")) os.writeKeyword("note")
<< token::END_STATEMENT << nl; << string(dict_.lookup("note")) << token::END_STATEMENT << nl;
} }
coordSys_.writeDict(os, true); coordSys_.writeDict(os, true);
if (dict_.found("porosity")) if (dict_.found("porosity"))
{ {
os.writeKeyword("porosity") << porosity() << token::END_STATEMENT << nl; os.writeKeyword("porosity")
<< porosity() << token::END_STATEMENT << nl;
}
if (dict_.found("intensity"))
{
os.writeKeyword("intensity")
<< intensity() << token::END_STATEMENT << nl;
}
if (dict_.found("mixingLength"))
{
os.writeKeyword("mixingLength")
<< mixingLength() << token::END_STATEMENT << nl;
} }
// powerLaw coefficients // powerLaw coefficients
if (const dictionary* dictPtr = dict_.subDictPtr("powerLaw")) if (const dictionary* dictPtr = dict_.subDictPtr("powerLaw"))
{ {
os << indent << "powerLaw"; os << indent << "powerLaw";
dictPtr->write(os); dictPtr->write(os);
} }
// Darcy-Forchheimer coefficients // Darcy-Forchheimer coefficients
if (const dictionary* dictPtr = dict_.subDictPtr("Darcy")) if (const dictionary* dictPtr = dict_.subDictPtr("Darcy"))
{ {
os << indent << "Darcy"; os << indent << "Darcy";
dictPtr->write(os); dictPtr->write(os);
} }
os << decrIndent << indent << token::END_BLOCK << endl; os << decrIndent << indent << token::END_BLOCK << endl;
} }
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const porousZone& pZone) Foam::Ostream& Foam::operator<<(Ostream& os, const porousZone& pz)
{ {
pZone.writeDict(os); pz.writeDict(os);
return os; return os;
} }

View File

@ -51,6 +51,25 @@ Description
The porousZones method porousZones::ddt() mirrors the normal fvm::ddt() The porousZones method porousZones::ddt() mirrors the normal fvm::ddt()
method, but accounts for the effective volume of the cells. method, but accounts for the effective volume of the cells.
An example dictionary entry:
@verbatim
cat1
{
note "some catalyst";
coordinateSystem system_10;
porosity 0.809;
intensity 0.001; // optional: default 1% turbulence
mixingLength 0.0001; // optional: default 1mm mixingLength
printCoeffs yes; // optional: feedback for the user
Darcy
{
d d [0 -2 0 0 0] (-1000 -1000 5.3756e+07);
f f [0 -1 0 0 0] (-1000 -1000 15.83);
}
}
@endverbatim
See Also See Also
porousZones and coordinateSystems porousZones and coordinateSystems
@ -111,6 +130,12 @@ class porousZone
// Currently unused. // Currently unused.
scalar porosity_; scalar porosity_;
//- Turbulent intensity as fraction of the velocity (default: 0.01)
scalar intensity_;
//- Turbulent length scale (default: 0.001)
scalar mixingLength_;
//- powerLaw coefficient C0 //- powerLaw coefficient C0
scalar C0_; scalar C0_;
@ -283,6 +308,30 @@ public:
return porosity_; return porosity_;
} }
//- Return turbulent intensity
scalar intensity() const
{
return intensity_;
}
//- Edit access to turbulent intensity
scalar& intensity()
{
return intensity_;
}
//- Return turbulent length scale
scalar mixingLength() const
{
return mixingLength_;
}
//- Edit access to turbulent length scale
scalar& mixingLength()
{
return mixingLength_;
}
//- Modify time derivative elements according to porosity //- Modify time derivative elements according to porosity
template<class Type> template<class Type>