Reaktoro  v2.1.1
A unified framework for modeling chemically reactive systems
Material Class Reference

A type used to represent a material composed of one or more substances. More...

#include <Material.hpp>

Public Member Functions

 Material (ChemicalSystem const &system)
 Construct a Material object.
 
auto addSpeciesAmount (StringOrIndex const &species, double amount) -> void
 Add a given amount of an existing species in the chemical system to the material. More...
 
auto addSpeciesAmount (StringOrIndex const &species, double amount, Chars unit) -> void
 Add a given amount of an existing species in the chemical system to the material. More...
 
auto addSpeciesMass (StringOrIndex const &species, double mass, Chars unit) -> void
 Add a given mass of an existing species in the chemical system to the material. More...
 
auto addSubstanceAmount (ChemicalFormula const &substance, double amount) -> void
 Add a given amount of a substance to the material. More...
 
auto addSubstanceAmount (ChemicalFormula const &substance, double amount, Chars unit) -> void
 Add a given amount of a substance to the material. More...
 
auto addSubstanceMass (ChemicalFormula const &substance, double mass, Chars unit) -> void
 Add a given mass of a substance to the material. More...
 
auto addMaterialAmount (Material const &material, double amount) -> void
 Add a given amount of another material in this material. More...
 
auto addMaterialAmount (Material const &material, double amount, Chars unit) -> void
 Add a given amount of another material in this material. More...
 
auto addMaterialMass (Material const &material, double mass, Chars unit) -> void
 Add a given mass of another material in this material. More...
 
auto add (String const &substance, double value, Chars unit) -> void
 Add a given amount or mass of a substance or existing species to the material. More...
 
auto add (Material const &material, double value, Chars unit) -> void
 Add a given amount or mass of another material in this material. More...
 
auto scaleAmount (double value, Chars unit) -> void
 Scale the amount of the material to a desired value. More...
 
auto scaleMass (double value, Chars unit) -> void
 Scale the mass of the material to a desired value. More...
 
auto scale (double value, Chars unit) -> void
 Scale the amount or mass of the material to a desired value. More...
 
auto with (double value, Chars unit) const -> Material
 Return a copy of this material with scaled amount or mass. More...
 
auto system () const -> const ChemicalSystem &
 Return the underlying chemical system in this material.
 
auto substances () const -> const Pairs< ChemicalFormula, double > &
 Return the substances and their amounts in this material.
 
auto species () const -> const Pairs< Index, double > &
 Return the chemical species (as indices) and their amounts in this material.
 
auto componentAmounts () const -> ArrayXd
 Return the accumulated amounts of elements and electric charge in the material.
 
auto elementAmounts () const -> ArrayXd
 Return the accumulated amounts of elements in the material.
 
auto charge () const -> double
 Return the accumulated electric charge in the material.
 
auto amount () const -> double
 Return the amount of the material as the sum of its substance amounts (in mol).
 
auto mass () const -> double
 Return the mass of the material as the sum of its substance masses (in kg).
 
auto molarMass () const -> double
 Return the molar mass of the material as the ratio of its mass and amount (in kg/mol).
 
auto equilibrate () -> ChemicalState
 Perform a chemical equilibrium calculation on this material at 25 °C and 1 bar.
 
auto equilibrate (const EquilibriumOptions &options) -> ChemicalState
 Perform a chemical equilibrium calculation on this material at 25 °C and 1 bar.
 
auto equilibrate (const EquilibriumRestrictions &restrictions) -> ChemicalState
 Perform a chemical equilibrium calculation on this material at 25 °C and 1 bar.
 
auto equilibrate (const EquilibriumRestrictions &restrictions, const EquilibriumOptions &options) -> ChemicalState
 Perform a chemical equilibrium calculation on this material at 25 °C and 1 bar.
 
auto equilibrate (double T, Chars unitT, double P, Chars unitP) -> ChemicalState
 Perform a chemical equilibrium calculation on this material at given temperature and pressure.
 
auto equilibrate (double T, Chars unitT, double P, Chars unitP, const EquilibriumOptions &options) -> ChemicalState
 Perform a chemical equilibrium calculation on this material at given temperature and pressure.
 
auto equilibrate (double T, Chars unitT, double P, Chars unitP, const EquilibriumRestrictions &restrictions) -> ChemicalState
 Perform a chemical equilibrium calculation on this material at given temperature and pressure.
 
auto equilibrate (double T, Chars unitT, double P, Chars unitP, const EquilibriumRestrictions &restrictions, const EquilibriumOptions &options) -> ChemicalState
 Perform a chemical equilibrium calculation on this material at given temperature and pressure.
 
auto result () const -> const EquilibriumResult &
 Return the result of the chemical equilibrium calculation performed by equilibrate.
 
auto initialState (double T, double P) const -> ChemicalState
 Return the initial chemical state that is used in the chemical equilibrium calculation performed by equilibrate. More...
 
auto operator() (double value, Chars unit) const -> Material
 Return a copy of this material with scaled amount or mass (equivalent to with). More...
 

Detailed Description

A type used to represent a material composed of one or more substances.

Member Function Documentation

◆ addSpeciesAmount() [1/2]

auto addSpeciesAmount ( StringOrIndex const &  species,
double  amount 
) -> void

Add a given amount of an existing species in the chemical system to the material.

Parameters
speciesThe name or index of the species in the chemical system.
amountThe amount of the species (in mol)
Warning
An error is thrown if species is not the name or index of an existing species in the chemical system.

◆ addSpeciesAmount() [2/2]

auto addSpeciesAmount ( StringOrIndex const &  species,
double  amount,
Chars  unit 
) -> void

Add a given amount of an existing species in the chemical system to the material.

Parameters
speciesThe name or index of the species in the chemical system.
amountThe amount of the species
unitThe amount unit
Warning
An error is thrown if species is not the name or index of an existing species in the chemical system.

◆ addSpeciesMass()

auto addSpeciesMass ( StringOrIndex const &  species,
double  mass,
Chars  unit 
) -> void

Add a given mass of an existing species in the chemical system to the material.

Parameters
speciesThe name or index of the species in the chemical system.
massThe mass of the species
unitThe mass unit
Warning
An error is thrown if species is not the name or index of an existing species in the chemical system.

◆ addSubstanceAmount() [1/2]

auto addSubstanceAmount ( ChemicalFormula const &  substance,
double  amount 
) -> void

Add a given amount of a substance to the material.

Parameters
substanceThe chemical formula of the substance.
amountThe amount of the substance (in mol)

◆ addSubstanceAmount() [2/2]

auto addSubstanceAmount ( ChemicalFormula const &  substance,
double  amount,
Chars  unit 
) -> void

Add a given amount of a substance to the material.

Parameters
substanceThe chemical formula of the substance.
amountThe amount of the substance
unitThe amount unit

◆ addSubstanceMass()

auto addSubstanceMass ( ChemicalFormula const &  substance,
double  mass,
Chars  unit 
) -> void

Add a given mass of a substance to the material.

Parameters
substanceThe chemical formula of the substance.
massThe mass of the substance
unitThe mass unit

◆ addMaterialAmount() [1/2]

auto addMaterialAmount ( Material const &  material,
double  amount 
) -> void

Add a given amount of another material in this material.

Parameters
materialThe other material composing this material.
amountThe amount of the substance (in mol)
Warning
An error is thrown if material has elements not present in the chemical system of this material.

◆ addMaterialAmount() [2/2]

auto addMaterialAmount ( Material const &  material,
double  amount,
Chars  unit 
) -> void

Add a given amount of another material in this material.

Parameters
materialThe other material composing this material.
amountThe amount of the substance
unitThe amount unit
Warning
An error is thrown if material has elements not present in the chemical system of this material.

◆ addMaterialMass()

auto addMaterialMass ( Material const &  material,
double  mass,
Chars  unit 
) -> void

Add a given mass of another material in this material.

Parameters
materialThe other material composing this material.
massThe mass of the substance
unitThe mass unit
Warning
An error is thrown if material has elements not present in the chemical system of this material.

◆ add() [1/2]

auto add ( String const &  substance,
double  value,
Chars  unit 
) -> void

Add a given amount or mass of a substance or existing species to the material.

Parameters
substanceThe chemical formula of the substance or the name of an existing species in the chemical system.
valueThe amount or mass value of the added substance.
unitThe amount or mass unit (must be convertible to mol or kg).
Warning
An error is thrown if substance has elements not present in the chemical system of this material.

◆ add() [2/2]

auto add ( Material const &  material,
double  value,
Chars  unit 
) -> void

Add a given amount or mass of another material in this material.

Parameters
materialThe other material composing this material.
valueThe amount or mass value of the added material.
unitThe amount or mass unit (must be convertible to mol or kg).
Warning
An error is thrown if material has elements not present in the chemical system of this material.

◆ scaleAmount()

auto scaleAmount ( double  value,
Chars  unit 
) -> void

Scale the amount of the material to a desired value.

This method will adjust the amounts of the material's substances to obtain the desired amount value.

Parameters
valueThe desired amount of the material
unitThe amount unit

◆ scaleMass()

auto scaleMass ( double  value,
Chars  unit 
) -> void

Scale the mass of the material to a desired value.

This method will adjust the amounts of the material's substances to obtain the desired mass value.

Parameters
valueThe desired mass of the material
unitThe mass unit

◆ scale()

auto scale ( double  value,
Chars  unit 
) -> void

Scale the amount or mass of the material to a desired value.

This method will adjust the amounts of the material's substances to obtain the desired amount or mass value.

Parameters
valueThe desired amount or mass of the material
unitThe amount or mass unit (must be convertible to mol or kg).

◆ with()

auto with ( double  value,
Chars  unit 
) const -> Material

Return a copy of this material with scaled amount or mass.

Parameters
valueThe desired amount or mass of the copied material
unitThe amount or mass unit (must be convertible to mol or kg).

◆ initialState()

auto initialState ( double  T,
double  P 
) const -> ChemicalState

Return the initial chemical state that is used in the chemical equilibrium calculation performed by equilibrate.

By accessing this initial chemical state, you can see how your material definition was used to construct an initial guess for the equilibrium calculation.

Parameters
TThe temperature for the initial chemical state (in K)
PThe pressure for the initial chemical state (in Pa)

◆ operator()()

auto operator() ( double  value,
Chars  unit 
) const -> Material

Return a copy of this material with scaled amount or mass (equivalent to with).

Parameters
valueThe desired amount or mass of the copied material
unitThe amount or mass unit (must be convertible to mol or kg).

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