![]() |
|
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 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 //- Add a layer of cells 00113 void addCellLayer(polyTopoChange&) const; 00114 00115 //- Remove a layer of cells 00116 void removeCellLayer(polyTopoChange&) const; 00117 00118 //- Clear addressing 00119 void clearAddressing() const; 00120 00121 // Helpers 00122 00123 //- Optionally read old thickness 00124 static scalar readOldThickness(const dictionary&); 00125 00126 00127 // Static data members 00128 00129 //- Thickness insertion fraction for the pre-motion 00130 static const scalar addDelta_; 00131 00132 //- Thickness removal fraction for the cell collapse 00133 // Note: the cell will be collapsed to this relative 00134 // thickness before the layer is removed. 00135 static const scalar removeDelta_; 00136 00137 public: 00138 00139 //- Runtime type information 00140 TypeName("layerAdditionRemoval"); 00141 00142 00143 // Constructors 00144 00145 //- Construct from components 00146 layerAdditionRemoval 00147 ( 00148 const word& name, 00149 const label index, 00150 const polyTopoChanger& mme, 00151 const word& zoneName, 00152 const scalar minThickness, 00153 const scalar maxThickness 00154 ); 00155 00156 //- Construct from dictionary 00157 layerAdditionRemoval 00158 ( 00159 const word& name, 00160 const dictionary& dict, 00161 const label index, 00162 const polyTopoChanger& mme 00163 ); 00164 00165 00166 // Destructor 00167 00168 virtual ~layerAdditionRemoval(); 00169 00170 00171 // Member Functions 00172 00173 //- Check for topology change 00174 virtual bool changeTopology() const; 00175 00176 //- Insert the layer addition/removal instructions 00177 // into the topological change 00178 virtual void setRefinement(polyTopoChange&) const; 00179 00180 //- Modify motion points to comply with the topological change 00181 virtual void modifyMotionPoints(pointField& motionPoints) const; 00182 00183 //- Force recalculation of locally stored data on topological change 00184 virtual void updateMesh(const mapPolyMesh&); 00185 00186 00187 // Edit 00188 00189 //- Return min layer thickness which triggers removal 00190 scalar minLayerThickness() const 00191 { 00192 return minLayerThickness_; 00193 } 00194 00195 //- Set min layer thickness which triggers removal 00196 void setMinLayerThickness(const scalar t) const; 00197 00198 //- Return max layer thickness which triggers removal 00199 scalar maxLayerThickness() const 00200 { 00201 return maxLayerThickness_; 00202 } 00203 00204 //- Set max layer thickness which triggers removal 00205 void setMaxLayerThickness(const scalar t) const; 00206 00207 00208 //- Write 00209 virtual void write(Ostream&) const; 00210 00211 //- Write dictionary 00212 virtual void writeDict(Ostream&) const; 00213 }; 00214 00215 00216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00217 00218 } // End namespace Foam 00219 00220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00221 00222 #endif 00223 00224 // ************************************************************************* //