You are on page 1of 17

CE30240 – Advanced Process Modelling

Intro and solving second order ODEs

Prof Tina Düren


t.duren@bath.ac.uk
Welcome!

Tina Düren Stuart Scott Jon Noble


MATLAB sessions MATLAB sessions
Where we left off in CE20236 (PDMC)
Explosion after runaway reaction at T2 Runaway reaction during the production of
laboratories (21/22) nitroaniline (20/22)

• Covered different numerical methods for chemical engineering problem solving

• Modelled explosion due to runaway reaction

• Ran different what-if scenarios to investigate the cause of the explosion to find out how it could
have been prevented
What we will do in CE30240 – Advanced Process
Modelling
• Three more tools to solve chemical engineering problems
𝑑 2 𝐶𝐴 2 𝑑𝐶𝐴 𝑘𝑛 𝑛
• Week 1 - Second order ODEs 𝑑𝑟 2
+ − 𝐶 =0
𝑟 𝑑𝑟 𝐷𝑒 𝐴

𝑑2𝑇
• Week 2 - Boundary value problems 𝑘 2
𝑑𝑧
4
= ℎ (𝑇 − 𝑇air )
𝐷

𝜕𝐶𝐴 𝜕 2 𝐶𝐴
• Week 3 -Partial differential equations 𝜕𝑡
= 𝐷𝐴𝐵
𝜕𝑧 2
− 𝑘𝐶𝐴

• Coursework design based


• Use MATLAB as a tool
• Focus is on design
In addition we will revisit & explore model building

10-9 m 102 m
Molecular level Plant level

• What do you want to model?


• What is the right model for your purpose?
• What assumptions do you want to / have to make?
Mathematical Models in Chemical Engineering

Mathematical models
in Chemical Engineering

Improve our Can be used in R&D,


understanding training and education
of complex systems
Use for sensitivity Assist in experiment
Help to predict analysis, parameter design and troubleshooting
the design and estimation, scaling and
control variables optimisation

Modelling and simulation are valuable tools since it is much safer and cheaper to perform tests on the
model using computer simulations rather than carrying out repetitive experimentation and
observations on the real system, provided that the model used is VALIDATED.
Relation of this material to your other topics

Transport
phenomena
Mass and energy Thermodynamics
balances

Reaction Mathematical
kinetics Modelling Mathematics,
in Chemical numerical techniques
Engineering and computing

Economics

Environmental
Process engineering
control Material
science
How does it work?

Advanced process modelling

Lectures Prework / MATLAB workshops Coursework sessions


Monday, 10:15 Independent Wednesday, 11:15 Monday 12:15 – 14:05
Week 1 – 3 Learning Week 1 - 3 Week 4, 5, 7, 8

Whenever suits
you Advanced Chemical Two LOIL drop-
Background for Dedicated time
MATLAB Engineering problem in sessions in
computing to work on your
background for solving using MATLAB week 6 and end
workshops coursework
the computing as a tool of week 8
sessions
You said … we did

• High workload in semester 1


• Now dedicated 2 h sessions in week 4, 5, 7 & 8
• Coursework will be done in pairs
• More guidance on time management for coursework

• Stronger focus on chemical engineering applications


• No separate maths lectures

• From colleagues: when is MATLAB the right tool to use


Reminder: Classification of differential equations
Example 1: 3-dimensional heat conduction

T =Temperature = f(x,y,z,t)

y
2 2 2
𝜕 𝑇 𝜕 𝑇 𝜕 𝑇 𝜕𝑇
𝑘 2 + 𝑘 2 + 𝑘 2 = 𝜌𝐶𝑣 y
𝜕𝑥 𝜕𝑦 𝜕𝑧 𝜕𝑡 x
z
z Cartesian Coordinates
x

What are the:


• dependent variables?
• independent variables?
Linear or non-linear?
ODE or PDE?
Reminder: Classification of differential equations
Example 2: Heat loss in a rod
Heat loss Tair
T = f(z)
T(z) T(L)=T2
T(0) = T1
z z=L
z=0 Heat loss

At steady state the temperature changes within the rod as a function of z can be described as:

𝑑2𝑇
𝑘 2 = ℎ𝐴 𝑇 − 𝑇𝑎𝑖𝑟
𝑑𝑧
a) What are the dependent/independent variables of this system?

b) Is this is an initial or boundary value problem?

c) How many initial or boundary conditions do we need to solve this equation?


Other examples of 2nd order ODEs in ChemEng
CE30240 – Chemical Reaction Engineering (Antonio Exposito)

Topic 4: Reaction and diffusion in a spherical catalyst particle

𝑑2 𝐶𝐴 2 𝑑𝐶𝐴 𝑘𝑛 𝑛
2
+ − 𝐶𝐴 = 0
𝑑𝑟 𝑟 𝑑𝑟 𝐷𝑒

Topic 5: Mass transfer and reaction in a packed bed

𝑑2 𝐶𝐴𝑏 𝑑𝐶𝐴𝑏
𝐷𝑎 2
+𝑈 − Ω𝑘1 𝐶𝐴𝑏 = 0
𝑑𝑧 𝑑𝑧
How to convert a 2nd order ODE to a system of 1st order ODEs

𝑑2 𝑥 𝑑𝑥
2
+2 − 3𝑥 = 0
𝑑𝑡 𝑑𝑡
𝑑𝑥
Let’s set 𝑣 =
𝑑𝑡
𝑑𝑣
+ 2𝑣 − 3𝑥 = 0
𝑑𝑡

Two coupled, first order ODEs

Use ode45 (or ode15s) to solve

But first convert ODEs into standard form


for MATLAB
𝑑𝑥 𝑑𝑣
= 𝑣, = −2𝑣 + 3𝑥
𝑑𝑡 𝑑𝑡
How to convert a 2nd order ODE to a system of 1st order ODEs
MATLAB implementation
𝑑𝑥 𝑑𝑣 With x(t = -1) = 5 and dx/dt(t = -1) = -5
= 𝑣, = −2𝑣 + 3𝑥
𝑑𝑡 𝑑𝑡
x_0 = 5;
deriv_0 = -5;

t_span = [-1 0.5];

U_ini = [x_0 deriv_0];

[t,U] = ode45(@example_lec1,t_span, U_ini);

function dUdt = example_lec1(t,U)


x = U(1);
v = U(2);
dxdt = v;
Remember that the order of the variables for the initial condition (U_ini), the
dvdt = -2*v+3*x;
input to the function (U) and the output from the function (dUdt) needs to be the
dUdt = [dxdt;dvdt];
same.
end
Over to you
Heat loss Tair

𝑑2𝑇 T(0) = 313 K


T(L) = 473 K
𝑘 2 = ℎ𝐴 𝑇 − 𝑇𝑎𝑖𝑟 z=0
𝑑𝑧 z z=L=0.1 m
Heat loss

• Convert the second order ODE into a system of two first order ODEs
• What are the two boundary values for this problem?
• MATLAB requires “initial” values (i.e. at z = 0). What can we do?
Wednesday’s problem
A glass tube is originally filled with pure liquid B and exposed to the surroundings filled
with gas A. As the gas is present in large excess its concentration remains constant at
CA0 = 0.2 kmol / m3. The diffusivity of gas A in liquid B is DAB = 1.2 × 10-9 m2 /s and the
liquid level in the tube is L = 10-3 m. Once A diffuses into the liquid, it reacts with B.

𝜕𝐶𝐴 𝜕 2 𝐶𝐴 𝑛
= 𝐷𝐴𝐵 − 𝑘𝐶𝐴
𝜕𝑡 𝜕𝑧 2

Prework: Remind yourself how to solve systems of ODEs with ode45.


Recommended text book

Not yet available in the Library

You might also like