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

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

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

Parameters
 species The name or index of the species in the chemical system. amount The 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.

 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
 species The name or index of the species in the chemical system. amount The amount of the species unit The amount unit
Warning
An error is thrown if species is not the name or index of an existing species in the chemical system.

 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
 species The name or index of the species in the chemical system. mass The mass of the species unit The mass unit
Warning
An error is thrown if species is not the name or index of an existing species in the chemical system.

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

Add a given amount of a substance to the material.

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

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

Add a given amount of a substance to the material.

Parameters
 substance The chemical formula of the substance. amount The amount of the substance unit The amount unit

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

Add a given mass of a substance to the material.

Parameters
 substance The chemical formula of the substance. mass The mass of the substance unit The mass unit

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

Add a given amount of another material in this material.

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

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

Add a given amount of another material in this material.

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

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

Add a given mass of another material in this material.

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

 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
 substance The chemical formula of the substance or the name of an existing species in the chemical system. value The amount or mass value of the added substance. unit The 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.

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

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

Parameters
 material The other material composing this material. value The amount or mass value of the added material. unit The 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
 value The desired amount of the material unit The 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
 value The desired mass of the material unit The 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
 value The desired amount or mass of the material unit The 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
 value The desired amount or mass of the copied material unit The 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
 T The temperature for the initial chemical state (in K) P The 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
 value The desired amount or mass of the copied material unit The amount or mass unit (must be convertible to mol or kg).

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