Simulation

After the governing partial differential equations (PDEs) are discretized in space (see Column Models and Unit Operations), the resulting system of Differential-Algebraic Equations (DAEs) can be assembled from all units and connections, and then integrated in time using an implicit or explicit solver.

Differential-Algebraic Equation Formulation

The solver assembles a monolithic DAE system from all units and connections:

dxdt=f(t,x,z,p)\frac{dx}{dt} = f(t, x, z, p)
0=g(t,x,z,p)0 = g(t, x, z, p)

where:

  • xx — differential states (concentrations, bound phase)
  • zz — algebraic states (Danckwerts inlet boundary conditions, detector pass-through)
  • pp — parameters (inlet profile coefficients, constant per phase)
  • tt — time

Differential-Algebraic Equation Assembly

The full DAE is assembled from individual unit contributions:

  1. Topological sort of units based on the connection graph — upstream units are processed before downstream ones.
  2. Per-unit equation building — each unit type contributes its own differential and algebraic states and equations.
  3. Inlet routing — for each unit, the inlet concentration and flow are resolved from upstream connections. When multiple upstream units feed into one unit, concentrations are mixed by flow-weighted average:
cin=kckQkkQkc_{\text{in}} = \frac{\sum_k c_k \cdot Q_k}{\sum_k Q_k}

Time Integration Method

The DAE system is solved using IDAS, an implicit DAE solver that uses a variable-order, variable-step Backward Differentiation Formula (BDF) method with Newton iteration for the nonlinear systems at each time step.

ParameterDefaultDescription
Absolute tolerance10810^{-8}Absolute error tolerance
Relative tolerance10610^{-6}Relative error tolerance
Max steps50,000Maximum internal steps per output interval

The Jacobian matrix is computed via automatic differentiation, preserving the sparsity structure from the finite volume discretization. This makes Newton iteration efficient even for large systems.

Phase-Based Integration

The simulation is divided into phases (sections), each with potentially different:

  • Flow topology (connections between units)
  • Inlet profiles (concentration and flow rate)

For each phase:

  1. A new DAE system is constructed with that phase's connections and inlet profiles.
  2. Initial conditions are taken from the end of the previous phase (or from unit defaults for the first phase).
  3. Integration proceeds over the phase duration.
  4. Results are appended to the output trajectory.

This allows the system topology to change between phases. For example, column switching or different gradient profiles or flow rates at different stages of the process.