PatchInteractionModel.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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::PatchInteractionModel
29
30Group
31 grpLagrangianIntermediatePatchInteractionSubModels
32
33Description
34 Templated patch interaction model class
35
36SourceFiles
37 PatchInteractionModel.C
38 PatchInteractionModelNew.C
39
40\*---------------------------------------------------------------------------*/
41
42#ifndef PatchInteractionModel_H
43#define PatchInteractionModel_H
44
45#include "IOdictionary.H"
46#include "autoPtr.H"
48#include "polyPatch.H"
49#include "wallPolyPatch.H"
50#include "tetIndices.H"
51#include "CloudSubModelBase.H"
52#include "writeFile.H"
53
54// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55
56namespace Foam
57{
58
59/*---------------------------------------------------------------------------*\
60 Class PatchInteractionModel Declaration
61\*---------------------------------------------------------------------------*/
62
63template<class CloudType>
65:
66 public CloudSubModelBase<CloudType>,
68{
69public:
70
71 // Public enumerations
72
73 // Interaction types
75 {
81 };
84
85
86protected:
87
88 // Protected data
89
90 //- Name of velocity field - default = "U"
91 const word UName_;
92
93
94 // Counters
95
96 //- Number of parcels escaped
97 label escapedParcels_;
98
99 //- Mass of parcels escaped
100 scalar escapedMass_;
101
102 //- Maximum relative U with patch for particle to be removed
103 scalar Urmax_;
104
105
106 // Protected Member Functions
107
108 //- Output file header information
109 virtual void writeFileHeader(Ostream& os);
110
111
112public:
113
114 //- Runtime type information
115 TypeName("patchInteractionModel");
116
117 //- Declare runtime constructor selection table
119 (
120 autoPtr,
123 (
124 const dictionary& dict,
126 ),
127 (dict, owner)
128 );
129
130
131 // Constructors
132
133 //- Construct null from owner
135
136 //- Construct from components
138 (
139 const dictionary& dict,
141 const word& type
142 );
143
144 //- Construct copy
146
147 //- Construct and return a clone
149
150
151 //- Destructor
152 virtual ~PatchInteractionModel() = default;
153
154
155 //- Selector
157 (
158 const dictionary& dict,
160 );
161
162
163 // Access
164
165 //- Return name of velocity field
166 const word& UName() const;
167
168 //- Return Urmax
169 const scalar& Urmax() const;
170
171 // Member Functions
172
173 //- Convert interaction result to word
174 static word interactionTypeToWord(const interactionType& itEnum);
175
176 //- Convert word to interaction result
177 static interactionType wordToInteractionType(const word& itWord);
178
179 //- Apply velocity correction
180 // Returns true if particle remains in same cell
181 virtual bool correct
182 (
183 typename CloudType::parcelType& p,
184 const polyPatch& pp,
185 bool& keepParticle
186 ) = 0;
187
188 //- Add to escaped parcels
189 virtual void addToEscapedParcels(const scalar mass);
190
191 //- Post-evolve hook
192 virtual void postEvolve();
193
194 //- Write patch interaction info to stream
195 virtual void info(Ostream& os);
196};
197
198
199// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200
201} // End namespace Foam
202
203// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205#define makePatchInteractionModel(CloudType) \
206 \
207 typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
208 defineNamedTemplateTypeNameAndDebug \
209 ( \
210 Foam::PatchInteractionModel<kinematicCloudType>, \
211 0 \
212 ); \
213 \
214 namespace Foam \
215 { \
216 defineTemplateRunTimeSelectionTable \
217 ( \
218 PatchInteractionModel<kinematicCloudType>, \
219 dictionary \
220 ); \
221 }
222
224#define makePatchInteractionModelType(SS, CloudType) \
225 \
226 typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
227 defineNamedTemplateTypeNameAndDebug(Foam::SS<kinematicCloudType>, 0); \
228 \
229 Foam::PatchInteractionModel<kinematicCloudType>:: \
230 adddictionaryConstructorToTable<Foam::SS<kinematicCloudType>> \
231 add##SS##CloudType##kinematicCloudType##ConstructorToTable_;
232
233
234// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235
236#ifdef NoRepository
237 #include "PatchInteractionModel.C"
238#endif
239
240// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241
242#endif
243
244// ************************************************************************* //
Base class for cloud sub-models.
const CloudType & owner() const
Return const access to the owner cloud.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:75
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Templated patch interaction model class.
virtual void postEvolve()
Post-evolve hook.
const scalar & Urmax() const
Return Urmax.
virtual ~PatchInteractionModel()=default
Destructor.
TypeName("patchInteractionModel")
Runtime type information.
scalar escapedMass_
Mass of parcels escaped.
virtual void info(Ostream &os)
Write patch interaction info to stream.
label escapedParcels_
Number of parcels escaped.
declareRunTimeSelectionTable(autoPtr, PatchInteractionModel, dictionary,(const dictionary &dict, CloudType &owner),(dict, owner))
Declare runtime constructor selection table.
virtual void addToEscapedParcels(const scalar mass)
Add to escaped parcels.
static autoPtr< PatchInteractionModel< CloudType > > New(const dictionary &dict, CloudType &owner)
Selector.
const word & UName() const
Return name of velocity field.
static interactionType wordToInteractionType(const word &itWord)
Convert word to interaction result.
virtual void writeFileHeader(Ostream &os)
Output file header information.
const word UName_
Name of velocity field - default = "U".
virtual autoPtr< PatchInteractionModel< CloudType > > clone() const =0
Construct and return a clone.
static word interactionTypeToWord(const interactionType &itEnum)
Convert interaction result to word.
scalar Urmax_
Maximum relative U with patch for particle to be removed.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Base class for writing single files from the function objects.
Definition: writeFile.H:120
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:75
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
thermo correct()
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73