DAkOmega.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2 
3  DAFoam : Discrete Adjoint with OpenFOAM
4  Version : v3
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  (
69  new volScalarField
70  (
71  "DkEff",
72  alphaK_*this->nut_ + this->nu()
73  )
74  );
75  }
76 
77  //- Return the effective diffusivity for omega
78  tmp<volScalarField> DomegaEff() const
79  {
80  return tmp<volScalarField>
81  (
82  new volScalarField
83  (
84  "DomegaEff",
85  alphaOmega_*this->nut_ + this->nu()
86  )
87  );
88  }
90 
92 
93  volScalarField& omega_;
94  volScalarField omegaRes_;
95  volScalarField& k_;
96  volScalarField kRes_;
98 
103  scalarList omegaNearWall_;
104 
106  label solveTurbState_ = 0;
107 
110 
111 public:
112  TypeName("kOmega");
113  // Constructors
114 
115  //- Construct from components
116  DAkOmega(
117  const word modelType,
118  const fvMesh& mesh,
119  const DAOption& daOption);
120 
121  //- Destructor
122  virtual ~DAkOmega()
123  {
124  }
125 
126  // Member functions
127 
129  virtual void correctModelStates(wordList& modelStates) const;
130 
132  virtual void correctNut();
133 
135  virtual void correctBoundaryConditions();
136 
138  virtual void updateIntermediateVariables();
139 
141  virtual void correctStateResidualModelCon(List<List<word>>& stateCon) const;
142 
144  virtual void addModelResidualCon(HashTable<List<List<word>>>& allCon) const;
145 
147  virtual void calcResiduals(const dictionary& options);
148 
150  virtual void correct();
151 
153  void saveOmegaNearWall();
154 
156  void setOmegaNearWall();
157 
160 };
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 } // End namespace Foam
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 #endif
169 
170 // ************************************************************************* //
Foam::DAkOmega
Definition: DAkOmega.H:48
Foam::DAkOmega::~DAkOmega
virtual ~DAkOmega()
Definition: DAkOmega.H:122
Foam::DAkOmega::saveOmegaNearWall
void saveOmegaNearWall()
save near wall omega values to omegaNearWall_
Definition: DAkOmega.C:241
Foam::DAOption
Definition: DAOption.H:29
daOption
DAOption daOption(mesh, pyOptions_)
Foam::DAkOmega::Cmu_
dimensionedScalar Cmu_
Definition: DAkOmega.H:55
Foam::DAkOmega::omegaRes_
volScalarField omegaRes_
Definition: DAkOmega.H:94
Foam::DAkOmega::correct
virtual void correct()
solve the residual equations and update the state
Definition: DAkOmega.C:493
Foam::DAkOmega::DomegaEff
tmp< volScalarField > DomegaEff() const
Definition: DAkOmega.H:78
mesh
fvMesh & mesh
Definition: createRefsHeatTransfer.H:4
Foam::DAkOmega::kRes_
volScalarField kRes_
Definition: DAkOmega.H:96
Foam::DAkOmega::omegaNearWall_
scalarList omegaNearWall_
Definition: DAkOmega.H:103
Foam::DATurbulenceModel::nut_
volScalarField & nut_
turbulence viscosity
Definition: DATurbulenceModel.H:83
Foam::DAkOmega::alphaK_
dimensionedScalar alphaK_
Definition: DAkOmega.H:58
Foam
Definition: multiFreqScalarFvPatchField.C:144
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:302
Foam::DAkOmega::k_
volScalarField & k_
Definition: DAkOmega.H:95
Foam::DAkOmega::correctModelStates
virtual void correctModelStates(wordList &modelStates) const
update the turbulence state for DAStateInfo::regStates_
Definition: DAkOmega.C:148
Foam::DAkOmega::solveTurbState_
label solveTurbState_
whether to solve for turb states
Definition: DAkOmega.H:106
Foam::DAkOmega::omega_
volScalarField & omega_
Definition: DAkOmega.H:93
Foam::DAkOmega::gamma_
dimensionedScalar gamma_
Definition: DAkOmega.H:57
Foam::DATurbulenceModel::nu
tmp< volScalarField > nu() const
get the nu field
Definition: DATurbulenceModel.C:262
Foam::DAkOmega::correctNut
virtual void correctNut()
update nut based on other turbulence variables and update the BCs
Definition: DAkOmega.C:184
Foam::DAkOmega::addModelResidualCon
virtual void addModelResidualCon(HashTable< List< List< word >>> &allCon) const
add the model residual connectivity to stateCon
Definition: DAkOmega.C:401
Foam::DATurbulenceModel
Definition: DATurbulenceModel.H:61
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:513
Foam::DAkOmega::correctOmegaBoundaryConditions
void correctOmegaBoundaryConditions()
specially treatment to correct epsilon BC
Definition: DAkOmega.C:214
Foam::DAkOmega::printInterval_
label printInterval_
time step interval to print residual
Definition: DAkOmega.H:109
Foam::DAkOmega::correctBoundaryConditions
virtual void correctBoundaryConditions()
update turbulence variable boundary values
Definition: DAkOmega.C:202
Foam::DAkOmega::updateIntermediateVariables
virtual void updateIntermediateVariables()
update any intermediate variables that are dependent on state variables and are used in calcResiduals
Definition: DAkOmega.C:291
Foam::DAkOmega::setOmegaNearWall
void setOmegaNearWall()
set omegaNearWall_ to near wall omega values
Definition: DAkOmega.C:265
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