fvFieldDecomposer.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-2023 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::fvFieldDecomposer
26 
27 Description
28  Finite Volume volume and surface field decomposer.
29 
30 SourceFiles
31  fvFieldDecomposer.C
32  fvFieldDecomposerTemplates.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef fvFieldDecomposer_H
37 #define fvFieldDecomposer_H
38 
39 #include "fvMesh.H"
40 #include "IOobjectList.H"
41 #include "volFields.H"
42 #include "surfaceFields.H"
43 #include "forwardFieldMapper.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 class IOobjectList;
51 
52 /*---------------------------------------------------------------------------*\
53  Class fvFieldDecomposer Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 {
58 public:
59 
60  // Public Classes
61 
62  //- Patch field decomposer class
64  :
65  public labelList,
66  public forwardFieldMapper
67  {
68  public:
69 
70  // Constructors
71 
72  //- Construct given addressing
73  patchFieldDecomposer(const labelUList& addressing);
74  };
75 
76 
77 private:
78 
79  // Private Data
80 
81  //- Reference to complete mesh
82  const fvMesh& completeMesh_;
83 
84  //- List of processor meshes
85  const PtrList<fvMesh>& procMeshes_;
86 
87  //- Reference to face addressing
88  const labelListList& faceProcAddressing_;
89 
90  //- Reference to cell addressing
91  const labelListList& cellProcAddressing_;
92 
93  //- Reference to face addressing boundary field
94  const PtrList<surfaceLabelField::Boundary>& faceProcAddressingBf_;
95 
96  //- List of patch field decomposers
97  PtrList<PtrList<patchFieldDecomposer>> patchFieldDecomposers_;
98 
99 
100  // Private Member Functions
101 
102  //- Convert a processor patch to the corresponding complete patch index
103  label completePatchID(const label proci, const label procPatchi) const;
104 
105  //- Map cell values to faces
106  template<class Type>
107  static tmp<Field<Type>> mapCellToFace
108  (
109  const labelUList& owner,
110  const labelUList& neighbour,
111  const Field<Type>& field,
112  const labelUList& addressing
113  );
114 
115  //- Map face values to faces
116  template<class Type>
117  static tmp<Field<Type>> mapFaceToFace
118  (
119  const Field<Type>& field,
120  const labelUList& addressing,
121  const bool isFlux
122  );
123 
124  //- Decompose a volume internal field
125  template<class Type>
127  decomposeVolInternalField(const IOobject& fieldIoObject) const;
128 
129  //- Decompose a volume field
130  template<class Type>
132  decomposeVolField(const IOobject& fieldIoObject) const;
133 
134  //- Decompose a surface field
135  template<class Type>
137  decomposeFvSurfaceField(const IOobject& fieldIoObject) const;
138 
139 
140 public:
141 
142  // Constructors
143 
144  //- Construct from components
146  (
147  const fvMesh& completeMesh,
148  const PtrList<fvMesh>& procMeshes,
149  const labelListList& faceProcAddressing,
150  const labelListList& cellProcAddressing,
151  const PtrList<surfaceLabelField::Boundary>& faceProcAddressingBf
152  );
153 
154  //- Disallow default bitwise copy construction
155  fvFieldDecomposer(const fvFieldDecomposer&) = delete;
156 
157 
158  //- Destructor
160 
161 
162  // Member Functions
163 
164  //- Return whether anything in the object list gets decomposed
165  static bool decomposes(const IOobjectList& objects);
166 
167  //- Read, decompose and write all volume internal fields
168  template<class Type>
170 
171  //- Read, decompose and write all volume fields
172  template<class Type>
174 
175  //- Read, decompose and write all surface fields
176  template<class Type>
178 
179 
180  // Member Operators
181 
182  //- Disallow default bitwise assignment
183  void operator=(const fvFieldDecomposer&) = delete;
184 };
185 
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 } // End namespace Foam
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 #ifdef NoRepository
195 #endif
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #endif
200 
201 // ************************************************************************* //
Pre-declare SubField and related Field type.
Definition: Field.H:83
List of IOobjects with searching and retrieving facilities.
Definition: IOobjectList.H:53
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
Forward field mapper.
patchFieldDecomposer(const labelUList &addressing)
Construct given addressing.
Finite Volume volume and surface field decomposer.
void decomposeVolFields(const IOobjectList &objects)
Read, decompose and write all volume fields.
static bool decomposes(const IOobjectList &objects)
Return whether anything in the object list gets decomposed.
void decomposeFvSurfaceFields(const IOobjectList &objects)
Read, decompose and write all surface fields.
void decomposeVolInternalFields(const IOobjectList &objects)
Read, decompose and write all volume internal fields.
fvFieldDecomposer(const fvMesh &completeMesh, const PtrList< fvMesh > &procMeshes, const labelListList &faceProcAddressing, const labelListList &cellProcAddressing, const PtrList< surfaceLabelField::Boundary > &faceProcAddressingBf)
Construct from components.
~fvFieldDecomposer()
Destructor.
void operator=(const fvFieldDecomposer &)=delete
Disallow default bitwise assignment.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.
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
bool isFlux(const DimensionedField< Type, surfaceMesh > &df)
Check if surfaceField is a flux.
Definition: surfaceFields.H:55
objects
Foam::surfaceFields.