/[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 771 - (show annotations) (download) (as text)
Fri Jul 14 04:31:54 2006 UTC (14 years, 4 months ago) by johnpye
File MIME type: text/x-ascend
File size: 1863 byte(s)
Removed some debug noise.
Minor changes to dsg models.
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 (* consistent design *)
14 node[1..n].rhow ARE_THE_SAME;
15 node[1..n].D2 ARE_THE_SAME;
16 node[1..n].cw ARE_THE_SAME;
17 node[1..n].hw ARE_THE_SAME;
18 node[1..n].qdots ARE_THE_SAME;
19 node[1..n].Tamb ARE_THE_SAME;
20
21 (* central difference *)
22 FOR i IN [2..(n-1)] CREATE
23 node[i].dp_dz = (node[i+1].p - node[i-1].p)/(2*dz);
24 node[i].dmdot_dz = (node[i+1].mdot - node[i-1].mdot)/(2*dz);
25 node[i].dmdoth_dz = (node[i+1].mdoth - node[i-1].mdoth)/(2*dz);
26 node[i].drhovel2_dz = (node[i+1].rhovel2 - node[i-1].rhovel2)/(2*dz);
27 node[i].dekdot_dz = (node[i+1].ekdot - node[i-1].ekdot)/(2*dz);
28 END FOR;
29
30 (* backward difference *)
31 FOR i IN [n] CREATE
32 dz_p[i]: node[i].dp_dz = (node[i].p - node[i-1].p)/dz;
33 dz_mdot[i]: node[i].dmdot_dz = (node[i].mdot - node[i-1].mdot)/dz;
34 dz_mdoth[i]: node[i].dmdoth_dz = (node[i].mdoth - node[i-1].mdoth)/dz;
35 dz_rhovel2[i]: node[i].drhovel2_dz = (node[i].rhovel2 - node[i-1].rhovel2)/dz;
36 dz_ekdot[i]: node[i].dekdot_dz = (node[i].ekdot - node[i-1].ekdot)/dz;
37 END FOR;
38
39 (* forward difference *)
40 FOR i IN [1] CREATE
41 node[i].dp_dz = (node[i+1].p - node[i].p)/dz;
42 node[i].dmdot_dz = (node[i+1].mdot - node[i].mdot)/dz;
43 node[i].dmdoth_dz = (node[i+1].mdoth - node[i].mdoth)/dz;
44 node[i].drhovel2_dz = (node[i+1].rhovel2 - node[i].rhovel2)/dz;
45 node[i].dekdot_dz = (node[i+1].ekdot - node[i].ekdot)/dz;
46 END FOR;
47
48 METHODS
49 METHOD specify;
50 FOR i IN [1..n] DO
51 RUN node[i].fix_design;
52 RUN node[i].fix_states;
53 END FOR;
54 RUN node[1].fix_temporals;
55 RUN node[2].fix_temporals;
56 END specify;
57
58 METHOD values;
59 FOR i IN [1..n] DO
60 RUN node[i].values;
61 END FOR;
62 END values;
63
64 METHOD on_load;
65 RUN specify;
66 RUN values;
67 END on_load;
68
69 END dsg_array;

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