coupledFaPatch.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) 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::coupledFaPatch
29
30Author
31 Zeljko Tukovic and Hrvoje Jasak
32
33Description
34 coupledFaPatch is an abstract base class for patches that couple regions
35 of the computational domain e.g. cyclic, arbitrary interfaces, sliding
36 interfaces and processor-processor links.
37
38SourceFiles
39 coupledFaPatch.C
40
41\*---------------------------------------------------------------------------*/
42
43#ifndef Foam_coupledFaPatch_H
44#define Foam_coupledFaPatch_H
45
46#include "lduInterface.H"
47#include "faPatch.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
53
54/*---------------------------------------------------------------------------*\
55 Class coupledFaPatch Declaration
56\*---------------------------------------------------------------------------*/
59:
60 public lduInterface,
61 public faPatch
62{
63 // Private Data
64
65 //- offset (distance) vector from one side of the couple to the other
66 mutable vectorField separation_;
67
68 //- Face transformation tensor
69 mutable tensorField forwardT_;
70
71 //- Neighbour-cell transformation tensor
72 mutable tensorField reverseT_;
73
74
75protected:
76
77 // Protected Member Functions
78
79 //- Make patch weighting factors
80 virtual void makeWeights(scalarField&) const = 0;
81
82 //- Make patch face - neighbour cell distances
83 virtual void makeDeltaCoeffs(scalarField&) const = 0;
84
85 //- Calculate the uniform transformation tensors
87 (
88 const vector& Cf,
89 const vector& Cr,
90 const vector& nf,
91 const vector& nr
92 ) const;
93
94 //- Calculate the transformation tensors
96 (
97 const vectorField& Cf,
98 const vectorField& Cr,
99 const vectorField& nf,
100 const vectorField& nr
101 ) const;
102
103
104public:
105
106 //- Runtime type information
107 TypeName("coupled");
108
109
110 // Constructors
111
112 //- Construct from components
114 (
115 const word& name,
116 const labelList& edgeLabels,
117 const label index,
118 const faBoundaryMesh& bm,
119 const label nbrPolyPatchIndex,
120 const word& patchType
121 )
122 :
123 faPatch(name, edgeLabels, index, bm, nbrPolyPatchIndex, patchType)
124 {}
125
126 //- Construct from dictionary
128 (
129 const word& name,
130 const dictionary& dict,
131 const label index,
132 const faBoundaryMesh& bm,
133 const word& patchType
134 )
135 :
136 faPatch(name, dict, index, bm, patchType)
137 {}
138
139
140 //- Destructor
141 virtual ~coupledFaPatch() = default;
142
143
144 // Member Functions
145
146 // Access
147
148 //- Return true because this patch is coupled
149 virtual bool coupled() const
150 {
151 return true;
152 }
153
154 //- Does this side own the patch ?
155 virtual bool owner() const = 0;
156
157 //- Does the coupled side own the patch ?
158 virtual bool neighbour() const
159 {
160 return !owner();
161 }
162
163 //- Are the coupled planes separated?
164 bool separated() const
165 {
166 return separation_.size();
167 }
168
169 //- Return the offset (distance) vector from one side of the couple
170 // to the other
171 const vectorField& separation() const
172 {
173 if (!separation_.size())
174 {
176 << "Coupled patches are not separated"
177 << abort(FatalError);
178 }
179
180 return separation_;
181 }
182
183 //- Return face transformation tensor
184 const tensorField& forwardT() const
185 {
186 if (!forwardT_.size())
187 {
189 << "Coupled planes do not need transformation"
190 << abort(FatalError);
191 }
192
193 return forwardT_;
194 }
195
196 //- Return neighbour-cell transformation tensor
197 const tensorField& reverseT() const
198 {
199 if (!reverseT_.size())
200 {
202 << "Coupled planes do not need transformation"
203 << abort(FatalError);
204 }
205
206 return reverseT_;
207 }
208
209 //- Are the cyclic planes parallel
210 bool parallel() const
211 {
212 return forwardT_.size() == 0;
213 }
214
215
216 //- Initialise the calculation of the patch geometry
217 virtual void initGeometry(PstreamBuffers&) = 0;
218
219 //- Calculate the patch geometry
220 virtual void calcGeometry(PstreamBuffers&) = 0;
221
222 //- Initialise the patches for moving points
223 virtual void initMovePoints(PstreamBuffers&, const pointField&) = 0;
224
225 //- Correct patches after moving points
226 virtual void movePoints(PstreamBuffers&, const pointField&) = 0;
227
228
229 // Access functions for demand driven data
230
231 //- Return delta (P to N) vectors across coupled patch
232 virtual tmp<vectorField> delta() const = 0;
233
234
235 // Interface transfer functions
236
237 //- Return faceCell addressing: lduInterface virtual function
238 virtual const labelUList& faceCells() const
239 {
240 return edgeFaces();
241 }
242
243 //- Return the values of the given internal data adjacent to
244 // the interface as a field
246 (
247 const labelUList& internalData
248 ) const = 0;
249
250 //- Initialise interface data transfer
251 virtual void initTransfer
252 (
253 const Pstream::commsTypes commsType,
254 const labelUList& interfaceData
255 ) const
256 {}
257
258 //- Transfer and return neighbour field
260 (
261 const Pstream::commsTypes commsType,
262 const labelUList& interfaceData
263 ) const = 0;
264
265 //- Initialise neighbour field transfer
266 virtual void initInternalFieldTransfer
267 (
268 const Pstream::commsTypes commsType,
269 const labelUList& iF
270 ) const
271 {}
272
273 //- Return neighbour field
275 (
276 const Pstream::commsTypes commsType,
277 const labelUList& iF
278 ) const = 0;
279};
280
281
282// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
283
284} // End namespace Foam
285
286// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
287
288#endif
289
290// ************************************************************************* //
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
commsTypes
Types of communications.
Definition: UPstream.H:67
coupledFaPatch is an abstract base class for patches that couple regions of the computational domain ...
virtual ~coupledFaPatch()=default
Destructor.
bool separated() const
Are the coupled planes separated?
const vectorField & separation() const
Return the offset (distance) vector from one side of the couple.
const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
virtual void makeDeltaCoeffs(scalarField &) const =0
Make patch face - neighbour cell distances.
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Initialise neighbour field transfer.
virtual void initMovePoints(PstreamBuffers &, const pointField &)=0
Initialise the patches for moving points.
virtual bool coupled() const
Return true because this patch is coupled.
virtual tmp< labelField > transfer(const Pstream::commsTypes commsType, const labelUList &interfaceData) const =0
Transfer and return neighbour field.
virtual void calcGeometry(PstreamBuffers &)=0
Calculate the patch geometry.
const tensorField & forwardT() const
Return face transformation tensor.
bool parallel() const
Are the cyclic planes parallel.
virtual void makeWeights(scalarField &) const =0
Make patch weighting factors.
coupledFaPatch(const word &name, const labelList &edgeLabels, const label index, const faBoundaryMesh &bm, const label nbrPolyPatchIndex, const word &patchType)
Construct from components.
virtual const labelUList & faceCells() const
Return faceCell addressing: lduInterface virtual function.
virtual void initTransfer(const Pstream::commsTypes commsType, const labelUList &interfaceData) const
Initialise interface data transfer.
virtual void movePoints(PstreamBuffers &, const pointField &)=0
Correct patches after moving points.
virtual tmp< vectorField > delta() const =0
Return delta (P to N) vectors across coupled patch.
virtual bool owner() const =0
Does this side own the patch ?
TypeName("coupled")
Runtime type information.
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const =0
Return neighbour field.
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const =0
Return the values of the given internal data adjacent to.
void calcTransformTensors(const vector &Cf, const vector &Cr, const vector &nf, const vector &nr) const
Calculate the uniform transformation tensors.
virtual bool neighbour() const
Does the coupled side own the patch ?
coupledFaPatch(const word &name, const dictionary &dict, const label index, const faBoundaryMesh &bm, const word &patchType)
Construct from dictionary.
virtual void initGeometry(PstreamBuffers &)=0
Initialise the calculation of the patch geometry.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Finite area boundary mesh.
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:78
const labelList & edgeLabels() const noexcept
Return the list of edges.
Definition: faPatch.H:275
const labelUList & edgeFaces() const
Return edge-face addressing.
Definition: faPatch.C:429
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
Definition: lduInterface.H:58
label index() const noexcept
The index of this patch in the boundaryMesh.
const word & name() const noexcept
The patch name.
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Namespace for OpenFOAM.
errorManip< error > abort(error &err)
Definition: errorManip.H:144
error FatalError
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73