checkBlockMesh.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "blockMesh.H"
00030
00031
00032
00033
00034 void Foam::blockMesh::checkBlockMesh(const polyMesh& bm)
00035 {
00036 Info<< nl << "Check block mesh topology" << endl;
00037
00038 bool blockMeshOK = true;
00039
00040 const pointField& points = bm.points();
00041 const faceList& faces = bm.faces();
00042 const cellList& cells = bm.cells();
00043 const polyPatchList& patches = bm.boundaryMesh();
00044
00045 label nBoundaryFaces=0;
00046 forAll(cells, celli)
00047 {
00048 nBoundaryFaces += cells[celli].nFaces();
00049 }
00050
00051 nBoundaryFaces -= 2*bm.nInternalFaces();
00052
00053 label nDefinedBoundaryFaces=0;
00054 forAll(patches, patchi)
00055 {
00056 nDefinedBoundaryFaces += patches[patchi].size();
00057 }
00058
00059
00060 Info<< nl << tab << "Basic statistics" << endl;
00061
00062 Info<< tab << tab << "Number of internal faces : "
00063 << bm.nInternalFaces() << endl;
00064
00065 Info<< tab << tab << "Number of boundary faces : "
00066 << nBoundaryFaces << endl;
00067
00068 Info<< tab << tab << "Number of defined boundary faces : "
00069 << nDefinedBoundaryFaces << endl;
00070
00071 Info<< tab << tab << "Number of undefined boundary faces : "
00072 << nBoundaryFaces - nDefinedBoundaryFaces << endl;
00073
00074 if ((nBoundaryFaces - nDefinedBoundaryFaces) > 0)
00075 {
00076 Info<< tab << tab << tab
00077 << "(Warning : only leave undefined the front and back planes "
00078 << "of 2D planar geometries!)" << endl;
00079 }
00080
00081 Info<< nl << tab << "Checking patch -> block consistency" << endl;
00082
00083
00084 forAll(patches, patchi)
00085 {
00086 const faceList& Patch = patches[patchi];
00087
00088 forAll(Patch, patchFacei)
00089 {
00090 const face& patchFace = Patch[patchFacei];
00091 bool patchFaceOK = false;
00092
00093 forAll(cells, celli)
00094 {
00095 const labelList& cellFaces = cells[celli];
00096
00097 forAll(cellFaces, cellFacei)
00098 {
00099 if (patchFace == faces[cellFaces[cellFacei]])
00100 {
00101 patchFaceOK = true;
00102
00103 if
00104 (
00105 (
00106 patchFace.normal(points)
00107 & faces[cellFaces[cellFacei]].normal(points)
00108 ) < 0.0
00109 )
00110 {
00111 Info<< tab << tab
00112 << "Face " << patchFacei
00113 << " of patch " << patchi
00114 << " (" << patches[patchi].name() << ")"
00115 << " points inwards"
00116 << endl;
00117
00118 blockMeshOK = false;
00119 }
00120 }
00121 }
00122 }
00123
00124 if (!patchFaceOK)
00125 {
00126 Info<< tab << tab
00127 << "Face " << patchFacei
00128 << " of patch " << patchi
00129 << " (" << patches[patchi].name() << ")"
00130 << " does not match any block faces" << endl;
00131
00132 blockMeshOK = false;
00133 }
00134 }
00135 }
00136
00137 if (!blockMeshOK)
00138 {
00139 FatalErrorIn("blockMesh::checkBlockMesh(const polyMesh& bm)")
00140 << "Block mesh topology incorrect, stopping mesh generation!"
00141 << exit(FatalError);
00142 }
00143 }
00144
00145
Copyright © 2000-2009 OpenCFD Ltd