https://mooseframework.inl.gov
NodalAuxVariableUserObjectBasePD.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 #include "PeridynamicsMesh.h"
13 #include "MooseVariable.h"
14 
17 {
19  params.addClassDescription("Base class for computing value for nodal AuxVariable from elemental "
20  "information in a peridynamic model");
21 
22  params.addRequiredCoupledVar("variable", "Name of AuxVariable this userobject is acting on");
23 
24  return params;
25 }
26 
28  const InputParameters & parameters)
29  : ElementUserObjectBasePD(parameters), _var(getVar("variable", 0))
30 {
31 }
32 
33 void
35 {
36  std::vector<std::string> zero_vars;
37  zero_vars.push_back(_var->name());
38  _aux.zeroVariables(zero_vars);
39 
40  _aux.solution().close();
41 }
42 
43 void
45 {
46  for (unsigned int i = 0; i < _nnodes; ++i)
47  {
48  dof_id_type dof = _current_elem->node_ptr(i)->dof_number(_aux.number(), _var->number(), 0);
49 
50  computeValue(i, dof);
51  }
52 }
53 
54 void
56 {
57  _aux.solution().close();
58 }
static InputParameters validParams()
NodalAuxVariableUserObjectBasePD(const InputParameters &parameters)
NumericVector< Number > & solution()
unsigned int number() const
const std::string & name() const override
const unsigned int _nnodes
number of nodes for a edge element
unsigned int number() const
MooseVariable * _var
Pointer to the aux variable this userobject operates on.
virtual void close()=0
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
Base element userobject class for peridynamics.
const Elem *const & _current_elem
void addClassDescription(const std::string &doc_string)
AuxiliarySystem & _aux
Reference to auxiliary system.
virtual void computeValue(unsigned int id, dof_id_type dof)=0
Function to assemble elemental quantities to nodal AuxVariable at a material point.
virtual void zeroVariables(std::vector< std::string > &vars_to_be_zeroed)
uint8_t dof_id_type