BACKPORT: turbulent inlets handled as inletOutlet

This commit is contained in:
Henrik Rusche 2013-07-05 22:11:36 +02:00
parent af120e323c
commit 3539477f95
10 changed files with 318 additions and 123 deletions

View file

@ -39,11 +39,15 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
fixedValueFvPatchField<scalar>(p, iF), inletOutletFvPatchScalarField(p, iF),
UName_("U"), intensity_(0.0),
intensity_(0.05) UName_("undefined-U"),
{} phiName_("undefined-phi")
{
this->refValue() = 0.0;
this->refGrad() = 0.0;
this->valueFraction() = 0.0;
}
Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField:: Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
turbulentIntensityKineticEnergyInletFvPatchScalarField turbulentIntensityKineticEnergyInletFvPatchScalarField
@ -54,9 +58,10 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), inletOutletFvPatchScalarField(ptf, p, iF, mapper),
intensity_(ptf.intensity_),
UName_(ptf.UName_), UName_(ptf.UName_),
intensity_(ptf.intensity_) phiName_(ptf.phiName_)
{} {}
@ -68,9 +73,10 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
const dictionary& dict const dictionary& dict
) )
: :
fixedValueFvPatchField<scalar>(p, iF, dict), inletOutletFvPatchScalarField(p, iF),
intensity_(readScalar(dict.lookup("intensity"))),
UName_(dict.lookupOrDefault<word>("U", "U")), UName_(dict.lookupOrDefault<word>("U", "U")),
intensity_(readScalar(dict.lookup("intensity"))) phiName_(dict.lookupOrDefault<word>("phi", "phi"))
{ {
if (intensity_ < 0 || intensity_ > 1) if (intensity_ < 0 || intensity_ > 1)
{ {
@ -88,8 +94,13 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
<< " in file " << this->dimensionedInternalField().objectPath() << " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalError); << exit(FatalError);
} }
}
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->refValue() = 0.0;
this->refGrad() = 0.0;
this->valueFraction() = 0.0;
}
Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField:: Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
turbulentIntensityKineticEnergyInletFvPatchScalarField turbulentIntensityKineticEnergyInletFvPatchScalarField
@ -97,9 +108,10 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
const turbulentIntensityKineticEnergyInletFvPatchScalarField& ptf const turbulentIntensityKineticEnergyInletFvPatchScalarField& ptf
) )
: :
fixedValueFvPatchField<scalar>(ptf), inletOutletFvPatchScalarField(ptf),
intensity_(ptf.intensity_),
UName_(ptf.UName_), UName_(ptf.UName_),
intensity_(ptf.intensity_) phiName_(ptf.phiName_)
{} {}
@ -110,16 +122,16 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
fixedValueFvPatchField<scalar>(ptf, iF), inletOutletFvPatchScalarField(ptf, iF),
intensity_(ptf.intensity_),
UName_(ptf.UName_), UName_(ptf.UName_),
intensity_(ptf.intensity_) phiName_(ptf.phiName_)
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void void Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
updateCoeffs() updateCoeffs()
{ {
if (updated()) if (updated())
@ -127,12 +139,16 @@ updateCoeffs()
return; return;
} }
const fvPatchField<vector>& Up = const fvPatchVectorField& Up =
lookupPatchField<volVectorField, vector>(UName_); patch().lookupPatchField<volVectorField, vector>(UName_);
operator==(1.5*sqr(intensity_)*magSqr(Up)); const fvsPatchScalarField& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
fixedValueFvPatchField<scalar>::updateCoeffs(); this->refValue() = SMALL + 1.5*sqr(intensity_)*magSqr(Up);
this->valueFraction() = neg(phip);
inletOutletFvPatchScalarField::updateCoeffs();
} }
@ -141,12 +157,10 @@ void Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::write
Ostream& os Ostream& os
) const ) const
{ {
fvPatchField<scalar>::write(os); fvPatchScalarField::write(os);
if (UName_ != "U")
{
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("intensity") << intensity_ << token::END_STATEMENT << nl; os.writeKeyword("intensity") << intensity_ << token::END_STATEMENT << nl;
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
writeEntry("value", os); writeEntry("value", os);
} }

View file

@ -30,7 +30,7 @@ Description
fraction of the mean velocity fraction of the mean velocity
Example of the boundary condition specification: Example of the boundary condition specification:
@verbatim \verbatim
inlet inlet
{ {
type turbulentIntensityKineticEnergyInlet; type turbulentIntensityKineticEnergyInlet;
@ -38,7 +38,7 @@ Description
intensity 0.05; // 5% turbulence intensity 0.05; // 5% turbulence
value uniform 1; // placeholder value uniform 1; // placeholder
} }
@endverbatim \endverbatim
SourceFiles SourceFiles
turbulentIntensityKineticEnergyInletFvPatchScalarField.C turbulentIntensityKineticEnergyInletFvPatchScalarField.C
@ -48,7 +48,7 @@ SourceFiles
#ifndef turbulentIntensityKineticEnergyInletFvPatchScalarField_H #ifndef turbulentIntensityKineticEnergyInletFvPatchScalarField_H
#define turbulentIntensityKineticEnergyInletFvPatchScalarField_H #define turbulentIntensityKineticEnergyInletFvPatchScalarField_H
#include "fixedValueFvPatchFields.H" #include "inletOutletFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -61,16 +61,19 @@ namespace Foam
class turbulentIntensityKineticEnergyInletFvPatchScalarField class turbulentIntensityKineticEnergyInletFvPatchScalarField
: :
public fixedValueFvPatchScalarField public inletOutletFvPatchScalarField
{ {
// Private data // Private data
//- Name of velocity field
word UName_;
//- Turbulent intensity as fraction of mean velocity //- Turbulent intensity as fraction of mean velocity
scalar intensity_; scalar intensity_;
//- Name of the velocity field
word UName_;
//- Name of the flux field
word phiName_;
public: public:

View file

@ -47,9 +47,15 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
fixedValueFvPatchField<scalar>(p, iF), inletOutletFvPatchScalarField(p, iF),
mixingLength_(0.001) mixingLength_(0.0),
{} phiName_("undefined-phi"),
kName_("undefined-k")
{
this->refValue() = 0.0;
this->refGrad() = 0.0;
this->valueFraction() = 0.0;
}
turbulentMixingLengthDissipationRateInletFvPatchScalarField:: turbulentMixingLengthDissipationRateInletFvPatchScalarField::
turbulentMixingLengthDissipationRateInletFvPatchScalarField turbulentMixingLengthDissipationRateInletFvPatchScalarField
@ -60,8 +66,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), inletOutletFvPatchScalarField(ptf, p, iF, mapper),
mixingLength_(ptf.mixingLength_) mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{} {}
turbulentMixingLengthDissipationRateInletFvPatchScalarField:: turbulentMixingLengthDissipationRateInletFvPatchScalarField::
@ -72,9 +80,17 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
const dictionary& dict const dictionary& dict
) )
: :
fixedValueFvPatchField<scalar>(p, iF, dict), inletOutletFvPatchScalarField(p, iF),
mixingLength_(readScalar(dict.lookup("mixingLength"))) mixingLength_(readScalar(dict.lookup("mixingLength"))),
{} phiName_(dict.lookupOrDefault<word>("phi", "phi")),
kName_(dict.lookupOrDefault<word>("k", "k"))
{
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->refValue() = 0.0;
this->refGrad() = 0.0;
this->valueFraction() = 0.0;
}
turbulentMixingLengthDissipationRateInletFvPatchScalarField:: turbulentMixingLengthDissipationRateInletFvPatchScalarField::
turbulentMixingLengthDissipationRateInletFvPatchScalarField turbulentMixingLengthDissipationRateInletFvPatchScalarField
@ -82,8 +98,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf
) )
: :
fixedValueFvPatchField<scalar>(ptf), inletOutletFvPatchScalarField(ptf),
mixingLength_(ptf.mixingLength_) mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{} {}
turbulentMixingLengthDissipationRateInletFvPatchScalarField:: turbulentMixingLengthDissipationRateInletFvPatchScalarField::
@ -93,8 +111,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
fixedValueFvPatchField<scalar>(ptf, iF), inletOutletFvPatchScalarField(ptf, iF),
mixingLength_(ptf.mixingLength_) mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{} {}
@ -115,12 +135,16 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs()
const scalar Cmu75 = pow(Cmu, 0.75); const scalar Cmu75 = pow(Cmu, 0.75);
const fvPatchField<scalar>& kp = const fvPatchScalarField& kp =
lookupPatchField<volScalarField, scalar>("k"); patch().lookupPatchField<volScalarField, scalar>(kName_);
operator==(Cmu75*kp*sqrt(kp)/mixingLength_); const fvsPatchScalarField& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
fixedValueFvPatchField<scalar>::updateCoeffs(); this->refValue() = Cmu75*kp*sqrt(kp)/mixingLength_;
this->valueFraction() = neg(phip);
inletOutletFvPatchScalarField::updateCoeffs();
} }
@ -129,9 +153,11 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::write
Ostream& os Ostream& os
) const ) const
{ {
fvPatchField<scalar>::write(os); fvPatchScalarField::write(os);
os.writeKeyword("mixingLength") os.writeKeyword("mixingLength")
<< mixingLength_ << token::END_STATEMENT << nl; << mixingLength_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl;
writeEntry("value", os); writeEntry("value", os);
} }

View file

@ -30,14 +30,14 @@ Description
Calculate epsilon via the mixing length [m] Calculate epsilon via the mixing length [m]
Example of the boundary condition specification: Example of the boundary condition specification:
@verbatim \verbatim
inlet inlet
{ {
type compressible::turbulentMixingLengthDissipationRateInlet; type compressible::turbulentMixingLengthDissipationRateInlet;
mixingLength 0.005; // 5 mm mixingLength 0.005; // 5 mm
value uniform 200; // placeholder value uniform 200; // placeholder
} }
@endverbatim \endverbatim
SourceFiles SourceFiles
turbulentMixingLengthDissipationRateInletFvPatchScalarField.C turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
@ -47,7 +47,7 @@ SourceFiles
#ifndef compressibleturbulentMixingLengthDissipationRateInletFvPatchField_H #ifndef compressibleturbulentMixingLengthDissipationRateInletFvPatchField_H
#define compressibleturbulentMixingLengthDissipationRateInletFvPatchField_H #define compressibleturbulentMixingLengthDissipationRateInletFvPatchField_H
#include "fixedValueFvPatchFields.H" #include "inletOutletFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -62,13 +62,20 @@ namespace compressible
class turbulentMixingLengthDissipationRateInletFvPatchScalarField class turbulentMixingLengthDissipationRateInletFvPatchScalarField
: :
public fixedValueFvPatchScalarField public inletOutletFvPatchScalarField
{ {
// Private data // Private data
//- turbulent length scale //- turbulent length scale
scalar mixingLength_; scalar mixingLength_;
//- Name of the flux field
word phiName_;
//- Name of the turbulent kinetic energy field
word kName_;
public: public:
//- Runtime type information //- Runtime type information

View file

@ -47,10 +47,15 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
fixedValueFvPatchField<scalar>(p, iF), inletOutletFvPatchScalarField(p, iF),
mixingLength_(0.0), mixingLength_(0.0),
kName_("k") phiName_("undefined-phi"),
{} kName_("undefined-k")
{
this->refValue() = 0.0;
this->refGrad() = 0.0;
this->valueFraction() = 0.0;
}
turbulentMixingLengthFrequencyInletFvPatchScalarField:: turbulentMixingLengthFrequencyInletFvPatchScalarField::
turbulentMixingLengthFrequencyInletFvPatchScalarField turbulentMixingLengthFrequencyInletFvPatchScalarField
@ -61,8 +66,9 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), inletOutletFvPatchScalarField(ptf, p, iF, mapper),
mixingLength_(ptf.mixingLength_), mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_) kName_(ptf.kName_)
{} {}
@ -74,10 +80,17 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
const dictionary& dict const dictionary& dict
) )
: :
fixedValueFvPatchField<scalar>(p, iF, dict), inletOutletFvPatchScalarField(p, iF),
mixingLength_(readScalar(dict.lookup("mixingLength"))), mixingLength_(readScalar(dict.lookup("mixingLength"))),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
kName_(dict.lookupOrDefault<word>("k", "k")) kName_(dict.lookupOrDefault<word>("k", "k"))
{} {
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->refValue() = 0.0;
this->refGrad() = 0.0;
this->valueFraction() = 0.0;
}
turbulentMixingLengthFrequencyInletFvPatchScalarField:: turbulentMixingLengthFrequencyInletFvPatchScalarField::
turbulentMixingLengthFrequencyInletFvPatchScalarField turbulentMixingLengthFrequencyInletFvPatchScalarField
@ -85,8 +98,9 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
const turbulentMixingLengthFrequencyInletFvPatchScalarField& ptf const turbulentMixingLengthFrequencyInletFvPatchScalarField& ptf
) )
: :
fixedValueFvPatchField<scalar>(ptf), inletOutletFvPatchScalarField(ptf),
mixingLength_(ptf.mixingLength_), mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_) kName_(ptf.kName_)
{} {}
@ -97,8 +111,9 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
fixedValueFvPatchField<scalar>(ptf, iF), inletOutletFvPatchScalarField(ptf, iF),
mixingLength_(ptf.mixingLength_), mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_) kName_(ptf.kName_)
{} {}
@ -120,12 +135,16 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs()
const scalar Cmu25 = pow(Cmu, 0.25); const scalar Cmu25 = pow(Cmu, 0.25);
const fvPatchField<scalar>& kp = const fvPatchScalarField& kp =
lookupPatchField<volScalarField, scalar>(kName_); patch().lookupPatchField<volScalarField, scalar>(kName_);
operator==(sqrt(kp)/(Cmu25*mixingLength_)); const fvsPatchScalarField& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
fixedValueFvPatchField<scalar>::updateCoeffs(); this->refValue() = sqrt(kp)/(Cmu25*mixingLength_);
this->valueFraction() = neg(phip);
inletOutletFvPatchScalarField::updateCoeffs();
} }
@ -134,9 +153,10 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::write
Ostream& os Ostream& os
) const ) const
{ {
fvPatchField<scalar>::write(os); fvPatchScalarField::write(os);
os.writeKeyword("mixingLength") os.writeKeyword("mixingLength")
<< mixingLength_ << token::END_STATEMENT << nl; << mixingLength_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl; os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl;
writeEntry("value", os); writeEntry("value", os);
} }

View file

@ -25,19 +25,52 @@ License
Class Class
Foam::compressible::turbulentMixingLengthFrequencyInletFvPatchScalarField Foam::compressible::turbulentMixingLengthFrequencyInletFvPatchScalarField
Group
grpIcoRASBoundaryConditions grpInletBoundaryConditions
Description Description
Calculate omega via the mixing length This boundary condition provides a turbulence specific dissipation,
\f$\omega\f$ (omega) inlet condition based on a specified mixing length.
The patch values are calculated using:
\f[
\omega_p = \frac{k^{0.5}}{C_{\mu}^{0.25} L}
\f]
where
\vartable
\omega_p | patch omega values
C_{\mu} | Model coefficient, set to 0.09
k | turbulence kinetic energy
L | length scale
\endvartable
\heading Patch usage
\table
Property | Description | Required | Default value
mixingLength | Length scale [m] | yes |
phi | flux field name | no | phi
k | turbulence kinetic energy field name | no | k
\endtable
Example of the boundary condition specification: Example of the boundary condition specification:
@verbatim \verbatim
inlet myPatch
{ {
type compressible::turbulentMixingLengthFrequencyInlet; type turbulentMixingLengthFrequencyInlet;
mixingLength 0.005; // 5 mm mixingLength 0.005;
k k; // turbulent k field value uniform 200; // placeholder
value uniform 5; // initial value
} }
@endverbatim \endverbatim
Note
In the event of reverse flow, a zero-gradient condition is applied
SeeAlso
Foam::inletOutletFvPatchField
SourceFiles SourceFiles
turbulentMixingLengthFrequencyInletFvPatchScalarField.C turbulentMixingLengthFrequencyInletFvPatchScalarField.C
@ -47,7 +80,7 @@ SourceFiles
#ifndef compressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H #ifndef compressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H
#define compressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H #define compressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H
#include "fixedValueFvPatchFields.H" #include "inletOutletFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -62,13 +95,16 @@ namespace compressible
class turbulentMixingLengthFrequencyInletFvPatchScalarField class turbulentMixingLengthFrequencyInletFvPatchScalarField
: :
public fixedValueFvPatchScalarField public inletOutletFvPatchScalarField
{ {
// Private data // Private data
//- Turbulent length scale //- Turbulent length scale
scalar mixingLength_; scalar mixingLength_;
//- Name of the flux field
word phiName_;
//- Name of the turbulent kinetic energy field //- Name of the turbulent kinetic energy field
word kName_; word kName_;

View file

@ -47,9 +47,15 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
fixedValueFvPatchField<scalar>(p, iF), inletOutletFvPatchScalarField(p, iF),
mixingLength_(0.001) mixingLength_(0.0),
{} phiName_("undefined-phi"),
kName_("undefined-k")
{
this->refValue() = 0.0;
this->refGrad() = 0.0;
this->valueFraction() = 0.0;
}
turbulentMixingLengthDissipationRateInletFvPatchScalarField:: turbulentMixingLengthDissipationRateInletFvPatchScalarField::
turbulentMixingLengthDissipationRateInletFvPatchScalarField turbulentMixingLengthDissipationRateInletFvPatchScalarField
@ -60,8 +66,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), inletOutletFvPatchScalarField(ptf, p, iF, mapper),
mixingLength_(ptf.mixingLength_) mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{} {}
turbulentMixingLengthDissipationRateInletFvPatchScalarField:: turbulentMixingLengthDissipationRateInletFvPatchScalarField::
@ -72,9 +80,17 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
const dictionary& dict const dictionary& dict
) )
: :
fixedValueFvPatchField<scalar>(p, iF, dict), inletOutletFvPatchScalarField(p, iF),
mixingLength_(readScalar(dict.lookup("mixingLength"))) mixingLength_(readScalar(dict.lookup("mixingLength"))),
{} phiName_(dict.lookupOrDefault<word>("phi", "phi")),
kName_(dict.lookupOrDefault<word>("k", "k"))
{
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->refValue() = 0.0;
this->refGrad() = 0.0;
this->valueFraction() = 0.0;
}
turbulentMixingLengthDissipationRateInletFvPatchScalarField:: turbulentMixingLengthDissipationRateInletFvPatchScalarField::
turbulentMixingLengthDissipationRateInletFvPatchScalarField turbulentMixingLengthDissipationRateInletFvPatchScalarField
@ -82,8 +98,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf
) )
: :
fixedValueFvPatchField<scalar>(ptf), inletOutletFvPatchScalarField(ptf),
mixingLength_(ptf.mixingLength_) mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{} {}
turbulentMixingLengthDissipationRateInletFvPatchScalarField:: turbulentMixingLengthDissipationRateInletFvPatchScalarField::
@ -93,8 +111,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
fixedValueFvPatchField<scalar>(ptf, iF), inletOutletFvPatchScalarField(ptf, iF),
mixingLength_(ptf.mixingLength_) mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_)
{} {}
@ -115,12 +135,16 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs()
const scalar Cmu75 = pow(Cmu, 0.75); const scalar Cmu75 = pow(Cmu, 0.75);
const fvPatchField<scalar>& kp = const fvPatchScalarField& kp =
lookupPatchField<volScalarField, scalar>("k"); patch().lookupPatchField<volScalarField, scalar>(kName_);
operator==(Cmu75*kp*sqrt(kp)/mixingLength_); const fvsPatchScalarField& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
fixedValueFvPatchField<scalar>::updateCoeffs(); this->refValue() = Cmu75*kp*sqrt(kp)/mixingLength_;
this->valueFraction() = neg(phip);
inletOutletFvPatchScalarField::updateCoeffs();
} }
@ -129,9 +153,11 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::write
Ostream& os Ostream& os
) const ) const
{ {
fvPatchField<scalar>::write(os); fvPatchScalarField::write(os);
os.writeKeyword("mixingLength") os.writeKeyword("mixingLength")
<< mixingLength_ << token::END_STATEMENT << nl; << mixingLength_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl;
writeEntry("value", os); writeEntry("value", os);
} }

View file

@ -30,14 +30,14 @@ Description
Calculate epsilon via the mixing length [m] Calculate epsilon via the mixing length [m]
Example of the boundary condition specification: Example of the boundary condition specification:
@verbatim \verbatim
inlet inlet
{ {
type turbulentMixingLengthDissipationRateInlet; type turbulentMixingLengthDissipationRateInlet;
mixingLength 0.005; // 5 mm mixingLength 0.005; // 5 mm
value uniform 200; // placeholder value uniform 200; // placeholder
} }
@endverbatim \endverbatim
SourceFiles SourceFiles
turbulentMixingLengthDissipationRateInletFvPatchScalarField.C turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
@ -47,7 +47,7 @@ SourceFiles
#ifndef incompressibleturbulentMixingLengthDissipationRateInlet_H #ifndef incompressibleturbulentMixingLengthDissipationRateInlet_H
#define incompressibleturbulentMixingLengthDissipationRateInlet_H #define incompressibleturbulentMixingLengthDissipationRateInlet_H
#include "fixedValueFvPatchFields.H" #include "inletOutletFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -62,13 +62,20 @@ namespace incompressible
class turbulentMixingLengthDissipationRateInletFvPatchScalarField class turbulentMixingLengthDissipationRateInletFvPatchScalarField
: :
public fixedValueFvPatchScalarField public inletOutletFvPatchScalarField
{ {
// Private data // Private data
//- turbulent length scale //- turbulent length scale
scalar mixingLength_; scalar mixingLength_;
//- Name of the flux field
word phiName_;
//- Name of the turbulent kinetic energy field
word kName_;
public: public:
//- Runtime type information //- Runtime type information

View file

@ -47,10 +47,15 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
fixedValueFvPatchField<scalar>(p, iF), inletOutletFvPatchScalarField(p, iF),
mixingLength_(0.0), mixingLength_(0.0),
phiName_("undefined-phi"),
kName_("undefined-k") kName_("undefined-k")
{} {
this->refValue() = 0.0;
this->refGrad() = 0.0;
this->valueFraction() = 0.0;
}
turbulentMixingLengthFrequencyInletFvPatchScalarField:: turbulentMixingLengthFrequencyInletFvPatchScalarField::
turbulentMixingLengthFrequencyInletFvPatchScalarField turbulentMixingLengthFrequencyInletFvPatchScalarField
@ -61,8 +66,9 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), inletOutletFvPatchScalarField(ptf, p, iF, mapper),
mixingLength_(ptf.mixingLength_), mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_) kName_(ptf.kName_)
{} {}
@ -74,10 +80,17 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
const dictionary& dict const dictionary& dict
) )
: :
fixedValueFvPatchField<scalar>(p, iF, dict), inletOutletFvPatchScalarField(p, iF),
mixingLength_(readScalar(dict.lookup("mixingLength"))), mixingLength_(readScalar(dict.lookup("mixingLength"))),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
kName_(dict.lookupOrDefault<word>("k", "k")) kName_(dict.lookupOrDefault<word>("k", "k"))
{} {
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->refValue() = 0.0;
this->refGrad() = 0.0;
this->valueFraction() = 0.0;
}
turbulentMixingLengthFrequencyInletFvPatchScalarField:: turbulentMixingLengthFrequencyInletFvPatchScalarField::
turbulentMixingLengthFrequencyInletFvPatchScalarField turbulentMixingLengthFrequencyInletFvPatchScalarField
@ -85,8 +98,9 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
const turbulentMixingLengthFrequencyInletFvPatchScalarField& ptf const turbulentMixingLengthFrequencyInletFvPatchScalarField& ptf
) )
: :
fixedValueFvPatchField<scalar>(ptf), inletOutletFvPatchScalarField(ptf),
mixingLength_(ptf.mixingLength_), mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_) kName_(ptf.kName_)
{} {}
@ -97,8 +111,9 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
fixedValueFvPatchField<scalar>(ptf, iF), inletOutletFvPatchScalarField(ptf, iF),
mixingLength_(ptf.mixingLength_), mixingLength_(ptf.mixingLength_),
phiName_(ptf.phiName_),
kName_(ptf.kName_) kName_(ptf.kName_)
{} {}
@ -120,12 +135,16 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs()
const scalar Cmu25 = pow(Cmu, 0.25); const scalar Cmu25 = pow(Cmu, 0.25);
const fvPatchField<scalar>& kp = const fvPatchScalarField& kp =
lookupPatchField<volScalarField, scalar>(kName_); patch().lookupPatchField<volScalarField, scalar>(kName_);
operator==(sqrt(kp)/(Cmu25*mixingLength_)); const fvsPatchScalarField& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
fixedValueFvPatchField<scalar>::updateCoeffs(); this->refValue() = sqrt(kp)/(Cmu25*mixingLength_);
this->valueFraction() = neg(phip);
inletOutletFvPatchScalarField::updateCoeffs();
} }
@ -134,9 +153,10 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::write
Ostream& os Ostream& os
) const ) const
{ {
fvPatchField<scalar>::write(os); fvPatchScalarField::write(os);
os.writeKeyword("mixingLength") os.writeKeyword("mixingLength")
<< mixingLength_ << token::END_STATEMENT << nl; << mixingLength_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl; os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl;
writeEntry("value", os); writeEntry("value", os);
} }

View file

@ -25,19 +25,52 @@ License
Class Class
Foam::incompressible::turbulentMixingLengthFrequencyInletFvPatchScalarField Foam::incompressible::turbulentMixingLengthFrequencyInletFvPatchScalarField
Group
grpIcoRASBoundaryConditions grpInletBoundaryConditions
Description Description
Calculate omega via the mixing length This boundary condition provides a turbulence specific dissipation,
\f$\omega\f$ (omega) inlet condition based on a specified mixing length.
The patch values are calculated using:
\f[
\omega_p = \frac{k^{0.5}}{C_{\mu}^{0.25} L}
\f]
where
\vartable
\omega_p | patch omega values
C_{\mu} | Model coefficient, set to 0.09
k | turbulence kinetic energy
L | length scale
\endvartable
\heading Patch usage
\table
Property | Description | Required | Default value
mixingLength | Length scale [m] | yes |
phi | flux field name | no | phi
k | turbulence kinetic energy field name | no | k
\endtable
Example of the boundary condition specification: Example of the boundary condition specification:
@verbatim \verbatim
inlet myPatch
{ {
type turbulentMixingLengthFrequencyInlet; type turbulentMixingLengthFrequencyInlet;
mixingLength 0.005; // 5 mm mixingLength 0.005;
k k; // turbulent k field value uniform 200; // placeholder
value uniform 5; // initial value
} }
@endverbatim \endverbatim
Note
In the event of reverse flow, a zero-gradient condition is applied
SeeAlso
Foam::inletOutletFvPatchField
SourceFiles SourceFiles
turbulentMixingLengthFrequencyInletFvPatchScalarField.C turbulentMixingLengthFrequencyInletFvPatchScalarField.C
@ -47,7 +80,7 @@ SourceFiles
#ifndef incompressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H #ifndef incompressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H
#define incompressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H #define incompressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H
#include "fixedValueFvPatchFields.H" #include "inletOutletFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -62,13 +95,16 @@ namespace incompressible
class turbulentMixingLengthFrequencyInletFvPatchScalarField class turbulentMixingLengthFrequencyInletFvPatchScalarField
: :
public fixedValueFvPatchScalarField public inletOutletFvPatchScalarField
{ {
// Private data // Private data
//- Turbulent length scale //- Turbulent length scale
scalar mixingLength_; scalar mixingLength_;
//- Name of the flux field
word phiName_;
//- Name of the turbulent kinetic energy field //- Name of the turbulent kinetic energy field
word kName_; word kName_;