FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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