All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2024 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 "objectRegistry.H"
28 #include "Time.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
35 }
36 
37 
38 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * //
39 
41 (
42  const objectRegistry& obr,
43  const word& group,
44  bool registerObject
45 )
46 {
47  typeIOobject<IOdictionary> physicalPropertiesIO
48  (
49  IOobject::groupName(physicalProperties::typeName, group),
50  obr.time().constant(),
51  obr,
55  );
56 
57  if (physicalPropertiesIO.headerOk())
58  {
59  return physicalPropertiesIO;
60  }
61  else
62  {
63  typeIOobject<IOdictionary> thermophysicalPropertiesIO
64  (
65  IOobject::groupName("thermophysicalProperties", group),
66  obr.time().constant(),
67  obr,
71  );
72 
73  if (thermophysicalPropertiesIO.headerOk())
74  {
75  return thermophysicalPropertiesIO;
76  }
77  else
78  {
79  typeIOobject<IOdictionary> transportPropertiesIO
80  (
81  IOobject::groupName("transportProperties", group),
82  obr.time().constant(),
83  obr,
87  );
88 
89  if (transportPropertiesIO.headerOk())
90  {
91  return transportPropertiesIO;
92  }
93  else
94  {
95  return physicalPropertiesIO;
96  }
97  }
98  }
99 }
100 
101 
102 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
103 
105 (
106  const objectRegistry& obr,
107  const word& group
108 )
109 :
110  IOdictionary(findModelDict(obr, group, true))
111 {
112  // Ensure name of IOdictionary is typeName
113  rename(IOobject::groupName(physicalProperties::typeName, group));
114 }
115 
116 
117 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
118 
120 {
121  return regIOobject::read();
122 }
123 
124 
125 // ************************************************************************* //
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
Registry of regIOobjects.
const Time & time() const
Return time.
A base class for physical properties.
physicalProperties(const objectRegistry &obr, const word &group)
Construct from components.
static IOobject findModelDict(const objectRegistry &obr, const word &group, bool registerObject=false)
Find the physicalProperties dictionary and return the IOobject.
virtual bool read()
Read physicalProperties dictionary.
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)