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.
generalized_newmark_GN11_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: kratos/license.txt
9 //
10 // Main authors: Albert Puigferrat Perez
11 // Ignasi de Pouplana
12 //
13 
14 #if !defined(KRATOS_GENERALIZED_NEWMARK_GN11_SCHEME )
15 #define KRATOS_GENERALIZED_NEWMARK_GN11_SCHEME
16 
17 // Project includes
18 #include "includes/define.h"
19 #include "includes/model_part.h"
22 
23 // Application includes
25 
26 namespace Kratos
27 {
28 
29 template<class TSparseSpace, class TDenseSpace>
30 
31 class GeneralizedNewmarkGN11Scheme : public Scheme<TSparseSpace,TDenseSpace>
32 {
33 
34 public:
35 
37 
44 
45 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
46 
48  GeneralizedNewmarkGN11Scheme(double theta) : Scheme<TSparseSpace,TDenseSpace>()
49  {
50  mTheta = theta;
51 
52  //Allocate auxiliary memory
53  int NumThreads = ParallelUtilities::GetNumThreads();
54  mMMatrix.resize(NumThreads);
55  mMVector.resize(NumThreads);
56  }
57 
58  //------------------------------------------------------------------------------------
59 
62 
63 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
64 
65  int Check(ModelPart& r_model_part) override
66  {
68 
69  ConvectionDiffusionSettings::Pointer my_settings = r_model_part.GetProcessInfo().GetValue(CONVECTION_DIFFUSION_SETTINGS);
70  const Variable<double>& rUnknownVar = my_settings->GetUnknownVariable();
71 
72 
73  //check for variables keys (verify that the variables are correctly initialized)
74  if(DELTA_TIME.Key() == 0)
75  KRATOS_THROW_ERROR( std::invalid_argument,"DELTA_TIME Key is 0. Check if all applications were correctly registered.", "")
76  if(rUnknownVar.Key() == 0)
77  KRATOS_THROW_ERROR( std::invalid_argument, "UnknownVar Key is 0. Check if all applications were correctly registered.", "" )
78 
79  if(TEMPERATURE.Key() == 0)
80  KRATOS_THROW_ERROR( std::invalid_argument, "TEMPERATURE Key is 0. Check if all applications were correctly registered.", "" )
81 
82  //check that variables are correctly allocated
83  for(ModelPart::NodesContainerType::iterator it=r_model_part.NodesBegin(); it!=r_model_part.NodesEnd(); it++)
84  {
85  if(it->SolutionStepsDataHas(rUnknownVar) == false)
86  KRATOS_THROW_ERROR( std::logic_error, "UnknownVar variable is not allocated for node ", it->Id() )
87  if(it->SolutionStepsDataHas(TEMPERATURE) == false)
88  KRATOS_THROW_ERROR( std::logic_error, "TEMPERATURE variable is not allocated for node ", it->Id() )
89 
90  if(it->HasDofFor(rUnknownVar) == false)
91  KRATOS_THROW_ERROR( std::invalid_argument,"missing UnknownVar dof on node ",it->Id() )
92  }
93 
94  //check for minimum value of the buffer index.
95  if (r_model_part.GetBufferSize() < 2)
96  KRATOS_THROW_ERROR( std::logic_error, "insufficient buffer size. Buffer size should be greater than 2. Current size is", r_model_part.GetBufferSize() )
97 
98  // Check theta
99  if(mTheta <= 0.0)
100  KRATOS_THROW_ERROR( std::invalid_argument,"Some of the scheme variables: theta has an invalid value ", "" )
101 
102  return 0;
103 
104  KRATOS_CATCH( "" )
105  }
106 
107 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
108 
109  void Initialize(ModelPart& r_model_part) override
110  {
111  KRATOS_TRY
112 
113  mDeltaTime = r_model_part.GetProcessInfo()[DELTA_TIME];
114  r_model_part.GetProcessInfo().SetValue(THETA,mTheta);
115 
117 
118  KRATOS_CATCH("")
119  }
120 
121 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
122 
124  ModelPart& r_model_part,
126  TSystemVectorType& Dx,
127  TSystemVectorType& b) override
128  {
129  KRATOS_TRY
130 
131  mDeltaTime = r_model_part.GetProcessInfo()[DELTA_TIME];
132  r_model_part.GetProcessInfo().SetValue(THETA,mTheta);
133 
134  const ProcessInfo& CurrentProcessInfo = r_model_part.GetProcessInfo();
135 
136  int NElems = static_cast<int>(r_model_part.Elements().size());
137  ModelPart::ElementsContainerType::iterator el_begin = r_model_part.ElementsBegin();
138 
139  #pragma omp parallel for
140  for(int i = 0; i < NElems; i++)
141  {
142  ModelPart::ElementsContainerType::iterator itElem = el_begin + i;
143  itElem -> InitializeSolutionStep(CurrentProcessInfo);
144  }
145 
146  int NCons = static_cast<int>(r_model_part.Conditions().size());
147  ModelPart::ConditionsContainerType::iterator con_begin = r_model_part.ConditionsBegin();
148 
149  #pragma omp parallel for
150  for(int i = 0; i < NCons; i++)
151  {
152  ModelPart::ConditionsContainerType::iterator itCond = con_begin + i;
153  itCond -> InitializeSolutionStep(CurrentProcessInfo);
154  }
155 
156  KRATOS_CATCH("")
157  }
158 
159 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
160 
162  ModelPart& r_model_part,
164  TSystemVectorType& Dx,
165  TSystemVectorType& b) override
166  {
167  KRATOS_TRY
168 
169  // Clear nodal variables
170 
171  const int NNodes = static_cast<int>(r_model_part.Nodes().size());
172  ModelPart::NodesContainerType::iterator node_begin = r_model_part.NodesBegin();
173 
174 
175  #pragma omp parallel for
176  for(int i = 0; i < NNodes; i++)
177  {
178  ModelPart::NodesContainerType::iterator itNode = node_begin + i;
179 
180  itNode->FastGetSolutionStepValue(NODAL_AREA) = 0.0;
181 
182  array_1d<double,3>& rNodalPhiGradient = itNode->FastGetSolutionStepValue(NODAL_PHI_GRADIENT);
183  noalias(rNodalPhiGradient) = ZeroVector(3);
184  }
185 
186  BaseType::FinalizeSolutionStep(r_model_part,A,Dx,b);
187 
188  // Compute smoothed nodal variables
189 
190  #pragma omp parallel for
191  for(int i = 0; i < NNodes; i++)
192  {
193  ModelPart::NodesContainerType::iterator itNode = node_begin + i;
194 
195  const double& NodalArea = itNode->FastGetSolutionStepValue(NODAL_AREA);
196  if (NodalArea>1.0e-20)
197  {
198  const double InvNodalArea = 1.0/NodalArea;
199  array_1d<double,3>& rNodalPhiGradient = itNode->FastGetSolutionStepValue(NODAL_PHI_GRADIENT);
200  for(unsigned int i = 0; i<3; i++)
201  {
202  rNodalPhiGradient[i] *= InvNodalArea;
203  }
204  }
205  }
206 
207  // const double& Time = r_model_part.GetProcessInfo()[TIME];
208 
209  // const double M = 1000.0;
210  // const double D = 0.1;
211  // const double L = 4.0;
212 
213  // #pragma omp parallel for
214  // for(int i = 0; i < NNodes; i++)
215  // {
216  // ModelPart::NodesContainerType::iterator itNode = node_begin + i;
217 
218  // double& rNodalAnalyticSolution = itNode->FastGetSolutionStepValue(NODAL_ANALYTIC_SOLUTION);
219  // const double& velocity_x = itNode->FastGetSolutionStepValue(VELOCITY_X);
220  // const double& velocity_y = itNode->FastGetSolutionStepValue(VELOCITY_Y);
221  // const double& velocity_z = itNode->FastGetSolutionStepValue(VELOCITY_Z);
222 
223  // rNodalAnalyticSolution = M /(4.0 * Globals::Pi * Time * D * L)
224  // * std::exp(-(itNode->X()-(2.0 + velocity_x * Time))*(itNode->X()-(2.0 + velocity_x * Time)) / (4 * D * Time)
225  // -(itNode->Y()-(5.0 + velocity_y * Time))*(itNode->Y()-(5.0 + velocity_y * Time)) / (4 * D * Time)
226  // -(itNode->Z()-(0.0 + velocity_z * Time))*(itNode->Z()-(0.0 + velocity_z * Time)) / (4 * D * Time));
227 
228  // }
229 
230  KRATOS_CATCH("")
231  }
232 
233 
234 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
235 
236  void Predict(
237  ModelPart& r_model_part,
238  DofsArrayType& rDofSet,
240  TSystemVectorType& Dx,
241  TSystemVectorType& b) override
242  {
243  this->UpdateVariablesDerivatives(r_model_part);
244  }
245 
246 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
247 
249  ModelPart& r_model_part,
251  TSystemVectorType& Dx,
252  TSystemVectorType& b) override
253  {
254  KRATOS_TRY
255 
256 
257  // Clear nodal variables
258 
259  const int NNodes = static_cast<int>(r_model_part.Nodes().size());
260  ModelPart::NodesContainerType::iterator node_begin = r_model_part.NodesBegin();
261 
262 
263  #pragma omp parallel for
264  for(int i = 0; i < NNodes; i++)
265  {
266  ModelPart::NodesContainerType::iterator itNode = node_begin + i;
267 
268  itNode->FastGetSolutionStepValue(NODAL_AREA) = 0.0;
269 
270  array_1d<double,3>& rNodalPhiGradient = itNode->FastGetSolutionStepValue(NODAL_PHI_GRADIENT);
271  noalias(rNodalPhiGradient) = ZeroVector(3);
272  }
273 
274 
275  // // Extrapolate GP values to nodal variables
276 
277  const ProcessInfo& CurrentProcessInfo = r_model_part.GetProcessInfo();
278 
279  int NElems = static_cast<int>(r_model_part.Elements().size());
280  ModelPart::ElementsContainerType::iterator el_begin = r_model_part.ElementsBegin();
281 
282  #pragma omp parallel for
283  for(int i = 0; i < NElems; i++)
284  {
285  ModelPart::ElementsContainerType::iterator itElem = el_begin + i;
286  itElem -> InitializeNonLinearIteration(CurrentProcessInfo);
287  }
288 
289  int NCons = static_cast<int>(r_model_part.Conditions().size());
290  ModelPart::ConditionsContainerType::iterator con_begin = r_model_part.ConditionsBegin();
291 
292  #pragma omp parallel for
293  for(int i = 0; i < NCons; i++)
294  {
295  ModelPart::ConditionsContainerType::iterator itCond = con_begin + i;
296  itCond -> InitializeNonLinearIteration(CurrentProcessInfo);
297  }
298 
299 
300  // Compute smoothed nodal variables
301 
302  #pragma omp parallel for
303  for(int i = 0; i < NNodes; i++)
304  {
305  ModelPart::NodesContainerType::iterator itNode = node_begin + i;
306 
307  const double& NodalArea = itNode->FastGetSolutionStepValue(NODAL_AREA);
308  if (NodalArea>1.0e-20)
309  {
310  const double InvNodalArea = 1.0/NodalArea;
311  array_1d<double,3>& rNodalPhiGradient = itNode->FastGetSolutionStepValue(NODAL_PHI_GRADIENT);
312  for(unsigned int i = 0; i<3; i++)
313  {
314  rNodalPhiGradient[i] *= InvNodalArea;
315  }
316  }
317  }
318 
319 
320  KRATOS_CATCH("")
321  }
322 
323 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
324 
326  ModelPart& r_model_part,
328  TSystemVectorType& Dx,
329  TSystemVectorType& b) override
330  {
331  KRATOS_TRY
332 
333  const ProcessInfo& CurrentProcessInfo = r_model_part.GetProcessInfo();
334 
335  int NElems = static_cast<int>(r_model_part.Elements().size());
336  ModelPart::ElementsContainerType::iterator el_begin = r_model_part.ElementsBegin();
337 
338  #pragma omp parallel for
339  for(int i = 0; i < NElems; i++)
340  {
341  ModelPart::ElementsContainerType::iterator itElem = el_begin + i;
342  itElem -> FinalizeNonLinearIteration(CurrentProcessInfo);
343  }
344 
345  int NCons = static_cast<int>(r_model_part.Conditions().size());
346  ModelPart::ConditionsContainerType::iterator con_begin = r_model_part.ConditionsBegin();
347 
348  #pragma omp parallel for
349  for(int i = 0; i < NCons; i++)
350  {
351  ModelPart::ConditionsContainerType::iterator itCond = con_begin + i;
352  itCond -> FinalizeNonLinearIteration(CurrentProcessInfo);
353  }
354 
355  KRATOS_CATCH("")
356  }
357 
358 
359 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
360 
361 // Note: this is in a parallel loop
362 
364  Element& rCurrentElement,
365  LocalSystemMatrixType& LHS_Contribution,
366  LocalSystemVectorType& RHS_Contribution,
368  const ProcessInfo& CurrentProcessInfo) override
369  {
370  KRATOS_TRY
371 
372  int thread = OpenMPUtils::ThisThread();
373 
374  rCurrentElement.CalculateLocalSystem(LHS_Contribution,RHS_Contribution,CurrentProcessInfo);
375 
376  rCurrentElement.CalculateFirstDerivativesContributions(mMMatrix[thread], mMVector[thread],CurrentProcessInfo);
377 
378  // adding transient contribution
379  if (mMMatrix[thread].size1() != 0)
380  noalias(LHS_Contribution) += 1.0 / (mTheta*mDeltaTime) * mMMatrix[thread];
381 
382  if (mMVector[thread].size() != 0)
383  noalias(RHS_Contribution) += mMVector[thread];
384 
385  rCurrentElement.EquationIdVector(EquationId,CurrentProcessInfo);
386 
387 // if(rCurrentElement->Id() == 8)
388 // {
389 // KRATOS_WATCH(LHS_Contribution)
390 // KRATOS_WATCH(RHS_Contribution)
391 // }
392 
393  KRATOS_CATCH( "" )
394  }
395 
396 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
397 
398 // Note: this is in a parallel loop
399 
401  Condition& rCurrentCondition,
402  LocalSystemMatrixType& LHS_Contribution,
403  LocalSystemVectorType& RHS_Contribution,
405  const ProcessInfo& CurrentProcessInfo) override
406  {
407  KRATOS_TRY
408 
409  rCurrentCondition.CalculateLocalSystem(LHS_Contribution,RHS_Contribution,CurrentProcessInfo);
410 
411  rCurrentCondition.EquationIdVector(EquationId,CurrentProcessInfo);
412 
413  KRATOS_CATCH( "" )
414  }
415 
416 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
417 
418 // Note: this is in a parallel loop
419 
421  Element& rCurrentElement,
422  LocalSystemVectorType& RHS_Contribution,
424  const ProcessInfo& CurrentProcessInfo) override
425  {
426  KRATOS_TRY
427 
428  int thread = OpenMPUtils::ThisThread();
429 
430  rCurrentElement.CalculateRightHandSide(RHS_Contribution,CurrentProcessInfo);
431 
432  rCurrentElement.CalculateFirstDerivativesRHS(mMVector[thread],CurrentProcessInfo);
433 
434  // adding transient contribution
435 
436  if (mMVector[thread].size() != 0)
437  noalias(RHS_Contribution) += mMVector[thread];
438 
439  rCurrentElement.EquationIdVector(EquationId,CurrentProcessInfo);
440 
441  KRATOS_CATCH( "" )
442  }
443 
444 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
445 
446 // Note: this is in a parallel loop
447 
449  Condition& rCurrentCondition,
450  LocalSystemVectorType& RHS_Contribution,
452  const ProcessInfo& CurrentProcessInfo) override
453  {
454  KRATOS_TRY
455 
456  rCurrentCondition.CalculateRightHandSide(RHS_Contribution, CurrentProcessInfo);
457 
458  rCurrentCondition.EquationIdVector(EquationId, CurrentProcessInfo);
459 
460  KRATOS_CATCH( "" )
461  }
462 
463 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
464 
465 // Note: this is in a parallel loop
466 
468  Element& rCurrentElement,
469  LocalSystemMatrixType& LHS_Contribution,
471  const ProcessInfo& CurrentProcessInfo) override
472  {
473  KRATOS_TRY
474 
475  int thread = OpenMPUtils::ThisThread();
476 
477  rCurrentElement.CalculateLeftHandSide(LHS_Contribution,CurrentProcessInfo);
478 
479  rCurrentElement.CalculateFirstDerivativesLHS(mMMatrix[thread], CurrentProcessInfo);
480 
481  // adding transient contribution
482  if (mMMatrix[thread].size1() != 0)
483  noalias(LHS_Contribution) += 1.0 / (mTheta*mDeltaTime) * mMMatrix[thread];
484 
485  rCurrentElement.EquationIdVector(EquationId,CurrentProcessInfo);
486 
487  KRATOS_CATCH( "" )
488  }
489 
490 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
491 
492 // Note: this is in a parallel loop
493 
495  Condition& rCurrentCondition,
496  LocalSystemMatrixType& LHS_Contribution,
498  const ProcessInfo& CurrentProcessInfo) override
499  {
500  KRATOS_TRY
501 
502  rCurrentCondition.CalculateLeftHandSide(LHS_Contribution, CurrentProcessInfo);
503 
504  rCurrentCondition.EquationIdVector(EquationId, CurrentProcessInfo);
505 
506  KRATOS_CATCH( "" )
507  }
508 
509 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
510 
511  void Update(
512  ModelPart& r_model_part,
513  DofsArrayType& rDofSet,
515  TSystemVectorType& Dx,
516  TSystemVectorType& b) override
517  {
518  KRATOS_TRY
519 
520  int NumThreads = ParallelUtilities::GetNumThreads();
521  OpenMPUtils::PartitionVector DofSetPartition;
522  OpenMPUtils::DivideInPartitions(rDofSet.size(), NumThreads, DofSetPartition);
523 
524  #pragma omp parallel
525  {
526  int k = OpenMPUtils::ThisThread();
527 
528  typename DofsArrayType::iterator DofsBegin = rDofSet.begin() + DofSetPartition[k];
529  typename DofsArrayType::iterator DofsEnd = rDofSet.begin() + DofSetPartition[k+1];
530 
531  //Update Phi (DOFs)
532  for (typename DofsArrayType::iterator itDof = DofsBegin; itDof != DofsEnd; ++itDof)
533  {
534  if (itDof->IsFree())
535  itDof->GetSolutionStepValue() += TSparseSpace::GetValue(Dx, itDof->EquationId());
536  }
537  }
538 
539  this->UpdateVariablesDerivatives(r_model_part);
540 
541  KRATOS_CATCH( "" )
542  }
543 
544 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
545 
546 protected:
547 
549 
550  double mTheta;
551  double mDeltaTime;
552 
553  std::vector< Matrix > mMMatrix;
554  std::vector< Vector > mMVector;
555 
556 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
557 
558  inline void UpdateVariablesDerivatives(ModelPart& r_model_part)
559  {
560  KRATOS_TRY
561 
562  ConvectionDiffusionSettings::Pointer my_settings = r_model_part.GetProcessInfo().GetValue(CONVECTION_DIFFUSION_SETTINGS);
563  const Variable<double>& rUnknownVar = my_settings->GetUnknownVariable();
564 
565  const int NNodes = static_cast<int>(r_model_part.Nodes().size());
566  ModelPart::NodesContainerType::iterator node_begin = r_model_part.NodesBegin();
567 
568  #pragma omp parallel for
569  for(int i = 0; i < NNodes; i++)
570  {
571  ModelPart::NodesContainerType::iterator itNode = node_begin + i;
572 
573  double& CurrentPhi = itNode->FastGetSolutionStepValue(TEMPERATURE);
574  const double& PreviousPhi = itNode->FastGetSolutionStepValue(TEMPERATURE, 1);
575  const double& CurrentPhiTheta = itNode->FastGetSolutionStepValue(rUnknownVar);
576 
577  CurrentPhi = 1.0 / mTheta * CurrentPhiTheta + (1.0 - 1.0 / mTheta) * PreviousPhi;
578  }
579 
580  KRATOS_CATCH( "" )
581  }
582 
583 }; // Class GeneralizedNewmarkGN11Scheme
584 } // namespace Kratos
585 
586 #endif // KRATOS_GENERALIZED_NEWMARK_GN11_SCHEME defined
Base class for all Conditions.
Definition: condition.h:59
virtual void CalculateLeftHandSide(MatrixType &rLeftHandSideMatrix, const ProcessInfo &rCurrentProcessInfo)
Definition: condition.h:426
virtual void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const
Definition: condition.h:260
virtual void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: condition.h:440
virtual void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: condition.h:408
void SetValue(const Variable< TDataType > &rThisVariable, TDataType const &rValue)
Sets the value for a given variable.
Definition: data_value_container.h:320
TDataType & GetValue(const Variable< TDataType > &rThisVariable)
Gets the value associated with a given variable.
Definition: data_value_container.h:268
Base class for all Elements.
Definition: element.h:60
virtual void CalculateFirstDerivativesLHS(MatrixType &rLeftHandSideMatrix, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:479
virtual void CalculateLeftHandSide(MatrixType &rLeftHandSideMatrix, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:423
virtual void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:437
virtual void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const
Definition: element.h:258
virtual void CalculateFirstDerivativesContributions(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:461
virtual void CalculateFirstDerivativesRHS(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:493
virtual void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Definition: element.h:405
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
Definition: generalized_newmark_GN11_scheme.hpp:32
void CalculateRHSContribution(Element &rCurrentElement, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo) override
This function is designed to calculate just the RHS contribution.
Definition: generalized_newmark_GN11_scheme.hpp:420
BaseType::DofsArrayType DofsArrayType
Definition: generalized_newmark_GN11_scheme.hpp:39
void Update(ModelPart &r_model_part, DofsArrayType &rDofSet, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Performing the update of the solution.
Definition: generalized_newmark_GN11_scheme.hpp:511
GeneralizedNewmarkGN11Scheme(double theta)
Constructor.
Definition: generalized_newmark_GN11_scheme.hpp:48
void Initialize(ModelPart &r_model_part) override
This is the place to initialize the Scheme.
Definition: generalized_newmark_GN11_scheme.hpp:109
void CalculateRHSContribution(Condition &rCurrentCondition, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo) override
Functions totally analogous to the precedent but applied to the "condition" objects.
Definition: generalized_newmark_GN11_scheme.hpp:448
void CalculateSystemContributions(Element &rCurrentElement, LocalSystemMatrixType &LHS_Contribution, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo) override
This function is designed to be called in the builder and solver to introduce the selected time integ...
Definition: generalized_newmark_GN11_scheme.hpp:363
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: generalized_newmark_GN11_scheme.hpp:42
Scheme< TSparseSpace, TDenseSpace > BaseType
Definition: generalized_newmark_GN11_scheme.hpp:38
double mTheta
Member Variables.
Definition: generalized_newmark_GN11_scheme.hpp:550
void Predict(ModelPart &r_model_part, DofsArrayType &rDofSet, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Performing the prediction of the solution.
Definition: generalized_newmark_GN11_scheme.hpp:236
std::vector< Matrix > mMMatrix
Definition: generalized_newmark_GN11_scheme.hpp:553
BaseType::TSystemVectorType TSystemVectorType
Definition: generalized_newmark_GN11_scheme.hpp:41
void CalculateSystemContributions(Condition &rCurrentCondition, LocalSystemMatrixType &LHS_Contribution, LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo) override
Functions totally analogous to the precedent but applied to the "condition" objects.
Definition: generalized_newmark_GN11_scheme.hpp:400
void CalculateLHSContribution(Condition &rCurrentCondition, LocalSystemMatrixType &LHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo) override
Functions totally analogous to the precedent but applied to the "condition" objects.
Definition: generalized_newmark_GN11_scheme.hpp:494
std::vector< Vector > mMVector
Definition: generalized_newmark_GN11_scheme.hpp:554
void FinalizeSolutionStep(ModelPart &r_model_part, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Function called once at the end of a solution step, after convergence is reached if an iterative proc...
Definition: generalized_newmark_GN11_scheme.hpp:161
double mDeltaTime
Definition: generalized_newmark_GN11_scheme.hpp:551
int Check(ModelPart &r_model_part) override
Definition: generalized_newmark_GN11_scheme.hpp:65
void InitializeSolutionStep(ModelPart &r_model_part, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Function called once at the beginning of each solution step.
Definition: generalized_newmark_GN11_scheme.hpp:123
~GeneralizedNewmarkGN11Scheme() override
Destructor.
Definition: generalized_newmark_GN11_scheme.hpp:61
void InitializeNonLinIteration(ModelPart &r_model_part, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
unction to be called when it is needed to initialize an iteration. It is designed to be called at the...
Definition: generalized_newmark_GN11_scheme.hpp:248
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: generalized_newmark_GN11_scheme.hpp:43
void CalculateLHSContribution(Element &rCurrentElement, LocalSystemMatrixType &LHS_Contribution, Element::EquationIdVectorType &EquationId, const ProcessInfo &CurrentProcessInfo) override
This function is designed to calculate just the LHS contribution.
Definition: generalized_newmark_GN11_scheme.hpp:467
void UpdateVariablesDerivatives(ModelPart &r_model_part)
Definition: generalized_newmark_GN11_scheme.hpp:558
BaseType::TSystemMatrixType TSystemMatrixType
Definition: generalized_newmark_GN11_scheme.hpp:40
KRATOS_CLASS_POINTER_DEFINITION(GeneralizedNewmarkGN11Scheme)
void FinalizeNonLinIteration(ModelPart &r_model_part, 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: generalized_newmark_GN11_scheme.hpp:325
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
ConditionIterator ConditionsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1361
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
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
static void DivideInPartitions(const int NumTerms, const int NumThreads, PartitionVector &Partitions)
Divide an array of length NumTerms between NumThreads threads.
Definition: openmp_utils.h:158
static int ThisThread()
Wrapper for omp_get_thread_num().
Definition: openmp_utils.h:108
std::vector< int > PartitionVector
Vector type for the output of DivideInPartitions method.
Definition: openmp_utils.h:53
static int GetNumThreads()
Returns the current number of threads.
Definition: parallel_utilities.cpp:34
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
boost::indirect_iterator< typename TContainerType::iterator > iterator
Definition: pointer_vector_set.h:95
size_type size() const
Returns the number of elements in the container.
Definition: pointer_vector_set.h:502
iterator begin()
Returns an iterator pointing to the beginning of the container.
Definition: pointer_vector_set.h:278
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
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
typename TDenseSpace::MatrixType LocalSystemMatrixType
Local system matrix type definition.
Definition: scheme.h:77
bool mSchemeIsInitialized
Definition: scheme.h:755
KeyType Key() const
Definition: variable_data.h:187
#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
Parameters GetValue(Parameters &rParameters, const std::string &rEntry)
Definition: add_kratos_parameters_to_python.cpp:53
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
int k
Definition: quadrature.py:595
A
Definition: sensitivityMatrix.py:70
integer i
Definition: TensorModule.f:17