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.

See also
ChemicalSystem

Constructor & Destructor Documentation

◆ 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.

Member Function Documentation

◆ temperature() [1/2]

auto temperature ( real  value) -> void

Set the temperature of the chemical state.

Parameters
valueThe 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
valueThe temperature value.
unitThe temperature unit (convertible to K).

◆ pressure() [1/2]

auto pressure ( real  value) -> void

Set the pressure of the chemical state.

Parameters
valueThe 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
valueThe pressure value.
unitThe pressure unit (convertible to Pa).

◆ add() [1/2]

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

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

Parameters
speciesThe name of the species in the chemical system.
valueThe amount or mass value of the added species.
unitThe 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.

◆ add() [2/2]

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

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

Parameters
ispeciesThe index of the species in the chemical system.
valueThe amount or mass value of the added species.
unitThe 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
speciesThe name of the species in the chemical system.
valueThe amount or mass value of the added species.
unitThe 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
ispeciesThe index of the species in the chemical system.
valueThe amount or mass value of the added species.
unitThe 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
valueThe 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
valueThe temperature value.
unitThe 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
valueThe 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
valueThe pressure value.
unitThe 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
speciesThe name or index of the species in the system.
amountThe new amount of the species
unitThe amount unit

◆ setSpeciesMass()

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

Set the mass of a species in the system.

Parameters
speciesThe name or index of the species in the system.
massThe new mass of the species
unitThe mass unit

◆ scaleSpeciesAmounts()

auto scaleSpeciesAmounts ( real  scalar) -> void

Scale the amounts of every species by a given scalar.

Parameters
scalarThe scale factor

◆ scaleSpeciesAmountsInPhase()

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

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

Parameters
phaseThe name or index of the phase in the system.
scalarThe 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
valueThe new volume of the system
unitThe 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
phaseThe name or index of the phase in the system.
valueThe new volume of the phase
unitThe 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
valueThe new total volume of fluids in the system
unitThe 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
valueThe new total volume of solids in the system
unitThe 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
valueThe new mass of the system
unitThe 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
phaseThe name or index of the phase in the system.
valueThe new mass of the phase
unitThe 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
valueThe new total mass of fluids in the system
unitThe 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
valueThe new total mass of solids in the system
unitThe 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
phaseThe 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
speciesThe 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
speciesThe 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: