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.
pfem_2_monolithic_slip_strategy.h
Go to the documentation of this file.
1 #ifndef KRATOS_PFEM2_MONOLITHIC_SLIP_STRATEGY_H
2 #define KRATOS_PFEM2_MONOLITHIC_SLIP_STRATEGY_H
3 
4 #include "includes/define.h"
5 #include "includes/model_part.h"
7 #include "processes/process.h"
10 //#include "custom_elements/fractional_step.h"
11 
17 
18 #include "custom_utilities/solver_settings.h"
19 
20 namespace Kratos {
21 
24 
27 
28 
32 
34 
35 
38 
39 
43 
44 
45 
49 
50 template<class TSparseSpace,
51 class TDenseSpace,
52 class TLinearSolver
53 >
54 class PFEM2MonolithicSlipStrategy : public ImplicitSolvingStrategy<TSparseSpace,TDenseSpace,TLinearSolver>
55 {
56 public:
59 
61  typedef boost::shared_ptr< FSStrategy<TSparseSpace, TDenseSpace, TLinearSolver> > Pointer;
62 
64 
65  typedef typename BaseType::TDataType TDataType;
66 
67  //typedef typename BaseType::DofSetType DofSetType;
68 
70 
72 
74 
76 
78 
80 
82 
86 
88  SolverSettingsType& rSolverConfig,
89  bool PredictorCorrector):
90  BaseType(rModelPart,false),
91  mrPeriodicIdVar(Kratos::Variable<int>::StaticObject())
92  {
93  InitializeStrategy(rSolverConfig,PredictorCorrector);
94  }
95 
97  SolverSettingsType& rSolverConfig,
98  bool PredictorCorrector,
99  const Kratos::Variable<int>& PeriodicVar):
100  BaseType(rModelPart,false),
101  mrPeriodicIdVar(PeriodicVar)
102  {
103  InitializeStrategy(rSolverConfig,PredictorCorrector);
104  }
105 
106 
108 self.time_scheme,
109 self.monolithic_linear_solver,
110 self.conv_criteria,
111 CalculateReactionFlag,
112 ReformDofSetAtEachStep,
114  self.monolithic_solver.SetMaximumIterations(self.maximum_nonlin_iterations)
115 
117  /*SolverConfiguration<TSparseSpace, TDenseSpace, TLinearSolver>& rSolverConfig,*/
118  typename TLinearSolver::Pointer pLinearSolver,
119  bool ReformDofSet = true,
120  double Tol = 0.01,
121  int MaxIterations = 3,
122  unsigned int DomainSize = 2):
123  BaseType(rModelPart,MoveMeshFlag), // Move Mesh flag, pass as input?
124  mVelocityTolerance(VelTol),
125  mPressureTolerance(PresTol),
126  mMaxVelocityIter(MaxVelocityIterations),
127  mMaxPressureIter(MaxPressureIterations),
129  mTimeOrder(TimeOrder),
130  mPredictorCorrector(PredictorCorrector),
131  mUseSlipConditions(true),
134  mrPeriodicIdVar(Kratos::Variable<int>::StaticObject())
135  {
136  KRATOS_TRY;
137 
139 
140  // Check that input parameters are reasonable and sufficient.
141  this->Check();
142 
143  bool CalculateReactions = false;
144  bool CalculateNormDxFlag = true;
145 
146  bool ReformDofAtEachIteration = false; // DofSet modifiaction is managed by the fractional step strategy, auxiliary strategies should not modify the DofSet directly.
147 
148  // Additional Typedefs
149  typedef typename Kratos::VariableComponent<Kratos::VectorComponentAdaptor<Kratos::array_1d<double, 3 > > > VarComponent;
150  typedef typename BuilderAndSolver<TSparseSpace, TDenseSpace, TLinearSolver>::Pointer BuilderSolverTypePointer;
152 
153  //initializing fractional velocity solution step
154  typedef Scheme< TSparseSpace, TDenseSpace > SchemeType;
155  typename SchemeType::Pointer pScheme;
156  if (mUseSlipConditions)
157  {
158  typename SchemeType::Pointer Temp = typename SchemeType::Pointer(new ResidualBasedIncrementalUpdateStaticSchemeSlip< TSparseSpace, TDenseSpace > (mDomainSize,mDomainSize));
159  pScheme.swap(Temp);
160  }
161  else
162  {
163  typename SchemeType::Pointer Temp = typename SchemeType::Pointer(new ResidualBasedIncrementalUpdateStaticScheme< TSparseSpace, TDenseSpace > ());
164  pScheme.swap(Temp);
165  }
166 
167  //CONSTRUCTION OF VELOCITY
168  // BuilderSolverTypePointer vel_build = BuilderSolverTypePointer(new ResidualBasedEliminationBuilderAndSolver<TSparseSpace, TDenseSpace, TLinearSolver > (pVelocityLinearSolver));
169 // BuilderSolverTypePointer vel_build = BuilderSolverTypePointer(new ResidualBasedEliminationBuilderAndSolverSlip<TSparseSpace, TDenseSpace, TLinearSolver, VarComponent > (pNewVelocityLinearSolver, this->mDomainSize, VELOCITY_X, VELOCITY_Y, VELOCITY_Z));
170  // this->mpMomentumStrategy = typename BaseType::Pointer(new ResidualBasedLinearStrategy<TSparseSpace, TDenseSpace, TLinearSolver > (rModelPart, pScheme, pVelocityLinearSolver, vel_build, CalculateReactions, ReformDofAtEachIteration, CalculateNormDxFlag));
171  this->mpMomentumStrategy = typename BaseType::Pointer(new ResidualBasedLinearStrategy<TSparseSpace, TDenseSpace, TLinearSolver > (rModelPart, pScheme, pVelocityLinearSolver, CalculateReactions, ReformDofAtEachIteration, CalculateNormDxFlag));
172  this->mpMomentumStrategy->SetEchoLevel( BaseType::GetEchoLevel() );
173 
174  // BuilderSolverTypePointer pressure_build = BuilderSolverTypePointer(
175  // //new ResidualBasedEliminationBuilderAndSolver<TSparseSpace,TDenseSpace,TLinearSolver>(pPressureLinearSolver));
176  // new ResidualBasedEliminationBuilderAndSolverComponentwise<TSparseSpace, TDenseSpace, TLinearSolver, Variable<double> >(pPressureLinearSolver, PRESSURE));
177 
178  // this->mpPressureStrategy = typename BaseType::Pointer(new ResidualBasedLinearStrategy<TSparseSpace, TDenseSpace, TLinearSolver > (rModelPart, pScheme, pPressureLinearSolver, pressure_build, CalculateReactions, ReformDofAtEachIteration, CalculateNormDxFlag));
179  this->mpPressureStrategy = typename BaseType::Pointer(new ResidualBasedLinearStrategy<TSparseSpace, TDenseSpace, TLinearSolver > (rModelPart, pScheme, pPressureLinearSolver, CalculateReactions, ReformDofAtEachIteration, CalculateNormDxFlag));
180  this->mpPressureStrategy->SetEchoLevel( BaseType::GetEchoLevel() );
181 
182  if (mUseSlipConditions)
183  {
184 #pragma omp parallel
185  {
188  OpenMPUtils::PartitionedIterators(rModelPart.Conditions(),CondBegin,CondEnd);
189 
190  for (ModelPart::ConditionIterator itCond = CondBegin; itCond != CondEnd; ++itCond)
191  {
192  const double FlagValue = itCond->GetValue(IS_STRUCTURE);
193  itCond->Set(SLIP);
194  if (FlagValue != 0.0)
195  {
196 
197  Condition::GeometryType& rGeom = itCond->GetGeometry();
198  for (unsigned int i = 0; i < rGeom.PointsNumber(); ++i)
199  {
200  rGeom[i].SetLock();
201  rGeom[i].SetValue(IS_STRUCTURE,FlagValue);
202  rGeom[i].Set(SLIP);
203  rGeom[i].UnSetLock();
204  }
205  }
206  }
207  }
208  rModelPart.GetCommunicator().AssembleNonHistoricalData(IS_STRUCTURE);
209  rModelPart.GetCommunicator().SynchronizeOrNodalFlags(SLIP);
210  }
211 
212 
213  KRATOS_CATCH("");
214  }
215 
217  virtual ~FSStrategy(){}
218 
222 
223 
227 
228  virtual int Check()
229  {
230  KRATOS_TRY;
231 
232  // Check elements and conditions in the model part
233  int ierr = BaseType::Check();
234  if (ierr != 0) return ierr;
235 
236  if(DELTA_TIME.Key() == 0)
237  KRATOS_THROW_ERROR(std::runtime_error,"DELTA_TIME Key is 0. Check that the application was correctly registered.","");
238  if(BDF_COEFFICIENTS.Key() == 0)
239  KRATOS_THROW_ERROR(std::runtime_error,"BDF_COEFFICIENTS Key is 0. Check that the application was correctly registered.","");
240 
241  ModelPart& rModelPart = BaseType::GetModelPart();
242 
243  if ( mTimeOrder == 2 && rModelPart.GetBufferSize() < 3 )
244  KRATOS_THROW_ERROR(std::invalid_argument,"Buffer size too small for fractional step strategy (BDF2), needed 3, got ",rModelPart.GetBufferSize());
245  if ( mTimeOrder == 1 && rModelPart.GetBufferSize() < 2 )
246  KRATOS_THROW_ERROR(std::invalid_argument,"Buffer size too small for fractional step strategy (Backward Euler), needed 2, got ",rModelPart.GetBufferSize());
247 
248  const ProcessInfo& rCurrentProcessInfo = rModelPart.GetProcessInfo();
249 
250  for ( ModelPart::ElementIterator itEl = rModelPart.ElementsBegin(); itEl != rModelPart.ElementsEnd(); ++itEl )
251  {
252  ierr = itEl->Check(rCurrentProcessInfo);
253  if (ierr != 0) break;
254  }
255 
256  for ( ModelPart::ConditionIterator itCond = rModelPart.ConditionsBegin(); itCond != rModelPart.ConditionsEnd(); ++itCond)
257  {
258  ierr = itCond->Check(rCurrentProcessInfo);
259  if (ierr != 0) break;
260  }
261 
262  return ierr;
263 
264  KRATOS_CATCH("");
265  }
266 
267  virtual double Solve()
268  {
269  // Initialize BDF2 coefficients
270  ModelPart& rModelPart = BaseType::GetModelPart();
271  this->SetTimeCoefficients(rModelPart.GetProcessInfo());
272 
273  double NormDp = 0.0;
274 
276  {
277  bool Converged = false;
278 
279  // Iterative solution for pressure
280  for(unsigned int it = 0; it < mMaxPressureIter; ++it)
281  {
282  if ( BaseType::GetEchoLevel() > 1 && rModelPart.GetCommunicator().MyPID() == 0)
283  std::cout << "Pressure iteration " << it << std::endl;
284 
285  NormDp = this->SolveStep();
286 
287  Converged = this->CheckPressureConvergence(NormDp);
288 
289  if ( Converged )
290  {
291  if ( BaseType::GetEchoLevel() > 0 && rModelPart.GetCommunicator().MyPID() == 0)
292  std::cout << "Predictor-corrector converged in " << it+1 << " iterations." << std::endl;
293  break;
294  }
295  }
296  if (!Converged && BaseType::GetEchoLevel() > 0 && rModelPart.GetCommunicator().MyPID() == 0)
297  std::cout << "Predictor-correctior iterations did not converge." << std::endl;
298 
299  }
300  else
301  {
302  // Solve for fractional step velocity, then update pressure once
303  NormDp = this->SolveStep();
304  }
305 
306  if (mReformDofSet)
307  this->Clear();
308 
309  return NormDp;
310  }
311 
312 
313  virtual void CalculateReactions()
314  {
315  ModelPart& rModelPart = BaseType::GetModelPart();
316  ProcessInfo& rCurrentProcessInfo = rModelPart.GetProcessInfo();
317 
318  // Set fractional step index to the momentum equation step
319  int OriginalStep = rCurrentProcessInfo[FRACTIONAL_STEP];
320  rCurrentProcessInfo.SetValue(FRACTIONAL_STEP,1);
321 
322 #pragma omp parallel
323  {
324  ModelPart::NodeIterator NodesBegin;
325  ModelPart::NodeIterator NodesEnd;
326  OpenMPUtils::PartitionedIterators(rModelPart.Nodes(),NodesBegin,NodesEnd);
327 
328  const array_1d<double,3> Zero(3,0.0);
329 
330  for (ModelPart::NodeIterator itNode = NodesBegin; itNode != NodesEnd; ++itNode)
331  {
332  itNode->FastGetSolutionStepValue(REACTION) = Zero;
333  }
334  }
335 
336 #pragma omp parallel
337  {
338  ModelPart::ElementIterator ElemBegin;
340  OpenMPUtils::PartitionedIterators(rModelPart.Elements(),ElemBegin,ElemEnd);
341 
342  LocalSystemVectorType RHS_Contribution;
343  LocalSystemMatrixType LHS_Contribution;
344 
345  for (ModelPart::ElementIterator itElem = ElemBegin; itElem != ElemEnd; ++itElem)
346  {
347 
348 
349  // Build local system
350  itElem->CalculateLocalSystem(LHS_Contribution, RHS_Contribution, rCurrentProcessInfo);
351 
352  Element::GeometryType& rGeom = itElem->GetGeometry();
353  unsigned int NumNodes = rGeom.PointsNumber();
354  unsigned int index = 0;
355 
356  for (unsigned int i = 0; i < NumNodes; i++)
357  {
358  rGeom[i].SetLock();
359  array_1d<double,3>& rReaction = rGeom[i].FastGetSolutionStepValue(REACTION);
360  for (unsigned int d = 0; d < mDomainSize; ++d)
361  rReaction[d] -= RHS_Contribution[index++];
362  rGeom[i].UnSetLock();
363  }
364  }
365  }
366 
367  rModelPart.GetCommunicator().AssembleCurrentData(REACTION);
368 
369  // Reset original fractional step index
370  rCurrentProcessInfo.SetValue(FRACTIONAL_STEP,OriginalStep);
371  }
372 
373  virtual void AddIterationStep(Process::Pointer pNewStep)
374  {
375  mExtraIterationSteps.push_back(pNewStep);
376  }
377 
378  virtual void ClearExtraIterationSteps()
379  {
380  mExtraIterationSteps.clear();
381  }
382 
383  virtual void Clear()
384  {
385  mpMomentumStrategy->Clear();
386  mpPressureStrategy->Clear();
387  }
388 
389 
393 
394  virtual void SetEchoLevel(int Level)
395  {
396  BaseType::SetEchoLevel(Level);
397  int StrategyLevel = Level > 0 ? Level - 1 : 0;
398  mpMomentumStrategy->SetEchoLevel(StrategyLevel);
399  mpPressureStrategy->SetEchoLevel(StrategyLevel);
400  }
401 
402 
406 
407 
411 
413  virtual std::string Info() const
414  {
415  std::stringstream buffer;
416  buffer << "FSStrategy" ;
417  return buffer.str();
418  }
419 
421  virtual void PrintInfo(std::ostream& rOStream) const {rOStream << "FSStrategy";}
422 
424  virtual void PrintData(std::ostream& rOStream) const {}
425 
426 
430 
431 
433 
434 protected:
435 
438 
439 
443 
444 
448 
449 
453 
454 
458 
459 
461 
464  void SetTimeCoefficients(ProcessInfo& rCurrentProcessInfo)
465  {
466  KRATOS_TRY;
467 
468  if (mTimeOrder == 2)
469  {
470  //calculate the BDF coefficients
471  double Dt = rCurrentProcessInfo[DELTA_TIME];
472  double OldDt = rCurrentProcessInfo.GetPreviousTimeStepInfo(1)[DELTA_TIME];
473 
474  double Rho = OldDt / Dt;
475  double TimeCoeff = 1.0 / (Dt * Rho * Rho + Dt * Rho);
476 
477  Vector& BDFcoeffs = rCurrentProcessInfo[BDF_COEFFICIENTS];
478  BDFcoeffs.resize(3, false);
479 
480  BDFcoeffs[0] = TimeCoeff * (Rho * Rho + 2.0 * Rho); //coefficient for step n+1 (3/2Dt if Dt is constant)
481  BDFcoeffs[1] = -TimeCoeff * (Rho * Rho + 2.0 * Rho + 1.0); //coefficient for step n (-4/2Dt if Dt is constant)
482  BDFcoeffs[2] = TimeCoeff; //coefficient for step n-1 (1/2Dt if Dt is constant)
483  }
484  else if (mTimeOrder == 1)
485  {
486  double Dt = rCurrentProcessInfo[DELTA_TIME];
487  double TimeCoeff = 1.0 / Dt;
488 
489  Vector& BDFcoeffs = rCurrentProcessInfo[BDF_COEFFICIENTS];
490  BDFcoeffs.resize(2, false);
491 
492  BDFcoeffs[0] = TimeCoeff; //coefficient for step n+1 (1/Dt)
493  BDFcoeffs[1] = -TimeCoeff; //coefficient for step n (-1/Dt)
494  }
495 
496  KRATOS_CATCH("");
497  }
498 
499  double SolveStep()
500  {
501  ModelPart& rModelPart = BaseType::GetModelPart();
502 
503  // 1. Fractional step momentum iteration
504  rModelPart.GetProcessInfo().SetValue(FRACTIONAL_STEP,1);
505 
506  bool Converged = false;
507  int Rank = rModelPart.GetCommunicator().MyPID();
508 
509  for(unsigned int it = 0; it < mMaxVelocityIter; ++it)
510  {
511  if ( BaseType::GetEchoLevel() > 1 && Rank == 0)
512  std::cout << "Momentum iteration " << it << std::endl;
513 
514  // build momentum system and solve for fractional step velocity increment
515  rModelPart.GetProcessInfo().SetValue(FRACTIONAL_STEP,1);
516  double NormDv = mpMomentumStrategy->Solve();
517 
518 // // Compute projections (for stabilization)
519 // rModelPart.GetProcessInfo().SetValue(FRACTIONAL_STEP,4);
520 // this->ComputeSplitOssProjections(rModelPart);
521 
522 // // Additional steps // Moved to end of step
523 // for (std::vector<Process::Pointer>::iterator iExtraSteps = mExtraIterationSteps.begin();
524 // iExtraSteps != mExtraIterationSteps.end(); ++iExtraSteps)
525 // (*iExtraSteps)->Execute();
526 
527  // Check convergence
528  Converged = this->CheckFractionalStepConvergence(NormDv);
529 
530  if (Converged)
531  {
532  if ( BaseType::GetEchoLevel() > 0 && Rank == 0)
533  std::cout << "Fractional velocity converged in " << it+1 << " iterations." << std::endl;
534  break;
535  }
536  }
537 
538  if (!Converged && BaseType::GetEchoLevel() > 0 && Rank == 0)
539  std::cout << "Fractional velocity iterations did not converge." << std::endl;
540 
541  // Compute projections (for stabilization)
542  rModelPart.GetProcessInfo().SetValue(FRACTIONAL_STEP,4);
543  this->ComputeSplitOssProjections(rModelPart);
544 
545  // 2. Pressure solution (store pressure variation in PRESSURE_OLD_IT)
546  rModelPart.GetProcessInfo().SetValue(FRACTIONAL_STEP,5);
547 
548 #pragma omp parallel
549  {
550  ModelPart::NodeIterator NodesBegin;
551  ModelPart::NodeIterator NodesEnd;
552  OpenMPUtils::PartitionedIterators(rModelPart.Nodes(),NodesBegin,NodesEnd);
553 
554  for (ModelPart::NodeIterator itNode = NodesBegin; itNode != NodesEnd; ++itNode)
555  {
556  const double OldPress = itNode->FastGetSolutionStepValue(PRESSURE);
557  itNode->FastGetSolutionStepValue(PRESSURE_OLD_IT) = -OldPress;
558  }
559  }
560 
561  if (BaseType::GetEchoLevel() > 0 && Rank == 0)
562  std::cout << "Calculating Pressure." << std::endl;
563  double NormDp = mpPressureStrategy->Solve();
564 
565 #pragma omp parallel
566  {
567  ModelPart::NodeIterator NodesBegin;
568  ModelPart::NodeIterator NodesEnd;
569  OpenMPUtils::PartitionedIterators(rModelPart.Nodes(),NodesBegin,NodesEnd);
570 
571  for (ModelPart::NodeIterator itNode = NodesBegin; itNode != NodesEnd; ++itNode)
572  itNode->FastGetSolutionStepValue(PRESSURE_OLD_IT) += itNode->FastGetSolutionStepValue(PRESSURE);
573  }
574 
575  // 3. Compute end-of-step velocity
576  if (BaseType::GetEchoLevel() > 0 && Rank == 0)
577  std::cout << "Updating Velocity." << std::endl;
578  rModelPart.GetProcessInfo().SetValue(FRACTIONAL_STEP,6);
579 
580  this->CalculateEndOfStepVelocity();
581 
582  // Additional steps
583  for (std::vector<Process::Pointer>::iterator iExtraSteps = mExtraIterationSteps.begin();
584  iExtraSteps != mExtraIterationSteps.end(); ++iExtraSteps)
585  (*iExtraSteps)->Execute();
586 
587 
588  return NormDp;
589  }
590 
591  bool CheckFractionalStepConvergence(const double NormDv)
592  {
593  ModelPart& rModelPart = BaseType::GetModelPart();
594 
595  double NormV = 0.00;
596 
597 #pragma omp parallel reduction(+:NormV)
598  {
599  ModelPart::NodeIterator NodeBegin;
600  ModelPart::NodeIterator NodeEnd;
601  OpenMPUtils::PartitionedIterators(rModelPart.Nodes(),NodeBegin,NodeEnd);
602 
603  for (ModelPart::NodeIterator itNode = NodeBegin; itNode != NodeEnd; ++itNode)
604  {
605  const array_1d<double,3> &Vel = itNode->FastGetSolutionStepValue(VELOCITY);
606 
607  for (unsigned int d = 0; d < 3; ++d)
608  NormV += Vel[d] * Vel[d];
609  }
610  }
611 
612  BaseType::GetModelPart().GetCommunicator().SumAll(NormV);
613 
614  NormV = sqrt(NormV);
615 
616  if (NormV == 0.0) NormV = 1.00;
617 
618  double Ratio = NormDv / NormV;
619 
620  if ( BaseType::GetEchoLevel() > 0 && rModelPart.GetCommunicator().MyPID() == 0)
621  std::cout << "Fractional velocity relative error: " << Ratio << std::endl;
622 
623  if (Ratio < mVelocityTolerance)
624  {
625  return true;
626  }
627  else
628  return false;
629  }
630 
631  bool CheckPressureConvergence(const double NormDp)
632  {
633  ModelPart& rModelPart = BaseType::GetModelPart();
634 
635  double NormP = 0.00;
636 
637 #pragma omp parallel reduction(+:NormP)
638  {
639  ModelPart::NodeIterator NodeBegin;
640  ModelPart::NodeIterator NodeEnd;
641  OpenMPUtils::PartitionedIterators(rModelPart.Nodes(),NodeBegin,NodeEnd);
642 
643  for (ModelPart::NodeIterator itNode = NodeBegin; itNode != NodeEnd; ++itNode)
644  {
645  const double Pr = itNode->FastGetSolutionStepValue(PRESSURE);
646  NormP += Pr * Pr;
647  }
648  }
649 
650  BaseType::GetModelPart().GetCommunicator().SumAll(NormP);
651 
652  NormP = sqrt(NormP);
653 
654  if (NormP == 0.0) NormP = 1.00;
655 
656  double Ratio = NormDp / NormP;
657 
658  if ( BaseType::GetEchoLevel() > 0 && rModelPart.GetCommunicator().MyPID() == 0)
659  std::cout << "Pressure relative error: " << Ratio << std::endl;
660 
661  if (Ratio < mPressureTolerance)
662  {
663  return true;
664  }
665  else
666  return false;
667  }
668 
669 
670  void ComputeSplitOssProjections(ModelPart& rModelPart)
671  {
672  const array_1d<double,3> Zero(3,0.0);
673 
674  array_1d<double,3> Out(3,0.0);
675 
676 #pragma omp parallel
677  {
678  ModelPart::NodeIterator NodesBegin;
679  ModelPart::NodeIterator NodesEnd;
680  OpenMPUtils::PartitionedIterators(rModelPart.Nodes(),NodesBegin,NodesEnd);
681 
682  for ( ModelPart::NodeIterator itNode = NodesBegin; itNode != NodesEnd; ++itNode )
683  {
684  itNode->FastGetSolutionStepValue(CONV_PROJ) = Zero;
685  itNode->FastGetSolutionStepValue(PRESS_PROJ) = Zero;
686  itNode->FastGetSolutionStepValue(DIVPROJ) = 0.0;
687  itNode->FastGetSolutionStepValue(NODAL_AREA) = 0.0;
688  }
689  }
690 
691 #pragma omp parallel
692  {
693  ModelPart::ElementIterator ElemBegin;
695  OpenMPUtils::PartitionedIterators(rModelPart.Elements(),ElemBegin,ElemEnd);
696 
697  for ( ModelPart::ElementIterator itElem = ElemBegin; itElem != ElemEnd; ++itElem )
698  {
699  itElem->Calculate(CONV_PROJ,Out,rModelPart.GetProcessInfo());
700  }
701  }
702 
703  rModelPart.GetCommunicator().AssembleCurrentData(CONV_PROJ);
704  rModelPart.GetCommunicator().AssembleCurrentData(PRESS_PROJ);
705  rModelPart.GetCommunicator().AssembleCurrentData(DIVPROJ);
706  rModelPart.GetCommunicator().AssembleCurrentData(NODAL_AREA);
707 
708  // If there are periodic conditions, add contributions from both sides to the periodic nodes
709  this->PeriodicConditionProjectionCorrection(rModelPart);
710 
711 #pragma omp parallel
712  {
713  ModelPart::NodeIterator NodesBegin;
714  ModelPart::NodeIterator NodesEnd;
715  OpenMPUtils::PartitionedIterators(rModelPart.Nodes(),NodesBegin,NodesEnd);
716 
717  for ( ModelPart::NodeIterator itNode = NodesBegin; itNode != NodesEnd; ++itNode )
718  {
719  const double NodalArea = itNode->FastGetSolutionStepValue(NODAL_AREA);
720  itNode->FastGetSolutionStepValue(CONV_PROJ) /= NodalArea;
721  itNode->FastGetSolutionStepValue(PRESS_PROJ) /= NodalArea;
722  itNode->FastGetSolutionStepValue(DIVPROJ) /= NodalArea;
723  }
724  }
725  }
726 
727  void CalculateEndOfStepVelocity()
728  {
729  ModelPart& rModelPart = BaseType::GetModelPart();
730 
731  const array_1d<double,3> Zero(3,0.0);
732  array_1d<double,3> Out(3,0.0);
733 
734 #pragma omp parallel
735  {
736  ModelPart::NodeIterator NodesBegin;
737  ModelPart::NodeIterator NodesEnd;
738  OpenMPUtils::PartitionedIterators(rModelPart.Nodes(),NodesBegin,NodesEnd);
739 
740  for ( ModelPart::NodeIterator itNode = NodesBegin; itNode != NodesEnd; ++itNode )
741  {
742  itNode->FastGetSolutionStepValue(FRACT_VEL) = Zero;
743  }
744  }
745 
746 #pragma omp parallel
747  {
748  ModelPart::ElementIterator ElemBegin;
750  OpenMPUtils::PartitionedIterators(rModelPart.Elements(),ElemBegin,ElemEnd);
751 
752  for ( ModelPart::ElementIterator itElem = ElemBegin; itElem != ElemEnd; ++itElem )
753  {
754  itElem->Calculate(VELOCITY,Out,rModelPart.GetProcessInfo());
755  }
756  }
757 
758  rModelPart.GetCommunicator().AssembleCurrentData(FRACT_VEL);
759  this->PeriodicConditionVelocityCorrection(rModelPart);
760 
761  // Force the end of step velocity to verify slip conditions in the model
762  if (mUseSlipConditions)
763  this->EnforceSlipCondition(SLIP);
764 
765  if (mDomainSize > 2)
766  {
767 #pragma omp parallel
768  {
769  ModelPart::NodeIterator NodesBegin;
770  ModelPart::NodeIterator NodesEnd;
771  OpenMPUtils::PartitionedIterators(rModelPart.Nodes(),NodesBegin,NodesEnd);
772 
773  for ( ModelPart::NodeIterator itNode = NodesBegin; itNode != NodesEnd; ++itNode )
774  {
775  const double NodalArea = itNode->FastGetSolutionStepValue(NODAL_AREA);
776  if ( ! itNode->IsFixed(VELOCITY_X) )
777  itNode->FastGetSolutionStepValue(VELOCITY_X) += itNode->FastGetSolutionStepValue(FRACT_VEL_X) / NodalArea;
778  if ( ! itNode->IsFixed(VELOCITY_Y) )
779  itNode->FastGetSolutionStepValue(VELOCITY_Y) += itNode->FastGetSolutionStepValue(FRACT_VEL_Y) / NodalArea;
780  if ( ! itNode->IsFixed(VELOCITY_Z) )
781  itNode->FastGetSolutionStepValue(VELOCITY_Z) += itNode->FastGetSolutionStepValue(FRACT_VEL_Z) / NodalArea;
782  }
783  }
784  }
785  else
786  {
787 #pragma omp parallel
788  {
789  ModelPart::NodeIterator NodesBegin;
790  ModelPart::NodeIterator NodesEnd;
791  OpenMPUtils::PartitionedIterators(rModelPart.Nodes(),NodesBegin,NodesEnd);
792 
793  for ( ModelPart::NodeIterator itNode = NodesBegin; itNode != NodesEnd; ++itNode )
794  {
795  const double NodalArea = itNode->FastGetSolutionStepValue(NODAL_AREA);
796  if ( ! itNode->IsFixed(VELOCITY_X) )
797  itNode->FastGetSolutionStepValue(VELOCITY_X) += itNode->FastGetSolutionStepValue(FRACT_VEL_X) / NodalArea;
798  if ( ! itNode->IsFixed(VELOCITY_Y) )
799  itNode->FastGetSolutionStepValue(VELOCITY_Y) += itNode->FastGetSolutionStepValue(FRACT_VEL_Y) / NodalArea;
800  }
801  }
802  }
803  }
804 
809  void EnforceSlipCondition(const Kratos::Flags& rSlipWallFlag)
810  {
811  ModelPart& rModelPart = BaseType::GetModelPart();
812 
813 #pragma omp parallel
814  {
815  ModelPart::NodeIterator NodeBegin; // = rModelPart.NodesBegin();
816  ModelPart::NodeIterator NodeEnd; // = rModelPart.NodesEnd();
817  OpenMPUtils::PartitionedIterators(rModelPart.Nodes(),NodeBegin,NodeEnd);
818 
819  for ( ModelPart::NodeIterator itNode = NodeBegin; itNode != NodeEnd; ++itNode )
820  {
821  if ( itNode->Is(rSlipWallFlag) )
822  {
823  const array_1d<double,3>& rNormal = itNode->FastGetSolutionStepValue(NORMAL);
824  array_1d<double,3>& rDeltaVelocity = itNode->FastGetSolutionStepValue(FRACT_VEL);
825 
826  double Proj = rNormal[0] * rDeltaVelocity[0];
827  double Norm = rNormal[0] * rNormal[0];
828 
829  for (unsigned int d = 1; d < mDomainSize; ++d)
830  {
831  Proj += rNormal[d] * rDeltaVelocity[d];
832  Norm += rNormal[d] * rNormal[d];
833  }
834 
835  Proj /= Norm;
836  rDeltaVelocity -= Proj * rNormal;
837  }
838  }
839  }
840  }
841 
848  void PeriodicConditionProjectionCorrection(ModelPart& rModelPart)
849  {
850  if (mrPeriodicIdVar.Key() != 0)
851  {
852  int GlobalNodesNum = rModelPart.GetCommunicator().LocalMesh().Nodes().size();
853  rModelPart.GetCommunicator().SumAll(GlobalNodesNum);
854 
855  for (typename ModelPart::ConditionIterator itCond = rModelPart.ConditionsBegin(); itCond != rModelPart.ConditionsEnd(); itCond++ )
856  {
857  ModelPart::ConditionType::GeometryType& rGeom = itCond->GetGeometry();
858  if (rGeom.PointsNumber() == 2)
859  {
860  Node& rNode0 = rGeom[0];
861  int Node0Pair = rNode0.FastGetSolutionStepValue(mrPeriodicIdVar);
862 
863  Node& rNode1 = rGeom[1];
864  int Node1Pair = rNode1.FastGetSolutionStepValue(mrPeriodicIdVar);
865 
866  // If the nodes are marked as a periodic pair (this is to avoid acting on two-noded conditions that are not PeriodicCondition)
867  if ( ( static_cast<int>(rNode0.Id()) == Node1Pair ) && (static_cast<int>(rNode1.Id()) == Node0Pair ) )
868  {
869  double NodalArea = rNode0.FastGetSolutionStepValue(NODAL_AREA) + rNode1.FastGetSolutionStepValue(NODAL_AREA);
870  array_1d<double,3> ConvProj = rNode0.FastGetSolutionStepValue(CONV_PROJ) + rNode1.FastGetSolutionStepValue(CONV_PROJ);
871  array_1d<double,3> PressProj = rNode0.FastGetSolutionStepValue(PRESS_PROJ) + rNode1.FastGetSolutionStepValue(PRESS_PROJ);
872  double DivProj = rNode0.FastGetSolutionStepValue(DIVPROJ) + rNode1.FastGetSolutionStepValue(DIVPROJ);
873 
874  rNode0.GetValue(NODAL_AREA) = NodalArea;
875  rNode0.GetValue(CONV_PROJ) = ConvProj;
876  rNode0.GetValue(PRESS_PROJ) = PressProj;
877  rNode0.GetValue(DIVPROJ) = DivProj;
878  rNode1.GetValue(NODAL_AREA) = NodalArea;
879  rNode1.GetValue(CONV_PROJ) = ConvProj;
880  rNode1.GetValue(PRESS_PROJ) = PressProj;
881  rNode1.GetValue(DIVPROJ) = DivProj;
882  }
883  }
884  else if (rGeom.PointsNumber() == 4 && rGeom[0].FastGetSolutionStepValue(mrPeriodicIdVar) > GlobalNodesNum)
885  {
886  double NodalArea = rGeom[0].FastGetSolutionStepValue(NODAL_AREA);
887  array_1d<double,3> ConvProj = rGeom[0].FastGetSolutionStepValue(CONV_PROJ);
888  array_1d<double,3> PressProj = rGeom[0].FastGetSolutionStepValue(PRESS_PROJ);
889  double DivProj = rGeom[0].FastGetSolutionStepValue(DIVPROJ);
890 
891  for (unsigned int i = 1; i < 4; i++)
892  {
893  NodalArea += rGeom[i].FastGetSolutionStepValue(NODAL_AREA);
894  ConvProj += rGeom[i].FastGetSolutionStepValue(CONV_PROJ);
895  PressProj += rGeom[i].FastGetSolutionStepValue(PRESS_PROJ);
896  DivProj += rGeom[i].FastGetSolutionStepValue(DIVPROJ);
897  }
898 
899  for (unsigned int i = 0; i < 4; i++)
900  {
901  rGeom[i].GetValue(NODAL_AREA) = NodalArea;
902  rGeom[i].GetValue(CONV_PROJ) = ConvProj;
903  rGeom[i].GetValue(PRESS_PROJ) = PressProj;
904  rGeom[i].GetValue(DIVPROJ) = DivProj;
905  }
906  }
907  }
908 
909  rModelPart.GetCommunicator().AssembleNonHistoricalData(NODAL_AREA);
910  rModelPart.GetCommunicator().AssembleNonHistoricalData(CONV_PROJ);
911  rModelPart.GetCommunicator().AssembleNonHistoricalData(PRESS_PROJ);
912  rModelPart.GetCommunicator().AssembleNonHistoricalData(DIVPROJ);
913 
914  for (typename ModelPart::NodeIterator itNode = rModelPart.NodesBegin(); itNode != rModelPart.NodesEnd(); itNode++)
915  {
916  if (itNode->GetValue(NODAL_AREA) != 0.0)
917  {
918  itNode->FastGetSolutionStepValue(NODAL_AREA) = itNode->GetValue(NODAL_AREA);
919  itNode->FastGetSolutionStepValue(CONV_PROJ) = itNode->GetValue(CONV_PROJ);
920  itNode->FastGetSolutionStepValue(PRESS_PROJ) = itNode->GetValue(PRESS_PROJ);
921  itNode->FastGetSolutionStepValue(DIVPROJ) = itNode->GetValue(DIVPROJ);
922 
923  // reset for next iteration
924  itNode->GetValue(NODAL_AREA) = 0.0;
925  itNode->GetValue(CONV_PROJ) = array_1d<double,3>(3,0.0);
926  itNode->GetValue(PRESS_PROJ) = array_1d<double,3>(3,0.0);
927  itNode->GetValue(DIVPROJ) = 0.0;
928  }
929  }
930  }
931  }
932 
933  void PeriodicConditionVelocityCorrection(ModelPart& rModelPart)
934  {
935  if (mrPeriodicIdVar.Key() != 0)
936  {
937  int GlobalNodesNum = rModelPart.GetCommunicator().LocalMesh().Nodes().size();
938  rModelPart.GetCommunicator().SumAll(GlobalNodesNum);
939 
940  for (typename ModelPart::ConditionIterator itCond = rModelPart.ConditionsBegin(); itCond != rModelPart.ConditionsEnd(); itCond++ )
941  {
942  ModelPart::ConditionType::GeometryType& rGeom = itCond->GetGeometry();
943  if (rGeom.PointsNumber() == 2)
944  {
945  Node& rNode0 = rGeom[0];
946  int Node0Pair = rNode0.FastGetSolutionStepValue(mrPeriodicIdVar);
947 
948  Node& rNode1 = rGeom[1];
949  int Node1Pair = rNode1.FastGetSolutionStepValue(mrPeriodicIdVar);
950 
951  // If the nodes are marked as a periodic pair (this is to avoid acting on two-noded conditions that are not PeriodicCondition)
952  if ( ( static_cast<int>(rNode0.Id()) == Node1Pair ) && (static_cast<int>(rNode1.Id()) == Node0Pair ) )
953  {
954  array_1d<double,3> DeltaVel = rNode0.FastGetSolutionStepValue(FRACT_VEL) + rNode1.FastGetSolutionStepValue(FRACT_VEL);
955 
956  rNode0.GetValue(FRACT_VEL) = DeltaVel;
957  rNode1.GetValue(FRACT_VEL) = DeltaVel;
958  }
959  }
960  else if (rGeom.PointsNumber() == 4 && rGeom[0].FastGetSolutionStepValue(mrPeriodicIdVar) > GlobalNodesNum)
961  {
962  array_1d<double,3> DeltaVel = rGeom[0].FastGetSolutionStepValue(FRACT_VEL);
963  for (unsigned int i = 1; i < 4; i++)
964  {
965  DeltaVel += rGeom[i].FastGetSolutionStepValue(FRACT_VEL);
966  }
967 
968  for (unsigned int i = 0; i < 4; i++)
969  {
970  rGeom[i].GetValue(FRACT_VEL) = DeltaVel;
971  }
972  }
973  }
974 
975  rModelPart.GetCommunicator().AssembleNonHistoricalData(FRACT_VEL);
976 
977  for (typename ModelPart::NodeIterator itNode = rModelPart.NodesBegin(); itNode != rModelPart.NodesEnd(); itNode++)
978  {
979  array_1d<double,3>& rDeltaVel = itNode->GetValue(FRACT_VEL);
980  if ( rDeltaVel[0]*rDeltaVel[0] + rDeltaVel[1]*rDeltaVel[1] + rDeltaVel[2]*rDeltaVel[2] != 0.0)
981  {
982  itNode->FastGetSolutionStepValue(FRACT_VEL) = itNode->GetValue(FRACT_VEL);
983  rDeltaVel = array_1d<double,3>(3,0.0);
984  }
985  }
986  }
987  }
988 
989 
993 
994 
998 
999 
1003 
1004 
1006 
1007 private:
1010 
1011 
1015 
1016  double mVelocityTolerance;
1017 
1019 
1020  unsigned int mMaxVelocityIter;
1021 
1022  unsigned int mMaxPressureIter;
1023 
1024  unsigned int mDomainSize;
1025 
1026  unsigned int mTimeOrder;
1027 
1029 
1031 
1033 
1034  // Fractional step index.
1035  /* 1 : Momentum step (calculate fractional step velocity)
1036  * 2-3 : Unused (reserved for componentwise calculation of frac step velocity)
1037  * 4 : Pressure step
1038  * 5 : Computation of projections
1039  * 6 : End of step velocity
1040  */
1041 // unsigned int mStepId;
1042 
1045 
1048 
1049  std::vector< Process::Pointer > mExtraIterationSteps;
1050 
1052 
1056 
1057 
1061 
1062 
1064  bool PredictorCorrector)
1065  {
1066  KRATOS_TRY;
1067 
1068  mTimeOrder = rSolverConfig.GetTimeOrder();
1069 
1070  // Check that input parameters are reasonable and sufficient.
1071  this->Check();
1072 
1073  ModelPart& rModelPart = this->GetModelPart();
1074 
1075  mDomainSize = rSolverConfig.GetDomainSize();
1076 
1077  mPredictorCorrector = PredictorCorrector;
1078 
1079  mUseSlipConditions = rSolverConfig.UseSlipConditions();
1080 
1081  mReformDofSet = rSolverConfig.GetReformDofSet();
1082 
1083  BaseType::SetEchoLevel(rSolverConfig.GetEchoLevel());
1084 
1085  // Initialize strategies for each step
1086  bool HaveVelStrategy = rSolverConfig.FindStrategy(SolverSettingsType::Velocity,mpMomentumStrategy);
1087 
1088  if (HaveVelStrategy)
1089  {
1090  rSolverConfig.FindTolerance(SolverSettingsType::Velocity,mVelocityTolerance);
1092  }
1093  else
1094  {
1095  KRATOS_THROW_ERROR(std::runtime_error,"FS_Strategy error: No Velocity strategy defined in FractionalStepSettings","");
1096  }
1097 
1098  bool HavePressStrategy = rSolverConfig.FindStrategy(SolverSettingsType::Pressure,mpPressureStrategy);
1099 
1100  if (HavePressStrategy)
1101  {
1104  }
1105  else
1106  {
1107  KRATOS_THROW_ERROR(std::runtime_error,"FS_Strategy error: No Pressure strategy defined in FractionalStepSettings","");
1108  }
1109 
1110  Process::Pointer pTurbulenceProcess;
1111  bool HaveTurbulence = rSolverConfig.GetTurbulenceModel(pTurbulenceProcess);
1112 
1113  if (HaveTurbulence)
1114  mExtraIterationSteps.push_back(pTurbulenceProcess);
1115 
1116  // Set up nodes to use slip conditions if needed.
1117  if (mUseSlipConditions)
1118  {
1119 #pragma omp parallel
1120  {
1121  ModelPart::ConditionIterator CondBegin;
1123  OpenMPUtils::PartitionedIterators(rModelPart.Conditions(),CondBegin,CondEnd);
1124 
1125  for (ModelPart::ConditionIterator itCond = CondBegin; itCond != CondEnd; ++itCond)
1126  {
1127  const bool is_slip = itCond->Is(SLIP);
1128  if (is_slip)
1129  {
1130 
1131  Condition::GeometryType& rGeom = itCond->GetGeometry();
1132  for (unsigned int i = 0; i < rGeom.PointsNumber(); ++i)
1133  {
1134  rGeom[i].SetLock();
1135  rGeom[i].Set(SLIP);
1136  rGeom[i].UnSetLock();
1137  }
1138  }
1139  }
1140  }
1141  rModelPart.GetCommunicator().SynchronizeOrNodalFlags(SLIP);
1142  }
1143 
1144  // Check input parameters
1145  this->Check();
1146 
1147  KRATOS_CATCH("");
1148  }
1149 
1150 
1154 
1155 
1159 
1160 
1164 
1166  FSStrategy& operator=(FSStrategy const& rOther){}
1167 
1169  FSStrategy(FSStrategy const& rOther){}
1170 
1171 
1173 
1174 };
1175 
1179 
1180 
1182 
1184 
1185 } // namespace Kratos.
1186 
1187 #endif // KRATOS_FS_STRATEGY_H
Current class provides an implementation for the base builder and solving operations.
Definition: builder_and_solver.h:64
virtual bool SynchronizeOrNodalFlags(const Flags &TheFlags)
Definition: communicator.cpp:623
virtual bool AssembleNonHistoricalData(Variable< int > const &ThisVariable)
Definition: communicator.cpp:527
Geometry< NodeType > GeometryType
definition of the geometry type with given NodeType
Definition: condition.h:83
Geometry< NodeType > GeometryType
definition of the geometry type with given NodeType
Definition: element.h:83
Definition: flags.h:58
Geometry base class.
Definition: geometry.h:71
SizeType PointsNumber() const
Definition: geometry.h:528
void SetValue(const TVariableType &rThisVariable, typename TVariableType::Type const &rValue)
Definition: geometry.h:617
Implicit solving strategy base class This is the base class from which we will derive all the implici...
Definition: implicit_solving_strategy.h:61
std::string Info() const override
Turn back information as a string.
Definition: implicit_solving_strategy.h:251
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
Communicator & GetCommunicator()
Definition: model_part.h:1821
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
MeshType::NodeIterator NodeIterator
Definition: model_part.h:134
MeshType::ElementIterator ElementIterator
Definition: model_part.h:174
MeshType::ConditionIterator ConditionIterator
Definition: model_part.h:189
static void PartitionedIterators(TVector &rVector, typename TVector::iterator &rBegin, typename TVector::iterator &rEnd)
Generate a partition for an std::vector-like array, providing iterators to the begin and end position...
Definition: openmp_utils.h:179
Definition: pfem_2_monolithic_slip_strategy.h:55
bool mPredictorCorrector
Definition: pfem_2_monolithic_slip_strategy.h:1028
unsigned int mTimeOrder
Definition: pfem_2_monolithic_slip_strategy.h:1026
FSStrategy & operator=(FSStrategy const &rOther)
Assignment operator.
Definition: pfem_2_monolithic_slip_strategy.h:1166
TLinearSolver::Pointer bool double Tol
Definition: pfem_2_monolithic_slip_strategy.h:120
void InitializeStrategy(SolverSettingsType &rSolverConfig, bool PredictorCorrector)
Definition: pfem_2_monolithic_slip_strategy.h:1063
double mPressureTolerance
Definition: pfem_2_monolithic_slip_strategy.h:1018
bool mReformDofSet
Definition: pfem_2_monolithic_slip_strategy.h:1032
TLinearSolver::Pointer pLinearSolver
Definition: pfem_2_monolithic_slip_strategy.h:118
TLinearSolver::Pointer bool ReformDofSet
Definition: pfem_2_monolithic_slip_strategy.h:119
ImplicitSolvingStrategy< TSparseSpace, TDenseSpace, TLinearSolver >::Pointer StrategyPointerType
Definition: pfem_2_monolithic_slip_strategy.h:79
PFEM2MonolithicSlipStrategy(ModelPart &rModelPart, SolverSettingsType &rSolverConfig, bool PredictorCorrector)
Definition: pfem_2_monolithic_slip_strategy.h:87
FSStrategy(FSStrategy const &rOther)
Copy constructor.
Definition: pfem_2_monolithic_slip_strategy.h:1169
StrategyPointerType mpMomentumStrategy
Scheme for the solution of the momentum equation.
Definition: pfem_2_monolithic_slip_strategy.h:1044
BaseType::TSystemMatrixType TSystemMatrixType
Definition: pfem_2_monolithic_slip_strategy.h:71
boost::shared_ptr< FSStrategy< TSparseSpace, TDenseSpace, TLinearSolver > > Pointer
Counted pointer of FSStrategy.
Definition: pfem_2_monolithic_slip_strategy.h:61
SolverSettings< TSparseSpace, TDenseSpace, TLinearSolver > SolverSettingsType
Definition: pfem_2_monolithic_slip_strategy.h:81
BaseType::TSystemVectorType TSystemVectorType
Definition: pfem_2_monolithic_slip_strategy.h:73
BaseType::DofsArrayType DofsArrayType
Definition: pfem_2_monolithic_slip_strategy.h:69
std::vector< Process::Pointer > mExtraIterationSteps
Definition: pfem_2_monolithic_slip_strategy.h:1049
TLinearSolver::Pointer bool double int MaxIterations
Definition: pfem_2_monolithic_slip_strategy.h:121
StrategyPointerType mpPressureStrategy
Scheme for the solution of the mass equation.
Definition: pfem_2_monolithic_slip_strategy.h:1047
SolvingStrategyPython(self.model_part, self.time_scheme, self.monolithic_linear_solver, self.conv_criteria, CalculateReactionFlag, ReformDofSetAtEachStep, MoveMeshFlag) self.monolithic_solver.SetMaximumIterations(self.maximum_nonlin_iterations) PFEM2MonolithicSlipStrategy(ModelPart &rModelPart
const Kratos::Variable< int > & mrPeriodicIdVar
Definition: pfem_2_monolithic_slip_strategy.h:1051
TLinearSolver::Pointer bool double int unsigned int DomainSize
Definition: pfem_2_monolithic_slip_strategy.h:122
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: pfem_2_monolithic_slip_strategy.h:77
unsigned int mMaxPressureIter
Definition: pfem_2_monolithic_slip_strategy.h:1022
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: pfem_2_monolithic_slip_strategy.h:75
PFEM2MonolithicSlipStrategy(ModelPart &rModelPart, SolverSettingsType &rSolverConfig, bool PredictorCorrector, const Kratos::Variable< int > &PeriodicVar)
Definition: pfem_2_monolithic_slip_strategy.h:96
bool mUseSlipConditions
Definition: pfem_2_monolithic_slip_strategy.h:1030
BaseType::TDataType TDataType
Definition: pfem_2_monolithic_slip_strategy.h:65
ImplicitSolvingStrategy< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition: pfem_2_monolithic_slip_strategy.h:63
unsigned int mMaxVelocityIter
Definition: pfem_2_monolithic_slip_strategy.h:1020
unsigned int mDomainSize
Definition: pfem_2_monolithic_slip_strategy.h:1024
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
This class provides the implementation of a static scheme.
Definition: residualbased_incrementalupdate_static_scheme.h:57
Scheme for the solution of problems involving a slip condition.
Definition: residualbased_incrementalupdate_static_scheme_slip.h:70
This is a very simple strategy to solve linearly the problem.
Definition: residualbased_linear_strategy.h:64
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
Helper class to define solution strategies for FS_Strategy.
Definition: solver_settings.h:53
@ Velocity
Definition: solver_settings.h:66
@ Pressure
Definition: solver_settings.h:66
virtual bool FindMaxIter(StrategyLabel const &rStrategyLabel, unsigned int &rMaxIter)
Definition: solver_settings.h:201
virtual unsigned int GetDomainSize() const
Definition: solver_settings.h:146
bool GetReformDofSet()
Definition: solver_settings.h:226
virtual bool UseSlipConditions() const
Definition: solver_settings.h:156
virtual bool GetTurbulenceModel(ProcessPointerType &pTurbulenceModel)
Definition: solver_settings.h:135
virtual bool FindStrategy(StrategyLabel const &rStrategyLabel, StrategyPointerType &pThisStrategy)
Definition: solver_settings.h:166
virtual unsigned int GetEchoLevel()
Definition: solver_settings.h:221
virtual bool FindTolerance(StrategyLabel const &rStrategyLabel, double &rTolerance)
Definition: solver_settings.h:188
virtual unsigned int GetTimeOrder() const
Definition: solver_settings.h:151
Solving strategy base class This is the base class from which we will derive all the strategies (impl...
Definition: solving_strategy.h:64
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: solving_strategy.h:467
TDenseSpace::MatrixType LocalSystemMatrixType
Definition: solving_strategy.h:79
TSparseSpace::DataType TDataType
Definition: solving_strategy.h:69
virtual void SetEchoLevel(const int Level)
This sets the level of echo for the solving strategy.
Definition: solving_strategy.h:255
ModelPart & GetModelPart()
Operations to get the pointer to the model.
Definition: solving_strategy.h:350
virtual void Clear()
Clears the internal storage.
Definition: solving_strategy.h:198
int GetEchoLevel()
This returns the level of echo for the solving strategy.
Definition: solving_strategy.h:271
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: solving_strategy.h:473
TSparseSpace::MatrixType TSystemMatrixType
Definition: solving_strategy.h:71
virtual int Check()
Function to perform expensive checks.
Definition: solving_strategy.h:377
bool MoveMeshFlag()
This function returns the flag that says if the mesh is moved.
Definition: solving_strategy.h:290
virtual double Solve()
The problem of interest is solved.
Definition: solving_strategy.h:183
TSparseSpace::VectorType TSystemVectorType
Definition: solving_strategy.h:73
TDenseSpace::VectorType LocalSystemVectorType
Definition: solving_strategy.h:81
KeyType Key() const
Definition: variable_data.h:187
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
Kratos::ModelPart ModelPart
Definition: kratos_wrapper.h:31
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Internals::Matrix< double, AMatrix::dynamic, 1 > Vector
Definition: amatrix_interface.h:472
REACTION_CHECK_STIFFNESS_FACTOR int
Definition: contact_structural_mechanics_application_variables.h:75
Temp
Definition: PecletTest.py:105
ProcessInfo
Definition: edgebased_PureConvection.py:116
model_part
Definition: face_heat.py:14
Dt
Definition: face_heat.py:78
int d
Definition: ode_solve.py:397
def Norm(vector)
Definition: sand_production_post_process_tool.py:10
integer i
Definition: TensorModule.f:17
ReformDofAtEachIteration
Definition: test_pureconvectionsolver_benchmarking.py:131