www.mooseframework.org
CriticalTimeStep.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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("TensorMechanicsApp", CriticalTimeStep);
13 
15 
16 InputParameters
18 {
19  InputParameters params = ElementPostprocessor::validParams();
20  params.addClassDescription(
21  "Computes and reports the critical time step for the explicit solver.");
22  params.addParam<MaterialPropertyName>(
23  "density",
24  "Name of Material Property or a constant real number defining the density of the material.");
25  params.addParam<Real>("factor", 1.0, "Factor to mulitply to the critical time step.");
26  return params;
27 }
28 
29 CriticalTimeStep::CriticalTimeStep(const InputParameters & parameters)
30  : ElementPostprocessor(parameters),
31  GuaranteeConsumer(this),
32  _material_density(getMaterialPropertyByName<Real>("density")),
33  _effective_stiffness(getMaterialPropertyByName<Real>("effective_stiffness")),
34  _factor(getParam<Real>("factor")),
35  _critical_time(parameters.isParamValid("critical_time"))
36 {
37 }
38 
39 void
41 {
42  if (!hasGuaranteedMaterialProperty("effective_stiffness", Guarantee::ISOTROPIC))
43  paramError("CriticalTimeStep can only be used with elasticity tensor materials "
44  "that guarantee isotropic tensors.");
45 }
46 
47 void
49 {
50  _critical_time = std::numeric_limits<Real>::max();
51 }
52 
53 void
55 {
56  Real dens = _material_density[0];
57  // In the above line, density is inferred only at the first quadrature point
58  // of each element. Since critical time step is computed across all elements and
59  // a minimum is then taken, this is okay.
61  std::min(_factor * _current_elem->hmin() * std::sqrt(dens) / (_effective_stiffness[0]),
63 }
64 
65 void
67 {
68  gatherMin(_critical_time);
69 }
70 
71 Real
73 {
74  return _critical_time;
75 }
76 
77 void
78 CriticalTimeStep::threadJoin(const UserObject & y)
79 {
80  const CriticalTimeStep & pps = static_cast<const CriticalTimeStep &>(y);
82 }
CriticalTimeStep::initialSetup
virtual void initialSetup() override
Definition: CriticalTimeStep.C:40
CriticalTimeStep::validParams
static InputParameters validParams()
Definition: CriticalTimeStep.C:17
CriticalTimeStep::finalize
virtual void finalize() override
Definition: CriticalTimeStep.C:66
CriticalTimeStep::execute
virtual void execute() override
Definition: CriticalTimeStep.C:54
CriticalTimeStep.h
CriticalTimeStep::threadJoin
virtual void threadJoin(const UserObject &y) override
Definition: CriticalTimeStep.C:78
CriticalTimeStep::_factor
const Real & _factor
User defined factor to be multiplied to the critical time step.
Definition: CriticalTimeStep.h:50
CriticalTimeStep::_critical_time
Real _critical_time
Critical time step for explicit solver.
Definition: CriticalTimeStep.h:53
CriticalTimeStep::_effective_stiffness
const MaterialProperty< Real > & _effective_stiffness
Effective stiffness of element: function of material properties and element size.
Definition: CriticalTimeStep.h:47
GuaranteeConsumer
Add-on class that provides the functionality to check if guarantees for material properties are provi...
Definition: GuaranteeConsumer.h:25
validParams
InputParameters validParams()
GuaranteeConsumer::hasGuaranteedMaterialProperty
bool hasGuaranteedMaterialProperty(const MaterialPropertyName &prop, Guarantee guarantee)
Definition: GuaranteeConsumer.C:28
CriticalTimeStep::_material_density
const MaterialProperty< Real > & _material_density
Density of the material.
Definition: CriticalTimeStep.h:44
CriticalTimeStep::getValue
virtual Real getValue() override
Definition: CriticalTimeStep.C:72
CriticalTimeStep
Definition: CriticalTimeStep.h:27
CriticalTimeStep::CriticalTimeStep
CriticalTimeStep(const InputParameters &parameters)
Definition: CriticalTimeStep.C:29
registerMooseObject
registerMooseObject("TensorMechanicsApp", CriticalTimeStep)
CriticalTimeStep::initialize
virtual void initialize() override
Definition: CriticalTimeStep.C:48
defineLegacyParams
defineLegacyParams(CriticalTimeStep)
Guarantee::ISOTROPIC