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.
fluid_test_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: Suneth Warnakulasuriya
11 //
12 
13 #pragma once
14 
15 // System includes
16 #include <functional>
17 
18 // External includes
19 
20 // Project includes
21 #include "containers/model.h"
22 #include "includes/model_part.h"
23 #include "processes/process.h"
24 
25 // Application includes
26 
27 namespace Kratos
28 {
31 
32 class KRATOS_API(FLUID_DYNAMICS_APPLICATION) FluidTestUtilities
33 {
34 public:
37 
39 
41 
42  using DofsVectorType = std::vector<Dof<double>::Pointer>;
43 
44  using EquationIdVectorType = std::vector<std::size_t>;
45 
47 
49 
51 
55 
56  template<class TDataType>
57  static void AssignRandomValues(
58  TDataType& rValue,
59  const std::string& rSeed,
60  const int DomainSize,
61  const double MinValue = 0.0,
62  const double MaxValue = 1.0);
63 
65  Model& rModel,
66  const std::string& rModelPartName,
67  const std::string& rElementName,
68  const std::string& rConditionName,
69  const std::function<void(PropertiesType&)>& rSetElementProperties,
70  const std::function<void(PropertiesType&)>& rSetConditionProperties,
71  const std::function<void(ModelPart&)>& rAddNodalSolutionStepVariablesFuncion,
72  const std::function<void(NodeType&)>& rAddDofsFunction,
73  const int BufferSize = 2);
74 
75  template<class TDataType>
77  ModelPart& rModelPart,
78  const Variable<TDataType>& rVariable,
79  const double MinValue = 0.0,
80  const double MaxValue = 1.0,
81  const int Step = 0)
82  {
83  RandomFillHistoricalVariable<TDataType>(rModelPart, rVariable, rVariable.Name(), MinValue, MaxValue, Step);
84  }
85 
86  template<class TDataType>
87  static void RandomFillHistoricalVariable(
88  ModelPart& rModelPart,
89  const Variable<TDataType>& rVariable,
90  const std::string& rSeedExtension,
91  const double MinValue = 0.0,
92  const double MaxValue = 1.0,
93  const int Step = 0);
94 
95  template<class TContainerType, class TDataType>
97  TContainerType& rContainer,
98  const Variable<TDataType>& rVariable,
99  const IndexType DomainSize,
100  const double MinValue = 0.0,
101  const double MaxValue = 1.0)
102  {
103  RandomFillNonHistoricalVariable<TContainerType, TDataType>(rContainer, rVariable, rVariable.Name(), DomainSize, MinValue, MaxValue);
104  }
105 
106  template<class TContainerType, class TDataType>
107  static void RandomFillNonHistoricalVariable(
108  TContainerType& rContainer,
109  const Variable<TDataType>& rVariable,
110  const std::string& rSeedExtension,
111  const IndexType DomainSize,
112  const double MinValue = 0.0,
113  const double MaxValue = 1.0);
114 
115  template<class TContainerType>
116  static void RunEntityGetDofListTest(
117  const TContainerType& rContainer,
118  const ProcessInfo& rProcessInfo,
119  const std::vector<const Variable<double>*>& rDofVariablesList);
120 
121  template<class TContainerType>
122  static void RunEntityEquationIdVectorTest(
123  const TContainerType& rContainer,
124  const ProcessInfo& rProcessInfo,
125  const std::vector<const Variable<double>*>& rDofVariablesList);
126 
127  template<class TContainerType>
128  static void RunEntityGetValuesVectorTest(
129  const TContainerType& rContainer,
130  const std::vector<const Variable<double>*>& rDofVariablesList);
131 
132  template<class TContainerType>
133  static void RunEntityGetFirstDerivativesVectorTest(
134  const TContainerType& rContainer,
135  const std::function<Vector(const ModelPart::NodeType&)>& rValueRetrievalMethod);
136 
137  template<class TContainerType>
138  static void RunEntityGetSecondDerivativesVectorTest(
139  const TContainerType& rContainer,
140  const std::function<Vector(const ModelPart::NodeType&)>& rValueRetrievalMethod);
141 
145 
146  template<class TContainerType>
148  {
149  public:
150  TContainerType& operator()(ModelPart& rModelPart);
151  };
152 
154 };
155 
157 
158 } // namespace Kratos
Definition: fluid_test_utilities.h:148
TContainerType & operator()(ModelPart &rModelPart)
Definition: fluid_test_utilities.h:33
ModelPart::ElementsContainerType ElementsContainerType
Definition: fluid_test_utilities.h:50
ModelPart::ConditionsContainerType ConditionsContainerType
Definition: fluid_test_utilities.h:48
static void RandomFillHistoricalVariable(ModelPart &rModelPart, const Variable< TDataType > &rVariable, const double MinValue=0.0, const double MaxValue=1.0, const int Step=0)
Definition: fluid_test_utilities.h:76
std::vector< std::size_t > EquationIdVectorType
Definition: fluid_test_utilities.h:44
static void AssignRandomValues(TDataType &rValue, const std::string &rSeed, const int DomainSize, const double MinValue=0.0, const double MaxValue=1.0)
static void RandomFillNonHistoricalVariable(TContainerType &rContainer, const Variable< TDataType > &rVariable, const IndexType DomainSize, const double MinValue=0.0, const double MaxValue=1.0)
Definition: fluid_test_utilities.h:96
ModelPart::NodesContainerType NodesContainerType
Definition: fluid_test_utilities.h:46
std::vector< Dof< double >::Pointer > DofsVectorType
Definition: fluid_test_utilities.h:42
This class aims to manage different model parts across multi-physics simulations.
Definition: model.h:60
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MeshType::ConditionsContainerType ConditionsContainerType
Condintions container. A vector set of Conditions with their Id's as key.
Definition: model_part.h:183
MeshType::ElementsContainerType ElementsContainerType
Element container. A vector set of Elements with their Id's as key.
Definition: model_part.h:168
Node NodeType
Definition: model_part.h:117
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
Properties PropertiesType
Definition: model_part.h:119
This class defines the node.
Definition: node.h:65
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
const std::string & Name() const
Definition: variable_data.h:201
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
std::size_t IndexType
The definition of the index type.
Definition: key_hash.h:35
ModelPart & CreateTestModelPart(Model &rModel, const std::string &rElementName, const std::string &rConditionName, const std::function< void(ModelPart &rModelPart)> &rAddNodalSolutionStepVariablesFuncion, const std::function< void(ModelPart::NodeType &)> &rAddDofsFunction, const std::function< void(Properties &)> &rSetProperties, const int BufferSize)
Definition: test_utilities.cpp:94
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Internals::Matrix< double, AMatrix::dynamic, 1 > Vector
Definition: amatrix_interface.h:472