diff --git a/src/TurbulenceModels/incompressible/Make/files b/src/TurbulenceModels/incompressible/Make/files index 4d4d5729bdcf6809883f8577b7183f58d71136dc..f0800b1a49b86fbab5323c32476a74be226e62f8 100644 --- a/src/TurbulenceModels/incompressible/Make/files +++ b/src/TurbulenceModels/incompressible/Make/files @@ -3,7 +3,6 @@ incompressibleTurbulenceModel.C turbulentTransportModels/turbulentTransportModels.C turbulentTransportModels/RAS/kOmega/kOmega.C turbulentTransportModels/RAS/RNGkEpsilon/RNGkEpsilon.C -turbulentTransportModels/RAS/v2f/v2f.C turbulentTransportModels/RAS/qZeta/qZeta.C turbulentTransportModels/RAS/kkLOmega/kkLOmega.C turbulentTransportModels/RAS/LamBremhorstKE/LamBremhorstKE.C @@ -13,8 +12,10 @@ turbulentTransportModels/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.C turbulentTransportModels/RAS/nonlinearKEShih/nonlinearKEShih.C BCs = turbulentTransportModels/RAS/derivedFvPatchFields +/* $(BCs)/wallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C $(BCs)/wallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C +*/ turbulentTransportModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/derivedFvPatchFields/wallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/derivedFvPatchFields/wallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C deleted file mode 100644 index fa2652446bc3aa3b134d31ad1e427a48bc316664..0000000000000000000000000000000000000000 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/derivedFvPatchFields/wallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C +++ /dev/null @@ -1,267 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "fWallFunctionFvPatchScalarField.H" -#include "v2f.H" -#include "fvPatchFieldMapper.H" -#include "volFields.H" -#include "wallFvPatch.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -void fWallFunctionFvPatchScalarField::checkType() -{ - if (!isA<wallFvPatch>(patch())) - { - FatalErrorIn("fWallFunctionFvPatchScalarField::checkType()") - << "Invalid wall function specification" << nl - << " Patch type for patch " << patch().name() - << " must be wall" << nl - << " Current patch type is " << patch().type() << nl << endl - << abort(FatalError); - } -} - - -void fWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const -{ - os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; - os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; - os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; -} - - -scalar fWallFunctionFvPatchScalarField::yPlusLam -( - const scalar kappa, - const scalar E -) -{ - scalar ypl = 11.0; - - for (int i=0; i<10; i++) - { - ypl = log(max(E*ypl, 1))/kappa; - } - - return ypl; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF -) -: - fixedValueFvPatchField<scalar>(p, iF), - Cmu_(0.09), - kappa_(0.41), - E_(9.8), - yPlusLam_(yPlusLam(kappa_, E_)) -{ - checkType(); -} - - -fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField -( - const fWallFunctionFvPatchScalarField& ptf, - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF, - const fvPatchFieldMapper& mapper -) -: - fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), - Cmu_(ptf.Cmu_), - kappa_(ptf.kappa_), - E_(ptf.E_), - yPlusLam_(ptf.yPlusLam_) -{ - checkType(); -} - - -fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF, - const dictionary& dict -) -: - fixedValueFvPatchField<scalar>(p, iF, dict), - Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), - kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), - E_(dict.lookupOrDefault<scalar>("E", 9.8)), - yPlusLam_(yPlusLam(kappa_, E_)) -{ - checkType(); -} - - -fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField -( - const fWallFunctionFvPatchScalarField& v2wfpsf -) -: - fixedValueFvPatchField<scalar>(v2wfpsf), - Cmu_(v2wfpsf.Cmu_), - kappa_(v2wfpsf.kappa_), - E_(v2wfpsf.E_), - yPlusLam_(v2wfpsf.yPlusLam_) -{ - checkType(); -} - - -fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField -( - const fWallFunctionFvPatchScalarField& v2wfpsf, - const DimensionedField<scalar, volMesh>& iF -) -: - fixedValueFvPatchField<scalar>(v2wfpsf, iF), - Cmu_(v2wfpsf.Cmu_), - kappa_(v2wfpsf.kappa_), - E_(v2wfpsf.E_), - yPlusLam_(v2wfpsf.yPlusLam_) -{ - checkType(); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void fWallFunctionFvPatchScalarField::updateCoeffs() -{ - if (updated()) - { - return; - } - - const label patchi = patch().index(); - - const turbulenceModel& turbulence = db().lookupObject<turbulenceModel> - ( - IOobject::groupName - ( - turbulenceModel::propertiesName, - dimensionedInternalField().group() - ) - ); - const v2f& v2fModel = refCast<const v2f>(turbulence); - - const scalarField& y = v2fModel.y()[patchi]; - - const tmp<volScalarField> tk = v2fModel.k(); - const volScalarField& k = tk(); - - const tmp<volScalarField> tepsilon = v2fModel.epsilon(); - const volScalarField& epsilon = tepsilon(); - - const tmp<volScalarField> tv2 = v2fModel.v2(); - const volScalarField& v2 = tv2(); - - const tmp<scalarField> tnuw = turbulence.nu(patchi); - const scalarField& nuw = tnuw(); - - const scalar Cmu25 = pow025(Cmu_); - - scalarField& f = *this; - - // Set f wall values - forAll(f, faceI) - { - label faceCellI = patch().faceCells()[faceI]; - - scalar uTau = Cmu25*sqrt(k[faceCellI]); - - scalar yPlus = uTau*y[faceI]/nuw[faceI]; - - if (yPlus > yPlusLam_) - { - scalar N = 6.0; - scalar v2c = v2[faceCellI]; - scalar epsc = epsilon[faceCellI]; - scalar kc = k[faceCellI]; - - f[faceI] = N*v2c*epsc/(sqr(kc) + ROOTVSMALL); - f[faceI] /= sqr(uTau) + ROOTVSMALL; - } - else - { - f[faceI] = 0.0; - } - } - - fixedValueFvPatchField<scalar>::updateCoeffs(); - - // TODO: perform averaging for cells sharing more than one boundary face -} - - -void fWallFunctionFvPatchScalarField::evaluate -( - const Pstream::commsTypes commsType -) -{ - fixedValueFvPatchField<scalar>::evaluate(commsType); -} - - -void fWallFunctionFvPatchScalarField::write(Ostream& os) const -{ - writeLocalEntries(os); - fixedValueFvPatchField<scalar>::write(os); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeField -( - fvPatchScalarField, - fWallFunctionFvPatchScalarField -); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // End namespace incompressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/derivedFvPatchFields/wallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.H b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/derivedFvPatchFields/wallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.H deleted file mode 100644 index d99d16102642a9c99bd4aefd4ca2b4676c7de01d..0000000000000000000000000000000000000000 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/derivedFvPatchFields/wallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.H +++ /dev/null @@ -1,209 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Class - Foam::RASModels::fWallFunctionFvPatchScalarField - -Group - grpWallFunctions - -Description - This boundary condition provides a turbulence damping function, f, wall - function condition for low- and high Reynolds number, turbulent flow cases - - The model operates in two modes, based on the computed laminar-to-turbulent - switch-over y+ value derived from kappa and E. - - \heading Patch usage - - \table - Property | Description | Required | Default value - Cmu | model coefficient | no | 0.09 - kappa | Von Karman constant | no | 0.41 - E | model coefficient | no | 9.8 - \endtable - - Example of the boundary condition specification: - \verbatim - myPatch - { - type fWallFunction; - } - \endverbatim - -SeeAlso - Foam::fixedValueFvPatchField - -SourceFiles - fWallFunctionFvPatchScalarField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef fWallFunctionFvPatchScalarField_H -#define fWallFunctionFvPatchScalarField_H - -#include "fixedValueFvPatchField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -/*---------------------------------------------------------------------------*\ - Class fWallFunctionFvPatchScalarField Declaration -\*---------------------------------------------------------------------------*/ - -class fWallFunctionFvPatchScalarField -: - public fixedValueFvPatchField<scalar> -{ -protected: - - // Protected data - - //- Cmu coefficient - scalar Cmu_; - - //- Von Karman constant - scalar kappa_; - - //- E coefficient - scalar E_; - - //- Y+ at the edge of the laminar sublayer - scalar yPlusLam_; - - - // Protected Member Functions - - //- Check the type of the patch - virtual void checkType(); - - //- Write local wall function variables - virtual void writeLocalEntries(Ostream&) const; - - //- Calculate the Y+ at the edge of the laminar sublayer - scalar yPlusLam(const scalar kappa, const scalar E); - - -public: - - //- Runtime type information - TypeName("fWallFunction"); - - - // Constructors - - //- Construct from patch and internal field - fWallFunctionFvPatchScalarField - ( - const fvPatch&, - const DimensionedField<scalar, volMesh>& - ); - - //- Construct from patch, internal field and dictionary - fWallFunctionFvPatchScalarField - ( - const fvPatch&, - const DimensionedField<scalar, volMesh>&, - const dictionary& - ); - - //- Construct by mapping given fWallFunctionFvPatchScalarField - // onto a new patch - fWallFunctionFvPatchScalarField - ( - const fWallFunctionFvPatchScalarField&, - const fvPatch&, - const DimensionedField<scalar, volMesh>&, - const fvPatchFieldMapper& - ); - - //- Construct as copy - fWallFunctionFvPatchScalarField - ( - const fWallFunctionFvPatchScalarField& - ); - - //- Construct and return a clone - virtual tmp<fvPatchScalarField> clone() const - { - return tmp<fvPatchScalarField> - ( - new fWallFunctionFvPatchScalarField(*this) - ); - } - - //- Construct as copy setting internal field reference - fWallFunctionFvPatchScalarField - ( - const fWallFunctionFvPatchScalarField&, - const DimensionedField<scalar, volMesh>& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp<fvPatchScalarField> clone - ( - const DimensionedField<scalar, volMesh>& iF - ) const - { - return tmp<fvPatchScalarField> - ( - new fWallFunctionFvPatchScalarField(*this, iF) - ); - } - - - // Member functions - - // Evaluation functions - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - - //- Evaluate the patchField - virtual void evaluate(const Pstream::commsTypes); - - - // I-O - - //- Write - virtual void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // End namespace incompressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/derivedFvPatchFields/wallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/derivedFvPatchFields/wallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C deleted file mode 100644 index c2df8e4a94ef8bf7778d6e5a3a2b43bdbfe1f883..0000000000000000000000000000000000000000 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/derivedFvPatchFields/wallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C +++ /dev/null @@ -1,258 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "v2WallFunctionFvPatchScalarField.H" -#include "turbulenceModel.H" -#include "fvPatchFieldMapper.H" -#include "volFields.H" -#include "addToRunTimeSelectionTable.H" -#include "wallFvPatch.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -void v2WallFunctionFvPatchScalarField::checkType() -{ - if (!isA<wallFvPatch>(patch())) - { - FatalErrorIn("v2WallFunctionFvPatchScalarField::checkType()") - << "Invalid wall function specification" << nl - << " Patch type for patch " << patch().name() - << " must be wall" << nl - << " Current patch type is " << patch().type() << nl << endl - << abort(FatalError); - } -} - - -void v2WallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const -{ - os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; - os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; - os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; -} - - -scalar v2WallFunctionFvPatchScalarField::yPlusLam -( - const scalar kappa, - const scalar E -) -{ - scalar ypl = 11.0; - - for (int i=0; i<10; i++) - { - ypl = log(max(E*ypl, 1))/kappa; - } - - return ypl; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF -) -: - fixedValueFvPatchField<scalar>(p, iF), - Cmu_(0.09), - kappa_(0.41), - E_(9.8), - yPlusLam_(yPlusLam(kappa_, E_)) -{ - checkType(); -} - - -v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField -( - const v2WallFunctionFvPatchScalarField& ptf, - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF, - const fvPatchFieldMapper& mapper -) -: - fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), - Cmu_(ptf.Cmu_), - kappa_(ptf.kappa_), - E_(ptf.E_), - yPlusLam_(ptf.yPlusLam_) -{ - checkType(); -} - - -v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF, - const dictionary& dict -) -: - fixedValueFvPatchField<scalar>(p, iF, dict), - Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), - kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), - E_(dict.lookupOrDefault<scalar>("E", 9.8)), - yPlusLam_(yPlusLam(kappa_, E_)) -{ - checkType(); -} - - -v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField -( - const v2WallFunctionFvPatchScalarField& v2wfpsf -) -: - fixedValueFvPatchField<scalar>(v2wfpsf), - Cmu_(v2wfpsf.Cmu_), - kappa_(v2wfpsf.kappa_), - E_(v2wfpsf.E_), - yPlusLam_(v2wfpsf.yPlusLam_) -{ - checkType(); -} - - -v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField -( - const v2WallFunctionFvPatchScalarField& v2wfpsf, - const DimensionedField<scalar, volMesh>& iF -) -: - fixedValueFvPatchField<scalar>(v2wfpsf, iF), - Cmu_(v2wfpsf.Cmu_), - kappa_(v2wfpsf.kappa_), - E_(v2wfpsf.E_), - yPlusLam_(v2wfpsf.yPlusLam_) -{ - checkType(); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void v2WallFunctionFvPatchScalarField::updateCoeffs() -{ - if (updated()) - { - return; - } - - const label patchi = patch().index(); - - const turbulenceModel& turbulence = db().lookupObject<turbulenceModel> - ( - IOobject::groupName - ( - turbulenceModel::propertiesName, - dimensionedInternalField().group() - ) - ); - const scalarField& y = turbulence.y()[patchi]; - - const tmp<volScalarField> tk = turbulence.k(); - const volScalarField& k = tk(); - - const tmp<scalarField> tnuw = turbulence.nu(patchi); - const scalarField& nuw = tnuw(); - - const scalar Cmu25 = pow025(Cmu_); - - scalarField& v2 = *this; - - // Set v2 wall values - forAll(v2, faceI) - { - label faceCellI = patch().faceCells()[faceI]; - - scalar uTau = Cmu25*sqrt(k[faceCellI]); - - scalar yPlus = uTau*y[faceI]/nuw[faceI]; - - if (yPlus > yPlusLam_) - { - scalar Cv2 = 0.193; - scalar Bv2 = -0.94; - v2[faceI] = Cv2/kappa_*log(yPlus) + Bv2; - } - else - { - scalar Cv2 = 0.193; - v2[faceI] = Cv2*pow4(yPlus); - } - - v2[faceI] *= sqr(uTau); - } - - fixedValueFvPatchField<scalar>::updateCoeffs(); - - // TODO: perform averaging for cells sharing more than one boundary face -} - - -void v2WallFunctionFvPatchScalarField::evaluate -( - const Pstream::commsTypes commsType -) -{ - fixedValueFvPatchField<scalar>::evaluate(commsType); -} - - -void v2WallFunctionFvPatchScalarField::write(Ostream& os) const -{ - writeLocalEntries(os); - fixedValueFvPatchField<scalar>::write(os); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeField -( - fvPatchScalarField, - v2WallFunctionFvPatchScalarField -); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // End namespace incompressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/derivedFvPatchFields/wallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H b/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/derivedFvPatchFields/wallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H deleted file mode 100644 index e4e8fdafa061a35310a75290979158f9c3aae241..0000000000000000000000000000000000000000 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/derivedFvPatchFields/wallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H +++ /dev/null @@ -1,211 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Class - Foam::RASModels::v2WallFunctionFvPatchScalarField - -Group - grpWallFunctions - -Description - This boundary condition provides a turbulence stress normal to streamlines - wall function condition for low- and high-Reynolds number, turbulent flow - cases. - - The model operates in two modes, based on the computed laminar-to-turbulent - switch-over y+ value derived from kappa and E. - - - \heading Patch usage - - \table - Property | Description | Required | Default value - Cmu | model coefficient | no | 0.09 - kappa | Von Karman constant | no | 0.41 - E | model coefficient | no | 9.8 - \endtable - - Example of the boundary condition specification: - \verbatim - myPatch - { - type v2WallFunction; - } - \endverbatim - -SeeAlso - Foam::fixedValueFvPatchField - -SourceFiles - v2WallFunctionFvPatchScalarField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef v2WallFunctionFvPatchScalarField_H -#define v2WallFunctionFvPatchScalarField_H - -#include "fixedValueFvPatchField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -/*---------------------------------------------------------------------------*\ - Class v2WallFunctionFvPatchScalarField Declaration -\*---------------------------------------------------------------------------*/ - -class v2WallFunctionFvPatchScalarField -: - public fixedValueFvPatchField<scalar> -{ -protected: - - // Protected data - - //- Cmu coefficient - scalar Cmu_; - - //- Von Karman constant - scalar kappa_; - - //- E coefficient - scalar E_; - - //- Y+ at the edge of the laminar sublayer - scalar yPlusLam_; - - - // Protected Member Functions - - //- Check the type of the patch - virtual void checkType(); - - //- Write local wall function variables - virtual void writeLocalEntries(Ostream&) const; - - //- Calculate the Y+ at the edge of the laminar sublayer - scalar yPlusLam(const scalar kappa, const scalar E); - - -public: - - //- Runtime type information - TypeName("v2WallFunction"); - - - // Constructors - - //- Construct from patch and internal field - v2WallFunctionFvPatchScalarField - ( - const fvPatch&, - const DimensionedField<scalar, volMesh>& - ); - - //- Construct from patch, internal field and dictionary - v2WallFunctionFvPatchScalarField - ( - const fvPatch&, - const DimensionedField<scalar, volMesh>&, - const dictionary& - ); - - //- Construct by mapping given v2WallFunctionFvPatchScalarField - // onto a new patch - v2WallFunctionFvPatchScalarField - ( - const v2WallFunctionFvPatchScalarField&, - const fvPatch&, - const DimensionedField<scalar, volMesh>&, - const fvPatchFieldMapper& - ); - - //- Construct as copy - v2WallFunctionFvPatchScalarField - ( - const v2WallFunctionFvPatchScalarField& - ); - - //- Construct and return a clone - virtual tmp<fvPatchScalarField> clone() const - { - return tmp<fvPatchScalarField> - ( - new v2WallFunctionFvPatchScalarField(*this) - ); - } - - //- Construct as copy setting internal field reference - v2WallFunctionFvPatchScalarField - ( - const v2WallFunctionFvPatchScalarField&, - const DimensionedField<scalar, volMesh>& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp<fvPatchScalarField> clone - ( - const DimensionedField<scalar, volMesh>& iF - ) const - { - return tmp<fvPatchScalarField> - ( - new v2WallFunctionFvPatchScalarField(*this, iF) - ); - } - - - // Member functions - - // Evaluation functions - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - - //- Evaluate the patchField - virtual void evaluate(const Pstream::commsTypes); - - - // I-O - - //- Write - virtual void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // End namespace incompressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/incompressible/turbulentTransportModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C index 46051f0a671597e0e611443fb4b13c5929d1ffac..3e5e056ecbab312d64e1de315a3f20c80079e9c1 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C @@ -203,7 +203,7 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs() // Retrieve turbulence properties from model - const turbulenceModel& turbulence = db().lookupObject<turbulenceModel> + const turbulenceModel& turbModel = db().lookupObject<turbulenceModel> ( IOobject::groupName ( @@ -213,11 +213,11 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs() ); const scalar Cmu25 = pow(Cmu_, 0.25); - const scalarField& y = turbulence.y()[patchi]; - const tmp<volScalarField> tnu = turbulence.nu(); + const scalarField& y = turbModel.y()[patchi]; + const tmp<volScalarField> tnu = turbModel.nu(); const volScalarField& nu = tnu(); const scalarField& nuw = nu.boundaryField()[patchi]; - const tmp<volScalarField> tk = turbulence.k(); + const tmp<volScalarField> tk = turbModel.k(); const volScalarField& k = tk(); const IOdictionary& transportProperties = diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.C b/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.C index 791ea15db459afb48ef9b3821e396241ceca1d68..6ae16a78644ffd86f0e60a7205e8c49a8d2adc4b 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.C +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.C @@ -67,6 +67,9 @@ makeRASModel(LaunderSharmaKE); #include "kOmegaSST.H" makeRASModel(kOmegaSST); +#include "v2f.H" +makeRASModel(v2f); + #include "LRR.H" makeRASModel(LRR); diff --git a/src/TurbulenceModels/turbulenceModels/Make/files b/src/TurbulenceModels/turbulenceModels/Make/files index 8fc5627614b5912f0903dec73b655ad4a614782a..1faa13d7db64f8928b135ab706beb7dc0e4ce5f6 100644 --- a/src/TurbulenceModels/turbulenceModels/Make/files +++ b/src/TurbulenceModels/turbulenceModels/Make/files @@ -52,13 +52,11 @@ kqRWallFunctions = $(wallFunctions)/kqRWallFunctions $(kqRWallFunctions)/kqRWallFunction/kqRWallFunctionFvPatchFields.C $(kqRWallFunctions)/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C -/* v2WallFunctions = $(wallFunctions)/v2WallFunctions $(v2WallFunctions)/v2WallFunction/v2WallFunctionFvPatchScalarField.C fWallFunctions = $(wallFunctions)/fWallFunctions $(fWallFunctions)/fWallFunction/fWallFunctionFvPatchScalarField.C -*/ RASBCs = RAS/derivedFvPatchFields diff --git a/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C index 666a6fca7c65046fa0107c1da106edde0eeb01dd..8a136069e1f8dbb6644abfc5df1f991c7d029f2a 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C @@ -126,7 +126,7 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs() } // Lookup Cmu corresponding to the turbulence model selected - const turbulenceModel& turbulence = db().lookupObject<turbulenceModel> + const turbulenceModel& turbModel = db().lookupObject<turbulenceModel> ( IOobject::groupName ( @@ -136,7 +136,7 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs() ); const scalar Cmu = - turbulence.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); + turbModel.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); const scalar Cmu75 = pow(Cmu, 0.75); diff --git a/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C index 7db0599d11f5d4b3092cafb5af73565b3feab4df..4c19cf6a0f6948573fd93268ff0bc23a2ff83e5e 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C @@ -122,7 +122,7 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs() } // Lookup Cmu corresponding to the turbulence model selected - const turbulenceModel& turbulence = db().lookupObject<turbulenceModel> + const turbulenceModel& turbModel = db().lookupObject<turbulenceModel> ( IOobject::groupName ( @@ -132,7 +132,7 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs() ); const scalar Cmu = - turbulence.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); + turbModel.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); const scalar Cmu25 = pow(Cmu, 0.25); diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/v2f/v2f.C b/src/TurbulenceModels/turbulenceModels/RAS/v2f/v2f.C similarity index 58% rename from src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/v2f/v2f.C rename to src/TurbulenceModels/turbulenceModels/RAS/v2f/v2f.C index 5ad4914970ad5a9091baabac901714d22ce1dc4c..a281ef4fa515d20d7c5827ef03de553ef8726794 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/v2f/v2f.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/v2f/v2f.C @@ -27,49 +27,47 @@ License #include "bound.H" #include "fixedValueFvPatchField.H" #include "zeroGradientFvPatchField.H" -#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -namespace incompressible -{ namespace RASModels { -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(v2f, 0); -addToRunTimeSelectionTable(RASModel, v2f, dictionary); - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -tmp<volScalarField> v2f::Ts() const +template<class BasicTurbulenceModel> +tmp<volScalarField> v2f<BasicTurbulenceModel>::Ts() const { - return max(k_/epsilon_, 6.0*sqrt(nu()/epsilon_)); + return max(k_/epsilon_, 6.0*sqrt(this->nu()/epsilon_)); } -tmp<volScalarField> v2f::Ls() const +template<class BasicTurbulenceModel> +tmp<volScalarField> v2f<BasicTurbulenceModel>::Ls() const { - return CL_*max(pow(k_, 1.5)/epsilon_, Ceta_*pow025(pow3(nu())/epsilon_)); + return + CL_*max(pow(k_, 1.5) + /epsilon_, Ceta_*pow025(pow3(this->nu())/epsilon_)); } -void v2f::correctNut() +template<class BasicTurbulenceModel> +void v2f<BasicTurbulenceModel>::correctNut() { - nut_ = min(CmuKEps_*sqr(k_)/epsilon_, Cmu_*v2_*Ts()); - nut_.correctBoundaryConditions(); + this->nut_ = min(CmuKEps_*sqr(k_)/epsilon_, this->Cmu_*v2_*Ts()); + this->nut_.correctBoundaryConditions(); } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -v2f::v2f +template<class BasicTurbulenceModel> +v2f<BasicTurbulenceModel>::v2f ( - const geometricOneField& alpha, - const geometricOneField& rho, + const alphaField& alpha, + const rhoField& rho, const volVectorField& U, const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& phi, @@ -78,7 +76,7 @@ v2f::v2f const word& type ) : - eddyViscosity<incompressible::RASModel> + eddyViscosity<RASModel<BasicTurbulenceModel> > ( type, alpha, @@ -89,13 +87,14 @@ v2f::v2f transport, propertiesName ), + v2fBase(), Cmu_ ( dimensioned<scalar>::lookupOrAddToDict ( "Cmu", - coeffDict_, + this->coeffDict_, 0.22 ) ), @@ -104,7 +103,7 @@ v2f::v2f dimensioned<scalar>::lookupOrAddToDict ( "CmuKEps", - coeffDict_, + this->coeffDict_, 0.09 ) ), @@ -113,7 +112,7 @@ v2f::v2f dimensioned<scalar>::lookupOrAddToDict ( "C1", - coeffDict_, + this->coeffDict_, 1.4 ) ), @@ -122,7 +121,7 @@ v2f::v2f dimensioned<scalar>::lookupOrAddToDict ( "C2", - coeffDict_, + this->coeffDict_, 0.3 ) ), @@ -131,7 +130,7 @@ v2f::v2f dimensioned<scalar>::lookupOrAddToDict ( "CL", - coeffDict_, + this->coeffDict_, 0.23 ) ), @@ -140,7 +139,7 @@ v2f::v2f dimensioned<scalar>::lookupOrAddToDict ( "Ceta", - coeffDict_, + this->coeffDict_, 70.0 ) ), @@ -149,16 +148,25 @@ v2f::v2f dimensioned<scalar>::lookupOrAddToDict ( "Ceps2", - coeffDict_, + this->coeffDict_, 1.9 ) ), + Ceps3_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Ceps3", + this->coeffDict_, + -0.33 + ) + ), sigmaK_ ( dimensioned<scalar>::lookupOrAddToDict ( "sigmaK", - coeffDict_, + this->coeffDict_, 1.0 ) ), @@ -167,7 +175,7 @@ v2f::v2f dimensioned<scalar>::lookupOrAddToDict ( "sigmaEps", - coeffDict_, + this->coeffDict_, 1.3 ) ), @@ -177,80 +185,82 @@ v2f::v2f IOobject ( IOobject::groupName("k", U.group()), - runTime_.timeName(), - mesh_, + this->runTime_.timeName(), + this->mesh_, IOobject::MUST_READ, IOobject::AUTO_WRITE ), - mesh_ + this->mesh_ ), epsilon_ ( IOobject ( IOobject::groupName("epsilon", U.group()), - runTime_.timeName(), - mesh_, + this->runTime_.timeName(), + this->mesh_, IOobject::MUST_READ, IOobject::AUTO_WRITE ), - mesh_ + this->mesh_ ), v2_ ( IOobject ( IOobject::groupName("v2", U.group()), - runTime_.timeName(), - mesh_, + this->runTime_.timeName(), + this->mesh_, IOobject::MUST_READ, IOobject::AUTO_WRITE ), - mesh_ + this->mesh_ ), f_ ( IOobject ( IOobject::groupName("f", U.group()), - runTime_.timeName(), - mesh_, + this->runTime_.timeName(), + this->mesh_, IOobject::MUST_READ, IOobject::AUTO_WRITE ), - mesh_ + this->mesh_ ), v2Min_(dimensionedScalar("v2Min", v2_.dimensions(), SMALL)), fMin_(dimensionedScalar("fMin", f_.dimensions(), 0.0)) { - bound(k_, kMin_); - bound(epsilon_, epsilonMin_); + bound(k_, this->kMin_); + bound(epsilon_, this->epsilonMin_); bound(v2_, v2Min_); bound(f_, fMin_); if (type == typeName) { + this->printCoeffs(type); correctNut(); - printCoeffs(type); } } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool v2f::read() +template<class BasicTurbulenceModel> +bool v2f<BasicTurbulenceModel>::read() { - if (eddyViscosity<incompressible::RASModel>::read()) + if (eddyViscosity<RASModel<BasicTurbulenceModel> >::read()) { - Cmu_.readIfPresent(coeffDict()); - CmuKEps_.readIfPresent(coeffDict()); - C1_.readIfPresent(coeffDict()); - C2_.readIfPresent(coeffDict()); - CL_.readIfPresent(coeffDict()); - Ceta_.readIfPresent(coeffDict()); - Ceps2_.readIfPresent(coeffDict()); - sigmaK_.readIfPresent(coeffDict()); - sigmaEps_.readIfPresent(coeffDict()); + Cmu_.readIfPresent(this->coeffDict()); + CmuKEps_.readIfPresent(this->coeffDict()); + C1_.readIfPresent(this->coeffDict()); + C2_.readIfPresent(this->coeffDict()); + CL_.readIfPresent(this->coeffDict()); + Ceta_.readIfPresent(this->coeffDict()); + Ceps2_.readIfPresent(this->coeffDict()); + Ceps3_.readIfPresent(this->coeffDict()); + sigmaK_.readIfPresent(this->coeffDict()); + sigmaEps_.readIfPresent(this->coeffDict()); return true; } @@ -261,32 +271,45 @@ bool v2f::read() } -void v2f::correct() +template<class BasicTurbulenceModel> +void v2f<BasicTurbulenceModel>::correct() { - eddyViscosity<incompressible::RASModel>::correct(); - - if (!turbulence_) + if (!this->turbulence_) { return; } - // use N=6 so that f=0 at walls + // Local references + const alphaField& alpha = this->alpha_; + const rhoField& rho = this->rho_; + const surfaceScalarField& alphaRhoPhi = this->alphaRhoPhi_; + const volVectorField& U = this->U_; + volScalarField& nut = this->nut_; + + eddyViscosity<RASModel<BasicTurbulenceModel> >::correct(); + + volScalarField divU(fvc::div(fvc::absolute(this->phi(), U))); + + // Use N=6 so that f=0 at walls const dimensionedScalar N("N", dimless, 6.0); - const volTensorField gradU(fvc::grad(U_)); + const volTensorField gradU(fvc::grad(U)); const volScalarField S2(2*magSqr(dev(symm(gradU)))); - const volScalarField G(GName(), nut_*S2); + const volScalarField G(this->GName(), nut*S2); const volScalarField T(Ts()); const volScalarField L2(type() + ":L2", sqr(Ls())); - const volScalarField alpha + const volScalarField v2fAlpha ( - "v2f:alpha", + type() + ":alpha", 1.0/T*((C1_ - N)*v2_ - 2.0/3.0*k_*(C1_ - 1.0)) ); - tmp<volScalarField> Ceps1 = - 1.4*(1.0 + 0.05*min(sqrt(k_/v2_), scalar(100.0))); + const volScalarField Ceps1 + ( + "Ceps1", + 1.4*(1.0 + 0.05*min(sqrt(k_/v2_), scalar(100.0))) + ); // Update epsilon (and possibly G) at the wall epsilon_.boundaryField().updateCoeffs(); @@ -294,12 +317,13 @@ void v2f::correct() // Dissipation equation tmp<fvScalarMatrix> epsEqn ( - fvm::ddt(epsilon_) - + fvm::div(phi_, epsilon_) - - fvm::laplacian(DepsilonEff(), epsilon_) + fvm::ddt(alpha, rho, epsilon_) + + fvm::div(alphaRhoPhi, epsilon_) + - fvm::laplacian(alpha*rho*DepsilonEff(), epsilon_) == - Ceps1*G/T - - fvm::Sp(Ceps2_/T, epsilon_) + Ceps1*alpha*rho*G/T + - fvm::SuSp(((2.0/3.0)*Ceps1 + Ceps3_)*alpha*rho*divU, epsilon_) + - fvm::Sp(Ceps2_*alpha*rho/T, epsilon_) ); epsEqn().relax(); @@ -307,23 +331,24 @@ void v2f::correct() epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); - bound(epsilon_, epsilonMin_); + bound(epsilon_, this->epsilonMin_); // Turbulent kinetic energy equation tmp<fvScalarMatrix> kEqn ( - fvm::ddt(k_) - + fvm::div(phi_, k_) - - fvm::laplacian(DkEff(), k_) + fvm::ddt(alpha, rho, k_) + + fvm::div(alphaRhoPhi, k_) + - fvm::laplacian(alpha*rho*DkEff(), k_) == - G - - fvm::Sp(epsilon_/k_, k_) + alpha*rho*G + - fvm::SuSp((2.0/3.0)*alpha*rho*divU, k_) + - fvm::Sp(alpha*rho*epsilon_/k_, k_) ); kEqn().relax(); solve(kEqn); - bound(k_, kMin_); + bound(k_, this->kMin_); // Relaxation function equation @@ -332,7 +357,7 @@ void v2f::correct() - fvm::laplacian(f_) == - fvm::Sp(1.0/L2, f_) - - 1.0/L2/k_*(alpha - C2_*G) + - 1.0/L2/k_*(v2fAlpha - C2_*G) ); fEqn().relax(); @@ -343,12 +368,12 @@ void v2f::correct() // Turbulence stress normal to streamlines equation tmp<fvScalarMatrix> v2Eqn ( - fvm::ddt(v2_) - + fvm::div(phi_, v2_) - - fvm::laplacian(DkEff(), v2_) + fvm::ddt(alpha, rho, v2_) + + fvm::div(alphaRhoPhi, v2_) + - fvm::laplacian(alpha*rho*DkEff(), v2_) == - min(k_*f_, -alpha + C2_*G) - - fvm::Sp(N*epsilon_/k_, v2_) + alpha*rho*min(k_*f_, C2_*G - v2fAlpha) + - fvm::Sp(N*alpha*rho*epsilon_/k_, v2_) ); v2Eqn().relax(); @@ -362,7 +387,6 @@ void v2f::correct() // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace RASModels -} // End namespace incompressible } // End namespace Foam // ************************************************************************* // diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/v2f/v2f.H b/src/TurbulenceModels/turbulenceModels/RAS/v2f/v2f.H similarity index 81% rename from src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/v2f/v2f.H rename to src/TurbulenceModels/turbulenceModels/RAS/v2f/v2f.H index 631f548b49dd4f5a844b7cdc560d182aa9b5f405..9ce1dca85479200a04abac46b471f08661ee0c4e 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/RAS/v2f/v2f.H +++ b/src/TurbulenceModels/turbulenceModels/RAS/v2f/v2f.H @@ -22,14 +22,15 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::v2f + Foam::RASModels::v2f Group - grpIcoRASTurbulence + grpRASTurbulence Description - Lien and Kalitzin's v2-f turbulence model for incompressible flows, with - a limit imposed on the turbulent viscosity given by Davidson et al. + Lien and Kalitzin's v2-f turbulence model for incompressible and + compressible flows, with a limit imposed on the turbulent viscosity given + by Davidson et al. The model solves for turbulence kinetic energy k and turbulence dissipation rate epsilon, with additional equations for the turbulence stress normal to @@ -74,6 +75,7 @@ Description CL 0.23; Ceta 70; Ceps2 1.9; + Ceps3 -0.33; sigmaEps 1.3; sigmaK 1; } @@ -99,15 +101,13 @@ SourceFiles #ifndef v2f_H #define v2f_H -#include "turbulentTransportModel.H" +#include "RASModel.H" #include "eddyViscosity.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -namespace incompressible -{ namespace RASModels { @@ -115,9 +115,40 @@ namespace RASModels Class v2f Declaration \*---------------------------------------------------------------------------*/ +class v2fBase +{ +public: + + //- Runtime type information + TypeName("v2fBase"); + + + // Constructors + + v2fBase() + {} + + + //- Destructor + virtual ~v2fBase() + {} + + + // Member Functions + + //- Return turbulence stress normal to streamlines + virtual tmp<volScalarField> v2() const = 0; + + //- Return the damping function + virtual tmp<volScalarField> f() const = 0; +}; + + +template<class BasicTurbulenceModel> class v2f : - public eddyViscosity<incompressible::RASModel> + public eddyViscosity<RASModel<BasicTurbulenceModel> >, + public v2fBase { protected: @@ -133,6 +164,7 @@ protected: dimensionedScalar CL_; dimensionedScalar Ceta_; dimensionedScalar Ceps2_; + dimensionedScalar Ceps3_; dimensionedScalar sigmaK_; dimensionedScalar sigmaEps_; @@ -171,16 +203,22 @@ protected: public: + typedef typename BasicTurbulenceModel::alphaField alphaField; + typedef typename BasicTurbulenceModel::rhoField rhoField; + typedef typename BasicTurbulenceModel::transportModel transportModel; + + //- Runtime type information TypeName("v2f"); + // Constructors //- Construct from components v2f ( - const geometricOneField& alpha, - const geometricOneField& rho, + const alphaField& alpha, + const rhoField& rho, const volVectorField& U, const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& phi, @@ -205,7 +243,11 @@ public: { return tmp<volScalarField> ( - new volScalarField("DkEff", nut_/sigmaK_ + nu()) + new volScalarField + ( + "DkEff", + this->nut_/sigmaK_ + this->nu() + ) ); } @@ -214,7 +256,11 @@ public: { return tmp<volScalarField> ( - new volScalarField("DepsilonEff", nut_/sigmaEps_ + nu()) + new volScalarField + ( + "DepsilonEff", + this->nut_/sigmaEps_ + this->nu() + ) ); } @@ -250,11 +296,16 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace RASModels -} // End namespace incompressible } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository +# include "v2f.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C index 5ff91831f349f8683e04d7b50c362a70644ab1c7..c5c31269eb567b6b6c5a9835a0f7fed3ef37942d 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C @@ -37,6 +37,8 @@ namespace Foam namespace RASModels { + defineTypeNameAndDebug(v2fBase, 0); + // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // void fWallFunctionFvPatchScalarField::checkType() @@ -173,7 +175,7 @@ void fWallFunctionFvPatchScalarField::updateCoeffs() const label patchi = patch().index(); - const turbulenceModel& turbulence = db().lookupObject<turbulenceModel> + const turbulenceModel& turbModel = db().lookupObject<turbulenceModel> ( IOobject::groupName ( @@ -181,20 +183,20 @@ void fWallFunctionFvPatchScalarField::updateCoeffs() dimensionedInternalField().group() ) ); - const v2f& v2fModel = refCast<const v2f>(turbulence); + const v2fBase& v2fModel = refCast<const v2fBase>(turbModel); - const scalarField& y = v2fModel.y()[patchi]; + const scalarField& y = turbModel.y()[patchi]; - const tmp<volScalarField> tk = v2fModel.k(); + const tmp<volScalarField> tk = turbModel.k(); const volScalarField& k = tk(); - const tmp<volScalarField> tepsilon = v2fModel.epsilon(); + const tmp<volScalarField> tepsilon = turbModel.epsilon(); const volScalarField& epsilon = tepsilon(); const tmp<volScalarField> tv2 = v2fModel.v2(); const volScalarField& v2 = tv2(); - const tmp<scalarField> tnuw = turbulence.nu(patchi); + const tmp<scalarField> tnuw = turbModel.nu(patchi); const scalarField& nuw = tnuw(); const scalar Cmu25 = pow025(Cmu_); diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C index f6a16def4b9f30bb0902d590fd0e558c8a32811f..8749bc02a41f55d535b510ef0c6251e99012fc83 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C @@ -170,7 +170,7 @@ void kLowReWallFunctionFvPatchScalarField::updateCoeffs() const label patchi = patch().index(); - const turbulenceModel& turbulence = db().lookupObject<turbulenceModel> + const turbulenceModel& turbModel = db().lookupObject<turbulenceModel> ( IOobject::groupName ( @@ -178,12 +178,12 @@ void kLowReWallFunctionFvPatchScalarField::updateCoeffs() dimensionedInternalField().group() ) ); - const scalarField& y = turbulence.y()[patchi]; + const scalarField& y = turbModel.y()[patchi]; - const tmp<volScalarField> tk = turbulence.k(); + const tmp<volScalarField> tk = turbModel.k(); const volScalarField& k = tk(); - const tmp<scalarField> tnuw = turbulence.nu(patchi); + const tmp<scalarField> tnuw = turbModel.nu(patchi); const scalarField& nuw = tnuw(); const scalar Cmu25 = pow025(Cmu_); diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C index 174b2a2bc84f32bd4f1c9818dc672c4ec0911cd5..9392408888be779726a7fc2fedf690a4b791a5a5 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C @@ -40,7 +40,7 @@ tmp<scalarField> nutkAtmRoughWallFunctionFvPatchScalarField::calcNut() const { const label patchi = patch().index(); - const turbulenceModel& turbulence = db().lookupObject<turbulenceModel> + const turbulenceModel& turbModel = db().lookupObject<turbulenceModel> ( IOobject::groupName ( @@ -48,10 +48,10 @@ tmp<scalarField> nutkAtmRoughWallFunctionFvPatchScalarField::calcNut() const dimensionedInternalField().group() ) ); - const scalarField& y = turbulence.y()[patchi]; - const tmp<volScalarField> tk = turbulence.k(); + const scalarField& y = turbModel.y()[patchi]; + const tmp<volScalarField> tk = turbModel.k(); const volScalarField& k = tk(); - const tmp<scalarField> tnuw = turbulence.nu(patchi); + const tmp<scalarField> tnuw = turbModel.nu(patchi); const scalarField& nuw = tnuw(); const scalar Cmu25 = pow025(Cmu_); diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C index 05b659f0519c45952508dc64075738f23452bed8..da6130662a94652273444d4c6968ecfdb5b32f81 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C @@ -173,7 +173,7 @@ omegaWallFunctionFvPatchScalarField::omegaPatch(const label patchi) void omegaWallFunctionFvPatchScalarField::calculateTurbulenceFields ( - const turbulenceModel& turbulence, + const turbulenceModel& turbModel, scalarField& G0, scalarField& omega0 ) @@ -187,7 +187,7 @@ void omegaWallFunctionFvPatchScalarField::calculateTurbulenceFields const List<scalar>& w = cornerWeights_[patchi]; - opf.calculate(turbulence, w, opf.patch(), G0, omega0); + opf.calculate(turbModel, w, opf.patch(), G0, omega0); } } @@ -206,7 +206,7 @@ void omegaWallFunctionFvPatchScalarField::calculateTurbulenceFields void omegaWallFunctionFvPatchScalarField::calculate ( - const turbulenceModel& turbulence, + const turbulenceModel& turbModel, const List<scalar>& cornerWeights, const fvPatch& patch, scalarField& G, @@ -215,20 +215,20 @@ void omegaWallFunctionFvPatchScalarField::calculate { const label patchi = patch.index(); - const scalarField& y = turbulence.y()[patchi]; + const scalarField& y = turbModel.y()[patchi]; const scalar Cmu25 = pow025(Cmu_); - const tmp<volScalarField> tk = turbulence.k(); + const tmp<volScalarField> tk = turbModel.k(); const volScalarField& k = tk(); - const tmp<scalarField> tnuw = turbulence.nu(patchi); + const tmp<scalarField> tnuw = turbModel.nu(patchi); const scalarField& nuw = tnuw(); - const tmp<scalarField> tnutw = turbulence.nut(patchi); + const tmp<scalarField> tnutw = turbModel.nut(patchi); const scalarField& nutw = tnutw(); - const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchi]; + const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; const scalarField magGradUw(mag(Uw.snGrad())); @@ -413,7 +413,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs() return; } - const turbulenceModel& turbulence = db().lookupObject<turbulenceModel> + const turbulenceModel& turbModel = db().lookupObject<turbulenceModel> ( IOobject::groupName ( @@ -427,7 +427,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs() if (patch().index() == master_) { createAveragingWeights(); - calculateTurbulenceFields(turbulence, G(true), omega(true)); + calculateTurbulenceFields(turbModel, G(true), omega(true)); } const scalarField& G0 = this->G(); @@ -438,7 +438,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs() FieldType& G = const_cast<FieldType&> ( - db().lookupObject<FieldType>(turbulence.GName()) + db().lookupObject<FieldType>(turbModel.GName()) ); FieldType& omega = const_cast<FieldType&>(dimensionedInternalField()); @@ -465,7 +465,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs return; } - const turbulenceModel& turbulence = db().lookupObject<turbulenceModel> + const turbulenceModel& turbModel = db().lookupObject<turbulenceModel> ( IOobject::groupName ( @@ -479,7 +479,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs if (patch().index() == master_) { createAveragingWeights(); - calculateTurbulenceFields(turbulence, G(true), omega(true)); + calculateTurbulenceFields(turbModel, G(true), omega(true)); } const scalarField& G0 = this->G(); @@ -490,7 +490,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs FieldType& G = const_cast<FieldType&> ( - db().lookupObject<FieldType>(turbulence.GName()) + db().lookupObject<FieldType>(turbModel.GName()) ); FieldType& omega = const_cast<FieldType&>(dimensionedInternalField()); diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C index ce40a41ae691c1f6e9cae4139e2913cf3995bdd2..5351ea669a406c09d5081144a38aa4e2ccb01ddb 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C @@ -173,7 +173,7 @@ void v2WallFunctionFvPatchScalarField::updateCoeffs() const label patchi = patch().index(); - const turbulenceModel& turbulence = db().lookupObject<turbulenceModel> + const turbulenceModel& turbModel = db().lookupObject<turbulenceModel> ( IOobject::groupName ( @@ -181,12 +181,12 @@ void v2WallFunctionFvPatchScalarField::updateCoeffs() dimensionedInternalField().group() ) ); - const scalarField& y = turbulence.y()[patchi]; + const scalarField& y = turbModel.y()[patchi]; - const tmp<volScalarField> tk = turbulence.k(); + const tmp<volScalarField> tk = turbModel.k(); const volScalarField& k = tk(); - const tmp<scalarField> tnuw = turbulence.nu(patchi); + const tmp<scalarField> tnuw = turbModel.nu(patchi); const scalarField& nuw = tnuw(); const scalar Cmu25 = pow025(Cmu_);