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.
distance_calcuation_utility.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: Aditya Ghantasala
11 
12 #if !defined(CHIMERA_DISTANCE_CALCULATION_UTILITY )
13 #define CHIMERA_DISTANCE_CALCULATION_UTILITY
14 
15 
16 
17 // System includes
18 
19 // External includes
20 
21 // Project includes
22 #include "includes/define.h"
27 
28 
29 namespace Kratos
30 {
31 
34 
36 template <int TDim>
38 {
39 public:
42 
45 
49 
52 
56 
57 
61 
62 
66 
72  static inline void CalculateDistance(ModelPart &rBackgroundModelPart, ModelPart &rSkinModelPart)
73  {
74  typedef CalculateDistanceToSkinProcess<TDim> CalculateDistanceToSkinProcessType;
75  const int nnodes = static_cast<int>(rBackgroundModelPart.NumberOfNodes());
76 
77 #pragma omp parallel for
78  for (int i_node = 0; i_node < nnodes; ++i_node)
79  {
80  auto it_node = rBackgroundModelPart.NodesBegin() + i_node;
81  it_node->FastGetSolutionStepValue(DISTANCE, 0) = 0.0;
82  it_node->FastGetSolutionStepValue(DISTANCE, 1) = 0.0;
83  it_node->SetValue(DISTANCE, 0.0);
84  }
85 
86  CalculateDistanceToSkinProcessType(rBackgroundModelPart, rSkinModelPart).Execute();
87 
88  Parameters parallel_redistance_settings(R"({
89  "max_levels" : 100,
90  "max_distance" : 200.0
91  })");
92  auto p_distance_smoother = Kratos::make_shared<ParallelDistanceCalculationProcess<TDim>>(
93  rBackgroundModelPart,
94  parallel_redistance_settings
95  );
96  p_distance_smoother->Execute();
97 
98  VariableUtils().CopyVariable<double>(DISTANCE, CHIMERA_DISTANCE, rBackgroundModelPart.Nodes());
99  }
100 
104 
105 
109 
110 
114 
118 
119 
121 
122 }; // Class ChimeraDistanceCalculationUtility
123 
125 
128 
129 
133 
135 
136 
137 } // namespace Kratos.
138 
139 #endif // DISTANCE_CALCULATION_UTILITY defined
Calculates the nodal distances using elemental discontinuous distances.
Definition: calculate_distance_to_skin_process.h:40
Utility for calculating the Distance on a given modelpart.
Definition: distance_calcuation_utility.h:38
ChimeraDistanceCalculationUtility(const ChimeraDistanceCalculationUtility &rOther)=delete
ChimeraDistanceCalculationUtility()=delete
Default constructor.
KRATOS_CLASS_POINTER_DEFINITION(ChimeraDistanceCalculationUtility)
Pointer definition of ChimeraDistanceCalculationUtility.
static void CalculateDistance(ModelPart &rBackgroundModelPart, ModelPart &rSkinModelPart)
Calculates distance on the whole of rBackgroundModelPart from rSkinModelPart.
Definition: distance_calcuation_utility.h:72
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
SizeType NumberOfNodes(IndexType ThisIndex=0) const
Definition: model_part.h:341
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
This class implements a set of auxiliar, already parallelized, methods to perform some common tasks r...
Definition: variable_utils.h:63
void CopyVariable(const TVariableType &rOriginVariable, const TVariableType &rDestinationVariable, NodesContainerType &rNodesContainer)
Takes the value of an historical variable and sets it in another variable This function takes the val...
Definition: variable_utils.h:1017
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
int nnodes
Definition: sensitivityMatrix.py:24