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.
residualbased_newton_raphson_contact_strategy.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
22 #include "includes/define.h"
23 #include "includes/model_part.h"
24 #include "includes/variables.h"
25 
26 /* Strategies */
28 
29 /* Utilities */
32 #include "utilities/math_utils.h"
35 
36 namespace Kratos {
37 
40 
44 
48 
52 
56 
64 template<class TSparseSpace,
65  class TDenseSpace, // = DenseSpace<double>,
66  class TLinearSolver //= LinearSolver<TSparseSpace,TDenseSpace>
67  >
69  public ResidualBasedNewtonRaphsonStrategy< TSparseSpace, TDenseSpace, TLinearSolver >
70 {
71 public:
74 
77 
80 
83 
86 
89 
92 
95 
97  using TDataType = typename BaseType::TDataType;
98 
100  using SparseSpaceType = TSparseSpace;
101 
104 
107 
110 
113 
116 
119 
122 
125 
128 
131 
134 
136  using ProcessesListType = typename ProcessFactoryUtility::Pointer;
137 
139  using IndexType = std::size_t;
140 
145  {
146  }
147 
153  explicit ResidualBasedNewtonRaphsonContactStrategy(ModelPart& rModelPart, Parameters ThisParameters)
154  : BaseType(rModelPart),
155  mpMyProcesses(nullptr),
156  mpPostProcesses(nullptr)
157  {
158  // Validate and assign defaults
159  ThisParameters = this->ValidateAndAssignParameters(ThisParameters, this->GetDefaultParameters());
160  this->AssignSettings(ThisParameters);
161 
162  // Auxiliary assign
164  }
165 
177  ModelPart& rModelPart,
178  typename TSchemeType::Pointer pScheme,
179  typename TConvergenceCriteriaType::Pointer pNewConvergenceCriteria,
180  typename TBuilderAndSolverType::Pointer pNewBuilderAndSolver,
181  IndexType MaxIterations = 30,
182  bool CalculateReactions = false,
183  bool ReformDofSetAtEachStep = false,
184  bool MoveMeshFlag = false,
185  Parameters ThisParameters = Parameters(R"({})"),
186  ProcessesListType pMyProcesses = nullptr,
187  ProcessesListType pPostProcesses = nullptr
188  )
189  : BaseType(rModelPart, pScheme, pNewConvergenceCriteria, pNewBuilderAndSolver, MaxIterations, CalculateReactions, ReformDofSetAtEachStep, MoveMeshFlag ),
190  mThisParameters(ThisParameters),
191  mpMyProcesses(pMyProcesses),
192  mpPostProcesses(pPostProcesses)
193  {
194  KRATOS_TRY;
195 
196  mConvergenceCriteriaEchoLevel = pNewConvergenceCriteria->GetEchoLevel();
197 
198  Parameters default_parameters = GetDefaultParameters();
199  mThisParameters.ValidateAndAssignDefaults(default_parameters);
200 
201  KRATOS_CATCH("");
202  }
203 
216  ModelPart& rModelPart,
217  typename TSchemeType::Pointer pScheme,
218  typename TLinearSolver::Pointer pNewLinearSolver,
219  typename TConvergenceCriteriaType::Pointer pNewConvergenceCriteria,
220  IndexType MaxIterations = 30,
221  bool CalculateReactions = false,
222  bool ReformDofSetAtEachStep = false,
223  bool MoveMeshFlag = false,
224  Parameters ThisParameters = Parameters(R"({})"),
225  ProcessesListType pMyProcesses = nullptr,
226  ProcessesListType pPostProcesses = nullptr
227  )
228  : BaseType(rModelPart, pScheme, pNewLinearSolver, pNewConvergenceCriteria, MaxIterations, CalculateReactions, ReformDofSetAtEachStep, MoveMeshFlag),
229  mThisParameters(ThisParameters),
230  mpMyProcesses(pMyProcesses),
231  mpPostProcesses(pPostProcesses)
232  {
233  KRATOS_TRY;
234 
235  mConvergenceCriteriaEchoLevel = pNewConvergenceCriteria->GetEchoLevel();
236 
237  Parameters default_parameters = GetDefaultParameters();
238  mThisParameters.ValidateAndAssignDefaults(default_parameters);
239 
240  KRATOS_CATCH("");
241  }
242 
255  ModelPart& rModelPart,
256  typename TSchemeType::Pointer pScheme,
257  typename TLinearSolver::Pointer pNewLinearSolver,
258  typename TConvergenceCriteriaType::Pointer pNewConvergenceCriteria,
259  typename TBuilderAndSolverType::Pointer pNewBuilderAndSolver,
260  IndexType MaxIterations = 30,
261  bool CalculateReactions = false,
262  bool ReformDofSetAtEachStep = false,
263  bool MoveMeshFlag = false,
264  Parameters ThisParameters = Parameters(R"({})"),
265  ProcessesListType pMyProcesses = nullptr,
266  ProcessesListType pPostProcesses = nullptr
267  )
268  : ResidualBasedNewtonRaphsonStrategy<TSparseSpace, TDenseSpace, TLinearSolver>(rModelPart, pScheme, pNewLinearSolver, pNewConvergenceCriteria, pNewBuilderAndSolver, MaxIterations, CalculateReactions, ReformDofSetAtEachStep, MoveMeshFlag ),
269  mThisParameters(ThisParameters),
270  mpMyProcesses(pMyProcesses),
271  mpPostProcesses(pPostProcesses)
272  {
273  KRATOS_TRY;
274 
275  mConvergenceCriteriaEchoLevel = pNewConvergenceCriteria->GetEchoLevel();
276 
277  Parameters default_parameters = GetDefaultParameters();
278  mThisParameters.ValidateAndAssignDefaults(default_parameters);
279 
280  KRATOS_CATCH("");
281  }
282 
287  = default;
288 
292 
296 
302  typename SolvingStrategyType::Pointer Create(
303  ModelPart& rModelPart,
304  Parameters ThisParameters
305  ) const override
306  {
307  return Kratos::make_shared<ClassType>(rModelPart, ThisParameters);
308  }
309 
314  void Predict() override
315  {
316  KRATOS_TRY
317 
318  // Auxiliary zero array
319  const array_1d<double, 3> zero_array = ZeroVector(3);
320 
321  // Set to zero the weighted gap
322  ModelPart& r_model_part = StrategyBaseType::GetModelPart();
323  NodesArrayType& r_nodes_array = r_model_part.GetSubModelPart("Contact").Nodes();
324  const bool frictional = r_model_part.Is(SLIP);
325 
326  // We predict contact pressure in case of contact problem
327  if (r_nodes_array.begin()->SolutionStepsDataHas(WEIGHTED_GAP)) {
328  VariableUtils().SetVariable(WEIGHTED_GAP, 0.0, r_nodes_array);
329  if (frictional) {
330  VariableUtils().SetVariable(WEIGHTED_SLIP, zero_array, r_nodes_array);
331  }
332 
333  // Compute the current gap
335 
336  // We predict a contact pressure
337  ProcessInfo& r_process_info = r_model_part.GetProcessInfo();
338  const std::size_t step = r_process_info[STEP];
339 
340  if (step == 1) {
341  block_for_each(r_nodes_array, [&](Node& rNode) {
342  noalias(rNode.Coordinates()) += rNode.FastGetSolutionStepValue(DISPLACEMENT);
343  });
344  } else {
345  block_for_each(r_nodes_array, [&](Node& rNode) {
346  noalias(rNode.Coordinates()) += (rNode.FastGetSolutionStepValue(DISPLACEMENT) - rNode.FastGetSolutionStepValue(DISPLACEMENT, 1));
347  });
348  }
349  }
350 
351 // BaseType::Predict(); // NOTE: May cause problems in dynamics!!!
352 //
353 // // Set to zero the weighted gap // NOTE: This can be done during the search if the predict is deactivated
354 // ModelPart& r_model_part = StrategyBaseType::GetModelPart();
355 // NodesArrayType& nodes_array = r_model_part.GetSubModelPart("Contact").Nodes();
356 //
357 // // We predict contact pressure in case of contact problem
358 // if (nodes_array.begin()->SolutionStepsDataHas(WEIGHTED_GAP)) {
359 // VariableUtils().SetVariable(WEIGHTED_GAP, 0.0, nodes_array);
360 //
361 // // Compute the current gap
362 // ContactUtilities::ComputeExplicitContributionConditions(r_model_part.GetSubModelPart("ComputingContact"));
363 //
364 // // We predict a contact pressure
365 // ProcessInfo& r_process_info = r_model_part.GetProcessInfo();
366 // const double initial_penalty_parameter = r_process_info[INITIAL_PENALTY];
367 //
368 // // We iterate over the nodes
369 // const bool is_components = nodes_array.begin()->SolutionStepsDataHas(LAGRANGE_MULTIPLIER_CONTACT_PRESSURE) ? false : true;
370 //
371 // block_for_each(r_nodes_array, [&initial_penalty_parameter, &is_components](Node& rNode) {
372 // const double current_gap = rNode.FastGetSolutionStepValue(WEIGHTED_GAP);
373 // const double penalty = rNode.Has(INITIAL_PENALTY) ? rNode.GetValue(INITIAL_PENALTY) : initial_penalty_parameter;
374 // if (current_gap < 0.0) {
375 // rNode.Set(ACTIVE, true);
376 // if (is_components) {
377 // rNode.FastGetSolutionStepValue(LAGRANGE_MULTIPLIER_CONTACT_PRESSURE) = penalty * current_gap;
378 // } else {
379 // const array_1d<double, 3>& normal = rNode.FastGetSolutionStepValue(NORMAL);
380 // rNode.FastGetSolutionStepValue(VECTOR_LAGRANGE_MULTIPLIER) = penalty * current_gap * normal;
381 // }
382 // }
383 // });
384 // }
385 
386  KRATOS_CATCH("")
387  }
388 
393  void Initialize() override
394  {
395  KRATOS_TRY;
396 
398  mFinalizeWasPerformed = false;
399 
400  // Initializing NL_ITERATION_NUMBER
401  ModelPart& r_model_part = StrategyBaseType::GetModelPart();
402  ProcessInfo& r_process_info = r_model_part.GetProcessInfo();
403  r_process_info[NL_ITERATION_NUMBER] = 1;
404 
405  KRATOS_CATCH("");
406  }
407 
414  double Solve() override
415  {
416  this->Initialize();
417  this->InitializeSolutionStep();
418  this->Predict();
419  this->SolveSolutionStep();
420  this->FinalizeSolutionStep();
421 
422  // TODO: Add something if necessary
423 
424  return 0.0;
425  }
426 
433  void InitializeSolutionStep() override
434  {
435  BaseType::mpConvergenceCriteria->SetEchoLevel(0);
438 
439  mFinalizeWasPerformed = false;
440  }
441 
447  void FinalizeSolutionStep() override
448  {
449  KRATOS_TRY;
450 
451  if (mFinalizeWasPerformed == false) {
453 
454  // To avoid compute twice the FinalizeSolutionStep
455  mFinalizeWasPerformed = true;
456  }
457 
458  KRATOS_CATCH("");
459  }
460 
466  bool SolveSolutionStep() override
467  {
468  KRATOS_TRY;
469 
470 // bool is_converged = BaseType::SolveSolutionStep(); // FIXME: Requires to separate the non linear iterations
471 
472 // bool is_converged = BaseSolveSolutionStep(); // Direct solution
473  bool is_converged = false;
474 
475  // Getting model part
476  ModelPart& r_model_part = StrategyBaseType::GetModelPart();
477 
478  if (r_model_part.IsNot(INTERACTION)) {
479  // We get the system
483 
484  // We get the process info
485  ProcessInfo& r_process_info = r_model_part.GetProcessInfo();
486 
487  int inner_iteration = 0;
488  while (!is_converged && inner_iteration < mThisParameters["inner_loop_iterations"].GetInt()) {
489  ++inner_iteration;
490 
491  if (mConvergenceCriteriaEchoLevel > 0 && StrategyBaseType::GetModelPart().GetCommunicator().MyPID() == 0 ) {
492  std::cout << std::endl << BOLDFONT("Simplified semi-smooth strategy. INNER ITERATION: ") << inner_iteration;;
493  }
494 
495  // We solve one loop
496  r_process_info[NL_ITERATION_NUMBER] = 1;
497  r_process_info[INNER_LOOP_ITERATION] = inner_iteration;
498  is_converged = BaseSolveSolutionStep();
499 
500  // We check the convergence
501  BaseType::mpConvergenceCriteria->SetEchoLevel(0);
502  is_converged = BaseType::mpConvergenceCriteria->PostCriteria(r_model_part, BaseType::GetBuilderAndSolver()->GetDofSet(), A, Dx, b);
504 
505  if (mConvergenceCriteriaEchoLevel > 0 && StrategyBaseType::GetModelPart().GetCommunicator().MyPID() == 0 ) {
506  if (is_converged) std::cout << BOLDFONT("Simplified semi-smooth strategy. INNER ITERATION: ") << BOLDFONT(FGRN("CONVERGED")) << std::endl;
507  else std::cout << BOLDFONT("Simplified semi-smooth strategy. INNER ITERATION: ") << BOLDFONT(FRED("NOT CONVERGED")) << std::endl;
508  }
509  }
510  } else {
511  // We compute the base loop
512  r_model_part.GetProcessInfo()[INNER_LOOP_ITERATION] = 1;
513  is_converged = BaseSolveSolutionStep();
514  }
515 
516  if (mThisParameters["adaptative_strategy"].GetBool()) {
517  if (!is_converged) {
518  is_converged = AdaptativeStep();
519  }
520  }
521 
522  return is_converged;
523 
524  KRATOS_CATCH("");
525  }
526 
532  {
533  Parameters default_parameters = Parameters(R"(
534  {
535  "name" : "newton_raphson_contact_strategy",
536  "adaptative_strategy" : false,
537  "split_factor" : 10.0,
538  "max_number_splits" : 3,
539  "inner_loop_iterations" : 5
540  })" );
541 
542  // Getting base class default parameters
543  const Parameters base_default_parameters = BaseType::GetDefaultParameters();
544  default_parameters.RecursivelyAddMissingParameters(base_default_parameters);
545  return default_parameters;
546  }
547 
552  static std::string Name()
553  {
554  return "newton_raphson_contact_strategy";
555  }
556 
560 
564 
568 
572 
573 protected:
574 
577 
581 
583 
584  // ADAPTATIVE STRATEGY PARAMETERS
588 
589  // OTHER PARAMETERS
591 
595 
599 
604  void AssignSettings(const Parameters ThisParameters) override
605  {
606  BaseType::AssignSettings(ThisParameters);
607 
608  // Copy the parameters
609  mThisParameters = ThisParameters;
610  }
611 
617  {
618  KRATOS_TRY;
619 
620  // Pointers needed in the solution
621  ModelPart& r_model_part = StrategyBaseType::GetModelPart();
622  ProcessInfo& r_process_info = r_model_part.GetProcessInfo();
623  typename TSchemeType::Pointer p_scheme = BaseType::GetScheme();
624  typename TBuilderAndSolverType::Pointer p_builder_and_solver = BaseType::GetBuilderAndSolver();
625  auto& r_dof_set = p_builder_and_solver->GetDofSet();
626 
630 
631  // Initializing the parameters of the Newton-Raphson cicle
632  IndexType iteration_number = 1;
633  r_process_info[NL_ITERATION_NUMBER] = iteration_number;
634 
635  bool is_converged = false;
636  bool residual_is_updated = false;
637  p_scheme->InitializeNonLinIteration(r_model_part, rA, rDx, rb);
638  BaseType::mpConvergenceCriteria->InitializeNonLinearIteration(r_model_part, r_dof_set, rA, rDx, rb);
639  is_converged = BaseType::mpConvergenceCriteria->PreCriteria(r_model_part, r_dof_set, rA, rDx, rb);
640 
641  // We do a geometry check before solve the system for first time
642  if (mThisParameters["adaptative_strategy"].GetBool()) {
643  if (CheckGeometryInverted()) {
644  KRATOS_WARNING("Element inverted") << "INVERTED ELEMENT BEFORE FIRST SOLVE" << std::endl;
645  r_process_info[STEP] -= 1; // We revert one step in the case that the geometry is already broken before start the computing
646  return false;
647  }
648  }
649 
650  // Function to perform the building and the solving phase.
652  TSparseSpace::SetToZero(rA);
653  TSparseSpace::SetToZero(rDx);
654  TSparseSpace::SetToZero(rb);
655 
656  p_builder_and_solver->BuildAndSolve(p_scheme, r_model_part, rA, rDx, rb);
657  } else {
658  TSparseSpace::SetToZero(rDx); //Dx=0.00;
659  TSparseSpace::SetToZero(rb);
660 
661  p_builder_and_solver->BuildRHSAndSolve(p_scheme, r_model_part, rA, rDx, rb);
662  }
663 
664  // Debugging info
665  BaseType::EchoInfo(iteration_number);
666 
667  // Updating the results stored in the database
669 
670  // We now check the geometry
671  if (mThisParameters["adaptative_strategy"].GetBool()) {
672  if (CheckGeometryInverted()) {
673  KRATOS_WARNING("Element inverted") << "INVERTED ELEMENT DURING DATABASE UPDATE" << std::endl;
674  r_process_info[STEP] -= 1; // We revert one step in the case that the geometry is already broken before start the computing
675  return false;
676  }
677  }
678 
679  p_scheme->FinalizeNonLinIteration(r_model_part, rA, rDx, rb);
680  BaseType::mpConvergenceCriteria->FinalizeNonLinearIteration(r_model_part, r_dof_set, rA, rDx, rb);
681 
682  if (is_converged) {
683  // Initialisation of the convergence criteria
684  BaseType::mpConvergenceCriteria->InitializeSolutionStep(r_model_part, r_dof_set, rA, rDx, rb);
685 
686  if (BaseType::mpConvergenceCriteria->GetActualizeRHSflag()) {
687  TSparseSpace::SetToZero(rb);
688 
689  p_builder_and_solver->BuildRHS(p_scheme, r_model_part, rb);
690  }
691 
692  is_converged = BaseType::mpConvergenceCriteria->PostCriteria(r_model_part, r_dof_set, rA, rDx, rb);
693  }
694 
695  // Iteration Cicle... performed only for NonLinearProblems
696  while (is_converged == false && iteration_number++<BaseType::mMaxIterationNumber) {
697  //setting the number of iteration
698  r_process_info[NL_ITERATION_NUMBER] = iteration_number;
699 
700  p_scheme->InitializeNonLinIteration(r_model_part, rA, rDx, rb);
701  BaseType::mpConvergenceCriteria->InitializeNonLinearIteration(r_model_part, r_dof_set, rA, rDx, rb);
702 
703  is_converged = BaseType::mpConvergenceCriteria->PreCriteria(r_model_part, r_dof_set, rA, rDx, rb);
704 
705  //call the linear system solver to find the correction mDx for the
706  //it is not called if there is no system to solve
707  if (SparseSpaceType::Size(rDx) != 0) {
710  //A = 0.00;
711  TSparseSpace::SetToZero(rA);
712  TSparseSpace::SetToZero(rDx);
713  TSparseSpace::SetToZero(rb);
714 
715  p_builder_and_solver->BuildAndSolve(p_scheme, r_model_part, rA, rDx, rb);
716  }
717  else {
718  TSparseSpace::SetToZero(rDx);
719  TSparseSpace::SetToZero(rb);
720 
721  p_builder_and_solver->BuildRHSAndSolve(p_scheme, r_model_part, rA, rDx, rb);
722  }
723  }
724  else {
725  TSparseSpace::SetToZero(rDx);
726  TSparseSpace::SetToZero(rb);
727 
728  p_builder_and_solver->BuildRHSAndSolve(p_scheme, r_model_part, rA, rDx, rb);
729  }
730  } else {
731  KRATOS_WARNING("No DoFs") << "ATTENTION: no free DOFs!! " << std::endl;
732  }
733 
734  // Debugging info
735  BaseType::EchoInfo(iteration_number);
736 
737  // Updating the results stored in the database
739 
740  // We now check the geometry
741  if (mThisParameters["adaptative_strategy"].GetBool()) {
742  if (CheckGeometryInverted()) {
743  KRATOS_WARNING("Element inverted") << "INVERTED ELEMENT DURING DATABASE UPDATE" << std::endl;
744  r_process_info[STEP] -= 1; // We revert one step in the case that the geometry is already broken before start the computing
745  return false;
746  }
747  }
748 
749  p_scheme->FinalizeNonLinIteration(r_model_part, rA, rDx, rb);
750  BaseType::mpConvergenceCriteria->FinalizeNonLinearIteration(r_model_part, r_dof_set, rA, rDx, rb);
751 
752  residual_is_updated = false;
753 
754  if (is_converged) {
755 
756  if (BaseType::mpConvergenceCriteria->GetActualizeRHSflag()) {
757  TSparseSpace::SetToZero(rb);
758 
759  p_builder_and_solver->BuildRHS(p_scheme, r_model_part, rb);
760  residual_is_updated = true;
761  //std::cout << "mb is calculated" << std::endl;
762  }
763 
764  is_converged = BaseType::mpConvergenceCriteria->PostCriteria(r_model_part, r_dof_set, rA, rDx, rb);
765  }
766  }
767 
768  // Plots a warning if the maximum number of iterations is exceeded
769  if (iteration_number >= BaseType::mMaxIterationNumber && r_model_part.GetCommunicator().MyPID() == 0)
771 
772  // Recalculate residual if needed
773  // (note that some convergence criteria need it to be recalculated)
774  if (residual_is_updated == false) {
775  // NOTE:
776  // The following part will be commented because it is time consuming
777  // and there is no obvious reason to be here. If someone need this
778  // part please notify the community via mailing list before uncommenting it.
779  // Pooyan.
780 
781  // TSparseSpace::SetToZero(mb);
782  // p_builder_and_solver->BuildRHS(p_scheme, r_model_part, mb);
783  }
784 
785  // Calculate reactions if required
787  p_builder_and_solver->CalculateReactions(p_scheme, r_model_part, rA, rDx, rb);
788 
789  return is_converged;
790 
791  KRATOS_CATCH("");
792  }
793 
798  {
799  KRATOS_TRY;
800 
801  bool is_converged = false;
802  // Plots a warning if the maximum number of iterations is exceeded
803  if (mpMyProcesses == nullptr && StrategyBaseType::mEchoLevel > 0)
804  KRATOS_WARNING("No python processes") << "If you have not implemented any method to recalculate BC or loads in function of time, this strategy will be USELESS" << std::endl;
805 
806  if (mpPostProcesses == nullptr && StrategyBaseType::mEchoLevel > 0)
807  KRATOS_WARNING("No python post processes") << "If you don't add the postprocesses and the time step if splitted you won't postprocess that steps" << std::endl;
808 
809  ModelPart& r_model_part = StrategyBaseType::GetModelPart();
810  ProcessInfo& r_process_info = r_model_part.GetProcessInfo();
811 
812  const double original_delta_time = r_process_info[DELTA_TIME]; // We save the delta time to restore later
813 
814  int split_number = 0;
815 
816  // We iterate until we reach the convergence or we split more than desired
817  while (is_converged == false && split_number <= mThisParameters["max_number_splits"].GetInt()) {
818  // Expliting time step as a way to try improve the convergence
819  split_number += 1;
820  double aux_delta_time, current_time;
821  const double aux_time = SplitTimeStep(aux_delta_time, current_time);
822  current_time += aux_delta_time;
823 
824  bool inside_the_split_is_converged = false;
825  IndexType inner_iteration = 0;
826  while (current_time <= aux_time) {
827  inner_iteration += 1;
828  r_process_info[STEP] += 1;
829 
830  if (inner_iteration == 1) {
832  UnMoveMesh();
833 
834  NodesArrayType& r_nodes_array = r_model_part.Nodes();
835  block_for_each(r_nodes_array, [&](Node& rNode) {
836  rNode.OverwriteSolutionStepData(1, 0);
837 // rNode.OverwriteSolutionStepData(2, 1);
838  });
839 
840  r_process_info.SetCurrentTime(current_time); // Reduces the time step
841 
843  } else {
844  NodesArrayType& r_nodes_array = r_model_part.Nodes();
845  block_for_each(r_nodes_array, [&](Node& rNode) {
846  rNode.CloneSolutionStepData();
847  });
848 
849  r_process_info.CloneSolutionStepInfo();
850  r_process_info.ClearHistory(r_model_part.GetBufferSize());
851  r_process_info.SetAsTimeStepInfo(current_time); // Sets the new time step
852  }
853 
854  // We execute the processes before the non-linear iteration
855  if (mpMyProcesses != nullptr)
856  mpMyProcesses->ExecuteInitializeSolutionStep();
857 
858  if (mpPostProcesses != nullptr)
859  mpPostProcesses->ExecuteInitializeSolutionStep();
860 
861  // In order to initialize again everything
863  mFinalizeWasPerformed = false;
864 
865  // We repeat the solve with the new DELTA_TIME
866  this->Initialize();
867  this->InitializeSolutionStep();
868  this->Predict();
869  inside_the_split_is_converged = BaseType::SolveSolutionStep();
870  this->FinalizeSolutionStep();
871 
872  // We execute the processes after the non-linear iteration
873  if (mpMyProcesses != nullptr)
874  mpMyProcesses->ExecuteFinalizeSolutionStep();
875 
876  if (mpPostProcesses != nullptr)
877  mpPostProcesses->ExecuteFinalizeSolutionStep();
878 
879  if (mpMyProcesses != nullptr)
880  mpMyProcesses->ExecuteBeforeOutputStep();
881 
882  if (mpPostProcesses != nullptr)
883  mpPostProcesses->PrintOutput();
884 
885  if (mpMyProcesses != nullptr)
886  mpMyProcesses->ExecuteAfterOutputStep();
887 
888  current_time += aux_delta_time;
889  }
890 
891  if (inside_the_split_is_converged)
892  is_converged = true;
893  }
894 
895  // Plots a warning if the maximum number of iterations and splits are exceeded
896  if (is_converged == false)
898 
899  // Restoring original DELTA_TIME
900  r_process_info[DELTA_TIME] = original_delta_time;
901 
902  return is_converged;
903 
904  KRATOS_CATCH("");
905  }
906 
916  TSystemVectorType& Dx,
918  const bool MoveMesh
919  ) override
920  {
922 
923  // TODO: Add something if necessary
924  }
925 
930  {
931  ModelPart& r_model_part = StrategyBaseType::GetModelPart();
932  ProcessInfo& r_process_info = r_model_part.GetProcessInfo();
933  bool inverted_element = false;
934 
935  ElementsArrayType& elements_array = r_model_part.Elements();
936 
937  // NOT OMP
938  for(int i = 0; i < static_cast<int>(elements_array.size()); ++i) {
939  auto it_elem = elements_array.begin() + i;
940  auto& geom = it_elem->GetGeometry();
941  if (geom.DeterminantOfJacobian(0) < 0.0) {
943  KRATOS_WATCH(it_elem->Id())
944  KRATOS_WATCH(geom.DeterminantOfJacobian(0))
945  }
946  return true;
947  }
948 
949  // We check now the deformation gradient
950  std::vector<Matrix> deformation_gradient_matrices;
951  it_elem->CalculateOnIntegrationPoints( DEFORMATION_GRADIENT, deformation_gradient_matrices, r_process_info);
952 
953  for (IndexType i_gp = 0; i_gp < deformation_gradient_matrices.size(); ++i_gp) {
954  const double det_f = MathUtils<double>::Det(deformation_gradient_matrices[i_gp]);
955  if (det_f < 0.0) {
957  KRATOS_WATCH(it_elem->Id())
958  KRATOS_WATCH(det_f)
959  }
960  return true;
961  }
962  }
963  }
964 
965  return inverted_element;
966  }
967 
975  double& AuxDeltaTime,
976  double& CurrentTime
977  )
978  {
979  KRATOS_TRY;
980 
981  const double aux_time = StrategyBaseType::GetModelPart().GetProcessInfo()[TIME];
982  AuxDeltaTime = StrategyBaseType::GetModelPart().GetProcessInfo()[DELTA_TIME];
983  CurrentTime = aux_time - AuxDeltaTime;
984 
985  StrategyBaseType::GetModelPart().GetProcessInfo()[TIME] = CurrentTime; // Restore time to the previous one
986  AuxDeltaTime /= mThisParameters["split_factor"].GetDouble();
987  StrategyBaseType::GetModelPart().GetProcessInfo()[DELTA_TIME] = AuxDeltaTime; // Change delta time
988 
989  CoutSplittingTime(AuxDeltaTime, aux_time);
990 
991  return aux_time;
992 
993  KRATOS_CATCH("");
994  }
995 
999  void UnMoveMesh()
1000  {
1001  KRATOS_TRY;
1002 
1003  if (StrategyBaseType::GetModelPart().NodesBegin()->SolutionStepsDataHas(DISPLACEMENT_X) == false)
1004  KRATOS_ERROR << "It is impossible to move the mesh since the DISPLACEMENT var is not in the model_part. Either use SetMoveMeshFlag(False) or add DISPLACEMENT to the list of variables" << std::endl;
1005 
1007  block_for_each(r_nodes_array, [&](Node& rNode) {
1008  noalias(rNode.Coordinates()) = rNode.GetInitialPosition().Coordinates();
1009  noalias(rNode.Coordinates()) += rNode.FastGetSolutionStepValue(DISPLACEMENT, 1);
1010  });
1011 
1012  KRATOS_CATCH("");
1013  }
1014 
1019  {
1020  if (mConvergenceCriteriaEchoLevel != 0) {
1021  std::cout << "STEP: " << StrategyBaseType::GetModelPart().GetProcessInfo()[STEP] << "\t NON LINEAR ITERATION: " << StrategyBaseType::GetModelPart().GetProcessInfo()[NL_ITERATION_NUMBER] << "\t TIME: " << StrategyBaseType::GetModelPart().GetProcessInfo()[TIME] << "\t DELTA TIME: " << StrategyBaseType::GetModelPart().GetProcessInfo()[DELTA_TIME] << std::endl;
1022  }
1023  }
1024 
1031  const double AuxDeltaTime,
1032  const double AuxTime
1033  )
1034  {
1035  if (mConvergenceCriteriaEchoLevel > 0 && StrategyBaseType::GetModelPart().GetCommunicator().MyPID() == 0 ) {
1036  const double Time = StrategyBaseType::GetModelPart().GetProcessInfo()[TIME];
1037  std::cout.precision(4);
1038  std::cout << "|----------------------------------------------------|" << std::endl;
1039  std::cout << "| " << BOLDFONT("SPLITTING TIME STEP") << " |" << std::endl;
1040  std::cout << "| " << BOLDFONT("COMING BACK TO TIME: ") << std::scientific << Time << " |" << std::endl;
1041  std::cout << "| " << BOLDFONT(" NEW TIME STEP: ") << std::scientific << AuxDeltaTime << " |" << std::endl;
1042  std::cout << "| " << BOLDFONT(" UNTIL TIME: ") << std::scientific << AuxTime << " |" << std::endl;
1043  std::cout << "|----------------------------------------------------|" << std::endl;
1044  }
1045  }
1046 
1050  void MaxIterationsExceeded() override
1051  {
1052  if (mConvergenceCriteriaEchoLevel > 0 && StrategyBaseType::GetModelPart().GetCommunicator().MyPID() == 0 ) {
1053  std::cout << "|----------------------------------------------------|" << std::endl;
1054  std::cout << "| " << BOLDFONT(FRED("ATTENTION: Max iterations exceeded")) << " |" << std::endl;
1055  std::cout << "|----------------------------------------------------|" << std::endl;
1056  }
1057  }
1058 
1063  {
1064  if (mConvergenceCriteriaEchoLevel > 0 && StrategyBaseType::GetModelPart().GetCommunicator().MyPID() == 0 ) {
1065  std::cout << "|----------------------------------------------------|" << std::endl;
1066  std::cout << "| " << BOLDFONT(FRED("ATTENTION: Max iterations exceeded")) << " |" << std::endl;
1067  std::cout << "| " << BOLDFONT(FRED(" Max number of splits exceeded ")) << " |" << std::endl;
1068  std::cout << "|----------------------------------------------------|" << std::endl;
1069  }
1070  }
1071 
1075 
1079 
1083 
1088  {
1089  };
1090 
1092 
1093 }; /* Class ResidualBasedNewtonRaphsonContactStrategy */
1101 } // namespace Kratos
Current class provides an implementation for the base builder and solving operations.
Definition: builder_and_solver.h:64
virtual int MyPID() const
Definition: communicator.cpp:91
static void ComputeExplicitContributionConditions(ModelPart &rModelPart)
It computes the explicit contributions of the conditions.
Definition: contact_utilities.cpp:182
This is the base class to define the different convergence criterion considered.
Definition: convergence_criteria.h:58
bool Is(Flags const &rOther) const
Definition: flags.h:274
bool IsNot(Flags const &rOther) const
Definition: flags.h:291
Implicit solving strategy base class This is the base class from which we will derive all the implici...
Definition: implicit_solving_strategy.h:61
BaseType::TSystemVectorType TSystemVectorType
Definition: implicit_solving_strategy.h:72
BaseType::NodesArrayType NodesArrayType
Definition: implicit_solving_strategy.h:92
int mRebuildLevel
Definition: implicit_solving_strategy.h:263
bool mStiffnessMatrixIsBuilt
The current rebuild level.
Definition: implicit_solving_strategy.h:264
BaseType::TSystemVectorPointerType TSystemVectorPointerType
Definition: implicit_solving_strategy.h:76
BaseType::TSystemMatrixPointerType TSystemMatrixPointerType
Definition: implicit_solving_strategy.h:74
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: implicit_solving_strategy.h:80
BaseType::ConditionsArrayType ConditionsArrayType
Definition: implicit_solving_strategy.h:96
BaseType::TSystemMatrixType TSystemMatrixType
Definition: implicit_solving_strategy.h:70
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: implicit_solving_strategy.h:78
BaseType::TDataType TDataType
Definition: implicit_solving_strategy.h:68
BaseType::ElementsArrayType ElementsArrayType
Definition: implicit_solving_strategy.h:94
static double Det(const TMatrixType &rA)
Calculates the determinant of a matrix of a square matrix of any size (no check performed on release ...
Definition: math_utils.h:597
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MeshType::ConditionsContainerType ConditionsContainerType
Condintions container. A vector set of Conditions with their Id's as key.
Definition: model_part.h:183
MeshType::ElementsContainerType ElementsContainerType
Element container. A vector set of Elements with their Id's as key.
Definition: model_part.h:168
Communicator & GetCommunicator()
Definition: model_part.h:1821
IndexType GetBufferSize() const
This method gets the suffer size of the model part database.
Definition: model_part.h:1876
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
ModelPart & GetSubModelPart(std::string const &SubModelPartName)
Definition: model_part.cpp:2029
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class defines the node.
Definition: node.h:65
TVariableType::Type & FastGetSolutionStepValue(const TVariableType &rThisVariable)
Definition: node.h:435
void OverwriteSolutionStepData(IndexType SourceSolutionStepIndex, IndexType DestinationSourceSolutionStepIndex)
Definition: node.h:365
void CloneSolutionStepData()
Definition: node.h:360
const PointType & GetInitialPosition() const
Definition: node.h:559
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
void ValidateAndAssignDefaults(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing match the form prescribed by th...
Definition: kratos_parameters.cpp:1306
CoordinatesArrayType const & Coordinates() const
Definition: point.h:215
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.h:72
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
void SetCurrentTime(double NewTime)
Definition: process_info.cpp:63
void CloneSolutionStepInfo()
Definition: process_info.cpp:90
void ClearHistory(IndexType StepsBefore=0)
Definition: process_info.cpp:147
void SetAsTimeStepInfo()
Definition: process_info.cpp:29
Contact Newton Raphson class.
Definition: residualbased_newton_raphson_contact_strategy.h:70
void FinalizeSolutionStep() override
Performs all the required operations that should be done (for each step) after solving the solution s...
Definition: residualbased_newton_raphson_contact_strategy.h:447
Parameters mThisParameters
Definition: residualbased_newton_raphson_contact_strategy.h:582
std::size_t IndexType
Index type definition.
Definition: residualbased_newton_raphson_contact_strategy.h:139
void MaxIterationsExceeded() override
This method prints information after reach the max number of interations.
Definition: residualbased_newton_raphson_contact_strategy.h:1050
void UnMoveMesh()
This method moves bak the mesh to the previous position.
Definition: residualbased_newton_raphson_contact_strategy.h:999
void AssignSettings(const Parameters ThisParameters) override
This method assigns settings to member variables.
Definition: residualbased_newton_raphson_contact_strategy.h:604
bool BaseSolveSolutionStep()
Solves the current step.
Definition: residualbased_newton_raphson_contact_strategy.h:616
bool SolveSolutionStep() override
Solves the current step.
Definition: residualbased_newton_raphson_contact_strategy.h:466
bool AdaptativeStep()
This method performs the adaptative step.
Definition: residualbased_newton_raphson_contact_strategy.h:797
ResidualBasedNewtonRaphsonContactStrategy()
Default constructor.
Definition: residualbased_newton_raphson_contact_strategy.h:144
ProcessesListType mpMyProcesses
If the FinalizeSolutionStep has been already permformed.
Definition: residualbased_newton_raphson_contact_strategy.h:586
void InitializeSolutionStep() override
Performs all the required operations that should be done (for each step) before solving the solution ...
Definition: residualbased_newton_raphson_contact_strategy.h:433
bool mFinalizeWasPerformed
The configuration parameters.
Definition: residualbased_newton_raphson_contact_strategy.h:585
void UpdateDatabase(TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b, const bool MoveMesh) override
Here the database is updated.
Definition: residualbased_newton_raphson_contact_strategy.h:914
void CoutSolvingProblem()
This method prints information after solving the problem.
Definition: residualbased_newton_raphson_contact_strategy.h:1018
double Solve() override
The problem of interest is solved.
Definition: residualbased_newton_raphson_contact_strategy.h:414
ResidualBasedNewtonRaphsonContactStrategy(const ResidualBasedNewtonRaphsonContactStrategy &Other)
Definition: residualbased_newton_raphson_contact_strategy.h:1087
void Initialize() override
Initialization of member variables and prior operations.
Definition: residualbased_newton_raphson_contact_strategy.h:393
SolvingStrategyType::Pointer Create(ModelPart &rModelPart, Parameters ThisParameters) const override
Create method.
Definition: residualbased_newton_raphson_contact_strategy.h:302
ProcessesListType mpPostProcesses
The processes list.
Definition: residualbased_newton_raphson_contact_strategy.h:587
ResidualBasedNewtonRaphsonContactStrategy(ModelPart &rModelPart, Parameters ThisParameters)
Default constructor. (with parameters)
Definition: residualbased_newton_raphson_contact_strategy.h:153
int mConvergenceCriteriaEchoLevel
The post processes list.
Definition: residualbased_newton_raphson_contact_strategy.h:590
static std::string Name()
Returns the name of the class as used in the settings (snake_case format)
Definition: residualbased_newton_raphson_contact_strategy.h:552
typename ProcessFactoryUtility::Pointer ProcessesListType
Type for the list of processes.
Definition: residualbased_newton_raphson_contact_strategy.h:136
void Predict() override
Operation to predict the solution ... if it is not called a trivial predictor is used in which the va...
Definition: residualbased_newton_raphson_contact_strategy.h:314
bool CheckGeometryInverted()
his method checks if there is no element inverted
Definition: residualbased_newton_raphson_contact_strategy.h:929
void MaxIterationsAndSplitsExceeded()
This method prints information after reach the max number of interations and splits.
Definition: residualbased_newton_raphson_contact_strategy.h:1062
ResidualBasedNewtonRaphsonContactStrategy(ModelPart &rModelPart, typename TSchemeType::Pointer pScheme, typename TLinearSolver::Pointer pNewLinearSolver, typename TConvergenceCriteriaType::Pointer pNewConvergenceCriteria, typename TBuilderAndSolverType::Pointer pNewBuilderAndSolver, IndexType MaxIterations=30, bool CalculateReactions=false, bool ReformDofSetAtEachStep=false, bool MoveMeshFlag=false, Parameters ThisParameters=Parameters(R"({})"), ProcessesListType pMyProcesses=nullptr, ProcessesListType pPostProcesses=nullptr)
Default constructor.
Definition: residualbased_newton_raphson_contact_strategy.h:254
void CoutSplittingTime(const double AuxDeltaTime, const double AuxTime)
This method prints information after split the increment of time.
Definition: residualbased_newton_raphson_contact_strategy.h:1030
double SplitTimeStep(double &AuxDeltaTime, double &CurrentTime)
Here the time step is splitted.
Definition: residualbased_newton_raphson_contact_strategy.h:974
ResidualBasedNewtonRaphsonContactStrategy(ModelPart &rModelPart, typename TSchemeType::Pointer pScheme, typename TConvergenceCriteriaType::Pointer pNewConvergenceCriteria, typename TBuilderAndSolverType::Pointer pNewBuilderAndSolver, IndexType MaxIterations=30, bool CalculateReactions=false, bool ReformDofSetAtEachStep=false, bool MoveMeshFlag=false, Parameters ThisParameters=Parameters(R"({})"), ProcessesListType pMyProcesses=nullptr, ProcessesListType pPostProcesses=nullptr)
Default constructor.
Definition: residualbased_newton_raphson_contact_strategy.h:176
Parameters GetDefaultParameters() const override
This method returns the defaulr parameters in order to avoid code duplication.
Definition: residualbased_newton_raphson_contact_strategy.h:531
ResidualBasedNewtonRaphsonContactStrategy(ModelPart &rModelPart, typename TSchemeType::Pointer pScheme, typename TLinearSolver::Pointer pNewLinearSolver, typename TConvergenceCriteriaType::Pointer pNewConvergenceCriteria, IndexType MaxIterations=30, bool CalculateReactions=false, bool ReformDofSetAtEachStep=false, bool MoveMeshFlag=false, Parameters ThisParameters=Parameters(R"({})"), ProcessesListType pMyProcesses=nullptr, ProcessesListType pPostProcesses=nullptr)
Default constructor.
Definition: residualbased_newton_raphson_contact_strategy.h:215
KRATOS_CLASS_POINTER_DEFINITION(ResidualBasedNewtonRaphsonContactStrategy)
Pointer definition of ResidualBasedNewtonRaphsonContactStrategy.
This is the base Newton Raphson strategy.
Definition: residualbased_newton_raphson_strategy.h:66
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: residualbased_newton_raphson_strategy.h:97
TSparseSpace SparseSpaceType
Definition: residualbased_newton_raphson_strategy.h:85
TBuilderAndSolverType::Pointer GetBuilderAndSolver()
Get method for the builder and solver.
Definition: residualbased_newton_raphson_strategy.h:493
virtual void UpdateDatabase(TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb, const bool MoveMesh)
Here the database is updated.
Definition: residualbased_newton_raphson_strategy.h:1278
BaseType::TDataType TDataType
Definition: residualbased_newton_raphson_strategy.h:83
unsigned int mMaxIterationNumber
Definition: residualbased_newton_raphson_strategy.h:1261
TSchemeType::Pointer GetScheme()
Get method for the time scheme.
Definition: residualbased_newton_raphson_strategy.h:475
BaseType::TSystemVectorType TSystemVectorType
Definition: residualbased_newton_raphson_strategy.h:93
TSystemVectorPointerType mpb
The increment in the solution.
Definition: residualbased_newton_raphson_strategy.h:1237
TSystemMatrixPointerType mpA
The RHS vector of the system of equations.
Definition: residualbased_newton_raphson_strategy.h:1238
bool mCalculateReactionsFlag
Flag telling if it is needed or not to compute the reactions.
Definition: residualbased_newton_raphson_strategy.h:1253
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: residualbased_newton_raphson_strategy.h:1069
TSystemVectorPointerType mpDx
The pointer to the convergence criteria employed.
Definition: residualbased_newton_raphson_strategy.h:1236
bool SolveSolutionStep() override
Solves the current step. This function returns true if a solution has been found, false otherwise.
Definition: residualbased_newton_raphson_strategy.h:884
BaseType::TSchemeType TSchemeType
Definition: residualbased_newton_raphson_strategy.h:87
void Initialize() override
Initialization of member variables and prior operations.
Definition: residualbased_newton_raphson_strategy.h:672
void AssignSettings(const Parameters ThisParameters) override
This method assigns settings to member variables.
Definition: residualbased_newton_raphson_strategy.h:1351
void InitializeSolutionStep() override
Performs all the required operations that should be done (for each step) before solving the solution ...
Definition: residualbased_newton_raphson_strategy.h:781
BaseType::TBuilderAndSolverType TBuilderAndSolverType
Definition: residualbased_newton_raphson_strategy.h:81
BaseType::TSystemMatrixType TSystemMatrixType
Definition: residualbased_newton_raphson_strategy.h:91
bool GetKeepSystemConstantDuringIterations()
Get method for the flag mKeepSystemConstantDuringIterations.
Definition: residualbased_newton_raphson_strategy.h:1158
virtual void EchoInfo(const unsigned int IterationNumber)
This method returns the components of the system of equations depending of the echo level.
Definition: residualbased_newton_raphson_strategy.h:1298
TConvergenceCriteriaType::Pointer mpConvergenceCriteria
The pointer to the builder and solver employed.
Definition: residualbased_newton_raphson_strategy.h:1234
bool mInitializeWasPerformed
The maximum number of iterations, 30 by default.
Definition: residualbased_newton_raphson_strategy.h:1263
BaseType::TSystemVectorPointerType TSystemVectorPointerType
Definition: residualbased_newton_raphson_strategy.h:101
void FinalizeSolutionStep() override
Performs all the required operations that should be done (for each step) after solving the solution s...
Definition: residualbased_newton_raphson_strategy.h:848
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: residualbased_newton_raphson_strategy.h:95
BaseType::TSystemMatrixPointerType TSystemMatrixPointerType
Definition: residualbased_newton_raphson_strategy.h:99
BaseType::DofsArrayType DofsArrayType
Definition: residualbased_newton_raphson_strategy.h:89
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
Solving strategy base class This is the base class from which we will derive all the strategies (impl...
Definition: solving_strategy.h:64
ModelPart & GetModelPart()
Operations to get the pointer to the model.
Definition: solving_strategy.h:350
virtual Parameters ValidateAndAssignParameters(Parameters ThisParameters, const Parameters DefaultParameters) const
This method validate and assign default parameters.
Definition: solving_strategy.h:507
bool MoveMeshFlag()
This function returns the flag that says if the mesh is moved.
Definition: solving_strategy.h:290
int mEchoLevel
Definition: solving_strategy.h:485
virtual void MoveMesh()
This function is designed to move the mesh.
Definition: solving_strategy.h:330
static IndexType Size(VectorType const &rV)
return size of vector rV
Definition: ublas_space.h:190
This class implements a set of auxiliar, already parallelized, methods to perform some common tasks r...
Definition: variable_utils.h:63
void SetVariable(const TVarType &rVariable, const TDataType &rValue, NodesContainerType &rNodes, const unsigned int Step=0)
Sets the nodal value of a scalar variable.
Definition: variable_utils.h:675
#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_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_WATCH(variable)
Definition: define.h:806
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_WARNING(label)
Definition: logger.h:265
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
void block_for_each(TIterator itBegin, TIterator itEnd, TFunction &&rFunction)
Execute a functor on all items of a range in parallel.
Definition: parallel_utilities.h:299
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
int step
Definition: face_heat.py:88
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
A
Definition: sensitivityMatrix.py:70
integer i
Definition: TensorModule.f:17