FreeFOAM The Cross-Platform CFD Toolkit
DragModel.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::DragModel
26 
27 Description
28  Templated drag model class
29 
30 SourceFiles
31  DragModel.C
32  NewDragModel.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef DragModel_H
37 #define DragModel_H
38 
39 #include <OpenFOAM/IOdictionary.H>
40 #include <OpenFOAM/autoPtr.H>
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class DragModel Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 template<class CloudType>
53 class DragModel
54 {
55  // Private data
56 
57  //- The cloud dictionary
58  const dictionary& dict_;
59 
60  //- Reference to the owner cloud class
61  CloudType& owner_;
62 
63 
64 public:
65 
66  //- Runtime type information
67  TypeName("DragModel");
68 
69  //- Declare runtime constructor selection table
71  (
72  autoPtr,
73  DragModel,
74  dictionary,
75  (
76  const dictionary& dict,
77  CloudType& owner
78  ),
79  (dict, owner)
80  );
81 
82 
83  // Constructors
84 
85  //- Construct from components
86  DragModel
87  (
88  const dictionary& dict,
89  CloudType& owner
90  );
91 
92 
93  //- Destructor
94  virtual ~DragModel();
95 
96 
97  //- Selector
99  (
100  const dictionary& dict,
101  CloudType& cloud
102  );
103 
104 
105  // Access
106 
107  //- Return the owner cloud object
108  const CloudType& owner() const;
109 
110  //- Return the dictionary
111  const dictionary& dict() const;
112 
113 
114  // Member Functions
115 
116  //- Flag to indicate whether model activates drag model
117  virtual bool active() const = 0;
118 
119  //- Return drag coefficient
120  virtual scalar Cd(const scalar Re) const = 0;
121 
122  //- Return momentum transfer coefficient
123  // Drag force per unit particle surface area = utc(U - Up)
124  scalar utc(const scalar Re, const scalar d, const scalar mu) const;
125 };
126 
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 } // End namespace Foam
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 #define makeDragModel(CloudType) \
135  \
136  defineNamedTemplateTypeNameAndDebug(DragModel<CloudType>, 0); \
137  \
138  defineTemplateRunTimeSelectionTable(DragModel<CloudType>, dictionary);
139 
140 
141 #define makeDragModelType(SS, CloudType, ParcelType) \
142  \
143  defineNamedTemplateTypeNameAndDebug(SS<CloudType<ParcelType> >, 0); \
144  \
145  DragModel<CloudType<ParcelType> >:: \
146  adddictionaryConstructorToTable<SS<CloudType<ParcelType> > > \
147  add##SS##CloudType##ParcelType##ConstructorToTable_;
148 
149 
150 #define makeDragModelThermoType(SS, CloudType, ParcelType, ThermoType) \
151  \
152  defineNamedTemplateTypeNameAndDebug \
153  ( \
154  SS<CloudType<ParcelType<ThermoType> > >, \
155  0 \
156  ); \
157  \
158  DragModel<CloudType<ParcelType<ThermoType> > >:: \
159  adddictionaryConstructorToTable \
160  <SS<CloudType<ParcelType<ThermoType> > > > \
161  add##SS##CloudType##ParcelType##ThermoType##ConstructorToTable_;
162 
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #ifdef NoRepository
168 #endif
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #endif
173 
174 // ************************ vim: set sw=4 sts=4 et: ************************ //