Skip to content

Commit

Permalink
Allow nonlinear solver option to change initial trust region radius.
Browse files Browse the repository at this point in the history
  • Loading branch information
tupek2 committed Sep 27, 2024
1 parent 8950cf1 commit 67b54f6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/serac/numerics/equation_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ class TrustRegion : public mfem::NewtonSolver {
settings.min_cg_iterations = static_cast<size_t>(nonlinear_options.min_iterations);
settings.max_cg_iterations = static_cast<size_t>(linear_options.max_iterations);
settings.cg_tol = 0.5 * norm_goal;
double tr_size = 0.1 * std::sqrt(X.Size());
double tr_size = nonlinear_options.trust_region_scaling * std::sqrt(X.Size());
size_t cumulative_cg_iters_from_last_precond_update = 0;

auto& d = trResults.d; // reuse, maybe dangerous!
Expand Down
3 changes: 3 additions & 0 deletions src/serac/numerics/solver_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,9 @@ struct NonlinearSolverOptions {
/// Debug print level
int print_level = 0;

/// Scaling for the initial trust region size
double trust_region_scaling = 0.1;

/// Should the gradient be converted to a monolithic matrix
bool force_monolithic = false;
};
Expand Down
4 changes: 3 additions & 1 deletion src/serac/physics/solid_mechanics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,7 @@ class SolidMechanics<order, dim, Parameters<parameter_space...>, std::integer_se
du_[j] -= displacement_(j);
}

if (use_warm_start_ && is_quasistatic_) {
if (use_warm_start_) {
// Update the linearized Jacobian matrix
auto r = (*residual_)(time_ + dt, shape_displacement_, displacement_, acceleration_,
*parameters_[parameter_indices].state...);
Expand Down Expand Up @@ -1768,6 +1768,8 @@ class SolidMechanics<order, dim, Parameters<parameter_space...>, std::integer_se

displacement_ += du_;
}


};

} // namespace serac

0 comments on commit 67b54f6

Please sign in to comment.