diff --git a/firedrake/preconditioners/assembled.py b/firedrake/preconditioners/assembled.py index 5d521300ea..4d9710867b 100644 --- a/firedrake/preconditioners/assembled.py +++ b/firedrake/preconditioners/assembled.py @@ -44,8 +44,7 @@ def initialize(self, pc): (a, bcs) = self.form(pc, test, trial) - bcs_Jp = tuple(bc.extract_form('Jp') for bc in bcs) - form_assembler = get_assembler(a, bcs=bcs_Jp, form_compiler_parameters=fcp, mat_type=mat_type, options_prefix=options_prefix) + form_assembler = get_assembler(a, bcs=bcs, form_compiler_parameters=fcp, mat_type=mat_type, options_prefix=options_prefix) self.P = form_assembler.allocate() self._assemble_P = form_assembler.assemble self._assemble_P(tensor=self.P) diff --git a/firedrake/preconditioners/base.py b/firedrake/preconditioners/base.py index e7b809024e..797b939f8d 100644 --- a/firedrake/preconditioners/base.py +++ b/firedrake/preconditioners/base.py @@ -1,5 +1,6 @@ import abc +from firedrake.bcs import EquationBC, EquationBCSplit from firedrake_citations import Citations from firedrake.petsc import PETSc from firedrake.dmhooks import get_appctx @@ -95,11 +96,11 @@ def form(self, obj, *args): if P.getType() == "python": ctx = P.getPythonContext() a = ctx.a - bcs = tuple(ctx.row_bcs) + bcs = tuple(ctx.bcs) else: ctx = get_appctx(pc.getDM()) a = ctx.Jp or ctx.J - bcs = tuple(ctx._problem.bcs) + bcs = tuple(bc.extract_form('Jp') for bc in ctx._problem.bcs) if len(args): a = a(*args) return a, bcs @@ -121,6 +122,10 @@ def new_snes_ctx(pc, op, bcs, mat_type, fcp=None, options_prefix=None): old_appctx = get_appctx(dm).appctx u = Function(op.arguments()[-1].function_space()) F = action(op, u) + bcs = tuple( + EquationBC(bc, bc, bc, is_linear=False, Jp_eq_J=True) if isinstance(bc, EquationBCSplit) else bc + for bc in bcs + ) nprob = NonlinearVariationalProblem(F, u, bcs=bcs, J=op, diff --git a/firedrake/solving_utils.py b/firedrake/solving_utils.py index a9dda71038..aabb2eef28 100644 --- a/firedrake/solving_utils.py +++ b/firedrake/solving_utils.py @@ -369,7 +369,7 @@ def split(self, fields): if isinstance(bc, DirichletBC): bc_temp = bc.reconstruct(field=field, V=V, g=bc.function_arg, sub_domain=bc.sub_domain) elif isinstance(bc, EquationBC): - bc_temp = bc.reconstruct(field, V, subu, u) + bc_temp = bc.reconstruct(V, subu, u, field) if bc_temp is not None: bcs.append(bc_temp) new_problem = NLVP(F, subu, bcs=bcs, J=J, Jp=Jp, diff --git a/firedrake/variational_solver.py b/firedrake/variational_solver.py index 609d599800..570e12aac7 100644 --- a/firedrake/variational_solver.py +++ b/firedrake/variational_solver.py @@ -108,7 +108,7 @@ def __init__(self, F, u, bcs=None, J=None, self.bcs = solving._extract_bcs(bcs) # Check form style consistency self.is_linear = is_linear - is_form_consistent(self.is_linear, self.bcs) + #is_form_consistent(self.is_linear, self.bcs) self.Jp_eq_J = Jp is None # Argument checking