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