Hello all,
with BEMpp 0.3.1, when trying the snippets of figures 9 (preconditioned EFIE) and 13 (MFIE) extract from the 2017 amazing paper Redirecting.
import numpy as np
import bempp.api
from bempp.api.operators.boundary import maxwell
from bempp.api.operators.boundary import sparse
k=2
grid=bempp.api.shapes.cube(h=0.2)
def incident_field(x):
return np.array([np.exp(1j*k*x[2]),0.*x[2],0.*x[2]])
@bempp.api.complex_callable
def tangential_trace(x,n,domain_index,result):
result[:]=np.cross(np.array([1.,0.,0.]),n)*np.exp(1j*k*x[2])
#multitrace=maxwell.multitrace_operator(grid,k) # Lead to error when calculating E1
multitrace=maxwell.multitrace_operator(grid,k,space_type='all_rwg')
#identity=sparse.multitrace_identity(multitrace),spaces='maxwell') # doesn't work
identity=sparse.multitrace_identity(multitrace)
calderon=0.5*identity-multitrace
op=-calderon[0,0]
rhs=bempp.api.GridFunction(calderon.domain_spaces[0],fun=tangential_trace,dual_space=calderon.dual_to_range_spaces[0])
sol,info=bempp.api.linalg.gmres(op,rhs,use_strong_form=True)
we got error:
bempp:HOST:INFO: Created grid with id b3e09375-25df-4aa4-bc2d-82d2d4927082. Elements: 2400. Edges: 3600. Vertices: 1202
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[4], line 21
18 identity=sparse.multitrace_identity(multitrace)
19 calderon=0.5*identity-multitrace
---> 21 op=-calderon[0,0]
22 rhs=bempp.api.GridFunction(calderon.domain_spaces[0],fun=tangential_trace,dual_space=calderon.dual_to_range_spaces[0])
23 sol,info=bempp.api.linalg.gmres(op,rhs,use_strong_form=True)
TypeError: 'SumBlockedOperator' object is not subscriptable
Any idea?
Thanks in advance for help,
Gérard