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.
find_triple_point.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 author: Alex Jarauta
11 // Co-author : Elaf Mahrous
12 
13 #if !defined(FIND_TRIPLE_POINT_CONDITION_INCLUDED )
14 #define FIND_TRIPLE_POINT_CONDITION_INCLUDED
15 
16 
17 
18 // System includes
19 #include <string>
20 #include <iostream>
21 #include <algorithm>
22 
23 // External includes
24 
25 
26 // Project includes
27 #include <pybind11/pybind11.h>
28 #include "includes/define.h"
29 #include "includes/define_python.h"
30 
31 #include "includes/model_part.h"
32 #include "includes/node.h"
33 #include "utilities/math_utils.h"
34 #include "utilities/geometry_utilities.h"
35 #include "processes/process.h"
36 #include "includes/condition.h"
37 #include "includes/element.h"
38 #include "ULF_application.h"
39 //#include "custom_conditions/Surface_Tension2D.h"
40 
41 
42 
43 namespace Kratos
44 {
45 
48 
52 
53 
57 
61 
65 
67 
72  : public Process
73  {
74  public:
75 
78 
81 
85 
88  {
89  }
90 
92  ~FindTriplePoint() override
93  {
94  }
95 
96 
100 
101  // void operator()()
102  // {
103  // MergeParts();
104  // }
105 
106 
110 
111 
112  void FindTriplePoint2D(ModelPart& ThisModelPart)
113  {
114  KRATOS_TRY
115 
116  int is_free = 0;
117  int is_struct = 0;
118  int is_lagin = 0;
119 
120  for(ModelPart::NodesContainerType::iterator im = ThisModelPart.NodesBegin() ; im != ThisModelPart.NodesEnd() ; im++)
121  {
122  if (im->FastGetSolutionStepValue(IS_STRUCTURE) != 0.0)
123  {
124  is_free = 0;
125  is_struct = 0;
126  is_lagin = 0;
127  GlobalPointersVector< Node >& neighb = im->GetValue(NEIGHBOUR_NODES);
128  for (unsigned int i = 0; i < neighb.size(); i++)
129  {
130  if (neighb[i].FastGetSolutionStepValue(IS_BOUNDARY) != 0.0)
131  {
132  if (neighb[i].FastGetSolutionStepValue(IS_FREE_SURFACE) != 0.0)
133  is_free++;
134  if (neighb[i].FastGetSolutionStepValue(IS_STRUCTURE) != 0.0)
135  is_struct++;
136  if (neighb[i].FastGetSolutionStepValue(IS_LAGRANGIAN_INLET) != 0.0)
137  is_lagin++;
138  }
139  }
140  if (is_free == 1 && is_struct == 1)
141  im->FastGetSolutionStepValue(TRIPLE_POINT) = 1.0;
142  }
143  }
144 
145 
146  KRATOS_CATCH("")
147  }
148 
149  void FindTriplePoint3D(ModelPart& ThisModelPart)
150  {
151  KRATOS_TRY
152 
153  unsigned int num_tp = 0;
154  unsigned int num_fs = 0;
156 
157  for(ModelPart::NodesContainerType::iterator im = ThisModelPart.NodesBegin() ; im != ThisModelPart.NodesEnd() ; im++)
158  {
159  num_fs = num_tp = 0;
160 // if ((im->FastGetSolutionStepValue(TRIPLE_POINT) != 0.0) && (im->FastGetSolutionStepValue(CONTACT_ANGLE) == 0.0) && (im->FastGetSolutionStepValue(VELOCITY_X) != 0.0))
161  if ((im->FastGetSolutionStepValue(TRIPLE_POINT) != 0.0) && (im->FastGetSolutionStepValue(CONTACT_ANGLE) < 1e-15) && (im->FastGetSolutionStepValue(VELOCITY_X) != 0.0))
162  im->FastGetSolutionStepValue(TRIPLE_POINT) = 0.0;
163 
164  An = im->FastGetSolutionStepValue(NORMAL);
165  NormalizeVec3D(An);
166  if (im->FastGetSolutionStepValue(TRIPLE_POINT) != 0.0 && An[2] < -0.99)
167  {
168  im->FastGetSolutionStepValue(TRIPLE_POINT) = 0.0;
169  im->FastGetSolutionStepValue(CONTACT_ANGLE) = 0.0;
170  im->FastGetSolutionStepValue(FORCE) = ZeroVector(3);
171  }
172 
173  if (im->FastGetSolutionStepValue(IS_STRUCTURE) != 0.0)
174  {
175  if( An[0] > 0.01 || An[0] < -0.01 || An[1] > 0.01 || An[1] < -0.01)
176  {
177 
178  im->FastGetSolutionStepValue(TRIPLE_POINT) = 1.0;
179  }
180  else
181  im->FastGetSolutionStepValue(TRIPLE_POINT) = 0.0;
182  }
183  }
184 
185  KRATOS_CATCH("")
186  }
187 
188  double Norm3D(const array_1d<double,3>& a)
189  {
190  return sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2]);
191  }
192 
194  {
195  return (a[0]*b[0] + a[1]*b[1] + a[2]*b[2]);
196  }
197 
199  {
200  double norm = Norm3D(input);
201  if (norm != 0.0)
202  {
203  input[0] /= norm;
204  input[1] /= norm;
205  input[2] /= norm;
206  }
207  }
208 
209  private:
210 
211  }; // Class FindTriplePoint
212 
213 
214 } // namespace Kratos.
215 
216 #endif // KRATOS_CREATE_INTERFACE_CONDITIONS_PROCESS_INCLUDED defined
Short class definition.
Definition: find_triple_point.h:73
void NormalizeVec3D(array_1d< double, 3 > &input)
Definition: find_triple_point.h:198
FindTriplePoint()
Default constructor.
Definition: find_triple_point.h:87
void FindTriplePoint3D(ModelPart &ThisModelPart)
Definition: find_triple_point.h:149
void FindTriplePoint2D(ModelPart &ThisModelPart)
Definition: find_triple_point.h:112
double Norm3D(const array_1d< double, 3 > &a)
Definition: find_triple_point.h:188
KRATOS_CLASS_POINTER_DEFINITION(FindTriplePoint)
Pointer definition of PushStructureProcess.
~FindTriplePoint() override
Destructor.
Definition: find_triple_point.h:92
double DotProduct3D(const array_1d< double, 3 > &a, const array_1d< double, 3 > &b)
Definition: find_triple_point.h:193
This class is a vector which stores global pointers.
Definition: global_pointers_vector.h:61
size_type size() const
Definition: global_pointers_vector.h:307
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
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
The base class for all processes in Kratos.
Definition: process.h:49
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
im
Definition: GenerateCN.py:100
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
input
Definition: generate_frictional_mortar_condition.py:435
a
Definition: generate_stokes_twofluid_element.py:77
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
integer i
Definition: TensorModule.f:17
e
Definition: run_cpp_mpi_tests.py:31