Hi there,
I am running into the following error when running the Newton solver after assembling a variational formulation and specifying the jacobian.
I am still very new to FeniCSx and I simply don’t understand where to look for the source of this error. Would you be able to point me in the right direction?
I am sorry I cannot provide a minimal working example for this error as it is part of a fairly extensive model but below is an abstracted version of the code.
Many thanks for any suggestion!
vac = Function(V)
v = TestFunction(V)
w = TrialFunction(V)
# with V a FunctionSpace
F = (
v_sup*cell_locations*v[0]
- inner(C1*grad(vac[0]), grad(v[0]))
- inner(C2*grad(vac[1]), grad(v[1]))
- inner(C3*grad(vac[2]), grad(v[2]))
+ (C4*(C5 - vac[1])*bv_locations_rel_radius*v[1])
+ ( - C6*vac[0]*vac[1]*v[0]
- C7*vac[0]*vac[1]*v[1]
+ C8*vac[0]*vac[1]*v[2]
+ C9*vac[2]*v[0]
+ C10*vac[2]*v[1]
- C11*vac[2]*v[2]
- C12*vac[0]*v[0]
- C13*vac[1]*v[1]
- C14*vac[2]*v[2])
)*dx()
# [Ci] with i=1..14 are constants
# v_sup, cell_locations, and bv_locations_rel_radius are functions.
dF = derivative(F, vac, w)
prob=fem.petsc.NonlinearProblem(F=F, u=vac, bcs=None, J=dF)
solver = nls.petsc.NewtonSolver(MPI.COMM_WORLD, prob)
solver.ksp_type='gmres'
solver.convergence_criterion='incremental'
solver.atol=1e-8
solver.rtol=1e-7
solver.max_it=25
solver.krylov_solver.atol=1e-4
solver.krylov_solver.rtol=1e-5
solver.solve(vac)