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.
poro_explicit_cd_scheme.hpp
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license:
9 //kratos/license.txt
10 //
11 // Main authors: Ignasi de Pouplana
12 //
13 //
14 
15 #if !defined(KRATOS_PORO_EXPLICIT_CD_SCHEME_HPP_INCLUDED)
16 #define KRATOS_PORO_EXPLICIT_CD_SCHEME_HPP_INCLUDED
17 
18 /* External includes */
19 
20 /* Project includes */
23 
24 // Application includes
26 
27 namespace Kratos {
28 
31 
35 
37 
40 
44 
48 
55 template <class TSparseSpace,
56  class TDenseSpace //= DenseSpace<double>
57  >
59  : public Scheme<TSparseSpace, TDenseSpace> {
60 
61 public:
64 
67 
73 
78 
80  typedef std::size_t SizeType;
81 
83  typedef std::size_t IndexType;
84 
87 
89  static constexpr double numerical_limit = std::numeric_limits<double>::epsilon();
90 
93 
97 
103  : Scheme<TSparseSpace, TDenseSpace>() {}
104 
108 
112 
121  int Check(const ModelPart& rModelPart) const override
122  {
123  KRATOS_TRY;
124 
125  BaseType::Check(rModelPart);
126 
127  KRATOS_ERROR_IF(rModelPart.GetBufferSize() < 2) << "Insufficient buffer size for CD Scheme. It has to be >= 2" << std::endl;
128 
129  KRATOS_ERROR_IF_NOT(rModelPart.GetProcessInfo().Has(DOMAIN_SIZE)) << "DOMAIN_SIZE not defined on ProcessInfo. Please define" << std::endl;
130 
131  return 0;
132 
133  KRATOS_CATCH("");
134  }
135 
140  void Initialize(ModelPart& rModelPart) override
141  {
142  KRATOS_TRY
143 
144  const ProcessInfo& r_current_process_info = rModelPart.GetProcessInfo();
145 
146  // Preparing the time values for the first step (where time = initial_time +
147  // dt)
148  mDeltaTime = r_current_process_info[DELTA_TIME];
149  mAlpha = r_current_process_info[RAYLEIGH_ALPHA];
150  mBeta = r_current_process_info[RAYLEIGH_BETA];
151  mTheta = r_current_process_info[THETA_FACTOR];
152  mGCoefficient = r_current_process_info[G_COEFFICIENT];
153 
155  const SizeType dim = r_current_process_info[DOMAIN_SIZE];
156 
157  // Initialize scheme
159  InitializeExplicitScheme(rModelPart, dim);
160  else
161  SchemeCustomInitialization(rModelPart, dim);
162 
164 
165  KRATOS_CATCH("")
166  }
167 
168  // /**
169  // * @brief This is the place to initialize the elements.
170  // * @details This is intended to be called just once when the strategy is initialized
171  // * @param rModelPart The model part of the problem to solve
172  // */
173  void InitializeElements( ModelPart& rModelPart) override
174  {
175  KRATOS_TRY
176 
177  const ProcessInfo& CurrentProcessInfo = rModelPart.GetProcessInfo();
178 
179  int NElems = static_cast<int>(rModelPart.Elements().size());
180  ModelPart::ElementsContainerType::iterator el_begin = rModelPart.ElementsBegin();
181 
182  // #pragma omp parallel for
183  for(int i = 0; i < NElems; i++)
184  {
185  ModelPart::ElementsContainerType::iterator itElem = el_begin + i;
186  itElem -> Initialize(CurrentProcessInfo);
187  }
188 
190 
191  KRATOS_CATCH("")
192  }
193 
200  ModelPart& rModelPart,
201  const SizeType DomainSize = 3
202  )
203  {
204  KRATOS_TRY
205 
207  NodesArrayType& r_nodes = rModelPart.Nodes();
208 
209  // The first iterator of the array of nodes
210  const auto it_node_begin = rModelPart.NodesBegin();
211 
213  #pragma omp parallel for schedule(guided,512)
214  for (int i = 0; i < static_cast<int>(r_nodes.size()); ++i) {
215  auto it_node = (it_node_begin + i);
216  it_node->SetValue(NODAL_MASS, 0.0);
217  // TODO: Set Nodal AntiCompressibility to zero for mass-balance equation (C=1/Q, with Q being the compressibility coeff.)
218  array_1d<double, 3>& r_force_residual = it_node->FastGetSolutionStepValue(FORCE_RESIDUAL);
219  double& r_flux_residual = it_node->FastGetSolutionStepValue(FLUX_RESIDUAL);
220  array_1d<double, 3>& r_external_force = it_node->FastGetSolutionStepValue(EXTERNAL_FORCE);
221  array_1d<double, 3>& r_internal_force = it_node->FastGetSolutionStepValue(INTERNAL_FORCE);
222  noalias(r_force_residual) = ZeroVector(3);
223  r_flux_residual = 0.0;
224  noalias(r_external_force) = ZeroVector(3);
225  noalias(r_internal_force) = ZeroVector(3);
226  Matrix& rInitialStress = it_node->FastGetSolutionStepValue(INITIAL_STRESS_TENSOR);
227  if(rInitialStress.size1() != 3)
228  rInitialStress.resize(3,3,false);
229  noalias(rInitialStress) = ZeroMatrix(3,3);
230  }
231 
232  KRATOS_CATCH("")
233  }
234 
241  ModelPart& rModelPart,
242  const SizeType DomainSize = 3
243  )
244  {
245  KRATOS_TRY
246 
247  KRATOS_CATCH("")
248  }
249 
259  ModelPart& rModelPart,
260  TSystemMatrixType& rA,
261  TSystemVectorType& rDx,
263  ) override
264  {
265  KRATOS_TRY
266 
267  BaseType::InitializeSolutionStep(rModelPart, rA, rDx, rb);
268 
269  InitializeResidual(rModelPart);
270 
271  KRATOS_CATCH("")
272  }
273 
278  virtual void InitializeResidual(ModelPart& rModelPart)
279  {
280  KRATOS_TRY
281 
282  // The array of nodes
283  NodesArrayType& r_nodes = rModelPart.Nodes();
284 
285  // Auxiliar values
286  const array_1d<double, 3> zero_array = ZeroVector(3);
287  // Initializing the variables
288  VariableUtils().SetVariable(FORCE_RESIDUAL, zero_array,r_nodes);
289  VariableUtils().SetVariable(FLUX_RESIDUAL, 0.0,r_nodes);
290  VariableUtils().SetVariable(EXTERNAL_FORCE, zero_array,r_nodes);
291  VariableUtils().SetVariable(INTERNAL_FORCE, zero_array,r_nodes);
292 
293  KRATOS_CATCH("")
294  }
295 
296 
306  ModelPart& rModelPart,
307  TSystemMatrixType& rA,
308  TSystemVectorType& rDx,
310  ) override
311  {
312  KRATOS_TRY;
313 
314  const ProcessInfo& r_current_process_info = rModelPart.GetProcessInfo();
315 
316  const auto it_elem_begin = rModelPart.ElementsBegin();
317  #pragma omp parallel for schedule(guided,512)
318  for(int i=0; i<static_cast<int>(rModelPart.Elements().size()); ++i) {
319  auto it_elem = it_elem_begin + i;
320  it_elem->InitializeNonLinearIteration(r_current_process_info);
321  }
322 
323  const auto it_cond_begin = rModelPart.ConditionsBegin();
324  #pragma omp parallel for schedule(guided,512)
325  for(int i=0; i<static_cast<int>(rModelPart.Conditions().size()); ++i) {
326  auto it_elem = it_cond_begin + i;
327  it_elem->InitializeNonLinearIteration(r_current_process_info);
328  }
329 
330  KRATOS_CATCH( "" );
331  }
332 
333  void Predict(
334  ModelPart& rModelPart,
335  DofsArrayType& rDofSet,
337  TSystemVectorType& Dx,
339  ) override
340  {
341  KRATOS_TRY;
342 
343  this->CalculateAndAddRHS(rModelPart);
344 
345  KRATOS_CATCH("")
346  }
347 
348  virtual void CalculateAndAddRHS(ModelPart& rModelPart)
349  {
350  KRATOS_TRY
351 
352  const ProcessInfo& r_current_process_info = rModelPart.GetProcessInfo();
353  ConditionsArrayType& r_conditions = rModelPart.Conditions();
354  ElementsArrayType& r_elements = rModelPart.Elements();
355 
356  LocalSystemVectorType RHS_Contribution = LocalSystemVectorType(0);
357  Element::EquationIdVectorType equation_id_vector_dummy; // Dummy
358 
359  #pragma omp parallel for firstprivate(RHS_Contribution, equation_id_vector_dummy), schedule(guided,512)
360  for (int i = 0; i < static_cast<int>(r_conditions.size()); ++i) {
361  auto it_cond = r_conditions.begin() + i;
362  CalculateRHSContribution(*it_cond, RHS_Contribution, equation_id_vector_dummy, r_current_process_info);
363  }
364 
365  #pragma omp parallel for firstprivate(RHS_Contribution, equation_id_vector_dummy), schedule(guided,512)
366  for (int i = 0; i < static_cast<int>(r_elements.size()); ++i) {
367  auto it_elem = r_elements.begin() + i;
368  CalculateRHSContribution(*it_elem, RHS_Contribution, equation_id_vector_dummy, r_current_process_info);
369  }
370 
371  KRATOS_CATCH("")
372  }
373 
382  Element& rCurrentElement,
383  LocalSystemVectorType& RHS_Contribution,
385  const ProcessInfo& rCurrentProcessInfo
386  ) override
387  {
388  KRATOS_TRY
389 
390  // this->TCalculateRHSContribution(rCurrentElement, RHS_Contribution, rCurrentProcessInfo);
391  // rCurrentElement.CalculateRightHandSide(RHS_Contribution, rCurrentProcessInfo);
392  rCurrentElement.AddExplicitContribution(RHS_Contribution, RESIDUAL_VECTOR, FORCE_RESIDUAL, rCurrentProcessInfo);
393 
394  KRATOS_CATCH("")
395  }
396 
405  Condition& rCurrentCondition,
406  LocalSystemVectorType& RHS_Contribution,
408  const ProcessInfo& rCurrentProcessInfo
409  ) override
410  {
411  KRATOS_TRY
412 
413  // this->TCalculateRHSContribution(rCurrentCondition, RHS_Contribution, rCurrentProcessInfo);
414  rCurrentCondition.CalculateRightHandSide(RHS_Contribution, rCurrentProcessInfo);
415  rCurrentCondition.AddExplicitContribution(RHS_Contribution, RESIDUAL_VECTOR, FORCE_RESIDUAL, rCurrentProcessInfo);
416 
417  KRATOS_CATCH("")
418  }
419 
428  void Update(
429  ModelPart& rModelPart,
430  DofsArrayType& rDofSet,
431  TSystemMatrixType& rA,
432  TSystemVectorType& rDx,
434  ) override
435  {
436  KRATOS_TRY
437  // The current process info
438  const ProcessInfo& r_current_process_info = rModelPart.GetProcessInfo();
439 
440  // The array of nodes
441  NodesArrayType& r_nodes = rModelPart.Nodes();
442 
444  const SizeType dim = r_current_process_info[DOMAIN_SIZE];
445 
446  // Step Update
447  mDeltaTime = r_current_process_info[DELTA_TIME];
448 
449  // The iterator of the first node
450  const auto it_node_begin = rModelPart.NodesBegin();
451 
452  // Getting dof position
453  const IndexType disppos = it_node_begin->GetDofPosition(DISPLACEMENT_X);
454 
455  #pragma omp parallel for schedule(guided,512)
456  for (int i = 0; i < static_cast<int>(r_nodes.size()); ++i) {
457  // Current step information "N+1" (before step update).
458  this->UpdateTranslationalDegreesOfFreedom(it_node_begin + i, disppos, dim);
459  } // for Node parallel
460 
461  KRATOS_CATCH("")
462  }
463 
471  NodeIterator itCurrentNode,
472  const IndexType DisplacementPosition,
473  const SizeType DomainSize = 3
474  )
475  {
476  array_1d<double, 3>& r_displacement = itCurrentNode->FastGetSolutionStepValue(DISPLACEMENT);
477  array_1d<double, 3> displacement_aux;
478  noalias(displacement_aux) = r_displacement;
479  array_1d<double, 3>& r_displacement_old = itCurrentNode->FastGetSolutionStepValue(DISPLACEMENT_OLD);
480  // array_1d<double, 3>& r_displacement_older = itCurrentNode->FastGetSolutionStepValue(DISPLACEMENT_OLDER);
481  const double nodal_mass = itCurrentNode->GetValue(NODAL_MASS);
482 
483  double& r_current_water_pressure = itCurrentNode->FastGetSolutionStepValue(WATER_PRESSURE);
484  double& r_current_dt_water_pressure = itCurrentNode->FastGetSolutionStepValue(DT_WATER_PRESSURE);
485 
486  const array_1d<double, 3>& r_external_force = itCurrentNode->FastGetSolutionStepValue(EXTERNAL_FORCE);
487  const array_1d<double, 3>& r_external_force_old = itCurrentNode->FastGetSolutionStepValue(EXTERNAL_FORCE,1);
488  const array_1d<double, 3>& r_internal_force = itCurrentNode->FastGetSolutionStepValue(INTERNAL_FORCE);
489  const array_1d<double, 3>& r_internal_force_old = itCurrentNode->FastGetSolutionStepValue(INTERNAL_FORCE,1);
490 
491  std::array<bool, 3> fix_displacements = {false, false, false};
492  fix_displacements[0] = (itCurrentNode->GetDof(DISPLACEMENT_X, DisplacementPosition).IsFixed());
493  fix_displacements[1] = (itCurrentNode->GetDof(DISPLACEMENT_Y, DisplacementPosition + 1).IsFixed());
494  if (DomainSize == 3)
495  fix_displacements[2] = (itCurrentNode->GetDof(DISPLACEMENT_Z, DisplacementPosition + 2).IsFixed());
496 
497  for (IndexType j = 0; j < DomainSize; j++) {
498  if (fix_displacements[j] == false) {
499  r_displacement[j] = ( (2.0*(1.0+mGCoefficient*mDeltaTime)-mAlpha*mDeltaTime)*nodal_mass*r_displacement[j]
500  + (mAlpha*mDeltaTime-(1.0+mGCoefficient*mDeltaTime))*nodal_mass*r_displacement_old[j]
501  - mDeltaTime*(mBeta+mTheta*mDeltaTime)*r_internal_force[j]
502  + mDeltaTime*(mBeta-mDeltaTime*(1.0-mTheta))*r_internal_force_old[j]
503  + mDeltaTime*mDeltaTime*(mTheta*r_external_force[j]+(1.0-mTheta)*r_external_force_old[j])
504  ) / ( nodal_mass*(1.0+mGCoefficient*mDeltaTime) );
505  }
506  }
507 
508  // Solution of the darcy_equation
509  if( itCurrentNode->IsFixed(WATER_PRESSURE) == false ) {
510  // TODO: this is on standby
511  r_current_water_pressure = 0.0;
512  r_current_dt_water_pressure = 0.0;
513  }
514 
515  noalias(r_displacement_old) = displacement_aux;
516  const array_1d<double, 3>& r_velocity_old = itCurrentNode->FastGetSolutionStepValue(VELOCITY,1);
517  array_1d<double, 3>& r_velocity = itCurrentNode->FastGetSolutionStepValue(VELOCITY);
518  array_1d<double, 3>& r_acceleration = itCurrentNode->FastGetSolutionStepValue(ACCELERATION);
519 
520  noalias(r_velocity) = (1.0/mDeltaTime) * (r_displacement - r_displacement_old);
521  noalias(r_acceleration) = (1.0/mDeltaTime) * (r_velocity - r_velocity_old);
522  }
523 
532  ModelPart& rModelPart,
534  TSystemVectorType& Dx,
536  ) override
537  {
538  KRATOS_TRY
539 
540  BaseType::FinalizeNonLinIteration(rModelPart, A, Dx, b);
541 
542  this->CalculateAndAddRHSFinal(rModelPart);
543 
544  KRATOS_CATCH("")
545  }
546 
547  virtual void CalculateAndAddRHSFinal(ModelPart& rModelPart)
548  {
549  KRATOS_TRY
550 
551  // The array of nodes
552  NodesArrayType& r_nodes = rModelPart.Nodes();
553 
554  // Auxiliar values
555  const array_1d<double, 3> zero_array = ZeroVector(3);
556  // Initializing the variables
557  VariableUtils().SetVariable(FORCE_RESIDUAL, zero_array, r_nodes);
558  VariableUtils().SetVariable(FLUX_RESIDUAL, 0.0, r_nodes);
559 
560  const ProcessInfo& r_current_process_info = rModelPart.GetProcessInfo();
561  ConditionsArrayType& r_conditions = rModelPart.Conditions();
562  ElementsArrayType& r_elements = rModelPart.Elements();
563 
564  LocalSystemVectorType RHS_Contribution = LocalSystemVectorType(0);
565  Element::EquationIdVectorType equation_id_vector_dummy; // Dummy
566 
567  #pragma omp parallel for firstprivate(RHS_Contribution, equation_id_vector_dummy), schedule(guided,512)
568  for (int i = 0; i < static_cast<int>(r_conditions.size()); ++i) {
569  auto it_cond = r_conditions.begin() + i;
570  CalculateRHSContributionResidual(*it_cond, RHS_Contribution, equation_id_vector_dummy, r_current_process_info);
571  }
572 
573  #pragma omp parallel for firstprivate(RHS_Contribution, equation_id_vector_dummy), schedule(guided,512)
574  for (int i = 0; i < static_cast<int>(r_elements.size()); ++i) {
575  auto it_elem = r_elements.begin() + i;
576  CalculateRHSContributionResidual(*it_elem, RHS_Contribution, equation_id_vector_dummy, r_current_process_info);
577  }
578 
579  KRATOS_CATCH("")
580  }
581 
590  Element& rCurrentElement,
591  LocalSystemVectorType& RHS_Contribution,
593  const ProcessInfo& rCurrentProcessInfo
594  )
595  {
596  KRATOS_TRY
597 
598  // rCurrentElement.CalculateRightHandSide(RHS_Contribution, rCurrentProcessInfo);
599  rCurrentElement.AddExplicitContribution(RHS_Contribution, RESIDUAL_VECTOR, REACTION, rCurrentProcessInfo);
600  KRATOS_CATCH("")
601  }
602 
611  Condition& rCurrentCondition,
612  LocalSystemVectorType& RHS_Contribution,
614  const ProcessInfo& rCurrentProcessInfo
615  )
616  {
617  KRATOS_TRY
618 
619  rCurrentCondition.CalculateRightHandSide(RHS_Contribution, rCurrentProcessInfo);
620  rCurrentCondition.AddExplicitContribution(RHS_Contribution, RESIDUAL_VECTOR, REACTION, rCurrentProcessInfo);
621 
622  KRATOS_CATCH("")
623  }
624 
626  ModelPart& rModelPart,
627  TSystemMatrixType& rA,
628  TSystemVectorType& rDx,
629  TSystemVectorType& rb) override
630  {
631  KRATOS_TRY
632 
633  if(rModelPart.GetProcessInfo()[NODAL_SMOOTHING] == true)
634  {
635  const int NNodes = static_cast<int>(rModelPart.Nodes().size());
636  ModelPart::NodesContainerType::iterator node_begin = rModelPart.NodesBegin();
637 
638  // Clear nodal variables
639  #pragma omp parallel for
640  for(int i = 0; i < NNodes; i++)
641  {
642  ModelPart::NodesContainerType::iterator itNode = node_begin + i;
643 
644  itNode->FastGetSolutionStepValue(NODAL_AREA) = 0.0;
645  Matrix& rNodalStress = itNode->FastGetSolutionStepValue(NODAL_EFFECTIVE_STRESS_TENSOR);
646  if(rNodalStress.size1() != 3)
647  rNodalStress.resize(3,3,false);
648  noalias(rNodalStress) = ZeroMatrix(3,3);
649  array_1d<double,3>& r_nodal_grad_pressure = itNode->FastGetSolutionStepValue(NODAL_WATER_PRESSURE_GRADIENT);
650  noalias(r_nodal_grad_pressure) = ZeroVector(3);
651  itNode->FastGetSolutionStepValue(NODAL_DAMAGE_VARIABLE) = 0.0;
652  itNode->FastGetSolutionStepValue(NODAL_JOINT_AREA) = 0.0;
653  itNode->FastGetSolutionStepValue(NODAL_JOINT_WIDTH) = 0.0;
654  itNode->FastGetSolutionStepValue(NODAL_JOINT_DAMAGE) = 0.0;
655  }
656 
657  BaseType::FinalizeSolutionStep(rModelPart, rA, rDx, rb);
658 
659  // Compute smoothed nodal variables
660  #pragma omp parallel for
661  for(int n = 0; n < NNodes; n++)
662  {
663  ModelPart::NodesContainerType::iterator itNode = node_begin + n;
664 
665  const double& NodalArea = itNode->FastGetSolutionStepValue(NODAL_AREA);
666  if (NodalArea>1.0e-20)
667  {
668  const double InvNodalArea = 1.0/NodalArea;
669  Matrix& rNodalStress = itNode->FastGetSolutionStepValue(NODAL_EFFECTIVE_STRESS_TENSOR);
670  array_1d<double,3>& r_nodal_grad_pressure = itNode->FastGetSolutionStepValue(NODAL_WATER_PRESSURE_GRADIENT);
671  for(unsigned int i = 0; i<3; i++)
672  {
673  r_nodal_grad_pressure[i] *= InvNodalArea;
674  for(unsigned int j = 0; j<3; j++)
675  {
676  rNodalStress(i,j) *= InvNodalArea;
677  }
678  }
679  double& NodalDamage = itNode->FastGetSolutionStepValue(NODAL_DAMAGE_VARIABLE);
680  NodalDamage *= InvNodalArea;
681  }
682 
683  const double& NodalJointArea = itNode->FastGetSolutionStepValue(NODAL_JOINT_AREA);
684  if (NodalJointArea>1.0e-20)
685  {
686  const double InvNodalJointArea = 1.0/NodalJointArea;
687  double& NodalJointWidth = itNode->FastGetSolutionStepValue(NODAL_JOINT_WIDTH);
688  NodalJointWidth *= InvNodalJointArea;
689  double& NodalJointDamage = itNode->FastGetSolutionStepValue(NODAL_JOINT_DAMAGE);
690  NodalJointDamage *= InvNodalJointArea;
691  }
692  }
693  }
694  else
695  {
696  BaseType::FinalizeSolutionStep(rModelPart, rA, rDx, rb);
697  }
698 
699  KRATOS_CATCH("")
700  }
701 
702 
706 
710 
714 
718 
720 
721 protected:
722 
726 
737 
741 
742  double mDeltaTime;
743  double mAlpha;
744  double mBeta;
745  double mTheta;
747 
751 
755 
759 
763 
767 
769 
770 private:
773 
777 
781 
785 
789 
793 
797 
799 
800 }; /* Class PoroExplicitCDScheme */
801 
803 
806 
808 
809 } /* namespace Kratos.*/
810 
811 #endif /* KRATOS_PORO_EXPLICIT_CD_SCHEME_HPP_INCLUDED defined */
Base class for all Conditions.
Definition: condition.h:59
virtual void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: condition.h:440
virtual void AddExplicitContribution(const ProcessInfo &rCurrentProcessInfo)
Definition: condition.h:609
bool Has(const Variable< TDataType > &rThisVariable) const
Checks if the data container has a value associated with a given variable.
Definition: data_value_container.h:382
Base class for all Elements.
Definition: element.h:60
virtual void AddExplicitContribution(const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:622
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
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
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
MeshType::ConditionsContainerType ConditionsContainerType
Condintions container. A vector set of Conditions with their Id's as key.
Definition: model_part.h:183
ConditionIterator ConditionsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1361
MeshType::ElementsContainerType ElementsContainerType
Element container. A vector set of Elements with their Id's as key.
Definition: model_part.h:168
IndexType GetBufferSize() const
This method gets the suffer size of the model part database.
Definition: model_part.h:1876
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
MeshType::NodeIterator NodeIterator
Definition: model_part.h:134
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
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
An explicit forward euler scheme with a split of the inertial term.
Definition: poro_explicit_cd_scheme.hpp:59
void FinalizeSolutionStep(ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
Function called once at the end of a solution step, after convergence is reached if an iterative proc...
Definition: poro_explicit_cd_scheme.hpp:625
BaseType::TSystemMatrixType TSystemMatrixType
Definition: poro_explicit_cd_scheme.hpp:70
ModelPart::ConditionsContainerType ConditionsArrayType
Definition: poro_explicit_cd_scheme.hpp:76
void FinalizeNonLinIteration(ModelPart &rModelPart, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Function to be called when it is needed to finalize an iteration. It is designed to be called at the ...
Definition: poro_explicit_cd_scheme.hpp:531
void Predict(ModelPart &rModelPart, DofsArrayType &rDofSet, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Performing the prediction of the solution.
Definition: poro_explicit_cd_scheme.hpp:333
virtual void UpdateTranslationalDegreesOfFreedom(NodeIterator itCurrentNode, const IndexType DisplacementPosition, const SizeType DomainSize=3)
This method updates the translation DoF.
Definition: poro_explicit_cd_scheme.hpp:470
double mDeltaTime
Definition: poro_explicit_cd_scheme.hpp:742
void InitializeElements(ModelPart &rModelPart) override
This is the place to initialize the elements.
Definition: poro_explicit_cd_scheme.hpp:173
virtual void CalculateRHSContributionResidual(Element &rCurrentElement, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &rCurrentProcessInfo)
This function is designed to calculate just the RHS contribution.
Definition: poro_explicit_cd_scheme.hpp:589
void InitializeSolutionStep(ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
It initializes time step solution. Only for reasons if the time step solution is restarted.
Definition: poro_explicit_cd_scheme.hpp:258
virtual ~PoroExplicitCDScheme()
Definition: poro_explicit_cd_scheme.hpp:107
BaseType::TSystemVectorType TSystemVectorType
Definition: poro_explicit_cd_scheme.hpp:71
Scheme< TSparseSpace, TDenseSpace > BaseType
The definition of the base type.
Definition: poro_explicit_cd_scheme.hpp:66
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: poro_explicit_cd_scheme.hpp:72
ModelPart::NodeIterator NodeIterator
Definition fo the node iterator.
Definition: poro_explicit_cd_scheme.hpp:86
virtual void CalculateRHSContributionResidual(Condition &rCurrentCondition, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &rCurrentProcessInfo)
Functions that calculates the RHS of a "condition" object.
Definition: poro_explicit_cd_scheme.hpp:610
virtual void InitializeExplicitScheme(ModelPart &rModelPart, const SizeType DomainSize=3)
This method initializes some rutines related with the explicit scheme.
Definition: poro_explicit_cd_scheme.hpp:199
ModelPart::NodesContainerType NodesArrayType
Definition: poro_explicit_cd_scheme.hpp:77
BaseType::DofsArrayType DofsArrayType
Some definitions related with the base class.
Definition: poro_explicit_cd_scheme.hpp:69
double mAlpha
Definition: poro_explicit_cd_scheme.hpp:743
double mTheta
Definition: poro_explicit_cd_scheme.hpp:745
double mGCoefficient
Definition: poro_explicit_cd_scheme.hpp:746
std::size_t IndexType
Definition of the index type.
Definition: poro_explicit_cd_scheme.hpp:83
ModelPart::ElementsContainerType ElementsArrayType
The arrays of elements and nodes.
Definition: poro_explicit_cd_scheme.hpp:75
std::size_t SizeType
Definition of the size type.
Definition: poro_explicit_cd_scheme.hpp:80
virtual void CalculateAndAddRHS(ModelPart &rModelPart)
Definition: poro_explicit_cd_scheme.hpp:348
void InitializeNonLinIteration(ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
It initializes the non-linear iteration.
Definition: poro_explicit_cd_scheme.hpp:305
int Check(const ModelPart &rModelPart) const override
This function is designed to be called once to perform all the checks needed on the input provided.
Definition: poro_explicit_cd_scheme.hpp:121
void Update(ModelPart &rModelPart, DofsArrayType &rDofSet, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
Performing the update of the solution.
Definition: poro_explicit_cd_scheme.hpp:428
void Initialize(ModelPart &rModelPart) override
This is the place to initialize the Scheme. This is intended to be called just once when the strategy...
Definition: poro_explicit_cd_scheme.hpp:140
double mBeta
Definition: poro_explicit_cd_scheme.hpp:744
KRATOS_CLASS_POINTER_DEFINITION(PoroExplicitCDScheme)
Counted pointer of PoroExplicitCDScheme.
virtual void InitializeResidual(ModelPart &rModelPart)
This method initializes the residual in the nodes of the model part.
Definition: poro_explicit_cd_scheme.hpp:278
void CalculateRHSContribution(Condition &rCurrentCondition, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &rCurrentProcessInfo) override
Functions that calculates the RHS of a "condition" object.
Definition: poro_explicit_cd_scheme.hpp:404
static constexpr double numerical_limit
The definition of the numerical limit.
Definition: poro_explicit_cd_scheme.hpp:89
virtual void SchemeCustomInitialization(ModelPart &rModelPart, const SizeType DomainSize=3)
This method performs some custom operations to initialize the scheme.
Definition: poro_explicit_cd_scheme.hpp:240
void CalculateRHSContribution(Element &rCurrentElement, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &rCurrentProcessInfo) override
This function is designed to calculate just the RHS contribution.
Definition: poro_explicit_cd_scheme.hpp:381
PoroExplicitCDScheme()
Default constructor.
Definition: poro_explicit_cd_scheme.hpp:102
virtual void CalculateAndAddRHSFinal(ModelPart &rModelPart)
Definition: poro_explicit_cd_scheme.hpp:547
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
typename TSparseSpace::MatrixType TSystemMatrixType
Matrix type definition.
Definition: scheme.h:71
bool SchemeIsInitialized()
This method returns if the scheme is initialized.
Definition: scheme.h:179
void SetSchemeIsInitialized(bool SchemeIsInitializedFlag=true)
This method sets if the elements have been initialized or not (true by default)
Definition: scheme.h:188
ModelPart::ElementsContainerType ElementsArrayType
Elements containers definition.
Definition: scheme.h:89
virtual void EquationId(const Element &rElement, Element::EquationIdVectorType &rEquationId, const ProcessInfo &rCurrentProcessInfo)
This method gets the eqaution id corresponding to the current element.
Definition: scheme.h:636
typename TSparseSpace::VectorType TSystemVectorType
Vector type definition.
Definition: scheme.h:74
typename TDenseSpace::VectorType LocalSystemVectorType
Local system vector type definition.
Definition: scheme.h:80
virtual void FinalizeSolutionStep(ModelPart &rModelPart, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b)
Function called once at the end of a solution step, after convergence is reached if an iterative proc...
Definition: scheme.h:294
virtual void InitializeSolutionStep(ModelPart &rModelPart, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b)
Function called once at the beginning of each solution step.
Definition: scheme.h:272
void SetElementsAreInitialized(bool ElementsAreInitializedFlag=true)
This method sets if the elements have been initialized or not (true by default)
Definition: scheme.h:206
virtual int Check(const ModelPart &rModelPart) const
This function is designed to be called once to perform all the checks needed on the input provided....
Definition: scheme.h:508
ModelPart::ConditionsContainerType ConditionsArrayType
Conditions containers definition.
Definition: scheme.h:92
virtual void FinalizeNonLinIteration(ModelPart &rModelPart, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b)
Function to be called when it is needed to finalize an iteration. It is designed to be called at the ...
Definition: scheme.h:393
This class implements a set of auxiliar, already parallelized, methods to perform some common tasks r...
Definition: variable_utils.h:63
void SetVariable(const TVarType &rVariable, const TDataType &rValue, NodesContainerType &rNodes, const unsigned int Step=0)
Sets the nodal value of a scalar variable.
Definition: variable_utils.h:675
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
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
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
int n
manufactured solution and derivatives (u=0 at z=0 dudz=0 at z=domain_height)
Definition: ode_solve.py:402
int j
Definition: quadrature.py:648
A
Definition: sensitivityMatrix.py:70
int dim
Definition: sensitivityMatrix.py:25
integer i
Definition: TensorModule.f:17