integratedNonUniformTable1.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) 2020-2024 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 
27 #include "specie.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace Function1s
35 {
37 }
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
44 (
45  const word& name,
46  const unitConversions& units,
47  const dictionary& dict
48 )
49 :
50  NonUniformTable<scalar>(name, units, dict),
51  intf_(values().size()),
52  intfByT_(values().size())
53 {
54  assertNoConvertUnits(typeName, units, dict);
55 
56  intf_[0] = 0;
57  intfByT_[0] = 0;
58 
59  for(label i = 0; i<intf_.size() - 1; i++)
60  {
61  intf_[i + 1] = intfdT(values()[i + 1].first());
62  intfByT_[i + 1] = intfByTdT(values()[i + 1].first());
63  }
64 
65  const scalar intfStd = intfdT(Tstd);
66  const scalar intfByTStd = intfByTdT(Tstd);
67 
68  forAll(intf_, i)
69  {
70  intf_[i] -= intfStd;
71  intfByT_[i] -= intfByTStd;
72  }
73 }
74 
75 
76 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
77 
79 (
80  scalar T
81 ) const
82 {
83  const label i = index(T);
84  const scalar Ti = values()[i].first();
85  const scalar fi = values()[i].second();
86  const scalar dT = T - Ti;
87  const scalar lambda = dT/(values()[i + 1].first() - Ti);
88 
89  return
90  intf_[i]
91  + (fi + 0.5*lambda*(values()[i + 1].second() - fi))*dT;
92 }
93 
94 
96 (
97  scalar T
98 ) const
99 {
100  const label i = index(T);
101  const scalar Ti = values()[i].first();
102  const scalar fi = values()[i].second();
103  const scalar gradf =
104  (values()[i + 1].second() - fi)/(values()[i + 1].first() - Ti);
105 
106  return
107  intfByT_[i] + ((fi - gradf*Ti)*log(T/Ti) + gradf*(T - Ti));
108 }
109 
110 
112 (
113  Ostream& os,
114  const unitConversions& units
115 ) const
116 {
118 }
119 
120 
121 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
Macros for easy insertion into run-time selection tables.
Non-uniform tabulated property function that linearly interpolates between the values.
void write(Ostream &os, const unitConversions &units) const
Write the function coefficients.
const List< Tuple2< scalar, scalar > > & values() const
Return the non-uniform table of values.
Non-uniform tabulated property function that linearly interpolates between the values.
integratedNonUniformTable(const word &name, const unitConversions &units, const dictionary &dict)
Construct from entry name and dictionary.
scalar intfByTdT(scalar T) const
Integrate the function divided by T and return the result.
void write(Ostream &os, const unitConversions &units) const
Write the function coefficients.
scalar intfdT(scalar T) const
Integrate the function and return the result.
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
A class for handling words, derived from string.
Definition: word.H:62
dimensionedScalar lambda(viscosity->lookup("lambda"))
addScalarFunction1(laminarBL)
const dimensionedScalar Tstd
Standard temperature.
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
dimensionedScalar log(const dimensionedScalar &ds)
labelList first(const UList< labelPair > &p)
Definition: patchToPatch.C:39
const HashTable< unitConversion > & units()
Get the table of unit conversions.
void assertNoConvertUnits(const word &typeName, const Function1s::unitConversions &units, const dictionary &dict)
Generate an error in an context where unit conversions are not supported.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dictionary dict