https://mooseframework.inl.gov
ContactLineSearchBase.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 "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 
21 {
23  params.addRequiredParam<unsigned>("allowed_lambda_cuts",
24  "The number of times lambda is allowed to get cut");
25  params.addRequiredParam<Real>("contact_ltol",
26  "The linear tolerance to use when the contact set is changing.");
27  params.addRequiredParam<bool>("affect_ltol",
28  "Whether to change the linear tolerance from the default value "
29  "when the contact set is changing");
30  MooseEnum line_search_package("petsc moose");
31  return params;
32 }
33 
35  : LineSearch(parameters),
36  _user_ksp_rtol_set(false),
37  _allowed_lambda_cuts(getParam<unsigned>("allowed_lambda_cuts")),
38  _contact_ltol(getParam<Real>("contact_ltol")),
39  _affect_ltol(getParam<bool>("affect_ltol"))
40 {
41 }
42 
43 void
44 ContactLineSearchBase::printContactInfo(const std::set<dof_id_type> & contact_set)
45 {
46  if (!contact_set.empty())
47  _console << contact_set.size() << " nodes in contact" << std::endl;
48  else
49  _console << "No nodes in contact" << std::endl;
50 }
51 
52 void
53 ContactLineSearchBase::insertSet(const std::set<dof_id_type> & mech_set)
54 {
55  if (_current_contact_state.empty())
56  _current_contact_state = mech_set;
57  else
58  for (auto & node : mech_set)
59  _current_contact_state.insert(node);
60 }
61 
62 void
64 {
65  _current_contact_state.clear();
66  zeroIts();
67 }
std::set< dof_id_type > _current_contact_state
The current contact set.
virtual void reset()
Reset the line search data.
registerMooseObjectAliased("ContactApp", ContactLineSearchBase, "ContactLineSearch")
ContactLineSearchBase(const InputParameters &parameters)
void addRequiredParam(const std::string &name, const std::string &doc_string)
This class implements a custom line search for use with mechanical contact.
static InputParameters validParams()
void zeroIts()
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void insertSet(const std::set< dof_id_type > &mech_set)
Unionize sets from different constraints.
void printContactInfo(const std::set< dof_id_type > &contact_set)
Method for printing the contact information.
const ConsoleStream _console