Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::APIdiffCoefFunc
28
29Description
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
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49
50/*---------------------------------------------------------------------------*\
51 Class APIdiffCoefFunc Declaration
52\*---------------------------------------------------------------------------*/
53
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_;
66
67public:
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 }
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 }
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
125// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126
127} // End namespace Foam
128
129// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130
131#endif
132
133// ************************************************************************* //
void writeData(Ostream &os) const
Write the function coefficients.
APIdiffCoefFunc(const scalar a, const scalar b, const scalar wf, const scalar wa)
Construct from components.
scalar f(scalar p, scalar T) const
API vapour mass diffusivity function using properties from.
friend Ostream & operator<<(Ostream &os, const APIdiffCoefFunc &f)
scalar f(scalar p, scalar T, scalar Wa) const
API vapour mass diffusivity function using properties from.
TypeName("APIdiffCoefFunc")
Runtime type information.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
@ SPACE
Space [isspace].
Definition token.H:144
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
dimensionedScalar sqrt(const dimensionedScalar &ds)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dictionary dict
volScalarField & b
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68