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

Interpolation into Quadrature (non-basix) element #1546

Closed
michalhabera opened this issue May 17, 2021 · 4 comments · Fixed by #2878
Closed

Interpolation into Quadrature (non-basix) element #1546

michalhabera opened this issue May 17, 2021 · 4 comments · Fixed by #2878
Labels
enhancement New feature or request

Comments

@michalhabera
Copy link
Contributor

Elements which are not registered in basix, but still interpolatory, could prepare interpolation points and interpolation matrix during element construction in FiniteElement.cpp.
For Quadrature element this requires quadrature scheme provided from FFCx generated code, or better, a "variant".

@garth-wells
Copy link
Member

@michalhabera , @mscroggs is this still an issue with all the recent changes?

@jorgensd
Copy link
Sponsor Member

Still an issue:

import dolfinx
import basix.ufl
from mpi4py import MPI

def f(x):
    return x[0]

mesh = dolfinx.mesh.create_unit_square(MPI.COMM_WORLD, 10, 10)
el = basix.ufl.quadrature_element(mesh.topology.cell_name(), value_shape=(),scheme="default", degree=1)
V = dolfinx.fem.functionspace(mesh, el)
u = dolfinx.fem.Function(V)
u.interpolate(f)

returns

root@dokken-XPS-9320:~/shared# python3 mwe.py 
Traceback (most recent call last):
  File "/usr/local/dolfinx-real/lib/python3.10/dist-packages/dolfinx/fem/function.py", line 396, in interpolate
    _interpolate(u, cells)
  File "/usr/lib/python3.10/functools.py", line 889, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
  File "/usr/local/dolfinx-real/lib/python3.10/dist-packages/dolfinx/fem/function.py", line 372, in _interpolate
    self._cpp_object.interpolate(u, cells, nmm_interpolation_data)
TypeError: interpolate(): incompatible function arguments. The following argument types are supported:
    1. (self: dolfinx.cpp.fem.Function_float64, f: numpy.ndarray[numpy.float64], cells: numpy.ndarray[numpy.int32]) -> None
    2. (self: dolfinx.cpp.fem.Function_float64, u: dolfinx.cpp.fem.Function_float64, cells: numpy.ndarray[numpy.int32], nmm_interpolation_data: Tuple[List[int], List[int], List[float], List[int]]) -> None
    3. (self: dolfinx.cpp.fem.Function_float64, expr: dolfinx::fem::Expression<double, double>, cells: numpy.ndarray[numpy.int32]) -> None

Invoked with: <dolfinx.cpp.fem.Function_float64 object at 0x7fce44b32030>, <function f at 0x7fce523c3d90>, array([  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,
        13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,
        26,  27,  28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,
        39,  40,  41,  42,  43,  44,  45,  46,  47,  48,  49,  50,  51,
        52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,  64,
        65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,
        78,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,
        91,  92,  93,  94,  95,  96,  97,  98,  99, 100, 101, 102, 103,
       104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
       117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
       130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
       143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155,
       156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168,
       169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181,
       182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
       195, 196, 197, 198, 199], dtype=int32), ((), (), (), ())

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/shared/mwe.py", line 12, in <module>
    u.interpolate(f)
  File "/usr/local/dolfinx-real/lib/python3.10/dist-packages/dolfinx/fem/function.py", line 400, in interpolate
    x = _cpp.fem.interpolation_coords(self._V.element, self._V.mesh.geometry, cells)
RuntimeError: Cannot get interpolation points - no Basix element available. Maybe this is a mixed element?

@clementberger
Copy link

When will the fix be publicly available ? I upgraded to the latest version available in conda (dolfinx 0.7.2) and the issue remains the same.

@jorgensd
Copy link
Sponsor Member

When will the fix be publicly available ? I upgraded to the latest version available in conda (dolfinx 0.7.2) and the issue remains the same.

I guess the question is when will this be available on conda (i.e. when do we plan a new release).
I think there are a few things in the works at the moment, see: https://github.com/FEniCS/dolfinx/milestone/8
As long as no more milestones will be added, I guess a release within the end of February seems likely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants