Changeset 25537 in project


Ignore:
Timestamp:
11/21/11 17:53:55 (9 years ago)
Author:
Ivan Raikov
Message:

flsim: sundials support

Location:
release/4/flsim/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/flsim/trunk/flsim.scm

    r25511 r25537  
    236236     `((";; dummy solver; returns only the computed derivatives")
    237237       ("(define (integrate1d f x y h) (f x y))" ,nl))
    238      `(("(define (scaler x a) (map (lambda (k) (fp* x k)) a))" ,nl)
    239        ("(define (summer a b) (map fp+ a b))" ,nl)
    240        ("(define " ,solver " (make-" ,solver "))" ,nl)
    241        ("(define (make_stepper deriv) (" ,solver " scaler summer deriv))" ,nl)
    242        ("(define (integrate1d f x y h) (((make_stepper f) h) x y))" ,nl)))
    243        
     238     (case solver
     239       ((cvode)
     240        `(("(use sundials lolevel)" ,nl)
     241          ( #<<EOF
     242(define (integrate1d f x y h)
     243  (let ((solver
     244         (or (procedure-data f)
     245             (let ((solver (cvode-create-solver
     246                            x 0.0 (list->f64vector y)
     247                            (lambda (x y) (list->f64vector (f x (f64vector->list y))))
     248                            abstol: 1e-1
     249                            reltol: 1e-2
     250                            lmm: cvode-lmm/bdf)))
     251               (extend-procedure f solver)
     252               solver))))
     253    (cvode-solve solver (+ x h))
     254    (let ((yy (cvode-yy solver)))
     255      (list (f64vector-ref yy 0))
     256      )))
     257EOF
     258)))
     259       (else
     260        `(("(define (scaler x a) (map (lambda (k) (fp* x k)) a))" ,nl)
     261          ("(define (summer a b) (map fp+ a b))" ,nl)
     262          ("(define " ,solver " (make-" ,solver "))" ,nl)
     263          ("(define (make_stepper deriv) (" ,solver " scaler summer deriv))" ,nl)
     264          ("(define (integrate1d f x y h) (((make_stepper f) h) x y))" ,nl)))
     265       ))
    244266))
    245267
  • release/4/flsim/trunk/flsim.setup

    r25511 r25537  
    44  (make-pathname #f fn ##sys#load-dynamic-extension))   
    55
    6 (define version 2.1)
     6(define version 2.2)
    77
    88(make (
Note: See TracChangeset for help on using the changeset viewer.