Page MenuHomec4science

adimensional_system_structs.hpp
No OneTemporary

File Metadata

Created
Wed, Jun 5, 22:58

adimensional_system_structs.hpp

#ifndef SPECMICP_SPECMICP_ADIMENSIONALSYSTEMSTRUCTS_HPP
#define SPECMICP_SPECMICP_ADIMENSIONALSYSTEMSTRUCTS_HPP
#include "common.hpp"
namespace specmicp {
//! \brief Options for the Adimensional Systems
struct AdimensionalSystemOptions
{
bool non_ideality; //!< Solve for non ideality
scalar_t non_ideality_tolerance; //!< Tolerance for non ideality
index_t non_ideality_max_iter; //!< Max iterations fornon ideality
scalar_t under_relaxation_factor; //!< Under relaxation factor for the conservation of water
AdimensionalSystemOptions():
non_ideality(true),
non_ideality_tolerance(1e-8),
non_ideality_max_iter(10),
under_relaxation_factor(0.9)
{}
};
//! \brief Type of an aqueous component equation
enum class AqueousComponentEquationType
{
NoEquation, //!< Not an equation, component is not present in the system
MassConservation, //!< Mass balance
ChargeBalance, //!< M.B. replaced by charge balance
FixedFugacity, //!< M.B. replaced by a fixed fugacity equation
FixedActivity //!< M.B. replaced by a fixed activity equation
};
//! \brief Struct to contain information needed to solve a fix fugacity problem
struct FixedFugacityBC
{
index_t id_gas;
index_t id_component;
scalar_t log_value;
FixedFugacityBC(index_t gas, index_t component, scalar_t logvalue):
id_gas(gas),
id_component(component),
log_value(logvalue)
{}
};
//! \brief Struct to contain information needed to solve a fix activity problem.
struct FixedActivityBC
{
index_t id_component;
scalar_t log_value;
FixedActivityBC(index_t component, scalar_t logvalue):
id_component(component),
log_value(logvalue)
{}
};
//! \brief Struct to contains the "Boundary conditions" for
struct AdimensionalSystemBC
{
Vector total_concentrations; //!< Total concentrations
bool conservation_water; //!< True if conservation of water is solved
index_t charge_keeper; //!< The equation for this component is replace by the charge balance
std::vector<FixedFugacityBC> fixed_fugacity_bc; //!< Contains information about fixed fugacity gas
std::vector<FixedActivityBC> fixed_activity_bc; //!< Contains information about fixed activity component
AdimensionalSystemBC():
conservation_water(true),
charge_keeper(no_species)
{}
AdimensionalSystemBC(const Vector& total_concs):
total_concentrations(total_concs),
conservation_water(true),
charge_keeper(no_species)
{}
//! \brief Enable the conservation of water
void enable_conservation_water() {conservation_water = true;}
//! \brief Disable the conservation of water
void disable_conservation_water() {conservation_water = false;}
//! \brief Set the charge keeper to 'component'
void set_charge_keeper(index_t component) {
charge_keeper = component;
}
//! \brief Add a fixed fugacity gas condition
void add_fixed_fugacity_gas(const FixedFugacityBC& bc) {
fixed_fugacity_bc.push_back(bc);
}
//! \brief Add a fixed fugacity gas condition
void add_fixed_fugacity_gas(index_t gas, index_t component, scalar_t logvalue) {
fixed_fugacity_bc.push_back(FixedFugacityBC(gas, component, logvalue));
}
//! \brief Add a fixed activity component condition
void add_fixed_activity_component(const FixedActivityBC& bc) {
fixed_activity_bc.push_back(bc);
}
//! \brief Add a fixed activity component condition
void add_fixed_activity_component(index_t component, scalar_t log_value) {
fixed_activity_bc.push_back(FixedActivityBC(component, log_value));
}
};
} // end namespace specmicp
#endif // SPECMICP_SPECMICP_ADIMENSIONALSYSTEMSTRUCTS_HPP

Event Timeline