Auto iterate with transient solver


Need to iterate with fixed time step until time > T. For last time step, adjust dt so that tfinal = T.

;; Use the following scheme functions
:
;;
;; Two Functions to auto-iterate until a certain time is reached.
;;
;; 1. (aice tfinal) is for use by the coupled explicit solver
;;
;; 2. (ai tfinal ipts) is for use by the other solvers, where ipts is the maximum
;; number of iterations per time step
;;
;; Once time >= tfinal, no more iterations are performed.
;;
;;
(define delta-t)

(define (aice tfinal)
(set! delta-t (- tfinal (rpgetvar 'flow-time)))
(if (> delta-t 0)
(if (> delta-t (rpgetvar 'physical-time-step))
(begin
(iterate 1)
(aice tfinal)
)
(begin
(format "nWarning: Requested time step is ~a. Reducing time step to ~a.n" (rpgetvar 'physical-time-step) delta-t)
(rpsetvar 'physical-time-step delta-t)
(iterate 1)
(aice tfinal)
)
)
(display "nAuto-iterate Done.n")
)
)

(define (ai tfinal ipts)
(set! delta-t (- tfinal (rpgetvar 'flow-time)))
(if (> delta-t 0)
(if (> delta-t (rpgetvar 'physical-time-step))
(begin
(physical-time-steps 1 ipts)
(ai tfinal ipts)
)
(begin
(format "nWarning: Requested time step is ~a. Reducing time step to ~a.n" (rpgetvar 'physical-time-step) delta-t)
(rpsetvar 'physical-time-step delta-t)
(physical-time-steps 1 ipts)
(ai tfinal ipts)
)
)
(display "nAuto-iterate Done.n")
)
)





Show Form
No comments yet. Be the first to add a comment!