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

PatchInteractionModel.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) 2008-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::PatchInteractionModel
00026 
00027 Description
00028     Templated patch interaction model class
00029 
00030 SourceFiles
00031     PatchInteractionModel.C
00032     NewPatchInteractionModel.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef PatchInteractionModel_H
00037 #define PatchInteractionModel_H
00038 
00039 #include <OpenFOAM/IOdictionary.H>
00040 #include <OpenFOAM/autoPtr.H>
00041 #include <OpenFOAM/runTimeSelectionTables.H>
00042 #include <OpenFOAM/polyPatch.H>
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 namespace Foam
00047 {
00048 
00049 /*---------------------------------------------------------------------------*\
00050                    Class PatchInteractionModel Declaration
00051 \*---------------------------------------------------------------------------*/
00052 
00053 template<class CloudType>
00054 class PatchInteractionModel
00055 {
00056 public:
00057 
00058     // Public enumerations
00059 
00060         // Interaction types
00061         enum interactionType
00062         {
00063             itRebound,
00064             itStick,
00065             itEscape,
00066             itOther
00067         };
00068 
00069         static wordList interactionTypeNames_;
00070 
00071 
00072 private:
00073 
00074     // Private data
00075 
00076         //- The cloud dictionary
00077         const dictionary& dict_;
00078 
00079         //- Reference to the owner cloud class
00080         CloudType& owner_;
00081 
00082         //- The coefficients dictionary
00083         const dictionary coeffDict_;
00084 
00085 
00086 public:
00087 
00088     //- Runtime type information
00089     TypeName("PatchInteractionModel");
00090 
00091     //- Declare runtime constructor selection table
00092     declareRunTimeSelectionTable
00093     (
00094         autoPtr,
00095         PatchInteractionModel,
00096         dictionary,
00097         (
00098             const dictionary& dict,
00099             CloudType& owner
00100         ),
00101         (dict, owner)
00102     );
00103 
00104 
00105     // Constructors
00106 
00107         //- Construct from components
00108         PatchInteractionModel
00109         (
00110             const dictionary& dict,
00111             CloudType& owner,
00112             const word& type
00113         );
00114 
00115 
00116     //- Destructor
00117     virtual ~PatchInteractionModel();
00118 
00119 
00120     //- Selector
00121     static autoPtr<PatchInteractionModel<CloudType> > New
00122     (
00123         const dictionary& dict,
00124         CloudType& owner
00125     );
00126 
00127 
00128     // Access
00129 
00130         //- Return the owner cloud object
00131         const CloudType& owner() const;
00132 
00133         //- Return the dictionary
00134         const dictionary& dict() const;
00135 
00136         //- Return the coefficients dictionary
00137         const dictionary& coeffDict() const;
00138 
00139 
00140     // Member Functions
00141 
00142         //- Convert interaction result to word
00143         static word interactionTypeToWord(const interactionType& itEnum);
00144 
00145         //- Convert word to interaction result
00146         static interactionType wordToInteractionType(const word& itWord);
00147 
00148         //- Flag to indicate whether model activates patch interaction model
00149         virtual bool active() const = 0;
00150 
00151         //- Apply velocity correction
00152         //  Returns true if particle remains in same cell
00153         virtual bool correct
00154         (
00155             const polyPatch& pp,
00156             const label faceId,
00157             bool& keepParticle,
00158             bool& active,
00159             vector& U
00160         ) const = 0;
00161 };
00162 
00163 
00164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00165 
00166 } // End namespace Foam
00167 
00168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00169 
00170 #define makePatchInteractionModel(CloudType)                                  \
00171                                                                               \
00172     defineNamedTemplateTypeNameAndDebug(PatchInteractionModel<CloudType>, 0); \
00173                                                                               \
00174     defineTemplateRunTimeSelectionTable                                       \
00175     (                                                                         \
00176         PatchInteractionModel<CloudType>,                                     \
00177         dictionary                                                            \
00178     );
00179 
00180 
00181 #define makePatchInteractionModelType(SS, CloudType, ParcelType)              \
00182                                                                               \
00183     defineNamedTemplateTypeNameAndDebug(SS<CloudType<ParcelType> >, 0);       \
00184                                                                               \
00185     PatchInteractionModel<CloudType<ParcelType> >::                           \
00186         adddictionaryConstructorToTable<SS<CloudType<ParcelType> > >          \
00187             add##SS##CloudType##ParcelType##ConstructorToTable_;
00188 
00189 
00190 #define makePatchInteractionModelThermoType(SS, CloudType, ParcelType, ThermoType)\
00191                                                                               \
00192     defineNamedTemplateTypeNameAndDebug                                       \
00193     (                                                                         \
00194         SS<CloudType<ParcelType<ThermoType> > >,                              \
00195         0                                                                     \
00196     );                                                                        \
00197                                                                               \
00198     PatchInteractionModel<CloudType<ParcelType<ThermoType> > >::              \
00199         adddictionaryConstructorToTable                                       \
00200             <SS<CloudType<ParcelType<ThermoType> > > >                        \
00201             add##SS##CloudType##ParcelType##ThermoType##ConstructorToTable_;
00202 
00203 
00204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00205 
00206 #ifdef NoRepository
00207 #   include "PatchInteractionModel.C"
00208 #endif
00209 
00210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00211 
00212 #endif
00213 
00214 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines