You are on page 1of 3

% PSR Reactor % Constant Volume % Adiabatic % % % % Create three reservoirs: - Fuel - Air - Igniter (radicals to initiate chemical reactions)

close all; clear all; for f=1:51 % Make the fuel a simple hydrocarbon from the GRI Mechanism fuel = GRI30; % propane (C3H8) set(fuel, 'T', 298, 'P', oneatm, 'X', 'H2:1.0'); % I can get the molecular weight of the fuel (particularly useful if it's a mixture): fuel_mw = meanMolecularWeight(fuel); % <-- Discovered using "methods Solution -full" command fuel_in = Reservoir(fuel); % Make the oxidizer air oxidizer = air(); % Use default air composition (defined in air.cti) set(oxidizer, 'T', 298, 'P', oneatm); oxidizer_mw = meanMolecularWeight(oxidizer); oxidizer_in = Reservoir(oxidizer); % Make the igniter a bunch of radicals that will initiate combustion % reactions igniter = GRI30; set(igniter, 'T', 298, 'P', oneatm, 'X', 'H:1.0'); igniter_in = Reservoir(igniter); % Now create the combustor, and fill it with inert gas to begin with inert = GRI30; set(inert, 'T', 298, 'P', oneatm, 'X', 'N2:1.0'); inert_exhaust = GRI30; set(inert, 'T', 298, 'P', oneatm, 'X', 'N2:1.0'); % Now fill the CSTR and the exhaust reservoir with inert nitrogen combustor = Reactor(inert); setInitialVolume(combustor ,67.4e-3); exhaust = Reservoir(inert_exhaust);

m1 = MassFlowController(oxidizer_in, combustor); m2 = MassFlowController(fuel_in, combustor); m3 = MassFlowController(igniter_in, combustor); exhaust_valve = Valve(combustor,exhaust); % Set equivalence ratio ER = 1; % This could be made into a for loop...

facmat=0.05:0.001:0.1;

factor = facmat(f); fuel_mdot = factor*fuel_mw*ER; % Compute air mass flowrate % 1 mol H2 = 0.5 mol O2 (@ stoich. conditions) oxidizer_mdot = factor*0.5*(1/.21)*oxidizer_mw; % Igniter m_dot could be a function (gaussian or polynomial, % type "help Func" for more info), but this doesn't seem to be working... %igniter_mdot = Func('gaussian',0,[1.0, 0.0, 0.1] ); %igniter_mdot = Func('polynomial',2.0,[0.0,0.0,0.1]); % Since I can't make it a function, I'll just make it constant igniter_mdot = 0.005; % Now create the mass flowrate controllers feeding into the combustor setMassFlowRate(m1, oxidizer_mdot);

setMassFlowRate(m2, fuel_mdot);

setMassFlowRate(m3, igniter_mdot); % And create an exhaust valve regulating the pressure in the combustor setValveCoeff(exhaust_valve,1.0); % Now the reactor network can be created network = ReactorNet( {combustor} ); % Advance in time t = 0.0; dt = 1.0e-2; for n=1:100 t = t + dt; advance(network, t); tim(n) = time(combustor); temp(n) = temperature(combustor); press(n) = pressure(combustor); x(n,1:7) = moleFraction(inert,{'OH','H','H2','O2','NO','H2O','O'}); end fuelmdot1(f)=fuel_mdot; temp1(f) = temp(10); press1(f) = press(10); x1(f,1:7) = x(10,1:7); f end subplot(2,1,1);

plot(fuelmdot1,temp1,'.'); xlabel('fuel mass flow rate'); ylabel('Temperature (K)'); subplot(2,1,2) plot(fuelmdot1,press1,'*'); xlabel('fuel mass flow rate'); ylabel('Pressure (Pa)');

You might also like