APIdiffCoefFunc.H
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) 2011-2018 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 dictionary
84 
85 
86  // Member Functions
87 
88  //- API vapour mass diffusivity function using properties from
89  // construction
90  scalar f(scalar p, scalar T) const
91  {
92  return 3.6059e-3*(pow(1.8*T, 1.75))*alpha_/(p*beta_);
93  }
94 
95  //- API vapour mass diffusivity function using properties from
96  // construction - with specified binary pair
97  scalar f(scalar p, scalar T, scalar Wa) const
98  {
99  const scalar alphaBinary = sqrt(1/wf_ + 1/Wa);
100  return 3.6059e-3*(pow(1.8*T, 1.75))*alphaBinary/(p*beta_);
101  }
102 
103  //- Write the function coefficients
104  void writeData(Ostream& os) const
105  {
106  os << a_ << token::SPACE
107  << b_ << token::SPACE
108  << wf_ << token::SPACE
109  << wa_;
110  }
111 
112 
113  // Ostream Operator
115  friend Ostream& operator<<(Ostream& os, const APIdiffCoefFunc& f)
116  {
117  f.writeData(os);
118  return os;
119  }
120 };
121 
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 } // End namespace Foam
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 #endif
130 
131 // ************************************************************************* //
dictionary dict
scalar f(scalar p, scalar T) const
API vapour mass diffusivity function using properties from.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
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
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.
void writeData(Ostream &os) const
Write the function coefficients.
API function for vapour mass diffusivity.
volScalarField & p
friend Ostream & operator<<(Ostream &os, const APIdiffCoefFunc &f)
Namespace for OpenFOAM.