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 {
33  defineTypeNameAndDebug(physicalProperties, 0);
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,
53  registerObject
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,
69  registerObject
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,
85  registerObject
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 // ************************************************************************* //
virtual bool read()
Read object.
Templated form of IOobject providing type information for file reading and header type checking...
Definition: IOobject.H:537
static IOobject findModelDict(const objectRegistry &obr, const word &group, bool registerObject=false)
virtual bool read()=0
Read physicalProperties dictionary.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
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
physicalProperties(const fvMesh &mesh, const word &group)
Construct from components.
const Time & time() const
Return time.
defineTypeNameAndDebug(combustionModel, 0)
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
Registry of regIOobjects.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:98
Namespace for OpenFOAM.