pyrtid.inverse.get_adjoint_sources_for_obs#
- pyrtid.inverse.get_adjoint_sources_for_obs(model: ForwardModel, obs: Observable, n_obs: int, max_obs_time: Optional[float] = None) ndarray[Any, dtype[float64]][source]#
Get the adjoint sources for a given observable instance.
The objective function with respect to the vector of observed state variables and control parameters \((\mathbf{d})\) is defined as:
\[\mathcal{J}(\mathbf{d}_{\mathrm{calc}}) = \dfrac{1}{2N} \sum_{n=0}^{N} \left(\dfrac{d_{\mathrm{obs}}^{t} - d_{\mathrm{calc}}^{t}}{\sigma_{\mathrm{obs}}^{t}} \right)^{2} = \dfrac{1}{2N} \sum_{n=0}^{N} \left(\dfrac{d_{\mathrm{obs}}^{t} - \left(\omega_{n}av(d_{\mathrm{calc}}^{n}) + \omega_{n+1}av(d_{\mathrm{calc}}^{n+1})\right)}{ \sigma_{\mathrm{obs}}^{t}} \right)^{2}\]with \(d_{\mathrm{obs}}^{t}\) an observation at a time \(t\) comprised between simulation iterations \(n\) and \(n+1\), \(N = \lvert \mathbf{d}_{\mathrm{obs}} \rvert\) the number of observation points, and \(\omega\) the weights for the linear interpolation of the calculated value which read:
\(\omega_{n} = 1 - \dfrac{t - t(n)}{t(n+1) - t(n)}\)
\(\omega_{n+1} = 1 - \dfrac{(t(n+1) - t)}{t(n+1) - t(n)}\)
And \(av\) a spatial averaging operator required if the observation is done on several grid cells. Consequently, the objective function depends both on \(d_{\mathrm{calc}}^{n}\) and \(d_{\mathrm{calc}}^{n+1}\), and the derivatives read:
\[\begin{split}\begin{eqnarray} \dfrac{\partial\mathcal{J}}{\partial d_{\mathrm{calc}}^{n}} & = & \dfrac{\partial}{\partial d_{\mathrm{calc}}^{n}} \left(\dfrac{1}{2 \lvert \mathbf{d}_{\mathrm{obs}} \rvert } \sum_{n=0}^{N} \left(\dfrac{d_{\mathrm{obs}}^{t} - \left(\omega_{n}av(d_{\mathrm{calc}}^{n}) + \omega_{n+1}av(d_{\mathrm{calc}}^{n+1})\right)}{ \sigma_{\mathrm{obs}}^{t}} \right)^{2}\right) \\ & = & - \dfrac{\omega_{n}}{N } \dfrac{\partial av(d_{\mathrm{calc}}^{n})}{\partial d_{\mathrm{calc}}^{n}} \dfrac{d_{\mathrm{obs}}^{t} - \left(\omega_{n}av(d_{\mathrm{calc}}^{n}) + \omega_{n+1}av(d_{\mathrm{calc}}^{n+1})\right)}{ \left(\sigma_{\mathrm{obs}}^{t}\right)^{2}} \end{eqnarray}\end{split}\]And
\[\dfrac{\partial\mathcal{J}}{\partial d_{\mathrm{calc}}^{n+1}} = - \dfrac{\omega_{n+1}}{N} \dfrac{\partial av(d_{\mathrm{calc}}^{n+1})}{\partial d_{\mathrm{calc}}^{n}} \dfrac{d_{\mathrm{obs}}^{t} - \left(\omega_{n}av(d_{\mathrm{calc}}^{n}) + \omega_{n+1}av(d_{\mathrm{calc}}^{n+1})\right)}{ \left(\sigma_{\mathrm{obs}}^{t}\right)^{2}}\]- Parameters
model (ForwardModel) – _description_
obs (Observable) – _description_
max_obs_time (Optional[float], optional) – Maximum time for which to consider an observation value, by default None.
n_obs (float) – The number of observation point to consider.
- Returns
The adjoint sources for the given Observable instance.
- Return type
NDArrayFloat