printMeshSummary.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) 2021 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
12 
13 Description
14  Summary of faMesh information
15 
16 \*---------------------------------------------------------------------------*/
17 
18 {
19  const faBoundaryMesh& patches = aMesh.boundary();
20  const label nNonProcessor = patches.nNonProcessor();
21  const label nPatches = patches.size();
22 
23  Info<< "----------------" << nl
24  << "Mesh Information" << nl
25  << "----------------" << nl
26  << " " << "boundingBox: " << boundBox(aMesh.points()) << nl;
27 
28  Info<< " Number of points: "
29  << returnReduce(aMesh.nPoints(), sumOp<label>()) << nl
30  << " Number of faces: "
31  << returnReduce(aMesh.nFaces(), sumOp<label>()) << nl;
32 
33  Info<< " Number of edges: "
34  << returnReduce(aMesh.nEdges(), sumOp<label>()) << nl
35  << " Number of internal edges: "
36  << returnReduce(aMesh.nInternalEdges(), sumOp<label>()) << nl;
37 
38 
39  label nProcEdges = 0;
40 
41  if (Pstream::parRun())
42  {
43  for (const faPatch& fap : patches)
44  {
45  const auto* cpp = isA<processorFaPatch>(fap);
46 
47  if (cpp)
48  {
49  nProcEdges += fap.nEdges();
50  }
51  }
52  }
53 
54  const label nBoundEdges = aMesh.nBoundaryEdges() - nProcEdges;
55 
56  Info<< " Number of boundary edges: "
57  << returnReduce(nBoundEdges - nProcEdges, sumOp<label>()) << nl;
58 
59  if (Pstream::parRun())
60  {
61  Info<< " Number of processor edges: "
62  << returnReduce(nProcEdges, sumOp<label>()) << nl;
63  }
64 
65 
66  Info<< "----------------" << nl
67  << "Patches" << nl
68  << "----------------" << nl;
69 
70  for (label patchi = 0; patchi < nNonProcessor; ++patchi)
71  {
72  const faPatch& p = patches[patchi];
73 
74  Info<< " " << "patch " << p.index()
75  << " (size: " << returnReduce(p.size(), sumOp<label>())
76  << ") name: " << p.name()
77  << nl;
78  }
79 
80 
81  // Geometry information
82  Info<< nl;
83  {
84  scalarMinMax limit(gMinMax(aMesh.S().field()));
85  Info<< "Face area:" << nl
86  << " min = " << limit.min() << " max = " << limit.max() << nl;
87  }
88 
89  {
90  scalarMinMax limit(minMax(aMesh.magLe().primitiveField()));
91 
92  // Include processor boundaries into 'internal' edges
93  if (Pstream::parRun())
94  {
95  for (label patchi = nNonProcessor; patchi < nPatches; ++patchi)
96  {
97  limit.add(minMax(aMesh.magLe().boundaryField()[patchi]));
98  }
99 
100  reduce(limit, minMaxOp<scalar>());
101  }
102 
103  Info<< "Edge length (internal):" << nl
104  << " min = " << limit.min() << " max = " << limit.max() << nl;
105 
106 
107  // Include (non-processor) boundaries
108  for (label patchi = 0; patchi < nNonProcessor; ++patchi)
109  {
110  limit.add(minMax(aMesh.magLe().boundaryField()[patchi]));
111  }
112 
113  if (Pstream::parRun())
114  {
115  reduce(limit, minMaxOp<scalar>());
116  }
117 
118  Info<< "Edge length:" << nl
119  << " min = " << limit.min() << " max = " << limit.max() << nl;
120  }
121 
122  // Not particularly meaningful
123  #if 0
124  {
125  MinMax<vector> limit(gMinMax(aMesh.faceAreaNormals().field()));
126 
127  Info<< "Face area normals:" << nl
128  << " min = " << limit.min() << " max = " << limit.max() << nl;
129  }
130  #endif
131 }
132 
133 
134 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::MULES::limit
void limit(const RdeltaTType &rDeltaT, const RhoType &rho, const volScalarField &psi, const surfaceScalarField &phi, surfaceScalarField &phiPsi, const SpType &Sp, const SuType &Su, const PsiMaxType &psiMax, const PsiMinType &psiMin, const bool returnCorr)
Definition: MULESTemplates.C:581
Foam::returnReduce
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Definition: PstreamReduceOps.H:94
aMesh
faMesh aMesh(mesh)
nPatches
const label nPatches
Definition: printMeshSummary.H:30
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
nBoundEdges
const label nBoundEdges
Definition: printMeshSummary.H:63
Foam::scalarMinMax
MinMax< scalar > scalarMinMax
A scalar min/max range.
Definition: MinMax.H:117
reduce
reduce(hasMovingMesh, orOp< bool >())
nNonProcessor
const label nNonProcessor
Definition: printMeshSummary.H:29
Foam::nl
constexpr char nl
Definition: Ostream.H:404
patches
const polyBoundaryMesh & patches
Definition: convertProcessorPatches.H:65
Foam::minMax
MinMax< label > minMax(const labelHashSet &set)
Find the min/max values of labelHashSet.
Definition: hashSets.C:61
Foam::gMinMax
MinMax< Type > gMinMax(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:595