SmagorinskyZhang.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "SmagorinskyZhang.H"
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 namespace LESModels
33 {
34 
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 
37 template<class BasicTurbulenceModel>
39 (
40  const alphaField& alpha,
41  const rhoField& rho,
42  const volVectorField& U,
43  const surfaceScalarField& alphaRhoPhi,
44  const surfaceScalarField& phi,
45  const transportModel& transport,
46  const word& propertiesName,
47  const word& type
48 )
49 :
51  (
52  alpha,
53  rho,
54  U,
55  alphaRhoPhi,
56  phi,
57  transport,
58  propertiesName,
59  type
60  ),
61 
62  gasTurbulencePtr_(NULL),
63 
64  Cmub_
65  (
67  (
68  "Cmub",
69  this->coeffDict_,
70  0.6
71  )
72  )
73 {
74  if (type == typeName)
75  {
76  this->printCoeffs(type);
77  }
78 }
79 
80 
81 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
82 
83 template<class BasicTurbulenceModel>
85 {
87  {
88  Cmub_.readIfPresent(this->coeffDict());
89 
90  return true;
91  }
92  else
93  {
94  return false;
95  }
96 }
97 
98 
99 template<class BasicTurbulenceModel>
101 <
102  typename BasicTurbulenceModel::transportModel
103 >&
105 {
106  if (!gasTurbulencePtr_)
107  {
108  const volVectorField& U = this->U_;
109 
110  const transportModel& liquid = this->transport();
111  const twoPhaseSystem& fluid =
112  refCast<const twoPhaseSystem>(liquid.fluid());
113  const transportModel& gas = fluid.otherPhase(liquid);
114 
115  gasTurbulencePtr_ =
116  &U.db()
118  (
120  (
122  gas.name()
123  )
124  );
125  }
126 
127  return *gasTurbulencePtr_;
128 }
129 
130 
131 template<class BasicTurbulenceModel>
133 {
135  this->gasTurbulence();
136 
137  volScalarField k(this->k(fvc::grad(this->U_)));
138 
139  this->nut_ =
140  this->Ck_*sqrt(k)*this->delta()
141  + Cmub_*gasTurbulence.transport().d()*gasTurbulence.alpha()
142  *(mag(this->U_ - gasTurbulence.U()));
143 
144  this->nut_.correctBoundaryConditions();
145 }
146 
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 } // End namespace LESModels
151 } // End namespace Foam
152 
153 // ************************************************************************* //
Foam::IOobject::groupName
static word groupName(Name name, const word &group)
Foam::fvc::grad
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcGrad.C:52
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::twoPhaseSystem
Class which solves the volume fraction equations for two phases.
Definition: twoPhaseSystem.H:51
Foam::LESModels::SmagorinskyZhang::rhoField
BasicTurbulenceModel::rhoField rhoField
Definition: SmagorinskyZhang.H:116
Foam::PhaseCompressibleTurbulenceModel
Templated abstract base class for multiphase compressible turbulence models.
Definition: PhaseCompressibleTurbulenceModel.H:51
fluid
multiphaseSystem & fluid
Definition: createFields.H:10
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:216
Foam::LESModels::SmagorinskyZhang::SmagorinskyZhang
SmagorinskyZhang(const SmagorinskyZhang &)
Foam::turbulenceModel::propertiesName
static const word propertiesName
Default name of the turbulence properties dictionary.
Definition: turbulenceModel.H:97
Foam::LESModels::SmagorinskyZhang::alphaField
BasicTurbulenceModel::alphaField alphaField
Definition: SmagorinskyZhang.H:115
Foam::TurbulenceModel< volScalarField, volScalarField, compressibleTurbulenceModel, TransportModel >::alpha
const alphaField & alpha() const
Access function to phase fraction.
Definition: TurbulenceModel.H:148
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
U
U
Definition: pEqn.H:46
delta
scalar delta
Definition: LISASMDCalcMethod2.H:8
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:41
SmagorinskyZhang.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::LESModels::SmagorinskyZhang::read
virtual bool read()
Read model coefficients if they have changed.
Definition: SmagorinskyZhang.C:84
Foam::TurbulenceModel< volScalarField, volScalarField, compressibleTurbulenceModel, TransportModel >::transport
const transportModel & transport() const
Access function to incompressible transport model.
Definition: TurbulenceModel.H:154
rho
rho
Definition: pEqn.H:3
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:142
k
label k
Boltzmann constant.
Definition: LISASMDCalcMethod2.H:41
Foam::LESModels::Smagorinsky
The Smagorinsky SGS model.
Definition: Smagorinsky.H:89
Foam::type
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:588
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::LESModels::SmagorinskyZhang::transportModel
BasicTurbulenceModel::transportModel transportModel
Definition: SmagorinskyZhang.H:117
Foam::turbulenceModel::U
const volVectorField & U() const
Access function to velocity field.
Definition: turbulenceModel.H:142
Foam::LESModels::SmagorinskyZhang::gasTurbulence
const PhaseCompressibleTurbulenceModel< typename BasicTurbulenceModel::transportModel > & gasTurbulence() const
Return the turbulence model for the gas phase.
Definition: SmagorinskyZhang.C:104
Foam::LESModels::SmagorinskyZhang::correctNut
virtual void correctNut()
Update the SGS eddy viscosity.
Definition: SmagorinskyZhang.C:132