From 377cf389efac50f5de61b8207c2edebab5af5fe2 Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Fri, 18 Oct 2024 15:34:41 -0500 Subject: [PATCH 1/2] setting h start to the timestep --- include/micm/solver/rosenbrock.inl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/micm/solver/rosenbrock.inl b/include/micm/solver/rosenbrock.inl index bb2226819..71be8b74f 100644 --- a/include/micm/solver/rosenbrock.inl +++ b/include/micm/solver/rosenbrock.inl @@ -21,8 +21,8 @@ namespace micm auto& K = derived_class_temporary_variables->K_; auto& Yerror = derived_class_temporary_variables->Yerror_; const double h_max = parameters_.h_max_ == 0.0 ? time_step : std::min(time_step, parameters_.h_max_); - const double h_start = - parameters_.h_start_ == 0.0 ? std::max(parameters_.h_min_, DELTA_MIN) : std::min(h_max, parameters_.h_start_); + const double h_start = time_step; + // parameters_.h_start_ == 0.0 ? std::max(parameters_.h_min_, DELTA_MIN) : std::min(h_max, parameters_.h_start_); SolverStats stats; From db522ab7c724561e0754c7715707b2d8bd306dbd Mon Sep 17 00:00:00 2001 From: Kyle Shores Date: Fri, 18 Oct 2024 15:55:10 -0500 Subject: [PATCH 2/2] adding h start to backward euler paramters --- include/micm/solver/backward_euler.inl | 2 +- include/micm/solver/backward_euler_solver_parameters.hpp | 1 + include/micm/solver/rosenbrock.inl | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/micm/solver/backward_euler.inl b/include/micm/solver/backward_euler.inl index 25fe68353..7ba8bb917 100644 --- a/include/micm/solver/backward_euler.inl +++ b/include/micm/solver/backward_euler.inl @@ -61,7 +61,7 @@ namespace micm std::size_t max_iter = parameters_.max_number_of_steps_; const auto time_step_reductions = parameters_.time_step_reductions_; - double H = time_step; + double H = parameters_.h_start_ == 0.0 ? time_step : parameters_.h_start_; double t = 0.0; std::size_t n_successful_integrations = 0; std::size_t n_convergence_failures = 0; diff --git a/include/micm/solver/backward_euler_solver_parameters.hpp b/include/micm/solver/backward_euler_solver_parameters.hpp index 59b6ea03e..71ed89a94 100644 --- a/include/micm/solver/backward_euler_solver_parameters.hpp +++ b/include/micm/solver/backward_euler_solver_parameters.hpp @@ -22,6 +22,7 @@ namespace micm std::vector absolute_tolerance_; double relative_tolerance_{ 1.0e-8 }; double small_{ 1.0e-40 }; + double h_start_{ 0.0 }; size_t max_number_of_steps_{ 11 }; // The time step reductions are used to determine the time step after a failed solve // This default set of time step reductions is used by CAM-Chem diff --git a/include/micm/solver/rosenbrock.inl b/include/micm/solver/rosenbrock.inl index 71be8b74f..b50314bee 100644 --- a/include/micm/solver/rosenbrock.inl +++ b/include/micm/solver/rosenbrock.inl @@ -21,8 +21,8 @@ namespace micm auto& K = derived_class_temporary_variables->K_; auto& Yerror = derived_class_temporary_variables->Yerror_; const double h_max = parameters_.h_max_ == 0.0 ? time_step : std::min(time_step, parameters_.h_max_); - const double h_start = time_step; - // parameters_.h_start_ == 0.0 ? std::max(parameters_.h_min_, DELTA_MIN) : std::min(h_max, parameters_.h_start_); + const double h_start = + parameters_.h_start_ == 0.0 ? std::max(parameters_.h_min_, DELTA_MIN) : std::min(h_max, parameters_.h_start_); SolverStats stats;