Hello, I am trying to run the hyperelasticity demo from Hyperelasticity — Computational Mechanics Numerical Tours with FEniCSx , but I get the following error message, related to NewtonSolver in NonlinearProblem:
Traceback (most recent call last):
File "/home/claire/Downloads/hyperelasticity.py", line 224, in <module>
solver = nls.petsc.NewtonSolver(mesh.comm, problem)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/claire/anaconda3/envs/fenicsx-env-v11/lib/python3.11/site-packages/dolfinx/nls/petsc.py", line 54, in __init__
self._A = create_matrix(problem.a)
^^^^^^^^^
AttributeError: 'NonlinearProblem' object has no attribute 'a'. Did you mean: 'A'?
Exception ignored in: <function NewtonSolver.__del__ at 0x7fc392df0720>
Traceback (most recent call last):
File "/home/claire/anaconda3/envs/fenicsx-env-v11/lib/python3.11/site-packages/dolfinx/nls/petsc.py", line 62, in __del__
for obj in filter(lambda obj: obj is not None, (self._A, self._b)):
^^^^^^^
AttributeError: 'NewtonSolver' object has no attribute '_A'
I am not sure how to solve this. I have already tried editing lines below line 210:
petsc_options = {
"snes_type": "newtonls",
"snes_linesearch_type": "none",
"snes_stol": np.sqrt(np.finfo(dolfinx.default_real_type).eps) * 1e-2,
"snes_atol": 0,
"snes_rtol": 0,
"ksp_type": "preonly",
"pc_type": "lu",
"pc_factor_mat_solver_type": "mumps",
"snes_monitor": None,
}
problem = fem.petsc.NonlinearProblem(Residual, u, bcs=bcs, petsc_options_prefix="demo_hyperelasticity_", petsc_options=petsc_options)
but I still get the error above.
Many thanks in advance for your help !
Kind regards,
Claire