Unformatted text preview:

Produced using MATLAB software TR 1D model1 SS read program input Page 1 of 13 TR 1D model1 SS read program input m TR 1D model1 SS read program input m function ProbDim Reactor Physical Rxn Grid iflag read program input This procedure reads in the simulation parameters that are required to define the problem This is done only for an initial simulation and need not be done on a restart For the first version of the program the input is made from the screen so the routine also prints out sufficient information to explain the meaning of each input parameter Kenneth Beers Massachusetts Institute of Technology Department of Chemical Engineering 7 2 2001 Version as of 7 25 2001 function ProbDim Reactor Physical Rxn Grid iflag read program input func name read program input iflag 0 disp disp disp Input the system parameters disp The parameters are input in real units where disp L unit of length disp M unit of mass disp t unit of time disp E unit of energy disp T unit of temperature REACTOR DATA PDL Input first the reactor size and flow rate data Reactor len Reactor dia Reactor Qflow disp 7 16 2002 TR 1D model1 SS read program input Page 2 of 13 disp disp Input the reactor dimensions disp Perform assertion that a real scalar positive number has been entered This is performed by a function assert scalar that gives first the value and name of the variable the name of the function that is making the assertion and values of 1 for the three flags that tell the assertion routine to make sure the value is real positive and not to check that it is an integer Reactor len check real 1 check sign 1 check int 0 prompt Input the length of the reactor L Reactor len get input scalar prompt check real check sign check int Reactor dia check real 1 check sign 1 check int 0 prompt Input the diameter of the reactor L Reactor dia get input scalar prompt check real check sign check int Reactor Qflow check real 1 check sign 1 check int 0 prompt Input the volumetric flow rate L 3 t Reactor Qflow get input scalar prompt check real check sign check int PDL Calculate other static reactor properties reactor volume reactor cross area reactor surf area reactor velocity Reactor cross area pi 4 Reactor dia Reactor dia Reactor surf area pi Reactor dia Reactor len Reactor volume Reactor cross area Reactor len Reactor velocity Reactor Qflow Reactor cross area PDL Input reactor coolant variables Reactor Temp cool Reactor U HT disp Reactor Temp cool check real 1 check sign 1 check int 0 prompt Input the jacket coolant temperature T 7 16 2002 TR 1D model1 SS read program input Page 3 of 13 Reactor Temp cool get input scalar prompt check real check sign check int Reactor U HT check real 1 check sign 1 check int 0 prompt Input the jacket heat transfer coefficient E t L 2 T Reactor U HT get input scalar prompt check real check sign check int PDL Input number of species ProbDim num species disp disp ProbDim num species check real 1 check sign 1 check int 1 prompt Input the number of species ProbDim num species get input scalar prompt check real check sign check int PDL Input reactor inlet properties Reactor conc in Reactor Temp in disp disp disp Input the inlet concentrations mol L 3 and temperature T disp Reactor conc in linspace 0 0 ProbDim num species for ispecies 1 ProbDim num species Reactor conc in ispecies check real 1 check sign 2 check int 0 prompt Enter inlet concentration of species int2str ispecies Reactor conc in ispecies get input scalar prompt check real check sign check int end disp Reactor Temp in check real 1 check sign 1 check int 0 prompt Enter temperature of inlet Reactor Temp in get input scalar prompt 7 16 2002 TR 1D model1 SS read program input Page 4 of 13 check real check sign check int PHYSICAL DATA PDL Input physical data Physical diffusivity Physical density Physical Cp Physical thermal conductivity Physical diffusivity linspace 0 0 ProbDim num species disp disp disp Next input the diffusivities of each species L 2 t disp for ispecies 1 ProbDim num species Physical diffusivity ispecies check real 1 check sign 2 check int 0 prompt Input diffusivity of species int2str ispecies Physical diffusivity ispecies get input scalar prompt check real check sign check int end disp Physical density check real 1 check sign 1 check int 0 prompt Input density of medium M L 3 Physical density get input scalar prompt check real check sign check int disp Physical Cp check real 1 check sign 1 check int 0 prompt Input heat capactity of medium E T Physical Cp get input scalar prompt check real check sign check int disp Physical thermal conduct check real 1 check sign 1 check int 0 prompt Input thermal conductivity of medium E t L T 7 16 2002 TR 1D model1 SS read program input Page 5 of 13 Physical thermal conduct get input scalar prompt check real check sign check int PDL Set Physical thermal diff equal to thermal conductivity density Cp Physical thermal diff Physical thermal conduct Physical density Physical Cp REACTION DATA PDL Input the number of reactions ProbDim num rxn disp disp disp Now enter the kinetic data for the reaction network disp disp ProbDim num rxn check real 1 check sign 1 check int 1 prompt Enter the number of reactions ProbDim num rxn get input scalar prompt check real check sign check int PDL Input the reaction data one by one for each reaction Rxn stoich coeff Rxn is rxn elementary Rxn ratelaw exp Rxn k ref Rxn T ref Rxn E activ Rxn delta H allocate a structure for the reaction data Rxn stoich coeff zeros ProbDim num rxn ProbDim num species Rxn ratelaw exp zeros ProbDim num rxn ProbDim num species Rxn is rxn elementary linspace 0 0 ProbDim num rxn Rxn k ref linspace 0 0 ProbDim num rxn Rxn T ref linspace 0 0 ProbDim num rxn Rxn E activ linspace 0 0 ProbDim num rxn Rxn delta H linspace 0 0 ProbDim num rxn disp disp disp Now enter the kinetic data for each reaction 7 16 2002 TR 1D model1 SS read program input Page 6 of 13 disp for irxn 1 ProbDim num rxn We use a while loop to repeat the process of inputing the reaction network until we accept it This is because inputing the kinetic data is most prone to error iflag accept Rxn 0 while iflag accept Rxn 1 disp disp disp disp Enter kinetic data for reaction int2str irxn disp disp Stoichiometric coefficients disp for ispecies 1 ProbDim num species Rxn stoich coeff irxn ispecies check real 1 check sign 0 check int 0 prompt Enter stoich coeff for species int2str ispecies Rxn stoich coeff irxn ispecies get input scalar prompt check real check sign check int


View Full Document

MIT 10 34 - Lecture Notes

Documents in this Course
Load more
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?