1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#! /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
##
###############################################################
|
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#! /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.3 1998/08/17 09:42:26 peterg
## Third argument gives the desired methods.
##
## 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
##
###############################################################
|
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
118
119
120
121
122
123
124
125
126
|
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 "\\\\"}'\
METHOD=$METHOD STEPFACTOR=$STEPFACTOR System=HR$1 DT=$DT >> HR$1_table.txt
cp HR$1_odeso.ps HR$1.$METHOD.$DT.ps
done
cat HR$1_table.txt
|
|
|
|
|
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
118
119
120
121
122
123
124
125
126
127
128
129
|
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=`gawk '{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=`gawk '{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 |\
gawk '{print System " &\t" METHOD " &\t" DT " &\t" STEPFACTOR " &\t" $2 "\\\\"}'\
METHOD=$METHOD STEPFACTOR=$STEPFACTOR System=HR$1 DT=$DT >> HR$1_table.txt
cp HR$1_odeso.ps HR$1.$METHOD.$DT.ps
done
cat HR$1_table.txt
|