Page MenuHomec4science

adimensional_system_structs.hpp
No OneTemporary

File Metadata

Created
Thu, May 9, 14:19

adimensional_system_structs.hpp

#ifndef SPECMICP_SPECMICP_ADIMENSIONALSYSTEMSTRUCTS_HPP
#define SPECMICP_SPECMICP_ADIMENSIONALSYSTEMSTRUCTS_HPP
#include "common.hpp"
//! \file adimensional_system_structs.hpp Options and constraints for the AdimensionalSystem
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
scalar_t restart_concentration; //!< Log of the molality used to restart the computation
AdimensionalSystemOptions():
non_ideality(true),
non_ideality_tolerance(1e-8),
non_ideality_max_iter(10),
under_relaxation_factor(0.9),
restart_concentration(-6)
{}
};
//! \brief Type of an aqueous component equation
enum class AqueousComponentEquationType
{
NoEquation = no_equation, //!< 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
};
enum class WaterEquationType
{
NoEquation = no_equation, //!< Amount of water is not solved
MassConservation, //!< Water is conserved
SaturatedSystem //!< System is saturated
};
//! \brief Struct to contain information needed to solve a fix fugacity problem
struct FixedFugacityConstraint
{
index_t id_gas; //!< Id of the fixed-fugacity gas
index_t id_component; //!< Id of the corresponding component
scalar_t log_value; //!< Logarithm of the fugacity
FixedFugacityConstraint(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 FixedActivityConstraint
{
index_t id_component; //!< Id of the fixed-activity component
scalar_t log_value; //!< Log of the activity
FixedActivityConstraint(index_t component, scalar_t logvalue):
id_component(component),
log_value(logvalue)
{}
};
//! \brief Struct to contains the "Boundary conditions" for
struct AdimensionalSystemConstraints
{
Vector total_concentrations; //!< Total concentrations
WaterEquationType water_equation; //!< Water equation
index_t charge_keeper; //!< The equation for this component is replace by the charge balance
bool saturated_system; //!> System is saturated - no gas phase
std::vector<FixedFugacityConstraint> fixed_fugacity_cs; //!< Contains information about fixed fugacity gas
std::vector<FixedActivityConstraint> fixed_activity_cs; //!< Contains information about fixed activity component
scalar_t inert_volume_fraction; //! Volume fraction of inert solid (inert in the equilibrium computation)
AdimensionalSystemConstraints():
water_equation(WaterEquationType::MassConservation),
charge_keeper(no_species),
inert_volume_fraction(0.0)
{}
AdimensionalSystemConstraints(const Vector& total_concs):
total_concentrations(total_concs),
water_equation(WaterEquationType::MassConservation),
charge_keeper(no_species),
inert_volume_fraction(0.0)
{}
//! \brief Enable the conservation of water
void enable_conservation_water() {water_equation = WaterEquationType::MassConservation;}
//! \brief Disable the conservation of water
void disable_conservation_water() {water_equation = WaterEquationType::NoEquation;}
//! \brief The system is saturated
void set_saturated_system() {water_equation = WaterEquationType::SaturatedSystem;}
//! \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 FixedFugacityConstraint& constraint) {
fixed_fugacity_cs.push_back(constraint);
}
//! \brief Add a fixed fugacity gas condition
void add_fixed_fugacity_gas(index_t gas, index_t component, scalar_t logvalue) {
fixed_fugacity_cs.push_back(FixedFugacityConstraint(gas, component, logvalue));
}
//! \brief Add a fixed activity component condition
void add_fixed_activity_component(const FixedActivityConstraint& constraint) {
fixed_activity_cs.push_back(constraint);
}
//! \brief Add a fixed activity component condition
void add_fixed_activity_component(index_t component, scalar_t log_value) {
fixed_activity_cs.push_back(FixedActivityConstraint(component, log_value));
}
//! \brief Set the inert volume fraction
void set_inert_volume_fraction(scalar_t value){
inert_volume_fraction = value;
}
};
} // end namespace specmicp
#endif // SPECMICP_SPECMICP_ADIMENSIONALSYSTEMSTRUCTS_HPP

Event Timeline