FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

APIdiffCoefFunc.H

Go 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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::APIdiffCoefFunc
00026 
00027 Description
00028     API function for vapour mass diffusivity
00029 
00030     Source:
00031     @verbatim
00032             API (American Petroleum Institute)
00033                     Technical Data Book
00034     @endverbatim
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef APIdiffCoefFunc_H
00039 #define APIdiffCoefFunc_H
00040 
00041 #include <thermophysicalFunctions/thermophysicalFunction.H>
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 /*---------------------------------------------------------------------------*\
00049                       Class APIdiffCoefFunc Declaration
00050 \*---------------------------------------------------------------------------*/
00051 
00052 class APIdiffCoefFunc
00053 :
00054     public thermophysicalFunction
00055 {
00056     // Private data
00057 
00058         // API vapour mass diffusivity function coefficients
00059         scalar a_, b_, wf_, wa_;
00060 
00061         // Helper variables
00062         scalar alpha_, beta_;
00063 
00064 
00065 public:
00066 
00067     //- Runtime type information
00068     TypeName("APIdiffCoefFunc");
00069 
00070 
00071     // Constructors
00072 
00073         //- Construct from components
00074         APIdiffCoefFunc(scalar a, scalar b, scalar wf, scalar wa)
00075         :
00076             a_(a),
00077             b_(b),
00078             wf_(wf),
00079             wa_(wa),
00080             alpha_(sqrt(1/wf_ + 1/wa_)),
00081             beta_(sqr(cbrt(a_) + cbrt(b_)))
00082         {}
00083 
00084         //- Construct from Istream
00085         APIdiffCoefFunc(Istream& is)
00086         :
00087             a_(readScalar(is)),
00088             b_(readScalar(is)),
00089             wf_(readScalar(is)),
00090             wa_(readScalar(is)),
00091             alpha_(sqrt(1/wf_ + 1/wa_)),
00092             beta_(sqr((cbrt(a_) + cbrt(b_))))
00093         {}
00094 
00095 
00096     // Member Functions
00097 
00098         //- API vapour mass diffusivity function using properties from
00099         //  construction
00100         scalar f(scalar p, scalar T) const
00101         {
00102             return 3.6059e-3*(pow(1.8*T, 1.75))*alpha_/(p*beta_);
00103         }
00104 
00105         //- API vapour mass diffusivity function using properties from
00106         //  construction - with specified binary pair
00107         scalar f(scalar p, scalar T, scalar  Wa) const
00108         {
00109             const scalar alphaBinary = sqrt(1/wf_ + 1/Wa);
00110             return 3.6059e-3*(pow(1.8*T, 1.75))*alphaBinary/(p*beta_);
00111         }
00112 
00113         //- Write the function coefficients
00114         void writeData(Ostream& os) const
00115         {
00116             os  << a_ << token::SPACE
00117                 << b_ << token::SPACE
00118                 << wf_ << token::SPACE
00119                 << wa_;
00120         }
00121 
00122 
00123     // Ostream Operator
00124 
00125         friend Ostream& operator<<(Ostream& os, const APIdiffCoefFunc& f)
00126         {
00127             f.writeData(os);
00128             return os;
00129         }
00130 };
00131 
00132 
00133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00134 
00135 } // End namespace Foam
00136 
00137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00138 
00139 #endif
00140 
00141 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines