I want to pass a relationship based on the solution of the problem to a python function as a float in every time step. Here a sample of my solution loop:
while (time <= T): # solve the system and obtain the solution (u,trz) nIter, rNorm = NewtonRaphson(Res,Jac,bcs_,uknown,uknown0,rank) # split the unkown u,trz = uknown.split(True) # Define a tensor based on the solution of the u F = as_tensor([[u,0.,0.],[0.,u,0.],[0.,0.,1.]]) # Define a scalar quantity FF = inner(F,F) # pass this scalar to a python function and take the output "out" which is a float out = reaction(FF) # Move to next time step u0.assign(u) trz0.assign(trz) time += dt
I want to pass the quantity FF, as a float, to a python function reaction() to solve a system of ODEs with solve_ivp of scipy. How can I do it ?