FacePostProcessing.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
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::FacePostProcessing
26 
27 Description
28  Records particle face quantities on used-specified face zone
29 
30  Currently supports:
31  accumulated mass
32  average mass flux
33 
34 SourceFiles
35  FacePostProcessing.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef FacePostProcessing_H
40 #define FacePostProcessing_H
41 
42 #include "CloudFunctionObject.H"
43 #include "faceZone.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class FacePostProcessing Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 template<class CloudType>
56 :
57  public CloudFunctionObject<CloudType>
58 {
59  // Private Data
60 
61  // Typedefs
62 
63  //- Convenience typedef for parcel type
64  typedef typename CloudType::parcelType parcelType;
65 
66 
67  //- Face zone IDs
68  labelList faceZoneIndices_;
69 
70  //- Surface output format
71  const word surfaceFormat_;
72 
73  //- Flag to indicate whether data should be reset/cleared on writing
74  Switch resetOnWrite_;
75 
76  //- Total time
77  scalar totalTime_;
78 
79  //- Mass storage
80  List<scalarField> mass_;
81 
82  //- Mass total storage
83  List<scalarField> massTotal_;
84 
85  //- Mass flow rate storage
86  List<scalarField> massFlowRate_;
87 
88  //- Flag to indicate whether data should be written to file
89  Switch log_;
90 
91  //- Output file pointer per zone
92  PtrList<OFstream> outputFilePtr_;
93 
94  //- Last calculation time
95  scalar timeOld_;
96 
97 
98  // Private Member Functions
99 
100  //- Helper function to create log files
101  void makeLogFile
102  (
103  const word& zoneName,
104  const label zoneI,
105  const label nFaces,
106  const scalar totArea
107  );
108 
109 
110 protected:
111 
112  // Protected Member Functions
113 
114  //- Write post-processing info
115  void write();
116 
117 
118 public:
119 
120  //- Runtime type information
121  TypeName("facePostProcessing");
122 
123 
124  // Constructors
125 
126  //- Construct from dictionary
128  (
129  const dictionary& dict,
130  CloudType& owner,
131  const word& modelName
132  );
133 
134  //- Construct copy
136 
137  //- Construct and return a clone
139  {
141  (
143  );
144  }
145 
146 
147  //- Destructor
148  virtual ~FacePostProcessing();
149 
150 
151  // Member Functions
152 
153  // Access
154 
155  //- Return const access to the reset on write flag
156  inline const Switch& resetOnWrite() const;
157 
158 
159  // Evaluation
160 
161  //- Post-patch hook
162  virtual void postPatch(const parcelType& p, const polyPatch& pp);
163 
164  //- Post-face hook
165  virtual void preFace(const parcelType& p);
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace Foam
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #include "FacePostProcessingI.H"
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #ifdef NoRepository
180  #include "FacePostProcessing.C"
181 #endif
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #endif
186 
187 // ************************************************************************* //
Templated cloud function object base class.
const CloudType & owner() const
Return const access to the owner cloud.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:80
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:225
Records particle face quantities on used-specified face zone.
virtual void postPatch(const parcelType &p, const polyPatch &pp)
Post-patch hook.
virtual void preFace(const parcelType &p)
Post-face hook.
void write()
Write post-processing info.
const Switch & resetOnWrite() const
Return const access to the reset on write flag.
TypeName("facePostProcessing")
Runtime type information.
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
virtual ~FacePostProcessing()
Destructor.
FacePostProcessing(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:61
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
volScalarField & p