patchProbes.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 | Copyright (C) 2011-2014 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::patchProbes
26 
27 Description
28  Set of locations to sample at patches
29 
30  Call write() to sample and write files.
31  - find nearest location on nearest face
32  - update *this with location (so header contains 'snapped' locations
33  - use *this as the sampling location
34 
35  Example of function object specification:
36  \verbatim
37  patchProbes
38  {
39  type patchProbes;
40  functionObjectLibs ( "libsampling.so" );
41 
42  // Name of the directory for probe data
43  name patchProbes;
44 
45  // Patches to sample (wildcards allowed)
46  patches (".*inl.*");
47 
48  // Write at same frequency as fields
49  outputControl outputTime;
50  outputInterval 1;
51 
52  // Fields to be probed
53  fields
54  (
55  p U
56  );
57 
58  // Locations to probe. These get snapped onto the nearest point
59  // on the selected patches
60  probeLocations
61  (
62  ( -100 0 0.01 ) // at inlet
63  );
64  }
65  \endverbatim
66 
67 
68 SourceFiles
69  patchProbes.C
70 
71 \*---------------------------------------------------------------------------*/
72 
73 #ifndef patchProbes_H
74 #define patchProbes_H
75 
76 #include "probes.H"
77 
78 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
79 
80 namespace Foam
81 {
82 
83 // Forward declaration of classes
84 class objectRegistry;
85 class dictionary;
86 class fvMesh;
87 class mapPolyMesh;
88 
89 /*---------------------------------------------------------------------------*\
90  Class patchProbes Declaration
91 \*---------------------------------------------------------------------------*/
92 
93 class patchProbes
94 :
95  public probes
96 {
97 protected:
98 
99  // Protected data
100 
101  //- Patches to sample
103 
104 
105  // Protected Member Functions
106 
107  //- Sample and write a particular volume field
108  template<class Type>
109  void sampleAndWrite
110  (
112  );
113 
114  //- Sample and write a particular surface field
115  template<class Type>
116  void sampleAndWrite
117  (
119  );
120 
121  //- Sample and write all the fields of the given type
122  template<class Type>
123  void sampleAndWrite(const fieldGroup<Type>&);
124 
125  //- Sample and write all the surface fields of the given type
126  template<class Type>
128 
129  //- Sample a volume field at all locations
130  template<class Type>
132  (
134  ) const;
135 
136  //- Sample a surface field at all locations
137  template<class Type>
139  (
141  ) const;
142 
143  //- Sample a single field on all sample locations
144  template<class Type>
145  tmp<Field<Type> > sample(const word& fieldName) const;
146 
147  //- Find elements containing patchProbes
148  virtual void findElements(const fvMesh&);
149 
150  //- Read dictionary settings
151  void readDict(const dictionary& dict);
152 
153 
154 private:
155 
156  //- Disallow default bitwise copy construct
157  patchProbes(const patchProbes&);
158 
159  //- Disallow default bitwise assignment
160  void operator=(const patchProbes&);
161 
162 
163 public:
164 
165  //- Runtime type information
166  TypeName("patchProbes");
167 
168 
169  // Constructors
170 
171  //- Construct for given objectRegistry and dictionary.
172  // Allow the possibility to load fields from files
174  (
175  const word& name,
176  const objectRegistry&,
177  const dictionary&,
178  const bool loadFromFiles = false,
179  const bool findElements = true
180  );
181 
182 
183  //- Destructor
184  virtual ~patchProbes();
185 
186  //- Public members
187 
188  //- Sample and write
189  virtual void write();
190 
191  //- Read
192  virtual void read(const dictionary&);
193 };
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 } // End namespace Foam
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 #ifdef NoRepository
202 # include "patchProbesTemplates.C"
203 #endif
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 #endif
208 
209 // ************************************************************************* //
Foam::patchProbes::findElements
virtual void findElements(const fvMesh &)
Find elements containing patchProbes.
Definition: patchProbes.C:43
Foam::patchProbes::patchNames_
wordReList patchNames_
Patches to sample.
Definition: patchProbes.H:101
Foam::patchProbes
Set of locations to sample at patches.
Definition: patchProbes.H:92
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::patchProbes::~patchProbes
virtual ~patchProbes()
Destructor.
Definition: patchProbes.C:246
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::patchProbes::patchProbes
patchProbes(const patchProbes &)
Disallow default bitwise copy construct.
Foam::patchProbes::readDict
void readDict(const dictionary &dict)
Read dictionary settings.
Definition: patchProbes.C:207
probes.H
Foam::probes::fieldGroup
Class used for grouping field types.
Definition: probes.H:112
patchProbesTemplates.C
Foam::patchProbes::operator=
void operator=(const patchProbes &)
Disallow default bitwise assignment.
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
Foam::patchProbes::sample
tmp< Field< Type > > sample(const GeometricField< Type, fvPatchField, volMesh > &) const
Sample a volume field at all locations.
Foam::probes
Set of locations to sample.
Definition: probes.H:102
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::patchProbes::sampleAndWriteSurfaceFields
void sampleAndWriteSurfaceFields(const fieldGroup< Type > &)
Sample and write all the surface fields of the given type.
Definition: patchProbesTemplates.C:139
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::patchProbes::TypeName
TypeName("patchProbes")
Runtime type information.
Foam::probes::name
virtual const word & name() const
Return name of the set of probes.
Definition: probes.H:259
Foam::patchProbes::read
virtual void read(const dictionary &)
Read.
Definition: patchProbes.C:269
Foam::patchProbes::write
virtual void write()
Public members.
Definition: patchProbes.C:250
Foam::patchProbes::sampleAndWrite
void sampleAndWrite(const GeometricField< Type, fvPatchField, volMesh > &)
Sample and write a particular volume field.
Definition: patchProbesTemplates.C:35
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52