https://mooseframework.inl.gov
DensityScaling.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* This file is part of the MOOSE framework
3 //* https://mooseframework.inl.gov
4 //*
5 //* All rights reserved, see COPYRIGHT for full restrictions
6 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
7 //*
8 //* Licensed under LGPL 2.1, please see LICENSE for details
9 //* https://www.gnu.org/licenses/lgpl-2.1.html
10 
11 #include "DensityScaling.h"
12 #include "libmesh/utility.h"
13 
14 registerMooseObject("SolidMechanicsApp", DensityScaling);
15 
18 {
20  params.addClassDescription("Automatically scale the material density to achieve the desired time "
21  "step size to satisfy CFL conditions.");
22  params.addRequiredParam<MaterialPropertyName>(
23  "density",
24  "Name of Material Property or a constant real number defining the density of the material.");
25  params.addRequiredParam<Real>("desired_time_step", "Time step to achieve.");
26  params.addParam<Real>(
27  "factor",
28  1.0,
29  "Factor to multiply to the critical time step. This factor is typically less than one to be "
30  "on the conservative side due to two types of approximation: Time step lagging and the "
31  "approximation of the critical time step formula.");
32  return params;
33 }
34 
36  : Material(parameters),
37  _desired_time_step(getParam<Real>("desired_time_step")),
38  _density_scaling(declareProperty<Real>("density_scaling")),
39  _material_density(getMaterialPropertyByName<Real>("density")),
40  _effective_stiffness(getMaterialPropertyByName<Real>("effective_stiffness")),
41  _factor(getParam<Real>("factor"))
42 {
43  mooseInfo("Since it can change key simulation results, usage of selective density (mass) scaling "
44  "is only recommended for advanced users.");
45 }
46 
47 void
49 {
50  const Real critical = _factor * _current_elem->hmin() * std::sqrt(_material_density[_qp]) /
52 
53  if (critical < _desired_time_step)
54  {
55  const Real desired_density = std::pow(_effective_stiffness[_qp] * _desired_time_step, 2) /
56  std::pow(_factor * _current_elem->hmin(), 2);
57 
58  const Real density_to_add =
59  desired_density > _material_density[_qp] ? desired_density - _material_density[_qp] : 0.0;
60 
61  _density_scaling[_qp] = density_to_add;
62  }
63  else
64  _density_scaling[_qp] = 0.0;
65 }
DensityScaling(const InputParameters &parameters)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const Real _desired_time_step
User-prescribed desired time step. Mass will be added until fulfilled.
void mooseInfo(Args &&... args) const
const MaterialProperty< Real > & _material_density
Density of the material.
const Real & _factor
User defined factor to be multiplied to the critical time step.
virtual void computeQpProperties()
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
This material computes the mass required to fulfill a prescribed critical time step.
unsigned int _qp
const MaterialProperty< Real > & _effective_stiffness
Effective stiffness of element: function of material properties and element size. ...
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
MooseUnits pow(const MooseUnits &, int)
MaterialProperty< Real > & _density_scaling
The stress tensor.
const Elem *const & _current_elem
registerMooseObject("SolidMechanicsApp", DensityScaling)