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_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 
104 
109  : BaseType()
110  {
111  }
112 
118  : BaseType()
119  {
120  // Validate and assign defaults
121  ThisParameters = this->ValidateAndAssignParameters(ThisParameters, this->GetDefaultParameters());
122  this->AssignSettings(ThisParameters);
123  }
124 
138  const double DispRatioTolerance,
139  const double DispAbsTolerance,
140  const double RotRatioTolerance,
141  const double RotAbsTolerance,
142  const double LMRatioTolerance,
143  const double LMAbsTolerance,
144  const bool EnsureContact = false,
145  const bool PrintingOutput = false
146  )
147  : BaseType()
148  {
149  // Set local flags
150  mOptions.Set(DisplacementLagrangeMultiplierResidualContactCriteria::ENSURE_CONTACT, EnsureContact);
151  mOptions.Set(DisplacementLagrangeMultiplierResidualContactCriteria::PRINTING_OUTPUT, PrintingOutput);
152  mOptions.Set(DisplacementLagrangeMultiplierResidualContactCriteria::TABLE_IS_INITIALIZED, false);
153  mOptions.Set(DisplacementLagrangeMultiplierResidualContactCriteria::ROTATION_DOF_IS_CONSIDERED, false);
154  mOptions.Set(DisplacementLagrangeMultiplierResidualContactCriteria::INITIAL_RESIDUAL_IS_SET, false);
155 
156  // The displacement residual
157  mDispRatioTolerance = DispRatioTolerance;
158  mDispAbsTolerance = DispAbsTolerance;
159 
160  // The rotation residual
161  mRotRatioTolerance = RotRatioTolerance;
162  mRotAbsTolerance = RotAbsTolerance;
163 
164  // The normal contact residual
165  mLMRatioTolerance = LMRatioTolerance;
166  mLMAbsTolerance = LMAbsTolerance;
167  }
168 
169  //* Copy constructor.
171  :BaseType(rOther)
172  ,mOptions(rOther.mOptions)
173  ,mDispRatioTolerance(rOther.mDispRatioTolerance)
174  ,mDispAbsTolerance(rOther.mDispAbsTolerance)
175  ,mDispInitialResidualNorm(rOther.mDispInitialResidualNorm)
176  ,mDispCurrentResidualNorm(rOther.mDispCurrentResidualNorm)
177  ,mRotRatioTolerance(rOther.mRotRatioTolerance)
178  ,mRotAbsTolerance(rOther.mRotAbsTolerance)
179  ,mRotInitialResidualNorm(rOther.mRotInitialResidualNorm)
180  ,mRotCurrentResidualNorm(rOther.mRotCurrentResidualNorm)
181  ,mLMRatioTolerance(rOther.mLMRatioTolerance)
182  ,mLMAbsTolerance(rOther.mLMAbsTolerance)
183  ,mLMInitialResidualNorm(rOther.mLMInitialResidualNorm)
184  ,mLMCurrentResidualNorm(rOther.mLMCurrentResidualNorm)
185  {
186  }
187 
190 
194 
198 
203  typename BaseType::Pointer Create(Parameters ThisParameters) const override
204  {
205  return Kratos::make_shared<ClassType>(ThisParameters);
206  }
207 
218  ModelPart& rModelPart,
219  DofsArrayType& rDofSet,
220  const TSystemMatrixType& rA,
221  const TSystemVectorType& rDx,
222  const TSystemVectorType& rb
223  ) override
224  {
225  if (SparseSpaceType::Size(rb) != 0) { //if we are solving for something
226  // Initialize
227  double disp_residual_solution_norm = 0.0, rot_residual_solution_norm = 0.0, lm_residual_solution_norm = 0.0;
228  IndexType disp_dof_num(0), rot_dof_num(0), lm_dof_num(0);
229 
230  // Auxiliary values
231  struct AuxValues {
232  std::size_t dof_id = 0;
233  double residual_dof_value = 0.0;
234  };
235 
236  // The number of active dofs
237  const std::size_t number_active_dofs = rb.size();
238 
239  // Auxiliary displacement DoF check
240  const std::function<bool(const VariableData&)> check_without_rot =
241  [](const VariableData& rCurrVar) -> bool {return true;};
242  const std::function<bool(const VariableData&)> check_with_rot =
243  [](const VariableData& rCurrVar) -> bool {return ((rCurrVar == DISPLACEMENT_X) || (rCurrVar == DISPLACEMENT_Y) || (rCurrVar == DISPLACEMENT_Z));};
244  const auto* p_check_disp = (mOptions.Is(DisplacementLagrangeMultiplierResidualContactCriteria::ROTATION_DOF_IS_CONSIDERED)) ? &check_with_rot : &check_without_rot;
245 
246  // Loop over Dofs
248  std::tie(disp_residual_solution_norm,rot_residual_solution_norm,lm_residual_solution_norm,disp_dof_num,rot_dof_num,lm_dof_num) = block_for_each<SixReduction>(rDofSet, AuxValues(), [this,p_check_disp,&number_active_dofs,&rb](Dof<double>& rDof, AuxValues& aux_values) {
249  aux_values.dof_id = rDof.EquationId();
250 
251  // Check dof id is solved
252  if (aux_values.dof_id < number_active_dofs) {
253  if (mActiveDofs[aux_values.dof_id] == 1) {
254  aux_values.residual_dof_value = rb[aux_values.dof_id];
255 
256  const auto& r_curr_var = rDof.GetVariable();
257  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)) {
258  return std::make_tuple(0.0,0.0,std::pow(aux_values.residual_dof_value, 2),0,0,1);
259  } else if ((*p_check_disp)(r_curr_var)) {
260  return std::make_tuple(std::pow(aux_values.residual_dof_value, 2),0.0,0.0,1,0,0);
261  } else { // We will assume is rotation dof
262  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;
263  return std::make_tuple(0.0,std::pow(aux_values.residual_dof_value, 2),0.0,0,1,0);
264  }
265  }
266  }
267  return std::make_tuple(0.0,0.0,0.0,0,0,0);
268  });
269 
270  mDispCurrentResidualNorm = disp_residual_solution_norm;
271  mRotCurrentResidualNorm = rot_residual_solution_norm;
272  mLMCurrentResidualNorm = lm_residual_solution_norm;
273 
274  double residual_disp_ratio = 1.0;
275  double residual_rot_ratio = 1.0;
276  double residual_lm_ratio = 1.0;
277 
278  // We initialize the solution
279  if (mOptions.IsNot(DisplacementLagrangeMultiplierResidualContactCriteria::INITIAL_RESIDUAL_IS_SET)) {
280  mDispInitialResidualNorm = (disp_residual_solution_norm == 0.0) ? 1.0 : disp_residual_solution_norm;
281  mLMInitialResidualNorm = (lm_residual_solution_norm == 0.0) ? 1.0 : lm_residual_solution_norm;
282  residual_disp_ratio = 1.0;
283  residual_lm_ratio = 1.0;
284  if (mOptions.Is(DisplacementLagrangeMultiplierResidualContactCriteria::ROTATION_DOF_IS_CONSIDERED)) {
285  mRotInitialResidualNorm = (rot_residual_solution_norm == 0.0) ? 1.0 : rot_residual_solution_norm;
286  residual_rot_ratio = 1.0;
287  }
288  mOptions.Set(DisplacementLagrangeMultiplierResidualContactCriteria::INITIAL_RESIDUAL_IS_SET, true);
289  }
290 
291  // We calculate the ratio of the displacements
292  residual_disp_ratio = mDispCurrentResidualNorm/mDispInitialResidualNorm;
293 
294  // We calculate the ratio of the rotations
295  residual_rot_ratio = mRotCurrentResidualNorm/mRotInitialResidualNorm;
296 
297  // We calculate the ratio of the LM
298  residual_lm_ratio = mLMCurrentResidualNorm/mLMInitialResidualNorm;
299 
300  KRATOS_ERROR_IF(mOptions.Is(DisplacementLagrangeMultiplierResidualContactCriteria::ENSURE_CONTACT) && residual_lm_ratio == 0.0) << "ERROR::CONTACT LOST::ARE YOU SURE YOU ARE SUPPOSED TO HAVE CONTACT?" << std::endl;
301 
302  // We calculate the absolute norms
303  const double residual_disp_abs = mDispCurrentResidualNorm/disp_dof_num;
304  const double residual_rot_abs = mRotCurrentResidualNorm/rot_dof_num;
305  const double residual_lm_abs = mLMCurrentResidualNorm/lm_dof_num;
306 
307  // The process info of the model part
308  ProcessInfo& r_process_info = rModelPart.GetProcessInfo();
309 
310  // We print the results // TODO: Replace for the new log
311  if (rModelPart.GetCommunicator().MyPID() == 0 && this->GetEchoLevel() > 0) {
312  if (r_process_info.Has(TABLE_UTILITY)) {
313  std::cout.precision(4);
314  TablePrinterPointerType p_table = r_process_info[TABLE_UTILITY];
315  auto& Table = p_table->GetTable();
316  if (mOptions.Is(DisplacementLagrangeMultiplierResidualContactCriteria::ROTATION_DOF_IS_CONSIDERED)) {
317  Table << residual_disp_ratio << mDispRatioTolerance << residual_disp_abs << mDispAbsTolerance << residual_rot_ratio << mRotRatioTolerance << residual_rot_abs << mRotAbsTolerance << residual_lm_ratio << mLMRatioTolerance << residual_lm_abs << mLMAbsTolerance;
318  } else {
319  Table << residual_disp_ratio << mDispRatioTolerance << residual_disp_abs << mDispAbsTolerance << residual_lm_ratio << mLMRatioTolerance << residual_lm_abs << mLMAbsTolerance;
320  }
321  } else {
322  std::cout.precision(4);
323  if (mOptions.IsNot(DisplacementLagrangeMultiplierResidualContactCriteria::PRINTING_OUTPUT)) {
324  KRATOS_INFO("DisplacementLagrangeMultiplierResidualContactCriteria") << BOLDFONT("RESIDUAL CONVERGENCE CHECK") << "\tSTEP: " << r_process_info[STEP] << "\tNL ITERATION: " << r_process_info[NL_ITERATION_NUMBER] << std::endl << std::scientific;
325  KRATOS_INFO("DisplacementLagrangeMultiplierResidualContactCriteria") << BOLDFONT("\tDISPLACEMENT: RATIO = ") << residual_disp_ratio << BOLDFONT(" EXP.RATIO = ") << mDispRatioTolerance << BOLDFONT(" ABS = ") << residual_disp_abs << BOLDFONT(" EXP.ABS = ") << mDispAbsTolerance << std::endl;
326  if (mOptions.Is(DisplacementLagrangeMultiplierResidualContactCriteria::ROTATION_DOF_IS_CONSIDERED)) {
327  KRATOS_INFO("DisplacementLagrangeMultiplierResidualContactCriteria") << BOLDFONT("\tROTATION: RATIO = ") << residual_rot_ratio << BOLDFONT(" EXP.RATIO = ") << mRotRatioTolerance << BOLDFONT(" ABS = ") << residual_rot_abs << BOLDFONT(" EXP.ABS = ") << mRotAbsTolerance << std::endl;
328  }
329  KRATOS_INFO("DisplacementLagrangeMultiplierResidualContactCriteria") << BOLDFONT("\tLAGRANGE MUL: RATIO = ") << residual_lm_ratio << BOLDFONT(" EXP.RATIO = ") << mLMRatioTolerance << BOLDFONT(" ABS = ") << residual_lm_abs << BOLDFONT(" EXP.ABS = ") << mLMAbsTolerance << std::endl;
330  } else {
331  KRATOS_INFO("DisplacementLagrangeMultiplierResidualContactCriteria") << "RESIDUAL CONVERGENCE CHECK" << "\tSTEP: " << r_process_info[STEP] << "\tNL ITERATION: " << r_process_info[NL_ITERATION_NUMBER] << std::endl << std::scientific;
332  KRATOS_INFO("DisplacementLagrangeMultiplierResidualContactCriteria") << "\tDISPLACEMENT: RATIO = " << residual_disp_ratio << " EXP.RATIO = " << mDispRatioTolerance << " ABS = " << residual_disp_abs << " EXP.ABS = " << mDispAbsTolerance << std::endl;
333  if (mOptions.Is(DisplacementLagrangeMultiplierResidualContactCriteria::ROTATION_DOF_IS_CONSIDERED)) {
334  KRATOS_INFO("DisplacementLagrangeMultiplierResidualContactCriteria") << "\tROTATION: RATIO = " << residual_rot_ratio << " EXP.RATIO = " << mRotRatioTolerance << " ABS = " << residual_rot_abs << " EXP.ABS = " << mRotAbsTolerance << std::endl;
335  }
336  KRATOS_INFO("DisplacementLagrangeMultiplierResidualContactCriteria") << "\tLAGRANGE MUL: RATIO = " << residual_lm_ratio << " EXP.RATIO = " << mLMRatioTolerance << " ABS = " << residual_lm_abs << " EXP.ABS = " << mLMAbsTolerance << std::endl;
337  }
338  }
339  }
340 
341  r_process_info[CONVERGENCE_RATIO] = (residual_disp_ratio > residual_lm_ratio) ? residual_disp_ratio : residual_lm_ratio;
342  r_process_info[RESIDUAL_NORM] = (residual_lm_abs > mLMAbsTolerance) ? residual_lm_abs : mLMAbsTolerance;
343 
344  // We check if converged
345  const bool disp_converged = (residual_disp_ratio <= mDispRatioTolerance || residual_disp_abs <= mDispAbsTolerance);
346  const bool rot_converged = (mOptions.Is(DisplacementLagrangeMultiplierResidualContactCriteria::ROTATION_DOF_IS_CONSIDERED)) ? (residual_rot_ratio <= mRotRatioTolerance || residual_rot_abs <= mRotAbsTolerance) : true;
347  const bool lm_converged = (mOptions.IsNot(DisplacementLagrangeMultiplierResidualContactCriteria::ENSURE_CONTACT) && residual_lm_ratio == 0.0) ? true : (residual_lm_ratio <= mLMRatioTolerance || residual_lm_abs <= mLMAbsTolerance);
348 
349  if (disp_converged && rot_converged && lm_converged ) {
350  if (rModelPart.GetCommunicator().MyPID() == 0 && this->GetEchoLevel() > 0) {
351  if (r_process_info.Has(TABLE_UTILITY)) {
352  TablePrinterPointerType p_table = r_process_info[TABLE_UTILITY];
353  auto& Table = p_table->GetTable();
354  if (mOptions.IsNot(DisplacementLagrangeMultiplierResidualContactCriteria::PRINTING_OUTPUT))
355  Table << BOLDFONT(FGRN(" Achieved"));
356  else
357  Table << "Achieved";
358  } else {
359  if (mOptions.IsNot(DisplacementLagrangeMultiplierResidualContactCriteria::PRINTING_OUTPUT))
360  KRATOS_INFO("DisplacementLagrangeMultiplierResidualContactCriteria") << BOLDFONT("\tResidual") << " convergence is " << BOLDFONT(FGRN("achieved")) << std::endl;
361  else
362  KRATOS_INFO("DisplacementLagrangeMultiplierResidualContactCriteria") << "\tResidual convergence is achieved" << std::endl;
363  }
364  }
365  return true;
366  } else {
367  if (rModelPart.GetCommunicator().MyPID() == 0 && this->GetEchoLevel() > 0) {
368  if (r_process_info.Has(TABLE_UTILITY)) {
369  TablePrinterPointerType p_table = r_process_info[TABLE_UTILITY];
370  auto& r_table = p_table->GetTable();
371  if (mOptions.IsNot(DisplacementLagrangeMultiplierResidualContactCriteria::PRINTING_OUTPUT))
372  r_table << BOLDFONT(FRED(" Not achieved"));
373  else
374  r_table << "Not achieved";
375  } else {
376  if (mOptions.IsNot(DisplacementLagrangeMultiplierResidualContactCriteria::PRINTING_OUTPUT))
377  KRATOS_INFO("DisplacementLagrangeMultiplierResidualContactCriteria") << BOLDFONT("\tResidual") << " convergence is " << BOLDFONT(FRED(" not achieved")) << std::endl;
378  else
379  KRATOS_INFO("DisplacementLagrangeMultiplierResidualContactCriteria") << "\tResidual convergence is not achieved" << std::endl;
380  }
381  }
382  return false;
383  }
384  } else // In this case all the displacements are imposed!
385  return true;
386  }
387 
392  void Initialize( ModelPart& rModelPart) override
393  {
394  // Initialize
395  BaseType::mConvergenceCriteriaIsInitialized = true;
396 
397  // Check rotation dof
398  mOptions.Set(DisplacementLagrangeMultiplierResidualContactCriteria::ROTATION_DOF_IS_CONSIDERED, ContactUtilities::CheckModelPartHasRotationDoF(rModelPart));
399 
400  // Initialize header
401  ProcessInfo& r_process_info = rModelPart.GetProcessInfo();
402  if (r_process_info.Has(TABLE_UTILITY) && mOptions.IsNot(DisplacementLagrangeMultiplierResidualContactCriteria::TABLE_IS_INITIALIZED)) {
403  TablePrinterPointerType p_table = r_process_info[TABLE_UTILITY];
404  auto& r_table = p_table->GetTable();
405  r_table.AddColumn("DP RATIO", 10);
406  r_table.AddColumn("EXP. RAT", 10);
407  r_table.AddColumn("ABS", 10);
408  r_table.AddColumn("EXP. ABS", 10);
409  if (mOptions.Is(DisplacementLagrangeMultiplierResidualContactCriteria::ROTATION_DOF_IS_CONSIDERED)) {
410  r_table.AddColumn("RT RATIO", 10);
411  r_table.AddColumn("EXP. RAT", 10);
412  r_table.AddColumn("ABS", 10);
413  r_table.AddColumn("EXP. ABS", 10);
414  }
415  r_table.AddColumn("LM RATIO", 10);
416  r_table.AddColumn("EXP. RAT", 10);
417  r_table.AddColumn("ABS", 10);
418  r_table.AddColumn("EXP. ABS", 10);
419  r_table.AddColumn("CONVERGENCE", 15);
420  mOptions.Set(DisplacementLagrangeMultiplierResidualContactCriteria::TABLE_IS_INITIALIZED, true);
421  }
422  }
423 
433  ModelPart& rModelPart,
434  DofsArrayType& rDofSet,
435  const TSystemMatrixType& rA,
436  const TSystemVectorType& rDx,
437  const TSystemVectorType& rb
438  ) override
439  {
440  // Initialize flag
441  mOptions.Set(DisplacementLagrangeMultiplierResidualContactCriteria::INITIAL_RESIDUAL_IS_SET, false);
442 
443  // Filling mActiveDofs when MPC exist
444  ConstraintUtilities::ComputeActiveDofs(rModelPart, mActiveDofs, rDofSet);
445  }
446 
452  {
453  Parameters default_parameters = Parameters(R"(
454  {
455  "name" : "displacement_lagrangemultiplier_residual_contact_criteria",
456  "ensure_contact" : false,
457  "print_convergence_criterion" : false,
458  "residual_relative_tolerance" : 1.0e-4,
459  "residual_absolute_tolerance" : 1.0e-9,
460  "rotation_residual_relative_tolerance" : 1.0e-4,
461  "rotation_residual_absolute_tolerance" : 1.0e-9,
462  "contact_residual_relative_tolerance" : 1.0e-4,
463  "contact_residual_absolute_tolerance" : 1.0e-9
464  })");
465 
466  // Getting base class default parameters
467  const Parameters base_default_parameters = BaseType::GetDefaultParameters();
468  default_parameters.RecursivelyAddMissingParameters(base_default_parameters);
469  return default_parameters;
470  }
471 
476  static std::string Name()
477  {
478  return "displacement_lagrangemultiplier_residual_contact_criteria";
479  }
480 
484 
488 
492 
494  std::string Info() const override
495  {
496  return "DisplacementLagrangeMultiplierResidualContactCriteria";
497  }
498 
500  void PrintInfo(std::ostream& rOStream) const override
501  {
502  rOStream << Info();
503  }
504 
506  void PrintData(std::ostream& rOStream) const override
507  {
508  rOStream << Info();
509  }
510 
512 protected:
515 
519 
523 
527 
532  void AssignSettings(const Parameters ThisParameters) override
533  {
534  BaseType::AssignSettings(ThisParameters);
535 
536  // The displacement residual
537  mDispRatioTolerance = ThisParameters["residual_relative_tolerance"].GetDouble();
538  mDispAbsTolerance = ThisParameters["residual_absolute_tolerance"].GetDouble();
539 
540  // The rotation residual
541  mRotRatioTolerance = ThisParameters["rotation_residual_relative_tolerance"].GetDouble();
542  mRotAbsTolerance = ThisParameters["rotation_residual_absolute_tolerance"].GetDouble();
543 
544  // The contact residual
545  mLMRatioTolerance = ThisParameters["contact_displacement_absolute_tolerance"].GetDouble();
546  mLMAbsTolerance = ThisParameters["contact_residual_absolute_tolerance"].GetDouble();
547 
548  // Set local flags
549  mOptions.Set(DisplacementLagrangeMultiplierResidualContactCriteria::ENSURE_CONTACT, ThisParameters["ensure_contact"].GetBool());
550  mOptions.Set(DisplacementLagrangeMultiplierResidualContactCriteria::PRINTING_OUTPUT, ThisParameters["print_convergence_criterion"].GetBool());
551  mOptions.Set(DisplacementLagrangeMultiplierResidualContactCriteria::TABLE_IS_INITIALIZED, false);
552  mOptions.Set(DisplacementLagrangeMultiplierResidualContactCriteria::ROTATION_DOF_IS_CONSIDERED, false);
553  mOptions.Set(DisplacementLagrangeMultiplierResidualContactCriteria::INITIAL_RESIDUAL_IS_SET, false);
554  }
555 
557 private:
560 
564 
565  Flags mOptions;
566 
567  double mDispRatioTolerance;
568  double mDispAbsTolerance;
569  double mDispInitialResidualNorm;
570  double mDispCurrentResidualNorm;
571 
572  double mRotRatioTolerance;
573  double mRotAbsTolerance;
574  double mRotInitialResidualNorm;
575  double mRotCurrentResidualNorm;
576 
577  double mLMRatioTolerance;
578  double mLMAbsTolerance;
579  double mLMInitialResidualNorm;
580  double mLMCurrentResidualNorm;
581 
582  std::vector<int> mActiveDofs;
583 
585 }; // Kratos DisplacementLagrangeMultiplierResidualContactCriteria
586 
589 
591 template<class TSparseSpace, class TDenseSpace>
592 const Kratos::Flags DisplacementLagrangeMultiplierResidualContactCriteria<TSparseSpace, TDenseSpace>::ENSURE_CONTACT(Kratos::Flags::Create(0));
593 template<class TSparseSpace, class TDenseSpace>
594 const Kratos::Flags DisplacementLagrangeMultiplierResidualContactCriteria<TSparseSpace, TDenseSpace>::PRINTING_OUTPUT(Kratos::Flags::Create(1));
595 template<class TSparseSpace, class TDenseSpace>
596 const Kratos::Flags DisplacementLagrangeMultiplierResidualContactCriteria<TSparseSpace, TDenseSpace>::TABLE_IS_INITIALIZED(Kratos::Flags::Create(2));
597 template<class TSparseSpace, class TDenseSpace>
598 const Kratos::Flags DisplacementLagrangeMultiplierResidualContactCriteria<TSparseSpace, TDenseSpace>::ROTATION_DOF_IS_CONSIDERED(Kratos::Flags::Create(3));
599 template<class TSparseSpace, class TDenseSpace>
600 const Kratos::Flags DisplacementLagrangeMultiplierResidualContactCriteria<TSparseSpace, TDenseSpace>::INITIAL_RESIDUAL_IS_SET(Kratos::Flags::Create(4));
601 }
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 This class implements a convergence control based on nodal ...
Definition: displacement_lagrangemultiplier_residual_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
This class represents the value of its variable depending to other variable.
Definition: piecewize_linear_table.h:63
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
BaseType::Pointer Create(Parameters ThisParameters) const override
Create method.
Definition: displacement_lagrangemultiplier_residual_contact_criteria.h:203
typename BaseType::TSystemMatrixType TSystemMatrixType
The sparse matrix type.
Definition: displacement_lagrangemultiplier_residual_contact_criteria.h:87
KRATOS_CLASS_POINTER_DEFINITION(DisplacementLagrangeMultiplierResidualContactCriteria)
Pointer definition of DisplacementLagrangeMultiplierResidualContactCriteria.
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: displacement_lagrangemultiplier_residual_contact_criteria.h:451
std::size_t IndexType
The index type definition.
Definition: displacement_lagrangemultiplier_residual_contact_criteria.h:99
~DisplacementLagrangeMultiplierResidualContactCriteria() override=default
Destructor.
DisplacementLagrangeMultiplierResidualContactCriteria()
Default constructor.
Definition: displacement_lagrangemultiplier_residual_contact_criteria.h:108
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: displacement_lagrangemultiplier_residual_contact_criteria.h:500
DisplacementLagrangeMultiplierResidualContactCriteria(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 (parameters)
Definition: displacement_lagrangemultiplier_residual_contact_criteria.h:137
void AssignSettings(const Parameters ThisParameters) override
This method assigns settings to member variables.
Definition: displacement_lagrangemultiplier_residual_contact_criteria.h:532
DisplacementLagrangeMultiplierResidualContactCriteria(Kratos::Parameters ThisParameters)
Default constructor. (with parameters)
Definition: displacement_lagrangemultiplier_residual_contact_criteria.h:117
typename BaseType::DofsArrayType DofsArrayType
The dofs array type.
Definition: displacement_lagrangemultiplier_residual_contact_criteria.h:84
DisplacementLagrangeMultiplierResidualContactCriteria(DisplacementLagrangeMultiplierResidualContactCriteria const &rOther)
Definition: displacement_lagrangemultiplier_residual_contact_criteria.h:170
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: displacement_lagrangemultiplier_residual_contact_criteria.h:506
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_contact_criteria.h:432
TSparseSpace SparseSpaceType
The sparse space used.
Definition: displacement_lagrangemultiplier_residual_contact_criteria.h:93
void Initialize(ModelPart &rModelPart) override
This function initialize the convergence criteria.
Definition: displacement_lagrangemultiplier_residual_contact_criteria.h:392
std::string Info() const override
Turn back information as a string.
Definition: displacement_lagrangemultiplier_residual_contact_criteria.h:494
static std::string Name()
Returns the name of the class as used in the settings (snake_case format)
Definition: displacement_lagrangemultiplier_residual_contact_criteria.h:476
TableStreamUtility::Pointer TablePrinterPointerType
The table stream definition TODO: Replace by logger.
Definition: displacement_lagrangemultiplier_residual_contact_criteria.h:96
typename BaseType::TSystemVectorType TSystemVectorType
The dense vector type.
Definition: displacement_lagrangemultiplier_residual_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_contact_criteria.h:217
#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