liquid.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2020 OpenFOAM Foundation
9  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "liquid.H"
30 #include "NoneFunction1.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37  defineTypeNameAndDebug(liquid, 0);
38  addToRunTimeSelectionTable(liquidProperties, liquid, dictionary);
39 }
40 
41 
42 // * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 template<class Type>
49 (
50  const word& entryName,
51  const dictionary& dict
52 )
53 {
55  (
57  );
58 
59  if (!ptr)
60  {
61  ptr.reset
62  (
63  new Function1Types::None<Type>(entryName, dict)
64  );
65  }
66 
67  return ptr;
68 }
69 
70 } // End namespace Foam
71 
72 
73 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
74 
75 Foam::liquid::liquid(const dictionary& dict)
76 :
77  liquidProperties(dict),
78  rho_(NewOrNone<scalar>("rho", dict)),
79  pv_(NewOrNone<scalar>("pv", dict)),
80  hl_(NewOrNone<scalar>("hl", dict)),
81  Cp_(NewOrNone<scalar>("Cp", dict)),
82  h_(NewOrNone<scalar>("h", dict)),
83  Cpg_(NewOrNone<scalar>("Cpg", dict)),
84  B_(NewOrNone<scalar>("B", dict)),
85  mu_(NewOrNone<scalar>("mu", dict)),
86  mug_(NewOrNone<scalar>("mug", dict)),
87  kappa_(NewOrNone<scalar>("kappa", dict)),
88  kappag_(NewOrNone<scalar>("kappag", dict)),
89  sigma_(NewOrNone<scalar>("sigma", dict)),
90  D_(NewOrNone<scalar>("D", dict))
91 {}
92 
93 
94 
95 Foam::liquid::liquid(const liquid& rhs)
96 :
97  liquidProperties(rhs),
98  rho_(rhs.rho_.clone()),
99  pv_(rhs.pv_.clone()),
100  hl_(rhs.hl_.clone()),
101  Cp_(rhs.Cp_.clone()),
102  h_(rhs.h_.clone()),
103  Cpg_(rhs.Cpg_.clone()),
104  B_(rhs.B_.clone()),
105  mu_(rhs.mu_.clone()),
106  mug_(rhs.mug_.clone()),
107  kappa_(rhs.kappa_.clone()),
108  kappag_(rhs.kappag_.clone()),
109  sigma_(rhs.sigma_.clone()),
110  D_(rhs.D_.clone())
111 {}
112 
113 
114 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
115 
117 {
119  rho_->writeData(os); os << nl;
120  pv_->writeData(os); os << nl;
121  hl_->writeData(os); os << nl;
122  Cp_->writeData(os); os << nl;
123  h_->writeData(os); os << nl;
124  Cpg_->writeData(os); os << nl;
125  B_->writeData(os); os << nl;
126  mu_->writeData(os); os << nl;
127  mug_->writeData(os); os << nl;
128  kappa_->writeData(os); os << nl;
129  kappag_->writeData(os); os << nl;
130  sigma_->writeData(os); os << nl;
131  D_->writeData(os); os << endl;
132 }
133 
134 
135 // ************************************************************************* //
Generic thermophysical properties class for a liquid in which the functions and coefficients for each...
Definition: liquid.H:50
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:50
liquid(const dictionary &dict)
Construct from dictionary.
Definition: liquid.C:68
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
Macros for easy insertion into run-time selection tables.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
Definition: autoPtrI.H:37
Templated placeholder function that returns an error message if called.
Definition: NoneFunction1.H:47
void writeData(Ostream &os) const
Write the function coefficients.
Definition: liquid.C:109
A class for handling words, derived from Foam::string.
Definition: word.H:63
static autoPtr< Function1< Type > > NewOrNone(const word &entryName, const dictionary &dict)
Definition: liquid.C:42
The thermophysical properties of a liquid.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
virtual void writeData(Ostream &os) const =0
Write the function coefficients.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Namespace for OpenFOAM.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)