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

Contents of /trunk/models/johnpye/dsg_array.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 758 - (show annotations) (download) (as text)
Thu Jul 13 01:15:58 2006 UTC (14 years, 4 months ago) by johnpye
File MIME type: text/x-ascend
File size: 1589 byte(s)
Some extfn test cases.
1 REQUIRE "ivpsystem.a4l";
2 REQUIRE "johnpye/dsg.a4c";
3
4 MODEL dsg_array;
5
6 t IS_A time;
7 dz IS_A distance;
8 n IS_A integer_constant;
9 n :== 3;
10
11 node[1..n] IS_A dsg;
12
13 (* central difference *)
14 (*
15 FOR i IN [2..(n-1)] CREATE
16 node[i].dp_dz = (node[i+1].p - node[i-1].p)/(2*dz);
17 node[i].dmdot_dz = (node[i+1].mdot - node[i-1].mdot)/(2*dz);
18 node[i].dmdoth_dz = (node[i+1].mdoth - node[i-1].mdoth)/(2*dz);
19 node[i].drhovel2_dz = (node[i+1].rhovel2 - node[i-1].rhovel2)/(2*dz);
20 node[i].dekdot_dz = (node[i+1].ekdot - node[i-1].ekdot)/(2*dz);
21 END FOR;
22 *)
23
24 (* backward difference *)
25 FOR i IN [2..n] CREATE
26 dz_p[i]: node[i].dp_dz = (node[i].p - node[i-1].p)/dz;
27 dz_mdot[i]: node[i].dmdot_dz = (node[i].mdot - node[i-1].mdot)/dz;
28 dz_mdoth[i]: node[i].dmdoth_dz = (node[i].mdoth - node[i-1].mdoth)/dz;
29 dz_rhovel2[i]: node[i].drhovel2_dz = (node[i].rhovel2 - node[i-1].rhovel2)/dz;
30 dz_ekdot[i]: node[i].dekdot_dz = (node[i].ekdot - node[i-1].ekdot)/dz;
31 END FOR;
32
33 (* forward difference *)
34 (*
35 FOR i IN [1] CREATE
36 node[i].dp_dz = (node[i+1].p - node[i].p)/dz;
37 node[i].dmdot_dz = (node[i+1].mdot - node[i].mdot)/dz;
38 node[i].dmdoth_dz = (node[i+1].mdoth - node[i].mdoth)/dz;
39 node[i].drhovel2_dz = (node[i+1].rhovel2 - node[i].rhovel2)/dz;
40 node[i].dekdot_dz = (node[i+1].ekdot - node[i].ekdot)/dz;
41 END FOR;
42 *)
43
44 METHODS
45 METHOD specify;
46 FOR i IN [1..n] DO
47 RUN node[i].specify;
48 END FOR;
49 END specify;
50
51 METHOD values;
52 FOR i IN [1..n] DO
53 RUN node[i].values;
54 END FOR;
55 END values;
56
57 METHOD on_load;
58 RUN specify;
59 RUN values;
60 END on_load;
61
62 END dsg_array;

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