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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 748 - (hide annotations) (download) (as text)
Tue Jul 11 05:54:26 2006 UTC (14 years, 2 months ago) by johnpye
File MIME type: text/x-ascend
File size: 1528 byte(s)
Lot of svn ignore tagging.
Little more work on DSG model.
1 johnpye 748 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 :== 10;
10    
11     node[1..n] IS_A dsg;
12    
13     (* central difference *)
14     FOR i IN [2..(n-1)] CREATE
15     (* spatial derivatives *)
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].rholvel2 - 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     (* backward difference *)
24     FOR i IN [n] CREATE
25     node[i].dp_dz = (node[i].p - node[i-1].p)/dz;
26     node[i].dmdot_dz = (node[i].mdot - node[i-1].mdot)/dz;
27     node[i].dmdoth_dz = (node[i].mdoth - node[i-1].mdoth)/dz;
28     node[i].drhovel2_dz = (node[i].rholvel2 - node[i-1].rhovel2)/dz;
29     node[i].dekdot_dz = (node[i].ekdot - node[i-1].ekdot)/dz;
30     END FOR;
31    
32     (* forward difference *)
33     FOR i IN [1] CREATE
34     node[i].dp_dz = (node[i+1].p - node[i].p)/dz;
35     node[i].dmdot_dz = (node[i+1].mdot - node[i].mdot)/dz;
36     node[i].dmdoth_dz = (node[i+1].mdoth - node[i].mdoth)/dz;
37     node[i].drhovel2_dz = (node[i+1].rholvel2 - node[i].rhovel2)/dz;
38     node[i].dekdot_dz = (node[i+1].ekdot - node[i].ekdot)/dz;
39     END FOR;
40    
41     METHODS
42     METHOD specify;
43     FOR i IN [1..n] DO
44     RUN node[i].specify;
45     END FOR;
46     END specify;
47    
48     METHOD values;
49     FOR i IN [1..n] DO
50     RUN node[i].values;
51     END FOR;
52     END values;
53    
54     METHOD on_load;
55     RUN specify;
56     RUN values;
57     END on_load;
58    
59     END dsg_array;

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