momentumTransportModel.C
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) 2011-2020 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 \*---------------------------------------------------------------------------*/
25 
26 #include "momentumTransportModel.H"
27 #include "volFields.H"
28 #include "surfaceFields.H"
29 #include "wallFvPatch.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
36 }
37 
38 
39 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
40 
42 (
43  const objectRegistry& obr,
44  const word& group,
45  bool registerObject
46 )
47 {
48  IOobject momentumTransport
49  (
50  IOobject::groupName(typeName, group),
51  obr.time().constant(),
52  obr,
55  registerObject
56  );
57 
58  if (momentumTransport.typeHeaderOk<IOdictionary>(true))
59  {
60  return momentumTransport;
61  }
62  else
63  {
64  IOobject turbulenceProperties
65  (
66  IOobject::groupName("turbulenceProperties", group),
67  obr.time().constant(),
68  obr,
71  registerObject
72  );
73 
74  if (turbulenceProperties.typeHeaderOk<IOdictionary>(true))
75  {
76  return turbulenceProperties;
77  }
78  else
79  {
80  return momentumTransport;
81  }
82  }
83 }
84 
85 
86 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
87 
89 (
90  const volVectorField& U,
91  const surfaceScalarField& alphaRhoPhi,
92  const surfaceScalarField& phi
93 )
94 :
95  IOdictionary(readModelDict(U.db(), alphaRhoPhi.group(), true)),
96 
97  runTime_(U.time()),
98  mesh_(U.mesh()),
99 
100  U_(U),
101  alphaRhoPhi_(alphaRhoPhi),
102  phi_(phi),
103  y_(mesh_)
104 {
105  // Ensure name of IOdictionary is typeName
106  rename(IOobject::groupName(typeName, alphaRhoPhi.group()));
107 }
108 
109 
110 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
111 
113 {
114  return phi_;
115 }
116 
117 
119 {
120  return regIOobject::read();
121 }
122 
123 
125 {}
126 
127 
129 {
130  if (mesh_.changing())
131  {
132  y_.correct();
133  }
134 }
135 
136 
137 // ************************************************************************* //
Foam::surfaceFields.
static word group(const word &name)
Return group (extension part of name)
Definition: IOobject.C:134
virtual bool read()
Read object.
virtual void validate()
Validate the turbulence fields after construction.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
virtual void correct()=0
Solve the turbulence equations and correct the turbulence viscosity.
CompressibleMomentumTransportModel< dynamicTransportModel > momentumTransportModel
A class for handling words, derived from string.
Definition: word.H:59
static word groupName(Name name, const word &group)
static IOdictionary readModelDict(const objectRegistry &obr, const word &group, bool registerObject=false)
const word & constant() const
Return constant name.
Definition: TimePaths.H:123
const Mesh & mesh() const
Return mesh.
const Time & time() const
Return time.
defineTypeNameAndDebug(combustionModel, 0)
momentumTransportModel(const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi)
Construct from components.
virtual bool read()=0
Read model coefficients if they have changed.
const Time & time() const
Return time.
Definition: IOobject.C:318
A class for managing temporary objects.
Definition: PtrList.H:53
Registry of regIOobjects.
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:312
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
virtual tmp< surfaceScalarField > phi() const
Return the volumetric flux field.
Namespace for OpenFOAM.