DAkOmega.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  DAFoam : Discrete Adjoint with OpenFOAM
4  Version : v4
5 
6  Description:
7  Child class for the kOmega model
8 
9  This file is modified from OpenFOAM's source code
10  src/TurbulenceModels/turbulenceModels/RAS/kOmega/kOmega.H
11 
12  OpenFOAM: The Open Source CFD Toolbox
13 
14  Copyright (C): 2011-2016 OpenFOAM Foundation
15 
16  OpenFOAM License:
17 
18  OpenFOAM is free software: you can redistribute it and/or modify it
19  under the terms of the GNU General Public License as published by
20  the Free Software Foundation, either version 3 of the License, or
21  (at your option) any later version.
22 
23  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
24  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
25  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26  for more details.
27 
28  You should have received a copy of the GNU General Public License
29  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
30 
31 \*---------------------------------------------------------------------------*/
32 
33 #ifndef DAkOmega_H
34 #define DAkOmega_H
35 
36 #include "DATurbulenceModel.H"
37 #include "addToRunTimeSelectionTable.H"
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43 
44 /*---------------------------------------------------------------------------*\
45  Class DAkOmega Declaration
46 \*---------------------------------------------------------------------------*/
47 
48 class DAkOmega
49  : public DATurbulenceModel
50 {
51 
52 protected:
54 
55  dimensionedScalar Cmu_;
56  dimensionedScalar beta_;
57  dimensionedScalar gamma_;
58  dimensionedScalar alphaK_;
59  dimensionedScalar alphaOmega_;
61 
63 
64  //- Return the effective diffusivity for k
65  tmp<volScalarField> DkEff() const
66  {
67  return tmp<volScalarField>(
68  new volScalarField(
69  "DkEff",
70  alphaK_ * this->nut_ + this->nu()));
71  }
72 
73  //- Return the effective diffusivity for omega
74  tmp<volScalarField> DomegaEff() const
75  {
76  return tmp<volScalarField>(
77  new volScalarField(
78  "DomegaEff",
79  alphaOmega_ * this->nut_ + this->nu()));
80  }
82 
84 
85  volScalarField& omega_;
86  volScalarField omegaRes_;
87  volScalarField& k_;
88  volScalarField kRes_;
90 
93  autoPtr<volScalarField> GPtr_;
94 
96  volScalarField betaFIK_;
97  volScalarField betaFIOmega_;
98 
103  scalarList omegaNearWall_;
104 
106  label solveTurbState_ = 0;
107 
108 public:
109  TypeName("kOmega");
110  // Constructors
111 
112  //- Construct from components
113  DAkOmega(
114  const word modelType,
115  const fvMesh& mesh,
116  const DAOption& daOption);
117 
118  //- Destructor
119  virtual ~DAkOmega()
120  {
121  }
122 
123  // Member functions
124 
126  virtual void correctModelStates(wordList& modelStates) const;
127 
129  virtual void correctNut();
130 
132  virtual void correctBoundaryConditions();
133 
135  virtual void updateIntermediateVariables();
136 
138  virtual void correctStateResidualModelCon(List<List<word>>& stateCon) const;
139 
141  virtual void addModelResidualCon(HashTable<List<List<word>>>& allCon) const;
142 
144  virtual void calcResiduals(const dictionary& options);
145 
147  virtual void correct(label printToScreen);
148 
150  void saveOmegaNearWall();
151 
153  void setOmegaNearWall();
154 
157 
159  virtual void getFvMatrixFields(
160  const word varName,
161  scalarField& diag,
162  scalarField& upper,
163  scalarField& lower);
164 
166  virtual void getTurbProdOverDestruct(volScalarField& PoD) const;
167 
169  virtual void getTurbConvOverProd(volScalarField& CoP) const;
170 };
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
Foam::DAkOmega
Definition: DAkOmega.H:48
Foam::DAkOmega::correct
virtual void correct(label printToScreen)
solve the residual equations and update the state
Definition: DAkOmega.C:498
Foam::DAkOmega::~DAkOmega
virtual ~DAkOmega()
Definition: DAkOmega.H:119
Foam::DAkOmega::saveOmegaNearWall
void saveOmegaNearWall()
save near wall omega values to omegaNearWall_
Definition: DAkOmega.C:245
Foam::DAkOmega::getTurbProdOverDestruct
virtual void getTurbProdOverDestruct(volScalarField &PoD) const
return the value of the destruction term from the turbulence model
Definition: DAkOmega.C:723
Foam::DAkOmega::getTurbConvOverProd
virtual void getTurbConvOverProd(volScalarField &CoP) const
return the value of the convective over production term from the turbulence model
Definition: DAkOmega.C:744
Foam::DAOption
Definition: DAOption.H:29
Foam::DAkOmega::Cmu_
dimensionedScalar Cmu_
Definition: DAkOmega.H:55
Foam::DAkOmega::betaFIOmega_
volScalarField betaFIOmega_
Definition: DAkOmega.H:97
Foam::DAkOmega::omegaRes_
volScalarField omegaRes_
Definition: DAkOmega.H:86
Foam::DAkOmega::DomegaEff
tmp< volScalarField > DomegaEff() const
Definition: DAkOmega.H:74
mesh
fvMesh & mesh
Definition: createRefsHeatTransfer.H:4
Foam::DAkOmega::kRes_
volScalarField kRes_
Definition: DAkOmega.H:88
Foam::DAkOmega::omegaNearWall_
scalarList omegaNearWall_
Definition: DAkOmega.H:103
Foam::DAkOmega::betaFIK_
volScalarField betaFIK_
beta field for field inversion
Definition: DAkOmega.H:96
Foam::DATurbulenceModel::nut_
volScalarField & nut_
turbulence viscosity
Definition: DATurbulenceModel.H:77
Foam::DAkOmega::alphaK_
dimensionedScalar alphaK_
Definition: DAkOmega.H:58
Foam
Definition: checkGeometry.C:32
Foam::DAkOmega::correctStateResidualModelCon
virtual void correctStateResidualModelCon(List< List< word >> &stateCon) const
update the original variable connectivity for the adjoint state residuals in stateCon
Definition: DAkOmega.C:306
Foam::DAkOmega::k_
volScalarField & k_
Definition: DAkOmega.H:87
Foam::DAkOmega::correctModelStates
virtual void correctModelStates(wordList &modelStates) const
update the turbulence state for DAStateInfo::regStates_
Definition: DAkOmega.C:152
Foam::DAkOmega::solveTurbState_
label solveTurbState_
whether to solve for turb states
Definition: DAkOmega.H:106
Foam::DAkOmega::omega_
volScalarField & omega_
Definition: DAkOmega.H:85
Foam::DAkOmega::gamma_
dimensionedScalar gamma_
Definition: DAkOmega.H:57
Foam::DATurbulenceModel::nu
tmp< volScalarField > nu() const
get the nu field
Definition: DATurbulenceModel.C:267
Foam::DAkOmega::correctNut
virtual void correctNut()
update nut based on other turbulence variables and update the BCs
Definition: DAkOmega.C:188
Foam::DAkOmega::addModelResidualCon
virtual void addModelResidualCon(HashTable< List< List< word >>> &allCon) const
add the model residual connectivity to stateCon
Definition: DAkOmega.C:405
Foam::DATurbulenceModel
Definition: DATurbulenceModel.H:52
Foam::DAkOmega::beta_
dimensionedScalar beta_
Definition: DAkOmega.H:56
Foam::DAkOmega::TypeName
TypeName("kOmega")
Foam::DAkOmega::calcResiduals
virtual void calcResiduals(const dictionary &options)
compute the turbulence residuals
Definition: DAkOmega.C:519
Foam::DAkOmega::correctOmegaBoundaryConditions
void correctOmegaBoundaryConditions()
specially treatment to correct epsilon BC
Definition: DAkOmega.C:218
Foam::DAkOmega::getFvMatrixFields
virtual void getFvMatrixFields(const word varName, scalarField &diag, scalarField &upper, scalarField &lower)
return the diag(), upper(), and lower() scalarFields from the turbulence model's fvMatrix
Definition: DAkOmega.C:649
Foam::DAkOmega::correctBoundaryConditions
virtual void correctBoundaryConditions()
update turbulence variable boundary values
Definition: DAkOmega.C:206
Foam::DAkOmega::updateIntermediateVariables
virtual void updateIntermediateVariables()
update any intermediate variables that are dependent on state variables and are used in calcResiduals
Definition: DAkOmega.C:295
Foam::DAkOmega::GPtr_
autoPtr< volScalarField > GPtr_
Definition: DAkOmega.H:93
Foam::DAkOmega::setOmegaNearWall
void setOmegaNearWall()
set omegaNearWall_ to near wall omega values
Definition: DAkOmega.C:269
DATurbulenceModel.H
Foam::DAkOmega::DkEff
tmp< volScalarField > DkEff() const
Definition: DAkOmega.H:65
Foam::DAkOmega::DAkOmega
DAkOmega(const word modelType, const fvMesh &mesh, const DAOption &daOption)
Definition: DAkOmega.C:41
Foam::DAkOmega::alphaOmega_
dimensionedScalar alphaOmega_
Definition: DAkOmega.H:59