https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MechanicsMaterialBasePD.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 "MooseVariable.h"
12
15{
17 params.addClassDescription("Base class for Peridynamic mechanic materials");
18
19 params.addRequiredCoupledVar("displacements", "Nonlinear variable name for the displacements");
20 params.addCoupledVar("temperature", "Nonlinear variable name for the temperature");
21
22 return params;
23}
24
26 : PeridynamicsMaterialBase(parameters),
27 _has_temp(isCoupled("temperature")),
28 _temp_var(_has_temp ? getVar("temperature", 0) : nullptr),
29 _bond_status_var(&_subproblem.getStandardVariable(_tid, "bond_status")),
30 _total_stretch(declareProperty<Real>("total_stretch")),
31 _mechanical_stretch(declareProperty<Real>("mechanical_stretch"))
32{
33 if (_dim != coupledComponents("displacements"))
34 mooseError("Size of displacements vector is different from the mesh dimension!");
35
36 for (unsigned int i = 0; i < coupledComponents("displacements"); ++i)
37 _disp_var.push_back(getVar("displacements", i));
38}
39
40void
42{
43 RealGradient dxyz;
44 dxyz.zero();
45
46 for (unsigned int i = 0; i < _dim; ++i)
47 {
48 dxyz(i) = (_pdmesh.getNodeCoord(_current_elem->node_id(1)))(i) +
49 _disp_var[i]->getNodalValue(*_current_elem->node_ptr(1));
50 dxyz(i) -= (_pdmesh.getNodeCoord(_current_elem->node_id(0)))(i) +
51 _disp_var[i]->getNodalValue(*_current_elem->node_ptr(0));
52 }
53
54 _current_len = dxyz.norm();
55}
MooseVariable * getVar(const std::string &var_name, unsigned int comp)
unsigned int coupledComponents(const std::string &var_name) const
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
const Elem *const & _current_elem
MechanicsMaterialBasePD(const InputParameters &parameters)
std::vector< MooseVariable * > _disp_var
Displacement variables.
Real _current_len
Length of current bond.
void computeBondCurrentLength()
Function to compute the current bond length.
static InputParameters validParams()
void mooseError(Args &&... args) const
Base class for peridynamics material models.
static InputParameters validParams()
PeridynamicsMesh & _pdmesh
Mesh related information for material points of current bond/element.
Point getNodeCoord(dof_id_type node_id)
Function to return coordinates for node node_id.