LocalInteraction.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) 2018-2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::LocalInteraction
29 
30 Group
31  grpLagrangianIntermediatePatchInteractionSubModels
32 
33 Description
34  Patch interaction specified on a patch-by-patch basis
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef LocalInteraction_H
39 #define LocalInteraction_H
40 
41 #include "PatchInteractionModel.H"
43 #include "Switch.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class LocalInteraction Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 template<class CloudType>
55 class LocalInteraction
56 :
57  public PatchInteractionModel<CloudType>
58 {
59  // Private data
60 
61  //- List of participating patches
62  const patchInteractionDataList patchData_;
63 
64 
65  // Bookkeeping for particle fates
66 
67  //- Number of parcels escaped
68  List<List<label>> nEscape_;
69 
70  //- Mass of parcels escaped
71  List<List<scalar>> massEscape_;
72 
73  //- Number of parcels stuck to patches
74  List<List<label>> nStick_;
75 
76  //- Mass of parcels stuck to patches
77  List<List<scalar>> massStick_;
78 
79 
80  //- Flag to output data as fields
81  bool writeFields_;
82 
83  //- InjectorId to index map, when outputting escaped/stick/...
84  // particles sorted by injectorID
85  Map<label> injIdToIndex_;
86 
87  //- Mass escape field
88  autoPtr<volScalarField> massEscapePtr_;
89 
90  //- Mass stick field
91  autoPtr<volScalarField> massStickPtr_;
92 
93 
94 protected:
95 
96  // Protected Member Functions
97 
98  //- Output file header information
99  virtual void writeFileHeader(Ostream& os);
100 
101 
102 public:
103 
104  //- Runtime type information
105  TypeName("localInteraction");
106 
107 
108  // Constructors
109 
110  //- Construct from dictionary
112 
113  //- Construct copy from owner cloud and patch interaction model
115 
116  //- Construct and return a clone using supplied owner cloud
118  {
120  (
121  new LocalInteraction<CloudType>(*this)
122  );
123  }
124 
125 
126  //- Destructor
127  virtual ~LocalInteraction() = default;
128 
129 
130  // Member Functions
131 
132  //- Return access to the massEscape field
134 
135  //- Return access to the massStick field
137 
138  //- Apply velocity correction
139  // Returns true if particle remains in same cell
140  virtual bool correct
141  (
142  typename CloudType::parcelType& p,
143  const polyPatch& pp,
144  bool& keepParticle
145  );
146 
147 
148  //- Write patch interaction info
149  virtual void info();
150 };
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #ifdef NoRepository
160  #include "LocalInteraction.C"
161 #endif
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #endif
166 
167 // ************************************************************************* //
Patch interaction specified on a patch-by-patch basis.
volScalarField & massEscape()
Return access to the massEscape field.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:56
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:104
Templated patch interaction model class.
const CloudType & owner() const
Return const access to the owner cloud.
virtual ~LocalInteraction()=default
Destructor.
virtual void info()
Write patch interaction info.
List container for patchInteractionData class.
LocalInteraction(const dictionary &dict, CloudType &owner)
Construct from dictionary.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:290
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
volScalarField & massStick()
Return access to the massStick field.
TypeName("localInteraction")
Runtime type information.
virtual void writeFileHeader(Ostream &os)
Output file header information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
volScalarField & p
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:69
virtual autoPtr< PatchInteractionModel< CloudType > > clone() const
Construct and return a clone using supplied owner cloud.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:67
virtual bool correct(typename CloudType::parcelType &p, const polyPatch &pp, bool &keepParticle)
Apply velocity correction.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Namespace for OpenFOAM.