/[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 775 - (show annotations) (download) (as text)
Sat Jul 15 07:18:54 2006 UTC (14 years, 3 months ago) by johnpye
File MIME type: text/x-ascend
File size: 2414 byte(s)
Tidied up headers in slvDOF.h
Added 'show freeable vars' to GUI.
Fixed up the 'check' function a bit. It was doing strange things.
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 (* design variables shared *)
14 rhow ALIASES node[1].rhow; node[1..n].rhow ARE_THE_SAME;
15 eps ALIASES node[1].eps; node[1..n].eps ARE_THE_SAME;
16 D ALIASES node[1].D; node[1..n].D ARE_THE_SAME;
17 D2 ALIASES node[1].D2; node[1..n].D2 ARE_THE_SAME;
18 cw ALIASES node[1].cw; node[1..n].cw ARE_THE_SAME;
19 hw ALIASES node[1].hw; node[1..n].hw ARE_THE_SAME;
20 qdots ALIASES node[1].qdots; node[1..n].qdots ARE_THE_SAME;
21 Tamb ALIASES node[1].Tamb; node[1..n].Tamb ARE_THE_SAME;
22
23 (* central difference *)
24 FOR i IN [2..(n-1)] CREATE
25 z_cd_p[i]: node[i].dp_dz = (node[i+1].p - node[i-1].p)/(2*dz);
26 z_cd_mdot[i]: node[i].dmdot_dz = (node[i+1].mdot - node[i-1].mdot)/(2*dz);
27 z_cd_mdoth[i]: node[i].dmdoth_dz = (node[i+1].mdoth - node[i-1].mdoth)/(2*dz);
28 z_cd_rhovel2[i]:node[i].drhovel2_dz = (node[i+1].rhovel2 - node[i-1].rhovel2)/(2*dz);
29 z_cd_ekdot[i]: node[i].dekdot_dz = (node[i+1].ekdot - node[i-1].ekdot)/(2*dz);
30 END FOR;
31
32 (* backward difference *)
33 FOR i IN [n] CREATE
34 z_bd_p[i]: node[i].dp_dz = (node[i].p - node[i-1].p)/dz;
35 z_bd_mdot[i]: node[i].dmdot_dz = (node[i].mdot - node[i-1].mdot)/dz;
36 z_bd_mdoth[i]: node[i].dmdoth_dz = (node[i].mdoth - node[i-1].mdoth)/dz;
37 z_bd_rhovel2[i]: node[i].drhovel2_dz = (node[i].rhovel2 - node[i-1].rhovel2)/dz;
38 z_bd_ekdot[i]: node[i].dekdot_dz = (node[i].ekdot - node[i-1].ekdot)/dz;
39 END FOR;
40
41 (* forward difference *)
42 FOR i IN [1] CREATE
43 z_fd_p[i]: node[i].dp_dz = (node[i+1].p - node[i].p)/dz;
44 z_fd_mdot[i]: node[i].dmdot_dz = (node[i+1].mdot - node[i].mdot)/dz;
45 z_fd_mdoth[i]: node[i].dmdoth_dz = (node[i+1].mdoth - node[i].mdoth)/dz;
46 z_fd_rhovel2[i]: node[i].drhovel2_dz = (node[i+1].rhovel2 - node[i].rhovel2)/dz;
47 z_fd_ekdot[i]: node[i].dekdot_dz = (node[i+1].ekdot - node[i].ekdot)/dz;
48 END FOR;
49
50 METHODS
51 METHOD specify;
52 (* steady state solution, hopefully... *)
53 FIX dz;
54 RUN fix_design;
55 FOR i IN [1..n] DO
56 RUN node[i].fix_temporals;
57 END FOR;
58 END specify;
59
60 METHOD fix_design;
61 RUN node[1].fix_design;
62 END fix_design;
63
64 METHOD values;
65 dz := 1.0 {m};
66 t := 0 {s};
67 FOR i IN [1..n] DO
68 RUN node[i].values;
69 END FOR;
70 END values;
71
72 METHOD on_load;
73 RUN specify;
74 RUN values;
75 END on_load;
76
77 END dsg_array;

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