Skip to content

Commit

Permalink
Fix adjoint utils
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrubeck committed Dec 22, 2024
1 parent 337d087 commit ed34164
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions firedrake/adjoint_utils/blocks/solving.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,11 @@ def evaluate_adj_component(self, inputs, adj_inputs, block_variable, idx,
return dFdm

dFdm = -firedrake.derivative(F_form, c_rep, trial_function)
dFdm = firedrake.adjoint(dFdm)
dFdm = dFdm * adj_sol
if isinstance(dFdm, ufl.Form):
dFdm = firedrake.adjoint(dFdm)
dFdm = firedrake.action(dFdm, adj_sol)
else:
dFdm = dFdm(adj_sol)
dFdm = firedrake.assemble(dFdm, **self.assemble_kwargs)
return dFdm

Expand Down

0 comments on commit ed34164

Please sign in to comment.