Index: mttroot/mtt/bin/trans/make_ode2odes ================================================================== --- mttroot/mtt/bin/trans/make_ode2odes +++ mttroot/mtt/bin/trans/make_ode2odes @@ -7,10 +7,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.11 1998/08/25 12:28:31 peterg +## Move initila switch to after initial input +## ## Revision 1.10 1998/08/25 12:22:45 peterg ## Put _switch after update and also at initilisation ## ## Revision 1.9 1998/08/15 13:46:59 peterg ## New versions of integration routines @@ -72,48 +75,38 @@ mtt_write(MTTt,MTTx,MTTy,$Nx,$Ny); # And write them [mttAA] = zero_matrix($Nx); # Zero the A matrix [mttAAx] = zero_vector($Nx); # Zero the AAx vector -if mttmethod==1 #Euler - mttsteps = mttstepfactor; -endif; - -if mttmethod>1 #everything else - mttsteps = 1; -end; - - -mttddt = mttdt/mttsteps; # The small sample interval - -if mttmethod==2 #Linear implicit - mttAA = $1_smx(MTTx,MTTu,mttdt); # Set up AA= I-Adt matrix - linearised system -end; + if mttmethod==1 # Euler + MTTddt = mttdt/mttstepfactor; # The small sample interval + endif; #Integration loop for MTTit = 1:MTTilast - if mttmethod==3 # nonlinear implicit - [mttAA] = $1_smx(MTTx,MTTu,mttdt); # Set up AA=I-A*dt matrix - linearised system - end; - if mttmethod>1 # nonlinear implicit - [mttAAx] = $1_smxx(MTTx,MTTu,MTTx,mttdt); # Set up AAx = AA*x vector - linearised system - end; - [MTTu] = $1_input(MTTx,MTTt); # Input - for MTTjt = 1:mttsteps + if mttmethod==1 # Euler + for MTTjt = 1:mttstepfactor + [MTTdx] = $1_ode(MTTx,MTTu,MTTt); # State derivative + [MTTx] = mtt_euler(MTTx,MTTdx,MTTddt,$Nx); # Euler update + MTTt = MTTt + MTTddt; + endfor; + endif; + if mttmethod==2 # Implicit [MTTdx] = $1_ode(MTTx,MTTu,MTTt); # State derivative - [MTTx] = mtt_update(MTTdx,MTTx,mttAAx,mttAA,mttdt,mttstepfactor,$Nx,mttmethod); - MTTt = MTTt + mttddt; - end; + [mttAA,mttAAx] = $1_smx(MTTx,MTTu,mttdt); # (I-Adt) and (I-Adt)x + [MTTx] = mtt_implicit(MTTx,MTTdx,mttAA,mttAAx,mttdt,$Nx); # Implicit update + MTTt = MTTt + mttdt; + endif; [MTTx] = $1_switch(MTTx); # Switches [MTTy] = $1_odeo(MTTx,MTTu,MTTt); mtt_write(MTTt,MTTx,MTTy,$Nx,$Ny); -end; +endfor; # Integration loop EOF Index: mttroot/mtt/bin/trans/mtt_m2p ================================================================== --- mttroot/mtt/bin/trans/mtt_m2p +++ mttroot/mtt/bin/trans/mtt_m2p @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.17 1998/08/27 07:38:40 peterg +## About to change to new integration (Euler/Implicit only) +## ## Revision 1.16 1998/08/19 08:46:00 peterg ## Now translates ; % to # ## ## Revision 1.15 1998/08/15 13:46:01 peterg ## Included new sparse update routines @@ -106,21 +109,14 @@ echo " mttx : StateVector;" echo " mttu : InputVector;" echo " mttt : REAL);" ;; smx) - echo "PROCEDURE $Sys_rep(VAR mtta : StateMatrix;" - echo " VAR mttx : StateVector;" - echo " VAR mttu : InputVector;" - echo " mttdt : REAL);" - ;; - smxx|smxtx) - echo "PROCEDURE $Sys_rep(VAR mttax : StateVector;" - echo " mttx : StateVector;" - echo " mttu : InputVector;" - echo " mttxx : StateVector;" - echo " mttdt : REAL);" + echo "PROCEDURE $Sys_rep(VAR mtta : StateMatrix;" + echo " VAR mttax,mttx : StateVector;" + echo " VAR mttu : InputVector;" + echo " mttdt : REAL);" ;; ode2odes) echo "PROGRAM $Sys_rep;" echo "TYPE" echo " StateVector = ARRAY[1..$Nx] OF REAL;" @@ -223,35 +219,22 @@ } else { if (doing_header==1){ if (rep=="ode2odes"){ - printf("VAR "); - for (k=1;k