Index: mttroot/mtt/lib/examples/Simulation/BigHeatedRod/Run ================================================================== --- mttroot/mtt/lib/examples/Simulation/BigHeatedRod/Run +++ mttroot/mtt/lib/examples/Simulation/BigHeatedRod/Run @@ -6,10 +6,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.2 1998/08/15 14:07:11 peterg +## Don't do ImplicitL +## ## Revision 1.1 1998/08/15 13:58:27 peterg ## Initial revision ## ############################################################### @@ -23,15 +26,22 @@ fi if [ -z "$DT" ]; then echo "Second argument is DT: the sample interval (eg 0.25)" exit fi +if [ -z "$3" ]; then + METHODS='ImplicitS Euler Implicit' +else + METHODS=$3 +fi echo "Running system HR$1 with DT = $DT" +echo "using methods $METHODS" #Create the system mtt -q rename HR HR$n >/dev/null +rm -f MTT_work/HR$1_state.* #Why ?? # Is it already correct? count=`grep -c "*$n" HR$1_abg.fig` # if not, then set the correct number of segments @@ -49,48 +59,57 @@ echo "Setting $n states to c_t*t_0" mv HR$1_state.txt HR$1_state.old sed "s/0.0/c_t*t_0/"HR$1_state.txt fi -echo Computing STEPFACTOR -mtt -q HR$n numpar m -mtt -q HR$n sm m - - -# What is the minimum step size for Euler? (and for sparse method) -octave -q <HR$1.tmp1 - HR$1_numpar; - A=HR$1_sm; - Max_Eig=max(eig(-A)) - STEPFACTOR=ceil( Max_Eig*$DT/2 ) - SparseSTEPFACTOR=5*$n # Emiprical!! -EOF - -MinSTEPFACTOR=`awk '{if ($1=="STEPFACTOR") print $3}' HR$1.tmp1` -SparseSTEPFACTOR=`awk '{if ($1=="SparseSTEPFACTOR") print $3}' HR$1.tmp1` + + + + rm -f HR$1_table.txt -#Set the methods of interest -METHODS='ImplicitS Euler Implicit' +#Do the methods of interest for METHOD in $METHODS; do case $METHOD in Euler) - STEPFACTOR=$MinSTEPFACTOR + # What is the minimum step size for Euler? + mtt -q HR$n numpar m + mtt -q HR$n sm m +octave -q <HR$1.tmp1 + HR$1_numpar; + A=HR$1_sm; + Max_Eig=max(eig(-A)) + STEPFACTOR=ceil( Max_Eig*$DT/2 ) +EOF + MinSTEPFACTOR=`awk '{if ($1=="STEPFACTOR") print $3}' HR$1.tmp1` + STEPFACTOR=$MinSTEPFACTOR ;; ImplicitS) + # What is the empirical step size for sparse method? + octave -q <HR$1.tmp1 + if $n>100 + SparseSTEPFACTOR=10*$n + else + SparseSTEPFACTOR=5*$n + endif +EOF + SparseSTEPFACTOR=`awk '{if ($1=="SparseSTEPFACTOR") print $3}' HR$1.tmp1` + STEPFACTOR=$SparseSTEPFACTOR ;; *) STEPFACTOR=1 ;; esac echo "Doing HR$1 with DT=$DT using $METHOD (STEPFACTOR = $STEPFACTOR)" + + # Modify the simpar.txt files grep -v 'STEPFACTOR' HR_simpar.txt | grep -v 'METHOD' | grep -v 'DT' > HR$1_simpar.txt echo "STEPFACTOR = $STEPFACTOR; # Added automatically" >>HR$1_simpar.txt echo "METHOD = $METHOD; # Added automatically" >>HR$1_simpar.txt echo "DT = $DT; # Added automatically" >>HR$1_simpar.txt mtt -q -c -o HR$1 odeso ps > junk 2>>junk #HR$1_$METHOD.tmp