Reaktoro  v2.0.0 A unified framework for modeling chemically reactive systems
ChemicalState Class Reference

The chemical state of a chemical system. More...

#include <ChemicalState.hpp>

## Classes

class  Equilibrium
The access to the properties related to an equilibrium state in a ChemicalState object. More...

## Public Member Functions

ChemicalState (const ChemicalSystem &system)
Construct a ChemicalState instance with standard conditions. More...

ChemicalState (const ChemicalState &other)
Construct a copy of a ChemicalState instance.

virtual ~ChemicalState ()
Destroy this ChemicalState instance.

auto operator= (ChemicalState other) -> ChemicalState &
Assign a ChemicalState instance to this instance.

auto temperature (real value) -> void
Set the temperature of the chemical state. More...

auto temperature (real value, String unit) -> void
Set the temperature of the chemical state with given unit. More...

auto pressure (real value) -> void
Set the pressure of the chemical state. More...

auto pressure (real value, String unit) -> void
Set the pressure of the chemical state with given unit. More...

auto add (String species, real value, String unit) -> void
Add a specified amount or mass of a chemical species in the chemical state. More...

auto add (Index ispecies, real value, String unit) -> void
Add a specified amount or mass of a chemical species in the chemical state. More...

auto set (String species, real value, String unit) -> void
Set a specified amount or mass of a chemical species in the chemical state. More...

auto set (Index ispecies, real value, String unit) -> void
Set a specified amount or mass of a chemical species in the chemical state. More...

auto setTemperature (real value) -> void
Set the temperature of the chemical state. More...

auto setTemperature (real value, String unit) -> void
Set the temperature of the chemical state with given unit. More...

auto setPressure (real value) -> void
Set the pressure of the chemical state. More...

auto setPressure (real value, String unit) -> void
Set the pressure of the chemical state with given unit. More...

auto setSpeciesAmounts (real value) -> void
Set the amounts of all species in the chemical state to a common value (in mol).

auto setSpeciesAmounts (ArrayXrConstRef n) -> void
Set the amounts of the species in the chemical state (in mol).

auto setSpeciesAmounts (ArrayXdConstRef n) -> void
Set the amounts of the species in the chemical state (in mol).

auto setSpeciesAmount (StringOrIndex species, real amount, String unit) -> void
Set the amount of a species in the system. More...

auto setSpeciesMass (StringOrIndex species, real mass, String unit) -> void
Set the mass of a species in the system. More...

auto scaleSpeciesAmounts (real scalar) -> void
Scale the amounts of every species by a given scalar. More...

auto scaleSpeciesAmountsInPhase (StringOrIndex phase, real scalar) -> void
Scale the amounts of the species in a phase by a given scalar. More...

auto scaleVolume (real value, String unit) -> void
Scale the volume of the system by adjusting the amounts of its species equally. More...

auto scalePhaseVolume (StringOrIndex phase, real value, String unit) -> void
Scale the volume of a phase by adjusting the amounts of its species equally. More...

auto scaleFluidVolume (real value, String unit) -> void
Scale the total volume of fluids in the system by adjusting the volumes of fluid phases equally. More...

auto scaleSolidVolume (real value, String unit) -> void
Scale the total volume of solids in the system by adjusting the volumes of solid phases equally. More...

auto scaleMass (real value, String unit) -> void
Scale the mass of the system by adjusting the amounts of its species equally. More...

auto scalePhaseMass (StringOrIndex phase, real value, String unit) -> void
Scale the mass of a phase by adjusting the amounts of its species equally. More...

auto scaleFluidMass (real value, String unit) -> void
Scale the total mass of fluids in the system by adjusting the masses of fluid phases equally. More...

auto scaleSolidMass (real value, String unit) -> void
Scale the total mass of solids in the system by adjusting the masses of solid phases equally. More...

auto system () const -> const ChemicalSystem &
Return the underlying chemical system for this chemical state.

auto temperature () const -> real
Return the temperature in the chemical state (in K).

auto pressure () const -> real
Return the pressure in the chemical state (in Pa).

auto speciesAmounts () const -> ArrayXrConstRef
Return the amounts of the species in the chemical state (in mol).

auto speciesAmountsInPhase (StringOrIndex phase) const -> ArrayXrConstRef
Return the amounts of the species from a phase in the chemical state (in mol). More...

auto componentAmounts () const -> ArrayXr
Return the amounts of the elements and charge in the chemical state (in mol).

auto elementAmounts () const -> ArrayXr
Return the amounts of the elements in the chemical state (in mol).

auto charge () const -> real
Return the electric charge in the chemical state (in mol).

auto speciesAmount (StringOrIndex species) const -> real
Return the amount of a species in the chemical state (in mol). More...

auto speciesMass (StringOrIndex species) const -> real
Return the mass of a species in the chemical state (in kg). More...

auto props () const -> const ChemicalProps &
Return the chemical properties of the system. More...

auto props () -> ChemicalProps &
Return the chemical properties of the system. More...

auto equilibrium () const -> const Equilibrium &
Return the equilibrium properties of a calculated chemical equilibrium state.

auto equilibrium () -> Equilibrium &
Return the equilibrium properties of a calculated chemical equilibrium state.

auto output (std::ostream &out) const -> void
Output this ChemicalState instance to a stream.

auto output (const String &filename) const -> void
Output this ChemicalState instance to a file.

## Detailed Description

The chemical state of a chemical system.

ChemicalSystem

## ◆ ChemicalState()

 ChemicalState ( const ChemicalSystem & system )
explicit

Construct a ChemicalState instance with standard conditions.

This constructor creates an instance of ChemicalState with temperature 25 °C, pressure 1 bar, and zero mole amounts for the species.

## ◆ temperature() [1/2]

 auto temperature ( real value ) -> void

Set the temperature of the chemical state.

Parameters
 value The temperature value (in K).

## ◆ temperature() [2/2]

 auto temperature ( real value, String unit ) -> void

Set the temperature of the chemical state with given unit.

Parameters
 value The temperature value. unit The temperature unit (convertible to K).

## ◆ pressure() [1/2]

 auto pressure ( real value ) -> void

Set the pressure of the chemical state.

Parameters
 value The pressure value (in Pa).

## ◆ pressure() [2/2]

 auto pressure ( real value, String unit ) -> void

Set the pressure of the chemical state with given unit.

Parameters
 value The pressure value. unit The pressure unit (convertible to Pa).

 auto add ( String species, real value, String unit ) -> void

Add a specified amount or mass of a chemical species in the chemical state.

Parameters
 species The name of the species in the chemical system. value The amount or mass value of the added species. unit The amount or mass unit (must be convertible to mol or kg).
Warning
An error is thrown if the chemical system has no species with name species.

 auto add ( Index ispecies, real value, String unit ) -> void

Add a specified amount or mass of a chemical species in the chemical state.

Parameters
 ispecies The index of the species in the chemical system. value The amount or mass value of the added species. unit The amount or mass unit (must be convertible to mol or kg).

## ◆ set() [1/2]

 auto set ( String species, real value, String unit ) -> void

Set a specified amount or mass of a chemical species in the chemical state.

Parameters
 species The name of the species in the chemical system. value The amount or mass value of the added species. unit The amount or mass unit (must be convertible to mol or kg).
Warning
An error is thrown if the chemical system has no species with name species.

## ◆ set() [2/2]

 auto set ( Index ispecies, real value, String unit ) -> void

Set a specified amount or mass of a chemical species in the chemical state.

Parameters
 ispecies The index of the species in the chemical system. value The amount or mass value of the added species. unit The amount or mass unit (must be convertible to mol or kg).

## ◆ setTemperature() [1/2]

 auto setTemperature ( real value ) -> void

Set the temperature of the chemical state.

Parameters
 value The temperature value (in K).
Note
This method is equivalent to ChemicalState::temperature(real)

## ◆ setTemperature() [2/2]

 auto setTemperature ( real value, String unit ) -> void

Set the temperature of the chemical state with given unit.

Parameters
 value The temperature value. unit The temperature unit (convertible to K).
Note
This method is equivalent to ChemicalState::temperature(real, String)

## ◆ setPressure() [1/2]

 auto setPressure ( real value ) -> void

Set the pressure of the chemical state.

Parameters
 value The pressure value (in Pa).
Note
This method is equivalent to ChemicalState::pressure(real)

## ◆ setPressure() [2/2]

 auto setPressure ( real value, String unit ) -> void

Set the pressure of the chemical state with given unit.

Parameters
 value The pressure value. unit The pressure unit (convertible to Pa).
Note
This method is equivalent to ChemicalState::pressure(real, String)

## ◆ setSpeciesAmount()

 auto setSpeciesAmount ( StringOrIndex species, real amount, String unit ) -> void

Set the amount of a species in the system.

Parameters
 species The name or index of the species in the system. amount The new amount of the species unit The amount unit

## ◆ setSpeciesMass()

 auto setSpeciesMass ( StringOrIndex species, real mass, String unit ) -> void

Set the mass of a species in the system.

Parameters
 species The name or index of the species in the system. mass The new mass of the species unit The mass unit

## ◆ scaleSpeciesAmounts()

 auto scaleSpeciesAmounts ( real scalar ) -> void

Scale the amounts of every species by a given scalar.

Parameters
 scalar The scale factor

## ◆ scaleSpeciesAmountsInPhase()

 auto scaleSpeciesAmountsInPhase ( StringOrIndex phase, real scalar ) -> void

Scale the amounts of the species in a phase by a given scalar.

Parameters
 phase The name or index of the phase in the system. scalar The scale factor

## ◆ scaleVolume()

 auto scaleVolume ( real value, String unit ) -> void

Scale the volume of the system by adjusting the amounts of its species equally.

Parameters
 value The new volume of the system unit The volume unit

## ◆ scalePhaseVolume()

 auto scalePhaseVolume ( StringOrIndex phase, real value, String unit ) -> void

Scale the volume of a phase by adjusting the amounts of its species equally.

Parameters
 phase The name or index of the phase in the system. value The new volume of the phase unit The volume unit

## ◆ scaleFluidVolume()

 auto scaleFluidVolume ( real value, String unit ) -> void

Scale the total volume of fluids in the system by adjusting the volumes of fluid phases equally.

Parameters
 value The new total volume of fluids in the system unit The volume unit

## ◆ scaleSolidVolume()

 auto scaleSolidVolume ( real value, String unit ) -> void

Scale the total volume of solids in the system by adjusting the volumes of solid phases equally.

Parameters
 value The new total volume of solids in the system unit The volume unit

## ◆ scaleMass()

 auto scaleMass ( real value, String unit ) -> void

Scale the mass of the system by adjusting the amounts of its species equally.

Parameters
 value The new mass of the system unit The mass unit

## ◆ scalePhaseMass()

 auto scalePhaseMass ( StringOrIndex phase, real value, String unit ) -> void

Scale the mass of a phase by adjusting the amounts of its species equally.

Parameters
 phase The name or index of the phase in the system. value The new mass of the phase unit The mass unit

## ◆ scaleFluidMass()

 auto scaleFluidMass ( real value, String unit ) -> void

Scale the total mass of fluids in the system by adjusting the masses of fluid phases equally.

Parameters
 value The new total mass of fluids in the system unit The mass unit

## ◆ scaleSolidMass()

 auto scaleSolidMass ( real value, String unit ) -> void

Scale the total mass of solids in the system by adjusting the masses of solid phases equally.

Parameters
 value The new total mass of solids in the system unit The mass unit

## ◆ speciesAmountsInPhase()

 auto speciesAmountsInPhase ( StringOrIndex phase ) const -> ArrayXrConstRef

Return the amounts of the species from a phase in the chemical state (in mol).

Parameters
 phase The name or index of the phase in the system.

## ◆ speciesAmount()

 auto speciesAmount ( StringOrIndex species ) const -> real

Return the amount of a species in the chemical state (in mol).

Parameters
 species The name or index of the species in the system.

## ◆ speciesMass()

 auto speciesMass ( StringOrIndex species ) const -> real

Return the mass of a species in the chemical state (in kg).

Parameters
 species The name or index of the species in the system.

## ◆ props() [1/2]

 auto props ( ) const -> const ChemicalProps &

Return the chemical properties of the system.

For performance reasons, the stored chemical properties are not updated at every change in the chemical state. For a ChemicalState object state, update its chemical properties using state.props().update(state).

## ◆ props() [2/2]

 auto props ( ) -> ChemicalProps &

Return the chemical properties of the system.

For performance reasons, the stored chemical properties are not updated at every change in the chemical state. For a ChemicalState object state, update its chemical properties using state.props().update(state).

The documentation for this class was generated from the following file: