ReynoldsStress.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2015-2016 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::ReynoldsStress
29 
30 Group
31  grpTurbulence
32 
33 Description
34  Reynolds-stress turbulence model base class
35 
36 SourceFiles
37  ReynoldsStress.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef ReynoldsStress_H
42 #define ReynoldsStress_H
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class ReynoldsStress Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 template<class BasicTurbulenceModel>
54 class ReynoldsStress
55 :
56  public BasicTurbulenceModel
57 {
58 
59 protected:
60 
61  // Protected data
62 
63  // Model coefficients
64 
66 
67  // Fields
68 
71 
72 
73  // Protected Member Functions
74 
77 
78  //- Update the eddy-viscosity
79  virtual void correctNut() = 0;
80 
81  //- Return the source term for the momentum equation
82  template<class RhoFieldType>
84  (
85  const RhoFieldType& rho,
87  ) const;
88 
89 
90 public:
91 
92  typedef typename BasicTurbulenceModel::alphaField alphaField;
93  typedef typename BasicTurbulenceModel::rhoField rhoField;
94  typedef typename BasicTurbulenceModel::transportModel transportModel;
95 
96 
97  // Constructors
98 
99  //- Construct from components
101  (
102  const word& modelName,
103  const alphaField& alpha,
104  const rhoField& rho,
105  const volVectorField& U,
106  const surfaceScalarField& alphaRhoPhi,
107  const surfaceScalarField& phi,
108  const transportModel& transport,
109  const word& propertiesName
110  );
111 
112 
113  //- Destructor
114  virtual ~ReynoldsStress() = default;
115 
116 
117  // Member Functions
118 
119  //- Re-read model coefficients if they have changed
120  virtual bool read() = 0;
121 
122  //- Return the turbulence viscosity
123  virtual tmp<volScalarField> nut() const
124  {
125  return nut_;
126  }
127 
128  //- Return the turbulence viscosity on patch
129  virtual tmp<scalarField> nut(const label patchi) const
130  {
131  return nut_.boundaryField()[patchi];
132  }
133 
134  //- Return the turbulence kinetic energy
135  virtual tmp<volScalarField> k() const;
136 
137  //- Return the Reynolds stress tensor
138  virtual tmp<volSymmTensorField> R() const;
139 
140  //- Return the effective stress tensor
141  virtual tmp<volSymmTensorField> devRhoReff() const;
142 
143  //- Return the effective stress tensor based on a given velocity field
145  (
146  const volVectorField& U
147  ) const;
148 
149  //- Return the source term for the momentum equation
151 
152  //- Return the source term for the momentum equation
154  (
155  const volScalarField& rho,
157  ) const;
158 
159  //- Validate the turbulence fields after construction
160  // Update turbulence viscosity and other derived fields as requires
161  virtual void validate();
162 
163  //- Solve the turbulence equations and correct the turbulence viscosity
164  virtual void correct() = 0;
165 };
166 
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 } // End namespace Foam
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 #ifdef NoRepository
175  #include "ReynoldsStress.C"
176 #endif
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 #endif
181 
182 // ************************************************************************* //
Foam::ReynoldsStress::k
virtual tmp< volScalarField > k() const
Return the turbulence kinetic energy.
Definition: ReynoldsStress.C:200
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::ReynoldsStress::read
virtual bool read()=0
Re-read model coefficients if they have changed.
Definition: ReynoldsStress.C:184
Foam::ReynoldsStress::nut_
volScalarField nut_
Definition: ReynoldsStress.H:69
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Foam::ReynoldsStress::correctWallShearStress
void correctWallShearStress(volSymmTensorField &R) const
Definition: ReynoldsStress.C:63
rho
rho
Definition: readInitialConditions.H:88
Foam::ReynoldsStress::nut
virtual tmp< scalarField > nut(const label patchi) const
Return the turbulence viscosity on patch.
Definition: ReynoldsStress.H:128
Foam::ReynoldsStress::correctNut
virtual void correctNut()=0
Update the eddy-viscosity.
Foam::ReynoldsStress
Reynolds-stress turbulence model base class.
Definition: ReynoldsStress.H:53
Foam::ReynoldsStress::divDevRhoReff
virtual tmp< fvVectorMatrix > divDevRhoReff(volVectorField &U) const
Return the source term for the momentum equation.
Definition: ReynoldsStress.C:294
Foam::ReynoldsStress::ReynoldsStress
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.
Definition: ReynoldsStress.C:112
Foam::ReynoldsStress::~ReynoldsStress
virtual ~ReynoldsStress()=default
Destructor.
Foam::ReynoldsStress::transportModel
BasicTurbulenceModel::transportModel transportModel
Definition: ReynoldsStress.H:93
Foam::ReynoldsStress::DivDevRhoReff
tmp< fvVectorMatrix > DivDevRhoReff(const RhoFieldType &rho, volVectorField &U) const
Return the source term for the momentum equation.
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::RASModel::rhoField
BasicTurbulenceModel::rhoField rhoField
Definition: RASModel.H:98
Foam::dimensioned< scalar >
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::ReynoldsStress::validate
virtual void validate()
Validate the turbulence fields after construction.
Definition: ReynoldsStress.C:315
Foam::RASModel::alphaField
BasicTurbulenceModel::alphaField alphaField
Definition: RASModel.H:97
Foam::ReynoldsStress::nut
virtual tmp< volScalarField > nut() const
Return the turbulence viscosity.
Definition: ReynoldsStress.H:122
Foam::ReynoldsStress::devRhoReff
virtual tmp< volSymmTensorField > devRhoReff() const
Return the effective stress tensor.
Definition: ReynoldsStress.C:210
Foam::RASModel::transportModel
BasicTurbulenceModel::transportModel transportModel
Definition: RASModel.H:99
U
U
Definition: pEqn.H:72
ReynoldsStress.C
Foam::ReynoldsStress::correct
virtual void correct()=0
Solve the turbulence equations and correct the turbulence viscosity.
Definition: ReynoldsStress.C:322
Foam::ReynoldsStress::R_
volSymmTensorField R_
Definition: ReynoldsStress.H:68
Foam::ReynoldsStress::R
virtual tmp< volSymmTensorField > R() const
Return the Reynolds stress tensor.
Definition: ReynoldsStress.C:192
Foam::ReynoldsStress::boundNormalStress
void boundNormalStress(volSymmTensorField &R) const
Definition: ReynoldsStress.C:38
Foam::ReynoldsStress::alphaField
BasicTurbulenceModel::alphaField alphaField
Definition: ReynoldsStress.H:91
Foam::GeometricField< symmTensor, fvPatchField, volMesh >
Foam::ReynoldsStress::rhoField
BasicTurbulenceModel::rhoField rhoField
Definition: ReynoldsStress.H:92
Foam::ReynoldsStress::couplingFactor_
dimensionedScalar couplingFactor_
Definition: ReynoldsStress.H:64
Foam::GeometricField::boundaryField
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Definition: GeometricFieldI.H:62