I've been using SfePy for about a week - it's a great piece of work.

I'm working on a 2D problem involving a dw_diffusion_coupling term. For a homogenous material everything works as expected using the material definition

'mat_diffusion_coupling': ({'f': np.array([[0], [0]])},),

For an inhomogenous material, since the shape of this local parameter is (2, 1), I defined a function which takes the array of coordinates - coors - and returns an array of shape (coors.shape[0], 2, 1) like so

def diffusion_coupling_coefficient(ts, coors, mode=None, **kwargs):
    return {'f': np.zeros((coors.shape[0], 2, 1))}

This gives the error

  File ".../sfepy/terms/termsLaplace.py", line 199, in dw_fun
    status = terms.mulATB_integrate(out, vg.bfg, mat * val, vg)
ValueError: operands could not be broadcast together with shapes (5151,2,1) (5000,8,1,1)

, so I expect I'm doing something silly! How do I get this to work?

(I've attached a minimal version of the code giving the error.)

Many thanks,