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-2020 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  //- Return the source term for the momentum equation
76  template<class RhoFieldType>
78  (
79  const RhoFieldType& rho,
81  ) const;
82 
83 
84 public:
85 
86  typedef typename BasicMomentumTransportModel::alphaField alphaField;
87  typedef typename BasicMomentumTransportModel::rhoField rhoField;
88  typedef typename BasicMomentumTransportModel::transportModel transportModel;
89 
90 
91  // Constructors
92 
93  //- Construct from components
95  (
96  const word& modelName,
97  const alphaField& alpha,
98  const rhoField& rho,
99  const volVectorField& U,
100  const surfaceScalarField& alphaRhoPhi,
101  const surfaceScalarField& phi,
102  const transportModel& transport
103  );
104 
105 
106  //- Destructor
107  virtual ~ReynoldsStress()
108  {}
109 
110 
111  // Member Functions
112 
113  //- Re-read model coefficients if they have changed
114  virtual bool read() = 0;
115 
116  //- Return the turbulence viscosity
117  virtual tmp<volScalarField> nut() const
118  {
119  return nut_;
120  }
121 
122  //- Return the turbulence viscosity on patch
123  virtual tmp<scalarField> nut(const label patchi) const
124  {
125  return nut_.boundaryField()[patchi];
126  }
127 
128  //- Return the turbulence kinetic energy
129  virtual tmp<volScalarField> k() const;
130 
131  //- Return the Reynolds stress tensor [m^2/s^2]
132  virtual tmp<volSymmTensorField> sigma() const;
133 
134  //- Return the effective stress tensor
135  virtual tmp<volSymmTensorField> devTau() const;
136 
137  //- Return the source term for the momentum equation
139 
140  //- Return the source term for the momentum equation
142  (
143  const volScalarField& rho,
144  volVectorField& U
145  ) const;
146 
147  //- Validate the turbulence fields after construction
148  // Update turbulence viscosity and other derived fields as requires
149  virtual void validate();
150 
151  //- Solve the turbulence equations and correct the turbulence viscosity
152  virtual void correct() = 0;
153 };
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #ifdef NoRepository
163  #include "ReynoldsStress.C"
164 #endif
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 #endif
169 
170 // ************************************************************************* //
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 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.
virtual void correct()=0
Solve the turbulence equations and correct the turbulence viscosity.
phi
Definition: pEqn.H:104
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
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_
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.
Reynolds-stress turbulence model base class.