From ada4bd4fa57f331ea5f09246c9be768d8b36a23f Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 27 Aug 2008 17:11:38 +0100 Subject: [PATCH] adding new wall function methods --- .../RAS/incompressible/LRR/LRR.C | 26 +- .../LaunderGibsonRSTM/LaunderGibsonRSTM.C | 27 +- .../RAS/incompressible/Make/files | 16 +- .../RAS/incompressible/RASModel/RASModel.C | 14 +- .../RAS/incompressible/RASModel/RASModel.H | 22 +- .../incompressible/RNGkEpsilon/RNGkEpsilon.C | 27 +- .../epsilonWallFunctionFvPatchScalarField.C | 209 ++++++++++++ .../epsilonWallFunctionFvPatchScalarField.H | 162 ++++++++++ .../fixedInternalValueFvPatchField.C | 184 +++++++++++ .../fixedInternalValueFvPatchField.H | 174 ++++++++++ .../fixedInternalValueFvPatchFields.C | 45 +++ .../fixedInternalValueFvPatchFields.H | 50 +++ .../kWallFunctionFvPatchScalarField.C | 155 +++++++++ .../kWallFunctionFvPatchScalarField.H | 161 ++++++++++ .../nutRoughWallFunctionFvPatchScalarField.C | 204 ++++++++++++ .../nutRoughWallFunctionFvPatchScalarField.H | 167 ++++++++++ ...ndardRoughWallFunctionFvPatchScalarField.C | 302 ++++++++++++++++++ ...ndardRoughWallFunctionFvPatchScalarField.H | 208 ++++++++++++ ...asStandardWallFunctionFvPatchScalarField.C | 172 ++++++++++ ...asStandardWallFunctionFvPatchScalarField.H | 160 ++++++++++ ...rtAllmarasWallFunctionFvPatchScalarField.C | 180 +++++++++++ ...rtAllmarasWallFunctionFvPatchScalarField.H | 153 +++++++++ .../nutWallFunctionFvPatchScalarField.C | 157 +++++++++ .../nutWallFunctionFvPatchScalarField.H | 154 +++++++++ .../omegaWallFunctionFvPatchScalarField.C | 200 ++++++++++++ .../omegaWallFunctionFvPatchScalarField.H | 159 +++++++++ .../RAS/incompressible/kEpsilon/kEpsilon.C | 27 +- .../RAS/incompressible/kOmegaSST/kOmegaSST.C | 33 +- .../realizableKE/realizableKE.C | 28 +- 29 files changed, 3522 insertions(+), 54 deletions(-) create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/fixedInternalValueFvPatchField/fixedInternalValueFvPatchField.C create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/fixedInternalValueFvPatchField/fixedInternalValueFvPatchField.H create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.C create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.H create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/kWallFunctions/kWallFunction/kWallFunctionFvPatchScalarField.C create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/kWallFunctions/kWallFunction/kWallFunctionFvPatchScalarField.H create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutRoughWallFunction/nutRoughWallFunctionFvPatchScalarField.C create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutRoughWallFunction/nutRoughWallFunctionFvPatchScalarField.H create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardRoughWallFunction/nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.C create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardRoughWallFunction/nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.H create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardWallFunction/nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardWallFunction/nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.H create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasWallFunction/nutSpalartAllmarasWallFunctionFvPatchScalarField.C create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasWallFunction/nutSpalartAllmarasWallFunctionFvPatchScalarField.H create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.H create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C create mode 100644 src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H diff --git a/src/turbulenceModels/RAS/incompressible/LRR/LRR.C b/src/turbulenceModels/RAS/incompressible/LRR/LRR.C index 45384f3612..6a6aad2333 100644 --- a/src/turbulenceModels/RAS/incompressible/LRR/LRR.C +++ b/src/turbulenceModels/RAS/incompressible/LRR/LRR.C @@ -175,9 +175,21 @@ LRR::LRR mesh_ ), - nut_(Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_)) + nut_ + ( + IOobject + ( + "nut", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ) { -# include "wallViscosityI.H" + nut_ == Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); + nut_.correctBoundaryConditions(); if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0) { @@ -289,9 +301,10 @@ void LRR::correct() 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 epsEqn @@ -307,7 +320,7 @@ void LRR::correct() epsEqn().relax(); -# include "wallDissipationI.H" + epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); bound(epsilon_, epsilon0_); @@ -370,8 +383,7 @@ void LRR::correct() // Re-calculate viscosity nut_ = Cmu_*sqr(k_)/epsilon_; - -# include "wallViscosityI.H" + nut_.correctBoundaryConditions(); // Correct wall shear stresses diff --git a/src/turbulenceModels/RAS/incompressible/LaunderGibsonRSTM/LaunderGibsonRSTM.C b/src/turbulenceModels/RAS/incompressible/LaunderGibsonRSTM/LaunderGibsonRSTM.C index 47d7773c85..d45af4201f 100644 --- a/src/turbulenceModels/RAS/incompressible/LaunderGibsonRSTM/LaunderGibsonRSTM.C +++ b/src/turbulenceModels/RAS/incompressible/LaunderGibsonRSTM/LaunderGibsonRSTM.C @@ -204,9 +204,21 @@ LaunderGibsonRSTM::LaunderGibsonRSTM mesh_ ), - nut_(Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_)) + nut_ + ( + IOobject + ( + "nut", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ) { -# include "wallViscosityI.H" + nut_ == Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); + nut_.correctBoundaryConditions(); if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0) { @@ -321,9 +333,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 epsEqn @@ -339,7 +352,7 @@ void LaunderGibsonRSTM::correct() epsEqn().relax(); -# include "wallDissipationI.H" + epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); bound(epsilon_, epsilon0_); @@ -411,9 +424,7 @@ void LaunderGibsonRSTM::correct() // Re-calculate turbulent viscosity nut_ = Cmu_*sqr(k_)/epsilon_; - - -# include "wallViscosityI.H" + nut_.correctBoundaryConditions(); // Correct wall shear stresses diff --git a/src/turbulenceModels/RAS/incompressible/Make/files b/src/turbulenceModels/RAS/incompressible/Make/files index c7746e7fd2..991c22d26b 100644 --- a/src/turbulenceModels/RAS/incompressible/Make/files +++ b/src/turbulenceModels/RAS/incompressible/Make/files @@ -18,9 +18,19 @@ LienLeschzinerLowRe/LienLeschzinerLowRe.C LamBremhorstKE/LamBremhorstKE.C /* Wall functions */ -wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C -wallFunctions/nutWallFunctions/nutStandardWallFunction/nutStandardWallFunctionFvPatchScalarField.C -wallFunctions/nutWallFunctions/nutStandardRoughWallFunction/nutStandardRoughWallFunctionFvPatchScalarField.C +derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C +derivedFvPatchFields/wallFunctions/nutWallFunctions/nutRoughWallFunction/nutRoughWallFunctionFvPatchScalarField.C + +derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasWallFunction/nutSpalartAllmarasWallFunctionFvPatchScalarField.C +derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardWallFunction/nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C +derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardRoughWallFunction/nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.C + +derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C + +derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C + +derivedFvPatchFields/wallFunctions/kWallFunctions/kWallFunction/kWallFunctionFvPatchScalarField.C + /* Patch fields */ derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C diff --git a/src/turbulenceModels/RAS/incompressible/RASModel/RASModel.C b/src/turbulenceModels/RAS/incompressible/RASModel/RASModel.C index b33dcb752f..ec41fae3aa 100644 --- a/src/turbulenceModels/RAS/incompressible/RASModel/RASModel.C +++ b/src/turbulenceModels/RAS/incompressible/RASModel/RASModel.C @@ -82,13 +82,14 @@ RASModel::RASModel turbulence_(lookup("turbulence")), printCoeffs_(lookupOrDefault("printCoeffs", false)), coeffDict_(subDict(type + "Coeffs")), + wallFunctionDict_(subDict("wallFunctionCoeffs")), kappa_ ( dimensioned::lookupOrAddToDict ( "kappa", - subDict("wallFunctionCoeffs"), + wallFunctionDict_, 0.4187 ) ), @@ -97,10 +98,19 @@ RASModel::RASModel dimensioned::lookupOrAddToDict ( "E", - subDict("wallFunctionCoeffs"), + wallFunctionDict_, 9.0 ) ), + Cmu_ + ( + dimensioned::lookupOrAddToDict + ( + "Cmu", + wallFunctionDict_, + 0.09 + ) + ), yPlusLam_(yPlusLam(kappa_.value(), E_.value())), diff --git a/src/turbulenceModels/RAS/incompressible/RASModel/RASModel.H b/src/turbulenceModels/RAS/incompressible/RASModel/RASModel.H index 345565fbab..21220f2e3a 100644 --- a/src/turbulenceModels/RAS/incompressible/RASModel/RASModel.H +++ b/src/turbulenceModels/RAS/incompressible/RASModel/RASModel.H @@ -88,8 +88,10 @@ protected: Switch printCoeffs_; dictionary coeffDict_; + dictionary wallFunctionDict_; dimensionedScalar kappa_; dimensionedScalar E_; + dimensionedScalar Cmu_; scalar yPlusLam(const scalar kappa, const scalar E); scalar yPlusLam_; @@ -192,7 +194,6 @@ public: return epsilonSmall_; } - //- Allow k0 to be changed dimensionedScalar& k0() { @@ -211,7 +212,6 @@ public: return epsilonSmall_; } - //- Return kappa for use in wall-functions dimensionedScalar kappa() const { @@ -224,6 +224,18 @@ 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_; + } + //- Return y+ at the edge of the laminar sublayer // for use in wall-functions scalar yPlusLam() const @@ -237,6 +249,12 @@ public: return coeffDict_; } + //- Const access to the wall functions coefficients dictionary + const dictionary& walLFunctionDict() const + { + return wallFunctionDict_; + } + //- Return the laminar viscosity const volScalarField& nu() const diff --git a/src/turbulenceModels/RAS/incompressible/RNGkEpsilon/RNGkEpsilon.C b/src/turbulenceModels/RAS/incompressible/RNGkEpsilon/RNGkEpsilon.C index 602adee89b..7003d6d26c 100644 --- a/src/turbulenceModels/RAS/incompressible/RNGkEpsilon/RNGkEpsilon.C +++ b/src/turbulenceModels/RAS/incompressible/RNGkEpsilon/RNGkEpsilon.C @@ -143,9 +143,21 @@ RNGkEpsilon::RNGkEpsilon mesh_ ), - nut_(Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_)) + nut_ + ( + IOobject + ( + "nut", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ) { -# include "wallViscosityI.H" + nut_ == Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); + nut_.correctBoundaryConditions(); printCoeffs(); } @@ -239,13 +251,14 @@ void RNGkEpsilon::correct() volScalarField S2 = 2*magSqr(symm(fvc::grad(U_))); - volScalarField G = nut_*S2; + volScalarField G("G", nut_*S2); volScalarField eta = sqrt(S2)*k_/epsilon_; volScalarField R = ((eta*(scalar(1) - eta/eta0_))/(scalar(1) + beta_*eta*sqr(eta))); -# include "wallFunctionsI.H" + // Update espsilon and G at the wall + epsilon_.boundaryField().updateCoeffs(); // Dissipation equation tmp epsEqn @@ -261,7 +274,7 @@ void RNGkEpsilon::correct() epsEqn().relax(); -# include "wallDissipationI.H" + epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); bound(epsilon_, epsilon0_); @@ -285,9 +298,7 @@ void RNGkEpsilon::correct() // Re-calculate viscosity nut_ = Cmu_*sqr(k_)/epsilon_; - -# include "wallViscosityI.H" - + nut_.correctBoundaryConditions(); } diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..7765dc0757 --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -0,0 +1,209 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 incompressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void epsilonWallFunctionFvPatchScalarField::checkType() +{ + if (!isA(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& iF +) +: + fixedInternalValueFvPatchField(p, iF) +{ + checkType(); +} + + +epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField +( + const epsilonWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedInternalValueFvPatchField(ptf, p, iF, mapper) +{ + checkType(); +} + + +epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedInternalValueFvPatchField(p, iF, dict) +{ + checkType(); +} + + +epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField +( + const epsilonWallFunctionFvPatchScalarField& ewfpsf +) +: + fixedInternalValueFvPatchField(ewfpsf) +{ + checkType(); +} + + +epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField +( + const epsilonWallFunctionFvPatchScalarField& ewfpsf, + const DimensionedField& iF +) +: + fixedInternalValueFvPatchField(ewfpsf, iF) +{ + checkType(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void epsilonWallFunctionFvPatchScalarField::updateCoeffs() +{ + const RASModel& ras = db().lookupObject("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 + (db().lookupObject("G")); + + volScalarField& epsilon = const_cast + (db().lookupObject("epsilon")); + + const scalarField& k = db().lookupObject("k"); + + const scalarField& nuw = + patch().lookupPatchField("nu"); + + const scalarField& nutw = + patch().lookupPatchField("nut"); + + const fvPatchVectorField& Uw = + patch().lookupPatchField("U"); + + const scalarField magGradUw = mag(Uw.snGrad()); + + // Set epsilon and G + forAll(nutw, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar yPlus = Cmu25*y[faceCellI]*sqrt(k[faceCellI])/nuw[faceI]; + + epsilon[faceCellI] = Cmu75*pow(k[faceCellI], 1.5)/(kappa*y[faceCellI]); + + if (yPlus > yPlusLam) + { + G[faceCellI] = + (nutw[faceI] + nuw[faceI]) + *magGradUw[faceI] + *Cmu25*sqrt(k[faceCellI]) + /(kappa*y[faceCellI]); + } + } + + // TODO: perform averaging for cells sharing more than one boundary face +} + + +void epsilonWallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes commsType +) +{ + fixedInternalValueFvPatchField::evaluate(commsType); +} + + +void epsilonWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fixedInternalValueFvPatchField::write(os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + epsilonWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..3fb9121d73 --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H @@ -0,0 +1,162 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::epsilonWallFunctionFvPatchScalarField + +Description + Replaces functionality in wallFunctionsI.H + +SourceFiles + epsilonWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef epsilonWallFunctionFvPatchScalarField_H +#define epsilonWallFunctionFvPatchScalarField_H + +#include "fixedInternalValueFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class epsilonWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class epsilonWallFunctionFvPatchScalarField +: + public fixedInternalValueFvPatchField +{ + + // 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& + ); + + //- Construct from patch, internal field and dictionary + epsilonWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // epsilonWallFunctionFvPatchScalarField + // onto a new patch + epsilonWallFunctionFvPatchScalarField + ( + const epsilonWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + epsilonWallFunctionFvPatchScalarField + ( + const epsilonWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new epsilonWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + epsilonWallFunctionFvPatchScalarField + ( + const epsilonWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + 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 incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/fixedInternalValueFvPatchField/fixedInternalValueFvPatchField.C b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/fixedInternalValueFvPatchField/fixedInternalValueFvPatchField.C new file mode 100644 index 0000000000..a808b78a58 --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/fixedInternalValueFvPatchField/fixedInternalValueFvPatchField.C @@ -0,0 +1,184 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "fixedInternalValueFvPatchField.H" +#include "fvPatchFieldMapper.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +fixedInternalValueFvPatchField::fixedInternalValueFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + zeroGradientFvPatchField(p, iF) +{} + + +template +fixedInternalValueFvPatchField::fixedInternalValueFvPatchField +( + const fixedInternalValueFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + zeroGradientFvPatchField(ptf, p, iF, mapper) +{} + + +template +fixedInternalValueFvPatchField::fixedInternalValueFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + zeroGradientFvPatchField(p, iF, dict) +{ + fvPatchField::operator=(this->patchInternalField()); +} + + +template +fixedInternalValueFvPatchField::fixedInternalValueFvPatchField +( + const fixedInternalValueFvPatchField& fivpf +) +: + zeroGradientFvPatchField(fivpf) +{} + + +template +fixedInternalValueFvPatchField::fixedInternalValueFvPatchField +( + const fixedInternalValueFvPatchField& fivpf, + const DimensionedField& iF +) +: + zeroGradientFvPatchField(fivpf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void fixedInternalValueFvPatchField::evaluate(const Pstream::commsTypes) +{ + if (!this->updated()) + { + this->updateCoeffs(); + } + + Info<< "fixedInternalValueFvPatchField::evaluate" << endl; + zeroGradientFvPatchField::evaluate(); +} + + +template +tmp > fixedInternalValueFvPatchField::valueInternalCoeffs +( + const tmp& +) const +{ + Info<< "fixedInternalValueFvPatchField::valueInternalCoeffs" << endl; + return tmp > + ( + new Field(this->size(), pTraits::one) + ); +} + + +template +tmp > fixedInternalValueFvPatchField::valueBoundaryCoeffs +( + const tmp& +) const +{ + Info<< "fixedInternalValueFvPatchField::valueBoundaryCoeffs" << endl; +// return tmp > +// ( +// new Field(this->size(), pTraits::zero) +// ); + return this->patchInternalField(); +} + + +template +tmp > fixedInternalValueFvPatchField:: +gradientInternalCoeffs() const +{ + Info<< "fixedInternalValueFvPatchField::gradientInternalCoeffs" + << endl; + return tmp > + ( + new Field(this->size(), pTraits::zero) + ); +} + + +template +tmp > fixedInternalValueFvPatchField:: +gradientBoundaryCoeffs() const +{ + Info<< "fixedInternalValueFvPatchField::gradientBoundaryCoeffs" + << endl; + return tmp > + ( + new Field(this->size(), pTraits::zero) + ); +} + + +template +void fixedInternalValueFvPatchField::manipulateMatrix +( + fvMatrix& matrix +) +{ + Info<< "fixedInternalValueFvPatchField::manipulateMatrix(...)" + << endl; + + // Apply the patch internal field as a constraint in the matrix + matrix.setValues(this->patch().faceCells(), this->patchInternalField()); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/fixedInternalValueFvPatchField/fixedInternalValueFvPatchField.H b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/fixedInternalValueFvPatchField/fixedInternalValueFvPatchField.H new file mode 100644 index 0000000000..220b7d570e --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/fixedInternalValueFvPatchField/fixedInternalValueFvPatchField.H @@ -0,0 +1,174 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + fixedInternalValueFvPatchField + +Description + +SourceFiles + fixedInternalValueFvPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fixedInternalValueFvPatchField_H +#define fixedInternalValueFvPatchField_H + +#include "zeroGradientFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class fixedInternalValueFvPatchField Declaration +\*---------------------------------------------------------------------------*/ + +template +class fixedInternalValueFvPatchField +: + public zeroGradientFvPatchField +{ + +public: + + //- Runtime type information + TypeName("fixedInternalValue"); + + + // Constructors + + //- Construct from patch and internal field + fixedInternalValueFvPatchField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + fixedInternalValueFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping the given fixedInternalValueFvPatchField + // onto a new patch + fixedInternalValueFvPatchField + ( + const fixedInternalValueFvPatchField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + fixedInternalValueFvPatchField + ( + const fixedInternalValueFvPatchField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new fixedInternalValueFvPatchField(*this) + ); + } + + //- Construct as copy setting internal field reference + fixedInternalValueFvPatchField + ( + const fixedInternalValueFvPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new fixedInternalValueFvPatchField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Evaluate the patch field + virtual void evaluate + ( + const Pstream::commsTypes commsType=Pstream::Pstream::blocking + ); + + //- Return the matrix diagonal coefficients corresponding to the + // evaluation of the value of this patchField with given weights + virtual tmp > valueInternalCoeffs + ( + const tmp& + ) const; + + //- Return the matrix source coefficients corresponding to the + // evaluation of the value of this patchField with given weights + virtual tmp > valueBoundaryCoeffs + ( + const tmp& + ) const; + + //- Return the matrix diagonal coefficients corresponding to the + // evaluation of the gradient of this patchField + virtual tmp > gradientInternalCoeffs() const; + + //- Return the matrix source coefficients corresponding to the + // evaluation of the gradient of this patchField + virtual tmp > gradientBoundaryCoeffs() const; + + //-Manipulate a matrix + virtual void manipulateMatrix(fvMatrix& matrix); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "fixedInternalValueFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.C b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.C new file mode 100644 index 0000000000..cd6d5d4901 --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.C @@ -0,0 +1,45 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "fixedInternalValueFvPatchFields.H" +#include "fvPatchFields.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePatchFields(fixedInternalValue); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.H b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.H new file mode 100644 index 0000000000..779339f443 --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + +\*---------------------------------------------------------------------------*/ + +#ifndef fixedInternalValueFvPatchFields_H +#define fixedInternalValueFvPatchFields_H + +#include "fixedInternalValueFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(fixedInternalValue) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/kWallFunctions/kWallFunction/kWallFunctionFvPatchScalarField.C b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/kWallFunctions/kWallFunction/kWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..2d164f9931 --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/kWallFunctions/kWallFunction/kWallFunctionFvPatchScalarField.C @@ -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 "kWallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" +#include "wallFvPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void kWallFunctionFvPatchScalarField::checkType() +{ + if (!isA(patch())) + { + FatalErrorIn("kWallFunctionFvPatchScalarField::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 * * * * * * * * * * * * * * // + +kWallFunctionFvPatchScalarField::kWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + zeroGradientFvPatchScalarField(p, iF) +{ + checkType(); +} + + +kWallFunctionFvPatchScalarField::kWallFunctionFvPatchScalarField +( + const kWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + zeroGradientFvPatchScalarField(ptf, p, iF, mapper) +{ + checkType(); +} + + +kWallFunctionFvPatchScalarField::kWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + zeroGradientFvPatchScalarField(p, iF, dict) +{ + checkType(); +} + + +kWallFunctionFvPatchScalarField::kWallFunctionFvPatchScalarField +( + const kWallFunctionFvPatchScalarField& tppsf +) +: + zeroGradientFvPatchScalarField(tppsf) +{ + checkType(); +} + + +kWallFunctionFvPatchScalarField::kWallFunctionFvPatchScalarField +( + const kWallFunctionFvPatchScalarField& tppsf, + const DimensionedField& iF +) +: + zeroGradientFvPatchScalarField(tppsf, iF) +{ + checkType(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void kWallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes commsType +) +{ + zeroGradientFvPatchScalarField::evaluate(commsType); +} + + +void kWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + zeroGradientFvPatchScalarField::write(os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + kWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/kWallFunctions/kWallFunction/kWallFunctionFvPatchScalarField.H b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/kWallFunctions/kWallFunction/kWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..10e8a255ef --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/kWallFunctions/kWallFunction/kWallFunctionFvPatchScalarField.H @@ -0,0 +1,161 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::kWallFunctionFvPatchScalarField + +Description + +SourceFiles + kWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef kWallFunctionFvPatchScalarField_H +#define kWallFunctionFvPatchScalarField_H + +#include "zeroGradientFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class kWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class kWallFunctionFvPatchScalarField +: + public zeroGradientFvPatchScalarField +{ + + // Private member functions + + //- Check the type of the patch + void checkType(); + + +public: + + //- Runtime type information + TypeName("kWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + kWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + kWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // kWallFunctionFvPatchScalarField + // onto a new patch + kWallFunctionFvPatchScalarField + ( + const kWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + kWallFunctionFvPatchScalarField + ( + const kWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new kWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + kWallFunctionFvPatchScalarField + ( + const kWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new kWallFunctionFvPatchScalarField(*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 incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutRoughWallFunction/nutRoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutRoughWallFunction/nutRoughWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..233ab8de50 --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutRoughWallFunction/nutRoughWallFunctionFvPatchScalarField.C @@ -0,0 +1,204 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "nutRoughWallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +scalar nutRoughWallFunctionFvPatchScalarField::fnRough +( + const scalar KsPlus, + const scalar kappa +) const +{ + // Set deltaB based on non-dimensional roughness height + scalar deltaB = 0.0; + if (KsPlus <= 2.25) + { + deltaB = 0.0; + } + else if ((KsPlus > 2.25) && (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*(1.0 + Cs_*KsPlus); + } + + return exp(deltaB*kappa); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +nutRoughWallFunctionFvPatchScalarField:: +nutRoughWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(p, iF), + Ks_(0.0), + Cs_(0.0) +{} + + +nutRoughWallFunctionFvPatchScalarField:: +nutRoughWallFunctionFvPatchScalarField +( + const nutRoughWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + Ks_(ptf.Ks_), + Cs_(ptf.Cs_) +{} + + +nutRoughWallFunctionFvPatchScalarField:: +nutRoughWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF, dict), + Ks_(readScalar(dict.lookup("Ks"))), + Cs_(readScalar(dict.lookup("Cs"))) +{} + + +nutRoughWallFunctionFvPatchScalarField:: +nutRoughWallFunctionFvPatchScalarField +( + const nutRoughWallFunctionFvPatchScalarField& nrwfpsf +) +: + fixedValueFvPatchScalarField(nrwfpsf), + Ks_(nrwfpsf.Ks_), + Cs_(nrwfpsf.Cs_) +{} + + +nutRoughWallFunctionFvPatchScalarField:: +nutRoughWallFunctionFvPatchScalarField +( + const nutRoughWallFunctionFvPatchScalarField& nrwfpsf, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(nrwfpsf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void nutRoughWallFunctionFvPatchScalarField::updateCoeffs() +{ + const RASModel& ras = db().lookupObject("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& k = db().lookupObject("k"); + + const scalarField& nuw = + patch().lookupPatchField("nu"); + + scalarField& nutw = *this; + + forAll(nutw, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar uStar = Cmu25*sqrt(k[faceCellI]); + + scalar yPlus = uStar*y[faceCellI]/nuw[faceI]; + + scalar KsPlus = uStar*Ks_/nuw[faceI]; + + scalar Edash = E/fnRough(KsPlus, kappa); + + if (yPlus > yPlusLam) + { + nutw[faceI] = nuw[faceI]*(yPlus*kappa/log(Edash*yPlus) - 1); + } + else + { + nutw[faceI] = 0.0; + } + } +} + + +void nutRoughWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fvPatchField::write(os); + os.writeKeyword("Cs") << Cs_ << token::END_STATEMENT << nl; + os.writeKeyword("Ks") << Ks_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField(fvPatchScalarField, nutRoughWallFunctionFvPatchScalarField); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutRoughWallFunction/nutRoughWallFunctionFvPatchScalarField.H b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutRoughWallFunction/nutRoughWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..785b1c55f6 --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutRoughWallFunction/nutRoughWallFunctionFvPatchScalarField.H @@ -0,0 +1,167 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::incompressible::RASModels::nutRoughWallFunctionFvPatchScalarField + +Description + Rough wall function boundary condition + +SourceFiles + nutRoughWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef nutRoughWallFunctionFvPatchScalarField_H +#define nutRoughWallFunctionFvPatchScalarField_H + +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class nutWallFunctionFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +class nutRoughWallFunctionFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ + // Private data + + //- Roughness height + scalar Ks_; + + //- Roughness constant + scalar Cs_; + + + // Private member functions + + //- Compute the roughness function + scalar fnRough(const scalar KsPlus, const scalar kappa) const; + + +public: + + //- Runtime type information + TypeName("nutWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + nutRoughWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + nutRoughWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // nutRoughWallFunctionFvPatchScalarField + // onto a new patch + nutRoughWallFunctionFvPatchScalarField + ( + const nutRoughWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + nutRoughWallFunctionFvPatchScalarField + ( + const nutRoughWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new nutRoughWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + nutRoughWallFunctionFvPatchScalarField + ( + const nutRoughWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new nutRoughWallFunctionFvPatchScalarField(*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 incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardRoughWallFunction/nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardRoughWallFunction/nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..0455576df4 --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardRoughWallFunction/nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.C @@ -0,0 +1,302 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField:: +nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(p, iF), + roughnessHeight_(pTraits::zero), + roughnessConstant_(pTraits::zero), + roughnessFudgeFactor_(pTraits::zero) +{} + + +nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField:: +nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField +( + const nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + roughnessHeight_(ptf.roughnessHeight_), + roughnessConstant_(ptf.roughnessConstant_), + roughnessFudgeFactor_(ptf.roughnessFudgeFactor_) +{} + + +nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField:: +nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF, dict), + roughnessHeight_(readScalar(dict.lookup("roughnessHeight"))), + roughnessConstant_(readScalar(dict.lookup("roughnessConstant"))), + roughnessFudgeFactor_(readScalar(dict.lookup("roughnessFudgeFactor"))) +{} + + +nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField:: +nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField +( + const nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField& tppsf +) +: + fixedValueFvPatchScalarField(tppsf), + roughnessHeight_(tppsf.roughnessHeight_), + roughnessConstant_(tppsf.roughnessConstant_), + roughnessFudgeFactor_(tppsf.roughnessFudgeFactor_) +{} + + +nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField:: +nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField +( + const nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField& tppsf, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(tppsf, iF), + roughnessHeight_(tppsf.roughnessHeight_), + roughnessConstant_(tppsf.roughnessConstant_), + roughnessFudgeFactor_(tppsf.roughnessFudgeFactor_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes +) +{ + const RASModel& ras = db().lookupObject("RASProperties"); + + const scalar kappa = ras.kappa().value(); + const scalar E = ras.E().value(); + const scalar yPlusLam = 11.225; + + // The reciprical of the distance to the adjacent cell centre. + const scalarField& ry = patch().deltaCoeffs(); + + const fvPatchVectorField& U = + patch().lookupPatchField("U"); + + // The flow velocity at the adjacent cell centre. + scalarField magUp = mag(U.patchInternalField() - U); + + const scalarField& nuw = + patch().lookupPatchField("nu"); + scalarField& nutw = *this; + + scalarField magFaceGradU = mag(U.snGrad()); + + if (roughnessHeight_ > 0.0) + { + // Rough Walls. + const scalar c_1 = 1/(90 - 2.25) + roughnessConstant_; + static const scalar c_2 = 2.25/(90 - 2.25); + static const scalar c_3 = 2.0*atan(1.0)/log(90/2.25); + static const scalar c_4 = c_3*log(2.25); + + //if (KsPlusBasedOnYPlus_) + { + // If KsPlus is based on YPlus the extra term added to the law + // of the wall will depend on yPlus. + forAll(nutw, facei) + { + const scalar magUpara = magUp[facei]; + const scalar Re = magUpara/(nuw[facei]*ry[facei]); + const scalar kappaRe = kappa*Re; + + scalar yPlus = yPlusLam; + const scalar ryPlusLam = 1.0/yPlus; + + int iter = 0; + scalar yPlusLast = 0.0; + scalar dKsPlusdYPlus = roughnessHeight_*ry[facei]; + + // Enforce the roughnessHeight to be less than the distance to + // the first cell centre. + if(dKsPlusdYPlus > 1) + { + dKsPlusdYPlus = 1; + } + + // Fudge factor to get results to be similar to fluent + // (at least difference between rough and smooth). + dKsPlusdYPlus *= roughnessFudgeFactor_; + + do + { + yPlusLast = yPlus; + + // The non-dimensional roughness height. + scalar KsPlus = yPlus*dKsPlusdYPlus; + + // The extra term in the law-of-the-wall. + scalar G = 0.0; + + scalar yPlusGPrime = 0.0; + + if (KsPlus >= 90) + { + const scalar t_1 = 1 + roughnessConstant_*KsPlus; + G = log(t_1); + yPlusGPrime = roughnessConstant_*KsPlus/t_1; + } + else if (KsPlus > 2.25) + { + const scalar t_1 = c_1*KsPlus - c_2; + const scalar t_2 = c_3*log(KsPlus) - c_4; + const scalar sint_2 = sin(t_2); + const scalar logt_1 = log(t_1); + G = logt_1*sint_2; + yPlusGPrime = + (c_1*sint_2*KsPlus/t_1) + (c_3*logt_1*cos(t_2)); + } + + scalar denom = 1.0 + log(E* yPlus) - G - yPlusGPrime; + if (mag(denom) > VSMALL) + { + yPlus = (kappaRe + yPlus*(1 - yPlusGPrime))/denom; + } + else + { + // Ensure immediate end and nutw = 0. + yPlus = 0; + } + + } while + ( + mag(ryPlusLam*(yPlus - yPlusLast)) > 0.0001 + && ++iter < 10 + && yPlus > VSMALL + ); + + if (yPlus > yPlusLam) + { + nutw[facei] = nuw[facei]*(yPlus*yPlus/Re - 1); + } + else + { + nutw[facei] = 0.0; + } + } + } + } + else + { + // Smooth Walls. + forAll(nutw, facei) + { + const scalar magUpara = magUp[facei]; + const scalar Re = magUpara/(nuw[facei]*ry[facei]); + const scalar kappaRe = kappa*Re; + + scalar yPlus = yPlusLam; + const 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.0001 && ++iter < 10); + + if (yPlus > yPlusLam) + { + nutw[facei] = nuw[facei]*(yPlus*yPlus/Re - 1); + } + else + { + nutw[facei] = 0.0; + } + } + } +} + + +void nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField::write +( + Ostream& os +) const +{ + fixedValueFvPatchScalarField::write(os); + os.writeKeyword("roughnessHeight") + << roughnessHeight_ << token::END_STATEMENT << nl; + os.writeKeyword("roughnessConstant") + << roughnessConstant_ << token::END_STATEMENT << nl; + os.writeKeyword("roughnessFudgeFactor") + << roughnessFudgeFactor_ << token::END_STATEMENT << nl; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardRoughWallFunction/nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.H b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardRoughWallFunction/nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..2806288b2a --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardRoughWallFunction/nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField.H @@ -0,0 +1,208 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::incompressible::RASModels:: + nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField + +Description + Wall function boundary condition for rough walls + +SourceFiles + nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H +#define nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H + +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ +Class nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ + // Private data + + scalar roughnessHeight_; + scalar roughnessConstant_; + scalar roughnessFudgeFactor_; + + +public: + + //- Runtime type information + TypeName("nutSpalartAllmarasStandardRoughWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField + // onto a new patch + nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField + ( + const nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField + ( + const nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField + ( + *this + ) + ); + } + + //- Construct as copy setting internal field reference + nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField + ( + const nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new nutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField + ( + *this, + iF + ) + ); + } + + + // Member functions + + // Access + + //- Return the fluctuation scale + const scalar& roughnessHeight() const + { + return roughnessHeight_; + } + + //- Return reference to the fluctuation scale to allow adjustment + scalar& roughnessHeight() + { + return roughnessHeight_; + } + + + //- Return the fluctuation scale + const scalar& roughnessConstant() const + { + return roughnessConstant_; + } + + //- Return reference to the fluctuation scale to allow adjustment + scalar& roughnessConstant() + { + return roughnessConstant_; + } + + //- Return the fluctuation scale + const scalar& roughnessFudgeFactor() const + { + return roughnessFudgeFactor_; + } + + //- Return reference to the fluctuation scale to allow adjustment + scalar& roughnessFudgeFactor() + { + return roughnessFudgeFactor_; + } + + + // Evaluation functions + + //- Evaluate the patchField + virtual void evaluate + ( + const Pstream::commsTypes commsType=Pstream::blocking + ); + + + //- Write + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardWallFunction/nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardWallFunction/nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..c60e065f05 --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardWallFunction/nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C @@ -0,0 +1,172 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +nutSpalartAllmarasStandardWallFunctionFvPatchScalarField:: +nutSpalartAllmarasStandardWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(p, iF) +{} + + +nutSpalartAllmarasStandardWallFunctionFvPatchScalarField:: +nutSpalartAllmarasStandardWallFunctionFvPatchScalarField +( + const nutSpalartAllmarasStandardWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper) +{} + + +nutSpalartAllmarasStandardWallFunctionFvPatchScalarField:: +nutSpalartAllmarasStandardWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF, dict) +{} + + +nutSpalartAllmarasStandardWallFunctionFvPatchScalarField:: +nutSpalartAllmarasStandardWallFunctionFvPatchScalarField +( + const nutSpalartAllmarasStandardWallFunctionFvPatchScalarField& tppsf +) +: + fixedValueFvPatchScalarField(tppsf) +{} + + +nutSpalartAllmarasStandardWallFunctionFvPatchScalarField:: +nutSpalartAllmarasStandardWallFunctionFvPatchScalarField +( + const nutSpalartAllmarasStandardWallFunctionFvPatchScalarField& tppsf, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(tppsf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void nutSpalartAllmarasStandardWallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes +) +{ + const RASModel& ras = db().lookupObject("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("U"); + + scalarField magUp = mag(U.patchInternalField() - U); + + const scalarField& nuw = + patch().lookupPatchField("nu"); + scalarField& nutw = *this; + + scalarField magFaceGradU = mag(U.snGrad()); + + forAll(nutw, facei) + { + scalar magUpara = magUp[facei]; + + scalar kappaRe = kappa*magUpara/(nuw[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) + { + nutw[facei] = nuw[facei]*(yPlus*kappa/log(E*yPlus) - 1); + } + else + { + nutw[facei] = 0.0; + } + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + nutSpalartAllmarasStandardWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardWallFunction/nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.H b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardWallFunction/nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..7613962708 --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasStandardWallFunction/nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.H @@ -0,0 +1,160 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::incompressible::RASModels:: + nutSpalartAllmarasStandardWallFunctionFvPatchScalarField + +Description + Wall function boundary condition for walls + +SourceFiles + nutSpalartAllmarasStandardWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef nutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H +#define nutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H + +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class nutWallFunctionFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +class nutSpalartAllmarasStandardWallFunctionFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ + // Private data + + +public: + + //- Runtime type information + TypeName("nutSpalartAllmarasStandardWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + nutSpalartAllmarasStandardWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + nutSpalartAllmarasStandardWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // nutSpalartAllmarasStandardWallFunctionFvPatchScalarField + // onto a new patch + nutSpalartAllmarasStandardWallFunctionFvPatchScalarField + ( + const nutSpalartAllmarasStandardWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + nutSpalartAllmarasStandardWallFunctionFvPatchScalarField + ( + const nutSpalartAllmarasStandardWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new nutSpalartAllmarasStandardWallFunctionFvPatchScalarField + ( + *this + ) + ); + } + + //- Construct as copy setting internal field reference + nutSpalartAllmarasStandardWallFunctionFvPatchScalarField + ( + const nutSpalartAllmarasStandardWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new nutSpalartAllmarasStandardWallFunctionFvPatchScalarField + ( + *this, + iF + ) + ); + } + + + // Member functions + + // Evaluation functions + + //- Evaluate the patchField + virtual void evaluate + ( + const Pstream::commsTypes commsType=Pstream::blocking + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasWallFunction/nutSpalartAllmarasWallFunctionFvPatchScalarField.C b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasWallFunction/nutSpalartAllmarasWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..6e37a19949 --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasWallFunction/nutSpalartAllmarasWallFunctionFvPatchScalarField.C @@ -0,0 +1,180 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "nutSpalartAllmarasWallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +nutSpalartAllmarasWallFunctionFvPatchScalarField:: +nutSpalartAllmarasWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(p, iF) +{} + + +nutSpalartAllmarasWallFunctionFvPatchScalarField:: +nutSpalartAllmarasWallFunctionFvPatchScalarField +( + const nutSpalartAllmarasWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper) +{} + + +nutSpalartAllmarasWallFunctionFvPatchScalarField:: +nutSpalartAllmarasWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF, dict) +{} + + +nutSpalartAllmarasWallFunctionFvPatchScalarField:: +nutSpalartAllmarasWallFunctionFvPatchScalarField +( + const nutSpalartAllmarasWallFunctionFvPatchScalarField& tppsf +) +: + fixedValueFvPatchScalarField(tppsf) +{} + + +nutSpalartAllmarasWallFunctionFvPatchScalarField:: +nutSpalartAllmarasWallFunctionFvPatchScalarField +( + const nutSpalartAllmarasWallFunctionFvPatchScalarField& tppsf, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(tppsf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void nutSpalartAllmarasWallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes +) +{ + const RASModel& ras = db().lookupObject("RASProperties"); + + scalar kappa = ras.kappa().value(); + scalar E = ras.E().value(); + + const scalarField& ry = patch().deltaCoeffs(); + + const fvPatchVectorField& U = + patch().lookupPatchField("U"); + + scalarField magUp = mag(U.patchInternalField() - U); + + const scalarField& nuw = + patch().lookupPatchField("nu"); + + scalarField& nutw = *this; + + scalarField magFaceGradU = mag(U.snGrad()); + + forAll(nutw, facei) + { + scalar magUpara = magUp[facei]; + + scalar utau = sqrt((nutw[facei] + nuw[facei])*magFaceGradU[facei]); + + if (utau > VSMALL) + { + int iter = 0; + scalar err = GREAT; + + do + { + scalar kUu = min(kappa*magUpara/utau, 50); + scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu); + + scalar f = + - utau/(ry[facei]*nuw[facei]) + + magUpara/utau + + 1/E*(fkUu - 1.0/6.0*kUu*sqr(kUu)); + + scalar df = + 1.0/(ry[facei]*nuw[facei]) + + magUpara/sqr(utau) + + 1/E*kUu*fkUu/utau; + + scalar utauNew = utau + f/df; + err = mag((utau - utauNew)/utau); + utau = utauNew; + + } while (utau > VSMALL && err > 0.01 && ++iter < 10); + + nutw[facei] = + max(sqr(max(utau, 0))/magFaceGradU[facei] - nuw[facei], 0.0); + } + else + { + nutw[facei] = 0; + } + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField(fvPatchScalarField, nutSpalartAllmarasWallFunctionFvPatchScalarField); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasWallFunction/nutSpalartAllmarasWallFunctionFvPatchScalarField.H b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasWallFunction/nutSpalartAllmarasWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..174b6e3a34 --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutSpalartAllmarasWallFunction/nutSpalartAllmarasWallFunctionFvPatchScalarField.H @@ -0,0 +1,153 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::incompressible::RASModels:: + nutSpalartAllmarasWallFunctionFvPatchScalarField + +Description + Wall function boundary condition for walls + +SourceFiles + nutSpalartAllmarasWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef nutSpalartAllmarasWallFunctionFvPatchScalarField_H +#define nutSpalartAllmarasWallFunctionFvPatchScalarField_H + +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class nutSpalartAllmarasWallFunctionFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +class nutSpalartAllmarasWallFunctionFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ + // Private data + + +public: + + //- Runtime type information + TypeName("nutSpalartAllmarasWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + nutSpalartAllmarasWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + nutSpalartAllmarasWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // nutSpalartAllmarasWallFunctionFvPatchScalarField + // onto a new patch + nutSpalartAllmarasWallFunctionFvPatchScalarField + ( + const nutSpalartAllmarasWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + nutSpalartAllmarasWallFunctionFvPatchScalarField + ( + const nutSpalartAllmarasWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new nutSpalartAllmarasWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + nutSpalartAllmarasWallFunctionFvPatchScalarField + ( + const nutSpalartAllmarasWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new nutSpalartAllmarasWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Evaluate the patchField + virtual void evaluate + ( + const Pstream::commsTypes commsType=Pstream::blocking + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..25bbee8a29 --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C @@ -0,0 +1,157 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "nutWallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +nutWallFunctionFvPatchScalarField:: +nutWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(p, iF) +{} + + +nutWallFunctionFvPatchScalarField:: +nutWallFunctionFvPatchScalarField +( + const nutWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper) +{} + + +nutWallFunctionFvPatchScalarField:: +nutWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF, dict) +{} + + +nutWallFunctionFvPatchScalarField:: +nutWallFunctionFvPatchScalarField +( + const nutWallFunctionFvPatchScalarField& tppsf +) +: + fixedValueFvPatchScalarField(tppsf) +{} + + +nutWallFunctionFvPatchScalarField:: +nutWallFunctionFvPatchScalarField +( + const nutWallFunctionFvPatchScalarField& tppsf, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(tppsf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void nutWallFunctionFvPatchScalarField::updateCoeffs() +{ + const RASModel& ras = db().lookupObject("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& k = db().lookupObject("k"); + + const scalarField& nuw = + patch().lookupPatchField("nu"); + + scalarField& nutw = *this; + + forAll(nutw, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar yPlus = Cmu25*y[faceCellI]*sqrt(k[faceCellI])/nuw[faceI]; + + if (yPlus > yPlusLam) + { + nutw[faceI] = nuw[faceI]*(yPlus*kappa/log(E*yPlus) - 1); + } + else + { + nutw[faceI] = 0.0; + } + } +} + + +void nutWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fvPatchField::write(os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField(fvPatchScalarField, nutWallFunctionFvPatchScalarField); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.H b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..bf3fe1753e --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.H @@ -0,0 +1,154 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::incompressible::RASModels::nutWallFunctionFvPatchScalarField + +Description + Wall function boundary condition + - replicates OpenFOAM v1.5 (and lower) behaviour + +SourceFiles + nutWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef nutWallFunctionFvPatchScalarField_H +#define nutWallFunctionFvPatchScalarField_H + +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class nutWallFunctionFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +class nutWallFunctionFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ + +public: + + //- Runtime type information + TypeName("nutWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + nutWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + nutWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // nutWallFunctionFvPatchScalarField + // onto a new patch + nutWallFunctionFvPatchScalarField + ( + const nutWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + nutWallFunctionFvPatchScalarField + ( + const nutWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new nutWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + nutWallFunctionFvPatchScalarField + ( + const nutWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new nutWallFunctionFvPatchScalarField(*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 incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..63bdc2e7d4 --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C @@ -0,0 +1,200 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 incompressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void omegaWallFunctionFvPatchScalarField::checkType() +{ + if (!isA(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& iF +) +: + fixedInternalValueFvPatchField(p, iF) +{ + checkType(); +} + + +omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField +( + const omegaWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedInternalValueFvPatchField(ptf, p, iF, mapper) +{ + checkType(); +} + + +omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedInternalValueFvPatchField(p, iF, dict) +{ + checkType(); +} + + +omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField +( + const omegaWallFunctionFvPatchScalarField& ewfpsf +) +: + fixedInternalValueFvPatchField(ewfpsf) +{ + checkType(); +} + + +omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField +( + const omegaWallFunctionFvPatchScalarField& ewfpsf, + const DimensionedField& iF +) +: + fixedInternalValueFvPatchField(ewfpsf, iF) +{ + checkType(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void omegaWallFunctionFvPatchScalarField::updateCoeffs() +{ + const RASModel& ras = db().lookupObject("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 + (db().lookupObject("G")); + + volScalarField& omega = const_cast + (db().lookupObject("omega")); + + const scalarField& k = db().lookupObject("k"); + + const scalarField& nuw = + patch().lookupPatchField("nu"); + + const scalarField& nutw = + patch().lookupPatchField("nut"); + + const fvPatchVectorField& Uw = + patch().lookupPatchField("U"); + + const scalarField magGradUw = mag(Uw.snGrad()); + + // Set epsilon and G + forAll(nutw, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar yPlus = Cmu25*y[faceCellI]*sqrt(k[faceCellI])/nuw[faceI]; + + omega[faceCellI] = sqrt(k[faceCellI])/(Cmu25*kappa*y[faceCellI]); + + if (yPlus > yPlusLam) + { + G[faceCellI] = + (nutw[faceI] + nuw[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::write(os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + omegaWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..604cf71577 --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H @@ -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::omegaWallFunctionFvPatchScalarField + +Description + Replaces functionality in wallFunctionsI.H + +SourceFiles + omegaWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef omegaWallFunctionFvPatchScalarField_H +#define omegaWallFunctionFvPatchScalarField_H + +#include "fixedInternalValueFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class omegaWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class omegaWallFunctionFvPatchScalarField +: + public fixedInternalValueFvPatchField +{ + + // 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& + ); + + //- Construct from patch, internal field and dictionary + omegaWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // omegaWallFunctionFvPatchScalarField + // onto a new patch + omegaWallFunctionFvPatchScalarField + ( + const omegaWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + omegaWallFunctionFvPatchScalarField + ( + const omegaWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new omegaWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + omegaWallFunctionFvPatchScalarField + ( + const omegaWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + 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 incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/kEpsilon/kEpsilon.C b/src/turbulenceModels/RAS/incompressible/kEpsilon/kEpsilon.C index 0f4e20df04..9bc9aad003 100644 --- a/src/turbulenceModels/RAS/incompressible/kEpsilon/kEpsilon.C +++ b/src/turbulenceModels/RAS/incompressible/kEpsilon/kEpsilon.C @@ -117,9 +117,21 @@ kEpsilon::kEpsilon mesh_ ), - nut_(Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_)) + nut_ + ( + IOobject + ( + "nut", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ) { -# include "wallViscosityI.H" + nut_ == Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); + nut_.correctBoundaryConditions(); printCoeffs(); } @@ -207,9 +219,10 @@ void kEpsilon::correct() RASModel::correct(); - volScalarField G = nut_*2*magSqr(symm(fvc::grad(U_))); + volScalarField G("G", nut_*2*magSqr(symm(fvc::grad(U_)))); -# include "wallFunctionsI.H" + // Update espsilon and G at the wall + epsilon_.boundaryField().updateCoeffs(); // Dissipation equation tmp epsEqn @@ -225,7 +238,7 @@ void kEpsilon::correct() epsEqn().relax(); -# include "wallDissipationI.H" + epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); bound(epsilon_, epsilon0_); @@ -250,9 +263,7 @@ void kEpsilon::correct() // Re-calculate viscosity nut_ = Cmu_*sqr(k_)/epsilon_; - -# include "wallViscosityI.H" - + nut_.correctBoundaryConditions(); } diff --git a/src/turbulenceModels/RAS/incompressible/kOmegaSST/kOmegaSST.C b/src/turbulenceModels/RAS/incompressible/kOmegaSST/kOmegaSST.C index 1cf4a5c6d7..8a6886bc70 100644 --- a/src/turbulenceModels/RAS/incompressible/kOmegaSST/kOmegaSST.C +++ b/src/turbulenceModels/RAS/incompressible/kOmegaSST/kOmegaSST.C @@ -237,9 +237,27 @@ kOmegaSST::kOmegaSST mesh_ ), - nut_(a1_*k_/max(a1_*(omega_ + omegaSmall_), F2()*mag(symm(fvc::grad(U_))))) + nut_ + ( + IOobject + ( + "nut", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ) { -# include "kOmegaWallViscosityI.H" + nut_ == + a1_*k_ + /max + ( + a1_*(omega_ + omegaSmall_), + F2()*mag(symm(fvc::grad(U_))) + ); + nut_.correctBoundaryConditions(); printCoeffs(); } @@ -341,9 +359,10 @@ void kOmegaSST::correct() } volScalarField S2 = magSqr(symm(fvc::grad(U_))); - volScalarField G = nut_*2*S2; + volScalarField G("G", nut_*2*S2); -# include "kOmegaWallFunctionsI.H" + // Update omega and G at the wall + omega_.boundaryField().updateCoeffs(); volScalarField CDkOmega = (2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_; @@ -369,7 +388,7 @@ void kOmegaSST::correct() omegaEqn().relax(); -# include "wallOmegaI.H" + omegaEqn().boundaryManipulate(omega_.boundaryField()); solve(omegaEqn); bound(omega_, omega0_); @@ -393,9 +412,7 @@ void kOmegaSST::correct() // Re-calculate viscosity nut_ = a1_*k_/max(a1_*omega_, F2()*sqrt(S2)); - -# include "kOmegaWallViscosityI.H" - + nut_.correctBoundaryConditions(); } diff --git a/src/turbulenceModels/RAS/incompressible/realizableKE/realizableKE.C b/src/turbulenceModels/RAS/incompressible/realizableKE/realizableKE.C index a9d2cbc601..7ef65a01de 100644 --- a/src/turbulenceModels/RAS/incompressible/realizableKE/realizableKE.C +++ b/src/turbulenceModels/RAS/incompressible/realizableKE/realizableKE.C @@ -166,11 +166,24 @@ realizableKE::realizableKE mesh_ ), - nut_(rCmu(fvc::grad(U_))*sqr(k_)/(epsilon_ + epsilonSmall_)) + nut_ + ( + IOobject + ( + "nut", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ) { bound(k_, k0_); bound(epsilon_, epsilon0_); -# include "wallViscosityI.H" + + nut_ == rCmu(fvc::grad(U_))*sqr(k_)/(epsilon_ + epsilonSmall_); + nut_.correctBoundaryConditions(); printCoeffs(); } @@ -266,9 +279,10 @@ void realizableKE::correct() volScalarField eta = magS*k_/epsilon_; volScalarField C1 = max(eta/(scalar(5) + eta), scalar(0.43)); - volScalarField G = nut_*S2; + volScalarField G("G", nut_*S2); -# include "wallFunctionsI.H" + // Update espsilon and G at the wall + epsilon_.boundaryField().updateCoeffs(); // Dissipation equation @@ -289,7 +303,7 @@ void realizableKE::correct() epsEqn().relax(); -# include "wallDissipationI.H" + epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); bound(epsilon_, epsilon0_); @@ -313,9 +327,7 @@ void realizableKE::correct() // Re-calculate viscosity nut_ = rCmu(gradU, S2, magS)*sqr(k_)/epsilon_; - -# include "wallViscosityI.H" - + nut_.correctBoundaryConditions(); }