[petsc-users] SNES solvers
Barry Smith
bsmith at mcs.anl.gov
Thu May 2 12:52:04 CDT 2013
Have you tried Newton's method? Do you have the Jacobian? Since it is a small problem you can compute the Jacobian with differences trivially just create with MatCreateSeqDense() matrix with size 4 and pass it and SNESComputeJacobianDefault to SNESSetJacobian().
Barry
On May 2, 2013, at 7:04 AM, Abdul-Lateef Haji-Ali <abdullateef.hajiali at kaust.edu.sa> wrote:
> Greetings,
>
> I am trying to solve a system of 4 non-linear equations to find 4 unknowns.
> The equations are slightly complicated and unstable for slightly large values of the unknowns.
> In most of the cases the correct solution is found. However sometimes the values that are fed to my residual function are big and nan/inf values are produced.
>
> This is the output of my residual function (x are the parameters and f is the computed residual)
> x= [1, 1, 2, 4]; f= [-1.32993, 6.46116, 0.490443, -4.47854];
> x= [2.32993, -5.46116, 1.50956, 8.47854]; f= [-1.77078, -133.872, 4.26217, 71.9728];
> x= [1.06488, 0.684771, 1.97607, 4.2185]; f= [-0.431978, 2.79625, 0.190123, 0.0503181];
> x= [4.10071, 128.411, -2.75261, -63.4942]; f= [62.0141, 2548.28, -95.0523, -1354.74];
> x= [1.74294, 0.960827, 1.63558, 4.54888]; f= [19.6641, 4.52508, -9.48464, 7.44219];
> x= [-57.9134, -2419.86, 92.2997, 1291.24]; f= [inf, -inf, inf, -inf];
> This was using ngmres, I noticed similar behaviour with other types.
>
> What can I do to improve the solver?
> N ote that my experience with petsc in new and limited.
>
> Thank you,
> --
> Abdul Lateef Haji Ali
More information about the petsc-users
mailing list