https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ContactPressureAux.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 "ContactPressureAux.h"
11
12#include "NodalArea.h"
13#include "PenetrationLocator.h"
14
15#include "libmesh/string_to_enum.h"
16
18
21{
23 params.addRequiredCoupledVar("nodal_area", "The nodal area");
24 params.addRequiredParam<std::vector<BoundaryName>>(
25 "paired_boundary",
26 "The set of boundaries in contact with those specified in 'boundary'. Ordering must be "
27 "consistent with that in 'boundary'.");
28 params.set<ExecFlagEnum>("execute_on") = EXEC_NONLINEAR;
29 MooseEnum orders("FIRST SECOND THIRD FOURTH", "FIRST");
30 params.addParam<MooseEnum>("order", orders, "The finite element order: " + orders.getRawNames());
31
32 params.addClassDescription("Computes the contact pressure from the contact force and nodal area");
33
34 return params;
35}
36
38 : AuxKernel(params),
39 _nodal_area(coupledValue("nodal_area")),
40 _number_pairs(getParam<std::vector<BoundaryName>>("paired_boundary").size()),
41 _penetration_locators(_number_pairs)
42{
43 if (_number_pairs != getParam<std::vector<BoundaryName>>("boundary").size())
44 paramError("boundary",
45 "Boundary and paired boundary vectors are not the same size in the contact pressure "
46 "auxiliary kernel. Please check your input");
47
48 for (const auto i : make_range(_number_pairs))
50 &getPenetrationLocator(getParam<std::vector<BoundaryName>>("paired_boundary")[i],
51 getParam<std::vector<BoundaryName>>("boundary")[i],
52 Utility::string_to_enum<Order>(getParam<MooseEnum>("order")));
53}
54
56
57Real
59{
60 Real value(0);
61 const Real area = _nodal_area[_qp];
62 const PenetrationInfo * penetration_info(nullptr);
63
64 for (const auto i : make_range(_number_pairs))
65 {
66 const auto it = _penetration_locators[i]->_penetration_info.find(_current_node->id());
67 if (it != _penetration_locators[i]->_penetration_info.end())
68 penetration_info = it->second;
69
70 if (penetration_info && area != 0)
71 value -= (penetration_info->_contact_force * penetration_info->_normal) / area;
72
73 penetration_info = nullptr;
74 }
75
76 return value;
77}
registerMooseObject("ContactApp", ContactPressureAux)
const ExecFlagType EXEC_NONLINEAR
const Node *const & _current_node
static InputParameters validParams()
Computes the contact pressure from the contact force and nodal area.
const VariableValue & _nodal_area
AuxVariable containing the nodal area.
static InputParameters validParams()
ContactPressureAux(const InputParameters &parameters)
const size_t _number_pairs
Number of contact pairs in the entire model.
virtual Real computeValue() override
std::vector< const PenetrationLocator * > _penetration_locators
References to the PenetrationLocator objects for the individual interactions.
PenetrationLocator & getPenetrationLocator(const BoundaryName &primary, const BoundaryName &secondary, Order order)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
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)
T & set(const std::string &name, bool quiet_mode=false)
void paramError(const std::string &param, Args... args) const
const T & getParam(const std::string &name) const
virtual const OutputTools< ComputeValueType >::VariableValue & value()
RealVectorValue _contact_force
RealVectorValue _normal