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.
select_elements_mesher_process.hpp
Go to the documentation of this file.
1 //
2 // Project Name: KratosDelaunayMeshingApplication $
3 // Created by: $Author: JMCarbonell $
4 // Last modified by: $Co-Author: $
5 // Date: $Date: April 2018 $
6 // Revision: $Revision: 0.0 $
7 //
8 //
9 
10 #if !defined( KRATOS_SELECT_ELEMENTS_MESHER_PROCESS_H_INCLUDED )
11 #define KRATOS_SELECT_ELEMENTS_MESHER_PROCESS_H_INCLUDED
12 
13 
14 // External includes
15 
16 // System includes
17 
18 // Project includes
21 
24 
26 //Data:
27 //StepData: NODAL_H, CONTACT_FORCE ,VELOCITY, DISPLACEMENT
28 //Flags: (checked) TO_ERASE, BOUNDARY, RIGID, SOLID, FREE_SURFACE, FLUID
29 // (set)
30 // (modified)
31 // (reset)
32 //(set):=(set in this process)
33 
34 namespace Kratos
35 {
36 
39 
41 
46  : public MesherProcess
47 {
48  public:
51 
54 
58 
62 
65  MesherUtilities::MeshingParameters& rRemeshingParameters,
66  int EchoLevel)
67  : mrModelPart(rModelPart),
68  mrRemesh(rRemeshingParameters)
69  {
71  }
72 
73 
76 
77 
81 
83  void operator()()
84  {
85  Execute();
86  }
87 
88 
92 
93 
95  void Execute() override
96  {
98 
99  if( mEchoLevel > 0 )
100  std::cout<<" [ SELECT MESH ELEMENTS: ("<<mrRemesh.OutMesh.GetNumberOfElements()<<") "<<std::endl;
101 
102  const int& OutNumberOfElements = mrRemesh.OutMesh.GetNumberOfElements();
103  mrRemesh.PreservedElements.clear();
104  mrRemesh.PreservedElements.resize(OutNumberOfElements);
105  std::fill( mrRemesh.PreservedElements.begin(), mrRemesh.PreservedElements.end(), 0 );
107 
108  mrRemesh.Info->NumberOfElements=0;
109 
110  bool box_side_element = false;
111  bool wrong_added_node = false;
112 
113  unsigned int number_of_slivers = 0;
114 
115  unsigned int passed_alpha_shape = 0;
116  unsigned int passed_inner_outer = 0;
117 
118 
119  if(mrRemesh.ExecutionOptions.IsNot(MesherUtilities::SELECT_TESSELLATION_ELEMENTS))
120  {
121  for(int el=0; el<OutNumberOfElements; ++el)
122  {
124  mrRemesh.Info->NumberOfElements+=1;
125  }
126  }
127  else
128  {
129  if( mEchoLevel > 0 )
130  std::cout<<" Start Element Selection "<<OutNumberOfElements<<std::endl;
131 
132  //reassign fluid and rigid flags to eliminate full rigid elements
133  //if( !IsFirstTimeStep() )
135 
136  unsigned int dimension = 0;
137  unsigned int number_of_vertices = 0;
138 
139  this->GetElementDimension(dimension,number_of_vertices);
140 
141  const int* OutElementList = mrRemesh.OutMesh.GetElementList();
142 
144 
145  int el = 0;
146  int number = 0;
147 
148  //void CheckIds(OuterElementsList,OutNumberOfElements,number_of_vertices);
149 
150  //#pragma omp parallel for reduction(+:number) private(el)
151  for(el=0; el<OutNumberOfElements; ++el)
152  {
153  GeometryType Vertices;
154 
155  // std::cout<<" selected vertices ["<<OutElementList[el*number_of_vertices];
156  // for(unsigned int d=1; d<number_of_vertices; ++d)
157  // {
158  // std::cout<<", "<<OutElementList[el*number_of_vertices+d];
159  // }
160  // std::cout<<"] "<<std::endl;
161 
162  wrong_added_node = false;
163  box_side_element = false;
164 
165  NodalFlags VerticesFlags;
166  for(unsigned int pn=0; pn<number_of_vertices; ++pn)
167  {
168  //std::cout<<" pn "<<pn<<" id "<<OutElementList[id]<<" size "<<rNodes.size()<<" IDS "<<mrRemesh.NodalPreIds.size()<<" preid "<<mrRemesh.NodalPreIds[OutElementList[id]]<<std::endl;
169  unsigned int id = el*number_of_vertices+pn;
170 
171  if(OutElementList[id]<=0)
172  std::cout<<" ERROR: something is wrong: nodal id < 0 "<<el<<std::endl;
173 
174  //check if the number of nodes are considered in the nodal pre ids
175  if( (unsigned int)OutElementList[id] >= mrRemesh.NodalPreIds.size() ){
176  if(mrRemesh.Options.Is(MesherUtilities::CONTACT_SEARCH))
177  wrong_added_node = true;
178  std::cout<<" ERROR: something is wrong: node out of bounds "<<std::endl;
179  break;
180  }
181 
182  //check if is a vertex of an artificial external bounding box
183  if(mrRemesh.NodalPreIds[OutElementList[id]]<0){
184  if(mrRemesh.Options.IsNot(MesherUtilities::CONTACT_SEARCH))
185  std::cout<<" ERROR: something is wrong: nodal id < 0 "<<std::endl;
186  box_side_element = true;
187  break;
188  }
189 
190  //get node from model part and set it as vertex
191  Vertices.push_back(rNodes(OutElementList[id]));
192 
193  //vertices flags
194  VerticesFlags.CountFlags(Vertices.back());
195  }
196 
197 
198  if(box_side_element || wrong_added_node){
199  //std::cout<<" Box_Side_Element "<<std::endl;
200  continue;
201  }
202 
203  bool accepted=false;
204 
205  //monitoring bools
206  // bool boundary_accepted = false;
207  // bool alpha_accepted = false;
208  // bool subdomain_accepted = false;
209  // bool center_accepted = false;
210  // bool shape_accepted = false;
211 
212  accepted = this->CheckElementBoundaries(Vertices,VerticesFlags);
213 
214  double Alpha = mrRemesh.AlphaParameter;
215 
216  this->GetAlphaParameter(Alpha,Vertices,VerticesFlags,dimension);
217 
218  //Alpha = 1.5;
219 
220  MesherUtilities MesherUtils;
221 
222  //2.- to control the alpha size
223  if( accepted )
224  {
225  //boundary_accepted = true;
226  if(mrRemesh.Options.Is(MesherUtilities::CONTACT_SEARCH))
227  {
228  accepted=MesherUtils.ShrankAlphaShape(Alpha,Vertices,mrRemesh.OffsetFactor,dimension);
229  }
230  else
231  {
232  if(mrModelPart.Is(FLUID)){
233  accepted=MesherUtils.AlphaShape(Alpha,Vertices,dimension,4.0*mrRemesh.Refine->CriticalRadius);
234  }
235  else{ //SOLID
236  accepted=MesherUtils.AlphaShape(Alpha,Vertices,dimension);
237  }
238  }
239  }
240 
241  //3.- to control all nodes from the same subdomain (problem, domain is not already set for new inserted particles on mesher)
242  bool self_contact = false;
243  if(accepted)
244  {
245  //alpha_accepted = true;
246  ++passed_alpha_shape;
247 
248  if(mrRemesh.Options.Is(MesherUtilities::CONTACT_SEARCH))
249  self_contact = MesherUtils.CheckSubdomain(Vertices);
250  }
251 
252 
253  //4.- to control that the element is inside of the domain boundaries
254  if(accepted)
255  {
256  //subdomain_accepted = true;
257  if(mrRemesh.Options.Is(MesherUtilities::CONTACT_SEARCH))
258  {
259  //problems in 3D: be careful
260  if(self_contact)
261  accepted = MesherUtils.CheckOuterCentre(Vertices,mrRemesh.OffsetFactor, self_contact);
262  }
263  else
264  {
265  //accepted=MesherUtils.CheckInnerCentre(Vertices); //problems in 3D: when slivers are released, a boundary is created and the normals calculated, then elements that are inside suddently its center is calculated as outside... // some corrections are needded.
266  }
267  }
268 
269  //5.- to control that the element has a good shape
270  if(accepted)
271  {
272  //center_accepted = true;
273  ++passed_inner_outer;
274  accepted = this->CheckElementShape(Vertices,VerticesFlags,dimension,number_of_slivers);
275  }
276 
277 
278  // if all checks have been passed, accept the element
279  if(accepted)
280  {
281  //shape_accepted = true;
282  number+=1;
283  mrRemesh.PreservedElements[el] = number;
284  }
285  // else{
286  // std::cout<<" Element ["<<el<<"] with alpha "<<mrRemesh.AlphaParameter<<"("<<Alpha<<")"<<std::endl;
287  // for( unsigned int n=0; n<number_of_vertices; ++n)
288  // {
289  // std::cout<<" ("<<n+1<<"): Id["<<Vertices[n].Id()<<"] PreID["<<mrRemesh.NodalPreIds[Vertices[n].Id()]<<"] "<<Vertices[n].Coordinates()<<std::endl;
290  // }
291  // std::cout<<" (alpha:"<<alpha_accepted<<" subdomain:"<<subdomain_accepted<<" center:"<<center_accepted<<" shape:"<<shape_accepted<<") "<< std::endl;
292 
293  // }
294 
295  }
296 
297  mrRemesh.Info->NumberOfElements=number;
298 
299  }
300 
301  if( mEchoLevel > 0 ){
302  std::cout<<" [Preserved Elements "<<mrRemesh.Info->NumberOfElements<<"] ("<<mrModelPart.NumberOfElements() <<") :: (slivers detected: "<<number_of_slivers<<") "<<std::endl;
303  std::cout<<" (passed_alpha_shape: "<<passed_alpha_shape<<", passed_inner_outer: "<<passed_inner_outer<<") "<<std::endl;
304  }
305 
306  if( mrModelPart.IsNot(CONTACT) )
307  this->SelectNodesToErase();
308 
309  // AF for fluids ???
310  // mrRemesh.InputInitializedFlag = false;
311  // mMesherUtilities.SetNodes(mrModelPart,mrRemesh);
312  // mrRemesh.InputInitializedFlag = true;
313 
314 
315  if( mEchoLevel > 0 ){
316  // std::cout<<" Generated_Elements :"<<OutNumberOfElements<<std::endl;
317  // std::cout<<" Passed_AlphaShape :"<<mrRemesh.Info->NumberOfElements<<std::endl;
318  // if(OutNumberOfElements-mrRemesh.Info->NumberOfElements!=0)
319  // std::cout<<" DELETED ELEMENTS "<<std::endl;
320  std::cout<<" SELECT MESH ELEMENTS ("<<mrRemesh.Info->NumberOfElements<<") ]; "<<std::endl;
321 
322  }
323 
324  KRATOS_CATCH( "" )
325 
326  }
327 
328 
332 
333 
337 
338 
342 
344  std::string Info() const override
345  {
346  return "SelectElementsMesherProcess";
347  }
348 
350  void PrintInfo(std::ostream& rOStream) const override
351  {
352  rOStream << "SelectElementsMesherProcess";
353  }
354 
356  void PrintData(std::ostream& rOStream) const override
357  {
358  }
359 
360 
364 
366 
367  protected:
368 
374 
376 
378 
380 
382 
383  struct NodalFlags{
384 
385  unsigned int Solid;
386  unsigned int Fluid;
387  unsigned int Rigid;
388  unsigned int Boundary;
389  unsigned int FreeSurface;
390  unsigned int NoWallFreeSurface;
391  unsigned int Contact;
392  unsigned int Inlet;
393  unsigned int Isolated;
394  unsigned int Sliver;
395  unsigned int NewEntity;
396  unsigned int OldEntity;
397  unsigned int Slave;
398 
399  double Radius;
400 
401  //constructor
403  {
404  Solid = 0;
405  Fluid = 0;
406  Rigid = 0;
407  Boundary = 0;
408  FreeSurface = 0;
409  NoWallFreeSurface = 0;
410  Contact = 0;
411  Inlet = 0;
412  Isolated = 0;
413  Sliver = 0;
414  NewEntity = 0;
415  OldEntity = 0;
416  Radius = 0;
417  Slave = 0;
418  }
419 
420  //counter method
421  void CountFlags(const Node& rNode)
422  {
423  if(rNode.Is(SOLID))
424  ++Solid;
425  if(rNode.Is(FLUID))
426  ++Fluid;
427  if(rNode.Is(RIGID))
428  ++Rigid;
429  if(rNode.Is(BOUNDARY))
430  ++Boundary;
431  if(rNode.Is(CONTACT))
432  ++Contact;
433  if(rNode.Is(INLET))
434  ++Inlet;
435  if(rNode.Is(ISOLATED))
436  ++Isolated;
437  if(rNode.Is(FREE_SURFACE)){
438  ++FreeSurface;
439  if(rNode.IsNot(SOLID) && rNode.IsNot(RIGID))
441  }
442  if(rNode.Is(SELECTED))
443  ++Sliver;
444  if(rNode.Is(NEW_ENTITY))
445  ++NewEntity;
446  if(rNode.Is(OLD_ENTITY))
447  ++OldEntity;
448  if(rNode.Is(SLAVE))
449  ++Slave;
450 
451  Radius+=rNode.FastGetSolutionStepValue(NODAL_H);
452  }
453 
454  };
455 
462 
463  //*******************************************************************************************
464  //*******************************************************************************************
465 
467  {
468  const ProcessInfo& rCurrentProcessInfo = mrModelPart.GetProcessInfo();
469  const double& CurrentTime = rCurrentProcessInfo[TIME];
470  const double& TimeStep = rCurrentProcessInfo[DELTA_TIME];
471  if(CurrentTime<=TimeStep)
472  return true;
473  else
474  return false;
475  }
476 
477  //*******************************************************************************************
478  //*******************************************************************************************
479 
480  void LabelEdgeNodes(ModelPart& rModelPart)
481  {
482 
483  //reset domain flags in nodes before new assignment
484  if( rModelPart.Is(FLUID) ){
485  //reset domain flags in nodes before new assignment
486  unsigned int count_rigid;
487  for(ModelPart::ElementsContainerType::iterator i_elem = rModelPart.ElementsBegin() ; i_elem != rModelPart.ElementsEnd() ; ++i_elem)
488  {
489  GeometryType::PointsArrayType& vertices=i_elem->GetGeometry().Points();
490 
491  count_rigid = 0;
492  for(unsigned int i=0; i<vertices.size(); ++i)
493  {
494  if( vertices[i].Is(RIGID) )
495  ++count_rigid;
496  }
497 
498  //to release full rigid elements with no fluid surrounding them
499  if( count_rigid == vertices.size() ){
500 
501  for(unsigned int i=0; i<vertices.size(); ++i)
502  {
503  vertices[i].Set(OLD_ENTITY,true);
504  }
505  }
506  }
507 
508 
509  //set new element and domain flags to nodes
510  for(ModelPart::ElementsContainerType::iterator i_elem = rModelPart.ElementsBegin() ; i_elem != rModelPart.ElementsEnd() ; ++i_elem)
511  {
512  GeometryType::PointsArrayType& vertices=i_elem->GetGeometry().Points();
513  count_rigid = 0;
514  for(unsigned int i=0; i<vertices.size(); ++i)
515  {
516  if( vertices[i].Is(RIGID) )
517  ++count_rigid;
518  }
519 
520  //to release full rigid elements with no fluid surrounding them
521  if( count_rigid != vertices.size() ){
522 
523  for(unsigned int i=0; i<vertices.size(); ++i)
524  {
525  //set domain type to nodes
526  vertices[i].Set(OLD_ENTITY,false);
527  }
528 
529  }
530  }
531  }
532 
533 
534  }
535 
536  //*******************************************************************************************
537  //*******************************************************************************************
538 
540  {
541 
542  // Set disconnected nodes to erase
543  unsigned int dimension = 0;
544  unsigned int number_of_vertices = 0;
545  unsigned int isolated_nodes = 0;
546 
547  this->GetElementDimension(dimension,number_of_vertices);
548 
549  int* OutElementList = mrRemesh.OutMesh.GetElementList();
550 
552 
553  const int& OutNumberOfElements = mrRemesh.OutMesh.GetNumberOfElements();
554 
555  //check engaged nodes
556  for(int el=0; el<OutNumberOfElements; ++el)
557  {
559  for(unsigned int pn=0; pn<number_of_vertices; ++pn)
560  {
561  //set vertices
562  rNodes[OutElementList[el*number_of_vertices+pn]].Set(BLOCKED);
563  }
564  }
565 
566  }
567 
568  int count_release = 0;
569  for(ModelPart::NodesContainerType::iterator i_node = rNodes.begin() ; i_node != rNodes.end() ; ++i_node)
570  {
571  if( i_node->IsNot(BLOCKED) ){
572 
573  if(mrModelPart.Is(FLUID)){
574 
575  if( i_node->Is(RIGID) || i_node->Is(SOLID) || i_node->Is(INLET) ){
576  if( i_node->Is(TO_ERASE) ){
577  i_node->Set(TO_ERASE,false);
578  std::cout<<" WARNING TRYING TO DELETE A WALL NODE (fluid): "<<i_node->Id()<<std::endl;
579  }
580  }
581  else{
582 
583  if(mrRemesh.ExecutionOptions.Is(MesherUtilities::KEEP_ISOLATED_NODES)){
584 
585  if( i_node->IsNot(TO_ERASE) ){
586  i_node->Set(ISOLATED,true);
587  ++isolated_nodes;
588  }
589  // else{
590  // std::cout<<" ISOLATED TO ERASE "<<std::endl;
591  // }
592 
593  }
594  else{
595 
596  //std::cout<<" ISOLATED NODES NOT KEPT "<<std::endl;
597  i_node->Set(TO_ERASE,true);
598  if( mEchoLevel > 0 )
599  std::cout<<" NODE "<<i_node->Id()<<" IS INSIDE RELEASE "<<std::endl;
600  if( i_node->Is(BOUNDARY) )
601  std::cout<<" NODE "<<i_node->Id()<<" IS BOUNDARY RELEASE "<<std::endl;
602  ++count_release;
603 
604  }
605 
606  }
607 
608  }
609  else{
610 
611  if( i_node->Is(RIGID) || i_node->Is(INLET) ){
612 
613  if( i_node->Is(TO_ERASE) ){
614  i_node->Set(TO_ERASE,false);
615  std::cout<<" WARNING TRYING TO DELETE A WALL NODE (solid): "<<i_node->Id()<<std::endl;
616  }
617 
618  }
619  else{
620 
621  if(mrRemesh.ExecutionOptions.Is(MesherUtilities::KEEP_ISOLATED_NODES)){
622 
623  if( i_node->IsNot(TO_ERASE) ){
624  i_node->Set(ISOLATED,true);
625  ++isolated_nodes;
626  }
627 
628  }
629  else{
630 
631  i_node->Set(TO_ERASE);
632  if( mEchoLevel > 0 )
633  std::cout<<" NODE "<<i_node->Id()<<" IS INSIDE RELEASE "<<std::endl;
634  if( i_node->Is(BOUNDARY) )
635  std::cout<<" NODE "<<i_node->Id()<<" IS BOUNDARY RELEASE "<<std::endl;
636  ++count_release;
637  }
638  }
639  }
640 
641  }
642  else{
643 
644  i_node->Set(TO_ERASE,false);
645  i_node->Set(ISOLATED,false);
646 
647  }
648 
649  i_node->Set(BLOCKED,false);
650  i_node->Set(OLD_ENTITY,false);
651  if(i_node->Is(VISITED))
652  i_node->Set(SELECTED,true);
653  else
654  i_node->Set(SELECTED,false);
655  i_node->Set(VISITED,false);
656 
657  }
658 
659  if( mEchoLevel > 0 ){
660  std::cout<<" NUMBER OF RELEASED NODES "<<count_release<<std::endl;
661  std::cout<<" NUMBER OF ISOLATED NODES "<<isolated_nodes<<std::endl;
662  }
663  }
664 
665  //*******************************************************************************************
666  //*******************************************************************************************
667 
668  void CheckIds(const int* OutElementList, const int& OutNumberOfElements, const unsigned int number_of_vertices)
669  {
670 
671  unsigned int max_out_id = 0;
672  for(int el=0; el<OutNumberOfElements; ++el)
673  {
674  for(unsigned int pn=0; pn<number_of_vertices; ++pn)
675  {
676  unsigned int id = el*number_of_vertices+pn;
677  if( int(max_out_id) < OutElementList[id] )
678  max_out_id = OutElementList[id];
679  }
680  }
681 
682  if( max_out_id >= mrRemesh.NodalPreIds.size() )
683  std::cout<<" ERROR ID PRE IDS "<<max_out_id<<" > "<<mrRemesh.NodalPreIds.size()<<" (nodes size:"<<mrModelPart.Nodes().size()<<")"<<std::endl;
684 
685  }
686 
687  //*******************************************************************************************
688  //*******************************************************************************************
689 
690  void GetElementDimension(unsigned int& dimension, unsigned int& number_of_vertices)
691  {
693  ModelPart::ElementsContainerType::iterator element_begin = mrModelPart.ElementsBegin();
694  dimension = element_begin->GetGeometry().WorkingSpaceDimension();
695  number_of_vertices = element_begin->GetGeometry().size();
696  }
697  else if ( mrModelPart.NumberOfConditions() ){
698  ModelPart::ConditionsContainerType::iterator condition_begin = mrModelPart.ConditionsBegin();
699  dimension = condition_begin->GetGeometry().WorkingSpaceDimension();
700  if( dimension == 3 ) //number of nodes of a tetrahedron
701  number_of_vertices = 4;
702  else if( dimension == 2 ) //number of nodes of a triangle
703  number_of_vertices = 3;
704  }
705 
706  }
707 
708  //*******************************************************************************************
709  //*******************************************************************************************
710 
711  //it can set TO_ERASE to new entities inserted in full rigid elements
712  bool CheckElementBoundaries(GeometryType& rVertices,const NodalFlags& rVerticesFlags)
713  {
714  bool accepted = true;
715  unsigned int NumberOfVertices = rVertices.size();
716 
717  if ( mrModelPart.Is(FLUID) ){
718 
719  //check outer normal
720  MesherUtilities MesherUtils;
721  if( rVerticesFlags.Rigid >= NumberOfVertices-1 )
722  accepted = !MesherUtils.CheckRigidOuterCentre(rVertices);
723 
724  if( accepted ){
725 
726  //do not accept full rigid elements (no fluid)
727  if( rVerticesFlags.Rigid == NumberOfVertices && rVerticesFlags.Fluid>0){
728  //accept when it has more than two fluid nodes (2D) and more than 3 fluid nodes (3D)
729  if( rVerticesFlags.Fluid < NumberOfVertices-1 ){
730  //std::cout<<" RIGID EDGE DISCARDED (free_surface: "<<rVerticesFlags.FreeSurface<<" fluid: "<<rVerticesFlags.Fluid<<" rigid: "<<rVerticesFlags.Rigid<<")"<<std::endl;
731  accepted=false;
732  }
733  else if( rVerticesFlags.Fluid == NumberOfVertices && rVerticesFlags.OldEntity >= 2 ){
734  //std::cout<<" OLD RIGID EDGE DISCARDED (old_entity: "<<rVerticesFlags.OldEntity<<" fluid: "<<rVerticesFlags.Fluid<<" rigid: "<<rVerticesFlags.Rigid<<")"<<std::endl;
735  accepted=false;
736  }
737  // rigid bodies slave boundaries
738  // else if( rVerticesFlags.Fluid >= NumberOfVertices-1 && rVerticesFlags.Slave >= 1){
739  // accepted=false;
740  // }
741  }
742 
743  //do not accept full rigid elements with a new inserted node (no fluid)
744  if( (rVerticesFlags.Rigid + rVerticesFlags.NewEntity) == NumberOfVertices && rVerticesFlags.Fluid>0){
745  if( rVerticesFlags.Fluid == NumberOfVertices && rVerticesFlags.OldEntity >= NumberOfVertices-1 ){
746  std::cout<<" OLD RIGID NEW ENTITY EDGE DISCARDED (old_entity: "<<rVerticesFlags.OldEntity<<" fluid: "<<rVerticesFlags.Fluid<<" rigid: "<<rVerticesFlags.Rigid<<" free_surface: "<<rVerticesFlags.FreeSurface<<")"<<std::endl;
747  accepted=false;
748  }
749  }
750 
751  //do not accept full rigid-solid elements (no fluid)
752  if( (rVerticesFlags.Solid + rVerticesFlags.Rigid) >= NumberOfVertices && rVerticesFlags.Fluid == 0)
753  accepted=false;
754 
755  //do not accept full solid elements
756  if( rVerticesFlags.Solid == NumberOfVertices )
757  accepted=false;
758  }
759  }
760 
761  return accepted;
762  }
763 
764  //*******************************************************************************************
765  //*******************************************************************************************
766 
767  void GetAlphaParameter(double &rAlpha,GeometryType& rVertices,const NodalFlags& rVerticesFlags,const unsigned int& rDimension)
768  {
769  unsigned int NumberOfVertices = rVertices.size();
770 
771  rAlpha = mrRemesh.AlphaParameter;
772 
773  if( mrModelPart.Is(SOLID) ){
774 
775  if( rVerticesFlags.Boundary >= NumberOfVertices )
776  rAlpha*=1.2;
777 
778  }
779  else if( mrModelPart.Is(FLUID) ){
780 
781  MesherUtilities MesherUtils;
782 
783  //avoid penetrating/scaping isolated nodes at large speeds and full free surface fluid nodes at large speeds
784  if( (rVerticesFlags.Isolated+rVerticesFlags.FreeSurface) == NumberOfVertices && (rVerticesFlags.Isolated > 0 || rVerticesFlags.NoWallFreeSurface == NumberOfVertices || (rVerticesFlags.NoWallFreeSurface+rVerticesFlags.Isolated)== NumberOfVertices) ){
785  const double MaxRelativeVelocity = 1.5; //arbitrary value, will depend on time step (AF)
786  if( MesherUtils.CheckRelativeVelocities(rVertices, MaxRelativeVelocity) ){
787  rAlpha=0;
788  //set isolated nodes to erase if they approach to fast
789  for(unsigned int i=0; i<rVertices.size(); ++i)
790  {
791  if( rVertices[i].Is(ISOLATED) )
792  rVertices[i].Set(TO_ERASE);
793  }
794  }
795  }
796 
797  if(rDimension==2){
798  this->GetTriangleFluidElementAlpha(rAlpha,rVertices,rVerticesFlags,rDimension);
799  }
800  else if(rDimension==3){
801  this->GetTetrahedronFluidElementAlpha(rAlpha,rVertices,rVerticesFlags,rDimension);
802  }
803  }
804 
805  }
806 
807  //*******************************************************************************************
808  //*******************************************************************************************
809 
810  void GetTriangleFluidElementAlpha(double &rAlpha,GeometryType& rVertices,const NodalFlags& rVerticesFlags,const unsigned int& rDimension)
811  {
812 
813  MesherUtilities MesherUtils;
814 
815  double VolumeChange = 0;
816  double VolumeTolerance = 1.15e-4*pow(4.0*mrRemesh.Refine->CriticalRadius,rDimension);
817  unsigned int NumberOfVertices = rVertices.size();
818 
819  //criterion for elements formed with new wall nodes
820  if( rVerticesFlags.Fluid != NumberOfVertices ){
821 
822  //there are not fluid nodes
823  if( rVerticesFlags.Fluid == 0 ){
824  rAlpha = 0;
825  }
826  else{
827 
828  //if the element is decreasing its volume:
829  VolumeChange = 0;
830  if(MesherUtils.CheckVolumeDecrease(rVertices,rDimension,VolumeTolerance,VolumeChange)){
831 
832  //accept new elements formed with isolated nodes (here speedy test passed)
833  if( rVerticesFlags.Isolated > 0 ){
834  rAlpha*=0.80;
835  }
836  //one wall vertex
837  else if( rVerticesFlags.Rigid == 1 || rVerticesFlags.Solid == 1 ){
838  //to avoid new approaching wall elements with two non-wall free-surface nodes
839  if( rVerticesFlags.NoWallFreeSurface == 2 )
840  rAlpha*=0.60;
841  else
842  rAlpha*=0.80;
843  }
844  //two wall vertices
845  else if( rVerticesFlags.Rigid == 2 || rVerticesFlags.Solid == 2 || (rVerticesFlags.Rigid+rVerticesFlags.Solid)==2 ){
846  //to avoid new approaching wall elements with only one non-wall free-surface node
847  if( rVerticesFlags.NoWallFreeSurface == 1 ){
848  rAlpha*=0.60;
849  }
850  else{
851  rAlpha*=0.80;
852  }
853  }
854  //there are no wall vertices (impossible)
855  else{
856  rAlpha*=0.80;
857  //std::cout<<" WARNING: new element with non-fluid particles and non wall-particles (rigid: "<<rVerticesFlags.Rigid<<" solid: "<<rVerticesFlags.Solid<<" fluid: "<<rVerticesFlags.Fluid<<" free-surface: "<<rVerticesFlags.FreeSurface<<")"<<std::endl;
858  }
859 
860  }
861  //if the element is not decreasing its volume:
862  else{
863 
864  //if the element does not change the volume (all rigid or moving tangentially to the wall)
865  if( VolumeChange > 0 && VolumeChange < VolumeTolerance ){
866  rAlpha*=0.95;
867  //std::cout<<" CONSIDERING VOLUME CHANGE "<<VolumeChange<<std::endl;
868  }
869  else{
870  rAlpha=0;
871  }
872  }
873  }
874  }
875  //all nodes are fluid (pre-existing elements) or new elements formed in the free-surface
876  else{ //fluid element
877 
878  //all nodes in the free-surface
879  if( rVerticesFlags.FreeSurface == 3 ){
880 
881  //all nodes in the non-wall free-surface
882  if( rVerticesFlags.NoWallFreeSurface == 3 ){
883 
884  //if the element is decreasing its volume:
885  VolumeChange = 0;
886  //to avoid closing fluid voids with new elements
887  if(MesherUtils.CheckVolumeDecrease(rVertices,rDimension,VolumeTolerance,VolumeChange)){
888  //to avoid too avoid approaching free surfaces at very high speeds
889  const double MaxRelativeVelocity = 1.5;
890  if(MesherUtils.CheckRelativeVelocities(rVertices, MaxRelativeVelocity))
891  rAlpha=0;
892  else
893  rAlpha*=0.80;
894  }
895  //to avoid increasing fluid surface with new elements
896  else{
897  rAlpha*=0.60;
898  }
899  }
900  //two nodes in non-wall free-surface
901  else if( rVerticesFlags.NoWallFreeSurface == 2 ){
902  rAlpha*=0.80;
903  }
904  //one node in non-wall free-surface
905  else if( rVerticesFlags.NoWallFreeSurface == 1 ){
906  rAlpha*=0.80;
907  }
908  //one node in non-wall free-surface
909  else{
910  rAlpha*=1.20;
911  }
912  }
913  //two nodes in the free-surface
914  else if( rVerticesFlags.FreeSurface == 2 ){
915 
916  //to avoid closing fluid voids with new elements with a wall fluid node
917  if( rVerticesFlags.NoWallFreeSurface == 2 && (rVerticesFlags.Rigid == 1 || rVerticesFlags.Solid == 1) )
918  rAlpha*=0.80;
919  else
920  rAlpha*=1.20;
921 
922  }
923  else{
924  rAlpha*=1.20;
925  }
926  }
927 
928  }
929 
930 
931  //*******************************************************************************************
932  //*******************************************************************************************
933 
934  void GetTetrahedronFluidElementAlpha(double &rAlpha,GeometryType& rVertices,const NodalFlags& rVerticesFlags,const unsigned int& rDimension)
935  {
936  MesherUtilities MesherUtils;
937 
938  double VolumeChange = 0;
939  double VolumeTolerance = 2.5e-3*pow(4.0*mrRemesh.Refine->CriticalRadius,rDimension);
940  unsigned int NumberOfVertices = rVertices.size();
941 
942  //criterion for elements formed with new wall nodes
943  if( rVerticesFlags.Fluid != NumberOfVertices ){ //element formed with a wall
944 
945  //there are not fluid nodes
946  if( rVerticesFlags.Fluid == 0 ){
947  rAlpha = 0;
948  }
949  else{
950 
951  //if the element is decreasing its volume:
952  VolumeChange = 0;
953  if(MesherUtils.CheckVolumeDecrease(rVertices,rDimension,VolumeTolerance,VolumeChange)){
954 
955  //accept new elements formed with isolated nodes (here speedy test passed)
956  if( rVerticesFlags.Isolated > 0 ){
957  rAlpha*=0.8;
958  }
959  //one wall vertex
960  else if( (rVerticesFlags.Rigid == 1 || rVerticesFlags.Solid == 1) ){
961  //to avoid new approaching wall elements with three non-wall free-surface nodes
962  if( rVerticesFlags.NoWallFreeSurface == 3 )
963  rAlpha *= 0.60;
964  else
965  rAlpha *= 0.70;
966  }
967  //two wall vertices
968  else if( rVerticesFlags.Rigid == 2 || rVerticesFlags.Solid == 2 || (rVerticesFlags.Rigid+rVerticesFlags.Solid)==2 ){
969  //to avoid new approaching wall elements with two non-wall free-surface nodes
970  if( rVerticesFlags.NoWallFreeSurface == 2 )
971  rAlpha *= 0.50;
972  else
973  rAlpha *= 0.80;
974  }
975  //three wall vertices
976  else if( rVerticesFlags.Rigid == 3 || rVerticesFlags.Solid == 3 || (rVerticesFlags.Rigid+rVerticesFlags.Solid)==3 ){
977  //to avoid new approaching wall elements with only one non-wall free-surface node
978  if( rVerticesFlags.NoWallFreeSurface == 1 ){
979  if( rVerticesFlags.Fluid == 1 )
980  rAlpha *= 0.40;
981  else
982  rAlpha *= 0.60;
983  }
984  else{
985  rAlpha *= 0.80;
986  }
987  }
988  //there are no wall vertices (maybe impossible)
989  else{
990  rAlpha*=0.80;
991  //std::cout<<" WARNING: new element with non-fluid particles and non wall-particles (rigid: "<<rVerticesFlags.Rigid<<" solid: "<<rVerticesFlags.Solid<<" fluid: "<<rVerticesFlags.Fluid<<" free-surface: "<<rVerticesFlags.FreeSurface<<" new_entity: "<<rVerticesFlags.NewEntity<<" isolated: "<<rVerticesFlags.Isolated<<" old_entity: "<<rVerticesFlags.OldEntity<<")"<<std::endl;
992  }
993 
994  }
995  //if the element is not decreasing its volume:
996  else{
997 
998  //if the element does not change the volume (all rigid or moving tangentially to the wall)
999  if( VolumeChange > 0 && VolumeChange < VolumeTolerance && rVerticesFlags.Rigid == NumberOfVertices ){
1000  rAlpha*=0.80;
1001  }
1002  else{
1003  //if( !(VolumeChange == 0 && MesherUtils.CheckInnerCentre(rVertices)) ){//no moving elements VolumeChange == 0 are accepted if previously inside
1004  rAlpha=0;
1005  //}
1006  }
1007 
1008  }
1009  }
1010 
1011  //in 3D alpha must be larger
1012  rAlpha*=1.10;
1013 
1014  }
1015  //all nodes are fluid (pre-existing elements) or new elements formed inside or in the free-surface
1016  else{ //fluid element
1017 
1018  //all nodes in the free-surface
1019  if( rVerticesFlags.FreeSurface == 4 && rVerticesFlags.Sliver == 0 ){
1020 
1021  //all nodes in the non-wall free-surface (free surface flat element can be artificial)
1022  if( rVerticesFlags.NoWallFreeSurface == 4){
1023 
1024  //if the element is decreasing its volume:
1025  VolumeChange = 0;
1026  //to avoid closing fluid voids with new elements
1027  if(MesherUtils.CheckVolumeDecrease(rVertices,rDimension,VolumeTolerance,VolumeChange))
1028  rAlpha*=0.70;
1029  //to avoid increasing fluid surface with new elements
1030  else
1031  rAlpha*=0.40;
1032 
1033  }
1034  //three nodes in non-wall free-surface
1035  else if( rVerticesFlags.NoWallFreeSurface == 3 ){
1036  if(MesherUtils.CheckVolumeDecrease(rVertices,rDimension,VolumeTolerance,VolumeChange))
1037  rAlpha*=0.70;
1038  else
1039  rAlpha*=0.50;
1040  }
1041  //two nodes in non-wall free-surface
1042  else if( rVerticesFlags.NoWallFreeSurface == 2 ){
1043  if(MesherUtils.CheckVolumeDecrease(rVertices,rDimension,VolumeTolerance,VolumeChange))
1044  rAlpha*=0.70;
1045  else
1046  rAlpha*=0.50;
1047  }
1048  //one node in non-wall free-surface
1049  else{
1050  rAlpha*=0.80;
1051  }
1052  }
1053  else{
1054 
1055  if( rVerticesFlags.FreeSurface > 0 && rVerticesFlags.Rigid > 0 ){
1056  if( MesherUtils.CheckVolumeDecrease(rVertices,rDimension,VolumeTolerance,VolumeChange) )
1057  rAlpha*=1.50;
1058  else
1059  rAlpha*=1.10;
1060  }
1061  else if(rVerticesFlags.FreeSurface == 0 && rVerticesFlags.Rigid == 3 ){
1062  rAlpha*=2.0; //accept large elements
1063  }
1064  else{
1065  rAlpha*=1.70;
1066  }
1067  }
1068 
1069  //in 3D alpha must be larger
1070  rAlpha*=1.10;
1071 
1072  }
1073 
1074  }
1075 
1076  //*******************************************************************************************
1077  //*******************************************************************************************
1078 
1079  bool CheckElementShape(GeometryType& rVertices, const NodalFlags& rVerticesFlags,const unsigned int& rDimension, unsigned int& number_of_slivers)
1080  {
1081  bool accepted = true;
1082  unsigned int NumberOfVertices = rVertices.size();
1083 
1084  if( mrModelPart.Is(SOLID) ){
1085 
1086  int sliver = 0;
1087  if(rDimension == 3 && NumberOfVertices==4){
1088 
1089  Tetrahedra3D4<Node > Tetrahedron(rVertices);
1090 
1091  MesherUtilities MesherUtils;
1092  accepted = MesherUtils.CheckGeometryShape(Tetrahedron,sliver);
1093 
1094  if( sliver ){
1095  if(mrRemesh.Options.Is(MesherUtilities::CONTACT_SEARCH))
1096  accepted = true;
1097  else
1098  accepted = false;
1099 
1100  ++number_of_slivers;
1101  }
1102  else{
1103 
1104  if(mrRemesh.Options.Is(MesherUtilities::CONTACT_SEARCH))
1105  accepted = false;
1106  else
1107  accepted = true;
1108  }
1109 
1110  }
1111 
1112  }
1113  else if ( mrModelPart.Is(FLUID) ){
1114 
1115  if(rDimension == 2 && NumberOfVertices==3){
1116 
1117  //check 2D distorted elements with edges decreasing very fast
1118  if( rVerticesFlags.NoWallFreeSurface > 1 && (rVerticesFlags.Rigid+rVerticesFlags.Solid)==0 ){
1119 
1120  double MaxEdgeLength = std::numeric_limits<double>::min();
1121  double MinEdgeLength = std::numeric_limits<double>::max();
1122 
1123  for(unsigned int i=0; i<NumberOfVertices-1; ++i)
1124  {
1125  for(unsigned int j=i+1; j<NumberOfVertices; ++j)
1126  {
1127  double Length = norm_2(rVertices[j].Coordinates() - rVertices[i].Coordinates());
1128  if( Length < MinEdgeLength ){
1129  MinEdgeLength = Length;
1130  }
1131  if( Length > MaxEdgeLength ){
1132  MaxEdgeLength = Length;
1133  }
1134 
1135  }
1136  }
1137  MesherUtilities MesherUtils;
1138  const double MaxRelativeVelocity = 1.5; //arbitrary value, will depend on time step (AF)
1139  if( MinEdgeLength*5 < MaxEdgeLength ){
1140  if( MesherUtils.CheckRelativeVelocities(rVertices, MaxRelativeVelocity) ){
1141  std::cout<<" WARNING 2D sliver "<<std::endl;
1142  //commented to no erase but labeled to not calculate them
1143  //accepted = false;
1144  //only erase full free surface sliver elements (visualization purposes)
1145  if( rVerticesFlags.FreeSurface == NumberOfVertices)
1146  accepted = false;
1147  ++number_of_slivers;
1148  for(unsigned int i=0; i<NumberOfVertices; ++i)
1149  {
1150  if( rVertices[i].Is(VISITED) )
1151  std::cout<<" WARNING Second sliver in the same node bis "<<std::endl;
1152  rVertices[i].Set(VISITED);
1153  }
1154  }
1155  }
1156  }
1157 
1158  }
1159  else if(rDimension == 3 && NumberOfVertices==4){
1160 
1161  if( rVerticesFlags.FreeSurface >=2 || (rVerticesFlags.Boundary == 4 && rVerticesFlags.NoWallFreeSurface !=4) ){
1162 
1163  Tetrahedra3D4<Node > Tetrahedron(rVertices);
1164  double Volume = Tetrahedron.Volume();
1165 
1166  if( Volume < 0.01*pow(4.0*mrRemesh.Refine->CriticalRadius,rDimension) ){
1167  //KRATOS_INFO("SLIVER")<<" Volume="<<Volume<<" VS Critical Volume="<<0.01*pow(4.0*mrRemesh.Refine->CriticalRadius,rDimension)<<std::endl;
1168  //std::cout<<" SLIVER Volume="<<Volume<<" VS Critical Volume="<< 0.01*pow(4.0*mrRemesh.Refine->CriticalRadius,rDimension) <<std::endl;
1169 
1170  //commented to no erase but labeled to not calculate them
1171  //accepted = false;
1172  //only erase full free surface sliver elements (visualization purposes)
1173  if( rVerticesFlags.FreeSurface == NumberOfVertices)
1174  accepted = false;
1175 
1176  ++number_of_slivers;
1177 
1178  for(unsigned int i=0; i<NumberOfVertices; ++i)
1179  {
1180  // if( rVertices[i].Is(VISITED) )
1181  // std::cout<<" WARNING Second sliver in the same node "<<std::endl;
1182  rVertices[i].Set(VISITED);
1183  }
1184 
1185  }
1186  // else if( Volume < 0.02*pow(4.0*mrRemesh.Refine->CriticalRadius,rDimension) ){
1187  // int sliver = 0;
1188  // MesherUtilities MesherUtils;
1189  // bool distorted = MesherUtils.CheckGeometryShape(Tetrahedron,sliver);
1190 
1191  // //std::cout << " SLIVER " << sliver <<" DISTORTED "<< distorted << std::endl;
1192 
1193  // if( sliver ){
1194  // std::cout<<" SLIVER SHAPE Volume="<<Volume<<" VS Critical Volume="<< 0.02*pow(4.0*mrRemesh.Refine->CriticalRadius,rDimension) <<std::endl;
1195  // accepted = false;
1196  // ++number_of_slivers;
1197 
1198  // for(unsigned int i=0; i<rVertices.size(); ++i)
1199  // {
1200  // rVertices[i].Set(VISITED);
1201  // }
1202 
1203  // }
1204 
1205  // }
1206  }
1207  else if( ( rVerticesFlags.Rigid == 1 || rVerticesFlags.Rigid == 2 ) ){
1208 
1209  MesherUtilities MesherUtils;
1210 
1211  double VolumeIncrement = MesherUtils.GetDeformationGradientDeterminant(rVertices,rDimension);
1212 
1213  double MovedVolume = MesherUtils.GetMovedVolume(rVertices,rDimension,1.0);
1214 
1215  //check if the element is going to invert
1216  if( VolumeIncrement < 0.0 || MovedVolume < 0.0 ){
1217 
1218  //std::cout<<" SLIVER FOR INVERSION "<<VolumeIncrement<<" VS Critical Volume="<< 0.01*pow(4.0*mrRemesh.Refine->CriticalRadius,rDimension) <<"( rigid: "<<rVerticesFlags.Rigid<<" )"<<std::endl;
1219 
1220  //commented to no erase but labeled to not calculate them
1221  //accepted = false;
1222 
1223  ++number_of_slivers;
1224 
1225  for(unsigned int i=0; i<NumberOfVertices; ++i)
1226  {
1227  // if( rVertices[i].Is(VISITED) )
1228  // std::cout<<" WARNING Second sliver in the same node bis "<<std::endl;
1229  rVertices[i].Set(VISITED);
1230  }
1231  }
1232 
1233  }
1234 
1235  }
1236 
1237 
1238  }
1239  return accepted;
1240 
1241  }
1242 
1243 
1254 
1255  private:
1256 
1277 
1279  SelectElementsMesherProcess& operator=(SelectElementsMesherProcess const& rOther);
1280 
1282  //Process(Process const& rOther);
1283 
1285 
1286 }; // Class Process
1287 
1289 
1292 
1293 
1297 
1298 
1300 inline std::istream& operator >> (std::istream& rIStream,
1302 
1304 inline std::ostream& operator << (std::ostream& rOStream,
1305  const SelectElementsMesherProcess& rThis)
1306 {
1307  rThis.PrintInfo(rOStream);
1308  rOStream << std::endl;
1309  rThis.PrintData(rOStream);
1310 
1311  return rOStream;
1312 }
1314 
1315 
1316 } // namespace Kratos.
1317 
1318 #endif // KRATOS_SELECT_ELEMENTS_MESHER_PROCESS_H_INCLUDED defined
Base class for all Conditions.
Definition: condition.h:59
bool Is(Flags const &rOther) const
Definition: flags.h:274
bool IsNot(Flags const &rOther) const
Definition: flags.h:291
Geometry base class.
Definition: geometry.h:71
void push_back(PointPointerType x)
Definition: geometry.h:548
SizeType size() const
Definition: geometry.h:518
PointReferenceType back()
Definition: geometry.h:507
The base class for processes passed to the solution scheme.
Definition: mesher_process.hpp:37
Short class definition.
Definition: mesher_utilities.hpp:49
bool CheckVolumeDecrease(GeometryType &rVertices, const unsigned int &rDimension, const double &rTolerance, double &VolumeChange)
Definition: mesher_utilities.cpp:1378
double GetMovedVolume(GeometryType &rVertices, const unsigned int &rDimension, double MovementFactor)
Definition: mesher_utilities.cpp:1421
bool CheckOuterCentre(Geometry< Node > &rGeometry, double &rOffsetFactor, bool &rSelfContact)
Definition: mesher_utilities.cpp:436
double GetDeformationGradientDeterminant(GeometryType &rVertices, const unsigned int &rDimension)
Definition: mesher_utilities.cpp:1483
bool CheckGeometryShape(Geometry< Node > &rGeometry, int &rShape)
Definition: mesher_utilities.cpp:849
bool ShrankAlphaShape(double AlphaParameter, Geometry< Node > &rGeometry, double &rOffsetFactor, const unsigned int dimension)
Definition: mesher_utilities.cpp:1241
bool CheckRelativeVelocities(Geometry< Node > &rGeometry, const double &rRelativeFactor)
Definition: mesher_utilities.cpp:1346
bool CheckRigidOuterCentre(Geometry< Node > &rGeometry)
Definition: mesher_utilities.cpp:262
bool CheckSubdomain(Geometry< Node > &rGeometry)
Definition: mesher_utilities.cpp:198
bool AlphaShape(double AlphaParameter, Geometry< Node > &rGeometry, const unsigned int dimension)
Definition: mesher_utilities.cpp:1182
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
ConditionIterator ConditionsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1361
SizeType NumberOfElements(IndexType ThisIndex=0) const
Definition: model_part.h:1027
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
SizeType NumberOfConditions(IndexType ThisIndex=0) const
Definition: model_part.h:1218
ElementIterator ElementsEnd(IndexType ThisIndex=0)
Definition: model_part.h:1179
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class defines the node.
Definition: node.h:65
TVariableType::Type & FastGetSolutionStepValue(const TVariableType &rThisVariable)
Definition: node.h:435
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
size_type size() const
Definition: pointer_vector.h:255
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
Refine Mesh Elements Process 2D and 3D.
Definition: select_elements_mesher_process.hpp:47
void GetElementDimension(unsigned int &dimension, unsigned int &number_of_vertices)
Definition: select_elements_mesher_process.hpp:690
int mEchoLevel
Definition: select_elements_mesher_process.hpp:381
std::string Info() const override
Turn back information as a string.
Definition: select_elements_mesher_process.hpp:344
void GetTriangleFluidElementAlpha(double &rAlpha, GeometryType &rVertices, const NodalFlags &rVerticesFlags, const unsigned int &rDimension)
Definition: select_elements_mesher_process.hpp:810
SelectElementsMesherProcess(ModelPart &rModelPart, MesherUtilities::MeshingParameters &rRemeshingParameters, int EchoLevel)
Default constructor.
Definition: select_elements_mesher_process.hpp:64
void GetAlphaParameter(double &rAlpha, GeometryType &rVertices, const NodalFlags &rVerticesFlags, const unsigned int &rDimension)
Definition: select_elements_mesher_process.hpp:767
void operator()()
This operator is provided to call the process as a function and simply calls the Execute method.
Definition: select_elements_mesher_process.hpp:83
void SelectNodesToErase()
Definition: select_elements_mesher_process.hpp:539
MesherUtilities mMesherUtilities
Definition: select_elements_mesher_process.hpp:379
void LabelEdgeNodes(ModelPart &rModelPart)
Definition: select_elements_mesher_process.hpp:480
void GetTetrahedronFluidElementAlpha(double &rAlpha, GeometryType &rVertices, const NodalFlags &rVerticesFlags, const unsigned int &rDimension)
Definition: select_elements_mesher_process.hpp:934
virtual ~SelectElementsMesherProcess()
Destructor.
Definition: select_elements_mesher_process.hpp:75
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: select_elements_mesher_process.hpp:95
KRATOS_CLASS_POINTER_DEFINITION(SelectElementsMesherProcess)
Pointer definition of Process.
ModelPart & mrModelPart
Definition: select_elements_mesher_process.hpp:375
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: select_elements_mesher_process.hpp:350
ModelPart::ConditionType ConditionType
Definition: select_elements_mesher_process.hpp:55
ConditionType::GeometryType GeometryType
Definition: select_elements_mesher_process.hpp:57
bool CheckElementBoundaries(GeometryType &rVertices, const NodalFlags &rVerticesFlags)
Definition: select_elements_mesher_process.hpp:712
bool IsFirstTimeStep()
Definition: select_elements_mesher_process.hpp:466
MesherUtilities::MeshingParameters & mrRemesh
Definition: select_elements_mesher_process.hpp:377
void CheckIds(const int *OutElementList, const int &OutNumberOfElements, const unsigned int number_of_vertices)
Definition: select_elements_mesher_process.hpp:668
bool CheckElementShape(GeometryType &rVertices, const NodalFlags &rVerticesFlags, const unsigned int &rDimension, unsigned int &number_of_slivers)
Definition: select_elements_mesher_process.hpp:1079
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: select_elements_mesher_process.hpp:356
ModelPart::PropertiesType PropertiesType
Definition: select_elements_mesher_process.hpp:56
A four node tetrahedra geometry with linear shape functions.
Definition: tetrahedra_3d_4.h:59
double Volume() const override
Definition: tetrahedra_3d_4.h:450
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
static int EchoLevel
Definition: co_sim_EMPIRE_API.h:42
static double max(double a, double b)
Definition: GeometryFunctions.h:79
static double min(double a, double b)
Definition: GeometryFunctions.h:71
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
TExpressionType::data_type norm_2(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression)
Definition: amatrix_interface.h:625
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
pn
Definition: generate_droplet_dynamics.py:65
int dimension
Definition: isotropic_damage_automatic_differentiation.py:123
def Alpha(n, j)
Definition: quadrature.py:93
int j
Definition: quadrature.py:648
el
Definition: read_stl.py:25
integer i
Definition: TensorModule.f:17
int * GetElementList()
Definition: mesher_utilities.hpp:178
int & GetNumberOfElements()
Definition: mesher_utilities.hpp:183
Definition: mesher_utilities.hpp:631
MeshingInfoParameters::Pointer Info
Definition: mesher_utilities.hpp:681
Flags Options
Definition: mesher_utilities.hpp:645
std::vector< int > PreservedElements
Definition: mesher_utilities.hpp:669
RefiningParameters::Pointer Refine
Definition: mesher_utilities.hpp:684
bool MeshElementsSelectedFlag
Definition: mesher_utilities.hpp:662
MeshContainer OutMesh
Definition: mesher_utilities.hpp:675
double OffsetFactor
Definition: mesher_utilities.hpp:652
std::vector< int > NodalPreIds
Definition: mesher_utilities.hpp:668
double AlphaParameter
Definition: mesher_utilities.hpp:651
Flags ExecutionOptions
Definition: mesher_utilities.hpp:648
Definition: select_elements_mesher_process.hpp:383
unsigned int Rigid
Definition: select_elements_mesher_process.hpp:387
unsigned int OldEntity
Definition: select_elements_mesher_process.hpp:396
unsigned int Sliver
Definition: select_elements_mesher_process.hpp:394
unsigned int Boundary
Definition: select_elements_mesher_process.hpp:388
unsigned int Slave
Definition: select_elements_mesher_process.hpp:397
unsigned int Isolated
Definition: select_elements_mesher_process.hpp:393
unsigned int Fluid
Definition: select_elements_mesher_process.hpp:386
unsigned int Inlet
Definition: select_elements_mesher_process.hpp:392
unsigned int Contact
Definition: select_elements_mesher_process.hpp:391
unsigned int FreeSurface
Definition: select_elements_mesher_process.hpp:389
unsigned int NewEntity
Definition: select_elements_mesher_process.hpp:395
unsigned int NoWallFreeSurface
Definition: select_elements_mesher_process.hpp:390
NodalFlags()
Definition: select_elements_mesher_process.hpp:402
unsigned int Solid
Definition: select_elements_mesher_process.hpp:385
void CountFlags(const Node &rNode)
Definition: select_elements_mesher_process.hpp:421
double Radius
Definition: select_elements_mesher_process.hpp:399