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.
assign_point_neumann_conditions.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3 KratosIncompressibleFluidApplication
4 A library based on:
5 Kratos
6 A General Purpose Software for Multi-Physics Finite Element Analysis
7 Version 1.0 (Released on march 05, 2007).
8 
9 Copyright 2007
10 Pooyan Dadvand, Riccardo Rossi
11 pooyan@cimne.upc.edu
12 rrossi@cimne.upc.edu
13 - CIMNE (International Center for Numerical Methods in Engineering),
14 Gran Capita' s/n, 08034 Barcelona, Spain
15 
16 
17 Permission is hereby granted, free of charge, to any person obtaining
18 a copy of this software and associated documentation files (the
19 "Software"), to deal in the Software without restriction, including
20 without limitation the rights to use, copy, modify, merge, publish,
21 distribute, sublicense and/or sell copies of the Software, and to
22 permit persons to whom the Software is furnished to do so, subject to
23 the following condition:
24 
25 Distribution of this code for any commercial purpose is permissible
26 ONLY BY DIRECT ARRANGEMENT WITH THE COPYRIGHT OWNERS.
27 
28 The above copyright notice and this permission notice shall be
29 included in all copies or substantial portions of the Software.
30 
31 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
34 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
35 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
36 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
37 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38 
39 ==============================================================================
40 */
41 
42 //
43 // Project Name: Kratos
44 // Last Modified by: $Author: rrossi $
45 // Date: $Date: 2008-10-13 06:58:23 $
46 // Revision: $Revision: 1.2 $
47 //
48 //
49 
50 
51 #if !defined(ASSIGN_POINT_NEUMANN3D_CONDITION )
52 #define ASSIGN_POINT_NEUMANN3D_CONDITION
53 
54 
55 
56 // System includes
57 #include <string>
58 #include <iostream>
59 #include <algorithm>
60 
61 // External includes
62 
63 
64 // Project includes
65 #include <pybind11/pybind11.h>
66 #include "includes/define.h"
67 #include "includes/define_python.h"
68 
69 #include "includes/model_part.h"
70 #include "includes/node.h"
71 #include "utilities/geometry_utilities.h"
72 //#include "geometries/tetrahedra_3d_4.h"
73 #include "geometries/point.h"
74 #include "ULF_application.h"
77 //#include "custom_conditions/Point_Neumann_Monolithic2D.h"
78 //#include "includes/variables.h"
79 
80 
81 
82 namespace Kratos
83 {
84 
85 
87  {
88  public:
89 
90  //**********************************************************************************************
91  //**********************************************************************************************
92  //
93  //template<unsigned int TDim>
95  {
96  KRATOS_TRY;
97  //KRATOS_WATCH("Inside of AssignPointNeumannConditions UTILITY")
98  const int TDim=ThisModelPart.ElementsBegin()->GetGeometry().WorkingSpaceDimension();
99 
100  Properties::Pointer properties = ThisModelPart.GetMesh().pGetProperties(1);
101  int id = ThisModelPart.Conditions().size();
102  //KRATOS_WATCH(ThisModelPart.Conditions().size())
104  for(ModelPart::NodesContainerType::iterator it = ThisModelPart.NodesBegin();
105  it!=ThisModelPart.NodesEnd(); it++)
106  {
107  if( it->FastGetSolutionStepValue(FLAG_VARIABLE) == 1.0)
108  {
109  temp.reserve(1);
110  temp.push_back(*(it.base()));
111 
112  if constexpr (TDim==3)
113  {
114  Condition::Pointer p_cond = (KratosComponents<Condition>::Get("PointNeumann3D")).Create(id, temp, properties);
115  (ThisModelPart.Conditions()).push_back(p_cond);
116  }
117  else if constexpr (TDim==2)
118  {
119  Condition::Pointer p_cond = (KratosComponents<Condition>::Get("PointNeumann2D")).Create(id, temp, properties);
120  (ThisModelPart.Conditions()).push_back(p_cond);
121 
122  }
123 
124  id++;
125  temp.clear();
126 
127  }
128 
129  }
130 
131  //ThisModelPart.Conditions().Sort();
132 
133 
134  KRATOS_CATCH("")
135  }
136 
138  {
139  KRATOS_TRY;
140  KRATOS_WATCH("Inside of AssignPointNeumannConditions UTILITY")
141  const int TDim=ThisModelPart.ElementsBegin()->GetGeometry().WorkingSpaceDimension();
142 
143  Properties::Pointer properties = ThisModelPart.GetMesh().pGetProperties(1);
144  int id = ThisModelPart.Conditions().size();
145  //KRATOS_WATCH(ThisModelPart.Conditions().size())
147  for(ModelPart::NodesContainerType::iterator it = ThisModelPart.NodesBegin();
148  it!=ThisModelPart.NodesEnd(); it++)
149  {
150 
151  temp.reserve(1);
152  temp.push_back(*(it.base()));
153 
154  if( it->FastGetSolutionStepValue(FLAG_VARIABLE) == 1.0)
155  {
156  Condition::Pointer p_cond = (KratosComponents<Condition>::Get("PointNeumannAxisym")).Create(id, temp, properties);
157  (ThisModelPart.Conditions()).push_back(p_cond);
158 
159 
160  id++;
161  temp.clear();
162 
163  }
164 
165  }
166  //KRATOS_WATCH(ThisModelPart.Conditions().size())
167  //KRATOS_WATCH("BEFORE SORTING")
168  //ThisModelPart.Conditions().Sort();
169  //KRATOS_WATCH(ThisModelPart.Conditions().size())
170 
171 
172  KRATOS_CATCH("")
173 
174  }
175 
176  //THIS ONE IS FOR THE VELOCITY-BASED FORMUALTION
177  /* IT WORKS, BUT IS COMMENTED
178  void AssignPointNeumannConditionsMonolithic2D(ModelPart& ThisModelPart)
179  {
180  KRATOS_TRY;
181  KRATOS_WATCH("INSide of AssignPointNeumannConditions UTILITY Point_Neumann_Monolithic2D")
182  const int TDim=ThisModelPart.ElementsBegin()->GetGeometry().WorkingSpaceDimension();
183 
184  Properties::Pointer properties = ThisModelPart.GetMesh().pGetProperties(1);
185  int id = ThisModelPart.Conditions().size();
186  //const char* ConditionName = "NoSlipCondition2D";
187  KRATOS_WATCH(ThisModelPart.Conditions().size())
188  for(ModelPart::NodesContainerType::iterator it = ThisModelPart.NodesBegin();
189  it!=ThisModelPart.NodesEnd(); it++)
190  {
191  if( it->FastGetSolutionStepValue(FLAG_VARIABLE) == 1.0)
192  {
193  //KRATOS_WATCH(">>>>>>>>>>>>>>>>>>>>> ASSIGNING THE NEUMANN POINT CONDITIONS -> EXTERNAL PRESSURE WILL BE APPLIED <<<<<<<<<<<<<<<<<<<<<");
194  Condition::NodesArrayType temp;
195  temp.reserve(1);
196  temp.push_back(*(it.base()));
197 
198  if constexpr (TDim==3)
199  {
200  KRATOS_ERROR(std::logic_error,"Method not implemented for 3D","");
201  }
202  else if constexpr (TDim==2)
203  {
204  Condition::Pointer p_cond = (KratosComponents<Condition>::Get("PointNeumannMonolithic2D")).Create(id, temp, properties);
205  (ThisModelPart.Conditions()).push_back(p_cond);
206  }
207 
208  id++;
209 
210  }
211 
212  }
213 KRATOS_WATCH(ThisModelPart.Conditions().size())
214  //KRATOS_WATCH("BEFORE SORTING")
215  ThisModelPart.Conditions().Sort();
216 KRATOS_WATCH(ThisModelPart.Conditions().size())
217 
218 
219  KRATOS_CATCH("")
220  }
221 
222  */
223  private:
224 
225 
226  };
227 
228 } // namespace Kratos.
229 
230 #endif // ASSIGN_POINT_NEUMANN3D_CONDITION defined
Definition: assign_point_neumann_conditions.h:87
void AssignPointNeumannConditionsDisp(ModelPart &ThisModelPart)
Definition: assign_point_neumann_conditions.h:94
void AssignPointNeumannConditionsDispAxisym(ModelPart &ThisModelPart)
Definition: assign_point_neumann_conditions.h:137
static const TComponentType & Get(const std::string &rName)
Retrieves a component with the specified name.
Definition: kratos_components.h:114
PropertiesType::Pointer pGetProperties(IndexType PropertiesId)
Definition: mesh.h:394
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
MeshType & GetMesh(IndexType ThisIndex=0)
Definition: model_part.h:1791
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_WATCH(variable)
Definition: define.h:806
#define KRATOS_TRY
Definition: define.h:109
Modeler::Pointer Create(const std::string &ModelerName, Model &rModel, const Parameters ModelParameters)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:30
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
float temp
Definition: rotating_cone.py:85