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

multiphaseMixture.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::multiphaseMixture
00026 
00027 Description
00028     Incompressible multi-phase mixture with built in solution for the
00029     phase fractions with interface compression for interface-capturing.
00030 
00031     Derived from transportModel so that it can be unsed in conjunction with
00032     the incompressible turbulence models.
00033 
00034     Surface tension and contact-angle is handled for the interface
00035     between each phase-pair.
00036 
00037 SourceFiles
00038     multiphaseMixture.C
00039 
00040 \*---------------------------------------------------------------------------*/
00041 
00042 #ifndef multiphaseMixture_H
00043 #define multiphaseMixture_H
00044 
00045 #include <incompressibleTransportModels/transportModel.H>
00046 #include <multiphaseMixture/phase.H>
00047 #include <OpenFOAM/PtrDictionary.H>
00048 #include <finiteVolume/volFields.H>
00049 #include <finiteVolume/surfaceFields.H>
00050 #include <finiteVolume/multivariateSurfaceInterpolationScheme.H>
00051 
00052 
00053 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00054 
00055 namespace Foam
00056 {
00057 
00058 /*---------------------------------------------------------------------------*\
00059                       Class multiphaseMixture Declaration
00060 \*---------------------------------------------------------------------------*/
00061 
00062 class multiphaseMixture
00063 :
00064     public transportModel
00065 {
00066 public:
00067 
00068     class interfacePair
00069     :
00070         public Pair<word>
00071     {
00072     public:
00073 
00074         class hash
00075         :
00076             public Hash<interfacePair>
00077         {
00078         public:
00079 
00080             hash()
00081             {}
00082 
00083             label operator()(const interfacePair& key) const
00084             {
00085                 return word::hash()(key.first()) + word::hash()(key.second());
00086             }
00087         };
00088 
00089 
00090         // Constructors
00091 
00092             interfacePair()
00093             {}
00094 
00095             interfacePair(const word& alpha1Name, const word& alpha2Name)
00096             :
00097                 Pair<word>(alpha1Name, alpha2Name)
00098             {}
00099 
00100             interfacePair(const phase& alpha1, const phase& alpha2)
00101             :
00102                 Pair<word>(alpha1.name(), alpha2.name())
00103             {}
00104 
00105 
00106         // Friend Operators
00107 
00108             friend bool operator==
00109             (
00110                 const interfacePair& a,
00111                 const interfacePair& b
00112             )
00113             {
00114                 return
00115                 (
00116                     ((a.first() == b.first()) && (a.second() == b.second()))
00117                  || ((a.first() == b.second()) && (a.second() == b.first()))
00118                 );
00119             }
00120 
00121             friend bool operator!=
00122             (
00123                 const interfacePair& a,
00124                 const interfacePair& b
00125             )
00126             {
00127                 return (!(a == b));
00128             }
00129     };
00130 
00131 
00132 private:
00133 
00134     // Private data
00135 
00136         //- Dictionary of phases
00137         PtrDictionary<phase> phases_;
00138 
00139         //- The phase chosen as reference, the one which is derived from
00140         //  the others such thatr they sum to 1
00141         phase& refPhase_;
00142 
00143         const fvMesh& mesh_;
00144         const volVectorField& U_;
00145         const surfaceScalarField& phi_;
00146 
00147         surfaceScalarField rhoPhi_;
00148 
00149         volScalarField alphas_;
00150 
00151         typedef HashTable<scalar, interfacePair, interfacePair::hash>
00152             sigmaTable;
00153 
00154         sigmaTable sigmas_;
00155         dimensionSet dimSigma_;
00156 
00157         //- Stabilisation for normalisation of the interface normal
00158         const dimensionedScalar deltaN_;
00159 
00160         //- Conversion factor for degrees into radians
00161         static const scalar convertToRad;
00162 
00163         //- Phase-fraction field table for multivariate discretisation
00164         multivariateSurfaceInterpolationScheme<scalar>::fieldTable alphaTable_;
00165 
00166 
00167     // Private member functions
00168 
00169         void calcAlphas();
00170 
00171         void solveAlphas
00172         (
00173             const label nAlphaCorr,
00174             const bool cycleAlpha,
00175             const scalar cAlpha
00176         );
00177 
00178         tmp<surfaceVectorField> nHatfv
00179         (
00180             const volScalarField& alpha1,
00181             const volScalarField& alpha2
00182         ) const;
00183 
00184         tmp<surfaceScalarField> nHatf
00185         (
00186             const volScalarField& alpha1,
00187             const volScalarField& alpha2
00188         ) const;
00189 
00190         void correctContactAngle
00191         (
00192             const phase& alpha1,
00193             const phase& alpha2,
00194             surfaceVectorField::GeometricBoundaryField& nHatb
00195         ) const;
00196 
00197         tmp<volScalarField> K(const phase& alpha1, const phase& alpha2) const;
00198 
00199 
00200 public:
00201 
00202     // Constructors
00203 
00204         //- Construct from components
00205         multiphaseMixture
00206         (
00207             const volVectorField& U,
00208             const surfaceScalarField& phi
00209         );
00210 
00211 
00212     // Destructor
00213 
00214         ~multiphaseMixture()
00215         {}
00216 
00217 
00218     // Member Functions
00219 
00220         //- Return the phases
00221         const PtrDictionary<phase>& phases() const
00222         {
00223             return phases_;
00224         }
00225 
00226         //- Return the velocity
00227         const volVectorField& U() const
00228         {
00229             return U_;
00230         }
00231 
00232         //- Return the volumetric flux
00233         const surfaceScalarField& phi() const
00234         {
00235             return phi_;
00236         }
00237 
00238         const surfaceScalarField& rhoPhi() const
00239         {
00240             return rhoPhi_;
00241         }
00242 
00243         //- Return the mixture density
00244         tmp<volScalarField> rho() const;
00245 
00246         //- Return the dynamic laminar viscosity
00247         tmp<volScalarField> mu() const;
00248 
00249         //- Return the face-interpolated dynamic laminar viscosity
00250         tmp<surfaceScalarField> muf() const;
00251 
00252         //- Return the kinematic laminar viscosity
00253         tmp<volScalarField> nu() const;
00254 
00255         //- Return the face-interpolated dynamic laminar viscosity
00256         tmp<surfaceScalarField> nuf() const;
00257 
00258         tmp<surfaceScalarField> surfaceTensionForce() const;
00259 
00260         //- Indicator of the proximity of the interface
00261         //  Field values are 1 near and 0 away for the interface.
00262         tmp<surfaceScalarField> nearInterface() const;
00263 
00264         //- Solve for the mixture phase-fractions
00265         void solve();
00266 
00267         //- Correct the mixture properties
00268         void correct();
00269 
00270         //- Read base transportProperties dictionary
00271         bool read();
00272 };
00273 
00274 
00275 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00276 
00277 } // End namespace Foam
00278 
00279 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00280 
00281 #endif
00282 
00283 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines