Skip to content

Commit

Permalink
Merge pull request #1230 from LLNL/tupek/initial_acceleration
Browse files Browse the repository at this point in the history
Easier initial guess for acceleration in dynamics.
  • Loading branch information
tupek2 authored Sep 30, 2024
2 parents c9a1f94 + f3b9d1c commit a830718
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 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
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

0 comments on commit a830718

Please sign in to comment.