16 #ifndef _d2k_imex_stepper_h 17 #define _d2k_imex_stepper_h 19 #include <deal2lkit/config.h> 26 #ifdef D2K_WITH_SUNDIALS 30 #ifdef DEAL_II_WITH_MPI 54 template<
typename VEC=Vector<
double> >
59 #ifdef DEAL_II_WITH_MPI 65 MPI_Comm comm = MPI_COMM_WORLD);
78 unsigned int solve_dae(VEC &solution, VEC &solution_dot);
105 #ifdef DEAL_II_WITH_MPI 106 MPI_Comm communicator;
113 void compute_y_dot(
const VEC &y,
const VEC &prev,
const double alpha, VEC &y_dot);
201 const bool update_Jacobian,
202 const VEC &previous_solution,
230 std::function<int(
const double t,
238 std::function<int(
const double t,
251 std::function<void (
const double t,
261 std::function<bool (
const double t,
276 std::function<int(
const VEC &src,
double line_search_with_backtracking(const VEC &update, const VEC &prev_sol, const double &alpha, const double &t, VEC &sol, VEC &sol_dot, VEC &residual)
line search algorithm with backtracking.The following sequence of Newton relaxation parameters is tes...
unsigned int max_outer_non_linear_iterations
Maximum number of outer iterations for Newton method.
bool update_jacobian_continuously
Jacobian is updated at each outer iteration and time step.
std::function< int(const VEC &src, VEC &dst)> jacobian_vmult
Compute the matrix-vector product Jacobian times src, and the result is put in dst.
double abs_tol
Absolute error tolerance for non linear iterations.
A parameter acceptor base class.
ConditionalOStream pcout
Output stream.
virtual void declare_parameters(ParameterHandler &prm)
Declare parameters for this class to function properly.
void set_functions_to_trigger_an_assert()
Set the std::functions above to trigger an assert if they are not implemented.
void do_newton(const double t, const double alpha, const bool update_Jacobian, const VEC &previous_solution, VEC &solution, VEC &solution_dot)
find solution applying the newton method with given
KINSOLInterface< VEC > kinsol
kinsol solver
void set_initial_time(const double &t)
Set initial time equal to t disregarding what is written in the parameter file.
std::string method
method used for alpha selection
static ParameterHandler prm
Static parameter.
bool verbose
print useful informations
bool use_kinsol
use kinsol solver true or false
unsigned int max_inner_non_linear_iterations
Maximum number of inner iterations for Newton method.
std::function< VEC &()> get_lumped_mass_matrix
Return the lumped mass matrix vector.
unsigned int solve_dae(VEC &solution, VEC &solution_dot)
Evolve.
void compute_y_dot(const VEC &y, const VEC &prev, const double alpha, VEC &y_dot)
double step_size
Step size.
std::function< void(const double t, const VEC &sol, const VEC &sol_dot, const unsigned int step_number)> output_step
Store solutions to file.
std::function< int(const VEC &rhs, VEC &dst)> solve_jacobian_system
Solve linear system.
std::string _step_size
user defined step_size
Interface to SUNDIALS KINSOL library.
unsigned int output_period
Seconds between each output.
double final_time
Final time.
double rel_tol
Relative error tolerance for non linear iterations.
void compute_consistent_initial_conditions(const double &t, VEC &y, VEC &y_dot)
compute_consistent_initial_conditions
void compute_previous_solution(const VEC &sol, const VEC &sol_dot, const double &alpha, VEC &prev)
compute previous solution from given
IMEXStepper(std::string &name="")
Constructor for the IMEXStepper class.
std::function< bool(const double t, VEC &sol, VEC &sol_dot)> solver_should_restart
Evaluate wether the mesh should be refined or not.
std::function< int(const double t, const VEC &y, const VEC &y_dot, VEC &res)> residual
Compute residual.
IMEXStepper solves non-linear time dependent problems with user-defined size of the time step and usi...
double get_alpha() const
if initial time is different from final time (i.e., we are solving a time-dep problem and not a stati...
std::function< int(const double t, const VEC &y, const VEC &y_dot, const double alpha)> setup_jacobian
Compute Jacobian.
double evaluate_step_size(const double &t)
evaluate step size at time t according to the expression stored in _step_size
unsigned int n_max_backtracking
i max
double initial_time
Initial time for the ode.
std::function< shared_ptr< VEC >)> create_new_vector
Return a shared_ptr<VEC>.
std::function< double(const VEC &vector)> vector_norm
Return the norm of vector.
double newton_alpha
Alpha to use in Newton method for the update of the solution.