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-2022 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 #include "nearWallDist.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
37 }
38 
39 
40 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
41 
44 (
45  const objectRegistry& obr,
46  const word& group,
47  bool registerObject
48 )
49 {
50  typeIOobject<IOdictionary> momentumTransport
51  (
52  IOobject::groupName(typeName, group),
53  obr.time().constant(),
54  obr,
57  registerObject
58  );
59 
60  if (momentumTransport.headerOk())
61  {
62  return momentumTransport;
63  }
64  else
65  {
66  typeIOobject<IOdictionary> turbulenceProperties
67  (
68  IOobject::groupName("turbulenceProperties", group),
69  obr.time().constant(),
70  obr,
73  registerObject
74  );
75 
76  if (turbulenceProperties.headerOk())
77  {
78  return turbulenceProperties;
79  }
80  else
81  {
82  return momentumTransport;
83  }
84  }
85 }
86 
87 
88 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
89 
91 (
92  const volVectorField& U,
93  const surfaceScalarField& alphaRhoPhi,
94  const surfaceScalarField& phi,
95  const viscosity& viscosity
96 )
97 :
98  IOdictionary(readModelDict(U.db(), alphaRhoPhi.group(), true)),
99 
100  runTime_(U.time()),
101  mesh_(U.mesh()),
102 
103  U_(U),
104  alphaRhoPhi_(alphaRhoPhi),
105  phi_(phi),
106  viscosity_(viscosity)
107 {
108  // Ensure name of IOdictionary is typeName
109  rename(IOobject::groupName(typeName, alphaRhoPhi.group()));
110 }
111 
112 
113 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
114 
116 {
117  return phi_;
118 }
119 
120 
122 {
123  return nearWallDist::New(mesh_).y();
124 }
125 
126 
128 {
129  return regIOobject::read();
130 }
131 
132 
134 {}
135 
136 
138 {}
139 
140 
141 // ************************************************************************* //
Foam::surfaceFields.
static word group(const word &name)
Return group (extension part of name)
Definition: IOobject.C:134
virtual bool read()
Read object.
Templated form of IOobject providing type information for file reading and header type checking...
Definition: IOobject.H:537
virtual void validate()
Validate the turbulence fields after construction.
const volScalarField::Boundary & y() const
Return the near wall distance.
static typeIOobject< IOdictionary > readModelDict(const objectRegistry &obr, const word &group, bool registerObject=false)
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 momentumTransportModel
A class for handling words, derived from string.
Definition: word.H:59
static word groupName(Name name, const word &group)
const word & constant() const
Return constant name.
Definition: TimePaths.H:123
momentumTransportModel(const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const viscosity &viscosity)
Construct from components.
const Mesh & mesh() const
Return mesh.
const Time & time() const
Return time.
defineTypeNameAndDebug(combustionModel, 0)
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
const volScalarField::Boundary & y() const
Access to the near-wall distances.
Definition: nearWallDist.H:93
virtual tmp< surfaceScalarField > phi() const
Return the volumetric flux field.
Namespace for OpenFOAM.