https://mooseframework.inl.gov
CriticalTimeStep.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 "CriticalTimeStep.h"
11 
12 registerMooseObject("SolidMechanicsApp", CriticalTimeStep);
13 
16 {
18  params.addClassDescription(
19  "Computes and reports the critical time step for the explicit solver.");
20  params.addParam<MaterialPropertyName>(
21  "density",
22  "Name of Material Property or a constant real number defining the density of the material.");
23  params.addParam<MaterialPropertyName>(
24  "density_scaling", "Name of material property to add mass scaling in explicit simulations.");
25  params.addParam<Real>("factor", 1.0, "Factor to mulitply to the critical time step.");
26  return params;
27 }
28 
30  : ElementPostprocessor(parameters),
31  GuaranteeConsumer(this),
32  _material_density(getMaterialPropertyByName<Real>("density")),
33  _density_scaling(parameters.isParamSetByUser("density_scaling")
34  ? &getMaterialPropertyByName<Real>("density_scaling")
35  : nullptr),
36  _effective_stiffness(getMaterialPropertyByName<Real>("effective_stiffness")),
37  _factor(getParam<Real>("factor")),
38  _critical_time(parameters.isParamValid("critical_time"))
39 {
40 }
41 
42 void
44 {
45  if (!hasGuaranteedMaterialProperty("effective_stiffness", Guarantee::ISOTROPIC))
46  paramError("CriticalTimeStep can only be used with elasticity tensor materials "
47  "that guarantee isotropic tensors.");
48 }
49 
50 void
52 {
53  _critical_time = std::numeric_limits<Real>::max();
54 }
55 
56 void
58 {
59  const Real dens = _material_density[0];
60  const Real dens_scaling = _density_scaling ? (*_density_scaling)[0] : 0.0;
61 
62  // In the above line, density is inferred only at the first quadrature point
63  // of each element. Since critical time step is computed across all elements and
64  // a minimum is then taken, this is okay.
65  _critical_time = std::min(_factor * _current_elem->hmin() * std::sqrt(dens + dens_scaling) /
68 }
69 
70 void
72 {
74 }
75 
76 Real
78 {
79  return _critical_time;
80 }
81 
82 void
84 {
85  const auto & pps = static_cast<const CriticalTimeStep &>(y);
86  _critical_time = std::min(pps._critical_time, _critical_time);
87 }
Compute the critical time step for an explicit integration scheme by inferring an effective_stiffness...
const MaterialProperty< Real > & _effective_stiffness
Effective stiffness of element: function of material properties and element size. ...
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const MaterialProperty< Real > * _density_scaling
Added density due to mass scaling (zero if no scaling is selected or applied)
static InputParameters validParams()
const MaterialProperty< Real > & _material_density
Density of the material.
const std::vector< double > y
void gatherMin(T &value)
virtual void initialize() override
CriticalTimeStep(const InputParameters &parameters)
virtual Real getValue() const override
virtual void initialSetup() override
void paramError(const std::string &param, Args... args) const
virtual void finalize() override
virtual void execute() override
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real & _factor
User defined factor to be multiplied to the critical time step.
const Elem *const & _current_elem
virtual void threadJoin(const UserObject &y) override
registerMooseObject("SolidMechanicsApp", CriticalTimeStep)
void addClassDescription(const std::string &doc_string)
bool hasGuaranteedMaterialProperty(const MaterialPropertyName &prop, Guarantee guarantee)
Add-on class that provides the functionality to check if guarantees for material properties are provi...
Real _critical_time
Critical time step for explicit solver.