cyclicPolyPatch.C
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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2015-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "cyclicPolyPatch.H"
31 #include "polyBoundaryMesh.H"
32 #include "polyMesh.H"
33 #include "demandDrivenData.H"
34 #include "OFstream.H"
35 #include "matchPoints.H"
36 #include "edgeHashes.H"
37 #include "Time.H"
38 #include "transformField.H"
39 #include "SubField.H"
40 #include "unitConversion.H"
41 
42 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46  defineTypeNameAndDebug(cyclicPolyPatch, 0);
47 
48  addToRunTimeSelectionTable(polyPatch, cyclicPolyPatch, word);
49  addToRunTimeSelectionTable(polyPatch, cyclicPolyPatch, dictionary);
50 }
51 
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 Foam::label Foam::cyclicPolyPatch::findMaxArea
56 (
57  const pointField& points,
58  const faceList& faces
59 )
60 {
61  label maxI = -1;
62  scalar maxAreaSqr = -GREAT;
63 
64  forAll(faces, facei)
65  {
66  scalar areaSqr = magSqr(faces[facei].areaNormal(points));
67 
68  if (maxAreaSqr < areaSqr)
69  {
70  maxAreaSqr = areaSqr;
71  maxI = facei;
72  }
73  }
74  return maxI;
75 }
76 
77 
79 {
80  if (size())
81  {
82  // Half0
83  const cyclicPolyPatch& half0 = *this;
84  vectorField half0Areas(half0.size());
85  forAll(half0, facei)
86  {
87  half0Areas[facei] = half0[facei].areaNormal(half0.points());
88  }
89 
90  // Half1
91  const cyclicPolyPatch& half1 = neighbPatch();
92  vectorField half1Areas(half1.size());
93  forAll(half1, facei)
94  {
95  half1Areas[facei] = half1[facei].areaNormal(half1.points());
96  }
97 
98  calcTransforms
99  (
100  half0,
101  half0.faceCentres(),
102  half0Areas,
103  half1.faceCentres(),
104  half1Areas
105  );
106  }
107 }
108 
109 
111 (
112  const primitivePatch& half0,
113  const pointField& half0Ctrs,
114  const vectorField& half0Areas,
115  const pointField& half1Ctrs,
116  const vectorField& half1Areas
117 )
118 {
119  if (debug && owner())
120  {
121  fileName casePath(boundaryMesh().mesh().time().path());
122  {
123  fileName nm0(casePath/name()+"_faces.obj");
124  Pout<< "cyclicPolyPatch::calcTransforms : Writing " << name()
125  << " faces to OBJ file " << nm0 << endl;
126  writeOBJ(nm0, half0, half0.points());
127  }
128  const cyclicPolyPatch& half1 = neighbPatch();
129  {
130  fileName nm1(casePath/half1.name()+"_faces.obj");
131  Pout<< "cyclicPolyPatch::calcTransforms : Writing " << half1.name()
132  << " faces to OBJ file " << nm1 << endl;
133  writeOBJ(nm1, half1, half1.points());
134  }
135  {
136  OFstream str(casePath/name()+"_to_" + half1.name() + ".obj");
137  label vertI = 0;
138  Pout<< "cyclicPolyPatch::calcTransforms :"
139  << " Writing coupled face centres as lines to " << str.name()
140  << endl;
141  forAll(half0Ctrs, i)
142  {
143  const point& p0 = half0Ctrs[i];
144  str << "v " << p0.x() << ' ' << p0.y() << ' ' << p0.z() << nl;
145  vertI++;
146  const point& p1 = half1Ctrs[i];
147  str << "v " << p1.x() << ' ' << p1.y() << ' ' << p1.z() << nl;
148  vertI++;
149  str << "l " << vertI-1 << ' ' << vertI << nl;
150  }
151  }
152  }
153 
154 
155  // Some sanity checks
156 
157  if (half0Ctrs.size() != half1Ctrs.size())
158  {
160  << "For patch " << name()
161  << " there are " << half0Ctrs.size()
162  << " face centres, for the neighbour patch " << neighbPatch().name()
163  << " there are " << half1Ctrs.size()
164  << exit(FatalError);
165  }
166 
167  if (transform() != neighbPatch().transform())
168  {
170  << "Patch " << name()
171  << " has transform type " << transformTypeNames[transform()]
172  << ", neighbour patch " << neighbPatchName()
173  << " has transform type "
174  << neighbPatch().transformTypeNames[neighbPatch().transform()]
175  << exit(FatalError);
176  }
177 
178 
179  // Calculate transformation tensors
180 
181  if (half0Ctrs.size() > 0)
182  {
183  vectorField half0Normals(half0Areas.size());
184  vectorField half1Normals(half1Areas.size());
185 
186  scalar maxAreaDiff = -GREAT;
187  label maxAreaFacei = -1;
188 
189  forAll(half0, facei)
190  {
191  scalar magSf = mag(half0Areas[facei]);
192  scalar nbrMagSf = mag(half1Areas[facei]);
193  scalar avSf = (magSf + nbrMagSf)/2.0;
194 
195  if (magSf < ROOTVSMALL && nbrMagSf < ROOTVSMALL)
196  {
197  // Undetermined normal. Use dummy normal to force separation
198  // check. (note use of sqrt(VSMALL) since that is how mag
199  // scales)
200  half0Normals[facei] = point(1, 0, 0);
201  half1Normals[facei] = half0Normals[facei];
202  }
203  else
204  {
205  scalar areaDiff = mag(magSf - nbrMagSf)/avSf;
206 
207  if (areaDiff > maxAreaDiff)
208  {
209  maxAreaDiff = areaDiff;
210  maxAreaFacei = facei;
211  }
212 
213  if (areaDiff > matchTolerance())
214  {
216  << "face " << facei
217  << " area does not match neighbour by "
218  << 100*areaDiff
219  << "% -- possible face ordering problem." << endl
220  << "patch:" << name()
221  << " my area:" << magSf
222  << " neighbour area:" << nbrMagSf
223  << " matching tolerance:" << matchTolerance()
224  << endl
225  << "Mesh face:" << start()+facei
226  << " fc:" << half0Ctrs[facei]
227  << endl
228  << "Neighbour fc:" << half1Ctrs[facei]
229  << endl
230  << "If you are certain your matching is correct"
231  << " you can increase the 'matchTolerance' setting"
232  << " in the patch dictionary in the boundary file."
233  << endl
234  << "Rerun with cyclic debug flag set"
235  << " for more information." << exit(FatalError);
236  }
237  else
238  {
239  half0Normals[facei] = half0Areas[facei] / magSf;
240  half1Normals[facei] = half1Areas[facei] / nbrMagSf;
241  }
242  }
243  }
244 
245 
246  // Print area match
247  if (debug)
248  {
249  Pout<< "cyclicPolyPatch::calcTransforms :"
250  << " patch:" << name()
251  << " Max area error:" << 100*maxAreaDiff << "% at face:"
252  << maxAreaFacei << " at:" << half0Ctrs[maxAreaFacei]
253  << " coupled face at:" << half1Ctrs[maxAreaFacei]
254  << endl;
255  }
256 
257 
258  // Calculate transformation tensors
259 
260  if (transform() == ROTATIONAL)
261  {
262  // Calculate using the given rotation axis and centre. Do not
263  // use calculated normals.
264  vector n0 = findFaceMaxRadius(half0Ctrs);
265  vector n1 = -findFaceMaxRadius(half1Ctrs);
266  n0.normalise();
267  n1.normalise();
268 
269  if (debug)
270  {
271  Pout<< "cyclicPolyPatch::calcTransforms :"
272  << " patch:" << name()
273  << " Specified rotation :"
274  << " n0:" << n0 << " n1:" << n1
275  << " swept angle: " << radToDeg(acos(n0 & n1))
276  << " [deg]" << endl;
277  }
278 
279  // Extended tensor from two local coordinate systems calculated
280  // using normal and rotation axis
281  const tensor E0
282  (
283  rotationAxis_,
284  (n0 ^ rotationAxis_),
285  n0
286  );
287  const tensor E1
288  (
289  rotationAxis_,
290  (-n1 ^ rotationAxis_),
291  -n1
292  );
293  const tensor revT(E1.T() & E0);
294 
295  const_cast<tensorField&>(forwardT()) = tensorField(1, revT.T());
296  const_cast<tensorField&>(reverseT()) = tensorField(1, revT);
297  const_cast<vectorField&>(separation()).setSize(0);
298  const_cast<boolList&>(collocated()) = boolList(1, false);
299  }
300  else
301  {
302  scalarField half0Tols
303  (
304  matchTolerance()
305  *calcFaceTol
306  (
307  half0,
308  half0.points(),
309  static_cast<const pointField&>(half0Ctrs)
310  )
311  );
312 
313  calcTransformTensors
314  (
315  static_cast<const pointField&>(half0Ctrs),
316  static_cast<const pointField&>(half1Ctrs),
317  half0Normals,
318  half1Normals,
319  half0Tols,
320  matchTolerance(),
321  transform()
322  );
323 
324 
325  if (transform() == TRANSLATIONAL)
326  {
327  if (debug)
328  {
329  Pout<< "cyclicPolyPatch::calcTransforms :"
330  << " patch:" << name()
331  << " Specified separation vector : "
332  << separationVector_ << endl;
333  }
334 
335  // Check that separation vectors are same.
336  const scalar avgTol = average(half0Tols);
337  if
338  (
339  mag(separationVector_ + neighbPatch().separationVector_)
340  > avgTol
341  )
342  {
344  << "Specified separation vector " << separationVector_
345  << " differs by that of neighbouring patch "
346  << neighbPatch().separationVector_
347  << " by more than tolerance " << avgTol << endl
348  << "patch:" << name()
349  << " neighbour:" << neighbPatchName()
350  << endl;
351  }
352 
353 
354  // Override computed transform with specified.
355  if
356  (
357  separation().size() != 1
358  || mag(separation()[0] - separationVector_) > avgTol
359  )
360  {
362  << "Specified separationVector " << separationVector_
363  << " differs from computed separation vector "
364  << separation() << endl
365  << "This probably means your geometry is not consistent"
366  << " with the specified separation and might lead"
367  << " to problems." << endl
368  << "Continuing with specified separation vector "
369  << separationVector_ << endl
370  << "patch:" << name()
371  << " neighbour:" << neighbPatchName()
372  << endl;
373  }
374 
375  // Set tensors
376  const_cast<tensorField&>(forwardT()).clear();
377  const_cast<tensorField&>(reverseT()).clear();
378  const_cast<vectorField&>(separation()) = vectorField
379  (
380  1,
381  separationVector_
382  );
383  const_cast<boolList&>(collocated()) = boolList(1, false);
384  }
385  }
386  }
387 }
388 
389 
390 void Foam::cyclicPolyPatch::getCentresAndAnchors
391 (
392  const primitivePatch& pp0,
393  const primitivePatch& pp1,
394 
395  pointField& half0Ctrs,
396  pointField& half1Ctrs,
397  pointField& anchors0,
398  scalarField& tols
399 ) const
400 {
401  // Get geometric data on both halves.
402  half0Ctrs = pp0.faceCentres();
403  anchors0 = getAnchorPoints(pp0, pp0.points(), transform());
404  half1Ctrs = pp1.faceCentres();
405 
406  if (debug)
407  {
408  Pout<< "cyclicPolyPatch::getCentresAndAnchors :"
409  << " patch:" << name() << nl
410  << "half0 untransformed faceCentres (avg) : "
411  << gAverage(half0Ctrs) << nl
412  << "half1 untransformed faceCentres (avg) : "
413  << gAverage(half1Ctrs) << endl;
414  }
415 
416  if (half0Ctrs.size())
417  {
418  switch (transform())
419  {
420  case ROTATIONAL:
421  {
422  vector n0 = findFaceMaxRadius(half0Ctrs);
423  vector n1 = -findFaceMaxRadius(half1Ctrs);
424  n0.normalise();
425  n1.normalise();
426 
427  if (debug)
428  {
429  Pout<< "cyclicPolyPatch::getCentresAndAnchors :"
430  << " patch:" << name()
431  << " Specified rotation :"
432  << " n0:" << n0 << " n1:" << n1
433  << " swept angle: "
434  << radToDeg(acos(n0 & n1)) << " [deg]"
435  << endl;
436  }
437 
438  // Extended tensor from two local coordinate systems calculated
439  // using normal and rotation axis
440  const tensor E0
441  (
442  rotationAxis_,
443  (n0 ^ rotationAxis_),
444  n0
445  );
446  const tensor E1
447  (
448  rotationAxis_,
449  (-n1 ^ rotationAxis_),
450  -n1
451  );
452  const tensor revT(E1.T() & E0);
453 
454  // Rotation
455  forAll(half0Ctrs, facei)
456  {
457  half0Ctrs[facei] =
459  (
460  revT,
461  half0Ctrs[facei] - rotationCentre_
462  )
463  + rotationCentre_;
464  anchors0[facei] =
466  (
467  revT,
468  anchors0[facei] - rotationCentre_
469  )
470  + rotationCentre_;
471  }
472 
473  break;
474  }
475  case TRANSLATIONAL:
476  {
477  // Transform 0 points.
478 
479  if (debug)
480  {
481  Pout<< "cyclicPolyPatch::getCentresAndAnchors :"
482  << " patch:" << name()
483  << "Specified translation : " << separationVector_
484  << endl;
485  }
486 
487  // Note: getCentresAndAnchors gets called on the slave side
488  // so separationVector is owner-slave points.
489 
490  half0Ctrs -= separationVector_;
491  anchors0 -= separationVector_;
492  break;
493  }
494  default:
495  {
496  // Assumes that cyclic is rotational. This is also the initial
497  // condition for patches without faces.
498 
499  // Determine the face with max area on both halves. These
500  // two faces are used to determine the transformation tensors
501  label max0I = findMaxArea(pp0.points(), pp0);
502  const vector n0 = pp0[max0I].unitNormal(pp0.points());
503 
504  label max1I = findMaxArea(pp1.points(), pp1);
505  const vector n1 = pp1[max1I].unitNormal(pp1.points());
506 
507  if (mag(n0 & n1) < 1-matchTolerance())
508  {
509  if (debug)
510  {
511  Pout<< "cyclicPolyPatch::getCentresAndAnchors :"
512  << " patch:" << name()
513  << " Detected rotation :"
514  << " n0:" << n0 << " n1:" << n1 << endl;
515  }
516 
517  // Rotation (around origin)
518  const tensor revT(rotationTensor(n0, -n1));
519 
520  // Rotation
521  forAll(half0Ctrs, facei)
522  {
523  half0Ctrs[facei] = Foam::transform
524  (
525  revT,
526  half0Ctrs[facei]
527  );
528  anchors0[facei] = Foam::transform
529  (
530  revT,
531  anchors0[facei]
532  );
533  }
534  }
535  else
536  {
537  // Parallel translation. Get average of all used points.
538 
539  const point ctr0(sum(pp0.localPoints())/pp0.nPoints());
540  const point ctr1(sum(pp1.localPoints())/pp1.nPoints());
541 
542  if (debug)
543  {
544  Pout<< "cyclicPolyPatch::getCentresAndAnchors :"
545  << " patch:" << name()
546  << " Detected translation :"
547  << " n0:" << n0 << " n1:" << n1
548  << " ctr0:" << ctr0 << " ctr1:" << ctr1 << endl;
549  }
550 
551  half0Ctrs += ctr1 - ctr0;
552  anchors0 += ctr1 - ctr0;
553  }
554  break;
555  }
556  }
557  }
558 
559  // Calculate typical distance per face
560  tols = matchTolerance()*calcFaceTol(pp1, pp1.points(), half1Ctrs);
561 }
562 
563 
564 Foam::vector Foam::cyclicPolyPatch::findFaceMaxRadius
565 (
566  const pointField& faceCentres
567 ) const
568 {
569  // Determine a face furthest away from the axis
570 
571  const vectorField n((faceCentres - rotationCentre_) ^ rotationAxis_);
572 
573  const scalarField magRadSqr(magSqr(n));
574 
575  label facei = findMax(magRadSqr);
576 
577  if (debug)
578  {
579  Info<< "findFaceMaxRadius(const pointField&) : patch: " << name() << nl
580  << " rotFace = " << facei << nl
581  << " point = " << faceCentres[facei] << nl
582  << " distance = " << Foam::sqrt(magRadSqr[facei])
583  << endl;
584  }
585 
586  return n[facei];
587 }
588 
589 
590 // * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
591 
593 (
594  const word& name,
595  const label size,
596  const label start,
597  const label index,
598  const polyBoundaryMesh& bm,
599  const word& patchType,
601 )
602 :
603  coupledPolyPatch(name, size, start, index, bm, patchType, transform),
604  neighbPatchName_(word::null),
605  neighbPatchID_(-1),
606  rotationAxis_(Zero),
607  rotationCentre_(Zero),
608  separationVector_(Zero),
609  coupledPointsPtr_(nullptr),
610  coupledEdgesPtr_(nullptr)
611 {
612  // Neighbour patch might not be valid yet so no transformation
613  // calculation possible.
614 }
615 
616 
618 (
619  const word& name,
620  const label size,
621  const label start,
622  const label index,
623  const polyBoundaryMesh& bm,
624  const word& neighbPatchName,
625  const transformType transform,
626  const vector& rotationAxis,
627  const point& rotationCentre,
628  const vector& separationVector
629 )
630 :
631  coupledPolyPatch(name, size, start, index, bm, typeName, transform),
632  neighbPatchName_(neighbPatchName),
633  neighbPatchID_(-1),
634  rotationAxis_(rotationAxis),
635  rotationCentre_(rotationCentre),
636  separationVector_(separationVector),
637  coupledPointsPtr_(nullptr),
638  coupledEdgesPtr_(nullptr)
639 {
640  // Neighbour patch might not be valid yet so no transformation
641  // calculation possible.
642 }
643 
644 
646 (
647  const word& name,
648  const dictionary& dict,
649  const label index,
650  const polyBoundaryMesh& bm,
651  const word& patchType
652 )
653 :
654  coupledPolyPatch(name, dict, index, bm, patchType),
655  neighbPatchName_(dict.getOrDefault("neighbourPatch", word::null)),
656  coupleGroup_(dict),
657  neighbPatchID_(-1),
658  rotationAxis_(Zero),
659  rotationCentre_(Zero),
660  separationVector_(Zero),
661  coupledPointsPtr_(nullptr),
662  coupledEdgesPtr_(nullptr)
663 {
664  if (neighbPatchName_ == word::null && !coupleGroup_.valid())
665  {
667  << "No \"neighbourPatch\" provided." << endl
668  << "Is your mesh uptodate with split cyclics?" << endl
669  << "Run foamUpgradeCyclics to convert mesh and fields"
670  << " to split cyclics." << exit(FatalIOError);
671  }
672 
673  if (neighbPatchName_ == name)
674  {
676  << "Neighbour patch name " << neighbPatchName_
677  << " cannot be the same as this patch " << name
678  << exit(FatalIOError);
679  }
680 
681  switch (transform())
682  {
683  case ROTATIONAL:
684  {
685  dict.readEntry("rotationAxis", rotationAxis_);
686  dict.readEntry("rotationCentre", rotationCentre_);
687 
688  scalar magRot = mag(rotationAxis_);
689  if (magRot < SMALL)
690  {
692  << "Illegal rotationAxis " << rotationAxis_ << endl
693  << "Please supply a non-zero vector."
694  << exit(FatalIOError);
695  }
696  rotationAxis_ /= magRot;
697 
698  break;
699  }
700  case TRANSLATIONAL:
701  {
702  dict.readEntry("separationVector", separationVector_);
703  break;
704  }
705  default:
706  {
707  // no additional info required
708  }
709  }
710 
711  // Neighbour patch might not be valid yet so no transformation
712  // calculation possible.
713 }
714 
715 
717 (
718  const cyclicPolyPatch& pp,
719  const polyBoundaryMesh& bm
720 )
721 :
722  coupledPolyPatch(pp, bm),
723  neighbPatchName_(pp.neighbPatchName_),
724  coupleGroup_(pp.coupleGroup_),
725  neighbPatchID_(-1),
726  rotationAxis_(pp.rotationAxis_),
727  rotationCentre_(pp.rotationCentre_),
728  separationVector_(pp.separationVector_),
729  coupledPointsPtr_(nullptr),
730  coupledEdgesPtr_(nullptr)
731 {
732  // Neighbour patch might not be valid yet so no transformation
733  // calculation possible.
734 }
735 
736 
738 (
739  const cyclicPolyPatch& pp,
740  const polyBoundaryMesh& bm,
741  const label index,
742  const label newSize,
743  const label newStart,
744  const word& neighbName
745 )
746 :
747  coupledPolyPatch(pp, bm, index, newSize, newStart),
748  neighbPatchName_(neighbName),
749  coupleGroup_(pp.coupleGroup_),
750  neighbPatchID_(-1),
751  rotationAxis_(pp.rotationAxis_),
752  rotationCentre_(pp.rotationCentre_),
753  separationVector_(pp.separationVector_),
754  coupledPointsPtr_(nullptr),
755  coupledEdgesPtr_(nullptr)
756 {
757  if (neighbName == name())
758  {
760  << "Neighbour patch name " << neighbName
761  << " cannot be the same as this patch " << name()
762  << exit(FatalError);
763  }
764 
765  // Neighbour patch might not be valid yet so no transformation
766  // calculation possible.
767 }
768 
769 
771 (
772  const cyclicPolyPatch& pp,
773  const polyBoundaryMesh& bm,
774  const label index,
775  const labelUList& mapAddressing,
776  const label newStart
777 )
778 :
779  coupledPolyPatch(pp, bm, index, mapAddressing, newStart),
780  neighbPatchName_(pp.neighbPatchName_),
781  coupleGroup_(pp.coupleGroup_),
782  neighbPatchID_(-1),
783  rotationAxis_(pp.rotationAxis_),
784  rotationCentre_(pp.rotationCentre_),
785  separationVector_(pp.separationVector_),
786  coupledPointsPtr_(nullptr),
787  coupledEdgesPtr_(nullptr)
788 {}
789 
790 
791 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
792 
794 {
795  deleteDemandDrivenData(coupledPointsPtr_);
796  deleteDemandDrivenData(coupledEdgesPtr_);
797 }
798 
799 
800 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
801 
803 {
804  if (neighbPatchName_.empty())
805  {
806  // Try and use patchGroup to find samplePatch and sampleRegion
807  label patchID = coupleGroup_.findOtherPatchID(*this);
808 
809  neighbPatchName_ = boundaryMesh()[patchID].name();
810  }
811  return neighbPatchName_;
812 }
813 
814 
816 {
817  if (neighbPatchID_ == -1)
818  {
819  neighbPatchID_ = this->boundaryMesh().findPatchID(neighbPatchName());
820 
821  if (neighbPatchID_ == -1)
822  {
824  << "Illegal neighbourPatch name " << neighbPatchName()
825  << endl << "Valid patch names are "
826  << this->boundaryMesh().names()
827  << exit(FatalError);
828  }
829 
830  // Check that it is a cyclic
831  const cyclicPolyPatch& nbrPatch = refCast<const cyclicPolyPatch>
832  (
833  this->boundaryMesh()[neighbPatchID_]
834  );
835 
836  if (nbrPatch.neighbPatchName() != name())
837  {
839  << "Patch " << name()
840  << " specifies neighbour patch " << neighbPatchName()
841  << endl << " but that in return specifies "
842  << nbrPatch.neighbPatchName()
843  << endl;
844  }
845  }
846  return neighbPatchID_;
847 }
848 
849 
851 {
852  if (!parallel())
853  {
854  if (transform() == ROTATIONAL)
855  {
856  l =
857  Foam::transform(forwardT(), l-rotationCentre_)
858  + rotationCentre_;
859  }
860  else
861  {
862  l = Foam::transform(forwardT(), l);
863  }
864  }
865  else if (separated())
866  {
867  // transformPosition gets called on the receiving side,
868  // separation gets calculated on the sending side so subtract.
869 
870  const vectorField& s = separation();
871  if (s.size() == 1)
872  {
873  forAll(l, i)
874  {
875  l[i] -= s[0];
876  }
877  }
878  else
879  {
880  l -= s;
881  }
882  }
883 }
884 
885 
886 void Foam::cyclicPolyPatch::transformPosition(point& l, const label facei) const
887 {
888  if (!parallel())
889  {
890  const tensor& T =
891  (
892  forwardT().size() == 1
893  ? forwardT()[0]
894  : forwardT()[facei]
895  );
896 
897  if (transform() == ROTATIONAL)
898  {
899  l = Foam::transform(T, l-rotationCentre_) + rotationCentre_;
900  }
901  else
902  {
903  l = Foam::transform(T, l);
904  }
905  }
906  else if (separated())
907  {
908  const vector& s =
909  (
910  separation().size() == 1
911  ? separation()[0]
912  : separation()[facei]
913  );
914 
915  l -= s;
916  }
917 }
918 
919 
921 {
923 }
924 
925 
927 (
928  const primitivePatch& referPatch,
929  pointField& nbrCtrs,
930  vectorField& nbrAreas,
931  pointField& nbrCc
932 )
933 {}
934 
935 
937 (
938  const primitivePatch& referPatch,
939  const pointField& thisCtrs,
940  const vectorField& thisAreas,
941  const pointField& thisCc,
942  const pointField& nbrCtrs,
943  const vectorField& nbrAreas,
944  const pointField& nbrCc
945 )
946 {
947  calcTransforms
948  (
949  referPatch,
950  thisCtrs,
951  thisAreas,
952  nbrCtrs,
953  nbrAreas
954  );
955 }
956 
957 
959 {
960  calcGeometry
961  (
962  *this,
963  faceCentres(),
964  faceAreas(),
965  faceCellCentres(),
966  neighbPatch().faceCentres(),
967  neighbPatch().faceAreas(),
968  neighbPatch().faceCellCentres()
969  );
970 }
971 
972 
974 (
975  PstreamBuffers& pBufs,
976  const pointField& p
977 )
978 {
980 }
981 
982 
984 (
985  PstreamBuffers& pBufs,
986  const pointField& p
987 )
988 {
989  polyPatch::movePoints(pBufs, p);
990  calcTransforms();
991 }
992 
993 
995 {
997 }
998 
999 
1001 {
1002  polyPatch::updateMesh(pBufs);
1003  deleteDemandDrivenData(coupledPointsPtr_);
1004  deleteDemandDrivenData(coupledEdgesPtr_);
1005 }
1006 
1007 
1009 {
1010  if (!coupledPointsPtr_)
1011  {
1012  const faceList& nbrLocalFaces = neighbPatch().localFaces();
1013  const labelList& nbrMeshPoints = neighbPatch().meshPoints();
1014 
1015  // Now all we know is that relative face index in *this is same
1016  // as coupled face in nbrPatch and also that the 0th vertex
1017  // corresponds.
1018 
1019  // From local point to nbrPatch or -1.
1020  labelList coupledPoint(nPoints(), -1);
1021 
1022  forAll(*this, patchFacei)
1023  {
1024  const face& fA = localFaces()[patchFacei];
1025  const face& fB = nbrLocalFaces[patchFacei];
1026 
1027  forAll(fA, indexA)
1028  {
1029  label patchPointA = fA[indexA];
1030 
1031  if (coupledPoint[patchPointA] == -1)
1032  {
1033  label indexB = (fB.size() - indexA) % fB.size();
1034 
1035  // Filter out points on wedge axis
1036  if (meshPoints()[patchPointA] != nbrMeshPoints[fB[indexB]])
1037  {
1038  coupledPoint[patchPointA] = fB[indexB];
1039  }
1040  }
1041  }
1042  }
1043 
1044  coupledPointsPtr_ = new edgeList(nPoints());
1045  edgeList& connected = *coupledPointsPtr_;
1046 
1047  // Extract coupled points.
1048  label connectedI = 0;
1049 
1050  forAll(coupledPoint, i)
1051  {
1052  if (coupledPoint[i] != -1)
1053  {
1054  connected[connectedI++] = edge(i, coupledPoint[i]);
1055  }
1056  }
1057 
1058  connected.setSize(connectedI);
1059 
1060  if (debug)
1061  {
1062  OFstream str
1063  (
1064  boundaryMesh().mesh().time().path()
1065  /name() + "_coupledPoints.obj"
1066  );
1067  label vertI = 0;
1068 
1069  Pout<< "Writing file " << str.name() << " with coordinates of "
1070  << "coupled points" << endl;
1071 
1072  forAll(connected, i)
1073  {
1074  const point& a = points()[meshPoints()[connected[i][0]]];
1075  const point& b = points()[nbrMeshPoints[connected[i][1]]];
1076 
1077  str<< "v " << a.x() << ' ' << a.y() << ' ' << a.z() << nl;
1078  str<< "v " << b.x() << ' ' << b.y() << ' ' << b.z() << nl;
1079  vertI += 2;
1080 
1081  str<< "l " << vertI-1 << ' ' << vertI << nl;
1082  }
1083  }
1084  }
1085  return *coupledPointsPtr_;
1086 }
1087 
1088 
1090 {
1091  if (!coupledEdgesPtr_)
1092  {
1093  const edgeList& pointCouples = coupledPoints();
1094 
1095  // Build map from points on *this (A) to points on neighbourpatch (B)
1096  Map<label> aToB(2*pointCouples.size());
1097 
1098  for (const edge& e : pointCouples)
1099  {
1100  aToB.insert(e[0], e[1]);
1101  }
1102 
1103  // Map from edge on A to points (in B indices)
1104  EdgeMap<label> edgeMap(nEdges());
1105 
1106  forAll(*this, patchFacei)
1107  {
1108  const labelList& fEdges = faceEdges()[patchFacei];
1109 
1110  for (const label edgeI : fEdges)
1111  {
1112  const edge& e = edges()[edgeI];
1113 
1114  // Convert edge end points to corresponding points on B side.
1115  const auto fnd0 = aToB.cfind(e[0]);
1116  if (fnd0.found())
1117  {
1118  const auto fnd1 = aToB.cfind(e[1]);
1119  if (fnd1.found())
1120  {
1121  edgeMap.insert(edge(fnd0(), fnd1()), edgeI);
1122  }
1123  }
1124  }
1125  }
1126 
1127  // Use the edgeMap to get the edges on the B side.
1128 
1129  const cyclicPolyPatch& neighbPatch = this->neighbPatch();
1130  const labelList& nbrMp = neighbPatch.meshPoints();
1131  const labelList& mp = meshPoints();
1132 
1133 
1134  coupledEdgesPtr_ = new edgeList(edgeMap.size());
1135  edgeList& coupledEdges = *coupledEdgesPtr_;
1136  label coupleI = 0;
1137 
1138  forAll(neighbPatch, patchFacei)
1139  {
1140  const labelList& fEdges = neighbPatch.faceEdges()[patchFacei];
1141 
1142  for (const label edgeI : fEdges)
1143  {
1144  const edge& e = neighbPatch.edges()[edgeI];
1145 
1146  // Look up A edge from HashTable.
1147  auto iter = edgeMap.find(e);
1148 
1149  if (iter.found())
1150  {
1151  const label edgeA = iter.val();
1152  const edge& eA = edges()[edgeA];
1153 
1154  // Store correspondence. Filter out edges on wedge axis.
1155  if
1156  (
1157  edge(mp[eA[0]], mp[eA[1]])
1158  != edge(nbrMp[e[0]], nbrMp[e[1]])
1159  )
1160  {
1161  coupledEdges[coupleI++] = edge(edgeA, edgeI);
1162  }
1163 
1164  // Remove so we build unique list
1165  edgeMap.erase(iter);
1166  }
1167  }
1168  }
1169  coupledEdges.setSize(coupleI);
1170 
1171 
1172  // Some checks
1173 
1174  forAll(coupledEdges, i)
1175  {
1176  const edge& e = coupledEdges[i];
1177 
1178  if (e[0] < 0 || e[1] < 0)
1179  {
1181  << "Problem : at position " << i
1182  << " illegal couple:" << e
1183  << abort(FatalError);
1184  }
1185  }
1186 
1187  if (debug)
1188  {
1189  OFstream str
1190  (
1191  boundaryMesh().mesh().time().path()
1192  /name() + "_coupledEdges.obj"
1193  );
1194  label vertI = 0;
1195 
1196  Pout<< "Writing file " << str.name() << " with centres of "
1197  << "coupled edges" << endl;
1198 
1199  for (const edge& e : coupledEdges)
1200  {
1201  const point& a = edges()[e[0]].centre(localPoints());
1202  const point& b = neighbPatch.edges()[e[1]].centre
1203  (
1204  neighbPatch.localPoints()
1205  );
1206 
1207  str<< "v " << a.x() << ' ' << a.y() << ' ' << a.z() << nl;
1208  str<< "v " << b.x() << ' ' << b.y() << ' ' << b.z() << nl;
1209  vertI += 2;
1210 
1211  str<< "l " << vertI-1 << ' ' << vertI << nl;
1212  }
1213  }
1214  }
1215  return *coupledEdgesPtr_;
1216 }
1217 
1218 
1221  PstreamBuffers&,
1222  const primitivePatch& pp
1223 ) const
1224 {
1225  if (owner())
1226  {
1227  // Save patch for use in non-owner side ordering. Equivalent to
1228  // processorPolyPatch using OPstream.
1229  ownerPatchPtr_.reset
1230  (
1231  new primitivePatch
1232  (
1233  pp,
1234  pp.points()
1235  )
1236  );
1237  }
1238 }
1239 
1240 
1243  PstreamBuffers& pBufs,
1244  const primitivePatch& pp,
1245  labelList& faceMap,
1246  labelList& rotation
1247 ) const
1248 {
1249  if (debug)
1250  {
1251  Pout<< "order : of " << pp.size()
1252  << " faces of patch:" << name()
1253  << " neighbour:" << neighbPatchName()
1254  << endl;
1255  }
1256  faceMap.setSize(pp.size());
1257  faceMap = -1;
1258 
1259  rotation.setSize(pp.size());
1260  rotation = 0;
1261 
1262  if (transform() == NOORDERING)
1263  {
1264  // No faces, nothing to change.
1265  return false;
1266  }
1267 
1268  if (owner())
1269  {
1270  // Do nothing (i.e. identical mapping, zero rotation).
1271  // See comment at top.
1272  forAll(faceMap, patchFacei)
1273  {
1274  faceMap[patchFacei] = patchFacei;
1275  }
1276 
1277  return false;
1278  }
1279  else
1280  {
1281  // Get stored geometry from initOrder invocation of owner.
1282  const primitivePatch& pp0 = neighbPatch().ownerPatchPtr_();
1283 
1284  // Get geometric quantities
1285  pointField half0Ctrs, half1Ctrs, anchors0;
1286  scalarField tols;
1287  getCentresAndAnchors
1288  (
1289  pp0,
1290  pp,
1291 
1292  half0Ctrs,
1293  half1Ctrs,
1294  anchors0,
1295  tols
1296  );
1297 
1298  if (debug)
1299  {
1300  Pout<< "half0 transformed faceCentres (avg) : "
1301  << gAverage(half0Ctrs) << nl
1302  << "half1 untransformed faceCentres (avg) : "
1303  << gAverage(half1Ctrs) << endl;
1304  }
1305 
1306  // Geometric match of face centre vectors
1307  bool matchedAll = matchPoints
1308  (
1309  half1Ctrs,
1310  half0Ctrs,
1311  tols,
1312  true,
1313  faceMap
1314  );
1315 
1316  if (!matchedAll || debug)
1317  {
1318  // Dump halves
1319  fileName nm0
1320  (
1321  boundaryMesh().mesh().time().path()
1322  /neighbPatch().name()+"_faces.obj"
1323  );
1324  Pout<< "cyclicPolyPatch::order : Writing neighbour"
1325  << " faces to OBJ file " << nm0 << endl;
1326  writeOBJ(nm0, pp0, pp0.points());
1327 
1328  fileName nm1
1329  (
1330  boundaryMesh().mesh().time().path()
1331  /name()+"_faces.obj"
1332  );
1333  Pout<< "cyclicPolyPatch::order : Writing my"
1334  << " faces to OBJ file " << nm1 << endl;
1335  writeOBJ(nm1, pp, pp.points());
1336 
1337  OFstream ccStr
1338  (
1339  boundaryMesh().mesh().time().path()
1340  /name() + "_faceCentres.obj"
1341  );
1342  Pout<< "cyclicPolyPatch::order : "
1343  << "Dumping currently found cyclic match as lines between"
1344  << " corresponding face centres to file " << ccStr.name()
1345  << endl;
1346 
1347  // Recalculate untransformed face centres
1348  //pointField rawHalf0Ctrs =
1349  // calcFaceCentres(half0Faces, pp.points());
1350  label vertI = 0;
1351 
1352  forAll(half1Ctrs, i)
1353  {
1354  if (faceMap[i] != -1)
1355  {
1356  // Write edge between c1 and c0
1357  const point& c0 = half0Ctrs[faceMap[i]];
1358  const point& c1 = half1Ctrs[i];
1359  writeOBJ(ccStr, c0, c1, vertI);
1360  }
1361  }
1362  }
1363 
1364  if (!matchedAll)
1365  {
1367  << "Patch:" << name() << " : "
1368  << "Cannot match vectors to faces on both sides of patch"
1369  << endl
1370  << " Perhaps your faces do not match?"
1371  << " The obj files written contain the current match." << endl
1372  << " Continuing with incorrect face ordering from now on!"
1373  << endl;
1374 
1375  return false;
1376  }
1377 
1378 
1379  // Set rotation.
1380  forAll(faceMap, oldFacei)
1381  {
1382  // The face f will be at newFacei (after morphing) and we want its
1383  // anchorPoint (= f[0]) to align with the anchorpoint for the
1384  // corresponding face on the other side.
1385 
1386  label newFacei = faceMap[oldFacei];
1387 
1388  const point& wantedAnchor = anchors0[newFacei];
1389 
1390  rotation[newFacei] = getRotation
1391  (
1392  pp.points(),
1393  pp[oldFacei],
1394  wantedAnchor,
1395  tols[oldFacei]
1396  );
1397 
1398  if (rotation[newFacei] == -1)
1399  {
1401  << "in patch " << name()
1402  << " : "
1403  << "Cannot find point on face " << pp[oldFacei]
1404  << " with vertices "
1405  << UIndirectList<point>(pp.points(), pp[oldFacei])
1406  << " that matches point " << wantedAnchor
1407  << " when matching the halves of processor patch " << name()
1408  << "Continuing with incorrect face ordering from now on!"
1409  << endl;
1410 
1411  return false;
1412  }
1413  }
1414 
1415  ownerPatchPtr_.clear();
1416 
1417  // Return false if no change necessary, true otherwise.
1418 
1419  forAll(faceMap, facei)
1420  {
1421  if (faceMap[facei] != facei || rotation[facei] != 0)
1422  {
1423  return true;
1424  }
1425  }
1426 
1427  return false;
1428  }
1429 }
1430 
1431 
1433 {
1435  if (!neighbPatchName_.empty())
1436  {
1437  os.writeEntry("neighbourPatch", neighbPatchName_);
1438  }
1439  coupleGroup_.write(os);
1440  switch (transform())
1441  {
1442  case ROTATIONAL:
1443  {
1444  os.writeEntry("rotationAxis", rotationAxis_);
1445  os.writeEntry("rotationCentre", rotationCentre_);
1446  break;
1447  }
1448  case TRANSLATIONAL:
1449  {
1450  os.writeEntry("separationVector", separationVector_);
1451  break;
1452  }
1453  case NOORDERING:
1454  {
1455  break;
1456  }
1457  default:
1458  {
1459  // no additional info to write
1460  }
1461  }
1462 }
1463 
1464 
1465 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
Foam::HashTable::size
label size() const noexcept
The number of elements in table.
Definition: HashTableI.H:52
Foam::Tensor< scalar >
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
setSize
points setSize(newPointi)
Foam::constant::atomic::mp
const dimensionedScalar mp
Proton mass.
Foam::Vector::x
const Cmpt & x() const
Access to the vector x component.
Definition: VectorI.H:73
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::faceMap
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Definition: blockMeshMergeTopological.C:94
Foam::cyclicPolyPatch::updateMesh
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
Definition: cyclicPolyPatch.C:1000
Foam::cyclicPolyPatch::initMovePoints
virtual void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
Definition: cyclicPolyPatch.C:974
Foam::edgeList
List< edge > edgeList
A List of edges.
Definition: edgeList.H:63
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
SubField.H
s
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputSpray.H:25
Foam::polyPatch::movePoints
virtual void movePoints(PstreamBuffers &, const pointField &p)
Correct patches after moving points.
Definition: polyPatch.C:61
Foam::polyBoundaryMesh
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Definition: polyBoundaryMesh.H:62
Foam::PrimitivePatch::edges
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
Definition: PrimitivePatch.C:190
Foam::OFstream::name
virtual const fileName & name() const
Read/write access to the name of the stream.
Definition: OSstream.H:107
cyclicPolyPatch.H
Foam::cyclicPolyPatch
Cyclic plane patch.
Definition: cyclicPolyPatch.H:65
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::gAverage
Type gAverage(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:604
Foam::meshTools::writeOBJ
void writeOBJ(Ostream &os, const point &pt)
Write obj representation of a point.
Definition: meshTools.C:203
Foam::cyclicPolyPatch::initGeometry
virtual void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
Definition: cyclicPolyPatch.C:920
Foam::cyclicPolyPatch::order
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
Definition: cyclicPolyPatch.C:1242
demandDrivenData.H
Template functions to aid in the implementation of demand driven data.
Foam::PstreamBuffers
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Definition: PstreamBuffers.H:87
Foam::edge
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:63
Foam::tensorField
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
Definition: primitiveFieldsFwd.H:57
Foam::HashTable::insert
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
Definition: HashTableI.H:180
Foam::Map< label >
unitConversion.H
Unit conversion functions.
Foam::boolList
List< bool > boolList
A List of bools.
Definition: List.H:69
Foam::cyclicPolyPatch::initUpdateMesh
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
Definition: cyclicPolyPatch.C:994
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
Foam::coupledPolyPatch
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
Definition: coupledPolyPatch.H:53
Foam::PrimitivePatch::faceEdges
const labelListList & faceEdges() const
Return face-edge addressing.
Definition: PrimitivePatch.C:255
Foam::Pout
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Foam::transform
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:519
polyMesh.H
Foam::polyPatch::updateMesh
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
Definition: polyPatch.C:67
Foam::Vector::z
const Cmpt & z() const
Access to the vector z component.
Definition: VectorI.H:85
transformField.H
Spatial transformation functions for primitive fields.
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
OFstream.H
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:54
Foam::magSqr
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Foam::cyclicPolyPatch::coupledPoints
const edgeList & coupledPoints() const
Return connected points (from patch local to neighbour patch local)
Definition: cyclicPolyPatch.C:1008
nPoints
label nPoints
Definition: gmvOutputHeader.H:2
Foam::deleteDemandDrivenData
void deleteDemandDrivenData(DataPtr &dataPtr)
Definition: demandDrivenData.H:42
n
label n
Definition: TABSMDCalcMethod2.H:31
matchPoints.H
Determine correspondence between points. See below.
Foam::polyPatch::initUpdateMesh
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
Definition: polyPatch.H:117
Foam::constant::physicoChemical::c1
const dimensionedScalar c1
First radiation constant: default SI units: [W/m2].
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::Field< vector >
Foam::polyPatch::initMovePoints
virtual void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
Definition: polyPatch.H:110
Foam::HashTable::erase
bool erase(const iterator &iter)
Erase an entry specified by given iterator.
Definition: HashTable.C:392
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
Foam::cyclicPolyPatch::calcGeometry
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
Definition: cyclicPolyPatch.C:958
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::OSstream::name
virtual const fileName & name() const
Return the name of the stream.
Definition: OSstream.H:107
patchID
label patchID
Definition: boundaryProcessorFaPatchPoints.H:5
Foam::Vector::centre
const Vector< Cmpt > & centre(const Foam::List< Vector< Cmpt >> &) const
Return *this (used for point which is a typedef to Vector<scalar>.
Definition: VectorI.H:114
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
SeriousErrorInFunction
#define SeriousErrorInFunction
Report an error message using Foam::SeriousError.
Definition: messageStream.H:281
Foam::dictionary::readEntry
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
Definition: dictionaryTemplates.C:314
Foam::radToDeg
constexpr scalar radToDeg(const scalar rad) noexcept
Conversion from radians to degrees.
Definition: unitConversion.H:54
Foam::polyPatch::initGeometry
virtual void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
Definition: polyPatch.H:102
Foam::coupledPolyPatch::write
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
Definition: coupledPolyPatch.C:567
Foam::cyclicPolyPatch::coupledEdges
const edgeList & coupledEdges() const
Return connected edges (from patch local to neighbour patch local).
Definition: cyclicPolyPatch.C:1089
dict
dictionary dict
Definition: searchingEngine.H:14
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:121
Foam::word::valid
static bool valid(char c)
Is this character valid for a word?
Definition: wordI.H:130
Foam::cyclicPolyPatch::transformPosition
virtual void transformPosition(pointField &l) const
Transform a patch-based position from other side to this side.
Definition: cyclicPolyPatch.C:850
Foam::PrimitivePatch::points
const Field< point_type > & points() const
Return reference to global points.
Definition: PrimitivePatch.H:305
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::cyclicPolyPatch::~cyclicPolyPatch
virtual ~cyclicPolyPatch()
Destructor.
Definition: cyclicPolyPatch.C:793
Foam::Ostream::write
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
Foam::HashTable::find
iterator find(const Key &key)
Find and return an iterator set at the hashed entry.
Definition: HashTableI.H:114
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::PrimitivePatch::localPoints
const Field< point_type > & localPoints() const
Return pointField of points in patch.
Definition: PrimitivePatch.C:339
Foam::OFstream
Output to file stream, using an OSstream.
Definition: OFstream.H:53
Foam::cyclicPolyPatch::movePoints
virtual void movePoints(PstreamBuffers &, const pointField &)
Correct patches after moving points.
Definition: cyclicPolyPatch.C:984
Time.H
Foam::EdgeMap< label >
Foam::Vector::y
const Cmpt & y() const
Access to the vector y component.
Definition: VectorI.H:79
Foam::cyclicPolyPatch::initOrder
virtual void initOrder(PstreamBuffers &, const primitivePatch &) const
Initialize ordering for primitivePatch. Does not.
Definition: cyclicPolyPatch.C:1220
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:381
edgeHashes.H
clear
patchWriters clear()
Foam::nl
constexpr char nl
Definition: Ostream.H:385
Foam::polyPatch::faceCentres
const vectorField::subField faceCentres() const
Return face centres.
Definition: polyPatch.C:313
Foam::cyclicPolyPatch::write
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
Definition: cyclicPolyPatch.C:1432
Foam::faceList
List< face > faceList
A List of faces.
Definition: faceListFwd.H:47
Foam::Vector
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition: Vector.H:62
Foam::findMax
label findMax(const ListType &input, label start=0)
Foam::List< edge >
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:144
Foam::acos
dimensionedScalar acos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:268
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::UList< label >
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::constant::electromagnetic::e
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
Foam::sum
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:327
path
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
Foam::word::null
static const word null
An empty word.
Definition: word.H:77
Foam::cyclicPolyPatch::calcTransforms
virtual void calcTransforms()
Recalculate the transformation tensors.
Definition: cyclicPolyPatch.C:78
polyBoundaryMesh.H
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:232
Foam::UIndirectList
A List with indirect addressing.
Definition: faMatrix.H:60
Foam::boundaryMesh
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
Definition: boundaryMesh.H:62
Foam::primitivePatch
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field.
Definition: primitivePatch.H:51
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:72
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:401
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
p0
const volScalarField & p0
Definition: EEqn.H:36
Foam::rotationTensor
tensor rotationTensor(const vector &n1, const vector &n2)
Rotational transformation tensor from vector n1 to n2.
Definition: transform.H:51
Foam::point
vector point
Point is a vector.
Definition: point.H:43
Foam::coupledPolyPatch::transformType
transformType
Definition: coupledPolyPatch.H:59
Foam::PrimitivePatch::meshPoints
const labelList & meshPoints() const
Return labelList of mesh points in patch.
Definition: PrimitivePatch.C:310
Foam::List::setSize
void setSize(const label newSize)
Alias for resize(const label)
Definition: ListI.H:146
Foam::dictionary::getOrDefault
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:122
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::cyclicPolyPatch::neighbPatchID
virtual label neighbPatchID() const
Neighbour patchID.
Definition: cyclicPolyPatch.C:815
Foam::matchPoints
bool matchPoints(const UList< point > &pts0, const UList< point > &pts1, const UList< scalar > &matchDistance, const bool verbose, labelList &from0To1, const point &origin=point::zero)
Determine correspondence between pointFields. Gets passed.
Definition: matchPoints.C:36
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:303
Foam::cyclicPolyPatch::neighbPatchName
const word & neighbPatchName() const
Neighbour patch name.
Definition: cyclicPolyPatch.C:802
Foam::tensor
Tensor< scalar > tensor
Tensor of scalars, i.e. Tensor<scalar>.
Definition: symmTensor.H:61
Foam::average
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:328
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:85
Foam::cyclicPolyPatch::cyclicPolyPatch
cyclicPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const word &patchType, const transformType transform=UNKNOWN)
Construct from components.
Definition: cyclicPolyPatch.C:593