Adding:
dolfinx.log.set_log_level(dolfinx.log.LogLevel.DEBUG)
prior to your loop, you will get the output:
[2024-11-21 14:12:59.423] [info] Newton iteration 0: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.424] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.424] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.424] [info] Newton iteration 1: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.424] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.424] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.424] [info] Newton iteration 2: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.424] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.424] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.424] [info] Newton iteration 3: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.424] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.424] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.424] [info] Newton iteration 4: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.424] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.424] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.424] [info] Newton iteration 5: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.424] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.424] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.424] [info] Newton iteration 6: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.424] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.425] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.425] [info] Newton iteration 7: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.425] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.425] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.425] [info] Newton iteration 8: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.425] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.425] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.425] [info] Newton iteration 9: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.425] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.425] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.425] [info] Newton iteration 10: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.425] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.425] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.425] [info] Newton iteration 11: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.425] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.425] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.425] [info] Newton iteration 12: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.425] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.425] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.425] [info] Newton iteration 13: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.425] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.425] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.425] [info] Newton iteration 14: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.425] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.425] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.425] [info] Newton iteration 15: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.426] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.426] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.426] [info] Newton iteration 16: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.426] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.426] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.426] [info] Newton iteration 17: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.426] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.426] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.426] [info] Newton iteration 18: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.426] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.426] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.426] [info] Newton iteration 19: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.426] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.426] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.426] [info] Newton iteration 20: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.426] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.426] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.426] [info] Newton iteration 21: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.426] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.426] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.426] [info] Newton iteration 22: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.426] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.426] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.426] [info] Newton iteration 23: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.426] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.426] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.426] [info] Newton iteration 24: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.427] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.427] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.427] [info] Newton iteration 25: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.427] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.427] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.427] [info] Newton iteration 26: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.427] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.427] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.427] [info] Newton iteration 27: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.427] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.427] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.427] [info] Newton iteration 28: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.427] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.427] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.427] [info] Newton iteration 29: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.427] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.427] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.427] [info] Newton iteration 30: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.427] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.427] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.427] [info] Newton iteration 31: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.427] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.427] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.427] [info] Newton iteration 32: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.427] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.427] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.428] [info] Newton iteration 33: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.428] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.428] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.428] [info] Newton iteration 34: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.428] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.428] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.428] [info] Newton iteration 35: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.428] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.428] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.428] [info] Newton iteration 36: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.428] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.428] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.428] [info] Newton iteration 37: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.428] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.428] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.428] [info] Newton iteration 38: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.428] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.428] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.428] [info] Newton iteration 39: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.428] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.428] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.428] [info] Newton iteration 40: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.428] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.428] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.429] [info] Newton iteration 41: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.429] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.429] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.429] [info] Newton iteration 42: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.429] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.429] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.429] [info] Newton iteration 43: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.429] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.429] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.429] [info] Newton iteration 44: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.429] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.429] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.429] [info] Newton iteration 45: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.429] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.429] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.429] [info] Newton iteration 46: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.429] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.429] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.429] [info] Newton iteration 47: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.429] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.429] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.429] [info] Newton iteration 48: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.429] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.429] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.429] [info] Newton iteration 49: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:12:59.429] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:12:59.429] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
[2024-11-21 14:12:59.429] [info] Newton iteration 50: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
Traceback (most recent call last):
File "/root/shared/mwe.py", line 87, in <module>
solver.solve(r)
File "/usr/local/dolfinx-real/lib/python3.12/dist-packages/dolfinx/nls/petsc.py", line 51, in solve
n, converged = super().solve(u.x.petsc_vec)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Newton solver did not converge because maximum number of iterations reached
which means that your solver don’t even converge for the first iteration.
We can then add the following options to get deeper into the problem:
solver.krylov_solver.setType("preonly")
solver.krylov_solver.getPC().setType("lu")
solver.krylov_solver.getPC().setFactorSolverType("mumps")
solver.krylov_solver.setErrorIfNotConverged(True)
yielding
[2024-11-21 14:14:45.932] [info] Newton iteration 0: r (abs) = -nan (tol = 0.01), r (rel) = -nan (tol = 0.01)
[2024-11-21 14:14:45.932] [info] PETSc Krylov solver starting to solve system.
[2024-11-21 14:14:45.934] [info] PETSc error in '/src/dolfinx/cpp/dolfinx/la/petsc.cpp', 'KSPSolve'
[2024-11-21 14:14:45.934] [info] PETSc error code '76' 'Error in external library'
[2024-11-21 14:14:45.934] [debug] Elapsed wall, usr, sys time: 0.000000, 0.000000, 0.000000 (PETSc Krylov solver)
Traceback (most recent call last):
File "/root/shared/mwe.py", line 92, in <module>
solver.solve(r)
File "/usr/local/dolfinx-real/lib/python3.12/dist-packages/dolfinx/nls/petsc.py", line 51, in solve
n, converged = super().solve(u.x.petsc_vec)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Failed to successfully call PETSc function 'KSPSolve'. PETSc error code is: 76, Error in external library
We next assemble the residual F
prior to the loop:
print(dolfinx.fem.assemble_vector(dolfinx.fem.form(F)).array)
yielding
array([nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan])
which means that something in F
is singular.
One thing that stands out is that you define r_prime
twice:
ravi:
r_prime = ufl.grad(r)
and your initial r
is zero everwhere, meaning that dividing by norm_r_prime
gives you something singular.
I hope this can serve as a guide on how to debug time dependent, non-linear problems in the future.