www.mooseframework.org
CrackFrontData.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "CrackFrontData.h"
11 
12 // MOOSE includes
13 #include "MooseMesh.h"
14 #include "MooseVariable.h"
15 #include "SubProblem.h"
16 
17 #include "libmesh/boundary_info.h"
18 
19 registerMooseObject("SolidMechanicsApp", CrackFrontData);
20 
23 {
25  params.addClassDescription("Determines which nodes are along the crack front");
26  params.addRequiredParam<VariableName>(
27  "variable", "The name of a variable whose value at the crack front is to be reported");
28  params.addRequiredParam<UserObjectName>("crack_front_definition",
29  "The CrackFrontDefinition user object name");
30  params.addParam<unsigned int>(
31  "crack_front_point_index",
32  "The index of the point on the crack front where data is to be reported");
33  params.addParam<Real>("scale_factor", 1, "A scale factor to be applied to the reported quantity");
34  return params;
35 }
36 
38  : GeneralPostprocessor(parameters),
39  _crack_front_definition(&getUserObject<CrackFrontDefinition>("crack_front_definition")),
40  _crack_front_point_index(isParamValid("crack_front_point_index")
41  ? getParam<unsigned int>("crack_front_point_index")
42  : 0),
43  _crack_front_node(NULL),
44  _mesh(_subproblem.mesh()),
45  _var_name(parameters.get<VariableName>("variable")),
46  _scale_factor(getParam<Real>("scale_factor")),
47  _field_var(_subproblem.getStandardVariable(_tid, _var_name)),
48  _value(0)
49 {
50  if (!_field_var.isNodal())
51  mooseError("CrackFrontData can be output only for nodal variables, variable '",
52  _var_name,
53  "' is not nodal");
54 }
55 
56 void
58 {
59  if (!(_crack_front_point_index < _crack_front_definition->getNumCrackFrontPoints()))
60  mooseError("crack_front_point_index out of range in CrackFrontData");
62  mooseError("CrackFrontData not currently supported if crack front is defined with points "
63  "rather than nodes");
64 
66 }
67 void
69 {
70  _value = 0;
71 
72  if (_crack_front_node->processor_id() == processor_id())
74 }
75 
76 Real
78 {
79 
80  return _scale_factor * _value;
81 }
82 
83 void
85 {
87 }
static InputParameters validParams()
CrackFrontData(const InputParameters &parameters)
const CrackFrontDefinition *const _crack_front_definition
const Node * getCrackFrontNodePtr(const std::size_t node_index) const
Get the node pointer for a specified node on the crack front.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const Real _scale_factor
MooseVariable & _field_var
registerMooseObject("SolidMechanicsApp", CrackFrontData)
MeshBase & mesh
virtual Real getValue() const override
This will return the degrees of freedom in the system.
bool hasCrackFrontNodes() const
Determine whether the crack front was defined using nodes.
virtual void execute() override
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
Class used in fracture integrals to define geometric characteristics of the crack front...
const unsigned int _crack_front_point_index
void gatherSum(T &value)
std::string _var_name
virtual void initialize() override
OutputData getNodalValue(const Node &node) const
bool isNodal() const override
const Node * _crack_front_node
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
processor_id_type processor_id() const
void ErrorVector unsigned int
const Elem & get(const ElemType type_in)
virtual void finalize() override