https://mooseframework.inl.gov
ZeroBondStatusUserObjectPD.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 
11 #include "AuxiliarySystem.h"
12 
13 registerMooseObject("PeridynamicsTestApp", ZeroBondStatusUserObjectPD);
14 
17 {
19  params.addClassDescription("Class to assign value of zero to auxilary variable bond status for "
20  "user specified bonds list");
21 
22  params.addRequiredParam<std::vector<unsigned int>>(
23  "bond_ids_list", "List of bond IDs to be assigned with value 0");
24 
25  params.set<ExecFlagEnum>("execute_on", true) = EXEC_INITIAL;
26 
27  return params;
28 }
29 
31  : GeneralUserObjectBasePD(parameters), _list(getParam<std::vector<unsigned int>>("bond_ids_list"))
32 {
33 }
34 
35 void
37 {
38  _aux.solution().close();
39 }
40 
41 void
43 {
44  for (const auto & bid : _list)
45  {
46  const Elem * current_bond = _pdmesh.elemPtr(bid);
47  if (current_bond->processor_id() == _tid)
48  {
49  dof_id_type dof = current_bond->dof_number(_aux.number(), _bond_status_var->number(), 0);
50  _aux.solution().set(dof, 0); // set the status of bonds in the given list to 0
51  }
52  }
53 }
54 
55 void
57 {
58  _aux.solution().close();
59 }
static InputParameters validParams()
AuxiliarySystem & _aux
Reference to auxiliary system.
virtual Elem * elemPtr(const dof_id_type i)
NumericVector< Number > & solution()
unsigned int number() const
T & set(const std::string &name, bool quiet_mode=false)
registerMooseObject("PeridynamicsTestApp", ZeroBondStatusUserObjectPD)
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
std::vector< unsigned int > _list
user specified bond IDs list
PeridynamicsMesh & _pdmesh
Reference to peridynamics mesh.
ZeroBondStatusUserObjectPD(const InputParameters &parameters)
virtual void initialize() override
unsigned int number() const
virtual void close()=0
User object to set the bond status to zero for a given list of bond IDs.
const THREAD_ID _tid
void addClassDescription(const std::string &doc_string)
virtual void set(const numeric_index_type i, const Number value)=0
void ErrorVector unsigned int
MooseVariable * _bond_status_var
Bond status aux variable.
uint8_t dof_id_type
const ExecFlagType EXEC_INITIAL