diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C index bca5179990..50d0c99f83 100644 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C +++ b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C @@ -73,6 +73,8 @@ Foam::porousZone::porousZone cellZoneID_(mesh_.cellZones().findZoneID(name)), coordSys_(dict, mesh), porosity_(1), + intensity_(1e-2), + mixingLength_(1e-3), C0_(0), C1_(0), D_("D", dimensionSet(0, -2, 0, 0, 0), tensor::zero), @@ -95,21 +97,57 @@ Foam::porousZone::porousZone // 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 - ( - "Foam::porousZone::porousZone" - "(const fvMesh&, const word&, const dictionary&)", - dict_ - ) - << "out-of-range porosity value " << porosity_ - << exit(FatalIOError); - } + FatalIOErrorIn + ( + "Foam::porousZone::porousZone" + "(const fvMesh&, const word&, const dictionary&)", + dict_ + ) + << "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 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 if ( @@ -191,6 +226,12 @@ Foam::porousZone::porousZone "nor Darcy-Forchheimer law (d/f) specified" << 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) { os << indent << token::BEGIN_BLOCK << incrIndent << nl; - os.writeKeyword("name") << zoneName() << token::END_STATEMENT << nl; + os.writeKeyword("name") + << zoneName() << token::END_STATEMENT << nl; } else { @@ -375,40 +417,53 @@ void Foam::porousZone::writeDict(Ostream& os, bool subDict) const if (dict_.found("note")) { - os.writeKeyword("note") << string(dict_.lookup("note")) - << token::END_STATEMENT << nl; + os.writeKeyword("note") + << string(dict_.lookup("note")) << token::END_STATEMENT << nl; } coordSys_.writeDict(os, true); 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 if (const dictionary* dictPtr = dict_.subDictPtr("powerLaw")) { - os << indent << "powerLaw"; + os << indent << "powerLaw"; dictPtr->write(os); } // Darcy-Forchheimer coefficients if (const dictionary* dictPtr = dict_.subDictPtr("Darcy")) { - os << indent << "Darcy"; + os << indent << "Darcy"; dictPtr->write(os); } - os << decrIndent << indent << token::END_BLOCK << endl; + os << decrIndent << indent << token::END_BLOCK << endl; } // * * * * * * * * * * * * * * * 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; } diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H index 3054df0328..4105902bac 100644 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H +++ b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H @@ -51,6 +51,25 @@ Description The porousZones method porousZones::ddt() mirrors the normal fvm::ddt() 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 porousZones and coordinateSystems @@ -111,6 +130,12 @@ class porousZone // Currently unused. 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 scalar C0_; @@ -283,6 +308,30 @@ public: 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 template