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

LocalInteraction.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-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::LocalInteraction
00027 
00028 Description
00029     Patch interaction specified on a patch-by-patch basis
00030 
00031 \*---------------------------------------------------------------------------*/
00032 
00033 #ifndef LocalInteraction_H
00034 #define LocalInteraction_H
00035 
00036 #include "PatchInteractionModel.H"
00037 #include "dictionaryEntry.H"
00038 
00039 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00040 
00041 namespace Foam
00042 {
00043 /*---------------------------------------------------------------------------*\
00044                       Class LocalInteraction Declaration
00045 \*---------------------------------------------------------------------------*/
00046 
00047 template<class CloudType>
00048 class LocalInteraction
00049 :
00050     public PatchInteractionModel<CloudType>
00051 {
00052     class patchInteractionData
00053     {
00054         // Private data
00055 
00056             //- Patch name
00057             word patchName_;
00058 
00059             //- Elasticity coefficient
00060             scalar e_;
00061 
00062             //- Restitution coefficient
00063             scalar mu_;
00064 
00065 
00066     public:
00067 
00068         //- Construct null
00069         patchInteractionData()
00070         :
00071             patchName_("unknownPatch"),
00072             e_(0.0),
00073             mu_(0.0)
00074         {}
00075 
00076         //- Construct from dictionary
00077         patchInteractionData(const dictionary& dict);
00078 
00079         // Member functions
00080 
00081             // Access
00082 
00083                 //- Return const access to the patch name
00084                 const word& patchName() const
00085                 {
00086                     return patchName_;
00087                 }
00088 
00089                 //- Return const access to the elasticity coefficient
00090                 scalar e() const
00091                 {
00092                     return e_;
00093                 }
00094 
00095                 //- Return const access to the restitution coefficient
00096                 scalar mu() const
00097                 {
00098                     return mu_;
00099                 }
00100 
00101 
00102             // I-O
00103 
00104                 //- Istream operator
00105                 friend Istream& operator>>(Istream& is, patchInteractionData& pid)
00106                 {
00107                     is.check
00108                     (
00109                         "Istream& operator>>"
00110                         "(Istream&, patchInteractionData&)"
00111                     );
00112 
00113                     const dictionaryEntry entry(dictionary::null, is);
00114 
00115                     pid.patchName_ = entry.keyword();
00116                     entry.lookup("e") >> pid.e_;
00117                     entry.lookup("mu") >> pid.mu_;
00118 
00119                     return is;
00120                 }
00121     };
00122 
00123 
00124     // Private data
00125 
00126         //- List of participating patches
00127         const List<patchInteractionData> patchData_;
00128 
00129         //- List of participating patch ids
00130         List<label> patchIds_;
00131 
00132 
00133     // Private member functions
00134 
00135         //- Returns local patchI if patch is in patchIds_ list
00136         label applyToPatch(const label globalPatchI) const;
00137 
00138 
00139 
00140 public:
00141 
00142     //- Runtime type information
00143     TypeName("LocalInteraction");
00144 
00145 
00146     // Constructors
00147 
00148         //- Construct from dictionary
00149         LocalInteraction(const dictionary& dict, CloudType& cloud);
00150 
00151 
00152     //- Destructor
00153     virtual ~LocalInteraction();
00154 
00155 
00156     // Member Functions
00157 
00158         //- Flag to indicate whether model activates patch interaction model
00159         virtual bool active() const;
00160 
00161         //- Apply velocity correction
00162         //  Returns true if particle remains in same cell
00163         virtual bool correct
00164         (
00165             const polyPatch& pp,
00166             const label faceId,
00167             vector& U
00168         ) const;
00169 };
00170 
00171 
00172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00173 
00174 } // End namespace Foam
00175 
00176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00177 
00178 #ifdef NoRepository
00179 #   include "LocalInteraction.C"
00180 #endif
00181 
00182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00183 
00184 #endif
00185 
00186 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd