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

layerAdditionRemoval.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::layerAdditionRemoval
00027 
00028 Description
00029     Cell layer addition mesh modifier
00030 
00031 SourceFiles
00032     layerAdditionRemoval.C
00033     addCellLayer.C
00034     removeCellLayer.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef layerAdditionRemoval_H
00039 #define layerAdditionRemoval_H
00040 
00041 #include "polyMeshModifier.H"
00042 #include "primitiveFacePatch.H"
00043 #include "ZoneIDs.H"
00044 
00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00046 
00047 namespace Foam
00048 {
00049 
00050 /*---------------------------------------------------------------------------*\
00051                      Class layerAdditionRemoval Declaration
00052 \*---------------------------------------------------------------------------*/
00053 
00054 class layerAdditionRemoval
00055 :
00056     public polyMeshModifier
00057 {
00058     // Private data
00059 
00060         //- Master face zone ID
00061         faceZoneID faceZoneID_;
00062 
00063         //- Min thickness of extrusion layer.  Triggers layer removal
00064         mutable scalar minLayerThickness_;
00065 
00066         //- Max thickness of extrusion layer.  Triggers layer addition
00067         mutable scalar maxLayerThickness_;
00068 
00069         //- Layer thickness from previous step
00070         //  Used to decide whether to add or remove layers
00071         mutable scalar oldLayerThickness_;
00072 
00073         //- Point pairing
00074         mutable labelList* pointsPairingPtr_;
00075 
00076         //- Face pairing
00077         mutable labelList* facesPairingPtr_;
00078 
00079         //- Layer removal trigger time index
00080         mutable label triggerRemoval_;
00081 
00082         //- Layer addition trigger  time index
00083         mutable label triggerAddition_;
00084 
00085 
00086     // Private Member Functions
00087 
00088         //- Disallow default bitwise copy construct
00089         layerAdditionRemoval(const layerAdditionRemoval&);
00090 
00091         //- Disallow default bitwise assignment
00092         void operator=(const layerAdditionRemoval&);
00093 
00094         //- Check validity of construction data
00095         void checkDefinition();
00096 
00097 
00098         // Topological changes
00099 
00100             //- Check for valid layer
00101             bool validCollapse() const;
00102 
00103             //- Set layer pairing.  Return true if a valid layer exists
00104             bool setLayerPairing() const;
00105 
00106             //- Return points pairing in a layer (not automatic!)
00107             const labelList& pointsPairing() const;
00108 
00109             //- Return faces pairing in a layer (not automatic!)
00110             const labelList& facesPairing() const;
00111 
00112             //- Calculate the offset to the next layer
00113             tmp<vectorField> extrusionDir() const;
00114 
00115             //- Add a layer of cells
00116             void addCellLayer(polyTopoChange&) const;
00117 
00118             //- Remove a layer of cells
00119             void removeCellLayer(polyTopoChange&) const;
00120 
00121             //- Clear addressing
00122             void clearAddressing() const;
00123 
00124         // Helpers
00125 
00126             //- Optionally read old thickness
00127             static scalar readOldThickness(const dictionary&);
00128 
00129 
00130     // Static data members
00131 
00132         //- Thickness insertion fraction for the pre-motion
00133         static const scalar addDelta_;
00134 
00135         //- Thickness removal fraction for the cell collapse
00136         //  Note: the cell will be collapsed to this relative
00137         //  thickness before the layer is removed.
00138         static const scalar removeDelta_;
00139 
00140 public:
00141 
00142     //- Runtime type information
00143     TypeName("layerAdditionRemoval");
00144 
00145 
00146     // Constructors
00147 
00148         //- Construct from components
00149         layerAdditionRemoval
00150         (
00151             const word& name,
00152             const label index,
00153             const polyTopoChanger& mme,
00154             const word& zoneName,
00155             const scalar minThickness,
00156             const scalar maxThickness
00157         );
00158 
00159         //- Construct from dictionary
00160         layerAdditionRemoval
00161         (
00162             const word& name,
00163             const dictionary& dict,
00164             const label index,
00165             const polyTopoChanger& mme
00166         );
00167 
00168 
00169     // Destructor
00170 
00171         virtual ~layerAdditionRemoval();
00172 
00173 
00174     // Member Functions
00175 
00176         //- Check for topology change
00177         virtual bool changeTopology() const;
00178 
00179         //- Insert the layer addition/removal instructions
00180         //  into the topological change
00181         virtual void setRefinement(polyTopoChange&) const;
00182 
00183         //- Modify motion points to comply with the topological change
00184         virtual void modifyMotionPoints(pointField& motionPoints) const;
00185 
00186         //- Force recalculation of locally stored data on topological change
00187         virtual void updateMesh(const mapPolyMesh&);
00188 
00189 
00190         // Edit
00191 
00192             //- Return min layer thickness which triggers removal
00193             scalar minLayerThickness() const
00194             {
00195                 return minLayerThickness_;
00196             }
00197 
00198             //- Set min layer thickness which triggers removal
00199            void setMinLayerThickness(const scalar t) const;
00200 
00201             //- Return max layer thickness which triggers removal
00202             scalar maxLayerThickness() const
00203             {
00204                 return maxLayerThickness_;
00205             }
00206 
00207             //- Set max layer thickness which triggers removal
00208            void setMaxLayerThickness(const scalar t) const;
00209 
00210 
00211         //- Write
00212         virtual void write(Ostream&) const;
00213 
00214         //- Write dictionary
00215         virtual void writeDict(Ostream&) const;
00216 };
00217 
00218 
00219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00220 
00221 } // End namespace Foam
00222 
00223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00224 
00225 #endif
00226 
00227 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd