ReynoldsStress.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2015-2021 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 Class
25  Foam::ReynoldsStress
26 
27 Description
28  Reynolds-stress turbulence model base class
29 
30 SourceFiles
31  ReynoldsStress.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef ReynoldsStress_H
36 #define ReynoldsStress_H
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace Foam
41 {
42 
43 /*---------------------------------------------------------------------------*\
44  Class ReynoldsStress Declaration
45 \*---------------------------------------------------------------------------*/
46 
47 template<class BasicMomentumTransportModel>
48 class ReynoldsStress
49 :
50  public BasicMomentumTransportModel
51 {
52 
53 protected:
54 
55  // Protected data
56 
57  // Model coefficients
58 
60 
61  // Fields
62 
65 
66 
67  // Protected Member Functions
68 
71 
72  //- Update the eddy-viscosity
73  virtual void correctNut() = 0;
74 
75  //- Source term for the R equation
76  virtual tmp<fvSymmTensorMatrix> RSource() const;
77 
78  //- Return the source term for the momentum equation
79  template<class RhoFieldType>
81  (
82  const RhoFieldType& rho,
84  ) const;
85 
86 
87 public:
88 
89  typedef typename BasicMomentumTransportModel::alphaField alphaField;
90  typedef typename BasicMomentumTransportModel::rhoField rhoField;
91  typedef typename BasicMomentumTransportModel::transportModel transportModel;
92 
93 
94  // Constructors
95 
96  //- Construct from components
98  (
99  const word& modelName,
100  const alphaField& alpha,
101  const rhoField& rho,
102  const volVectorField& U,
103  const surfaceScalarField& alphaRhoPhi,
104  const surfaceScalarField& phi,
105  const transportModel& transport
106  );
107 
108 
109  //- Destructor
110  virtual ~ReynoldsStress()
111  {}
112 
113 
114  // Member Functions
115 
116  //- Re-read model coefficients if they have changed
117  virtual bool read() = 0;
118 
119  //- Return the turbulence viscosity
120  virtual tmp<volScalarField> nut() const
121  {
122  return nut_;
123  }
124 
125  //- Return the turbulence viscosity on patch
126  virtual tmp<scalarField> nut(const label patchi) const
127  {
128  return nut_.boundaryField()[patchi];
129  }
130 
131  //- Return the turbulence kinetic energy
132  virtual tmp<volScalarField> k() const;
133 
134  //- Return the Reynolds stress tensor [m^2/s^2]
135  virtual tmp<volSymmTensorField> sigma() const;
136 
137  //- Return the effective stress tensor
138  virtual tmp<volSymmTensorField> devTau() const;
139 
140  //- Return the source term for the momentum equation
142 
143  //- Return the source term for the momentum equation
145  (
146  const volScalarField& rho,
147  volVectorField& U
148  ) const;
149 
150  //- Validate the turbulence fields after construction
151  // Update turbulence viscosity and other derived fields as requires
152  virtual void validate();
153 
154  //- Solve the turbulence equations and correct the turbulence viscosity
155  virtual void correct() = 0;
156 };
157 
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 } // End namespace Foam
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #ifdef NoRepository
166  #include "ReynoldsStress.C"
167 #endif
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 #endif
172 
173 // ************************************************************************* //
void correctWallShearStress(volSymmTensorField &R) const
virtual tmp< fvVectorMatrix > divDevTau(volVectorField &U) const
Return the source term for the momentum equation.
ReynoldsStress(const word &modelName, const alphaField &alpha, const rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const transportModel &transport)
Construct from components.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
virtual tmp< volSymmTensorField > sigma() const
Return the Reynolds stress tensor [m^2/s^2].
BasicMomentumTransportModel::rhoField rhoField
BasicMomentumTransportModel::alphaField alphaField
virtual tmp< fvSymmTensorMatrix > RSource() const
Source term for the R equation.
virtual void correctNut()=0
Update the eddy-viscosity.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
tmp< fvVectorMatrix > DivDevRhoReff(const RhoFieldType &rho, volVectorField &U) const
Return the source term for the momentum equation.
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
virtual void correct()=0
Solve the turbulence equations and correct the turbulence viscosity.
virtual bool read()=0
Re-read model coefficients if they have changed.
BasicMomentumTransportModel::transportModel transportModel
A class for handling words, derived from string.
Definition: word.H:59
phi
Definition: correctPhi.H:3
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
virtual ~ReynoldsStress()
Destructor.
label patchi
U
Definition: pEqn.H:72
#define R(A, B, C, D, E, F, K, M)
virtual tmp< volSymmTensorField > devTau() const
Return the effective stress tensor.
virtual tmp< volScalarField > k() const
Return the turbulence kinetic energy.
volSymmTensorField R_
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.
Reynolds-stress turbulence model base class.