replacing ScalarType
with np.float32
in the code segment above changed this.
But later I get an error:
from dolfinx.fem.petsc import LinearProblem
problem = LinearProblem(a, L, bcs=[bc], petsc_options={"ksp_type": "preonly", "pc_type": "lu"})
uh = problem.solve()
throws:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[10], line 4
1 from dolfinx.fem.petsc import LinearProblem
----> 4 problem = LinearProblem(a, L, bcs=[bc], petsc_options={"ksp_type": "preonly", "pc_type": "lu"})
5 uh = problem.solve()
File /usr/local/dolfinx-complex/lib/python3.10/dist-packages/dolfinx/fem/petsc.py:566, in LinearProblem.__init__(self, a, L, bcs, u, petsc_options, form_compiler_options, jit_options)
538 def __init__(self, a: ufl.Form, L: ufl.Form, bcs: typing.List[DirichletBCMetaClass] = [],
539 u: typing.Optional[_Function] = None, petsc_options={}, form_compiler_options={}, jit_options={}):
540 """Initialize solver for a linear variational problem.
541
542 Args:
(...)
564 "pc_factor_mat_solver_type": "mumps"})
565 """
--> 566 self._a = _create_form(a, form_compiler_options=form_compiler_options, jit_options=jit_options)
567 self._A = create_matrix(self._a)
569 self._L = _create_form(L, form_compiler_options=form_compiler_options, jit_options=jit_options)
File /usr/local/dolfinx-complex/lib/python3.10/dist-packages/dolfinx/fem/forms.py:176, in form(form, dtype, form_compiler_options, jit_options)
173 return list(map(lambda sub_form: _create_form(sub_form), form))
174 return form
--> 176 return _create_form(form)
...
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
1. dolfinx.cpp.fem.Form_complex128(spaces: List[dolfinx::fem::FunctionSpace], integrals: Dict[dolfinx::fem::IntegralType, Tuple[List[Tuple[int, object]], dolfinx.cpp.mesh.MeshTags_int32]], coefficients: List[dolfinx.cpp.fem.Function_complex128], constants: List[dolfinx.cpp.fem.Constant_complex128], need_permutation_data: bool, mesh: dolfinx.cpp.mesh.Mesh = None)
2. dolfinx.cpp.fem.Form_complex128(form: int, spaces: List[dolfinx::fem::FunctionSpace], coefficients: List[dolfinx.cpp.fem.Function_complex128], constants: List[dolfinx.cpp.fem.Constant_complex128], subdomains: Dict[dolfinx::fem::IntegralType, dolfinx.cpp.mesh.MeshTags_int32], mesh: dolfinx.cpp.mesh.Mesh)
Invoked with: , [, ], [], [], {: None, : None, : None, : None},