Line data Source code
1 : // libMesh includes 2 : #include "libmesh/numeric_vector.h" 3 : 4 : // MOOSE includes 5 : #include "Assembly.h" 6 : #include "MooseVariable.h" 7 : #include "SystemBase.h" 8 : 9 : // Mastodon includes 10 : #include "ShearWaveIndicator.h" 11 : 12 : registerMooseObject("MastodonApp", ShearWaveIndicator); 13 : 14 : InputParameters 15 32 : ShearWaveIndicator::validParams() 16 : { 17 32 : InputParameters params = Indicator::validParams(); 18 64 : params.addParam<MaterialPropertyName>("shear_wave_speed", 19 : "shear_wave_speed", 20 : "The name of the material properties " 21 : "(type Real) that computes the shear " 22 : "wave velocity."); 23 64 : params.addRequiredParam<Real>("cutoff_frequency", "The cutoff frequency in Hertz."); 24 32 : params.addClassDescription("Computes the minimum element size based on the shear wave speed."); 25 32 : return params; 26 0 : } 27 : 28 16 : ShearWaveIndicator::ShearWaveIndicator(const InputParameters & parameters) 29 : : Indicator(parameters), 30 16 : _shear_wave_speed(getMaterialProperty<Real>("shear_wave_speed")), 31 32 : _cutoff_frequency(getParam<Real>("cutoff_frequency")), 32 16 : _qrule(_assembly.qRule()), 33 32 : _indicator_var(_sys.getFieldVariable<Real>(_tid, name())) 34 : { 35 16 : } 36 : 37 : void 38 53038 : ShearWaveIndicator::computeIndicator() 39 : { 40 53038 : _minimum_element_size.resize(_qrule->n_points()); 41 265190 : for (_qp = 0; _qp < _qrule->n_points(); ++_qp) 42 212152 : _minimum_element_size[_qp] = 1.0 / _cutoff_frequency * _shear_wave_speed[_qp]; 43 : 44 : Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx); 45 106076 : _solution.set(_indicator_var.nodalDofIndex(), 46 : *std::min_element(_minimum_element_size.begin(), _minimum_element_size.end())); 47 53038 : }