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

PhaseChangeModel.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) 2009-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::PhaseChangeModel
00026 
00027 Description
00028     Templated phase change model class
00029 
00030 SourceFiles
00031     PhaseChangeModel.C
00032     NewPhaseChangeModel.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef PhaseChangeModel_H
00037 #define PhaseChangeModel_H
00038 
00039 #include <OpenFOAM/IOdictionary.H>
00040 #include <OpenFOAM/autoPtr.H>
00041 #include <OpenFOAM/runTimeSelectionTables.H>
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 /*---------------------------------------------------------------------------*\
00049                       Class PhaseChangeModel Declaration
00050 \*---------------------------------------------------------------------------*/
00051 
00052 template<class CloudType>
00053 class PhaseChangeModel
00054 {
00055 public:
00056 
00057     // Public enumerations
00058 
00059         //- Enthalpy transfer type
00060         enum enthalpyTransferType
00061         {
00062             etLatentHeat,
00063             etEnthalpyDifference
00064         };
00065 
00066         //- Name representations of enthalpy transfer types
00067         static const Foam::wordList enthalpyTransferTypeNames;
00068 
00069 
00070 protected:
00071 
00072     // Protected data
00073 
00074         //- The cloud dictionary
00075         const dictionary& dict_;
00076 
00077         //- Reference to the owner cloud class
00078         CloudType& owner_;
00079 
00080         //- The coefficient dictionary
00081         const dictionary coeffDict_;
00082 
00083         //- Enthalpy transfer type enumeration
00084         enthalpyTransferType enthalpyTransfer_;
00085 
00086 
00087     // Protected member functions
00088 
00089         //- Convert word to enthalpy transfer type
00090         enthalpyTransferType wordToEnthalpyTransfer(const word& etName) const;
00091 
00092         //- Sherwood number
00093         scalar Sh() const;
00094 
00095 
00096 public:
00097 
00098     //- Runtime type information
00099     TypeName("PhaseChangeModel");
00100 
00101     //- Declare runtime constructor selection table
00102     declareRunTimeSelectionTable
00103     (
00104         autoPtr,
00105         PhaseChangeModel,
00106         dictionary,
00107         (
00108             const dictionary& dict,
00109             CloudType& owner
00110         ),
00111         (dict, owner)
00112     );
00113 
00114 
00115     // Constructors
00116 
00117         //- Construct null from owner
00118         PhaseChangeModel(CloudType& owner);
00119 
00120         //- Construct from dictionary
00121         PhaseChangeModel
00122         (
00123             const dictionary& dict,
00124             CloudType& owner,
00125             const word& type
00126         );
00127 
00128 
00129     //- Destructor
00130     virtual ~PhaseChangeModel();
00131 
00132 
00133     //- Selector
00134     static autoPtr<PhaseChangeModel<CloudType> > New
00135     (
00136         const dictionary& dict,
00137         CloudType& owner
00138     );
00139 
00140 
00141     // Access
00142 
00143         //- Return the owner cloud object
00144         const CloudType& owner() const;
00145 
00146         //- Return the cloud dictionary
00147         const dictionary& dict() const;
00148 
00149         //- Return the coefficient dictionary
00150         const dictionary& coeffDict() const;
00151 
00152         //- Return the enthalpy transfer type enumeration
00153         const enthalpyTransferType& enthalpyTransfer() const;
00154 
00155 
00156     // Member Functions
00157 
00158         //- Flag to indicate whether model activates phase change model
00159         virtual bool active() const = 0;
00160 
00161         //- Update model
00162         virtual void calculate
00163         (
00164             const scalar dt,
00165             const label cellI,
00166             const scalar Re,
00167             const scalar d,
00168             const scalar nu,
00169             const scalar T,
00170             const scalar Ts,
00171             const scalar pc,
00172             scalarField& dMassPC
00173         ) const = 0;
00174 };
00175 
00176 
00177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00178 
00179 } // End namespace Foam
00180 
00181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00182 
00183 #define makePhaseChangeModel(CloudType)                                       \
00184                                                                               \
00185     defineNamedTemplateTypeNameAndDebug(PhaseChangeModel<CloudType>, 0);      \
00186                                                                               \
00187     defineTemplateRunTimeSelectionTable                                       \
00188     (                                                                         \
00189         PhaseChangeModel<CloudType>,                                          \
00190         dictionary                                                            \
00191     );
00192 
00193 
00194 #define makePhaseChangeModelThermoType(SS, CloudType, ParcelType, ThermoType) \
00195                                                                               \
00196     defineNamedTemplateTypeNameAndDebug                                       \
00197     (                                                                         \
00198         SS<CloudType<ParcelType<ThermoType> > >,                              \
00199         0                                                                     \
00200     );                                                                        \
00201                                                                               \
00202     PhaseChangeModel<CloudType<ParcelType<ThermoType> > >::                   \
00203         adddictionaryConstructorToTable                                       \
00204             <SS<CloudType<ParcelType<ThermoType> > > >                        \
00205             add##SS##CloudType##ParcelType##ThermoType##ConstructorToTable_;
00206 
00207 
00208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00209 
00210 #ifdef NoRepository
00211 #   include "PhaseChangeModel.C"
00212 #endif
00213 
00214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00215 
00216 #endif
00217 
00218 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines