absorptionCoeffs.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2015 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 
26 #include "absorptionCoeffs.H"
27 #include "IOstreams.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
32 :
33  Tcommon_(readScalar(is)),
34  Tlow_(readScalar(is)),
35  Thigh_(readScalar(is)),
36  invTemp_(readBool(is))
37 {
38  for (label coefLabel=0; absorptionCoeffs::nCoeffs_; coefLabel++)
39  {
40  is >> highACoeffs_[coefLabel];
41  }
42 
43  for (label coefLabel=0; absorptionCoeffs::nCoeffs_; coefLabel++)
44  {
45  is >> lowACoeffs_[coefLabel];
46  }
47 }
48 
49 
50 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
51 
53 {}
54 
55 
56 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
57 
59 {
60  if (T < Tlow_ || T > Thigh_)
61  {
63  << "usinf absCoeff out of temperature range:" << nl
64  << " " << Tlow_ << " -> " << Thigh_ << "; T = " << T
65  << nl << endl;
66  }
67 }
68 
69 
72 (
73  const scalar T
74 ) const
75 {
76  checkT(T);
77 
78  if (T < Tcommon_)
79  {
80  return lowACoeffs_;
81  }
82  else
83  {
84  return highACoeffs_;
85  }
86 }
87 
88 
90 {
92 }
93 
94 
96 {
97  dict.lookup("Tcommon") >> Tcommon_;
98  dict.lookup("Tlow") >> Tlow_;
99  dict.lookup("Thigh") >> Thigh_;
100  dict.lookup("invTemp") >> invTemp_;
101 
102  dict.lookup("loTcoeffs") >> lowACoeffs_;
103  dict.lookup("hiTcoeffs") >> highACoeffs_;
104 }
105 
106 
107 // ************************************************************************* //
Foam::radiation::absorptionCoeffs::coeffs
const coeffArray & coeffs(const scalar T) const
Return the coefficients corresponding to the given temperature.
Definition: absorptionCoeffs.C:72
Foam::radiation::absorptionCoeffs::highACoeffs_
coeffArray highACoeffs_
Definition: absorptionCoeffs.H:78
IOstreams.H
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Foam::radiation::absorptionCoeffs
Definition: absorptionCoeffs.H:52
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::radiation::absorptionCoeffs::nCoeffs_
static const int nCoeffs_
Definition: absorptionCoeffs.H:58
Foam::radiation::absorptionCoeffs::checkT
void checkT(const scalar T) const
Check given temperature is within the range of the fitted coeffs.
Definition: absorptionCoeffs.C:58
Foam::radiation::absorptionCoeffs::initialise
void initialise(const dictionary &)
Definition: absorptionCoeffs.C:95
Foam::radiation::absorptionCoeffs::absorptionCoeffs
absorptionCoeffs()
Definition: absorptionCoeffs.H:96
Foam::label
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
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:55
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
readScalar
#define readScalar
Definition: doubleScalar.C:38
Foam::FixedList< scalar, nCoeffs_ >
Foam::readBool
bool readBool(Istream &)
Definition: boolIO.C:60
Foam::radiation::absorptionCoeffs::~absorptionCoeffs
~absorptionCoeffs()
Destructor.
Definition: absorptionCoeffs.C:52
absorptionCoeffs.H
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:259
Foam::radiation::absorptionCoeffs::lowACoeffs_
coeffArray lowACoeffs_
Definition: absorptionCoeffs.H:79