Skip to content
Snippets Groups Projects
Commit 232a11fa authored by MALOU THIBAULT's avatar MALOU THIBAULT
Browse files

update the solver of the adjoint model, move the former solver method to a...

update the solver of the adjoint model, move the former solver method to a more generic method given an adjoint derivative observation operator and specialize a solver for the classical adjoint model and one for the one-sensor adjoint model
parent 20d6d013
No related branches found
No related tags found
No related merge requests found
Pipeline #245752 passed
...@@ -309,7 +309,7 @@ class AdjointDiffusionConvectionReaction2DEquation: ...@@ -309,7 +309,7 @@ class AdjointDiffusionConvectionReaction2DEquation:
p_out = np.append(np.copy(p), p_out) # np.copy NECESSARY??? p_out = np.append(np.copy(p), p_out) # np.copy NECESSARY???
return p_out return p_out
def solver(self, cost, display_flag=True): def solver(self, cost, display_flag=True):
r""" r"""
Compute the adjoint state :math:`c^*(x,y,t)` by solving the adjoint model on the whole time window. Compute the adjoint state :math:`c^*(x,y,t)` by solving the adjoint model on the whole time window.
...@@ -337,7 +337,7 @@ class AdjointDiffusionConvectionReaction2DEquation: ...@@ -337,7 +337,7 @@ class AdjointDiffusionConvectionReaction2DEquation:
of the class :class:`~source_localization.control.Control`. of the class :class:`~source_localization.control.Control`.
""" """
return self.solver_given_adj_deriv_obs_op(cost.obs.adjoint_derivative_obs_operator, cost, display_flag=display_flag) return self.solver_given_adj_deriv_obs_op(cost.obs.adjoint_derivative_obs_operator, cost, display_flag=display_flag)
def onesensor_solver(self, cost, index_sensor, display_flag=True): def onesensor_solver(self, cost, index_sensor, display_flag=True):
r""" r"""
Compute the one-sensor adjoint state :math:`c^*(x,y,t)` by solving the adjoint model on the whole time window. Compute the one-sensor adjoint state :math:`c^*(x,y,t)` by solving the adjoint model on the whole time window.
...@@ -364,6 +364,8 @@ class AdjointDiffusionConvectionReaction2DEquation: ...@@ -364,6 +364,8 @@ class AdjointDiffusionConvectionReaction2DEquation:
to match the format of the attribute :attr:`~source_localization.control.Control.value` to match the format of the attribute :attr:`~source_localization.control.Control.value`
of the class :class:`~source_localization.control.Control`. of the class :class:`~source_localization.control.Control`.
""" """
def adj_der_obs_op(t, phi): def adj_der_obs_op(t, phi):
return cost.obs.onesensor_adjoint_derivative_obs_operator(t, phi, index_sensor) return cost.obs.onesensor_adjoint_derivative_obs_operator(t, phi, index_sensor)
return self.solver_given_adj_deriv_obs_op(adj_der_obs_op, cost, display_flag=display_flag) return self.solver_given_adj_deriv_obs_op(adj_der_obs_op, cost, display_flag=display_flag)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment