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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::saturationModels::function1
28
29Description
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
72SourceFiles
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
85namespace Foam
86{
87namespace saturationModels
88{
89
90/*---------------------------------------------------------------------------*\
91 Class function1 Declaration
92\*---------------------------------------------------------------------------*/
94class 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
104public:
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// ************************************************************************* //
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition: IOobject.C:500
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Registry of regIOobjects.
Saturation vapour temperature in terms of the vapour pressure (in Pa). The saturation temperature in ...
Definition: function1.H:96
TypeName("function1")
Runtime type information.
virtual tmp< volScalarField > lnPSat(const volScalarField &T) const
Natural log of the saturation pressure.
Definition: function1.C:91
virtual tmp< volScalarField > Tsat(const volScalarField &p) const
Saturation temperature.
Definition: function1.C:102
virtual tmp< volScalarField > pSatPrime(const volScalarField &T) const
Saturation pressure derivetive w.r.t. temperature.
Definition: function1.C:80
virtual tmp< volScalarField > pSat(const volScalarField &T) const
Saturation pressure.
Definition: function1.C:69
virtual ~function1()
Destructor.
Definition: function1.C:61
A class for managing temporary objects.
Definition: tmp.H:65
volScalarField & p
const volScalarField & T
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73