Overview
| Comment: | Third argument gives the desired methods. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | origin/master | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
1eb75b2991bb4e56da728300b12b3d64 |
| User & Date: | gawthrop@users.sourceforge.net on 1998-08-17 09:42:26.000 |
| Other Links: | branch diff | manifest | tags |
Context
|
1998-08-17
| ||
| 09:43:04 | Initial revision check-in: 47506c39eb user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
| 09:42:26 | Third argument gives the desired methods. check-in: 1eb75b2991 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
|
1998-08-15
| ||
| 14:07:11 | Don't do ImplicitL check-in: b126ff16bf user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/lib/examples/Simulation/BigHeatedRod/Run
from [15b4b596fa]
to [e9ed9bb08f].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
#! /bin/sh
# Shell script for running the large HeatedRod systems to compare
# four integration methods.
# Usage example: Run 100 0.25 runf the 100 segment example at interval 0.25
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1 1998/08/15 13:58:27 peterg
## Initial revision
##
###############################################################
n=$1
DT=$2
if [ -z "$n" ]; then
echo "First argument is N: number of segments (eg 100)"
exit
fi
if [ -z "$DT" ]; then
echo "Second argument is DT: the sample interval (eg 0.25)"
exit
fi
echo "Running system HR$1 with DT = $DT"
#Create the system
mtt -q rename HR HR$n >/dev/null
# Is it already correct?
count=`grep -c "*$n" HR$1_abg.fig`
# if not, then set the correct number of segments
if [ "$count" = "0" ]; then
echo Setting number of segments to $n
| > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
#! /bin/sh
# Shell script for running the large HeatedRod systems to compare
# four integration methods.
# Usage example: Run 100 0.25 runf the 100 segment example at interval 0.25
###############################################################
## 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
##
###############################################################
n=$1
DT=$2
if [ -z "$n" ]; then
echo "First argument is N: number of segments (eg 100)"
exit
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
if [ "$count" = "0" ]; then
echo Setting number of segments to $n
|
| ︙ | ︙ | |||
47 48 49 50 51 52 53 | rm -f HR$1_state.txt MTT_work/HR$1_state.txt mtt -q HR$1 state txt 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.old >HR$1_state.txt fi | | < < < < < < < < < < < < | < > > > > > > > > > > | > > > > > > > > > > > > | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
rm -f HR$1_state.txt MTT_work/HR$1_state.txt
mtt -q HR$1 state txt
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.old >HR$1_state.txt
fi
rm -f HR$1_table.txt
#Do the methods of interest
for METHOD in $METHODS; do
case $METHOD in
Euler)
# What is the minimum step size for Euler?
mtt -q HR$n numpar m
mtt -q HR$n sm m
octave -q <<EOF >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 <<EOF >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
grep user junk |\
awk '{print System " &\t" METHOD " &\t" DT " &\t" STEPFACTOR " &\t" $2 "\\\\"}'\
|
| ︙ | ︙ |