mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Updated compressible RAS models to use the new run-time selectable wall
functions, and added commpressible variants of the mut wall functions employed in the incompressible libraray. - minor updates to the icompressible RAS model library
This commit is contained in:
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
fixedInternalValueFvPatchField
|
||||
Foam::incompressible::RASModels::fixedInternalValueFvPatchField
|
||||
|
||||
Description
|
||||
Boundary condition providing mechanism to set boundary (cell) values
|
||||
@ -201,13 +201,14 @@ LRR::LRR
|
||||
"mut",
|
||||
runTime_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_)
|
||||
mesh_
|
||||
)
|
||||
{
|
||||
# include "wallViscosityI.H"
|
||||
mut_ = Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||
mut_.correctBoundaryConditions();
|
||||
|
||||
if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
|
||||
{
|
||||
@ -311,15 +312,17 @@ void LRR::correct()
|
||||
{
|
||||
// Re-calculate viscosity
|
||||
mut_ = rho_*Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||
mut_.correctBoundaryConditions();
|
||||
return;
|
||||
}
|
||||
|
||||
RASModel::correct();
|
||||
|
||||
volSymmTensorField P = -twoSymm(R_ & fvc::grad(U_));
|
||||
volScalarField G = 0.5*tr(P);
|
||||
volScalarField G("G", 0.5*tr(P));
|
||||
|
||||
# include "wallFunctionsI.H"
|
||||
// Update espsilon and G at the wall
|
||||
epsilon_.boundaryField().updateCoeffs();
|
||||
|
||||
// Dissipation equation
|
||||
tmp<fvScalarMatrix> epsEqn
|
||||
@ -335,7 +338,7 @@ void LRR::correct()
|
||||
|
||||
epsEqn().relax();
|
||||
|
||||
# include "wallDissipationI.H"
|
||||
epsEqn().boundaryManipulate(epsilon_.boundaryField());
|
||||
|
||||
solve(epsEqn);
|
||||
bound(epsilon_, epsilon0_);
|
||||
@ -398,8 +401,7 @@ void LRR::correct()
|
||||
|
||||
// Re-calculate viscosity
|
||||
mut_ = rho_*Cmu_*sqr(k_)/epsilon_;
|
||||
|
||||
# include "wallViscosityI.H"
|
||||
mut_.correctBoundaryConditions();
|
||||
|
||||
|
||||
// Correct wall shear stresses
|
||||
|
||||
@ -223,13 +223,14 @@ LaunderGibsonRSTM::LaunderGibsonRSTM
|
||||
"mut",
|
||||
runTime_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_)
|
||||
mesh_
|
||||
)
|
||||
{
|
||||
# include "wallViscosityI.H"
|
||||
mut_ = Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||
mut_.correctBoundaryConditions();
|
||||
|
||||
if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
|
||||
{
|
||||
@ -336,6 +337,7 @@ void LaunderGibsonRSTM::correct()
|
||||
{
|
||||
// Re-calculate viscosity
|
||||
mut_ = rho_*Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||
mut_.correctBoundaryConditions();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -347,9 +349,10 @@ void LaunderGibsonRSTM::correct()
|
||||
}
|
||||
|
||||
volSymmTensorField P = -twoSymm(R_ & fvc::grad(U_));
|
||||
volScalarField G = 0.5*tr(P);
|
||||
volScalarField G("G", 0.5*tr(P));
|
||||
|
||||
# include "wallFunctionsI.H"
|
||||
// Update espsilon and G at the wall
|
||||
epsilon_.boundaryField().updateCoeffs();
|
||||
|
||||
// Dissipation equation
|
||||
tmp<fvScalarMatrix> epsEqn
|
||||
@ -365,7 +368,7 @@ void LaunderGibsonRSTM::correct()
|
||||
|
||||
epsEqn().relax();
|
||||
|
||||
# include "wallDissipationI.H"
|
||||
epsEqn().boundaryManipulate(epsilon_.boundaryField());
|
||||
|
||||
solve(epsEqn);
|
||||
bound(epsilon_, epsilon0_);
|
||||
@ -437,9 +440,7 @@ void LaunderGibsonRSTM::correct()
|
||||
|
||||
// Re-calculate turbulent viscosity
|
||||
mut_ = Cmu_*rho_*sqr(k_)/epsilon_;
|
||||
|
||||
|
||||
# include "wallViscosityI.H"
|
||||
mut_.correctBoundaryConditions();
|
||||
|
||||
|
||||
// Correct wall shear stresses
|
||||
|
||||
@ -12,7 +12,20 @@ SpalartAllmaras/SpalartAllmaras.C
|
||||
kOmegaSST/kOmegaSST.C
|
||||
|
||||
/* Wall functions */
|
||||
wallFunctions/mutWallFunctions/mutStandardRoughWallFunction/mutStandardRoughWallFunctionFvPatchScalarField.C
|
||||
derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.C
|
||||
derivedFvPatchFields/wallFunctions/mutWallFunctions/mutRoughWallFunction/mutRoughWallFunctionFvPatchScalarField.C
|
||||
|
||||
derivedFvPatchFields/wallFunctions/mutWallFunctions/mutSpalartAllmarasWallFunction/mutSpalartAllmarasWallFunctionFvPatchScalarField.C
|
||||
derivedFvPatchFields/wallFunctions/mutWallFunctions/mutSpalartAllmarasStandardWallFunction/mutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C
|
||||
derivedFvPatchFields/wallFunctions/mutWallFunctions/mutSpalartAllmarasStandardRoughWallFunction/mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.C
|
||||
|
||||
derivedFvPatchFields/wallFunctions/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.H
|
||||
|
||||
derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C
|
||||
|
||||
derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C
|
||||
|
||||
derivedFvPatchFields/wallFunctions/kQRWallFunctions/kQRWallFunction/kQRWallFunctionFvPatchFields.C
|
||||
|
||||
/* Patch fields */
|
||||
derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
|
||||
|
||||
@ -87,6 +87,7 @@ RASModel::RASModel
|
||||
printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
|
||||
coeffDict_(subDict(type + "Coeffs")),
|
||||
|
||||
wallFunctionDict_(subDict("wallFunctionCoeffs")),
|
||||
kappa_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
@ -105,6 +106,15 @@ RASModel::RASModel
|
||||
9.0
|
||||
)
|
||||
),
|
||||
Cmu_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"Cmu",
|
||||
wallFunctionDict_,
|
||||
0.09
|
||||
)
|
||||
),
|
||||
|
||||
yPlusLam_(yPlusLam(kappa_.value(), E_.value())),
|
||||
|
||||
@ -118,7 +128,7 @@ RASModel::RASModel
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
scalar RASModel::yPlusLam(const scalar kappa, const scalar E)
|
||||
scalar RASModel::yPlusLam(const scalar kappa, const scalar E) const
|
||||
{
|
||||
scalar ypl = 11.0;
|
||||
|
||||
|
||||
@ -91,10 +91,11 @@ protected:
|
||||
Switch printCoeffs_;
|
||||
dictionary coeffDict_;
|
||||
|
||||
dictionary wallFunctionDict_;
|
||||
dimensionedScalar kappa_;
|
||||
dimensionedScalar E_;
|
||||
dimensionedScalar Cmu_;
|
||||
|
||||
scalar yPlusLam(const scalar kappa, const scalar E);
|
||||
scalar yPlusLam_;
|
||||
|
||||
dimensionedScalar k0_;
|
||||
@ -237,6 +238,21 @@ public:
|
||||
return E_;
|
||||
}
|
||||
|
||||
//- Return Cmu for use in wall-functions
|
||||
dimensionedScalar Cmu() const
|
||||
{
|
||||
return Cmu_;
|
||||
}
|
||||
|
||||
//- 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;
|
||||
|
||||
//- Return y+ at the edge of the laminar sublayer
|
||||
// for use in wall-functions
|
||||
scalar yPlusLam() const
|
||||
@ -250,6 +266,12 @@ public:
|
||||
return coeffDict_;
|
||||
}
|
||||
|
||||
//- Const access to the wall functions coefficients dictionary
|
||||
const dictionary& walLFunctionDict() const
|
||||
{
|
||||
return wallFunctionDict_;
|
||||
}
|
||||
|
||||
|
||||
//- Return the laminar viscosity
|
||||
const volScalarField& mu() const
|
||||
|
||||
@ -170,13 +170,14 @@ RNGkEpsilon::RNGkEpsilon
|
||||
"mut",
|
||||
runTime_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_)
|
||||
mesh_
|
||||
)
|
||||
{
|
||||
# include "wallViscosityI.H"
|
||||
mut_ = Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||
mut_.correctBoundaryConditions();
|
||||
|
||||
printCoeffs();
|
||||
}
|
||||
@ -263,6 +264,7 @@ void RNGkEpsilon::correct()
|
||||
{
|
||||
// Re-calculate viscosity
|
||||
mut_ = rho_*Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||
mut_.correctBoundaryConditions();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -279,7 +281,7 @@ void RNGkEpsilon::correct()
|
||||
volScalarField S2 = (tgradU() && dev(twoSymm(tgradU())));
|
||||
tgradU.clear();
|
||||
|
||||
volScalarField G = mut_*S2;
|
||||
volScalarField G("G", mut_*S2);
|
||||
|
||||
volScalarField eta = sqrt(mag(S2))*k_/epsilon_;
|
||||
volScalarField eta3 = eta*sqr(eta);
|
||||
@ -287,7 +289,8 @@ void RNGkEpsilon::correct()
|
||||
volScalarField R =
|
||||
((eta*(-eta/eta0_ + scalar(1)))/(beta_*eta3 + scalar(1)));
|
||||
|
||||
# include "wallFunctionsI.H"
|
||||
// Update espsilon and G at the wall
|
||||
epsilon_.boundaryField().updateCoeffs();
|
||||
|
||||
// Dissipation equation
|
||||
tmp<fvScalarMatrix> epsEqn
|
||||
@ -303,7 +306,7 @@ void RNGkEpsilon::correct()
|
||||
|
||||
epsEqn().relax();
|
||||
|
||||
# include "wallDissipationI.H"
|
||||
epsEqn().boundaryManipulate(epsilon_.boundaryField());
|
||||
|
||||
solve(epsEqn);
|
||||
bound(epsilon_, epsilon0_);
|
||||
@ -328,9 +331,7 @@ void RNGkEpsilon::correct()
|
||||
|
||||
// Re-calculate viscosity
|
||||
mut_ = rho_*Cmu_*sqr(k_)/epsilon_;
|
||||
|
||||
# include "wallViscosityI.H"
|
||||
|
||||
mut_.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,218 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "epsilonWallFunctionFvPatchScalarField.H"
|
||||
#include "RASModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "wallFvPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void epsilonWallFunctionFvPatchScalarField::checkType()
|
||||
{
|
||||
if (!isA<wallFvPatch>(patch()))
|
||||
{
|
||||
FatalErrorIn("epsilonWallFunctionFvPatchScalarField::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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(p, iF)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const epsilonWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(p, iF, dict)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const epsilonWallFunctionFvPatchScalarField& ewfpsf
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(ewfpsf)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const epsilonWallFunctionFvPatchScalarField& ewfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(ewfpsf, iF)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
const RASModel& ras = db().lookupObject<RASModel>("RASProperties");
|
||||
|
||||
const scalar Cmu = ras.Cmu().value();
|
||||
const scalar Cmu25 = pow(Cmu, 0.25);
|
||||
const scalar Cmu75 = pow(Cmu, 0.75);
|
||||
const scalar kappa = ras.kappa().value();
|
||||
const scalar yPlusLam = ras.yPlusLam();
|
||||
|
||||
const scalarField& y = ras.y()[patch().index()];
|
||||
|
||||
volScalarField& G = const_cast<volScalarField&>
|
||||
(db().lookupObject<volScalarField>("G"));
|
||||
|
||||
volScalarField& epsilon = const_cast<volScalarField&>
|
||||
(db().lookupObject<volScalarField>("epsilon"));
|
||||
|
||||
const volScalarField& k = db().lookupObject<volScalarField>("k");
|
||||
|
||||
const scalarField& rhow =
|
||||
patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||
|
||||
const scalarField& muw =
|
||||
patch().lookupPatchField<volScalarField, scalar>("mu");
|
||||
|
||||
const scalarField& mutw =
|
||||
patch().lookupPatchField<volScalarField, scalar>("mut");
|
||||
|
||||
const fvPatchVectorField& Uw =
|
||||
patch().lookupPatchField<volVectorField, vector>("U");
|
||||
|
||||
const scalarField magGradUw = mag(Uw.snGrad());
|
||||
|
||||
// Set epsilon and G
|
||||
forAll(mutw, faceI)
|
||||
{
|
||||
label faceCellI = patch().faceCells()[faceI];
|
||||
|
||||
scalar yPlus =
|
||||
Cmu25*y[faceI]*sqrt(k[faceCellI])
|
||||
/(muw[faceI]/rhow[faceI]);
|
||||
|
||||
epsilon[faceCellI] = Cmu75*pow(k[faceCellI], 1.5)/(kappa*y[faceI]);
|
||||
|
||||
if (yPlus > yPlusLam)
|
||||
{
|
||||
G[faceCellI] =
|
||||
(mutw[faceI] + muw[faceI])
|
||||
*magGradUw[faceI]
|
||||
*Cmu25*sqrt(k[faceCellI])
|
||||
/(kappa*y[faceI]);
|
||||
}
|
||||
else
|
||||
{
|
||||
G[faceCellI] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: perform averaging for cells sharing more than one boundary face
|
||||
}
|
||||
|
||||
|
||||
void epsilonWallFunctionFvPatchScalarField::evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType
|
||||
)
|
||||
{
|
||||
fixedInternalValueFvPatchField<scalar>::evaluate(commsType);
|
||||
}
|
||||
|
||||
|
||||
void epsilonWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fixedInternalValueFvPatchField<scalar>::write(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
epsilonWallFunctionFvPatchScalarField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,164 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::compressible::RASModels::epsilonWallFunctionFvPatchScalarField
|
||||
|
||||
Description
|
||||
Boundary condition for epsilon when using wall functions
|
||||
- calculates epsilon and G
|
||||
- epsilon values added directly into the matrix to act as a constraint
|
||||
|
||||
SourceFiles
|
||||
epsilonWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef epsilonWallFunctionFvPatchScalarField_H
|
||||
#define epsilonWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "fixedInternalValueFvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class epsilonWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class epsilonWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedInternalValueFvPatchField<scalar>
|
||||
{
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Check the type of the patch
|
||||
void checkType();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("epsilonWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// epsilonWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const epsilonWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const epsilonWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new epsilonWallFunctionFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
epsilonWallFunctionFvPatchScalarField
|
||||
(
|
||||
const epsilonWallFunctionFvPatchScalarField&,
|
||||
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 epsilonWallFunctionFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Evaluate the patchField
|
||||
virtual void evaluate(const Pstream::commsTypes);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,155 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "kQRWallFunctionFvPatchField.H"
|
||||
#include "RASModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "wallFvPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void kQRWallFunctionFvPatchField<Type>::checkType()
|
||||
{
|
||||
if (!isA<wallFvPatch>(this->patch()))
|
||||
{
|
||||
FatalErrorIn("kQRWallFunctionFvPatchField::checkType()")
|
||||
<< "Invalid wall function specification" << nl
|
||||
<< " Patch type for patch " << this->patch().name()
|
||||
<< " must be wall" << nl
|
||||
<< " Current patch type is " << this->patch().type()
|
||||
<< nl << endl << abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
kQRWallFunctionFvPatchField<Type>::kQRWallFunctionFvPatchField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
)
|
||||
:
|
||||
zeroGradientFvPatchField<Type>(p, iF)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
kQRWallFunctionFvPatchField<Type>::kQRWallFunctionFvPatchField
|
||||
(
|
||||
const kQRWallFunctionFvPatchField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
zeroGradientFvPatchField<Type>(ptf, p, iF, mapper)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
kQRWallFunctionFvPatchField<Type>::kQRWallFunctionFvPatchField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
zeroGradientFvPatchField<Type>(p, iF, dict)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
kQRWallFunctionFvPatchField<Type>::kQRWallFunctionFvPatchField
|
||||
(
|
||||
const kQRWallFunctionFvPatchField& tkqrwfpf
|
||||
)
|
||||
:
|
||||
zeroGradientFvPatchField<Type>(tkqrwfpf)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
kQRWallFunctionFvPatchField<Type>::kQRWallFunctionFvPatchField
|
||||
(
|
||||
const kQRWallFunctionFvPatchField& tkqrwfpf,
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
)
|
||||
:
|
||||
zeroGradientFvPatchField<Type>(tkqrwfpf, iF)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void kQRWallFunctionFvPatchField<Type>::evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType
|
||||
)
|
||||
{
|
||||
zeroGradientFvPatchField<Type>::evaluate(commsType);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void kQRWallFunctionFvPatchField<Type>::write(Ostream& os) const
|
||||
{
|
||||
zeroGradientFvPatchField<Type>::write(os);
|
||||
this->writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,170 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::compressible::RASModels::kQRWallFunctionFvPatchField
|
||||
|
||||
Description
|
||||
Boundary condition for turbulence k, Q, and R when using wall functions.
|
||||
Simply acts as a zero gradient condition.
|
||||
|
||||
SourceFiles
|
||||
kQRWallFunctionFvPatchField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef kQRWallFunctionFvPatchField_H
|
||||
#define kQRWallFunctionFvPatchField_H
|
||||
|
||||
#include "zeroGradientFvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class kQRWallFunctionFvPatchField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class kQRWallFunctionFvPatchField
|
||||
:
|
||||
public zeroGradientFvPatchField<Type>
|
||||
{
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Check the type of the patch
|
||||
void checkType();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("kQRWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
kQRWallFunctionFvPatchField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<Type, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
kQRWallFunctionFvPatchField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<Type, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// kQRWallFunctionFvPatchField
|
||||
// onto a new patch
|
||||
kQRWallFunctionFvPatchField
|
||||
(
|
||||
const kQRWallFunctionFvPatchField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<Type, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
kQRWallFunctionFvPatchField
|
||||
(
|
||||
const kQRWallFunctionFvPatchField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchField<Type> > clone() const
|
||||
{
|
||||
return tmp<fvPatchField<Type> >
|
||||
(
|
||||
new kQRWallFunctionFvPatchField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
kQRWallFunctionFvPatchField
|
||||
(
|
||||
const kQRWallFunctionFvPatchField&,
|
||||
const DimensionedField<Type, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchField<Type> > clone
|
||||
(
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchField<Type> >
|
||||
(
|
||||
new kQRWallFunctionFvPatchField(*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 RASModels
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "kQRWallFunctionFvPatchField.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,51 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "kQRWallFunctionFvPatchFields.H"
|
||||
#include "fvPatchFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
makePatchFields(kQRWallFunction);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,56 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef kQRWallFunctionFvPatchFields_H
|
||||
#define kQRWallFunctionFvPatchFields_H
|
||||
|
||||
#include "kQRWallFunctionFvPatchField.H"
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeFieldTypedefs(kQRWallFunction)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,248 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "mutRoughWallFunctionFvPatchScalarField.H"
|
||||
#include "RASModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
scalar mutRoughWallFunctionFvPatchScalarField::fnRough
|
||||
(
|
||||
const scalar KsPlus,
|
||||
const scalar Cs,
|
||||
const scalar kappa
|
||||
) const
|
||||
{
|
||||
// Set deltaB based on non-dimensional roughness height
|
||||
scalar deltaB = 0.0;
|
||||
if (KsPlus < 90.0)
|
||||
{
|
||||
deltaB =
|
||||
1.0/kappa
|
||||
*log((KsPlus - 2.25)/87.75 + Cs*KsPlus)
|
||||
*sin(0.4258*(log(KsPlus) - 0.811));
|
||||
}
|
||||
else
|
||||
{
|
||||
deltaB = 1.0/kappa*log(1.0 + Cs*KsPlus);
|
||||
}
|
||||
|
||||
return exp(min(deltaB*kappa, 50.0));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
mutRoughWallFunctionFvPatchScalarField::
|
||||
mutRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
Ks_(p.size(), 0.0),
|
||||
Cs_(p.size(), 0.0)
|
||||
{}
|
||||
|
||||
|
||||
mutRoughWallFunctionFvPatchScalarField::
|
||||
mutRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutRoughWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||
Ks_(ptf.Ks_, mapper),
|
||||
Cs_(ptf.Cs_, mapper)
|
||||
{}
|
||||
|
||||
|
||||
mutRoughWallFunctionFvPatchScalarField::
|
||||
mutRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict),
|
||||
Ks_("Ks", dict, p.size()),
|
||||
Cs_("Cs", dict, p.size())
|
||||
{}
|
||||
|
||||
|
||||
mutRoughWallFunctionFvPatchScalarField::
|
||||
mutRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutRoughWallFunctionFvPatchScalarField& nrwfpsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(nrwfpsf),
|
||||
Ks_(nrwfpsf.Ks_),
|
||||
Cs_(nrwfpsf.Cs_)
|
||||
{}
|
||||
|
||||
|
||||
mutRoughWallFunctionFvPatchScalarField::
|
||||
mutRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutRoughWallFunctionFvPatchScalarField& nrwfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(nrwfpsf, iF),
|
||||
Ks_(nrwfpsf.Ks_),
|
||||
Cs_(nrwfpsf.Cs_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void mutRoughWallFunctionFvPatchScalarField::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchScalarField::autoMap(m);
|
||||
Ks_.autoMap(m);
|
||||
Cs_.autoMap(m);
|
||||
}
|
||||
|
||||
|
||||
void mutRoughWallFunctionFvPatchScalarField::rmap
|
||||
(
|
||||
const fvPatchScalarField& ptf,
|
||||
const labelList& addr
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchScalarField::rmap(ptf, addr);
|
||||
|
||||
const mutRoughWallFunctionFvPatchScalarField& nrwfpsf =
|
||||
refCast<const mutRoughWallFunctionFvPatchScalarField>(ptf);
|
||||
|
||||
Cs_.rmap(nrwfpsf.Cs_, addr);
|
||||
Ks_.rmap(nrwfpsf.Ks_, addr);
|
||||
}
|
||||
|
||||
|
||||
void mutRoughWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
const RASModel& ras = db().lookupObject<RASModel>("RASProperties");
|
||||
|
||||
const scalar Cmu = ras.Cmu().value();
|
||||
const scalar Cmu25 = pow(Cmu, 0.25);
|
||||
const scalar kappa = ras.kappa().value();
|
||||
const scalar E = ras.E().value();
|
||||
scalar yPlusLam = ras.yPlusLam();
|
||||
|
||||
const scalarField& y = ras.y()[patch().index()];
|
||||
|
||||
const scalarField& rhow =
|
||||
patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||
|
||||
const scalarField& k = db().lookupObject<volScalarField>("k");
|
||||
|
||||
const scalarField& muw =
|
||||
patch().lookupPatchField<volScalarField, scalar>("mu");
|
||||
|
||||
scalarField& mutw = *this;
|
||||
|
||||
forAll(mutw, faceI)
|
||||
{
|
||||
label faceCellI = patch().faceCells()[faceI];
|
||||
|
||||
scalar uStar = Cmu25*sqrt(k[faceCellI]);
|
||||
|
||||
scalar yPlus = uStar*y[faceI]/(muw[faceI]/rhow[faceI]);
|
||||
|
||||
scalar KsPlus = uStar*Ks_[faceI]/(muw[faceI]/rhow[faceI]);
|
||||
|
||||
scalar Edash = E;
|
||||
scalar yPlusLamNew = yPlusLam;
|
||||
if (KsPlus > 2.25)
|
||||
{
|
||||
Edash = E/fnRough(KsPlus, Cs_[faceI], kappa);
|
||||
yPlusLam = ras.yPlusLam(kappa, Edash);
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "yPlus = " << yPlus
|
||||
<< ", KsPlus = " << KsPlus
|
||||
<< ", Edash = " << Edash
|
||||
<< ", yPlusLam = " << yPlusLam
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (yPlus > yPlusLamNew)
|
||||
{
|
||||
mutw[faceI] = muw[faceI]*(yPlus*kappa/log(Edash*yPlus) - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mutw[faceI] = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void mutRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
Cs_.writeEntry("Cs", os);
|
||||
Ks_.writeEntry("Ks", os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField(fvPatchScalarField, mutRoughWallFunctionFvPatchScalarField);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,194 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::compressible::RASModels::nutRoughWallFunctionFvPatchScalarField
|
||||
|
||||
Description
|
||||
Boundary condition for turbulent (kinematic) viscosity when using wall
|
||||
functions for rough walls.
|
||||
|
||||
Manipulates the E parameter to account for roughness effects, based on
|
||||
KsPlus.
|
||||
|
||||
- roughness height = sand-grain roughness (0 for smooth walls)
|
||||
- roughness constant = 0.5-1.0 (0.5 default)
|
||||
|
||||
SourceFiles
|
||||
mutRoughWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef mutRoughWallFunctionFvPatchScalarField_H
|
||||
#define mutRoughWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class mutRoughWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class mutRoughWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Roughness height
|
||||
scalarField Ks_;
|
||||
|
||||
//- Roughness constant
|
||||
scalarField Cs_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Compute the roughness function
|
||||
scalar fnRough
|
||||
(
|
||||
const scalar KsPlus,
|
||||
const scalar Cs,
|
||||
const scalar kappa
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("mutRoughWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
mutRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
mutRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// mutRoughWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
mutRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutRoughWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
mutRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutRoughWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new mutRoughWallFunctionFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
mutRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutRoughWallFunctionFvPatchScalarField&,
|
||||
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 mutRoughWallFunctionFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
virtual void autoMap
|
||||
(
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
virtual void rmap
|
||||
(
|
||||
const fvPatchScalarField&,
|
||||
const labelList&
|
||||
);
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -24,7 +24,7 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "mutStandardRoughWallFunctionFvPatchScalarField.H"
|
||||
#include "mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.H"
|
||||
#include "RASModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
@ -41,8 +41,8 @@ namespace RASModels
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
mutStandardRoughWallFunctionFvPatchScalarField::
|
||||
mutStandardRoughWallFunctionFvPatchScalarField
|
||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::
|
||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
@ -55,10 +55,10 @@ mutStandardRoughWallFunctionFvPatchScalarField
|
||||
{}
|
||||
|
||||
|
||||
mutStandardRoughWallFunctionFvPatchScalarField::
|
||||
mutStandardRoughWallFunctionFvPatchScalarField
|
||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::
|
||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutStandardRoughWallFunctionFvPatchScalarField& ptf,
|
||||
const mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
@ -71,8 +71,8 @@ mutStandardRoughWallFunctionFvPatchScalarField
|
||||
{}
|
||||
|
||||
|
||||
mutStandardRoughWallFunctionFvPatchScalarField::
|
||||
mutStandardRoughWallFunctionFvPatchScalarField
|
||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::
|
||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
@ -86,10 +86,10 @@ mutStandardRoughWallFunctionFvPatchScalarField
|
||||
{}
|
||||
|
||||
|
||||
mutStandardRoughWallFunctionFvPatchScalarField::
|
||||
mutStandardRoughWallFunctionFvPatchScalarField
|
||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::
|
||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutStandardRoughWallFunctionFvPatchScalarField& tppsf
|
||||
const mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField& tppsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(tppsf),
|
||||
@ -99,10 +99,10 @@ mutStandardRoughWallFunctionFvPatchScalarField
|
||||
{}
|
||||
|
||||
|
||||
mutStandardRoughWallFunctionFvPatchScalarField::
|
||||
mutStandardRoughWallFunctionFvPatchScalarField
|
||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::
|
||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutStandardRoughWallFunctionFvPatchScalarField& tppsf,
|
||||
const mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField& tppsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
@ -115,7 +115,7 @@ mutStandardRoughWallFunctionFvPatchScalarField
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void mutStandardRoughWallFunctionFvPatchScalarField::evaluate
|
||||
void mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::evaluate
|
||||
(
|
||||
const Pstream::commsTypes
|
||||
)
|
||||
@ -282,7 +282,10 @@ void mutStandardRoughWallFunctionFvPatchScalarField::evaluate
|
||||
}
|
||||
|
||||
|
||||
void mutStandardRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
void mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
fixedValueFvPatchScalarField::write(os);
|
||||
os.writeKeyword("roughnessHeight")
|
||||
@ -299,7 +302,7 @@ void mutStandardRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
mutStandardRoughWallFunctionFvPatchScalarField
|
||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -23,18 +23,19 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::compressible::RASModels::mutStandardRoughWallFunctionFvPatchScalarField
|
||||
Foam::compressible::RASModels::
|
||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
|
||||
Description
|
||||
Wall function boundary condition for rough walls
|
||||
|
||||
SourceFiles
|
||||
mutStandardWallFunctionFvPatchScalarField.C
|
||||
mutSpalartAllamarasStandardWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef mutStandardRoughWallFunctionFvPatchScalarField_H
|
||||
#define mutStandardRoughWallFunctionFvPatchScalarField_H
|
||||
#ifndef mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H
|
||||
#define mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
@ -48,10 +49,10 @@ namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class mutWallFunctionFvPatch Declaration
|
||||
Class mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class mutStandardRoughWallFunctionFvPatchScalarField
|
||||
class mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
{
|
||||
@ -65,41 +66,41 @@ class mutStandardRoughWallFunctionFvPatchScalarField
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("mutStandardRoughWallFunction");
|
||||
TypeName("mutSpalartAllmarasStandardRoughWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
mutStandardRoughWallFunctionFvPatchScalarField
|
||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
mutStandardRoughWallFunctionFvPatchScalarField
|
||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// mutStandardRoughWallFunctionFvPatchScalarField
|
||||
//- Construct by mapping given
|
||||
// mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
mutStandardRoughWallFunctionFvPatchScalarField
|
||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutStandardRoughWallFunctionFvPatchScalarField&,
|
||||
const mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
mutStandardRoughWallFunctionFvPatchScalarField
|
||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutStandardRoughWallFunctionFvPatchScalarField&
|
||||
const mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
@ -107,14 +108,17 @@ public:
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new mutStandardRoughWallFunctionFvPatchScalarField(*this)
|
||||
new mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
mutStandardRoughWallFunctionFvPatchScalarField
|
||||
mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutStandardRoughWallFunctionFvPatchScalarField&,
|
||||
const mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
@ -126,7 +130,11 @@ public:
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new mutStandardRoughWallFunctionFvPatchScalarField(*this, iF)
|
||||
new mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -0,0 +1,175 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "mutSpalartAllmarasStandardWallFunctionFvPatchScalarField.H"
|
||||
#include "RASModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutSpalartAllmarasStandardWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
|
||||
{}
|
||||
|
||||
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict)
|
||||
{}
|
||||
|
||||
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutSpalartAllmarasStandardWallFunctionFvPatchScalarField& tppsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(tppsf)
|
||||
{}
|
||||
|
||||
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutSpalartAllmarasStandardWallFunctionFvPatchScalarField& tppsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(tppsf, iF)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void mutSpalartAllmarasStandardWallFunctionFvPatchScalarField::evaluate
|
||||
(
|
||||
const Pstream::commsTypes
|
||||
)
|
||||
{
|
||||
const RASModel& ras = db().lookupObject<RASModel>("RASProperties");
|
||||
|
||||
scalar kappa = ras.kappa().value();
|
||||
scalar E = ras.E().value();
|
||||
scalar yPlusLam = ras.yPlusLam();
|
||||
|
||||
const scalarField& ry = patch().deltaCoeffs();
|
||||
|
||||
const fvPatchVectorField& U =
|
||||
patch().lookupPatchField<volVectorField, vector>("U");
|
||||
|
||||
scalarField magUp = mag(U.patchInternalField() - U);
|
||||
|
||||
const scalarField& rhow =
|
||||
patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||
|
||||
const scalarField& muw =
|
||||
patch().lookupPatchField<volScalarField, scalar>("mu");
|
||||
scalarField& mutw = *this;
|
||||
|
||||
scalarField magFaceGradU = mag(U.snGrad());
|
||||
|
||||
forAll(mutw, faceI)
|
||||
{
|
||||
scalar magUpara = magUp[faceI];
|
||||
|
||||
scalar kappaRe = kappa*magUpara/((muw[faceI]/rhow[faceI])*ry[faceI]);
|
||||
|
||||
scalar yPlus = yPlusLam;
|
||||
scalar ryPlusLam = 1.0/yPlus;
|
||||
|
||||
int iter = 0;
|
||||
scalar yPlusLast = 0.0;
|
||||
|
||||
do
|
||||
{
|
||||
yPlusLast = yPlus;
|
||||
yPlus = (kappaRe + yPlus)/(1.0 + log(E*yPlus));
|
||||
|
||||
} while(mag(ryPlusLam*(yPlus - yPlusLast)) > 0.01 && ++iter < 10 );
|
||||
|
||||
if (yPlus > yPlusLam)
|
||||
{
|
||||
mutw[faceI] = muw[faceI]*(yPlus*kappa/log(E*yPlus) - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mutw[faceI] = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,158 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::compressible::RASModels::
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
|
||||
Description
|
||||
Wall function boundary condition for walls
|
||||
|
||||
SourceFiles
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef mutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H
|
||||
#define mutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class mutSpalartAllmarasStandardWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("mutSpalartAllmarasStandardWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutSpalartAllmarasStandardWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutSpalartAllmarasStandardWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutSpalartAllmarasStandardWallFunctionFvPatchScalarField&,
|
||||
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 mutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Evaluate the patchField
|
||||
virtual void evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType=Pstream::blocking
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,187 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "mutSpalartAllmarasWallFunctionFvPatchScalarField.H"
|
||||
#include "RASModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField::
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField::
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutSpalartAllmarasWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
|
||||
{}
|
||||
|
||||
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField::
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict)
|
||||
{}
|
||||
|
||||
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField::
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutSpalartAllmarasWallFunctionFvPatchScalarField& tppsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(tppsf)
|
||||
{}
|
||||
|
||||
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField::
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutSpalartAllmarasWallFunctionFvPatchScalarField& tppsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(tppsf, iF)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void mutSpalartAllmarasWallFunctionFvPatchScalarField::evaluate
|
||||
(
|
||||
const Pstream::commsTypes
|
||||
)
|
||||
{
|
||||
const RASModel& ras = db().lookupObject<RASModel>("RASProperties");
|
||||
|
||||
scalar kappa = ras.kappa().value();
|
||||
scalar E = ras.E().value();
|
||||
|
||||
const scalarField& ry = patch().deltaCoeffs();
|
||||
|
||||
const fvPatchVectorField& U =
|
||||
patch().lookupPatchField<volVectorField, vector>("U");
|
||||
|
||||
scalarField magUp = mag(U.patchInternalField() - U);
|
||||
|
||||
const scalarField& rhow =
|
||||
patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||
|
||||
const scalarField& muw =
|
||||
patch().lookupPatchField<volScalarField, scalar>("mu");
|
||||
|
||||
scalarField& mutw = *this;
|
||||
|
||||
scalarField magFaceGradU = mag(U.snGrad());
|
||||
|
||||
forAll(mutw, faceI)
|
||||
{
|
||||
scalar magUpara = magUp[faceI];
|
||||
|
||||
scalar utau =
|
||||
sqrt((mutw[faceI] + muw[faceI])*magFaceGradU[faceI]/rhow[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]*(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);
|
||||
|
||||
mutw[faceI] = max
|
||||
(
|
||||
rhow[faceI]*sqr(max(utau, 0))/magFaceGradU[faceI]- muw[faceI],
|
||||
0.0
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
mutw[faceI] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField(fvPatchScalarField, mutSpalartAllmarasWallFunctionFvPatchScalarField);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,150 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::compressible::RASModels::
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||
|
||||
Description
|
||||
Wall function boundary condition for walls
|
||||
|
||||
SourceFiles
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef mutSpalartAllmarasWallFunctionFvPatchScalarField_H
|
||||
#define mutSpalartAllmarasWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class mutSpalartAllmarasWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
{
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("mutSpalartAllmarasWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutSpalartAllmarasWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutSpalartAllmarasWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new mutSpalartAllmarasWallFunctionFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
mutSpalartAllmarasWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutSpalartAllmarasWallFunctionFvPatchScalarField&,
|
||||
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 mutSpalartAllmarasWallFunctionFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Evaluate the patchField
|
||||
virtual void evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType=Pstream::blocking
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,162 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "mutWallFunctionFvPatchScalarField.H"
|
||||
#include "RASModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
mutWallFunctionFvPatchScalarField::
|
||||
mutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
mutWallFunctionFvPatchScalarField::
|
||||
mutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
|
||||
{}
|
||||
|
||||
|
||||
mutWallFunctionFvPatchScalarField::
|
||||
mutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict)
|
||||
{}
|
||||
|
||||
|
||||
mutWallFunctionFvPatchScalarField::
|
||||
mutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutWallFunctionFvPatchScalarField& tppsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(tppsf)
|
||||
{}
|
||||
|
||||
|
||||
mutWallFunctionFvPatchScalarField::
|
||||
mutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutWallFunctionFvPatchScalarField& tppsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(tppsf, iF)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void mutWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
const RASModel& ras = db().lookupObject<RASModel>("RASProperties");
|
||||
|
||||
const scalar Cmu = ras.Cmu().value();
|
||||
const scalar Cmu25 = pow(Cmu, 0.25);
|
||||
const scalar kappa = ras.kappa().value();
|
||||
const scalar E = ras.E().value();
|
||||
const scalar yPlusLam = ras.yPlusLam();
|
||||
|
||||
const scalarField& y = ras.y()[patch().index()];
|
||||
|
||||
const scalarField& rhow =
|
||||
patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||
|
||||
const volScalarField& k = db().lookupObject<volScalarField>("k");
|
||||
|
||||
const scalarField& muw =
|
||||
patch().lookupPatchField<volScalarField, scalar>("mu");
|
||||
|
||||
scalarField& mutw = *this;
|
||||
|
||||
forAll(mutw, faceI)
|
||||
{
|
||||
label faceCellI = patch().faceCells()[faceI];
|
||||
|
||||
scalar yPlus =
|
||||
Cmu25*y[faceI]*sqrt(k[faceCellI])
|
||||
/(muw[faceI]/rhow[faceI]);
|
||||
|
||||
if (yPlus > yPlusLam)
|
||||
{
|
||||
mutw[faceI] = muw[faceI]*(yPlus*kappa/log(E*yPlus) - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mutw[faceI] = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void mutWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<scalar>::write(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField(fvPatchScalarField, mutWallFunctionFvPatchScalarField);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,155 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::compressible::RASModels::mutWallFunctionFvPatchScalarField
|
||||
|
||||
Description
|
||||
Boundary condition for turbulent (kinematic) viscosity when using wall
|
||||
functions
|
||||
- replicates OpenFOAM v1.5 (and earlier) behaviour
|
||||
|
||||
SourceFiles
|
||||
mutWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef mutWallFunctionFvPatchScalarField_H
|
||||
#define mutWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class mutWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class mutWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("mutWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
mutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
mutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// mutWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
mutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
mutWallFunctionFvPatchScalarField
|
||||
(
|
||||
const mutWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new mutWallFunctionFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
mutWallFunctionFvPatchScalarField
|
||||
(
|
||||
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 mutWallFunctionFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,205 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "omegaWallFunctionFvPatchScalarField.H"
|
||||
#include "RASModel.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "wallFvPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void omegaWallFunctionFvPatchScalarField::checkType()
|
||||
{
|
||||
if (!isA<wallFvPatch>(patch()))
|
||||
{
|
||||
FatalErrorIn("omegaWallFunctionFvPatchScalarField::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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(p, iF)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const omegaWallFunctionFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(p, iF, dict)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const omegaWallFunctionFvPatchScalarField& ewfpsf
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(ewfpsf)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const omegaWallFunctionFvPatchScalarField& ewfpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(ewfpsf, iF)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void omegaWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
const RASModel& ras = db().lookupObject<RASModel>("RASProperties");
|
||||
|
||||
const scalar Cmu = ras.Cmu().value();
|
||||
const scalar Cmu25 = pow(Cmu, 0.25);
|
||||
|
||||
const scalar kappa = ras.kappa().value();
|
||||
const scalar yPlusLam = ras.yPlusLam();
|
||||
|
||||
const scalarField& y = ras.y()[patch().index()];
|
||||
|
||||
volScalarField& G = const_cast<volScalarField&>
|
||||
(db().lookupObject<volScalarField>("G"));
|
||||
|
||||
volScalarField& omega = const_cast<volScalarField&>
|
||||
(db().lookupObject<volScalarField>("omega"));
|
||||
|
||||
const scalarField& k = db().lookupObject<volScalarField>("k");
|
||||
|
||||
const scalarField& rhow =
|
||||
patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||
|
||||
const scalarField& muw =
|
||||
patch().lookupPatchField<volScalarField, scalar>("mu");
|
||||
|
||||
const scalarField& mutw =
|
||||
patch().lookupPatchField<volScalarField, scalar>("mut");
|
||||
|
||||
const fvPatchVectorField& Uw =
|
||||
patch().lookupPatchField<volVectorField, vector>("U");
|
||||
|
||||
const scalarField magGradUw = mag(Uw.snGrad());
|
||||
|
||||
// Set epsilon and G
|
||||
forAll(mutw, faceI)
|
||||
{
|
||||
label faceCellI = patch().faceCells()[faceI];
|
||||
|
||||
scalar yPlus =
|
||||
Cmu25*y[faceCellI]*sqrt(k[faceCellI])
|
||||
/(muw[faceI]/rhow[faceI]);
|
||||
|
||||
omega[faceCellI] = sqrt(k[faceCellI])/(Cmu25*kappa*y[faceCellI]);
|
||||
|
||||
if (yPlus > yPlusLam)
|
||||
{
|
||||
G[faceCellI] =
|
||||
(mutw[faceI] + muw[faceI])
|
||||
*magGradUw[faceI]
|
||||
*Cmu25*sqrt(k[faceCellI])
|
||||
/(kappa*y[faceCellI]);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: perform averaging for cells sharing more than one boundary face
|
||||
}
|
||||
|
||||
|
||||
void omegaWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fixedInternalValueFvPatchField<scalar>::write(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
omegaWallFunctionFvPatchScalarField
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,159 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::compressible::RASModels::omegaWallFunctionFvPatchScalarField
|
||||
|
||||
Description
|
||||
Replaces functionality in wallFunctionsI.H
|
||||
|
||||
SourceFiles
|
||||
omegaWallFunctionFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef omegaWallFunctionFvPatchScalarField_H
|
||||
#define omegaWallFunctionFvPatchScalarField_H
|
||||
|
||||
#include "fixedInternalValueFvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace compressible
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class omegaWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class omegaWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedInternalValueFvPatchField<scalar>
|
||||
{
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Check the type of the patch
|
||||
void checkType();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("omegaWallFunction");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// omegaWallFunctionFvPatchScalarField
|
||||
// onto a new patch
|
||||
omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const omegaWallFunctionFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const omegaWallFunctionFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new omegaWallFunctionFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
omegaWallFunctionFvPatchScalarField
|
||||
(
|
||||
const omegaWallFunctionFvPatchScalarField&,
|
||||
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 omegaWallFunctionFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace compressible
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -151,13 +151,14 @@ kEpsilon::kEpsilon
|
||||
"mut",
|
||||
runTime_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_)
|
||||
mesh_
|
||||
)
|
||||
{
|
||||
# include "wallViscosityI.H"
|
||||
mut_ = Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||
mut_.correctBoundaryConditions();
|
||||
|
||||
printCoeffs();
|
||||
}
|
||||
@ -243,7 +244,7 @@ void kEpsilon::correct()
|
||||
{
|
||||
// Re-calculate viscosity
|
||||
mut_ = rho_*Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||
# include "wallViscosityI.H"
|
||||
mut_.correctBoundaryConditions();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -257,10 +258,11 @@ void kEpsilon::correct()
|
||||
}
|
||||
|
||||
tmp<volTensorField> tgradU = fvc::grad(U_);
|
||||
volScalarField G = mut_*(tgradU() && dev(twoSymm(tgradU())));
|
||||
volScalarField G("G", mut_*(tgradU() && dev(twoSymm(tgradU()))));
|
||||
tgradU.clear();
|
||||
|
||||
# include "wallFunctionsI.H"
|
||||
// Update espsilon and G at the wall
|
||||
epsilon_.boundaryField().updateCoeffs();
|
||||
|
||||
// Dissipation equation
|
||||
tmp<fvScalarMatrix> epsEqn
|
||||
@ -274,10 +276,10 @@ void kEpsilon::correct()
|
||||
- fvm::Sp(C2_*rho_*epsilon_/k_, epsilon_)
|
||||
);
|
||||
|
||||
# include "wallDissipationI.H"
|
||||
|
||||
epsEqn().relax();
|
||||
|
||||
epsEqn().boundaryManipulate(epsilon_.boundaryField());
|
||||
|
||||
solve(epsEqn);
|
||||
bound(epsilon_, epsilon0_);
|
||||
|
||||
@ -302,9 +304,7 @@ void kEpsilon::correct()
|
||||
|
||||
// Re-calculate viscosity
|
||||
mut_ = rho_*Cmu_*sqr(k_)/epsilon_;
|
||||
|
||||
# include "wallViscosityI.H"
|
||||
|
||||
mut_.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -254,13 +254,14 @@ kOmegaSST::kOmegaSST
|
||||
"mut",
|
||||
runTime_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
a1_*rho_*k_/max(a1_*omega_, F2()*sqrt(magSqr(symm(fvc::grad(U_)))))
|
||||
mesh_
|
||||
)
|
||||
{
|
||||
# include "kOmegaWallViscosityI.H"
|
||||
mut_ = a1_*rho_*k_/max(a1_*omega_, F2()*sqrt(magSqr(symm(fvc::grad(U_)))));
|
||||
mut_.correctBoundaryConditions();
|
||||
|
||||
printCoeffs();
|
||||
}
|
||||
@ -353,7 +354,8 @@ void kOmegaSST::correct()
|
||||
mut_ =
|
||||
a1_*rho_*k_
|
||||
/max(a1_*omega_, F2()*sqrt(magSqr(symm(fvc::grad(U_)))));
|
||||
# include "kOmegaWallViscosityI.H"
|
||||
mut_.correctBoundaryConditions();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -374,10 +376,11 @@ void kOmegaSST::correct()
|
||||
tmp<volTensorField> tgradU = fvc::grad(U_);
|
||||
volScalarField S2 = magSqr(symm(tgradU()));
|
||||
volScalarField GbyMu = (tgradU() && dev(twoSymm(tgradU())));
|
||||
volScalarField G = mut_*GbyMu;
|
||||
volScalarField G("G", mut_*GbyMu);
|
||||
tgradU.clear();
|
||||
|
||||
# include "kOmegaWallFunctionsI.H"
|
||||
// Update omega and G at the wall
|
||||
omega_.boundaryField().updateCoeffs();
|
||||
|
||||
volScalarField CDkOmega =
|
||||
(2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_;
|
||||
@ -404,7 +407,7 @@ void kOmegaSST::correct()
|
||||
|
||||
omegaEqn().relax();
|
||||
|
||||
# include "wallOmegaI.H"
|
||||
omegaEqn().boundaryManipulate(omega_.boundaryField());
|
||||
|
||||
solve(omegaEqn);
|
||||
bound(omega_, omega0_);
|
||||
@ -428,9 +431,7 @@ void kOmegaSST::correct()
|
||||
|
||||
// Re-calculate viscosity
|
||||
mut_ = a1_*rho_*k_/max(a1_*omega_, F2()*sqrt(S2));
|
||||
|
||||
# include "kOmegaWallViscosityI.H"
|
||||
|
||||
mut_.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -183,15 +183,17 @@ realizableKE::realizableKE
|
||||
"mut",
|
||||
runTime_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
rCmu(fvc::grad(U_))*rho_*sqr(k_)/(epsilon_ + epsilonSmall_)
|
||||
mesh_
|
||||
)
|
||||
{
|
||||
bound(k_, k0_);
|
||||
bound(epsilon_, epsilon0_);
|
||||
# include "wallViscosityI.H"
|
||||
|
||||
mut_ = rCmu(fvc::grad(U_))*rho_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||
mut_.correctBoundaryConditions();
|
||||
|
||||
printCoeffs();
|
||||
}
|
||||
@ -275,6 +277,7 @@ void realizableKE::correct()
|
||||
{
|
||||
// Re-calculate viscosity
|
||||
mut_ = rCmu(fvc::grad(U_))*rho_*sqr(k_)/epsilon_;
|
||||
mut_.correctBoundaryConditions();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -294,9 +297,10 @@ void realizableKE::correct()
|
||||
volScalarField eta = magS*k_/epsilon_;
|
||||
volScalarField C1 = max(eta/(scalar(5) + eta), scalar(0.43));
|
||||
|
||||
volScalarField G = mut_*(gradU && dev(twoSymm(gradU)));
|
||||
volScalarField G("G", mut_*(gradU && dev(twoSymm(gradU))));
|
||||
|
||||
# include "wallFunctionsI.H"
|
||||
// Update espsilon and G at the wall
|
||||
epsilon_.boundaryField().updateCoeffs();
|
||||
|
||||
// Dissipation equation
|
||||
tmp<fvScalarMatrix> epsEqn
|
||||
@ -315,7 +319,7 @@ void realizableKE::correct()
|
||||
|
||||
epsEqn().relax();
|
||||
|
||||
# include "wallDissipationI.H"
|
||||
epsEqn().boundaryManipulate(epsilon_.boundaryField());
|
||||
|
||||
solve(epsEqn);
|
||||
bound(epsilon_, epsilon0_);
|
||||
@ -339,9 +343,7 @@ void realizableKE::correct()
|
||||
|
||||
// Re-calculate viscosity
|
||||
mut_ = rCmu(gradU, S2, magS)*rho_*sqr(k_)/epsilon_;
|
||||
|
||||
# include "wallViscosityI.H"
|
||||
|
||||
mut_.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -188,7 +188,7 @@ LRR::LRR
|
||||
mesh_
|
||||
)
|
||||
{
|
||||
nut_ == Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||
nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||
nut_.correctBoundaryConditions();
|
||||
|
||||
if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
|
||||
|
||||
@ -217,7 +217,7 @@ LaunderGibsonRSTM::LaunderGibsonRSTM
|
||||
mesh_
|
||||
)
|
||||
{
|
||||
nut_ == Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||
nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||
nut_.correctBoundaryConditions();
|
||||
|
||||
if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0)
|
||||
|
||||
@ -179,13 +179,25 @@ LienCubicKE::LienCubicKE
|
||||
|
||||
C5viscosity_
|
||||
(
|
||||
-2.0*pow(Cmu_, 3.0)*pow(k_, 4.0)/pow(epsilon_, 3.0)*
|
||||
(magSqr(gradU_ + gradU_.T()) - magSqr(gradU_ - gradU_.T()))
|
||||
- 2.0*pow3(Cmu_)*pow4(k_)/pow3(epsilon_)
|
||||
*(
|
||||
magSqr(gradU_ + gradU_.T())
|
||||
- magSqr(gradU_ - gradU_.T())
|
||||
)
|
||||
),
|
||||
|
||||
// C5 term, implicit
|
||||
nut_(Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_) + C5viscosity_),
|
||||
// turbulent viscosity, with implicit part of C5
|
||||
nut_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"nut",
|
||||
runTime_.timeName(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh_
|
||||
),
|
||||
|
||||
nonlinearStress_
|
||||
(
|
||||
@ -215,7 +227,8 @@ LienCubicKE::LienCubicKE
|
||||
)
|
||||
)
|
||||
{
|
||||
# include "wallNonlinearViscosityI.H"
|
||||
nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_) + C5viscosity_;
|
||||
nut_.correctBoundaryConditions();
|
||||
|
||||
printCoeffs();
|
||||
}
|
||||
@ -315,9 +328,14 @@ void LienCubicKE::correct()
|
||||
// generation term
|
||||
volScalarField S2 = symm(gradU_) && gradU_;
|
||||
|
||||
volScalarField G = Cmu_*sqr(k_)/epsilon_*S2 - (nonlinearStress_ && gradU_);
|
||||
volScalarField G
|
||||
(
|
||||
"G",
|
||||
Cmu_*sqr(k_)/epsilon_*S2 - (nonlinearStress_ && gradU_)
|
||||
);
|
||||
|
||||
# include "nonLinearWallFunctionsI.H"
|
||||
// Update espsilon and G at the wall
|
||||
epsilon_.boundaryField().updateCoeffs();
|
||||
|
||||
// Dissipation equation
|
||||
tmp<fvScalarMatrix> epsEqn
|
||||
@ -332,7 +350,7 @@ void LienCubicKE::correct()
|
||||
|
||||
epsEqn().relax();
|
||||
|
||||
# include "wallDissipationI.H"
|
||||
epsEqn().boundaryManipulate(epsilon_.boundaryField());
|
||||
|
||||
solve(epsEqn);
|
||||
bound(epsilon_, epsilon0_);
|
||||
@ -367,8 +385,7 @@ void LienCubicKE::correct()
|
||||
*(magSqr(gradU_ + gradU_.T()) - magSqr(gradU_ - gradU_.T()));
|
||||
|
||||
nut_ = Cmu_*sqr(k_)/epsilon_ + C5viscosity_;
|
||||
|
||||
# include "wallNonlinearViscosityI.H"
|
||||
nut_.correctBoundaryConditions();
|
||||
|
||||
nonlinearStress_ = symm
|
||||
(
|
||||
|
||||
@ -156,7 +156,7 @@ RNGkEpsilon::RNGkEpsilon
|
||||
mesh_
|
||||
)
|
||||
{
|
||||
nut_ == Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||
nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||
nut_.correctBoundaryConditions();
|
||||
|
||||
printCoeffs();
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::epsilonWallFunctionFvPatchScalarField
|
||||
Foam::incompressible::RASModels::epsilonWallFunctionFvPatchScalarField
|
||||
|
||||
Description
|
||||
Boundary condition for epsilon when using wall functions
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::kQRWallFunctionFvPatchField
|
||||
Foam::incompressible::RASModels::kQRWallFunctionFvPatchField
|
||||
|
||||
Description
|
||||
Boundary condition for turbulence k, Q, and R when using wall functions.
|
||||
|
||||
@ -55,7 +55,7 @@ namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class nutWallFunctionFvPatch Declaration
|
||||
Class nutRoughWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class nutRoughWallFunctionFvPatchScalarField
|
||||
|
||||
@ -49,7 +49,7 @@ namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class nutWallFunctionFvPatch Declaration
|
||||
Class nutSpalartAllmarasStandardWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class nutSpalartAllmarasStandardWallFunctionFvPatchScalarField
|
||||
|
||||
@ -50,7 +50,7 @@ namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class nutWallFunctionFvPatch Declaration
|
||||
Class nutWallFunctionFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class nutWallFunctionFvPatchScalarField
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::omegaWallFunctionFvPatchScalarField
|
||||
Foam::incompressible::RASModels::omegaWallFunctionFvPatchScalarField
|
||||
|
||||
Description
|
||||
Replaces functionality in wallFunctionsI.H
|
||||
|
||||
@ -141,7 +141,7 @@ kOmega::kOmega
|
||||
mesh_
|
||||
)
|
||||
{
|
||||
nut_ == k_/(omega_ + omegaSmall_);
|
||||
nut_ = k_/(omega_ + omegaSmall_);
|
||||
nut_.correctBoundaryConditions();
|
||||
|
||||
printCoeffs();
|
||||
|
||||
@ -250,7 +250,7 @@ kOmegaSST::kOmegaSST
|
||||
mesh_
|
||||
)
|
||||
{
|
||||
nut_ ==
|
||||
nut_ =
|
||||
a1_*k_
|
||||
/max
|
||||
(
|
||||
|
||||
@ -182,7 +182,7 @@ realizableKE::realizableKE
|
||||
bound(k_, k0_);
|
||||
bound(epsilon_, epsilon0_);
|
||||
|
||||
nut_ == rCmu(fvc::grad(U_))*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||
nut_ = rCmu(fvc::grad(U_))*sqr(k_)/(epsilon_ + epsilonSmall_);
|
||||
nut_.correctBoundaryConditions();
|
||||
|
||||
printCoeffs();
|
||||
|
||||
Reference in New Issue
Block a user