|
|
|
addPatchCellLayer.HGo to the documentation of this file.00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. 00006 \\/ M anipulation | 00007 ------------------------------------------------------------------------------- 00008 License 00009 This file is part of OpenFOAM. 00010 00011 OpenFOAM is free software; you can redistribute it and/or modify it 00012 under the terms of the GNU General Public License as published by the 00013 Free Software Foundation; either version 2 of the License, or (at your 00014 option) any later version. 00015 00016 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT 00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00018 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00019 for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with OpenFOAM; if not, write to the Free Software Foundation, 00023 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 00025 Class 00026 addPatchCellLayer 00027 00028 Description 00029 Adds layers of cells to outside of polyPatch. Call setRefinement with 00030 offset vector for every patch point. 00031 - offset vector should be zero for any non-manifold point and synchronised 00032 on coupled points before calling this. 00033 - offset vector of zero will not add any points. 00034 - added faces get same patchID as face they are extruded from 00035 - 'side' faces (i.e. on the edge of pp) get the patchID of the 00036 other patch they are connected to. 00037 00038 00039 E.g. 3 boundary faces on patches a,b. b gets extruded, a doesn't. 00040 00041 a b b <- patch of boundary face 00042 +------+------+------+ 00043 | | | | <- cells 00044 +------+------+------+ 00045 00046 00047 ^ ^ <- wanted extrusion vector (none at far right) 00048 a | b | b <- patch of boundary face 00049 +------+------+------+ 00050 | | | | <- cells 00051 +------+------+------+ 00052 00053 b 00054 +------+\ b 1. prism cell added onto second b face since 00055 a a| | ----\ only one side gets extruded. 00056 +------+------+------+ 2. side-face gets patch a, not b. 00057 | | | | 00058 +------+------+------+ 00059 00060 00061 SourceFiles 00062 addPatchCellLayer.C 00063 00064 \*---------------------------------------------------------------------------*/ 00065 00066 #ifndef addPatchCellLayer_H 00067 #define addPatchCellLayer_H 00068 00069 #include "labelList.H" 00070 #include "typeInfo.H" 00071 #include "pointField.H" 00072 #include "indirectPrimitivePatch.H" 00073 00074 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00075 00076 namespace Foam 00077 { 00078 00079 // Class forward declarations 00080 class polyMesh; 00081 class polyTopoChange; 00082 class mapPolyMesh; 00083 00084 /*---------------------------------------------------------------------------*\ 00085 Class addPatchCellLayer Declaration 00086 \*---------------------------------------------------------------------------*/ 00087 00088 class addPatchCellLayer 00089 { 00090 // Private data 00091 00092 //- Reference to mesh 00093 const polyMesh& mesh_; 00094 00095 //- For all patchpoints: list of added points (size 0 or nLayers) 00096 // First point in list is one nearest to original point in patch, 00097 // last one is the new point on the surface. 00098 labelListList addedPoints_; 00099 00100 //- For all patchfaces: list of layer faces. 00101 // - empty if no face extruded 00102 // - first face is original boundary face 00103 // - last one is new boundary face. 00104 labelListList layerFaces_; 00105 00106 00107 // Private Member Functions 00108 00109 //- Get the face on the other side of the edge. 00110 static label nbrFace 00111 ( 00112 const indirectPrimitivePatch&, 00113 const label patchEdgeI, 00114 const label patchFaceI 00115 ); 00116 00117 //- Add vertex to face if unique. 00118 static void addVertex(const label, face&, label& fp); 00119 00120 bool sameEdgeNeighbour 00121 ( 00122 const indirectPrimitivePatch& pp, 00123 const boolList& doneEdge, 00124 const label thisFaceI, 00125 const label nbrFaceI, 00126 const label edgeI 00127 ) const; 00128 00129 //- Get index on face that hasn't been handled yet. 00130 void getStartEdge 00131 ( 00132 const indirectPrimitivePatch& pp, 00133 const boolList& doneEdge, 00134 const label patchFaceI, 00135 label& startFp, 00136 label& nbrFaceI 00137 ) const; 00138 00139 //- Add face between layer-1 and layer. 00140 label addSideFace 00141 ( 00142 const indirectPrimitivePatch&, 00143 const labelList& patchID, 00144 const labelListList& addedCells, 00145 const face& newFace, 00146 const label ownFaceI, 00147 const label nbrFaceI, 00148 const label patchEdgeI, 00149 const label layerI, 00150 polyTopoChange& 00151 ) const; 00152 00153 00154 //- Disallow default bitwise copy construct 00155 addPatchCellLayer(const addPatchCellLayer&); 00156 00157 //- Disallow default bitwise assignment 00158 void operator=(const addPatchCellLayer&); 00159 00160 00161 public: 00162 00163 //- Runtime type information 00164 ClassName("addPatchCellLayer"); 00165 00166 00167 // Constructors 00168 00169 //- Construct from mesh. 00170 addPatchCellLayer(const polyMesh& mesh); 00171 00172 00173 // Member Functions 00174 00175 00176 // Access 00177 00178 //- Added points per patch point. 00179 const labelListList& addedPoints() const 00180 { 00181 return addedPoints_; 00182 } 00183 00184 //- Layer faces per patch face. See above. 00185 const labelListList& layerFaces() const 00186 { 00187 return layerFaces_; 00188 } 00189 00190 //- Helper: get added cells per patch face. 00191 // addedCells[patchFace] is list of cells added. Last element is 00192 // the top cells (i.e. the boundary cell) 00193 static labelListList addedCells 00194 ( 00195 const polyMesh&, 00196 const labelListList& layerFaces 00197 ); 00198 00199 //- added cells given current mesh & layerfaces. 00200 labelListList addedCells() const; 00201 00202 00203 // Edit 00204 00205 //- Play commands into polyTopoChange to create layers on top 00206 // of indirectPrimitivePatch (have to be outside faces). 00207 // Gets displacement per patch point. 00208 // - nLayers : number of layers 00209 // - firstDisplacement : displacement per point for first 00210 // layer of points. If zero do not add point. 00211 // Layer thicknesses are calculated to constant geometric 00212 // expansion. Use expansionRatio for constant size. 00213 // Sets addedPoints_ which is per pp point a list of points 00214 // added. 00215 // Note: firstDisplacement has to be parallel synchronised before 00216 // calling this routine. Only if all procs sharing a point 00217 // get a cell should firstDisplacement be <> 0 00218 void setRefinement 00219 ( 00220 const scalar expansionRatio, 00221 const indirectPrimitivePatch& pp, 00222 const labelList& nLayers, 00223 const vectorField& firstDisplacement, 00224 polyTopoChange& 00225 ); 00226 00227 //- Add with constant expansion ratio 00228 void setRefinement 00229 ( 00230 const label nLayers, 00231 const indirectPrimitivePatch& pp, 00232 const vectorField& overallDisplacement, 00233 polyTopoChange& meshMod 00234 ) 00235 { 00236 setRefinement 00237 ( 00238 1.0, // expansion ration 00239 pp, 00240 labelList(pp.nPoints(), nLayers), 00241 overallDisplacement / nLayers, 00242 meshMod 00243 ); 00244 } 00245 00246 00247 //- Update any locally stored mesh information. Gets additional 00248 // map from new to old patch (since patch needs to be 00249 // recreated since has to be on outside). 00250 void updateMesh 00251 ( 00252 const mapPolyMesh&, 00253 const labelList& faceMap, // new to old patch faces 00254 const labelList& pointMap // new to old patch points 00255 ); 00256 }; 00257 00258 00259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00260 00261 } // End namespace Foam 00262 00263 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00264 00265 #endif 00266 00267 // ************************************************************************* // |