/[ascend]/trunk/models/ivpNondimensional/ivpStepN.dynTank.a4s
ViewVC logotype

Contents of /trunk/models/ivpNondimensional/ivpStepN.dynTank.a4s

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5 - (show annotations) (download)
Sun Nov 7 19:45:14 2004 UTC (19 years, 8 months ago) by aw0a
File size: 5516 byte(s)
adding ivp models to model library
1 # ------------------------------------------------------------
2 # --------------------Normal simulation-----------------------
3 # ------------------------------------------------------------
4
5 # Run this first set of statements to set up the
6 # problem initial state. The first statement turns
7 # off a compiler option to eliminate a compiler
8 # bug. When the bug is gone, we can remove
9 # this statement.
10
11 asc_compiler_option -useCopyAnon 0;
12 DELETE TYPES;
13 READ FILE "ivpNondimensional/ivpStepN.dynTank.a4c";
14 COMPILE int OF ivpTest;
15 BROWSE {int};
16 source $env(ASCENDDIST)/../models/ivpNondimensional/ivpStepN.tcl;
17 IVP.Integrator int Bdf 0.0001 50 0.001 10.0 20.0;
18
19
20 # the parameters for IVP.Integrator are
21 #
22 # qkfdid (qualified id) the name of compiled simulation: int
23 # method the name of the integration method to use: Bfd or Am
24 # relativeError the desired relative integration error, e.g., 0.001
25 # maxNumberSolves max number of model solves the integrator is allowed
26 # to perform before forcibly stopping, e.g., 1000
27 # initDeltaX the initial value to use for the stepsize deltaX,
28 # e.g., 0.0001
29 # maxDeltaX the maximum value for deltaX the integrator should use
30 # when stepping, e.g. 10.0
31 # stopX the stopping value for x
32
33
34
35 # ------------------------------------------------------------
36 # -----------Put interesting variables into Probe-------------
37 # ------------------------------------------------------------
38
39 # Run the following to put variables of interest
40 # into the Probe
41
42 for {set i 0} { $i <= 7 } { incr i 1} {
43 PROBE current "int.iP\[$i\].x" {}
44 PROBE current "int.iP\[$i\].y" {0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0}
45 PROBE current "int.iP\[$i\].dydx" {0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0}
46 }
47
48 for {set i 0} { $i <= 6 } { incr i 1} {
49 PROBE current "int.p.a\[$i\].var" {0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0}
50 }
51
52 PROBE current {int.dxMax} {0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0};
53
54
55
56 # ------------------------------------------------------------
57 # ------------------Test for index problem--------------------
58 # ------------------------------------------------------------
59
60
61 # Run the following steps to test if there is a "index" problem.
62 # There is no index problem if the current point is nonsingular
63 # with the degrees of freedom set as is done here. After these
64 # steps, go to the solver and run
65 #
66 # Analyze/Find dependent eqns./Structural dependencies
67 # Analyze/Find dependent eqns./Numerical dependencies
68 #
69 # If both report no problem, there is no "index" problem.
70 # If there is an index problem, you should reformulate the
71 # problem to eliminate it. The currentPt model should be able
72 # to compute variables dVdx and all algebraic variables when
73 # variables V are fixed for all states.
74
75 DELETE SYSTEM;
76 RUN {int.currentPt.ClearAll};
77 RUN {int.currentPt.specifyForStepping};
78 RUN {int.currentPt.testForIndexProblem};
79 SOLVE {int.currentPt} WITH QRSlv;
80
81
82
83 # ------------------------------------------------------------
84 # ------------------Manually run simulation-------------------
85 # ------------------------------------------------------------
86
87 # ------------------------------------------------------------
88 # -----------------This first set of commands-----------------
89 # ----------------establishes the initial state---------------
90 # -----------------and starts the simulation------------------
91 # ------------------------------------------------------------
92
93 asc_compiler_option -useCopyAnon 0;
94 DELETE TYPES;
95 READ FILE "ivpNondimensional/ivpStepN.dynTank.a4c";
96 COMPILE int OF ivpTest;
97 BROWSE {int};
98 RUN {int.valuesForInitializing};
99 RUN {int.specifyForInitializing};
100 SOLVE {int.currentPt} WITH QRSlv;
101 DELETE SYSTEM;
102 RUN {int.valuesForStepping};
103 RUN {int.specifyForStepping};
104
105 # Run one of the following to set the method
106
107 RUN {int.setUseMethodToAm};
108 RUN {int.setUseMethodToBdf};
109
110
111
112 # ------------------------------------------------------------
113 # ---------------------Step integration-----------------------
114 # -----------------Hold polynomial order same ----------------
115 # ------------------------------------------------------------
116
117 # Edit the number of steps (2 at present) into the next
118 # statement and then execute this for loop to take that many
119 # integration steps while holding the polynomial order
120 # and the integration step size constant.
121
122 set ivp_steps 5
123
124 for {set ivp_i 1} {$ivp_i <= $ivp_steps} {incr ivp_i} {
125 puts "\nstep $ivp_i"
126 RUN {int.stepX}
127 SOLVE {int} WITH QRSlv}
128
129
130
131 # ------------------------------------------------------------
132 # ---------------------Step integration-----------------------
133 # -------------Increase polynomial order each step -----------
134 # ------------------------------------------------------------
135
136 # Edit the number of steps into the next statement and
137 # then execute this for loop to take that many integration
138 # steps. This script holds the step size constant but
139 # increases the polynomial order by one as it takes each
140 # step - note that the method "incrementUsePolyOrder limits
141 # the order to a maximum value of 6.
142
143 set ivp_steps 3
144
145 for {set ivp_i 1} {$ivp_i <= $ivp_steps} {incr ivp_i} {
146 puts "\nstep $ivp_i"
147 RUN {int.incrementUsePolyOrder}
148 RUN {int.stepX}
149 SOLVE {int} WITH QRSlv}
150
151
152
153 # ------------------------------------------------------------
154 # ---------------------Change polynomial----------------------
155 # -----------------order if it allows larger step ------------
156 # ------------------------------------------------------------
157
158 RUN {int.computeMaxNominalStepsForEachVariable};

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