motionSmootherAlgoCheck.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-2014 OpenFOAM Foundation
9  Copyright (C) 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 "motionSmootherAlgo.H"
30 #include "polyMeshGeometry.H"
31 #include "IOmanip.H"
32 
33 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
34 
36 (
37  const bool report,
38  const polyMesh& mesh,
39  const dictionary& dict,
40  const labelList& checkFaces,
41  labelHashSet& wrongFaces,
42  const bool dryRun
43 )
44 {
45  List<labelPair> emptyBaffles;
46  return checkMesh
47  (
48  report,
49  mesh,
50  dict,
51  checkFaces,
52  emptyBaffles,
53  wrongFaces,
54  dryRun
55  );
56 }
57 
59 (
60  const bool report,
61  const polyMesh& mesh,
62  const dictionary& dict,
63  const labelList& checkFaces,
64  const List<labelPair>& baffles,
65  labelHashSet& wrongFaces,
66  const bool dryRun
67 )
68 {
69  const scalar maxNonOrtho
70  (
71  get<scalar>(dict, "maxNonOrtho", dryRun, keyType::REGEX_RECURSIVE)
72  );
73  const scalar minVol
74  (
75  get<scalar>(dict, "minVol", dryRun, keyType::REGEX_RECURSIVE)
76  );
77  const scalar minTetQuality
78  (
79  get<scalar>(dict, "minTetQuality", dryRun, keyType::REGEX_RECURSIVE)
80  );
81  const scalar maxConcave
82  (
83  get<scalar>(dict, "maxConcave", dryRun, keyType::REGEX_RECURSIVE)
84  );
85  const scalar minArea
86  (
87  get<scalar>(dict, "minArea", dryRun, keyType::REGEX_RECURSIVE)
88  );
89  const scalar maxIntSkew
90  (
91  get<scalar>
92  (
93  dict, "maxInternalSkewness", dryRun, keyType::REGEX_RECURSIVE
94  )
95  );
96  const scalar maxBounSkew
97  (
98  get<scalar>
99  (
100  dict, "maxBoundarySkewness", dryRun, keyType::REGEX_RECURSIVE
101  )
102  );
103  const scalar minWeight
104  (
105  get<scalar>(dict, "minFaceWeight", dryRun, keyType::REGEX_RECURSIVE)
106  );
107  const scalar minVolRatio
108  (
109  get<scalar>(dict, "minVolRatio", dryRun, keyType::REGEX_RECURSIVE)
110  );
111  const scalar minTwist
112  (
113  get<scalar>(dict, "minTwist", dryRun, keyType::REGEX_RECURSIVE)
114  );
115  const scalar minTriangleTwist
116  (
117  get<scalar>(dict, "minTriangleTwist", dryRun, keyType::REGEX_RECURSIVE)
118  );
119  const scalar minFaceFlatness
120  (
121  dict.getOrDefault<scalar>
122  (
123  "minFaceFlatness", -1, keyType::REGEX_RECURSIVE
124  )
125  );
126  const scalar minDet
127  (
128  get<scalar>(dict, "minDeterminant", dryRun, keyType::REGEX_RECURSIVE)
129  );
130 
131 
132  if (dryRun)
133  {
134  string errorMsg(FatalError.message());
135  string IOerrorMsg(FatalIOError.message());
136 
137  if (errorMsg.size() || IOerrorMsg.size())
138  {
139  //errorMsg = "[dryRun] " + errorMsg;
140  //errorMsg.replaceAll("\n", "\n[dryRun] ");
141  //IOerrorMsg = "[dryRun] " + IOerrorMsg;
142  //IOerrorMsg.replaceAll("\n", "\n[dryRun] ");
143 
145  << nl
146  << "Missing/incorrect required dictionary entries:" << nl
147  << nl
148  << IOerrorMsg.c_str() << nl
149  << errorMsg.c_str() << nl
150  //<< nl << "Exiting dry-run" << nl
151  << endl;
152 
153  FatalError.clear();
155  }
156  return false;
157  }
158 
159 
160  label nWrongFaces = 0;
161 
162  Info<< "Checking faces in error :" << endl;
163  //Pout.setf(ios_base::left);
164 
165  if (maxNonOrtho < 180.0-SMALL)
166  {
167  polyMeshGeometry::checkFaceDotProduct
168  (
169  report,
170  maxNonOrtho,
171  mesh,
172  mesh.cellCentres(),
173  mesh.faceAreas(),
174  checkFaces,
175  baffles,
176  &wrongFaces
177  );
178 
179  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
180 
181  Info<< " non-orthogonality > "
182  << setw(3) << maxNonOrtho
183  << " degrees : "
184  << nNewWrongFaces-nWrongFaces << endl;
185 
186  nWrongFaces = nNewWrongFaces;
187  }
188 
189  if (minVol > -GREAT)
190  {
191  polyMeshGeometry::checkFacePyramids
192  (
193  report,
194  minVol,
195  mesh,
196  mesh.cellCentres(),
197  mesh.points(),
198  checkFaces,
199  baffles,
200  &wrongFaces
201  );
202 
203  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
204 
205  Info<< " faces with face pyramid volume < "
206  << setw(5) << minVol << " : "
207  << nNewWrongFaces-nWrongFaces << endl;
208 
209  nWrongFaces = nNewWrongFaces;
210  }
211 
212  if (minTetQuality > -GREAT)
213  {
214  polyMeshGeometry::checkFaceTets
215  (
216  report,
217  minTetQuality,
218  mesh,
219  mesh.cellCentres(),
220  mesh.faceCentres(),
221  mesh.points(),
222  checkFaces,
223  baffles,
224  &wrongFaces
225  );
226 
227  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
228 
229  Info<< " faces with face-decomposition tet quality < "
230  << setw(5) << minTetQuality << " : "
231  << nNewWrongFaces-nWrongFaces << endl;
232 
233  nWrongFaces = nNewWrongFaces;
234  }
235 
236  if (maxConcave < 180.0-SMALL)
237  {
238  polyMeshGeometry::checkFaceAngles
239  (
240  report,
241  maxConcave,
242  mesh,
243  mesh.faceAreas(),
244  mesh.points(),
245  checkFaces,
246  &wrongFaces
247  );
248 
249  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
250 
251  Info<< " faces with concavity > "
252  << setw(3) << maxConcave
253  << " degrees : "
254  << nNewWrongFaces-nWrongFaces << endl;
255 
256  nWrongFaces = nNewWrongFaces;
257  }
258 
259  if (minArea > -SMALL)
260  {
261  polyMeshGeometry::checkFaceArea
262  (
263  report,
264  minArea,
265  mesh,
266  mesh.faceAreas(),
267  checkFaces,
268  &wrongFaces
269  );
270 
271  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
272 
273  Info<< " faces with area < "
274  << setw(5) << minArea
275  << " m^2 : "
276  << nNewWrongFaces-nWrongFaces << endl;
277 
278  nWrongFaces = nNewWrongFaces;
279  }
280 
281  if (maxIntSkew > 0 || maxBounSkew > 0)
282  {
283  polyMeshGeometry::checkFaceSkewness
284  (
285  report,
286  maxIntSkew,
287  maxBounSkew,
288  mesh,
289  mesh.points(),
290  mesh.cellCentres(),
291  mesh.faceCentres(),
292  mesh.faceAreas(),
293  checkFaces,
294  baffles,
295  &wrongFaces
296  );
297 
298  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
299 
300  Info<< " faces with skewness > "
301  << setw(3) << maxIntSkew
302  << " (internal) or " << setw(3) << maxBounSkew
303  << " (boundary) : " << nNewWrongFaces-nWrongFaces << endl;
304 
305  nWrongFaces = nNewWrongFaces;
306  }
307 
308  if (minWeight >= 0 && minWeight < 1)
309  {
310  polyMeshGeometry::checkFaceWeights
311  (
312  report,
313  minWeight,
314  mesh,
315  mesh.cellCentres(),
316  mesh.faceCentres(),
317  mesh.faceAreas(),
318  checkFaces,
319  baffles,
320  &wrongFaces
321  );
322 
323  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
324 
325  Info<< " faces with interpolation weights (0..1) < "
326  << setw(5) << minWeight
327  << " : "
328  << nNewWrongFaces-nWrongFaces << endl;
329 
330  nWrongFaces = nNewWrongFaces;
331  }
332 
333  if (minVolRatio >= 0)
334  {
335  polyMeshGeometry::checkVolRatio
336  (
337  report,
338  minVolRatio,
339  mesh,
340  mesh.cellVolumes(),
341  checkFaces,
342  baffles,
343  &wrongFaces
344  );
345 
346  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
347 
348  Info<< " faces with volume ratio of neighbour cells < "
349  << setw(5) << minVolRatio
350  << " : "
351  << nNewWrongFaces-nWrongFaces << endl;
352 
353  nWrongFaces = nNewWrongFaces;
354  }
355 
356  if (minTwist > -1)
357  {
358  //Pout<< "Checking face twist: dot product of face normal "
359  // << "with face triangle normals" << endl;
360  polyMeshGeometry::checkFaceTwist
361  (
362  report,
363  minTwist,
364  mesh,
365  mesh.cellCentres(),
366  mesh.faceAreas(),
367  mesh.faceCentres(),
368  mesh.points(),
369  checkFaces,
370  &wrongFaces
371  );
372 
373  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
374 
375  Info<< " faces with face twist < "
376  << setw(5) << minTwist
377  << " : "
378  << nNewWrongFaces-nWrongFaces << endl;
379 
380  nWrongFaces = nNewWrongFaces;
381  }
382 
383  if (minTriangleTwist > -1)
384  {
385  //Pout<< "Checking triangle twist: dot product of consecutive triangle"
386  // << " normals resulting from face-centre decomposition" << endl;
387  polyMeshGeometry::checkTriangleTwist
388  (
389  report,
390  minTriangleTwist,
391  mesh,
392  mesh.faceAreas(),
393  mesh.faceCentres(),
394  mesh.points(),
395  checkFaces,
396  &wrongFaces
397  );
398 
399  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
400 
401  Info<< " faces with triangle twist < "
402  << setw(5) << minTriangleTwist
403  << " : "
404  << nNewWrongFaces-nWrongFaces << endl;
405 
406  nWrongFaces = nNewWrongFaces;
407  }
408 
409  if (minFaceFlatness > -SMALL)
410  {
411  polyMeshGeometry::checkFaceFlatness
412  (
413  report,
414  minFaceFlatness,
415  mesh,
416  mesh.faceAreas(),
417  mesh.faceCentres(),
418  mesh.points(),
419  checkFaces,
420  &wrongFaces
421  );
422 
423  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
424 
425  Info<< " faces with flatness < "
426  << setw(5) << minFaceFlatness
427  << " : "
428  << nNewWrongFaces-nWrongFaces << endl;
429 
430  nWrongFaces = nNewWrongFaces;
431  }
432 
433  if (minDet > -1)
434  {
435  polyMeshGeometry::checkCellDeterminant
436  (
437  report,
438  minDet,
439  mesh,
440  mesh.faceAreas(),
441  checkFaces,
442  polyMeshGeometry::affectedCells(mesh, checkFaces),
443  &wrongFaces
444  );
445 
446  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
447 
448  Info<< " faces on cells with determinant < "
449  << setw(5) << minDet << " : "
450  << nNewWrongFaces-nWrongFaces << endl;
451 
452  nWrongFaces = nNewWrongFaces;
453  }
454 
455  //Pout.setf(ios_base::right);
456 
457  return nWrongFaces > 0;
458 }
459 
460 
462 (
463  const bool report,
464  const polyMesh& mesh,
465  const dictionary& dict,
466  labelHashSet& wrongFaces,
467  const bool dryRun
468 )
469 {
470  return checkMesh
471  (
472  report,
473  mesh,
474  dict,
475  identity(mesh.nFaces()),
476  wrongFaces,
477  dryRun
478  );
479 }
480 
482 (
483  const bool report,
484  const dictionary& dict,
485  const polyMeshGeometry& meshGeom,
486  const pointField& points,
487  const labelList& checkFaces,
488  labelHashSet& wrongFaces,
489  const bool dryRun
490 )
491 {
492  List<labelPair> emptyBaffles;
493 
494  return checkMesh
495  (
496  report,
497  dict,
498  meshGeom,
499  points,
500  checkFaces,
501  emptyBaffles,
502  wrongFaces,
503  dryRun
504  );
505 }
506 
507 
509 (
510  const bool report,
511  const dictionary& dict,
512  const polyMeshGeometry& meshGeom,
513  const pointField& points,
514  const labelList& checkFaces,
515  const List<labelPair>& baffles,
516  labelHashSet& wrongFaces,
517  const bool dryRun
518 )
519 {
520  const scalar maxNonOrtho
521  (
522  get<scalar>(dict, "maxNonOrtho", dryRun, keyType::REGEX_RECURSIVE)
523  );
524  const scalar minVol
525  (
526  get<scalar>(dict, "minVol", dryRun, keyType::REGEX_RECURSIVE)
527  );
528  const scalar minTetQuality
529  (
530  get<scalar>(dict, "minTetQuality", dryRun, keyType::REGEX_RECURSIVE)
531  );
532  const scalar maxConcave
533  (
534  get<scalar>(dict, "maxConcave", dryRun, keyType::REGEX_RECURSIVE)
535  );
536  const scalar minArea
537  (
538  get<scalar>(dict, "minArea", dryRun, keyType::REGEX_RECURSIVE)
539  );
540  const scalar maxIntSkew
541  (
542  get<scalar>(dict, "maxInternalSkewness", dryRun, keyType::REGEX_RECURSIVE)
543  );
544  const scalar maxBounSkew
545  (
546  get<scalar>(dict, "maxBoundarySkewness", dryRun, keyType::REGEX_RECURSIVE)
547  );
548  const scalar minWeight
549  (
550  get<scalar>(dict, "minFaceWeight", dryRun, keyType::REGEX_RECURSIVE)
551  );
552  const scalar minVolRatio
553  (
554  get<scalar>(dict, "minVolRatio", dryRun, keyType::REGEX_RECURSIVE)
555  );
556  const scalar minTwist
557  (
558  get<scalar>(dict, "minTwist", dryRun, keyType::REGEX_RECURSIVE)
559  );
560  const scalar minTriangleTwist
561  (
562  get<scalar>(dict, "minTriangleTwist", dryRun, keyType::REGEX_RECURSIVE)
563  );
564  scalar minFaceFlatness = -1.0;
565  dict.readIfPresent
566  (
567  "minFaceFlatness",
568  minFaceFlatness,
569  keyType::REGEX_RECURSIVE
570  );
571  const scalar minDet
572  (
573  get<scalar>(dict, "minDeterminant", dryRun, keyType::REGEX_RECURSIVE)
574  );
575 
576  if (dryRun)
577  {
578  string errorMsg(FatalError.message());
579  string IOerrorMsg(FatalIOError.message());
580 
581  if (errorMsg.size() || IOerrorMsg.size())
582  {
583  //errorMsg = "[dryRun] " + errorMsg;
584  //errorMsg.replaceAll("\n", "\n[dryRun] ");
585  //IOerrorMsg = "[dryRun] " + IOerrorMsg;
586  //IOerrorMsg.replaceAll("\n", "\n[dryRun] ");
587 
588  Perr<< nl
589  << "Missing/incorrect required dictionary entries:" << nl
590  << nl
591  << IOerrorMsg.c_str() << nl
592  << errorMsg.c_str() << nl
593  //<< nl << "Exiting dry-run" << nl
594  << endl;
595 
596  FatalError.clear();
598  }
599  return false;
600  }
601 
602 
603  label nWrongFaces = 0;
604 
605  Info<< "Checking faces in error :" << endl;
606  //Pout.setf(ios_base::left);
607 
608  if (maxNonOrtho < 180.0-SMALL)
609  {
610  meshGeom.checkFaceDotProduct
611  (
612  report,
613  maxNonOrtho,
614  checkFaces,
615  baffles,
616  &wrongFaces
617  );
618 
619  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
620 
621  Info<< " non-orthogonality > "
622  << setw(3) << maxNonOrtho
623  << " degrees : "
624  << nNewWrongFaces-nWrongFaces << endl;
625 
626  nWrongFaces = nNewWrongFaces;
627  }
628 
629  if (minVol > -GREAT)
630  {
631  meshGeom.checkFacePyramids
632  (
633  report,
634  minTetQuality,
635  points,
636  checkFaces,
637  baffles,
638  &wrongFaces
639  );
640 
641  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
642 
643  Info<< " faces with face pyramid volume < "
644  << setw(5) << minVol << " : "
645  << nNewWrongFaces-nWrongFaces << endl;
646 
647  nWrongFaces = nNewWrongFaces;
648  }
649 
650  if (minTetQuality > -GREAT)
651  {
652  meshGeom.checkFaceTets
653  (
654  report,
655  minTetQuality,
656  points,
657  checkFaces,
658  baffles,
659  &wrongFaces
660  );
661 
662  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
663 
664  Info<< " faces with face-decomposition tet quality < "
665  << setw(5) << minTetQuality << " : "
666  << nNewWrongFaces-nWrongFaces << endl;
667 
668  nWrongFaces = nNewWrongFaces;
669  }
670 
671  if (maxConcave < 180.0-SMALL)
672  {
673  meshGeom.checkFaceAngles
674  (
675  report,
676  maxConcave,
677  points,
678  checkFaces,
679  &wrongFaces
680  );
681 
682  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
683 
684  Info<< " faces with concavity > "
685  << setw(3) << maxConcave
686  << " degrees : "
687  << nNewWrongFaces-nWrongFaces << endl;
688 
689  nWrongFaces = nNewWrongFaces;
690  }
691 
692  if (minArea > -SMALL)
693  {
694  meshGeom.checkFaceArea
695  (
696  report,
697  minArea,
698  checkFaces,
699  &wrongFaces
700  );
701 
702  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
703 
704  Info<< " faces with area < "
705  << setw(5) << minArea
706  << " m^2 : "
707  << nNewWrongFaces-nWrongFaces << endl;
708 
709  nWrongFaces = nNewWrongFaces;
710  }
711 
712  if (maxIntSkew > 0 || maxBounSkew > 0)
713  {
714  polyMeshGeometry::checkFaceSkewness
715  (
716  report,
717  maxIntSkew,
718  maxBounSkew,
719  meshGeom.mesh(),
720  points,
721  meshGeom.cellCentres(),
722  meshGeom.faceCentres(),
723  meshGeom.faceAreas(),
724  checkFaces,
725  baffles,
726  &wrongFaces
727  );
728 
729  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
730 
731  Info<< " faces with skewness > "
732  << setw(3) << maxIntSkew
733  << " (internal) or " << setw(3) << maxBounSkew
734  << " (boundary) : " << nNewWrongFaces-nWrongFaces << endl;
735 
736  nWrongFaces = nNewWrongFaces;
737  }
738 
739  if (minWeight >= 0 && minWeight < 1)
740  {
741  meshGeom.checkFaceWeights
742  (
743  report,
744  minWeight,
745  checkFaces,
746  baffles,
747  &wrongFaces
748  );
749 
750  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
751 
752  Info<< " faces with interpolation weights (0..1) < "
753  << setw(5) << minWeight
754  << " : "
755  << nNewWrongFaces-nWrongFaces << endl;
756 
757  nWrongFaces = nNewWrongFaces;
758  }
759 
760  if (minVolRatio >= 0)
761  {
762  meshGeom.checkVolRatio
763  (
764  report,
765  minVolRatio,
766  checkFaces,
767  baffles,
768  &wrongFaces
769  );
770 
771  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
772 
773  Info<< " faces with volume ratio of neighbour cells < "
774  << setw(5) << minVolRatio
775  << " : "
776  << nNewWrongFaces-nWrongFaces << endl;
777 
778  nWrongFaces = nNewWrongFaces;
779  }
780 
781  if (minTwist > -1)
782  {
783  //Pout<< "Checking face twist: dot product of face normal "
784  // << "with face triangle normals" << endl;
785  meshGeom.checkFaceTwist
786  (
787  report,
788  minTwist,
789  points,
790  checkFaces,
791  &wrongFaces
792  );
793 
794  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
795 
796  Info<< " faces with face twist < "
797  << setw(5) << minTwist
798  << " : "
799  << nNewWrongFaces-nWrongFaces << endl;
800 
801  nWrongFaces = nNewWrongFaces;
802  }
803 
804  if (minTriangleTwist > -1)
805  {
806  //Pout<< "Checking triangle twist: dot product of consecutive triangle"
807  // << " normals resulting from face-centre decomposition" << endl;
808  meshGeom.checkTriangleTwist
809  (
810  report,
811  minTriangleTwist,
812  points,
813  checkFaces,
814  &wrongFaces
815  );
816 
817  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
818 
819  Info<< " faces with triangle twist < "
820  << setw(5) << minTriangleTwist
821  << " : "
822  << nNewWrongFaces-nWrongFaces << endl;
823 
824  nWrongFaces = nNewWrongFaces;
825  }
826 
827  if (minFaceFlatness > -SMALL)
828  {
829  meshGeom.checkFaceFlatness
830  (
831  report,
832  minFaceFlatness,
833  points,
834  checkFaces,
835  &wrongFaces
836  );
837 
838  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
839 
840  Info<< " faces with flatness < "
841  << setw(5) << minFaceFlatness
842  << " : "
843  << nNewWrongFaces-nWrongFaces << endl;
844 
845  nWrongFaces = nNewWrongFaces;
846  }
847 
848  if (minDet > -1)
849  {
850  meshGeom.checkCellDeterminant
851  (
852  report,
853  minDet,
854  checkFaces,
855  polyMeshGeometry::affectedCells(meshGeom.mesh(), checkFaces),
856  &wrongFaces
857  );
858 
859  label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
860 
861  Info<< " faces on cells with determinant < "
862  << setw(5) << minDet << " : "
863  << nNewWrongFaces-nWrongFaces << endl;
864 
865  nWrongFaces = nNewWrongFaces;
866  }
867 
868  //Pout.setf(ios_base::right);
869 
870  return nWrongFaces > 0;
871 }
872 
873 
874 // ************************************************************************* //
Foam::polyMeshGeometry::checkFaceDotProduct
static bool checkFaceDotProduct(const bool report, const scalar orthWarn, const polyMesh &, const vectorField &cellCentres, const vectorField &faceAreas, const labelList &checkFaces, const List< labelPair > &baffles, labelHashSet *setPtr)
See primitiveMesh.
Definition: polyMeshGeometry.C:360
Foam::polyMeshGeometry::faceAreas
const vectorField & faceAreas() const
Definition: polyMeshGeometry.H:146
Foam::returnReduce
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Definition: PstreamReduceOps.H:94
polyMeshGeometry.H
Foam::polyMeshGeometry::checkFaceWeights
static bool checkFaceWeights(const bool report, const scalar warnWeight, const polyMesh &mesh, const vectorField &cellCentres, const vectorField &faceCentres, const vectorField &faceAreas, const labelList &checkFaces, const List< labelPair > &baffles, labelHashSet *setPtr)
Interpolation weights (0.5 for regular mesh)
Definition: polyMeshGeometry.C:1135
Foam::FatalIOError
IOerror FatalIOError
Foam::motionSmootherAlgo::checkMesh
static bool checkMesh(const bool report, const polyMesh &mesh, const dictionary &dict, labelHashSet &wrongFaces, const bool dryRun=false)
Check mesh with mesh settings in dict. Collects incorrect faces.
Definition: motionSmootherAlgoCheck.C:462
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::polyMeshGeometry::checkFaceTets
static bool checkFaceTets(const bool report, const scalar minPyrVol, const polyMesh &, const vectorField &cellCentres, const vectorField &faceCentres, const pointField &p, const labelList &checkFaces, const List< labelPair > &baffles, labelHashSet *)
See primitiveMesh.
Definition: polyMeshGeometry.C:709
Foam::HashSet< label, Hash< label > >
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::sumOp
Definition: ops.H:213
Foam::polyMeshGeometry::faceCentres
const vectorField & faceCentres() const
Definition: polyMeshGeometry.H:150
Foam::polyMeshGeometry::checkFaceArea
static bool checkFaceArea(const bool report, const scalar minArea, const polyMesh &, const vectorField &faceAreas, const labelList &checkFaces, labelHashSet *setPtr)
Small faces.
Definition: polyMeshGeometry.C:1932
Foam::Field< vector >
Foam::polyMeshGeometry::mesh
const polyMesh & mesh() const
Definition: polyMeshGeometry.H:141
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
IOmanip.H
Istream and Ostream manipulators taking arguments.
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:123
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::error::message
string message() const
The accumulated error message.
Definition: error.C:319
Foam::setw
Omanip< int > setw(const int i)
Definition: IOmanip.H:199
Foam::polyMeshGeometry::checkFaceTwist
static bool checkFaceTwist(const bool report, const scalar minTwist, const polyMesh &, const vectorField &cellCentres, const vectorField &faceAreas, const vectorField &faceCentres, const pointField &p, const labelList &checkFaces, labelHashSet *setPtr)
Triangle (from face-centre decomposition) normal v.s.
Definition: polyMeshGeometry.C:1547
Foam::Perr
prefixOSstream Perr
OSstream wrapped stderr (std::cerr) with parallel prefix.
Foam::polyMeshGeometry::checkFaceFlatness
static bool checkFaceFlatness(const bool report, const scalar minFlatness, const polyMesh &, const vectorField &faceAreas, const vectorField &faceCentres, const pointField &p, const labelList &checkFaces, labelHashSet *setPtr)
Area of faces v.s. sum of triangle areas.
Definition: polyMeshGeometry.C:1839
Foam::nl
constexpr char nl
Definition: Ostream.H:404
Foam::List< label >
motionSmootherAlgo.H
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::identity
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
Definition: labelList.C:38
Foam::error::clear
void clear() const
Clear any messages.
Definition: error.C:325
Foam::polyMeshGeometry
Updateable mesh geometry and checking routines.
Definition: polyMeshGeometry.H:55
Foam::polyMeshGeometry::checkFacePyramids
static bool checkFacePyramids(const bool report, const scalar minPyrVol, const polyMesh &, const vectorField &cellCentres, const pointField &p, const labelList &checkFaces, const List< labelPair > &baffles, labelHashSet *)
See primitiveMesh.
Definition: polyMeshGeometry.C:538
IOWarningInFunction
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
Definition: messageStream.H:340
Foam::polyMeshGeometry::checkCellDeterminant
static bool checkCellDeterminant(const bool report, const scalar minDet, const polyMesh &, const vectorField &faceAreas, const labelList &checkFaces, const labelList &affectedCells, labelHashSet *setPtr)
Area of internal faces v.s. boundary faces.
Definition: polyMeshGeometry.C:1989
Foam::polyMeshGeometry::checkTriangleTwist
static bool checkTriangleTwist(const bool report, const scalar minTwist, const polyMesh &, const vectorField &faceAreas, const vectorField &faceCentres, const pointField &p, const labelList &checkFaces, labelHashSet *setPtr)
Consecutive triangle (from face-centre decomposition) normals.
Definition: polyMeshGeometry.C:1693
Foam::polyMeshGeometry::cellCentres
const vectorField & cellCentres() const
Definition: polyMeshGeometry.H:154
Foam::polyMeshGeometry::checkVolRatio
static bool checkVolRatio(const bool report, const scalar warnRatio, const polyMesh &mesh, const scalarField &cellVolumes, const labelList &checkFaces, const List< labelPair > &baffles, labelHashSet *setPtr)
Cell volume ratio of neighbouring cells (1 for regular mesh)
Definition: polyMeshGeometry.C:1283
Foam::polyMeshGeometry::checkFaceAngles
static bool checkFaceAngles(const bool report, const scalar maxDeg, const polyMesh &mesh, const vectorField &faceAreas, const pointField &p, const labelList &checkFaces, labelHashSet *setPtr)
See primitiveMesh.
Definition: polyMeshGeometry.C:1419