28 real(RP) :: tol = 1
e-5_rp, eps = 1
e-3_rp
29 integer :: verb=0, itmax=100
35 integer :: iter, feval=0
36 logical :: ierr = .false.
55 real(RP),
intent(in),
optional :: tol, eps
56 integer ,
intent(in),
optional :: itmax, verb
58 if (
present(verb )) n%verb = verb
59 if (
present(tol )) n%tol = tol
60 if (
present(itmax)) n%itMax= itmax
61 if (
present(eps )) n%eps = eps
64 & itmax=100, restart=3)
92 real(RP),
dimension(:),
intent(inout) :: x
93 type(
newton) ,
intent(inout) :: n
94 procedure(rntorn) :: F
96 real(RP),
dimension(size(x, 1)) :: Fx, z, x0
103 write(*,*)
'newton_mod: newton_solve: ' 114 if (n%verb>1)
write(*,*)
' Iter', n%iter,
', residual', n%res
115 if (n%res<n%tol)
goto 10
130 n%Feval = n%Feval + 1 + n%kry%AEval
134 &
write(*,*)
' Iter', ii,
', residual', n%res
138 if (n%res<n%tol)
goto 10
145 call warning(
"newton_mod: newton_solve: not converged", n%verb-1)
151 write(*,*)
" Iter ",n%iter
152 write(*,*)
" Performed x-->F(x) ",n%Feval
153 write(*,*)
" Residual ",n%res
156 write(*,*)
' CPU ',
real(cpu,
sp)
164 subroutine df(zz, yy)
166 real(RP),
dimension(:),
intent(out) :: zz
167 real(RP),
dimension(:),
intent(in) :: yy
169 call f(zz,x + n%eps*yy)
180 function residual(Fx, x)
result(res)
183 real(RP),
dimension(:),
intent(in) :: Fx, x
DEFINITION OF ABSTRACT_INTERFACES FOR THE LIBRARY CHORAL
integer, parameter kry_gmres
GmRes linear solver.
The type krylov defines the settings of a linear solver.
integer, parameter, public sp
simple precision for real numbers
NEWTON NON LINEAR SOLVER.
REAL NUMBERS PRECISION IN CHORAL: selects simple/double/quad
OPENMP OPERATIONS ON 1-DIMENSIONAL REAL ARRAYS
real(rp) function e(x, v1, v2)
real(rp) function residual(Fx, x)
Residual.
type(newton) function newton_create(tol, itmax, eps, verb)
constructor
real(rp), parameter, public real_tol
subroutine newton_solve(x, n, F)
Newton algorithm to solve F(x) = 0.
DERIVED TYPE krylov: for the resolution of linear systems