Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %script file to solve tank's in series (assignment question 1)
- %ModellingAssignmentFns contains the ODE's
- %Definition of global variables
- global t
- global M1 % Mass in tank 1 kg
- global M2 % Mass in tank 2 kg
- global cp % Specific heat capacity of reactant J.kg-1 °C-1
- global T1 % Temperature in tank 1 °C
- global T2 % Temperature in tank 2 °C
- global THi % Temperature of jacket fluid in °C
- global THo % Temperature of jacket fluid out °C
- global THm % Temperature of jacket between tank 1 and 2 °C
- global E % Activation energy J.mol-1
- global R % Ideal gas constant J.mol-1K-1
- global k % Rate constant (mol.kg-1)1-n s-1
- global T1i % Initial temperature in tank 1 °C
- global T2i % Initial temperature in tank 2 °C
- global F % Flowrate between tanks kg.s-1
- global q % Flowrate of heating fluid in jackets kg.s-1
- global cpw % Specific heat capacity of heating fluid J.kg-1 °C-1
- global C1 % Concentration in tank 1 mol.kg-1
- global C2 % Concentration in tank 2 mol.kg-1
- global Cf % Feed concentration to tank 1 mol.kg-1
- global UA % Overall htc jacket to tanks W.m-2°C-1
- global C1i % Initial concentration in tank 1 mol.kg-1
- global C2i % Initial concentration in tank 2 mol.kg-1
- % Quantify variables
- % t time s
- M1 = 50; % Mass in tank 1 kg
- M2 = 50; % Mass in tank 2 kg
- cp = 4180; % Specific heat capacity of reactant J.kg-1 °C-1
- E = 50; % Activation energy J.mol-1
- R = 8.314; % Ideal gas constant J.mol-1K-1
- F = 100/60/10; % Flowrate between tanks kg.s-1
- q = 100; % Flowrate of heating fluid in jackets kg.s-1
- cpw = 4180; % Specific heat capacity of heating fluid J.kg-1 °C-1
- Cf = 20; % Feed concentration to tank 1 mol.kg-1
- UA = 50; % Overall htc jacket to tanks W.m-2°C-1
- % Define the simulation time
- tSpan = 60;
- tStop = 3600;
- % Initial conditions
- T1i = 20; % Initial temperature in tank 1 °C
- T2i = 20; % Initial temperature in tank 2 °C
- C1i = 50; % Initial concentration in tank 1 mol.kg-1
- C2i = 50; % Initial concentration in tank 2 mol.kg-1
- [t, T1, T2, C1, C2] = ode45('ModellingAssignment1BFuns', [0:tSpan:tStop], [t, T1i, T2i, C1i, C2i]);
- % Plot the graphs
- % Once we have the solutions to the ODEs, this bit should be easy.
Add Comment
Please, Sign In to add comment