Skip to content

Cannot dot numpy array with MeshVariable #962

Open
@guyer

Description

@guyer
>>> import fipy as fp
>>> mesh = fp.Grid1D(nx=10)
>>> n = mesh.faceNormals
>>> a = fp.FaceVariable(mesh=mesh, rank=1)
>>> n.dot(a)
Traceback (most recent call last):
  Cell In[7], line 1
    n.dot(a)
ValueError: shapes (1,11) and (1,11) not aligned: 11 (dim 1) != 1 (dim 0)

This is because numpy is expecting dot() to operate between something of shape (1,11) and something of shape (11,1), producing a single scalar. FiPy, instead, is trying to produce a field of 11 scalars from two fields of 11 vectors.

Based on the writeup on Robin conditions, this used to work, but numpy has been active lately.

Note that

>>> a.dot(n)

works fine (although it has a separate issue (#961) with the representation of an indexed variable).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions