physicalProperties.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) 2021 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 "physicalProperties.H"
27 #include "fvMesh.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
34 }
35 
36 
37 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * //
38 
40 (
41  const objectRegistry& obr,
42  const word& group,
43  bool registerObject
44 )
45 {
46  typeIOobject<IOdictionary> physicalPropertiesIO
47  (
48  IOobject::groupName(physicalProperties::typeName, group),
49  obr.time().constant(),
50  obr,
54  );
55 
56  if (physicalPropertiesIO.headerOk())
57  {
58  return physicalPropertiesIO;
59  }
60  else
61  {
62  typeIOobject<IOdictionary> thermophysicalPropertiesIO
63  (
64  IOobject::groupName("thermophysicalProperties", group),
65  obr.time().constant(),
66  obr,
70  );
71 
72  if (thermophysicalPropertiesIO.headerOk())
73  {
74  return thermophysicalPropertiesIO;
75  }
76  else
77  {
78  typeIOobject<IOdictionary> transportPropertiesIO
79  (
80  IOobject::groupName("transportProperties", group),
81  obr.time().constant(),
82  obr,
86  );
87 
88  if (transportPropertiesIO.headerOk())
89  {
90  return transportPropertiesIO;
91  }
92  else
93  {
94  return physicalPropertiesIO;
95  }
96  }
97  }
98 }
99 
100 
101 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
102 
104 (
105  const fvMesh& mesh,
106  const word& group
107 )
108 :
109  IOdictionary(findModelDict(mesh, group, true))
110 {
111  // Ensure name of IOdictionary is typeName
112  rename(IOobject::groupName(physicalProperties::typeName, group));
113 }
114 
115 
116 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
117 
119 {
120  return regIOobject::read();
121 }
122 
123 
124 // ************************************************************************* //
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
@ MUST_READ_IF_MODIFIED
Definition: IOobject.H:119
bool & registerObject()
Register object created from this IOobject with registry if true.
Definition: IOobject.H:346
word group() const
Return group (extension part of name)
Definition: IOobject.C:324
static word groupName(Name name, const word &group)
static const word & constant()
Return constant name.
Definition: TimePaths.H:122
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
Registry of regIOobjects.
const Time & time() const
Return time.
An abstract base class for physical properties.
virtual bool read()=0
Read physicalProperties dictionary.
physicalProperties(const fvMesh &mesh, const word &group)
Construct from components.
static IOobject findModelDict(const objectRegistry &obr, const word &group, bool registerObject=false)
virtual void rename(const word &newName)
Rename.
Definition: regIOobject.C:417
virtual bool read()
Read object.
Templated form of IOobject providing type information for file reading and header type checking.
Definition: IOobject.H:531
bool headerOk()
Read header (uses typeGlobalFile to find file) and check.
A class for handling words, derived from string.
Definition: word.H:62
const char *const group
Group name for atomic constants.
Namespace for OpenFOAM.
defineTypeNameAndDebug(combustionModel, 0)