Traceback (most recent call last):
File "/home/remidm/FESTIM-workshop/book/content/mwe.py", line 26, in <module>
u_sub.interpolate(u_sub_expr)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "/home/remidm/anaconda3/envs/festim-workshop/lib/python3.13/site-packages/dolfinx/fem/function.py", line 459, in interpolate
_interpolate(u0)
~~~~~~~~~~~~^^^^
File "/home/remidm/anaconda3/envs/festim-workshop/lib/python3.13/functools.py", line 934, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/home/remidm/anaconda3/envs/festim-workshop/lib/python3.13/site-packages/dolfinx/fem/function.py", line 455, in _
self._cpp_object.interpolate(e0._cpp_object, cells0, cells1) # type: ignore
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Cells lists have different lengths.
One more idea (not sure it’s what you need but at least fem.Expression is used): first interpolate u as uu on the submesh and then use uu to construct the fem.Expression:
thanks! I’d like to avoid making another function if possible (because I have a transient problem and I’d have to update it at each timestep, i’d like to avoid that if possible).
Don’t know if we could use interpolate_nonmatching on Expression