Temperature Optimization for Parallel Reaction Selectivity¶
Background¶
In a batch reactor, one feed species can form both a desired product and an unwanted by-product. Temperature changes both reaction rates, but it need not change them equally: the channel with the larger activation energy becomes relatively more important as temperature rises. Heating can therefore improve conversion while degrading selectivity.
This example chooses a smooth heat-hold-cool trajectory for the irreversible parallel network
where \(B\) is desired. The batch must reach 92% conversion in 90 minutes and return to its charging temperature with zero temperature ramp.
Kinetics and dynamic states¶
For channel \(i\in\{B,C\}\), the first-order Arrhenius rate constant is
Let \(c_A,c_B,c_C\) be concentrations. Temperature is represented by a scaled state \(\vartheta\in[0,1]\),
and its physical ramp \(r_T=\dot T\) is also a state. The control is ramp acceleration \(a_T=\dot r_T\). The full dynamics are
The kinetic data are
Because \(E_C>E_B\), high temperature increases the unwanted-to-desired rate ratio \(k_C/k_B\).
Objective and constraints¶
The initial and terminal conditions are
Final \(c_B\) and \(c_C\) are free optimization outcomes. The path bounds are
The objective is
At exactly fixed conversion, conservation gives \(c_B(t_f)+c_C(t_f)=0.92\ \mathrm{mol/L}\), so minimizing \(c_C\) alone would maximize desired yield and the ratio \(c_B/c_C\). The implemented objective is not strictly equivalent to maximum selectivity, because it adds a finite temperature-ramp and ramp-acceleration regularizer. It deliberately trades a small amount of product performance for a smoother thermal program.
Variables and units¶
| Symbol | Meaning | Unit |
|---|---|---|
| \(t\) | Batch time | min |
| \(c_A,c_B,c_C\) | Reactant, desired-product, and by-product concentrations | mol/L |
| \(T,\vartheta\) | Physical and scaled reactor temperature | K, dimensionless |
| \(r_T\) | Temperature ramp | K/min |
| \(a_T\) | Temperature-ramp acceleration | K/min² |
| \(k_B,k_C\) | First-order rate constants | 1/min |
| \(A_B,A_C\) | Arrhenius pre-exponential factors | 1/min |
| \(E_B,E_C\) | Activation energies | J/mol |
| \(J\) | By-product plus smoothness objective | mol/L |
Modeling choices and limits¶
Temperature ramp is a state and ramp acceleration is the control, so both the thermal trajectory and its first derivative are continuous and bounded. A \(200\times2\) Lobatto mesh gives piecewise-linear acceleration samples and resolves the smooth Arrhenius kinetics.
This is an ideal, spatially uniform constant-volume batch model. It assumes irreversible first-order reactions and omits energy balance, heat-transfer area, jacket or heater dynamics, reagent depletion other than \(A\), secondary reactions, volume change, uncertainty, and safety constraints such as heat release. The optimized \(T(t)\) should be read as a set-point trajectory for an ideal thermal actuator, not a complete reactor-control design.
Run the example¶
Save the figure without opening a window:
Independent numerical validation¶
The script reconstructs concentrations, temperature, ramp, and acceleration at 6,001 times. It independently evaluates the exact reactant relation
checks \(c_A+c_B+c_C=c_A(0)\), integrates both product formation rates, checks the temperature-ramp balance, and evaluates every endpoint and path bound.
| Quantity | Verified value |
|---|---|
| Objective \(J\) | \(0.38924799\ \mathrm{mol/L}\) |
| Desired-product yield \(c_B(t_f)/c_A(0)\) | \(0.533074\) |
| Desired/unwanted ratio \(c_B(t_f)/c_C(t_f)\) | \(1.377718\) |
| Conversion | \(0.920000\) |
| Peak temperature | \(320.047293\ \mathrm K\) |
| Maximum analytical reactant error | \(1.819\times10^{-5}\ \mathrm{mol/L}\) |
| Maximum species-conservation error | \(2.220\times10^{-16}\ \mathrm{mol/L}\) |
| Maximum dense product-rate balance error | \(3.319\times10^{-6}\ \mathrm{mol/L}\) |
| Dense temperature-balance error | \(0\) at printed precision |
| Maximum dense path-bound violation | \(0\) at printed precision |

Source code¶
See the complete runnable example:
examples/parallel_reaction_selectivity.py.