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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::coupledFaPatch
28 
29 Author
30  Zeljko Tukovic and Hrvoje Jasak
31 
32 Description
33  coupledFaPatch is an abstract base class for patches that couple regions
34  of the computational domain e.g. cyclic, arbitrary interfaces, sliding
35  interfaces and processor-processor links.
36 
37 SourceFiles
38  coupledFaPatch.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef coupledFaPatch_H
43 #define coupledFaPatch_H
44 
45 #include "lduInterface.H"
46 #include "faPatch.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class coupledFaPatch Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class coupledFaPatch
58 :
59  public lduInterface,
60  public faPatch
61 {
62  // Private data
63 
64  //- offset (distance) vector from one side of the couple to the other
65  mutable vectorField separation_;
66 
67  //- Face transformation tensor
68  mutable tensorField forwardT_;
69 
70  //- Neighbour-cell transformation tensor
71  mutable tensorField reverseT_;
72 
73 
74 protected:
75 
76  // Protected Member Functions
77 
78  //- Make patch weighting factors
79  virtual void makeWeights(scalarField&) const = 0;
80 
81  //- Make patch face - neighbour cell distances
82  virtual void makeDeltaCoeffs(scalarField&) const = 0;
83 
84  //- Calculate the uniform transformation tensors
86  (
87  const vector& Cf,
88  const vector& Cr,
89  const vector& nf,
90  const vector& nr
91  ) const;
92 
93  //- Calculate the transformation tensors
95  (
96  const vectorField& Cf,
97  const vectorField& Cr,
98  const vectorField& nf,
99  const vectorField& nr
100  ) const;
101 
102 
103 public:
104 
105  //- Runtime type information
106  TypeName("coupled");
107 
108 
109  // Constructors
110 
111  //- Construct from components
113  (
114  const word& name,
115  const labelList& edgeLabels,
116  const label index,
117  const faBoundaryMesh& bm,
118  const label ngbPolyPatchIndex
119  )
120  :
122  {}
123 
124  //- Construct from dictionary
126  (
127  const word& name,
128  const dictionary& dict,
129  const label index,
130  const faBoundaryMesh& bm
131  )
132  :
133  faPatch(name, dict, index, bm)
134  {}
135 
136 
137  //- Destructor
138  virtual ~coupledFaPatch() = default;
139 
140 
141  // Member Functions
142 
143  // Access
144 
145  //- Return true because this patch is coupled
146  virtual bool coupled() const
147  {
148  return true;
149  }
150 
151 
152  //- Are the coupled planes separated
153  bool separated() const
154  {
155  return separation_.size();
156  }
157 
158  //- Return the offset (distance) vector from one side of the couple
159  // to the other
160  const vectorField& separation() const
161  {
162  if (!separation_.size())
163  {
165  << "Coupled patches are not separated"
166  << abort(FatalError);
167  }
168 
169  return separation_;
170  }
171 
172  //- Return face transformation tensor
173  const tensorField& forwardT() const
174  {
175  if (!forwardT_.size())
176  {
178  << "Coupled planes do not need transformation"
179  << abort(FatalError);
180  }
181 
182  return forwardT_;
183  }
184 
185  //- Return neighbour-cell transformation tensor
186  const tensorField& reverseT() const
187  {
188  if (!reverseT_.size())
189  {
191  << "Coupled planes do not need transformation"
192  << abort(FatalError);
193  }
194 
195  return reverseT_;
196  }
197 
198  //- Are the cyclic planes parallel
199  bool parallel() const
200  {
201  return forwardT_.size() == 0;
202  }
203 
204 
205  //- Initialise the calculation of the patch geometry
206  virtual void initGeometry() = 0;
207 
208  //- Calculate the patch geometry
209  virtual void calcGeometry() = 0;
210 
211  //- Initialise the patches for moving points
212  virtual void initMovePoints(const pointField&) = 0;
213 
214  //- Correct patches after moving points
215  virtual void movePoints(const pointField&) = 0;
216 
217 
218  // Access functions for demand driven data
219 
220  //- Return delta (P to N) vectors across coupled patch
221  virtual tmp<vectorField> delta() const = 0;
222 
223 
224  // Interface transfer functions
225 
226  //- Return faceCell addressing: lduInterface virtual function
227  virtual const labelUList& faceCells() const
228  {
229  return edgeFaces();
230  }
231 
232  //- Return the values of the given internal data adjacent to
233  // the interface as a field
235  (
236  const labelUList& internalData
237  ) const = 0;
238 
239  //- Initialise interface data transfer
240  virtual void initTransfer
241  (
242  const Pstream::commsTypes commsType,
243  const labelUList& interfaceData
244  ) const
245  {}
246 
247  //- Transfer and return neighbour field
248  virtual tmp<labelField> transfer
249  (
250  const Pstream::commsTypes commsType,
251  const labelUList& interfaceData
252  ) const = 0;
253 
254  //- Initialise neighbour field transfer
256  (
257  const Pstream::commsTypes commsType,
258  const labelUList& iF
259  ) const
260  {}
261 
262  //- Return neighbour field
264  (
265  const Pstream::commsTypes commsType,
266  const labelUList& iF
267  ) const = 0;
268 };
269 
270 
271 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
272 
273 } // End namespace Foam
274 
275 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
276 
277 #endif
278 
279 // ************************************************************************* //
Foam::coupledFaPatch::calcGeometry
virtual void calcGeometry()=0
Calculate the patch geometry.
Foam::coupledFaPatch::parallel
bool parallel() const
Are the cyclic planes parallel.
Definition: coupledFaPatch.H:198
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::coupledFaPatch::makeWeights
virtual void makeWeights(scalarField &) const =0
Make patch weighting factors.
Foam::coupledFaPatch::delta
virtual tmp< vectorField > delta() const =0
Return delta (P to N) vectors across coupled patch.
Foam::lduInterface
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
Definition: lduInterface.H:54
Foam::coupledFaPatch::makeDeltaCoeffs
virtual void makeDeltaCoeffs(scalarField &) const =0
Make patch face - neighbour cell distances.
Foam::coupledFaPatch::initGeometry
virtual void initGeometry()=0
Initialise the calculation of the patch geometry.
Foam::coupledFaPatch::movePoints
virtual void movePoints(const pointField &)=0
Correct patches after moving points.
Foam::coupledFaPatch::coupledFaPatch
coupledFaPatch(const word &name, const labelList &edgeLabels, const label index, const faBoundaryMesh &bm, const label ngbPolyPatchIndex)
Construct from components.
Definition: coupledFaPatch.H:112
Foam::faPatch::edgeLabels
const labelList & edgeLabels() const noexcept
Return the list of edges.
Definition: faPatch.H:225
Foam::faPatch::edgeFaces
const labelUList & edgeFaces() const
Return edge-face addressing.
Definition: faPatch.C:358
Foam::faBoundaryMesh
Finite area boundary mesh.
Definition: faBoundaryMesh.H:65
Foam::coupledFaPatch::reverseT
const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
Definition: coupledFaPatch.H:185
Foam::Field< vector >
Foam::coupledFaPatch
coupledFaPatch is an abstract base class for patches that couple regions of the computational domain ...
Definition: coupledFaPatch.H:56
Foam::coupledFaPatch::interfaceInternalField
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const =0
Return the values of the given internal data adjacent to.
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::coupledFaPatch::initMovePoints
virtual void initMovePoints(const pointField &)=0
Initialise the patches for moving points.
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::coupledFaPatch::internalFieldTransfer
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const =0
Return neighbour field.
Foam::coupledFaPatch::forwardT
const tensorField & forwardT() const
Return face transformation tensor.
Definition: coupledFaPatch.H:172
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::patchIdentifier::index
label index() const noexcept
The index of this patch in the boundaryMesh.
Definition: patchIdentifier.H:147
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::coupledFaPatch::separation
const vectorField & separation() const
Return the offset (distance) vector from one side of the couple.
Definition: coupledFaPatch.H:159
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::coupledFaPatch::separated
bool separated() const
Are the coupled planes separated.
Definition: coupledFaPatch.H:152
Foam::coupledFaPatch::calcTransformTensors
void calcTransformTensors(const vector &Cf, const vector &Cr, const vector &nf, const vector &nr) const
Calculate the uniform transformation tensors.
Definition: coupledFaPatch.C:41
Foam::coupledFaPatch::initTransfer
virtual void initTransfer(const Pstream::commsTypes commsType, const labelUList &interfaceData) const
Initialise interface data transfer.
Definition: coupledFaPatch.H:240
Foam::Vector< scalar >
Foam::List< label >
faPatch.H
Foam::UList< label >
Foam::coupledFaPatch::faceCells
virtual const labelUList & faceCells() const
Return faceCell addressing: lduInterface virtual function.
Definition: coupledFaPatch.H:226
Foam::patchIdentifier::name
const word & name() const noexcept
The patch name.
Definition: patchIdentifier.H:135
Foam::coupledFaPatch::initInternalFieldTransfer
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Initialise neighbour field transfer.
Definition: coupledFaPatch.H:255
Foam::coupledFaPatch::coupled
virtual bool coupled() const
Return true because this patch is coupled.
Definition: coupledFaPatch.H:145
lduInterface.H
Foam::faPatch
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:69
Foam::coupledFaPatch::TypeName
TypeName("coupled")
Runtime type information.
Foam::coupledFaPatch::transfer
virtual tmp< labelField > transfer(const Pstream::commsTypes commsType, const labelUList &interfaceData) const =0
Transfer and return neighbour field.
Foam::faPatch::ngbPolyPatchIndex
label ngbPolyPatchIndex() const noexcept
The neighbour polyPatch index.
Definition: faPatch.H:246
Foam::coupledFaPatch::~coupledFaPatch
virtual ~coupledFaPatch()=default
Destructor.