You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Figure (1): FFD-Box with fixed points (red) and allowed deformation direction indicated by arrows.
113
113
114
114
## 3. Mesh deformation test
@@ -242,38 +242,66 @@ $ SU2_DEF <config-file>.cfg
242
242
243
243
In this special case the deformed produces a bad mesh at the outlet, as the mesh is 'ripped apart' there. This happens because the FFD-Box only deforms what is prescribed in `DV_MARKER` and the remaining boundaries are considered 'clamped' in the volume mesh algorithm. All boundaries? No! The boundaries in `MARKER_SYM` are allowed to move along their symmetry plane in the volume mesher.This obviously requires the boundary to form a single plane which is the case for the present outlet. So, if the outlet is prescribed as a `MARKER_SYM` for the Volume deformation step the mesh deformation will yield a reasonable mesh.
Figure (3): Defining the `outlet` as `MARKER_SYM` results in a satisfactory deformed mesh.
250
250
251
251
## 4. Gradient Validation
252
252
253
-
The gradient validation script is executed via:
253
+
In the gradient validation the Discrete Adjoint gradient is compared against a Finite Difference gradient. The script `gradient_validation.py` is using FADO, so please make yourself familiar with the tutorials in that respective repository. But with the comments in the file and observing the output it is possible to reverse engineer many aspects.
254
+
255
+
Notable here is that, first, all deformed primal computations are done and the baseline at the very end. This is done as the discrete adjoint requires the solution of the baseline mesh, so that is done right before computing the discrete adjoint gradient.
256
+
The `MARKER_SYM`-trick that was introduced in the mesh-deformation section is also applied here and also in the `SU2_DOT_AD` step. This is required to stay consistent between the mesh deformation execution and the gradient projection.
257
+
258
+
The Objective Function used is `SURFACE_SPECIES_VARIANCE` and, as the name suggests, sums the local differences in the species mass fraction against the mean, and can therefore be used as a measure for uniform mixing. A Variance of zero would indicate perfect mixing.
254
259
260
+
The gradient validation script is executed via:
255
261
```
256
262
$ python gradient_validation.py
257
263
```
258
264
259
-
And to print the gradient comparison:
265
+
In order to postprocess the results a python script is added which compares both gradients and prints to screen and file:
260
266
```
261
-
262
267
$ python postprocess.py
263
268
```
264
269
265
-
**RESULTS screen output**
270
+
At a maximum of ~0.06% relative difference between the discrete adjoint and finite difference gradient,the agreement is excellent.
The setup of a shape optimization with FADO is rather straight forward once a working gradient validation script is available. It is usually a good idea to add lower and upper bounds to the design variables. In the case of FFD-Box points these values translate directly into the cartesian space and a first estimation can be made intuitively.
291
+
292
+
The second notable extension to the gradient validation is of course the optimization setup itself. Please follow the tutorials FADO provides to learn more about the capabilities and options. But, in the provided script some additional explanations are given and more details to certain function can be printed to screen by adding e.g. `printDocumentation(driver.setFailureMode)` to the script if more information for that option are required.
293
+
294
+
The used optimization method is [SLSQP](https://docs.scipy.org/doc/scipy/reference/optimize.minimize-slsqp.html) from the [SciPy](https://docs.scipy.org/doc/scipy/index.html) library.
270
295
296
+
The unconstrained optimization with the objective function of `SURFACE_SPECIES_VARIANCE` (as in the gradient validation introduced) is started with the following command:
271
297
```
272
298
$ python optimization.py
273
299
```
274
300
275
-
**OF history**
301
+
In order to compute the gradient norms of each iteration a `gradient_norm.py` script was added.
276
302
277
-
**initial vs final desing and FFD box**
303
+

304
+
Figure (4): Objective Function value and Gradient Norm over optimizer iterations. Capped after 12 iterations.
0 commit comments