Path: blob/devel/elmerice/Solvers/Documentation/Adjoint_GradientValidation.md
3206 views
Adjoint GradientValidation
Module name: Adjoint_GradientValidation Module subroutines: Adjoint_GradientValidation Module authors: Fabien Gillet-Chaulet (IGE-Grenoble) Document authors: Fabien Gillet-Chaulet Document edited: 25.04.2020
Introduction
This solver is an utility to check the accuracy of the gradients computed from the adjoint solvers.
We have tried to validate each solver independently; however as the model is continuously under development, and the Elmer configuration sometimes complex it might be interesting to check that your derivatives used for the minimisation are correct.
As the optimisation algorithm uses the gradient for the descent direction, a minimisation that get trapped in linear searches or can not decrease the value of the cost function might be the sign for inaccurate gradients.
We have done the maximum to derive the adjoints by differentiating crucial parts by hand, however the gradient maight still be not as accurate as possible, e.g. if the direct problem is non-linear. Also Elmer is continuously improving and allow for a lot of flexibility, so we can not exclude that some features, e.g. different element types, etc..., will not be supported. Please report if you encounter such problems.
Theory
This solver compare the derivatives computed with the adjoint codes with derivatives obtained by forward finite differences.
The Taylor expansion of the cost function for a small perturbation leads to
This solver then compares the totat derivative computed at a given state and for a given perturbation : with the forward finite difference equivalent: .
is computed at the first iteration, and is computed in the following iterations, starting with and decreasing by two for each successive iteration.
The relative error is computed as
If your set-up is correct, should tend to .
Well done!! you can replace the validation solver by the optimisation solver and find your best initial state
Keywords
Below is the sequence and related keywords in the .sif file:
First set your number of iterations in the simulation section:
Second, set-up your configuration file that computes the cost function and its derivative with respect to your optimisation variable
Finally, put the validation solver:
Tests and Examples
See examples for the Adjoint CostRegSolver