diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryEpsilonWallFunctions/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.C b/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryEpsilonWallFunctions/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.C deleted file mode 100644 index 9a479f37a..000000000 --- a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryEpsilonWallFunctions/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.C +++ /dev/null @@ -1,393 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 "immersedBoundaryEpsilonWallFunctionFvPatchScalarField.H" -#include "immersedBoundaryVelocityWallFunctionFvPatchVectorField.H" -#include "RASModel.H" -#include "fvPatchFieldMapper.H" -#include "volFields.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -immersedBoundaryEpsilonWallFunctionFvPatchScalarField:: -immersedBoundaryEpsilonWallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF -) -: - immersedBoundaryWallFunctionFvPatchScalarField(p, iF), - UName_("U"), - kName_("k"), - GName_("RASModel::G"), - nuName_("nu"), - nutName_("nut"), - Cmu_(0.09), - kappa_(0.41), - E_(9.8) -{} - - -immersedBoundaryEpsilonWallFunctionFvPatchScalarField:: -immersedBoundaryEpsilonWallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - immersedBoundaryWallFunctionFvPatchScalarField(p, iF, dict), - UName_(dict.lookupOrDefault("U", "U")), - kName_(dict.lookupOrDefault("k", "k")), - GName_(dict.lookupOrDefault("G", "RASModel::G")), - nuName_(dict.lookupOrDefault("nu", "nu")), - nutName_(dict.lookupOrDefault("nut", "nut")), - Cmu_(dict.lookupOrDefault("Cmu", 0.09)), - kappa_(dict.lookupOrDefault("kappa", 0.41)), - E_(dict.lookupOrDefault("E", 9.8)) -{} - - -immersedBoundaryEpsilonWallFunctionFvPatchScalarField:: -immersedBoundaryEpsilonWallFunctionFvPatchScalarField -( - const immersedBoundaryEpsilonWallFunctionFvPatchScalarField& ptf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - immersedBoundaryWallFunctionFvPatchScalarField(ptf, p, iF, mapper), - UName_(ptf.UName_), - kName_(ptf.kName_), - GName_(ptf.GName_), - nuName_(ptf.nuName_), - nutName_(ptf.nutName_), - Cmu_(ptf.Cmu_), - kappa_(ptf.kappa_), - E_(ptf.E_) -{} - - -immersedBoundaryEpsilonWallFunctionFvPatchScalarField:: -immersedBoundaryEpsilonWallFunctionFvPatchScalarField -( - const immersedBoundaryEpsilonWallFunctionFvPatchScalarField& ewfpsf -) -: - immersedBoundaryWallFunctionFvPatchScalarField(ewfpsf), - UName_(ewfpsf.UName_), - kName_(ewfpsf.kName_), - GName_(ewfpsf.GName_), - nuName_(ewfpsf.nuName_), - nutName_(ewfpsf.nutName_), - Cmu_(ewfpsf.Cmu_), - kappa_(ewfpsf.kappa_), - E_(ewfpsf.E_) -{} - - -immersedBoundaryEpsilonWallFunctionFvPatchScalarField:: -immersedBoundaryEpsilonWallFunctionFvPatchScalarField -( - const immersedBoundaryEpsilonWallFunctionFvPatchScalarField& ewfpsf, - const DimensionedField& iF -) -: - immersedBoundaryWallFunctionFvPatchScalarField(ewfpsf, iF), - UName_(ewfpsf.UName_), - kName_(ewfpsf.kName_), - GName_(ewfpsf.GName_), - nuName_(ewfpsf.nuName_), - nutName_(ewfpsf.nutName_), - Cmu_(ewfpsf.Cmu_), - kappa_(ewfpsf.kappa_), - E_(ewfpsf.E_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void immersedBoundaryEpsilonWallFunctionFvPatchScalarField::updateCoeffs() -{ - if (updated()) - { - return; - } - - // If G field is not present, execute zero gradient evaluation - // HJ, 20/Mar/2011 - if (!db().foundObject(GName_)) - { - InfoIn - ( - "void immersedBoundaryEpsilonWallFunctionFvPatchScalarField::" - "updateCoeffs()" - ) << "Cannot access " << GName_ << " field. for patch " - << patch().name() << ". Evaluating as regular immersed boundary" - << endl; - - immersedBoundaryWallFunctionFvPatchScalarField::evaluate(); - - return; - } - - const vectorField& n = ibPatch().ibNormals(); - - const RASModel& rasModel = db().lookupObject("RASProperties"); - const scalar yPlusLam = rasModel.yPlusLam(kappa_, E_); - - const scalar Cmu25 = pow(Cmu_, 0.25); - const scalar Cmu50 = sqrt(Cmu_); - const scalar Cmu75 = pow(Cmu_, 0.75); - - volScalarField& G = const_cast - (db().lookupObject(GName_)); - - // Grab values of other fields required for wall functions - - // Velocity - const fvPatchVectorField& Uwg = - patch().lookupPatchField(UName_); - const immersedBoundaryVelocityWallFunctionFvPatchVectorField& Uw = - refCast - ( - Uwg - ); - - // Calculate tangential component, taking into account wall velocity - const vectorField UtanOld = - (I - sqr(n)) & (Uw.ibSamplingPointValue() - Uw.ibValue()); - const scalarField magUtanOld = mag(UtanOld); - - // Tangential velocity component - scalarField& UTangentialNew = Uw.wallTangentialValue(); - - // Wall shear stress - vectorField& tauWall = Uw.tauWall(); - - // Turbulence kinetic energy - const fvPatchScalarField& kg = - patch().lookupPatchField(kName_); - const immersedBoundaryWallFunctionFvPatchScalarField& kw = - refCast(kg); - - // Current and new values of k at sampling point - scalarField k = kw.ibSamplingPointValue(); - scalarField& kNew = kw.wallValue(); - - // Laminar viscosity - const fvPatchScalarField& nuwg = - patch().lookupPatchField(nuName_); - const immersedBoundaryFvPatchScalarField& nuw = - refCast(nuwg); - scalarField nu = nuw.ibCellValue(); - - // Turbulent viscosity - const fvPatchScalarField& nutwg = - patch().lookupPatchField(nutName_); - const immersedBoundaryWallFunctionFvPatchScalarField& nutw = - refCast(nutwg); - - // New values of nut - scalarField nutOld = nutw.ibCellValue(); - scalarField& nutNew = nutw.wallValue(); - - const scalarField magGradUw = mag(Uw.ibGrad()); - - // Get the IB addressing and distance - const labelList& ibc = ibPatch().ibCells(); - - // Distance to sampling point - const scalarField& ySample = ibPatch().ibSamplingPointDelta(); - - // Distance from wall to IB point - const scalarField& y = ibPatch().ibDelta(); - - // Epsilon: store IB cell values for direct insertion - scalarField epsilonSample = this->ibSamplingPointValue(); - - scalarField& epsilonNew = this->wallValue(); - - // Mark values to be fixed - boolList wf(ibc.size(), false); - - // Calculate yPlus for sample points - scalarField ypd = Cmu25*ySample*sqrt(k)/nu; - - // Calculate wall function conditions - forAll (ibc, ibCellI) - { - const scalar nuLam = nu[ibCellI]; - - // Calculate yPlus from k and laminar viscosity for the IB point - const scalar yPlusSample = ypd[ibCellI]; - - scalar uTau; - - if (yPlusSample > yPlusLam) - { - // Calculate uTau from log-law, knowing sampled k and U - uTau = magUtanOld[ibCellI]*kappa_/log(E_*yPlusSample); - } - else - { - // Sampling point is in laminar sublayer - // Bug fix: HJ, 11/Aug/2014 - uTau = yPlusSample; - - } - - // Set wall shear stress - tauWall[ibCellI] = sqr(uTau)*UtanOld[ibCellI]/(magUtanOld[ibCellI] + SMALL); - - // Calculate yPlus for IB point -// scalar yPlusIB = uTau*y[ibCellI]/nuLam; - scalar yPlusIB = yPlusSample*y[ibCellI]/ySample[ibCellI]; - - // Calculate wall function data in the immersed boundary point - if (yPlusIB > yPlusLam) - { - // Logarithmic region - wf[ibCellI] = true; - - scalar nutw = nuLam*(yPlusIB*kappa_/log(E_*yPlusIB) - 1); - - // Fix generation even though it if is not used - G[ibc[ibCellI]] = - sqr((nutw + nuLam)*magGradUw[ibCellI])/ - (Cmu25*sqrt(k[ibCellI])*kappa_*y[ibCellI]); - - // Log-Law for tangential velocity - UTangentialNew[ibCellI] = - min - ( - magUtanOld[ibCellI], - uTau/kappa_*log(E_*yPlusIB) - ); - - // Calculate turbulent viscosity - nutNew[ibCellI] = nutw; - - // Calculate k in the IB cell from G = epsilon - kNew[ibCellI] = (nutw + nuLam)*magGradUw[ibCellI]/Cmu50; - - // Calculate epsilon from yPlus and set it - epsilonNew[ibCellI] = - Cmu75*pow(kNew[ibCellI], 1.5)/(kappa_*y[ibCellI]); - } - else - { - // Laminar sub-layer - wf[ibCellI] = false; - - // G is zero - G[ibc[ibCellI]] = 0; - - // Laminar sub-layer for tangential velocity: uPlus = yPlus - UTangentialNew[ibCellI] = min(magUtanOld[ibCellI], uTau*yPlusIB); - - // Turbulent viscosity is zero - nutNew[ibCellI] = SMALL; - - // k is zero gradient: use the sampled value - kNew[ibCellI] = k[ibCellI]; - - // Calculate epsilon from yPlus and set it. - // Note: calculating equilibrium epsilon in the sub-layer creates - // an unrealistic oscillation: use sampled value - // HJ, 27/Jul/2012 - epsilonNew[ibCellI] = epsilonSample[ibCellI]; - } - } - -// Info<< "UTangentialNew " << min(UTangentialNew) << " " << max(UTangentialNew) << endl; -// Info<< "nutNew " << min(nutNew) << " " << max(nutNew) << endl; -// Info<< "kNew " << min(kNew) << " " << max(kNew) << endl; -// Info<< "epsilonNew " << min(epsilonNew) << " " << max(epsilonNew) << endl; - - // Set the fields to calculated wall function values - Uw.wallMask() = true; - kw.wallMask() = wf; - nutw.wallMask() = true; - this->wallMask() = true; - - // Insert epsilon values into the internal field - immersedBoundaryWallFunctionFvPatchScalarField::updateCoeffs(); -} - - -void immersedBoundaryEpsilonWallFunctionFvPatchScalarField::evaluate -( - const Pstream::commsTypes commsType -) -{ - // Insert epsilon values into the internal field - this->setIbCellValues(this->wallValue()); - - fvPatchScalarField::evaluate(commsType); -} - - -void immersedBoundaryEpsilonWallFunctionFvPatchScalarField:: -write(Ostream& os) const -{ - immersedBoundaryWallFunctionFvPatchScalarField::write(os); - writeEntryIfDifferent(os, "U", "U", UName_); - writeEntryIfDifferent(os, "k", "k", kName_); - writeEntryIfDifferent(os, "G", "RASModel::G", GName_); - writeEntryIfDifferent(os, "nu", "nu", nuName_); - writeEntryIfDifferent(os, "nut", "nut", nutName_); - os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; - os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; - os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeField -( - fvPatchScalarField, - immersedBoundaryEpsilonWallFunctionFvPatchScalarField -); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // End namespace incompressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryEpsilonWallFunctions/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.H b/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryEpsilonWallFunctions/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.H deleted file mode 100644 index 124fbddbb..000000000 --- a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryEpsilonWallFunctions/immersedBoundaryEpsilonWallFunctionFvPatchScalarField.H +++ /dev/null @@ -1,201 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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::incompressible::RASModels:: - immersedBoundaryEpsilonWallFunctionFvPatchScalarField - -Description - Boundary condition for epsilon when using wall functions - - calculates y+, G, tangential velocity, nut and k - - each of calculated values is handled separately by the appropriate - boundary condition - - epsilon values added directly into the field to act as a constraint - -SourceFiles - immersedBoundaryEpsilonWallFunctionFvPatchScalarField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef immersedBoundaryEpsilonWallFunctionFvPatchScalarField_H -#define immersedBoundaryEpsilonWallFunctionFvPatchScalarField_H - -#include "immersedBoundaryWallFunctionFvPatchFields.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -/*---------------------------------------------------------------------------*\ - Class immersedBoundaryEpsilonWallFunctionFvPatchScalarField Declaration -\*---------------------------------------------------------------------------*/ - -class immersedBoundaryEpsilonWallFunctionFvPatchScalarField -: - public immersedBoundaryWallFunctionFvPatchScalarField -{ - // Private data - - //- Name of velocity field - word UName_; - - //- Name of turbulence kinetic energy field - word kName_; - - //- Name of turbulence generation field - word GName_; - - //- Name of laminar viscosity field - word nuName_; - - //- Name of turbulent viscosity field - word nutName_; - - //- Cmu coefficient - scalar Cmu_; - - //- Von Karman constant - scalar kappa_; - - //- E coefficient - scalar E_; - - -public: - - //- Runtime type information - TypeName("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 - - // 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 incompressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.C b/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.C deleted file mode 100644 index b1f3a6022..000000000 --- a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.C +++ /dev/null @@ -1,401 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 "immersedBoundaryVelocityWallFunctionFvPatchVectorField.H" -#include "RASModel.H" -#include "fvPatchFieldMapper.H" -#include "volFields.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -immersedBoundaryOmegaWallFunctionFvPatchScalarField:: -immersedBoundaryOmegaWallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF -) -: - immersedBoundaryWallFunctionFvPatchScalarField(p, iF), - UName_("U"), - kName_("k"), - GName_("RASModel::G"), - nuName_("nu"), - nutName_("nut"), - Cmu_(0.09), - kappa_(0.41), - E_(9.8), - beta1_(0.075) -{} - - -immersedBoundaryOmegaWallFunctionFvPatchScalarField:: -immersedBoundaryOmegaWallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - immersedBoundaryWallFunctionFvPatchScalarField(p, iF, dict), - UName_(dict.lookupOrDefault("U", "U")), - kName_(dict.lookupOrDefault("k", "k")), - GName_(dict.lookupOrDefault("G", "RASModel::G")), - nuName_(dict.lookupOrDefault("nu", "nu")), - nutName_(dict.lookupOrDefault("nut", "nut")), - Cmu_(dict.lookupOrDefault("Cmu", 0.09)), - kappa_(dict.lookupOrDefault("kappa", 0.41)), - E_(dict.lookupOrDefault("E", 9.8)), - beta1_(dict.lookupOrDefault("beta1", 0.075)) -{} - - -immersedBoundaryOmegaWallFunctionFvPatchScalarField:: -immersedBoundaryOmegaWallFunctionFvPatchScalarField -( - const immersedBoundaryOmegaWallFunctionFvPatchScalarField& ptf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - immersedBoundaryWallFunctionFvPatchScalarField(ptf, p, iF, mapper), - UName_(ptf.UName_), - kName_(ptf.kName_), - GName_(ptf.GName_), - nuName_(ptf.nuName_), - nutName_(ptf.nutName_), - Cmu_(ptf.Cmu_), - kappa_(ptf.kappa_), - E_(ptf.E_), - beta1_(ptf.beta1_) -{} - - -immersedBoundaryOmegaWallFunctionFvPatchScalarField:: -immersedBoundaryOmegaWallFunctionFvPatchScalarField -( - const immersedBoundaryOmegaWallFunctionFvPatchScalarField& owfpsf -) -: - immersedBoundaryWallFunctionFvPatchScalarField(owfpsf), - UName_(owfpsf.UName_), - kName_(owfpsf.kName_), - GName_(owfpsf.GName_), - nuName_(owfpsf.nuName_), - nutName_(owfpsf.nutName_), - Cmu_(owfpsf.Cmu_), - kappa_(owfpsf.kappa_), - E_(owfpsf.E_), - beta1_(owfpsf.beta1_) -{} - - -immersedBoundaryOmegaWallFunctionFvPatchScalarField:: -immersedBoundaryOmegaWallFunctionFvPatchScalarField -( - const immersedBoundaryOmegaWallFunctionFvPatchScalarField& owfpsf, - const DimensionedField& iF -) -: - immersedBoundaryWallFunctionFvPatchScalarField(owfpsf, iF), - UName_(owfpsf.UName_), - kName_(owfpsf.kName_), - GName_(owfpsf.GName_), - nuName_(owfpsf.nuName_), - nutName_(owfpsf.nutName_), - Cmu_(owfpsf.Cmu_), - kappa_(owfpsf.kappa_), - E_(owfpsf.E_), - beta1_(owfpsf.beta1_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void immersedBoundaryOmegaWallFunctionFvPatchScalarField::updateCoeffs() -{ - if (updated()) - { - return; - } - - // If G field is not present, execute zero gradient evaluation - // HJ, 20/Mar/2011 - if (!db().foundObject(GName_)) - { - InfoIn - ( - "void immersedBoundaryOmegaWallFunctionFvPatchScalarField::" - "updateCoeffs()" - ) << "Cannot access " << GName_ << " field. for patch " - << patch().name() << ". Evaluating as regular immersed boundary" - << endl; - - immersedBoundaryWallFunctionFvPatchScalarField::evaluate(); - - return; - } - - const vectorField& n = ibPatch().ibNormals(); - - const RASModel& rasModel = db().lookupObject("RASProperties"); - const scalar yPlusLam = rasModel.yPlusLam(kappa_, E_); - - const scalar Cmu25 = pow(Cmu_, 0.25); - const scalar Cmu50 = sqrt(Cmu_); - - volScalarField& G = const_cast - (db().lookupObject(GName_)); - - // Grab values of other fields required for wall functions - - // Velocity - const fvPatchVectorField& Uwg = - patch().lookupPatchField(UName_); - const immersedBoundaryVelocityWallFunctionFvPatchVectorField& Uw = - refCast - ( - Uwg - ); - - // Calculate tangential component, taking into account wall velocity - const vectorField UtanOld = - (I - sqr(n)) & (Uw.ibSamplingPointValue() - Uw.ibValue()); - const scalarField magUtanOld = mag(UtanOld); - - // Tangential velocity component - scalarField& UTangentialNew = Uw.wallTangentialValue(); - - // Wall shear stress - vectorField& tauWall = Uw.tauWall(); - - // Turbulence kinetic energy - const fvPatchScalarField& kg = - patch().lookupPatchField(kName_); - const immersedBoundaryWallFunctionFvPatchScalarField& kw = - refCast(kg); - - // Current and new values of k at sampling point - scalarField k = kw.ibSamplingPointValue(); - scalarField& kNew = kw.wallValue(); - - // Laminar viscosity - const fvPatchScalarField& nuwg = - patch().lookupPatchField(nuName_); - const immersedBoundaryFvPatchScalarField& nuw = - refCast(nuwg); - scalarField nu = nuw.ibCellValue(); - - // Turbulent viscosity - const fvPatchScalarField& nutwg = - patch().lookupPatchField(nutName_); - const immersedBoundaryWallFunctionFvPatchScalarField& nutw = - refCast(nutwg); - - // New values of nut - scalarField nutOld = nutw.ibCellValue(); - scalarField& nutNew = nutw.wallValue(); - - const scalarField magGradUw = mag(Uw.ibGrad()); - - // Get the IB addressing and distance - const labelList& ibc = ibPatch().ibCells(); - - // Distance to sampling point - const scalarField& ySample = ibPatch().ibSamplingPointDelta(); - - // Distance from wall to IB point - const scalarField& y = ibPatch().ibDelta(); - - // Omega: store IB cell values for direct insertion - scalarField omegaSample = this->ibSamplingPointValue(); - - scalarField& omegaNew = this->wallValue(); - - // Mark values to be fixed - boolList wf(ibc.size(), false); - - // Calculate yPlus for sample points - scalarField ypd = Cmu25*ySample*sqrt(k)/nu; - - // Calculate wall function conditions - forAll (ibc, ibCellI) - { - - // Calculate yPlus from k and laminar viscosity for the IB point - const scalar yPlusSample = ypd[ibCellI]; - - scalar tauW, uTau; // wall-shear and friction velocity from LOW - - if (yPlusSample > yPlusLam) - { - // Calculate tauW from log-law using k and U at sampling point - - tauW = magUtanOld[ibCellI]*Cmu25*sqrt(k[ibCellI])*kappa_ - /log(E_*yPlusSample); - } - else - { - // Sampling point is in laminar sublayer - tauW = magUtanOld[ibCellI]*Cmu25*sqrt(k[ibCellI])/yPlusSample; - } - - // friction velocity computed from k and U at sampling point - uTau = sqrt(tauW); - - tauWall[ibCellI] = tauW*UtanOld[ibCellI]/(magUtanOld[ibCellI] + SMALL); - - // Calculate yPlus for IB point - - scalar yPlusIB = yPlusSample*y[ibCellI]/ySample[ibCellI]; - - // Calculate wall function data in the immersed boundary point - if (yPlusIB > yPlusLam) - { - const scalar nuLam = nu[ibCellI]; - // Logarithmic region - wf[ibCellI] = true; - - // turbulent viscosity at IB cell and at wall - scalar nutw = nuLam*(yPlusIB*kappa_/log(E_*yPlusIB) - 1); - - // Fix generation even though it if is not used - G[ibc[ibCellI]] = - sqr((nutw + nuLam)*magGradUw[ibCellI])/ - (Cmu25*sqrt(k[ibCellI])*kappa_*y[ibCellI]); - - // Compute k at the IB cell - kNew[ibCellI] = tauW/Cmu50; // equilibrium boundary layer - // kNew[ibCellI] = k[ibCellI]; // zero-Gradient (less stable) - - // Compute omega at the IB cell - omegaNew[ibCellI] = sqrt(kNew[ibCellI])/(Cmu25*kappa_*y[ibCellI]); - - // Log-Law for tangential velocity - uTau = Cmu25*sqrt(kNew) - UTangentialNew[ibCellI] = uTau/kappa_*log(E_*yPlusIB); - - // Calculate turbulent viscosity - nutNew[ibCellI] = nutw; - } - else - { - // Laminar sub-layer - wf[ibCellI] = false; - - // G is zero - immaterial! - // G[ibc[ibCellI]] = 0; - - // quadratic fit - kNew[ibCellI] = k[ibCellI]*sqr(yPlusIB/yPlusLam); - - // Compute omega at the IB cell - omegaNew[ibCellI] = 6.0*nu[ibCellI]/(beta1_*sqr(y[ibCellI])); - - // Bugfix - set zeroGradient bc for large omega values at ib boundary - // to avoid k unboundedness (IG 30/OCT/2015), not - // sure if this is a good criteria - if(omegaNew[ibCellI] > 10.0) - { - wf[ibCellI] = true; - } - - // Laminar sub-layer for tangential velocity: uPlus = yPlus - UTangentialNew[ibCellI] = uTau*yPlusIB; - - // Turbulent viscosity is zero - nutNew[ibCellI] = SMALL; - } - } - -// Info<< "UTangentialNew " << min(UTangentialNew) << " " << max(UTangentialNew) << endl; -// Info<< "nutNew " << min(nutNew) << " " << max(nutNew) << endl; -// Info<< "kNew " << min(kNew) << " " << max(kNew) << endl; -// Info<< "epsilonNew " << min(epsilonNew) << " " << max(epsilonNew) << endl; - - // Set the fields to calculated wall function values - Uw.wallMask() = true; - kw.wallMask() = wf; - nutw.wallMask() = true; - this->wallMask() = true; - - // Insert epsilon values into the internal field - immersedBoundaryWallFunctionFvPatchScalarField::updateCoeffs(); -} - - -void immersedBoundaryOmegaWallFunctionFvPatchScalarField::evaluate -( - const Pstream::commsTypes commsType -) -{ - // Insert epsilon values into the internal field - this->setIbCellValues(this->wallValue()); - - fvPatchScalarField::evaluate(commsType); -} - - -void immersedBoundaryOmegaWallFunctionFvPatchScalarField:: -write(Ostream& os) const -{ - immersedBoundaryWallFunctionFvPatchScalarField::write(os); - writeEntryIfDifferent(os, "U", "U", UName_); - writeEntryIfDifferent(os, "k", "k", kName_); - writeEntryIfDifferent(os, "G", "RASModel::G", GName_); - writeEntryIfDifferent(os, "nu", "nu", nuName_); - writeEntryIfDifferent(os, "nut", "nut", nutName_); - os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; - os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; - os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; - os.writeKeyword("beta1") << beta1_ << token::END_STATEMENT << nl; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeField -( - fvPatchScalarField, - immersedBoundaryOmegaWallFunctionFvPatchScalarField -); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // End namespace incompressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.H b/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.H deleted file mode 100644 index e153fe7f4..000000000 --- a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryOmegaWallFunctions/immersedBoundaryOmegaWallFunctionFvPatchScalarField.H +++ /dev/null @@ -1,216 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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::incompressible::RASModels:: - immersedBoundaryOmegaWallFunctionFvPatchScalarField - -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 - -SourceFiles - immersedBoundaryOmegaWallFunctionFvPatchScalarField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef immersedBoundaryOmegaWallFunctionFvPatchScalarField_H -#define immersedBoundaryOmegaWallFunctionFvPatchScalarField_H - -#include "immersedBoundaryWallFunctionFvPatchFields.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -/*---------------------------------------------------------------------------*\ - Class immersedBoundaryOmegaWallFunctionFvPatchScalarField Declaration -\*---------------------------------------------------------------------------*/ - -class immersedBoundaryOmegaWallFunctionFvPatchScalarField -: - public immersedBoundaryWallFunctionFvPatchScalarField -{ - // Private data - - //- Name of velocity field - word UName_; - - //- Name of turbulence kinetic energy field - word kName_; - - //- Name of turbulence generation field - word GName_; - - //- Name of laminar viscosity field - word nuName_; - - //- Name of turbulent viscosity field - word nutName_; - - //- Cmu coefficient - scalar Cmu_; - - //- Von Karman constant - scalar kappa_; - - //- E coefficient - scalar E_; - - //- beta1 coefficient - scalar beta1_; - - -public: - - //- Runtime type information - TypeName("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 - ) - ); - } - - - //- Destructor - virtual ~immersedBoundaryOmegaWallFunctionFvPatchScalarField() - {} - - - // Member functions - - // 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 incompressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryVelocityWallFunctions/immersedBoundaryVelocityWallFunctionFvPatchVectorField.C b/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryVelocityWallFunctions/immersedBoundaryVelocityWallFunctionFvPatchVectorField.C deleted file mode 100644 index 37f117a43..000000000 --- a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryVelocityWallFunctions/immersedBoundaryVelocityWallFunctionFvPatchVectorField.C +++ /dev/null @@ -1,294 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 "immersedBoundaryVelocityWallFunctionFvPatchVectorField.H" -#include "immersedBoundaryWallFunctionFvPatchFields.H" -#include "RASModel.H" -#include "fvPatchFieldMapper.H" -#include "volFields.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -void immersedBoundaryVelocityWallFunctionFvPatchVectorField::setIbCellValues -( - const vectorField& ibcValues -) const -{ - const labelList& ibc = ibPatch().ibCells(); - - if (ibcValues.size() != ibc.size()) - { - FatalErrorIn - ( - "void immersedBoundaryVelocityWallFunctionFvPatchVectorField::" - "setIbCellValues\n" - "(\n" - " const vectorField& ibcValues\n" - ") const" - ) << "Size of ibcValues field not equal to the number of IB cells." - << nl << "ibcValues: " << ibcValues.size() - << " ibc: " << ibc.size() - << abort(FatalError); - } - - // Get non-const access to internal field - vectorField& psiI = const_cast(this->internalField()); - - immersedBoundaryFvPatchVectorField::setIbCellValues(ibcValues); - - if (wallTangentialValue_.empty() || wallMask_.empty()) - { - immersedBoundaryFvPatchVectorField::setIbCellValues(ibcValues); - } - else - { - const vectorField& n = ibPatch().ibNormals(); - - // Calculate tangential component taking into account wall velocity - scalarField UtanOld = mag((I - sqr(n)) & this->ibCellValue()); - - vectorField Uwall = this->ibValue(); - - forAll (ibcValues, cellI) - { - // If mask is set, correct the velocity for the - // tangential wall value, otherwise use the fitted value - if (wallMask_[cellI]) - { - // Decompose fitted velocity into the normal and - // tangential components - const vector& curN = n[cellI]; - const vector curU = psiI[ibc[cellI]]; - - scalar ibcNormal = curN & ibcValues[cellI]; - - // Get tangential velocity and direction - vector ibcTangential = (I - sqr(curN)) & curU; - ibcTangential /= mag(ibcTangential) + SMALL; - - // Reconstruct the velocity, imposing the magnitude of - // tangential value and add wall velocity - psiI[ibc[cellI]] = curN*ibcNormal - + ibcTangential*wallTangentialValue_[cellI] - + Uwall[cellI]; - } - else - { - psiI[ibc[cellI]] = ibcValues[cellI]; - } - } - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -immersedBoundaryVelocityWallFunctionFvPatchVectorField:: -immersedBoundaryVelocityWallFunctionFvPatchVectorField -( - const fvPatch& p, - const DimensionedField& iF -) -: - immersedBoundaryFvPatchVectorField(p, iF), - wallTangentialValue_(), - tauWall_(), - wallMask_() -{} - - -immersedBoundaryVelocityWallFunctionFvPatchVectorField:: -immersedBoundaryVelocityWallFunctionFvPatchVectorField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - immersedBoundaryFvPatchVectorField(p, iF, dict), - wallTangentialValue_(), - tauWall_(), - wallMask_() -{} - - -immersedBoundaryVelocityWallFunctionFvPatchVectorField:: -immersedBoundaryVelocityWallFunctionFvPatchVectorField -( - const immersedBoundaryVelocityWallFunctionFvPatchVectorField& ptf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - immersedBoundaryFvPatchVectorField(ptf, p, iF, mapper), - wallTangentialValue_(), - tauWall_(), - wallMask_() -{} - - -immersedBoundaryVelocityWallFunctionFvPatchVectorField:: -immersedBoundaryVelocityWallFunctionFvPatchVectorField -( - const immersedBoundaryVelocityWallFunctionFvPatchVectorField& ewfpsf -) -: - immersedBoundaryFvPatchVectorField(ewfpsf), - wallTangentialValue_(), - tauWall_(), - wallMask_() -{} - - -immersedBoundaryVelocityWallFunctionFvPatchVectorField:: -immersedBoundaryVelocityWallFunctionFvPatchVectorField -( - const immersedBoundaryVelocityWallFunctionFvPatchVectorField& ewfpsf, - const DimensionedField& iF -) -: - immersedBoundaryFvPatchVectorField(ewfpsf, iF), - wallTangentialValue_(), - tauWall_(), - wallMask_() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -const vectorField& -immersedBoundaryVelocityWallFunctionFvPatchVectorField::wallShearStress() const -{ - if (tauWall_.empty()) - { - FatalErrorIn - ( - "const vectorField& " - "immersedBoundaryVelocityWallFunctionFvPatchVectorField::" - "wallShearStress() const" - ) << "tauWall not set for IB patch " << patch().name() - << " for field " << dimensionedInternalField().name() - << abort(FatalError); - } - - return tauWall_; -} - -Foam::scalarField& -immersedBoundaryVelocityWallFunctionFvPatchVectorField::wallTangentialValue() const -{ - // Bugfix 30/OCT/2015 - check if the mesh is moving - - const immersedBoundaryFvPatch& ibFvP = - immersedBoundaryFvPatchVectorField::ibPatch(); - if - ( - wallTangentialValue_.empty() - || (ibFvP.movingIb() || ibFvP.boundaryMesh().mesh().moving()) - ) - { - wallTangentialValue_.setSize - ( - this->ibPatch().ibCells().size(), - 0 - ); - } - - return wallTangentialValue_; -} - - -Foam::vectorField& -immersedBoundaryVelocityWallFunctionFvPatchVectorField::tauWall() const -{ - // Bugfix 30/OCT/2015 - check if the mesh is moving - - const immersedBoundaryFvPatch& ibFvP = - immersedBoundaryFvPatchVectorField::ibPatch(); - if - ( - tauWall_.empty() - || (ibFvP.movingIb() || ibFvP.boundaryMesh().mesh().moving()) - ) - { - tauWall_.setSize - ( - this->ibPatch().ibCells().size(), - vector::zero - ); - } - - return tauWall_; -} - - -Foam::boolList& -immersedBoundaryVelocityWallFunctionFvPatchVectorField::wallMask() const -{ - // Bugfix 30/OCT/2015 - check if the mesh is moving - - const immersedBoundaryFvPatch& ibFvP = - immersedBoundaryFvPatchVectorField::ibPatch(); - if - ( - wallMask_.empty() - || (ibFvP.movingIb() || ibFvP.boundaryMesh().mesh().moving()) - ) - { - wallMask_.setSize - ( - this->ibPatch().ibCells().size(), - false - ); - } - - return wallMask_; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeField -( - fvPatchVectorField, - immersedBoundaryVelocityWallFunctionFvPatchVectorField -); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // End namespace incompressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryVelocityWallFunctions/immersedBoundaryVelocityWallFunctionFvPatchVectorField.H b/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryVelocityWallFunctions/immersedBoundaryVelocityWallFunctionFvPatchVectorField.H deleted file mode 100644 index e2c8d44b4..000000000 --- a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryVelocityWallFunctions/immersedBoundaryVelocityWallFunctionFvPatchVectorField.H +++ /dev/null @@ -1,192 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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::incompressible::RASModels:: - immersedBoundaryVelocityWallFunctionFvPatchVectorField - -Description - Boundary condition for velocity when using wall functions - - uses tangential velocity as prescribed by the epsilon boundary condition - to enforce into the fit - -SourceFiles - immersedBoundaryVelocityWallFunctionFvPatchVectorField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef immersedBoundaryVelocityWallFunctionFvPatchVectorField_H -#define immersedBoundaryVelocityWallFunctionFvPatchVectorField_H - -#include "fvPatchFields.H" -#include "immersedBoundaryFvPatchFields.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -/*---------------------------------------------------------------------------*\ - Class immersedBoundaryVelocityWallFunctionFvPatchVectorField Declaration -\*---------------------------------------------------------------------------*/ - -class immersedBoundaryVelocityWallFunctionFvPatchVectorField -: - public immersedBoundaryFvPatchVectorField -{ - // Private data - - //- Tangential velocity value to fix in IB cell - mutable scalarField wallTangentialValue_; - - //- Wall shear stress - mutable vectorField tauWall_; - - //- Indicator on values to fix - mutable boolList wallMask_; - - -protected: - - // Protected Member Functions - - //- Set IB cell values: contains data manipulation - virtual void setIbCellValues(const vectorField&) const; - - -public: - - //- Runtime type information - TypeName("immersedBoundaryVelocityWallFunction"); - - - // Constructors - - //- Construct from patch and internal field - immersedBoundaryVelocityWallFunctionFvPatchVectorField - ( - const fvPatch&, - const DimensionedField& - ); - - //- Construct from patch, internal field and dictionary - immersedBoundaryVelocityWallFunctionFvPatchVectorField - ( - const fvPatch&, - const DimensionedField&, - const dictionary& - ); - - //- Construct by mapping given - // immersedBoundaryVelocityWallFunctionFvPatchVectorField - // onto a new patch - immersedBoundaryVelocityWallFunctionFvPatchVectorField - ( - const immersedBoundaryVelocityWallFunctionFvPatchVectorField&, - const fvPatch&, - const DimensionedField&, - const fvPatchFieldMapper& - ); - - //- Construct as copy - immersedBoundaryVelocityWallFunctionFvPatchVectorField - ( - const immersedBoundaryVelocityWallFunctionFvPatchVectorField& - ); - - //- Construct and return a clone - virtual tmp clone() const - { - return tmp - ( - new immersedBoundaryVelocityWallFunctionFvPatchVectorField - ( - *this - ) - ); - } - - //- Construct as copy setting internal field reference - immersedBoundaryVelocityWallFunctionFvPatchVectorField - ( - const immersedBoundaryVelocityWallFunctionFvPatchVectorField&, - const DimensionedField& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp clone - ( - const DimensionedField& iF - ) const - { - return tmp - ( - new immersedBoundaryVelocityWallFunctionFvPatchVectorField - ( - *this, - iF - ) - ); - } - - - //- Destructor - virtual ~immersedBoundaryVelocityWallFunctionFvPatchVectorField() - {} - - - // Member functions - - // Access - - //- Access to tangential velocity value to fix in IB cell - // Note non-const access - scalarField& wallTangentialValue() const; - - //- Return wall shear stress - const vectorField& wallShearStress() const; - - //- Access to wall shear stress in IB cell - // Note non-const access - vectorField& tauWall() const; - - //- Access to indicator on fixed values. Note non-const access - boolList& wallMask() const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // End namespace incompressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryWallFunctions/immersedBoundaryWallFunctionFvPatchField.C b/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryWallFunctions/immersedBoundaryWallFunctionFvPatchField.C deleted file mode 100644 index db3db4342..000000000 --- a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryWallFunctions/immersedBoundaryWallFunctionFvPatchField.C +++ /dev/null @@ -1,233 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 "immersedBoundaryWallFunctionFvPatchField.H" -#include "fvPatchFieldMapper.H" -#include "addToRunTimeSelectionTable.H" -#include "wallFvPatch.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // - - - -template -void immersedBoundaryWallFunctionFvPatchField::setIbCellValues -( - const Field& ibcValues -) const -{ - const labelList& ibc = this->ibPatch().ibCells(); - - if (ibcValues.size() != ibc.size()) - { - FatalErrorIn - ( - "template\n" - "void immersedBoundaryWallFunctionFvPatchField::" - "setIbCellValues\n" - "(\n" - " const Field& ibcValues\n" - ") const" - ) << "Size of ibcValues field not equal to the number of IB cells." - << nl << "ibcValues: " << ibcValues.size() - << " ibc: " << ibc.size() - << abort(FatalError); - } - - // Get non-const access to internal field - Field& psiI = const_cast&>(this->internalField()); - - if (wallValue_.empty() || wallMask_.empty()) - { - immersedBoundaryFvPatchField::setIbCellValues(ibcValues); - } - else - { - forAll (ibcValues, cellI) - { - // If mask is set use the wall value, otherwise use the - // fitted value - if (wallMask_[cellI]) - { - psiI[ibc[cellI]] = wallValue_[cellI]; - } - else - { - psiI[ibc[cellI]] = ibcValues[cellI]; - } - } - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -immersedBoundaryWallFunctionFvPatchField:: -immersedBoundaryWallFunctionFvPatchField -( - const fvPatch& p, - const DimensionedField& iF -) -: - immersedBoundaryFvPatchField(p, iF), - wallValue_(), - wallMask_() -{} - - -template -immersedBoundaryWallFunctionFvPatchField:: -immersedBoundaryWallFunctionFvPatchField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - immersedBoundaryFvPatchField(p, iF, dict), - wallValue_(), - wallMask_() -{} - - -template -immersedBoundaryWallFunctionFvPatchField:: -immersedBoundaryWallFunctionFvPatchField -( - const immersedBoundaryWallFunctionFvPatchField& ptf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - immersedBoundaryFvPatchField(ptf, p, iF, mapper), - wallValue_(), - wallMask_() -{} - - -template -immersedBoundaryWallFunctionFvPatchField:: -immersedBoundaryWallFunctionFvPatchField -( - const immersedBoundaryWallFunctionFvPatchField& tkqrwfpf -) -: - immersedBoundaryFvPatchField(tkqrwfpf), - wallValue_(), - wallMask_() -{} - - -template -immersedBoundaryWallFunctionFvPatchField:: -immersedBoundaryWallFunctionFvPatchField -( - const immersedBoundaryWallFunctionFvPatchField& tkqrwfpf, - const DimensionedField& iF -) -: - immersedBoundaryFvPatchField(tkqrwfpf, iF), - wallValue_(), - wallMask_() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -Foam::Field& immersedBoundaryWallFunctionFvPatchField::wallValue() const -{ - // Note: on a moving mesh, the intersection has changed and - // wallValue fields should be cleared and recalculated. - // This should happen only once, but I cannot see the mechanism - // HJ, 17/Oct/2012 - // Bugfix 30/OCT/2015 - check if the mesh is moving - - const immersedBoundaryFvPatch& ibFvP = - immersedBoundaryFvPatchField::ibPatch(); - - if - ( - wallValue_.empty() - || (ibFvP.movingIb() || ibFvP.boundaryMesh().mesh().moving()) - ) - { - wallValue_.setSize - ( - this->ibPatch().ibCells().size(), - pTraits::zero - ); - } - - return wallValue_; -} - - -template -Foam::boolList& immersedBoundaryWallFunctionFvPatchField::wallMask() const -{ - // Note: on a moving mesh, the intersection has changed and - // wallValue fields should be cleared and recalculated. - // This should happen only once, but I cannot see the mechanism - // HJ, 17/Oct/2012 - // Bugfix 30/OCT/2015 - check if the mesh is moving - const immersedBoundaryFvPatch& ibFvP = - immersedBoundaryFvPatchField::ibPatch(); - - if - ( - wallMask_.empty() - || (ibFvP.movingIb() || ibFvP.boundaryMesh().mesh().moving()) - ) - { - wallMask_.setSize - ( - this->ibPatch().ibCells().size(), - false - ); - } - - return wallMask_; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // End namespace incompressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryWallFunctions/immersedBoundaryWallFunctionFvPatchField.H b/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryWallFunctions/immersedBoundaryWallFunctionFvPatchField.H deleted file mode 100644 index 5b54df76b..000000000 --- a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryWallFunctions/immersedBoundaryWallFunctionFvPatchField.H +++ /dev/null @@ -1,195 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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::incompressible::RASModels::immersedBoundaryWallFunctionFvPatchField - -Description - Boundary condition for passive turbulence variables (U, k, q, R, nut) - when using wall functions on an immersed boundary patch - - Apart form standard immersed boundary capability, the patch field allows - only some values to be fixed, as defined by the wall function calculation. - - This is handled using the ibWallValue and ibWallMask arrays, corresponding - to the number of ibCells - - The implementation of wall functions on an immersed boundary will fix - the values of k, epsilon, nut and tangential velocity in cells within - the log-law layer. For the cells in the laminar sublayer, k and epsilon - (omega) will be calculated using a zero gradient condition, - nut will be set to zero and the tangential component of the - velocity will be corrected. - -Author - Hrvoje Jasak, Wikki Ltd. All rights reserved - -SourceFiles - immersedBoundaryWallFunctionFvPatchField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef immersedBoundaryWallFunctionFvPatchField_H -#define immersedBoundaryWallFunctionFvPatchField_H - -#include "fvPatchFields.H" -#include "immersedBoundaryFvPatchField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -/*---------------------------------------------------------------------------*\ - Class immersedBoundaryWallFunctionFvPatchField Declaration -\*---------------------------------------------------------------------------*/ - -template -class immersedBoundaryWallFunctionFvPatchField -: - public immersedBoundaryFvPatchField -{ - // Private data - - //- Value to fix in IB cell - mutable Field wallValue_; - - //- Indicator on values to fix - mutable boolList wallMask_; - - -protected: - - // Protected Member Functions - - //- Set IB cell values: contains data manipulation - virtual void setIbCellValues(const Field&) const; - - -public: - - //- Runtime type information - TypeName("immersedBoundaryWallFunction"); - - - // Constructors - - //- Construct from patch and internal field - immersedBoundaryWallFunctionFvPatchField - ( - const fvPatch&, - const DimensionedField& - ); - - //- Construct from patch, internal field and dictionary - immersedBoundaryWallFunctionFvPatchField - ( - const fvPatch&, - const DimensionedField&, - const dictionary& - ); - - //- Construct by mapping given - // immersedBoundaryWallFunctionFvPatchField - // onto a new patch - immersedBoundaryWallFunctionFvPatchField - ( - const immersedBoundaryWallFunctionFvPatchField&, - const fvPatch&, - const DimensionedField&, - const fvPatchFieldMapper& - ); - - //- Construct as copy - immersedBoundaryWallFunctionFvPatchField - ( - const immersedBoundaryWallFunctionFvPatchField& - ); - - //- Construct and return a clone - virtual tmp > clone() const - { - return tmp > - ( - new immersedBoundaryWallFunctionFvPatchField(*this) - ); - } - - //- Construct as copy setting internal field reference - immersedBoundaryWallFunctionFvPatchField - ( - const immersedBoundaryWallFunctionFvPatchField&, - const DimensionedField& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp > clone - ( - const DimensionedField& iF - ) const - { - return tmp > - ( - new immersedBoundaryWallFunctionFvPatchField(*this, iF) - ); - } - - - //- Destructor - virtual ~immersedBoundaryWallFunctionFvPatchField() - {} - - - // Member functions - - // Access - - //- Access to value to fix in IB cell. Note non-const access - Field& wallValue() const; - - //- Access to indicator on fixed values. Note non-const access - boolList& wallMask() const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // End namespace incompressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "immersedBoundaryWallFunctionFvPatchField.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryWallFunctions/immersedBoundaryWallFunctionFvPatchFields.C b/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryWallFunctions/immersedBoundaryWallFunctionFvPatchFields.C deleted file mode 100644 index 105954cbc..000000000 --- a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryWallFunctions/immersedBoundaryWallFunctionFvPatchFields.C +++ /dev/null @@ -1,50 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 "immersedBoundaryWallFunctionFvPatchFields.H" -#include "fvPatchFields.H" -#include "addToRunTimeSelectionTable.H" -#include "volFields.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makePatchFields(immersedBoundaryWallFunction); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // End namespace incompressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryWallFunctions/immersedBoundaryWallFunctionFvPatchFields.H b/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryWallFunctions/immersedBoundaryWallFunctionFvPatchFields.H deleted file mode 100644 index 668153faf..000000000 --- a/src/immersedBoundary/immersedBoundaryTurbulence/wallFunctions/immersedBoundaryWallFunctions/immersedBoundaryWallFunctionFvPatchFields.H +++ /dev/null @@ -1,55 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 immersedBoundaryWallFunctionFvPatchFields_H -#define immersedBoundaryWallFunctionFvPatchFields_H - -#include "immersedBoundaryWallFunctionFvPatchField.H" -#include "fieldTypes.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeFieldTypedefs(immersedBoundaryWallFunction) - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // End namespace incompressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* //