Loading...
Searching...
No Matches
RecycleInteraction.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) 2020 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::RecycleInteraction
28
29Group
30 grpLagrangianIntermediatePatchInteractionSubModels
31
32Description
33 Patch interaction model to perform
34 parcel transfer and recycle from one patch to another.
35
36 Parcels that hit a given 'outflow' patch
37 are recycled to a given 'inflow' patch, with optional:
38 - recycle fraction [0-1]
39
40Usage
41 Minimal example by using
42 \c constant/reactingCloud1Properties.subModels.multiInteractionCoeffs
43 \verbatim
44 multiInteractionCoeffs
45 {
46 ...
47
48 model1
49 {
50 // Mandatory entries (unmodifiable)
51 patchInteractionModel recycleInteraction;
52
53 recycleInteractionCoeffs
54 {
55 recyclePatches
56 (
57 (<outletPatch1> <inletPatch1>)
58 (<outletPatch2> <inletPatch2>)
59 ...
60 );
61
62 recycleFraction 0.8; // [0-1]
63
64 // Optional entries (unmodifiable)
65 outputByInjectorId false;
66 }
67 }
68
69 ...
70 }
71 \endverbatim
72
73 where the entries mean:
74 \table
75 Property | Description | Type | Reqd | Dflt
76 patchInteractionModel | Type name: recycleInteraction <!--
77 --> | word | yes | -
78 recyclePatches | Names of outlet-inlet patch pairs <!--
79 --> | (word word) | yes | -
80 recycleFraction | Fraction of parcels recycled from <!--
81 --> outlet to inlet | scalar | yes | -
82 outputByInjectorId | Flag to output escaped/mass <!--
83 --> particles sorted by injectorID | bool | no | false
84 \endtable
85
86SourceFiles
87 RecycleInteraction.C
88
89\*---------------------------------------------------------------------------*/
90
91#ifndef RecycleInteraction_H
92#define RecycleInteraction_H
93
94#include "patchInjectionBase.H"
95#include "IDLList.H"
96#include "PtrList.H"
98
99// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100
101namespace Foam
102{
103/*---------------------------------------------------------------------------*\
104 Class RecycleInteraction Declaration
105\*---------------------------------------------------------------------------*/
106
107template<class CloudType>
109:
110 public PatchInteractionModel<CloudType>
111{
112protected:
113
114 typedef typename CloudType::parcelType parcelType;
115
116 // Protected Data
117
118 //- Reference to mesh
119 const fvMesh& mesh_;
120
121 //- Outlet-inlet patch pair to apply parcel recycling
122 List<Pair<word>> recyclePatches_;
123
124 //- Patch IDs of recyclePatches
125 List<Pair<label>> recyclePatchesIds_;
126
127 //- Parcel IDs of recycled parcels
128 List<IDLList<parcelType>> recycledParcels_;
129
130
131 // Bookkeeping for particle fates
132
133 //- Number of parcels removed
134 List<List<label>> nRemoved_;
135
136 //- Mass of parcels removed
137 List<List<scalar>> massRemoved_;
138
139 //- Number of parcels injected
140 List<List<label>> nInjected_;
142 //- Mass of parcels injected
144
145
146 //- Injector ID to local index map
148
149 //- Injection patch pointer
151
152 //- Parcel fraction to be recycled from outlet to inlet
153 const scalar recycleFraction_;
155 //- Flag to output escaped/mass particles sorted by injectorID
157
158
159 // Protected Member Functions
160
161 //- Output file header information
162 virtual void writeFileHeader(Ostream& os);
163
165public:
166
167 //- Runtime type information
168 TypeName("recycleInteraction");
170
171 // Constructors
172
173 //- Construct from dictionary
175
176 //- Construct copy from owner cloud and patch interaction model
178
179 //- Construct and return a clone using supplied owner cloud
181 {
183 (
185 );
186 }
188
189 //- Destructor
190 virtual ~RecycleInteraction() = default;
191
193 // Member Functions
194
195 //- Apply velocity correction
196 // Returns true if particle remains in same cell
197 virtual bool correct
199 typename CloudType::parcelType& p,
200 const polyPatch& pp,
201 bool& keepParticle
202 );
204 //- Post-evolve hook
205 virtual void postEvolve();
206
207 //- Write patch interaction info
208 virtual void info();
209};
210
211
212// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214} // End namespace Foam
215
216// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217
218#ifdef NoRepository
219 #include "RecycleInteraction.C"
220#endif
221
222// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223
224#endif
225
226// ************************************************************************* //
Intrusive doubly-linked list.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
A HashTable to objects of type <T> with a label key.
Definition Map.H:54
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Templated patch interaction model class.
PatchInteractionModel(CloudType &owner)
Construct null from owner.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition PtrList.H:67
Patch interaction model to perform parcel transfer and recycle from one patch to another.
virtual void postEvolve()
Post-evolve hook.
const fvMesh & mesh_
Reference to mesh.
RecycleInteraction(const dictionary &dict, CloudType &cloud)
Construct from dictionary.
virtual autoPtr< PatchInteractionModel< CloudType > > clone() const
Construct and return a clone using supplied owner cloud.
List< Pair< label > > recyclePatchesIds_
Patch IDs of recyclePatches.
Map< label > injIdToIndex_
Injector ID to local index map.
List< List< scalar > > massInjected_
Mass of parcels injected.
List< List< label > > nRemoved_
Number of parcels removed.
List< Pair< word > > recyclePatches_
Outlet-inlet patch pair to apply parcel recycling.
virtual ~RecycleInteraction()=default
Destructor.
List< List< label > > nInjected_
Number of parcels injected.
virtual void info()
Write patch interaction info.
virtual void writeFileHeader(Ostream &os)
Output file header information.
List< List< scalar > > massRemoved_
Mass of parcels removed.
const scalar recycleFraction_
Parcel fraction to be recycled from outlet to inlet.
TypeName("recycleInteraction")
Runtime type information.
List< IDLList< parcelType > > recycledParcels_
Parcel IDs of recycled parcels.
CloudType::parcelType parcelType
bool outputByInjectorId_
Flag to output escaped/mass particles sorted by injectorID.
PtrList< patchInjectionBase > injectionPatchPtr_
Injection patch pointer.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A cloud is a registry collection of lagrangian particles.
Definition cloud.H:56
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
A patch is a list of labels that address the faces in the global face list.
Definition polyPatch.H:73
const dictionary & dict() const
Return const access to the cloud dictionary.
volScalarField & p
thermo correct()
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
DSMCCloud< dsmcParcel > CloudType
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68