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-2018 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 BasicTurbulenceModel>
48 class ReynoldsStress
49 :
50  public BasicTurbulenceModel
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 BasicTurbulenceModel::alphaField alphaField;
87  typedef typename BasicTurbulenceModel::rhoField rhoField;
88  typedef typename BasicTurbulenceModel::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  const word& propertiesName
104  );
105 
106 
107  //- Destructor
108  virtual ~ReynoldsStress()
109  {}
110 
111 
112  // Member Functions
113 
114  //- Re-read model coefficients if they have changed
115  virtual bool read() = 0;
116 
117  //- Return the turbulence viscosity
118  virtual tmp<volScalarField> nut() const
119  {
120  return nut_;
121  }
122 
123  //- Return the turbulence viscosity on patch
124  virtual tmp<scalarField> nut(const label patchi) const
125  {
126  return nut_.boundaryField()[patchi];
127  }
128 
129  //- Return the turbulence kinetic energy
130  virtual tmp<volScalarField> k() const;
131 
132  //- Return the Reynolds stress tensor
133  virtual tmp<volSymmTensorField> R() const;
134 
135  //- Return the effective stress tensor
136  virtual tmp<volSymmTensorField> devRhoReff() const;
137 
138  //- Return the source term for the momentum equation
140 
141  //- Return the source term for the momentum equation
143  (
144  const volScalarField& rho,
145  volVectorField& U
146  ) const;
147 
148  //- Validate the turbulence fields after construction
149  // Update turbulence viscosity and other derived fields as requires
150  virtual void validate();
151 
152  //- Solve the turbulence equations and correct the turbulence viscosity
153  virtual void correct() = 0;
154 };
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace Foam
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #ifdef NoRepository
164  #include "ReynoldsStress.C"
165 #endif
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 #endif
170 
171 // ************************************************************************* //
void correctWallShearStress(volSymmTensorField &R) const
BasicTurbulenceModel::alphaField alphaField
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
surfaceScalarField & phi
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.
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
virtual bool read()=0
Re-read model coefficients if they have changed.
A class for handling words, derived from string.
Definition: word.H:59
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
virtual ~ReynoldsStress()
Destructor.
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.
label patchi
U
Definition: pEqn.H:72
virtual tmp< volScalarField > k() const
Return the turbulence kinetic energy.
volSymmTensorField R_
A class for managing temporary objects.
Definition: PtrList.H:53
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Namespace for OpenFOAM.
Reynolds-stress turbulence model base class.