Transferred copyright to the OpenFOAM Foundation
[OpenFOAM-2.0.x.git] / src / lagrangian / intermediate / submodels / Kinematic / ParticleForces / ParticleForce / ParticleForce.H
blobc5a6cf01d73976951461d56fd104fe9e24792e12
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by
13     the Free Software Foundation, either version 3 of the License, or
14     (at your option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::ParticleForce
27 Description
28     Abstract base class for particle forces
30 SourceFiles
31     ParticleForceI.H
32     ParticleForce.C
33     ParticleForceNew.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef ParticleForce_H
38 #define ParticleForce_H
40 #include "dictionary.H"
41 #include "forceSuSp.H"
42 #include "fvMesh.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 namespace Foam
49 /*---------------------------------------------------------------------------*\
50                       Class ParticleForce Declaration
51 \*---------------------------------------------------------------------------*/
53 template<class CloudType>
54 class ParticleForce
56     // Private data
58         //- Reference to the owner cloud
59         CloudType& owner_;
61         //- Reference to the mesh database
62         const fvMesh& mesh_;
64         //- Force coefficients dictaionary
65         const dictionary coeffs_;
68 public:
70     //- Runtime type information
71     TypeName("particleForce");
73     //- Declare runtime constructor selection table
74     declareRunTimeSelectionTable
75     (
76         autoPtr,
77         ParticleForce,
78         dictionary,
79         (
80             CloudType& owner,
81             const fvMesh& mesh,
82             const dictionary& dict
83         ),
84         (owner, mesh, dict)
85     );
88     //- Convenience typedef for return type
89     typedef VectorSpace<Vector<vector>, vector, 2> returnType;
92     // Constructors
94         //- Construct from mesh
95         ParticleForce
96         (
97             CloudType& owner,
98             const fvMesh& mesh,
99             const dictionary& dict,
100             const word& forceType,
101             const bool readCoeffs
102         );
104         //- Construct copy
105         ParticleForce(const ParticleForce& pf);
107         //- Construct and return a clone
108         virtual autoPtr<ParticleForce<CloudType> > clone() const
109         {
110             return autoPtr<ParticleForce<CloudType> >
111             (
112                 new ParticleForce<CloudType>(*this)
113             );
114         }
117     //- Destructor
118     virtual ~ParticleForce();
121     //- Selector
122     static autoPtr<ParticleForce<CloudType> > New
123     (
124         CloudType& owner,
125         const fvMesh& mesh,
126         const dictionary& dict,
127         const word& forceType
128     );
131     // Member Functions
133         // Access
135             //- Return const access to the cloud owner
136             inline const CloudType& owner() const;
138             //- Return refernce to the cloud owner
139             inline CloudType& owner();
141             //- Return the mesh database
142             inline const fvMesh& mesh() const;
144             //- Return the force coefficients dictionary
145             inline const dictionary& coeffs() const;
148         // Evaluation
150             //- Cache fields
151             virtual void cacheFields(const bool store);
153             //- Calculate the coupled force
154             virtual forceSuSp calcCoupled
155             (
156                 const typename CloudType::parcelType& p,
157                 const scalar dt,
158                 const scalar mass,
159                 const scalar Re,
160                 const scalar muc
161             ) const;
163             //- Calculate the non-coupled force
164             virtual forceSuSp calcNonCoupled
165             (
166                 const typename CloudType::parcelType& p,
167                 const scalar dt,
168                 const scalar mass,
169                 const scalar Re,
170                 const scalar muc
171             ) const;
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 } // End namespace Foam
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 #include "ParticleForceI.H"
183 #ifdef NoRepository
184     #include "ParticleForce.C"
185 #endif
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 #define makeParticleForceModel(CloudType)                                     \
190                                                                               \
191     typedef CloudType::kinematicCloudType kinematicCloudType;                 \
192     defineNamedTemplateTypeNameAndDebug(ParticleForce<kinematicCloudType>, 0);\
193     defineTemplateRunTimeSelectionTable                                       \
194     (                                                                         \
195         ParticleForce<kinematicCloudType>,                                    \
196         dictionary                                                            \
197     );
200 #define makeParticleForceModelType(SS, CloudType)                             \
201                                                                               \
202     typedef CloudType::kinematicCloudType kinematicCloudType;                 \
203     defineNamedTemplateTypeNameAndDebug(SS<kinematicCloudType>, 0);           \
204                                                                               \
205     ParticleForce<kinematicCloudType>::                                       \
206         adddictionaryConstructorToTable<SS<kinematicCloudType> >              \
207         add##SS##CloudType##kinematicCloudType##ConstructorToTable_;
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 #endif
215 // ************************************************************************* //