mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
removed hard-coding for field names
This commit is contained in:
@ -41,19 +41,20 @@ namespace LESModels
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
muSgsWallFunctionFvPatchScalarField::
|
||||
muSgsWallFunctionFvPatchScalarField
|
||||
muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF)
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
UName_("U"),
|
||||
rhoName_("rho"),
|
||||
muName_("mu")
|
||||
{}
|
||||
|
||||
|
||||
muSgsWallFunctionFvPatchScalarField::
|
||||
muSgsWallFunctionFvPatchScalarField
|
||||
muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField
|
||||
(
|
||||
const muSgsWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
@ -61,52 +62,49 @@ muSgsWallFunctionFvPatchScalarField
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||
UName_(ptf.UName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
muName_(ptf.muName_)
|
||||
{}
|
||||
|
||||
|
||||
muSgsWallFunctionFvPatchScalarField::
|
||||
muSgsWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
Istream& is
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, is)
|
||||
{}
|
||||
|
||||
|
||||
muSgsWallFunctionFvPatchScalarField::
|
||||
muSgsWallFunctionFvPatchScalarField
|
||||
muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict)
|
||||
fixedValueFvPatchScalarField(p, iF, dict),
|
||||
UName_(dict.lookupOrDefault<word>("U", "U")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
muName_(dict.lookupOrDefault<word>("mu", "mu"))
|
||||
{}
|
||||
|
||||
|
||||
muSgsWallFunctionFvPatchScalarField::
|
||||
muSgsWallFunctionFvPatchScalarField
|
||||
muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField
|
||||
(
|
||||
const muSgsWallFunctionFvPatchScalarField& tppsf
|
||||
const muSgsWallFunctionFvPatchScalarField& mwfpsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(tppsf)
|
||||
fixedValueFvPatchScalarField(mwfpsf),
|
||||
UName_(mwfpsf.UName_),
|
||||
rhoName_(mwfpsf.rhoName_),
|
||||
muName_(mwfpsf.muName_)
|
||||
{}
|
||||
|
||||
|
||||
muSgsWallFunctionFvPatchScalarField::
|
||||
muSgsWallFunctionFvPatchScalarField
|
||||
muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField
|
||||
(
|
||||
const muSgsWallFunctionFvPatchScalarField& tppsf,
|
||||
const muSgsWallFunctionFvPatchScalarField& mwfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(tppsf, iF)
|
||||
fixedValueFvPatchScalarField(mwfpsf, iF),
|
||||
UName_(mwfpsf.UName_),
|
||||
rhoName_(mwfpsf.rhoName_),
|
||||
muName_(mwfpsf.muName_)
|
||||
{}
|
||||
|
||||
|
||||
@ -125,15 +123,15 @@ void muSgsWallFunctionFvPatchScalarField::evaluate
|
||||
const scalarField& ry = patch().deltaCoeffs();
|
||||
|
||||
const fvPatchVectorField& U =
|
||||
patch().lookupPatchField<volVectorField, vector>("U");
|
||||
patch().lookupPatchField<volVectorField, vector>(UName_);
|
||||
|
||||
scalarField magUp = mag(U.patchInternalField() - U);
|
||||
|
||||
const scalarField& muw =
|
||||
patch().lookupPatchField<volScalarField, scalar>("mu");
|
||||
patch().lookupPatchField<volScalarField, scalar>(muName_);
|
||||
|
||||
const scalarField& rhow =
|
||||
patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
||||
scalarField& muSgsw = *this;
|
||||
|
||||
@ -187,6 +185,16 @@ void muSgsWallFunctionFvPatchScalarField::evaluate
|
||||
}
|
||||
|
||||
|
||||
void muSgsWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
writeEntryIfDifferent<word>(os, "U", "U", UName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
writeEntryIfDifferent<word>(os, "mu", "mu", muName_);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
|
||||
@ -58,6 +58,15 @@ class muSgsWallFunctionFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of velocity field
|
||||
word UName_;
|
||||
|
||||
//- Name of density field
|
||||
word rhoName_;
|
||||
|
||||
//- Name of laminar viscosity field
|
||||
word muName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -74,14 +83,6 @@ public:
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and Istream
|
||||
muSgsWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
Istream&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
muSgsWallFunctionFvPatchScalarField
|
||||
(
|
||||
@ -149,6 +150,11 @@ public:
|
||||
(
|
||||
const Pstream::commsTypes commsType=Pstream::blocking
|
||||
);
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -48,7 +48,9 @@ nuSgsWallFunctionFvPatchScalarField
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF)
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
UName_("U"),
|
||||
nuName_("nu")
|
||||
{}
|
||||
|
||||
|
||||
@ -61,7 +63,9 @@ nuSgsWallFunctionFvPatchScalarField
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||
UName_(ptf.UName_),
|
||||
nuName_(ptf.nuName_)
|
||||
{}
|
||||
|
||||
|
||||
@ -73,28 +77,34 @@ nuSgsWallFunctionFvPatchScalarField
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict)
|
||||
fixedValueFvPatchScalarField(p, iF, dict),
|
||||
UName_(dict.lookupOrDefault<word>("U", "U")),
|
||||
nuName_(dict.lookupOrDefault<word>("nu", "nu"))
|
||||
{}
|
||||
|
||||
|
||||
nuSgsWallFunctionFvPatchScalarField::
|
||||
nuSgsWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nuSgsWallFunctionFvPatchScalarField& tppsf
|
||||
const nuSgsWallFunctionFvPatchScalarField& nwfpsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(tppsf)
|
||||
fixedValueFvPatchScalarField(nwfpsf),
|
||||
UName_(nwfpsf.UName_),
|
||||
nuName_(nwfpsf.nuName_)
|
||||
{}
|
||||
|
||||
|
||||
nuSgsWallFunctionFvPatchScalarField::
|
||||
nuSgsWallFunctionFvPatchScalarField
|
||||
(
|
||||
const nuSgsWallFunctionFvPatchScalarField& tppsf,
|
||||
const nuSgsWallFunctionFvPatchScalarField& nwfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(tppsf, iF)
|
||||
fixedValueFvPatchScalarField(nwfpsf, iF),
|
||||
UName_(nwfpsf.UName_),
|
||||
nuName_(nwfpsf.nuName_)
|
||||
{}
|
||||
|
||||
|
||||
@ -117,12 +127,12 @@ void nuSgsWallFunctionFvPatchScalarField::evaluate
|
||||
const scalarField& ry = patch().deltaCoeffs();
|
||||
|
||||
const fvPatchVectorField& U =
|
||||
patch().lookupPatchField<volVectorField, vector>("U");
|
||||
patch().lookupPatchField<volVectorField, vector>(UName_);
|
||||
|
||||
scalarField magUp = mag(U.patchInternalField() - U);
|
||||
|
||||
const scalarField& nuw =
|
||||
patch().lookupPatchField<volScalarField, scalar>("nu");
|
||||
patch().lookupPatchField<volScalarField, scalar>(nuName_);
|
||||
scalarField& nuSgsw = *this;
|
||||
|
||||
|
||||
@ -134,7 +144,7 @@ void nuSgsWallFunctionFvPatchScalarField::evaluate
|
||||
|
||||
scalar utau = sqrt((nuSgsw[facei] + nuw[facei])*magFaceGradU[facei]);
|
||||
|
||||
if(utau > VSMALL)
|
||||
if (utau > VSMALL)
|
||||
{
|
||||
int iter = 0;
|
||||
scalar err = GREAT;
|
||||
@ -171,6 +181,15 @@ void nuSgsWallFunctionFvPatchScalarField::evaluate
|
||||
}
|
||||
|
||||
|
||||
void nuSgsWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
writeEntryIfDifferent<word>(os, "U", "U", UName_);
|
||||
writeEntryIfDifferent<word>(os, "nu", "nu", nuName_);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
|
||||
@ -58,6 +58,12 @@ class nuSgsWallFunctionFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of velocity field
|
||||
word UName_;
|
||||
|
||||
//- Name of laminar viscosity field
|
||||
word nuName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -141,6 +147,12 @@ public:
|
||||
(
|
||||
const Pstream::commsTypes commsType=Pstream::blocking
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user