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.
rom_auxiliary_utilities.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: Ruben Zorrilla
11 // Suneth Warnakulasuriya
12 //
13 
14 #if !defined(KRATOS_ROM_AUXILIARY_UTILITIES_H)
15 #define KRATOS_ROM_AUXILIARY_UTILITIES_H
16 
17 // System includes
18 #include <unordered_map>
19 
20 // External includes
21 
22 // Project includes
23 #include "geometries/geometry.h"
24 #include "includes/key_hash.h"
25 #include "includes/node.h"
26 #include "includes/model_part.h"
30 
31 // Application includes
33 
34 
35 namespace Kratos
36 {
39 
42 
43 class KRATOS_API(ROM_APPLICATION) RomAuxiliaryUtilities
44 {
45 public:
48 
49  using SizeType = std::size_t;
50 
51  using IndexType = std::size_t;
52 
53  using NodeType = Node;
54 
56 
58 
60 
61  using ElementFacesMapType = std::unordered_map<
62  std::vector<IndexType>,
63  std::pair<bool, GeometryPointerType>,
66 
70 
80  static void SetHRomComputingModelPart(
81  const Parameters HRomWeights,
82  const ModelPart& rOriginModelPart,
83  ModelPart& rHRomComputingModelPart);
84 
98  static void SetHRomComputingModelPartWithNeighbours(
99  const Parameters HRomWeights,
100  ModelPart& rOriginModelPart,
101  ModelPart& rHRomComputingModelPart);
102 
112  static void SetHRomVolumetricVisualizationModelPart(
113  const ModelPart& rOriginModelPart,
114  ModelPart& rHRomVisualizationModelPart);
115 
125  static std::vector<IndexType> GetHRomConditionParentsIds(
126  const ModelPart& rModelPart,
127  const std::map<std::string, std::map<IndexType, double>>& rHRomWeights);
128 
143  static std::vector<IndexType> GetNodalNeighbouringElementIdsNotInHRom(
144  ModelPart& rModelPart,
145  ModelPart& rGivenModelPart,
146  const std::map<std::string, std::map<IndexType, double>>& rHRomWeights);
147 
161  static std::vector<IndexType> GetNodalNeighbouringElementIds(
162  ModelPart& rModelPart,
163  ModelPart& rGivenModelPart);
164 
173  static std::vector<IndexType> GetConditionIdsNotInHRomModelPart(
174  const ModelPart& rModelPartWithConditionsToInclude,
175  std::map<std::string, std::map<IndexType, double>>& rHRomWeights);
176 
185  static std::vector<IndexType> GetElementIdsNotInHRomModelPart(
186  const ModelPart& rModelPartWithElementsToInclude,
187  std::map<std::string, std::map<IndexType, double>>& rHRomWeights);
188 
197  static std::vector<IndexType> GetHRomMinimumConditionsIds(
198  const ModelPart& rModelPart,
199  const std::map<IndexType, double>& rHRomConditionWeights);
200 
201 
212  static std::vector<IndexType> GetElementIdsInModelPart(
213  const ModelPart& rModelPart
214  );
215 
226  static std::vector<IndexType> GetConditionIdsInModelPart(
227  const ModelPart& rModelPart
228  );
229 
237  static void ProjectRomSolutionIncrementToNodes(
238  const std::vector<std::string> &rRomVariableNames,
239  ModelPart &rModelPart);
240 
248  static void GetPhiElemental(
249  Matrix &rPhiElemental,
250  const Element::DofsVectorType& rDofs,
251  const Element::GeometryType& rGeom,
252  const std::unordered_map<Kratos::VariableData::KeyType, Matrix::size_type>& rVarToRowMapping);
253 
254 
262  static void GetPsiElemental(
263  Matrix &rPsiElemental,
264  const Element::DofsVectorType& rDofs,
265  const Element::GeometryType& rGeom,
266  const std::unordered_map<Kratos::VariableData::KeyType, Matrix::size_type>& rVarToRowMapping);
267 
278  static void GetJPhiElemental(
279  Matrix &rJPhiElemental,
280  const Element::DofsVectorType& rDofs,
281  const Matrix &rJPhi);
282 
284 
285  private:
286 
289 
290  static void RecursiveHRomModelPartCreation(
291  const NodesPointerSetType& rNodesSet,
292  const std::vector<Element::Pointer>& rElementsVector,
293  const std::vector<Condition::Pointer>& rConditionsVector,
294  const ModelPart& rOriginModelPart,
295  ModelPart& rDestinationModelPart);
296 
297  static void RecursiveHRomMinimumConditionIds(
298  const ModelPart& rModelPart,
299  const std::map<IndexType, double>& rHRomConditionWeights,
300  std::vector<IndexType>& rMinimumConditionsIds);
301 
302  static void RecursiveVisualizationSubModelPartCreation(
303  const ModelPart& rOriginSubModelPart,
304  ModelPart& rDestinationModelPart);
305 
307 
308 };
309 
311 
312 } // namespace Kratos
313 
314 #endif // KRATOS_ROM_AUXILIARY_UTILITIES_H
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
Geometry base class.
Definition: geometry.h:71
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
This class defines the node.
Definition: node.h:65
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
Definition: rom_auxiliary_utilities.h:44
std::size_t SizeType
Definition: rom_auxiliary_utilities.h:49
ModelPart::NodesContainerType NodesPointerSetType
Definition: rom_auxiliary_utilities.h:59
Geometry< NodeType >::Pointer GeometryPointerType
Definition: rom_auxiliary_utilities.h:57
std::size_t IndexType
Definition: rom_auxiliary_utilities.h:51
std::unordered_map< std::vector< IndexType >, std::pair< bool, GeometryPointerType >, KeyHasherRange< std::vector< IndexType > >, KeyComparorRange< std::vector< IndexType > >> ElementFacesMapType
Definition: rom_auxiliary_utilities.h:65
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
This is a key comparer of general pourpose between two classes.
Definition: key_hash.h:100
This is a hasher of general pourpose.
Definition: key_hash.h:138