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 164 : ContactLineSearchBase::validParams() 21 : { 22 164 : InputParameters params = LineSearch::validParams(); 23 328 : params.addRequiredParam<unsigned>("allowed_lambda_cuts", 24 : "The number of times lambda is allowed to get cut"); 25 328 : params.addRequiredParam<Real>("contact_ltol", 26 : "The linear tolerance to use when the contact set is changing."); 27 328 : params.addRequiredParam<bool>("affect_ltol", 28 : "Whether to change the linear tolerance from the default value " 29 : "when the contact set is changing"); 30 328 : MooseEnum line_search_package("petsc moose"); 31 164 : return params; 32 164 : } 33 : 34 82 : ContactLineSearchBase::ContactLineSearchBase(const InputParameters & parameters) 35 : : LineSearch(parameters), 36 82 : _user_ksp_rtol_set(false), 37 164 : _allowed_lambda_cuts(getParam<unsigned>("allowed_lambda_cuts")), 38 164 : _contact_ltol(getParam<Real>("contact_ltol")), 39 246 : _affect_ltol(getParam<bool>("affect_ltol")) 40 : { 41 82 : } 42 : 43 : void 44 3298 : ContactLineSearchBase::printContactInfo(const std::set<dof_id_type> & contact_set) 45 : { 46 3298 : if (!contact_set.empty()) 47 42 : _console << contact_set.size() << " nodes in contact" << std::endl; 48 : else 49 3256 : _console << "No nodes in contact" << std::endl; 50 3298 : } 51 : 52 : void 53 70 : ContactLineSearchBase::insertSet(const std::set<dof_id_type> & mech_set) 54 : { 55 70 : 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 70 : } 61 : 62 : void 63 14 : ContactLineSearchBase::reset() 64 : { 65 : _current_contact_state.clear(); 66 : zeroIts(); 67 14 : }