BACKPORT: turbulent inlets handled as inletOutlet
This commit is contained in:
parent
af120e323c
commit
3539477f95
10 changed files with 318 additions and 123 deletions
|
@ -39,11 +39,15 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
|
|||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF),
|
||||
UName_("U"),
|
||||
intensity_(0.05)
|
||||
{}
|
||||
|
||||
inletOutletFvPatchScalarField(p, iF),
|
||||
intensity_(0.0),
|
||||
UName_("undefined-U"),
|
||||
phiName_("undefined-phi")
|
||||
{
|
||||
this->refValue() = 0.0;
|
||||
this->refGrad() = 0.0;
|
||||
this->valueFraction() = 0.0;
|
||||
}
|
||||
|
||||
Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
|
||||
turbulentIntensityKineticEnergyInletFvPatchScalarField
|
||||
|
@ -54,9 +58,10 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
|
|||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
inletOutletFvPatchScalarField(ptf, p, iF, mapper),
|
||||
intensity_(ptf.intensity_),
|
||||
UName_(ptf.UName_),
|
||||
intensity_(ptf.intensity_)
|
||||
phiName_(ptf.phiName_)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -68,9 +73,10 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
|
|||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF, dict),
|
||||
inletOutletFvPatchScalarField(p, iF),
|
||||
intensity_(readScalar(dict.lookup("intensity"))),
|
||||
UName_(dict.lookupOrDefault<word>("U", "U")),
|
||||
intensity_(readScalar(dict.lookup("intensity")))
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi"))
|
||||
{
|
||||
if (intensity_ < 0 || intensity_ > 1)
|
||||
{
|
||||
|
@ -88,8 +94,13 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
|
|||
<< " in file " << this->dimensionedInternalField().objectPath()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
|
||||
|
||||
this->refValue() = 0.0;
|
||||
this->refGrad() = 0.0;
|
||||
this->valueFraction() = 0.0;
|
||||
}
|
||||
|
||||
Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
|
||||
turbulentIntensityKineticEnergyInletFvPatchScalarField
|
||||
|
@ -97,9 +108,10 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
|
|||
const turbulentIntensityKineticEnergyInletFvPatchScalarField& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf),
|
||||
inletOutletFvPatchScalarField(ptf),
|
||||
intensity_(ptf.intensity_),
|
||||
UName_(ptf.UName_),
|
||||
intensity_(ptf.intensity_)
|
||||
phiName_(ptf.phiName_)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -110,16 +122,16 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
|
|||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf, iF),
|
||||
inletOutletFvPatchScalarField(ptf, iF),
|
||||
intensity_(ptf.intensity_),
|
||||
UName_(ptf.UName_),
|
||||
intensity_(ptf.intensity_)
|
||||
phiName_(ptf.phiName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void
|
||||
Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
|
||||
void Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
|
||||
updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
|
@ -127,12 +139,16 @@ updateCoeffs()
|
|||
return;
|
||||
}
|
||||
|
||||
const fvPatchField<vector>& Up =
|
||||
lookupPatchField<volVectorField, vector>(UName_);
|
||||
const fvPatchVectorField& Up =
|
||||
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
|
||||
) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
if (UName_ != "U")
|
||||
{
|
||||
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
fvPatchScalarField::write(os);
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ Description
|
|||
fraction of the mean velocity
|
||||
|
||||
Example of the boundary condition specification:
|
||||
@verbatim
|
||||
\verbatim
|
||||
inlet
|
||||
{
|
||||
type turbulentIntensityKineticEnergyInlet;
|
||||
|
@ -38,7 +38,7 @@ Description
|
|||
intensity 0.05; // 5% turbulence
|
||||
value uniform 1; // placeholder
|
||||
}
|
||||
@endverbatim
|
||||
\endverbatim
|
||||
|
||||
SourceFiles
|
||||
turbulentIntensityKineticEnergyInletFvPatchScalarField.C
|
||||
|
@ -48,7 +48,7 @@ SourceFiles
|
|||
#ifndef turbulentIntensityKineticEnergyInletFvPatchScalarField_H
|
||||
#define turbulentIntensityKineticEnergyInletFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "inletOutletFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -61,16 +61,19 @@ namespace Foam
|
|||
|
||||
class turbulentIntensityKineticEnergyInletFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
public inletOutletFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of velocity field
|
||||
word UName_;
|
||||
|
||||
//- Turbulent intensity as fraction of mean velocity
|
||||
scalar intensity_;
|
||||
|
||||
//- Name of the velocity field
|
||||
word UName_;
|
||||
|
||||
//- Name of the flux field
|
||||
word phiName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -47,9 +47,15 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
|||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF),
|
||||
mixingLength_(0.001)
|
||||
{}
|
||||
inletOutletFvPatchScalarField(p, iF),
|
||||
mixingLength_(0.0),
|
||||
phiName_("undefined-phi"),
|
||||
kName_("undefined-k")
|
||||
{
|
||||
this->refValue() = 0.0;
|
||||
this->refGrad() = 0.0;
|
||||
this->valueFraction() = 0.0;
|
||||
}
|
||||
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField::
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
|
@ -60,8 +66,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
|||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
mixingLength_(ptf.mixingLength_)
|
||||
inletOutletFvPatchScalarField(ptf, p, iF, mapper),
|
||||
mixingLength_(ptf.mixingLength_),
|
||||
phiName_(ptf.phiName_),
|
||||
kName_(ptf.kName_)
|
||||
{}
|
||||
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField::
|
||||
|
@ -72,9 +80,17 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
|||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF, dict),
|
||||
mixingLength_(readScalar(dict.lookup("mixingLength")))
|
||||
{}
|
||||
inletOutletFvPatchScalarField(p, iF),
|
||||
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
|
||||
|
@ -82,8 +98,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
|||
const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf),
|
||||
mixingLength_(ptf.mixingLength_)
|
||||
inletOutletFvPatchScalarField(ptf),
|
||||
mixingLength_(ptf.mixingLength_),
|
||||
phiName_(ptf.phiName_),
|
||||
kName_(ptf.kName_)
|
||||
{}
|
||||
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField::
|
||||
|
@ -93,8 +111,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
|||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf, iF),
|
||||
mixingLength_(ptf.mixingLength_)
|
||||
inletOutletFvPatchScalarField(ptf, iF),
|
||||
mixingLength_(ptf.mixingLength_),
|
||||
phiName_(ptf.phiName_),
|
||||
kName_(ptf.kName_)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -115,12 +135,16 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs()
|
|||
|
||||
const scalar Cmu75 = pow(Cmu, 0.75);
|
||||
|
||||
const fvPatchField<scalar>& kp =
|
||||
lookupPatchField<volScalarField, scalar>("k");
|
||||
const fvPatchScalarField& kp =
|
||||
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
|
||||
) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
fvPatchScalarField::write(os);
|
||||
os.writeKeyword("mixingLength")
|
||||
<< mixingLength_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,14 +30,14 @@ Description
|
|||
Calculate epsilon via the mixing length [m]
|
||||
|
||||
Example of the boundary condition specification:
|
||||
@verbatim
|
||||
\verbatim
|
||||
inlet
|
||||
{
|
||||
type compressible::turbulentMixingLengthDissipationRateInlet;
|
||||
mixingLength 0.005; // 5 mm
|
||||
value uniform 200; // placeholder
|
||||
}
|
||||
@endverbatim
|
||||
\endverbatim
|
||||
|
||||
SourceFiles
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
|
||||
|
@ -47,7 +47,7 @@ SourceFiles
|
|||
#ifndef compressibleturbulentMixingLengthDissipationRateInletFvPatchField_H
|
||||
#define compressibleturbulentMixingLengthDissipationRateInletFvPatchField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "inletOutletFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -62,13 +62,20 @@ namespace compressible
|
|||
|
||||
class turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
public inletOutletFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- turbulent length scale
|
||||
scalar mixingLength_;
|
||||
|
||||
//- Name of the flux field
|
||||
word phiName_;
|
||||
|
||||
//- Name of the turbulent kinetic energy field
|
||||
word kName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
|
|
|
@ -47,10 +47,15 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
|
|||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF),
|
||||
inletOutletFvPatchScalarField(p, iF),
|
||||
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
|
||||
|
@ -61,8 +66,9 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
|
|||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
inletOutletFvPatchScalarField(ptf, p, iF, mapper),
|
||||
mixingLength_(ptf.mixingLength_),
|
||||
phiName_(ptf.phiName_),
|
||||
kName_(ptf.kName_)
|
||||
{}
|
||||
|
||||
|
@ -74,10 +80,17 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
|
|||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF, dict),
|
||||
inletOutletFvPatchScalarField(p, iF),
|
||||
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;
|
||||
}
|
||||
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField::
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
|
@ -85,8 +98,9 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
|
|||
const turbulentMixingLengthFrequencyInletFvPatchScalarField& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf),
|
||||
inletOutletFvPatchScalarField(ptf),
|
||||
mixingLength_(ptf.mixingLength_),
|
||||
phiName_(ptf.phiName_),
|
||||
kName_(ptf.kName_)
|
||||
{}
|
||||
|
||||
|
@ -97,8 +111,9 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
|
|||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf, iF),
|
||||
inletOutletFvPatchScalarField(ptf, iF),
|
||||
mixingLength_(ptf.mixingLength_),
|
||||
phiName_(ptf.phiName_),
|
||||
kName_(ptf.kName_)
|
||||
{}
|
||||
|
||||
|
@ -120,12 +135,16 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs()
|
|||
|
||||
const scalar Cmu25 = pow(Cmu, 0.25);
|
||||
|
||||
const fvPatchField<scalar>& kp =
|
||||
lookupPatchField<volScalarField, scalar>(kName_);
|
||||
const fvPatchScalarField& kp =
|
||||
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
|
||||
) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
fvPatchScalarField::write(os);
|
||||
os.writeKeyword("mixingLength")
|
||||
<< mixingLength_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
|
|
@ -25,19 +25,52 @@ License
|
|||
Class
|
||||
Foam::compressible::turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpIcoRASBoundaryConditions grpInletBoundaryConditions
|
||||
|
||||
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:
|
||||
@verbatim
|
||||
inlet
|
||||
{
|
||||
type compressible::turbulentMixingLengthFrequencyInlet;
|
||||
mixingLength 0.005; // 5 mm
|
||||
k k; // turbulent k field
|
||||
value uniform 5; // initial value
|
||||
}
|
||||
@endverbatim
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type turbulentMixingLengthFrequencyInlet;
|
||||
mixingLength 0.005;
|
||||
value uniform 200; // placeholder
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
In the event of reverse flow, a zero-gradient condition is applied
|
||||
|
||||
SeeAlso
|
||||
Foam::inletOutletFvPatchField
|
||||
|
||||
|
||||
SourceFiles
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField.C
|
||||
|
@ -47,7 +80,7 @@ SourceFiles
|
|||
#ifndef compressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H
|
||||
#define compressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "inletOutletFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -62,13 +95,16 @@ namespace compressible
|
|||
|
||||
class turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
public inletOutletFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Turbulent length scale
|
||||
scalar mixingLength_;
|
||||
|
||||
//- Name of the flux field
|
||||
word phiName_;
|
||||
|
||||
//- Name of the turbulent kinetic energy field
|
||||
word kName_;
|
||||
|
||||
|
|
|
@ -47,9 +47,15 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
|||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF),
|
||||
mixingLength_(0.001)
|
||||
{}
|
||||
inletOutletFvPatchScalarField(p, iF),
|
||||
mixingLength_(0.0),
|
||||
phiName_("undefined-phi"),
|
||||
kName_("undefined-k")
|
||||
{
|
||||
this->refValue() = 0.0;
|
||||
this->refGrad() = 0.0;
|
||||
this->valueFraction() = 0.0;
|
||||
}
|
||||
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField::
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
|
@ -60,8 +66,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
|||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
mixingLength_(ptf.mixingLength_)
|
||||
inletOutletFvPatchScalarField(ptf, p, iF, mapper),
|
||||
mixingLength_(ptf.mixingLength_),
|
||||
phiName_(ptf.phiName_),
|
||||
kName_(ptf.kName_)
|
||||
{}
|
||||
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField::
|
||||
|
@ -72,9 +80,17 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
|||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF, dict),
|
||||
mixingLength_(readScalar(dict.lookup("mixingLength")))
|
||||
{}
|
||||
inletOutletFvPatchScalarField(p, iF),
|
||||
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
|
||||
|
@ -82,8 +98,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
|||
const turbulentMixingLengthDissipationRateInletFvPatchScalarField& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf),
|
||||
mixingLength_(ptf.mixingLength_)
|
||||
inletOutletFvPatchScalarField(ptf),
|
||||
mixingLength_(ptf.mixingLength_),
|
||||
phiName_(ptf.phiName_),
|
||||
kName_(ptf.kName_)
|
||||
{}
|
||||
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField::
|
||||
|
@ -93,8 +111,10 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
|||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf, iF),
|
||||
mixingLength_(ptf.mixingLength_)
|
||||
inletOutletFvPatchScalarField(ptf, iF),
|
||||
mixingLength_(ptf.mixingLength_),
|
||||
phiName_(ptf.phiName_),
|
||||
kName_(ptf.kName_)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -115,12 +135,16 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs()
|
|||
|
||||
const scalar Cmu75 = pow(Cmu, 0.75);
|
||||
|
||||
const fvPatchField<scalar>& kp =
|
||||
lookupPatchField<volScalarField, scalar>("k");
|
||||
const fvPatchScalarField& kp =
|
||||
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
|
||||
) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
fvPatchScalarField::write(os);
|
||||
os.writeKeyword("mixingLength")
|
||||
<< mixingLength_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,14 +30,14 @@ Description
|
|||
Calculate epsilon via the mixing length [m]
|
||||
|
||||
Example of the boundary condition specification:
|
||||
@verbatim
|
||||
\verbatim
|
||||
inlet
|
||||
{
|
||||
type turbulentMixingLengthDissipationRateInlet;
|
||||
mixingLength 0.005; // 5 mm
|
||||
value uniform 200; // placeholder
|
||||
}
|
||||
@endverbatim
|
||||
\endverbatim
|
||||
|
||||
SourceFiles
|
||||
turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
|
||||
|
@ -47,7 +47,7 @@ SourceFiles
|
|||
#ifndef incompressibleturbulentMixingLengthDissipationRateInlet_H
|
||||
#define incompressibleturbulentMixingLengthDissipationRateInlet_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "inletOutletFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -62,13 +62,20 @@ namespace incompressible
|
|||
|
||||
class turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
public inletOutletFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- turbulent length scale
|
||||
scalar mixingLength_;
|
||||
|
||||
//- Name of the flux field
|
||||
word phiName_;
|
||||
|
||||
//- Name of the turbulent kinetic energy field
|
||||
word kName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
|
|
|
@ -47,10 +47,15 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
|
|||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF),
|
||||
inletOutletFvPatchScalarField(p, iF),
|
||||
mixingLength_(0.0),
|
||||
phiName_("undefined-phi"),
|
||||
kName_("undefined-k")
|
||||
{}
|
||||
{
|
||||
this->refValue() = 0.0;
|
||||
this->refGrad() = 0.0;
|
||||
this->valueFraction() = 0.0;
|
||||
}
|
||||
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField::
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
|
@ -61,8 +66,9 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
|
|||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
inletOutletFvPatchScalarField(ptf, p, iF, mapper),
|
||||
mixingLength_(ptf.mixingLength_),
|
||||
phiName_(ptf.phiName_),
|
||||
kName_(ptf.kName_)
|
||||
{}
|
||||
|
||||
|
@ -74,10 +80,17 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
|
|||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF, dict),
|
||||
inletOutletFvPatchScalarField(p, iF),
|
||||
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;
|
||||
}
|
||||
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField::
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
|
@ -85,8 +98,9 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
|
|||
const turbulentMixingLengthFrequencyInletFvPatchScalarField& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf),
|
||||
inletOutletFvPatchScalarField(ptf),
|
||||
mixingLength_(ptf.mixingLength_),
|
||||
phiName_(ptf.phiName_),
|
||||
kName_(ptf.kName_)
|
||||
{}
|
||||
|
||||
|
@ -97,8 +111,9 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
|
|||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(ptf, iF),
|
||||
inletOutletFvPatchScalarField(ptf, iF),
|
||||
mixingLength_(ptf.mixingLength_),
|
||||
phiName_(ptf.phiName_),
|
||||
kName_(ptf.kName_)
|
||||
{}
|
||||
|
||||
|
@ -120,12 +135,16 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs()
|
|||
|
||||
const scalar Cmu25 = pow(Cmu, 0.25);
|
||||
|
||||
const fvPatchField<scalar>& kp =
|
||||
lookupPatchField<volScalarField, scalar>(kName_);
|
||||
const fvPatchScalarField& kp =
|
||||
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
|
||||
) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
fvPatchScalarField::write(os);
|
||||
os.writeKeyword("mixingLength")
|
||||
<< mixingLength_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("k") << kName_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
|
|
@ -25,19 +25,52 @@ License
|
|||
Class
|
||||
Foam::incompressible::turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpIcoRASBoundaryConditions grpInletBoundaryConditions
|
||||
|
||||
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:
|
||||
@verbatim
|
||||
inlet
|
||||
{
|
||||
type turbulentMixingLengthFrequencyInlet;
|
||||
mixingLength 0.005; // 5 mm
|
||||
k k; // turbulent k field
|
||||
value uniform 5; // initial value
|
||||
}
|
||||
@endverbatim
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type turbulentMixingLengthFrequencyInlet;
|
||||
mixingLength 0.005;
|
||||
value uniform 200; // placeholder
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
In the event of reverse flow, a zero-gradient condition is applied
|
||||
|
||||
SeeAlso
|
||||
Foam::inletOutletFvPatchField
|
||||
|
||||
|
||||
SourceFiles
|
||||
turbulentMixingLengthFrequencyInletFvPatchScalarField.C
|
||||
|
@ -47,7 +80,7 @@ SourceFiles
|
|||
#ifndef incompressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H
|
||||
#define incompressibleturbulentMixingLengthFrequencyInletFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "inletOutletFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -62,13 +95,16 @@ namespace incompressible
|
|||
|
||||
class turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
public inletOutletFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Turbulent length scale
|
||||
scalar mixingLength_;
|
||||
|
||||
//- Name of the flux field
|
||||
word phiName_;
|
||||
|
||||
//- Name of the turbulent kinetic energy field
|
||||
word kName_;
|
||||
|
||||
|
|
Reference in a new issue