Skip to content

Commit

Permalink
keep AuxiliaryComplexBlock coefficients consistent with appctx
Browse files Browse the repository at this point in the history
  • Loading branch information
JHopeCollins committed Apr 22, 2024
1 parent 53e3799 commit 3f2aab2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
15 changes: 8 additions & 7 deletions asQ/preconditioners/auxiliary_blockpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,16 @@ def form(self, pc, v, u):
d1 = self.appctx['d1']
d2 = self.appctx['d2']

# PETScScalar is real so we can't get a complex number directly from options
d1r = self.options.getReal('d1r', default=d1.real)
d1i = self.options.getReal('d1i', default=d1.imag)
if all(type(d) is cpx.ComplexConstant for d in (d1, d2)):
msg = f"d1 and d2 must be of type cpx.ComplexConstant not {type(d1)} and {type(d2)}"
raise ValueError(msg)

d2r = self.options.getReal('d2r', default=d2.real)
d2i = self.options.getReal('d2i', default=d2.imag)
# PETScScalar is real so we can't get a complex number directly from options
d1.real.assign(self.options.getReal('d1r', default=d1.real))
d1.imag.assign(self.options.getReal('d1i', default=d1.imag))

d1 = complex(d1r, d1i)
d2 = complex(d2r, d2i)
d2.real.assign(self.options.getReal('d2r', default=d2.real))
d2.imag.assign(self.options.getReal('d2i', default=d2.imag))

# complex and real valued function spaces
W = v.function_space()
Expand Down
1 change: 0 additions & 1 deletion utils/hybridisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ def apply(self, pc, x, y):
def update(self, pc):
usubs = zip(self.uref.subfunctions, self.utr_ref.subfunctions[:-1])
self._mend_or_break(usubs)

self.solver.invalidate_jacobian()

def _process_context(self, pc):
Expand Down

0 comments on commit 3f2aab2

Please sign in to comment.