Download AMESet User Manual

Transcript
Chapter 3
Getting Started
tance that the code for detecting a change of regime should be totally consistent
with the code for setting the regime. In the present example you are using:
ic(1)
condition for regime
condition for leaving regime
0
t .lt. tstart
t .ge. tstart
1
t .ge. tstart
t .lt. tstart
or:
ic[0]
condition for regime
condition for leaving regime
0
t < tstart
t >= tstart
1
t >= tstart
t < tstart
However, note that in this example, since time does not go backwards, you do
not need to test for leaving the region corresponding to ic(1)=1 (in F77) or
ic[0]=1 (in C).
Submodel test
Retest the submodel with the same system as before (Figure 3.25). Remove the old
submodel PM50 by selecting the new prime mover PM51 in Submodel mode.
After this, collect statistics for the run (see Figure 3.26) with the modified
submodel. You should find that the run:
•
is faster,
•
has fewer function evaluations and
•
uses a bigger maximum step size.
The cost is a slightly more complex submodel, which must be coded very
precisely. You can examine the files PM51.f and PM51.c files in the $AME/
tutorial/submodels or %AME%\tutorial\submodels areas (the same as with
RACK50).
3.5
Square wave submodel
This is the last exercise, which deals specifically with discontinuities. Clearly a
square wave is a discontinuous function. Here is some simple code for the square
wave:
66