Skip to content

Commit

Permalink
Set hstart to timestep (#679)
Browse files Browse the repository at this point in the history
* setting h start to the timestep

* adding h start to backward euler paramters
  • Loading branch information
K20shores authored Oct 19, 2024
1 parent 9c93671 commit 24d9c19
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/micm/solver/backward_euler.inl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions include/micm/solver/backward_euler_solver_parameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace micm
std::vector<double> 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
Expand Down
2 changes: 1 addition & 1 deletion include/micm/solver/rosenbrock.inl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ 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 =
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;
Expand Down

0 comments on commit 24d9c19

Please sign in to comment.