Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easier initial guess for acceleration in dynamics. #1230

Merged
merged 5 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions src/serac/numerics/odes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,11 @@ void SecondOrderODE::Solve(const double time, const double c0, const double c1,
dU_dt_.SetSubVectorComplement(constrained_dofs, 0.0);
state_.du_dt += dU_dt_;

// use the previous solution as our starting guess
// use 0 as our starting guess for unconstrained dofs
d2u_dt2 = state_.d2u_dt2;
d2u_dt2.SetSubVector(constrained_dofs, 0.0);
d2U_dt2_.SetSubVectorComplement(constrained_dofs, 0.0);
d2u_dt2 += d2U_dt2_;
d2u_dt2.SetSubVectorComplement(constrained_dofs, 0.0);

solver_.solve(d2u_dt2);
SLIC_WARNING_ROOT_IF(!solver_.nonlinearSolver().GetConverged(), "Newton Solver did not converge.");
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
2 changes: 1 addition & 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