16 #ifndef dealii_sundials_arkode_h 17 #define dealii_sundials_arkode_h 19 #include <deal.II/base/config.h> 20 #include <deal.II/base/mpi.h> 22 #ifdef DEAL_II_WITH_SUNDIALS 24 #include <deal.II/base/logstream.h> 25 #include <deal.II/base/exceptions.h> 26 #include <deal.II/base/parameter_handler.h> 27 #include <deal.II/base/conditional_ostream.h> 28 #include <deal.II/base/mpi.h> 29 #ifdef DEAL_II_WITH_PETSC 30 # include <deal.II/lac/petsc_parallel_block_vector.h> 31 # include <deal.II/lac/petsc_parallel_vector.h> 33 #include <deal.II/lac/vector.h> 34 #include <deal.II/lac/vector_memory.h> 37 #include <arkode/arkode.h> 38 #include <arkode/arkode_impl.h> 39 #include <nvector/nvector_serial.h> 40 #ifdef DEAL_II_WITH_MPI 41 # include <nvector/nvector_parallel.h> 43 #include <sundials/sundials_math.h> 44 #include <sundials/sundials_types.h> 46 #include <boost/signals2.hpp> 50 DEAL_II_NAMESPACE_OPEN
53 #define AssertARKode(code) Assert(code >= 0, ExcARKodeError(code)) 309 template<
typename VectorType=Vector<
double> >
504 const MPI_Comm mpi_comm = MPI_COMM_WORLD);
515 unsigned int solve_ode(VectorType &solution);
531 void reset(
const double &t,
533 const VectorType &y);
557 std::function<int(
const double t,
577 std::function<int(
const double t,
662 std::function<int(
const int convfail,
665 const VectorType &ypred,
666 const VectorType &fpred,
712 std::function<int(
const double t,
714 const VectorType &ycur,
715 const VectorType &fcur,
716 const VectorType &rhs,
789 std::function<void(
const double t,
790 const VectorType &sol,
810 std::function<bool (
const double t,
824 DeclException1(ExcARKodeError,
int, <<
"One of the SUNDIALS ARKode internal functions " 825 <<
" returned a negative error code: " 826 << arg1 <<
". Please consult SUNDIALS manual.");
835 <<
"Please provide an implementation for the function \"" << arg1 <<
"\"");
876 #ifdef DEAL_II_WITH_PETSC 877 #ifdef PETSC_USE_COMPLEX 878 static_assert(!std::is_same<VectorType, PETScWrappers::MPI::Vector>::value,
879 "Sundials does not support complex scalar types, " 880 "but PETSc is configured to use a complex scalar type!");
882 static_assert(!std::is_same<VectorType, PETScWrappers::MPI::BlockVector>::value,
883 "Sundials does not support complex scalar types, " 884 "but PETSc is configured to use a complex scalar type!");
885 #endif // PETSC_USE_COMPLEX 886 #endif // DEAL_II_WITH_PETSC 891 DEAL_II_NAMESPACE_CLOSE
std::function< VectorType &()> get_local_tolerances
bool implicit_function_is_time_independent
GrowingVectorMemory< VectorType > mem
std::function< int(const VectorType &rhs, VectorType &dst)> solve_mass_system
double relative_tolerance
void reset(const double &t, const double &h, const VectorType &y)
std::function< bool(const double t, VectorType &sol)> solver_should_restart
unsigned int maximum_non_linear_iterations
std::function< int(const double t)> setup_mass
std::function< int(const double t, const VectorType &y, VectorType &explicit_f)> explicit_function
std::function< void(const double t, const VectorType &sol, const unsigned int step_number)> output_step
void enter_subsection(const std::string &subsection)
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 double &absolute_tolerance=1e-6, const double &relative_tolerance=1e-5)
std::function< int(const double t, const VectorType &y, VectorType &res)> implicit_function
bool implicit_function_is_linear
std::function< int(const int convfail, const double t, const double gamma, const VectorType &ypred, const VectorType &fpred, bool &j_is_current)> setup_jacobian
DeclException1(ExcARKodeError, int,<< "One of the SUNDIALS ARKode internal functions "<< " returned a negative error code: "<< arg1<< ". Please consult SUNDIALS manual.")
unsigned int maximum_order
void add_parameters(ParameterHandler &prm)
void add_parameter(const std::string &entry, ParameterType ¶meter, const std::string &documentation=std::string(), const Patterns::PatternBase &pattern= *Patterns::Tools::Convert< ParameterType >::to_pattern())
std::function< void(VectorType &)> reinit_vector
unsigned int solve_ode(VectorType &solution)
void set_functions_to_trigger_an_assert()
std::function< int(const double t, const double gamma, const VectorType &ycur, const VectorType &fcur, const VectorType &rhs, VectorType &dst)> solve_jacobian_system
ARKode(const AdditionalData &data=AdditionalData(), const MPI_Comm mpi_comm=MPI_COMM_WORLD)
double absolute_tolerance