59 template<
class TSparseSpace,
108 static constexpr
double ZeroTolerance = std::numeric_limits<double>::epsilon();
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
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);
176 mDispRatioTolerance = DispRatioTolerance;
177 mDispAbsTolerance = DispAbsTolerance;
180 mRotRatioTolerance = RotRatioTolerance;
181 mRotAbsTolerance = RotAbsTolerance;
184 mLMNormalRatioTolerance = LMNormalRatioTolerance;
185 mLMNormalAbsTolerance = LMNormalAbsTolerance;
188 mLMTangentStickRatioTolerance = LMTangentStickRatioTolerance;
189 mLMTangentStickAbsTolerance = LMTangentStickAbsTolerance;
190 mLMTangentSlipRatioTolerance = LMTangentSlipRatioTolerance;
191 mLMTangentSlipAbsTolerance = LMTangentSlipAbsTolerance;
194 mNormalTangentRatio = NormalTangentRatio;
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)
242 return Kratos::make_shared<ClassType>(ThisParameters);
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);
272 auto& r_nodes_array = rModelPart.
Nodes();
276 std::size_t dof_id = 0;
277 double residual_dof_value = 0.0;
279 const bool pure_slip = mOptions.
Is(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PURE_SLIP);
282 const std::size_t number_active_dofs = rb.size();
286 [](
const VariableData& rCurrVar) ->
bool {
return true;};
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;
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) {
297 if (aux_values.dof_id < number_active_dofs) {
298 if (mActiveDofs[aux_values.dof_id] == 1) {
300 aux_values.residual_dof_value = rb[aux_values.dof_id];
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) {
305 const auto it_node = r_nodes_array.find(rDof.Id());
306 const double mu = it_node->GetValue(FRICTION_COEFFICIENT);
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);
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);
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);
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);
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);
328 return std::make_tuple(0.0,0.0,0.0,0.0,0.0,0,0,0,0,0);
332 if (mStickCounter > 0) {
333 if (lm_stick_dof_num == 0) {
335 mOptions.
Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_STICK_RESIDUAL_IS_SET,
false);
338 if (lm_stick_dof_num > 0) {
339 mStickCounter = lm_stick_dof_num;
340 mOptions.
Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_STICK_RESIDUAL_IS_SET,
false);
343 if (mSlipCounter > 0) {
344 if (lm_slip_dof_num == 0) {
346 mOptions.
Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_SLIP_RESIDUAL_IS_SET,
false);
349 if (lm_slip_dof_num > 0) {
350 mSlipCounter = lm_slip_dof_num;
351 mOptions.
Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_SLIP_RESIDUAL_IS_SET,
false);
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;
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;
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;
375 mOptions.
Set(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::INITIAL_RESIDUAL_IS_SET,
true);
379 residual_disp_ratio = mDispCurrentResidualNorm/mDispInitialResidualNorm;
380 residual_rot_ratio = mRotCurrentResidualNorm/mRotInitialResidualNorm;
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);
390 residual_normal_lm_ratio = mLMNormalCurrentResidualNorm/mLMNormalInitialResidualNorm;
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);
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);
405 if (lm_stick_dof_num > 0) {
406 residual_tangent_lm_stick_ratio = mLMTangentStickCurrentResidualNorm/mLMTangentStickInitialResidualNorm;
408 residual_tangent_lm_stick_ratio = 0.0;
410 if (lm_slip_dof_num > 0) {
411 residual_tangent_lm_slip_ratio = mLMTangentSlipCurrentResidualNorm/mLMTangentSlipInitialResidualNorm;
413 residual_tangent_lm_slip_ratio = 0.0;
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;
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;
424 const double residual_tangent_lm_slip_abs = lm_slip_dof_num > 0 ? mLMTangentSlipCurrentResidualNorm/
static_cast<double>(lm_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;
431 if (r_process_info.Has(TABLE_UTILITY)) {
432 std::cout.precision(4);
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;
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;
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;
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;
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;
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;
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;
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;
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;
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);
481 if (disp_converged && rot_converged && lm_converged ) {
483 if (r_process_info.Has(TABLE_UTILITY)) {
485 auto& r_table = p_table->GetTable();
486 if (mOptions.
IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PRINTING_OUTPUT))
489 r_table <<
"Achieved";
491 if (mOptions.
IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PRINTING_OUTPUT))
492 KRATOS_INFO(
"DisplacementLagrangeMultiplierResidualFrictionalContactCriteria") <<
BOLDFONT(
"\tResidual") <<
" convergence is " <<
BOLDFONT(
FGRN(
"achieved")) << std::endl;
494 KRATOS_INFO(
"DisplacementLagrangeMultiplierResidualFrictionalContactCriteria") <<
"\tResidual convergence is achieved" << std::endl;
500 if (r_process_info.Has(TABLE_UTILITY)) {
502 auto& r_table = p_table->GetTable();
503 if (mOptions.
IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PRINTING_OUTPUT))
506 r_table <<
"Not achieved";
508 if (mOptions.
IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::PRINTING_OUTPUT))
509 KRATOS_INFO(
"DisplacementLagrangeMultiplierResidualFrictionalContactCriteria") <<
BOLDFONT(
"\tResidual") <<
" convergence is " <<
BOLDFONT(
FRED(
" not achieved")) << std::endl;
511 KRATOS_INFO(
"DisplacementLagrangeMultiplierResidualFrictionalContactCriteria") <<
"\tResidual convergence is not achieved" << std::endl;
528 BaseType::mConvergenceCriteriaIsInitialized =
true;
535 if (r_process_info.
Has(TABLE_UTILITY) && mOptions.IsNot(DisplacementLagrangeMultiplierResidualFrictionalContactCriteria::TABLE_IS_INITIALIZED)) {
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);
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);
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);
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);
610 BaseType::FinalizeNonLinearIteration(rModelPart, rDofSet, rA, rDx, rb);
614 r_process_info.
SetValue(ACTIVE_SET_COMPUTED,
false);
625 "name" : "displacement_lagrangemultiplier_ressidual_frictional_contact_criteria",
626 "ensure_contact" : 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
642 const Parameters base_default_parameters = BaseType::GetDefaultParameters();
644 return default_parameters;
653 return "displacement_lagrangemultiplier_ressidual_frictional_contact_criteria";
669 std::string
Info()
const override
671 return "DisplacementLagrangeMultiplierResidualFrictionalContactCriteria";
709 BaseType::AssignSettings(ThisParameters);
712 mDispRatioTolerance = ThisParameters[
"residual_relative_tolerance"].
GetDouble();
713 mDispAbsTolerance = ThisParameters[
"residual_absolute_tolerance"].
GetDouble();
716 mRotRatioTolerance = ThisParameters[
"rotation_residual_relative_tolerance"].
GetDouble();
717 mRotAbsTolerance = ThisParameters[
"rotation_residual_absolute_tolerance"].
GetDouble();
720 mLMNormalRatioTolerance = ThisParameters[
"contact_displacement_absolute_tolerance"].
GetDouble();
721 mLMNormalAbsTolerance = ThisParameters[
"contact_residual_absolute_tolerance"].
GetDouble();
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();
730 mNormalTangentRatio = ThisParameters[
"ratio_normal_tangent_threshold"].
GetDouble();
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);
755 double mDispRatioTolerance;
756 double mDispAbsTolerance;
757 double mDispInitialResidualNorm;
758 double mDispCurrentResidualNorm;
760 double mRotRatioTolerance;
761 double mRotAbsTolerance;
762 double mRotInitialResidualNorm;
763 double mRotCurrentResidualNorm;
765 double mLMNormalRatioTolerance;
766 double mLMNormalAbsTolerance;
767 double mLMNormalInitialResidualNorm;
768 double mLMNormalCurrentResidualNorm;
770 double mLMTangentStickRatioTolerance;
771 double mLMTangentStickAbsTolerance;
772 double mLMTangentSlipRatioTolerance;
773 double mLMTangentSlipAbsTolerance;
774 double mLMTangentStickInitialResidualNorm;
775 double mLMTangentStickCurrentResidualNorm;
776 double mLMTangentSlipInitialResidualNorm;
777 double mLMTangentSlipCurrentResidualNorm;
779 std::size_t mStickCounter = 0;
780 std::size_t mSlipCounter = 0;
782 double mNormalTangentRatio;
784 std::vector<int> mActiveDofs;
793 template<
class TSparseSpace,
class TDenseSpace>
795 template<
class TSparseSpace,
class TDenseSpace>
797 template<
class TSparseSpace,
class TDenseSpace>
799 template<
class TSparseSpace,
class TDenseSpace>
801 template<
class TSparseSpace,
class TDenseSpace>
803 template<
class TSparseSpace,
class TDenseSpace>
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));
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
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
Dof represents a degree of freedom (DoF).
Definition: dof.h:86
EquationIdType EquationId() const
Definition: dof.h:324
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
#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