volPointInterpolation.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) 2016 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::volPointInterpolation
29 
30 Description
31  Interpolate from cell centres to points (vertices) using inverse distance
32  weighting
33 
34 SourceFiles
35  volPointInterpolation.C
36  volPointInterpolate.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef volPointInterpolation_H
41 #define volPointInterpolation_H
42 
43 #include "MeshObject.H"
44 #include "scalarList.H"
45 #include "volFields.H"
46 #include "pointFields.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 class fvMesh;
54 class pointMesh;
55 
56 /*---------------------------------------------------------------------------*\
57  Class volPointInterpolation Declaration
58 \*---------------------------------------------------------------------------*/
59 
61 :
62  public MeshObject<fvMesh, UpdateableMeshObject, volPointInterpolation>
63 {
64  // Private data
65 
66  //- Interpolation scheme weighting factor array.
67  scalarListList pointWeights_;
68 
69 
70  // Boundary handling
71 
72  //- Boundary addressing
73  autoPtr<primitivePatch> boundaryPtr_;
74 
75  //- Per boundary face whether is on non-coupled patch
76  boolList boundaryIsPatchFace_;
77 
78  //- Per mesh(!) point whether is on non-coupled patch (on any
79  // processor)
80  boolList isPatchPoint_;
81 
82  //- Per boundary point the weights per pointFaces.
83  scalarListList boundaryPointWeights_;
84 
85 
86  // Private Member Functions
87 
88  //- Construct addressing over all boundary faces
89  void calcBoundaryAddressing();
90 
91  //- Make weights for internal and coupled-only boundarypoints
92  void makeInternalWeights(scalarField& sumWeights);
93 
94  //- Make weights for points on uncoupled patches
95  void makeBoundaryWeights(scalarField& sumWeights);
96 
97  //- Construct all point weighting factors
98  void makeWeights();
99 
100  //- Helper: push master point data to collocated points
101  template<class Type>
102  void pushUntransformedData(List<Type>&) const;
103 
104  //- Get boundary field in same order as boundary faces. Field is
105  // zero on all coupled and empty patches
106  template<class Type>
107  tmp<Field<Type>> flatBoundaryField
108  (
110  ) const;
111 
112  //- Add separated contributions
113  template<class Type>
114  void addSeparated
115  (
117  ) const;
118 
119  //- No copy construct
121 
122  //- No copy assignment
123  void operator=(const volPointInterpolation&) = delete;
124 
125 
126 public:
127 
128  // Declare name of the class and its debug switch
129  ClassName("volPointInterpolation");
130 
131 
132  // Constructors
133 
134  //- Constructor given fvMesh and pointMesh.
135  explicit volPointInterpolation(const fvMesh&);
136 
137 
138  //- Destructor
140 
141 
142  // Member functions
143 
144  // Edit
145 
146  //- Update mesh topology using the morph engine
147  void updateMesh(const mapPolyMesh&);
148 
149  //- Correct weighting factors for moving mesh.
150  bool movePoints();
151 
152 
153  // Interpolation Functions
154 
155  //- Interpolate volField using inverse distance weighting
156  // \return pointField
157  template<class Type>
159  (
161  ) const;
162 
163  //- Interpolate tmp<volField> using inverse distance weighting
164  // \return pointField
165  template<class Type>
167  (
169  ) const;
170 
171  //- Interpolate volField using inverse distance weighting
172  // returning pointField with the same patchField types. Assigns
173  // to any fixedValue boundary conditions to make them consistent
174  // with internal field
175  template<class Type>
177  (
179  const wordList& patchFieldTypes
180  ) const;
181 
182  //- Interpolate tmp<volField> using inverse distance weighting
183  // returning pointField with the same patchField types. Assigns
184  // to any fixedValue boundary conditions to make them consistent
185  // with internal field
186  template<class Type>
188  (
190  const wordList& patchFieldTypes
191  ) const;
192 
193  //- Interpolate dimensionedField using inverse distance weighting
194  // \return pointField
195  template<class Type>
197  (
199  ) const;
200 
201  //- Interpolate tmp<dimensionedField> using inverse distance
202  // weighting returning pointField
203  template<class Type>
205  (
207  ) const;
208 
209 
210  // Low level
211 
212  //- Interpolate internal field from volField to pointField
213  // using inverse distance weighting
214  template<class Type>
216  (
219  ) const;
220 
221  //- Interpolate boundary field without applying constraints/boundary
222  // conditions
223  template<class Type>
225  (
228  ) const;
229 
230  //- Interpolate boundary with constraints/boundary conditions
231  template<class Type>
233  (
236  const bool overrideFixedValue
237  ) const;
238 
239  //- Interpolate from volField to pointField
240  // using inverse distance weighting
241  template<class Type>
242  void interpolate
243  (
246  ) const;
247 
248  //- Interpolate volField using inverse distance weighting
249  // returning pointField with name. Optionally caches
250  template<class Type>
252  (
254  const word& name,
255  const bool cache
256  ) const;
257 
258  //- Interpolate dimensioned internal field from cells to points
259  // using inverse distance weighting
260  template<class Type>
262  (
265  ) const;
266 
267  //- Interpolate dimensionedField using inverse distance weighting
268  // returning pointField with name. Optionally caches
269  template<class Type>
271  (
273  const word& name,
274  const bool cache
275  ) const;
276 
277  // Interpolation for displacement (applies 2D correction)
278 
279  //- Interpolate from volField to pointField
280  // using inverse distance weighting
282  (
283  const volVectorField&,
285  ) const;
286 
287 };
288 
289 
290 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
291 
292 } // End namespace Foam
293 
294 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
295 
296 #ifdef NoRepository
297  #include "volPointInterpolate.C"
298 #endif
299 
300 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
301 
302 #endif
303 
304 // ************************************************************************* //
volFields.H
Foam::IOobject::name
const word & name() const
Return name.
Definition: IOobjectI.H:70
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::volPointInterpolation::ClassName
ClassName("volPointInterpolation")
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::volPointInterpolation::interpolate
tmp< GeometricField< Type, pointPatchField, pointMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &) const
Interpolate volField using inverse distance weighting.
Foam::volPointInterpolation::updateMesh
void updateMesh(const mapPolyMesh &)
Update mesh topology using the morph engine.
Definition: volPointInterpolation.C:367
scalarList.H
Foam::Field< scalar >
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::volPointInterpolation::~volPointInterpolation
~volPointInterpolation()
Destructor.
Definition: volPointInterpolation.C:361
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
volPointInterpolate.C
Foam::List< scalarList >
Foam::volPointInterpolation::movePoints
bool movePoints()
Correct weighting factors for moving mesh.
Definition: volPointInterpolation.C:373
Foam::volPointInterpolation::interpolateInternalField
void interpolateInternalField(const GeometricField< Type, fvPatchField, volMesh > &, GeometricField< Type, pointPatchField, pointMesh > &) const
Interpolate internal field from volField to pointField.
Definition: volPointInterpolate.C:133
Foam::volPointInterpolation::interpolateDisplacement
void interpolateDisplacement(const volVectorField &, pointVectorField &) const
Interpolate from volField to pointField.
Definition: volPointInterpolation.C:382
MeshObject.H
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:160
Foam::MeshObject
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: MeshObject.H:88
Foam::GeometricField< Type, fvPatchField, volMesh >
Foam::volPointInterpolation::interpolateDimensionedInternalField
void interpolateDimensionedInternalField(const DimensionedField< Type, volMesh > &vf, DimensionedField< Type, pointMesh > &pf) const
Interpolate dimensioned internal field from cells to points.
Definition: volPointInterpolate.C:170
Foam::volPointInterpolation::interpolateBoundaryField
void interpolateBoundaryField(const GeometricField< Type, fvPatchField, volMesh > &vf, GeometricField< Type, pointPatchField, pointMesh > &pf) const
Interpolate boundary field without applying constraints/boundary.
Definition: volPointInterpolate.C:277
Foam::volPointInterpolation
Interpolate from cell centres to points (vertices) using inverse distance weighting.
Definition: volPointInterpolation.H:59
pointFields.H
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54