Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
ksagiyam committed Oct 29, 2024
1 parent f911b02 commit e58987f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 1 addition & 2 deletions firedrake/preconditioners/assembled.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 7 additions & 2 deletions firedrake/preconditioners/base.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion firedrake/solving_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion firedrake/variational_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check failure on line 111 in firedrake/variational_solver.py

View workflow job for this annotation

GitHub Actions / Run linter

E265

firedrake/variational_solver.py:111:9: E265 block comment should start with '# '
self.Jp_eq_J = Jp is None

# Argument checking
Expand Down

0 comments on commit e58987f

Please sign in to comment.