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.
petrov_galerkin_rom_builder_and_solver.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: Sebastian Ares de Parga Regalado
11 //
12 
13 #pragma once
14 
15 /* System includes */
16 
17 /* External includes */
18 #include "concurrentqueue/concurrentqueue.h"
19 
20 /* Project includes */
21 #include "includes/define.h"
22 #include "includes/model_part.h"
28 
29 /* Application includes */
32 
33 namespace Kratos
34 {
35 
38 
39 
43 
44 
48 
49 
53 
54 
58 
77 template <class TSparseSpace, class TDenseSpace, class TLinearSolver>
78 class PetrovGalerkinROMBuilderAndSolver : public ROMBuilderAndSolver<TSparseSpace, TDenseSpace, TLinearSolver>
79 {
80 public:
81 
82 
85 
86  // Class pointer definition
88 
89  // The size_t types
90  typedef std::size_t SizeType;
91  typedef std::size_t IndexType;
92 
95 
108 
113 
114  // Non-distributed, dense:
117 
118  //Distributed, dense
121  // ^ Change this to a distributed dense type
122 
124  typedef Node NodeType;
125  typedef typename NodeType::DofType DofType;
127  typedef moodycamel::ConcurrentQueue<DofType::Pointer> DofQueue;
128 
132 
134  typename TLinearSolver::Pointer pNewLinearSystemSolver,
135  Parameters ThisParameters)
136  : ROMBuilderAndSolver<TSparseSpace, TDenseSpace, TLinearSolver>(pNewLinearSystemSolver)
137  {
138  // Validate and assign defaults
139  Parameters this_parameters_copy = ThisParameters.Clone();
140  this_parameters_copy = this->ValidateAndAssignParameters(this_parameters_copy, this->GetDefaultParameters());
141  this->AssignSettings(this_parameters_copy);
142  }
143 
145 
149 
150 
154 
156  typename TSchemeType::Pointer pScheme,
157  ModelPart &rModelPart) override
158  {
159  KRATOS_TRY;
160 
161  KRATOS_INFO_IF("PetrovGalerkinROMBuilderAndSolver", (this->GetEchoLevel() > 1)) << "Setting up the dofs" << std::endl;
162  KRATOS_INFO_IF("PetrovGalerkinROMBuilderAndSolver", (this->GetEchoLevel() > 2)) << "Number of threads" << ParallelUtilities::GetNumThreads() << "\n" << std::endl;
163  KRATOS_INFO_IF("PetrovGalerkinROMBuilderAndSolver", (this->GetEchoLevel() > 2)) << "Initializing element loop" << std::endl;
164 
165  // Get model part data
166  if (this->mHromWeightsInitialized == false) {
167  this->InitializeHROMWeights(rModelPart);
168  }
169 
170  auto dof_queue = this->ExtractDofSet(pScheme, rModelPart);
171 
172  // Fill a sorted auxiliary array of with the DOFs set
173  KRATOS_INFO_IF("PetrovGalerkinROMBuilderAndSolver", (this->GetEchoLevel() > 2)) << "Initializing ordered array filling\n" << std::endl;
174  auto dof_array = this->SortAndRemoveDuplicateDofs(dof_queue);
175 
176  // Update base builder and solver DOFs array and set corresponding flag
177  BaseType::GetDofSet().swap(dof_array);
179 
180  // Throw an exception if there are no DOFs involved in the analysis
181  KRATOS_ERROR_IF(BaseType::GetDofSet().size() == 0) << "No degrees of freedom!" << std::endl;
182  KRATOS_INFO_IF("PetrovGalerkinROMBuilderAndSolver", (this->GetEchoLevel() > 2)) << "Number of degrees of freedom:" << BaseType::GetDofSet().size() << std::endl;
183  KRATOS_INFO_IF("PetrovGalerkinROMBuilderAndSolver", (this->GetEchoLevel() > 2)) << "Finished setting up the dofs" << std::endl;
184 
185 #ifdef KRATOS_DEBUG
186  // If reactions are to be calculated, we check if all the dofs have reactions defined
188  {
189  for (const auto& r_dof: BaseType::GetDofSet())
190  {
191  KRATOS_ERROR_IF_NOT(r_dof.HasReaction())
192  << "Reaction variable not set for the following :\n"
193  << "Node : " << r_dof.Id() << '\n'
194  << "Dof : " << r_dof << '\n'
195  << "Not possible to calculate reactions." << std::endl;
196  }
197  }
198 #endif
199  KRATOS_CATCH("");
200  }
201 
203  typename TSchemeType::Pointer pScheme,
204  ModelPart &rModelPart,
206  TSystemVectorType &Dx,
207  TSystemVectorType &b) override
208  {
209  // KRATOS_TRY
211  PetrovGalerkinSystemVectorType brom = ZeroVector(mNumberOfPetrovGalerkinRomModes);
212  BuildROM(pScheme, rModelPart, Arom, brom);
213  SolveROM(rModelPart, Arom, brom, Dx);
214 
215 
216  // KRATOS_CATCH("")
217  }
218 
220  {
221  Parameters default_parameters = Parameters(R"(
222  {
223  "name" : "petrov_galerkin_rom_builder_and_solver",
224  "nodal_unknowns" : [],
225  "number_of_rom_dofs" : 10,
226  "petrov_galerkin_number_of_rom_dofs" : 10
227  })");
229 
230  return default_parameters;
231  }
232 
233  static std::string Name()
234  {
235  return "petrov_galerkin_rom_builder_and_solver";
236  }
237 
241 
242 
246 
247 
251 
253  virtual std::string Info() const override
254  {
255  return "PetrovGalerkinROMBuilderAndSolver";
256  }
257 
259  virtual void PrintInfo(std::ostream &rOStream) const override
260  {
261  rOStream << Info();
262  }
263 
265  virtual void PrintData(std::ostream &rOStream) const override
266  {
267  rOStream << Info();
268  }
269 
273 
274 
276 protected:
280 
281 
285 
287 
291 
292 
296 
297  void AssignSettings(const Parameters ThisParameters) override
298  {
299  BaseType::AssignSettings(ThisParameters);
300 
301  // // Set member variables
302  mNumberOfPetrovGalerkinRomModes = ThisParameters["petrov_galerkin_number_of_rom_dofs"].GetInt();
303  }
304 
308  struct AssemblyTLS
309  {
310  AssemblyTLS(SizeType NRomModes, SizeType NPetrovGalerkinRomModes)
311  : romA(ZeroMatrix(NPetrovGalerkinRomModes, NRomModes)),
312  romB(ZeroVector(NPetrovGalerkinRomModes))
313  { }
314  AssemblyTLS() = delete;
315 
316  Matrix phiE = {}; // Elemental Phi
317  Matrix psiE = {}; // Elemental Psi
318  LocalSystemMatrixType lhs = {}; // Elemental LHS
319  LocalSystemVectorType rhs = {}; // Elemental RHS
320  EquationIdVectorType eq_id = {}; // Elemental equation ID vector
321  DofsVectorType dofs = {}; // Elemental dof vector
324  RomSystemMatrixType aux = {}; // Auxiliary: romA = psi.t * (LHS * phi) := psi.t * aux
325  };
326 
330  template<typename T>
332  {
333  typedef T value_type;
334  typedef T return_type;
335 
337  bool mInitialized = false;
338 
339  void Init(const value_type& first_value)
340  {
341  mValue = first_value;
342  mInitialized = true;
343  }
344 
347  {
348  return mValue;
349  }
350 
351  void LocalReduce(const value_type& value)
352  {
353  if(!mInitialized) {
354  Init(value);
355  } else {
356  noalias(mValue) += value;
357  }
358  }
359 
361  {
362  if(!rOther.mInitialized) return;
363 
364  const std::lock_guard<LockObject> scope_lock(ParallelUtilities::GetGlobalLock());
365  LocalReduce(rOther.mValue);
366  }
367  };
368 
372  template<typename TMatrix>
373  static void ResizeIfNeeded(TMatrix& mat, const SizeType rows, const SizeType cols)
374  {
375  if(mat.size1() != rows || mat.size2() != cols) {
376  mat.resize(rows, cols, false);
377  }
378  };
379 
383  void BuildROM(
384  typename TSchemeType::Pointer pScheme,
385  ModelPart &rModelPart,
387  PetrovGalerkinSystemVectorType &rb) override
388  {
389  // KRATOS_TRY
390  // Define a dense matrix to hold the reduced problem
393 
394  // Build the system matrix by looping over elements and conditions and assembling to A
395  KRATOS_ERROR_IF(!pScheme) << "No scheme provided!" << std::endl;
396 
397  // Get ProcessInfo from main model part
398  const auto& r_current_process_info = rModelPart.GetProcessInfo();
399 
400 
401  // Assemble all entities
402  const auto assembling_timer = BuiltinTimer();
403 
405  AssemblyTLS assembly_tls_container(this->GetNumberOfROMModes(), mNumberOfPetrovGalerkinRomModes);
406 
407  const auto& r_elements = this->mHromSimulation ? this->mSelectedElements : rModelPart.Elements();
408 
409  if(!r_elements.empty())
410  {
411  std::tie(rA, rb) =
412  block_for_each<SystemSumReducer>(r_elements, assembly_tls_container,
413  [&](Element& r_element, AssemblyTLS& r_thread_prealloc)
414  {
415  return CalculateLocalContributionPetrovGalerkin(r_element, rA, rb, r_thread_prealloc, *pScheme, r_current_process_info);
416  });
417  }
418 
419 
420  const auto& r_conditions = this->mHromSimulation ? this->mSelectedConditions : rModelPart.Conditions();
421 
422  if(!r_conditions.empty())
423  {
424  PetrovGalerkinSystemMatrixType aconditions;
425  PetrovGalerkinSystemVectorType bconditions;
426 
427  std::tie(aconditions, bconditions) =
428  block_for_each<SystemSumReducer>(r_conditions, assembly_tls_container,
429  [&](Condition& r_condition, AssemblyTLS& r_thread_prealloc)
430  {
431  return CalculateLocalContributionPetrovGalerkin(r_condition, rA, rb, r_thread_prealloc, *pScheme, r_current_process_info);
432  });
433 
434  rA += aconditions;
435  rb += bconditions;
436  }
437 
438  KRATOS_INFO_IF("PetrovGalerkinROMBuilderAndSolver", (this->GetEchoLevel() > 0)) << "Build time: " << assembling_timer.ElapsedSeconds() << std::endl;
439  KRATOS_INFO_IF("PetrovGalerkinROMBuilderAndSolver", (this->GetEchoLevel() > 2)) << "Finished parallel building" << std::endl;
440 
441  // KRATOS_CATCH("")
442  }
443 
447  void SolveROM(
448  ModelPart &rModelPart,
451  TSystemVectorType &rDx) override
452  {
453  KRATOS_TRY
454 
456 
457  const auto solving_timer = BuiltinTimer();
458  // Calculate the QR decomposition
460  // ^Correct after properly defining PetrovGalerkinSystemMatrixType
461  qr_decomposition.Compute(rA);
462  qr_decomposition.Solve(rb, dxrom);
463  KRATOS_INFO_IF("PetrovGalerkinROMBuilderAndSolver", (this->GetEchoLevel() > 0)) << "Solve reduced system time: " << solving_timer.ElapsedSeconds() << std::endl;
464 
465  // Save the ROM solution increment in the root modelpart database
466  auto& r_root_mp = rModelPart.GetRootModelPart();
467  noalias(r_root_mp.GetValue(ROM_SOLUTION_INCREMENT)) += dxrom;
468 
469  // project reduced solution back to full order model
470  const auto backward_projection_timer = BuiltinTimer();
471  this->ProjectToFineBasis(dxrom, rModelPart, rDx);
472  KRATOS_INFO_IF("PetrovGalerkinROMBuilderAndSolver", (this->GetEchoLevel() > 0)) << "Project to fine basis time: " << backward_projection_timer.ElapsedSeconds() << std::endl;
473 
474  KRATOS_CATCH("")
475  }
476 
480 
481 
485 
486 
490 
491 private:
495 
499  template<typename TEntity>
500  std::tuple<LocalSystemMatrixType, LocalSystemVectorType> CalculateLocalContributionPetrovGalerkin(
501  TEntity& rEntity,
504  AssemblyTLS& rPreAlloc,
505  TSchemeType& rScheme,
506  const ProcessInfo& rCurrentProcessInfo)
507  {
508  if (rEntity.IsDefined(ACTIVE) && rEntity.IsNot(ACTIVE))
509  {
512  return std::tie(rPreAlloc.romA, rPreAlloc.romB);
513  }
514 
515  // Calculate elemental contribution
516  rScheme.CalculateSystemContributions(rEntity, rPreAlloc.lhs, rPreAlloc.rhs, rPreAlloc.eq_id, rCurrentProcessInfo);
517  rEntity.GetDofList(rPreAlloc.dofs, rCurrentProcessInfo);
518 
519  const SizeType ndofs = rPreAlloc.dofs.size();
520  ResizeIfNeeded(rPreAlloc.phiE, ndofs, this->GetNumberOfROMModes());
521  ResizeIfNeeded(rPreAlloc.psiE, ndofs, mNumberOfPetrovGalerkinRomModes);
522  ResizeIfNeeded(rPreAlloc.aux, ndofs, this->GetNumberOfROMModes());
523 
524  const auto &r_geom = rEntity.GetGeometry();
525  RomAuxiliaryUtilities::GetPhiElemental(rPreAlloc.phiE, rPreAlloc.dofs, r_geom, this->mMapPhi);
526  RomAuxiliaryUtilities::GetPsiElemental(rPreAlloc.psiE, rPreAlloc.dofs, r_geom, this->mMapPhi);
527 
528  const double h_rom_weight = this->mHromSimulation ? rEntity.GetValue(HROM_WEIGHT) : 1.0;
529 
530  noalias(rPreAlloc.aux) = prod(rPreAlloc.lhs, rPreAlloc.phiE);
531  noalias(rPreAlloc.romA) = prod(trans(rPreAlloc.psiE), rPreAlloc.aux) * h_rom_weight;
532  noalias(rPreAlloc.romB) = prod(trans(rPreAlloc.psiE), rPreAlloc.rhs) * h_rom_weight;
533 
534  return std::tie(rPreAlloc.romA, rPreAlloc.romB);
535  }
536 
537 
539 }; /* Class PetrovGalerkinROMBuilderAndSolver */
540 
544 
545 
547 
548 } /* namespace Kratos.*/
549 
TSparseSpace::VectorType TSystemVectorType
Definition of the vector size.
Definition: builder_and_solver.h:85
bool GetCalculateReactionsFlag() const
This method returns the flag mCalculateReactionsFlag.
Definition: builder_and_solver.h:184
TSparseSpace::MatrixType TSystemMatrixType
Definition of the sparse matrix.
Definition: builder_and_solver.h:82
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
void SetDofSetIsInitializedFlag(bool DofSetIsInitialized)
This method sets the flag mDofSetIsInitialized.
Definition: builder_and_solver.h:211
TDenseSpace::VectorType LocalSystemVectorType
The local vector definition.
Definition: builder_and_solver.h:97
std::size_t SizeType
Definition of the size type.
Definition: builder_and_solver.h:73
int GetEchoLevel() const
It returns the echo level.
Definition: builder_and_solver.h:674
virtual DofsArrayType & GetDofSet()
It allows to get the list of Dofs from the element.
Definition: builder_and_solver.h:507
Definition: builtin_timer.h:26
Base class for all Conditions.
Definition: condition.h:59
Definition: dense_householder_qr_decomposition.h:45
void Compute(MatrixType &rInputMatrix) override
Compute the QR Computes the QR Decomposition (QR) of the given imput matrix Note that the input matri...
Definition: dense_householder_qr_decomposition.h:92
void Solve(MatrixType &rB, MatrixType &rX) const override
Solves the problem Ax=b Being A the input matrix, this method solves the problem Ax = b.
Definition: dense_householder_qr_decomposition.h:148
Dof represents a degree of freedom (DoF).
Definition: dof.h:86
Base class for all Elements.
Definition: element.h:60
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
Definition: amatrix_interface.h:497
Definition: amatrix_interface.h:530
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ModelPart & GetRootModelPart()
Definition: model_part.cpp:510
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
This class defines the node.
Definition: node.h:65
static LockObject & GetGlobalLock()
Returns the global lock Global lock that can be used for critical sections.
Definition: parallel_utilities.cpp:125
static int GetNumThreads()
Returns the current number of threads.
Definition: parallel_utilities.cpp:34
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
int GetInt() const
This method returns the integer contained in the current Parameter.
Definition: kratos_parameters.cpp:666
Parameters Clone() const
Generates a clone of the current document.
Definition: kratos_parameters.cpp:397
void AddMissingParameters(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing contain at least all parameters...
Definition: kratos_parameters.cpp:1369
Current class provides an implementation for PetrovGalerkinROM builder and solving operations.
Definition: petrov_galerkin_rom_builder_and_solver.h:79
NodeType::DofType DofType
Definition: petrov_galerkin_rom_builder_and_solver.h:125
void SolveROM(ModelPart &rModelPart, PetrovGalerkinSystemMatrixType &rA, PetrovGalerkinSystemVectorType &rb, TSystemVectorType &rDx) override
Definition: petrov_galerkin_rom_builder_and_solver.h:447
static std::string Name()
Definition: petrov_galerkin_rom_builder_and_solver.h:233
SizeType mNumberOfPetrovGalerkinRomModes
Definition: petrov_galerkin_rom_builder_and_solver.h:286
ModelPart::MasterSlaveConstraintContainerType MasterSlaveConstraintContainerType
Additional definitions.
Definition: petrov_galerkin_rom_builder_and_solver.h:110
std::size_t SizeType
Definition: petrov_galerkin_rom_builder_and_solver.h:90
virtual std::string Info() const override
Turn back information as a string.
Definition: petrov_galerkin_rom_builder_and_solver.h:253
BaseType::ConditionsArrayType ConditionsArrayType
Definition: petrov_galerkin_rom_builder_and_solver.h:107
BaseType::TSystemVectorType TSystemVectorType
Definition: petrov_galerkin_rom_builder_and_solver.h:101
DofType::Pointer DofPointerType
Definition: petrov_galerkin_rom_builder_and_solver.h:126
BaseType::ElementsArrayType ElementsArrayType
Definition: petrov_galerkin_rom_builder_and_solver.h:106
void BuildROM(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, PetrovGalerkinSystemMatrixType &rA, PetrovGalerkinSystemVectorType &rb) override
Definition: petrov_galerkin_rom_builder_and_solver.h:383
BaseType::TSystemVectorPointerType TSystemVectorPointerType
Definition: petrov_galerkin_rom_builder_and_solver.h:105
LocalSystemMatrixType RomSystemMatrixType
Definition: petrov_galerkin_rom_builder_and_solver.h:115
virtual void PrintData(std::ostream &rOStream) const override
Print object's data.GetNumberOfROMModes()
Definition: petrov_galerkin_rom_builder_and_solver.h:265
std::size_t IndexType
Definition: petrov_galerkin_rom_builder_and_solver.h:91
ROMBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition of the classes from the base class.
Definition: petrov_galerkin_rom_builder_and_solver.h:97
PetrovGalerkinROMBuilderAndSolver(typename TLinearSolver::Pointer pNewLinearSystemSolver, Parameters ThisParameters)
Definition: petrov_galerkin_rom_builder_and_solver.h:133
BaseType::TSchemeType TSchemeType
Definition: petrov_galerkin_rom_builder_and_solver.h:98
PetrovGalerkinROMBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver > ClassType
The definition of the current class.
Definition: petrov_galerkin_rom_builder_and_solver.h:94
BaseType::TSystemMatrixType TSystemMatrixType
Definition: petrov_galerkin_rom_builder_and_solver.h:100
Element::EquationIdVectorType EquationIdVectorType
Definition: petrov_galerkin_rom_builder_and_solver.h:111
RomSystemVectorType PetrovGalerkinSystemVectorType
Definition: petrov_galerkin_rom_builder_and_solver.h:120
moodycamel::ConcurrentQueue< DofType::Pointer > DofQueue
Definition: petrov_galerkin_rom_builder_and_solver.h:127
RomSystemMatrixType PetrovGalerkinSystemMatrixType
Definition: petrov_galerkin_rom_builder_and_solver.h:119
BaseType::DofsArrayType DofsArrayType
Definition: petrov_galerkin_rom_builder_and_solver.h:99
Node NodeType
DoF types definition.
Definition: petrov_galerkin_rom_builder_and_solver.h:124
BaseType::TSystemMatrixPointerType TSystemMatrixPointerType
Definition: petrov_galerkin_rom_builder_and_solver.h:104
void SetUpDofSet(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart) override
Builds the list of the DofSets involved in the problem by "asking" to each element and condition its ...
Definition: petrov_galerkin_rom_builder_and_solver.h:155
virtual void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: petrov_galerkin_rom_builder_and_solver.h:259
KRATOS_CLASS_POINTER_DEFINITION(PetrovGalerkinROMBuilderAndSolver)
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: petrov_galerkin_rom_builder_and_solver.h:103
LocalSystemVectorType RomSystemVectorType
Definition: petrov_galerkin_rom_builder_and_solver.h:116
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: petrov_galerkin_rom_builder_and_solver.h:219
static void ResizeIfNeeded(TMatrix &mat, const SizeType rows, const SizeType cols)
Definition: petrov_galerkin_rom_builder_and_solver.h:373
Element::DofsVectorType DofsVectorType
Definition: petrov_galerkin_rom_builder_and_solver.h:112
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: petrov_galerkin_rom_builder_and_solver.h:102
void BuildAndSolve(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Function to perform the building and solving phase at the same time.
Definition: petrov_galerkin_rom_builder_and_solver.h:202
void AssignSettings(const Parameters ThisParameters) override
This method assigns settings to member variables.
Definition: petrov_galerkin_rom_builder_and_solver.h:297
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
void swap(PointerVectorSet &rOther)
Swaps the contents of this PointerVectorSet with another.
Definition: pointer_vector_set.h:532
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Definition: rom_builder_and_solver.h:62
BaseType::TSystemMatrixType TSystemMatrixType
Definition: rom_builder_and_solver.h:91
void InitializeHROMWeights(ModelPart &rModelPart)
Definition: rom_builder_and_solver.h:487
void ProjectToFineBasis(const TSystemVectorType &rRomUnkowns, const ModelPart &rModelPart, TSystemVectorType &rDx) const
Definition: rom_builder_and_solver.h:254
ElementsArrayType mSelectedElements
Definition: rom_builder_and_solver.h:408
BaseType::TSystemVectorType TSystemVectorType
Definition: rom_builder_and_solver.h:92
ConditionsArrayType mSelectedConditions
Definition: rom_builder_and_solver.h:409
static DofsArrayType SortAndRemoveDuplicateDofs(DofQueue &rDofQueue)
Definition: rom_builder_and_solver.h:589
SizeType GetNumberOfROMModes() const noexcept
Definition: rom_builder_and_solver.h:249
Parameters GetDefaultParameters() const override
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: rom_builder_and_solver.h:338
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: rom_builder_and_solver.h:93
void AssignSettings(const Parameters ThisParameters) override
This method assigns settings to member variables.
Definition: rom_builder_and_solver.h:466
bool mHromSimulation
Definition: rom_builder_and_solver.h:411
BaseType::TSystemMatrixPointerType TSystemMatrixPointerType
Definition: rom_builder_and_solver.h:95
BaseType::ConditionsArrayType ConditionsArrayType
Definition: rom_builder_and_solver.h:98
BaseType::TSystemVectorPointerType TSystemVectorPointerType
Definition: rom_builder_and_solver.h:96
bool mHromWeightsInitialized
Definition: rom_builder_and_solver.h:412
BaseType::ElementsArrayType ElementsArrayType
Definition: rom_builder_and_solver.h:97
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: rom_builder_and_solver.h:94
static DofQueue ExtractDofSet(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart)
Definition: rom_builder_and_solver.h:540
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
static void GetPsiElemental(Matrix &rPsiElemental, const Element::DofsVectorType &rDofs, const Element::GeometryType &rGeom, const std::unordered_map< Kratos::VariableData::KeyType, Matrix::size_type > &rVarToRowMapping)
Obtain the left elemental basis (Psi) matrix for a particular element.
Definition: rom_auxiliary_utilities.cpp:750
static void GetPhiElemental(Matrix &rPhiElemental, const Element::DofsVectorType &rDofs, const Element::GeometryType &rGeom, const std::unordered_map< Kratos::VariableData::KeyType, Matrix::size_type > &rVarToRowMapping)
Obtain the elemental basis matrix for a particular element.
Definition: rom_auxiliary_utilities.cpp:718
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_INFO_IF(label, conditional)
Definition: logger.h:251
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
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
AMatrix::TransposeMatrix< const T > trans(const T &TheMatrix)
Definition: amatrix_interface.h:486
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
mat
Definition: script_ELASTIC.py:155
A
Definition: sensitivityMatrix.py:70
Definition: reduction_utilities.h:310
Definition: petrov_galerkin_rom_builder_and_solver.h:309
PetrovGalerkinSystemVectorType romB
Definition: petrov_galerkin_rom_builder_and_solver.h:323
EquationIdVectorType eq_id
Definition: petrov_galerkin_rom_builder_and_solver.h:320
DofsVectorType dofs
Definition: petrov_galerkin_rom_builder_and_solver.h:321
PetrovGalerkinSystemMatrixType romA
Definition: petrov_galerkin_rom_builder_and_solver.h:322
Matrix psiE
Definition: petrov_galerkin_rom_builder_and_solver.h:317
LocalSystemVectorType rhs
Definition: petrov_galerkin_rom_builder_and_solver.h:319
LocalSystemMatrixType lhs
Definition: petrov_galerkin_rom_builder_and_solver.h:318
AssemblyTLS(SizeType NRomModes, SizeType NPetrovGalerkinRomModes)
Definition: petrov_galerkin_rom_builder_and_solver.h:310
RomSystemMatrixType aux
Definition: petrov_galerkin_rom_builder_and_solver.h:324
Matrix phiE
Definition: petrov_galerkin_rom_builder_and_solver.h:316
Definition: petrov_galerkin_rom_builder_and_solver.h:332
void ThreadSafeReduce(const NonTrivialSumReduction &rOther)
Definition: petrov_galerkin_rom_builder_and_solver.h:360
bool mInitialized
Definition: petrov_galerkin_rom_builder_and_solver.h:337
void LocalReduce(const value_type &value)
Definition: petrov_galerkin_rom_builder_and_solver.h:351
T value_type
Definition: petrov_galerkin_rom_builder_and_solver.h:333
void Init(const value_type &first_value)
Definition: petrov_galerkin_rom_builder_and_solver.h:339
T mValue
Definition: petrov_galerkin_rom_builder_and_solver.h:336
return_type GetValue() const
access to reduced value
Definition: petrov_galerkin_rom_builder_and_solver.h:346
T return_type
Definition: petrov_galerkin_rom_builder_and_solver.h:334