function1.H
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) 2017-2018 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::saturationModels::function1
28 
29 Description
30  Saturation vapour temperature in terms of
31  the vapour pressure (in Pa). The saturation temperature in Kelvins is
32  specified as a Foam::Function1 type, to enable use of, e.g. constant,
33  polynomial, table values.
34 
35  Currently this class only provides \f$T_sat\f$, the inverse function to
36  return the vapour pressure for a given temperature are not implemented.
37 
38  Examples:
39 
40  \verbatim
41  type function1;
42  function polynomial
43  (
44  (308.0422 0)
45  (0.0015096 1)
46  (-1.61589e-8 2)
47  (1.114106e-13 3)
48  (-4.52216e-19 4)
49  (1.05192e-24 5)
50  (-1.2953e-30 6)
51  (6.5365e-37 7)
52  )
53  \endverbatim
54 
55  \verbatim
56  type function1;
57 
58  function csvFile;
59  functionCoeffs
60  {
61  nHeaderLine 1;
62  refColumn 0;
63  componentColumns (1);
64  separator ",";
65  mergeSeparators no;
66  file "filename.csv";
67  outOfBounds clamp;
68  interpolationScheme linear;
69  };
70  \endverbatim
71 
72 SourceFiles
73  function1.C
74 
75 \*---------------------------------------------------------------------------*/
76 
77 #ifndef saturationModels_function1_H
78 #define saturationModels_function1_H
79 
80 #include "saturationModel.H"
81 #include "Function1.H"
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 namespace Foam
86 {
87 namespace saturationModels
88 {
89 
90 /*---------------------------------------------------------------------------*\
91  Class function1 Declaration
92 \*---------------------------------------------------------------------------*/
93 
94 class function1
95 :
96  public saturationModel
97 {
98  // Private data
99 
100  //- Saturation temperature as a function of pressure
101  autoPtr<Function1<scalar>> function_;
102 
103 
104 public:
105 
106  //- Runtime type information
107  TypeName("function1");
108 
109  // Constructors
110 
111  //- Construct from a dictionary
112  function1(const dictionary& dict, const objectRegistry& db);
113 
114 
115  //- Destructor
116  virtual ~function1();
117 
118 
119  // Member Functions
120 
121  //- Saturation pressure
122  virtual tmp<volScalarField> pSat(const volScalarField& T) const;
123 
124  //- Saturation pressure derivetive w.r.t. temperature
125  virtual tmp<volScalarField> pSatPrime(const volScalarField& T) const;
126 
127  //- Natural log of the saturation pressure
128  virtual tmp<volScalarField> lnPSat(const volScalarField& T) const;
129 
130  //- Saturation temperature
131  virtual tmp<volScalarField> Tsat(const volScalarField& p) const;
132 };
133 
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 } // End namespace saturationModels
138 } // End namespace Foam
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 #endif
143 
144 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::saturationModels::function1::~function1
virtual ~function1()
Destructor.
Definition: function1.C:61
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::saturationModels::function1::function1
function1(const dictionary &dict, const objectRegistry &db)
Construct from a dictionary.
Definition: function1.C:46
Foam::saturationModel
Definition: saturationModel.H:53
Function1.H
Foam::saturationModels::function1::pSat
virtual tmp< volScalarField > pSat(const volScalarField &T) const
Saturation pressure.
Definition: function1.C:69
Foam::saturationModels::function1::pSatPrime
virtual tmp< volScalarField > pSatPrime(const volScalarField &T) const
Saturation pressure derivetive w.r.t. temperature.
Definition: function1.C:80
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
saturationModel.H
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::saturationModels::function1::Tsat
virtual tmp< volScalarField > Tsat(const volScalarField &p) const
Saturation temperature.
Definition: function1.C:102
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::saturationModels::function1::TypeName
TypeName("function1")
Runtime type information.
Foam::saturationModels::function1
Saturation vapour temperature in terms of the vapour pressure (in Pa). The saturation temperature in ...
Definition: function1.H:93
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::saturationModels::function1::lnPSat
virtual tmp< volScalarField > lnPSat(const volScalarField &T) const
Natural log of the saturation pressure.
Definition: function1.C:91
Foam::IOobject::db
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition: IOobject.C:487