Model activities and phase equilibrium with AIOMFAC
How much water will a particle take up when it contains both an organic compound and a salt? Dissolved ions and organics change the activity of water, and the mixture may separate into liquids of different composition. AIOMFAC calculates the activity of each exchanging species in the liquid. To predict water uptake, you also need to specify how much water is available or what humidity the surrounding air maintains.
The water–alcohol–salt example shows how to distinguish those calculations. If your question is how much salt dissolves, go to the crystal and ion mass balance. For mixtures that can use a simpler activity model, see the activity guide.
AIOMFAC in native isothermal condensation
Section titled “AIOMFAC in native isothermal condensation”Install Particula with its optional backend using
python -m pip install "particula[aiomfac]". The backend source distribution
also includes instructions for installing the paired development wheels and an
executable example for a closed water inventory.
Configure ActivityFactory().get_strategy("aiomfac", parameters) with a
MixtureSpec describing all dissolved organics and fully dissociated salts.
Use material_mapping to associate each participating material index with its
component name, and inert_indices for inert materials. Include dissolved
components that stay in the particle because they affect the activity of the
exchanging species. The gas species map selects which neutral material can
exchange. Each CPU rate evaluation uses the particle’s current liquid
composition and its temperature in kelvin.
The standalone calculator reports neutral activities on the mole-fraction scale and ion activity coefficients on the molality scale. Mixtures with bisulfate or closed carbonate equilibria require a speciation solver.
Stable liquids and gas–particle equilibrium
Section titled “Stable liquids and gas–particle equilibrium”Native simulations default to one homogeneous liquid (phase_mode="single_liquid").
Choose "stable" when the liquid may separate during condensation or a parcel
calculation. The model evaluates the activities directly at the current
composition and temperature, assuming that the liquids equilibrate instantly.
The particle still stores one total mass per material. Coexisting liquids share
the same neutral chemical potential at each gas exchange step, and the transport
model applies its own curvature correction.
Consider water, 2-propanol and ammonium sulfate at 303.15 K. First hold all
three masses fixed at 0.40, 0.42 and 0.18 in a common mass unit.
phase_equilibrium finds how the materials divide between liquids, and
activities_at_temperature gives their equilibrium water activity. Both calls
take masses in native material order.
Now keep the same temperature and alcohol-to-salt mass ratio, but let water
exchange with air at 77% relative humidity. In strategy.solve, supply
the alcohol and salt inventories as 7 and 3 µg/m³. Only water has a
pure-vapor saturation concentration (also in µg/m³), so both dry materials
remain condensed. The solver determines the water inventory needed to reach
the imposed humidity.
from particula.equilibria import EquilibriaFactoryfrom particula.particles import ActivityFactoryfrom particula_aiomfac import MixtureSpec
groups = { "water": {16: 1}, "2-propanol": {141: 2, 151: 1, 153: 1}, "ammonium sulfate": {204: 2, 261: 1},}activity = ActivityFactory().get_strategy("aiomfac", { "mixture": MixtureSpec(groups), "material_mapping": dict(enumerate(groups)), "phase_mode": "stable",})liquids = activity.phase_equilibrium([0.40, 0.42, 0.18], 303.15)water_activity = activity.activities_at_temperature( [0.40, 0.42, 0.18], 303.15, ["water"])strategy = EquilibriaFactory().get_strategy( "liquid_vapor", {"activity_model": activity})result = strategy.solve( inventories=[0.0, 7.0, 3.0], temperature=303.15, saturation_concentrations={"water": 3.03e7}, relative_humidity=0.77,)The fixed mixture forms two liquids with a common water activity of about
0.770. Inspect liquids.alpha_masses and liquids.beta_masses in the input
material order. Each liquid holds about half the water, but one holds about
95% of the alcohol and the other about 75% of the salt. Equal water activity
can therefore coexist with quite different compositions.
In the humidity-controlled calculation, the particle phases take up about
6.67 µg/m³ of water in total. Sum result.water_content to recover that
amount. The gas also takes up about 23.33 g/m³ of water vapor from the
reservoir. Consequently, result.water_exchanged is positive and reports
approximately 2.3331 × 10⁷ µg/m³ for the combined gas and liquids. To close the water budget,
omit relative_humidity and supply the total water inventory. List every
exchanging neutral, including water, in saturation_concentrations.
Inspect the convergence diagnostics before interpreting the phase amounts,
per-phase chemistry and gas inventories. If result.liquids is None,
check result.solid_liquid for crystals or dry ions. When no condensed
material remains, the gas contains all the mass.
Standalone equilibrium defaults to stable liquids. With execution="cuda",
the standalone bulk solver controls the reservoir calculation on the host and
evaluates liquids on the device. Native resident condensation and parcel
calculations keep the phase search on the device. The search requires a
dissolved mixture and admits at most two liquids. Check solver failures for
states outside that range. Liquid equilibrium assumptions
To see the effect of the water boundary condition, compare the humidity sweep with the closed evaporating droplet. The humidity ramp for 1,000 individual droplets follows particles with different compositions.
Follow salt mass into dissolved ions and back into crystals
Section titled “Follow salt mass into dissolved ions and back into crystals”Start with the form of the salt you measured. SpeciesInventory takes
physical mass concentrations in µg/m³ of air. For solid NaCl, enter its mass
in solids. For dissolved NaCl, enter the separate masses of Na⁺ and Cl⁻
in liquid_ions under AIOMFAC IDs 202 and 242. Assign each mass once across
the solid, liquid-neutral, liquid-ion, gas, surface-ion and dry-residual-ion
fields.
The example puts 1 µg/m³ of halite in 1,000 µg/m³ of liquid water at 298.15 K. Read the solid and liquid-ion inventories together to see where the salt went.
from particula.particles import ActivityFactoryfrom particula_aiomfac import MixtureSpec, SpeciesInventory
groups = {"water": {16: 1}, "NaCl": {202: 1, 242: 1}}salt_model = ActivityFactory().get_strategy("aiomfac", { "mixture": MixtureSpec(groups), "material_mapping": dict(enumerate(groups)), "phase_mode": "stable", "solids": {"NaCl": "halite"},})state = salt_model.equilibrate_species( species_inventory=SpeciesInventory( liquid_neutrals={"water": 1000.0}, solids={"NaCl": 1.0}, ), temperature=298.15,)print(state.inventory.solids, state.inventory.liquid_ions)The amount of liquid water determines how much salt remains crystalline in
this example. With 1,000 µg/m³ of water, all the halite dissolves. The
0.393375 µg/m³ of sodium and 0.606625 µg/m³ of chloride account for the
original 1 µg/m³ of salt. Repeat the calculation with "water": 1.0, keeping
the salt loading and temperature fixed. About 0.639611 µg/m³ of halite now
remains crystalline.
Use inventory.total_mass to check conservation across phases. The analytical
feed and phase diagnostics describe the same mass. At complete dry-out, an
ion with insufficient counterion or no specified mineral remains in
residual_ions; include that field when tracing where the salt went.
Include a finite gas inventory
Section titled “Include a finite gas inventory”Pass gas_reactions and declare the aqueous constituents in the mixture.
The supplied HCL_298 and NH3_298 reactions in
particula_aiomfac.reservoirs apply at 298.15 K. Each GasReaction
specifies stoichiometry, the natural logarithm of the equilibrium constant,
temperature, reference pressure and signed gas charge.
Charged transfer also requires an IonSurface with measured or explicitly
assumed binding constants, site capacity in mol/m³ of air and capacitance in
F/m³ of air. The equilibrium gas-ion amount depends on these electrochemical
inputs. Include the returned interfacial and gas populations when checking
charge balance.
Apply the closed solve to a native particle population
Section titled “Apply the closed solve to a native particle population”Pass species_layout=SpeciesLayout(...) and species_options={...} to
Equilibria(strategy, ...). Map each physical material exactly once, with
separate materials for the solid and dissolved ions. Select one internally
mixed population per box and reserve two slots so the runnable can represent
a fractional mean charge using adjacent integer charge states.
Native kinetic condensation and parcel transport exchange the configured
neutral vapors. The species runnable handles ions, crystals and charged gases
in an instantaneous equilibrium step. After the step, inspect
aerosol.equilibria_result for each box’s report.
Select the carbonate reference
Section titled “Select the carbonate reference”For stable carbonate calculations, set "carbonate_model": "gibbs_consistent"
in the activity factory parameters. This extension uses a molal reference for
dissolved CO₂ and includes the corresponding ion and solvent chemical
potentials. If the gas species map includes CO₂, use its Henry-law pressure
at unit molal activity to convert activity to partial pressure. Supply gas
equilibrium constants on the same reference. Historical single-liquid
calculations use the default "pinned" carbonate model. Phase stability and
the carbonate extension both require direct evaluation.
Carbonate derivation
Related studies
Section titled “Related studies”- Water and organic exchange in a closed box
- Which of 1,000 drying droplets first separate into two liquids?
Explore this topic: Nonideal mixtures · Chemical activity