https://mooseframework.inl.gov
Loading...
Searching...
No Matches
CrackFrontData.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
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
19registerMooseObject("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 '",
53 "' is not nodal");
54}
55
56void
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}
67void
75
76Real
78{
79
80 return _scale_factor * _value;
81}
82
83void
registerMooseObject("SolidMechanicsApp", CrackFrontData)
void ErrorVector unsigned int
const Node * _crack_front_node
virtual Real getValue() const override
This will return the degrees of freedom in the system.
std::string _var_name
const Real _scale_factor
virtual void initialize() override
static InputParameters validParams()
CrackFrontData(const InputParameters &parameters)
const CrackFrontDefinition *const _crack_front_definition
virtual void execute() override
const unsigned int _crack_front_point_index
MooseVariable & _field_var
virtual void finalize() override
Class used in fracture integrals to define geometric characteristics of the crack front.
const Node * getCrackFrontNodePtr(const std::size_t node_index) const
Get the node pointer for a specified node on the crack front.
bool hasCrackFrontNodes() const
Determine whether the crack front was defined using nodes.
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void mooseError(Args &&... args) const
DofValue getNodalValue(const Node &node) const
bool isNodal() const override
void gatherSum(T &value)
processor_id_type processor_id() const
MeshBase & mesh