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_mixed_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
24 
25 namespace Kratos
26 {
29 
32 
36 
40 
44 
47 
57 template< class TSparseSpace,
58  class TDenseSpace >
60  : public ConvergenceCriteria< TSparseSpace, TDenseSpace >
61 {
62 public:
63 
66 
69 
71  KRATOS_DEFINE_LOCAL_FLAG( ENSURE_CONTACT );
72  KRATOS_DEFINE_LOCAL_FLAG( PRINTING_OUTPUT );
73  KRATOS_DEFINE_LOCAL_FLAG( TABLE_IS_INITIALIZED );
74  KRATOS_DEFINE_LOCAL_FLAG( ROTATION_DOF_IS_CONSIDERED );
75  KRATOS_DEFINE_LOCAL_FLAG( INITIAL_RESIDUAL_IS_SET );
76 
79 
82 
85 
88 
91 
93  using SparseSpaceType = TSparseSpace;
94 
96  using TablePrinterPointerType = TableStreamUtility::Pointer;
97 
99  using IndexType = std::size_t;
100 
102  static constexpr double Tolerance = std::numeric_limits<double>::epsilon();
103 
107 
112  : BaseType()
113  {
114  }
115 
121  : BaseType()
122  {
123  // Validate and assign defaults
124  ThisParameters = this->ValidateAndAssignParameters(ThisParameters, this->GetDefaultParameters());
125  this->AssignSettings(ThisParameters);
126  }
127 
141  const double DispRatioTolerance,
142  const double DispAbsTolerance,
143  const double RotRatioTolerance,
144  const double RotAbsTolerance,
145  const double LMRatioTolerance,
146  const double LMAbsTolerance,
147  const bool EnsureContact = false,
148  const bool PrintingOutput = false
149  )
150  : BaseType()
151  {
152  // Set local flags
153  mOptions.Set(DisplacementLagrangeMultiplierMixedContactCriteria::ENSURE_CONTACT, EnsureContact);
154  mOptions.Set(DisplacementLagrangeMultiplierMixedContactCriteria::PRINTING_OUTPUT, PrintingOutput);
155  mOptions.Set(DisplacementLagrangeMultiplierMixedContactCriteria::TABLE_IS_INITIALIZED, false);
156  mOptions.Set(DisplacementLagrangeMultiplierMixedContactCriteria::ROTATION_DOF_IS_CONSIDERED, false);
157  mOptions.Set(DisplacementLagrangeMultiplierMixedContactCriteria::INITIAL_RESIDUAL_IS_SET, false);
158 
159  // The displacement solution
160  mDispRatioTolerance = DispRatioTolerance;
161  mDispAbsTolerance = DispAbsTolerance;
162 
163  // The rotation solution
164  mRotRatioTolerance = RotRatioTolerance;
165  mRotAbsTolerance = RotAbsTolerance;
166 
167  // The normal contact solution
168  mLMRatioTolerance = LMRatioTolerance;
169  mLMAbsTolerance = LMAbsTolerance;
170  }
171 
172  //* Copy constructor.
174  :BaseType(rOther)
175  ,mOptions(rOther.mOptions)
176  ,mDispRatioTolerance(rOther.mDispRatioTolerance)
177  ,mDispAbsTolerance(rOther.mDispAbsTolerance)
178  ,mDispInitialResidualNorm(rOther.mDispInitialResidualNorm)
179  ,mDispCurrentResidualNorm(rOther.mDispCurrentResidualNorm)
180  ,mRotRatioTolerance(rOther.mRotRatioTolerance)
181  ,mRotAbsTolerance(rOther.mRotAbsTolerance)
182  ,mRotInitialResidualNorm(rOther.mRotInitialResidualNorm)
183  ,mRotCurrentResidualNorm(rOther.mRotCurrentResidualNorm)
184  ,mLMRatioTolerance(rOther.mLMRatioTolerance)
185  ,mLMAbsTolerance(rOther.mLMAbsTolerance)
186  {
187  }
188 
191 
195 
199 
204  typename BaseType::Pointer Create(Parameters ThisParameters) const override
205  {
206  return Kratos::make_shared<ClassType>(ThisParameters);
207  }
208 
219  ModelPart& rModelPart,
220  DofsArrayType& rDofSet,
221  const TSystemMatrixType& rA,
222  const TSystemVectorType& rDx,
223  const TSystemVectorType& rb
224  ) override
225  {
226  if (SparseSpaceType::Size(rb) != 0) { //if we are solving for something
227  // Initialize
228  double disp_residual_solution_norm = 0.0, rot_residual_solution_norm = 0.0, lm_solution_norm = 0.0, lm_increase_norm = 0.0;
229  IndexType disp_dof_num(0),rot_dof_num(0),lm_dof_num(0);
230 
231  // Auxiliary values
232  struct AuxValues {
233  std::size_t dof_id = 0;
234  double residual_dof_value = 0.0, dof_value = 0.0, dof_incr = 0.0;
235  };
236 
237  // The number of active dofs
238  const std::size_t number_active_dofs = rb.size();
239 
240  // Auxiliary displacement DoF check
241  const std::function<bool(const VariableData&)> check_without_rot =
242  [](const VariableData& rCurrVar) -> bool {return true;};
243  const std::function<bool(const VariableData&)> check_with_rot =
244  [](const VariableData& rCurrVar) -> bool {return ((rCurrVar == DISPLACEMENT_X) || (rCurrVar == DISPLACEMENT_Y) || (rCurrVar == DISPLACEMENT_Z));};
245  const auto* p_check_disp = (mOptions.Is(DisplacementLagrangeMultiplierMixedContactCriteria::ROTATION_DOF_IS_CONSIDERED)) ? &check_with_rot : &check_without_rot;
246 
247  // Loop over Dofs
249  std::tie(disp_residual_solution_norm, rot_residual_solution_norm, lm_solution_norm, lm_increase_norm, disp_dof_num, rot_dof_num, lm_dof_num) = block_for_each<SevenReduction>(rDofSet, AuxValues(), [this,p_check_disp,&number_active_dofs,&rb,&rDx](Dof<double>& rDof, AuxValues& aux_values) {
250  aux_values.dof_id = rDof.EquationId();
251 
252  // Check dof id is solved
253  if (aux_values.dof_id < number_active_dofs) {
254  if (mActiveDofs[aux_values.dof_id] == 1) {
255  const auto& r_curr_var = rDof.GetVariable();
256  if ((r_curr_var == VECTOR_LAGRANGE_MULTIPLIER_X) || (r_curr_var == VECTOR_LAGRANGE_MULTIPLIER_Y) || (r_curr_var == VECTOR_LAGRANGE_MULTIPLIER_Z) || (r_curr_var == LAGRANGE_MULTIPLIER_CONTACT_PRESSURE)) {
257  aux_values.dof_value = rDof.GetSolutionStepValue(0);
258  aux_values.dof_incr = rDx[aux_values.dof_id];
259  return std::make_tuple(0.0,0.0,std::pow(aux_values.dof_value, 2),std::pow(aux_values.dof_incr, 2),0,0,1);
260  } else if ((*p_check_disp)(r_curr_var)) {
261  aux_values.residual_dof_value = rb[aux_values.dof_id];
262  return std::make_tuple(std::pow(aux_values.residual_dof_value, 2),0.0,0.0,0.0,1,0,0);
263  } else { // We will assume is rotation dof
264  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;
265  aux_values.residual_dof_value = rb[aux_values.dof_id];
266  return std::make_tuple(0.0,std::pow(aux_values.residual_dof_value, 2),0.0,0.0,0,1,0);
267  }
268  }
269  }
270  return std::make_tuple(0.0,0.0,0.0,0.0,0,0,0);
271  });
272 
273  if(lm_increase_norm < Tolerance) lm_increase_norm = 1.0;
274  KRATOS_ERROR_IF(mOptions.Is(DisplacementLagrangeMultiplierMixedContactCriteria::ENSURE_CONTACT) && lm_solution_norm < Tolerance) << "ERROR::CONTACT LOST::ARE YOU SURE YOU ARE SUPPOSED TO HAVE CONTACT?" << std::endl;
275 
276  mDispCurrentResidualNorm = disp_residual_solution_norm;
277  mRotCurrentResidualNorm = rot_residual_solution_norm;
278  const double lm_ratio = lm_solution_norm > Tolerance ? std::sqrt(lm_increase_norm/lm_solution_norm) : 0.0;
279  const double lm_abs = std::sqrt(lm_increase_norm)/static_cast<double>(lm_dof_num);
280 
281  double residual_disp_ratio, residual_rot_ratio;
282 
283  // We initialize the solution
284  if (mOptions.IsNot(DisplacementLagrangeMultiplierMixedContactCriteria::INITIAL_RESIDUAL_IS_SET)) {
285  mDispInitialResidualNorm = (disp_residual_solution_norm < Tolerance) ? 1.0 : disp_residual_solution_norm;
286  residual_disp_ratio = 1.0;
287  if (mOptions.Is(DisplacementLagrangeMultiplierMixedContactCriteria::ROTATION_DOF_IS_CONSIDERED)) {
288  mRotInitialResidualNorm = (rot_residual_solution_norm < Tolerance) ? 1.0 : rot_residual_solution_norm;
289  residual_rot_ratio = 1.0;
290  }
291  mOptions.Set(DisplacementLagrangeMultiplierMixedContactCriteria::INITIAL_RESIDUAL_IS_SET, true);
292  }
293 
294  // We calculate the ratio of the displacements
295  residual_disp_ratio = mDispCurrentResidualNorm/mDispInitialResidualNorm;
296 
297  // We calculate the ratio of the rotations
298  residual_rot_ratio = mRotCurrentResidualNorm/mRotInitialResidualNorm;
299 
300  // We calculate the absolute norms
301  double residual_disp_abs = mDispCurrentResidualNorm/disp_dof_num;
302  double residual_rot_abs = mRotCurrentResidualNorm/rot_dof_num;
303 
304  // The process info of the model part
305  ProcessInfo& r_process_info = rModelPart.GetProcessInfo();
306 
307  // We print the results // TODO: Replace for the new log
308  if (rModelPart.GetCommunicator().MyPID() == 0 && this->GetEchoLevel() > 0) {
309  if (r_process_info.Has(TABLE_UTILITY)) {
310  std::cout.precision(4);
311  TablePrinterPointerType p_table = r_process_info[TABLE_UTILITY];
312  auto& r_table = p_table->GetTable();
313  if (mOptions.Is(DisplacementLagrangeMultiplierMixedContactCriteria::ROTATION_DOF_IS_CONSIDERED)) {
314  r_table << residual_disp_ratio << mDispRatioTolerance << residual_disp_abs << mDispAbsTolerance << residual_rot_ratio << mRotRatioTolerance << residual_rot_abs << mRotAbsTolerance << lm_ratio << mLMRatioTolerance << lm_abs << mLMAbsTolerance;
315  } else {
316  r_table << residual_disp_ratio << mDispRatioTolerance << residual_disp_abs << mDispAbsTolerance << lm_ratio << mLMRatioTolerance << lm_abs << mLMAbsTolerance;
317  }
318  } else {
319  std::cout.precision(4);
320  if (mOptions.IsNot(DisplacementLagrangeMultiplierMixedContactCriteria::PRINTING_OUTPUT)) {
321  KRATOS_INFO("DisplacementLagrangeMultiplierMixedContactCriteria") << BOLDFONT("MIXED CONVERGENCE CHECK") << "\tSTEP: " << r_process_info[STEP] << "\tNL ITERATION: " << r_process_info[NL_ITERATION_NUMBER] << std::endl << std::scientific;
322  KRATOS_INFO("DisplacementLagrangeMultiplierMixedContactCriteria") << BOLDFONT("\tDISPLACEMENT: RATIO = ") << residual_disp_ratio << BOLDFONT(" EXP.RATIO = ") << mDispRatioTolerance << BOLDFONT(" ABS = ") << residual_disp_abs << BOLDFONT(" EXP.ABS = ") << mDispAbsTolerance << std::endl;
323  if (mOptions.Is(DisplacementLagrangeMultiplierMixedContactCriteria::ROTATION_DOF_IS_CONSIDERED)) {
324  KRATOS_INFO("DisplacementLagrangeMultiplierMixedContactCriteria") << BOLDFONT("\tROTATION: RATIO = ") << residual_rot_ratio << BOLDFONT(" EXP.RATIO = ") << mRotRatioTolerance << BOLDFONT(" ABS = ") << residual_rot_abs << BOLDFONT(" EXP.ABS = ") << mRotAbsTolerance << std::endl;
325  }
326  KRATOS_INFO("DisplacementLagrangeMultiplierMixedContactCriteria") << BOLDFONT("\tLAGRANGE MUL: RATIO = ") << lm_ratio << BOLDFONT(" EXP.RATIO = ") << mLMRatioTolerance << BOLDFONT(" ABS = ") << lm_abs << BOLDFONT(" EXP.ABS = ") << mLMAbsTolerance << std::endl;
327  } else {
328  KRATOS_INFO("DisplacementLagrangeMultiplierMixedContactCriteria") << "MIXED CONVERGENCE CHECK" << "\tSTEP: " << r_process_info[STEP] << "\tNL ITERATION: " << r_process_info[NL_ITERATION_NUMBER] << std::endl << std::scientific;
329  KRATOS_INFO("DisplacementLagrangeMultiplierMixedContactCriteria") << "\tDISPLACEMENT: RATIO = " << residual_disp_ratio << " EXP.RATIO = " << mDispRatioTolerance << " ABS = " << residual_disp_abs << " EXP.ABS = " << mDispAbsTolerance << std::endl;
330  if (mOptions.Is(DisplacementLagrangeMultiplierMixedContactCriteria::ROTATION_DOF_IS_CONSIDERED)) {
331  KRATOS_INFO("DisplacementLagrangeMultiplierMixedContactCriteria") << "\tROTATION: RATIO = " << residual_rot_ratio << " EXP.RATIO = " << mRotRatioTolerance << " ABS = " << residual_rot_abs << " EXP.ABS = " << mRotAbsTolerance << std::endl;
332  }
333  KRATOS_INFO("DisplacementLagrangeMultiplierMixedContactCriteria") << "\tLAGRANGE MUL: RATIO = " << lm_ratio << " EXP.RATIO = " << mLMRatioTolerance << " ABS = " << lm_abs << " EXP.ABS = " << mLMAbsTolerance << std::endl;
334  }
335  }
336  }
337 
338  r_process_info[CONVERGENCE_RATIO] = (residual_disp_ratio > lm_ratio) ? residual_disp_ratio : lm_ratio;
339  r_process_info[RESIDUAL_NORM] = (lm_abs > mLMAbsTolerance) ? lm_abs : mLMAbsTolerance;
340 
341  // We check if converged
342  const bool disp_converged = (residual_disp_ratio <= mDispRatioTolerance || residual_disp_abs <= mDispAbsTolerance);
343  const bool rot_converged = (mOptions.Is(DisplacementLagrangeMultiplierMixedContactCriteria::ROTATION_DOF_IS_CONSIDERED)) ? (residual_rot_ratio <= mRotRatioTolerance || residual_rot_abs <= mRotAbsTolerance) : true;
344  const bool lm_converged = (mOptions.IsNot(DisplacementLagrangeMultiplierMixedContactCriteria::ENSURE_CONTACT) && lm_solution_norm < Tolerance) ? true : (lm_ratio <= mLMRatioTolerance || lm_abs <= mLMAbsTolerance);
345 
346  if ( disp_converged && rot_converged && lm_converged ) {
347  if (rModelPart.GetCommunicator().MyPID() == 0 && this->GetEchoLevel() > 0) {
348  if (r_process_info.Has(TABLE_UTILITY)) {
349  TablePrinterPointerType p_table = r_process_info[TABLE_UTILITY];
350  auto& r_table = p_table->GetTable();
351  if (mOptions.IsNot(DisplacementLagrangeMultiplierMixedContactCriteria::PRINTING_OUTPUT))
352  r_table << BOLDFONT(FGRN(" Achieved"));
353  else
354  r_table << "Achieved";
355  } else {
356  if (mOptions.IsNot(DisplacementLagrangeMultiplierMixedContactCriteria::PRINTING_OUTPUT))
357  KRATOS_INFO("DisplacementLagrangeMultiplierMixedContactCriteria") << BOLDFONT("\tConvergence") << " is " << BOLDFONT(FGRN("achieved")) << std::endl;
358  else
359  KRATOS_INFO("DisplacementLagrangeMultiplierMixedContactCriteria") << "\tConvergence is achieved" << std::endl;
360  }
361  }
362  return true;
363  } else {
364  if (rModelPart.GetCommunicator().MyPID() == 0 && this->GetEchoLevel() > 0) {
365  if (r_process_info.Has(TABLE_UTILITY)) {
366  TablePrinterPointerType p_table = r_process_info[TABLE_UTILITY];
367  auto& r_table = p_table->GetTable();
368  if (mOptions.IsNot(DisplacementLagrangeMultiplierMixedContactCriteria::PRINTING_OUTPUT))
369  r_table << BOLDFONT(FRED(" Not achieved"));
370  else
371  r_table << "Not achieved";
372  } else {
373  if (mOptions.IsNot(DisplacementLagrangeMultiplierMixedContactCriteria::PRINTING_OUTPUT))
374  KRATOS_INFO("DisplacementLagrangeMultiplierMixedContactCriteria") << BOLDFONT("\tConvergence") << " is " << BOLDFONT(FRED(" not achieved")) << std::endl;
375  else
376  KRATOS_INFO("DisplacementLagrangeMultiplierMixedContactCriteria") << "\tConvergence is not achieved" << std::endl;
377  }
378  }
379  return false;
380  }
381  } else // In this case all the displacements are imposed!
382  return true;
383  }
384 
389  void Initialize( ModelPart& rModelPart) override
390  {
391  // Initialize
392  BaseType::mConvergenceCriteriaIsInitialized = true;
393 
394  // Check rotation dof
395  mOptions.Set(DisplacementLagrangeMultiplierMixedContactCriteria::ROTATION_DOF_IS_CONSIDERED, ContactUtilities::CheckModelPartHasRotationDoF(rModelPart));
396 
397  // Initialize header
398  ProcessInfo& r_process_info = rModelPart.GetProcessInfo();
399  if (r_process_info.Has(TABLE_UTILITY) && mOptions.IsNot(DisplacementLagrangeMultiplierMixedContactCriteria::TABLE_IS_INITIALIZED)) {
400  TablePrinterPointerType p_table = r_process_info[TABLE_UTILITY];
401  auto& r_table = p_table->GetTable();
402  r_table.AddColumn("DP RATIO", 10);
403  r_table.AddColumn("EXP. RAT", 10);
404  r_table.AddColumn("ABS", 10);
405  r_table.AddColumn("EXP. ABS", 10);
406  if (mOptions.Is(DisplacementLagrangeMultiplierMixedContactCriteria::ROTATION_DOF_IS_CONSIDERED)) {
407  r_table.AddColumn("RT RATIO", 10);
408  r_table.AddColumn("EXP. RAT", 10);
409  r_table.AddColumn("ABS", 10);
410  r_table.AddColumn("EXP. ABS", 10);
411  }
412  r_table.AddColumn("LM RATIO", 10);
413  r_table.AddColumn("EXP. RAT", 10);
414  r_table.AddColumn("ABS", 10);
415  r_table.AddColumn("EXP. ABS", 10);
416  r_table.AddColumn("CONVERGENCE", 15);
417  mOptions.Set(DisplacementLagrangeMultiplierMixedContactCriteria::TABLE_IS_INITIALIZED, true);
418  }
419  }
420 
430  ModelPart& rModelPart,
431  DofsArrayType& rDofSet,
432  const TSystemMatrixType& rA,
433  const TSystemVectorType& rDx,
434  const TSystemVectorType& rb
435  ) override
436  {
437  // Initialize flag
438  mOptions.Set(DisplacementLagrangeMultiplierMixedContactCriteria::INITIAL_RESIDUAL_IS_SET, false);
439 
440  // Filling mActiveDofs when MPC exist
441  ConstraintUtilities::ComputeActiveDofs(rModelPart, mActiveDofs, rDofSet);
442  }
443 
449  {
450  Parameters default_parameters = Parameters(R"(
451  {
452  "name" : "displacement_lagrange_multiplier_mixed_contact_criteria",
453  "ensure_contact" : false,
454  "print_convergence_criterion" : false,
455  "residual_relative_tolerance" : 1.0e-4,
456  "residual_absolute_tolerance" : 1.0e-9,
457  "rotation_residual_relative_tolerance" : 1.0e-4,
458  "rotation_residual_absolute_tolerance" : 1.0e-9,
459  "contact_displacement_relative_tolerance" : 1.0e-4,
460  "contact_displacement_absolute_tolerance" : 1.0e-9
461  })");
462 
463  // Getting base class default parameters
464  const Parameters base_default_parameters = BaseType::GetDefaultParameters();
465  default_parameters.RecursivelyAddMissingParameters(base_default_parameters);
466  return default_parameters;
467  }
468 
473  static std::string Name()
474  {
475  return "displacement_lagrange_multiplier_mixed_contact_criteria";
476  }
477 
481 
485 
489 
491  std::string Info() const override
492  {
493  return "DisplacementLagrangeMultiplierMixedContactCriteria";
494  }
495 
497  void PrintInfo(std::ostream& rOStream) const override
498  {
499  rOStream << Info();
500  }
501 
503  void PrintData(std::ostream& rOStream) const override
504  {
505  rOStream << Info();
506  }
507 
509 protected:
512 
516 
520 
525  void AssignSettings(const Parameters ThisParameters) override
526  {
527  BaseType::AssignSettings(ThisParameters);
528 
529  // The displacement solution
530  mDispRatioTolerance = ThisParameters["residual_relative_tolerance"].GetDouble();
531  mDispAbsTolerance = ThisParameters["residual_absolute_tolerance"].GetDouble();
532 
533  // The rotation solution
534  mRotRatioTolerance = ThisParameters["rotation_residual_relative_tolerance"].GetDouble();
535  mRotAbsTolerance = ThisParameters["rotation_residual_absolute_tolerance"].GetDouble();
536 
537  // The contact solution
538  mLMRatioTolerance = ThisParameters["contact_displacement_relative_tolerance"].GetDouble();
539  mLMAbsTolerance = ThisParameters["contact_displacement_absolute_tolerance"].GetDouble();
540 
541  // Set local flags
542  mOptions.Set(DisplacementLagrangeMultiplierMixedContactCriteria::ENSURE_CONTACT, ThisParameters["ensure_contact"].GetBool());
543  mOptions.Set(DisplacementLagrangeMultiplierMixedContactCriteria::PRINTING_OUTPUT, ThisParameters["print_convergence_criterion"].GetBool());
544  mOptions.Set(DisplacementLagrangeMultiplierMixedContactCriteria::TABLE_IS_INITIALIZED, false);
545  mOptions.Set(DisplacementLagrangeMultiplierMixedContactCriteria::ROTATION_DOF_IS_CONSIDERED, false);
546  mOptions.Set(DisplacementLagrangeMultiplierMixedContactCriteria::INITIAL_RESIDUAL_IS_SET, false);
547  }
548 
550 private:
553 
557 
558  Flags mOptions;
559 
560  double mDispRatioTolerance;
561  double mDispAbsTolerance;
562  double mDispInitialResidualNorm;
563  double mDispCurrentResidualNorm;
564 
565  double mRotRatioTolerance;
566  double mRotAbsTolerance;
567  double mRotInitialResidualNorm;
568  double mRotCurrentResidualNorm;
569 
570  double mLMRatioTolerance;
571  double mLMAbsTolerance;
572 
573  std::vector<int> mActiveDofs;
574 
576 }; // Kratos DisplacementLagrangeMultiplierMixedContactCriteria
577 
580 
582 template<class TSparseSpace, class TDenseSpace>
583 const Kratos::Flags DisplacementLagrangeMultiplierMixedContactCriteria<TSparseSpace, TDenseSpace>::ENSURE_CONTACT(Kratos::Flags::Create(0));
584 template<class TSparseSpace, class TDenseSpace>
585 const Kratos::Flags DisplacementLagrangeMultiplierMixedContactCriteria<TSparseSpace, TDenseSpace>::PRINTING_OUTPUT(Kratos::Flags::Create(1));
586 template<class TSparseSpace, class TDenseSpace>
587 const Kratos::Flags DisplacementLagrangeMultiplierMixedContactCriteria<TSparseSpace, TDenseSpace>::TABLE_IS_INITIALIZED(Kratos::Flags::Create(2));
588 template<class TSparseSpace, class TDenseSpace>
589 const Kratos::Flags DisplacementLagrangeMultiplierMixedContactCriteria<TSparseSpace, TDenseSpace>::ROTATION_DOF_IS_CONSIDERED(Kratos::Flags::Create(3));
590 template<class TSparseSpace, class TDenseSpace>
591 const Kratos::Flags DisplacementLagrangeMultiplierMixedContactCriteria<TSparseSpace, TDenseSpace>::INITIAL_RESIDUAL_IS_SET(Kratos::Flags::Create(4));
592 }
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
Convergence criteria for contact problems.
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:61
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
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
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_mixed_contact_criteria.h:429
typename BaseType::TSystemMatrixType TSystemMatrixType
The sparse matrix type.
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:87
KRATOS_CLASS_POINTER_DEFINITION(DisplacementLagrangeMultiplierMixedContactCriteria)
Pointer definition of DisplacementLagrangeMultiplierMixedContactCriteria.
static constexpr double Tolerance
The epsilon tolerance definition.
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:102
BaseType::Pointer Create(Parameters ThisParameters) const override
Create method.
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:204
void Initialize(ModelPart &rModelPart) override
This function initialize the convergence criteria.
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:389
DisplacementLagrangeMultiplierMixedContactCriteria()
Default constructor.
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:111
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:503
TSparseSpace SparseSpaceType
The sparse space used.
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:93
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:448
typename BaseType::TSystemVectorType TSystemVectorType
The dense vector type.
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:90
TableStreamUtility::Pointer TablePrinterPointerType
The table stream definition TODO: Replace by logger.
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:96
static std::string Name()
Returns the name of the class as used in the settings (snake_case format)
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:473
DisplacementLagrangeMultiplierMixedContactCriteria(Kratos::Parameters ThisParameters)
Default constructor. (with parameters)
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:120
~DisplacementLagrangeMultiplierMixedContactCriteria() override=default
Destructor.
DisplacementLagrangeMultiplierMixedContactCriteria(const double DispRatioTolerance, const double DispAbsTolerance, const double RotRatioTolerance, const double RotAbsTolerance, const double LMRatioTolerance, const double LMAbsTolerance, const bool EnsureContact=false, const bool PrintingOutput=false)
Default constructor.
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:140
std::string Info() const override
Turn back information as a string.
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:491
std::size_t IndexType
The index type definition.
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:99
DisplacementLagrangeMultiplierMixedContactCriteria(DisplacementLagrangeMultiplierMixedContactCriteria const &rOther)
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:173
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:497
bool PostCriteria(ModelPart &rModelPart, DofsArrayType &rDofSet, const TSystemMatrixType &rA, const TSystemVectorType &rDx, const TSystemVectorType &rb) override
Compute relative and absolute error.
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:218
typename BaseType::DofsArrayType DofsArrayType
The dofs array type.
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:84
void AssignSettings(const Parameters ThisParameters) override
This method assigns settings to member variables.
Definition: displacement_lagrangemultiplier_mixed_contact_criteria.h:525
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_INFO(label)
Definition: logger.h:250
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