c=========================================================== c chk_tlsoda: Program to check the output of tlsoda c by applying a second-order discretization of the ODE c to the computed solution. c c Output is dt and the RMS value of the residual of the c O(dt^2) discretization, which should itself be c approximately O(dt^2); refer to class notes for more c details. c=========================================================== program chk_tlsoda implicit none integer maxnt parameter ( maxnt = 100 000 ) real*8 t(maxnt), u(maxnt) real*8 hm2, rmsres integer nt, it call dvvfrom('-',t,u,nt,maxnt) c----------------------------------------------------------- c Will assume that 't' defines a *uniform* mesh. c----------------------------------------------------------- hm2 = 1.0d0 / (t(2) - t(1))**2 rmsres = 0.0d0 do it = 2 , nt - 1 rmsres = rmsres + & ( hm2 * (u(it+1) - 2.0d0 * u(it) + u(it-1)) + & u(it) )** 2 end do rmsres = sqrt(rmsres / (nt - 2)) write(*,*) t(2) - t(1), rmsres stop 900 continue write(0,*) 'usage: chk_tsloda' write(0,*) ' ' write(0,*) ' Reads (x_i, u_i) pairs from '// & 'standard input' stop end