Produced using MATLAB software TR 1D model1 SS read solver input Page 1 of 3 TR 1D model1 SS read solver input m TR 1D model1 SS read solver input m function Solver iflag read solver input This procedure reads in from the screen the simulation parameters that control the solver operation New values of these parameters are read every time the program runs even on restarts Kenneth Beers Massachusetts Institute of Technology Department of Chemical Engineering 7 2 2001 Version as of 7 25 2001 function Solver iflag read solver input iflag 0 func name read solver input This integer flag controls the action taken in the case of an assertion failure See the assertion routines for further details i error 2 disp disp disp Enter the parameters for the steady state solver PDL Input Solver max iter time disp disp First enter the maximum number of iterations of the disp implicit Euler method that is used to approach the disp vicinity of the steady state solution If a value of disp 0 is entered then no implicit Euler steps are performed disp and the solver goes directly to Newtons method disp Solver max iter time 7 16 2002 TR 1D model1 SS read solver input Page 2 of 3 check real 1 check sign 2 check int 1 prompt Enter max of time iterations Solver max iter time get input scalar prompt check real check sign check int PDL If Solver max iter time IS NOT 0 THEN if Solver max iter time 0 disp disp Enter data for the time integration stage PDL Input Solver dt check real 1 check sign 1 check int 0 prompt Enter the time step dt t Solver dt get input scalar prompt check real check sign check int PDL Input Solver atol time check real 1 check sign 1 check int 0 prompt Enter the abs tolerance for the time integration Solver atol time get input scalar prompt check real check sign check int Otherwise set dummy values else Solver dt 1 Solver atol time 1 PDL ENDIF end PDL Input data for Newton s method solver Solver max iter Newton Solver atol Newton disp disp Now enter parameters for Newtons method solver Solver max iter Newton check real 1 check sign 2 check int 1 7 16 2002 TR 1D model1 SS read solver input Page 3 of 3 prompt Enter max of Newtons method iterations Solver max iter Newton get input scalar prompt check real check sign check int Solver atol Newton check real 1 check sign 1 check int 0 prompt Enter abs tolerance for Newtons method solver Solver atol Newton get input scalar prompt check real check sign check int PDL Set Solver iflag Adepend to 0 to signify that the A matrix obtained by discretizing the system is not state dependent Solver iflag Adepend 0 PDL Set Solver iflag nonneg to 1 to signify that the components of the state vector should be enforced to be non negative at every iteration of the solution procedure Solver iflag nonneg 1 PDL Input desired value for Solver iflag verbose disp check real 1 check sign 0 check int 0 prompt Solver to be verbose enter 1 or silent other value Solver iflag verbose get input scalar prompt check real check sign check int iflag 1 return 7 16 2002
View Full Document
Unlocking...