jnick
2 October 2023 16:01
1
Dear Bempp-cl team,
when attempting to port my code to bempp-cl, I found that the “bempp.api.BlockedDiscreteOperator” functionality is not directly implemented in the new version.
Do you have a recommendation on how to implement custom block operators without this function?
Thank you very much in advance for your help.
Best,
Jörg
Elwin
6 October 2023 13:47
2
Hi Jörg,
The bempp-cl library has similar functionality as bempp v3 for blocked operators but with slightly different syntax.
If we have
grid = bempp.api.shapes.regular_sphere(1)
space = bempp.api.function_space(grid, "DP", 0)
sl_op = bempp.api.operators.boundary.laplace.single_layer(space, space, space)
sl_wf = sl_op.weak_form()
a continous operator sl_op
and a discrete operator sl_wf
one can form blocked operators in two ways.
First, one can assembly a continuous blocked operator as
block_op = bempp.api.BlockedOperator(2,2)
block_op[0,0] = sl_op
block_op[1,1] = sl_op
and then calculate its weak form as block_op.weak_form()
.
Second, one can assemble a discrete blocked operator as
block_wf = bempp.api.assembly.blocked_operator.BlockedDiscreteOperator([[sl_wf, sl_wf],[sl_wf, sl_wf]])
where you need to pass a list of lists with discrete operators.
Best,
Elwin
1 Like
jnick
17 October 2023 11:34
3
Thank you Elwin, this has fixed the problem.
Best,
Jörg