From 31ea91e35b56ad56147048fe1cdd74ea15b7f3e4 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 18 Jun 2019 12:48:16 +0100 Subject: [PATCH] Rewrite of wall function boundary conditions to support immersed boundary wall functions. Incompressible fixes; extended to compressible --- .../epsilonWallFunctionFvPatchScalarField.C | 31 ++++++++++++------- .../epsilonWallFunctionFvPatchScalarField.H | 21 +++++++++++-- .../kqRWallFunctionFvPatchField.C | 13 ++------ .../kqRWallFunctionFvPatchField.H | 9 ------ .../omegaWallFunctionFvPatchScalarField.C | 27 ++++++++++------ .../omegaWallFunctionFvPatchScalarField.H | 14 +++++++++ .../epsilonWallFunctionFvPatchScalarField.C | 2 +- 7 files changed, 72 insertions(+), 45 deletions(-) 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 09377cbf2..8c41a420d 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -54,6 +54,21 @@ void epsilonWallFunctionFvPatchScalarField::checkType() } +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void epsilonWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const +{ + writeEntryIfDifferent(os, "U", "U", UName_); + writeEntryIfDifferent(os, "k", "k", kName_); + writeEntryIfDifferent(os, "G", "RASModel::G", GName_); + writeEntryIfDifferent(os, "mu", "mu", muName_); + writeEntryIfDifferent(os, "mut", "mut", mutName_); + os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; + os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField @@ -251,7 +266,7 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs() // TODO: perform averaging for cells sharing more than one boundary face - fixedInternalValueFvPatchField::updateCoeffs(); + fixedInternalValueFvPatchScalarField::updateCoeffs(); } @@ -260,22 +275,14 @@ void epsilonWallFunctionFvPatchScalarField::evaluate const Pstream::commsTypes commsType ) { - fixedInternalValueFvPatchField::evaluate(commsType); + fixedInternalValueFvPatchScalarField::evaluate(commsType); } void epsilonWallFunctionFvPatchScalarField::write(Ostream& os) const { - fixedInternalValueFvPatchField::write(os); - writeEntryIfDifferent(os, "U", "U", UName_); - writeEntryIfDifferent(os, "k", "k", kName_); - writeEntryIfDifferent(os, "G", "RASModel::G", GName_); - writeEntryIfDifferent(os, "rho", "rho", rhoName_); - writeEntryIfDifferent(os, "mu", "mu", muName_); - writeEntryIfDifferent(os, "mut", "mut", mutName_); - os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; - os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; - os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; + fixedInternalValueFvPatchScalarField::write(os); + writeLocalEntries(os); } diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H index 0b02193ff..1ec927848 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H @@ -37,7 +37,7 @@ SourceFiles #ifndef compressibleEpsilonWallFunctionFvPatchScalarField_H #define compressibleEpsilonWallFunctionFvPatchScalarField_H -#include "fixedInternalValueFvPatchField.H" +#include "fixedInternalValueFvPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -92,6 +92,20 @@ class epsilonWallFunctionFvPatchScalarField void checkType(); +protected: + + // Protected Member Functions + + //- Write local wall function variables + virtual void writeLocalEntries(Ostream&) const; + + //- Return name of turbulence generation field + inline const word& GName() const + { + return GName_; + } + + public: //- Runtime type information @@ -169,7 +183,10 @@ public: virtual void updateCoeffs(); //- Evaluate the patchField - virtual void evaluate(const Pstream::commsTypes); + virtual void evaluate + ( + const Pstream::commsTypes = Pstream::blocking + ); // I-O diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.C index fce6ca69f..d6400b084 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.C @@ -47,7 +47,8 @@ void kqRWallFunctionFvPatchField::checkType() << "Invalid wall function specification" << nl << " Patch type for patch " << this->patch().name() << " must be wall" << nl - << " Current patch type is " << this->patch().type() << nl << endl + << " Current patch type is " << this->patch().type() + << nl << endl << abort(FatalError); } } @@ -124,16 +125,6 @@ kqRWallFunctionFvPatchField::kqRWallFunctionFvPatchField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -void kqRWallFunctionFvPatchField::evaluate -( - const Pstream::commsTypes commsType -) -{ - zeroGradientFvPatchField::evaluate(commsType); -} - - template void kqRWallFunctionFvPatchField::write(Ostream& os) const { diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H index a14508938..54d5b502e 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H @@ -134,15 +134,6 @@ public: // Member functions - // Evaluation functions - - //- Evaluate the patchField - virtual void evaluate - ( - const Pstream::commsTypes commsType=Pstream::Pstream::blocking - ); - - // I-O //- Write diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C index c3c6704ad..2b1801495 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C @@ -54,6 +54,22 @@ void omegaWallFunctionFvPatchScalarField::checkType() } +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void omegaWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const +{ + writeEntryIfDifferent(os, "U", "U", UName_); + writeEntryIfDifferent(os, "k", "k", kName_); + writeEntryIfDifferent(os, "G", "RASModel::G", GName_); + writeEntryIfDifferent(os, "mu", "mu", muName_); + writeEntryIfDifferent(os, "mut", "mut", mutName_); + os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; + os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; + os.writeKeyword("beta1") << beta1_ << token::END_STATEMENT << nl; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField @@ -264,16 +280,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs() void omegaWallFunctionFvPatchScalarField::write(Ostream& os) const { fixedInternalValueFvPatchField::write(os); - writeEntryIfDifferent(os, "U", "U", UName_); - writeEntryIfDifferent(os, "rho", "rho", rhoName_); - writeEntryIfDifferent(os, "k", "k", kName_); - writeEntryIfDifferent(os, "G", "RASModel::G", GName_); - writeEntryIfDifferent(os, "mu", "mu", muName_); - writeEntryIfDifferent(os, "mut", "mut", mutName_); - os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; - os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; - os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; - os.writeKeyword("beta1") << beta1_ << token::END_STATEMENT << nl; + writeLocalEntries(os); } diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H index 4ceb41375..ef85cd47e 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H @@ -109,6 +109,20 @@ class omegaWallFunctionFvPatchScalarField void checkType(); +protected: + + // Protected Member Functions + + //- Write local wall function variables + virtual void writeLocalEntries(Ostream&) const; + + //- Return name of turbulence generation field + inline const word& GName() const + { + return GName_; + } + + public: //- Runtime type information diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C index c55b45343..eb91c5fd7 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -42,7 +42,7 @@ namespace RASModels void epsilonWallFunctionFvPatchScalarField::checkType() { - if (!this->patch().isWall()) + if (!patch().isWall()) { FatalErrorIn("epsilonWallFunctionFvPatchScalarField::checkType()") << "Invalid wall function specification" << nl