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-2023 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 dictionary& dict
47 )
48 :
49  NonUniformTable<scalar>(name, dict),
50  intf_(values().size()),
51  intfByT_(values().size())
52 {
53  intf_[0] = 0;
54  intfByT_[0] = 0;
55 
56  for(label i = 0; i<intf_.size() - 1; i++)
57  {
58  intf_[i + 1] = intfdT(values()[i + 1].first());
59  intfByT_[i + 1] = intfByTdT(values()[i + 1].first());
60  }
61 
62  const scalar intfStd = intfdT(Tstd);
63  const scalar intfByTStd = intfByTdT(Tstd);
64 
65  forAll(intf_, i)
66  {
67  intf_[i] -= intfStd;
68  intfByT_[i] -= intfByTStd;
69  }
70 }
71 
72 
73 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
74 
76 (
77  scalar T
78 ) const
79 {
80  const label i = index(T);
81  const scalar Ti = values()[i].first();
82  const scalar fi = values()[i].second();
83  const scalar dT = T - Ti;
84  const scalar lambda = dT/(values()[i + 1].first() - Ti);
85 
86  return
87  intf_[i]
88  + (fi + 0.5*lambda*(values()[i + 1].second() - fi))*dT;
89 }
90 
91 
93 (
94  scalar T
95 ) const
96 {
97  const label i = index(T);
98  const scalar Ti = values()[i].first();
99  const scalar fi = values()[i].second();
100  const scalar gradf =
101  (values()[i + 1].second() - fi)/(values()[i + 1].first() - Ti);
102 
103  return
104  intfByT_[i] + ((fi - gradf*Ti)*log(T/Ti) + gradf*(T - Ti));
105 }
106 
107 
109 (
110  Ostream& os
111 ) const
112 {
114 }
115 
116 
117 // ************************************************************************* //
#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
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 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
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:160
A class for handling words, derived from string.
Definition: word.H:62
dimensionedScalar lambda(viscosity->lookup("lambda"))
makeScalarFunction1(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
dimensionedScalar log(const dimensionedScalar &ds)
labelList first(const UList< labelPair > &p)
Definition: patchToPatch.C:39
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dictionary dict