![]() |
|
00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2005 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 slidingInterface 00027 00028 Description 00029 Sliding interface mesh modifier. Given two face zones, couple the 00030 master and slave side using a cutting procedure. The coupled 00031 faces are collected into the "coupled" zone and can become either 00032 internal or placed into a master and slave coupled zone. The 00033 remaining faces (uncovered master or slave) are placed into the 00034 master and slave patch. 00035 00036 The definition of the sliding interface can be either integral or partial. 00037 Integral interface implies that the slave side completely covers 00038 the master (i.e. no faces are uncovered); partial interface 00039 implies that the uncovered part of master/slave face zone should 00040 become boundary faces. 00041 00042 SourceFiles 00043 slidingInterface.C 00044 coupleSlidingInterface.C 00045 decoupleSlidingInterface.C 00046 slidingInterfaceProjectPoints.C 00047 slidingInterfaceAttachedAddressing.C 00048 slidingInterfaceClearCouple.C 00049 00050 \*---------------------------------------------------------------------------*/ 00051 00052 #ifndef slidingInterface_H 00053 #define slidingInterface_H 00054 00055 #include "polyMeshModifier.H" 00056 #include "primitiveFacePatch.H" 00057 #include "polyPatchID.H" 00058 #include "ZoneIDs.H" 00059 #include "intersection.H" 00060 #include "Pair.H" 00061 00062 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00063 00064 namespace Foam 00065 { 00066 00067 // Class forward declarations 00068 class objectHit; 00069 00070 /*---------------------------------------------------------------------------*\ 00071 Class slidingInterface Declaration 00072 \*---------------------------------------------------------------------------*/ 00073 00074 class slidingInterface 00075 : 00076 public polyMeshModifier 00077 { 00078 public: 00079 00080 // Public enumerations 00081 00082 //- Type of match 00083 enum typeOfMatch 00084 { 00085 INTEGRAL, 00086 PARTIAL 00087 }; 00088 00089 //- Direction names 00090 static const NamedEnum<typeOfMatch, 2> typeOfMatchNames_; 00091 00092 private: 00093 00094 // Private data 00095 00096 //- Master face zone ID 00097 faceZoneID masterFaceZoneID_; 00098 00099 //- Slave face zone ID 00100 faceZoneID slaveFaceZoneID_; 00101 00102 //- Cut point zone ID 00103 pointZoneID cutPointZoneID_; 00104 00105 //- Cut face zone ID 00106 faceZoneID cutFaceZoneID_; 00107 00108 //- Master patch ID 00109 polyPatchID masterPatchID_; 00110 00111 //- Slave patch ID 00112 polyPatchID slavePatchID_; 00113 00114 //- Type of match 00115 const typeOfMatch matchType_; 00116 00117 //- Couple-decouple operation. 00118 // If the interface is coupled, decouple it and vice versa. 00119 // Used in conjuction with automatic mesh motion 00120 mutable Switch coupleDecouple_; 00121 00122 //- State of the modifier 00123 mutable Switch attached_; 00124 00125 //- Point projection algorithm 00126 intersection::algorithm projectionAlgo_; 00127 00128 //- Trigger topological change 00129 mutable bool trigger_; 00130 00131 00132 // Private addressing data. 00133 00134 //- Cut face master face. Gives the index of face in master patch 00135 // the cut face has been created from. For a slave-only face 00136 // this will be -1 00137 mutable labelList* cutFaceMasterPtr_; 00138 00139 //- Cut face slave face. Gives the index of face in slave patch 00140 // the cut face has been created from. For a master-only face 00141 // this will be -1 00142 mutable labelList* cutFaceSlavePtr_; 00143 00144 //- Master zone faceCells 00145 mutable labelList* masterFaceCellsPtr_; 00146 00147 //- Slave zone faceCells 00148 mutable labelList* slaveFaceCellsPtr_; 00149 00150 //- Master stick-out faces 00151 mutable labelList* masterStickOutFacesPtr_; 00152 00153 //- Slave stick-out faces 00154 mutable labelList* slaveStickOutFacesPtr_; 00155 00156 //- Retired point mapping. 00157 // For every retired slave side point, gives the label of the 00158 // master point that replaces it 00159 mutable Map<label>* retiredPointMapPtr_; 00160 00161 //- Cut edge pairs 00162 // For cut points created by intersection two edges, 00163 // store the master-slave edge pair used in creation 00164 mutable Map<Pair<edge> >* cutPointEdgePairMapPtr_; 00165 00166 //- Slave point hit. The index of master point hit by the 00167 // slave point in projection. For no point hit, set to -1 00168 mutable labelList* slavePointPointHitsPtr_; 00169 00170 //- Slave edge hit. The index of master edge hit by the 00171 // slave point in projection. For point or no edge hit, set to -1 00172 mutable labelList* slavePointEdgeHitsPtr_; 00173 00174 //- Slave face hit. The index of master face hit by the 00175 // slave point in projection. 00176 mutable List<objectHit>* slavePointFaceHitsPtr_; 00177 00178 //- Master point edge hit. The index of slave edge hit by 00179 // a master point. For no hit set to -1 00180 mutable labelList* masterPointEdgeHitsPtr_; 00181 00182 //- Projected slave points 00183 mutable pointField* projectedSlavePointsPtr_; 00184 00185 00186 // Private Member Functions 00187 00188 //- Disallow default bitwise copy construct 00189 slidingInterface(const slidingInterface&); 00190 00191 //- Disallow default bitwise assignment 00192 void operator=(const slidingInterface&); 00193 00194 //- Clear out 00195 void clearOut() const; 00196 00197 00198 //- Check validity of construction data 00199 void checkDefinition(); 00200 00201 //- Calculate attached addressing 00202 void calcAttachedAddressing() const; 00203 00204 //- Calculate decoupled zone face-cell addressing 00205 void renumberAttachedAddressing(const mapPolyMesh&) const; 00206 00207 //- Clear attached addressing 00208 void clearAttachedAddressing() const; 00209 00210 00211 // Topological changes 00212 00213 //- Master faceCells 00214 const labelList& masterFaceCells() const; 00215 00216 //- Slave faceCells 00217 const labelList& slaveFaceCells() const; 00218 00219 //- Master stick-out faces 00220 const labelList& masterStickOutFaces() const; 00221 00222 //- Slave stick-out faces 00223 const labelList& slaveStickOutFaces() const; 00224 00225 //- Retired point map 00226 const Map<label>& retiredPointMap() const; 00227 00228 //- Cut point edge pair map 00229 const Map<Pair<edge> >& cutPointEdgePairMap() const; 00230 00231 //- Clear addressing 00232 void clearAddressing() const; 00233 00234 //- Project slave points and compare with the current projection. 00235 // If the projection has changed, the sliding interface 00236 // changes topologically 00237 bool projectPoints() const; 00238 00239 //- Couple sliding interface 00240 void coupleInterface(polyTopoChange& ref) const; 00241 00242 //- Clear projection 00243 void clearPointProjection() const; 00244 00245 //- Clear old couple 00246 void clearCouple(polyTopoChange& ref) const; 00247 00248 //- Decouple interface (returns it to decoupled state) 00249 // Note: this should not be used in normal operation of the 00250 // sliding mesh, but only to return the mesh to its 00251 // original state 00252 void decoupleInterface(polyTopoChange& ref) const; 00253 00254 00255 // Static data members 00256 00257 //- Point merge tolerance 00258 static const scalar pointMergeTol_; 00259 00260 //- Edge merge tolerance 00261 static const scalar edgeMergeTol_; 00262 00263 //- Estimated number of faces an edge goes through 00264 static const label nFacesPerSlaveEdge_; 00265 00266 //- Edge-face interaction escape limit 00267 static const label edgeFaceEscapeLimit_; 00268 00269 //- Integral match point adjustment tolerance 00270 static const scalar integralAdjTol_; 00271 00272 //- Edge intersection master catch fraction 00273 static const scalar edgeMasterCatchFraction_; 00274 00275 //- Edge intersection co-planar tolerance 00276 static const scalar edgeCoPlanarTol_; 00277 00278 //- Edge end cut-off tolerance 00279 static const scalar edgeEndCutoffTol_; 00280 00281 00282 public: 00283 00284 //- Runtime type information 00285 TypeName("slidingInterface"); 00286 00287 00288 // Constructors 00289 00290 //- Construct from components 00291 slidingInterface 00292 ( 00293 const word& name, 00294 const label index, 00295 const polyTopoChanger& mme, 00296 const word& masterFaceZoneName, 00297 const word& slaveFaceZoneName, 00298 const word& cutPointZoneName, 00299 const word& cutFaceZoneName, 00300 const word& masterPatchName, 00301 const word& slavePatchName, 00302 const typeOfMatch tom, 00303 const bool coupleDecouple = false, 00304 const intersection::algorithm algo = intersection::VISIBLE 00305 ); 00306 00307 //- Construct from dictionary 00308 slidingInterface 00309 ( 00310 const word& name, 00311 const dictionary& dict, 00312 const label index, 00313 const polyTopoChanger& mme 00314 ); 00315 00316 00317 // Destructor 00318 00319 virtual ~slidingInterface(); 00320 00321 00322 // Member Functions 00323 00324 //- Return master face zone ID 00325 const faceZoneID& masterFaceZoneID() const; 00326 00327 //- Return slave face zone ID 00328 const faceZoneID& slaveFaceZoneID() const; 00329 00330 //- Return true if attached 00331 bool attached() const 00332 { 00333 return attached_; 00334 } 00335 00336 //- Check for topology change 00337 virtual bool changeTopology() const; 00338 00339 //- Insert the layer addition/removal instructions 00340 // into the topological change 00341 virtual void setRefinement(polyTopoChange&) const; 00342 00343 //- Modify motion points to comply with the topological change 00344 virtual void modifyMotionPoints(pointField& motionPoints) const; 00345 00346 //- Force recalculation of locally stored data on topological change 00347 virtual void updateMesh(const mapPolyMesh&); 00348 00349 //- Return projected points for a slave patch 00350 const pointField& pointProjection() const; 00351 00352 00353 //- Write 00354 virtual void write(Ostream&) const; 00355 00356 //- Write dictionary 00357 virtual void writeDict(Ostream&) const; 00358 }; 00359 00360 00361 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00362 00363 } // End namespace Foam 00364 00365 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00366 00367 #endif 00368 00369 // ************************************************************************* //