Page MenuHomec4science

variables.cpp
No OneTemporary

File Metadata

Created
Sun, Jul 7, 07:46

variables.cpp

#include "variables.hpp"
namespace specmicp {
namespace reactmicp {
namespace systems {
namespace siasaturated {
void SIASaturatedVariables::update_composition(int node, 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 (int 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);
}
double SIASaturatedVariables::immobile_total_amount(int node, int component)
{
double sum = 0;
for (int mineral: m_data->range_mineral())
{
if (m_data->nu_mineral(mineral, component) != 0)
{
sum += m_data->nu_mineral(mineral, component)*mineral_amount(node, mineral);
}
}
return sum;
}
void SIASaturatedVariables::nodal_update_total_amount(int node, Eigen::VectorXd& total_amount)
{
total_amount.resize(m_data->nb_component);
total_amount(0) = mass_water(node)/m_data->molar_mass_basis_si(0);
for (int component: m_data->range_aqueous_component())
{
total_amount(component) = nodal_component_update_total_amount(node, component);
}
}
double SIASaturatedVariables::nodal_component_update_total_amount(int node, int component)
{
return mass_water(node)*total_mobile_concentration(node,component)+immobile_total_amount(node, component);
}
double SIASaturatedVariables::mass_water(int node)
{
return m_param->density_water()*m_param->porosity(node)*m_mesh->cell_volume(node);
}
} // end namespace siasaturated
} // end namespace systems
} // end namespace reactmicp
} // end namespace specmicp

Event Timeline