Page MenuHomec4science

reactive_transport_solver.hpp
No OneTemporary

File Metadata

Created
Tue, Jul 16, 19:51

reactive_transport_solver.hpp

#ifndef SPECMICP_REACTMICP_SOLVER_REACTIVETRANSPORTSOLVER_HPP
#define SPECMICP_REACTMICP_SOLVER_REACTIVETRANSPORTSOLVER_HPP
//! \file reactive_transport_solver.hpp The reactive transport solver
//! \namespace specmicp::reactmicp::solver Namespace containing the algorithms for the reactive transport solver
#include "common.hpp"
#include <memory>
#include "reactive_transport_solver_structs.hpp"
#include "utils/options_handler.hpp"
#include "utils/perfs_handler.hpp"
// forward declarations
// ====================
namespace specmicp {
namespace reactmicp {
namespace solver {
class VariablesBase;
using VariablesBasePtr = std::shared_ptr<VariablesBase>;
class TransportStaggerBase;
class ChemistryStaggerBase;
class UpscalingStaggerBase;
using TransportStaggerPtr = std::shared_ptr<TransportStaggerBase>;
using ChemistryStaggerPtr = std::shared_ptr<ChemistryStaggerBase>;
using UpscalingStaggerPtr = std::shared_ptr<UpscalingStaggerBase>;
namespace internal {
struct ReactiveTransportResiduals;
} // end namespace internal
} // end namespace solver
} // end namespace reactmicp
} // end namespace specmicp
// Reactive Transport Solver
// =========================
namespace specmicp {
namespace reactmicp {
namespace solver {
//! \brief The reactive transport solver
//!
//! This class solves a reactive transport problem.
//! The details of the problem are implemented in the staggers.
//!
//! There is three staggers :
//! - The transport stagger
//! - The chemistry stagger
//! - The upscaling stagger
//!
//! The transport stagger also implements the residuals used to checked the convergence.
//!
//! This algorithm do not update, modify the variables.
//! The details must be implemented in the staggers.
//! The variables shared by the algorithm is a shared_ptr to the abstract base class specmicp::reactmicp::solver::VariablesBase
//! To be useful, this variable must be casted to the true class in the staggers.
class ReactiveTransportSolver:
public OptionsHandler<ReactiveTransportOptions>,
public PerformanceHandler<ReactiveTransportPerformance>
{
public:
//! \brief Build a reactive transport
//!
//! \param transport_stagger shared_ptr to a transport stagger
//! \param chemistry_stagger shared_ptr to a chemistry stagger
//! \param upscaling_stagger shared_ptr to an upscaling stagger
ReactiveTransportSolver(
TransportStaggerPtr transport_stagger,
ChemistryStaggerPtr chemistry_stagger,
UpscalingStaggerPtr upscaling_stagger
):
m_transport_stagger(transport_stagger),
m_chemistry_stagger(chemistry_stagger),
m_upscaling_stagger(upscaling_stagger)
{}
//! \brief Solve a timestep
//!
//! \param timestep The duration of the timestep
//! \param variables shared_ptr to the variables
ReactiveTransportReturnCode solve_timestep(
scalar_t timestep,
VariablesBasePtr variables
);
private: // members
//! \brief One iteration inside the timestep
//!
//! \param variables shared_ptr to the variables
//! \param residuals struct containing the residuals information
ReactiveTransportReturnCode one_iteration(
VariablesBasePtr variables,
internal::ReactiveTransportResiduals& residuals
);
//! \brief Check the convergence
//!
//! \param variables shared_ptr to the variables
//! \param residuals struct containing the residuals information
ReactiveTransportReturnCode check_convergence(
VariablesBasePtr variables,
const internal::ReactiveTransportResiduals& residuals
);
private: // attributes
TransportStaggerPtr m_transport_stagger; //!< The transport stagger
ChemistryStaggerPtr m_chemistry_stagger; //!< The chemistry stagger
UpscalingStaggerPtr m_upscaling_stagger; //!< The upscaling stagger
};
} // end namespace solver
} // end namespace reactmicp
} // end namespace specmicp
#endif // SPECMICP_REACTMICP_SOLVER_REACTIVETRANSPORTSOLVER_HPP

Event Timeline