Page MenuHomec4science

reactive_transport_solver_structs.hpp
No OneTemporary

File Metadata

Created
Sun, Nov 17, 09:42

reactive_transport_solver_structs.hpp

#ifndef SPECMICP_REACTMICP_SOLVER_REACTIVETRANSPORTSOLVERSTRUCTS_HPP
#define SPECMICP_REACTMICP_SOLVER_REACTIVETRANSPORTSOLVERSTRUCTS_HPP
#include "common.hpp"
//! \file reactive_transport_solver_structs.hpp Structs used by the reactive transport solver
namespace specmicp {
namespace reactmicp {
namespace solver {
//! \brief Return codes used by the reactive transport solver
enum class ReactiveTransportReturnCode
{
UpscalingFailure = -13, //!< Upscaling stagger has failed
ChemistryFailure = -12, //!< Chemistry stagger has failed
TransportFailure = -11, //!< Transport stagger has failed
StaggerFailure = -10, //!< A stagger has failed
MaximumIterationsReached = - 2, //!< Maximum number of fixed-point iterations is reached
StationaryPoint = - 1, //!< The solver has reached a stationnary points
NotConvergedYet = 0, //!< The solver has not converged yet
ResidualMinimized = 1, //!< The residuals are minimized
ErrorMinimized = 2, //!< The error is minimized (may indicate a stationnary point)
GoodEnough = 3, //!< Good enough
TransportBypass = 5, //!< Transport is minimized, no need to do iterations
};
//! \brief Options used by the reactive transport solver
struct ReactiveTransportOptions
{
scalar_t residuals_tolerance; //!< Relative tolerance for the residuals
scalar_t absolute_residuals_tolerance; //!< Absolute tolerance for the residuals
scalar_t step_tolerance; //!< Absolute tolerance for the step
scalar_t good_enough_tolerance; //!< Relative tolerance to detect a stationnary point
index_t maximum_iterations; //!< Maximum number of iterations allowed
bool implicit_upscaling; //!< When true, the upscaling problem is solved at each iteration
//! \brief Use a Sequential Non-iterative Algorithm
void set_snia() {maximum_iterations = 1;}
//! \brief Return true if the problem is solved using a SNIA
bool is_snia() {return maximum_iterations <= 1;}
ReactiveTransportOptions():
residuals_tolerance(1e-4),
absolute_residuals_tolerance(1e-16),
step_tolerance(1e-10),
good_enough_tolerance(1e-2),
maximum_iterations(100),
implicit_upscaling(false)
{}
};
//! \brief Struct containing performance information
//!
//! This is valid for one timestep.
struct ReactiveTransportPerformance
{
scalar_t timestep; //!< Timestep used
index_t nb_iterations; //!< The number of fixed-point iterations for this timestep
ReactiveTransportReturnCode return_code; //!< The return code of the timestep
scalar_t residuals; //!< The norm of the residuals at the end of the timestep
scalar_t total_time; //!< Time spent solving one timestep
scalar_t transport_time; //!< Time spent solving the transport problem
scalar_t chemistry_time; //!< Time spent solving the chemistry problem
ReactiveTransportPerformance():
nb_iterations(0),
return_code(ReactiveTransportReturnCode::NotConvergedYet),
residuals(HUGE_VAL),
total_time(0.0),
transport_time(0.0),
chemistry_time(0.0)
{}
};
//! \brief Struct containing the execution time of the staggers
struct ReactiveTransportTimer
{
scalar_t transport_time;
scalar_t chemistry_time;
scalar_t upscaling_time;
};
} // end namespace solver
} // end namespace reactmicp
} // end namespace specmicp
#endif // SPECMICP_REACTMICP_SOLVER_REACTIVETRANSPORTSOLVERSTRUCTS_HPP

Event Timeline