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 "RBMPresetOldValuePD.h" 11 : 12 : registerMooseObject("PeridynamicsApp", RBMPresetOldValuePD); 13 : 14 : InputParameters 15 80 : RBMPresetOldValuePD::validParams() 16 : { 17 80 : InputParameters params = DirichletBCBase::validParams(); 18 80 : params.addClassDescription("Class to apply a preset BC to nodes with rigid body motion (RBM)."); 19 : 20 : // Forcefully preset the BC 21 80 : params.set<bool>("preset") = true; 22 80 : params.suppressParameter<bool>("preset"); 23 : 24 80 : return params; 25 0 : } 26 : 27 40 : RBMPresetOldValuePD::RBMPresetOldValuePD(const InputParameters & parameters) 28 : : DirichletBCBase(parameters), 29 0 : _pdmesh(dynamic_cast<PeridynamicsMesh &>(_mesh)), 30 40 : _u_old(_var.dofValuesOld()), 31 80 : _bond_status_var(&_subproblem.getStandardVariable(_tid, "bond_status")) 32 : { 33 40 : } 34 : 35 : Real 36 5760 : RBMPresetOldValuePD::computeQpValue() 37 : { 38 5760 : return _u_old[_qp]; 39 : } 40 : 41 : bool 42 171264 : RBMPresetOldValuePD::shouldApply() const 43 : { 44 : // check whether the number of active bonds is less than number of problem dimension 45 : unsigned int active_bonds = 0; 46 171264 : std::vector<dof_id_type> bonds = _pdmesh.getBonds(_current_node->id()); 47 : 48 3104160 : for (unsigned int nb = 0; nb < bonds.size(); ++nb) 49 2932896 : if (_bond_status_var->getElementalValue(_pdmesh.elemPtr(bonds[nb])) > 0.5) 50 2895072 : active_bonds++; 51 : 52 342528 : return (active_bonds < _pdmesh.dimension() + 1); 53 171264 : }