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.
runge_kutta_fracstep_GLS_strategy.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Author Pavel Ryzhakov and Julio Marti
11 //
12 
13 
14 #if !defined(KRATOS_RUNGE_KUTTA_GLS_STRATEGY)
15 #define KRATOS_RUNGE_KUTTA_GLS_STRATEGY
16 
17 
18 /* System includes */
19 
20 
21 /* External includes */
22 #include "boost/smart_ptr.hpp"
23 
24 
25 /* Project includes */
26 #include "includes/define.h"
27 #include "includes/model_part.h"
30 //#include "incompressible_fluid_application.h"
31 #include "ULF_application.h"
32 #include "includes/cfd_variables.h"
33 #include "includes/mat_variables.h"
34 #include "includes/dem_variables.h"
35 
36 
37 #include <stdio.h> /* printf */
38 #include <cmath> /* cos */
39 
41 
42 #define UPDATE_MASS //chek if the element is correct
43 
44 namespace Kratos
45 {
46 
73 
94  template<unsigned int TDim, class TSparseSpace,
95  class TDenseSpace,
96  class TLinearSolver
97  >
99  : public ImplicitSolvingStrategy<TSparseSpace,TDenseSpace,TLinearSolver>
100  {
101  public:
106  typedef std::vector<unsigned int> IndicesVectorType;
107 
109 
111 
112  typedef typename BaseType::TDataType TDataType;
113 
114  //typedef typename BaseType::DofSetType DofSetType;
115 
117 
119 
121 
123 
125 
126  typedef Node PointType;
127 
128  typedef Node::Pointer PointPointerType;
129 
130  typedef std::vector<PointType::Pointer> PointVector;
131 
132  typedef PointVector::iterator PointIterator;
133 
134 
135 
145  typename TLinearSolver::Pointer pNewPressureLinearSolver,
146  bool CalculateReactions = false,
147  bool ReformDofAtEachIteration = true,
148  bool CalculateNormDxFlag = true
149  //double velocity_toll = 0.01,
150  //double pressure_toll = 0.01,
151  //int MaxVelocityIterations = 3,
152  //int MaxPressureIterations = 1,
153  //unsigned int time_order = 2,
154  //unsigned int prediction_order = 2,
155  //unsigned int domain_size = 2
156  //unsigned int laplacian_form = 2, //1 = laplacian, 2 = discrete laplacian
157  //bool predictor_corrector = false
158  )
159  : ImplicitSolvingStrategy<TSparseSpace,TDenseSpace,TLinearSolver>(model_part,false)
160  {
161  KRATOS_TRY
162  //std::cout << "SONO QUI" << std::endl;
163  //this->mvelocity_toll = velocity_toll;
164  //this->mpressure_toll = pressure_toll;
165  //this->mMaxVelIterations = MaxVelocityIterations;
166  //this->mMaxPressIterations = MaxPressureIterations;
167  //this->mtime_order = time_order;
168  //this->mprediction_order = time_order;
169  //this->mdomain_size = domain_size;
170 
171  //this->mpredictor_corrector = predictor_corrector;
173 
174  //this->proj_is_initialized = false;
175 
176  //the system will be cleared at the end!
177  //ReformDofAtEachIteration = false;
178 
179  //initializing fractional velocity solution step
180  typedef Scheme< TSparseSpace, TDenseSpace > SchemeType;
181  typename SchemeType::Pointer pscheme = typename SchemeType::Pointer
183 
184  //commented the 3 lines below
185 
186  /*
187  bool CalculateReactions = false;
188  bool ReformDofAtEachIteration = true;
189  bool CalculateNormDxFlag = true;
190  */
191 
192 
193  //computation of the fractional vel velocity (first step)
194  //3 dimensional case
195  //typedef typename Kratos::VariableComponent<Kratos::VectorComponentAdaptor<Kratos::array_1d<double, 3> > > VarComponent;
196 
197  //typedef typename BuilderAndSolver<TSparseSpace,TDenseSpace,TLinearSolver>::Pointer BuilderSolverTypePointer;
198 
199 
200  //std::cout << "standard laplacian form" << std::endl;
201  //mmin_conv_vel_norm = 0.0;
202  this->mpressurestep = typename BaseType::Pointer(
204  (model_part,pscheme,pNewPressureLinearSolver,CalculateReactions,ReformDofAtEachIteration,CalculateNormDxFlag) );
205  this->mpressurestep->SetEchoLevel(2);
206 
207  //identify nodes, weher slip shall be imposed .. store them in a list
208  mSlipBoundaryList.clear();
209  //ModelPart& model_part=GetModelPart();
210  for (typename ModelPart::NodesContainerType::iterator it=model_part.NodesBegin(); it!=model_part.NodesEnd(); ++it)
211  {
212  //FLAG_VAR = 1 is SLIP
213  if (it->FastGetSolutionStepValue(FLAG_VARIABLE)==3.0)
214 
215  mSlipBoundaryList.push_back(*(it.base()));
216  //mSlipBoundaryList.push_back(it);
217  }
218 
219  for (typename ModelPart::NodesContainerType::iterator it=model_part.NodesBegin(); it!=model_part.NodesEnd(); ++it)
220  {
221  if(it->pGetDof(VELOCITY_X)->IsFixed() == true)
222  {
223  mFixedVelocityDofSet.push_back( it->pGetDof(VELOCITY_X).get() );
224  mFixedVelocityDofValues.push_back( it->pGetDof(VELOCITY_X)->GetSolutionStepValue() );
225  }
226 
227  if(it->pGetDof(VELOCITY_Y)->IsFixed() == true)
228  {
229  mFixedVelocityDofSet.push_back( it->pGetDof(VELOCITY_Y).get() );
230  mFixedVelocityDofValues.push_back( it->pGetDof(VELOCITY_Y)->GetSolutionStepValue() );
231  }
232 
233  if(it->pGetDof(VELOCITY_Z)->IsFixed() == true)
234  {
235  mFixedVelocityDofSet.push_back( it->pGetDof(VELOCITY_Z).get() );
236  mFixedVelocityDofValues.push_back( it->pGetDof(VELOCITY_Z)->GetSolutionStepValue() );
237  }
238  }
239 
240 
241 
242  Element & ref_el = model_part.Elements().front();
244 
245  //int id=1;
246  if constexpr (TDim==2)
247  {
248  Fluid2DGLS_expl el(1, p_null_geom);
249 
250  if (typeid(ref_el) != typeid(el))
251  KRATOS_THROW_ERROR(std::logic_error, "Incompressible Runge Kutta Strategy requires utilization of Fluid2DGLS_expl elements " , "");
252  }
253 
254  if constexpr (TDim==3)
255  {
256  KRATOS_THROW_ERROR(std::logic_error, "not Runge Kutta Strategy for 3D problems " , "");
257  // Fluid3DGLS_expl el(1, p_null_geom);
258 
259  // if (typeid(ref_el) != typeid(el))
260  // KRATOS_THROW_ERROR(std::logic_error, "Incompressible Runge Kutta Strategy requires utilization of Fluid3DGLS_expl elements " , "");
261  }
262 
263  KRATOS_CATCH("")
264  }
265 
269 
273  //*********************************************************************************
274  //**********************************************************************
275  double Solve()
276  {
277  KRATOS_WATCH("Solve of Runge Kutta GLS Frac Step Strategy")
278  //we estimate the time step for the explicit time integration schem estability
279  KRATOS_WATCH("Started RK step1");
280  Timer::Start("SolveStep1");
281  SolveStep1();
282  Timer::Stop("SolveStep1");
283  KRATOS_WATCH("Finished RK step1");
284 
285  Timer::Start("SolveStep2");
286  double Dp_norm = this->SolveStep2();
287  Timer::Stop("SolveStep2");
288  KRATOS_WATCH("Finished RK step2");
289 
290  if(this->mReformDofAtEachIteration == true )
291  this->Clear();
292  Timer::Start("SolveStep3");
293  SolveStep3();
294  Timer::Stop("SolveStep3");
295  KRATOS_WATCH("Finished RK step3");
296 
297  return Dp_norm;
298 
299  }
300 
301  //*********************************************************************************
302  //**********************************************************************
303  void ApplyVelocityBoundaryConditions(DofsArrayType& mFixedVelocityDofSet,std::vector<double>& mFixedVelocityDofValues)
304  {
305  KRATOS_TRY
306 
307  unsigned int i=0;
308  for(typename DofsArrayType::iterator i_dof = mFixedVelocityDofSet.begin() ; i_dof != mFixedVelocityDofSet.end() ; ++i_dof)
309  {
310  i_dof->GetSolutionStepValue() = mFixedVelocityDofValues[i];
311  i++;
312  }
313 
314  KRATOS_CATCH("")
315  }
316  //*********************************************************************************
317  //**********************************************************************
319  {
320  KRATOS_TRY
322  for(ModelPart::NodesContainerType::iterator i = rNodes.begin(); i!=rNodes.end(); i++)
323  noalias(i->FastGetSolutionStepValue(rVariable)) = zero;
324  KRATOS_CATCH("")
325  }
326  //*********************************************************************************
327  //**********************************************************************
329  {
330  KRATOS_TRY
331  for(ModelPart::NodesContainerType::iterator i = rNodes.begin(); i!=rNodes.end(); i++)
332  i->FastGetSolutionStepValue(rVariable) = 0.0;
333  KRATOS_CATCH("")
334  }
335  //************************************************************************
336  //************************************************************************
337  void SolveStep1()
338  {
339  KRATOS_TRY
340  //vector that we shall use to store temporary results in the Runge-Kutta context
341  array_1d<double,3> aux;
342  array_1d<double,3> aux_res;
343 
345 
346  //getting delta time
347  //ProcessInfo& rCurrentProcessInfo = BaseType::GetModelPart().GetProcessInfo();
348  double delta_t = model_part.GetProcessInfo()[DELTA_TIME];
349  double dummy;
350  ProcessInfo& proc_info = model_part.GetProcessInfo();
351  bool inverted_element=true;
352 
353  //inverted_element=CalculateLumpedMassAux();
354 
355  double time_ccc = model_part.GetProcessInfo()[TIME];
356  double time_cal=time_ccc - delta_t;
357 
358  for(ModelPart::NodesContainerType::iterator in = model_part.NodesBegin() ; in != model_part.NodesEnd() ; ++in)
359  {
360  in->FastGetSolutionStepValue(IS_INTERFACE)=0.0;
361  }
362 
364  // //
365  // SAVING VELOCITY B.C.'s //
366  // //
368  //if the DOFsets are reformed at every step, we have to find the Dirichlet B.C.s every time again (think of coupling with Lag)
369  //otherwise do nothing
370  if (this->mReformDofAtEachIteration==true)
371  {
372  mFixedVelocityDofSet.clear();
373  mFixedVelocityDofValues.clear();
374 
375  for (typename ModelPart::NodesContainerType::iterator it=model_part.NodesBegin(); it!=model_part.NodesEnd(); ++it)
376  {
377  if(it->pGetDof(VELOCITY_X)->IsFixed() == true)
378  {
379  mFixedVelocityDofSet.push_back( it->pGetDof(VELOCITY_X).get() );
380  mFixedVelocityDofValues.push_back( it->pGetDof(VELOCITY_X)->GetSolutionStepValue() );
381  }
382 
383  if(it->pGetDof(VELOCITY_Y)->IsFixed() == true)
384  {
385  mFixedVelocityDofSet.push_back( it->pGetDof(VELOCITY_Y).get() );
386  mFixedVelocityDofValues.push_back( it->pGetDof(VELOCITY_Y)->GetSolutionStepValue() );
387  }
388 
389  if(it->pGetDof(VELOCITY_Z)->IsFixed() == true)
390  {
391  mFixedVelocityDofSet.push_back( it->pGetDof(VELOCITY_Z).get() );
392  mFixedVelocityDofValues.push_back( it->pGetDof(VELOCITY_Z)->GetSolutionStepValue() );
393  }
394  }
395  }
396 
397  //perform the First Fractional Step (using Runge-Kutta for finding u_tilda)
398  //important is to apply the boundary conditions upon the intermediate velocity
399  //set WORK = VELOCITY of the old step
400 
401  bool inverted=false;
402  while(inverted_element==true )
403  {
404  inverted_element=false;
405 
406  for (typename ModelPart::NodesContainerType::iterator it=model_part.NodesBegin(); it!=model_part.NodesEnd(); ++it)
407  {
408  noalias(it->FastGetSolutionStepValue(VELOCITY_OLD)) = it->FastGetSolutionStepValue(VELOCITY,1);
409  noalias(it->FastGetSolutionStepValue(CONV_PROJ)) = ZeroVector(3);
410  noalias(it->FastGetSolutionStepValue(CONV_PROJ,1)) = ZeroVector(3);
411  it->FastGetSolutionStepValue(PRESSURE) = it->FastGetSolutionStepValue(PRESSURE,1);
412  it->FastGetSolutionStepValue(VELOCITY) = it->FastGetSolutionStepValue(VELOCITY,1);
413  it->FastGetSolutionStepValue(NODAL_MASS)=0.0;
414  }
415 
416 
417 
418  for(ModelPart::ElementIterator im = model_part.ElementsBegin() ;
419  im != model_part.ElementsEnd() ; ++im)
420  {
421  //note that the lumped mass factors are saved nodally, and are equal for x, y, and z velocity
422  im->Calculate(NODAL_MASS, dummy, proc_info);
423  }
424 
425  //reset the RHS
426  SetToZero(VELOCITY_OLD_OLD,model_part.Nodes());
427 
428  array_1d<double,3> Frac_Step_Switch; //switch variable, that needs to be passed to the fct Calculate (of the element)
429  // which decides weather 1st or last Frac Step(correction of vel) should be performed
430  //if Frac_Step_Switch==1 - 1st if 2-last, otherwise - ERROR
431 
432  Frac_Step_Switch[0]=1.0;
433  Frac_Step_Switch[1]=1.0;
434  Frac_Step_Switch[2]=1.0;
435  //this variable is an array_1d just because of the structure of the function calculate....[1] and [2] aren't important
436 
437  //ProcessInfo& proc_info = model_part.GetProcessInfo();
438 
439 #if defined( UPDATE_MASS)
440  inverted=CalculateLumpedMassAux();
441  if(inverted==true ) inverted_element=true;
442 #endif
443 
444  double cal_time=time_cal;
445 
446 
447  //loop over elements calculating the Right Hand Side, that is stored directly to the node.. this is done by fct Calculate
448  for(ModelPart::ElementIterator im = model_part.ElementsBegin() ; im != model_part.ElementsEnd() ; ++im)
449  {
450  //compute the momentum residual, add it to the VELOCITY_OLD_OLD on nodes
451  im->Calculate(VELOCITY, Frac_Step_Switch, proc_info);
452  }
454  // first step of Runge Kutta //
456  //KRATOS_WATCH("RUNGE KUTTA 1st STEP")
457  double one_sixt = 0.166666666666667;
458  for (typename ModelPart::NodesContainerType::iterator it=model_part.NodesBegin(); it!=model_part.NodesEnd(); ++it)
459  {
460  noalias(it->FastGetSolutionStepValue(CONV_PROJ))= one_sixt * delta_t * it->FastGetSolutionStepValue(VELOCITY,1);
461 
462  noalias(aux) = delta_t/(it->FastGetSolutionStepValue(NODAL_MASS)) * it->FastGetSolutionStepValue(VELOCITY_OLD_OLD);
463  noalias(it->FastGetSolutionStepValue(VELOCITY_OLD)) += one_sixt * aux;
464  noalias(it->FastGetSolutionStepValue(VELOCITY)) = 0.5 * aux + it->FastGetSolutionStepValue(VELOCITY,1); //V_beta1
465 
466  }
467  ApplyVelocityBoundaryConditions(mFixedVelocityDofSet,mFixedVelocityDofValues);
468  //apply the slip BC only if there are some slip BCs identified
469  if (mSlipBoundaryList.size()!=0)
470  ApplySlipBC();
471 
472  SetToZero(VELOCITY_OLD_OLD,model_part.Nodes());
473 
474  //updating position
475  for (typename ModelPart::NodesContainerType::iterator it=model_part.NodesBegin(); it!=model_part.NodesEnd(); ++it)
476  {
477  it->FastGetSolutionStepValue(ADVPROJ)= it->Coordinates();
478 
479 
480  if(it->FastGetSolutionStepValue(IS_STRUCTURE)==0.0)
481  {
482  noalias(it->Coordinates())+= 0.5 * delta_t * it->FastGetSolutionStepValue(VELOCITY,1); //move with vn
483 
484  }
485  }
486 
488  // second step of Runge Kutta //
490  //KRATOS_WATCH("RUNGE KUTTA 2st STEP")
491 
492  //...now the residual will be computed with the intermediate velocity, that was computed at 1st step of R-K
493  //loop over elements calculating the Right Hand Side, that is stored directly to the node
494 
495  //LETS TRY NOT TO RECCOMPUTE MASS MATRIX
496 #if defined( UPDATE_MASS)
497  inverted=CalculateLumpedMassAux();
498  if(inverted==true ) inverted_element=true;
499 
500 #endif
501 
502  cal_time=time_cal + 0.5 * delta_t;
503 
504  for(ModelPart::ElementIterator im = model_part.ElementsBegin() ; im != model_part.ElementsEnd() ; ++im)
505  {
506  im->Calculate(VELOCITY, Frac_Step_Switch, proc_info);
507  }
508 
509  //updating position_ x_beta2=xn+0.5*dt*v_beta1
510  for (typename ModelPart::NodesContainerType::iterator it=model_part.NodesBegin(); it!=model_part.NodesEnd(); ++it)
511  {
512  //resetting coordinates to x_n
513  it->Coordinates()=it->FastGetSolutionStepValue(ADVPROJ);
514  if(it->FastGetSolutionStepValue(IS_STRUCTURE)==0.0)
515  {
516  //x_beta2=x_n+v_beta1
517  noalias(it->Coordinates())+= 0.5 * delta_t * it->FastGetSolutionStepValue(VELOCITY);
518 
519  }
520  }
521 
522  double one_third = 0.33333333333333333333333333;
523 
524  for (typename ModelPart::NodesContainerType::iterator it=model_part.NodesBegin(); it!=model_part.NodesEnd(); ++it)
525  {
526 
527  noalias(it->FastGetSolutionStepValue(CONV_PROJ))+= one_third * delta_t * it->FastGetSolutionStepValue(VELOCITY); //v_betta2
528  noalias(aux) = delta_t/(it->FastGetSolutionStepValue(NODAL_MASS)) * it->FastGetSolutionStepValue(VELOCITY_OLD_OLD);
529  noalias(it->FastGetSolutionStepValue(VELOCITY_OLD)) += one_third * aux;
530  //computing v_beta2=v_n+0.5dt*r
531  noalias(it->FastGetSolutionStepValue(VELOCITY)) = 0.5 * aux + it->FastGetSolutionStepValue(VELOCITY,1); //v beta2
532  }
533 
534  ApplyVelocityBoundaryConditions(mFixedVelocityDofSet,mFixedVelocityDofValues);
535  //apply the slip BC only if there are some slip BCs identified
536  if (mSlipBoundaryList.size()!=0)
537  ApplySlipBC();
538 
539  SetToZero(VELOCITY_OLD_OLD,model_part.Nodes());
540 
541  //LETS TRY NOT TO RECCOMPUTE MASS MATRIX
542 #if defined( UPDATE_MASS)
543  inverted=CalculateLumpedMassAux();
544  if(inverted==true ) inverted_element=true;
545 #endif
546 
548  //third step of Runge Kutta //
550  //KRATOS_WATCH("RUNGE KUTTA 3rd STEP")
551  //...now the residual will be computed with the intermediate velocity, that was computed at 2nd step of R-K
552  //loop over elements calculating the Right Hand Side, that is stored directly to the node
553 
554  cal_time=time_cal + 0.5 * delta_t;
555 
556  for(ModelPart::ElementIterator im = model_part.ElementsBegin() ; im != model_part.ElementsEnd() ; ++im)
557  {
558  im->Calculate(VELOCITY, Frac_Step_Switch, proc_info);
559  }
560 
561  for (typename ModelPart::NodesContainerType::iterator it=model_part.NodesBegin(); it!=model_part.NodesEnd(); ++it)
562  {
563 
564  if(it->FastGetSolutionStepValue(IS_STRUCTURE)==0.0)
565  {
566  //resetting coords to x_n
567  noalias(it->Coordinates())= it->FastGetSolutionStepValue(ADVPROJ);
568  //x_beta3=xn+dt*vbeta2
569  noalias(it->Coordinates())+= delta_t * it->FastGetSolutionStepValue(VELOCITY);
570  }
571  }
572 
573  for (typename ModelPart::NodesContainerType::iterator it=model_part.NodesBegin(); it!=model_part.NodesEnd(); ++it)
574  {
575  noalias(it->FastGetSolutionStepValue(CONV_PROJ))+= one_third * delta_t * it->FastGetSolutionStepValue(VELOCITY);
576  noalias(aux) = delta_t/(it->FastGetSolutionStepValue(NODAL_MASS)) * it->FastGetSolutionStepValue(VELOCITY_OLD_OLD);
577  noalias(it->FastGetSolutionStepValue(VELOCITY_OLD)) += one_third * aux;
578  //v_beta3=vn+dt*r3
579  noalias(it->FastGetSolutionStepValue(VELOCITY)) = aux + it->FastGetSolutionStepValue(VELOCITY,1);//aux;
580  //NEW VERSION OF VELbeta3 - see blue text in the paper
581  }
582  ApplyVelocityBoundaryConditions(mFixedVelocityDofSet,mFixedVelocityDofValues);
583  //apply the slip BC only if there are some slip BCs identified
584  if (mSlipBoundaryList.size()!=0)
585  ApplySlipBC();
586 
587  SetToZero(VELOCITY_OLD_OLD,model_part.Nodes());
588 
589  cal_time=time_cal + delta_t;
590 
592  //last step of Runge Kutta //
594 
595 #if defined( UPDATE_MASS)
596  inverted=CalculateLumpedMassAux();
597  if(inverted==true ) inverted_element=true;
598 #endif
599 
600  //KRATOS_WATCH("RUNGE KUTTA LAst STEP")
601  //...now the residual will be computed with the intermediate velocity, that was computed at 3rd step of R-K
602  //loop over elements calculating the Right Hand Side, that is stored directly at the node
603  for(ModelPart::ElementIterator im = model_part.ElementsBegin() ; im != model_part.ElementsEnd() ; ++im)
604  {
605  im->Calculate(VELOCITY, Frac_Step_Switch, proc_info);
606  }
607 
608  for (typename ModelPart::NodesContainerType::iterator it=model_part.NodesBegin(); it!=model_part.NodesEnd(); ++it)
609  {
610 
611  noalias(it->FastGetSolutionStepValue(CONV_PROJ))+= one_sixt * delta_t * it->FastGetSolutionStepValue(VELOCITY);
612  //VELOCITY_OLD = VELOCITY_OLD + delta_T/6 * 1/NODAL_MASS * RHS
613  //VELOCITY = AUX_VSetToZero_VectorVarECTOR
614  noalias(aux) = delta_t/(it->FastGetSolutionStepValue(NODAL_MASS)) * it->FastGetSolutionStepValue(VELOCITY_OLD_OLD);
615  noalias(it->FastGetSolutionStepValue(VELOCITY_OLD)) += one_sixt * aux;
616  }
617 
618  for (typename ModelPart::NodesContainerType::iterator it=model_part.NodesBegin(); it!=model_part.NodesEnd(); ++it)
619  {
620  noalias(it->Coordinates())=it->FastGetSolutionStepValue(ADVPROJ);
621  if(it->FastGetSolutionStepValue(IS_STRUCTURE)==0.0)
622  {
623  noalias(it->Coordinates())+= it->FastGetSolutionStepValue(CONV_PROJ);
624  }
625  }
626 
627  for (typename ModelPart::NodesContainerType::iterator it=model_part.NodesBegin(); it!=model_part.NodesEnd(); ++it)
628  {
629  noalias(it->FastGetSolutionStepValue(VELOCITY)) = it->FastGetSolutionStepValue(VELOCITY_OLD); // V tilde
630  }
631  ApplyVelocityBoundaryConditions(mFixedVelocityDofSet,mFixedVelocityDofValues);
632  //apply the slip BC only if there are some slip BCs identified
633  if (mSlipBoundaryList.size()!=0)
634  ApplySlipBC();
635 
636 #if defined( UPDATE_MASS)
637  inverted=CalculateLumpedMassAux();
638  if(inverted==true ) inverted_element=true;
639 #endif
640 
641  if(inverted_element==true) {
642  KRATOS_WATCH("AN ELEMENT HAS BEEN INVERTEDDDDDDDDD ");
643  KRATOS_WATCH("INSIDE -REDUCE TIME STEP- process")
644  inverted_element=false;
645  }
646  }
647  KRATOS_WATCH("FINISHED STAGE1 OF FRACTIONAL STEP")
648  KRATOS_CATCH("")
649  }
650 
651  //******************************************************************************************************
652  //******************************************************************************************************
653  //solve the pressure equation
654  double SolveStep2()
655  {
656  KRATOS_TRY
657  KRATOS_WATCH("Second stage of Frac Step")
658 
659  //solves the system that is assembled within "calculateLocalSystem" of the element
660  return mpressurestep->Solve();
661  KRATOS_CATCH("");
662  }
663  //******************************************************************************************************
664  //******************************************************************************************************
665  void SolveStep3()
666  {
667  KRATOS_TRY
668 
670 
671  const double dt = model_part.GetProcessInfo()[DELTA_TIME];
672 
673  //set to zero AUX vector
674  SetToZero(VELOCITY_OLD,model_part.Nodes());
675  for (typename ModelPart::NodesContainerType::iterator it=model_part.NodesBegin(); it!=model_part.NodesEnd(); ++it)
676  {
677  it->FastGetSolutionStepValue(VELOCITY_OLD)=ZeroVector(3);
678  it->FastGetSolutionStepValue(CONV_PROJ)=it->FastGetSolutionStepValue(VELOCITY);
679 
680  }
681  double one_sixth = 0.166666666666667;
682 
683  if constexpr (TDim==2)
684  {
685  //allocation of work space
686  boost::numeric::ublas::bounded_matrix<double,3,2> DN_DX;
688  //array_1d<double,3> aux0, aux1, aux2; //this are sized to 3 even in 2D!!
689  //double lumping_factor = 0.33333333333333;
690 
691 
692  //calculate the velocity correction and store it in VELOCITY_OLD
693  for (typename ModelPart::ElementsContainerType::iterator it=model_part.ElementsBegin(); it!=model_part.ElementsEnd(); ++it)
694  {
695  //get the list of nodes of the element
696  Geometry< Node >& geom = it->GetGeometry();
697 
698  double volume;
700  // OLD VERSION PAVEL'S IMPLEMENTATION
701  array_1d<double,3> pres_inc;
702  pres_inc[0] = geom[0].FastGetSolutionStepValue(PRESSURE)-geom[0].FastGetSolutionStepValue(PRESSURE,1);
703  pres_inc[1] = geom[1].FastGetSolutionStepValue(PRESSURE)-geom[1].FastGetSolutionStepValue(PRESSURE,1);
704  pres_inc[2] = geom[2].FastGetSolutionStepValue(PRESSURE)-geom[2].FastGetSolutionStepValue(PRESSURE,1);
705 
706  pres_inc*=one_sixth;
707 
709 
710  double p_avg = N[0]*pres_inc[0]
711  + N[1]*pres_inc[1]
712  + N[2]*pres_inc[2];
713 
714  p_avg *= volume;
715 
716  //KRATOS_WATCH(p_avg)
717 
719 
720  aaa[0] += DN_DX(0, 0) * p_avg;
721  aaa[1] += DN_DX(0, 1) * p_avg;
722  aaa[2] += DN_DX(1, 0) * p_avg;
723  aaa[3] += DN_DX(1, 1) * p_avg;
724  aaa[4] += DN_DX(2, 0) * p_avg;
725  aaa[5] += DN_DX(2, 1) * p_avg;
726 
727  //KRATOS_WATCH(aaa)
728 
729  geom[0].FastGetSolutionStepValue(VELOCITY_OLD_X) += aaa[0];
730  geom[0].FastGetSolutionStepValue(VELOCITY_OLD_Y) += aaa[1];
731 
732  geom[1].FastGetSolutionStepValue(VELOCITY_OLD_X) += aaa[2];
733  geom[1].FastGetSolutionStepValue(VELOCITY_OLD_Y) += aaa[3];
734 
735  geom[2].FastGetSolutionStepValue(VELOCITY_OLD_X) += aaa[4];
736  geom[2].FastGetSolutionStepValue(VELOCITY_OLD_Y) += aaa[5];
737  //reusing aux for the third node
738  }
739  }
740  if constexpr (TDim==3)
741  {
742  KRATOS_WATCH("Last step in 3D")
743 
744  array_1d<double,4> pres_inc;
745  boost::numeric::ublas::bounded_matrix<double,12,3> shape_func = ZeroMatrix(12, 3);
746  boost::numeric::ublas::bounded_matrix<double,12,4> G = ZeroMatrix(12,4);
747  boost::numeric::ublas::bounded_matrix<double,4,3> DN_DX;
749  //array_1d<double,3> aux0, aux1, aux2, aux3; //this are sized to 3 even in 2D!!
750  for (typename ModelPart::ElementsContainerType::iterator it=model_part.ElementsBegin(); it!=model_part.ElementsEnd(); ++it)
751  {
752  Geometry< Node >& geom = it->GetGeometry();
753 
754  pres_inc[0] = geom[0].FastGetSolutionStepValue(PRESSURE,1)-geom[0].FastGetSolutionStepValue(PRESSURE);
755  pres_inc[1] = geom[1].FastGetSolutionStepValue(PRESSURE,1)-geom[1].FastGetSolutionStepValue(PRESSURE);
756  pres_inc[2] = geom[2].FastGetSolutionStepValue(PRESSURE,1)-geom[2].FastGetSolutionStepValue(PRESSURE);
757  pres_inc[3] = geom[3].FastGetSolutionStepValue(PRESSURE,1)-geom[3].FastGetSolutionStepValue(PRESSURE);
758 
759 
760  //Riccardo's modification: multiply the G(p_n+1-p_n) by 1/2
761  pres_inc*=0.5;
762 
763  double volume;
765 
766  //Gradient operator G:
767 
768  for (int ii = 0; ii< 4; ii++)
769  {
770  int column = ii*3;
771  shape_func(column,0) = N[ii];
772  shape_func(column + 1, 1) = shape_func(column,0);
773  shape_func(column + 2, 2) = shape_func(column,0);
774  }
775  noalias(G)=prod(shape_func, trans(DN_DX));
776  G*=volume;
777 
779  noalias(aaa) = prod(G,pres_inc);
780 
781  array_1d<double,3> aux;
782  aux[0]=aaa[0];
783  aux[1]=aaa[1];
784  aux[2]=aaa[2];
785 
786  geom[0].FastGetSolutionStepValue(VELOCITY_OLD) += aux;
787  //reusing aux for the second node
788  aux[0]=aaa[3];
789  aux[1]=aaa[4];
790  aux[2]=aaa[5];
791  //z-component is zero
792  geom[1].FastGetSolutionStepValue(VELOCITY_OLD) += aux;
793  //reusing aux for the third node
794  aux[0]=aaa[6];
795  aux[1]=aaa[7];
796  aux[2]=aaa[8];
797  geom[2].FastGetSolutionStepValue(VELOCITY_OLD) += aux;
798 
799  aux[0]=aaa[9];
800  aux[1]=aaa[10];
801  aux[2]=aaa[11];
802  geom[3].FastGetSolutionStepValue(VELOCITY_OLD) += aux;
803 
804  //for(unsigned int i=0;i<3;i++)
805  // geom[i].FastGetSolutionStepValue(VELOCITY_OLD) += aux0;
806  }
807  }
808  //correct the velocities
809  for (typename ModelPart::NodesContainerType::iterator it=model_part.NodesBegin(); it!=model_part.NodesEnd(); ++it)
810  {
811  //VELOCITY = VELOCITY + dt * Minv * VELOCITY_OLD
812  double dt_Minv = dt / it->FastGetSolutionStepValue(NODAL_MASS);
813  array_1d<double,3>& temp = it->FastGetSolutionStepValue(VELOCITY_OLD);
814  if(!it->IsFixed(VELOCITY_X))
815  {
816  it->FastGetSolutionStepValue(VELOCITY_X)+= dt_Minv*temp[0];
817 
818  }
819  if(!it->IsFixed(VELOCITY_Y))
820  {
821  it->FastGetSolutionStepValue(VELOCITY_Y)+= dt_Minv*temp[1];
822  }
823  if(!it->IsFixed(VELOCITY_Z))
824  {
825  it->FastGetSolutionStepValue(VELOCITY_Z)+= dt_Minv*temp[2];
826  }
827 
828  }
829 
830  KRATOS_CATCH("");
831  }
832  //************************************
833  //************************************
835  {
836  KRATOS_TRY
837 
838  for(ModelPart::NodeIterator i = BaseType::GetModelPart().NodesBegin() ;
839  i != BaseType::GetModelPart().NodesEnd() ; ++i)
840  {
841  //setting the old value of the pressure to the current one
842  const double& p = (i)->FastGetSolutionStepValue(PRESSURE);
843 
844  }
845  KRATOS_CATCH("")
846  }
847  //************************************
848  //************************************
850  {
851  KRATOS_TRY
854  const double dt = model_part.GetProcessInfo()[DELTA_TIME];
855  for(ModelPart::NodeIterator i = BaseType::GetModelPart().NodesBegin() ;
856  i != BaseType::GetModelPart().NodesEnd() ; ++i)
857  {
858  acc=(i)->FastGetSolutionStepValue(VELOCITY)-(i)->FastGetSolutionStepValue(VELOCITY,1);
859  (i)->FastGetSolutionStepValue(ACCELERATION)=acc/dt;
860  }
861  KRATOS_CATCH("")
862  }
863  //************************************
864  //************************************
865  void ApplySlipBC()
866  {
867  KRATOS_TRY
868 
869 
870  for (PointIterator it=mSlipBoundaryList.begin(); it!=mSlipBoundaryList.end(); ++it)
871  {
872  //KRATOS_WATCH("slip node")
873  array_1d<double, 3> normal = (*it)->FastGetSolutionStepValue(NORMAL);
874  double length = sqrt(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2]);
875  if (length==0)
876  {
877  KRATOS_THROW_ERROR(std::logic_error, "TO apply SLIP you should calculate normals first! Dont forget to assign Condition2D/3D resp for that " , "");
878  }
879  normal*=1.0/length;
880  array_1d<double, 3> normal_comp_vec;
881  //CHECK IF NORMAL IS NORMALIZED (divided by the length)
882  //double length = ...
883  array_1d<double, 3> vel = (*it)->FastGetSolutionStepValue(VELOCITY);
884  double normal_comp;
885  normal_comp=inner_prod(normal, vel);
886  normal_comp_vec = normal_comp*normal;
887  (*it)->FastGetSolutionStepValue(VELOCITY)-=normal_comp_vec;
888  }
889  KRATOS_CATCH("")
890  }
891  //************************************
892  //************************************
893  void AssembleMassMatrices(TSystemMatrixType& Mconsistent, TSystemVectorType& mMdiagInv, ModelPart& r_model_part)
894  {
895  //first we assemble the diagonal mass matrix
896  KRATOS_TRY
897  //KRATOS_WATCH("BUILDING MASS MATRICES ")
898  boost::numeric::ublas::bounded_matrix<double,TDim+1,TDim> DN_DX;
900  array_1d<unsigned int ,TDim+1> local_indices;
901  //array_1d<double,TDim+1> rhs_contribution;
902  double Volume;
903  double temp;
904  //getting the dof position
905  unsigned int dof_position = (r_model_part.NodesBegin())->GetDofPosition(DISPLACEMENT_X);
906 
907  double aaa = 1.0/(TDim+1.0);
908 
909  for(ModelPart::ElementsContainerType::iterator i = r_model_part.ElementsBegin(); i!=r_model_part.ElementsEnd(); i++)
910  {
911 
912  Geometry< Node >& geom = i->GetGeometry();
913  //counting number of structural nodes
914  unsigned int str_nr=0;
915  //for (int k = 0;k<TDim+1;k++)
916  for (unsigned int k = 0; k<geom.size(); k++)
917  {
918  str_nr+=int(i->GetGeometry()[k].FastGetSolutionStepValue(IS_STRUCTURE));
919  }
920  //we do not do anything for the elements of the structure (all nodes are IS_STR)
921  if (geom.size()!=str_nr)
922  {
923 
924  GeometryUtils::CalculateGeometryData(geom, DN_DX, N, Volume);
925  if (Volume<0)
926  Volume*=-1.0;
927 
928  //finiding local indices
929  //for(int ii = 0; ii<TDim+1; ii++)
930  for(unsigned int ii = 0; ii<geom.size(); ii++)
931  {
932  local_indices[ii] = geom[ii].GetDof(DISPLACEMENT_X,dof_position).EquationId();
933  }
934 
935  temp = Volume*aaa;
936  for(unsigned int row = 0; row<TDim+1; row++)
937  {
938  unsigned int row_index = local_indices[row] / (TDim);
939  mMdiagInv[row_index] += temp;
940  }
941  }
942 
943  }
944  //KRATOS_WATCH(mMdiagInv)
945  //inverting the mass matrix
946  for(unsigned int i = 0; i<TSparseSpace::Size(mMdiagInv); i++)
947  {
948  if (mMdiagInv[i]>1e-26)
949  mMdiagInv[i] = 1.0/mMdiagInv[i];
950  else //if (mMdiagInv[i]==0.0)
951  {
952 
953  //KRATOS_WATCH(mMdiagInv[i])
954  //KRATOS_THROW_ERROR(std::logic_error,"something is wrong with the mass matrix entry - ZERO!!!","")
955  mMdiagInv[i] = 1000000000000.0;
956 
957  //KRATOS_WATCH(mMdiagInv[i])
958  //KRATOS_THROW_ERROR(std::logic_error,"Zero ELEMENT VOLUMEE!!!!!!!!!!!!!!","")
959  //mMdiagInv[i] = 0.0;
960 
961  }
962  }
963 
964  //KRATOS_WATCH(mMdiagInv)
965  //AND NOW WE BUILD THE CONSISTENT MASS MATRIX
966 
967  for(ModelPart::ElementsContainerType::iterator i = r_model_part.ElementsBegin(); i!=r_model_part.ElementsEnd(); i++)
968  {
969 
970  Geometry< Node >& geom = i->GetGeometry();
971  unsigned int str_nr=0;
972  for (unsigned int k = 0; k<i->GetGeometry().size(); k++)
973  {
974  str_nr+=(unsigned int)(i->GetGeometry()[k].FastGetSolutionStepValue(IS_STRUCTURE));
975  }
976 
977  if (geom.size()!=str_nr)
978  {
979 
980  GeometryUtils::CalculateGeometryData(geom, DN_DX, N, Volume);
981  if (Volume<0)
982  Volume*=-1.0;
983  //finiding local indices
984  //for(int ii = 0; ii<TDim+1; ii++)
985  for(unsigned int ii = 0; ii<geom.size(); ii++)
986  {
987  local_indices[ii] = geom[ii].GetDof(DISPLACEMENT_X,dof_position).EquationId();
988  }
989 
990  temp = Volume*aaa;
991  //element mass matrix has a shape:
992  // 2 1 1
993  // A/12.0* 1 2 1 in 2D
994  // 1 1 2
995  //
996  // and
997  //
998  // 2 1 1 1
999  // V/20.0* 1 2 1 1 in 3D
1000  // 1 1 2 1
1001  // 1 1 1 2
1002 
1003  //nothing should be added in case of mmassembrane
1004  for(unsigned int row = 0; row<TDim+1; row++)
1005  {
1006  unsigned int row_index = local_indices[row] / (TDim); //pressure is a scalar=>matrix size is Tdim times smaller than for vector
1007  for(unsigned int col = 0; col<TDim+1; col++)
1008  {
1009  unsigned int col_index = local_indices[col] /(TDim);
1010  if (row_index==col_index)
1011  {
1012  //Mconsistent(row_index,col_index) += temp * 2.0;
1013  if constexpr (TDim==2)
1014  Mconsistent(row_index,col_index) += 0.25*temp * 2.0;
1015  else if constexpr (TDim==3)
1016  Mconsistent(row_index,col_index) += 0.2*temp * 2.0;
1017  }
1018  else
1019  {
1020 
1021  //Mconsistent(row_index,col_index) += temp ;
1022  if constexpr (TDim==2)
1023  Mconsistent(row_index,col_index) += 0.25*temp ;
1024  else if constexpr (TDim==3)
1025  Mconsistent(row_index,col_index) += 0.2*temp;
1026 
1027  }
1028  }
1029 
1030 
1031  }
1032  }
1033  }
1034 
1035  // KRATOS_WATCH("FINISHED BUILDING MASS MATRICES ")
1036  KRATOS_CATCH("")
1037 
1038  }
1039 
1040  //************************************
1041  //************************************
1043  {
1044 
1045  KRATOS_TRY
1046 
1048 
1049  bool inv_element=false;
1050  unsigned int bad_elements_number=0;
1052 
1053  for(ModelPart::ElementsContainerType::iterator im = model_part.ElementsBegin() ; im != model_part.ElementsEnd() ; ++im)
1054  {
1055  //get the geometry
1056  Geometry< Node >& geom = im->GetGeometry();
1057 
1058  double Area = GeometryUtils::CalculateVolume2D(geom);
1059 
1060  if(Area<0.0)
1061  {
1062  inv_element=true;
1063 
1064  //WE MARK THE NODES OF THE INVERTED ELEMENTS
1065  im->GetGeometry()[0].FastGetSolutionStepValue(IS_INTERFACE)=1.0;
1066  im->GetGeometry()[1].FastGetSolutionStepValue(IS_INTERFACE)=1.0;
1067  im->GetGeometry()[2].FastGetSolutionStepValue(IS_INTERFACE)=1.0;
1068  bad_elements_number++;
1069 
1070  }
1071  }
1072  KRATOS_WATCH("Number of bad elements!")
1073  KRATOS_WATCH(bad_elements_number)
1074  unsigned int bad_nodes=0;
1075  for(ModelPart::NodesContainerType::iterator in = model_part.NodesBegin() ; in != model_part.NodesEnd() ; ++in)
1076  {
1077  if (in->FastGetSolutionStepValue(IS_INTERFACE)==1.0)
1078  bad_nodes++;
1079  }
1081  while (bad_nodes>=1)
1082  {
1083 
1084  for(ModelPart::NodesContainerType::iterator in = model_part.NodesBegin() ; in != model_part.NodesEnd() ; ++in)
1085  {
1086  //of thats a node of a bad element...
1087  if (in->FastGetSolutionStepValue(IS_INTERFACE)==1.0)
1088  {
1090  double p=0.0;
1091  unsigned int counter=0;
1092 
1093  for (GlobalPointersVector< Node >::iterator i = in->GetValue(NEIGHBOUR_NODES).begin();
1094  i != in->GetValue(NEIGHBOUR_NODES).end(); i++)
1095  {
1096  //If the a node is a node of a "good neighbor"
1097  if (i->FastGetSolutionStepValue(IS_INTERFACE)==0.0)
1098  {
1099 
1100  v+=i->FastGetSolutionStepValue(VELOCITY);
1101  p+=i->FastGetSolutionStepValue(PRESSURE);
1102 
1103  counter++;
1104  }
1105 
1106 
1107  }
1108  //if the node has at least one "good" neighbor
1109  if (counter>=1)
1110  {
1111  //averaging
1112 
1113  v/=counter;
1114  p/=counter;
1115  in->FastGetSolutionStepValue(VELOCITY)=v;
1116  in->FastGetSolutionStepValue(PRESSURE)=p;
1117  in->FastGetSolutionStepValue(PRESSURE,1)=p;
1118  in->FastGetSolutionStepValue(IS_INTERFACE)=0.0;
1119  bad_nodes+=-1;
1120 
1121 
1122  }
1123  else{
1124  if(in->FastGetSolutionStepValue(IS_STRUCTURE)==1.0)
1125  {
1126  }
1127  else
1128  {
1129  in->Set(TO_ERASE,true);
1130  KRATOS_WATCH("Counter is zero.. no clean node " );
1131  KRATOS_WATCH(in->X());
1132  KRATOS_WATCH(in->Y());
1133  bad_nodes+=-1;
1134  }
1135  }
1136  //closing if
1137  }
1138  //closing for
1139  }
1140  //closing while
1141  }
1142  KRATOS_WATCH("Finished While Loop, number of bad nodes is")
1143  KRATOS_WATCH(bad_nodes)
1144  if (bad_nodes==0)
1145  inv_element=false;
1146  return inv_element;
1147  KRATOS_CATCH("")
1148  }
1149  //******************************************************************************************************
1150  //******************************************************************************************************
1151  virtual void SetEchoLevel(int Level)
1152  {
1153  //mfracvel_x_strategy->SetEchoLevel(Level);
1154  //mfracvel_y_strategy->SetEchoLevel(Level);
1155  //if(mdomain_size == 3)
1156  // mfracvel_z_strategy->SetEchoLevel(Level);
1157  //
1158  mpressurestep->SetEchoLevel(Level);
1159  }
1160  //******************************************************************************************************
1161  //******************************************************************************************************
1162  virtual void Clear()
1163  {
1164  KRATOS_WATCH("RungeKuttaFractStepGLSStrategy Clear Function called");
1165  //mfracvel_x_strategy->Clear();
1166  //mfracvel_y_strategy->Clear();
1167  //if(mdomain_size == 3)
1168  // mfracvel_z_strategy->Clear();
1169  mpressurestep->Clear();
1170  }
1171 
1172 
1200  protected:
1209  //typename BaseType::Pointer mfracvel_x_strategy;
1210  //typename BaseType::Pointer mfracvel_y_strategy;
1211  //typename BaseType::Pointer mfracvel_z_strategy;
1212  typename BaseType::Pointer mpressurestep;
1213 
1214  //double mvelocity_toll;
1216  //unsigned int mdomain_size;
1217  //int mMaxVelIterations;
1218  //int mMaxPressIterations;
1219  //unsigned int mtime_order;
1220  //unsigned int mprediction_order;
1221  //bool mpredictor_corrector;
1223 
1224  //double mmin_conv_vel_norm;
1225 
1226 
1255  private:
1263  /*
1264  unsigned int m_step;
1265  int mdomain_size;
1266  double mOldDt;
1267  */
1268  //ModelPart& model_part;
1269 
1270  DofsArrayType mFixedVelocityDofSet;
1271  std::vector<double> mFixedVelocityDofValues;
1272  PointVector mSlipBoundaryList;
1273  //bool proj_is_initialized;
1274 
1275 
1279  //this funcion is needed to ensure that all the memory is allocated correctly
1280 
1281 
1304 
1305 
1308  }; /* Class RungeKuttaFracStepStrategy */
1309 
1318 } /* namespace Kratos.*/
1319 
1320 #endif /* KRATOS_RUNGE_KUTTA_GLS_STRATEGY defined */
1321 
Base class for all Elements.
Definition: element.h:60
Short class definition.
Definition: fluid_2dGLS_expl.h:61
Geometry base class.
Definition: geometry.h:71
SizeType size() const
Definition: geometry.h:518
static double CalculateVolume2D(const GeometryType &rGeometry)
This function computes the element's volume (with sign)
Definition: geometry_utilities.h:292
static void CalculateGeometryData(const GeometryType &rGeometry, BoundedMatrix< double, 4, 3 > &rDN_DX, array_1d< double, 4 > &rN, double &rVolume)
This function is designed to compute the shape function derivatives, shape functions and volume in 3D...
Definition: geometry_utilities.h:176
boost::indirect_iterator< typename TContainerType::iterator > iterator
Definition: global_pointers_vector.h:79
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::TSystemMatrixType TSystemMatrixType
Definition: implicit_solving_strategy.h:70
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
MeshType::NodeIterator NodeIterator
Definition: model_part.h:134
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
ElementIterator ElementsEnd(IndexType ThisIndex=0)
Definition: model_part.h:1179
MeshType::ElementIterator ElementIterator
Definition: model_part.h:174
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
This class defines the node.
Definition: node.h:65
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
void clear()
Clear the set, removing all elements.
Definition: pointer_vector_set.h:663
boost::indirect_iterator< typename TContainerType::iterator > iterator
Definition: pointer_vector_set.h:95
void push_back(TPointerType x)
Adds a pointer to the end of the set.
Definition: pointer_vector_set.h:544
iterator begin()
Returns an iterator pointing to the beginning of the container.
Definition: pointer_vector_set.h:278
iterator end()
Returns an iterator pointing to the end of the container.
Definition: pointer_vector_set.h:314
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
This class provides the implementation of a static scheme.
Definition: residualbased_incrementalupdate_static_scheme.h:57
This is a very simple strategy to solve linearly the problem.
Definition: residualbased_linear_strategy.h:64
Short class definition.
Definition: runge_kutta_fracstep_GLS_strategy.h:100
void ApplyVelocityBoundaryConditions(DofsArrayType &mFixedVelocityDofSet, std::vector< double > &mFixedVelocityDofValues)
Definition: runge_kutta_fracstep_GLS_strategy.h:303
ImplicitSolvingStrategy< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition: runge_kutta_fracstep_GLS_strategy.h:110
double mpressure_toll
Definition: runge_kutta_fracstep_GLS_strategy.h:1215
bool CalculateLumpedMassAux()
Definition: runge_kutta_fracstep_GLS_strategy.h:1042
virtual void Clear()
Clears the internal storage.
Definition: runge_kutta_fracstep_GLS_strategy.h:1162
Node::Pointer PointPointerType
Definition: runge_kutta_fracstep_GLS_strategy.h:128
std::vector< unsigned int > IndicesVectorType
Definition: runge_kutta_fracstep_GLS_strategy.h:106
void SaveAccelerations()
Definition: runge_kutta_fracstep_GLS_strategy.h:849
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: runge_kutta_fracstep_GLS_strategy.h:124
void SavePressureIt()
Definition: runge_kutta_fracstep_GLS_strategy.h:834
virtual void SetEchoLevel(int Level)
This sets the level of echo for the solving strategy.
Definition: runge_kutta_fracstep_GLS_strategy.h:1151
BaseType::TDataType TDataType
Definition: runge_kutta_fracstep_GLS_strategy.h:112
void AssembleMassMatrices(TSystemMatrixType &Mconsistent, TSystemVectorType &mMdiagInv, ModelPart &r_model_part)
Definition: runge_kutta_fracstep_GLS_strategy.h:893
void SolveStep1()
Definition: runge_kutta_fracstep_GLS_strategy.h:337
BaseType::DofsArrayType DofsArrayType
Definition: runge_kutta_fracstep_GLS_strategy.h:116
double Solve()
Definition: runge_kutta_fracstep_GLS_strategy.h:275
virtual ~RungeKuttaFracStepStrategy()
Definition: runge_kutta_fracstep_GLS_strategy.h:268
void SetToZero(Variable< double > &rVariable, ModelPart::NodesContainerType &rNodes)
Definition: runge_kutta_fracstep_GLS_strategy.h:328
BaseType::TSystemVectorType TSystemVectorType
Definition: runge_kutta_fracstep_GLS_strategy.h:120
BaseType::Pointer mpressurestep
Definition: runge_kutta_fracstep_GLS_strategy.h:1212
double SolveStep2()
Definition: runge_kutta_fracstep_GLS_strategy.h:654
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: runge_kutta_fracstep_GLS_strategy.h:122
std::vector< PointType::Pointer > PointVector
Definition: runge_kutta_fracstep_GLS_strategy.h:130
Node PointType
Definition: runge_kutta_fracstep_GLS_strategy.h:126
PointVector::iterator PointIterator
Definition: runge_kutta_fracstep_GLS_strategy.h:132
void SolveStep3()
Definition: runge_kutta_fracstep_GLS_strategy.h:665
RungeKuttaFracStepStrategy(ModelPart &model_part, typename TLinearSolver::Pointer pNewPressureLinearSolver, bool CalculateReactions=false, bool ReformDofAtEachIteration=true, bool CalculateNormDxFlag=true)
Definition: runge_kutta_fracstep_GLS_strategy.h:143
bool mReformDofAtEachIteration
Definition: runge_kutta_fracstep_GLS_strategy.h:1222
void ApplySlipBC()
Definition: runge_kutta_fracstep_GLS_strategy.h:865
BaseType::TSystemMatrixType TSystemMatrixType
Definition: runge_kutta_fracstep_GLS_strategy.h:118
KRATOS_CLASS_POINTER_DEFINITION(RungeKuttaFracStepStrategy)
void SetToZero(Variable< array_1d< double, 3 > > &rVariable, ModelPart::NodesContainerType &rNodes)
Definition: runge_kutta_fracstep_GLS_strategy.h:318
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
TDenseSpace::MatrixType LocalSystemMatrixType
Definition: solving_strategy.h:79
TSparseSpace::DataType TDataType
Definition: solving_strategy.h:69
ModelPart & GetModelPart()
Operations to get the pointer to the model.
Definition: solving_strategy.h:350
TSparseSpace::MatrixType TSystemMatrixType
Definition: solving_strategy.h:71
TSparseSpace::VectorType TSystemVectorType
Definition: solving_strategy.h:73
TDenseSpace::VectorType LocalSystemVectorType
Definition: solving_strategy.h:81
static void Start(std::string const &rIntervalName)
This method starts the timer meassures.
Definition: timer.cpp:109
static void Stop(std::string const &rIntervalName)
This method stops the timer meassures.
Definition: timer.cpp:125
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_WATCH(variable)
Definition: define.h:806
#define KRATOS_TRY
Definition: define.h:109
dt
Definition: DEM_benchmarks.py:173
im
Definition: GenerateCN.py:100
TSpaceType::IndexType Size(TSpaceType &dummy, typename TSpaceType::VectorType const &rV)
Definition: add_strategies_to_python.cpp:111
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
TExpression1Type::data_type inner_prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:592
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
AMatrix::MatrixRow< const TExpressionType > row(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression, std::size_t RowIndex)
Definition: amatrix_interface.h:649
AMatrix::TransposeMatrix< const T > trans(const T &TheMatrix)
Definition: amatrix_interface.h:486
REACTION_CHECK_STIFFNESS_FACTOR int
Definition: contact_structural_mechanics_application_variables.h:75
AMatrix::MatrixColumn< const TExpressionType > column(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression, std::size_t ColumnIndex)
Definition: amatrix_interface.h:637
model_part
Definition: face_heat.py:14
v
Definition: generate_convection_diffusion_explicit_element.py:114
vel
Definition: pure_conduction.py:76
int k
Definition: quadrature.py:595
el
Definition: read_stl.py:25
float temp
Definition: rotating_cone.py:85
float delta_t
Definition: rotatingcone_PureConvectionBenchmarking.py:129
int counter
Definition: script_THERMAL_CORRECT.py:218
dummy
Definition: script.py:194
p
Definition: sensitivityMatrix.py:52
N
Definition: sensitivityMatrix.py:29
volume
Definition: sp_statistics.py:15
integer i
Definition: TensorModule.f:17
zero
Definition: test_pureconvectionsolver_benchmarking.py:94
ReformDofAtEachIteration
Definition: test_pureconvectionsolver_benchmarking.py:131
e
Definition: run_cpp_mpi_tests.py:31