|
|
|
APIdiffCoefFunc.HGo to the documentation of this file.00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software; you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by the 00013 Free Software Foundation; either version 2 of the License, or (at your 00014 option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM; if not, write to the Free Software Foundation, 00023 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 00025 Class 00026 Foam::APIdiffCoefFunc 00027 00028 Description 00029 API function for vapour mass diffusivity 00030 00031 Source: 00032 @verbatim 00033 API (American Petroleum Institute) 00034 Technical Data Book 00035 @endverbatim 00036 00037 \*---------------------------------------------------------------------------*/ 00038 00039 #ifndef APIdiffCoefFunc_H 00040 #define APIdiffCoefFunc_H 00041 00042 #include "thermophysicalFunction.H" 00043 00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00045 00046 namespace Foam 00047 { 00048 00049 /*---------------------------------------------------------------------------*\ 00050 Class APIdiffCoefFunc Declaration 00051 \*---------------------------------------------------------------------------*/ 00052 00053 class APIdiffCoefFunc 00054 : 00055 public thermophysicalFunction 00056 { 00057 // Private data 00058 00059 // API vapour mass diffusivity function coefficients 00060 scalar a_, b_, wf_, wa_; 00061 00062 // Helper variables 00063 scalar alpha_, beta_; 00064 00065 00066 public: 00067 00068 //- Runtime type information 00069 TypeName("APIdiffCoefFunc"); 00070 00071 00072 // Constructors 00073 00074 //- Construct from components 00075 APIdiffCoefFunc(scalar a, scalar b, scalar wf, scalar wa) 00076 : 00077 a_(a), 00078 b_(b), 00079 wf_(wf), 00080 wa_(wa), 00081 alpha_(sqrt(1/wf_ + 1/wa_)), 00082 beta_(sqr((cbrt(a_) + cbrt(b_)))) 00083 {} 00084 00085 //- Construct from Istream 00086 APIdiffCoefFunc(Istream& is) 00087 : 00088 a_(readScalar(is)), 00089 b_(readScalar(is)), 00090 wf_(readScalar(is)), 00091 wa_(readScalar(is)), 00092 alpha_(sqrt(1/wf_ + 1/wa_)), 00093 beta_(sqr((cbrt(a_) + cbrt(b_)))) 00094 {} 00095 00096 00097 // Member Functions 00098 00099 //- API vapour mass diffusivity function using properties from 00100 // construction 00101 scalar f(scalar p, scalar T) const 00102 { 00103 return 3.6059e-3*(pow(1.8*T, 1.75))*alpha_/(p*beta_); 00104 } 00105 00106 //- Write the function coefficients 00107 void writeData(Ostream& os) const 00108 { 00109 os << a_ << token::SPACE 00110 << b_ << token::SPACE 00111 << wf_ << token::SPACE 00112 << wa_; 00113 } 00114 00115 00116 // Ostream Operator 00117 00118 friend Ostream& operator<<(Ostream& os, const APIdiffCoefFunc& f) 00119 { 00120 f.writeData(os); 00121 return os; 00122 } 00123 }; 00124 00125 00126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00127 00128 } // End namespace Foam 00129 00130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00131 00132 #endif 00133 00134 // ************************************************************************* // |