ReynoldsStress.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2015-2016 OpenFOAM Foundation
9  Copyright (C) 2019-2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::ReynoldsStress
29 
30 Group
31  grpTurbulence
32 
33 Description
34  Reynolds-stress turbulence model base class
35 
36  Reference:
37  \verbatim
38  Realizability conditions (tag:S):
39  Schumann, U. (1977).
40  Realizability of Reynolds‐stress turbulence models.
41  The Physics of Fluids, 20(5), 721-725.
42  DOI:10.1063/1.861942
43  \endverbatim
44 
45 SourceFiles
46  ReynoldsStress.C
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef ReynoldsStress_H
51 #define ReynoldsStress_H
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 /*---------------------------------------------------------------------------*\
59  Class ReynoldsStress Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 template<class BasicTurbulenceModel>
63 class ReynoldsStress
64 :
65  public BasicTurbulenceModel
66 {
67 
68 protected:
69 
70  // Protected data
71 
72  // Model coefficients
73 
75 
76  // Fields
77 
80 
81 
82  // Protected Member Functions
83 
87 
88  //- Update the eddy-viscosity
89  virtual void correctNut() = 0;
90 
91  //- Return the source term for the momentum equation
92  template<class RhoFieldType>
94  (
95  const RhoFieldType& rho,
97  ) const;
98 
99 
100 public:
102  typedef typename BasicTurbulenceModel::alphaField alphaField;
103  typedef typename BasicTurbulenceModel::rhoField rhoField;
104  typedef typename BasicTurbulenceModel::transportModel transportModel;
105 
106 
107  // Constructors
108 
109  //- Construct from components
111  (
112  const word& modelName,
113  const alphaField& alpha,
114  const rhoField& rho,
115  const volVectorField& U,
116  const surfaceScalarField& alphaRhoPhi,
117  const surfaceScalarField& phi,
118  const transportModel& transport,
119  const word& propertiesName
120  );
121 
122 
123  //- Destructor
124  virtual ~ReynoldsStress() = default;
125 
126 
127  // Member Functions
128 
129  //- Re-read model coefficients if they have changed
130  virtual bool read() = 0;
131 
132  //- Return the turbulence viscosity
133  virtual tmp<volScalarField> nut() const
134  {
135  return nut_;
136  }
137 
138  //- Return the turbulence viscosity on patch
139  virtual tmp<scalarField> nut(const label patchi) const
140  {
141  return nut_.boundaryField()[patchi];
142  }
143 
144  //- Return the turbulence kinetic energy
145  virtual tmp<volScalarField> k() const;
146 
147  //- Return the Reynolds stress tensor
148  virtual tmp<volSymmTensorField> R() const;
149 
150  //- Return the effective stress tensor
151  virtual tmp<volSymmTensorField> devRhoReff() const;
152 
153  //- Return the effective stress tensor based on a given velocity field
155  (
156  const volVectorField& U
157  ) const;
158 
159  //- Return the source term for the momentum equation
161 
162  //- Return the source term for the momentum equation
164  (
165  const volScalarField& rho,
167  ) const;
168 
169  //- Validate the turbulence fields after construction
170  // Update turbulence viscosity and other derived fields as requires
171  virtual void validate();
172 
173  //- Solve the turbulence equations and correct the turbulence viscosity
174  virtual void correct() = 0;
175 };
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 } // End namespace Foam
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #ifdef NoRepository
185  #include "ReynoldsStress.C"
186 #endif
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 #endif
191 
192 // ************************************************************************* //
void correctWallShearStress(volSymmTensorField &R) const
BasicTurbulenceModel::alphaField alphaField
virtual void correctNut()=0
Update the eddy-viscosity.
tmp< fvVectorMatrix > DivDevRhoReff(const RhoFieldType &rho, volVectorField &U) const
Return the source term for the momentum equation.
virtual ~ReynoldsStress()=default
Destructor.
BasicTurbulenceModel::rhoField rhoField
Definition: RASModel.H:143
virtual void correct()=0
Solve the turbulence equations and correct the turbulence viscosity.
virtual tmp< volSymmTensorField > R() const
Return the Reynolds stress tensor.
virtual tmp< fvVectorMatrix > divDevRhoReff(volVectorField &U) const
Return the source term for the momentum equation.
BasicTurbulenceModel::transportModel transportModel
Definition: RASModel.H:144
BasicTurbulenceModel::transportModel transportModel
void checkRealizabilityConditions(const volSymmTensorField &R) const
virtual bool read()=0
Re-read model coefficients if they have changed.
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual tmp< volSymmTensorField > devRhoReff() const
Return the effective stress tensor.
BasicTurbulenceModel::rhoField rhoField
virtual void validate()
Validate the turbulence fields after construction.
dimensionedScalar couplingFactor_
volScalarField nut_
virtual tmp< volScalarField > nut() const
Return the turbulence viscosity.
void boundNormalStress(volSymmTensorField &R) const
ReynoldsStress(const word &modelName, const alphaField &alpha, const rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const transportModel &transport, const word &propertiesName)
Construct from components.
U
Definition: pEqn.H:72
virtual tmp< volScalarField > k() const
Return the turbulence kinetic energy.
volSymmTensorField R_
A class for managing temporary objects.
Definition: HashPtrTable.H:50
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
Namespace for OpenFOAM.
BasicTurbulenceModel::alphaField alphaField
Definition: RASModel.H:142
Reynolds-stress turbulence model base class.