sampledPatchInternalField.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-2016 OpenFOAM Foundation
9  Copyright (C) 2018-2021 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::sampledPatchInternalField
29 
30 Description
31  Variation of sampledPatch that samples the internalField (at a given
32  normal distance from the patch) instead of the patchField.
33  Note:
34  - interpolate=false : get cell value on faces
35  - interpolate=true : interpolate inside cell and interpolate to points
36  There is no option to get interpolated value inside the cell on the faces.
37 
38  This is often embedded as part of a sampled surfaces function object.
39 
40 Usage
41  Example of function object partial specification:
42  \verbatim
43  surfaces
44  {
45  surface1
46  {
47  type patchInternalField;
48  patches (inlet "outlet.*");
49  offsetMode normal;
50  distance 0.05;
51  }
52  }
53  \endverbatim
54 
55  Where the sub-entries comprise:
56  \table
57  Property | Description | Required | Default
58  type | patchInternalField | yes |
59  patches | patch selection as word/regex list | yes |
60  offsetMode | normal/uniform/nonuniform | no | normal
61  distance | distance for normal offset | partly |
62  offset | point offset for uniform offset | partly |
63  offsets | point offsets for nonuniform offset | partly |
64  \endtable
65 
66 SourceFiles
67  sampledPatchInternalField.C
68 
69 \*---------------------------------------------------------------------------*/
70 
71 #ifndef sampledPatchInternalField_H
72 #define sampledPatchInternalField_H
73 
74 #include "sampledPatch.H"
75 #include "mappedPatchBase.H"
76 
77 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78 
79 namespace Foam
80 {
81 
82 /*---------------------------------------------------------------------------*\
83  Class sampledPatchInternalField Declaration
84 \*---------------------------------------------------------------------------*/
85 
86 class sampledPatchInternalField
87 :
88  public sampledPatch
89 {
90  // Private data
91 
92  //- Mapping engines
93  PtrList<mappedPatchBase> mappers_;
94 
95 
96  // Private Member Functions
97 
98  //- Sample volume field onto surface faces
99  template<class Type>
100  tmp<Field<Type>> sampleOnFaces
101  (
102  const interpolation<Type>& sampler
103  ) const;
104 
105  //- Interpolate volume field onto surface points
106  template<class Type>
107  tmp<Field<Type>> sampleOnPoints
108  (
109  const interpolation<Type>& interpolator
110  ) const;
111 
112 
113 public:
114 
115  //- Runtime type information
116  TypeName("sampledPatchInternalField");
117 
118 
119  // Constructors
120 
121  //- Construct from dictionary
123  (
124  const word& name,
125  const polyMesh& mesh,
126  const dictionary& dict
127  );
128 
129 
130  //- Destructor
131  virtual ~sampledPatchInternalField() = default;
132 
133 
134  // Member Functions
135 
136  // Sample
137 
138  //- Sample boundary of volume field onto surface faces
139  virtual tmp<scalarField> sample
140  (
141  const interpolation<scalar>& sampler
142  ) const;
143 
144  //- Sample boundary of volume field onto surface faces
145  virtual tmp<vectorField> sample
146  (
147  const interpolation<vector>& sampler
148  ) const;
149 
150  //- Sample boundary of volume field onto surface faces
152  (
153  const interpolation<sphericalTensor>& sampler
154  ) const;
155 
156  //- Sample boundary of volume field onto surface faces
158  (
159  const interpolation<symmTensor>& sampler
160  ) const;
161 
162  //- Sample boundary of volume field onto surface faces
163  virtual tmp<tensorField> sample
164  (
165  const interpolation<tensor>& sampler
166  ) const;
167 
168 
169  // Interpolate
170 
171  //- Interpolate boundary of volume field onto surface points
173  (
174  const interpolation<scalar>& interpolator
175  ) const;
176 
177  //- Interpolate boundary of volume field onto surface points
179  (
180  const interpolation<vector>& interpolator
181  ) const;
182 
183  //- Interpolate boundary of volume field onto surface points
185  (
186  const interpolation<sphericalTensor>& interpolator
187  ) const;
188 
189  //- Interpolate boundary of volume field onto surface points
191  (
192  const interpolation<symmTensor>& interpolator
193  ) const;
194 
195  //- Interpolate boundary of volume field onto surface points
197  (
198  const interpolation<tensor>& interpolator
199  ) const;
200 
201 
202  // Output
203 
204  //- Print information
205  virtual void print(Ostream& os, int level=0) const;
206 };
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 } // End namespace Foam
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #ifdef NoRepository
217 #endif
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #endif
222 
223 // ************************************************************************* //
sampledPatch.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::sampledPatchInternalField::print
virtual void print(Ostream &os, int level=0) const
Print information.
Definition: sampledPatchInternalField.C:231
Foam::sampledPatchInternalField::sample
virtual tmp< scalarField > sample(const interpolation< scalar > &sampler) const
Sample boundary of volume field onto surface faces.
Definition: sampledPatchInternalField.C:141
Foam::sampledPatchInternalField
Variation of sampledPatch that samples the internalField (at a given normal distance from the patch) ...
Definition: sampledPatchInternalField.H:120
Foam::sampledPatchInternalField::TypeName
TypeName("sampledPatchInternalField")
Runtime type information.
Foam::sampledPatchInternalField::~sampledPatchInternalField
virtual ~sampledPatchInternalField()=default
Destructor.
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
sampledPatchInternalFieldTemplates.C
Foam::sampledSurface::interpolate
bool interpolate() const noexcept
Same as isPointData()
Definition: sampledSurface.H:598
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
Foam::interpolation
Abstract base class for interpolation.
Definition: mappedPatchFieldBase.H:96
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::sampledPatchInternalField::sampledPatchInternalField
sampledPatchInternalField(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
Definition: sampledPatchInternalField.C:55
os
OBJstream os(runTime.globalPath()/outputName)
Foam::sampledSurface::name
const word & name() const noexcept
Name of surface.
Definition: sampledSurface.H:322
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::sampledSurface::mesh
const polyMesh & mesh() const noexcept
Access to the underlying mesh.
Definition: sampledSurface.H:316
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::sampledPatch
A sampledSurface on patches. Non-triangulated by default.
Definition: sampledPatch.H:95
mappedPatchBase.H