chemmisol 0.1
|
Namespaces | |
namespace | solver |
Classes | |
class | AqueousSpecies |
class | ChemicalComponent |
class | ChemicalSpecies |
struct | ChemicalSpeciesReagent |
class | ChemicalSystem |
struct | ComponentReagent |
class | dH |
class | EmptyReagents |
class | FixedAqueousSpecies |
class | FixedChemicalComponent |
class | FixedChemicalSpecies |
class | FixedMineralSpecies |
class | H |
class | Homotopy |
class | InvalidMineralSpeciesWithUndefinedSitesCount |
class | InvalidReaction |
class | InvalidSpecies |
class | MineralSpecies |
class | MissingProducedSpeciesInReaction |
class | Newton |
class | Reaction |
struct | Reagent |
class | RegulaFalsi |
class | Solvent |
class | TooManyProducedSpeciesInReaction |
Typedefs | |
template<typename T , std::size_t N> | |
using | X = std::array< T, N > |
template<typename T , std::size_t N, std::size_t P = N> | |
using | M = std::array< std::array< T, P >, N > |
template<typename T > | |
using | VecX = std::vector< T > |
template<typename T > | |
using | VecM = std::vector< std::vector< T > > |
template<typename X , typename M > | |
using | AbsoluteNewton = Newton< X, M, abs > |
Enumerations | |
enum | Phase { SOLVENT , AQUEOUS , MINERAL } |
enum | Category { MASS , LENGTH , VOLUME , SURFACE , QUANTITY } |
Functions | |
std::ostream & | operator<< (std::ostream &o, const Phase &phase) |
el::Logger * | init_logger (const char *logger_id) |
void | log_to_file (el::Logger *logger, const std::string &log_file, bool terminal_logging) |
template<typename T > | |
std::list< std::complex< T > > | unit_roots (int n) |
template<typename T > | |
std::list< std::complex< T > > | roots (const std::complex< T > &c, int n) |
template<typename T , std::size_t N, std::size_t P> | |
X< T, N > | operator* (const M< T, N, P > &m, const X< T, P > &x) |
template<typename T , std::size_t N> | |
X< T, N > | operator- (const X< T, N > &x) |
template<typename T , std::size_t N> | |
X< T, N > | operator+ (const X< T, N > &x1, const X< T, N > &x2) |
template<typename T , std::size_t N> | |
X< T, N > | operator* (const T &a, const X< T, N > &x) |
template<typename T , std::size_t N, std::size_t P> | |
M< T, N, P > | operator* (const T &a, const M< T, N, P > &m) |
template<typename T , std::size_t N> | |
double | norm (const X< T, N > &x) |
template<typename T , std::size_t N> | |
double | norm (const X< std::complex< T >, N > &x) |
template<typename T , std::size_t N> | |
X< T, N > | abs (const X< T, N > &x) |
template<typename _M > | |
M< typename _M::value_type::value_type, std::tuple_size< _M >::value, std::tuple_size< typename _M::value_type >::value+1 > | augment (const _M &m, const X< typename _M::value_type::value_type, std::tuple_size< _M >::value > &x) |
template<typename T , std::size_t N> | |
std::ostream & | operator<< (std::ostream &o, const X< T, N > &x) |
template<typename T > | |
VecX< T > | operator* (const VecM< T > &m, const VecX< T > &x) |
template<typename T > | |
VecX< T > | operator- (const VecX< T > &x) |
template<typename T > | |
VecX< T > | operator+ (const VecX< T > &x1, const VecX< T > &x2) |
template<typename T > | |
double | norm (const VecX< T > &x) |
template<typename T > | |
VecX< T > | abs (const VecX< T > &x) |
template<typename T > | |
VecM< T > | augment (const VecM< T > &m, const VecX< T > &x) |
template<typename T > | |
std::ostream & | operator<< (std::ostream &o, const VecX< T > &x) |
template<typename T > | |
double | norm (const T &x) |
template<typename T > | |
T | abs (const T &x) |
template<typename T > | |
T | identity (const T &x) |
Variables | |
el::Logger * | core_logger |
constexpr double | pi = 3.141592653589793238462643383279502884 |
const double | NA |
Main Chemmisol namespace.
using chemmisol::X = typedef std::array<T, N> |
Vector type hosted by a fixed size std::array.
using chemmisol::M = typedef std::array<std::array<T, P>, N> |
Matrix type hosted by a fixed size std::array.
The matrix contains N rows and P columns.
using chemmisol::VecX = typedef std::vector<T> |
Vector type hosted by a dynamic size std::vector.
using chemmisol::VecM = typedef std::vector<std::vector<T> > |
Matrix type hosted by a dynamic size std::vector.
Implements the absolute Newton-Raphson method, where the absolute value of x_n+1
is taken as the result of each iteration.
This variant is particularly suitable for chemical equilibrium solving, since it guarantees that x_n+1, that represents activity of species, is always positive.
Moreover, the absolute Newton-Raphson method has proven to have a much larger basin of attraction than the classical Newton-Raphson method [1].
[1] K. Meintjes and A. P. Morgan, “A methodology for solving chemical equilibrium systems,” Applied Mathematics and Computation, vol. 22, no. 4, pp. 333–361, Jun. 1987, doi: 10.1016/0096-3003(87)90076-2.
enum chemmisol::Phase |
Possible phases of a chemical species.
enum chemmisol::Category |
Describes the category of each unit.
std::ostream & chemmisol::operator<< | ( | std::ostream & | o, |
const Phase & | phase | ||
) |
Phases stream output operator.
el::Logger * chemmisol::init_logger | ( | const char * | logger_id | ) |
Initializes and configures a chemmisol logger with the specified ID.
The method is notably used to initialize the chemmisol::core_logger with the CHEM_CORE_LOGID, but can be used to define other loggers with the same configuration ad the chemmisol::core_logger.
logger_id | ID of the logger, used in Easylogging++ CLOG() and CVLOG() macros. |
void chemmisol::log_to_file | ( | el::Logger * | logger, |
const std::string & | log_file, | ||
bool | terminal_logging | ||
) |
Configures the specified logger to output to the specified log file. Logging to std::cout can also be disabled thanks to the terminal_logging argument.
Any Easylogging++ logger can be configured this way, including the chemmisol::core_logger or any logger initialized with init_logger().
logger | Logger to output to a file. |
log_file | Full path to the log file. |
terminal_logging | Set to false to disable std::cout logging. |
X< T, N > chemmisol::operator* | ( | const M< T, N, P > & | m, |
const X< T, P > & | x | ||
) |
Computes m*x as a matrix multiplication.
m | Matrix of size N*P. |
x | Vector of size P. |
Computes -x = [-x_0, ..., -x_N-1]
.
x | Vector of size N. |
X< T, N > chemmisol::operator+ | ( | const X< T, N > & | x1, |
const X< T, N > & | x2 | ||
) |
Computes x1+x2 = [x1_0+x2_0, ..., x1_N-1 + x2_N-1]
.
x1 | Vector of size N. |
x2 | Vector of size N. |
double chemmisol::norm | ( | const X< T, N > & | x | ) |
Computes the euclidean norm of the vector.
Computes the absolute value the vector.
M< typename _M::value_type::value_type, std::tuple_size< _M >::value, std::tuple_size< typename _M::value_type >::value+1 > chemmisol::augment | ( | const _M & | m, |
const X< typename _M::value_type::value_type, std::tuple_size< _M >::value > & | x | ||
) |
Implements the augment operation used by the Gaussian elimination algortihm for fixed size matrices and vectors.
Returns a new matrix corresponding to the concatenation of m and x, where x represents the last column of the new matrix.
m | Matrix of size N*P. |
x | Vector of size N. |
_M | Fixed size matrix type. |
std::ostream & chemmisol::operator<< | ( | std::ostream & | o, |
const X< T, N > & | x | ||
) |
Fixed size vector stream output operator.
The vector is serialized as "[x0, ..., xn]".
Computes m*x as a matrix multiplication.
m | Matrix of size N*P. |
x | Vector of size P. |
Computes -x = [-x_0, ..., -x_N-1]
.
x | Vector of size N. |
Computes x1+x2 = [x1_0+x2_0, ..., x1_N-1 + x2_N-1]
.
The behavior is unspecified if x1 and x2 are not the same size.
x1 | Vector of size N. |
x2 | Vector of size N. |
double chemmisol::norm | ( | const VecX< T > & | x | ) |
Computes the euclidean norm of the vector.
Computes the absolute value the vector.
Implements the augment operation used by the Gaussian elimination algortihm for dynamic size matrices and vectors.
Returns a new matrix corresponding to the concatenation of m and x, where x represents the last column of the new matrix.
The behavior is unspecified if the size of x is not equal to the count of rows in m.
m | Matrix of size N*P. |
x | Vector of size N. |
std::ostream & chemmisol::operator<< | ( | std::ostream & | o, |
const VecX< T > & | x | ||
) |
Dynamic size vector stream output operator.
The vector is serialized as "[x0, ..., xn]".
double chemmisol::norm | ( | const T & | x | ) |
Returns the norm of the scalar value x, i.e. its absolute value.
T chemmisol::abs | ( | const T & | x | ) |
Returns the absolute value of the scalar value x.
T chemmisol::identity | ( | const T & | x | ) |
Identity method, that returns x itself.
|
extern |
Pointer to the Easylogging++ Logger used internally by the chemmisol library.
|
extern |
The Avogadro constant.