domingo, 21 de diciembre de 2025

Starting with IDAES: Steady state CSTR

Recently I started using IDAES for simulating chemical engineering processes. For my first example, I choose a CSTR at steady state.

For the following reaction:

$$A \rightarrow B$$

The mass balance equation for \(A\) is:

$$FC_{A,out} = FC_{A,in} - V \cdot k \cdot C_{A,out}$$

Where:

  • \(F\) is the total volumetric flow.
  • \(C_{A}\) is the concentration of component A.
  • \(V\) is the volume.
  • \(k\) is the kinetic constant for a first-order reaction.

The algebraic solution for the value of concentration at the outlet is:

$$C_{A,out} = \frac{C_{A,in}}{1 + (kV/F)}$$

Data

Besides the \(A\) and \(B\) components, an inert \(C\) component was added as a solvent. The data for the simulation is:

$$F_{A,inlet} = 50 \text{ mol/s}$$

$$F_{B,inlet} = 0 \text{ mol/s}$$

$$F_{C,inlet} = 450 \text{ mol/s}$$

Whereas the CSTR and the reaction are defined by the following values:

$$V = 5 \text{ m}^3$$

$$k = 1e-4 \text{1/s}$$

The result for the concentration at the outlet is:

$$C_{A,oulet}=34483 \text{ mol/s}$$


The notebook with the implementation, and the required properties and reaction properties files can be found here:

code




lunes, 15 de diciembre de 2025

The diluted solution approximation for the computation of concentrations

When working with a process simulator, specifying the composition of a stream in terms of mass fractions is the "easiest" approach.

That's because mass is a conserved quantity, so the fraction of a certain "component" of the mixture is the same if the components are accounted for separately, and after they are physically combined in a single stream.

But what if we want to go from mass fraction to, say, concentration by volume?

We have,

$$ \begin{aligned} \text{Conc}_i &= \text{mass}_i / \text{total_volume} \\ &= \text{total_mass} * \text{mass_fraction} / (\text{total_mass} / \text{density}) \\ &= \text{mass_fraction} * \text{density} \end{aligned} $$

So we need and expression for the density of the mixture in terms of the mass fractions (and other state variables), that is, an equation of state.

Here enters the "dilute mixture" approximation. 

Now we say that if the mixture is "dilute", meaning every component but one (called solvent) is present only in small fraction, the density of the mixture is effectively approximated by the solvent density, which is known from an equation of state for the pure solvent, which is expectedly easier to solve than an equation of state for the arbitrary composition of an n-component mixture.

With that we have:

$$ \text{Conc}_i = \text{mass}_i * \text{density_solvent} $$ 

for every component, and we can easily go from mass fraction to volume concentration.



Starting with IDAES: Steady state CSTR