/[ascend]/trunk/models/johnpye/idadenx.a4c
ViewVC logotype

Annotation of /trunk/models/johnpye/idadenx.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 944 - (hide annotations) (download) (as text)
Sat Nov 25 10:46:13 2006 UTC (14 years, 3 months ago) by johnpye
File MIME type: text/x-ascend
File size: 1085 byte(s)
Implemented ATOLVECT, ATOL, RTOL parameters for the IDA integrator.
1 johnpye 942 REQUIRE "ivpsystem.a4l";
2     REQUIRE "atoms.a4l";
3    
4     IMPORT "johnpye/extpy/extpy";
5     IMPORT "johnpye/solve";
6    
7     (* ASCEND model based on the 'idadenx.c' example problem that accomanpanies IDA *)
8     MODEL idadenx;
9     y1, y2, y3 IS_A factor;
10     dy1_dt IS_A factor;
11     dy2_dt IS_A factor;
12    
13     eq1: dy1_dt = -0.04 * y1 + 1e4 * y2*y3;
14     eq2: dy2_dt = +0.04 * y1 - 1e4 * y2*y3 - 3e7*y2^2;
15     eq3: 0 = y1 + y2 + y3 - 1;
16    
17     t IS_A time;
18     METHODS
19    
20     METHOD values; (* initial values *)
21     y1 := 1;
22     y2 := 0;
23     y3 := 0;
24     t := 0 {s};
25     END values;
26    
27     METHOD specify;
28     FIX y1, y2;
29     END specify;
30    
31     METHOD ode_init;
32     FREE y1, y2;
33     t.ode_type := -1; t := 0 {s};
34     dy1_dt.ode_id := 1; dy1_dt.ode_type := 2;
35     y1.ode_id := 1; y1.ode_type := 1;
36    
37     dy2_dt.ode_id := 2; dy2_dt.ode_type := 2;
38     y2.ode_id := 2; y2.ode_type := 1;
39    
40     y3.ode_id := 3;
41 johnpye 944
42     t.obs_id := 1;
43     y1.obs_id := 2;
44     y2.obs_id := 3;
45     y3.obs_id := 4;
46     dy1_dt.obs_id := 5;
47     dy2_dt.obs_id := 6;
48    
49     y1.ode_atol := 1e-8;
50     y2.ode_atol := 1e-14;
51     y3.ode_atol := 1e-6;
52 johnpye 942 END ode_init;
53    
54     METHOD on_load;
55     RUN reset; RUN values;
56     EXTERNAL solve(SELF);
57     RUN ode_init;
58     END on_load;
59    
60     END idadenx;

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22