# Multiphase Mixtures (jl-type-multiphase)= ::::{describe} MultiPhase() ```julia MultiPhase(phases::AbstractVector{<:Pair{Solution,<:Real}}) ``` A mixture of one or more phases. Construct empty and add phases with [`add_phase!`](#jl-function-add-phase-bang) followed by [`init!`](#jl-function-init-bang), or pass a vector of `solution => moles` pairs to add and initialize in one step. ```julia gas = Solution("gri30.yaml") mix = MultiPhase([gas => 1.0]) set_temperature!(mix, 1200.0); set_pressure!(mix, one_atm) equilibrate!(mix, "TP") ``` :::: (jl-function-add-phase-bang)= ::::{describe} add_phase!(mp::MultiPhase, solution::Solution, moles::Real) Add `solution` to the mixture with the given number of `moles`. Call [`init!`](#jl-function-init-bang) after all phases have been added. :::: (jl-function-init-bang)= ::::{describe} init!(mp::MultiPhase) Finalize the mixture after all phases have been added. Required before any property or equilibrium calculation. :::: (jl-function-update-phases-bang)= ::::{describe} update_phases!(mp::MultiPhase) Synchronize the constituent phase objects with the mixture's current state. :::: (jl-function-n-phases)= ::::{describe} n_phases(mp::MultiPhase) Number of phases in the mixture. :::: (jl-function-set-temperature-bang)= ::::{describe} set_temperature!(mp::MultiPhase, T::Real) Set the mixture temperature [K]. :::: (jl-function-set-pressure-bang)= ::::{describe} set_pressure!(mp::MultiPhase, P::Real) Set the mixture pressure [Pa]. :::: (jl-function-charge)= ::::{describe} charge(mp::MultiPhase) Total electric charge [C/mol] of the mixture. :::: (jl-function-enthalpy)= ::::{describe} enthalpy(mp::MultiPhase) Total enthalpy [J]. :::: (jl-function-entropy)= ::::{describe} entropy(mp::MultiPhase) Total entropy [J/K]. :::: (jl-function-gibbs)= ::::{describe} gibbs(mp::MultiPhase) Total Gibbs free energy [J]. :::: (jl-function-volume)= ::::{describe} volume(mp::MultiPhase) Total volume [m^3]. :::: (jl-function-phase-moles)= ::::{describe} phase_moles(mp::MultiPhase, n::Integer) Number of moles in phase `n` (1-based). :::: (jl-function-set-phase-moles-bang)= ::::{describe} set_phase_moles!(mp::MultiPhase, n::Integer, moles::Real) Set the number of moles in phase `n` (1-based). :::: (jl-function-species-moles)= ::::{describe} species_moles(mp::MultiPhase, k::Integer) Moles of global species `k` (1-based). :::: (jl-function-element-moles)= ::::{describe} element_moles(mp::MultiPhase, m::Integer) Moles of element `m` (1-based). :::: (jl-function-mole-fraction)= ::::{describe} mole_fraction(mp::MultiPhase, k::Integer) Mole fraction of global species `k` (1-based). :::: (jl-function-set-moles-bang)= ::::{describe} set_moles!(mp::MultiPhase, moles) Set the moles of all global species from a numeric vector, or from a composition string (e.g. `"CH4:1, O2:2"`). ::::