Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Systems of first-order ODEs can also be solved numerically using similar approaches as for single first-order ODEs, but now all dependent variables must be advanced simultaneously. The methods we use for single first-order ODES can be straightforwardly extended to systems using the explicit-form vector notation y=f(t,y)\vv{y}' = \vv{f}(t, \vv{y}). For example, Euler’s method becomes:

y(t+Δt)y(t)+f(t,y)Δt\vv{y}(t+\Delta t) \approx \vv{y}(t) + \vv{f}(t, \vv{y}) \Delta t

We are “just” adding columns to our calculations!

Example: First-order reaction in a draining tank

A first-order reaction (rate constant k) is taking place in a tank that is initially 1 M concentration in the reactant A and has 10 L of solution. A feed stream that has a reactant concentration of 1 M enters at 1 L / min, while well-mixed solution exits at 2 L / min.

Reactions in draining tank.

Estimate the concentration of A after 1 minute if k=0.5/mink = 0.5/{\rm min}.


Start from an unsteady mole balance on A:

d ⁣nAd ⁣t=n˙A,inn˙A,out+rAV\dd{}{n_{\rm A}}{t} = \dot n_{{\rm A},{\rm in}} - \dot n_{{\rm A},{\rm out}} + r_A V

The number of moles in the tank, the molar flow rate in, and the molar flow rate out are:

nA=cAVn˙A,in=cA,inV˙in=1n˙A,out=cAV˙out=2cA\begin{align} n_{\rm A} &= c_{\rm A} V \\ \dot n_{{\rm A},{\rm in}} &= c_{{\rm A},{\rm in}} \dot V_{\rm in} = 1 \\ \dot n_{{\rm A},{\rm out}} &= c_{\rm A} \dot V_{\rm out} = 2c_A \end{align}

so

d ⁣(VcA)d ⁣t=12cAkcAVVd ⁣cAd ⁣t+cAd ⁣Vd ⁣t=12cAkcAV\begin{align} \dd{}{(Vc_{\rm A})}{t} &= 1 - 2 c_A - k c_A V \\ V \dd{}{c_{\rm A}}{t} + c_{\rm A} \dd{}{V}{t} &= 1 - 2 c_A - k c_A V \end{align}

Since the volume V is changing, write a mass balance on the tank assuming that the solution density ρ\rho does not depend on concentration:

d ⁣md ⁣t=m˙inm˙out\begin{align} \dd{}{m}{t} = \dot m_{\rm in} - \dot m_{\rm out} \end{align}

with the mass in the tank, mass flow rate in, and mass flow rate out:

m=ρVm˙in=ρV˙in=ρm˙out=ρV˙out=2ρ\begin{align} m &= \rho V \\ \dot m_{\rm in} &= \rho \dot V_{\rm in} = \rho \\ \dot m_{\rm out} &= \rho \dot V_{\rm out} = 2 \rho \end{align}

so

d ⁣(Vρ)d ⁣t=ρd ⁣Vd ⁣t=ρd ⁣Vd ⁣t=1\begin{align} \dd{}{(V\rho)}{t} = \rho \dd{}{V}{t} &= -\rho \\ \dd{}{V}{t} &= - 1 \end{align}

Substituting for d ⁣Vd ⁣t\dd{}{V}{t} in the unsteady mole balance and rearranging gives the system of first-order ODES:

d ⁣cAd ⁣t=1V(1cA0.5VcA),cA(0)=1d ⁣Vd ⁣t=1,V(0)=10\begin{align} \dd{}{c_{\rm A}}{t} &= \frac{1}{V} \left(1 - c_A - 0.5Vc_A\right),& c_{\rm A}(0) &= 1 \\ \dd{}{V}{t} &= -1, & V(0) &= 10 \end{align}

Calling y1=cAy_1 = c_{\rm A} and y2=Vy_2 = V:

nntty1y_1y2y_2f1f_1f2f_2
00110-0.5-1
10.20.99.8-0.4398-1
20.40.81209.6-0.3864-1
30.60.73479.4-0.3389-1
40.80.66699.2-0.2972-1
51.0.60759

The concentration after 1 minute is approximately 0.6 M.

Skill builder problems

Solution to Exercise 1

The ODE is already in explicit form, so start solving from the initial condition.

nntty1y_1y2y_2f1f_1f2f_2
001.5001.000-1.0000.500
10.51.0001.250-1.0000.000
21.00.5001.250-0.500-0.625
31.50.2500.938-0.146-0.703
42.00.1770.586-0.020-0.482
52.50.1670.3450.035-0.287
63.00.1840.2010.073-0.164
73.50.2210.1200.112-0.093
84.00.2770.0730.158-0.053
94.50.3560.0460.215-0.030
105.00.4640.032

The final result is y1(5)=0.464y_1(5) = 0.464 and y2(5)=0.032y_2(5) = 0.032.