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-2024 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  // Private member functions
53 
54  //- Return the source term for the momentum equation
55  template<class RhoFieldType>
56  tmp<fvVectorMatrix> DivDevTau
57  (
58  const RhoFieldType& rho,
60  ) const;
61 
62 
63 protected:
64 
65  // Protected data
66 
67  // Model coefficients
68 
70 
71  // Fields
72 
75 
76 
77  // Protected Member Functions
78 
81 
82  //- Update the eddy-viscosity
83  virtual void correctNut() = 0;
84 
85  //- Source term for the R equation
86  virtual tmp<fvSymmTensorMatrix> RSource() const;
87 
88  //- Return the effective Reynolds stress flux
90 
91 
92 public:
93 
94  typedef typename BasicMomentumTransportModel::alphaField alphaField;
95  typedef typename BasicMomentumTransportModel::rhoField rhoField;
96 
97 
98  // Constructors
99 
100  //- Construct from components
102  (
103  const word& modelName,
104  const alphaField& alpha,
105  const rhoField& rho,
106  const volVectorField& U,
107  const surfaceScalarField& alphaRhoPhi,
108  const surfaceScalarField& phi,
109  const viscosity& viscosity
110  );
111 
112 
113  //- Destructor
114  virtual ~ReynoldsStress()
115  {}
116 
117 
118  // Member Functions
119 
120  //- Re-read model coefficients if they have changed
121  virtual bool read() = 0;
122 
123  //- Return the turbulence viscosity
124  virtual tmp<volScalarField> nut() const
125  {
126  return nut_;
127  }
128 
129  //- Return the turbulence viscosity on patch
130  virtual tmp<scalarField> nut(const label patchi) const
131  {
132  return nut_.boundaryField()[patchi];
133  }
134 
135  //- Return the turbulence kinetic energy
136  virtual tmp<volScalarField> k() const;
137 
138  //- Return the Reynolds stress tensor [m^2/s^2]
139  virtual tmp<volSymmTensorField> R() const;
140 
141  //- Return the effective surface stress
142  virtual tmp<surfaceVectorField> devTau() const;
143 
144  //- Return the source term for the momentum equation
146 
147  //- Return the source term for the momentum equation
149  (
150  const volScalarField& rho,
152  ) const;
153 
154  //- Validate the turbulence fields after construction
155  // Update turbulence viscosity and other derived fields as requires
156  virtual void validate();
157 
158  //- Solve the turbulence equations and correct the turbulence viscosity
159  virtual void correct() = 0;
160 };
161 
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 } // End namespace Foam
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 #ifdef NoRepository
170  #include "ReynoldsStress.C"
171 #endif
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #endif
176 
177 // ************************************************************************* //
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Reynolds-stress turbulence model base class.
BasicMomentumTransportModel::alphaField alphaField
virtual tmp< volSymmTensorField > R() const
Return the Reynolds stress tensor [m^2/s^2].
void boundNormalStress(volSymmTensorField &R) const
virtual tmp< volScalarField > nut() const
Return the turbulence viscosity.
virtual ~ReynoldsStress()
Destructor.
virtual tmp< surfaceVectorField > devTau() const
Return the effective surface stress.
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 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.
tmp< surfaceVectorField > Refff(const volVectorField &U) const
Return the effective Reynolds stress flux.
virtual tmp< fvVectorMatrix > divDevTau(volVectorField &U) const
Return the source term for the momentum equation.
volSymmTensorField R_
virtual tmp< fvSymmTensorMatrix > RSource() const
Source term for the R equation.
dimensionedScalar couplingFactor_
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