Line data Source code
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 "GapValueAux.h" 11 : 12 : #include "MooseMesh.h" 13 : #include "SystemBase.h" 14 : #include "MooseEnum.h" 15 : #include "PenetrationLocator.h" 16 : 17 : #include "libmesh/string_to_enum.h" 18 : 19 : registerMooseObject("MooseApp", GapValueAux); 20 : 21 : InputParameters 22 14608 : GapValueAux::validParams() 23 : { 24 14608 : MooseEnum orders("FIRST SECOND THIRD FOURTH", "FIRST"); 25 : 26 14608 : InputParameters params = AuxKernel::validParams(); 27 14608 : params.addClassDescription( 28 : "Return the nearest value of a variable on a boundary from across a gap."); 29 14608 : params.set<bool>("_dual_restrictable") = true; 30 14608 : params.addRequiredParam<BoundaryName>("paired_boundary", 31 : "The boundary on the other side of a gap."); 32 14608 : params.addRequiredParam<VariableName>("paired_variable", "The variable to get the value of."); 33 14608 : params.set<bool>("use_displaced_mesh") = true; 34 14608 : params.addParam<Real>("tangential_tolerance", 35 : "Tangential distance to extend edges of contact surfaces"); 36 14608 : params.addParam<Real>( 37 : "normal_smoothing_distance", 38 : "Distance from edge in parametric coordinates over which to smooth contact normal"); 39 14608 : params.addParam<std::string>("normal_smoothing_method", 40 : "Method to use to smooth normals (edge_based|nodal_normal_based)"); 41 14608 : params.addParam<MooseEnum>("order", orders, "The finite element order"); 42 43824 : params.addParam<bool>( 43 29216 : "warnings", false, "Whether to output warning messages concerning nodes not being found"); 44 29216 : return params; 45 14608 : } 46 : 47 179 : GapValueAux::GapValueAux(const InputParameters & parameters) 48 : : AuxKernel(parameters), 49 179 : _penetration_locator( 50 327 : _nodal ? getPenetrationLocator( 51 9 : parameters.get<BoundaryName>("paired_boundary"), 52 109 : boundaryNames()[0], 53 109 : Utility::string_to_enum<Order>(parameters.get<MooseEnum>("order"))) 54 249 : : getQuadraturePenetrationLocator( 55 6 : parameters.get<BoundaryName>("paired_boundary"), 56 70 : boundaryNames()[0], 57 249 : Utility::string_to_enum<Order>(parameters.get<MooseEnum>("order")))), 58 179 : _moose_var(_subproblem.getStandardVariable(_tid, getParam<VariableName>("paired_variable"))), 59 179 : _serialized_solution(_moose_var.sys().currentSolution()), 60 179 : _dof_map(_moose_var.dofMap()), 61 358 : _warnings(getParam<bool>("warnings")) 62 : { 63 179 : if (parameters.isParamValid("tangential_tolerance")) 64 0 : _penetration_locator.setTangentialTolerance(getParam<Real>("tangential_tolerance")); 65 : 66 179 : if (parameters.isParamValid("normal_smoothing_distance")) 67 0 : _penetration_locator.setNormalSmoothingDistance(getParam<Real>("normal_smoothing_distance")); 68 : 69 179 : if (parameters.isParamValid("normal_smoothing_method")) 70 0 : _penetration_locator.setNormalSmoothingMethod( 71 0 : parameters.get<std::string>("normal_smoothing_method")); 72 : 73 179 : Order pairedVarOrder(_moose_var.order()); 74 179 : Order gvaOrder(Utility::string_to_enum<Order>(parameters.get<MooseEnum>("order"))); 75 179 : if (pairedVarOrder != gvaOrder && pairedVarOrder != CONSTANT) 76 0 : mooseError("ERROR: specified order for GapValueAux (", 77 0 : Utility::enum_to_string<Order>(gvaOrder), 78 : ") does not match order for paired_variable \"", 79 0 : _moose_var.name(), 80 : "\" (", 81 0 : Utility::enum_to_string<Order>(pairedVarOrder), 82 : ")"); 83 179 : } 84 : 85 : Real 86 58116 : GapValueAux::computeValue() 87 : { 88 58116 : const Node * current_node = NULL; 89 : 90 58116 : if (_nodal) 91 5528 : current_node = _current_node; 92 : else 93 52588 : current_node = _mesh.getQuadratureNode(_current_elem, _current_side, _qp); 94 : 95 58116 : PenetrationInfo * pinfo = _penetration_locator._penetration_info[current_node->id()]; 96 : 97 58116 : Real gap_value = 0.0; 98 : 99 58116 : if (pinfo) 100 : { 101 57608 : std::vector<std::vector<Real>> & side_phi = pinfo->_side_phi; 102 57608 : if (_moose_var.feType().order != CONSTANT) 103 57608 : gap_value = _moose_var.getValue(pinfo->_side, side_phi); 104 : else 105 0 : gap_value = _moose_var.getValue(pinfo->_elem, side_phi); 106 : } 107 : else 108 : { 109 508 : if (_warnings) 110 : { 111 0 : std::stringstream msg; 112 0 : msg << "No gap value information found for node "; 113 0 : msg << current_node->id(); 114 0 : msg << " on processor "; 115 0 : msg << processor_id(); 116 0 : mooseWarning(msg.str()); 117 0 : } 118 : } 119 58116 : return gap_value; 120 : }