diff --git a/src/turbulenceModels/RAS/incompressible/Make/files b/src/turbulenceModels/RAS/incompressible/Make/files index c7746e7fd2..6584fc6113 100644 --- a/src/turbulenceModels/RAS/incompressible/Make/files +++ b/src/turbulenceModels/RAS/incompressible/Make/files @@ -5,6 +5,7 @@ laminar/laminar.C kEpsilon/kEpsilon.C RNGkEpsilon/RNGkEpsilon.C realizableKE/realizableKE.C +kOmega/kOmega.C kOmegaSST/kOmegaSST.C SpalartAllmaras/SpalartAllmaras.C LRR/LRR.C diff --git a/src/turbulenceModels/RAS/incompressible/kOmega/kOmega.C b/src/turbulenceModels/RAS/incompressible/kOmega/kOmega.C new file mode 100644 index 0000000000..889f38961c --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/kOmega/kOmega.C @@ -0,0 +1,268 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "kOmega.H" +#include "addToRunTimeSelectionTable.H" +#include "wallFvPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(kOmega, 0); +addToRunTimeSelectionTable(RASModel, kOmega, dictionary); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +kOmega::kOmega +( + const volVectorField& U, + const surfaceScalarField& phi, + transportModel& lamTransportModel +) +: + RASModel(typeName, U, phi, lamTransportModel), + + Cmu_ + ( + dimensioned::lookupOrAddToDict + ( + "betaStar", + coeffDict_, + 0.09 + ) + ), + beta_ + ( + dimensioned::lookupOrAddToDict + ( + "beta", + coeffDict_, + 0.072 + ) + ), + alphaK_ + ( + dimensioned::lookupOrAddToDict + ( + "alphaK", + coeffDict_, + 0.5 + ) + ), + alphaOmega_ + ( + dimensioned::lookupOrAddToDict + ( + "alphaOmega", + coeffDict_, + 0.5 + ) + ), + + omega0_("omega0", dimless/dimTime, SMALL), + omegaSmall_("omegaSmall", dimless/dimTime, SMALL), + + k_ + ( + IOobject + ( + "k", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + + omega_ + ( + IOobject + ( + "omega", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + + nut_(k_/(omega_ + omegaSmall_)) +{ +# include "kOmegaWallViscosityI.H" + + printCoeffs(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +tmp kOmega::R() const +{ + return tmp + ( + new volSymmTensorField + ( + IOobject + ( + "R", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)), + k_.boundaryField().types() + ) + ); +} + + +tmp kOmega::devReff() const +{ + return tmp + ( + new volSymmTensorField + ( + IOobject + ( + "devRhoReff", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + -nuEff()*dev(twoSymm(fvc::grad(U_))) + ) + ); +} + + +tmp kOmega::divDevReff(volVectorField& U) const +{ + return + ( + - fvm::laplacian(nuEff(), U) + - fvc::div(nuEff()*dev(fvc::grad(U)().T())) + ); +} + + +bool kOmega::read() +{ + if (RASModel::read()) + { + Cmu_.readIfPresent(coeffDict_); + beta_.readIfPresent(coeffDict_); + alphaK_.readIfPresent(coeffDict_); + alphaOmega_.readIfPresent(coeffDict_); + + return true; + } + else + { + return false; + } +} + + +void kOmega::correct() +{ + transportModel_.correct(); + + if (!turbulence_) + { + return; + } + + RASModel::correct(); + + volScalarField G = nut_*2*magSqr(symm(fvc::grad(U_))); + +# include "kOmegaWallFunctionsI.H" + + // Turbulence specific dissipation rate equation + tmp omegaEqn + ( + fvm::ddt(omega_) + + fvm::div(phi_, omega_) + - fvm::Sp(fvc::div(phi_), omega_) + - fvm::laplacian(DomegaEff(), omega_) + == + G*omega_/k_ + - fvm::Sp(beta_*omega_, omega_) + ); + + omegaEqn().relax(); + +# include "wallOmegaI.H" + + solve(omegaEqn); + bound(omega_, omega0_); + + + // Turbulent kinetic energy equation + tmp kEqn + ( + fvm::ddt(k_) + + fvm::div(phi_, k_) + - fvm::Sp(fvc::div(phi_), k_) + - fvm::laplacian(DkEff(), k_) + == + G + - fvm::Sp(Cmu_*omega_, k_) + ); + + kEqn().relax(); + solve(kEqn); + bound(k_, k0_); + + + // Re-calculate viscosity + nut_ = k_/omega_; + +# include "kOmegaWallViscosityI.H" + +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/kOmega/kOmega.H b/src/turbulenceModels/RAS/incompressible/kOmega/kOmega.H new file mode 100644 index 0000000000..a524f64e40 --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/kOmega/kOmega.H @@ -0,0 +1,205 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::incompressible::RASModels::kOmega + +Description + Standard high Reynolds-number k-omega turbulence model for + incompressible flows. + + References: + @verbatim + "Turbulence Modeling for CFD" + D. C. Wilcox, + DCW Industries, Inc., La Canada, + California, 1998. + @endverbatim + + The default model coefficients correspond to the following: + @verbatim + kOmegaCoeffs + { + Cmu 0.09; // Equivalent to betaStar + beta 0.072; + alphak 0.5; + alphaOmega 0.5; + } + @endverbatim + +SourceFiles + kOmega.C + +\*---------------------------------------------------------------------------*/ + +#ifndef kOmega_H +#define kOmega_H + +#include "RASModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class kOmega Declaration +\*---------------------------------------------------------------------------*/ + +class kOmega +: + public RASModel +{ + // Private data + + // Model coefficients + + dimensionedScalar Cmu_; + dimensionedScalar beta_; + dimensionedScalar alphaK_; + dimensionedScalar alphaOmega_; + + + dimensionedScalar omega0_; + dimensionedScalar omegaSmall_; + + + // Fields + + volScalarField k_; + volScalarField omega_; + volScalarField nut_; + + +public: + + //- Runtime type information + TypeName("kOmega"); + + // Constructors + + //- Construct from components + kOmega + ( + const volVectorField& U, + const surfaceScalarField& phi, + transportModel& transport + ); + + + // Destructor + + ~kOmega() + {} + + + // Member Functions + + //- Return the turbulence viscosity + tmp nut() const + { + return nut_; + } + + //- Return the effective diffusivity for k + tmp DkEff() const + { + return tmp + ( + new volScalarField("DkEff", alphaK_*nut_ + nu()) + ); + } + + //- Return the effective diffusivity for omega + tmp DomegaEff() const + { + return tmp + ( + new volScalarField("DomegaEff", alphaOmega_*nut_ + nu()) + ); + } + + //- Return the turbulence kinetic energy + tmp k() const + { + return k_; + } + + //- Return the turbulence specific dissipation rate + tmp omega() const + { + return omega_; + } + + //- Return the turbulence kinetic energy dissipation rate + tmp epsilon() const + { + return tmp + ( + new volScalarField + ( + IOobject + ( + "epsilon", + mesh_.time().timeName(), + mesh_ + ), + Cmu_*k_*omega_, + omega_.boundaryField().types() + ) + ); + } + + //- Return the Reynolds stress tensor + tmp R() const; + + //- Return the effective stress tensor including the laminar stress + tmp devReff() const; + + //- Return the source term for the momentum equation + tmp divDevReff(volVectorField& U) const; + + //- Solve the turbulence equations and correct the turbulence viscosity + void correct(); + + //- Read turbulenceProperties dictionary + bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/kOmega/kOmegaWallFunctionsI.H b/src/turbulenceModels/RAS/incompressible/kOmega/kOmegaWallFunctionsI.H new file mode 100644 index 0000000000..aca757443e --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/kOmega/kOmegaWallFunctionsI.H @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Global + kOmegaWallFunctions + +Description + Calculate wall generation and frequency omega from wall-functions. + +\*---------------------------------------------------------------------------*/ + +{ + labelList cellBoundaryFaceCount(omega_.size(), 0); + + scalar Cmu25 = pow(Cmu_.value(), 0.25); + + const fvPatchList& patches = mesh_.boundary(); + + //- Initialise the near-wall omega and G fields to zero + forAll(patches, patchi) + { + const fvPatch& curPatch = patches[patchi]; + + if (isType(curPatch)) + { + forAll(curPatch, facei) + { + label faceCelli = curPatch.faceCells()[facei]; + + omega_[faceCelli] = 0.0; + G[faceCelli] = 0.0; + } + } + } + + //- Accumulate the wall face contributions to omega and G + // Increment cellBoundaryFaceCount for each face for averaging + forAll(patches, patchi) + { + const fvPatch& curPatch = patches[patchi]; + + if (isType(curPatch)) + { +# include "checkkOmegaPatchFieldTypes.H" + + const scalarField& nuw = nu().boundaryField()[patchi]; + const scalarField& nutw = nut_.boundaryField()[patchi]; + + scalarField magFaceGradU = + mag(U_.boundaryField()[patchi].snGrad()); + + forAll(curPatch, facei) + { + label faceCelli = curPatch.faceCells()[facei]; + + scalar yPlus = + Cmu25*y_[patchi][facei] + *sqrt(k_[faceCelli]) + /nuw[facei]; + + // For corner cells (with two boundary or more faces), + // omega and G in the near-wall cell are calculated + // as an average + + cellBoundaryFaceCount[faceCelli]++; + + omega_[faceCelli] += + sqrt(k_[faceCelli]) + /(Cmu25*kappa_.value()*y_[patchi][facei]); + + if (yPlus > yPlusLam_) + { + G[faceCelli] += + (nutw[facei] + nuw[facei]) + *magFaceGradU[facei] + *Cmu25*sqrt(k_[faceCelli]) + /(kappa_.value()*y_[patchi][facei]); + } + } + } + } + + + // Perform the averaging + + forAll(patches, patchi) + { + const fvPatch& curPatch = patches[patchi]; + + if (isType(curPatch)) + { + forAll(curPatch, facei) + { + label faceCelli = curPatch.faceCells()[facei]; + + omega_[faceCelli] /= cellBoundaryFaceCount[faceCelli]; + G[faceCelli] /= cellBoundaryFaceCount[faceCelli]; + } + } + } +} + + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/kOmega/kOmegaWallViscosityI.H b/src/turbulenceModels/RAS/incompressible/kOmega/kOmegaWallViscosityI.H new file mode 100644 index 0000000000..0f0571c93c --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/kOmega/kOmegaWallViscosityI.H @@ -0,0 +1,70 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Global + kOmegaWallViscosity + +Description + Calculate wall viscosity from wall-functions. + +\*---------------------------------------------------------------------------*/ + +{ + scalar Cmu25 = pow(Cmu_.value(), 0.25); + + const fvPatchList& patches = mesh_.boundary(); + + forAll(patches, patchi) + { + const fvPatch& curPatch = patches[patchi]; + + if (isType(curPatch)) + { + const scalarField& nuw = nu().boundaryField()[patchi]; + scalarField& nutw = nut_.boundaryField()[patchi]; + + forAll(curPatch, facei) + { + label faceCelli = curPatch.faceCells()[facei]; + + scalar yPlus = + Cmu25*y_[patchi][facei]*sqrt(k_[faceCelli])/nuw[facei]; + + if (yPlus > yPlusLam_) + { + nutw[facei] = + nuw[facei] + *(yPlus*kappa_.value()/log(E_.value()*yPlus) - 1); + } + else + { + nutw[facei] = 0.0; + } + } + } + } +} + + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/kOmega/wallOmegaI.H b/src/turbulenceModels/RAS/incompressible/kOmega/wallOmegaI.H new file mode 100644 index 0000000000..eb1b3c5919 --- /dev/null +++ b/src/turbulenceModels/RAS/incompressible/kOmega/wallOmegaI.H @@ -0,0 +1,51 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Global + wallOmega + +Description + Set wall dissipation in the omega matrix + +\*---------------------------------------------------------------------------*/ + +{ + const fvPatchList& patches = mesh_.boundary(); + + forAll(patches, patchi) + { + const fvPatch& p = patches[patchi]; + + if (isType(p)) + { + omegaEqn().setValues + ( + p.faceCells(), + omega_.boundaryField()[patchi].patchInternalField() + ); + } + } +} + +// ************************************************************************* // diff --git a/src/turbulenceModels/RAS/incompressible/kOmegaSST/kOmegaSST.H b/src/turbulenceModels/RAS/incompressible/kOmegaSST/kOmegaSST.H index ef44b6a9ac..5564d84555 100644 --- a/src/turbulenceModels/RAS/incompressible/kOmegaSST/kOmegaSST.H +++ b/src/turbulenceModels/RAS/incompressible/kOmegaSST/kOmegaSST.H @@ -238,6 +238,7 @@ public: return k_; } + //- Return the turbulence specific dissipation rate tmp omega() const { return omega_;