1 |
REQUIRE "ivpsystem.a4l"; |
2 |
REQUIRE "atoms.a4l"; |
3 |
(* |
4 |
Sample problem 'HIRES' from the Test Set for IVP Solvers |
5 |
|
6 |
'High Irradiance RESponse', from plant physiology, describing how light is |
7 |
involved in morphogenesis. |
8 |
|
9 |
http://pitagora.dm.uniba.it/~testset/problems/hires.php |
10 |
|
11 |
We're not really concerned with the details of this problem. We're just |
12 |
trying to determine that our solver gets the right answer. High-precision |
13 |
solution results are provided online and we aim to reproduce those here. |
14 |
*) |
15 |
|
16 |
MODEL hires; |
17 |
y[1..8] IS_A solver_var; |
18 |
dy_dt[1..8] IS_A solver_var; |
19 |
|
20 |
f1: dy_dt[1] = -1.71*y[1] + 0.43*y[2] + 8.32*y[3] + 0.0007; |
21 |
|
22 |
f2: dy_dt[2] = 1.71*y[1] - 8.75*y[2]; |
23 |
|
24 |
f3: dy_dt[3] = -10.03*y[3] + 0.43*y[4] + 0.035*y[5]; |
25 |
|
26 |
f4: dy_dt[4] = 8.32*y[2] + 1.71*y[3] - 1.12*y[4]; |
27 |
|
28 |
f5: dy_dt[5] = -1.745*y[5] + 0.43*y[6] +0.43*y[7]; |
29 |
|
30 |
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]; |
31 |
|
32 |
f7: dy_dt[7] = 280*y[6]*y[8] - 1.81*y[7]; |
33 |
|
34 |
f8: dy_dt[8] = -280*y[6]*y[8] + 1.81*y[7]; |
35 |
|
36 |
t IS_A time; |
37 |
|
38 |
METHODS |
39 |
METHOD values; |
40 |
FOR i IN [1..8] DO |
41 |
y[i] := 0; |
42 |
END FOR; |
43 |
y[1] := 1; |
44 |
y[8] := 0.0057; |
45 |
t := 0 {s}; |
46 |
END values; |
47 |
(* integrate up to t = 321.8122 *) |
48 |
METHOD ode_init; |
49 |
FOR i IN [1..8] DO |
50 |
y[i].ode_id := i; dy_dt[i].ode_id := i; |
51 |
y[i].ode_type := 1; dy_dt[i].ode_type := 2; |
52 |
y[i].obs_id := i; |
53 |
END FOR; |
54 |
t.ode_type := -1; |
55 |
END ode_init; |
56 |
METHOD self_test; |
57 |
ASSERT abs(y[1] - 0.7371312573325668e-3) < 1e-15; |
58 |
ASSERT abs(y[2] - 0.1442485726316185e-3) < 1e-15; |
59 |
ASSERT abs(y[3] - 0.5888729740967575e-4) < 1e-15; |
60 |
ASSERT abs(y[4] - 0.1175651343283149e-2) < 1e-15; |
61 |
ASSERT abs(y[5] - 0.2386356198831331e-2) < 1e-13; |
62 |
ASSERT abs(y[6] - 0.6238968252742796e-2) < 1e-13; |
63 |
ASSERT abs(y[7] - 0.2849998395185769e-2) < 1e-14; |
64 |
ASSERT abs(y[8] - 0.2850001604814231e-2) < 1e-14; |
65 |
END self_test; |
66 |
METHOD specify; |
67 |
(* nothing needs to be fixed *) |
68 |
END specify; |
69 |
METHOD on_load; |
70 |
RUN reset; RUN values; |
71 |
RUN ode_init; |
72 |
END on_load; |
73 |
END hires; |