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

revision 748 by johnpye, Tue Jul 11 05:54:26 2006 UTC revision 758 by johnpye, Thu Jul 13 01:15:58 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      (* central difference *)      (* central difference *)
14        (*
15      FOR i IN [2..(n-1)] CREATE      FOR i IN [2..(n-1)] CREATE
(* spatial derivatives *)
16          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);
17          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);
18          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);
19          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);
20          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);
21      END FOR;      END FOR;
22            *)
23
24      (* backward difference *)      (* backward difference *)
25      FOR i IN [n] CREATE      FOR i IN [2..n] CREATE
26          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;
27          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;
28          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;
29          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;
30          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;
31      END FOR;      END FOR;
32
33      (* forward difference *)      (* forward difference *)
34        (*
35      FOR i IN [1] CREATE      FOR i IN [1] CREATE
36          node[i].dp_dz = (node[i+1].p - node[i].p)/dz;          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;          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;          node[i].dmdoth_dz = (node[i+1].mdoth - node[i].mdoth)/dz;
39          node[i].drhovel2_dz = (node[i+1].rholvel2 - node[i].rhovel2)/dz;          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;          node[i].dekdot_dz = (node[i+1].ekdot - node[i].ekdot)/dz;
41      END FOR;      END FOR;
42        *)
43
44  METHODS  METHODS
45  METHOD specify;  METHOD specify;

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