Thank you for replying. According to the documentation the dw_diffusion_coupling term represents the integral

\int_\Omega pK_j\nabla_j q,

with the summation convention. So it states that K is a vector, rather than a matrix. If this is wrong, which integral does the dw_diffusion_coupling term represent?

Thanks again,
Ben

On Tuesday, March 12, 2013 5:24:41 PM UTC, vladimir lukes wrote:
Hi Ben,

for an inhomogenous material the shape of the material parameter should
be (dim, dim), it corresponds to the permeability tensor K_ij.

'mat_diffusion_coupling': ({'f': np.eye(2)},),

or

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

will work.

Regards,

On 03/12/2013 04:40 PM, Ben Derrett wrote:
> Hello,
>
> 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
> <http://sfepy.org/doc-devel/src/sfepy/terms/termsLaplace.html#sfepy.terms.termsLaplace.DiffusionCoupling>.
> 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,
> Ben
>
> --
> You received this message because you are subscribed to the Google
> Groups "sfepy-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send