8 const Form &form_to_damp,
10 const bool use_stiffness_as_ratio,
11 const double stiffness,
12 const int n_lagging_iters)
13 : form_to_damp_(form_to_damp),
14 time_integrator_(time_integrator),
15 use_stiffness_as_ratio_(use_stiffness_as_ratio),
16 stiffness_(stiffness),
17 n_lagging_iters_(n_lagging_iters)
25 const std::unordered_map<std::string, std::shared_ptr<Form>> &forms,
28 const std::string form_name = params[
"form"];
29 if (forms.find(form_name) == forms.end())
32 std::shared_ptr<Form> form_to_damp = forms.at(form_name);
33 if (form_to_damp ==
nullptr)
34 log_and_throw_error(
"Cannot use Rayleigh damping on {0} form because {0} is disabled", form_name);
36 const bool use_stiffness_as_ratio = params.contains(
"stiffness_ratio");
37 const double stiffness = use_stiffness_as_ratio ? params[
"stiffness_ratio"] : params[
"stiffness"];
39 return std::make_shared<RayleighDampingForm>(
40 *form_to_damp, time_integrator, use_stiffness_as_ratio,
stiffness,
41 params[
"lagging_iterations"]);
Implicit time integrator of a second order ODE (equivently a system of coupled first order ODEs).
const double & dt() const
Access the time step size.
virtual Eigen::VectorXd compute_velocity(const Eigen::VectorXd &x) const =0
Compute the current velocity given the current solution and using the stored previous solution(s).
virtual double dv_dx(const unsigned prev_ti=0) const =0
Compute the derivative of the velocity with respect to the solution.
void log_and_throw_error(const std::string &msg)
Eigen::SparseMatrix< double, Eigen::ColMajor > StiffnessMatrix