From Niklas Nordin:
[OpenFOAM-1.5.x.git] / src / thermophysicalModels / liquids / CH4N2O / CH4N2O.H
blob2b5b4f4ae5259d787b165eb4777ddb913bf727f6
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::CH4N2O
28 Description
29     urea, note that some of the properties are unavailable in the literature and have been copied from water.
31 SourceFiles
32     CH4N2O.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef CH4N2O_H
37 #define CH4N2O_H
39 #include "liquid.H"
40 #include "NSRDSfunc0.H"
41 #include "NSRDSfunc1.H"
42 #include "NSRDSfunc2.H"
43 #include "NSRDSfunc3.H"
44 #include "NSRDSfunc4.H"
45 #include "NSRDSfunc5.H"
46 #include "NSRDSfunc6.H"
47 #include "NSRDSfunc7.H"
48 #include "NSRDSfunc14.H"
49 #include "APIdiffCoefFunc.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 namespace Foam
56 /*---------------------------------------------------------------------------*\
57                            Class CH4N2O Declaration
58 \*---------------------------------------------------------------------------*/
60 class CH4N2O
62     public liquid
64     // Private data
66         NSRDSfunc0 rho_;
67         NSRDSfunc1 pv_;
68         NSRDSfunc6 hl_;
69         NSRDSfunc0 cp_;
70         NSRDSfunc0 h_;
71         NSRDSfunc7 cpg_;
72         NSRDSfunc4 B_;
73         NSRDSfunc1 mu_;
74         NSRDSfunc2 mug_;
75         NSRDSfunc0 K_;
76         NSRDSfunc2 Kg_;
77         NSRDSfunc6 sigma_;
78         APIdiffCoefFunc D_;
80 public:
82     //- Runtime type information
83     TypeName("CH4N2O");
86     // Constructors
88         //- Construct null
89         CH4N2O()
90         :
91             liquid(60.056, 705.0, 9.050e+6, 0.218, 0.337, 405.85, 9.3131e+1, 465.0, 1.52e-29, 0.3449, 4.7813e+4),
92             rho_(1230.006936, 0, 0, 0, 0, 0),
93             pv_(3015.15611544, -185497.059684, -430.223621983, 0.00017405122622, 2.0),
94             hl_(705.0, 2534249.0, 0.5, 0.0, 0.0, 0.0),
95             cp_(2006.46063673904, 0, 0, 0, 0, 0),
96             h_(-6154107.41641135, 2006.46063673904, 0, 0, 0, 0),
97             cpg_(811.875582789397, 2099.04089516451, 1627.3, 1603.63660583455, 724.41),
98             B_(-0.000383641934194752, 0.447249234048222, -469062.208605302, 5.5628080458239e+18, -2.3040162514986e+21),
99             mu_(-51.964, 3670.6, 5.7331, -5.3495e-29, 10),
100             mug_(2.6986e-06, 0.498, 1257.7, -19570),
101             K_(-0.4267, 0.0056903, -8.0065e-06, 1.815e-09, 0, 0),
102             Kg_(6.977e-05, 1.1243, 844.9, -148850),
103             sigma_(705.0, 1.0, 0.0, 0.0, 0.0, 0), // set to constant
104             D_(147.18, 20.1, 60.056, 28) // Same as nHeptane
105         {}
106         CH4N2O
107         (
108             const liquid& l,
109             const NSRDSfunc0& density,
110             const NSRDSfunc1& vapourPressure,
111             const NSRDSfunc6& heatOfVapourisation,
112             const NSRDSfunc0& heatCapacity,
113             const NSRDSfunc0& enthalpy,
114             const NSRDSfunc7& idealGasHeatCapacity,
115             const NSRDSfunc4& secondVirialCoeff,
116             const NSRDSfunc1& dynamicViscosity,
117             const NSRDSfunc2& vapourDynamicViscosity,
118             const NSRDSfunc0& thermalConductivity,
119             const NSRDSfunc2& vapourThermalConductivity,
120             const NSRDSfunc6& surfaceTension,
121             const APIdiffCoefFunc& vapourDiffussivity
122         )
123         :
124             liquid(l),
125             rho_(density),
126             pv_(vapourPressure),
127             hl_(heatOfVapourisation),
128             cp_(heatCapacity),
129             h_(enthalpy),
130             cpg_(idealGasHeatCapacity),
131             B_(secondVirialCoeff),
132             mu_(dynamicViscosity),
133             mug_(vapourDynamicViscosity),
134             K_(thermalConductivity),
135             Kg_(vapourThermalConductivity),
136             sigma_(surfaceTension),
137             D_(vapourDiffussivity)
138         {}
140         //- Construct from Istream
141         CH4N2O(Istream& is)
142         :
143             liquid(is),
144             rho_(is),
145             pv_(is),
146             hl_(is),
147             cp_(is),
148             h_(is),
149             cpg_(is),
150             B_(is),
151             mu_(is),
152             mug_(is),
153             K_(is),
154             Kg_(is),
155             sigma_(is),
156             D_(is)
157         {}
160     // Member Functions
162         //- Liquid density [kg/m^3]
163         scalar rho(scalar p, scalar T) const
164         {
165             return rho_.f(p, T);
166         }
168         //- Vapour pressure [Pa]
169         scalar pv(scalar p, scalar T) const
170         {
171             return pv_.f(p, T);
172         }
174         //- Heat of vapourisation [J/kg]
175         scalar hl(scalar p, scalar T) const
176         {
177             return hl_.f(p, T);
178         }
180         //- Liquid heat capacity [J/(kg K)]
181         scalar cp(scalar p, scalar T) const
182         {
183             return cp_.f(p, T);
184         }
186         //- Liquid Enthalpy [J/(kg)]
187         scalar h(scalar p, scalar T) const
188         {
189             return h_.f(p, T);
190         }
192         //- Ideal gas heat capacity [J/(kg K)]
193         scalar cpg(scalar p, scalar T) const
194         {
195             return cpg_.f(p, T);
196         }
198         //- Second Virial Coefficient [m^3/kg]
199         scalar B(scalar p, scalar T) const
200         {
201             return B_.f(p, T);
202         }
204         //- Liquid viscosity [Pa s]
205         scalar mu(scalar p, scalar T) const
206         {
207             return mu_.f(p, T);
208         }
210         //- Vapour viscosity [Pa s]
211         scalar mug(scalar p, scalar T) const
212         {
213             return mug_.f(p, T);
214         }
216         //- Liquid thermal conductivity  [W/(m K)]
217         scalar K(scalar p, scalar T) const
218         {
219             return K_.f(p, T);
220         }
222         //- Vapour thermal conductivity  [W/(m K)]
223         scalar Kg(scalar p, scalar T) const
224         {
225             return Kg_.f(p, T);
226         }
228         //- Surface tension [N/m]
229         scalar sigma(scalar p, scalar T) const
230         {
231             return sigma_.f(p, T);
232         }
234         //- Vapour diffussivity [m2/s]
235         scalar D(scalar p, scalar T) const
236         {
237             return D_.f(p, T);
238         }
241         //- Write the function coefficients
242         void writeData(Ostream& os) const
243         {
244             liquid::writeData(os); os << nl;
245             rho_.writeData(os); os << nl;
246             pv_.writeData(os); os << nl;
247             hl_.writeData(os); os << nl;
248             cp_.writeData(os); os << nl;
249             cpg_.writeData(os); os << nl;
250             B_.writeData(os); os << nl;
251             mu_.writeData(os); os << nl;
252             mug_.writeData(os); os << nl;
253             K_.writeData(os); os << nl;
254             Kg_.writeData(os); os << nl;
255             sigma_.writeData(os); os << nl;
256             D_.writeData(os); os << endl;
257         }
260     // Ostream Operator
262         friend Ostream& operator<<(Ostream& os, const CH4N2O& l)
263         {
264             l.writeData(os);
265             return os;
266         }
270 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
272 } // End namespace Foam
274 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276 #endif
278 // ************************************************************************* //