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

Possible fix for taking scalar derivatives of vector coefficients using coefficient derivative maps #124

Merged
merged 6 commits into from
Sep 12, 2023

Conversation

cianwilson
Copy link
Contributor

If the argument v is scalar then len(v.ufl_shape) = 0 and choosing the indices based on:

oi1 = oi[:-rv]
oi2 = oi[-rv:]

is not valid. Specifically v[oi2] will produce the error (see #123):

Component and shape length don't match.

This PR makes scalar v a special case so that the product can be evaluated as a tensor scalar product.

It also adds a unit test for this case, which fails with current main.

@mscroggs mscroggs merged commit 37ae353 into FEniCS:main Sep 12, 2023
7 checks passed
cianwilson added a commit to cianwilson/ufl that referenced this pull request Sep 26, 2023
…lar.

Also adding a test.

Merged into main in FEniCS#124.  Commits squashed for this patch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when using a coefficient derivative map of a vector coefficient w.r.t. a scalar
3 participants