another question, do i have to do like this from your code?? Calculate sensitivity when the control is a fem function - #3 by dokken
class Problem():
def __init__(self, V, bcs, u_obs):
"""Initialize all variational forms for the given problem, for a given set of boundary conditions and observed u"""
# Residual of the variational form of Poisson problem
self.f = fem.Function(V) # The forcing f is the design variable
self.u = fem.Function(V)
R = inner(grad(self.u), grad(v))*dx - inner(self.f, v)*dx
because when i did this
self._A.mult(self._u1[i].vector, self._wrk_comp.vector)
it said
NameError: name 'self' is not defined