www.mooseframework.org
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
ContactLineSearchBase Class Reference

This class implements a custom line search for use with mechanical contact. More...

#include <ContactLineSearchBase.h>

Inheritance diagram for ContactLineSearchBase:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 ContactLineSearchBase (const InputParameters &parameters)
 
void printContactInfo (const std::set< dof_id_type > &contact_set)
 Method for printing the contact information. More...
 
void insertSet (const std::set< dof_id_type > &mech_set)
 Unionize sets from different constraints. More...
 
virtual void reset ()
 Reset the line search data. More...
 
void zeroIts ()
 
size_t nlIts () const
 
virtual void lineSearch ()
 
virtual void timestepSetup ()
 
virtual void customSetup (const ExecFlagType &)
 
virtual void initialSetup ()
 
virtual bool enabled () const
 
std::shared_ptr< MooseObjectgetSharedPtr ()
 
std::shared_ptr< const MooseObjectgetSharedPtr () const
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
virtual const std::string & name () const
 
std::string typeAndName () const
 
std::string errorPrefix (const std::string &error_type) const
 
void callMooseError (std::string msg, const bool with_prefix) const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
const InputParametersparameters () const
 
MooseObjectName uniqueName () const
 
const T & getParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 
getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &nm) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void mooseError (Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &name, const std::string *param=nullptr) const
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static InputParameters validParams ()
 

Public Attributes

const ConsoleStream _console
 

Protected Attributes

std::set< dof_id_type_current_contact_state
 The current contact set. More...
 
std::set< dof_id_type_old_contact_state
 The old contact set. More...
 
Real _user_ksp_rtol
 the linear tolerance set by the user in the input file More...
 
bool _user_ksp_rtol_set
 Whether the user linear tolerance has been set yet in this object. More...
 
Real _contact_lambda
 The multiplier of the newton step. More...
 
unsigned _allowed_lambda_cuts
 How many times the linsearch is allowed to cut lambda. More...
 
Real _contact_ltol
 What the linear tolerance should be while the contact state is changing. More...
 
bool _affect_ltol
 Whether to modify the linear tolerance. More...
 
FEProblem_fe_problem
 
size_t _nl_its
 
const bool & _enabled
 
MooseApp_app
 
const std::string _type
 
const std::string _name
 
const InputParameters_pars
 
Factory_factory
 
ActionFactory_action_factory
 
const Parallel::Communicator & _communicator
 

Detailed Description

This class implements a custom line search for use with mechanical contact.

The line search is not fancy. It takes two parameters, set in the MOOSE Executioner block: contact_line_search_ltol and contact_line_search_allowed_lambda_cuts. The allowed_lambda_cuts parameter specifies the number of times the line search is allowed to cut lambda. If allowed to be cut, lambda will be reduced by half, and a new residual will be evaluated. If the residual is smaller with a smaller lambda, then cuts will continue until reaching allowed_lambda_cuts. If the residual is larger with a smaller lambda, then the line search is curtailed and the smaller residual is used. It's recommended that allowed_lambda_cuts be <= 3, with smaller values being used for smaller contact problems. This is to allow necessary residual increases when the transient problem requires significant changes in the contact state.

When the contact set is changing, the user may optionally use a looser linear tolerance set by the contact_line_search_ltol parameter. Then when the contact set is changing during the beginning of the Newton solve, unnecessary computational expense is avoided. Then when the contact set is resolved late in the Newton solve, the linear tolerance will return to the finer tolerance set through the traditional l_tol parameter.

Definition at line 34 of file ContactLineSearchBase.h.

Constructor & Destructor Documentation

◆ ContactLineSearchBase()

ContactLineSearchBase::ContactLineSearchBase ( const InputParameters parameters)

Definition at line 34 of file ContactLineSearchBase.C.

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 }
bool _affect_ltol
Whether to modify the linear tolerance.
Real _contact_ltol
What the linear tolerance should be while the contact state is changing.
unsigned _allowed_lambda_cuts
How many times the linsearch is allowed to cut lambda.
const InputParameters & parameters() const
LineSearch(const InputParameters &parameters)
bool _user_ksp_rtol_set
Whether the user linear tolerance has been set yet in this object.

Member Function Documentation

◆ insertSet()

void ContactLineSearchBase::insertSet ( const std::set< dof_id_type > &  mech_set)

Unionize sets from different constraints.

Definition at line 53 of file ContactLineSearchBase.C.

Referenced by MechanicalContactConstraint::residualEnd().

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 }
std::set< dof_id_type > _current_contact_state
The current contact set.

◆ printContactInfo()

void ContactLineSearchBase::printContactInfo ( const std::set< dof_id_type > &  contact_set)

Method for printing the contact information.

Definition at line 44 of file ContactLineSearchBase.C.

Referenced by PetscContactLineSearch::lineSearch().

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 }
const ConsoleStream _console

◆ reset()

void ContactLineSearchBase::reset ( )
virtual

Reset the line search data.

Definition at line 63 of file ContactLineSearchBase.C.

Referenced by MechanicalContactConstraint::timestepSetup().

64 {
65  _current_contact_state.clear();
66  zeroIts();
67 }
std::set< dof_id_type > _current_contact_state
The current contact set.
void zeroIts()

◆ validParams()

InputParameters ContactLineSearchBase::validParams ( )
static

Definition at line 20 of file ContactLineSearchBase.C.

Referenced by PetscContactLineSearch::validParams().

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 }
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Member Data Documentation

◆ _affect_ltol

bool ContactLineSearchBase::_affect_ltol
protected

Whether to modify the linear tolerance.

Definition at line 77 of file ContactLineSearchBase.h.

Referenced by PetscContactLineSearch::lineSearch().

◆ _allowed_lambda_cuts

unsigned ContactLineSearchBase::_allowed_lambda_cuts
protected

How many times the linsearch is allowed to cut lambda.

Definition at line 71 of file ContactLineSearchBase.h.

Referenced by PetscContactLineSearch::lineSearch().

◆ _contact_lambda

Real ContactLineSearchBase::_contact_lambda
protected

The multiplier of the newton step.

Definition at line 68 of file ContactLineSearchBase.h.

Referenced by PetscContactLineSearch::lineSearch().

◆ _contact_ltol

Real ContactLineSearchBase::_contact_ltol
protected

What the linear tolerance should be while the contact state is changing.

Definition at line 74 of file ContactLineSearchBase.h.

Referenced by PetscContactLineSearch::lineSearch().

◆ _current_contact_state

std::set<dof_id_type> ContactLineSearchBase::_current_contact_state
protected

The current contact set.

Definition at line 58 of file ContactLineSearchBase.h.

Referenced by insertSet(), PetscContactLineSearch::lineSearch(), and reset().

◆ _old_contact_state

std::set<dof_id_type> ContactLineSearchBase::_old_contact_state
protected

The old contact set.

Definition at line 60 of file ContactLineSearchBase.h.

Referenced by PetscContactLineSearch::lineSearch().

◆ _user_ksp_rtol

Real ContactLineSearchBase::_user_ksp_rtol
protected

the linear tolerance set by the user in the input file

Definition at line 63 of file ContactLineSearchBase.h.

Referenced by PetscContactLineSearch::lineSearch().

◆ _user_ksp_rtol_set

bool ContactLineSearchBase::_user_ksp_rtol_set
protected

Whether the user linear tolerance has been set yet in this object.

Definition at line 65 of file ContactLineSearchBase.h.

Referenced by PetscContactLineSearch::lineSearch().


The documentation for this class was generated from the following files: