/[ascend]/trunk/models/test/hires.a4c
ViewVC logotype

Annotation of /trunk/models/test/hires.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1247 - (hide annotations) (download) (as text)
Sat Jan 27 00:11:34 2007 UTC (16 years, 4 months ago) by johnpye
File MIME type: text/x-ascend
File size: 1980 byte(s)
Added 'hires.a4c' test model.
Split slv_system_structure out of slv.c and into system_impl.h.
Changed void* diffvars pointer in slv_system_structure to a typed pointer.
Moved SolverDiffVarCollectionStruct into system_impl.h.
Renamed slv_system_structure to just system_structure (in anticipation of a 'system' module separate from the actual solvers).
1 johnpye 1247 REQUIRE "ivpsystem.a4l";
2     REQUIRE "atoms.a4l";
3     (*
4     Sample problem 'HIRES' from the parallel-IVP-algorithm group of CWI:
5     'High Irradiance RESponse', from plant physiology, describing how light is
6     involved in morphogenesis.
7    
8     http://pitagora.dm.uniba.it/~testset/problems/hires.php
9    
10     We're not really concerned with the details of this problem. We're just
11     trying to determine that our solver gets the right answer. High-precision
12     solution results are provided online and we aim to reproduce those here.
13     *)
14    
15     MODEL hires;
16     y[1..8] IS_A solver_var;
17     dy_dt[1..8] IS_A solver_var;
18    
19     f1: dy_dt[1] = -1.71*y[1] + 0.43*y[2] + 8.32*y[3] + 0.0007;
20    
21     f2: dy_dt[2] = 1.71*y[1] - 8.75*y[2];
22    
23     f3: dy_dt[3] = -10.03*y[3] + 0.43*y[4] + 0.035*y[5];
24    
25     f4: dy_dt[4] = 8.32*y[2] + 1.71*y[3] - 1.12*y[4];
26    
27     f5: dy_dt[5] = -1.745*y[5] + 0.43*y[6] +0.43*y[7];
28    
29     f6: dy_dt[6] = -280*y[6]*y[8] + 0.69*y[4] + 1.71*y[5] - 0.43*y[6] + 0.69*y[7];
30    
31     f7: dy_dt[7] = 280*y[6]*y[8] - 1.81*y[7];
32    
33     f8: dy_dt[8] = -280*y[6]*y[8] + 1.81*y[7];
34    
35     t IS_A time;
36    
37     METHODS
38     METHOD values;
39     FOR i IN [1..8] DO
40     y[i] := 0;
41     END FOR;
42     y[1] := 1;
43     y[8] := 0.0057;
44     t := 0 {s};
45     END values;
46     (* integrate up to t = 321.8122 *)
47     METHOD ode_init;
48     FOR i IN [1..8] DO
49     y[i].ode_id := i; dy_dt[i].ode_id := i;
50     y[i].ode_type := 1; dy_dt[i].ode_type := 2;
51     y[i].obs_id := i;
52     END FOR;
53     t.ode_type := -1;
54     END ode_init;
55     METHOD self_test;
56     ASSERT abs(y[1] - 0.7371312573325668e-3) < 1e-8;
57     ASSERT abs(y[2] - 0.1442485726316185e-3) < 1e-8;
58     ASSERT abs(y[3] - 0.5888729740967575e-4) < 1e-8;
59     ASSERT abs(y[4] - 0.1175651343283149e-2) < 1e-8;
60     ASSERT abs(y[5] - 0.2386356198831331e-2) < 1e-8;
61     ASSERT abs(y[6] - 0.6238968252742796e-2) < 1e-8;
62     ASSERT abs(y[7] - 0.2849998395185769e-2) < 1e-8;
63     ASSERT abs(y[8] - 0.2850001604814231e-2) < 1e-8;
64     END self_test;
65     METHOD specify;
66     (* nothing needs to be fixed *)
67     END specify;
68     METHOD on_load;
69     RUN reset; RUN values;
70     RUN ode_init;
71     END on_load;
72     END hires;
73    

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