KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
residualbased_block_builder_and_solver_with_mass_and_damping.h
Go to the documentation of this file.
1 // KRATOS___
2 // // ) )
3 // // ___ ___
4 // // ____ //___) ) // ) )
5 // // / / // // / /
6 // ((____/ / ((____ ((___/ / MECHANICS
7 //
8 // License: BSD License
9 // geo_mechanics_application/license.txt
10 //
11 // Main authors: Riccardo Rossi, Aron Noordam
12 // Collaborators: Vicente Mataix
13 //
14 //
15 
16 #pragma once
17 
18 /* System includes */
19 #include <unordered_set>
20 
21 /* External includes */
22 #ifdef KRATOS_SMP_OPENMP
23 #include <omp.h>
24 #endif
25 
26 /* Project includes */
27 #include "includes/define.h"
28 #include "includes/key_hash.h"
29 #include "includes/kratos_flags.h"
30 #include "includes/lock_object.h"
31 #include "includes/model_part.h"
33 #include "spaces/ublas_space.h"
37 #include "utilities/timer.h"
39 
40 namespace Kratos
41 {
42 
45 
49 
53 
57 
61 
82 template <class TSparseSpace, class TDenseSpace, class TLinearSolver>
84  : public ResidualBasedBlockBuilderAndSolver<TSparseSpace, TDenseSpace, TLinearSolver>
85 {
86 public:
89 
91  KRATOS_DEFINE_LOCAL_FLAG(SILENT_WARNINGS);
92 
95 
98 
108 
112 
116 
121 
125  explicit ResidualBasedBlockBuilderAndSolverWithMassAndDamping(typename TLinearSolver::Pointer pNewLinearSystemSolver,
126  Parameters ThisParameters)
127  : BaseType(pNewLinearSystemSolver)
128  {
129  // Validate and assign defaults
130  ThisParameters = this->ValidateAndAssignParameters(ThisParameters, this->GetDefaultParameters());
131  this->AssignSettings(ThisParameters);
132  }
133 
137  explicit ResidualBasedBlockBuilderAndSolverWithMassAndDamping(typename TLinearSolver::Pointer pNewLinearSystemSolver)
138  : BaseType(pNewLinearSystemSolver)
139  {
140  }
141 
145 
149 
158  void Build(typename TSchemeType::Pointer pScheme, ModelPart& rModelPart, TSystemMatrixType& rA, TSystemVectorType& rb) override
159  {
160  KRATOS_TRY
161 
162  KRATOS_ERROR_IF(!pScheme) << "No scheme provided!" << std::endl;
163 
164  // Getting the elements from the model
165  const auto nelements = static_cast<int>(rModelPart.Elements().size());
166 
167  // Getting the array of the conditions
168  const auto nconditions = static_cast<int>(rModelPart.Conditions().size());
169 
170  const ProcessInfo& r_current_process_info = rModelPart.GetProcessInfo();
171  ModelPart::ElementsContainerType::iterator el_begin = rModelPart.ElementsBegin();
172  ModelPart::ConditionsContainerType::iterator cond_begin = rModelPart.ConditionsBegin();
173 
174  // contributions to the system
175  LocalSystemMatrixType lhs_contribution(0, 0);
176  LocalSystemMatrixType mass_contribution(0, 0);
177  LocalSystemMatrixType damping_contribution(0, 0);
178  LocalSystemVectorType rhs_contribution(0);
179 
180  InitializeDynamicMatrix(mMassMatrix, BaseType::mEquationSystemSize, pScheme, rModelPart);
181  InitializeDynamicMatrix(mDampingMatrix, BaseType::mEquationSystemSize, pScheme, rModelPart);
182 
183  // vector containing the localization in the system of the different
184  // terms
185  Element::EquationIdVectorType equation_ids;
186 
187  // Assemble all elements
188  const auto timer = BuiltinTimer();
189 
190 #pragma omp parallel firstprivate(nelements, nconditions, lhs_contribution, mass_contribution, \
191  damping_contribution, rhs_contribution, equation_ids)
192  {
193 #pragma omp for schedule(guided, 512) nowait
194  for (int k = 0; k < nelements; k++) {
195  auto it_elem = el_begin + k;
196 
197  if (it_elem->IsActive()) {
198  // Calculate elemental contribution
199  pScheme->CalculateSystemContributions(*it_elem, lhs_contribution, rhs_contribution,
200  equation_ids, r_current_process_info);
201 
202  // assemble mass and damping matrix
203  it_elem->CalculateMassMatrix(mass_contribution, r_current_process_info);
204  it_elem->CalculateDampingMatrix(damping_contribution, r_current_process_info);
205 
206  if (mass_contribution.size1() != 0) {
207  BaseType::AssembleLHS(mMassMatrix, mass_contribution, equation_ids);
208  }
209  if (damping_contribution.size1() != 0) {
210  BaseType::AssembleLHS(mDampingMatrix, damping_contribution, equation_ids);
211  }
212 
213  // Assemble the elemental contribution
214  BaseType::Assemble(rA, rb, lhs_contribution, rhs_contribution, equation_ids);
215  }
216  }
217 
218 #pragma omp for schedule(guided, 512)
219  for (int k = 0; k < nconditions; k++) {
220  auto it_cond = cond_begin + k;
221 
222  if (it_cond->IsActive()) {
223  // Calculate elemental contribution
224  pScheme->CalculateSystemContributions(*it_cond, lhs_contribution, rhs_contribution,
225  equation_ids, r_current_process_info);
226 
227  // assemble mass and damping matrix
228  it_cond->CalculateMassMatrix(mass_contribution, r_current_process_info);
229  it_cond->CalculateDampingMatrix(damping_contribution, r_current_process_info);
230 
231  if (mass_contribution.size1() != 0) {
232  BaseType::AssembleLHS(mMassMatrix, mass_contribution, equation_ids);
233  }
234  if (damping_contribution.size1() != 0) {
235  BaseType::AssembleLHS(mDampingMatrix, damping_contribution, equation_ids);
236  }
237 
238  // Assemble the elemental contribution
239  BaseType::Assemble(rA, rb, lhs_contribution, rhs_contribution, equation_ids);
240  }
241  }
242  }
243 
244  KRATOS_INFO_IF("ResidualBasedBlockBuilderAndSolverWithMassAndDamping", this->GetEchoLevel() >= 1)
245  << "Build time: " << timer.ElapsedSeconds() << std::endl;
246 
247  KRATOS_INFO_IF("ResidualBasedBlockBuilderAndSolverWithMassAndDamping",
248  (this->GetEchoLevel() > 2 && rModelPart.GetCommunicator().MyPID() == 0))
249  << "Finished parallel building" << std::endl;
250 
251  KRATOS_CATCH("")
252  }
253 
264  void BuildAndSolve(typename TSchemeType::Pointer pScheme,
265  ModelPart& rModelPart,
266  TSystemMatrixType& rA,
267  TSystemVectorType& rDx,
268  TSystemVectorType& rb) override
269  {
270  KRATOS_TRY
271 
272  Timer::Start("Build");
273 
274  Build(pScheme, rModelPart, rA, rb);
275 
276  Timer::Stop("Build");
277 
278  TSystemVectorType dummy_b(rA.size1(), 0.0);
279  TSystemVectorType dummy_rDx(rA.size1(), 0.0);
280 
281  if (!rModelPart.MasterSlaveConstraints().empty()) {
282  const auto timer_constraints = BuiltinTimer();
283  Timer::Start("ApplyConstraints");
284  BaseType::ApplyConstraints(pScheme, rModelPart, rA, rb);
285  BaseType::ApplyConstraints(pScheme, rModelPart, mMassMatrix, dummy_b);
286  BaseType::ApplyConstraints(pScheme, rModelPart, mDampingMatrix, dummy_b);
287  Timer::Stop("ApplyConstraints");
288  KRATOS_INFO_IF("ResidualBasedBlockBuilderAndSolverWithMassAndDamping", this->GetEchoLevel() >= 1)
289  << "Constraints build time: " << timer_constraints.ElapsedSeconds() << std::endl;
290  }
291 
292  BaseType::ApplyDirichletConditions(pScheme, rModelPart, rA, rDx, rb);
293  BaseType::ApplyDirichletConditions(pScheme, rModelPart, mMassMatrix, dummy_rDx, dummy_b);
294  BaseType::ApplyDirichletConditions(pScheme, rModelPart, mDampingMatrix, dummy_rDx, dummy_b);
295 
296  KRATOS_INFO_IF("ResidualBasedBlockBuilderAndSolverWithMassAndDamping", this->GetEchoLevel() == 3)
297  << "Before the solution of the system"
298  << "\nSystem Matrix = " << rA << "\nUnknowns vector = " << rDx
299  << "\nRHS vector = " << rb << std::endl;
300 
301  const auto timer = BuiltinTimer();
302  Timer::Start("Solve");
303 
304  BaseType::SystemSolveWithPhysics(rA, rDx, rb, rModelPart);
305 
306  Timer::Stop("Solve");
307  KRATOS_INFO_IF("ResidualBasedBlockBuilderAndSolverWithMassAndDamping", this->GetEchoLevel() >= 1)
308  << "System solve time: " << timer.ElapsedSeconds() << std::endl;
309 
310  KRATOS_INFO_IF("ResidualBasedBlockBuilderAndSolverWithMassAndDamping", this->GetEchoLevel() == 3)
311  << "After the solution of the system"
312  << "\nSystem Matrix = " << rA << "\nUnknowns vector = " << rDx
313  << "\nRHS vector = " << rb << std::endl;
314 
315  KRATOS_CATCH("")
316  }
317 
327  void BuildRHSAndSolve(typename TSchemeType::Pointer pScheme,
328  ModelPart& rModelPart,
329  TSystemMatrixType& rA,
330  TSystemVectorType& rDx,
331  TSystemVectorType& rb) override
332  {
333  KRATOS_TRY
334 
335  BuildRHS(pScheme, rModelPart, rb);
336 
337  if (!rModelPart.MasterSlaveConstraints().empty()) {
338  Timer::Start("ApplyRHSConstraints");
339  BaseType::ApplyRHSConstraints(pScheme, rModelPart, rb);
340  Timer::Stop("ApplyRHSConstraints");
341  }
342 
343  BaseType::ApplyDirichletConditions(pScheme, rModelPart, rA, rDx, rb);
344 
345  KRATOS_INFO_IF("ResidualBasedBlockBuilderAndSolverWithMassAndDamping", this->GetEchoLevel() == 3)
346  << "Before the solution of the system"
347  << "\nSystem Matrix = " << rA << "\nUnknowns vector = " << rDx
348  << "\nRHS vector = " << rb << std::endl;
349 
350  const auto timer = BuiltinTimer();
351  Timer::Start("Solve");
352 
353  BaseType::SystemSolveWithPhysics(rA, rDx, rb, rModelPart);
354 
355  Timer::Stop("Solve");
356  KRATOS_INFO_IF("ResidualBasedBlockBuilderAndSolverWithMassAndDamping", this->GetEchoLevel() >= 1)
357  << "System solve time: " << timer.ElapsedSeconds() << std::endl;
358 
359  KRATOS_INFO_IF("ResidualBasedBlockBuilderAndSolverWithMassAndDamping", this->GetEchoLevel() == 3)
360  << "After the solution of the system"
361  << "\nSystem Matrix = " << rA << "\nUnknowns vector = " << rDx
362  << "\nRHS vector = " << rb << std::endl;
363 
364  KRATOS_CATCH("")
365  }
366 
373  void BuildRHS(typename TSchemeType::Pointer pScheme, ModelPart& rModelPart, TSystemVectorType& rb) override
374  {
375  KRATOS_TRY
376 
377  Timer::Start("BuildRHS");
378 
379  BuildRHSNoDirichlet(pScheme, rModelPart, rb);
380 
381  // NOTE: dofs are assumed to be numbered consecutively in the BlockBuilderAndSolver
383  if (r_dof.IsFixed()) {
384  const std::size_t i = r_dof.EquationId();
385  rb[i] = 0.0;
386  }
387  });
388 
389  Timer::Stop("BuildRHS");
390 
391  KRATOS_CATCH("")
392  }
393 
399  {
400  Parameters default_parameters = Parameters(R"(
401  {
402  "name" : "block_builder_and_solver_with_mass_and_damping",
403  "block_builder" : true,
404  "diagonal_values_for_dirichlet_dofs" : "use_max_diagonal",
405  "silent_warnings" : false
406  })");
407 
408  // Getting base class default parameters
409  const Parameters base_default_parameters = BaseType::GetDefaultParameters();
410  default_parameters.RecursivelyAddMissingParameters(base_default_parameters);
411  return default_parameters;
412  }
413 
418  static std::string Name() { return "block_builder_and_solver_with_mass_and_damping"; }
419 
423 
427 
431 
433  std::string Info() const override
434  {
435  return "ResidualBasedBlockBuilderAndSolverWithMassAndDamping";
436  }
437 
441 
443 
444 protected:
447 
451 
455 
459 
461  TSystemVectorType& rSecondDerivativeVector,
462  ModelPart& rModelPart)
463  {
464  block_for_each(rModelPart.Nodes(), [&rFirstDerivativeVector, &rSecondDerivativeVector, this](Node& rNode) {
465  if (rNode.IsActive()) {
466  GetDerivativesForVariable(DISPLACEMENT_X, rNode, rFirstDerivativeVector, rSecondDerivativeVector);
467  GetDerivativesForVariable(DISPLACEMENT_Y, rNode, rFirstDerivativeVector, rSecondDerivativeVector);
468 
469  const std::vector<const Variable<double>*> optional_variables = {
470  &ROTATION_X, &ROTATION_Y, &ROTATION_Z, &DISPLACEMENT_Z};
471 
472  for (const auto p_variable : optional_variables) {
473  GetDerivativesForOptionalVariable(*p_variable, rNode, rFirstDerivativeVector,
474  rSecondDerivativeVector);
475  }
476  }
477  });
478  }
479 
481  const Node& rNode,
482  TSystemVectorType& rFirstDerivativeVector,
483  TSystemVectorType& rSecondDerivativeVector) const
484  {
485  if (rNode.HasDofFor(rVariable)) {
486  GetDerivativesForVariable(rVariable, rNode, rFirstDerivativeVector, rSecondDerivativeVector);
487  }
488  }
489 
491  const Node& rNode,
492  TSystemVectorType& rFirstDerivativeVector,
493  TSystemVectorType& rSecondDerivativeVector) const
494  {
495  const auto& first_derivative = rVariable.GetTimeDerivative();
496  const auto& second_derivative = first_derivative.GetTimeDerivative();
497 
498  const auto equation_id = rNode.GetDof(rVariable).EquationId();
499  rFirstDerivativeVector[equation_id] = rNode.FastGetSolutionStepValue(first_derivative);
500  rSecondDerivativeVector[equation_id] = rNode.FastGetSolutionStepValue(second_derivative);
501  }
502 
503  void BuildRHSNoDirichlet(typename TSchemeType::Pointer pScheme, ModelPart& rModelPart, TSystemVectorType& rb)
504  {
505  KRATOS_TRY
506 
507  // Getting the Elements
508  ElementsArrayType& r_elements = rModelPart.Elements();
509 
510  // getting the array of the conditions
511  ConditionsArrayType& r_conditions = rModelPart.Conditions();
512 
513  const ProcessInfo& r_current_process_info = rModelPart.GetProcessInfo();
514 
515  // contributions to the system
516  LocalSystemVectorType rhs_contribution = LocalSystemVectorType(0);
517 
518  // vector containing the localization in the system of the different
519  // terms
520  Element::EquationIdVectorType equation_ids;
521 
522  // assemble all elements
523 
524  const int nelements = static_cast<int>(r_elements.size());
525 #pragma omp parallel firstprivate(nelements, rhs_contribution, equation_ids)
526  {
527 #pragma omp for schedule(guided, 512) nowait
528  for (int i = 0; i < nelements; i++) {
529  typename ElementsArrayType::iterator it = r_elements.begin() + i;
530  // If the element is active
531  if (it->IsActive()) {
532  // calculate elemental Right Hand Side Contribution
533  it->CalculateRightHandSide(rhs_contribution, r_current_process_info);
534  it->EquationIdVector(equation_ids, r_current_process_info);
535 
536  // assemble the elemental contribution
537  BaseType::AssembleRHS(rb, rhs_contribution, equation_ids);
538  }
539  }
540 
541  rhs_contribution.resize(0, false);
542 
543  // assemble all conditions
544  const int nconditions = static_cast<int>(r_conditions.size());
545 #pragma omp for schedule(guided, 512)
546  for (int i = 0; i < nconditions; i++) {
547  auto it = r_conditions.begin() + i;
548  // If the condition is active
549  if (it->IsActive()) {
550  it->CalculateRightHandSide(rhs_contribution, r_current_process_info);
551  it->EquationIdVector(equation_ids, r_current_process_info);
552 
553  // assemble the elemental contribution
554  BaseType::AssembleRHS(rb, rhs_contribution, equation_ids);
555  }
556  }
557  }
558 
559  AddMassAndDampingToRhs(rModelPart, rb);
560 
561  KRATOS_CATCH("")
562  }
563 
564 private:
565  TSystemMatrixType mMassMatrix;
566  TSystemMatrixType mDampingMatrix;
567 
568  void InitializeDynamicMatrix(TSystemMatrixType& rMatrix,
569  unsigned int MatrixSize,
570  typename TSchemeType::Pointer pScheme,
571  ModelPart& rModelPart)
572  {
573  rMatrix.resize(MatrixSize, MatrixSize, false);
574  BaseType::ConstructMatrixStructure(pScheme, rMatrix, rModelPart);
575  TSparseSpace::SetToZero(rMatrix);
576  }
577 
578  void CalculateAndAddDynamicContributionToRhs(TSystemVectorType& rSolutionVector,
579  TSystemMatrixType& rGlobalMatrix,
580  TSystemVectorType& rb)
581  {
582  TSystemVectorType contribution;
583  contribution.resize(BaseType::mEquationSystemSize, false);
584  TSparseSpace::SetToZero(contribution);
585  TSparseSpace::Mult(rGlobalMatrix, rSolutionVector, contribution);
586 
587  TSparseSpace::UnaliasedAdd(rb, -1.0, contribution);
588  }
589 
598  void AddMassAndDampingToRhs(ModelPart& rModelPart, TSystemVectorType& rb)
599  {
600  // Get first and second derivative vector
601  TSystemVectorType first_derivative_vector = ZeroVector(BaseType::mEquationSystemSize);
602  TSystemVectorType second_derivative_vector = ZeroVector(BaseType::mEquationSystemSize);
603  GetFirstAndSecondDerivativeVector(first_derivative_vector, second_derivative_vector, rModelPart);
604 
605  // calculate and add mass and damping contribution to rhs
606  CalculateAndAddDynamicContributionToRhs(second_derivative_vector, mMassMatrix, rb);
607  CalculateAndAddDynamicContributionToRhs(first_derivative_vector, mDampingMatrix, rb);
608  }
609 
610 }; /* Class ResidualBasedBlockBuilderAndSolverWithMassAndDamping */
611 
613 
616 
617 // Here one should use the KRATOS_CREATE_LOCAL_FLAG, but it does not play nice with template parameters
618 template <class TSparseSpace, class TDenseSpace, class TLinearSolver>
619 const Kratos::Flags ResidualBasedBlockBuilderAndSolverWithMassAndDamping<TSparseSpace, TDenseSpace, TLinearSolver>::SILENT_WARNINGS(
621 
623 
624 } /* namespace Kratos.*/
Current class provides an implementation for the base builder and solving operations.
Definition: builder_and_solver.h:64
TSparseSpace::VectorType TSystemVectorType
Definition of the vector size.
Definition: builder_and_solver.h:85
ModelPart::NodesContainerType NodesArrayType
The containers of the entities.
Definition: builder_and_solver.h:109
TSparseSpace::MatrixType TSystemMatrixType
Definition of the sparse matrix.
Definition: builder_and_solver.h:82
ModelPart::ConditionsContainerType ConditionsArrayType
Definition: builder_and_solver.h:111
virtual Parameters ValidateAndAssignParameters(Parameters ThisParameters, const Parameters DefaultParameters) const
This method validate and assign default parameters.
Definition: builder_and_solver.h:767
TDenseSpace::MatrixType LocalSystemMatrixType
The local matrix definition.
Definition: builder_and_solver.h:94
DofsArrayType mDofSet
Pointer to the linear solver.
Definition: builder_and_solver.h:739
TDenseSpace::VectorType LocalSystemVectorType
The local vector definition.
Definition: builder_and_solver.h:97
int GetEchoLevel() const
It returns the echo level.
Definition: builder_and_solver.h:674
unsigned int mEquationSystemSize
Flag taking in account if it is needed or not to calculate the reactions.
Definition: builder_and_solver.h:747
ModelPart::ElementsContainerType ElementsArrayType
Definition: builder_and_solver.h:110
Definition: builtin_timer.h:26
virtual int MyPID() const
Definition: communicator.cpp:91
Dof represents a degree of freedom (DoF).
Definition: dof.h:86
bool IsFixed() const
Definition: dof.h:376
EquationIdType EquationId() const
Definition: dof.h:324
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
Definition: flags.h:58
static Flags Create(IndexType ThisPosition, bool Value=true)
Definition: flags.h:138
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
MasterSlaveConstraintContainerType & MasterSlaveConstraints(IndexType ThisIndex=0)
Definition: model_part.h:654
ConditionIterator ConditionsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1361
Communicator & GetCommunicator()
Definition: model_part.h:1821
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
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class defines the node.
Definition: node.h:65
const DofType & GetDof(TVariableType const &rDofVariable, int pos) const
Get dof with a given position. If not found it is search.
Definition: node.h:649
TVariableType::Type & FastGetSolutionStepValue(const TVariableType &rThisVariable)
Definition: node.h:435
bool HasDofFor(const VariableData &rDofVariable) const
Definition: node.h:887
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
void RecursivelyAddMissingParameters(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing contain at least all parameters...
Definition: kratos_parameters.cpp:1457
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
size_type size() const
Returns the number of elements in the container.
Definition: pointer_vector_set.h:502
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Current class provides an implementation for standard builder and solving operations.
Definition: residualbased_block_builder_and_solver.h:82
BaseType::TSystemVectorType TSystemVectorType
Definition: residualbased_block_builder_and_solver.h:108
void ApplyDirichletConditions(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
Applies the dirichlet conditions. This operation may be very heavy or completely unexpensive dependin...
Definition: residualbased_block_builder_and_solver.h:940
BaseType::ElementsArrayType ElementsArrayType
Definition: residualbased_block_builder_and_solver.h:114
virtual void SystemSolveWithPhysics(TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb, ModelPart &rModelPart)
This is a call to the linear system solver (taking into account some physical particularities of the ...
Definition: residualbased_block_builder_and_solver.h:408
void AssignSettings(const Parameters ThisParameters) override
This method assigns settings to member variables.
Definition: residualbased_block_builder_and_solver.h:1666
Element::EquationIdVectorType EquationIdVectorType
Definition: residualbased_block_builder_and_solver.h:119
BaseType::TSystemMatrixType TSystemMatrixType
Definition: residualbased_block_builder_and_solver.h:107
void AssembleLHS(TSystemMatrixType &rA, const LocalSystemMatrixType &rLHSContribution, Element::EquationIdVectorType &rEquationId)
Definition: residualbased_block_builder_and_solver.h:1589
BaseType::ConditionsArrayType ConditionsArrayType
Definition: residualbased_block_builder_and_solver.h:115
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: residualbased_block_builder_and_solver.h:109
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: residualbased_block_builder_and_solver.h:1111
void ApplyConstraints(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rb) override
Applies the constraints with master-slave relation matrix.
Definition: residualbased_block_builder_and_solver.h:1035
void Assemble(TSystemMatrixType &A, TSystemVectorType &b, const LocalSystemMatrixType &LHS_Contribution, const LocalSystemVectorType &RHS_Contribution, Element::EquationIdVectorType &EquationId)
Definition: residualbased_block_builder_and_solver.h:1566
BaseType::NodesArrayType NodesArrayType
Definition: residualbased_block_builder_and_solver.h:113
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: residualbased_block_builder_and_solver.h:110
void ApplyRHSConstraints(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemVectorType &rb) override
Applies the constraints with master-slave relation matrix (RHS only)
Definition: residualbased_block_builder_and_solver.h:997
BaseType::TSchemeType TSchemeType
Definition of the classes from the base class.
Definition: residualbased_block_builder_and_solver.h:104
Current class provides an implementation for builder and solving operations, while the global mass an...
Definition: residualbased_block_builder_and_solver_with_mass_and_damping.h:85
ResidualBasedBlockBuilderAndSolverWithMassAndDamping()=default
Default constructor.
void BuildRHSNoDirichlet(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemVectorType &rb)
Definition: residualbased_block_builder_and_solver_with_mass_and_damping.h:503
ResidualBasedBlockBuilderAndSolverWithMassAndDamping(typename TLinearSolver::Pointer pNewLinearSystemSolver, Parameters ThisParameters)
Constructor. (with parameters)
Definition: residualbased_block_builder_and_solver_with_mass_and_damping.h:125
void GetDerivativesForVariable(const Variable< double > &rVariable, const Node &rNode, TSystemVectorType &rFirstDerivativeVector, TSystemVectorType &rSecondDerivativeVector) const
Definition: residualbased_block_builder_and_solver_with_mass_and_damping.h:490
void BuildRHS(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemVectorType &rb) override
Function to perform the build of the RHS.
Definition: residualbased_block_builder_and_solver_with_mass_and_damping.h:373
void BuildAndSolve(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
Function to perform the building and solving phase at the same time.
Definition: residualbased_block_builder_and_solver_with_mass_and_damping.h:264
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: residualbased_block_builder_and_solver_with_mass_and_damping.h:398
void GetFirstAndSecondDerivativeVector(TSystemVectorType &rFirstDerivativeVector, TSystemVectorType &rSecondDerivativeVector, ModelPart &rModelPart)
Definition: residualbased_block_builder_and_solver_with_mass_and_damping.h:460
void GetDerivativesForOptionalVariable(const Variable< double > &rVariable, const Node &rNode, TSystemVectorType &rFirstDerivativeVector, TSystemVectorType &rSecondDerivativeVector) const
Definition: residualbased_block_builder_and_solver_with_mass_and_damping.h:480
KRATOS_CLASS_POINTER_DEFINITION(ResidualBasedBlockBuilderAndSolverWithMassAndDamping)
Definition of the pointer.
static std::string Name()
Returns the name of the class as used in the settings (snake_case format)
Definition: residualbased_block_builder_and_solver_with_mass_and_damping.h:418
KRATOS_DEFINE_LOCAL_FLAG(SILENT_WARNINGS)
Definition of the flags.
std::string Info() const override
Turn back information as a string.
Definition: residualbased_block_builder_and_solver_with_mass_and_damping.h:433
void Build(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rb) override
Function to perform the build of the RHS. The vector could be sized as the total number of dofs or as...
Definition: residualbased_block_builder_and_solver_with_mass_and_damping.h:158
void BuildRHSAndSolve(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
Corresponds to the previews, but the System's matrix is considered already built and only the RHS is ...
Definition: residualbased_block_builder_and_solver_with_mass_and_damping.h:327
ResidualBasedBlockBuilderAndSolverWithMassAndDamping(typename TLinearSolver::Pointer pNewLinearSystemSolver)
Constructor.
Definition: residualbased_block_builder_and_solver_with_mass_and_damping.h:137
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
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
const VariableType & GetTimeDerivative() const
This method returns the time derivative variable.
Definition: variable.h:336
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_INFO_IF(label, conditional)
Definition: logger.h:251
void Mult(TSpaceType &dummy, typename TSpaceType::MatrixType &rA, typename TSpaceType::VectorType &rX, typename TSpaceType::VectorType &rY)
Definition: add_strategies_to_python.cpp:98
void UnaliasedAdd(TSpaceType &dummy, typename TSpaceType::VectorType &x, const double A, const typename TSpaceType::VectorType &rY)
Definition: add_strategies_to_python.cpp:170
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
void block_for_each(TIterator itBegin, TIterator itEnd, TFunction &&rFunction)
Execute a functor on all items of a range in parallel.
Definition: parallel_utilities.h:299
int k
Definition: quadrature.py:595
integer i
Definition: TensorModule.f:17
Definition: timer.py:1