https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ExplicitMassDamping.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#include "ExplicitMassDamping.h"
11#include "MooseError.h"
12#include "FEProblemBase.h"
13#include "NonlinearSystemBase.h"
14
16
19{
22 "Adds Rayleigh mass damping, eta * M * v, to an ExplicitMixedOrder solid mechanics model.");
23 params.addRangeCheckedParam<Real>(
24 "eta",
25 0.0,
26 "eta >= 0.0",
27 "Damping strength. Mass damping helps to damp low-frequency, large-scale oscillations. A "
28 "reasonable value to use initially is eta = 2 * d * omega, where d is the damping fraction "
29 "(typically 0.1) and omega is the lowest relevant frequency mode of the model. For "
30 "instance, if the model is can oscillate longitudinally, omega = (pi / model_length) * "
31 "sqrt(youngs_modulus / density)");
32 return params;
33}
34
36 : NodalKernel(parameters),
37 _eta(getParam<Real>("eta")),
38 _mass_matrix_lumped(initLumpedMass()),
39 _u_dot_old(_var.nodalValueDotOld())
40{
41}
42
43Real
45{
46 const auto dofnum = _variable->nodalDofIndex(); // dof for current var
47 return _eta * _mass_matrix_lumped(dofnum) * _u_dot_old;
48}
49
50const NumericVector<Number> &
52{
53 const auto & nl = _fe_problem.getNonlinearSystemBase(_sys.number());
54 if (nl.hasVector("mass_matrix_lumped"))
55 return nl.getVector("mass_matrix_lumped");
56
57 mooseError("Lumped mass matrix is missing. Make sure ExplicitMixedOrder is being used as the "
58 "time integrator.");
59}
registerMooseObject("SolidMechanicsApp", ExplicitMassDamping)
Calculates eta * mass * velocity for use in ExplicitMixedOrder time integration.
static InputParameters validParams()
const Real & _u_dot_old
The old velocity.
const NumericVector< Number > & _mass_matrix_lumped
The lumped mass matrix.
const NumericVector< Number > & initLumpedMass()
Initialize the lumped mass matrix.
const Real _eta
Damping coefficient.
virtual Real computeQpResidual() override
ExplicitMassDamping(const InputParameters &parameters)
NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num)
void addClassDescription(const std::string &doc_string)
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
void mooseError(Args &&... args) const
const dof_id_type & nodalDofIndex() const override
MooseVariableFE< Real > * _variable
FEProblemBase & _fe_problem
static InputParameters validParams()
SystemBase & _sys
unsigned int number() const
virtual NumericVector< Number > & getVector(const std::string &name)