DOC PREVIEW
MIT 10 34 - Lecture Notes

This preview shows page 1-2-3-4 out of 13 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 13 pages.
Access to all documents
Download any document
Ad free experience

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/2002TR_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/2002TR_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/2002TR_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/2002TR_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);


View Full Document

MIT 10 34 - Lecture Notes

Documents in this Course
Load more
Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
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 2 2 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?