Error with PETSc Nonlinear Solver with No Explicit Boundary Conditions

I am trying to adapt the PETSc Newton solver (here) to allow for adaptive time stepping (as suggested as in a previous post). However, because of the way that I am setting up my problem (elastodynamics with contact), there are no explicit boundary conditions for the elastic body.

When I set the boundary conditions as None, the environment crashes with an MPI error code (I am working in Google Colab). When I set the boundary conditions as [] so that there is an iterable passed to the bc argument, I get the error:

TypeError: apply_lifting(): incompatible function arguments. The following argument types are supported:
    1. (arg0: numpy.ndarray[numpy.float64], arg1: List[dolfinx::fem::Form<double>], arg2: List[numpy.ndarray[numpy.float64]], arg3: List[Dict[Tuple[dolfinx::fem::IntegralType, int], numpy.ndarray[numpy.float64]]], arg4: List[List[dolfinx::fem::DirichletBC<double>]], arg5: List[numpy.ndarray[numpy.float64]], arg6: float) -> None
    2. (arg0: numpy.ndarray[numpy.float32], arg1: List[dolfinx::fem::Form<float>], arg2: List[numpy.ndarray[numpy.float32]], arg3: List[Dict[Tuple[dolfinx::fem::IntegralType, int], numpy.ndarray[numpy.float32]]], arg4: List[List[dolfinx::fem::DirichletBC<float>]], arg5: List[numpy.ndarray[numpy.float32]], arg6: float) -> None
    3. (arg0: numpy.ndarray[numpy.complex128], arg1: List[dolfinx::fem::Form<std::complex<double> >], arg2: List[numpy.ndarray[numpy.complex128]], arg3: List[Dict[Tuple[dolfinx::fem::IntegralType, int], numpy.ndarray[numpy.complex128]]], arg4: List[List[dolfinx::fem::DirichletBC<std::complex<double> >]], arg5: List[numpy.ndarray[numpy.complex128]], arg6: float) -> None

Is there a way to utilize PETSc Newton solvers without passing explicit boundary conditions? Are there ways to pass dirichletbc instantiations that don’t apply any constraints?

If you do not have any Dirichlet boundary conditions you do not need to apply lifting. If you want to keep it a possibility for other problems, pass in [[]]
as you can see from the docs: dolfinx.fem β€” DOLFINx 0.4.2.0 documentation

1 Like