FreeFOAM The Cross-Platform CFD Toolkit
smoothDelta.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::smoothDelta
26 
27 Description
28  Smoothed delta which takes a given simple geometric delta and applies
29  smoothing to it such that the ratio of deltas between two cells is no
30  larger than a specified amount, typically 1.15.
31 
32 SourceFiles
33  smoothDelta.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef smoothDelta_H
38 #define smoothDelta_H
39 
40 #include <LESdeltas/LESdelta.H>
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class smoothDelta Declaration
49 \*---------------------------------------------------------------------------*/
50 
52 :
53  public LESdelta
54 {
55  // Private data
56 
57  autoPtr<LESdelta> geometricDelta_;
58  scalar maxDeltaRatio_;
59 
60 
61  // Private Member Functions
62 
63  //- Disallow default bitwise copy construct and assignment
64  smoothDelta(const smoothDelta&);
65  void operator=(const smoothDelta&);
66 
67  // Calculate the delta values
68  void calcDelta();
69 
70  //- Private member class used by mesh-wave to propagate the delta-ratio
71  class deltaData
72  {
73  scalar delta_;
74 
75  // Private Member Functions
76 
77  //- Update. Gets information from neighbouring face/cell and
78  // uses this to update itself (if nessecary) and return true.
79  inline bool update
80  (
81  const deltaData& w2,
82  const scalar scale,
83  const scalar tol
84  );
85 
86 
87  public:
88 
89  // Static data members
90 
91  //- delta fraction
92  static scalar maxDeltaRatio;
93 
94 
95  // Constructors
96 
97  //- Construct null
98  inline deltaData();
99 
100  //- Construct from origin, yStar, distance
101  inline deltaData(const scalar delta);
102 
103 
104  // Member Functions
105 
106  // Access
107 
108  scalar delta() const
109  {
110  return delta_;
111  }
112 
113 
114  // Needed by FaceCellWave
115 
116  //- Check whether origin has been changed at all or
117  // still contains original (invalid) value.
118  inline bool valid() const;
119 
120  //- Check for identical geometrical data.
121  // Used for cyclics checking.
122  inline bool sameGeometry
123  (
124  const polyMesh&,
125  const deltaData&,
126  const scalar
127  ) const;
128 
129  //- Convert any absolute coordinates into relative to
130  // (patch)face centre
131  inline void leaveDomain
132  (
133  const polyMesh&,
134  const polyPatch&,
135  const label patchFaceI,
136  const point& faceCentre
137  );
138 
139  //- Reverse of leaveDomain
140  inline void enterDomain
141  (
142  const polyMesh&,
143  const polyPatch&,
144  const label patchFaceI,
145  const point& faceCentre
146  );
147 
148  //- Apply rotation matrix to any coordinates
149  inline void transform
150  (
151  const polyMesh&,
152  const tensor&
153  );
154 
155  //- Influence of neighbouring face.
156  inline bool updateCell
157  (
158  const polyMesh&,
159  const label thisCellI,
160  const label neighbourFaceI,
161  const deltaData& neighbourInfo,
162  const scalar tol
163  );
164 
165  //- Influence of neighbouring cell.
166  inline bool updateFace
167  (
168  const polyMesh&,
169  const label thisFaceI,
170  const label neighbourCellI,
171  const deltaData& neighbourInfo,
172  const scalar tol
173  );
174 
175  //- Influence of different value on same face.
176  inline bool updateFace
177  (
178  const polyMesh&,
179  const label thisFaceI,
180  const deltaData& neighbourInfo,
181  const scalar tol
182  );
183 
184  // Member Operators
185 
186  // Needed for List IO
187  inline bool operator==(const deltaData&) const;
188 
189  inline bool operator!=(const deltaData&) const;
190 
191  // IOstream Operators
192 
193  friend Ostream& operator<<
194  (
195  Ostream& os,
196  const deltaData& wDist
197  )
198  {
199  return os << wDist.delta_;
200  }
201 
202  friend Istream& operator>>(Istream& is, deltaData& wDist)
203  {
204  return is >> wDist.delta_;
205  }
206  };
207 
208 
209  void setChangedFaces
210  (
211  const polyMesh& mesh,
212  const volScalarField& delta,
213  DynamicList<label>& changedFaces,
214  DynamicList<deltaData>& changedFacesInfo
215  );
216 
217 
218 public:
219 
220  //- Runtime type information
221  TypeName("smooth");
222 
223 
224  // Constructors
225 
226  //- Construct from name, mesh and IOdictionary
228  (
229  const word& name,
230  const fvMesh& mesh,
231  const dictionary&
232  );
233 
234 
235  //- Destructor
236  virtual ~smoothDelta()
237  {}
238 
239 
240  // Member Functions
241 
242  //- Read the LESdelta dictionary
243  virtual void read(const dictionary&);
244 
245  // Correct values
246  virtual void correct();
247 };
248 
249 
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 
252 } // End namespace Foam
253 
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 
257 
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 
260 #endif
261 
262 // ************************ vim: set sw=4 sts=4 et: ************************ //