PatchInteractionFields.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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::PatchInteractionFields
28 
29 Group
30  grpLagrangianIntermediateFunctionObjects
31 
32 Description
33  Creates volume fields whose boundaries are used to store patch interaction
34  statistics.
35 
36  Current field output per patch face:
37  - <cloud><model>:count - cumulative particle hits
38  - <cloud><model>:mass - cumulative mass of hitting particles
39 
40  Fields can be reset according to:
41  - none: fields are not reset
42  - timeStep: reset at each time step
43  - writeTime: reset at each write time
44 
45 Usage
46 
47  \verbatim
48  patchInteractionFields1
49  {
50  type patchInteractionFields;
51  resetMode writeTime;
52  }
53  \endverbatim
54 
55 SourceFiles
56  PatchInteractionFields.C
57 
58 \*---------------------------------------------------------------------------*/
59 
60 #ifndef PatchInteractionFields_H
61 #define PatchInteractionFields_H
62 
63 #include "CloudFunctionObject.H"
64 #include "volFields.H"
65 #include "Enum.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class PatchInteractionFields Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 template<class CloudType>
78 :
79  public CloudFunctionObject<CloudType>
80 {
81 public:
82 
83  // Public enumerations
84 
85  //- Reset mode
86  enum class resetMode
87  {
88  none,
89  timeStep,
91  };
92 
93  static const Enum<resetMode> resetModeNames_;
94 
95 
96 private:
97 
98  // Private Data
99 
100  //- Convenience typedef for parcel type
101  typedef typename CloudType::parcelType parcelType;
102 
103  //- Parcel mass field
104  autoPtr<volScalarField> massPtr_;
105 
106  //- Parcel count field
107  autoPtr<volScalarField> countPtr_;
108 
109  //- Reset mode
110  resetMode resetMode_;
111 
112 
113 protected:
114 
115  // Protected Member Functions
116 
117  //- Create|read|reset the fields
118  void reset();
119 
120  //- Write post-processing info
121  virtual void write();
122 
123  //- Helper function to clear or reset fields
124  void clearOrReset
125  (
126  autoPtr<volScalarField>& fieldPtr,
127  const word& fieldName,
128  const dimensionSet& dims
129  ) const;
130 
131 
132 public:
133 
134  //- Runtime type information
135  TypeName("patchInteractionFields");
136 
137 
138  // Constructors
139 
140  //- Construct from dictionary
142  (
143  const dictionary& dict,
144  CloudType& owner,
145  const word& modelName
146  );
147 
148  //- Construct copy
150 
151  //- Construct and return a clone
153  {
155  (
157  );
158  }
159 
160 
161  //- Destructor
162  virtual ~PatchInteractionFields() = default;
163 
164 
165  // Member Functions
166 
167  // Evaluation
168 
169  //- Pre-evolve hook
170  virtual void preEvolve
171  (
172  const typename parcelType::trackingData& td
173  );
174 
175  //- Post-patch hook
176  virtual bool postPatch
177  (
178  const parcelType& p,
179  const polyPatch& pp,
180  const typename parcelType::trackingData& td
181  );
182 };
183 
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 } // End namespace Foam
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #ifdef NoRepository
192  #include "PatchInteractionFields.C"
193 #endif
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 #endif
198 
199 // ************************************************************************* //
virtual ~PatchInteractionFields()=default
Destructor.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual bool postPatch(const parcelType &p, const polyPatch &pp, const typename parcelType::trackingData &td)
Post-patch hook.
void clearOrReset(autoPtr< volScalarField > &fieldPtr, const word &fieldName, const dimensionSet &dims) const
Helper function to clear or reset fields.
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:98
static const Enum< resetMode > resetModeNames_
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:104
PatchInteractionFields(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
const CloudType & owner() const
Return const access to the owner cloud.
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:105
Creates volume fields whose boundaries are used to store patch interaction statistics.
A class for handling words, derived from Foam::string.
Definition: word.H:63
TypeName("patchInteractionFields")
Runtime type information.
virtual void write()
Write post-processing info.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:290
virtual void preEvolve(const typename parcelType::trackingData &td)
Pre-evolve hook.
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
void reset()
Create|read|reset the fields.
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
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:67
Templated cloud function object base class.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Namespace for OpenFOAM.