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-2018 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  accummulated 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 faceZoneIDs_;
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-face hook
162  virtual void postFace(const parcelType& p, bool& keepParticle);
163 };
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace Foam
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #include "FacePostProcessingI.H"
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #ifdef NoRepository
177  #include "FacePostProcessing.C"
178 #endif
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #endif
183 
184 // ************************************************************************* //
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
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
void write()
Write post-processing info.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
FacePostProcessing(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Definition: Switch.H:60
const Switch & resetOnWrite() const
Return const access to the reset on write flag.
virtual ~FacePostProcessing()
Destructor.
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
const CloudType & owner() const
Return const access to the owner cloud.
virtual void postFace(const parcelType &p, bool &keepParticle)
Post-face hook.
A class for handling words, derived from string.
Definition: word.H:59
Records particle face quantities on used-specified face zone.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:215
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:70
TypeName("facePostProcessing")
Runtime type information.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
volScalarField & p
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:69
Templated cloud function object base class.
Namespace for OpenFOAM.