1function dydt = conuv(t, y, gas, mw) %#ok<INUSL> 2% CONUV ODE system for a constant-volume, adiabatic reactor. 3% 4% Function CONUV evaluates the system of ordinary differential 5% equations for an adiabatic, constant-volume, 6% zero-dimensional reactor. It assumes that the 'gas' object 7% represents a reacting ideal gas mixture. 8 9 10% Set the state of the gas, based on the current solution vector. 11setMassFractions(gas, y(2:end), 'nonorm'); 12set(gas, 'T', y(1), 'Rho', density(gas)); 13nsp = nSpecies(gas); 14 15% energy equation 16wdot = netProdRates(gas); 17tdot = - temperature(gas) * gasconstant * (enthalpies_RT(gas) - ones(nsp,1))' ... 18 * wdot / (density(gas)*cv_mass(gas)); 19 20% set up column vector for dydt 21dydt = [ tdot 22 zeros(nsp, 1) ]; 23 24% species equations 25rrho = 1.0/density(gas); 26for i = 1:nsp 27 dydt(i+1) = rrho*mw(i)*wdot(i); 28end 29