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_levelset_process.h
Go to the documentation of this file.
1 // KRATOS __ __ _____ ____ _ _ ___ _ _ ____
2 // | \/ | ____/ ___|| | | |_ _| \ | |/ ___|
3 // | |\/| | _| \___ \| |_| || || \| | | _
4 // | | | | |___ ___) | _ || || |\ | |_| |
5 // |_| |_|_____|____/|_| |_|___|_| \_|\____| APPLICATION
6 //
7 // License: BSD License
8 // license: MeshingApplication/license.txt
9 //
10 // Main authors: Vicente Mataix Ferrandiz
11 //
12 
13 #if !defined(KRATOS_LEVELSET_METRICS_PROCESS)
14 #define KRATOS_LEVELSET_METRICS_PROCESS
15 
16 // Project includes
18 #include "processes/process.h"
19 #include "includes/model_part.h"
21 
22 namespace Kratos
23 {
26 
30 
32  typedef std::size_t SizeType;
33 
37 
41 
45 
52 template<SizeType TDim>
53 class KRATOS_API(MESHING_APPLICATION) ComputeLevelSetSolMetricProcess
54  : public Process
55 {
56 public:
57 
60 
63 
65  typedef Node NodeType;
66 
71 
73  typedef std::size_t IndexType;
74 
76  typedef typename std::conditional<TDim == 2, array_1d<double, 3>, array_1d<double, 6>>::type TensorArrayType;
77 
81 
85  enum class Interpolation {CONSTANT = 0, LINEAR = 1, EXPONENTIAL = 2, PIECEWISE_LINEAR = 3};
86 
90 
98  ModelPart& rThisModelPart,
99  const Variable<array_1d<double,3>>& rVariableGradient = DISTANCE_GRADIENT,
100  Parameters ThisParameters = Parameters(R"({})")
101  );
102 
104  ~ComputeLevelSetSolMetricProcess() override = default;
105 
109 
110  void operator()()
111  {
112  Execute();
113  }
114 
118  const Parameters GetDefaultParameters() const override;
119 
123 
127  void Execute() override;
128 
132 
133 
137 
138 
142 
144  std::string Info() const override
145  {
146  return "ComputeLevelSetSolMetricProcess";
147  }
148 
150  void PrintInfo(std::ostream& rOStream) const override
151  {
152  rOStream << "ComputeLevelSetSolMetricProcess";
153  }
154 
156  void PrintData(std::ostream& rOStream) const override
157  {
158  }
159 
160 protected:
163 
164 
168 
169 
173 
174 
178 
179 
183 
184 
188 
189 
193 
194 
196 
197 private:
200 
204 
205  ModelPart& mThisModelPart;
206  const Variable<array_1d<double,3>>& mVariableGradient;
207  std::string mRatioReferenceVariable = "DISTANCE";
208  std::string mSizeReferenceVariable = "DISTANCE";
209  double mMinSize;
210  double mMaxSize;
211  bool mEnforceCurrent;
212  double mAnisotropicRatio;
213  double mBoundLayer;
214  double mSizeBoundLayer;
215  Table<double> mSizeDistributionTable;
216  Interpolation mInterpolation;
217  Interpolation mSizeInterpolation;
218 
222 
226 
234  TensorArrayType ComputeLevelSetMetricTensor(
235  const array_1d<double, 3>& GradientValue,
236  const double Ratio,
237  const double ElementSize
238  );
239 
246  Interpolation ConvertInter(const std::string& Str)
247  {
248  if(Str == "Constant" || Str == "CONSTANT" || Str == "constant")
249  return Interpolation::CONSTANT;
250  else if(Str == "Linear" || Str == "LINEAR" || Str == "linear")
251  return Interpolation::LINEAR;
252  else if(Str == "Exponential" || Str == "EXPONENTIAL" || Str == "exponential")
253  return Interpolation::EXPONENTIAL;
254  else if(Str == "piecewise_linear" || Str == "PIECEWISE_LINEAR")
255  return Interpolation::PIECEWISE_LINEAR;
256  else
257  return Interpolation::LINEAR;
258  }
259 
268  double CalculateAnisotropicRatio(
269  const double Distance
270  );
271 
272  double CalculateElementSize(
273  const double Distance,
274  const double NodalH
275  );
276 
280 
284 
288 
292 
294  ComputeLevelSetSolMetricProcess& operator=(ComputeLevelSetSolMetricProcess const& rOther)
295  {
296  return *this;
297  };
298 
300  //ComputeLevelSetSolMetricProcess(ComputeLevelSetSolMetricProcess const& rOther);
301 
303 };// class ComputeLevelSetSolMetricProcess
307 
308 
312 
314 template<unsigned int TDim>
315 inline std::istream& operator >> (std::istream& rIStream,
317 
319 template<unsigned int TDim>
320 inline std::ostream& operator << (std::ostream& rOStream,
322 {
323  rThis.PrintInfo(rOStream);
324  rOStream << std::endl;
325  rThis.PrintData(rOStream);
326 
327  return rOStream;
328 }
329 
330 };// namespace Kratos.
331 #endif /* KRATOS_LEVELSET_METRICS_PROCESS defined */
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
This class is can be used to compute the metrics of the model part with a level set approach.
Definition: metrics_levelset_process.h:55
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: metrics_levelset_process.h:150
ModelPart::ConditionsContainerType ConditionsArrayType
Definition: metrics_levelset_process.h:70
void PrintData(std::ostream &rOStream) const override
Print object"s data.
Definition: metrics_levelset_process.h:156
std::size_t IndexType
The index type definition.
Definition: metrics_levelset_process.h:73
KRATOS_CLASS_POINTER_DEFINITION(ComputeLevelSetSolMetricProcess)
Pointer definition of ComputeLevelSetSolMetricProcess.
Interpolation
This enums allows to differentiate the interpolation types.
Definition: metrics_levelset_process.h:85
Node NodeType
Node definition.
Definition: metrics_levelset_process.h:65
ModelPart::ElementsContainerType ElementsArrayType
Definition: metrics_levelset_process.h:69
~ComputeLevelSetSolMetricProcess() override=default
Destructor.
std::conditional< TDim==2, array_1d< double, 3 >, array_1d< double, 6 > >::type TensorArrayType
The type of array considered for the tensor.
Definition: metrics_levelset_process.h:76
ModelPart::NodesContainerType NodesArrayType
Containers definition.
Definition: metrics_levelset_process.h:68
std::string Info() const override
Turn back information as a string.
Definition: metrics_levelset_process.h:144
void operator()()
Definition: metrics_levelset_process.h:110
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
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.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