KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
displacement_lagrangemultiplier_residual_frictional_contact_criteria.h
Go to the documentation of this file.
1 // KRATOS ______ __ __ _____ __ __ __
2 // / ____/___ ____ / /_____ ______/ /_/ ___// /________ _______/ /___ ___________ _/ /
3 // / / / __ \/ __ \/ __/ __ `/ ___/ __/\__ \/ __/ ___/ / / / ___/ __/ / / / ___/ __ `/ /
4 // / /___/ /_/ / / / / /_/ /_/ / /__/ /_ ___/ / /_/ / / /_/ / /__/ /_/ /_/ / / / /_/ / /
5 // \____/\____/_/ /_/\__/\__,_/\___/\__//____/\__/_/ \__,_/\___/\__/\__,_/_/ \__,_/_/ MECHANICS
6 //
7 // License: BSD License
8 // license: ContactStructuralMechanicsApplication/license.txt
9 //
10 // Main authors: Vicente Mataix Ferrandiz
11 //
12 
13 #pragma once
14 
15 // System includes
16 
17 // External includes
18 
19 // Project includes
26 
27 namespace Kratos
28 {
31 
34 
38 
42 
46 
49 
59 template< class TSparseSpace,
60  class TDenseSpace >
62  : public ConvergenceCriteria< TSparseSpace, TDenseSpace >
63 {
64 public:
65 
68 
71 
73  KRATOS_DEFINE_LOCAL_FLAG( ENSURE_CONTACT );
74  KRATOS_DEFINE_LOCAL_FLAG( PRINTING_OUTPUT );
75  KRATOS_DEFINE_LOCAL_FLAG( TABLE_IS_INITIALIZED );
76  KRATOS_DEFINE_LOCAL_FLAG( ROTATION_DOF_IS_CONSIDERED );
78  KRATOS_DEFINE_LOCAL_FLAG( INITIAL_RESIDUAL_IS_SET );
79  KRATOS_DEFINE_LOCAL_FLAG( INITIAL_NORMAL_RESIDUAL_IS_SET );
80  KRATOS_DEFINE_LOCAL_FLAG( INITIAL_STICK_RESIDUAL_IS_SET );
81  KRATOS_DEFINE_LOCAL_FLAG( INITIAL_SLIP_RESIDUAL_IS_SET );
82 
85 
88 
91 
94 
97 
99  using SparseSpaceType = TSparseSpace;
100 
102  using TablePrinterPointerType = TableStreamUtility::Pointer;
103 
105  using IndexType = std::size_t;
106 
108  static constexpr double ZeroTolerance = std::numeric_limits<double>::epsilon();
109 
113 
118  : BaseType()
119  {
120  }
121 
127  : BaseType()
128  {
129  // Validate and assign defaults
130  ThisParameters = this->ValidateAndAssignParameters(ThisParameters, this->GetDefaultParameters());
131  this->AssignSettings(ThisParameters);
132  }
133 
148  const double DispRatioTolerance,
149  const double DispAbsTolerance,
150  const double RotRatioTolerance,
151  const double RotAbsTolerance,
152  const double LMNormalRatioTolerance,
153  const double LMNormalAbsTolerance,
154  const double LMTangentStickRatioTolerance,
155  const double LMTangentStickAbsTolerance,
156  const double LMTangentSlipRatioTolerance,
157  const double LMTangentSlipAbsTolerance,
158  const double NormalTangentRatio,
159  const bool EnsureContact = false,
160  const bool PureSlip = false,
161  const bool PrintingOutput = false
162  ) : BaseType()
163  {
164  // Set local flags
165  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::ENSURE_CONTACT, EnsureContact);
166  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PRINTING_OUTPUT, PrintingOutput);
167  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::TABLE_IS_INITIALIZED, false);
168  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::ROTATION_DOF_IS_CONSIDERED, false);
169  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PURE_SLIP, PureSlip);
170  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_RESIDUAL_IS_SET, false);
171  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_NORMAL_RESIDUAL_IS_SET, false);
172  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_STICK_RESIDUAL_IS_SET, false);
173  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_SLIP_RESIDUAL_IS_SET, false);
174 
175  // The displacement residual
176  mDispRatioTolerance = DispRatioTolerance;
177  mDispAbsTolerance = DispAbsTolerance;
178 
179  // The rotation residual
180  mRotRatioTolerance = RotRatioTolerance;
181  mRotAbsTolerance = RotAbsTolerance;
182 
183  // The normal contact residual
184  mLMNormalRatioTolerance = LMNormalRatioTolerance;
185  mLMNormalAbsTolerance = LMNormalAbsTolerance;
186 
187  // The tangent contact residual
188  mLMTangentStickRatioTolerance = LMTangentStickRatioTolerance;
189  mLMTangentStickAbsTolerance = LMTangentStickAbsTolerance;
190  mLMTangentSlipRatioTolerance = LMTangentSlipRatioTolerance;
191  mLMTangentSlipAbsTolerance = LMTangentSlipAbsTolerance;
192 
193  // We get the ratio between the normal and tangent that will accepted as converged
194  mNormalTangentRatio = NormalTangentRatio;
195  }
196 
197  // Copy constructor.
199  :BaseType(rOther)
200  ,mOptions(rOther.mOptions)
201  ,mDispRatioTolerance(rOther.mDispRatioTolerance)
202  ,mDispAbsTolerance(rOther.mDispAbsTolerance)
203  ,mDispInitialResidualNorm(rOther.mDispInitialResidualNorm)
204  ,mDispCurrentResidualNorm(rOther.mDispCurrentResidualNorm)
205  ,mRotRatioTolerance(rOther.mRotRatioTolerance)
206  ,mRotAbsTolerance(rOther.mRotAbsTolerance)
207  ,mRotInitialResidualNorm(rOther.mRotInitialResidualNorm)
208  ,mRotCurrentResidualNorm(rOther.mRotCurrentResidualNorm)
209  ,mLMNormalRatioTolerance(rOther.mLMNormalRatioTolerance)
210  ,mLMNormalAbsTolerance(rOther.mLMNormalAbsTolerance)
211  ,mLMNormalInitialResidualNorm(rOther.mLMNormalInitialResidualNorm)
212  ,mLMNormalCurrentResidualNorm(rOther.mLMNormalCurrentResidualNorm)
213  ,mLMTangentStickRatioTolerance(rOther.mLMTangentStickRatioTolerance)
214  ,mLMTangentStickAbsTolerance(rOther.mLMTangentStickAbsTolerance)
215  ,mLMTangentSlipRatioTolerance(rOther.mLMTangentSlipRatioTolerance)
216  ,mLMTangentSlipAbsTolerance(rOther.mLMTangentSlipAbsTolerance)
217  ,mLMTangentStickInitialResidualNorm(rOther.mLMTangentStickInitialResidualNorm)
218  ,mLMTangentStickCurrentResidualNorm(rOther.mLMTangentStickCurrentResidualNorm)
219  ,mStickCounter(rOther.mStickCounter)
220  ,mSlipCounter(rOther.mSlipCounter)
221  ,mNormalTangentRatio(rOther.mNormalTangentRatio)
222  {
223  }
224 
227 
231 
235 
240  typename BaseType::Pointer Create(Parameters ThisParameters) const override
241  {
242  return Kratos::make_shared<ClassType>(ThisParameters);
243  }
244 
255  ModelPart& rModelPart,
256  DofsArrayType& rDofSet,
257  const TSystemMatrixType& rA,
258  const TSystemVectorType& rDx,
259  const TSystemVectorType& rb
260  ) override
261  {
262  if (SparseSpaceType::Size(rb) != 0) { //if we are solving for something
263 
264  // Getting process info
265  ProcessInfo& r_process_info = rModelPart.GetProcessInfo();
266 
267  // Initialize
268  double disp_residual_solution_norm = 0.0, rot_residual_solution_norm = 0.0,normal_lm_residual_solution_norm = 0.0, tangent_lm_stick_residual_solution_norm = 0.0, tangent_lm_slip_residual_solution_norm = 0.0;
269  IndexType disp_dof_num(0), rot_dof_num(0), lm_dof_num(0), lm_stick_dof_num(0), lm_slip_dof_num(0);
270 
271  // The nodes array
272  auto& r_nodes_array = rModelPart.Nodes();
273 
274  // Auxiliary values
275  struct AuxValues {
276  std::size_t dof_id = 0;
277  double residual_dof_value = 0.0;
278  };
279  const bool pure_slip = mOptions.Is(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PURE_SLIP);
280 
281  // The number of active dofs
282  const std::size_t number_active_dofs = rb.size();
283 
284  // Auxiliary displacement DoF check
285  const std::function<bool(const VariableData&)> check_without_rot =
286  [](const VariableData& rCurrVar) -> bool {return true;};
287  const std::function<bool(const VariableData&)> check_with_rot =
288  [](const VariableData& rCurrVar) -> bool {return ((rCurrVar == DISPLACEMENT_X) || (rCurrVar == DISPLACEMENT_Y) || (rCurrVar == DISPLACEMENT_Z));};
289  const auto* p_check_disp = (mOptions.Is(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::ROTATION_DOF_IS_CONSIDERED)) ? &check_with_rot : &check_without_rot;
290 
291  // Loop over Dofs
293  std::tie(disp_residual_solution_norm, rot_residual_solution_norm, normal_lm_residual_solution_norm, tangent_lm_slip_residual_solution_norm, tangent_lm_stick_residual_solution_norm, disp_dof_num, rot_dof_num, lm_dof_num, lm_slip_dof_num, lm_stick_dof_num) = block_for_each<TenReduction>(rDofSet, AuxValues(), [this,&number_active_dofs,p_check_disp,&pure_slip,&r_nodes_array,&rb](Dof<double>& rDof, AuxValues& aux_values) {
294  aux_values.dof_id = rDof.EquationId();
295 
296  // Check dof id is solved
297  if (aux_values.dof_id < number_active_dofs) {
298  if (mActiveDofs[aux_values.dof_id] == 1) {
299  // The component of the residual
300  aux_values.residual_dof_value = rb[aux_values.dof_id];
301 
302  const auto& r_curr_var = rDof.GetVariable();
303  if (r_curr_var == VECTOR_LAGRANGE_MULTIPLIER_X || r_curr_var == VECTOR_LAGRANGE_MULTIPLIER_Y || r_curr_var == VECTOR_LAGRANGE_MULTIPLIER_Z) {
304  // The normal of the node (TODO: how to solve this without accesing all the time to the database?)
305  const auto it_node = r_nodes_array.find(rDof.Id());
306  const double mu = it_node->GetValue(FRICTION_COEFFICIENT);
307 
308  if (mu < ZeroTolerance) {
309  return std::make_tuple(0.0,0.0,std::pow(aux_values.residual_dof_value, 2),0.0,0.0,0,0,1,0,0);
310  } else {
311  const double normal = it_node->FastGetSolutionStepValue(NORMAL)[r_curr_var.GetComponentIndex()];
312  const double normal_comp_residual = aux_values.residual_dof_value * normal;
313  if (it_node->Is(SLIP) || pure_slip) {
314  return std::make_tuple(0.0,0.0,std::pow(normal_comp_residual, 2),std::pow(aux_values.residual_dof_value - normal_comp_residual, 2),0.0,0,0,1,1,0);
315  } else {
316  return std::make_tuple(0.0,0.0,std::pow(normal_comp_residual, 2),0.0,std::pow(aux_values.residual_dof_value - normal_comp_residual, 2),0,0,1,0,1);
317  }
318  }
319  return std::make_tuple(0.0,0.0,0.0,0.0,0.0,0,0,0,0,0);
320  } else if ((*p_check_disp)(r_curr_var)) {
321  return std::make_tuple(std::pow(aux_values.residual_dof_value, 2),0.0,0.0,0.0,0.0,1,0,0,0,0);
322  } else { // We will assume is rotation dof
323  KRATOS_DEBUG_ERROR_IF_NOT((r_curr_var == ROTATION_X) || (r_curr_var == ROTATION_Y) || (r_curr_var == ROTATION_Z)) << "Variable must be a ROTATION and it is: " << r_curr_var.Name() << std::endl;
324  return std::make_tuple(0.0,std::pow(aux_values.residual_dof_value, 2),0.0,0.0,0.0,0,1,0,0,0);
325  }
326  }
327  }
328  return std::make_tuple(0.0,0.0,0.0,0.0,0.0,0,0,0,0,0);
329  });
330 
331  // Auxiliary dofs counters
332  if (mStickCounter > 0) {
333  if (lm_stick_dof_num == 0) {
334  mStickCounter = 0;
335  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_STICK_RESIDUAL_IS_SET, false);
336  }
337  } else {
338  if (lm_stick_dof_num > 0) {
339  mStickCounter = lm_stick_dof_num;
340  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_STICK_RESIDUAL_IS_SET, false);
341  }
342  }
343  if (mSlipCounter > 0) {
344  if (lm_slip_dof_num == 0) {
345  mSlipCounter = 0;
346  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_SLIP_RESIDUAL_IS_SET, false);
347  }
348  } else {
349  if (lm_slip_dof_num > 0) {
350  mSlipCounter = lm_slip_dof_num;
351  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_SLIP_RESIDUAL_IS_SET, false);
352  }
353  }
354 
355  mDispCurrentResidualNorm = disp_residual_solution_norm;
356  mRotCurrentResidualNorm = rot_residual_solution_norm;
357  mLMNormalCurrentResidualNorm = normal_lm_residual_solution_norm;
358  mLMTangentStickCurrentResidualNorm = tangent_lm_stick_residual_solution_norm;
359  mLMTangentSlipCurrentResidualNorm = tangent_lm_slip_residual_solution_norm;
360 
361  double residual_disp_ratio = 1.0;
362  double residual_rot_ratio = 1.0;
363  double residual_normal_lm_ratio = 1.0;
364  double residual_tangent_lm_stick_ratio = 1.0;
365  double residual_tangent_lm_slip_ratio = 1.0;
366 
367  // We initialize the solution
368  if (mOptions.IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_RESIDUAL_IS_SET)) {
369  mDispInitialResidualNorm = (disp_residual_solution_norm < ZeroTolerance) ? 1.0 : disp_residual_solution_norm;
370  residual_disp_ratio = 1.0;
371  if (mOptions.Is(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::ROTATION_DOF_IS_CONSIDERED)) {
372  mRotInitialResidualNorm = (rot_residual_solution_norm < ZeroTolerance) ? 1.0 : rot_residual_solution_norm;
373  residual_rot_ratio = 1.0;
374  }
375  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_RESIDUAL_IS_SET, true);
376  }
377 
378  // We calculate the ratio of the displacements
379  residual_disp_ratio = mDispCurrentResidualNorm/mDispInitialResidualNorm;
380  residual_rot_ratio = mRotCurrentResidualNorm/mRotInitialResidualNorm;
381 
382  // We initialize the solution
383  if (mOptions.IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_NORMAL_RESIDUAL_IS_SET)) {
384  mLMNormalInitialResidualNorm = (normal_lm_residual_solution_norm < ZeroTolerance) ? 1.0 : normal_lm_residual_solution_norm;
385  residual_normal_lm_ratio = 1.0;
386  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_NORMAL_RESIDUAL_IS_SET, true);
387  }
388 
389  // We calculate the ratio of the normal LM
390  residual_normal_lm_ratio = mLMNormalCurrentResidualNorm/mLMNormalInitialResidualNorm;
391 
392  // We initialize the solution
393  if (mOptions.IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_STICK_RESIDUAL_IS_SET) && lm_stick_dof_num > 0) {
394  mLMTangentStickInitialResidualNorm = (tangent_lm_stick_residual_solution_norm < ZeroTolerance) ? 1.0 : tangent_lm_stick_residual_solution_norm;
395  residual_tangent_lm_stick_ratio = 1.0;
396  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_STICK_RESIDUAL_IS_SET, true);
397  }
398  if (mOptions.IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_SLIP_RESIDUAL_IS_SET) && lm_slip_dof_num > 0) {
399  mLMTangentSlipInitialResidualNorm = (tangent_lm_slip_residual_solution_norm < ZeroTolerance) ? 1.0 : tangent_lm_slip_residual_solution_norm;
400  residual_tangent_lm_slip_ratio = 1.0;
401  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_SLIP_RESIDUAL_IS_SET, true);
402  }
403 
404  // We calculate the ratio of the tangent LM
405  if (lm_stick_dof_num > 0) {
406  residual_tangent_lm_stick_ratio = mLMTangentStickCurrentResidualNorm/mLMTangentStickInitialResidualNorm;
407  } else {
408  residual_tangent_lm_stick_ratio = 0.0;
409  }
410  if (lm_slip_dof_num > 0) {
411  residual_tangent_lm_slip_ratio = mLMTangentSlipCurrentResidualNorm/mLMTangentSlipInitialResidualNorm;
412  } else {
413  residual_tangent_lm_slip_ratio = 0.0;
414  }
415 
416  KRATOS_ERROR_IF(mOptions.Is(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::ENSURE_CONTACT) && residual_normal_lm_ratio < ZeroTolerance) << "ERROR::CONTACT LOST::ARE YOU SURE YOU ARE SUPPOSED TO HAVE CONTACT?" << std::endl;
417 
418  // We calculate the absolute norms
419  const double residual_disp_abs = mDispCurrentResidualNorm/static_cast<double>(disp_dof_num);
420  const double residual_rot_abs = mRotCurrentResidualNorm/static_cast<double>(rot_dof_num);
421  const double residual_normal_lm_abs = mLMNormalCurrentResidualNorm/static_cast<double>(lm_dof_num);
422  const double residual_tangent_lm_stick_abs = lm_stick_dof_num > 0 ? mLMTangentStickCurrentResidualNorm/static_cast<double>(lm_dof_num) : 0.0;
423 // const double residual_tangent_lm_stick_abs = lm_stick_dof_num > 0 ? mLMTangentStickCurrentResidualNorm/static_cast<double>(lm_stick_dof_num) : 0.0;
424  const double residual_tangent_lm_slip_abs = lm_slip_dof_num > 0 ? mLMTangentSlipCurrentResidualNorm/static_cast<double>(lm_dof_num) : 0.0;
425 // const double residual_tangent_lm_slip_abs = lm_slip_dof_num > 0 ? mLMTangentSlipCurrentResidualNorm/static_cast<double>(lm_slip_dof_num) : 0.0;
426  const double normal_tangent_stick_ratio = residual_tangent_lm_stick_abs/residual_normal_lm_abs;
427  const double normal_tangent_slip_ratio = residual_tangent_lm_slip_abs/residual_normal_lm_abs;
428 
429  // We print the results // TODO: Replace for the new log
430  if (rModelPart.GetCommunicator().MyPID() == 0 && this->GetEchoLevel() > 0) {
431  if (r_process_info.Has(TABLE_UTILITY)) {
432  std::cout.precision(4);
433  TablePrinterPointerType p_table = r_process_info[TABLE_UTILITY];
434  auto& r_table = p_table->GetTable();
435  if (mOptions.Is(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::ROTATION_DOF_IS_CONSIDERED)) {
436  if (mOptions.IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PURE_SLIP)) {
437  r_table << residual_disp_ratio << mDispRatioTolerance << residual_disp_abs << mDispAbsTolerance << residual_rot_ratio << mRotRatioTolerance << residual_rot_abs << mRotAbsTolerance << residual_normal_lm_ratio << mLMNormalRatioTolerance << residual_normal_lm_abs << mLMNormalAbsTolerance << residual_tangent_lm_stick_ratio << mLMTangentStickRatioTolerance << residual_tangent_lm_stick_abs << mLMTangentStickAbsTolerance << residual_tangent_lm_slip_ratio << mLMTangentSlipRatioTolerance << residual_tangent_lm_slip_abs << mLMTangentSlipAbsTolerance;
438  } else {
439  r_table << residual_disp_ratio << mDispRatioTolerance << residual_disp_abs << mDispAbsTolerance << residual_rot_ratio << mRotRatioTolerance << residual_rot_abs << mRotAbsTolerance << residual_normal_lm_ratio << mLMNormalRatioTolerance << residual_normal_lm_abs << mLMNormalAbsTolerance << residual_tangent_lm_slip_ratio << mLMTangentSlipRatioTolerance << residual_tangent_lm_slip_abs << mLMTangentSlipAbsTolerance;
440  }
441  } else {
442  if (mOptions.IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PURE_SLIP)) {
443  r_table << residual_disp_ratio << mDispRatioTolerance << residual_disp_abs << mDispAbsTolerance << residual_normal_lm_ratio << mLMNormalRatioTolerance << residual_normal_lm_abs << mLMNormalAbsTolerance << residual_tangent_lm_stick_ratio << mLMTangentStickRatioTolerance << residual_tangent_lm_stick_abs << mLMTangentStickAbsTolerance << residual_tangent_lm_slip_ratio << mLMTangentSlipRatioTolerance << residual_tangent_lm_slip_abs << mLMTangentSlipAbsTolerance;
444  } else {
445  r_table << residual_disp_ratio << mDispRatioTolerance << residual_disp_abs << mDispAbsTolerance << residual_normal_lm_ratio << mLMNormalRatioTolerance << residual_normal_lm_abs << mLMNormalAbsTolerance << residual_tangent_lm_slip_ratio << mLMTangentSlipRatioTolerance << residual_tangent_lm_slip_abs << mLMTangentSlipAbsTolerance;
446  }
447  }
448  } else {
449  std::cout.precision(4);
450  if (mOptions.IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PRINTING_OUTPUT)) {
451  KRATOS_INFO("DisplacementLagrangeMultiplierResidualFrictionalContactCriteria") << BOLDFONT("RESIDUAL CONVERGENCE CHECK") << "\tSTEP: " << r_process_info[STEP] << "\tNL ITERATION: " << r_process_info[NL_ITERATION_NUMBER] << std::endl << std::scientific;
452  KRATOS_INFO("DisplacementLagrangeMultiplierResidualFrictionalContactCriteria") << BOLDFONT("\tDISPLACEMENT: RATIO = ") << residual_disp_ratio << BOLDFONT(" EXP.RATIO = ") << mDispRatioTolerance << BOLDFONT(" ABS = ") << residual_disp_abs << BOLDFONT(" EXP.ABS = ") << mDispAbsTolerance << std::endl;
453  if (mOptions.Is(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::ROTATION_DOF_IS_CONSIDERED)) {
454  KRATOS_INFO("DisplacementLagrangeMultiplierResidualFrictionalContactCriteria") << BOLDFONT("\tROTATION: RATIO = ") << residual_rot_ratio << BOLDFONT(" EXP.RATIO = ") << mRotRatioTolerance << BOLDFONT(" ABS = ") << residual_rot_abs << BOLDFONT(" EXP.ABS = ") << mRotAbsTolerance << std::endl;
455  }
456  KRATOS_INFO("DisplacementLagrangeMultiplierResidualFrictionalContactCriteria") << BOLDFONT("\tNORMAL LAGRANGE MUL: RATIO = ") << residual_normal_lm_ratio << BOLDFONT(" EXP.RATIO = ") << mLMNormalRatioTolerance << BOLDFONT(" ABS = ") << residual_normal_lm_abs << BOLDFONT(" EXP.ABS = ") << mLMNormalAbsTolerance << std::endl;
457  KRATOS_INFO_IF("DisplacementLagrangeMultiplierResidualFrictionalContactCriteria", mOptions.IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PURE_SLIP)) << BOLDFONT("\tSTICK LAGRANGE MUL: RATIO = ") << residual_tangent_lm_stick_ratio << BOLDFONT(" EXP.RATIO = ") << mLMTangentStickRatioTolerance << BOLDFONT(" ABS = ") << residual_tangent_lm_stick_abs << BOLDFONT(" EXP.ABS = ") << mLMTangentStickAbsTolerance << std::endl;
458  KRATOS_INFO("DisplacementLagrangeMultiplierResidualFrictionalContactCriteria") << BOLDFONT("\tSLIP LAGRANGE MUL: RATIO = ") << residual_tangent_lm_slip_ratio << BOLDFONT(" EXP.RATIO = ") << mLMTangentSlipRatioTolerance << BOLDFONT(" ABS = ") << residual_tangent_lm_slip_abs << BOLDFONT(" EXP.ABS = ") << mLMTangentSlipAbsTolerance << std::endl;
459  } else {
460  KRATOS_INFO("DisplacementLagrangeMultiplierResidualFrictionalContactCriteria") << "RESIDUAL CONVERGENCE CHECK" << "\tSTEP: " << r_process_info[STEP] << "\tNL ITERATION: " << r_process_info[NL_ITERATION_NUMBER] << std::endl << std::scientific;
461  KRATOS_INFO("DisplacementLagrangeMultiplierResidualFrictionalContactCriteria") << "\tDISPLACEMENT: RATIO = " << residual_disp_ratio << " EXP.RATIO = " << mDispRatioTolerance << " ABS = " << residual_disp_abs << " EXP.ABS = " << mDispAbsTolerance << std::endl;
462  if (mOptions.Is(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::ROTATION_DOF_IS_CONSIDERED)) {
463  KRATOS_INFO("DisplacementLagrangeMultiplierResidualFrictionalContactCriteria") << "\tROTATION: RATIO = " << residual_rot_ratio << " EXP.RATIO = " << mRotRatioTolerance << " ABS = " << residual_rot_abs << " EXP.ABS = " << mRotAbsTolerance << std::endl;
464  }
465  KRATOS_INFO("DisplacementLagrangeMultiplierResidualFrictionalContactCriteria") << "\tNORMAL LAGRANGE MUL: RATIO = " << residual_normal_lm_ratio << " EXP.RATIO = " << mLMNormalRatioTolerance << " ABS = " << residual_normal_lm_abs << " EXP.ABS = " << mLMNormalAbsTolerance << std::endl;
466  KRATOS_INFO_IF("DisplacementLagrangeMultiplierResidualFrictionalContactCriteria", mOptions.IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PURE_SLIP)) << "\tSTICK LAGRANGE MUL: RATIO = " << residual_tangent_lm_stick_ratio << " EXP.RATIO = " << mLMTangentStickRatioTolerance << " ABS = " << residual_tangent_lm_stick_abs << " EXP.ABS = " << mLMTangentStickAbsTolerance << std::endl;
467  KRATOS_INFO("DisplacementLagrangeMultiplierResidualFrictionalContactCriteria") << "\tSLIP LAGRANGE MUL: RATIO = " << residual_tangent_lm_slip_ratio << " EXP.RATIO = " << mLMTangentSlipRatioTolerance << " ABS = " << residual_tangent_lm_slip_abs << " EXP.ABS = " << mLMTangentSlipAbsTolerance << std::endl;
468  }
469  }
470  }
471 
472  // NOTE: Here we don't include the tangent counter part
473  r_process_info[CONVERGENCE_RATIO] = (residual_disp_ratio > residual_normal_lm_ratio) ? residual_disp_ratio : residual_normal_lm_ratio;
474  r_process_info[RESIDUAL_NORM] = (residual_normal_lm_abs > mLMNormalAbsTolerance) ? residual_normal_lm_abs : mLMNormalAbsTolerance;
475 
476  // We check if converged
477  const bool disp_converged = (residual_disp_ratio <= mDispRatioTolerance || residual_disp_abs <= mDispAbsTolerance);
478  const bool rot_converged = (mOptions.Is(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::ROTATION_DOF_IS_CONSIDERED)) ? (residual_rot_ratio <= mRotRatioTolerance || residual_rot_abs <= mRotAbsTolerance) : true;
479  const bool lm_converged = (mOptions.IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::ENSURE_CONTACT) && residual_normal_lm_ratio == 0.0) ? true : (residual_normal_lm_ratio <= mLMNormalRatioTolerance || residual_normal_lm_abs <= mLMNormalAbsTolerance) && (residual_tangent_lm_stick_ratio <= mLMTangentStickRatioTolerance || residual_tangent_lm_stick_abs <= mLMTangentStickAbsTolerance || normal_tangent_stick_ratio <= mNormalTangentRatio) && (residual_tangent_lm_slip_ratio <= mLMTangentSlipRatioTolerance || residual_tangent_lm_slip_abs <= mLMTangentSlipAbsTolerance || normal_tangent_slip_ratio <= mNormalTangentRatio);
480 
481  if (disp_converged && rot_converged && lm_converged ) {
482  if (rModelPart.GetCommunicator().MyPID() == 0 && this->GetEchoLevel() > 0) {
483  if (r_process_info.Has(TABLE_UTILITY)) {
484  TablePrinterPointerType p_table = r_process_info[TABLE_UTILITY];
485  auto& r_table = p_table->GetTable();
486  if (mOptions.IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PRINTING_OUTPUT))
487  r_table << BOLDFONT(FGRN(" Achieved"));
488  else
489  r_table << "Achieved";
490  } else {
491  if (mOptions.IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PRINTING_OUTPUT))
492  KRATOS_INFO("DisplacementLagrangeMultiplierResidualFrictionalContactCriteria") << BOLDFONT("\tResidual") << " convergence is " << BOLDFONT(FGRN("achieved")) << std::endl;
493  else
494  KRATOS_INFO("DisplacementLagrangeMultiplierResidualFrictionalContactCriteria") << "\tResidual convergence is achieved" << std::endl;
495  }
496  }
497  return true;
498  } else {
499  if (rModelPart.GetCommunicator().MyPID() == 0 && this->GetEchoLevel() > 0) {
500  if (r_process_info.Has(TABLE_UTILITY)) {
501  TablePrinterPointerType p_table = r_process_info[TABLE_UTILITY];
502  auto& r_table = p_table->GetTable();
503  if (mOptions.IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PRINTING_OUTPUT))
504  r_table << BOLDFONT(FRED(" Not achieved"));
505  else
506  r_table << "Not achieved";
507  } else {
508  if (mOptions.IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PRINTING_OUTPUT))
509  KRATOS_INFO("DisplacementLagrangeMultiplierResidualFrictionalContactCriteria") << BOLDFONT("\tResidual") << " convergence is " << BOLDFONT(FRED(" not achieved")) << std::endl;
510  else
511  KRATOS_INFO("DisplacementLagrangeMultiplierResidualFrictionalContactCriteria") << "\tResidual convergence is not achieved" << std::endl;
512  }
513  }
514  return false;
515  }
516  } else { // In this case all the displacements are imposed!
517  return true;
518  }
519  }
520 
525  void Initialize( ModelPart& rModelPart) override
526  {
527  // Initialize
528  BaseType::mConvergenceCriteriaIsInitialized = true;
529 
530  // Check rotation dof
531  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::ROTATION_DOF_IS_CONSIDERED, ContactUtilities::CheckModelPartHasRotationDoF(rModelPart));
532 
533  // Initialize header
534  ProcessInfo& r_process_info = rModelPart.GetProcessInfo();
535  if (r_process_info.Has(TABLE_UTILITY) && mOptions.IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::TABLE_IS_INITIALIZED)) {
536  TablePrinterPointerType p_table = r_process_info[TABLE_UTILITY];
537  auto& r_table = p_table->GetTable();
538  r_table.AddColumn("DP RATIO", 10);
539  r_table.AddColumn("EXP. RAT", 10);
540  r_table.AddColumn("ABS", 10);
541  r_table.AddColumn("EXP. ABS", 10);
542  if (mOptions.Is(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::ROTATION_DOF_IS_CONSIDERED)) {
543  r_table.AddColumn("RT RATIO", 10);
544  r_table.AddColumn("EXP. RAT", 10);
545  r_table.AddColumn("ABS", 10);
546  r_table.AddColumn("EXP. ABS", 10);
547  }
548  r_table.AddColumn("N.LM RATIO", 10);
549  r_table.AddColumn("EXP. RAT", 10);
550  r_table.AddColumn("ABS", 10);
551  r_table.AddColumn("EXP. ABS", 10);
552  if (mOptions.IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PURE_SLIP)) {
553  r_table.AddColumn("STI. RATIO", 10);
554  r_table.AddColumn("EXP. RAT", 10);
555  r_table.AddColumn("ABS", 10);
556  r_table.AddColumn("EXP. ABS", 10);
557  }
558  r_table.AddColumn("SLIP RATIO", 10);
559  r_table.AddColumn("EXP. RAT", 10);
560  r_table.AddColumn("ABS", 10);
561  r_table.AddColumn("EXP. ABS", 10);
562  r_table.AddColumn("CONVERGENCE", 15);
563  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::TABLE_IS_INITIALIZED, true);
564  }
565  }
566 
576  ModelPart& rModelPart,
577  DofsArrayType& rDofSet,
578  const TSystemMatrixType& rA,
579  const TSystemVectorType& rDx,
580  const TSystemVectorType& rb
581  ) override
582  {
583  // Initialize flags
584  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_RESIDUAL_IS_SET, false);
585  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_NORMAL_RESIDUAL_IS_SET, false);
586  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_STICK_RESIDUAL_IS_SET, false);
587  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_SLIP_RESIDUAL_IS_SET, false);
588 
589  // Filling mActiveDofs when MPC exist
590  ConstraintUtilities::ComputeActiveDofs(rModelPart, mActiveDofs, rDofSet);
591  }
592 
602  ModelPart& rModelPart,
603  DofsArrayType& rDofSet,
604  const TSystemMatrixType& rA,
605  const TSystemVectorType& rDx,
606  const TSystemVectorType& rb
607  ) override
608  {
609  // Calling base criteria
610  BaseType::FinalizeNonLinearIteration(rModelPart, rDofSet, rA, rDx, rb);
611 
612  // The current process info
613  ProcessInfo& r_process_info = rModelPart.GetProcessInfo();
614  r_process_info.SetValue(ACTIVE_SET_COMPUTED, false);
615  }
616 
622  {
623  Parameters default_parameters = Parameters(R"(
624  {
625  "name" : "displacement_lagrangemultiplier_ressidual_frictional_contact_criteria",
626  "ensure_contact" : false,
627  "pure_slip" : false,
628  "print_convergence_criterion" : false,
629  "residual_relative_tolerance" : 1.0e-4,
630  "residual_absolute_tolerance" : 1.0e-9,
631  "rotation_residual_relative_tolerance" : 1.0e-4,
632  "rotation_residual_absolute_tolerance" : 1.0e-9,
633  "contact_residual_relative_tolerance" : 1.0e-4,
634  "contact_residual_absolute_tolerance" : 1.0e-9,
635  "frictional_stick_contact_residual_relative_tolerance" : 1.0e-4,
636  "frictional_stick_contact_residual_absolute_tolerance" : 1.0e-9,
637  "frictional_slip_contact_residual_relative_tolerance" : 1.0e-4,
638  "frictional_slip_contact_residual_absolute_tolerance" : 1.0e-9
639  })");
640 
641  // Getting base class default parameters
642  const Parameters base_default_parameters = BaseType::GetDefaultParameters();
643  default_parameters.RecursivelyAddMissingParameters(base_default_parameters);
644  return default_parameters;
645  }
646 
651  static std::string Name()
652  {
653  return "displacement_lagrangemultiplier_ressidual_frictional_contact_criteria";
654  }
655 
659 
663 
667 
669  std::string Info() const override
670  {
671  return "DisplacementLagrangeMultiplierResidualFrictionalContactCriteria";
672  }
673 
675  void PrintInfo(std::ostream& rOStream) const override
676  {
677  rOStream << Info();
678  }
679 
681  void PrintData(std::ostream& rOStream) const override
682  {
683  rOStream << Info();
684  }
685 
687 protected:
690 
694 
698 
702 
707  void AssignSettings(const Parameters ThisParameters) override
708  {
709  BaseType::AssignSettings(ThisParameters);
710 
711  // The displacement residual
712  mDispRatioTolerance = ThisParameters["residual_relative_tolerance"].GetDouble();
713  mDispAbsTolerance = ThisParameters["residual_absolute_tolerance"].GetDouble();
714 
715  // The rotation residual
716  mRotRatioTolerance = ThisParameters["rotation_residual_relative_tolerance"].GetDouble();
717  mRotAbsTolerance = ThisParameters["rotation_residual_absolute_tolerance"].GetDouble();
718 
719  // The normal contact residual
720  mLMNormalRatioTolerance = ThisParameters["contact_displacement_absolute_tolerance"].GetDouble();
721  mLMNormalAbsTolerance = ThisParameters["contact_residual_absolute_tolerance"].GetDouble();
722 
723  // The tangent contact residual
724  mLMTangentStickRatioTolerance = ThisParameters["frictional_stick_contact_residual_relative_tolerance"].GetDouble();
725  mLMTangentStickAbsTolerance = ThisParameters["frictional_stick_contact_residual_absolute_tolerance"].GetDouble();
726  mLMTangentSlipRatioTolerance = ThisParameters["frictional_slip_contact_residual_relative_tolerance"].GetDouble();
727  mLMTangentSlipAbsTolerance = ThisParameters["frictional_slip_contact_residual_absolute_tolerance"].GetDouble();
728 
729  // We get the ratio between the normal and tangent that will accepted as converged
730  mNormalTangentRatio = ThisParameters["ratio_normal_tangent_threshold"].GetDouble();
731 
732  // Set local flags
733  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::ENSURE_CONTACT, ThisParameters["ensure_contact"].GetBool());
734  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PRINTING_OUTPUT, ThisParameters["print_convergence_criterion"].GetBool());
735  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::TABLE_IS_INITIALIZED, false);
736  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::ROTATION_DOF_IS_CONSIDERED, false);
737  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PURE_SLIP, ThisParameters["pure_slip"].GetBool());
738  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_RESIDUAL_IS_SET, false);
739  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_NORMAL_RESIDUAL_IS_SET, false);
740  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_STICK_RESIDUAL_IS_SET, false);
741  mOptions.Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_SLIP_RESIDUAL_IS_SET, false);
742  }
743 
745 private:
748 
752 
753  Flags mOptions;
754 
755  double mDispRatioTolerance;
756  double mDispAbsTolerance;
757  double mDispInitialResidualNorm;
758  double mDispCurrentResidualNorm;
759 
760  double mRotRatioTolerance;
761  double mRotAbsTolerance;
762  double mRotInitialResidualNorm;
763  double mRotCurrentResidualNorm;
764 
765  double mLMNormalRatioTolerance;
766  double mLMNormalAbsTolerance;
767  double mLMNormalInitialResidualNorm;
768  double mLMNormalCurrentResidualNorm;
769 
770  double mLMTangentStickRatioTolerance;
771  double mLMTangentStickAbsTolerance;
772  double mLMTangentSlipRatioTolerance;
773  double mLMTangentSlipAbsTolerance;
774  double mLMTangentStickInitialResidualNorm;
775  double mLMTangentStickCurrentResidualNorm;
776  double mLMTangentSlipInitialResidualNorm;
777  double mLMTangentSlipCurrentResidualNorm;
778 
779  std::size_t mStickCounter = 0;
780  std::size_t mSlipCounter = 0;
781 
782  double mNormalTangentRatio;
783 
784  std::vector<int> mActiveDofs;
785 
787 }; // Kratos DisplacementLagrangeMultiplierResidualFrictionalContactCriteria
788 
791 
793 template<class TSparseSpace, class TDenseSpace>
794 const Kratos::Flags DisplacementLagrangeMultiplierResidualFrictionalContactCriteria<TSparseSpace, TDenseSpace>::ENSURE_CONTACT(Kratos::Flags::Create(0));
795 template<class TSparseSpace, class TDenseSpace>
796 const Kratos::Flags DisplacementLagrangeMultiplierResidualFrictionalContactCriteria<TSparseSpace, TDenseSpace>::PRINTING_OUTPUT(Kratos::Flags::Create(1));
797 template<class TSparseSpace, class TDenseSpace>
798 const Kratos::Flags DisplacementLagrangeMultiplierResidualFrictionalContactCriteria<TSparseSpace, TDenseSpace>::TABLE_IS_INITIALIZED(Kratos::Flags::Create(2));
799 template<class TSparseSpace, class TDenseSpace>
800 const Kratos::Flags DisplacementLagrangeMultiplierResidualFrictionalContactCriteria<TSparseSpace, TDenseSpace>::ROTATION_DOF_IS_CONSIDERED(Kratos::Flags::Create(3));
801 template<class TSparseSpace, class TDenseSpace>
802 const Kratos::Flags DisplacementLagrangeMultiplierResidualFrictionalContactCriteria<TSparseSpace, TDenseSpace>::PURE_SLIP(Kratos::Flags::Create(4));
803 template<class TSparseSpace, class TDenseSpace>
804 const Kratos::Flags DisplacementLagrangeMultiplierResidualFrictionalContactCriteria<TSparseSpace, TDenseSpace>::INITIAL_RESIDUAL_IS_SET(Kratos::Flags::Create(5));
805 template<class TSparseSpace, class TDenseSpace>
806 const Kratos::Flags DisplacementLagrangeMultiplierResidualFrictionalContactCriteria<TSparseSpace, TDenseSpace>::INITIAL_NORMAL_RESIDUAL_IS_SET(Kratos::Flags::Create(6));
807 template<class TSparseSpace, class TDenseSpace>
808 const Kratos::Flags DisplacementLagrangeMultiplierResidualFrictionalContactCriteria<TSparseSpace, TDenseSpace>::INITIAL_STICK_RESIDUAL_IS_SET(Kratos::Flags::Create(7));
809 template<class TSparseSpace, class TDenseSpace>
810 const Kratos::Flags DisplacementLagrangeMultiplierResidualFrictionalContactCriteria<TSparseSpace, TDenseSpace>::INITIAL_SLIP_RESIDUAL_IS_SET(Kratos::Flags::Create(8));
811 }
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
virtual int MyPID() const
Definition: communicator.cpp:91
static bool CheckModelPartHasRotationDoF(ModelPart &rModelPart)
This method checks that the modelpart has a rotation DoF.
Definition: contact_utilities.cpp:147
This is the base class to define the different convergence criterion considered.
Definition: convergence_criteria.h:58
int GetEchoLevel()
This returns the level of echo for the solving strategy.
Definition: convergence_criteria.h:209
virtual Parameters ValidateAndAssignParameters(Parameters ThisParameters, const Parameters DefaultParameters) const
This method validate and assign default parameters.
Definition: convergence_criteria.h:466
TSparseSpace::MatrixType TSystemMatrixType
Matrix type definition.
Definition: convergence_criteria.h:72
ModelPart::DofsArrayType DofsArrayType
DoF array type definition.
Definition: convergence_criteria.h:81
TSparseSpace::VectorType TSystemVectorType
Vector type definition.
Definition: convergence_criteria.h:74
bool Has(const Variable< TDataType > &rThisVariable) const
Checks if the data container has a value associated with a given variable.
Definition: data_value_container.h:382
void SetValue(const Variable< TDataType > &rThisVariable, TDataType const &rValue)
Sets the value for a given variable.
Definition: data_value_container.h:320
Convergence criteria for contact problems (only for frictional cases) This class implements a converg...
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:63
Dof represents a degree of freedom (DoF).
Definition: dof.h:86
EquationIdType EquationId() const
Definition: dof.h:324
Definition: flags.h:58
void Set(const Flags ThisFlag)
Definition: flags.cpp:33
bool Is(Flags const &rOther) const
Definition: flags.h:274
static Flags Create(IndexType ThisPosition, bool Value=true)
Definition: flags.h:138
bool IsNot(Flags const &rOther) const
Definition: flags.h:291
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
Communicator & GetCommunicator()
Definition: model_part.h:1821
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
double GetDouble() const
This method returns the double contained in the current Parameter.
Definition: kratos_parameters.cpp:657
void RecursivelyAddMissingParameters(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing contain at least all parameters...
Definition: kratos_parameters.cpp:1457
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
utility function to do a sum reduction
Definition: reduction_utilities.h:68
static IndexType Size(VectorType const &rV)
return size of vector rV
Definition: ublas_space.h:190
This class is the base of variables and variable's components which contains their common data.
Definition: variable_data.h:49
#define FGRN(x)
Definition: color_utilities.h:27
#define FRED(x)
Definition: color_utilities.h:26
#define BOLDFONT(x)
Definition: color_utilities.h:34
typename BaseType::TSystemVectorType TSystemVectorType
The dense vector type.
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:96
~DisplacementLagrangeMultiplierResidualFrictionalContactCriteria() override=default
Destructor.
void AssignSettings(const Parameters ThisParameters) override
This method assigns settings to member variables.
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:707
std::size_t IndexType
The index type definition.
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:105
typename BaseType::TSystemMatrixType TSystemMatrixType
The sparse matrix type.
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:93
std::string Info() const override
Turn back information as a string.
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:669
TSparseSpace SparseSpaceType
The sparse space used.
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:99
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:675
void FinalizeNonLinearIteration(ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &rA, const TSystemVectorType &rDx, const TSystemVectorType &rb) override
This function finalizes the non-linear iteration.
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:601
static constexpr double ZeroTolerance
Zero tolerance definition.
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:108
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:681
KRATOS_CLASS_POINTER_DEFINITION(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria)
Pointer definition of DisplacementLagrangeMultiplierResidualFrictionalContactCriteria.
void InitializeSolutionStep(ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &rA, const TSystemVectorType &rDx, const TSystemVectorType &rb) override
This function initializes the solution step.
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:575
DisplacementLagrangeMultiplierResidualFrictionalContactCriteria(const double DispRatioTolerance, const double DispAbsTolerance, const double RotRatioTolerance, const double RotAbsTolerance, const double LMNormalRatioTolerance, const double LMNormalAbsTolerance, const double LMTangentStickRatioTolerance, const double LMTangentStickAbsTolerance, const double LMTangentSlipRatioTolerance, const double LMTangentSlipAbsTolerance, const double NormalTangentRatio, const bool EnsureContact=false, const bool PureSlip=false, const bool PrintingOutput=false)
Default constructor.
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:147
typename BaseType::DofsArrayType DofsArrayType
The dofs array type.
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:90
bool PostCriteria(ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &rA, const TSystemVectorType &rDx, const TSystemVectorType &rb) override
Compute relative and absolute error.
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:254
DisplacementLagrangeMultiplierResidualFrictionalContactCriteria(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria const &rOther)
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:198
BaseType::Pointer Create(Parameters ThisParameters) const override
Create method.
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:240
DisplacementLagrangeMultiplierResidualFrictionalContactCriteria(Kratos::Parameters ThisParameters)
Default constructor. (with parameters)
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:126
DisplacementLagrangeMultiplierResidualFrictionalContactCriteria()
Default constructor.
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:117
static std::string Name()
Returns the name of the class as used in the settings (snake_case format)
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:651
TableStreamUtility::Pointer TablePrinterPointerType
The table stream definition TODO: Replace by logger.
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:102
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:621
void Initialize(ModelPart &rModelPart) override
This function initialize the convergence criteria.
Definition: displacement_lagrangemultiplier_residual_frictional_contact_criteria.h:525
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_INFO(label)
Definition: logger.h:250
#define KRATOS_INFO_IF(label, conditional)
Definition: logger.h:251
void ComputeActiveDofs(ModelPart &rModelPart, std::vector< int > &rActiveDofs, const ModelPart::DofsArrayType &rDofSet)
This method computes the active dofs.
Definition: constraint_utilities.cpp:26
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
REACTION_CHECK_STIFFNESS_FACTOR INNER_LOOP_ITERATION DISTANCE_THRESHOLD ACTIVE_CHECK_FACTOR AUXILIAR_COORDINATES NORMAL_GAP WEIGHTED_GAP WEIGHTED_SCALAR_RESIDUAL bool
Definition: contact_structural_mechanics_application_variables.h:93
Definition: reduction_utilities.h:310