diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C index 84762e6beb..d079c811ea 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C @@ -55,6 +55,67 @@ scalar epsilonLowReWallFunctionFvPatchScalarField::yPlusLam } +void epsilonLowReWallFunctionFvPatchScalarField::calculate +( + const turbulenceModel& turbulence, + const List& cornerWeights, + const fvPatch& patch, + scalarField& G, + scalarField& epsilon +) +{ + const label patchI = patch.index(); + + const scalarField& y = turbulence.y()[patchI]; + + const scalar Cmu25 = pow025(Cmu_); + const scalar Cmu75 = pow(Cmu_, 0.75); + + const tmp tk = turbulence.k(); + const volScalarField& k = tk(); + + const tmp tmu = turbulence.mu(); + const scalarField& muw = tmu().boundaryField()[patchI]; + + const tmp tmut = turbulence.mut(); + const volScalarField& mut = tmut(); + const scalarField& mutw = mut.boundaryField()[patchI]; + + const scalarField& rhow = turbulence.rho().boundaryField()[patchI]; + + const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchI]; + + const scalarField magGradUw(mag(Uw.snGrad())); + + // Set epsilon and G + forAll(mutw, faceI) + { + label cellI = patch.faceCells()[faceI]; + + scalar yPlus = Cmu25*sqrt(k[cellI])*y[faceI]/muw[faceI]/rhow[faceI]; + + scalar w = cornerWeights[faceI]; + + if (yPlus > yPlusLam_) + { + epsilon[cellI] = w*Cmu75*pow(k[cellI], 1.5)/(kappa_*y[faceI]); + } + else + { + epsilon[cellI] = + w*2.0*k[cellI]*muw[faceI]/rhow[faceI]/sqr(y[faceI]); + } + + G[cellI] = + w + *(mutw[faceI] + muw[faceI]) + *magGradUw[faceI] + *Cmu25*sqrt(k[cellI]) + /(kappa_*y[faceI]); + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // epsilonLowReWallFunctionFvPatchScalarField:: @@ -119,84 +180,6 @@ epsilonLowReWallFunctionFvPatchScalarField {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void epsilonLowReWallFunctionFvPatchScalarField::updateCoeffs() -{ - if (updated()) - { - return; - } - - const label patchI = patch().index(); - - const turbulenceModel& turbulence = - db().lookupObject("turbulenceModel"); - const scalarField& y = turbulence.y()[patchI]; - - volScalarField& G = - const_cast - ( - db().lookupObject - ( - turbulence.GName() - ) - ); - - DimensionedField& epsilon = - const_cast&> - ( - dimensionedInternalField() - ); - - const tmp tk = turbulence.k(); - const volScalarField& k = tk(); - - const tmp tmu = turbulence.mu(); - const scalarField& muw = tmu().boundaryField()[patchI]; - - const tmp tmut = turbulence.mut(); - const volScalarField& mut = tmut(); - const scalarField& mutw = mut.boundaryField()[patchI]; - - const scalarField& rhow = turbulence.rho().boundaryField()[patchI]; - - const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchI]; - const scalarField magGradUw(mag(Uw.snGrad())); - - const scalar Cmu25 = pow025(Cmu_); - const scalar Cmu75 = pow(Cmu_, 0.75); - - // Set epsilon and G - forAll(mutw, faceI) - { - label faceCellI = patch().faceCells()[faceI]; - - scalar yPlus = Cmu25*sqrt(k[faceCellI])*y[faceI]/muw[faceI]/rhow[faceI]; - - if (yPlus > yPlusLam_) - { - epsilon[faceCellI] = Cmu75*pow(k[faceCellI], 1.5)/(kappa_*y[faceI]); - } - else - { - epsilon[faceCellI] = - 2.0*k[faceCellI]*muw[faceI]/rhow[faceI]/sqr(y[faceI]); - } - - G[faceCellI] = - (mutw[faceI] + muw[faceI]) - *magGradUw[faceI] - *Cmu25*sqrt(k[faceCellI]) - /(kappa_*y[faceI]); - } - - fixedInternalValueFvPatchField::updateCoeffs(); - - // TODO: perform averaging for cells sharing more than one boundary face -} - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // makePatchTypeField diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H index 61434c29b5..c2f7cf178f 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -97,6 +97,16 @@ protected: //- Calculate the Y+ at the edge of the laminar sublayer scalar yPlusLam(const scalar kappa, const scalar E); + //- Calculate the epsilon and G + virtual void calculate + ( + const turbulenceModel& turbulence, + const List& cornerWeights, + const fvPatch& patch, + scalarField& G, + scalarField& epsilon + ); + public: @@ -165,14 +175,6 @@ public: new epsilonLowReWallFunctionFvPatchScalarField(*this, iF) ); } - - - // Member functions - - // Evaluation functions - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); }; diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C index dc6296f2ed..5e78e48c97 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -26,10 +26,10 @@ License #include "epsilonWallFunctionFvPatchScalarField.H" #include "compressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" +#include "fvMatrix.H" #include "volFields.H" -#include "addToRunTimeSelectionTable.H" -#include "mutWallFunctionFvPatchScalarField.H" #include "wallFvPatch.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -62,6 +62,193 @@ void epsilonWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const } +void epsilonWallFunctionFvPatchScalarField::setMaster() +{ + if (master_ != -1) + { + return; + } + + const volScalarField& epsilon = + static_cast(this->dimensionedInternalField()); + + const volScalarField::GeometricBoundaryField& bf = epsilon.boundaryField(); + + label master = -1; + forAll(bf, patchI) + { + if (isA(bf[patchI])) + { + epsilonWallFunctionFvPatchScalarField& epf = epsilonPatch(patchI); + + if (master == -1) + { + master = patchI; + } + + epf.master() = master; + } + } +} + + +void epsilonWallFunctionFvPatchScalarField::createAveragingWeights() +{ + if (initialised_) + { + return; + } + + const volScalarField& epsilon = + static_cast(this->dimensionedInternalField()); + + const volScalarField::GeometricBoundaryField& bf = epsilon.boundaryField(); + + const fvMesh& mesh = epsilon.mesh(); + + volScalarField weights + ( + IOobject + ( + "weights", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE, + false // do not register + ), + mesh, + dimensionedScalar("zero", dimless, 0.0) + ); + + DynamicList