1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# $Revision: 1.2 $
# $Date: 1996/08/14 16:12:14 $
# $Author: ballan $
# Interval list creation functions
# Copyright 1996 Benjamin Allan (ballan@edrc.cmu.edu)
#
# This file defines several functions for creating lists of
# numbers and passing them to the integration interface in
# ASCEND 4. These lists are the sample points at which we
# wish to record values during integration.
#
# We have functions for:
# - evenly spaced intervals starting at 0.0
# (set_int)
# - evenly spaced intervals starting at 0.0 with
# intermediate sample points at the 2nd order lagrange locations
# (set_lagrangeint)
#
# These functions should take a starting point instead of assuming 0 but don't.
#
# We want functions for:
# logarithmically spaced points, starting at some number and ending
# at some much larger number, for sampling growing functions.
#
# points spaced at multiple frequencies
#
# building lists of sample times
#
# taking a list, inserting a small initial sample to trick the
# integrator into thinking the problem stiff, and then generating
# whatever the desired sampling schedule is after that.
#
# Bugs:
# Poor design. There should be a suite of commands for building
# sample lists up, then a single command that takes such a list
# and sends it to the integrator.
#
# proc set_int {nsteps step units}
#-------------------------------------------------------------------------
# this proc sets intervals incrementally for blsode
#-------------------------------------------------------------------------
proc set_int {nsteps step units} {
set SetIntervals "integrate_set_samples $units";
for {set i 0} {$i < $nsteps} {incr i} {
lappend SetIntervals [expr $i*$step];
}
eval $SetIntervals;
}
#
# proc set_lagrangeint {nsteps step units}
#-------------------------------------------------------------------------
# this proc sets intervals incrementally for blsode
# adding the lagrange nodes within each regularly spaced step
#-------------------------------------------------------------------------
proc set_lagrangeint {nsteps step units} {
set SetIntervals "integrate_set_samples $units";
for {set i 0} {$i < $nsteps} {incr i} {
lappend SetIntervals [expr $i*$step];
lappend SetIntervals [expr $i*$step+0.21132486*$step];
lappend SetIntervals [expr $i*$step+0.7886751*$step];
}
eval $SetIntervals;
}
|