1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Foam::layerAdditionRemoval
29 Cell layer addition mesh modifier
32 layerAdditionRemoval.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef layerAdditionRemoval_H
39 #define layerAdditionRemoval_H
41 #include "polyMeshModifier.H"
42 #include "primitiveFacePatch.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 /*---------------------------------------------------------------------------*\
51 Class layerAdditionRemoval Declaration
52 \*---------------------------------------------------------------------------*/
54 class layerAdditionRemoval
56 public polyMeshModifier
60 //- Master face zone ID
61 faceZoneID faceZoneID_;
63 //- Min thickness of extrusion layer. Triggers layer removal
64 mutable scalar minLayerThickness_;
66 //- Max thickness of extrusion layer. Triggers layer addition
67 mutable scalar maxLayerThickness_;
69 //- Layer thickness from previous step
70 // Used to decide whether to add or remove layers
71 mutable scalar oldLayerThickness_;
74 mutable labelList* pointsPairingPtr_;
77 mutable labelList* facesPairingPtr_;
79 //- Layer removal trigger time index
80 mutable label triggerRemoval_;
82 //- Layer addition trigger time index
83 mutable label triggerAddition_;
86 // Private Member Functions
88 //- Disallow default bitwise copy construct
89 layerAdditionRemoval(const layerAdditionRemoval&);
91 //- Disallow default bitwise assignment
92 void operator=(const layerAdditionRemoval&);
94 //- Check validity of construction data
95 void checkDefinition();
98 // Topological changes
100 //- Check for valid layer
101 bool validCollapse() const;
103 //- Set layer pairing. Return true if a valid layer exists
104 bool setLayerPairing() const;
106 //- Return points pairing in a layer (not automatic!)
107 const labelList& pointsPairing() const;
109 //- Return faces pairing in a layer (not automatic!)
110 const labelList& facesPairing() const;
112 //- Calculate the offset to the next layer
113 tmp<vectorField> extrusionDir() const;
115 //- Add a layer of cells
116 void addCellLayer(polyTopoChange&) const;
118 //- Remove a layer of cells
119 void removeCellLayer(polyTopoChange&) const;
122 void clearAddressing() const;
126 //- Optionally read old thickness
127 static scalar readOldThickness(const dictionary&);
130 // Static data members
132 //- Thickness insertion fraction for the pre-motion
133 static const scalar addDelta_;
135 //- Thickness removal fraction for the cell collapse
136 // Note: the cell will be collapsed to this relative
137 // thickness before the layer is removed.
138 static const scalar removeDelta_;
142 //- Runtime type information
143 TypeName("layerAdditionRemoval");
148 //- Construct from components
153 const polyTopoChanger& mme,
154 const word& zoneName,
155 const scalar minThickness,
156 const scalar maxThickness
159 //- Construct from dictionary
163 const dictionary& dict,
165 const polyTopoChanger& mme
171 virtual ~layerAdditionRemoval();
176 //- Check for topology change
177 virtual bool changeTopology() const;
179 //- Insert the layer addition/removal instructions
180 // into the topological change
181 virtual void setRefinement(polyTopoChange&) const;
183 //- Modify motion points to comply with the topological change
184 virtual void modifyMotionPoints(pointField& motionPoints) const;
186 //- Force recalculation of locally stored data on topological change
187 virtual void updateMesh(const mapPolyMesh&);
192 //- Return min layer thickness which triggers removal
193 scalar minLayerThickness() const
195 return minLayerThickness_;
198 //- Set min layer thickness which triggers removal
199 void setMinLayerThickness(const scalar t) const;
201 //- Return max layer thickness which triggers removal
202 scalar maxLayerThickness() const
204 return maxLayerThickness_;
207 //- Set max layer thickness which triggers removal
208 void setMaxLayerThickness(const scalar t) const;
212 virtual void write(Ostream&) const;
215 virtual void writeDict(Ostream&) const;
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 } // End namespace Foam
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 // ************************************************************************* //