OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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