Dirichlet Boundary Conditions using NonlinearProblem

See the example here.

Specifically this change to your code:

    def F(self, b, x):
        assemble(self.L, tensor=b)
        for bc in bcs:
            bc.apply(b, x)

which will assemble the boundary conditions for the nonlinear problem rather than the linear problem.

1 Like