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 "ContactLineSearchBase.h" 11 : #include "PetscSupport.h" 12 : #include "InputParameters.h" 13 : #include "MooseEnum.h" 14 : #include "FEProblem.h" 15 : #include "MooseError.h" 16 : 17 : registerMooseObjectAliased("ContactApp", ContactLineSearchBase, "ContactLineSearch"); 18 : 19 : InputParameters 20 86 : ContactLineSearchBase::validParams() 21 : { 22 86 : InputParameters params = LineSearch::validParams(); 23 172 : params.addRequiredParam<unsigned>("allowed_lambda_cuts", 24 : "The number of times lambda is allowed to get cut"); 25 172 : params.addRequiredParam<Real>("contact_ltol", 26 : "The linear tolerance to use when the contact set is changing."); 27 172 : params.addRequiredParam<bool>("affect_ltol", 28 : "Whether to change the linear tolerance from the default value " 29 : "when the contact set is changing"); 30 172 : MooseEnum line_search_package("petsc moose"); 31 86 : return params; 32 86 : } 33 : 34 43 : ContactLineSearchBase::ContactLineSearchBase(const InputParameters & parameters) 35 : : LineSearch(parameters), 36 43 : _user_ksp_rtol_set(false), 37 86 : _allowed_lambda_cuts(getParam<unsigned>("allowed_lambda_cuts")), 38 86 : _contact_ltol(getParam<Real>("contact_ltol")), 39 129 : _affect_ltol(getParam<bool>("affect_ltol")) 40 : { 41 43 : } 42 : 43 : void 44 1739 : ContactLineSearchBase::printContactInfo(const std::set<dof_id_type> & contact_set) 45 : { 46 1739 : if (!contact_set.empty()) 47 39 : _console << contact_set.size() << " nodes in contact" << std::endl; 48 : else 49 1700 : _console << "No nodes in contact" << std::endl; 50 1739 : } 51 : 52 : void 53 66 : ContactLineSearchBase::insertSet(const std::set<dof_id_type> & mech_set) 54 : { 55 66 : if (_current_contact_state.empty()) 56 : _current_contact_state = mech_set; 57 : else 58 0 : for (auto & node : mech_set) 59 0 : _current_contact_state.insert(node); 60 66 : } 61 : 62 : void 63 13 : ContactLineSearchBase::reset() 64 : { 65 : _current_contact_state.clear(); 66 : zeroIts(); 67 13 : }