Skip to content

Compare ideal and nonideal organic activity

Download Python script

Compare ideal and nonideal organic activity

Section titled “Compare ideal and nonideal organic activity”

Does a mole fraction alone describe an organic component’s tendency to leave a water mixture? This example compares ideal organic activity with the Binary Activity Thermodynamics (BAT) approximation at three compositions. The diagnostic γ = a/x distinguishes the activity coefficient from activity itself; they are not interchangeable.

BAT uses reduced molecular descriptors to represent organic–water interactions. Its scientific basis and limitations are described by Gorkowski et al. (2019). This example compares model predictions, not a measured compound.

Python · section 1
import numpy as np
import particula as par

The illustrative organic has molar mass 200 g mol⁻¹, O:C = 0.5, and density 1200 kg m⁻³. O:C is held fixed in this page; a claim about its effect would require another sweep. The default functional-group assumption is retained.

Python · section 2
molar_mass_organic = 200.0e-3 # kg/mol
o2c_ratio = 0.5 # oxygen to carbon ratio
density_organic = 1200.0 # kg/m^3
print("=== Organic Properties ===")
print(f"Molar mass: {molar_mass_organic * 1e3:.1f} g/mol")
print(f"O:C ratio: {o2c_ratio}")
print(f"Density: {density_organic} kg/m^3")
=== Organic Properties ===
Molar mass: 200.0 g/mol
O:C ratio: 0.5
Density: 1200.0 kg/m^3

The builder records the descriptors with explicit units. ActivityNonIdealBinary expects the input order [water, organic] and returns the organic activity only. The underlying BAT helper can provide other quantities, but this strategy’s scalar output must not be interpreted as a two-species activity vector.

Python · section 3
non_ideal = (
par.particles.ActivityNonIdealBinaryBuilder()
.set_molar_mass(molar_mass_organic, "kg/mol")
.set_oxygen2carbon(o2c_ratio)
.set_density(density_organic, "kg/m^3")
.build()
)
print(f"Strategy: {type(non_ideal).__name__}")
Strategy: ActivityNonIdealBinary

The ideal strategy uses the same organic molar mass and returns both species’ mole fractions. Compare its organic entry with the BAT scalar. The water molar mass used by the BAT implementation has slightly more precision than the rounded 18.015 g mol⁻¹ reference here; the displayed comparison is correspondingly rounded.

Python · section 4
ideal = par.particles.ActivityIdealMolar(
molar_mass=np.array([18.015e-3, molar_mass_organic]),
)
print(f"Ideal strategy: {type(ideal).__name__}")
Ideal strategy: ActivityIdealMolar

Interpret activity and γ at the same composition

Section titled “Interpret activity and γ at the same composition”

The organic mass fractions are 0.2, 0.5, and 0.8 at total mass 1 µg m⁻³. The saved γ values are approximately 1.34, 0.824, and 0.752: departure from the ideal reference changes with composition and need not always increase activity. A value γ > 1 does not by itself imply a > 1, because activity is γ times mole fraction. No phase-equilibrium or mass-transfer calculation is performed here.

Python · section 5
mass_fractions = np.array([0.2, 0.5, 0.8])
print("=== Ideal vs Non-Ideal Activity Comparison ===")
print(f"Organic O:C ratio: {o2c_ratio}")
print(f"Organic molar mass: {molar_mass_organic * 1e3:.1f} g/mol")
print("Note: BAT model returns organic activity only (scalar)\n")
for org_frac in mass_fractions:
# Mass concentrations: [water, organic]
mass = np.array([1.0 - org_frac, org_frac]) * 1e-9 # kg/m^3
ideal_activity = ideal.activity(mass_concentration=mass)
# BAT model returns only organic activity (scalar)
bat_organic_activity = float(non_ideal.activity(mass_concentration=mass))
print(f"Organic mass fraction: {org_frac:.1f}")
print(
f" Mass conc: water={mass[0] * 1e9:.1f}, "
f"org={mass[1] * 1e9:.1f} ug/m^3"
)
print(
f" Ideal activity: water={ideal_activity[0]:.4f}, "
f"org={ideal_activity[1]:.4f}"
)
print(f" Non-ideal (BAT): org={bat_organic_activity:.4f}")
# Activity coefficient = activity / mole fraction
moles = mass / np.array([18.015e-3, molar_mass_organic])
mole_frac = moles / np.sum(moles)
gamma_organic = bat_organic_activity / mole_frac[1]
print(f" Organic activity coeff (gamma): {gamma_organic:.4f}\n")
=== Ideal vs Non-Ideal Activity Comparison ===
Organic O:C ratio: 0.5
Organic molar mass: 200.0 g/mol
Note: BAT model returns organic activity only (scalar)
Organic mass fraction: 0.2
  Mass conc: water=0.8, org=0.2 ug/m^3
  Ideal activity:     water=0.9780, org=0.0220
  Non-ideal (BAT):    org=0.0295
  Organic activity coeff (gamma): 1.3399
Organic mass fraction: 0.5
  Mass conc: water=0.5, org=0.5 ug/m^3
  Ideal activity:     water=0.9174, org=0.0826
  Non-ideal (BAT):    org=0.0681
  Organic activity coeff (gamma): 0.8244
Organic mass fraction: 0.8
  Mass conc: water=0.2, org=0.8 ug/m^3
  Ideal activity:     water=0.7351, org=0.2649
  Non-ideal (BAT):    org=0.1991
  Organic activity coeff (gamma): 0.7518

Ask whether nonideality changes your conclusion

Section titled “Ask whether nonideality changes your conclusion”

For these descriptors, ideality changes the organic activity in a composition-dependent way. The comparison identifies a model sensitivity, not which prediction is correct for a specific compound.

To extend it, vary O:C while keeping molar mass, functional-group assumptions, and composition fixed, then compare predicted equilibrium partial pressures. Check the chosen descriptor range against the model’s domain and independent data. The activity comparison includes such a sweep; partitioning connects thermodynamics to an equilibrium inventory rather than just a component activity.

Explore this topic: Nonideal mixtures