Loading...
Searching...
No Matches
processorFaPatch.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) 2016-2017 Wikki Ltd
9 Copyright (C) 2019-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::processorFaPatch
29
30Description
31 Processor patch.
32
33Author
34 Zeljko Tukovic, FMENA
35 Hrvoje Jasak, Wikki Ltd.
36
37SourceFiles
38 processorFaPatch.C
39
40\*---------------------------------------------------------------------------*/
41
42#ifndef Foam_processorFaPatch_H
43#define Foam_processorFaPatch_H
44
45#include "coupledFaPatch.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
53/*---------------------------------------------------------------------------*\
54 Class processorFaPatch Declaration
55\*---------------------------------------------------------------------------*/
56
58:
59 public coupledFaPatch,
61{
62 // Private Data
63
64 //- My processor number
65 int myProcNo_;
66
67 //- Neighbour processor number
68 int neighbProcNo_;
69
70 //- Processor-neighbour patch edge centres
71 vectorField neighbEdgeCentres_;
72
73 //- Processor-neighbour patch edge lengths
74 vectorField neighbEdgeLengths_;
75
76 //- Processor-neighbour patch neighbour face centres
77 vectorField neighbEdgeFaceCentres_;
78
79 //- Corresponding neighbouring local point label for every local point
80 // (so localPoints()[i] == neighb.localPoints()[neighbPoints_[i]])
81 mutable autoPtr<labelList> neighbPointsPtr_;
82
83 //- The set of labels of the processor patch points which are
84 // non-global, i.e. present in this processor patch
85 mutable autoPtr<labelList> nonGlobalPatchPointsPtr_;
86
87
88protected:
89
90 // Protected Member functions
91
92 //- Construct from components with specified name
94 (
95 const word& name,
97 const label index,
98 const faBoundaryMesh& bm,
99 const label nbrPolyPatchi,
100 const label myProcNo,
101 const label neighbProcNo,
102 const word& patchType = typeName
103 );
104
105 //- Make patch weighting factors
106 void makeWeights(scalarField&) const;
107
108 //- Make patch geodesic distance between P and N
109 void makeLPN(scalarField&) const;
110
111 //- Make patch face - neighbour cell distances
112 void makeDeltaCoeffs(scalarField&) const;
113
114 //- Make non-orthogonality correction vectors
116
117 //- Find non-globa patch points
118 void makeNonGlobalPatchPoints() const;
119
120
121 // Geometry Functions
122
123 //- Initialise the calculation of the patch geometry
125
126 //- Calculate the patch geometry
128
129 //- Initialise the patches for moving points
131
132 //- Correct patches after moving points
133 void movePoints(PstreamBuffers&, const pointField&);
134
135 //- Initialise the update of the patch topology
136 virtual void initUpdateMesh(PstreamBuffers&);
137
138 //- Update of the patch topology
139 virtual void updateMesh(PstreamBuffers&);
140
141
142public:
143
144 //- Runtime type information
145 TypeName("processor");
146
147
148 // Constructors
149
150 //- Construct from components with automatically generated standard name
152 (
153 const labelUList& edgeLabels,
154 const label index,
155 const faBoundaryMesh& bm,
156 const label nbrPolyPatchi,
157 const label myProcNo,
158 const label neighbProcNo,
159 const word& patchType = typeName
160 );
161
162 //- Construct from dictionary
164 (
165 const word& name,
166 const dictionary& dict,
167 const label index,
168 const faBoundaryMesh& bm,
169 const word& patchType = typeName
170 );
171
172
173 //- Destructor
174 virtual ~processorFaPatch();
175
176
177 // Member Functions
178
179 //- Return interface size
180 virtual label interfaceSize() const noexcept
181 {
182 return size();
183 }
184
185 //- Return processor number
186 int myProcNo() const noexcept
187 {
188 return myProcNo_;
189 }
190
191 //- Return neighbour processor number
192 int neighbProcNo() const noexcept
193 {
194 return neighbProcNo_;
195 }
196
197 //- Return true if running parallel
198 virtual bool coupled() const
199 {
200 return UPstream::parRun();
201 }
202
203 //- Does this side own the patch ?
204 virtual bool owner() const noexcept
205 {
206 return (myProcNo_ < neighbProcNo_);
207 }
208
209
210 //- The message tag to use for communication
211 virtual int tag() const
212 {
213 return UPstream::msgType();
214 }
215
216 //- Return communicator used for communication
217 virtual label comm() const;
218
219
220 //- Return face transformation tensor
221 virtual const tensorField& forwardT() const
222 {
224 }
226 //- Return delta (P to N) vectors across coupled patch
227 virtual tmp<vectorField> delta() const;
228
229
230 //- Return processor-neighbour patch edge centres
232 {
233 return neighbEdgeCentres_;
234 }
235
236 //- Return processor-neighbour patch edge lengths
238 {
239 return neighbEdgeLengths_;
240 }
242 //- Return processor-neighbour patch edge unit normals
244
245 //- Return processor-neighbour patch neighbour face centres
247 {
248 return neighbEdgeFaceCentres_;
250
251 //- Return neighbour point labels. This is for my local point the
252 // corresponding local point on the other side. Call
253 // faBoundaryMesh::updateMesh() on all processors
254 // before using this.
255 const labelList& neighbPoints() const;
256
257 //- Return the set of labels of the processor patch points which are
258 // non-global, i.e. present in this processorFaPatch
259 const labelList& nonGlobalPatchPoints() const;
260
261
262 // Interface transfer functions
263
264 //- Return the values of the given internal data adjacent to
265 //- the interface as a field
267 (
268 const labelUList& internalData
269 ) const;
270
271 //- Return the values of the given internal data adjacent to
272 //- the interface as a field using edgeFaces
274 (
275 const labelUList& internalData,
276 const labelUList& edgeFaces
277 ) const;
278
279 //- Initialise interface data transfer
280 virtual void initTransfer
281 (
282 const Pstream::commsTypes commsType,
283 const labelUList& interfaceData
284 ) const;
285
286 //- Transfer and return neighbour field
288 (
289 const Pstream::commsTypes commsType,
290 const labelUList& interfaceData
291 ) const;
292
293 //- Initialise neighbour field transfer
295 (
296 const Pstream::commsTypes commsType,
297 const labelUList& internalData
298 ) const;
299
300 //- Return neighbour field
303 const Pstream::commsTypes commsType,
304 const labelUList& internalData
305 ) const;
306
307 //- Return neighbour field using mapping
309 (
310 const Pstream::commsTypes commsType,
311 const labelUList& internalData,
312 const labelUList& edgeCells
313 ) const;
314
315 //- Write the patch data as a dictionary
316 virtual void write(Ostream& os) const;
317};
318
319
320// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
321
322} // End namespace Foam
323
324// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
325
326#endif
327
328// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Buffers for inter-processor communications streams (UOPstream, UIPstream).
commsTypes
Communications types.
Definition UPstream.H:81
static int & msgType() noexcept
Message tag of standard messages.
Definition UPstream.H:1926
static bool & parRun() noexcept
Test if this a parallel run.
Definition UPstream.H:1681
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
const tensorField & forwardT() const
Return face transformation tensor.
coupledFaPatch(const word &name, const labelUList &edgeLabels, const label index, const faBoundaryMesh &bm, const label nbrPolyPatchIndex, const word &patchType)
Construct from components.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Finite area boundary mesh, which is a faPatch list with registered IO, a reference to the associated ...
virtual label size() const
Patch size is the number of edge labels, but can be overloaded.
Definition faPatch.H:392
const labelList & edgeLabels() const noexcept
Return the list of edges.
Definition faPatch.H:335
const labelUList & edgeFaces() const
Return edge-face addressing.
Definition faPatch.C:424
label index() const noexcept
The index of this patch in the boundaryMesh.
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
virtual void initTransfer(const Pstream::commsTypes commsType, const labelUList &interfaceData) const
Initialise interface data transfer.
virtual ~processorFaPatch()
Destructor.
processorFaPatch(const word &name, const labelUList &edgeLabels, const label index, const faBoundaryMesh &bm, const label nbrPolyPatchi, const label myProcNo, const label neighbProcNo, const word &patchType=typeName)
Construct from components with specified name.
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
virtual bool coupled() const
Return true if running parallel.
void makeWeights(scalarField &) const
Make patch weighting factors.
void makeLPN(scalarField &) const
Make patch geodesic distance between P and N.
virtual label interfaceSize() const noexcept
Return interface size.
virtual bool owner() const noexcept
Does this side own the patch ?
void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
const labelList & neighbPoints() const
Return neighbour point labels. This is for my local point the.
void makeNonGlobalPatchPoints() const
Find non-globa patch points.
void makeDeltaCoeffs(scalarField &) const
Make patch face - neighbour cell distances.
int neighbProcNo() const noexcept
Return neighbour processor number.
virtual tmp< labelField > transfer(const Pstream::commsTypes commsType, const labelUList &interfaceData) const
Transfer and return neighbour field.
void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
tmp< vectorField > neighbEdgeNormals() const
Return processor-neighbour patch edge unit normals.
virtual label comm() const
Return communicator used for communication.
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
const vectorField & neighbEdgeCentres() const noexcept
Return processor-neighbour patch edge centres.
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Initialise neighbour field transfer.
int myProcNo() const noexcept
Return processor number.
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
Return the values of the given internal data adjacent to the interface as a field.
void movePoints(PstreamBuffers &, const pointField &)
Correct patches after moving points.
const vectorField & neighbEdgeFaceCentres() const noexcept
Return processor-neighbour patch neighbour face centres.
const labelList & nonGlobalPatchPoints() const
Return the set of labels of the processor patch points which are.
virtual int tag() const
The message tag to use for communication.
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
TypeName("processor")
Runtime type information.
const vectorField & neighbEdgeLengths() const noexcept
Return processor-neighbour patch edge lengths.
void makeCorrectionVectors(vectorField &) const
Make non-orthogonality correction vectors.
virtual const tensorField & forwardT() const
Return face transformation tensor.
processorLduInterface() noexcept=default
Default construct.
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Field< vector > vectorField
Specialisation of Field<T> for vector.
const direction noexcept
Definition scalarImpl.H:265
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
vectorField pointField
pointField is a vectorField.
UList< label > labelUList
A UList of labels.
Definition UList.H:75
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68