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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::APIdiffCoefFunc
28 
29 Description
30  API function for vapour mass diffusivity
31 
32  Source:
33  \verbatim
34  API (American Petroleum Institute)
35  Technical Data Book
36  \endverbatim
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef APIdiffCoefFunc_H
41 #define APIdiffCoefFunc_H
42 
43 #include "thermophysicalFunction.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class APIdiffCoefFunc Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class APIdiffCoefFunc
55 :
57 {
58  // Private data
59 
60  // API vapour mass diffusivity function coefficients
61  scalar a_, b_, wf_, wa_;
62 
63  // Helper variables
64  scalar alpha_, beta_;
65 
66 
67 public:
68 
69  //- Runtime type information
70  TypeName("APIdiffCoefFunc");
71 
72 
73  // Constructors
74 
75  //- Construct from components
77  (
78  const scalar a,
79  const scalar b,
80  const scalar wf,
81  const scalar wa
82  );
83 
84  //- Construct from dictionary
86 
87 
88  // Member Functions
89 
90  //- API vapour mass diffusivity function using properties from
91  // construction
92  scalar f(scalar p, scalar T) const
93  {
94  return 3.6059e-3*(pow(1.8*T, 1.75))*alpha_/(p*beta_);
95  }
96 
97  //- API vapour mass diffusivity function using properties from
98  // construction - with specified binary pair
99  scalar f(scalar p, scalar T, scalar Wa) const
100  {
101  const scalar alphaBinary = sqrt(1/wf_ + 1/Wa);
102  return 3.6059e-3*(pow(1.8*T, 1.75))*alphaBinary/(p*beta_);
103  }
104 
105  //- Write the function coefficients
106  void writeData(Ostream& os) const
107  {
108  os << a_ << token::SPACE
109  << b_ << token::SPACE
110  << wf_ << token::SPACE
111  << wa_;
112  }
113 
114 
115  // Ostream Operator
116 
117  friend Ostream& operator<<(Ostream& os, const APIdiffCoefFunc& f)
118  {
119  f.writeData(os);
120  return os;
121  }
122 };
123 
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 } // End namespace Foam
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 #endif
132 
133 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::thermophysicalFunction
Abstract base class for thermo-physical functions.
Definition: thermophysicalFunction.H:53
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::APIdiffCoefFunc::APIdiffCoefFunc
APIdiffCoefFunc(const scalar a, const scalar b, const scalar wf, const scalar wa)
Construct from components.
Definition: APIdiffCoefFunc.C:47
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:75
Foam::APIdiffCoefFunc
API function for vapour mass diffusivity.
Definition: APIdiffCoefFunc.H:53
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::APIdiffCoefFunc::writeData
void writeData(Ostream &os) const
Write the function coefficients.
Definition: APIdiffCoefFunc.H:105
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::APIdiffCoefFunc::operator<<
friend Ostream & operator<<(Ostream &os, const APIdiffCoefFunc &f)
Definition: APIdiffCoefFunc.H:116
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:144
Foam::token::SPACE
Space [isspace].
Definition: token.H:118
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::APIdiffCoefFunc::f
scalar f(scalar p, scalar T) const
API vapour mass diffusivity function using properties from.
Definition: APIdiffCoefFunc.H:91
thermophysicalFunction.H
Foam::APIdiffCoefFunc::TypeName
TypeName("APIdiffCoefFunc")
Runtime type information.