Line data Source code
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 "DensityScaling.h" 11 : #include "libmesh/utility.h" 12 : 13 : registerMooseObject("SolidMechanicsApp", DensityScaling); 14 : 15 : InputParameters 16 28 : DensityScaling::validParams() 17 : { 18 28 : InputParameters params = Material::validParams(); 19 28 : params.addClassDescription( 20 : "Computes the scaled inertial density needed to enable stable explicit time-stepping using " 21 : "the " 22 : "desired_time_step in solid-mechanics problems. Note that if this inertial density is used " 23 : "in input files (for instance, in the mass matrix) it will impact the dynamics of the " 24 : "system, largely eliminating high-frequency oscillations, and impacting low-frequency " 25 : "dynamics. Hence, use with caution."); 26 56 : params.addRequiredParam<MaterialPropertyName>( 27 : "true_density", 28 : "Name of Material Property defining the true inertial density of the material."); 29 56 : params.addRequiredParam<MaterialPropertyName>( 30 : "scaled_density", "Name of the scaled density property that this Material computes."); 31 56 : params.addParam<MaterialPropertyName>( 32 : "additional_density", 33 : "additional_density", 34 : "Name of the additional density property that this Material computes"); 35 56 : params.addRequiredParam<Real>("desired_time_step", "The desired time step."); 36 84 : params.addRangeCheckedParam<Real>( 37 : "safety_factor", 38 56 : 0.7, 39 : "(safety_factor>0) & (safety_factor<=1)", 40 : "The scaled density that this Material produces will potentially allow stable time-step " 41 : "sizes of desired_time_step / safety_factor. In practice, however, using such a time step " 42 : "might result in instabilities, because of time-step lagging and the approximate critical " 43 : "time-step formula used by this Material. Hence, safety_factor allows for a safety margin."); 44 28 : return params; 45 0 : } 46 : 47 21 : DensityScaling::DensityScaling(const InputParameters & parameters) 48 : : Material(parameters), 49 21 : _desired_time_step(getParam<Real>("desired_time_step")), 50 42 : _density_scaled(declareProperty<Real>(getParam<MaterialPropertyName>("scaled_density"))), 51 21 : _additional_density( 52 42 : declareProperty<Real>(getParam<MaterialPropertyName>("additional_density"))), 53 42 : _material_density(getMaterialProperty<Real>("true_density")), 54 42 : _sqrt_effective_stiffness(getMaterialPropertyByName<Real>("effective_stiffness")), 55 63 : _safety_factor(getParam<Real>("safety_factor")) 56 : { 57 21 : } 58 : 59 : void 60 1264 : DensityScaling::computeQpProperties() 61 : { 62 1264 : const Real stable_density = Utility::pow<2>(_sqrt_effective_stiffness[_qp] * _desired_time_step / 63 1264 : _safety_factor / _current_elem->hmin()); 64 : 65 1264 : _density_scaled[_qp] = std::max(stable_density, _material_density[_qp]); 66 1264 : _additional_density[_qp] = _density_scaled[_qp] - _material_density[_qp]; 67 1264 : }