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