From 94af00fa043ad6870d69d9ecb5d64d12965e8409 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 18 Jun 2019 12:46:03 +0100 Subject: [PATCH] Splitting immersed boundary turbulence libraries to incompressible and compressible; Added compressible wall functions --- src/Allwmake | 3 +- src/immersedBoundary/CMakeLists.txt | 1 + .../immersedBoundaryTurbulence/CMakeLists.txt | 34 ++ .../compressible/Make/files | 8 + .../compressible/Make/options | 17 + ...daryAlphatWallFunctionFvPatchScalarField.C | 229 +++++++++ ...daryAlphatWallFunctionFvPatchScalarField.H | 186 +++++++ ...aryEpsilonWallFunctionFvPatchScalarField.C | 4 +- ...aryEpsilonWallFunctionFvPatchScalarField.H | 191 +++++++ ...ersedBoundaryKqRWallFunctionFvPatchField.C | 243 +++++++++ ...ersedBoundaryKqRWallFunctionFvPatchField.H | 194 +++++++ ...rsedBoundaryKqRWallFunctionFvPatchFields.C | 49 ++ ...rsedBoundaryKqRWallFunctionFvPatchFields.H | 55 ++ ...oundaryMutWallFunctionFvPatchScalarField.C | 226 ++++++++ ...oundaryMutWallFunctionFvPatchScalarField.H | 182 +++++++ ...ndaryOmegaWallFunctionFvPatchScalarField.C | 283 ++++++++++ ...ndaryOmegaWallFunctionFvPatchScalarField.H | 205 ++++++++ .../{ => incompressible}/Make/files | 5 +- .../{ => incompressible}/Make/options | 0 ...aryEpsilonWallFunctionFvPatchScalarField.C | 289 +++++++++++ ...aryEpsilonWallFunctionFvPatchScalarField.H | 0 ...ersedBoundaryKqRWallFunctionFvPatchField.C | 0 ...ersedBoundaryKqRWallFunctionFvPatchField.H | 0 ...rsedBoundaryKqRWallFunctionFvPatchFields.C | 0 ...rsedBoundaryKqRWallFunctionFvPatchFields.H | 0 ...oundaryNutWallFunctionFvPatchScalarField.C | 2 +- ...oundaryNutWallFunctionFvPatchScalarField.H | 0 ...ndaryOmegaWallFunctionFvPatchScalarField.C | 0 ...ndaryOmegaWallFunctionFvPatchScalarField.H | 0 .../backwardsCompatibilityIbWallFunctions.C | 336 ------------ .../backwardsCompatibilityIbWallFunctions.H | 158 ------ ...rdsCompatibilityIbWallFunctionsTemplates.C | 184 ------- .../immersedBoundaryKOmegaSST.C | 483 ------------------ .../immersedBoundaryKOmegaSST.H | 313 ------------ 34 files changed, 2398 insertions(+), 1482 deletions(-) create mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/CMakeLists.txt create mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/compressible/Make/files create mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/compressible/Make/options create mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryAlphatWallFunction/immersedBoundaryAlphatWallFunctionFvPatchScalarField.C create mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryAlphatWallFunction/immersedBoundaryAlphatWallFunctionFvPatchScalarField.H rename src/immersedBoundary/immersedBoundaryTurbulence/{ => compressible}/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.C (99%) create mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.H create mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchField.C create mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchField.H create mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchFields.C create mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchFields.H create mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryMutWallFunction/immersedBoundaryMutWallFunctionFvPatchScalarField.C create mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryMutWallFunction/immersedBoundaryMutWallFunctionFvPatchScalarField.H create mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.C create mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.H rename src/immersedBoundary/immersedBoundaryTurbulence/{ => incompressible}/Make/files (61%) rename src/immersedBoundary/immersedBoundaryTurbulence/{ => incompressible}/Make/options (100%) create mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.C rename src/immersedBoundary/immersedBoundaryTurbulence/{ => incompressible}/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.H (100%) rename src/immersedBoundary/immersedBoundaryTurbulence/{ => incompressible}/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchField.C (100%) rename src/immersedBoundary/immersedBoundaryTurbulence/{ => incompressible}/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchField.H (100%) rename src/immersedBoundary/immersedBoundaryTurbulence/{ => incompressible}/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchFields.C (100%) rename src/immersedBoundary/immersedBoundaryTurbulence/{ => incompressible}/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchFields.H (100%) rename src/immersedBoundary/immersedBoundaryTurbulence/{ => incompressible}/wallFunctions/immersedBoundaryNutWallFunction/immersedBoundaryNutWallFunctionFvPatchScalarField.C (99%) rename src/immersedBoundary/immersedBoundaryTurbulence/{ => incompressible}/wallFunctions/immersedBoundaryNutWallFunction/immersedBoundaryNutWallFunctionFvPatchScalarField.H (100%) rename src/immersedBoundary/immersedBoundaryTurbulence/{ => incompressible}/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.C (100%) rename src/immersedBoundary/immersedBoundaryTurbulence/{ => incompressible}/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.H (100%) delete mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/backwardsCompability/wallFunctions/backwardsCompatibilityIbWallFunctions.C delete mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/backwardsCompability/wallFunctions/backwardsCompatibilityIbWallFunctions.H delete mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/backwardsCompability/wallFunctions/backwardsCompatibilityIbWallFunctionsTemplates.C delete mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/immersedBoundaryKOmegaSST/immersedBoundaryKOmegaSST.C delete mode 100644 src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/immersedBoundaryKOmegaSST/immersedBoundaryKOmegaSST.H diff --git a/src/Allwmake b/src/Allwmake index 6ff5d803d..755fa7dbd 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -80,7 +80,8 @@ wmake libso solidModels wmake libso dbns wmake libso immersedBoundary/immersedBoundary -wmake libso immersedBoundary/immersedBoundaryTurbulence +wmake libso immersedBoundary/immersedBoundaryTurbulence/incompressible +wmake libso immersedBoundary/immersedBoundaryTurbulence/compressible wmake libso immersedBoundary/immersedBoundaryDynamicMesh wmake libso overset/oversetMesh diff --git a/src/immersedBoundary/CMakeLists.txt b/src/immersedBoundary/CMakeLists.txt index 065dac471..18c31328d 100644 --- a/src/immersedBoundary/CMakeLists.txt +++ b/src/immersedBoundary/CMakeLists.txt @@ -32,3 +32,4 @@ add_subdirectory(immersedBoundary) add_subdirectory(immersedBoundaryDynamicMesh) +add_subdirectory(immersedBoundaryTurbulence) diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/CMakeLists.txt b/src/immersedBoundary/immersedBoundaryTurbulence/CMakeLists.txt new file mode 100644 index 000000000..ef9f3f406 --- /dev/null +++ b/src/immersedBoundary/immersedBoundaryTurbulence/CMakeLists.txt @@ -0,0 +1,34 @@ +# -------------------------------------------------------------------------- +# ======== | +# \ / F ield | foam-extend: Open Source CFD +# \ / O peration | Version: 4.1 +# \ / A nd | Web: http://www.foam-extend.org +# \/ M anipulation | For copyright notice see file Copyright +# -------------------------------------------------------------------------- +# License +# This file is part of foam-extend. +# +# foam-extend is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# foam-extend 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 foam-extend. If not, see . +# +# Description +# CMakeLists.txt file for libraries and applications +# +# Author +# Hrvoje Jasak, Wikki Ltd, 2019. All rights reserved +# +# +# -------------------------------------------------------------------------- + +add_subdirectory(incompressible) +add_subdirectory(compressible) diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/compressible/Make/files b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/Make/files new file mode 100644 index 000000000..3350966ea --- /dev/null +++ b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/Make/files @@ -0,0 +1,8 @@ +wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchFields.C +wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.C +wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.C + +wallFunctions/immersedBoundaryMutWallFunction/immersedBoundaryMutWallFunctionFvPatchScalarField.C +wallFunctions/immersedBoundaryAlphatWallFunction/immersedBoundaryAlphatWallFunctionFvPatchScalarField.C + +LIB = $(FOAM_LIBBIN)/libcompressibleImmersedBoundaryTurbulence diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/compressible/Make/options b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/Make/options new file mode 100644 index 000000000..388010238 --- /dev/null +++ b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/Make/options @@ -0,0 +1,17 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/immersedBoundary/immersedBoundary/lnInclude \ + -I$(LIB_SRC)/turbulenceModels \ + -I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude + +LIB_LIBS = \ + -lfiniteVolume \ + -lmeshTools \ + -lsampling \ + -limmersedBoundary \ + -lcompressibleTurbulenceModel \ + -lbasicThermophysicalModels \ + -lspecie diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryAlphatWallFunction/immersedBoundaryAlphatWallFunctionFvPatchScalarField.C b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryAlphatWallFunction/immersedBoundaryAlphatWallFunctionFvPatchScalarField.C new file mode 100644 index 000000000..a02cc2b4c --- /dev/null +++ b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryAlphatWallFunction/immersedBoundaryAlphatWallFunctionFvPatchScalarField.C @@ -0,0 +1,229 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "immersedBoundaryAlphatWallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "standAlonePatch.H" +#include "surfaceWriter.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +immersedBoundaryAlphatWallFunctionFvPatchScalarField:: +immersedBoundaryAlphatWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + alphatWallFunctionFvPatchScalarField(p, iF), + immersedBoundaryFieldBase(p, true, 1e-6) +{} + + +immersedBoundaryAlphatWallFunctionFvPatchScalarField:: +immersedBoundaryAlphatWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + alphatWallFunctionFvPatchScalarField(p, iF), // Do not read mixed data + immersedBoundaryFieldBase(p, true, 1e-6) +{ + this->readPatchType(dict); + + if (!isType(p)) + { + FatalIOErrorInFunction(dict) + << "\n patch type '" << p.type() + << "' not constraint type '" << typeName << "'" + << "\n for patch " << p.name() + << " of field " << this->dimensionedInternalField().name() + << " in file " << this->dimensionedInternalField().objectPath() + << exit(FatalIOError); + } + + scalarField::operator=(this->patchInternalField()); +} + + +immersedBoundaryAlphatWallFunctionFvPatchScalarField:: +immersedBoundaryAlphatWallFunctionFvPatchScalarField +( + const immersedBoundaryAlphatWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + alphatWallFunctionFvPatchScalarField(p, iF), // Do not map mixed data. Set patchType later + immersedBoundaryFieldBase(p, true, 1e-6) +{ + // Note: NO MAPPING. Fields are created on the immersed boundary + // HJ, 12/Apr/2012 + if (!isType(p)) + { + FatalErrorInFunction + << "\n patch type '" << p.type() + << "' not constraint type '" << typeName << "'" + << "\n for patch " << p.name() + << " of field " << this->dimensionedInternalField().name() + << " in file " << this->dimensionedInternalField().objectPath() + << exit(FatalIOError); + } + + this->setPatchType(ptf); + + // On creation of the mapped field, the internal field is dummy and + // cannot be used. Initialise the value to avoid errors + // HJ, 1/Dec/2017 + scalarField::operator=(scalar(0)); +} + + +immersedBoundaryAlphatWallFunctionFvPatchScalarField:: +immersedBoundaryAlphatWallFunctionFvPatchScalarField +( + const immersedBoundaryAlphatWallFunctionFvPatchScalarField& ptf +) +: + alphatWallFunctionFvPatchScalarField(ptf), + immersedBoundaryFieldBase(ptf.ibPatch(), true, 1e-6) +{ + this->setPatchType(ptf); +} + + +immersedBoundaryAlphatWallFunctionFvPatchScalarField:: +immersedBoundaryAlphatWallFunctionFvPatchScalarField +( + const immersedBoundaryAlphatWallFunctionFvPatchScalarField& ptf, + const DimensionedField& iF +) +: + alphatWallFunctionFvPatchScalarField(ptf, iF), + immersedBoundaryFieldBase(ptf.ibPatch(), true, 1e-6) +{ + this->setPatchType(ptf); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void immersedBoundaryAlphatWallFunctionFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& +) +{ + scalarField::operator=(this->patchInternalField()); +} + + +void immersedBoundaryAlphatWallFunctionFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& +) +{} + + +void immersedBoundaryAlphatWallFunctionFvPatchScalarField::updateOnMotion() +{ + if (size() != ibPatch().size()) + { + // Use internal values, resizing the file if needed + scalarField::operator=(this->patchInternalField()); + } +} + + +void immersedBoundaryAlphatWallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes commsType +) +{ + // Resize fields + if (size() != patch().size()) + { + Info<< "Resizing immersedBoundaryAlphatWallFunction in evaluate" + << endl; + + scalarField::operator=(patchInternalField()); + } + + // Get non-constant reference to internal field + scalarField& intField = const_cast(this->internalField()); + + // Set dead value + this->setDeadValues(intField); + + alphatWallFunctionFvPatchScalarField::evaluate(commsType); +} + + +void immersedBoundaryAlphatWallFunctionFvPatchScalarField::write +( + Ostream& os +) const +{ + fvPatchScalarField::write(os); + writeLocalEntries(os); + + // The value entry needs to be written with zero size + scalarField::null().writeEntry("value", os); + // this->writeEntry("value", os); + + writeField(*this); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + immersedBoundaryAlphatWallFunctionFvPatchScalarField +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryAlphatWallFunction/immersedBoundaryAlphatWallFunctionFvPatchScalarField.H b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryAlphatWallFunction/immersedBoundaryAlphatWallFunctionFvPatchScalarField.H new file mode 100644 index 000000000..cd360c959 --- /dev/null +++ b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryAlphatWallFunction/immersedBoundaryAlphatWallFunctionFvPatchScalarField.H @@ -0,0 +1,186 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +Class + Foam::compressible::RASModels::immersedBoundaryAlphatWallFunctionFvPatchScalarField + +Description + Boundary condition for turbulent (kinematic) viscosity when using wall + functions on immersed boundary patches + - replicates OpenFOAM v1.5 (and earlier) behaviour + +SourceFiles + immersedBoundaryAlphatWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef immersedBoundaryAlphatWallFunctionFvPatchScalarField_H +#define immersedBoundaryAlphatWallFunctionFvPatchScalarField_H + +#include "alphatWallFunctionFvPatchScalarField.H" +#include "immersedBoundaryFieldBase.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class immersedBoundaryAlphatWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class immersedBoundaryAlphatWallFunctionFvPatchScalarField +: + public alphatWallFunctionFvPatchScalarField, + public immersedBoundaryFieldBase +{ +public: + + //- Runtime type information + TypeName("immersedBoundaryAlphatWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + immersedBoundaryAlphatWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + immersedBoundaryAlphatWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // immersedBoundaryAlphatWallFunctionFvPatchScalarField + // onto a new patch + immersedBoundaryAlphatWallFunctionFvPatchScalarField + ( + const immersedBoundaryAlphatWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + immersedBoundaryAlphatWallFunctionFvPatchScalarField + ( + const immersedBoundaryAlphatWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new immersedBoundaryAlphatWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + immersedBoundaryAlphatWallFunctionFvPatchScalarField + ( + const immersedBoundaryAlphatWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new immersedBoundaryAlphatWallFunctionFvPatchScalarField + ( + *this, + iF + ) + ); + } + + + //- Destructor + virtual ~immersedBoundaryAlphatWallFunctionFvPatchScalarField() + {} + + + // Member functions + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + //- Update on mesh motion + virtual void updateOnMotion(); + + + // Evaluation functions + + //- Evaluate the patchField + virtual void evaluate + ( + const Pstream::commsTypes = Pstream::blocking + ); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.C b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.C similarity index 99% rename from src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.C rename to src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.C index 102fc5f8c..3edcdd566 100644 --- a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.C +++ b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.C @@ -35,7 +35,7 @@ License namespace Foam { -namespace incompressible +namespace compressible { namespace RASModels { @@ -279,7 +279,7 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace RASModels -} // End namespace incompressible +} // End namespace compressible } // End namespace Foam // ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.H b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.H new file mode 100644 index 000000000..6695e6ffe --- /dev/null +++ b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.H @@ -0,0 +1,191 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.1 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +Class + Foam::compressible::RASModels::immersedBoundaryEpsilonWallFunctionFvPatchScalarField + +Description + Boundary condition for epsilon when using wall functions + on immersed boundary patches + +Author + Hrvoje Jasak, Wikki Ltd. All rights reserved + +SourceFiles + immersedBoundaryEpsilonWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef immersedBoundaryEpsilonWallFunctionFvPatchScalarField_H +#define immersedBoundaryEpsilonWallFunctionFvPatchScalarField_H + +#include "epsilonWallFunctionFvPatchScalarField.H" +#include "immersedBoundaryFieldBase.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class immersedBoundaryEpsilonWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class immersedBoundaryEpsilonWallFunctionFvPatchScalarField +: + public epsilonWallFunctionFvPatchScalarField, + public immersedBoundaryFieldBase +{ +public: + + //- Runtime type information + TypeName("compressible::immersedBoundaryEpsilonWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + immersedBoundaryEpsilonWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + immersedBoundaryEpsilonWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // immersedBoundaryEpsilonWallFunctionFvPatchScalarField + // onto a new patch + immersedBoundaryEpsilonWallFunctionFvPatchScalarField + ( + const immersedBoundaryEpsilonWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + immersedBoundaryEpsilonWallFunctionFvPatchScalarField + ( + const immersedBoundaryEpsilonWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new immersedBoundaryEpsilonWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + immersedBoundaryEpsilonWallFunctionFvPatchScalarField + ( + const immersedBoundaryEpsilonWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new immersedBoundaryEpsilonWallFunctionFvPatchScalarField + ( + *this, + iF + ) + ); + } + + + //- Destructor + virtual ~immersedBoundaryEpsilonWallFunctionFvPatchScalarField() + {} + + + // Member functions + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + //- Update on mesh motion + virtual void updateOnMotion(); + + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Evaluate the patchField + virtual void evaluate + ( + const Pstream::commsTypes = Pstream::blocking + ); + + + // I-O + + //- Write + void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchField.C b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchField.C new file mode 100644 index 000000000..7f40e8f74 --- /dev/null +++ b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchField.C @@ -0,0 +1,243 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "immersedBoundaryKqRWallFunctionFvPatchField.H" +#include "fvPatchFieldMapper.H" +#include "standAlonePatch.H" +#include "surfaceWriter.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void immersedBoundaryKqRWallFunctionFvPatchField::checkType() +{ + if (!this->patch().isWall()) + { + FatalErrorIn("immersedBoundaryKqRWallFunctionFvPatchField::checkType()") + << "Invalid wall function specification" << nl + << " Patch type for patch " << this->patch().name() + << " must be wall" << nl + << " Current patch type is " << this->patch().type() + << nl << endl + << abort(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +immersedBoundaryKqRWallFunctionFvPatchField:: +immersedBoundaryKqRWallFunctionFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + kqRWallFunctionFvPatchField(p, iF), + immersedBoundaryFieldBase(p, true, pTraits::one*SMALL) +{ + this->checkType(); +} + + +template +immersedBoundaryKqRWallFunctionFvPatchField:: +immersedBoundaryKqRWallFunctionFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + kqRWallFunctionFvPatchField(p, iF), // Do not read mixed data + immersedBoundaryFieldBase + ( + p, + Switch(dict.lookup("setDeadValue")), + pTraits(dict.lookup("deadValue")) + ) +{ + this->readPatchType(dict); + this->checkType(); + + Field::operator=(this->patchInternalField()); +} + + +template +immersedBoundaryKqRWallFunctionFvPatchField:: +immersedBoundaryKqRWallFunctionFvPatchField +( + const immersedBoundaryKqRWallFunctionFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + kqRWallFunctionFvPatchField(p, iF), // Do not map mixed data. Set patchType later + immersedBoundaryFieldBase + ( + p, + ptf.setDeadValue(), + ptf.deadValue() + ) +{ + this->setPatchType(ptf); + this->checkType(); + + // cannot be used. Initialise the value to avoid errors + // HJ, 1/Dec/2017 + Field::operator=(pTraits::zero); +} + + +template +immersedBoundaryKqRWallFunctionFvPatchField:: +immersedBoundaryKqRWallFunctionFvPatchField +( + const immersedBoundaryKqRWallFunctionFvPatchField& ptf +) +: + kqRWallFunctionFvPatchField(ptf), + immersedBoundaryFieldBase + ( + ptf.ibPatch(), + ptf.setDeadValue(), + ptf.deadValue() + ) +{ + this->setPatchType(ptf); + this->checkType(); +} + + +template +immersedBoundaryKqRWallFunctionFvPatchField:: +immersedBoundaryKqRWallFunctionFvPatchField +( + const immersedBoundaryKqRWallFunctionFvPatchField& ptf, + const DimensionedField& iF +) +: + kqRWallFunctionFvPatchField(ptf, iF), + immersedBoundaryFieldBase + ( + ptf.ibPatch(), + ptf.setDeadValue(), + ptf.deadValue() + ) +{ + this->setPatchType(ptf); + this->checkType(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void immersedBoundaryKqRWallFunctionFvPatchField::autoMap +( + const fvPatchFieldMapper& +) +{ + Field::operator=(this->patchInternalField()); +} + + +template +void immersedBoundaryKqRWallFunctionFvPatchField::rmap +( + const fvPatchField& ptf, + const labelList& +) +{} + + +template +void immersedBoundaryKqRWallFunctionFvPatchField::updateOnMotion() +{ + if (this->size() != this->ibPatch().size()) + { + // Use internal values, resizing the file if needed + Field::operator=(this->patchInternalField()); + } +} + + +template +void immersedBoundaryKqRWallFunctionFvPatchField::evaluate +( + const Pstream::commsTypes commsType +) +{ + // Resize on evaluation if needed + if (this->size() != this->ibPatch().size()) + { + // Use internal values, resizing the file if needed + Field::operator=(this->patchInternalField()); + } + + // Get non-constant reference to internal field + Field& intField = const_cast&>(this->internalField()); + + // Set dead value + this->setDeadValues(intField); + + kqRWallFunctionFvPatchField::evaluate(commsType); +} + + +template +void immersedBoundaryKqRWallFunctionFvPatchField::write(Ostream& os) const +{ + fvPatchField::write(os); + this->writeDeadData(os); + + // The value entry needs to be written with zero size + Field::null().writeEntry("value", os); + // this->writeEntry("value", os); + + this->writeField(*this); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchField.H b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchField.H new file mode 100644 index 000000000..e87517a37 --- /dev/null +++ b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchField.H @@ -0,0 +1,194 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +Class + Foam::compressible::RASModels::immersedBoundaryKqRWallFunctionFvPatchField + +Description + Boundary condition for turbulence k, Q, and R when using wall functions. + Simply acts as a zero gradient condition. + +SourceFiles + immersedBoundaryKqRWallFunctionFvPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef immersedBoundaryKqRWallFunctionFvPatchField_H +#define immersedBoundaryKqRWallFunctionFvPatchField_H + +#include "kqRWallFunctionFvPatchFields.H" +#include "immersedBoundaryFieldBase.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class immersedBoundaryKqRWallFunctionFvPatchField Declaration +\*---------------------------------------------------------------------------*/ + +template +class immersedBoundaryKqRWallFunctionFvPatchField +: + public kqRWallFunctionFvPatchField, + public immersedBoundaryFieldBase +{ + // Private member functions + + //- Check the type of the patch + void checkType(); + + +public: + + //- Runtime type information + TypeName("compressible::immersedBoundaryKqRWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + immersedBoundaryKqRWallFunctionFvPatchField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + immersedBoundaryKqRWallFunctionFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // immersedBoundaryKqRWallFunctionFvPatchField + // onto a new patch + immersedBoundaryKqRWallFunctionFvPatchField + ( + const immersedBoundaryKqRWallFunctionFvPatchField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + immersedBoundaryKqRWallFunctionFvPatchField + ( + const immersedBoundaryKqRWallFunctionFvPatchField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new immersedBoundaryKqRWallFunctionFvPatchField(*this) + ); + } + + //- Construct as copy setting internal field reference + immersedBoundaryKqRWallFunctionFvPatchField + ( + const immersedBoundaryKqRWallFunctionFvPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new immersedBoundaryKqRWallFunctionFvPatchField(*this, iF) + ); + } + + + //- Destructor + virtual ~immersedBoundaryKqRWallFunctionFvPatchField() + {} + + + // Member functions + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchField&, + const labelList& + ); + + //- Update on mesh motion + virtual void updateOnMotion(); + + + // Evaluation functions + + //- Evaluate the patchField + virtual void evaluate + ( + const Pstream::commsTypes commsType = Pstream::blocking + ); + + + // I-O + + //- Write + void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "immersedBoundaryKqRWallFunctionFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchFields.C b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchFields.C new file mode 100644 index 000000000..c729790b2 --- /dev/null +++ b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchFields.C @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "immersedBoundaryKqRWallFunctionFvPatchFields.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePatchFields(immersedBoundaryKqRWallFunction); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchFields.H b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchFields.H new file mode 100644 index 000000000..bb3e8530b --- /dev/null +++ b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchFields.H @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#ifndef immersedBoundaryKqRWallFunctionFvPatchFields_H +#define immersedBoundaryKqRWallFunctionFvPatchFields_H + +#include "immersedBoundaryKqRWallFunctionFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(immersedBoundaryKqRWallFunction) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryMutWallFunction/immersedBoundaryMutWallFunctionFvPatchScalarField.C b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryMutWallFunction/immersedBoundaryMutWallFunctionFvPatchScalarField.C new file mode 100644 index 000000000..e7d0c99e8 --- /dev/null +++ b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryMutWallFunction/immersedBoundaryMutWallFunctionFvPatchScalarField.C @@ -0,0 +1,226 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "immersedBoundaryMutWallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "standAlonePatch.H" +#include "surfaceWriter.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +immersedBoundaryMutWallFunctionFvPatchScalarField:: +immersedBoundaryMutWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + mutkWallFunctionFvPatchScalarField(p, iF), + immersedBoundaryFieldBase(p, true, 1e-6) +{} + + +immersedBoundaryMutWallFunctionFvPatchScalarField:: +immersedBoundaryMutWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + mutkWallFunctionFvPatchScalarField(p, iF), // Do not read mixed data + immersedBoundaryFieldBase(p, true, 1e-6) +{ + this->readPatchType(dict); + + if (!isType(p)) + { + FatalIOErrorInFunction(dict) + << "\n patch type '" << p.type() + << "' not constraint type '" << typeName << "'" + << "\n for patch " << p.name() + << " of field " << this->dimensionedInternalField().name() + << " in file " << this->dimensionedInternalField().objectPath() + << exit(FatalIOError); + } + + scalarField::operator=(this->patchInternalField()); +} + + +immersedBoundaryMutWallFunctionFvPatchScalarField:: +immersedBoundaryMutWallFunctionFvPatchScalarField +( + const immersedBoundaryMutWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + mutkWallFunctionFvPatchScalarField(p, iF), // Do not map mixed data. Set patchType later + immersedBoundaryFieldBase(p, true, 1e-6) +{ + // Note: NO MAPPING. Fields are created on the immersed boundary + // HJ, 12/Apr/2012 + if (!isType(p)) + { + FatalErrorInFunction + << "\n patch type '" << p.type() + << "' not constraint type '" << typeName << "'" + << "\n for patch " << p.name() + << " of field " << this->dimensionedInternalField().name() + << " in file " << this->dimensionedInternalField().objectPath() + << exit(FatalIOError); + } + + this->setPatchType(ptf); + + // On creation of the mapped field, the internal field is dummy and + // cannot be used. Initialise the value to avoid errors + // HJ, 1/Dec/2017 + scalarField::operator=(scalar(0)); +} + + +immersedBoundaryMutWallFunctionFvPatchScalarField:: +immersedBoundaryMutWallFunctionFvPatchScalarField +( + const immersedBoundaryMutWallFunctionFvPatchScalarField& ptf +) +: + mutkWallFunctionFvPatchScalarField(ptf), + immersedBoundaryFieldBase(ptf.ibPatch(), true, 1e-6) +{ + this->setPatchType(ptf); +} + + +immersedBoundaryMutWallFunctionFvPatchScalarField:: +immersedBoundaryMutWallFunctionFvPatchScalarField +( + const immersedBoundaryMutWallFunctionFvPatchScalarField& ptf, + const DimensionedField& iF +) +: + mutkWallFunctionFvPatchScalarField(ptf, iF), + immersedBoundaryFieldBase(ptf.ibPatch(), true, 1e-6) +{ + this->setPatchType(ptf); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void immersedBoundaryMutWallFunctionFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& +) +{ + scalarField::operator=(this->patchInternalField()); +} + + +void immersedBoundaryMutWallFunctionFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& +) +{} + + +void immersedBoundaryMutWallFunctionFvPatchScalarField::updateOnMotion() +{ + if (size() != ibPatch().size()) + { + // Use internal values, resizing the file if needed + scalarField::operator=(this->patchInternalField()); + } +} + + +void immersedBoundaryMutWallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes commsType +) +{ + // Resize fields + if (size() != patch().size()) + { + Info<< "Resizing immersedBoundaryMutWallFunction in evaluate" + << endl; + + scalarField::operator=(patchInternalField()); + } + + // Get non-constant reference to internal field + scalarField& intField = const_cast(this->internalField()); + + // Set dead value + this->setDeadValues(intField); + + mutkWallFunctionFvPatchScalarField::evaluate(commsType); +} + + +void immersedBoundaryMutWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fvPatchScalarField::write(os); + writeLocalEntries(os); + + // The value entry needs to be written with zero size + scalarField::null().writeEntry("value", os); + // this->writeEntry("value", os); + + writeField(*this); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + immersedBoundaryMutWallFunctionFvPatchScalarField +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryMutWallFunction/immersedBoundaryMutWallFunctionFvPatchScalarField.H b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryMutWallFunction/immersedBoundaryMutWallFunctionFvPatchScalarField.H new file mode 100644 index 000000000..7cae24902 --- /dev/null +++ b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryMutWallFunction/immersedBoundaryMutWallFunctionFvPatchScalarField.H @@ -0,0 +1,182 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +Class + Foam::compressible::RASModels::immersedBoundaryMutWallFunctionFvPatchScalarField + +Description + Boundary condition for turbulent (kinematic) viscosity when using wall + functions on immersed boundary patches + - replicates OpenFOAM v1.5 (and earlier) behaviour + +SourceFiles + immersedBoundaryMutWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef immersedBoundaryMutWallFunctionFvPatchScalarField_H +#define immersedBoundaryMutWallFunctionFvPatchScalarField_H + +#include "mutkWallFunctionFvPatchScalarField.H" +#include "immersedBoundaryFieldBase.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class immersedBoundaryMutWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class immersedBoundaryMutWallFunctionFvPatchScalarField +: + public mutkWallFunctionFvPatchScalarField, + public immersedBoundaryFieldBase +{ +public: + + //- Runtime type information + TypeName("immersedBoundaryMutWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + immersedBoundaryMutWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + immersedBoundaryMutWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // immersedBoundaryMutWallFunctionFvPatchScalarField + // onto a new patch + immersedBoundaryMutWallFunctionFvPatchScalarField + ( + const immersedBoundaryMutWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + immersedBoundaryMutWallFunctionFvPatchScalarField + ( + const immersedBoundaryMutWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new immersedBoundaryMutWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + immersedBoundaryMutWallFunctionFvPatchScalarField + ( + const immersedBoundaryMutWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new immersedBoundaryMutWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + //- Destructor + virtual ~immersedBoundaryMutWallFunctionFvPatchScalarField() + {} + + + // Member functions + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + //- Update on mesh motion + virtual void updateOnMotion(); + + + // Evaluation functions + + //- Evaluate the patchField + virtual void evaluate + ( + const Pstream::commsTypes = Pstream::blocking + ); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.C b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.C new file mode 100644 index 000000000..67b8b4c13 --- /dev/null +++ b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.C @@ -0,0 +1,283 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "immersedBoundaryOmegaWallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +immersedBoundaryOmegaWallFunctionFvPatchScalarField:: +immersedBoundaryOmegaWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + omegaWallFunctionFvPatchScalarField(p, iF), + immersedBoundaryFieldBase(p, true, 90) +{} + + +immersedBoundaryOmegaWallFunctionFvPatchScalarField:: +immersedBoundaryOmegaWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + omegaWallFunctionFvPatchScalarField(p, iF), // Do not read mixed data + immersedBoundaryFieldBase + ( + p, + Switch(dict.lookup("setDeadValue")), + readScalar(dict.lookup("deadValue")) + ) +{ + this->readPatchType(dict); + + if (!isType(p)) + { + FatalIOErrorInFunction(dict) + << "\n patch type '" << p.type() + << "' not constraint type '" << typeName << "'" + << "\n for patch " << p.name() + << " of field " << this->dimensionedInternalField().name() + << " in file " << this->dimensionedInternalField().objectPath() + << exit(FatalIOError); + } + + scalarField::operator=(this->patchInternalField()); +} + + +immersedBoundaryOmegaWallFunctionFvPatchScalarField:: +immersedBoundaryOmegaWallFunctionFvPatchScalarField +( + const immersedBoundaryOmegaWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + omegaWallFunctionFvPatchScalarField(p, iF), // Do not map mixed data. Set patchType later + immersedBoundaryFieldBase + ( + p, + ptf.setDeadValue(), + ptf.deadValue() + ) +{ + // Note: NO MAPPING. Fields are created on the immersed boundary + // HJ, 12/Apr/2012 + if (!isType(p)) + { + FatalErrorInFunction + << "\n patch type '" << p.type() + << "' not constraint type '" << typeName << "'" + << "\n for patch " << p.name() + << " of field " << this->dimensionedInternalField().name() + << " in file " << this->dimensionedInternalField().objectPath() + << exit(FatalIOError); + } + + this->setPatchType(ptf); + + // On creation of the mapped field, the internal field is dummy and + // cannot be used. Initialise the value to avoid errors + // HJ, 1/Dec/2017 + scalarField::operator=(SMALL); +} + + +immersedBoundaryOmegaWallFunctionFvPatchScalarField:: +immersedBoundaryOmegaWallFunctionFvPatchScalarField +( + const immersedBoundaryOmegaWallFunctionFvPatchScalarField& ptf +) +: + omegaWallFunctionFvPatchScalarField(ptf), + immersedBoundaryFieldBase + ( + ptf.ibPatch(), + ptf.setDeadValue(), + ptf.deadValue() + ) +{ + this->setPatchType(ptf); +} + + +immersedBoundaryOmegaWallFunctionFvPatchScalarField:: +immersedBoundaryOmegaWallFunctionFvPatchScalarField +( + const immersedBoundaryOmegaWallFunctionFvPatchScalarField& ptf, + const DimensionedField& iF +) +: + omegaWallFunctionFvPatchScalarField(ptf, iF), + immersedBoundaryFieldBase + ( + ptf.ibPatch(), + ptf.setDeadValue(), + ptf.deadValue() + ) +{ + this->setPatchType(ptf); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void immersedBoundaryOmegaWallFunctionFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& +) +{ + scalarField::operator=(this->patchInternalField()); + + // Resize refValue as well. HJ, 10/Jul/2018 + refValue() = this->patchInternalField(); +} + + +void immersedBoundaryOmegaWallFunctionFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& +) +{} + + +void immersedBoundaryOmegaWallFunctionFvPatchScalarField::updateOnMotion() +{ + if (size() != ibPatch().size()) + { + // Use internal values, resizing the file if needed + scalarField::operator=(this->patchInternalField()); + + // Resize refValue as well. HJ, 10/Jul/2018 + refValue() = this->patchInternalField(); + } +} + + +void immersedBoundaryOmegaWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + // Resize fields + if (size() != this->ibPatch().size()) + { + Info<< "Resizing immersedBoundaryOmegaWallFunction in evaluate: " + << "patch: " << patch().size() << " field: " << size() + << endl; + + *this == patchInternalField(); + refValue() = patchInternalField(); + } + + // If G field is present, execute evaluation + // Remove the warning from the IB patch + // HJ, 20/May/2018 + if (db().foundObject(GName())) + { + omegaWallFunctionFvPatchScalarField::updateCoeffs(); + } +} + + +void immersedBoundaryOmegaWallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes commsType +) +{ + // Resize fields + if (size() != this->ibPatch().size()) + { + Info<< "Resizing immersedBoundaryOmegaWallFunction in evaluate" + << endl; + + *this == patchInternalField(); + refValue() = patchInternalField(); + } + + // Get non-constant reference to internal field + scalarField& intField = const_cast(this->internalField()); + + // Set dead value + this->setDeadValues(intField); + + omegaWallFunctionFvPatchScalarField::evaluate(commsType); +} + + +void immersedBoundaryOmegaWallFunctionFvPatchScalarField::write +( + Ostream& os +) const +{ + fvPatchScalarField::write(os); + writeLocalEntries(os); + this->writeDeadData(os); + + // The value entry needs to be written with zero size + scalarField::null().writeEntry("value", os); + // this->writeEntry("value", os); + + writeField(*this); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + immersedBoundaryOmegaWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.H b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.H new file mode 100644 index 000000000..3e8593339 --- /dev/null +++ b/src/immersedBoundary/immersedBoundaryTurbulence/compressible/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.H @@ -0,0 +1,205 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +Class + Foam::compressible::RASModels::omegaWallFunctionFvPatchScalarField + +Description + Provides a wall function boundary condition/constraint on omega + + Computed value is: + + omega = sqrt(omega_vis^2 + omega_log^2) + + where + omega_vis = omega in viscous region + omega_log = omega in logarithmic region + + Model described by Eq.(15) of: + @verbatim + Menter, F., Esch, T. + "Elements of Industrial Heat Transfer Prediction" + 16th Brazilian Congress of Mechanical Engineering (COBEM), + Nov. 2001 + @endverbatim + +Description + Boundary condition for omega when using wall functions + on immersed boundary patches + +Author + Hrvoje Jasak, Wikki Ltd. All rights reserved + +SourceFiles + immersedBoundaryOmegaWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef immersedBoundaryOmegaWallFunctionFvPatchScalarField_H +#define immersedBoundaryOmegaWallFunctionFvPatchScalarField_H + +#include "omegaWallFunctionFvPatchScalarField.H" +#include "immersedBoundaryFieldBase.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class immersedBoundaryOmegaWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class immersedBoundaryOmegaWallFunctionFvPatchScalarField +: + public omegaWallFunctionFvPatchScalarField, + public immersedBoundaryFieldBase +{ +public: + + //- Runtime type information + TypeName("compressible::immersedBoundaryOmegaWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + immersedBoundaryOmegaWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + immersedBoundaryOmegaWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // immersedBoundaryOmegaWallFunctionFvPatchScalarField + // onto a new patch + immersedBoundaryOmegaWallFunctionFvPatchScalarField + ( + const immersedBoundaryOmegaWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + immersedBoundaryOmegaWallFunctionFvPatchScalarField + ( + const immersedBoundaryOmegaWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new immersedBoundaryOmegaWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + immersedBoundaryOmegaWallFunctionFvPatchScalarField + ( + const immersedBoundaryOmegaWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new immersedBoundaryOmegaWallFunctionFvPatchScalarField + ( + *this, + iF + ) + ); + } + + + // Member functions + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + //- Update on mesh motion + virtual void updateOnMotion(); + + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Evaluate the patchField + virtual void evaluate + ( + const Pstream::commsTypes = Pstream::blocking + ); + + + // I-O + + //- Write + void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/Make/files b/src/immersedBoundary/immersedBoundaryTurbulence/incompressible/Make/files similarity index 61% rename from src/immersedBoundary/immersedBoundaryTurbulence/Make/files rename to src/immersedBoundary/immersedBoundaryTurbulence/incompressible/Make/files index 76e3a0ad7..fc853ae95 100644 --- a/src/immersedBoundary/immersedBoundaryTurbulence/Make/files +++ b/src/immersedBoundary/immersedBoundaryTurbulence/incompressible/Make/files @@ -3,7 +3,4 @@ wallFunctions/immersedBoundaryNutWallFunction/immersedBoundaryNutWallFunctionFvP wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.C wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.C -turbulenceModels/incompressible/RAS/backwardsCompability/wallFunctions/backwardsCompatibilityIbWallFunctions.C -turbulenceModels/incompressible/RAS/immersedBoundaryKOmegaSST/immersedBoundaryKOmegaSST.C - -LIB = $(FOAM_LIBBIN)/libimmersedBoundaryTurbulence +LIB = $(FOAM_LIBBIN)/libincompressibleImmersedBoundaryTurbulence diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/Make/options b/src/immersedBoundary/immersedBoundaryTurbulence/incompressible/Make/options similarity index 100% rename from src/immersedBoundary/immersedBoundaryTurbulence/Make/options rename to src/immersedBoundary/immersedBoundaryTurbulence/incompressible/Make/options diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.C b/src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.C new file mode 100644 index 000000000..87833197d --- /dev/null +++ b/src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.C @@ -0,0 +1,289 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.1 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "immersedBoundaryEpsilonWallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "standAlonePatch.H" +#include "surfaceWriter.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +immersedBoundaryEpsilonWallFunctionFvPatchScalarField:: +immersedBoundaryEpsilonWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + epsilonWallFunctionFvPatchScalarField(p, iF), + immersedBoundaryFieldBase(p, true, 0.09) +{} + + +immersedBoundaryEpsilonWallFunctionFvPatchScalarField:: +immersedBoundaryEpsilonWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + epsilonWallFunctionFvPatchScalarField(p, iF), // Do not read mixed data + immersedBoundaryFieldBase + ( + p, + Switch(dict.lookup("setDeadValue")), + readScalar(dict.lookup("deadValue")) + ) +{ + // Since patch does not read a dictionary, the patch type needs to be read + // manually. HJ, 6/Sep/2018 + this->readPatchType(dict); + + if (!isType(p)) + { + FatalIOErrorInFunction(dict) + << "\n patch type '" << p.type() + << "' not constraint type '" << typeName << "'" + << "\n for patch " << p.name() + << " of field " << this->dimensionedInternalField().name() + << " in file " << this->dimensionedInternalField().objectPath() + << exit(FatalIOError); + } + + scalarField::operator=(this->patchInternalField()); +} + + +immersedBoundaryEpsilonWallFunctionFvPatchScalarField:: +immersedBoundaryEpsilonWallFunctionFvPatchScalarField +( + const immersedBoundaryEpsilonWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + epsilonWallFunctionFvPatchScalarField(p, iF), // Do not map mixed data. Set patchType later + immersedBoundaryFieldBase + ( + p, + ptf.setDeadValue(), + ptf.deadValue() + ) +{ + // Note: NO MAPPING. Fields are created on the immersed boundary + // HJ, 12/Apr/2012 + if (!isType(p)) + { + FatalErrorInFunction + << "\n patch type '" << p.type() + << "' not constraint type '" << typeName << "'" + << "\n for patch " << p.name() + << " of field " << this->dimensionedInternalField().name() + << " in file " << this->dimensionedInternalField().objectPath() + << exit(FatalIOError); + } + + // Copy the patch type since mixed data was not mapped + this->setPatchType(ptf); + + // On creation of the mapped field, the internal field is dummy and + // cannot be used. Initialise the value to avoid errors + // HJ, 1/Dec/2017 + scalarField::operator=(SMALL); +} + + +immersedBoundaryEpsilonWallFunctionFvPatchScalarField:: +immersedBoundaryEpsilonWallFunctionFvPatchScalarField +( + const immersedBoundaryEpsilonWallFunctionFvPatchScalarField& ptf +) +: + epsilonWallFunctionFvPatchScalarField(ptf), + immersedBoundaryFieldBase + ( + ptf.ibPatch(), + ptf.setDeadValue(), + ptf.deadValue() + ) +{} + + +immersedBoundaryEpsilonWallFunctionFvPatchScalarField:: +immersedBoundaryEpsilonWallFunctionFvPatchScalarField +( + const immersedBoundaryEpsilonWallFunctionFvPatchScalarField& ptf, + const DimensionedField& iF +) +: + epsilonWallFunctionFvPatchScalarField(ptf, iF), + immersedBoundaryFieldBase + ( + ptf.ibPatch(), + ptf.setDeadValue(), + ptf.deadValue() + ) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void immersedBoundaryEpsilonWallFunctionFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& +) +{ + scalarField::operator=(this->patchInternalField()); + + // Resize refValue as well. HJ, 10/Jul/2018 + refValue() = this->patchInternalField(); +} + + +void immersedBoundaryEpsilonWallFunctionFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& +) +{} + + +void immersedBoundaryEpsilonWallFunctionFvPatchScalarField::updateOnMotion() +{ + if (size() != ibPatch().size()) + { + // Use internal values, resizing the file if needed + scalarField::operator=(this->patchInternalField()); + + // Resize refValue as well. HJ, 10/Jul/2018 + refValue() = this->patchInternalField(); + } +} + + +void immersedBoundaryEpsilonWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + // Resize fields + if (size() != patch().size()) + { + Info<< "Resizing immersedBoundaryEpsilonWallFunction in evaluate: " + << "patch: " << patch().size() << " field: " << size() + << endl; + + *this == patchInternalField(); + refValue() = patchInternalField(); + } + + // If G field is present, execute evaluation + // Remove the warning from the IB patch + // HJ, 20/May/2018 + if (db().foundObject(GName())) + { + epsilonWallFunctionFvPatchScalarField::updateCoeffs(); + } + + const RASModel& rasModel = db().lookupObject("RASProperties"); + const scalarField& y = rasModel.y()[patch().index()]; + Info<< "Patch y: (" << min(y) << " " << max(y) << ")" << endl; +} + + +void immersedBoundaryEpsilonWallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes commsType +) +{ + // Resize fields + if (size() != patch().size()) + { + Info<< "Resizing immersedBoundaryEpsilonWallFunction in evaluate" + << endl; + + *this == patchInternalField(); + refValue() = patchInternalField(); + } + + // Get non-constant reference to internal field + scalarField& intField = const_cast(this->internalField()); + + // Set dead value + this->setDeadValues(intField); + + epsilonWallFunctionFvPatchScalarField::evaluate(commsType); +} + + +void immersedBoundaryEpsilonWallFunctionFvPatchScalarField::write +( + Ostream& os +) const +{ + fvPatchScalarField::write(os); + writeLocalEntries(os); + this->writeDeadData(os); + + // The value entry needs to be written with zero size + scalarField::null().writeEntry("value", os); + // this->writeEntry("value", os); + + writeField(*this); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + immersedBoundaryEpsilonWallFunctionFvPatchScalarField +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.H b/src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.H similarity index 100% rename from src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.H rename to src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryEpsilonWallFunction/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.H diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchField.C b/src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchField.C similarity index 100% rename from src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchField.C rename to src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchField.C diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchField.H b/src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchField.H similarity index 100% rename from src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchField.H rename to src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchField.H diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchFields.C b/src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchFields.C similarity index 100% rename from src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchFields.C rename to src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchFields.C diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchFields.H b/src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchFields.H similarity index 100% rename from src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchFields.H rename to src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryKqRWallFunction/immersedBoundaryKqRWallFunctionFvPatchFields.H diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryNutWallFunction/immersedBoundaryNutWallFunctionFvPatchScalarField.C b/src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryNutWallFunction/immersedBoundaryNutWallFunctionFvPatchScalarField.C similarity index 99% rename from src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryNutWallFunction/immersedBoundaryNutWallFunctionFvPatchScalarField.C rename to src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryNutWallFunction/immersedBoundaryNutWallFunctionFvPatchScalarField.C index b934e90c0..404edb83e 100644 --- a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryNutWallFunction/immersedBoundaryNutWallFunctionFvPatchScalarField.C +++ b/src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryNutWallFunction/immersedBoundaryNutWallFunctionFvPatchScalarField.C @@ -182,7 +182,7 @@ void immersedBoundaryNutWallFunctionFvPatchScalarField::evaluate Info<< "Resizing immersedBoundaryNutWallFunction in evaluate" << endl; - *this == patchInternalField(); + scalarField::operator=(patchInternalField()); } // Get non-constant reference to internal field diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryNutWallFunction/immersedBoundaryNutWallFunctionFvPatchScalarField.H b/src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryNutWallFunction/immersedBoundaryNutWallFunctionFvPatchScalarField.H similarity index 100% rename from src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryNutWallFunction/immersedBoundaryNutWallFunctionFvPatchScalarField.H rename to src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryNutWallFunction/immersedBoundaryNutWallFunctionFvPatchScalarField.H diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.C b/src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.C similarity index 100% rename from src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.C rename to src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.C diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.H b/src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.H similarity index 100% rename from src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.H rename to src/immersedBoundary/immersedBoundaryTurbulence/incompressible/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.H diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/backwardsCompability/wallFunctions/backwardsCompatibilityIbWallFunctions.C b/src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/backwardsCompability/wallFunctions/backwardsCompatibilityIbWallFunctions.C deleted file mode 100644 index 6db7098c8..000000000 --- a/src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/backwardsCompability/wallFunctions/backwardsCompatibilityIbWallFunctions.C +++ /dev/null @@ -1,336 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | Version: 4.1 - \\ / A nd | Web: http://www.foam-extend.org - \\/ M anipulation | For copyright notice see file Copyright -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - foam-extend 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 foam-extend. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "backwardsCompatibilityIbWallFunctions.H" - -#include "calculatedFvPatchField.H" -#include "nutkWallFunctionFvPatchScalarField.H" -#include "nutLowReWallFunctionFvPatchScalarField.H" -#include "epsilonWallFunctionFvPatchScalarField.H" -#include "kqRWallFunctionFvPatchField.H" -#include "RWallFunctionFvPatchSymmTensorField.H" -#include "omegaWallFunctionFvPatchScalarField.H" -#include "immersedBoundaryEpsilonWallFunctionFvPatchScalarField.H" -#include "immersedBoundaryKqRWallFunctionFvPatchField.H" -#include "immersedBoundaryOmegaWallFunctionFvPatchScalarField.H" -#include "immersedBoundaryNutWallFunctionFvPatchScalarField.H" -#include "immersedBoundaryFvPatch.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -tmp autoCreateIbNut -( - const word& fieldName, - const fvMesh& mesh, - const objectRegistry& obj -) -{ - IOobject nutHeader - ( - fieldName, - mesh.time().timeName(), - obj, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ); - - if (nutHeader.headerOk()) - { - return tmp(new volScalarField(nutHeader, mesh)); - } - else - { - Info<< "--> Creating " << fieldName - << " to employ run-time selectable wall functions" << endl; - - const fvBoundaryMesh& bm = mesh.boundary(); - - wordList nutBoundaryTypes(bm.size()); - - forAll(bm, patchI) - { - if (isA(bm[patchI]) && bm[patchI].isWall()) - { - nutBoundaryTypes[patchI] = - RASModels::immersedBoundaryNutWallFunctionFvPatchScalarField::typeName; - } - else if (bm[patchI].isWall()) - { - nutBoundaryTypes[patchI] = - RASModels::nutkWallFunctionFvPatchScalarField::typeName; - } - else - { - nutBoundaryTypes[patchI] = - calculatedFvPatchField::typeName; - } - } - - tmp nut - ( - new volScalarField - ( - IOobject - ( - fieldName, - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - mesh, - dimensionedScalar("zero", dimArea/dimTime, 0.0), - nutBoundaryTypes - ) - ); - - Info<< " Writing new " << fieldName << endl; - nut().write(); - - return nut; - } -} - - -tmp autoCreateIbNut -( - const word& fieldName, - const fvMesh& mesh -) -{ - return autoCreateIbNut(fieldName, mesh, mesh); -} - - -tmp autoCreateIbEpsilon -( - const word& fieldName, - const fvMesh& mesh, - const objectRegistry& obj -) -{ - return - autoCreateWallFunctionField - < - scalar, - RASModels::epsilonWallFunctionFvPatchScalarField, - RASModels::immersedBoundaryEpsilonWallFunctionFvPatchScalarField - > - ( - fieldName, - mesh, - obj - ); -} - - -tmp autoCreateIbEpsilon -( - const word& fieldName, - const fvMesh& mesh -) -{ - return - autoCreateWallFunctionField - < - scalar, - RASModels::epsilonWallFunctionFvPatchScalarField, - RASModels::immersedBoundaryEpsilonWallFunctionFvPatchScalarField - > - ( - fieldName, - mesh, - mesh - ); -} - - -tmp autoCreateIbOmega -( - const word& fieldName, - const fvMesh& mesh, - const objectRegistry& obj -) -{ - return - autoCreateWallFunctionField - < - scalar, - RASModels::omegaWallFunctionFvPatchScalarField, - RASModels::immersedBoundaryOmegaWallFunctionFvPatchScalarField - > - ( - fieldName, - mesh, - obj - ); -} - - -tmp autoCreateIbOmega -( - const word& fieldName, - const fvMesh& mesh -) -{ - return - autoCreateWallFunctionField - < - scalar, - RASModels::omegaWallFunctionFvPatchScalarField, - RASModels::immersedBoundaryOmegaWallFunctionFvPatchScalarField - > - ( - fieldName, - mesh, - mesh - ); -} - - -tmp autoCreateIbK -( - const word& fieldName, - const fvMesh& mesh, - const objectRegistry& obj -) -{ - return - autoCreateWallFunctionField - < - scalar, - RASModels::kqRWallFunctionFvPatchField, - RASModels::immersedBoundaryKqRWallFunctionFvPatchField - > - ( - fieldName, - mesh, - obj - ); -} - - -tmp autoCreateIbK -( - const word& fieldName, - const fvMesh& mesh -) -{ - return - autoCreateWallFunctionField - < - scalar, - RASModels::kqRWallFunctionFvPatchField, - RASModels::immersedBoundaryKqRWallFunctionFvPatchField - > - ( - fieldName, - mesh, - mesh - ); -} - - -tmp autoCreateIbQ -( - const word& fieldName, - const fvMesh& mesh, - const objectRegistry& obj -) -{ - return - autoCreateWallFunctionField - < - scalar, - RASModels::kqRWallFunctionFvPatchField, - RASModels::immersedBoundaryKqRWallFunctionFvPatchField - > - ( - fieldName, - mesh, - obj - ); -} - - -tmp autoCreateIbQ -( - const word& fieldName, - const fvMesh& mesh -) -{ - return - autoCreateWallFunctionField - < - scalar, - RASModels::kqRWallFunctionFvPatchField, - RASModels::immersedBoundaryKqRWallFunctionFvPatchField - > - ( - fieldName, - mesh, - mesh - ); -} - - -tmp autoCreateIbR -( - const word& fieldName, - const fvMesh& mesh, - const objectRegistry& obj -) -{ - return - autoCreateWallFunctionField - < - symmTensor, - RASModels::kqRWallFunctionFvPatchField, - RASModels::immersedBoundaryKqRWallFunctionFvPatchField - > - ( - fieldName, - mesh, - obj - ); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace incompressible -} // End namespace Foam - -// ************************************************************************* // - diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/backwardsCompability/wallFunctions/backwardsCompatibilityIbWallFunctions.H b/src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/backwardsCompability/wallFunctions/backwardsCompatibilityIbWallFunctions.H deleted file mode 100644 index 06bf2b3cf..000000000 --- a/src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/backwardsCompability/wallFunctions/backwardsCompatibilityIbWallFunctions.H +++ /dev/null @@ -1,158 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | Version: 4.1 - \\ / A nd | Web: http://www.foam-extend.org - \\/ M anipulation | For copyright notice see file Copyright -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - foam-extend 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 foam-extend. If not, see . - -Class - Foam::incompressible - -Description - Auto creation of fields to provide backwards compatibility with - runtime selectable wall functions - -SourceFiles - backwardsCompatibilityIbWallFunctions.C - backwardsCompatibilityIbWallFunctionsTemplates.C - -\*---------------------------------------------------------------------------*/ - -#ifndef backwardsCompatibilityIbWallFunctions_H -#define backwardsCompatibilityIbWallFunctions_H - -#include "fvMesh.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ - //- nut - tmp autoCreateIbNut - ( - const word& fieldName, - const fvMesh& mesh, - const objectRegistry& obj - ); - - tmp autoCreateIbNut - ( - const word& fieldName, - const fvMesh& mesh - ); - - //- epsilon - tmp autoCreateIbEpsilon - ( - const word& fieldName, - const fvMesh& mesh, - const objectRegistry& obj - ); - - tmp autoCreateIbEpsilon - ( - const word& fieldName, - const fvMesh& mesh - ); - - //- omega - tmp autoCreateIbOmega - ( - const word& fieldName, - const fvMesh& mesh, - const objectRegistry& obj - ); - - tmp autoCreateIbOmega - ( - const word& fieldName, - const fvMesh& mesh - ); - - //- k - tmp autoCreateIbK - ( - const word& fieldName, - const fvMesh& mesh, - const objectRegistry& obj - ); - - tmp autoCreateIbK - ( - const word& fieldName, - const fvMesh& mesh - ); - - //- Q - tmp autoCreateIbQ - ( - const word& fieldName, - const fvMesh& mesh, - const objectRegistry& obj - ); - - tmp autoCreateIbQ - ( - const word& fieldName, - const fvMesh& mesh - ); - - //- R - tmp autoCreateIbR - ( - const word& fieldName, - const fvMesh& mesh, - const objectRegistry& obj - ); - - tmp autoCreateIbR - ( - const word& fieldName, - const fvMesh& mesh - ); - - //- Helper function to create the new field - template - tmp > - autoCreateIbWallFunctionField - ( - const word& fieldName, - const fvMesh& mesh, - const objectRegistry& obj - ); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace incompressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "backwardsCompatibilityIbWallFunctionsTemplates.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/backwardsCompability/wallFunctions/backwardsCompatibilityIbWallFunctionsTemplates.C b/src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/backwardsCompability/wallFunctions/backwardsCompatibilityIbWallFunctionsTemplates.C deleted file mode 100644 index b766546b2..000000000 --- a/src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/backwardsCompability/wallFunctions/backwardsCompatibilityIbWallFunctionsTemplates.C +++ /dev/null @@ -1,184 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | Version: 4.1 - \\ / A nd | Web: http://www.foam-extend.org - \\/ M anipulation | For copyright notice see file Copyright -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - foam-extend 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 foam-extend. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "backwardsCompatibilityIbWallFunctions.H" -#include "foamTime.H" -#include "OSspecific.H" -#include "immersedBoundaryFvPatch.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template -tmp > -autoCreateWallFunctionField -( - const word& fieldName, - const fvMesh& mesh, - const objectRegistry& obj -) -{ - IOobject nutHeader - ( - "nut", - mesh.time().timeName(), - obj, - IOobject::MUST_READ - ); - - typedef GeometricField fieldType; - - if (nutHeader.headerOk()) - { - return tmp - ( - new fieldType - ( - IOobject - ( - fieldName, - mesh.time().timeName(), - obj, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ), - mesh - ) - ); - } - else - { - Info<< "--> Upgrading " << fieldName - << " to employ run-time selectable wall functions" << endl; - - // Read existing field - IOobject ioObj - ( - fieldName, - mesh.time().timeName(), - obj, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ); - - tmp fieldOrig - ( - new fieldType - ( - ioObj, - mesh - ) - ); - - // rename file - Info<< " Backup original " << fieldName << " to " - << fieldName << ".old" << endl; - mvBak(ioObj.objectPath(), "old"); - - - PtrList > newPatchFields(mesh.boundary().size()); - - const fvBoundaryMesh& bm = mesh.boundary(); - - forAll(newPatchFields, patchI) - { - if (isA(bm[patchI]) && bm[patchI].isWall()) - { - newPatchFields.set - ( - patchI, - new ibPatchType - ( - mesh.boundary()[patchI], - fieldOrig().dimensionedInternalField() - ) - ); - newPatchFields[patchI] == fieldOrig().boundaryField()[patchI]; - } - else if (bm[patchI].isWall()) - { - newPatchFields.set - ( - patchI, - new PatchType - ( - mesh.boundary()[patchI], - fieldOrig().dimensionedInternalField() - ) - ); - newPatchFields[patchI] == fieldOrig().boundaryField()[patchI]; - } - else - { - newPatchFields.set - ( - patchI, - fieldOrig().boundaryField()[patchI].clone() - ); - } - } - - tmp fieldNew - ( - new fieldType - ( - IOobject - ( - fieldName, - mesh.time().timeName(), - obj, - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - mesh, - fieldOrig().dimensions(), - fieldOrig().internalField(), - newPatchFields - ) - ); - - Info<< " Writing updated " << fieldName << endl; - fieldNew().write(); - - return fieldNew; - } -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace incompressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/immersedBoundaryKOmegaSST/immersedBoundaryKOmegaSST.C b/src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/immersedBoundaryKOmegaSST/immersedBoundaryKOmegaSST.C deleted file mode 100644 index f535ff1b8..000000000 --- a/src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/immersedBoundaryKOmegaSST/immersedBoundaryKOmegaSST.C +++ /dev/null @@ -1,483 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | Version: 4.1 - \\ / A nd | Web: http://www.foam-extend.org - \\/ M anipulation | For copyright notice see file Copyright -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - foam-extend 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 foam-extend. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "immersedBoundaryKOmegaSST.H" -#include "addToRunTimeSelectionTable.H" - -#include "backwardsCompatibilityIbWallFunctions.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(immersedBoundaryKOmegaSST, 0); -addToRunTimeSelectionTable(RASModel, immersedBoundaryKOmegaSST, dictionary); - -// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // - -tmp immersedBoundaryKOmegaSST::F1 -( -const volScalarField& CDkOmega -) const -{ - volScalarField CDkOmegaPlus = max - ( - CDkOmega, - dimensionedScalar("1.0e-10", dimless/sqr(dimTime), 1.0e-10) - ); - - volScalarField arg1 = min - ( - min - ( - max - ( - (scalar(1)/betaStar_)*sqrt(k_)/(omega_*y_), - scalar(500)*nu()/(sqr(y_)*omega_) - ), - (4*alphaOmega2_)*k_/(CDkOmegaPlus*sqr(y_)) - ), - scalar(10) - ); - - return tanh(pow4(arg1)); -} - - -tmp immersedBoundaryKOmegaSST::F2() const -{ - volScalarField arg2 = min - ( - max - ( - (scalar(2)/betaStar_)*sqrt(k_)/(omega_*y_), - scalar(500)*nu()/(sqr(y_)*omega_) - ), - scalar(100) - ); - - return tanh(sqr(arg2)); -} - - -tmp immersedBoundaryKOmegaSST::F3() const -{ - tmp arg3 = min - ( - 150*nu()/(omega_*sqr(y_)), - scalar(10) - ); - - return 1 - tanh(pow4(arg3)); -} - - -tmp immersedBoundaryKOmegaSST::F23() const -{ - tmp f23(F2()); - - if (F3_) - { - f23() *= F3(); - } - - return f23; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -immersedBoundaryKOmegaSST::immersedBoundaryKOmegaSST -( - const volVectorField& U, - const surfaceScalarField& phi, - transportModel& transport, - const word& turbulenceModelName, - const word& modelName -) -: - RASModel(modelName, U, phi, transport, turbulenceModelName), - - alphaK1_ - ( - dimensionedScalar::lookupOrAddToDict - ( - "alphaK1", - coeffDict_, - 0.85 - ) - ), - alphaK2_ - ( - dimensionedScalar::lookupOrAddToDict - ( - "alphaK2", - coeffDict_, - 1.0 - ) - ), - alphaOmega1_ - ( - dimensionedScalar::lookupOrAddToDict - ( - "alphaOmega1", - coeffDict_, - 0.5 - ) - ), - alphaOmega2_ - ( - dimensionedScalar::lookupOrAddToDict - ( - "alphaOmega2", - coeffDict_, - 0.856 - ) - ), - gamma1_ - ( - dimensionedScalar::lookupOrAddToDict - ( - "gamma1", - coeffDict_, - 5.0/9.0 - ) - ), - gamma2_ - ( - dimensionedScalar::lookupOrAddToDict - ( - "gamma2", - coeffDict_, - 0.44 - ) - ), - beta1_ - ( - dimensionedScalar::lookupOrAddToDict - ( - "beta1", - coeffDict_, - 0.075 - ) - ), - beta2_ - ( - dimensionedScalar::lookupOrAddToDict - ( - "beta2", - coeffDict_, - 0.0828 - ) - ), - betaStar_ - ( - dimensionedScalar::lookupOrAddToDict - ( - "betaStar", - coeffDict_, - 0.09 - ) - ), - a1_ - ( - dimensionedScalar::lookupOrAddToDict - ( - "a1", - coeffDict_, - 0.31 - ) - ), - b1_ - ( - dimensionedScalar::lookupOrAddToDict - ( - "b1", - coeffDict_, - 1.0 - ) - ), - c1_ - ( - dimensionedScalar::lookupOrAddToDict - ( - "c1", - coeffDict_, - 10.0 - ) - ), - F3_ - ( - Switch::lookupOrAddToDict - ( - "F3", - coeffDict_, - false - ) - ), - - y_(mesh_), - - k_ - ( - IOobject - ( - "k", - runTime_.timeName(), - U_.db(), - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - autoCreateIbK("k", mesh_, U_.db()) - ), - omega_ - ( - IOobject - ( - "omega", - runTime_.timeName(), - U_.db(), - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - autoCreateIbOmega("omega", mesh_, U_.db()) - ), - nut_ - ( - IOobject - ( - "nut", - runTime_.timeName(), - U_.db(), - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - autoCreateIbNut("nut", mesh_, U_.db()) - ) -{ - bound(k_, k0_); - bound(omega_, omega0_); - - nut_ = - ( - a1_*k_/ - max - ( - a1_*omega_, - b1_*F23()*sqrt(2.0)*mag(symm(fvc::grad(U_))) - ) - ); - nut_.correctBoundaryConditions(); - - printCoeffs(); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -tmp immersedBoundaryKOmegaSST::R() const -{ - return tmp - ( - new volSymmTensorField - ( - IOobject - ( - "R", - runTime_.timeName(), - U_.db(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)), - k_.boundaryField().types() - ) - ); -} - - -tmp immersedBoundaryKOmegaSST::devReff() const -{ - return tmp - ( - new volSymmTensorField - ( - IOobject - ( - "devRhoReff", - runTime_.timeName(), - U_.db(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - -nuEff()*dev(twoSymm(fvc::grad(U_))) - ) - ); -} - - -tmp immersedBoundaryKOmegaSST::divDevReff() const -{ - const volScalarField nuEffective = nuEff(); - - return - ( - - fvm::laplacian(nuEffective, U_) - - (fvc::grad(U_) & fvc::grad(nuEffective)) - ); -} - - -bool immersedBoundaryKOmegaSST::read() -{ - if (RASModel::read()) - { - alphaK1_.readIfPresent(coeffDict()); - alphaK2_.readIfPresent(coeffDict()); - alphaOmega1_.readIfPresent(coeffDict()); - alphaOmega2_.readIfPresent(coeffDict()); - gamma1_.readIfPresent(coeffDict()); - gamma2_.readIfPresent(coeffDict()); - beta1_.readIfPresent(coeffDict()); - beta2_.readIfPresent(coeffDict()); - betaStar_.readIfPresent(coeffDict()); - a1_.readIfPresent(coeffDict()); - b1_.readIfPresent(coeffDict()); - c1_.readIfPresent(coeffDict()); - F3_.readIfPresent("F3", coeffDict()); - - return true; - } - else - { - return false; - } -} - - -void immersedBoundaryKOmegaSST::correct() -{ - // Bound in case of topological change - // HJ, 22/Aug/2007 - if (mesh_.changing()) - { - bound(k_, k0_); - bound(omega_, omega0_); - } - - RASModel::correct(); - - if (!turbulence_) - { - return; - } - - if (mesh_.changing()) - { - y_.correct(); - } - - const volScalarField S2(2*magSqr(symm(fvc::grad(U_)))); - volScalarField G("RASModel::G", nut_*S2); - - // Update omega and G at the wall - omega_.boundaryField().updateCoeffs(); - - const volScalarField CDkOmega - ( - (2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_ - ); - - const volScalarField F1(this->F1(CDkOmega)); - - // Turbulent frequency equation - fvScalarMatrix omegaEqn - ( - fvm::ddt(omega_) - + fvm::div(phi_, omega_) - + fvm::SuSp(-fvc::div(phi_), omega_) - - fvm::laplacian(DomegaEff(F1), omega_) - == - gamma(F1) - *min - ( - S2, - (c1_/a1_)*betaStar_*omega_*max(a1_*omega_, b1_*F23()*sqrt(S2)) - ) - - fvm::Sp(beta(F1)*omega_, omega_) - - fvm::SuSp - ( - (F1 - scalar(1))*CDkOmega/omega_, - omega_ - ) - ); - - omegaEqn.relax(); - - // No longer needed: matrix completes at the point of solution - // HJ, 17/Apr/2012 -// omegaEqn.completeAssembly(); - - solve(omegaEqn); - bound(omega_, omega0_); - - // Turbulent kinetic energy equation - fvScalarMatrix kEqn - ( - fvm::ddt(k_) - + fvm::div(phi_, k_) - + fvm::SuSp(-fvc::div(phi_), k_) - - fvm::laplacian(DkEff(F1), k_) - == - min(G, c1_*betaStar_*k_*omega_) - - fvm::Sp(betaStar_*omega_, k_) - ); - - kEqn.relax(); - solve(kEqn); - bound(k_, k0_); - - // Re-calculate viscosity - // Fixed sqrt(2) error. HJ, 10/Jun/2015 - nut_ = a1_*k_/max(a1_*omega_, b1_*F23()*sqrt(S2)); - nut_ = min(nut_, nuRatio()*nu()); - nut_.correctBoundaryConditions(); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // End namespace incompressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/immersedBoundaryKOmegaSST/immersedBoundaryKOmegaSST.H b/src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/immersedBoundaryKOmegaSST/immersedBoundaryKOmegaSST.H deleted file mode 100644 index 685a0dfcb..000000000 --- a/src/immersedBoundary/immersedBoundaryTurbulence/turbulenceModels/incompressible/RAS/immersedBoundaryKOmegaSST/immersedBoundaryKOmegaSST.H +++ /dev/null @@ -1,313 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | Version: 4.1 - \\ / A nd | Web: http://www.foam-extend.org - \\/ M anipulation | For copyright notice see file Copyright -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - foam-extend 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 foam-extend. If not, see . - -Class - Foam::incompressible::RASModels::immersedBoundaryKOmegaSST - -Description - Implementation of the k-omega-SST turbulence model for incompressible - flows. - - Turbulence model described in: - @verbatim - Menter, F., Esch, T. - "Elements of Industrial Heat Transfer Prediction" - 16th Brazilian Congress of Mechanical Engineering (COBEM), - Nov. 2001. - @endverbatim - - with updated coefficients from - @verbatim - Menter, F. R., Kuntz, M., and Langtry, R., - "Ten Years of Industrial Experience with the SST Turbulence Model", - Turbulence, Heat and Mass Transfer 4, 2003, - pp. 625 - 632. - @endverbatim - - but with the consistent production terms from the 2001 paper as form in the - 2003 paper is a typo, see - @verbatim - http://turbmodels.larc.nasa.gov/sst.html - @endverbatim - - and the addition of the optional F3 term for rough walls from - \verbatim - Hellsten, A. - "Some Improvements in Menter’s k-omega-SST turbulence model" - 29th AIAA Fluid Dynamics Conference, - AIAA-98-2554, - June 1998. - \endverbatim - - Note that this implementation is written in terms of alpha diffusion - coefficients rather than the more traditional sigma (alpha = 1/sigma) so - that the blending can be applied to all coefficuients in a consistent - manner. The paper suggests that sigma is blended but this would not be - consistent with the blending of the k-epsilon and k-omega models. - - Also note that the error in the last term of equation (2) relating to - sigma has been corrected. - - The default model coefficients correspond to the following: - @verbatim - immersedBoundaryKOmegaSSTCoeffs - { - alphaK1 0.85; - alphaK2 1.0; - alphaOmega1 0.5; - alphaOmega2 0.856; - beta1 0.075; - beta2 0.0828; - betaStar 0.09; - gamma1 5/9; - gamma2 0.44; - a1 0.31; - b1 1.0; - c1 10.0; - F3 no; - } - @endverbatim - -SourceFiles - immersedBoundaryKOmegaSST.C - -\*---------------------------------------------------------------------------*/ - -#ifndef immersedBoundaryKOmegaSST_H -#define immersedBoundaryKOmegaSST_H - -#include "RASModel.H" -#include "wallDist.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -/*---------------------------------------------------------------------------*\ - Class kOmega Declaration -\*---------------------------------------------------------------------------*/ - -class immersedBoundaryKOmegaSST -: - public RASModel -{ - // Private data - - // Model coefficients - dimensionedScalar alphaK1_; - dimensionedScalar alphaK2_; - - dimensionedScalar alphaOmega1_; - dimensionedScalar alphaOmega2_; - - dimensionedScalar gamma1_; - dimensionedScalar gamma2_; - - dimensionedScalar beta1_; - dimensionedScalar beta2_; - - dimensionedScalar betaStar_; - - dimensionedScalar a1_; - dimensionedScalar b1_; - dimensionedScalar c1_; - - Switch F3_; - - - //- Wall distance field - // Note: different to wall distance in parent RASModel - wallDist y_; - - - // Fields - - volScalarField k_; - volScalarField omega_; - volScalarField nut_; - - - // Private member functions - - tmp F1(const volScalarField& CDkOmega) const; - tmp F2() const; - tmp F3() const; - tmp F23() const; - - tmp blend - ( - const volScalarField& F1, - const dimensionedScalar& psi1, - const dimensionedScalar& psi2 - ) const - { - return F1*(psi1 - psi2) + psi2; - } - - tmp alphaK - ( - const volScalarField& F1 - ) const - { - return blend(F1, alphaK1_, alphaK2_); - } - - tmp alphaOmega - ( - const volScalarField& F1 - ) const - { - return blend(F1, alphaOmega1_, alphaOmega2_); - } - - tmp beta - ( - const volScalarField& F1 - ) const - { - return blend(F1, beta1_, beta2_); - } - - tmp gamma - ( - const volScalarField& F1 - ) const - { - return blend(F1, gamma1_, gamma2_); - } - - -public: - - //- Runtime type information - TypeName("immersedBoundaryKOmegaSST"); - - - // Constructors - - //- Construct from components - immersedBoundaryKOmegaSST - ( - const volVectorField& U, - const surfaceScalarField& phi, - transportModel& transport, - const word& turbulenceModelName = turbulenceModel::typeName, - const word& modelName = typeName - ); - - - //- Destructor - virtual ~immersedBoundaryKOmegaSST() - {} - - - // Member Functions - - //- Return the turbulence viscosity - virtual tmp nut() const - { - return nut_; - } - - //- Return the effective diffusivity for k - tmp DkEff(const volScalarField& F1) const - { - return tmp - ( - new volScalarField("DkEff", alphaK(F1)*nut_ + nu()) - ); - } - - //- Return the effective diffusivity for omega - tmp DomegaEff(const volScalarField& F1) const - { - return tmp - ( - new volScalarField("DomegaEff", alphaOmega(F1)*nut_ + nu()) - ); - } - - //- Return the turbulence kinetic energy - virtual tmp k() const - { - return k_; - } - - //- Return the turbulence specific dissipation rate - virtual tmp omega() const - { - return omega_; - } - - //- Return the turbulence kinetic energy dissipation rate - virtual tmp epsilon() const - { - return tmp - ( - new volScalarField - ( - IOobject - ( - "epsilon", - mesh_.time().timeName(), - mesh_ - ), - betaStar_*k_*omega_, - omega_.boundaryField().types() - ) - ); - } - - //- Return the Reynolds stress tensor - virtual tmp R() const; - - //- Return the effective stress tensor including the laminar stress - virtual tmp devReff() const; - - //- Return the source term for the momentum equation - virtual tmp divDevReff() const; - - //- Solve the turbulence equations and correct the turbulence viscosity - virtual void correct(); - - //- Read RASProperties dictionary - virtual bool read(); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // namespace incompressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* //