advectionDiffusionPatchDistMethod.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2015-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::patchDistMethods::advectionDiffusion
28 
29 Description
30  Calculation of approximate distance to nearest patch for all cells and
31  boundary by solving the Eikonal equation in advection form with diffusion
32  smoothing.
33 
34  If the diffusion coefficient is set to 0 this method is exact in principle
35  but the numerical schemes used are not rendering the scheme approximate, but
36  more accurate than the Poisson method. Also many models relying on the
37  distance to the wall benefit from this field being smooth and monotonic so
38  the addition of diffusion smoothing improves both the convergence and
39  stability of the solution of the Eikonal equation and the behavior of the
40  models using the distance field generated. However, it is not clear what
41  the optimum value for the diffusion coefficient epsilon should be; a
42  default value of 0.1 is provided but higher values may be preferable under
43  some circumstances.
44 
45  Convergence is accelerated by first generating an approximate solution
46  using one of the simpler methods, e.g. Poisson. The method used for
47  this prediction step is specified in the 'advectionDiffusionCoeffs'
48  sub-dictionary, see below.
49 
50  References:
51  \verbatim
52  P.G. Tucker, C.L. Rumsey, R.E. Bartels, R.T. Biedron,
53  "Transport equation based wall distance computations aimed at flows
54  with time-dependent geometry",
55  NASA/TM-2003-212680, December 2003.
56  \endverbatim
57 
58  Example of the wallDist specification in fvSchemes:
59  \verbatim
60  laplacianSchemes
61  {
62  .
63  .
64  laplacian(yPsi) Gauss linear corrected;
65  laplacian(yWall) Gauss linear corrected;
66  .
67  .
68  }
69 
70  wallDist
71  {
72  method advectionDiffusion;
73 
74  // Optional entry enabling the calculation
75  // of the normal-to-wall field
76  nRequired false;
77 
78  advectionDiffusionCoeffs
79  {
80  method Poisson;
81  epsilon 0.1;
82  tolerance 1e-3;
83  maxIter 10;
84  }
85  }
86  \endverbatim
87  Also the solver specification for yWall is required in fvSolution, e.g.
88  for simple cases:
89  \verbatim
90  yPsi
91  {
92  solver PCG;
93  preconditioner DIC;
94  tolerance 1e-4;
95  relTol 0;
96  }
97 
98  yWall
99  {
100  solver PBiCG;
101  preconditioner DILU;
102  tolerance 1e-4;
103  relTol 0;
104  }
105 
106  relaxationFactors
107  {
108  equations
109  {
110  .
111  .
112  yWall 1;
113  .
114  .
115  }
116  }
117 
118  or for more complex cases:
119 
120  yPsi
121  {
122  solver GAMG;
123  smoother GaussSeidel;
124  cacheAgglomeration true;
125  nCellsInCoarsestLevel 10;
126  agglomerator faceAreaPair;
127  mergeLevels 1;
128  tolerance 1e-4;
129  relTol 0;
130  }
131 
132  yWall
133  {
134  solver GAMG;
135  smoother symGaussSeidel;
136  cacheAgglomeration true;
137  nCellsInCoarsestLevel 10;
138  agglomerator faceAreaPair;
139  mergeLevels 1;
140  tolerance 1e-4;
141  relTol 0;
142  }
143 
144  relaxationFactors
145  {
146  equations
147  {
148  .
149  .
150  yWall 0.7;
151  .
152  .
153  }
154  }
155  \endverbatim
156 
157 See also
158  Foam::patchDistMethod::Poisson
159  Foam::patchDistMethod::meshWave
160  Foam::wallDist
161 
162 SourceFiles
163  advectionDiffusionPatchDistMethod.C
164 
165 \*---------------------------------------------------------------------------*/
166 
167 #ifndef advectionDiffusionPatchDistMethod_H
168 #define advectionDiffusionPatchDistMethod_H
169 
170 #include "patchDistMethod.H"
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 namespace Foam
175 {
176 namespace patchDistMethods
177 {
178 
179 /*---------------------------------------------------------------------------*\
180  Class advectionDiffusion Declaration
181 \*---------------------------------------------------------------------------*/
182 
183 class advectionDiffusion
184 :
185  public patchDistMethod
186 {
187  // Private Member Data
188 
189  //- Sub-dictionary of coefficients
190  dictionary coeffs_;
191 
192  //- Run-time selected method to predict the distance-to-wall field
193  autoPtr<patchDistMethod> pdmPredictor_;
194 
195  //- Diffusion coefficient multiplying y*laplacian(y)
196  scalar epsilon_;
197 
198  //- Convergence tolerance for the iterations of the advection-diffusion
199  // equation to correct the distance-to-patch and normal-to-patch fields
200  scalar tolerance_;
201 
202  //- Maximum number of iterations of the advection-diffusion equation
203  // to correct the distance-to-patch and normal-to-patch fields
204  int maxIter_;
205 
206  //- Flag to indicate the predictor step has been executed
207  bool predicted_;
208 
209 
210  // Private Member Functions
211 
212  //- No copy construct
213  advectionDiffusion(const advectionDiffusion&) = delete;
214 
215  //- No copy assignment
216  void operator=(const advectionDiffusion&) = delete;
217 
218 
219 public:
220 
221  //- Runtime type information
222  TypeName("advectionDiffusion");
223 
224 
225  // Constructors
226 
227  //- Construct from coefficients dictionary, mesh
228  // and fixed-value patch set
230  (
231  const dictionary& dict,
232  const fvMesh& mesh,
233  const labelHashSet& patchIDs
234  );
235 
236 
237  // Member Functions
238 
239  //- Correct the given distance-to-patch field
240  virtual bool correct(volScalarField& y);
241 
242  //- Correct the given distance-to-patch and normal-to-patch fields
243  virtual bool correct(volScalarField& y, volVectorField& n);
244 };
245 
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 } // End namespace patchDistMethods
250 } // End namespace Foam
251 
252 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 
254 #endif
255 
256 // ************************************************************************* //
Foam::patchDistMethods::advectionDiffusion
Calculation of approximate distance to nearest patch for all cells and boundary by solving the Eikona...
Definition: advectionDiffusionPatchDistMethod.H:182
Foam::HashSet< label, Hash< label > >
patchDistMethod.H
Foam::patchDistMethods::advectionDiffusion::correct
virtual bool correct(volScalarField &y)
Correct the given distance-to-patch field.
Definition: advectionDiffusionPatchDistMethod.C:84
n
label n
Definition: TABSMDCalcMethod2.H:31
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::patchDistMethods::advectionDiffusion::TypeName
TypeName("advectionDiffusion")
Runtime type information.
Foam::patchDistMethod
Specialisation of patchDist for wall distance calculation.
Definition: patchDistMethod.H:59
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::patchDistMethod::patchIDs
const labelHashSet & patchIDs() const
Return the patchIDs.
Definition: patchDistMethod.H:143
y
scalar y
Definition: LISASMDCalcMethod1.H:14