APIdiffCoefFunc.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 | Copyright (C) 2011 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 Class
25  Foam::APIdiffCoefFunc
26 
27 Description
28  API function for vapour mass diffusivity
29 
30  Source:
31  \verbatim
32  API (American Petroleum Institute)
33  Technical Data Book
34  \endverbatim
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef APIdiffCoefFunc_H
39 #define APIdiffCoefFunc_H
40 
41 #include "thermophysicalFunction.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class APIdiffCoefFunc Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class APIdiffCoefFunc
53 :
55 {
56  // Private data
57 
58  // API vapour mass diffusivity function coefficients
59  scalar a_, b_, wf_, wa_;
60 
61  // Helper variables
62  scalar alpha_, beta_;
63 
64 
65 public:
66 
67  //- Runtime type information
68  TypeName("APIdiffCoefFunc");
69 
70 
71  // Constructors
72 
73  //- Construct from components
75  (
76  const scalar a,
77  const scalar b,
78  const scalar wf,
79  const scalar wa
80  );
81 
82  //- Construct from Istream
84 
85  //- Construct from dictionary
87 
88 
89  // Member Functions
90 
91  //- API vapour mass diffusivity function using properties from
92  // construction
93  scalar f(scalar p, scalar T) const
94  {
95  return 3.6059e-3*(pow(1.8*T, 1.75))*alpha_/(p*beta_);
96  }
97 
98  //- API vapour mass diffusivity function using properties from
99  // construction - with specified binary pair
100  scalar f(scalar p, scalar T, scalar Wa) const
101  {
102  const scalar alphaBinary = sqrt(1/wf_ + 1/Wa);
103  return 3.6059e-3*(pow(1.8*T, 1.75))*alphaBinary/(p*beta_);
104  }
105 
106  //- Write the function coefficients
107  void writeData(Ostream& os) const
108  {
109  os << a_ << token::SPACE
110  << b_ << token::SPACE
111  << wf_ << token::SPACE
112  << wa_;
113  }
114 
115 
116  // Ostream Operator
118  friend Ostream& operator<<(Ostream& os, const APIdiffCoefFunc& f)
119  {
120  f.writeData(os);
121  return os;
122  }
123 };
124 
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 } // End namespace Foam
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 #endif
133 
134 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
dimensionedScalar sqrt(const dimensionedScalar &ds)
APIdiffCoefFunc(const scalar a, const scalar b, const scalar wf, const scalar wa)
Construct from components.
Abstract base class for thermo-physical functions.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
void writeData(Ostream &os) const
Write the function coefficients.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
TypeName("APIdiffCoefFunc")
Runtime type information.
API function for vapour mass diffusivity.
volScalarField & p
friend Ostream & operator<<(Ostream &os, const APIdiffCoefFunc &f)
scalar f(scalar p, scalar T) const
API vapour mass diffusivity function using properties from.
Namespace for OpenFOAM.