Loading...
Searching...
No Matches
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{
54/*---------------------------------------------------------------------------*\
55 Class coupledFaPatch Declaration
56\*---------------------------------------------------------------------------*/
57
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 geodesic distance between P and N
83 virtual void makeLPN(scalarField&) const = 0;
84
85 //- Make patch face - neighbour cell distances
86 virtual void makeDeltaCoeffs(scalarField&) const = 0;
87
88 //- Make non-orthogonality correction vectors
89 virtual void makeCorrectionVectors(vectorField&) const = 0;
90
91 //- Calculate the uniform transformation tensors
93 (
94 const vector& Cf,
95 const vector& Cr,
96 const vector& nf,
97 const vector& nr
98 ) const;
99
100 //- Calculate the transformation tensors
102 (
103 const vectorField& Cf,
104 const vectorField& Cr,
105 const vectorField& nf,
106 const vectorField& nr
107 ) const;
108
109
110public:
111
112 //- Runtime type information
113 TypeNameNoDebug("coupled");
114
115
116 // Constructors
117
118 //- Construct from components
120 (
121 const word& name,
122 const labelUList& edgeLabels,
123 const label index,
124 const faBoundaryMesh& bm,
125 const label nbrPolyPatchIndex,
126 const word& patchType
127 )
129 faPatch(name, edgeLabels, index, bm, nbrPolyPatchIndex, patchType)
130 {}
131
132 //- Construct from dictionary
134 (
135 const word& name,
137 const label index,
138 const faBoundaryMesh& bm,
139 const word& patchType
140 )
141 :
142 faPatch(name, dict, index, bm, patchType)
143 {}
144
145
146 //- Destructor
147 virtual ~coupledFaPatch() = default;
148
149
150 // Member Functions
151
152 // Access
153
154 //- Return true because this patch is coupled
155 virtual bool coupled() const
156 {
157 return true;
158 }
159
160 //- Does this side own the patch ?
161 virtual bool owner() const = 0;
162
163 //- Does the coupled side own the patch ?
164 virtual bool neighbour() const
165 {
166 return !owner();
167 }
169 //- The referring patchID (eg, for cyclics).
170 // Here for consistency with coupledPolyPatch
171 virtual label referPatchID() const
172 {
173 return -1;
174 }
175
176 //- Are the coupled planes separated?
177 bool separated() const
179 return separation_.size();
180 }
181
182 //- Return the offset (distance) vector from one side of the couple
183 // to the other
184 const vectorField& separation() const
185 {
186 if (!separation_.size())
187 {
189 << "Coupled patches are not separated"
190 << abort(FatalError);
192
193 return separation_;
194 }
195
196 //- Return face transformation tensor
197 const tensorField& forwardT() const
198 {
199 if (!forwardT_.size())
200 {
202 << "Coupled planes do not need transformation"
203 << abort(FatalError);
204 }
205
206 return forwardT_;
207 }
208
209 //- Return neighbour-cell transformation tensor
210 const tensorField& reverseT() const
211 {
212 if (!reverseT_.size())
213 {
215 << "Coupled planes do not need transformation"
216 << abort(FatalError);
217 }
218
219 return reverseT_;
220 }
221
222 //- Are the cyclic planes parallel
223 bool parallel() const
224 {
225 return forwardT_.size() == 0;
226 }
227
228
229 //- Initialise the calculation of the patch geometry
230 virtual void initGeometry(PstreamBuffers&) = 0;
231
232 //- Calculate the patch geometry
233 virtual void calcGeometry(PstreamBuffers&) = 0;
235 //- Initialise the patches for moving points
236 virtual void initMovePoints(PstreamBuffers&, const pointField&) = 0;
237
238 //- Correct patches after moving points
239 virtual void movePoints(PstreamBuffers&, const pointField&) = 0;
240
241
242 // Access functions for demand driven data
243
244 //- Return delta (P to N) vectors across coupled patch
245 virtual tmp<vectorField> delta() const = 0;
246
247
248 // Interface transfer functions
250 //- Return faceCell addressing: lduInterface virtual function
251 virtual const labelUList& faceCells() const
252 {
253 return edgeFaces();
254 }
255
256 //- Return the values of the given internal data adjacent to
257 // the interface as a field
259 (
260 const labelUList& internalData
261 ) const = 0;
262
263 //- Initialise interface data transfer
264 virtual void initTransfer
265 (
266 const Pstream::commsTypes commsType,
267 const labelUList& interfaceData
268 ) const
269 {}
270
271 //- Transfer and return neighbour field
274 const Pstream::commsTypes commsType,
275 const labelUList& interfaceData
276 ) const = 0;
277
278 //- Initialise neighbour field transfer
279 virtual void initInternalFieldTransfer
280 (
281 const Pstream::commsTypes commsType,
282 const labelUList& iF
283 ) const
284 {}
285
286 //- Return neighbour field
289 const Pstream::commsTypes commsType,
290 const labelUList& iF
291 ) const = 0;
292};
293
294
295// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
296
297} // End namespace Foam
298
299// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
300
301#endif
302
303// ************************************************************************* //
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void size(const label n)
Older name for setAddressableSize.
Definition UList.H:118
commsTypes
Communications types.
Definition UPstream.H:81
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 label referPatchID() const
The referring patchID (eg, for cyclics).
virtual void makeLPN(scalarField &) const =0
Make patch geodesic distance between P and N.
virtual void makeWeights(scalarField &) const =0
Make patch weighting factors.
virtual void makeCorrectionVectors(vectorField &) const =0
Make non-orthogonality correction vectors.
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 bool owner() const =0
Does this side own the patch ?
TypeNameNoDebug("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.
coupledFaPatch(const word &name, const labelUList &edgeLabels, const label index, const faBoundaryMesh &bm, const label nbrPolyPatchIndex, const word &patchType)
Construct from components.
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 ?
virtual tmp< vectorField > delta() const =0
Return delta (P to N) vectors across coupled 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:133
const labelList & edgeLabels() const noexcept
Return the list of edges.
Definition faPatch.H:335
friend class faBoundaryMesh
The faPatch geometry initialisation is called by faBoundaryMesh.
Definition faPatch.H:130
const labelUList & edgeFaces() const
Return edge-face addressing.
Definition faPatch.C:424
lduInterface() noexcept=default
Default construct.
label index() const noexcept
The index of this patch in the boundaryMesh.
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
errorManip< error > abort(error &err)
Definition errorManip.H:139
Field< vector > vectorField
Specialisation of Field<T> for vector.
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
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.
Vector< scalar > vector
Definition vector.H:57
UList< label > labelUList
A UList of labels.
Definition UList.H:75
dictionary dict
#define TypeNameNoDebug(TypeNameString)
Declare a ClassNameNoDebug() with extra virtual type info.
Definition typeInfo.H:61