Changeset 25509 in project for release/4/sundials/trunk
 Timestamp:
 11/16/11 12:10:14 (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

release/4/sundials/trunk/tests/ml.scm
r25082 r25509 66 66 67 67 68 69 (define (main) 68 (define (idamain) 69 70 (define (ressc t yy yp) 71 (let ((dd (rhs t yy))) 72 73 (let ((v ( (f64vectorref dd 0) (f64vectorref yp 0))) 74 (w ( (f64vectorref dd 1) (f64vectorref yp 1)))) 75 (f64vector v w)))) 70 76 71 (let ((yy (f64vector 60.899 0.0149)) ;; v w 77 (let* ((yy (f64vector 60.899 0.0149)) ;; v w 78 (yp (rhs 0.0 yy)) 79 80 ;; Integration limits 81 (t0 0.0) 82 (tf TEND) 83 (dt 1e2)) 84 85 86 ;; IDA initialization 87 (let ((solver (idacreatesolver t0 tf yy yp ressc 88 abstol: 1e14 89 reltol: 1e14))) 90 91 ;; In loop, call IDASolve, print results, and test for error. 92 93 (let recur ((tnext (+ t0 dt)) (iout 1)) 94 95 (let ((flag (idasolve solver tnext))) 96 (if (negative? flag) (error 'main "IDA solver error" flag)) 97 98 99 (let ((yy (idayy solver))) 100 (printf "~A ~A ~A~%" 101 tnext 102 (f64vectorref yy 0) 103 (f64vectorref yy 1) 104 )) 105 106 107 (if (< tnext tf) 108 (recur (+ tnext dt) (+ 1 iout))) 109 )) 110 111 (idadestroysolver solver) 112 113 ))) 114 115 116 117 (define (cvodemain) 118 119 (let ((yy (f64vector 60.899 0.0149));; v w 72 120 73 121 ;; Integration limits … … 89 137 (if (negative? flag) (error 'main "CVODE solver error" flag)) 90 138 139 91 140 (if (< tnext tf) 92 141 (recur (+ tnext dt) (+ 1 iout))) … … 103 152 ))) 104 153 105 (define ( main/unsafe)154 (define (cvodemain/unsafe) 106 155 107 156 (let ((yy (f64vector 60.899 0.0149)) ;; v w … … 151 200 ))) 152 201 153 154 ( main)155 ( main/unsafe)202 ;(idamain) 203 (cvodemain) 204 (cvodemain/unsafe)
Note: See TracChangeset
for help on using the changeset viewer.