# Diff of /trunk/models/johnpye/dsg_array.a4c

revision 748 by johnpye, Tue Jul 11 05:54:26 2006 UTC revision 772 by johnpye, Fri Jul 14 06:03:47 2006 UTC
# Line 6  MODEL dsg_array; Line 6  MODEL dsg_array;
6      t IS_A time;          t IS_A time;
7      dz IS_A distance;      dz IS_A distance;
8      n IS_A integer_constant;      n IS_A integer_constant;
9      n :== 10;      n :== 3;
10
11      node[1..n] IS_A dsg;      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 *)      (* central difference *)
22      FOR i IN [2..(n-1)] CREATE      FOR i IN [2..(n-1)] CREATE
(* spatial derivatives *)
23          node[i].dp_dz = (node[i+1].p - node[i-1].p)/(2*dz);          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);          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);          node[i].dmdoth_dz = (node[i+1].mdoth - node[i-1].mdoth)/(2*dz);
26          node[i].drhovel2_dz = (node[i+1].rholvel2 - node[i-1].rhovel2)/(2*dz);          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);          node[i].dekdot_dz = (node[i+1].ekdot - node[i-1].ekdot)/(2*dz);
28      END FOR;      END FOR;
29
30      (* backward difference *)      (* backward difference *)
31      FOR i IN [n] CREATE      FOR i IN [n] CREATE
32          node[i].dp_dz = (node[i].p - node[i-1].p)/dz;          dz_p[i]:       node[i].dp_dz = (node[i].p - node[i-1].p)/dz;
33          node[i].dmdot_dz = (node[i].mdot - node[i-1].mdot)/dz;          dz_mdot[i]:    node[i].dmdot_dz = (node[i].mdot - node[i-1].mdot)/dz;
34          node[i].dmdoth_dz = (node[i].mdoth - node[i-1].mdoth)/dz;          dz_mdoth[i]:   node[i].dmdoth_dz = (node[i].mdoth - node[i-1].mdoth)/dz;
35          node[i].drhovel2_dz = (node[i].rholvel2 - node[i-1].rhovel2)/dz;          dz_rhovel2[i]: node[i].drhovel2_dz = (node[i].rhovel2 - node[i-1].rhovel2)/dz;
36          node[i].dekdot_dz = (node[i].ekdot - node[i-1].ekdot)/dz;          dz_ekdot[i]:   node[i].dekdot_dz = (node[i].ekdot - node[i-1].ekdot)/dz;
37      END FOR;      END FOR;
38
39      (* forward difference *)      (* forward difference *)
# Line 34  MODEL dsg_array; Line 41  MODEL dsg_array;
41          node[i].dp_dz = (node[i+1].p - node[i].p)/dz;          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;          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;          node[i].dmdoth_dz = (node[i+1].mdoth - node[i].mdoth)/dz;
44          node[i].drhovel2_dz = (node[i+1].rholvel2 - node[i].rhovel2)/dz;          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;          node[i].dekdot_dz = (node[i+1].ekdot - node[i].ekdot)/dz;
46      END FOR;      END FOR;
47
48  METHODS  METHODS
49  METHOD specify;  METHOD specify;
50        FIX dz;
51      FOR i IN [1..n] DO      FOR i IN [1..n] DO
52          RUN node[i].specify;          RUN node[i].fix_design;
53            RUN node[i].fix_states;
54      END FOR;      END FOR;
55        RUN node[1].fix_temporals;
56        RUN node[2].fix_temporals;
57  END specify;  END specify;
58
59  METHOD values;  METHOD values;
60        dz := 1.0 {m};
61      FOR i IN [1..n] DO      FOR i IN [1..n] DO
62          RUN node[i].values;          RUN node[i].values;
63      END FOR;      END FOR;

Legend:
 Removed from v.748 changed lines Added in v.772