This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
optim:start [2019/06/17 17:39] helene |
optim:start [2022/03/25 11:48] (current) helene |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== OPTIM: Parameter optimization tool for Lagamine ====== | ====== OPTIM: Parameter optimization tool for Lagamine ====== | ||
+ | |||
+ | ---- | ||
+ | |||
===== Objective ===== | ===== Objective ===== | ||
- | This optimization program allows the identification of the values of parameters likely to minimize a function representing the difference between two curves. The program will take a reference curve as an input (an experimental curve for instance) and will attempt to approach this curve with the finite element code Lagamine using different parameters obtained through the **Levenberg-Marquardt** algorithm. \\ | + | This optimization program allows the identification of the values of parameters likely to minimize an objective function representing the difference between two curves. The program will take a reference curve as an input (an experimental curve for instance) and will attempt to approach this curve with the finite element code Lagamine using different parameters obtained through the **Levenberg-Marquardt** algorithm. A schematic representation of the algorithm is shown in <imgref image1>. \\ \\ |
+ | <imgcaption image1|Optim algorithm>{{ :optim:optim_gen1.png?600 |}}</imgcaption> \\ | ||
The optimization process is iterative and stops once a stop criterion is met, such as the stabilization of the objective function for instance. \\ | The optimization process is iterative and stops once a stop criterion is met, such as the stabilization of the objective function for instance. \\ | ||
The code gives the possibility to optimize a set of parameters using several curves for one simulation, or several simulations at a time. All the curves are then concatenated in one global curve for the computation of the objective function. | The code gives the possibility to optimize a set of parameters using several curves for one simulation, or several simulations at a time. All the curves are then concatenated in one global curve for the computation of the objective function. | ||
+ | |||
+ | ---- | ||
+ | |||
===== Description ===== | ===== Description ===== | ||
- | The objective function to be minimized by the algorith is the following: \\ | + | The objective function to be minimized by the algorithm is the following: \\ |
- | $S=\sqrt{\displaystyle\sum_{i=1}^{n_{total}} (u_i^{FE}-u_i^{REF})^2}$ \\ | + | \[S=\sqrt{\displaystyle\sum_{i=1}^{n_{total}} (u_i^{FE}-u_i^{REF})^2}\] |
Where: | Where: | ||
* $i$ represents one of the $n_{total}$ points of the global reference curve. If the global curve is constituted of several curves, $n_{total}$ is the sum of the $n$ points of each curve (each curve can have a different number of points). In Optim, the number of points $n$ to be used for each curve is defined by the user (NPOI) in the *.info file. Giving a larger NPOI to a curve gives it more weight in the objective function. | * $i$ represents one of the $n_{total}$ points of the global reference curve. If the global curve is constituted of several curves, $n_{total}$ is the sum of the $n$ points of each curve (each curve can have a different number of points). In Optim, the number of points $n$ to be used for each curve is defined by the user (NPOI) in the *.info file. Giving a larger NPOI to a curve gives it more weight in the objective function. | ||
Line 18: | Line 25: | ||
* $x_A=min(x_{end}^{EF},x_{end}^{REF})$ | * $x_A=min(x_{end}^{EF},x_{end}^{REF})$ | ||
- | The objective function is the square root of the sum of the squares of the residuals. The function must however be modified in the case where several curves of different orders of magnitude are used. The residual is then rewritten as: \\ $res_i=\left(\frac{u_i^{FE}-u_i^{REF}}{u_i^{REF}}\right)$ if $|u_i^{REF}|>tolerance$\\ | + | The objective function is the square root of the sum of the squares of the residuals. The function must however be modified in the case where several curves of different orders of magnitude are used. The residual is then rewritten as: \\ \[res_i=\left(\frac{u_i^{FE}-u_i^{REF}}{u_i^{REF}}\right) \text{ if }|u_i^{REF}|>tolerance\] |
- | $res_i=\left({u_i^{FE}-u_i^{REF}}\right)$ if $|u_i^{REF}|<tolerance$ | + | \[res_i=\left({u_i^{FE}-u_i^{REF}}\right) \text{ if }|u_i^{REF}|<tolerance\] |
In order to minimize the objective function, the program needs the derivatives of this function with respect to the parameters $P_j$: | In order to minimize the objective function, the program needs the derivatives of this function with respect to the parameters $P_j$: | ||
- | \\ $\frac{\partial S}{\partial P_j}=\frac{\partial S}{\partial u^{EF}}\frac{\partial u^{EF}}{\partial P_j}=\frac{1}{S(P)}{\displaystyle\sum_{i=1}^{n_{total}} res_i \frac{\partial u_i^{EF}}{\partial P_j}}$ \\ | + | \\ \[\frac{\partial S}{\partial P_j}=\frac{\partial S}{\partial u^{EF}}\frac{\partial u^{EF}}{\partial P_j}=\frac{1}{S(P)}{\displaystyle\sum_{i=1}^{n_{total}} res_i \frac{\partial u_i^{EF}}{\partial P_j}}\] \\ |
- | Therefore, the only unknowns are the $\frac{\partial u_i^{EF}}{\partial P_j}$ that must be computed by finite difference in the Lagamine code. | + | Therefore, the only unknowns are the $\frac{\partial u_i^{EF}}{\partial P_j}$ that must be computed by finite difference in the Lagamine code. To compute these derivatives, Lagamine performs simulations with perturbed values of each parameter $P_j$ to be optimized (see <imgref fig2>). |
+ | |||
+ | <imgcaption fig2|>{{ :optim:dudp.png?400 |}}</imgcaption> | ||
+ | |||
+ | The derivatives can then be estimated as: \\ | ||
+ | \[\frac{\partial u_i^{EF}}{\partial P_j}=\frac{u_i^{EF}(P_j^+)-u_i^{EF}(P_j^-)}{P_j^+-P_j^-}\] | ||
+ | With: | ||
+ | \[ \begin{cases} | ||
+ | P_J^+=(1+PREC_{IA})P_J \\ | ||
+ | P_J^-=(1-PREC_{IA})P_J | ||
+ | \end{cases}\] | ||
+ | $PREC_{IA}$ is an input value chosen by the user (see [[optim:files#*.ia file|*.ia file]]); the recommended value is $PREC_{IA}=0.001$. | ||