function1.H
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) 2017-2018 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 Class
25  Foam::saturationModels::function1
26 
27 Description
28  Saturation vapour temperature in terms of
29  the vapour pressure (in Pa). The saturation temperature in Kelvins is
30  specified as a Foam::Function1 type, to enable use of, e.g. constant,
31  polynomial, table values.
32 
33  Currently this class only provides \f$T_sat\f$, the inverse function to
34  return the vapour pressure for a given temperature are not implemented.
35 
36  Examples:
37 
38  \verbatim
39  type function1;
40  function polynomial
41  (
42  (308.0422 0)
43  (0.0015096 1)
44  (-1.61589e-8 2)
45  (1.114106e-13 3)
46  (-4.52216e-19 4)
47  (1.05192e-24 5)
48  (-1.2953e-30 6)
49  (6.5365e-37 7)
50  )
51  \endverbatim
52 
53  \verbatim
54  type function1;
55 
56  function csvFile;
57  functionCoeffs
58  {
59  nHeaderLine 1;
60  refColumn 0;
61  componentColumns (1);
62  separator ",";
63  mergeSeparators no;
64  file "filename.csv";
65  outOfBounds clamp;
66  interpolationScheme linear;
67  };
68  \endverbatim
69 
70 SourceFiles
71  function1.C
72 
73 \*---------------------------------------------------------------------------*/
74 
75 #ifndef function1_H
76 #define function1_H
77 
78 #include "saturationModel.H"
79 #include "Function1.H"
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83 namespace Foam
84 {
85 namespace saturationModels
86 {
87 
88 /*---------------------------------------------------------------------------*\
89  Class function1 Declaration
90 \*---------------------------------------------------------------------------*/
91 
92 class function1
93 :
94  public saturationModel
95 {
96  // Private data
97 
98  //- Saturation temperature as a function of pressure
99  autoPtr<Function1<scalar>> function_;
100 
101 
102 public:
103 
104  //- Runtime type information
105  TypeName("function1");
106 
107  // Constructors
108 
109  //- Construct from a dictionary
110  function1(const dictionary& dict, const objectRegistry& db);
111 
112 
113  //- Destructor
114  virtual ~function1();
115 
116 
117  // Member Functions
118 
119  //- Saturation pressure
120  virtual tmp<volScalarField> pSat(const volScalarField& T) const;
121 
122  //- Saturation pressure derivetive w.r.t. temperature
123  virtual tmp<volScalarField> pSatPrime(const volScalarField& T) const;
124 
125  //- Natural log of the saturation pressure
126  virtual tmp<volScalarField> lnPSat(const volScalarField& T) const;
127 
128  //- Saturation temperature
129  virtual tmp<volScalarField> Tsat(const volScalarField& p) const;
130 };
131 
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 } // End namespace saturationModels
136 } // End namespace Foam
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 #endif
141 
142 // ************************************************************************* //
dictionary dict
virtual tmp< volScalarField > pSatPrime(const volScalarField &T) const
Saturation pressure derivetive w.r.t. temperature.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual tmp< volScalarField > Tsat(const volScalarField &p) const
Saturation temperature.
TypeName("function1")
Runtime type information.
virtual ~function1()
Destructor.
virtual tmp< volScalarField > pSat(const volScalarField &T) const
Saturation pressure.
function1(const dictionary &dict, const objectRegistry &db)
Construct from a dictionary.
Saturation vapour temperature in terms of the vapour pressure (in Pa). The saturation temperature in ...
Definition: function1.H:91
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
volScalarField & p
A class for managing temporary objects.
Definition: PtrList.H:53
Registry of regIOobjects.
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:361
virtual tmp< volScalarField > lnPSat(const volScalarField &T) const
Natural log of the saturation pressure.
Namespace for OpenFOAM.