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 
92 
93  // Constructors
94 
95  //- Construct from components
97  (
98  const word& modelName,
99  const alphaField& alpha,
100  const rhoField& rho,
101  const volVectorField& U,
102  const surfaceScalarField& alphaRhoPhi,
103  const surfaceScalarField& phi,
104  const viscosity& viscosity
105  );
106 
107 
108  //- Destructor
109  virtual ~ReynoldsStress()
110  {}
111 
112 
113  // Member Functions
114 
115  //- Re-read model coefficients if they have changed
116  virtual bool read() = 0;
117 
118  //- Return the turbulence viscosity
119  virtual tmp<volScalarField> nut() const
120  {
121  return nut_;
122  }
123 
124  //- Return the turbulence viscosity on patch
125  virtual tmp<scalarField> nut(const label patchi) const
126  {
127  return nut_.boundaryField()[patchi];
128  }
129 
130  //- Return the turbulence kinetic energy
131  virtual tmp<volScalarField> k() const;
132 
133  //- Return the Reynolds stress tensor [m^2/s^2]
134  virtual tmp<volSymmTensorField> sigma() const;
135 
136  //- Return the effective stress tensor
137  virtual tmp<volSymmTensorField> devTau() const;
138 
139  //- Return the source term for the momentum equation
141 
142  //- Return the source term for the momentum equation
144  (
145  const volScalarField& rho,
147  ) const;
148 
149  //- Validate the turbulence fields after construction
150  // Update turbulence viscosity and other derived fields as requires
151  virtual void validate();
152 
153  //- Solve the turbulence equations and correct the turbulence viscosity
154  virtual void correct() = 0;
155 };
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace Foam
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #ifdef NoRepository
165  #include "ReynoldsStress.C"
166 #endif
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #endif
171 
172 // ************************************************************************* //
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Reynolds-stress turbulence model base class.
BasicMomentumTransportModel::alphaField alphaField
void boundNormalStress(volSymmTensorField &R) const
virtual tmp< volScalarField > nut() const
Return the turbulence viscosity.
virtual ~ReynoldsStress()
Destructor.
virtual tmp< volScalarField > k() const
Return the turbulence kinetic energy.
virtual void validate()
Validate the turbulence fields after construction.
volScalarField nut_
ReynoldsStress(const word &modelName, const alphaField &alpha, const rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const viscosity &viscosity)
Construct from components.
virtual tmp< volSymmTensorField > devTau() const
Return the effective stress tensor.
virtual bool read()=0
Re-read model coefficients if they have changed.
virtual void correctNut()=0
Update the eddy-viscosity.
virtual void correct()=0
Solve the turbulence equations and correct the turbulence viscosity.
virtual tmp< fvVectorMatrix > divDevTau(volVectorField &U) const
Return the source term for the momentum equation.
virtual tmp< volSymmTensorField > sigma() const
Return the Reynolds stress tensor [m^2/s^2].
volSymmTensorField R_
virtual tmp< fvSymmTensorMatrix > RSource() const
Source term for the R equation.
dimensionedScalar couplingFactor_
tmp< fvVectorMatrix > DivDevRhoReff(const RhoFieldType &rho, volVectorField &U) const
Return the source term for the momentum equation.
void correctWallShearStress(volSymmTensorField &R) const
BasicMomentumTransportModel::rhoField rhoField
A class for managing temporary objects.
Definition: tmp.H:55
Abstract base class for all fluid physical properties.
Definition: viscosity.H:50
A class for handling words, derived from string.
Definition: word.H:62
label patchi
U
Definition: pEqn.H:72
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
Namespace for OpenFOAM.
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
static scalar R(const scalar a, const scalar x)
Definition: invIncGamma.C:102