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.
metrics_divergencefree_process.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: Riccardo Tosi
11 // Brendan Keith
12 //
13 
14 #if !defined(KRATOS_DIVERGENCEFREE_METRICS_PROCESS)
15 #define KRATOS_DIVERGENCEFREE_METRICS_PROCESS
16 
17 // Project includes
19 #include "includes/model_part.h"
20 #include "processes/process.h"
21 
22 namespace Kratos
23 {
26 
30 
32  typedef std::size_t SizeType;
33 
37 
41 
45 
55 template<SizeType TDim>
56 class KRATOS_API(MESHING_APPLICATION) MetricDivergenceFreeProcess
57  : public Process
58 {
59 public:
62 
67 
69  typedef Node NodeType;
70 
73  typedef NodesArrayType::iterator NodeItType;
74  typedef ElementsArrayType::iterator ElementItType;
75 
77  typedef std::size_t IndexType;
78 
81 
83  typedef typename std::conditional<TDim == 2, array_1d<double, 3>, array_1d<double, 6>>::type TensorArrayType;
84 
87 
91 
92  // Constructor
93 
100  ModelPart& rThisModelPart,
101  Parameters ThisParameters = Parameters(R"({})")
102  );
103 
105  ~MetricDivergenceFreeProcess() override = default;
106 
110 
111  void operator()()
112  {
113  Execute();
114  }
115 
119 
123  void Execute() override;
124 
128 
129 
133 
134 
138 
140  std::string Info() const override
141  {
142  return "MetricDivergenceFreeProcess";
143  }
144 
146  void PrintInfo(std::ostream& rOStream) const override
147  {
148  rOStream << "MetricDivergenceFreeProcess";
149  }
150 
152  void PrintData(std::ostream& rOStream) const override
153  {
154  }
155 
156 protected:
159 
160 
164 
165 
169 
170 
174 
175 
179 
180 
184 
185 
189 
190 
192 
193 private:
196 
200 
201  ModelPart& mrThisModelPart;
202 
203  double mMinSize;
204  double mMaxSize;
205  enum RefinementStrategies {MaximumStrategy, MeanDistributionStrategy, GlobalToleranceStrategy};
206  RefinementStrategies mRefinementStrategy;
207  SizeType mEchoLevel;
208  std::string mReferenceVariable;
209 
210  // Mean dsitribution strategy
211  std::string mMeanStrategyReferenceNorm;
212  double mMeanStrategyTargetRefinementCoefficient;
213  double mMeanStrategyRefinementBound;
214  double mMeanStrategyDivergenceFreeOverAllDomain;
215 
216  // Maximum strategy
217  double mMaxStrategyTargetRefinementCoefficient;
218  double mMaxStrategyRefinementCoefficient;
219  double mDivergenceFreeMaxValue;
220 
221  // Interpolation error strategy
222  double mGlobalErrorStrategyGlobalTolerance;
223  double mGlobalErrorStrategyMeshConstant;
224 
228 
232 
236  void InitializeRefinementStrategy();
237 
241  void CalculateMetric();
242 
246 
250 
254 
258 
260  MetricDivergenceFreeProcess& operator=(MetricDivergenceFreeProcess const& rOther);
261 
263  //MetricDivergenceFreeProcess(MetricDivergenceFreeProcess const& rOther);
264 
266 };// class MetricDivergenceFreeProcess
268 
271 
275 
277 template<unsigned int TDim, class TVarType>
278 inline std::istream& operator >> (std::istream& rIStream,
280 
282 template<unsigned int TDim, class TVarType>
283 inline std::ostream& operator << (std::ostream& rOStream,
285 {
286  rThis.PrintInfo(rOStream);
287  rOStream << std::endl;
288  rThis.PrintData(rOStream);
289 
290  return rOStream;
291 }
292 
293 };// namespace Kratos.
294 #endif /* KRATOS_DIVERGENCEFREE_METRICS_PROCESS defined */
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Definition: amatrix_interface.h:41
This class is can be used to compute the metrics of the model part with different strategies,...
Definition: metrics_divergencefree_process.h:58
WeakPointerVector< Element >::iterator WeakElementItType
Definition of the iterators.
Definition: metrics_divergencefree_process.h:72
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: metrics_divergencefree_process.h:146
std::conditional< TDim==2, array_1d< double, 3 >, array_1d< double, 6 > >::type TensorArrayType
The type of array considered for the tensor.
Definition: metrics_divergencefree_process.h:83
ElementsArrayType::iterator ElementItType
Definition: metrics_divergencefree_process.h:74
Node NodeType
The definition of the node type.
Definition: metrics_divergencefree_process.h:69
void PrintData(std::ostream &rOStream) const override
Print object"s data.
Definition: metrics_divergencefree_process.h:152
ModelPart::ElementsContainerType ElementsArrayType
Definition: metrics_divergencefree_process.h:65
~MetricDivergenceFreeProcess() override=default
Destructor.
void operator()()
Definition: metrics_divergencefree_process.h:111
ModelPart::ConditionsContainerType ConditionsArrayType
Definition: metrics_divergencefree_process.h:66
NodesArrayType::iterator NodeItType
Definition: metrics_divergencefree_process.h:73
std::string Info() const override
Turn back information as a string.
Definition: metrics_divergencefree_process.h:140
ModelPart::NodesContainerType NodesArrayType
Containers definition.
Definition: metrics_divergencefree_process.h:64
KRATOS_CLASS_POINTER_DEFINITION(MetricDivergenceFreeProcess)
Pointer definition of MetricDivergenceFreeProcess.
std::size_t IndexType
Definition of the indextype.
Definition: metrics_divergencefree_process.h:77
BoundedMatrix< double, TDim, TDim > MatrixType
Matrix type definition.
Definition: metrics_divergencefree_process.h:80
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
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
The base class for all processes in Kratos.
Definition: process.h:49
Short class definition.
Definition: weak_pointer_vector_iterator.h:63
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
type
Definition: generate_gid_list_file.py:35