Skip to content

Commit 951ff9d

Browse files
committed
RieszMap boundary condition fixes
1 parent e55085b commit 951ff9d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

firedrake/cofunction.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,13 @@ def __init__(self, function_space_or_inner_product=None,
426426
sobolev_space, u, v
427427
)
428428

429+
if bcs is None:
430+
bcs = ()
431+
else:
432+
bcs = tuple(bcs)
433+
if len(bcs) > 0 and inner_product == "l2":
434+
raise ValueError("Cannot supply boundary conditions with an l2 Riesz map")
435+
429436
self._function_space = function_space
430437
self._inner_product = inner_product
431438
self._bcs = bcs
@@ -490,8 +497,13 @@ def __call__(self, value):
490497
for o, c in zip(output.subfunctions, value.subfunctions):
491498
o.dat.data[:] = c.dat.data_ro[:]
492499
else:
500+
if len(self._bcs) > 0:
501+
value = value.copy(deepcopy=True)
502+
for bc in self._bcs:
503+
bc.apply(value)
493504
output = firedrake.assemble(
494-
firedrake.action(self._inner_product, value)
505+
firedrake.action(self._inner_product, value),
506+
bcs=self._bcs, zero_bc_nodes=True,
495507
)
496508
else:
497509
raise ValueError(

0 commit comments

Comments
 (0)