19  Dynamic Simulation

Dynamic simulation tracks the time evolution of process variables by integrating differential-algebraic equations (DAEs). This is essential for studying startup, shutdown, disturbance response, and control system design.

19.1 DAE Formulation

A general process model is a system of differential-algebraic equations:

\[ \dot{x} = f(x, y, t) \]

\[ 0 = g(x, y, t) \]

where \(x\) are differential variables (e.g., component holdups \(M_{x,i}\)) and \(y\) are algebraic variables (temperatures, compositions, flows, enthalpies).

19.1.1 Index

The differentiation index of a DAE is the number of times the algebraic constraints must be differentiated to obtain an ODE system. Process simulation models are typically index-1, meaning one differentiation suffices.

Higher-index DAEs arise when algebraic constraints involve derivatives of differential variables. Index reduction techniques (e.g., Pantelides algorithm) convert them to index-1 form.

19.2 Conservation Forms

Dynamic models of process equipment use conservation laws as the basis for differential equations.

19.2.1 Material Balance

\[ \frac{dn_i}{dt} = \sum_k F_{in,k} z_{in,k,i} - \sum_k F_{out,k} z_{out,k,i} + V_R \sum_j \nu_{ij} r_j \]

19.2.2 Energy Balance

For systems where energy accumulation matters (reactors, flash drums):

\[ \frac{dU}{dt} = \sum_k F_{in,k} H_{in,k} - \sum_k F_{out,k} H_{out,k} + Q + \dot{W} \]

where \(U\) is the total internal energy of the system.

For distillation stages, the quasi-steady-state (QSS) approximation is standard: the energy balance is written as an algebraic equation (0 = energy in − energy out), since the thermal time constant is much shorter than the composition time constant. See the Distillation chapter for details.

19.2.3 State Variable Choice

Using total component holdups \(n_i\) (or \(M_{x,i}\)) as state variables (rather than mole fractions) produces equations in natural conservation form. Whether the energy state is differential or algebraic depends on the application — for distillation, the QSS (algebraic) formulation is preferred; for reactors and flash drums, the differential energy balance is appropriate.

19.3 Time Integration

19.3.1 Stiff Systems

Chemical process models are typically stiff — they contain a wide range of time scales (fast thermodynamic equilibration vs. slow holdup dynamics). Explicit methods require impractically small time steps.

19.3.2 Implicit Methods

Implicit methods (BDF, Rosenbrock, SDIRK) solve a nonlinear system at each time step and can take large steps on stiff problems:

Backward Differentiation Formula (BDF):

\[ \sum_{j=0}^{k} \alpha_j x_{n-j} = h \beta_0 f(x_n, t_n) \]

Rosenbrock methods linearize the implicit equations, requiring only one Jacobian evaluation and linear solve per step.

19.3.3 Steady-State via Dynamic Relaxation

A steady-state solution can be found by integrating the dynamic equations until all time derivatives vanish:

\[ \|\dot{x}\| < \varepsilon \]

This is pseudo-transient continuation. It combines the robustness of time integration with the goal of steady-state solving.

19.4 Events and Discontinuities

Process models often contain discontinuities:

  • Valve opening/closing
  • Controller setpoint changes
  • Feed composition disturbances
  • Equipment switching

These are handled as discrete events that interrupt the continuous integration, modify the system state, and restart the integrator.

19.4.1 Callback Structure

An event is defined by:

  • Condition: A function that crosses zero at the event time
  • Affect: A function that modifies the system state when the event occurs

19.5 References

  • Brenan, K.E., Campbell, S.L. & Petzold, L.R. (1996). Numerical Solution of Initial-Value Problems in Differential-Algebraic Equations. SIAM.
  • Hairer, E. & Wanner, G. (1996). Solving Ordinary Differential Equations II: Stiff and Differential-Algebraic Problems. Springer.
  • Pantelides, C.C. (1988). The consistent initialization of differential-algebraic systems. SIAM Journal on Scientific and Statistical Computing, 9(2), 213–231.