Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot dot numpy array with MeshVariable #962

Open
guyer opened this issue Oct 3, 2023 · 0 comments
Open

Cannot dot numpy array with MeshVariable #962

guyer opened this issue Oct 3, 2023 · 0 comments

Comments

@guyer
Copy link
Member

guyer commented Oct 3, 2023

>>> 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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant