mutWallFunctions: Generalised for RAS and LES

muSgsUSpaldingWallFunction removed, now use mutUSpaldingWallFunction
This commit is contained in:
Henry 2012-07-03 13:57:27 +01:00
parent 98df99b20a
commit c1696f9cde
36 changed files with 449 additions and 1509 deletions

View File

@ -155,6 +155,7 @@ autoPtr<LESModel> LESModel::New
void LESModel::correct(const tmp<volTensorField>&)
{
turbulenceModel::correct();
delta_().correct();
}

View File

@ -11,14 +11,4 @@ SpalartAllmaras/SpalartAllmaras.C
vanDriestDelta/vanDriestDelta.C
/* Wall functions */
wallFunctions=derivedFvPatchFields/wallFunctions
muSgsWallFunctions=$(wallFunctions)/muSgsWallFunctions
$(muSgsWallFunctions)/muSgsUSpaldingWallFunction/muSgsUSpaldingWallFunctionFvPatchScalarField.C
alphaSgsWallFunctions=$(wallFunctions)/alphaSgsWallFunctions
$(alphaSgsWallFunctions)/alphaSgsWallFunction/alphaSgsWallFunctionFvPatchScalarField.C
$(alphaSgsWallFunctions)/alphaSgsJayatillekeWallFunction/alphaSgsJayatillekeWallFunctionFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libcompressibleLESModels

View File

@ -1,341 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "alphaSgsJayatillekeWallFunctionFvPatchScalarField.H"
#include "LESModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
scalar alphaSgsJayatillekeWallFunctionFvPatchScalarField::maxExp_ = 50.0;
scalar alphaSgsJayatillekeWallFunctionFvPatchScalarField::tolerance_ = 0.01;
label alphaSgsJayatillekeWallFunctionFvPatchScalarField::maxIters_ = 10;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void alphaSgsJayatillekeWallFunctionFvPatchScalarField::checkType()
{
if (!isA<wallFvPatch>(patch()))
{
FatalErrorIn
(
"alphaSgsJayatillekeWallFunctionFvPatchScalarField::checkType()"
)
<< "Patch type for patch " << patch().name() << " must be wall\n"
<< "Current patch type is " << patch().type() << nl
<< exit(FatalError);
}
}
scalar alphaSgsJayatillekeWallFunctionFvPatchScalarField::Psmooth
(
const scalar Prat
) const
{
return 9.24*(pow(Prat, 0.75) - 1.0)*(1.0 + 0.28*exp(-0.007*Prat));
}
scalar alphaSgsJayatillekeWallFunctionFvPatchScalarField::yPlusTherm
(
const scalar P,
const scalar Prat
) const
{
scalar ypt = 11.0;
for (int i=0; i<maxIters_; i++)
{
scalar f = ypt - (log(E_*ypt)/kappa_ + P)/Prat;
scalar df = 1.0 - 1.0/(ypt*kappa_*Prat);
scalar yptNew = ypt - f/df;
if (yptNew < VSMALL)
{
return 0;
}
else if (mag(yptNew - ypt) < tolerance_)
{
return yptNew;
}
else
{
ypt = yptNew;
}
}
return ypt;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
alphaSgsJayatillekeWallFunctionFvPatchScalarField::
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
Prt_(0.85),
kappa_(0.41),
E_(9.8),
heName_("he")
{
checkType();
}
alphaSgsJayatillekeWallFunctionFvPatchScalarField::
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const alphaSgsJayatillekeWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
Prt_(ptf.Prt_),
kappa_(ptf.kappa_),
E_(ptf.E_),
heName_(ptf.heName_)
{}
alphaSgsJayatillekeWallFunctionFvPatchScalarField::
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict),
Prt_(dict.lookupOrDefault<scalar>("Prt", 0.85)),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
heName_(dict.lookupOrDefault<word>("he", "he"))
{
checkType();
}
alphaSgsJayatillekeWallFunctionFvPatchScalarField::
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const alphaSgsJayatillekeWallFunctionFvPatchScalarField& awfpsf
)
:
fixedValueFvPatchScalarField(awfpsf),
Prt_(awfpsf.Prt_),
kappa_(awfpsf.kappa_),
E_(awfpsf.E_),
heName_(awfpsf.heName_)
{
checkType();
}
alphaSgsJayatillekeWallFunctionFvPatchScalarField::
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const alphaSgsJayatillekeWallFunctionFvPatchScalarField& awfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(awfpsf, iF),
Prt_(awfpsf.Prt_),
kappa_(awfpsf.kappa_),
E_(awfpsf.E_),
heName_(awfpsf.heName_)
{
checkType();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void alphaSgsJayatillekeWallFunctionFvPatchScalarField::evaluate
(
const Pstream::commsTypes
)
{
const LESModel& lesModel = db().lookupObject<LESModel>("LESProperties");
// Field data
const label patchI = patch().index();
const scalarField& muw = lesModel.mu().boundaryField()[patchI];
const scalarField muSgsw(lesModel.muSgs()().boundaryField()[patchI]);
const scalarField& alphaw = lesModel.alpha().boundaryField()[patchI];
scalarField& alphaSgsw = *this;
const fvPatchVectorField& Uw = lesModel.U().boundaryField()[patchI];
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
const scalarField magGradUw(mag(Uw.snGrad()));
const scalarField& rhow = lesModel.rho().boundaryField()[patchI];
const fvPatchScalarField& hw =
patch().lookupPatchField<volScalarField, scalar>(heName_);
const scalarField& ry = patch().deltaCoeffs();
// Heat flux [W/m2] - lagging alphaSgsw
const scalarField qDot((alphaw + alphaSgsw)*hw.snGrad());
// Populate boundary values
forAll(alphaSgsw, faceI)
{
// Calculate uTau using Newton-Raphson iteration
scalar uTau =
sqrt((muSgsw[faceI] + muw[faceI])/rhow[faceI]*magGradUw[faceI]);
if (uTau > ROOTVSMALL)
{
label iter = 0;
scalar err = GREAT;
do
{
scalar kUu = min(kappa_*magUp[faceI]/uTau, maxExp_);
scalar fkUu = exp(kUu) - 1.0 - kUu*(1.0 + 0.5*kUu);
scalar f =
- uTau/(ry[faceI]*muw[faceI]/rhow[faceI])
+ magUp[faceI]/uTau
+ 1.0/E_*(fkUu - 1.0/6.0*kUu*sqr(kUu));
scalar df =
- 1.0/(ry[faceI]*muw[faceI]/rhow[faceI])
- magUp[faceI]/sqr(uTau)
- 1.0/E_*kUu*fkUu/uTau;
scalar uTauNew = uTau - f/df;
err = mag((uTau - uTauNew)/uTau);
uTau = uTauNew;
} while (uTau>VSMALL && err>tolerance_ && ++iter<maxIters_);
scalar yPlus = uTau/ry[faceI]/(muw[faceI]/rhow[faceI]);
// Molecular Prandtl number
scalar Pr = muw[faceI]/alphaw[faceI];
// Molecular-to-turbulenbt Prandtl number ratio
scalar Prat = Pr/Prt_;
// Thermal sublayer thickness
scalar P = Psmooth(Prat);
scalar yPlusTherm = this->yPlusTherm(P, Prat);
// Evaluate new effective thermal diffusivity
scalar alphaEff = 0.0;
if (yPlus < yPlusTherm)
{
scalar A = qDot[faceI]*rhow[faceI]*uTau/ry[faceI];
scalar B = qDot[faceI]*Pr*yPlus;
scalar C = Pr*0.5*rhow[faceI]*uTau*sqr(magUp[faceI]);
alphaEff = A/(B + C + VSMALL);
}
else
{
scalar A = qDot[faceI]*rhow[faceI]*uTau/ry[faceI];
scalar B = qDot[faceI]*Prt_*(1.0/kappa_*log(E_*yPlus) + P);
scalar magUc = uTau/kappa_*log(E_*yPlusTherm) - mag(Uw[faceI]);
scalar C =
0.5*rhow[faceI]*uTau
*(Prt_*sqr(magUp[faceI]) + (Pr - Prt_)*sqr(magUc));
alphaEff = A/(B + C + VSMALL);
}
// Update turbulent thermal diffusivity
alphaSgsw[faceI] = max(0.0, alphaEff - alphaw[faceI]);
if (debug)
{
Info<< " uTau = " << uTau << nl
<< " Pr = " << Pr << nl
<< " Prt = " << Prt_ << nl
<< " qDot = " << qDot[faceI] << nl
<< " yPlus = " << yPlus << nl
<< " yPlusTherm = " << yPlusTherm << nl
<< " alphaEff = " << alphaEff << nl
<< " alphaw = " << alphaw[faceI] << nl
<< " alphaSgsw = " << alphaSgsw[faceI] << nl
<< endl;
}
}
else
{
alphaSgsw[faceI] = 0.0;
}
}
}
void alphaSgsJayatillekeWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
os.writeKeyword("Prt") << Prt_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
os.writeKeyword("he") << heName_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
alphaSgsJayatillekeWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,197 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
alphaSgsJayatillekeWallFunctionFvPatchScalarField
Description
Thermal wall function for turbulent thermal diffusivity based on the
Jayatilleke thermal wall function
SourceFiles
alphaSgsJayatillekeWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef alphaSgsJayatillekeWallFunctionFvPatchScalarField_H
#define alphaSgsJayatillekeWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESModels
{
/*---------------------------------------------------------------------------*\
Class alphaSgsJayatillekeWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class alphaSgsJayatillekeWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
// Private data
//- Turbulent Prandtl number
scalar Prt_;
//- Von Karman constant
scalar kappa_;
//- E coefficient
scalar E_;
//- Name of (sensible/total) enthalpy field
word heName_;
// Solution parameters
static scalar maxExp_;
static scalar tolerance_;
static label maxIters_;
// Private Member Functions
//- Check the type of the patch
void checkType();
//- `P' function
scalar Psmooth(const scalar Prat) const;
//- Calculate y+ at the edge of the thermal laminar sublayer
scalar yPlusTherm
(
const scalar P,
const scalar Prat
) const;
public:
//- Runtime type information
TypeName("alphaSgsJayatillekeWallFunction");
// Constructors
//- Construct from patch and internal field
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given an
// alphaSgsJayatillekeWallFunctionFvPatchScalarField
// onto a new patch
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const alphaSgsJayatillekeWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const alphaSgsJayatillekeWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new alphaSgsJayatillekeWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const alphaSgsJayatillekeWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
*this,
iF
)
);
}
// Member functions
// Evaluation functions
//- Evaluate the patchField
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::Pstream::blocking
);
// I-O
//- Write
void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,164 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "alphaSgsWallFunctionFvPatchScalarField.H"
#include "LESModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESModels
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void alphaSgsWallFunctionFvPatchScalarField::checkType()
{
if (!isA<wallFvPatch>(patch()))
{
FatalErrorIn
(
"alphaSgsWallFunctionFvPatchScalarField::checkType()"
)
<< "Patch type for patch " << patch().name() << " must be wall\n"
<< "Current patch type is " << patch().type() << nl
<< exit(FatalError);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
alphaSgsWallFunctionFvPatchScalarField::
alphaSgsWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
Prt_(0.85)
{
checkType();
}
alphaSgsWallFunctionFvPatchScalarField::
alphaSgsWallFunctionFvPatchScalarField
(
const alphaSgsWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
Prt_(ptf.Prt_)
{}
alphaSgsWallFunctionFvPatchScalarField::
alphaSgsWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict),
Prt_(dict.lookupOrDefault<scalar>("Prt", 0.85))
{
checkType();
}
alphaSgsWallFunctionFvPatchScalarField::
alphaSgsWallFunctionFvPatchScalarField
(
const alphaSgsWallFunctionFvPatchScalarField& awfpsf
)
:
fixedValueFvPatchScalarField(awfpsf),
Prt_(awfpsf.Prt_)
{
checkType();
}
alphaSgsWallFunctionFvPatchScalarField::
alphaSgsWallFunctionFvPatchScalarField
(
const alphaSgsWallFunctionFvPatchScalarField& awfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(awfpsf, iF),
Prt_(awfpsf.Prt_)
{
checkType();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void alphaSgsWallFunctionFvPatchScalarField::evaluate
(
const Pstream::commsTypes
)
{
const LESModel& lesModel = db().lookupObject<LESModel>("LESProperties");
const scalarField muSgsw
(
lesModel.muSgs()().boundaryField()[patch().index()]
);
operator==(muSgsw/Prt_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
alphaSgsWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,223 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "muSgsUSpaldingWallFunctionFvPatchScalarField.H"
#include "LESModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESModels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
muSgsUSpaldingWallFunctionFvPatchScalarField::
muSgsUSpaldingWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
UName_("U"),
rhoName_("rho"),
muName_("mu"),
kappa_(0.41),
E_(9.8)
{}
muSgsUSpaldingWallFunctionFvPatchScalarField::
muSgsUSpaldingWallFunctionFvPatchScalarField
(
const muSgsUSpaldingWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
UName_(ptf.UName_),
rhoName_(ptf.rhoName_),
muName_(ptf.muName_),
kappa_(ptf.kappa_),
E_(ptf.E_)
{}
muSgsUSpaldingWallFunctionFvPatchScalarField::
muSgsUSpaldingWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict),
UName_(dict.lookupOrDefault<word>("U", "U")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
muName_(dict.lookupOrDefault<word>("mu", "mu")),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8))
{}
muSgsUSpaldingWallFunctionFvPatchScalarField::
muSgsUSpaldingWallFunctionFvPatchScalarField
(
const muSgsUSpaldingWallFunctionFvPatchScalarField& mwfpsf
)
:
fixedValueFvPatchScalarField(mwfpsf),
UName_(mwfpsf.UName_),
rhoName_(mwfpsf.rhoName_),
muName_(mwfpsf.muName_),
kappa_(mwfpsf.kappa_),
E_(mwfpsf.E_)
{}
muSgsUSpaldingWallFunctionFvPatchScalarField::
muSgsUSpaldingWallFunctionFvPatchScalarField
(
const muSgsUSpaldingWallFunctionFvPatchScalarField& mwfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(mwfpsf, iF),
UName_(mwfpsf.UName_),
rhoName_(mwfpsf.rhoName_),
muName_(mwfpsf.muName_),
kappa_(mwfpsf.kappa_),
E_(mwfpsf.E_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void muSgsUSpaldingWallFunctionFvPatchScalarField::evaluate
(
const Pstream::commsTypes
)
{
const scalarField& ry = patch().deltaCoeffs();
const fvPatchVectorField& U =
patch().lookupPatchField<volVectorField, vector>(UName_);
const scalarField magUp(mag(U.patchInternalField() - U));
const scalarField& muw =
patch().lookupPatchField<volScalarField, scalar>(muName_);
const scalarField& rhow =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
scalarField& muSgsw = *this;
const scalarField magFaceGradU(mag(U.snGrad()));
forAll(muSgsw, facei)
{
scalar magUpara = magUp[facei];
scalar utau =
sqrt((muSgsw[facei] + muw[facei])*magFaceGradU[facei]/rhow[facei]);
if (utau > 0)
{
int iter = 0;
scalar err = GREAT;
do
{
scalar kUu = kappa_*magUpara/utau;
scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu);
scalar f =
- utau/(ry[facei]*muw[facei]/rhow[facei])
+ magUpara/utau
+ 1/E_*(fkUu - 1.0/6.0*kUu*sqr(kUu));
scalar df =
- 1.0/(ry[facei]*muw[facei]/rhow[facei])
- magUpara/sqr(utau)
- 1/E_*kUu*fkUu/utau;
scalar utauNew = utau - f/df;
err = mag((utau - utauNew)/utau);
utau = utauNew;
} while (utau > VSMALL && err > 0.01 && ++iter < 10);
muSgsw[facei] =
max
(
rhow[facei]*sqr(utau)/magFaceGradU[facei] - muw[facei],
0.0
);
}
else
{
muSgsw[facei] = 0;
}
}
}
void muSgsUSpaldingWallFunctionFvPatchScalarField::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_);
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
muSgsUSpaldingWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,173 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::LESModels::
muSgsUSpaldingWallFunctionFvPatchScalarField
Description
Wall function boundary condition for walls, based on velocity, using
Spaldings law to give a continuous muSgs profile to the wall (y+ = 0).
SourceFiles
muSgsUSpaldingWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef muSgsUSpaldingWallFunctionFvPatchScalarField_H
#define muSgsUSpaldingWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESModels
{
/*---------------------------------------------------------------------------*\
Class muSgsUSpaldingWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class muSgsUSpaldingWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
// Private data
//- Name of velocity field
word UName_;
//- Name of density field
word rhoName_;
//- Name of laminar viscosity field
word muName_;
//- Von Karman constant
scalar kappa_;
//- E coefficient
scalar E_;
public:
//- Runtime type information
TypeName("muSgsUSpaldingWallFunction");
// Constructors
//- Construct from patch and internal field
muSgsUSpaldingWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
muSgsUSpaldingWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// muSgsUSpaldingWallFunctionFvPatchScalarField
// onto a new patch
muSgsUSpaldingWallFunctionFvPatchScalarField
(
const muSgsUSpaldingWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
muSgsUSpaldingWallFunctionFvPatchScalarField
(
const muSgsUSpaldingWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new muSgsUSpaldingWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
muSgsUSpaldingWallFunctionFvPatchScalarField
(
const muSgsUSpaldingWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new muSgsUSpaldingWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Evaluate the patchField
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::blocking
);
// I-O
//- Write
void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -18,11 +18,14 @@ $(alphatWallFunctions)/alphatWallFunction/alphatWallFunctionFvPatchScalarField.C
$(alphatWallFunctions)/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C
mutWallFunctions = $(wallFunctions)/mutWallFunctions
$(mutWallFunctions)/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutWallFunction/mutWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.C
epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions
@ -35,7 +38,7 @@ kqRWallFunctions = $(wallFunctions)/kqRWallFunctions
$(kqRWallFunctions)/kqRWallFunction/kqRWallFunctionFvPatchFields.C
/* Patch fields */
derivedFvPatchFields/htcConv/htcConvFvPatchScalarField.C
derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C
derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C
backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C

View File

@ -83,9 +83,7 @@ RASModel::RASModel
kMin_("kMin", sqr(dimVelocity), SMALL),
epsilonMin_("epsilonMin", kMin_.dimensions()/dimTime, SMALL),
omegaMin_("omegaMin", dimless/dimTime, SMALL),
y_(mesh_)
omegaMin_("omegaMin", dimless/dimTime, SMALL)
{
kMin_.readIfPresent(*this);
epsilonMin_.readIfPresent(*this);
@ -159,57 +157,9 @@ autoPtr<RASModel> RASModel::New
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
scalar RASModel::yPlusLam(const scalar kappa, const scalar E) const
{
scalar ypl = 11.0;
for (int i=0; i<10; i++)
{
ypl = log(max(E*ypl, 1))/kappa;
}
return ypl;
}
tmp<scalarField> RASModel::yPlus(const label patchNo, const scalar Cmu) const
{
const fvPatch& curPatch = mesh_.boundary()[patchNo];
tmp<scalarField> tYp(new scalarField(curPatch.size()));
scalarField& Yp = tYp();
if (isA<wallFvPatch>(curPatch))
{
Yp = pow025(Cmu)
*y_[patchNo]
*sqrt(k()().boundaryField()[patchNo].patchInternalField())
/(
mu().boundaryField()[patchNo].patchInternalField()
/rho_.boundaryField()[patchNo]
);
}
else
{
WarningIn
(
"tmp<scalarField> RASModel::yPlus(const label patchNo) const"
) << "Patch " << patchNo << " is not a wall. Returning null field"
<< nl << endl;
Yp.setSize(0);
}
return tYp;
}
void RASModel::correct()
{
if (mesh_.changing())
{
y_.correct();
}
turbulenceModel::correct();
}

View File

@ -46,7 +46,6 @@ SourceFiles
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "nearWallDist.H"
#include "fvm.H"
#include "fvc.H"
#include "fvMatrices.H"
@ -96,9 +95,6 @@ protected:
//- Lower limit for omega
dimensionedScalar omegaMin_;
//- Near wall distance boundary field
nearWallDist y_;
// Protected Member Functions
@ -213,15 +209,6 @@ public:
return omegaMin_;
}
//- Return the near wall distances
const nearWallDist& y() const
{
return y_;
}
//- Calculate y+ at the edge of the laminar sublayer
scalar yPlusLam(const scalar kappa, const scalar E) const;
//- Const access to the coefficients dictionary
const dictionary& coeffDict() const
{
@ -264,13 +251,6 @@ public:
thermo().alphaEff(alphat()().boundaryField()[patchI], patchI);
}
//- Return yPlus for the given patch
virtual tmp<scalarField> yPlus
(
const label patchI,
const scalar Cmu
) const;
//- Solve the turbulence equations and correct the turbulence viscosity
virtual void correct();

View File

@ -199,34 +199,35 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
return;
}
const label patchI = patch().index();
const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalar Cmu25 = pow025(Cmu_);
const scalarField& y = rasModel.y()[patchI];
const scalarField& y = turbModel.y()[patchi];
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const scalarField& muw = turbModel.mu().boundaryField()[patchi];
const scalarField& alphaw = rasModel.alpha().boundaryField()[patchI];
const scalarField& alphaw = turbModel.alpha().boundaryField()[patchi];
scalarField& alphatw = *this;
const tmp<volScalarField> tk = rasModel.k();
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
const scalarField magGradUw(mag(Uw.snGrad()));
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const scalarField& rhow = turbModel.rho().boundaryField()[patchi];
const fvPatchScalarField& hew =
rasModel.thermo().he().boundaryField()[patchI];
turbModel.thermo().he().boundaryField()[patchi];
// Heat flux [W/m2] - lagging alphatw
const scalarField qDot
(
rasModel.thermo().alphaEff(alphatw, patchI)*hew.snGrad()
turbModel.thermo().alphaEff(alphatw, patchi)*hew.snGrad()
);
// Populate boundary values

View File

@ -28,6 +28,7 @@ License
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "mutWallFunctionFvPatchScalarField.H"
#include "wallFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,23 +56,6 @@ void epsilonWallFunctionFvPatchScalarField::checkType()
}
scalar epsilonWallFunctionFvPatchScalarField::calcYPlusLam
(
const scalar kappa,
const scalar E
) const
{
scalar ypl = 11.0;
for (int i=0; i<10; i++)
{
ypl = log(E*ypl)/kappa;
}
return ypl;
}
void epsilonWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
{
writeEntryIfDifferent<word>(os, "G", "RASModel::G", GName_);
@ -94,7 +78,7 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
Cmu_(0.09),
kappa_(0.41),
E_(9.8),
yPlusLam_(calcYPlusLam(kappa_, E_))
yPlusLam_(mutWallFunctionFvPatchScalarField::yPlusLam(kappa_, E_))
{
@ -134,7 +118,7 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
yPlusLam_(calcYPlusLam(kappa_, E_))
yPlusLam_(mutWallFunctionFvPatchScalarField::yPlusLam(kappa_, E_))
{
checkType();

View File

@ -81,9 +81,6 @@ protected:
//- Check the type of the patch
virtual void checkType();
//- Calculate the Y+ at the edge of the laminar sublayer
virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const;
//- Write local wall function variables
virtual void writeLocalEntries(Ostream&) const;

View File

@ -54,7 +54,7 @@ mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
mutkWallFunctionFvPatchScalarField(p, iF)
mutWallFunctionFvPatchScalarField(p, iF)
{}
@ -66,7 +66,7 @@ mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper
)
:
mutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
{}
@ -77,7 +77,7 @@ mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField
const dictionary& dict
)
:
mutkWallFunctionFvPatchScalarField(p, iF, dict)
mutWallFunctionFvPatchScalarField(p, iF, dict)
{}
@ -86,7 +86,7 @@ mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField
const mutLowReWallFunctionFvPatchScalarField& mlrwfpsf
)
:
mutkWallFunctionFvPatchScalarField(mlrwfpsf)
mutWallFunctionFvPatchScalarField(mlrwfpsf)
{}
@ -96,10 +96,29 @@ mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
mutkWallFunctionFvPatchScalarField(mlrwfpsf, iF)
mutWallFunctionFvPatchScalarField(mlrwfpsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField> mutLowReWallFunctionFvPatchScalarField::yPlus() const
{
const label patchi = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchi];
const scalarField nuw
(
turbModel.mu().boundaryField()[patchi]
/turbModel.rho().boundaryField()[patchi]
);
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
return y*sqrt(nuw*mag(Uw.snGrad()))/nuw;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField

View File

@ -38,7 +38,7 @@ SourceFiles
#ifndef compressibleMutLowReWallFunctionFvPatchScalarField_H
#define compressibleMutLowReWallFunctionFvPatchScalarField_H
#include "mutkWallFunctionFvPatchScalarField.H"
#include "mutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,7 +55,7 @@ namespace RASModels
class mutLowReWallFunctionFvPatchScalarField
:
public mutkWallFunctionFvPatchScalarField
public mutWallFunctionFvPatchScalarField
{
protected:
@ -132,6 +132,14 @@ public:
new mutLowReWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const;
};

View File

@ -45,12 +45,14 @@ tmp<scalarField> mutURoughWallFunctionFvPatchScalarField::calcYPlus
const scalarField& magUp
) const
{
const label patchI = patch().index();
const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const fvPatchScalarField& rho = rasModel.rho().boundaryField()[patchI];
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchi];
const scalarField& muw = turbModel.mu().boundaryField()[patchi];
const fvPatchScalarField& rho = turbModel.rho().boundaryField()[patchi];
tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0));
scalarField& yPlus = tyPlus();
@ -170,13 +172,15 @@ tmp<scalarField> mutURoughWallFunctionFvPatchScalarField::calcYPlus
tmp<scalarField> mutURoughWallFunctionFvPatchScalarField::calcMut() const
{
const label patchI = patch().index();
const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const fvPatchScalarField& rho = rasModel.rho().boundaryField()[patchI];
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchi];
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
const scalarField& muw = turbModel.mu().boundaryField()[patchi];
const fvPatchScalarField& rho = turbModel.rho().boundaryField()[patchi];
scalarField magUp(mag(Uw.patchInternalField() - Uw));
@ -208,7 +212,7 @@ mutURoughWallFunctionFvPatchScalarField::mutURoughWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
mutkWallFunctionFvPatchScalarField(p, iF),
mutWallFunctionFvPatchScalarField(p, iF),
roughnessHeight_(pTraits<scalar>::zero),
roughnessConstant_(pTraits<scalar>::zero),
roughnessFactor_(pTraits<scalar>::zero)
@ -223,7 +227,7 @@ mutURoughWallFunctionFvPatchScalarField::mutURoughWallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper
)
:
mutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
roughnessHeight_(ptf.roughnessHeight_),
roughnessConstant_(ptf.roughnessConstant_),
roughnessFactor_(ptf.roughnessFactor_)
@ -237,7 +241,7 @@ mutURoughWallFunctionFvPatchScalarField::mutURoughWallFunctionFvPatchScalarField
const dictionary& dict
)
:
mutkWallFunctionFvPatchScalarField(p, iF, dict),
mutWallFunctionFvPatchScalarField(p, iF, dict),
roughnessHeight_(readScalar(dict.lookup("roughnessHeight"))),
roughnessConstant_(readScalar(dict.lookup("roughnessConstant"))),
roughnessFactor_(readScalar(dict.lookup("roughnessFactor")))
@ -249,7 +253,7 @@ mutURoughWallFunctionFvPatchScalarField::mutURoughWallFunctionFvPatchScalarField
const mutURoughWallFunctionFvPatchScalarField& rwfpsf
)
:
mutkWallFunctionFvPatchScalarField(rwfpsf),
mutWallFunctionFvPatchScalarField(rwfpsf),
roughnessHeight_(rwfpsf.roughnessHeight_),
roughnessConstant_(rwfpsf.roughnessConstant_),
roughnessFactor_(rwfpsf.roughnessFactor_)
@ -262,7 +266,7 @@ mutURoughWallFunctionFvPatchScalarField::mutURoughWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
mutkWallFunctionFvPatchScalarField(rwfpsf, iF),
mutWallFunctionFvPatchScalarField(rwfpsf, iF),
roughnessHeight_(rwfpsf.roughnessHeight_),
roughnessConstant_(rwfpsf.roughnessConstant_),
roughnessFactor_(rwfpsf.roughnessFactor_)
@ -273,10 +277,11 @@ mutURoughWallFunctionFvPatchScalarField::mutURoughWallFunctionFvPatchScalarField
tmp<scalarField> mutURoughWallFunctionFvPatchScalarField::yPlus() const
{
const label patchI = patch().index();
const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
return calcYPlus(magUp);

View File

@ -35,7 +35,7 @@ SourceFiles
#ifndef compressibleMutURoughWallFunctionFvPatchScalarField_H
#define compressibleMutURoughWallFunctionFvPatchScalarField_H
#include "mutkWallFunctionFvPatchScalarField.H"
#include "mutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,7 +52,7 @@ namespace RASModels
class mutURoughWallFunctionFvPatchScalarField
:
public mutkWallFunctionFvPatchScalarField
public mutWallFunctionFvPatchScalarField
{
protected:

View File

@ -45,19 +45,21 @@ tmp<scalarField> mutUSpaldingWallFunctionFvPatchScalarField::calcUTau
const scalarField& magGradU
) const
{
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patch().index()];
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patch().index()];
const fvPatchVectorField& Uw =
rasModel.U().boundaryField()[patch().index()];
turbModel.U().boundaryField()[patch().index()];
scalarField magUp(mag(Uw.patchInternalField() - Uw));
const fvPatchScalarField& rhow =
rasModel.rho().boundaryField()[patch().index()];
turbModel.rho().boundaryField()[patch().index()];
const fvPatchScalarField& muw =
rasModel.mu().boundaryField()[patch().index()];
turbModel.mu().boundaryField()[patch().index()];
const scalarField& mutw = *this;
tmp<scalarField> tuTau(new scalarField(patch().size(), 0.0));
@ -104,13 +106,15 @@ tmp<scalarField> mutUSpaldingWallFunctionFvPatchScalarField::calcUTau
tmp<scalarField> mutUSpaldingWallFunctionFvPatchScalarField::calcMut() const
{
const label patchI = patch().index();
const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
const scalarField magGradU(mag(Uw.snGrad()));
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const scalarField& rhow = turbModel.rho().boundaryField()[patchi];
const scalarField& muw = turbModel.mu().boundaryField()[patchi];
return max
(
@ -129,7 +133,7 @@ mutUSpaldingWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
mutkWallFunctionFvPatchScalarField(p, iF)
mutWallFunctionFvPatchScalarField(p, iF)
{}
@ -142,7 +146,7 @@ mutUSpaldingWallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper
)
:
mutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
{}
@ -154,7 +158,7 @@ mutUSpaldingWallFunctionFvPatchScalarField
const dictionary& dict
)
:
mutkWallFunctionFvPatchScalarField(p, iF, dict)
mutWallFunctionFvPatchScalarField(p, iF, dict)
{}
@ -164,7 +168,7 @@ mutUSpaldingWallFunctionFvPatchScalarField
const mutUSpaldingWallFunctionFvPatchScalarField& wfpsf
)
:
mutkWallFunctionFvPatchScalarField(wfpsf)
mutWallFunctionFvPatchScalarField(wfpsf)
{}
@ -175,7 +179,7 @@ mutUSpaldingWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
mutkWallFunctionFvPatchScalarField(wfpsf, iF)
mutWallFunctionFvPatchScalarField(wfpsf, iF)
{}
@ -183,13 +187,15 @@ mutUSpaldingWallFunctionFvPatchScalarField
tmp<scalarField> mutUSpaldingWallFunctionFvPatchScalarField::yPlus() const
{
const label patchI = patch().index();
const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchi];
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
const scalarField& rhow = turbModel.rho().boundaryField()[patchi];
const scalarField& muw = turbModel.mu().boundaryField()[patchi];
return y*calcUTau(mag(Uw.snGrad()))/(muw/rhow);
}

View File

@ -35,7 +35,7 @@ SourceFiles
#ifndef compressibleMutUSpaldingWallFunctionFvPatchScalarField_H
#define compressibleMutUSpaldingWallFunctionFvPatchScalarField_H
#include "mutkWallFunctionFvPatchScalarField.H"
#include "mutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,7 +52,7 @@ namespace RASModels
class mutUSpaldingWallFunctionFvPatchScalarField
:
public mutkWallFunctionFvPatchScalarField
public mutWallFunctionFvPatchScalarField
{
protected:

View File

@ -45,12 +45,14 @@ tmp<scalarField> mutUWallFunctionFvPatchScalarField::calcYPlus
const scalarField& magUp
) const
{
const label patchI = patch().index();
const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const fvPatchScalarField& rhow = rasModel.rho().boundaryField()[patchI];
const fvPatchScalarField& muw = rasModel.mu().boundaryField()[patchI];
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchi];
const fvPatchScalarField& rhow = turbModel.rho().boundaryField()[patchi];
const fvPatchScalarField& muw = turbModel.mu().boundaryField()[patchi];
tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0));
scalarField& yPlus = tyPlus();
@ -81,12 +83,14 @@ tmp<scalarField> mutUWallFunctionFvPatchScalarField::calcYPlus
tmp<scalarField> mutUWallFunctionFvPatchScalarField::calcMut() const
{
const label patchI = patch().index();
const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
const fvPatchScalarField& muw = rasModel.mu().boundaryField()[patchI];
const fvPatchScalarField& muw = turbModel.mu().boundaryField()[patchi];
tmp<scalarField> tyPlus = calcYPlus(magUp);
scalarField& yPlus = tyPlus();
@ -115,7 +119,7 @@ mutUWallFunctionFvPatchScalarField::mutUWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
mutkWallFunctionFvPatchScalarField(p, iF)
mutWallFunctionFvPatchScalarField(p, iF)
{}
@ -127,7 +131,7 @@ mutUWallFunctionFvPatchScalarField::mutUWallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper
)
:
mutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
{}
@ -138,7 +142,7 @@ mutUWallFunctionFvPatchScalarField::mutUWallFunctionFvPatchScalarField
const dictionary& dict
)
:
mutkWallFunctionFvPatchScalarField(p, iF, dict)
mutWallFunctionFvPatchScalarField(p, iF, dict)
{}
@ -147,7 +151,7 @@ mutUWallFunctionFvPatchScalarField::mutUWallFunctionFvPatchScalarField
const mutUWallFunctionFvPatchScalarField& sawfpsf
)
:
mutkWallFunctionFvPatchScalarField(sawfpsf)
mutWallFunctionFvPatchScalarField(sawfpsf)
{}
@ -157,7 +161,7 @@ mutUWallFunctionFvPatchScalarField::mutUWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
mutkWallFunctionFvPatchScalarField(sawfpsf, iF)
mutWallFunctionFvPatchScalarField(sawfpsf, iF)
{}
@ -165,9 +169,10 @@ mutUWallFunctionFvPatchScalarField::mutUWallFunctionFvPatchScalarField
tmp<scalarField> mutUWallFunctionFvPatchScalarField::yPlus() const
{
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const label patchi = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
return calcYPlus(magUp);

View File

@ -35,7 +35,7 @@ SourceFiles
#ifndef compressibleMutUWallFunctionFvPatchScalarField_H
#define compressibleMutUWallFunctionFvPatchScalarField_H
#include "mutkWallFunctionFvPatchScalarField.H"
#include "mutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,7 +52,7 @@ namespace RASModels
class mutUWallFunctionFvPatchScalarField
:
public mutkWallFunctionFvPatchScalarField
public mutWallFunctionFvPatchScalarField
{
protected:

View File

@ -0,0 +1,191 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "mutWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "wallFvPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTypeNameAndDebug(mutWallFunctionFvPatchScalarField, 0);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void mutWallFunctionFvPatchScalarField::checkType()
{
if (!isA<wallFvPatch>(patch()))
{
FatalErrorIn("mutWallFunctionFvPatchScalarField::checkType()")
<< "Invalid wall function specification" << nl
<< " Patch type for patch " << patch().name()
<< " must be wall" << nl
<< " Current patch type is " << patch().type() << nl << endl
<< abort(FatalError);
}
}
void mutWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
{
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
Cmu_(0.09),
kappa_(0.41),
E_(9.8),
yPlusLam_(yPlusLam(kappa_, E_))
{}
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
(
const mutWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
Cmu_(ptf.Cmu_),
kappa_(ptf.kappa_),
E_(ptf.E_),
yPlusLam_(ptf.yPlusLam_)
{}
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict),
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
yPlusLam_(yPlusLam(kappa_, E_))
{}
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
(
const mutWallFunctionFvPatchScalarField& wfpsf
)
:
fixedValueFvPatchScalarField(wfpsf),
Cmu_(wfpsf.Cmu_),
kappa_(wfpsf.kappa_),
E_(wfpsf.E_),
yPlusLam_(wfpsf.yPlusLam_)
{}
mutWallFunctionFvPatchScalarField::mutWallFunctionFvPatchScalarField
(
const mutWallFunctionFvPatchScalarField& wfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(wfpsf, iF),
Cmu_(wfpsf.Cmu_),
kappa_(wfpsf.kappa_),
E_(wfpsf.E_),
yPlusLam_(wfpsf.yPlusLam_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
scalar mutWallFunctionFvPatchScalarField::yPlusLam
(
const scalar kappa,
const scalar E
)
{
scalar ypl = 11.0;
for (int i=0; i<10; i++)
{
ypl = log(max(E*ypl, 1))/kappa;
}
return ypl;
}
void mutWallFunctionFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
operator==(calcMut());
fixedValueFvPatchScalarField::updateCoeffs();
}
void mutWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -22,19 +22,20 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
alphaSgsWallFunctionFvPatchScalarField
Foam::compressible::RASModels::mutWallFunctionFvPatchScalarField
Description
Boundary condition for thermal diffusivity when using wall functions
Boundary condition for turbulent (kinematic) viscosity when using wall
functions, based on turbulence kinetic energy.
- replicates OpenFOAM v1.5 (and earlier) behaviour
SourceFiles
alphaSgsWallFunctionFvPatchScalarField.C
mutWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef alphaSgsWallFunctionFvPatchScalarField_H
#define alphaSgsWallFunctionFvPatchScalarField_H
#ifndef compressibleMutWallFunctionFvPatchScalarField_H
#define compressibleMutWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
@ -44,112 +45,119 @@ namespace Foam
{
namespace compressible
{
namespace LESModels
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class alphaSgsWallFunctionFvPatchScalarField Declaration
Class mutWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class alphaSgsWallFunctionFvPatchScalarField
class mutWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
// Private data
protected:
//- Turbulent Prandtl number
scalar Prt_;
// Protected data
//- Cmu coefficient
scalar Cmu_;
//- Von Karman constant
scalar kappa_;
//- E coefficient
scalar E_;
//- Y+ at the edge of the laminar sublayer
scalar yPlusLam_;
// Private Member Functions
// Protected Member Functions
//- Check the type of the patch
void checkType();
virtual void checkType();
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcMut() const = 0;
//- Write local wall function variables
virtual void writeLocalEntries(Ostream&) const;
public:
//- Runtime type information
TypeName("alphaSgsWallFunction");
TypeName("mutWallFunction");
// Constructors
//- Construct from patch and internal field
alphaSgsWallFunctionFvPatchScalarField
mutWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
alphaSgsWallFunctionFvPatchScalarField
mutWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given alphaSgsWallFunctionFvPatchScalarField
//- Construct by mapping given
// mutWallFunctionFvPatchScalarField
// onto a new patch
alphaSgsWallFunctionFvPatchScalarField
mutWallFunctionFvPatchScalarField
(
const alphaSgsWallFunctionFvPatchScalarField&,
const mutWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
alphaSgsWallFunctionFvPatchScalarField
mutWallFunctionFvPatchScalarField
(
const alphaSgsWallFunctionFvPatchScalarField&
const mutWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new alphaSgsWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
alphaSgsWallFunctionFvPatchScalarField
mutWallFunctionFvPatchScalarField
(
const alphaSgsWallFunctionFvPatchScalarField&,
const mutWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new alphaSgsWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
//- Calculate the Y+ at the edge of the laminar sublayer
static scalar yPlusLam(const scalar kappa, const scalar E);
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const = 0;
// Evaluation functions
//- Evaluate the patchField
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::Pstream::blocking
);
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
// I-O
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam

View File

@ -65,14 +65,16 @@ scalar mutkRoughWallFunctionFvPatchScalarField::fnRough
tmp<scalarField> mutkRoughWallFunctionFvPatchScalarField::calcMut() const
{
const label patchI = patch().index();
const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const tmp<volScalarField> tk = rasModel.k();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchi];
const scalarField& rhow = turbModel.rho().boundaryField()[patchi];
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const scalarField& muw = turbModel.mu().boundaryField()[patchi];
const scalar Cmu25 = pow025(Cmu_);

View File

@ -41,46 +41,16 @@ namespace RASModels
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void mutkWallFunctionFvPatchScalarField::checkType()
{
if (!isA<wallFvPatch>(patch()))
{
FatalErrorIn("mutkWallFunctionFvPatchScalarField::checkType()")
<< "Invalid wall function specification" << nl
<< " Patch type for patch " << patch().name()
<< " must be wall" << nl
<< " Current patch type is " << patch().type() << nl << endl
<< abort(FatalError);
}
}
scalar mutkWallFunctionFvPatchScalarField::calcYPlusLam
(
const scalar kappa,
const scalar E
) const
{
scalar ypl = 11.0;
for (int i=0; i<10; i++)
{
ypl = log(E*ypl)/kappa;
}
return ypl;
}
tmp<scalarField> mutkWallFunctionFvPatchScalarField::calcMut() const
{
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const tmp<volScalarField> tk = rasModel.k();
const label patchi = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchi];
const scalarField& rhow = turbModel.rho().boundaryField()[patchi];
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const scalarField& muw = turbModel.mu().boundaryField()[patchi];
const scalar Cmu25 = pow025(Cmu_);
@ -104,14 +74,6 @@ tmp<scalarField> mutkWallFunctionFvPatchScalarField::calcMut() const
}
void mutkWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
{
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
mutkWallFunctionFvPatchScalarField::mutkWallFunctionFvPatchScalarField
@ -120,11 +82,7 @@ mutkWallFunctionFvPatchScalarField::mutkWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
Cmu_(0.09),
kappa_(0.41),
E_(9.8),
yPlusLam_(calcYPlusLam(kappa_, E_))
mutWallFunctionFvPatchScalarField(p, iF)
{}
@ -136,11 +94,7 @@ mutkWallFunctionFvPatchScalarField::mutkWallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
Cmu_(ptf.Cmu_),
kappa_(ptf.kappa_),
E_(ptf.E_),
yPlusLam_(ptf.yPlusLam_)
mutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
{}
@ -151,11 +105,7 @@ mutkWallFunctionFvPatchScalarField::mutkWallFunctionFvPatchScalarField
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict),
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
yPlusLam_(calcYPlusLam(kappa_, E_))
mutWallFunctionFvPatchScalarField(p, iF, dict)
{}
@ -164,11 +114,7 @@ mutkWallFunctionFvPatchScalarField::mutkWallFunctionFvPatchScalarField
const mutkWallFunctionFvPatchScalarField& wfpsf
)
:
fixedValueFvPatchScalarField(wfpsf),
Cmu_(wfpsf.Cmu_),
kappa_(wfpsf.kappa_),
E_(wfpsf.E_),
yPlusLam_(wfpsf.yPlusLam_)
mutWallFunctionFvPatchScalarField(wfpsf)
{}
@ -178,54 +124,30 @@ mutkWallFunctionFvPatchScalarField::mutkWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(wfpsf, iF),
Cmu_(wfpsf.Cmu_),
kappa_(wfpsf.kappa_),
E_(wfpsf.E_),
yPlusLam_(wfpsf.yPlusLam_)
mutWallFunctionFvPatchScalarField(wfpsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void mutkWallFunctionFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
operator==(calcMut());
fixedValueFvPatchScalarField::updateCoeffs();
}
tmp<scalarField> mutkWallFunctionFvPatchScalarField::yPlus() const
{
const label patchI = patch().index();
const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchi];
const tmp<volScalarField> tk = rasModel.k();
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
const scalarField kwc(k.boundaryField()[patchI].patchInternalField());
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const scalarField kwc(k.boundaryField()[patchi].patchInternalField());
const scalarField& muw = turbModel.mu().boundaryField()[patchi];
const scalarField& rhow = turbModel.rho().boundaryField()[patchi];
return pow025(Cmu_)*y*sqrt(kwc)/(muw/rhow);
}
void mutkWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
@ -234,6 +156,7 @@ makePatchTypeField
mutkWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels

View File

@ -37,7 +37,7 @@ SourceFiles
#ifndef compressibleMutkWallFunctionFvPatchScalarField_H
#define compressibleMutkWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
#include "mutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -54,39 +54,15 @@ namespace RASModels
class mutkWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
public mutWallFunctionFvPatchScalarField
{
protected:
// Protected data
//- Cmu coefficient
scalar Cmu_;
//- Von Karman constant
scalar kappa_;
//- E coefficient
scalar E_;
//- Y+ at the edge of the laminar sublayer
scalar yPlusLam_;
// Protected Member Functions
//- Check the type of the patch
virtual void checkType();
//- Calculate the Y+ at the edge of the laminar sublayer
virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const;
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcMut() const;
//- Write local wall function variables
virtual void writeLocalEntries(Ostream&) const;
public:
@ -163,15 +139,6 @@ public:
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const;
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
// I-O
//- Write
virtual void write(Ostream&) const;
};

View File

@ -28,6 +28,7 @@ License
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "mutWallFunctionFvPatchScalarField.H"
#include "wallFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,23 +56,6 @@ void omegaWallFunctionFvPatchScalarField::checkType()
}
scalar omegaWallFunctionFvPatchScalarField::calcYPlusLam
(
const scalar kappa,
const scalar E
) const
{
scalar ypl = 11.0;
for (int i=0; i<10; i++)
{
ypl = log(E*ypl)/kappa;
}
return ypl;
}
void omegaWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
{
writeEntryIfDifferent<word>(os, "G", "RASModel::G", GName_);
@ -96,7 +80,7 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
kappa_(0.41),
E_(9.8),
beta1_(0.075),
yPlusLam_(calcYPlusLam(kappa_, E_))
yPlusLam_(mutWallFunctionFvPatchScalarField::yPlusLam(kappa_, E_))
{
checkType();
@ -136,7 +120,7 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
beta1_(dict.lookupOrDefault<scalar>("beta1", 0.075)),
yPlusLam_(calcYPlusLam(kappa_, E_))
yPlusLam_(mutWallFunctionFvPatchScalarField::yPlusLam(kappa_, E_))
{
checkType();
}

View File

@ -98,9 +98,6 @@ protected:
//- Check the type of the patch
virtual void checkType();
//- Calculate the Y+ at the edge of the laminar sublayer
virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const;
//- Write local wall function variables
virtual void writeLocalEntries(Ostream&) const;

View File

@ -68,7 +68,9 @@ turbulenceModel::turbulenceModel
rho_(rho),
U_(U),
phi_(phi),
thermophysicalModel_(thermophysicalModel)
thermophysicalModel_(thermophysicalModel),
y_(mesh_)
{}
@ -137,7 +139,12 @@ tmp<volScalarField> turbulenceModel::rhoEpsilonEff() const
void turbulenceModel::correct()
{}
{
if (mesh_.changing())
{
y_.correct();
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -49,6 +49,7 @@ SourceFiles
#include "surfaceFieldsFwd.H"
#include "fvMatricesFwd.H"
#include "basicThermo.H"
#include "nearWallDist.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
@ -85,6 +86,9 @@ protected:
const basicThermo& thermophysicalModel_;
//- Near wall distance boundary field
nearWallDist y_;
private:
@ -178,6 +182,12 @@ public:
return thermophysicalModel_;
}
//- Return the near wall distances
const nearWallDist& y() const
{
return y_;
}
//- Return the laminar viscosity
const volScalarField& mu() const
{

View File

@ -32,14 +32,14 @@ boundaryField
upperWall
{
type alphaSgsJayatillekeWallFunction;
type alphatJayatillekeWallFunction;
he ha;
value uniform 0;
}
lowerWall
{
type alphaSgsJayatillekeWallFunction;
type alphatJayatillekeWallFunction;
he ha;
value uniform 0;
}

View File

@ -32,13 +32,13 @@ boundaryField
upperWall
{
type muSgsUSpaldingWallFunction;
type mutUSpaldingWallFunction;
value uniform 0;
}
lowerWall
{
type muSgsUSpaldingWallFunction;
type mutUSpaldingWallFunction;
value uniform 0;
}

View File

@ -31,13 +31,13 @@ boundaryField
}
upperWall
{
type alphaSgsJayatillekeWallFunction;
type alphatJayatillekeWallFunction;
he ha;
value uniform 0;
}
lowerWall
{
type alphaSgsJayatillekeWallFunction;
type alphatJayatillekeWallFunction;
he ha;
value uniform 0;
}

View File

@ -31,12 +31,12 @@ boundaryField
}
upperWall
{
type muSgsUSpaldingWallFunction;
type mutUSpaldingWallFunction;
value uniform 0;
}
lowerWall
{
type muSgsUSpaldingWallFunction;
type mutUSpaldingWallFunction;
value uniform 0;
}
front

View File

@ -23,7 +23,7 @@ boundaryField
{
ground
{
type alphaSgsWallFunction;
type alphatWallFunction;
value uniform 0;
}
@ -44,7 +44,7 @@ boundaryField
"(region0_to.*)"
{
type alphaSgsWallFunction;
type alphatWallFunction;
value uniform 0;
}
}

View File

@ -43,7 +43,7 @@ boundaryField
"(region0_to.*)"
{
type muSgsUSpaldingWallFunction;
type mutUSpaldingWallFunction;
value uniform 0;
}
}