Page MenuHomec4science

reactive_transport_neutrality_solver.hpp
No OneTemporary

File Metadata

Created
Thu, Jun 6, 21:57

reactive_transport_neutrality_solver.hpp

#ifndef SPECMICP_REACTMICP_SATURATED_DIFFUSION_REACTIVETRANSPORTNEUTRALITYSOLVER_HPP
#define SPECMICP_REACTMICP_SATURATED_DIFFUSION_REACTIVETRANSPORTNEUTRALITYSOLVER_HPP
#include "common.hpp"
#include "options.hpp"
#include "variables.hpp"
#include "transport_neutrality_program.hpp"
#include "dfpmsolver/parabolic_driver.hpp"
namespace specmicp {
namespace reactmicp {
using namespace systems::siasaturated;
// Forward declarations
// --------------------
namespace systems {
namespace siasaturated {
class SIABoundaryConditions;
} // end namespace siasaturated
} // end namespace systems
namespace internals {
struct SIAResiduals;
} // end namespace internals
// end forward declarations
// Class declaration
// =================
//! \brief SIA solver for saturated reactive transport problem
//!
class SIASaturatedReactiveTransportNeutralitySolver
{
public:
using retcode_t = SIASaturatedReactiveTransportSolverReturnCode;
SIASaturatedReactiveTransportNeutralitySolver(
std::shared_ptr<mesh::Mesh1D> the_mesh,
RawDatabasePtr the_database,
std::shared_ptr<SaturatedNeutralityDiffusionTransportParameters> transport_parameters
);
void apply_boundary_conditions(SIABoundaryConditions bcs);
SIASaturatedVariables& get_variables() {return m_variables;}
//! \brief Solve a timestep
SIASaturatedReactiveTransportSolverReturnCode solve_timestep(scalar_t dt);
//! \brief Return a read-write reference to the options
SIASaturatedReactiveTransportSolverOptions& get_options() {return m_options;}
//! \brief Return a read-only reference to the options
const SIASaturatedReactiveTransportSolverOptions& get_options() const {return m_options;}
//! \brief Use the sequential iterative algorithm
void use_sia(int nb_iterations) {get_options().use_sia(nb_iterations);}
//! \brief Use the sequential non-iterative algorithm
void use_snia() {get_options().use_snia();}
private:
//! \brief Restart the transport problem
void restart_transport_iterations(internals::SIAResiduals& residuals_storage);
//! \brief Restart the speciation problems
void restart_speciation_iterations(scalar_t dt, internals::SIAResiduals& residuals_storage, Vector& transport_variables);
//! \brief Solve the speciation problem at one node
void solve_speciation_node(
scalar_t dt,
index_t node,
internals::SIAResiduals& residuals_storage,
Vector& transport_variables
);
retcode_t check_convergence(internals::SIAResiduals& residuals_storage,
const Vector& transport_variables);
scalar_t residuals_transport(const Vector& transport_variables);
void set_scaling();
SIASaturatedReactiveTransportSolverOptions m_options;
mesh::Mesh1DPtr m_mesh;
database::RawDatabasePtr m_database;
SIASaturatedVariables m_variables;
Eigen::MatrixXd m_minerals_start_iteration;
// transport program
std::shared_ptr<SaturatedNeutralityDiffusionTransportParameters> m_transport_parameters;
SaturatedNeutralityDiffusionProgram m_transport_program;
dfpmsolver::ParabolicDriver<SaturatedNeutralityDiffusionProgram> m_transport_solver;
//
Eigen::VectorXi m_bcs;
Eigen::VectorXi m_flag_compute_speciation;
};
} // end namespace reactmicp
} // end namespace specmicp
#endif // SPECMICP_REACTMICP_SATURATED_DIFFUSION_REACTIVETRANSPORTNEUTRALITYSOLVER_HPP

Event Timeline