parFvFieldReconstructor.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) 2015 OpenFOAM Foundation
9  Copyright (C) 2018 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::parFvFieldReconstructor
29 
30 Description
31  Finite volume reconstructor for volume and surface fields.
32 
33  Runs in parallel. Reconstructs from procMesh to baseMesh. baseMesh
34  is non-zero cells on processor0 only.
35 
36 SourceFiles
37  parFvFieldReconstructor.C
38  parFvFieldReconstructorFields.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef parFvFieldReconstructor_H
43 #define parFvFieldReconstructor_H
44 
45 #include "PtrList.H"
46 #include "fvMesh.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward declarations
54 class mapDistributePolyMesh;
55 class mapDistributeBase;
56 class IOobjectList;
57 
58 /*---------------------------------------------------------------------------*\
59  Class parFvFieldReconstructor Declaration
60 \*---------------------------------------------------------------------------*/
61 
63 {
64  // Private data
65 
66  //- Reconstructed mesh reference
67  fvMesh& baseMesh_;
68 
69  //- Processor mesh reference
70  const fvMesh& procMesh_;
71 
72  //- Distribution map reference
73  const mapDistributePolyMesh& distMap_;
74 
75  //- Do I need to to write (usually master only)
76  const bool isWriteProc_;
77 
78  //- Patch mappers
79  PtrList<mapDistributeBase> patchFaceMaps_;
80 
81 
82  // Private Member Functions
83 
84  //- Construct per-patch addressing
85  void createPatchFaceMaps();
86 
87  //- No copy construct
89 
90  //- No copy assignment
91  void operator=(const parFvFieldReconstructor&) = delete;
92 
93 
94 public:
95 
96  // Constructors
97 
98  //- Construct from components
100  (
101  fvMesh& baseMesh,
102  const fvMesh& procMesh,
103  const mapDistributePolyMesh& distMap,
104  const bool isWriteProc
105  );
106 
107 
108  // Member Functions
109 
110  //- Reconstruct volume internal field
111  template<class Type>
114  (
116  ) const;
117 
118  //- Read and reconstruct volume internal field
119  template<class Type>
121  reconstructFvVolumeInternalField(const IOobject& fieldIoObject) const;
122 
123 
124 
125  //- Reconstruct volume field
126  template<class Type>
129  (
131  ) const;
132 
133  //- Read and reconstruct volume field
134  template<class Type>
136  reconstructFvVolumeField(const IOobject& fieldIoObject) const;
137 
138 
139 
140  //- Reconstruct surface field
141  template<class Type>
144  (
146  ) const;
147 
148  //- Read and reconstruct surface field
149  template<class Type>
151  reconstructFvSurfaceField(const IOobject& fieldIoObject) const;
152 
153 
154  //- Read, reconstruct and write all/selected volume internal fields
155  template<class Type>
157  (
158  const IOobjectList& objects,
159  const wordRes& selectedFields = wordRes()
160  ) const;
161 
162  //- Read, reconstruct and write all/selected volume fields
163  template<class Type>
165  (
166  const IOobjectList& objects,
167  const wordRes& selectedFields = wordRes()
168  ) const;
169 
170  //- Read, reconstruct and write all/selected surface fields
171  template<class Type>
173  (
174  const IOobjectList& objects,
175  const wordRes& selectedFields = wordRes()
176  ) const;
177 
178  //- Helper: reconstruct and write mesh points
179  // (note: should be moved to something like processorMeshes class)
180  void reconstructPoints();
181 };
182 
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 } // End namespace Foam
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 #ifdef NoRepository
192 #endif
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 #endif
197 
198 // ************************************************************************* //
Foam::parFvFieldReconstructor::reconstructFvVolumeInternalFields
label reconstructFvVolumeInternalFields(const IOobjectList &objects, const wordRes &selectedFields=wordRes()) const
Read, reconstruct and write all/selected volume internal fields.
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::parFvFieldReconstructor::reconstructFvVolumeInternalField
tmp< DimensionedField< Type, volMesh > > reconstructFvVolumeInternalField(const DimensionedField< Type, volMesh > &) const
Reconstruct volume internal field.
Foam::parFvFieldReconstructor::reconstructPoints
void reconstructPoints()
Helper: reconstruct and write mesh points.
parFvFieldReconstructorFields.C
Foam::parFvFieldReconstructor::reconstructFvSurfaceFields
label reconstructFvSurfaceFields(const IOobjectList &objects, const wordRes &selectedFields=wordRes()) const
Read, reconstruct and write all/selected surface fields.
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
fld
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputLagrangian.H:23
Foam::parFvFieldReconstructor::reconstructFvSurfaceField
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > reconstructFvSurfaceField(const GeometricField< Type, fvsPatchField, surfaceMesh > &) const
Reconstruct surface field.
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::IOobjectList
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:55
Foam::parFvFieldReconstructor::reconstructFvVolumeFields
label reconstructFvVolumeFields(const IOobjectList &objects, const wordRes &selectedFields=wordRes()) const
Read, reconstruct and write all/selected volume fields.
Foam::parFvFieldReconstructor::reconstructFvVolumeField
tmp< GeometricField< Type, fvPatchField, volMesh > > reconstructFvVolumeField(const GeometricField< Type, fvPatchField, volMesh > &fld) const
Reconstruct volume field.
Foam::wordRes
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:51
PtrList.H
Foam::mapDistributePolyMesh
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Definition: mapDistributePolyMesh.H:66
Foam::GeometricField< Type, fvPatchField, volMesh >
Foam::parFvFieldReconstructor
Finite volume reconstructor for volume and surface fields.
Definition: parFvFieldReconstructor.H:61
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54