Page MenuHomec4science

variables.cpp
No OneTemporary

File Metadata

Created
Wed, Sep 4, 20:17

variables.cpp

#include "variables.hpp"
namespace specmicp {
namespace reactmicp {
namespace systems {
namespace siasaturated {
void SIASaturatedVariables::update_composition(index_t node, const EquilibriumState& composition) {
// speciation
m_speciation_variables.col(node) = composition.main_variables();
m_secondary_concentration.col(node) = composition.molality_secondary();
m_secondary_variables.col(node) = composition.activity_coefficient();
m_ionic_strength(node) = composition.ionic_strength();
// transport
for (index_t component: m_data->range_aqueous_component())
{
total_mobile_concentration(node, component) = composition.total_aqueous_concentration_component(component);
}
m_speciation_variables(0, node) = mass_water(node);
}
scalar_t SIASaturatedVariables::immobile_total_amount(index_t node, index_t component)
{
return (m_data->nu_mineral.col(component).array()*
m_speciation_variables.block(m_data->nb_component, node, m_data->nb_mineral, 1).array()).sum();
}
void SIASaturatedVariables::nodal_update_total_amount(index_t node, Vector& total_amount)
{
total_amount.resize(m_data->nb_component);
total_amount(0) = mass_water(node)/m_data->molar_mass_basis_si(0)+immobile_total_amount(node, 0);
for (index_t component: m_data->range_aqueous_component())
{
total_amount(component) = nodal_component_update_total_amount(node, component);
}
}
scalar_t SIASaturatedVariables::nodal_component_update_total_amount(index_t node, index_t component)
{
return mass_water(node)*total_mobile_concentration(node,component)+immobile_total_amount(node, component);
}
scalar_t SIASaturatedVariables::mass_water(index_t node)
{
return m_param->density_water()*m_param->porosity(node)*m_mesh->cell_volume(node)*1e-3;
}
} // end namespace siasaturated
} // end namespace systems
} // end namespace reactmicp
} // end namespace specmicp

Event Timeline