Thank you for your reply, prj.
Here I uploaded my problem using SNESSolve, all the macro and constants are deleted to reduce the program from 2300 lines to 270+ lines. This is a nonlinear problem F(x)=0, the F is given in funcRes part and the correct Jacobian matrix is obtained in funcJ part. Their forms have been proved in my original IPOPT program so don’t worry about that. The solution vector is [u1,u2,u3,eta,eta0], boundary condition is given for u1, u2 and u3, bound Inequality constrain [0,1] is given for eta and eta0. Also, the eta and eta0 are time dependent so their values of previous time step is defined as etaOLD and eta0OLD.PETSc_Example.edp (18.0 KB)
Would you please help me point out the incorrect part in this program? Thanke you very much. I’m nont sure whether I transform the code in a correct way.