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 (ChemicalSystem const &system) | |
Construct a ChemicalState instance with standard conditions. More... | |
ChemicalState (ChemicalState const &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 | setTemperature (real const &value) -> void |
Set the temperature of the chemical state. More... | |
auto | setTemperature (real value, Chars unit) -> void |
Set the temperature of the chemical state with given unit. More... | |
auto | temperature (real const &value) -> void |
Set the temperature of the chemical state. More... | |
auto | temperature (real value, Chars unit) -> void |
Set the temperature of the chemical state with given unit. More... | |
auto | temperature () const -> real |
Return the temperature in the chemical state (in K). | |
auto | setPressure (real const &value) -> void |
Set the pressure of the chemical state. More... | |
auto | setPressure (real value, Chars unit) -> void |
Set the pressure of the chemical state with given unit. More... | |
auto | pressure (real const &value) -> void |
Set the pressure of the chemical state. More... | |
auto | pressure (real value, Chars unit) -> void |
Set the pressure of the chemical state with given unit. More... | |
auto | pressure () const -> real |
Return the pressure in the chemical state (in Pa). | |
auto | setSpeciesAmounts (real const &value) -> void |
Set the amounts of all species in the chemical state to a common value (in mol). | |
auto | setSpeciesAmounts (ArrayXrConstRef const &n) -> void |
Set the amounts of the species in the chemical state with given array (in mol). | |
auto | setSpeciesAmounts (ArrayXdConstRef const &n) -> void |
Set the amounts of the species in the chemical state with given array (in mol). | |
auto | setSpeciesAmount (Index ispecies, real const &amount) -> void |
Set the amount of a specific species in the system (in mol). More... | |
auto | setSpeciesAmount (StringOrIndex const &species, real amount, Chars unit) -> void |
Set the amount of a specific species in the system. More... | |
auto | setSpeciesMass (StringOrIndex const &species, real mass, Chars unit) -> void |
Set the mass of a specific species in the system. More... | |
auto | set (StringOrIndex const &species, real value, Chars unit) -> void |
Set the amount or mass of a chemical species in the chemical state. More... | |
auto | add (StringOrIndex const &species, real value, Chars unit) -> void |
Add a specified amount or mass of a chemical species in the chemical state. More... | |
auto | speciesAmounts () const -> ArrayXrConstRef |
Return the amounts of the species in the chemical state (in mol). | |
auto | speciesAmountsInPhase (StringOrIndex const &phase) const -> ArrayXrConstRef |
Return the amounts of the species from a phase in the chemical state (in mol). More... | |
auto | speciesAmount (StringOrIndex const &species) const -> real |
Return the amount of a species in the chemical state (in mol). More... | |
auto | speciesMass (StringOrIndex const &species) const -> real |
Return the mass of a species in the chemical state (in kg). More... | |
auto | componentAmounts () const -> ArrayXr |
Return the amounts of the conservative components (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 | scaleSpeciesAmounts (real const &scalar) -> void |
Scale the amounts of every species by a given factor. More... | |
auto | scaleSpeciesAmounts (real const &scalar, Indices const &indices) -> void |
Scale the amounts of the species with given indices. More... | |
auto | scaleSpeciesAmountsInPhase (StringOrIndex const &phase, real const &scalar) -> void |
Scale the amounts of the species in a phase by a given factor. More... | |
auto | scaleAmount (real amount, Chars unit) -> void |
Scale the amount of the system to a new value. More... | |
auto | scalePhaseAmount (StringOrIndex const &phase, real amount, Chars unit) -> void |
Scale the amount of a phase to a new value. More... | |
auto | scaleFluidAmount (real amount, Chars unit) -> void |
Scale the total amount of fluids in the system to a new value. More... | |
auto | scaleSolidAmount (real amount, Chars unit) -> void |
Scale the total amount of solids in the system to a new value. More... | |
auto | scaleMass (real mass, Chars unit) -> void |
Scale the mass of the system to a new value. More... | |
auto | scalePhaseMass (StringOrIndex const &phase, real mass, Chars unit) -> void |
Scale the mass of a phase to a new value. More... | |
auto | scaleFluidMass (real mass, Chars unit) -> void |
Scale the total mass of fluids in the system to a new value. More... | |
auto | scaleSolidMass (real mass, Chars unit) -> void |
Scale the total mass of solids in the system to a new value. More... | |
auto | scaleVolume (real volume, Chars unit) -> void |
Scale the volume of the system to a new value. More... | |
auto | scalePhaseVolume (StringOrIndex const &phase, real volume, Chars unit) -> void |
Scale the volume of a phase to a new value. More... | |
auto | scaleFluidVolume (real volume, Chars unit) -> void |
Scale the total volume of fluids in the system to a new value. More... | |
auto | scaleSolidVolume (real volume, Chars unit) -> void |
Scale the total volume of solids in the system to a new value. More... | |
auto | update (real const &T, real const &P, ArrayXrConstRef const &n) -> void |
Update the chemical state and properties of the system. More... | |
auto | updateIdeal (real const &T, real const &P, ArrayXrConstRef const &n) -> void |
Update the chemical state and properties of the system using ideal activity models. More... | |
auto | system () const -> ChemicalSystem const & |
Return the underlying chemical system for this chemical state. | |
auto | props () const -> ChemicalProps const & |
Return the chemical properties of the system. More... | |
auto | props () -> ChemicalProps & |
Return the chemical properties of the system. More... | |
auto | equilibrium () const -> Equilibrium const & |
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 (String const &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()
|
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
◆ setTemperature() [1/2]
auto setTemperature | ( | real const & | value | ) | -> void |
Set the temperature of the chemical state.
- Parameters
-
value The temperature value (in K).
◆ setTemperature() [2/2]
Set the temperature of the chemical state with given unit.
- Parameters
-
value The temperature value. unit The temperature unit (must be convertible to K).
◆ temperature() [1/2]
auto temperature | ( | real const & | value | ) | -> void |
Set the temperature of the chemical state.
- Parameters
-
value The temperature value (in K).
- Note
- This method is equivalent to ChemicalState::setTemperature(real)
◆ temperature() [2/2]
Set the temperature of the chemical state with given unit.
- Parameters
-
value The temperature value. unit The temperature unit (must be convertible to K).
- Note
- This method is equivalent to ChemicalState::setTemperature(real, String)
◆ setPressure() [1/2]
auto setPressure | ( | real const & | value | ) | -> void |
Set the pressure of the chemical state.
- Parameters
-
value The pressure value (in Pa).
◆ setPressure() [2/2]
Set the pressure of the chemical state with given unit.
- Parameters
-
value The pressure value. unit The pressure unit (must be convertible to Pa).
◆ pressure() [1/2]
auto pressure | ( | real const & | value | ) | -> void |
Set the pressure of the chemical state.
- Parameters
-
value The pressure value (in Pa).
- Note
- This method is equivalent to ChemicalState::setPressure(real)
◆ pressure() [2/2]
Set the pressure of the chemical state with given unit.
- Parameters
-
value The pressure value. unit The pressure unit (must be convertible to Pa).
- Note
- This method is equivalent to ChemicalState::setPressure(real, String)
◆ setSpeciesAmount() [1/2]
Set the amount of a specific species in the system (in mol).
- Parameters
-
ispecies The index of the species. amount The amount of the species
◆ setSpeciesAmount() [2/2]
auto setSpeciesAmount | ( | StringOrIndex const & | species, |
real | amount, | ||
Chars | unit | ||
) | -> void |
Set the amount of a specific species in the system.
- Parameters
-
species The name or index of the species. amount The amount of the species unit The amount unit (must be convertible to mol)
◆ setSpeciesMass()
auto setSpeciesMass | ( | StringOrIndex const & | species, |
real | mass, | ||
Chars | unit | ||
) | -> void |
Set the mass of a specific species in the system.
- Parameters
-
species The name or index of the species. mass The mass of the species unit The mass unit (must be convertible to kg)
◆ set()
auto set | ( | StringOrIndex const & | species, |
real | value, | ||
Chars | unit | ||
) | -> void |
Set the amount or mass of a chemical species in the chemical state.
- Parameters
-
species The name or index of the species. value The amount or mass value of the 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
.
◆ add()
auto add | ( | StringOrIndex const & | species, |
real | value, | ||
Chars | unit | ||
) | -> void |
Add a specified amount or mass of a chemical species in the chemical state.
- Parameters
-
species The name or 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).
- Warning
- An error is thrown if the chemical system has no species with name
species
.
◆ speciesAmountsInPhase()
auto speciesAmountsInPhase | ( | StringOrIndex const & | 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 const & | species | ) | const -> real |
Return the amount of a species in the chemical state (in mol).
- Parameters
-
species The name or index of the species.
◆ speciesMass()
auto speciesMass | ( | StringOrIndex const & | species | ) | const -> real |
Return the mass of a species in the chemical state (in kg).
- Parameters
-
species The name or index of the species.
◆ scaleSpeciesAmounts() [1/2]
auto scaleSpeciesAmounts | ( | real const & | scalar | ) | -> void |
Scale the amounts of every species by a given factor.
- Parameters
-
scalar The scale factor
◆ scaleSpeciesAmounts() [2/2]
Scale the amounts of the species with given indices.
- Parameters
-
scalar The scale factor indices The indices of the species
◆ scaleSpeciesAmountsInPhase()
auto scaleSpeciesAmountsInPhase | ( | StringOrIndex const & | phase, |
real const & | scalar | ||
) | -> void |
Scale the amounts of the species in a phase by a given factor.
- Parameters
-
phase The name or index of the phase in the system. scalar The scale factor
◆ scaleAmount()
Scale the amount of the system to a new value.
- Parameters
-
amount The new amount of the system unit The amount unit (must be convertible to mol)
◆ scalePhaseAmount()
auto scalePhaseAmount | ( | StringOrIndex const & | phase, |
real | amount, | ||
Chars | unit | ||
) | -> void |
Scale the amount of a phase to a new value.
- Parameters
-
phase The name or index of the phase in the system. amount The new amount of the phase unit The amount unit (must be convertible to mol)
◆ scaleFluidAmount()
Scale the total amount of fluids in the system to a new value.
- Parameters
-
amount The new total amount of fluids in the system unit The amount unit (must be convertible to mol)
◆ scaleSolidAmount()
Scale the total amount of solids in the system to a new value.
- Parameters
-
amount The new total amount of solids in the system unit The amount unit (must be convertible to mol)
◆ scaleMass()
Scale the mass of the system to a new value.
- Parameters
-
mass The new mass of the system unit The mass unit (must be convertible to kg)
◆ scalePhaseMass()
auto scalePhaseMass | ( | StringOrIndex const & | phase, |
real | mass, | ||
Chars | unit | ||
) | -> void |
Scale the mass of a phase to a new value.
- Parameters
-
phase The name or index of the phase in the system. mass The new mass of the phase unit The mass unit (must be convertible to kg)
◆ scaleFluidMass()
Scale the total mass of fluids in the system to a new value.
- Parameters
-
mass The new total mass of fluids in the system unit The mass unit (must be convertible to kg)
◆ scaleSolidMass()
Scale the total mass of solids in the system to a new value.
- Parameters
-
mass The new total mass of solids in the system unit The mass unit (must be convertible to kg)
◆ scaleVolume()
Scale the volume of the system to a new value.
- Parameters
-
volume The new volume of the system unit The volume unit (must be convertible to m3)
◆ scalePhaseVolume()
auto scalePhaseVolume | ( | StringOrIndex const & | phase, |
real | volume, | ||
Chars | unit | ||
) | -> void |
Scale the volume of a phase to a new value.
- Parameters
-
phase The name or index of the phase in the system. volume The new volume of the phase unit The volume unit (must be convertible to m3)
◆ scaleFluidVolume()
Scale the total volume of fluids in the system to a new value.
- Parameters
-
volume The new total volume of fluids in the system unit The volume unit (must be convertible to m3)
◆ scaleSolidVolume()
Scale the total volume of solids in the system to a new value.
- Parameters
-
volume The new total volume of solids in the system unit The volume unit (must be convertible to m3)
◆ update()
auto update | ( | real const & | T, |
real const & | P, | ||
ArrayXrConstRef const & | n | ||
) | -> void |
Update the chemical state and properties of the system.
- Parameters
-
T The temperature condition (in K) P The pressure condition (in Pa) n The amounts of the species in the system (in mol)
◆ updateIdeal()
auto updateIdeal | ( | real const & | T, |
real const & | P, | ||
ArrayXrConstRef const & | n | ||
) | -> void |
Update the chemical state and properties of the system using ideal activity models.
- Parameters
-
T The temperature condition (in K) P The pressure condition (in Pa) n The amounts of the species in the system (in mol)
◆ props() [1/2]
auto props | ( | ) | const -> ChemicalProps const & |
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:
- Reaktoro/Core/ChemicalState.hpp