16 #ifndef dealii_sundials_arkode_h 17 #define dealii_sundials_arkode_h 23 #ifdef DEAL_II_WITH_SUNDIALS 29 # ifdef DEAL_II_WITH_PETSC 36 # include <arkode/arkode.h> 37 # if DEAL_II_SUNDIALS_VERSION_LT(4, 0, 0) 38 # include <arkode/arkode_impl.h> 40 # include <nvector/nvector_serial.h> 41 # ifdef DEAL_II_WITH_MPI 42 # include <nvector/nvector_parallel.h> 49 # include <boost/signals2.hpp> 51 # include <sundials/sundials_linearsolver.h> 52 # include <sundials/sundials_math.h> 53 # include <sundials/sundials_types.h> 62 # define AssertARKode(code) Assert(code >= 0, ExcARKodeError(code)) 332 template <
typename VectorType = Vector<
double>>
530 const MPI_Comm & mpi_comm = MPI_COMM_WORLD);
575 const double intermediate_time,
576 const bool reset_solver =
false);
661 std::function<int(const double t, const VectorType &y, VectorType &res)>
664 # if DEAL_II_SUNDIALS_VERSION_LT(4, 0, 0) 749 std::function<
int(
const int convfail,
754 bool & j_is_current)>
801 std::function<
int(
const double t,
863 std::function<int(const VectorType &rhs, VectorType &dst)>
884 std::function<int(double t, const VectorType &v, VectorType &Mv)>
990 std::function<int(realtype t, const VectorType &y, const VectorType &fy)>
1063 std::function<
int(
double t,
1115 std::function<
int(
double t,
1195 std::function<void(
const double t,
1197 const unsigned int step_number)>
1260 <<
"Please provide an implementation for the function \"" 1269 const bool do_reset);
1271 # if DEAL_II_SUNDIALS_VERSION_GTE(4, 0, 0) 1323 # if DEAL_II_SUNDIALS_VERSION_GTE(4, 0, 0) 1325 std::unique_ptr<internal::LinearSolverWrapper<VectorType>>
mass_solver;
1328 # ifdef DEAL_II_WITH_PETSC 1329 # ifdef PETSC_USE_COMPLEX 1330 static_assert(!std::is_same<VectorType, PETScWrappers::MPI::Vector>::value,
1331 "Sundials does not support complex scalar types, " 1332 "but PETSc is configured to use a complex scalar type!");
1335 !std::is_same<VectorType, PETScWrappers::MPI::BlockVector>::value,
1336 "Sundials does not support complex scalar types, " 1337 "but PETSc is configured to use a complex scalar type!");
1338 # endif // PETSC_USE_COMPLEX 1339 # endif // DEAL_II_WITH_PETSC 1348 <<
"One of the SUNDIALS ARKode internal functions " 1349 <<
" returned a negative error code: " << arg1
1350 <<
". Please consult SUNDIALS manual.");
void setup_mass_solver(const VectorType &solution)
void reset(const double t, const double h, const VectorType &y)
bool implicit_function_is_time_independent
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
LinearSolveFunction< VectorType > solve_linearized_system
void * get_arkode_memory() const
std::function< int(const VectorType &rhs, VectorType &dst)> solve_mass_system
void add_parameter(const std::string &entry, ParameterType ¶meter, const std::string &documentation="", const Patterns::PatternBase &pattern= *Patterns::Tools::Convert< ParameterType >::to_pattern(), const bool has_to_be_set=false)
DEAL_II_DEPRECATED std::function< void(VectorType &)> reinit_vector
double relative_tolerance
std::function< void(const double t, const VectorType &sol, const unsigned int step_number)> output_step
std::function< VectorType &()> get_local_tolerances
unsigned int maximum_non_linear_iterations
std::function< int(const double t)> setup_mass
std::function< bool(const double t, VectorType &sol)> solver_should_restart
void enter_subsection(const std::string &subsection)
std::unique_ptr< internal::LinearSolverWrapper< VectorType > > mass_solver
AdditionalData(const double initial_time=0.0, const double final_time=1.0, const double initial_step_size=1e-2, const double output_period=1e-1, const double minimum_step_size=1e-6, const unsigned int maximum_order=5, const unsigned int maximum_non_linear_iterations=10, const bool implicit_function_is_linear=false, const bool implicit_function_is_time_independent=false, const bool mass_is_time_independent=false, const int anderson_acceleration_subspace=3, const double absolute_tolerance=1e-6, const double relative_tolerance=1e-5)
ARKode(const AdditionalData &data=AdditionalData(), const MPI_Comm &mpi_comm=MPI_COMM_WORLD)
std::function< int(const double t, const double gamma, const VectorType &ycur, const VectorType &fcur, const VectorType &rhs, VectorType &dst)> solve_jacobian_system
std::function< int(const double t)> mass_times_setup
bool mass_is_time_independent
std::function< int(double t, const VectorType &y, const VectorType &fy, const VectorType &r, VectorType &z, double gamma, double tol, int lr)> jacobian_preconditioner_solve
void setup_system_solver(const VectorType &solution)
#define DEAL_II_NAMESPACE_CLOSE
std::function< int(const double t, const VectorType &y, VectorType &res)> implicit_function
std::function< int(realtype t, const VectorType &y, const VectorType &fy)> jacobian_times_setup
bool implicit_function_is_linear
LinearSolveFunction< VectorType > solve_mass
std::function< int(double t, const VectorType &v, VectorType &Mv)> mass_times_vector
unsigned int maximum_order
void add_parameters(ParameterHandler &prm)
std::function< int(double t, const VectorType &y, const VectorType &fy, int jok, int &jcur, double gamma)> jacobian_preconditioner_setup
#define DEAL_II_NAMESPACE_OPEN
std::function< int(const double t, const VectorType &y, VectorType &explicit_f)> explicit_function
int do_evolve_time(VectorType &solution, ::DiscreteTime &time, const bool do_reset)
std::function< int(const VectorType &v, VectorType &Jv, double t, const VectorType &y, const VectorType &fy)> jacobian_times_vector
int anderson_acceleration_subspace
DeclException1(ExcFunctionNotProvided, std::string,<< "Please provide an implementation for the function << arg1<< "\")
std::function< int(double t)> mass_preconditioner_setup
std::function< void(void *arkode_mem)> custom_setup
unsigned int solve_ode(VectorType &solution)
std::function< int(const int convfail, const double t, const double gamma, const VectorType &ypred, const VectorType &fpred, bool &j_is_current)> setup_jacobian
std::function< int(SundialsOperator< VectorType > &op, SundialsPreconditioner< VectorType > &prec, VectorType &x, const VectorType &b, double tol)> LinearSolveFunction
std::function< int(double t, const VectorType &r, VectorType &z, double tol, int lr)> mass_preconditioner_solve
long double gamma(const unsigned int n)
void set_functions_to_trigger_an_assert()
#define DEAL_II_DEPRECATED
unsigned int solve_ode_incrementally(VectorType &solution, const double intermediate_time, const bool reset_solver=false)
std::unique_ptr< internal::LinearSolverWrapper< VectorType > > linear_solver
double absolute_tolerance