Open
Description
Describe the bug
Point evaluation fails to get the expected answer when using an immersed sphere with certain function spaces:
from firedrake import *
import numpy as np
m = UnitIcosahedralSphereMesh(refinement_level=2, name='immersedsphere')
m.init_cell_orientations(SpatialCoordinate(m))
V = FunctionSpace(m, 'N1curl', 2) # also fails with N2curl
expr = 2 * SpatialCoordinate(m)
f = Function(V).interpolate(expr)
point = m.coordinates.dat.data_ro[0] # array([-0.52573111, 0.85065081, 0.0]) - definitely on the manifold!
f.at(point) # array([ 2.36328118e-01, 2.03143488e-01, -6.67673661e-16])
2*point # array([-1.05146222, 1.70130162, 0.0])
assert np.allclose(f.at(point), 2*point) # fails
I get the same result if I interpolate onto a vertex-only mesh (see #3068).
If I switch to N1div
or N2div
I get loopy.diagnostic.TypeInferenceFailure: name not known in type inference: cell_orientations
when using f.at(point)
.
With vertex-only mesh interpolation, I raise this runtime error
Line 2313 in 35f2b3c
when target mesh cell orientations are requested
firedrake/firedrake/interpolation.py
Line 960 in 35f2b3c
despite them being set in the script.
Expected behavior
Either the correct answer or a NotImplementedError
Error message
See above.
Environment:
- OS: MacOS
- Python version: 3.11.3
- Output of
firedrake-status
Firedrake Configuration:
package_manager: True
minimal_petsc: False
mpicc: None
mpicxx: None
mpif90: None
mpiexec: None
disable_ssh: False
honour_petsc_dir: False
with_parmetis: False
slepc: False
packages: []
honour_pythonpath: False
opencascade: False
tinyasm: False
torch: False
petsc_int_type: int32
cache_dir: /Users/rwh10/firedrake/.cache
complex: False
remove_build_files: False
with_blas: None
netgen: False
Additions:
None
Environment:
PYTHONPATH: None
PETSC_ARCH: None
PETSC_DIR: None
Status of components:
---------------------------------------------------------------------------
|Package |Branch |Revision |Modified |
---------------------------------------------------------------------------
|FInAT |master |47f6c37 |False |
|PyOP2 |master |8e4ad930 |False |
|fiat |master |8c66270 |False |
|firedrake |master |35f2b3cce |False |
|h5py |firedrake |6cc4c912 |False |
|libspatialindex |master |4768bf3 |True |
|libsupermesh |master |b145b65 |False |
|loopy |main |8158afdb |False |
|petsc |firedrake |9364cb008b|False |
|pyadjoint |master |42959ef |False |
|pytest-mpi |main |a478bc8 |False |
|tsfc |master |6f72c9c |False |
|ufl |master |55c281d7 |False |
---------------------------------------------------------------------------
- Output of
firedrake-status
for VertexOnlyMesh investigations:
Firedrake Configuration:
package_manager: True
minimal_petsc: False
mpicc: None
mpicxx: None
mpif90: None
mpiexec: None
disable_ssh: False
honour_petsc_dir: False
with_parmetis: False
slepc: False
packages: []
honour_pythonpath: False
opencascade: False
tinyasm: False
torch: False
petsc_int_type: int32
cache_dir: /Users/rwh10/firedrake/.cache
complex: False
remove_build_files: False
with_blas: None
netgen: False
Additions:
None
Environment:
PYTHONPATH: None
PETSC_ARCH: None
PETSC_DIR: None
Status of components:
---------------------------------------------------------------------------
|Package |Branch |Revision |Modified |
---------------------------------------------------------------------------
|FInAT |master |47f6c37 |False |
|PyOP2 |master |8e4ad930 |False |
|fiat |master |8c66270 |False |
|firedrake |ReubenHill/vom-immersed-manifold|455129ff2 |False |
|h5py |firedrake |6cc4c912 |False |
|libspatialindex |master |4768bf3 |True |
|libsupermesh |master |b145b65 |False |
|loopy |main |8158afdb |False |
|petsc |firedrake |9364cb008b|False |
|pyadjoint |master |42959ef |False |
|pytest-mpi |main |a478bc8 |False |
|tsfc |master |6f72c9c |False |
|ufl |master |55c281d7 |False |
---------------------------------------------------------------------------