Is it possible to adapt this solution for Helmholtz equation? I just executed it with complex fenics (0.8, conda) and got the following error:
{
"name": "TypeError",
"message": "apply_lifting(): incompatible function arguments. The following argument types are supported:
1. apply_lifting(b: ndarray[dtype=float32, shape=(*), order='C'], a: list[dolfinx.cpp.fem.Form_float32], constants: list[ndarray[dtype=float32, writable=False, shape=(*), order='C']], coeffs: list[dict[tuple[dolfinx.cpp.fem.IntegralType, int], ndarray[dtype=float32, writable=False, shape=(*, *), order='C']]], bcs1: list[list[dolfinx.cpp.fem.DirichletBC_float32]], x0: list[ndarray[dtype=float32, writable=False, shape=(*), order='C']], scale: float) -> None
2. apply_lifting(b: ndarray[dtype=float64, shape=(*), order='C'], a: list[dolfinx.cpp.fem.Form_float64], constants: list[ndarray[dtype=float64, writable=False, shape=(*), order='C']], coeffs: list[dict[tuple[dolfinx.cpp.fem.IntegralType, int], ndarray[dtype=float64, writable=False, shape=(*, *), order='C']]], bcs1: list[list[dolfinx.cpp.fem.DirichletBC_float64]], x0: list[ndarray[dtype=float64, writable=False, shape=(*), order='C']], scale: float) -> None
3. apply_lifting(b: ndarray[dtype=complex64, shape=(*), order='C'], a: list[dolfinx.cpp.fem.Form_complex64], constants: list[ndarray[dtype=complex64, writable=False, shape=(*), order='C']], coeffs: list[dict[tuple[dolfinx.cpp.fem.IntegralType, int], ndarray[dtype=complex64, writable=False, shape=(*, *), order='C']]], bcs1: list[list[dolfinx.cpp.fem.DirichletBC_complex64]], x0: list[ndarray[dtype=complex64, writable=False, shape=(*), order='C']], scale: complex) -> None
4. apply_lifting(b: ndarray[dtype=complex128, shape=(*), order='C'], a: list[dolfinx.cpp.fem.Form_complex128], constants: list[ndarray[dtype=complex128, writable=False, shape=(*), order='C']], coeffs: list[dict[tuple[dolfinx.cpp.fem.IntegralType, int], ndarray[dtype=complex128, writable=False, shape=(*, *), order='C']]], bcs1: list[list[dolfinx.cpp.fem.DirichletBC_complex128]], x0: list[ndarray[dtype=complex128, writable=False, shape=(*), order='C']], scale: complex) -> None
Invoked with types: ndarray, list, list, list, list, list, float",
"stack": "---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[1], line 77
75 dofs = V.dofmap.cell_dofs(cell)
76 b.x.array[dofs] += basis_value
---> 77 dolfinx.fem.petsc.apply_lifting(b.vector, [a_compiled], [[bc]])
78 b.x.scatter_reverse(dolfinx.la.InsertMode.add)
79 dolfinx.fem.petsc.set_bc(b.vector, [bc])
File ~/miniconda3/envs/fenics-complex/lib/python3.12/site-packages/dolfinx/fem/petsc.py:651, in apply_lifting(b, a, bcs, x0, scale, constants, coeffs)
649 x0_r = [x.array_r for x in x0]
650 b_local = stack.enter_context(b.localForm())
--> 651 _assemble.apply_lifting(b_local.array_w, a, bcs, x0_r, scale, constants, coeffs)
File ~/miniconda3/envs/fenics-complex/lib/python3.12/site-packages/dolfinx/fem/assemble.py:348, in apply_lifting(b, a, bcs, x0, scale, constants, coeffs)
346 _a = [None if form is None else form._cpp_object for form in a]
347 _bcs = [[bc._cpp_object for bc in bcs0] for bcs0 in bcs]
--> 348 _cpp.fem.apply_lifting(b, _a, constants, coeffs, _bcs, x0, scale)
TypeError: apply_lifting(): incompatible function arguments. The following argument types are supported:
1. apply_lifting(b: ndarray[dtype=float32, shape=(*), order='C'], a: list[dolfinx.cpp.fem.Form_float32], constants: list[ndarray[dtype=float32, writable=False, shape=(*), order='C']], coeffs: list[dict[tuple[dolfinx.cpp.fem.IntegralType, int], ndarray[dtype=float32, writable=False, shape=(*, *), order='C']]], bcs1: list[list[dolfinx.cpp.fem.DirichletBC_float32]], x0: list[ndarray[dtype=float32, writable=False, shape=(*), order='C']], scale: float) -> None
2. apply_lifting(b: ndarray[dtype=float64, shape=(*), order='C'], a: list[dolfinx.cpp.fem.Form_float64], constants: list[ndarray[dtype=float64, writable=False, shape=(*), order='C']], coeffs: list[dict[tuple[dolfinx.cpp.fem.IntegralType, int], ndarray[dtype=float64, writable=False, shape=(*, *), order='C']]], bcs1: list[list[dolfinx.cpp.fem.DirichletBC_float64]], x0: list[ndarray[dtype=float64, writable=False, shape=(*), order='C']], scale: float) -> None
3. apply_lifting(b: ndarray[dtype=complex64, shape=(*), order='C'], a: list[dolfinx.cpp.fem.Form_complex64], constants: list[ndarray[dtype=complex64, writable=False, shape=(*), order='C']], coeffs: list[dict[tuple[dolfinx.cpp.fem.IntegralType, int], ndarray[dtype=complex64, writable=False, shape=(*, *), order='C']]], bcs1: list[list[dolfinx.cpp.fem.DirichletBC_complex64]], x0: list[ndarray[dtype=complex64, writable=False, shape=(*), order='C']], scale: complex) -> None
4. apply_lifting(b: ndarray[dtype=complex128, shape=(*), order='C'], a: list[dolfinx.cpp.fem.Form_complex128], constants: list[ndarray[dtype=complex128, writable=False, shape=(*), order='C']], coeffs: list[dict[tuple[dolfinx.cpp.fem.IntegralType, int], ndarray[dtype=complex128, writable=False, shape=(*, *), order='C']]], bcs1: list[list[dolfinx.cpp.fem.DirichletBC_complex128]], x0: list[ndarray[dtype=complex128, writable=False, shape=(*), order='C']], scale: complex) -> None
Invoked with types: ndarray, list, list, list, list, list, float"
}