OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

slidingInterface.H

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