nutWallFunctions: Generalised for RAS and LES

nuSgsUSpaldingWallFunction removed, now use nutUSpaldingWallFunction
This commit is contained in:
Henry
2012-07-03 10:34:20 +01:00
parent 668a0e95b5
commit ef2bc10d11
33 changed files with 241 additions and 638 deletions

View File

@ -34,6 +34,7 @@ Description
#include "LESModel.H" #include "LESModel.H"
#include "nearWallDist.H" #include "nearWallDist.H"
#include "wallDist.H" #include "wallDist.H"
#include "wallFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -30,7 +30,7 @@ License
#include "compressible/LES/LESModel/LESModel.H" #include "compressible/LES/LESModel/LESModel.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "nearWallDist.H" #include "nearWallDist.H"
//#include "wallDist.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -53,7 +53,6 @@ SourceFiles
#include "fvc.H" #include "fvc.H"
#include "fvMatrices.H" #include "fvMatrices.H"
#include "incompressible/transportModel/transportModel.H" #include "incompressible/transportModel/transportModel.H"
#include "wallFvPatch.H"
#include "bound.H" #include "bound.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"

View File

@ -28,10 +28,4 @@ mixedSmagorinsky/mixedSmagorinsky.C
kOmegaSSTSAS/kOmegaSSTSAS.C kOmegaSSTSAS/kOmegaSSTSAS.C
/* Wall functions */
wallFunctions=derivedFvPatchFields/wallFunctions
nuSgsWallFunctions=$(wallFunctions)/nuSgsWallFunctions
$(nuSgsWallFunctions)/nuSgsUSpaldingWallFunction/nuSgsUSpaldingWallFunctionFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libincompressibleLESModels LIB = $(FOAM_LIBBIN)/libincompressibleLESModels

View File

@ -1,199 +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 "nuSgsUSpaldingWallFunctionFvPatchScalarField.H"
#include "LESModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace LESModels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nuSgsUSpaldingWallFunctionFvPatchScalarField::
nuSgsUSpaldingWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
kappa_(0.41),
E_(9.8)
{}
nuSgsUSpaldingWallFunctionFvPatchScalarField::
nuSgsUSpaldingWallFunctionFvPatchScalarField
(
const nuSgsUSpaldingWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
kappa_(ptf.kappa_),
E_(ptf.E_)
{}
nuSgsUSpaldingWallFunctionFvPatchScalarField::
nuSgsUSpaldingWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8))
{}
nuSgsUSpaldingWallFunctionFvPatchScalarField::
nuSgsUSpaldingWallFunctionFvPatchScalarField
(
const nuSgsUSpaldingWallFunctionFvPatchScalarField& nwfpsf
)
:
fixedValueFvPatchScalarField(nwfpsf),
kappa_(nwfpsf.kappa_),
E_(nwfpsf.E_)
{}
nuSgsUSpaldingWallFunctionFvPatchScalarField::
nuSgsUSpaldingWallFunctionFvPatchScalarField
(
const nuSgsUSpaldingWallFunctionFvPatchScalarField& nwfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(nwfpsf, iF),
kappa_(nwfpsf.kappa_),
E_(nwfpsf.E_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void nuSgsUSpaldingWallFunctionFvPatchScalarField::evaluate
(
const Pstream::commsTypes
)
{
const LESModel& lesModel = db().lookupObject<LESModel>("LESProperties");
const label patchi = patch().index();
const fvPatchVectorField& U = lesModel.U().boundaryField()[patchi];
const scalarField nuw = lesModel.nu()().boundaryField()[patchi];
const scalarField& ry = patch().deltaCoeffs();
const scalarField magUp(mag(U.patchInternalField() - U));
scalarField& nuSgsw = *this;
const scalarField magFaceGradU(mag(U.snGrad()));
forAll(nuSgsw, facei)
{
scalar magUpara = magUp[facei];
scalar utau = sqrt((nuSgsw[facei] + nuw[facei])*magFaceGradU[facei]);
if (utau > VSMALL)
{
int iter = 0;
scalar err = GREAT;
do
{
scalar kUu = min(kappa_*magUpara/utau, 50);
scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu);
scalar f =
- utau/(ry[facei]*nuw[facei])
+ magUpara/utau
+ 1/E_*(fkUu - 1.0/6.0*kUu*sqr(kUu));
scalar df =
- 1.0/(ry[facei]*nuw[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);
nuSgsw[facei] =
max(sqr(max(utau, 0))/magFaceGradU[facei] - nuw[facei], 0.0);
}
else
{
nuSgsw[facei] = 0;
}
}
fixedValueFvPatchScalarField::evaluate();
}
void nuSgsUSpaldingWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
nuSgsUSpaldingWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,165 +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::incompressible::LESModels::
nuSgsUSpaldingWallFunctionFvPatchScalarField
Description
Wall function boundary condition for walls, based on velocity, using
Spaldings law to give a continuous nuSgs profile to the wall (y+ = 0)
SourceFiles
nuSgsUSpaldingWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef nuSgsUSpaldingWallFunctionFvPatchScalarField_H
#define nuSgsUSpaldingWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace LESModels
{
/*---------------------------------------------------------------------------*\
Class nuSgsUSpaldingWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class nuSgsUSpaldingWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
// Private data
//- Von Karman constant
scalar kappa_;
//- E constant
scalar E_;
public:
//- Runtime type information
TypeName("nuSgsUSpaldingWallFunction");
// Constructors
//- Construct from patch and internal field
nuSgsUSpaldingWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
nuSgsUSpaldingWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// nuSgsUSpaldingWallFunctionFvPatchScalarField
// onto a new patch
nuSgsUSpaldingWallFunctionFvPatchScalarField
(
const nuSgsUSpaldingWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
nuSgsUSpaldingWallFunctionFvPatchScalarField
(
const nuSgsUSpaldingWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new nuSgsUSpaldingWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
nuSgsUSpaldingWallFunctionFvPatchScalarField
(
const nuSgsUSpaldingWallFunctionFvPatchScalarField&,
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 nuSgsUSpaldingWallFunctionFvPatchScalarField(*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 incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -22,14 +22,17 @@ kkLOmega/kkLOmega.C
wallFunctions = derivedFvPatchFields/wallFunctions wallFunctions = derivedFvPatchFields/wallFunctions
nutWallFunctions = $(wallFunctions)/nutWallFunctions nutWallFunctions = $(wallFunctions)/nutWallFunctions
$(nutWallFunctions)/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C $(nutWallFunctions)/nutWallFunction/nutWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C $(nutWallFunctions)/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C $(nutWallFunctions)/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C $(nutWallFunctions)/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C $(nutWallFunctions)/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.C $(nutWallFunctions)/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C $(nutWallFunctions)/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C $(nutWallFunctions)/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C
epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions
$(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C $(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C

View File

@ -26,6 +26,7 @@ License
#include "NonlinearKEShih.H" #include "NonlinearKEShih.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "nutkWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "RASModel.H" #include "RASModel.H"
#include "wallFvPatch.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -82,9 +81,7 @@ RASModel::RASModel
kMin_("kMin", sqr(dimVelocity), SMALL), kMin_("kMin", sqr(dimVelocity), SMALL),
epsilonMin_("epsilonMin", kMin_.dimensions()/dimTime, SMALL), epsilonMin_("epsilonMin", kMin_.dimensions()/dimTime, SMALL),
omegaMin_("omegaMin", dimless/dimTime, SMALL), omegaMin_("omegaMin", dimless/dimTime, SMALL)
y_(mesh_)
{ {
kMin_.readIfPresent(*this); kMin_.readIfPresent(*this);
epsilonMin_.readIfPresent(*this); epsilonMin_.readIfPresent(*this);
@ -156,57 +153,9 @@ autoPtr<RASModel> RASModel::New
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * 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())
/nu()().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() void RASModel::correct()
{ {
turbulenceModel::correct(); turbulenceModel::correct();
if (turbulence_ && mesh_.changing())
{
y_.correct();
}
} }

View File

@ -44,7 +44,6 @@ SourceFiles
#include "incompressible/turbulenceModel/turbulenceModel.H" #include "incompressible/turbulenceModel/turbulenceModel.H"
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "nearWallDist.H"
#include "fvm.H" #include "fvm.H"
#include "fvc.H" #include "fvc.H"
#include "fvMatrices.H" #include "fvMatrices.H"
@ -94,9 +93,6 @@ protected:
//- Lower limit for omega //- Lower limit for omega
dimensionedScalar omegaMin_; dimensionedScalar omegaMin_;
//- Near wall distance boundary field
nearWallDist y_;
// Protected Member Functions // Protected Member Functions
@ -208,15 +204,6 @@ public:
return omegaMin_; 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 access to the coefficients dictionary
const dictionary& coeffDict() const const dictionary& coeffDict() const
{ {
@ -233,13 +220,6 @@ public:
); );
} }
//- 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 //- Solve the turbulence equations and correct the turbulence viscosity
virtual void correct(); virtual void correct();

View File

@ -29,6 +29,8 @@ License
#include "volFields.H" #include "volFields.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "nutkWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,23 +57,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 void epsilonWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
{ {
writeEntryIfDifferent<word>(os, "G", "RASModel::G", GName_); writeEntryIfDifferent<word>(os, "G", "RASModel::G", GName_);
@ -94,7 +79,7 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
Cmu_(0.09), Cmu_(0.09),
kappa_(0.41), kappa_(0.41),
E_(9.8), E_(9.8),
yPlusLam_(calcYPlusLam(kappa_, E_)) yPlusLam_(nutkWallFunctionFvPatchScalarField::yPlusLam(kappa_, E_))
{ {
checkType(); checkType();
} }
@ -131,7 +116,7 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8)), E_(dict.lookupOrDefault<scalar>("E", 9.8)),
yPlusLam_(calcYPlusLam(kappa_, E_)) yPlusLam_(nutkWallFunctionFvPatchScalarField::yPlusLam(kappa_, E_))
{ {
checkType(); checkType();
} }

View File

@ -82,9 +82,6 @@ protected:
//- Check the type of the patch //- Check the type of the patch
virtual void checkType(); 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 //- Write local wall function variables
virtual void writeLocalEntries(Ostream&) const; virtual void writeLocalEntries(Ostream&) const;

View File

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

View File

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

View File

@ -42,14 +42,15 @@ namespace RASModels
tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::calcNut() const tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::calcNut() const
{ {
const label patchI = patch().index(); const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const turbulenceModel& turbModel =
const scalarField& y = rasModel.y()[patchI]; db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; const scalarField& y = turbModel.y()[patchi];
const tmp<volScalarField> tnu = rasModel.nu(); const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
const tmp<volScalarField> tnu = turbModel.nu();
const volScalarField& nu = tnu(); const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchI]; const scalarField& nuw = nu.boundaryField()[patchi];
// The flow velocity at the adjacent cell centre // The flow velocity at the adjacent cell centre
const scalarField magUp(mag(Uw.patchInternalField() - Uw)); const scalarField magUp(mag(Uw.patchInternalField() - Uw));
@ -78,13 +79,14 @@ tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::calcYPlus
const scalarField& magUp const scalarField& magUp
) const ) const
{ {
const label patchI = patch().index(); const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const turbulenceModel& turbModel =
const scalarField& y = rasModel.y()[patchI]; db().lookupObject<turbulenceModel>("turbulenceModel");
const tmp<volScalarField> tnu = rasModel.nu(); const scalarField& y = turbModel.y()[patchi];
const tmp<volScalarField> tnu = turbModel.nu();
const volScalarField& nu = tnu(); const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchI]; const scalarField& nuw = nu.boundaryField()[patchi];
tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0)); tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0));
scalarField& yPlus = tyPlus(); scalarField& yPlus = tyPlus();
@ -200,7 +202,7 @@ nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
nutkWallFunctionFvPatchScalarField(p, iF), nutWallFunctionFvPatchScalarField(p, iF),
roughnessHeight_(pTraits<scalar>::zero), roughnessHeight_(pTraits<scalar>::zero),
roughnessConstant_(pTraits<scalar>::zero), roughnessConstant_(pTraits<scalar>::zero),
roughnessFactor_(pTraits<scalar>::zero) roughnessFactor_(pTraits<scalar>::zero)
@ -215,7 +217,7 @@ nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper), nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
roughnessHeight_(ptf.roughnessHeight_), roughnessHeight_(ptf.roughnessHeight_),
roughnessConstant_(ptf.roughnessConstant_), roughnessConstant_(ptf.roughnessConstant_),
roughnessFactor_(ptf.roughnessFactor_) roughnessFactor_(ptf.roughnessFactor_)
@ -229,7 +231,7 @@ nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
const dictionary& dict const dictionary& dict
) )
: :
nutkWallFunctionFvPatchScalarField(p, iF, dict), nutWallFunctionFvPatchScalarField(p, iF, dict),
roughnessHeight_(readScalar(dict.lookup("roughnessHeight"))), roughnessHeight_(readScalar(dict.lookup("roughnessHeight"))),
roughnessConstant_(readScalar(dict.lookup("roughnessConstant"))), roughnessConstant_(readScalar(dict.lookup("roughnessConstant"))),
roughnessFactor_(readScalar(dict.lookup("roughnessFactor"))) roughnessFactor_(readScalar(dict.lookup("roughnessFactor")))
@ -241,7 +243,7 @@ nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
const nutURoughWallFunctionFvPatchScalarField& rwfpsf const nutURoughWallFunctionFvPatchScalarField& rwfpsf
) )
: :
nutkWallFunctionFvPatchScalarField(rwfpsf), nutWallFunctionFvPatchScalarField(rwfpsf),
roughnessHeight_(rwfpsf.roughnessHeight_), roughnessHeight_(rwfpsf.roughnessHeight_),
roughnessConstant_(rwfpsf.roughnessConstant_), roughnessConstant_(rwfpsf.roughnessConstant_),
roughnessFactor_(rwfpsf.roughnessFactor_) roughnessFactor_(rwfpsf.roughnessFactor_)
@ -254,7 +256,7 @@ nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
nutkWallFunctionFvPatchScalarField(rwfpsf, iF), nutWallFunctionFvPatchScalarField(rwfpsf, iF),
roughnessHeight_(rwfpsf.roughnessHeight_), roughnessHeight_(rwfpsf.roughnessHeight_),
roughnessConstant_(rwfpsf.roughnessConstant_), roughnessConstant_(rwfpsf.roughnessConstant_),
roughnessFactor_(rwfpsf.roughnessFactor_) roughnessFactor_(rwfpsf.roughnessFactor_)
@ -265,10 +267,11 @@ nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::yPlus() const tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::yPlus() const
{ {
const label patchI = patch().index(); const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const turbulenceModel& turbModel =
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
tmp<scalarField> magUp = mag(Uw.patchInternalField() - Uw); tmp<scalarField> magUp = mag(Uw.patchInternalField() - Uw);
return calcYPlus(magUp()); return calcYPlus(magUp());

View File

@ -35,7 +35,7 @@ SourceFiles
#ifndef nutURoughWallFunctionFvPatchScalarField_H #ifndef nutURoughWallFunctionFvPatchScalarField_H
#define nutURoughWallFunctionFvPatchScalarField_H #define nutURoughWallFunctionFvPatchScalarField_H
#include "nutkWallFunctionFvPatchScalarField.H" #include "nutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,7 +52,7 @@ namespace RASModels
class nutURoughWallFunctionFvPatchScalarField class nutURoughWallFunctionFvPatchScalarField
: :
public nutkWallFunctionFvPatchScalarField public nutWallFunctionFvPatchScalarField
{ {
// Private data // Private data

View File

@ -42,14 +42,15 @@ namespace RASModels
tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcNut() const tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcNut() const
{ {
const label patchI = patch().index(); const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const turbulenceModel& turbModel =
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
const scalarField magGradU(mag(Uw.snGrad())); const scalarField magGradU(mag(Uw.snGrad()));
const tmp<volScalarField> tnu = rasModel.nu(); const tmp<volScalarField> tnu = turbModel.nu();
const volScalarField& nu = tnu(); const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchI]; const scalarField& nuw = nu.boundaryField()[patchi];
return max return max
( (
@ -64,14 +65,15 @@ tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcUTau
const scalarField& magGradU const scalarField& magGradU
) const ) const
{ {
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const turbulenceModel& turbModel =
const scalarField& y = rasModel.y()[patch().index()]; db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patch().index()];
const fvPatchVectorField& Uw = const fvPatchVectorField& Uw =
rasModel.U().boundaryField()[patch().index()]; turbModel.U().boundaryField()[patch().index()];
const scalarField magUp(mag(Uw.patchInternalField() - Uw)); const scalarField magUp(mag(Uw.patchInternalField() - Uw));
const scalarField& nuw = rasModel.nu()().boundaryField()[patch().index()]; const scalarField& nuw = turbModel.nu()().boundaryField()[patch().index()];
const scalarField& nutw = *this; const scalarField& nutw = *this;
tmp<scalarField> tuTau(new scalarField(patch().size(), 0.0)); tmp<scalarField> tuTau(new scalarField(patch().size(), 0.0));
@ -124,7 +126,7 @@ nutUSpaldingWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
nutkWallFunctionFvPatchScalarField(p, iF) nutWallFunctionFvPatchScalarField(p, iF)
{} {}
@ -137,7 +139,7 @@ nutUSpaldingWallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper) nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
{} {}
@ -149,7 +151,7 @@ nutUSpaldingWallFunctionFvPatchScalarField
const dictionary& dict const dictionary& dict
) )
: :
nutkWallFunctionFvPatchScalarField(p, iF, dict) nutWallFunctionFvPatchScalarField(p, iF, dict)
{} {}
@ -159,7 +161,7 @@ nutUSpaldingWallFunctionFvPatchScalarField
const nutUSpaldingWallFunctionFvPatchScalarField& wfpsf const nutUSpaldingWallFunctionFvPatchScalarField& wfpsf
) )
: :
nutkWallFunctionFvPatchScalarField(wfpsf) nutWallFunctionFvPatchScalarField(wfpsf)
{} {}
@ -170,7 +172,7 @@ nutUSpaldingWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
nutkWallFunctionFvPatchScalarField(wfpsf, iF) nutWallFunctionFvPatchScalarField(wfpsf, iF)
{} {}
@ -178,14 +180,15 @@ nutUSpaldingWallFunctionFvPatchScalarField
tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::yPlus() const tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::yPlus() const
{ {
const label patchI = patch().index(); const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const turbulenceModel& turbModel =
const scalarField& y = rasModel.y()[patchI]; db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; const scalarField& y = turbModel.y()[patchi];
const tmp<volScalarField> tnu = rasModel.nu(); const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
const tmp<volScalarField> tnu = turbModel.nu();
const volScalarField& nu = tnu(); const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchI]; const scalarField& nuw = nu.boundaryField()[patchi];
return y*calcUTau(mag(Uw.snGrad()))/nuw; return y*calcUTau(mag(Uw.snGrad()))/nuw;
} }

View File

@ -36,7 +36,7 @@ SourceFiles
#ifndef nutUSpaldingWallFunctionFvPatchScalarField_H #ifndef nutUSpaldingWallFunctionFvPatchScalarField_H
#define nutUSpaldingWallFunctionFvPatchScalarField_H #define nutUSpaldingWallFunctionFvPatchScalarField_H
#include "nutkWallFunctionFvPatchScalarField.H" #include "nutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,7 +53,7 @@ namespace RASModels
class nutUSpaldingWallFunctionFvPatchScalarField class nutUSpaldingWallFunctionFvPatchScalarField
: :
public nutkWallFunctionFvPatchScalarField public nutWallFunctionFvPatchScalarField
{ {
protected: protected:

View File

@ -42,16 +42,17 @@ namespace RASModels
tmp<scalarField> nutUTabulatedWallFunctionFvPatchScalarField::calcNut() const tmp<scalarField> nutUTabulatedWallFunctionFvPatchScalarField::calcNut() const
{ {
const label patchI = patch().index(); const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const turbulenceModel& turbModel =
const scalarField& y = rasModel.y()[patchI]; db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; const scalarField& y = turbModel.y()[patchi];
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
const scalarField magUp(mag(Uw.patchInternalField() - Uw)); const scalarField magUp(mag(Uw.patchInternalField() - Uw));
const scalarField magGradU(mag(Uw.snGrad())); const scalarField magGradU(mag(Uw.snGrad()));
const tmp<volScalarField> tnu = rasModel.nu(); const tmp<volScalarField> tnu = turbModel.nu();
const volScalarField& nu = tnu(); const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchI]; const scalarField& nuw = nu.boundaryField()[patchi];
return return
max max
@ -90,7 +91,7 @@ nutUTabulatedWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
nutkWallFunctionFvPatchScalarField(p, iF), nutWallFunctionFvPatchScalarField(p, iF),
uPlusTableName_("undefined-uPlusTableName"), uPlusTableName_("undefined-uPlusTableName"),
uPlusTable_ uPlusTable_
( (
@ -117,7 +118,7 @@ nutUTabulatedWallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper), nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
uPlusTableName_(ptf.uPlusTableName_), uPlusTableName_(ptf.uPlusTableName_),
uPlusTable_(ptf.uPlusTable_) uPlusTable_(ptf.uPlusTable_)
{} {}
@ -131,7 +132,7 @@ nutUTabulatedWallFunctionFvPatchScalarField
const dictionary& dict const dictionary& dict
) )
: :
nutkWallFunctionFvPatchScalarField(p, iF, dict), nutWallFunctionFvPatchScalarField(p, iF, dict),
uPlusTableName_(dict.lookup("uPlusTable")), uPlusTableName_(dict.lookup("uPlusTable")),
uPlusTable_ uPlusTable_
( (
@ -155,7 +156,7 @@ nutUTabulatedWallFunctionFvPatchScalarField
const nutUTabulatedWallFunctionFvPatchScalarField& wfpsf const nutUTabulatedWallFunctionFvPatchScalarField& wfpsf
) )
: :
nutkWallFunctionFvPatchScalarField(wfpsf), nutWallFunctionFvPatchScalarField(wfpsf),
uPlusTableName_(wfpsf.uPlusTableName_), uPlusTableName_(wfpsf.uPlusTableName_),
uPlusTable_(wfpsf.uPlusTable_) uPlusTable_(wfpsf.uPlusTable_)
{} {}
@ -168,7 +169,7 @@ nutUTabulatedWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
nutkWallFunctionFvPatchScalarField(wfpsf, iF), nutWallFunctionFvPatchScalarField(wfpsf, iF),
uPlusTableName_(wfpsf.uPlusTableName_), uPlusTableName_(wfpsf.uPlusTableName_),
uPlusTable_(wfpsf.uPlusTable_) uPlusTable_(wfpsf.uPlusTable_)
{} {}
@ -178,15 +179,16 @@ nutUTabulatedWallFunctionFvPatchScalarField
tmp<scalarField> nutUTabulatedWallFunctionFvPatchScalarField::yPlus() const tmp<scalarField> nutUTabulatedWallFunctionFvPatchScalarField::yPlus() const
{ {
const label patchI = patch().index(); const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const turbulenceModel& turbModel =
const scalarField& y = rasModel.y()[patchI]; db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; const scalarField& y = turbModel.y()[patchi];
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
const scalarField magUp(mag(Uw.patchInternalField() - Uw)); const scalarField magUp(mag(Uw.patchInternalField() - Uw));
const tmp<volScalarField> tnu = rasModel.nu(); const tmp<volScalarField> tnu = turbModel.nu();
const volScalarField& nu = tnu(); const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchI]; const scalarField& nuw = nu.boundaryField()[patchi];
const scalarField Rey(magUp*y/nuw); const scalarField Rey(magUp*y/nuw);
return Rey/(calcUPlus(Rey) + ROOTVSMALL); return Rey/(calcUPlus(Rey) + ROOTVSMALL);

View File

@ -39,7 +39,7 @@ SourceFiles
#ifndef nutUTabulatedWallFunctionFvPatchScalarField_H #ifndef nutUTabulatedWallFunctionFvPatchScalarField_H
#define nutUTabulatedWallFunctionFvPatchScalarField_H #define nutUTabulatedWallFunctionFvPatchScalarField_H
#include "nutkWallFunctionFvPatchScalarField.H" #include "nutWallFunctionFvPatchScalarField.H"
#include "uniformInterpolationTable.H" #include "uniformInterpolationTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -57,7 +57,7 @@ namespace RASModels
class nutUTabulatedWallFunctionFvPatchScalarField class nutUTabulatedWallFunctionFvPatchScalarField
: :
public nutkWallFunctionFvPatchScalarField public nutWallFunctionFvPatchScalarField
{ {
protected: protected:

View File

@ -42,14 +42,15 @@ namespace RASModels
tmp<scalarField> nutUWallFunctionFvPatchScalarField::calcNut() const tmp<scalarField> nutUWallFunctionFvPatchScalarField::calcNut() const
{ {
const label patchI = patch().index(); const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const turbulenceModel& turbModel =
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
const scalarField magUp(mag(Uw.patchInternalField() - Uw)); const scalarField magUp(mag(Uw.patchInternalField() - Uw));
const tmp<volScalarField> tnu = rasModel.nu(); const tmp<volScalarField> tnu = turbModel.nu();
const volScalarField& nu = tnu(); const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchI]; const scalarField& nuw = nu.boundaryField()[patchi];
tmp<scalarField> tyPlus = calcYPlus(magUp); tmp<scalarField> tyPlus = calcYPlus(magUp);
scalarField& yPlus = tyPlus(); scalarField& yPlus = tyPlus();
@ -75,13 +76,14 @@ tmp<scalarField> nutUWallFunctionFvPatchScalarField::calcYPlus
const scalarField& magUp const scalarField& magUp
) const ) const
{ {
const label patchI = patch().index(); const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const turbulenceModel& turbModel =
const scalarField& y = rasModel.y()[patchI]; db().lookupObject<turbulenceModel>("turbulenceModel");
const tmp<volScalarField> tnu = rasModel.nu(); const scalarField& y = turbModel.y()[patchi];
const tmp<volScalarField> tnu = turbModel.nu();
const volScalarField& nu = tnu(); const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchI]; const scalarField& nuw = nu.boundaryField()[patchi];
tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0)); tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0));
scalarField& yPlus = tyPlus(); scalarField& yPlus = tyPlus();
@ -118,7 +120,7 @@ nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
nutkWallFunctionFvPatchScalarField(p, iF) nutWallFunctionFvPatchScalarField(p, iF)
{} {}
@ -130,7 +132,7 @@ nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper) nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
{} {}
@ -141,7 +143,7 @@ nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
const dictionary& dict const dictionary& dict
) )
: :
nutkWallFunctionFvPatchScalarField(p, iF, dict) nutWallFunctionFvPatchScalarField(p, iF, dict)
{} {}
@ -150,7 +152,7 @@ nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
const nutUWallFunctionFvPatchScalarField& sawfpsf const nutUWallFunctionFvPatchScalarField& sawfpsf
) )
: :
nutkWallFunctionFvPatchScalarField(sawfpsf) nutWallFunctionFvPatchScalarField(sawfpsf)
{} {}
@ -160,7 +162,7 @@ nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF const DimensionedField<scalar, volMesh>& iF
) )
: :
nutkWallFunctionFvPatchScalarField(sawfpsf, iF) nutWallFunctionFvPatchScalarField(sawfpsf, iF)
{} {}
@ -168,9 +170,10 @@ nutUWallFunctionFvPatchScalarField::nutUWallFunctionFvPatchScalarField
tmp<scalarField> nutUWallFunctionFvPatchScalarField::yPlus() const tmp<scalarField> nutUWallFunctionFvPatchScalarField::yPlus() const
{ {
const label patchI = patch().index(); const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const turbulenceModel& turbModel =
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
const scalarField magUp(mag(Uw.patchInternalField() - Uw)); const scalarField magUp(mag(Uw.patchInternalField() - Uw));
return calcYPlus(magUp); return calcYPlus(magUp);

View File

@ -35,7 +35,7 @@ SourceFiles
#ifndef nutUWallFunctionFvPatchScalarField_H #ifndef nutUWallFunctionFvPatchScalarField_H
#define nutUWallFunctionFvPatchScalarField_H #define nutUWallFunctionFvPatchScalarField_H
#include "nutkWallFunctionFvPatchScalarField.H" #include "nutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,7 +52,7 @@ namespace RASModels
class nutUWallFunctionFvPatchScalarField class nutUWallFunctionFvPatchScalarField
: :
public nutkWallFunctionFvPatchScalarField public nutWallFunctionFvPatchScalarField
{ {
protected: protected:

View File

@ -65,15 +65,16 @@ scalar nutkRoughWallFunctionFvPatchScalarField::fnRough
tmp<scalarField> nutkRoughWallFunctionFvPatchScalarField::calcNut() const tmp<scalarField> nutkRoughWallFunctionFvPatchScalarField::calcNut() const
{ {
const label patchI = patch().index(); const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const turbulenceModel& turbModel =
const scalarField& y = rasModel.y()[patchI]; db().lookupObject<turbulenceModel>("turbulenceModel");
const tmp<volScalarField> tk = rasModel.k(); const scalarField& y = turbModel.y()[patchi];
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk(); const volScalarField& k = tk();
const tmp<volScalarField> tnu = rasModel.nu(); const tmp<volScalarField> tnu = turbModel.nu();
const volScalarField& nu = tnu(); const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchI]; const scalarField& nuw = nu.boundaryField()[patchi];
const scalar Cmu25 = pow025(Cmu_); const scalar Cmu25 = pow025(Cmu_);

View File

@ -1,4 +1,4 @@
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------* \
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
@ -55,34 +55,18 @@ void nutkWallFunctionFvPatchScalarField::checkType()
} }
scalar nutkWallFunctionFvPatchScalarField::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> nutkWallFunctionFvPatchScalarField::calcNut() const tmp<scalarField> nutkWallFunctionFvPatchScalarField::calcNut() const
{ {
const label patchI = patch().index(); const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const turbulenceModel& turbModel =
const scalarField& y = rasModel.y()[patchI]; db().lookupObject<turbulenceModel>("turbulenceModel");
const tmp<volScalarField> tk = rasModel.k(); const scalarField& y = turbModel.y()[patchi];
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk(); const volScalarField& k = tk();
const tmp<volScalarField> tnu = rasModel.nu(); const tmp<volScalarField> tnu = turbModel.nu();
const volScalarField& nu = tnu(); const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchI]; const scalarField& nuw = nu.boundaryField()[patchi];
const scalar Cmu25 = pow025(Cmu_); const scalar Cmu25 = pow025(Cmu_);
@ -125,7 +109,7 @@ nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
Cmu_(0.09), Cmu_(0.09),
kappa_(0.41), kappa_(0.41),
E_(9.8), E_(9.8),
yPlusLam_(calcYPlusLam(kappa_, E_)) yPlusLam_(yPlusLam(kappa_, E_))
{ {
checkType(); checkType();
} }
@ -160,7 +144,7 @@ nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8)), E_(dict.lookupOrDefault<scalar>("E", 9.8)),
yPlusLam_(calcYPlusLam(kappa_, E_)) yPlusLam_(yPlusLam(kappa_, E_))
{ {
checkType(); checkType();
} }
@ -199,6 +183,23 @@ nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
scalar nutkWallFunctionFvPatchScalarField::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 nutkWallFunctionFvPatchScalarField::updateCoeffs() void nutkWallFunctionFvPatchScalarField::updateCoeffs()
{ {
if (updated()) if (updated())
@ -214,17 +215,18 @@ void nutkWallFunctionFvPatchScalarField::updateCoeffs()
tmp<scalarField> nutkWallFunctionFvPatchScalarField::yPlus() const tmp<scalarField> nutkWallFunctionFvPatchScalarField::yPlus() const
{ {
const label patchI = patch().index(); const label patchi = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); const turbulenceModel& turbModel =
const scalarField& y = rasModel.y()[patchI]; 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 volScalarField& k = tk();
tmp<scalarField> kwc = k.boundaryField()[patchI].patchInternalField(); tmp<scalarField> kwc = k.boundaryField()[patchi].patchInternalField();
const tmp<volScalarField> tnu = rasModel.nu(); const tmp<volScalarField> tnu = turbModel.nu();
const volScalarField& nu = tnu(); const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchI]; const scalarField& nuw = nu.boundaryField()[patchi];
return pow025(Cmu_)*y*sqrt(kwc)/nuw; return pow025(Cmu_)*y*sqrt(kwc)/nuw;
} }

View File

@ -78,9 +78,6 @@ protected:
//- Check the type of the patch //- Check the type of the patch
virtual void checkType(); 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 //- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const; virtual tmp<scalarField> calcNut() const;
@ -159,6 +156,10 @@ public:
// Member functions // Member functions
//- Calculate the Y+ at the edge of the laminar sublayer
static scalar yPlusLam(const scalar kappa, const scalar E);
// Evaluation functions // Evaluation functions
//- Calculate and return the yPlus at the boundary //- Calculate and return the yPlus at the boundary

View File

@ -29,6 +29,8 @@ License
#include "volFields.H" #include "volFields.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "nutkWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,23 +57,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 void omegaWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
{ {
writeEntryIfDifferent<word>(os, "G", "RASModel::G", GName_); writeEntryIfDifferent<word>(os, "G", "RASModel::G", GName_);
@ -96,7 +81,7 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
kappa_(0.41), kappa_(0.41),
E_(9.8), E_(9.8),
beta1_(0.075), beta1_(0.075),
yPlusLam_(calcYPlusLam(kappa_, E_)) yPlusLam_(nutkWallFunctionFvPatchScalarField::yPlusLam(kappa_, E_))
{ {
checkType(); checkType();
} }
@ -135,7 +120,7 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8)), E_(dict.lookupOrDefault<scalar>("E", 9.8)),
beta1_(dict.lookupOrDefault<scalar>("beta1", 0.075)), beta1_(dict.lookupOrDefault<scalar>("beta1", 0.075)),
yPlusLam_(calcYPlusLam(kappa_, E_)) yPlusLam_(nutkWallFunctionFvPatchScalarField::yPlusLam(kappa_, E_))
{ {
checkType(); checkType();
} }

View File

@ -98,9 +98,6 @@ protected:
//- Check the type of the patch //- Check the type of the patch
virtual void checkType(); 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 //- Write local wall function variables
virtual void writeLocalEntries(Ostream&) const; virtual void writeLocalEntries(Ostream&) const;

View File

@ -33,7 +33,11 @@ Description
{ {
labelList cellBoundaryFaceCount(epsilon_.size(), 0); labelList cellBoundaryFaceCount(epsilon_.size(), 0);
scalar yPlusLam = this->yPlusLam(kappa_.value(), E_.value()); scalar yPlusLam = nutkWallFunctionFvPatchScalarField::yPlusLam
(
kappa_.value(),
E_.value()
);
const fvPatchList& patches = mesh_.boundary(); const fvPatchList& patches = mesh_.boundary();

View File

@ -32,7 +32,11 @@ Description
{ {
const fvPatchList& patches = mesh_.boundary(); const fvPatchList& patches = mesh_.boundary();
const scalar yPlusLam = this->yPlusLam(kappa_.value(), E_.value()); const scalar yPlusLam = nutkWallFunctionFvPatchScalarField::yPlusLam
(
kappa_.value(),
E_.value()
);
const volScalarField nuLam(this->nu()); const volScalarField nuLam(this->nu());

View File

@ -26,6 +26,7 @@ License
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "wallFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -65,7 +66,8 @@ turbulenceModel::turbulenceModel
U_(U), U_(U),
phi_(phi), phi_(phi),
transportModel_(transport) transportModel_(transport),
y_(mesh_)
{} {}
@ -127,6 +129,11 @@ autoPtr<turbulenceModel> turbulenceModel::New
void turbulenceModel::correct() void turbulenceModel::correct()
{ {
transportModel_.correct(); transportModel_.correct();
if (mesh_.changing())
{
y_.correct();
}
} }

View File

@ -48,6 +48,7 @@ SourceFiles
#include "surfaceFieldsFwd.H" #include "surfaceFieldsFwd.H"
#include "fvMatricesFwd.H" #include "fvMatricesFwd.H"
#include "incompressible/transportModel/transportModel.H" #include "incompressible/transportModel/transportModel.H"
#include "nearWallDist.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
@ -83,6 +84,9 @@ protected:
transportModel& transportModel_; transportModel& transportModel_;
//- Near wall distance boundary field
nearWallDist y_;
private: private:
@ -167,6 +171,12 @@ public:
return transportModel_; return transportModel_;
} }
//- Return the near wall distances
const nearWallDist& y() const
{
return y_;
}
//- Return the laminar viscosity //- Return the laminar viscosity
inline tmp<volScalarField> nu() const inline tmp<volScalarField> nu() const
{ {

View File

@ -40,7 +40,7 @@ boundaryField
lowerWall lowerWall
{ {
type nuSgsUSpaldingWallFunction; type nutUSpaldingWallFunction;
value uniform 0.0544766; value uniform 0.0544766;
} }
@ -51,7 +51,7 @@ boundaryField
"motorBike_.*" "motorBike_.*"
{ {
type nuSgsUSpaldingWallFunction; type nutUSpaldingWallFunction;
value uniform 0.0544766; value uniform 0.0544766;
} }

View File

@ -53,16 +53,16 @@ functions
{ {
functionObjectLibs ( "libfieldFunctionObjects.so" ); functionObjectLibs ( "libfieldFunctionObjects.so" );
type readFields; type readFields;
fields ( p U ); fields (p U);
} }
streamLines streamLines
{ {
type streamLine; type streamLine;
outputControl outputTime; outputControl outputTime;
setFormat vtk; setFormat vtk;
U U; UName U;
trackForward true; trackForward true;
fields ( p U ); fields (p U);
lifeTime 10000; lifeTime 10000;
nSubCycle 5; nSubCycle 5;
cloudName particleTracks; cloudName particleTracks;
@ -71,8 +71,8 @@ functions
{ {
type uniform; type uniform;
axis x; axis x;
start ( -1.001 1e-07 0.0011 ); start (-1.001 1e-07 0.0011);
end ( -1.001 1e-07 1.0011 ); end (-1.001 1e-07 1.0011);
nPoints 20; nPoints 20;
} }
} }
@ -84,7 +84,20 @@ functions
surfaceFormat vtk; surfaceFormat vtk;
fields ( p U ); fields ( p U );
interpolationScheme cellPoint; interpolationScheme cellPoint;
surfaces ( yNormal { type cuttingPlane ; planeType pointAndNormal ; pointAndNormalDict { basePoint ( 0 0 0 ) ; normalVector ( 0 1 0 ) ; } interpolate true ; } ); surfaces
(
yNormal
{
type cuttingPlane;
planeType pointAndNormal;
pointAndNormalDict
{
basePoint (0 0 0);
normalVector (0 1 0);
}
interpolate true;
}
);
} }
forces forces
{ {
@ -98,10 +111,10 @@ functions
rhoName rhoInf; rhoName rhoInf;
log true; log true;
rhoInf 1; rhoInf 1;
liftDir ( 0 0 1 ); liftDir (0 0 1);
dragDir ( 1 0 0 ); dragDir (1 0 0);
CofR ( 0.72 0 0 ); CofR (0.72 0 0);
pitchAxis ( 0 1 0 ); pitchAxis (0 1 0);
magUInf 20; magUInf 20;
lRef 1.42; lRef 1.42;
Aref 0.75; Aref 0.75;