https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
AugmentedLagrangianContactConvergence< T > Class Template Reference

Class to check convergence for the augmented Lagrangian contact problem. More...

#include <AugmentedLagrangianContactConvergence.h>

Inheritance diagram for AugmentedLagrangianContactConvergence< T >:
[legend]

Public Member Functions

 AugmentedLagrangianContactConvergence (const InputParameters &params)
 
virtual void preLoop () override
 
virtual Convergence::MooseConvergenceStatus checkConvergence (unsigned int iter) override
 
const unsigned int & getLagrangianIterationNumber () const
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Attributes

const unsigned int _maximum_number_lagrangian_iterations
 maximum number of augmented Lagrangian iterations
 
unsigned int _lagrangian_iteration_number
 current augmented Lagrangian iteration number
 

Detailed Description

template<class T>
class AugmentedLagrangianContactConvergence< T >

Class to check convergence for the augmented Lagrangian contact problem.

Template Parameters
Ta convergence class type to use for such problems

Definition at line 21 of file AugmentedLagrangianContactConvergence.h.

Constructor & Destructor Documentation

◆ AugmentedLagrangianContactConvergence()

Definition at line 48 of file AugmentedLagrangianContactConvergence.C.

51{
52}
const double T
Non-templated base of AugmentedLagrangianContactConvergence that owns the augmented Lagrangian iterat...

Member Function Documentation

◆ checkConvergence()

template<class T >
Convergence::MooseConvergenceStatus AugmentedLagrangianContactConvergence< T >::checkConvergence ( unsigned int  iter)
overridevirtual

Definition at line 65 of file AugmentedLagrangianContactConvergence.C.

66{
67 // Check convergence of the nonlinear problem
68 auto reason = T::checkConvergence(iter);
69
70 auto & fe_problem_base = this->getMooseApp().feProblem();
71
72 bool repeat_augmented_lagrange_step = false;
73
74 // Nonlinear solve is converged, now check that the constraints are met
75 if (reason == Convergence::MooseConvergenceStatus::CONVERGED)
76 {
78 {
79
80 auto & nonlinear_sys = fe_problem_base.currentNonlinearSystem();
81 nonlinear_sys.update();
82
83 // Get the penetration locator from the displaced mesh if it exist, otherwise get
84 // it from the undisplaced mesh.
85 const auto displaced_problem = fe_problem_base.getDisplacedProblem();
86 const auto & penetration_locators = (displaced_problem ? displaced_problem->geomSearchData()
87 : fe_problem_base.geomSearchData())
88 ._penetration_locators;
89
90 // loop over contact pairs (penetration locators)
91 const ConstraintWarehouse & constraints = nonlinear_sys.getConstraintWarehouse();
92 std::list<std::shared_ptr<MechanicalContactConstraint>> mccs;
93 for (const auto & pair : penetration_locators)
94 {
95 const auto & boundaries = pair.first;
96
97 if (!constraints.hasActiveNodeFaceConstraints(boundaries.second, bool(displaced_problem)))
98 continue;
99 const auto & ncs =
100 constraints.getActiveNodeFaceConstraints(boundaries.second, bool(displaced_problem));
101
102 mccs.emplace_back(nullptr);
103 for (const auto & nc : ncs)
104 if (const auto mcc = std::dynamic_pointer_cast<MechanicalContactConstraint>(nc); !mcc)
105 mooseError("AugmentedLagrangianContactProblem: dynamic cast of "
106 "MechanicalContactConstraint object failed.");
107 else
108 {
109 // Return if this constraint does not correspond to the primary-secondary pair
110 // prepared by the outer loops.
111 // This continue statement is required when, e.g. one secondary surface constrains
112 // more than one primary surface.
113 if (mcc->secondaryBoundary() != boundaries.second ||
114 mcc->primaryBoundary() != boundaries.first)
115 continue;
116
117 // save one constraint pointer for each contact pair
118 if (!mccs.back())
119 mccs.back() = mcc;
120
121 // check if any of the constraints is not yet converged
122 if (repeat_augmented_lagrange_step || !mcc->AugmentedLagrangianContactConverged())
123 {
124 repeat_augmented_lagrange_step = true;
125 break;
126 }
127 }
128 }
129
130 // next loop over penalty mortar user objects
131 const auto & pmuos = this->_app.template getInterfaceObjects<AugmentedLagrangeInterface>();
132 for (auto * pmuo : pmuos)
133 {
134 // check if any of the constraints is not yet converged
135 if (!repeat_augmented_lagrange_step && !pmuo->isAugmentedLagrangianConverged())
136 repeat_augmented_lagrange_step = true;
137 }
138
139 // Communicate the repeat_augmented_lagrange_step in parallel.
140 // If one proc needs to do another loop, all do.
141 this->_communicator.max(repeat_augmented_lagrange_step);
142
143 // repeat update step if necessary
144 if (repeat_augmented_lagrange_step)
145 {
147 Moose::out << "Augmented Lagrangian contact repeat " << _lagrangian_iteration_number
148 << '\n';
149
150 // Each contact pair will have constraints for all displacements, but those share the
151 // Lagrange multipliers, which are stored on the penetration locator. We call update
152 // only for the first constraint for each contact pair.
153 for (const auto & mcc : mccs)
154 mcc->updateAugmentedLagrangianMultiplier(/* beginning_of_step = */ false);
155
156 // Update all penalty mortar user objects
157 for (const auto & pmuo : pmuos)
158 pmuo->updateAugmentedLagrangianMultipliers();
159
160 // call AM setup again (e.g. to update active sets)
161 for (const auto & pmuo : pmuos)
162 pmuo->augmentedLagrangianSetup();
163
164 // force it to keep iterating
165 reason = Convergence::MooseConvergenceStatus::ITERATING;
166 Moose::out << "Augmented Lagrangian Multiplier needs updating.";
167 }
168 else
169 Moose::out << "Augmented Lagrangian contact constraint enforcement is satisfied.";
170 }
171 else
172 {
173 // maxed out
174 Moose::out << "Maximum Augmented Lagrangian contact iterations have been reached.";
175 reason = Convergence::MooseConvergenceStatus::DIVERGED;
176 }
177 }
178
179 return reason;
180}
std::unique_ptr< T_DEST, T_DELETER > dynamic_pointer_cast(std::unique_ptr< T_SRC, T_DELETER > &src)
void mooseError(Args &&... args)
std::shared_ptr< DisplacedProblem > displaced_problem
const unsigned int _maximum_number_lagrangian_iterations
maximum number of augmented Lagrangian iterations
unsigned int _lagrangian_iteration_number
current augmented Lagrangian iteration number
const std::vector< std::shared_ptr< NodeFaceConstraint > > & getActiveNodeFaceConstraints(BoundaryID boundary_id, bool displaced) const
bool hasActiveNodeFaceConstraints(BoundaryID boundary_id, bool displaced) const
A MechanicalContactConstraint forces the value of a variable to be the same on both sides of an inter...
if(subdm)

◆ getLagrangianIterationNumber()

const unsigned int & AugmentedLagrangianContactConvergenceBase::getLagrangianIterationNumber ( ) const
inlineinherited
Returns
the current augmented Lagrangian iteration number

Definition at line 29 of file AugmentedLagrangianContactConvergenceBase.h.

Referenced by AugmentedLagrangianContactProblemInterface::getLagrangianIterationNumber().

◆ preLoop()

template<class T >
void AugmentedLagrangianContactConvergence< T >::preLoop ( )
overridevirtual

Definition at line 56 of file AugmentedLagrangianContactConvergence.C.

57{
58 T::preLoop();
59
61}

◆ validParams()

template<class T >
InputParameters AugmentedLagrangianContactConvergence< T >::validParams ( )
static

Definition at line 39 of file AugmentedLagrangianContactConvergence.C.

40{
41 InputParameters params = T::validParams();
43 params.addClassDescription("Convergence for augmented Lagrangian contact");
44 return params;
45}
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _lagrangian_iteration_number

unsigned int AugmentedLagrangianContactConvergenceBase::_lagrangian_iteration_number
protectedinherited

current augmented Lagrangian iteration number

Definition at line 36 of file AugmentedLagrangianContactConvergenceBase.h.

Referenced by AugmentedLagrangianContactConvergenceBase::getLagrangianIterationNumber().

◆ _maximum_number_lagrangian_iterations

const unsigned int AugmentedLagrangianContactConvergenceBase::_maximum_number_lagrangian_iterations
protectedinherited

maximum number of augmented Lagrangian iterations

Definition at line 33 of file AugmentedLagrangianContactConvergenceBase.h.


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