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.
ulf_utilities.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3 KratosULFApplication
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, Pawel Ryzhakov
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 //
44 // Project Name: Kratos
45 // Last Modified by: $Author: anonymous $
46 // Date: $Date: 2009-01-15 14:50:24 $
47 // Revision: $Revision: 1.12 $
48 //
49 //
50 //utilities for the updated lagrangian fluid
51 
52 #if !defined(KRATOS_ULF_UTILITIES_INCLUDED )
53 #define KRATOS_ULF_UTILITIES_INCLUDED
54 
55 
56 
57 // System includes
58 #include <string>
59 #include <iostream>
60 #include <algorithm>
61 
62 // External includes
63 
64 
65 // Project includes
66 #include <pybind11/pybind11.h>
67 #include "includes/define.h"
68 #include "includes/define_python.h"
69 
70 #include "includes/model_part.h"
71 #include "includes/node.h"
72 #include "utilities/geometry_utilities.h"
74 #include "ULF_application.h"
75 // #include "boost/smart_ptr.hpp"
76 #include "utilities/openmp_utils.h"
77 
78 namespace Kratos
79 {
80 class UlfUtils
81 {
82 public:
83  typedef Node NodeType;
84  //**********************************************************************************************
85  //**********************************************************************************************
86 
87  //functions to apply the boundary conditions
88 
89  void ApplyBoundaryConditions(ModelPart& ThisModelPart, int laplacian_type)
90  {
91  KRATOS_TRY;
92 
93  if(laplacian_type == 1)
94  {
95  //identify fluid nodes and mark as boundary the free ones
96  for(ModelPart::NodesContainerType::const_iterator in = ThisModelPart.NodesBegin(); in!=ThisModelPart.NodesEnd(); in++)
97  {
98  //marking wet nodes
99  if(in->FastGetSolutionStepValue(IS_STRUCTURE) )
100  if( (in->GetValue(NEIGHBOUR_ELEMENTS)).size() != 0)
101  in->FastGetSolutionStepValue(IS_FLUID) = 1.0;
102  else //it is not anymore of fluid
103  in->FastGetSolutionStepValue(IS_FLUID) = 0.0;
104  //marking as free surface the lonely nodes
105  else if( (in->GetValue(NEIGHBOUR_ELEMENTS)).size() == 0)
106  in->FastGetSolutionStepValue(IS_BOUNDARY) = 1.0;
107  }
108 
109  //identify the free surface
110  for(ModelPart::NodeIterator i = ThisModelPart.NodesBegin() ;
111  i != ThisModelPart.NodesEnd() ; ++i)
112  {
113  //reset the free surface
114  i->FastGetSolutionStepValue(IS_FREE_SURFACE) = 0;
115  i->Free(PRESSURE);
116 
117  //identify the free surface and fix the pressure accordingly
118  if( i->FastGetSolutionStepValue(IS_BOUNDARY) != 0
119  &&
120  i->FastGetSolutionStepValue(IS_STRUCTURE) == 0)
121  {
122  i->FastGetSolutionStepValue(IS_FREE_SURFACE) = 1;
123  i->FastGetSolutionStepValue(PRESSURE) = 0.00;
124  i->Fix(PRESSURE);
125  }
126  }
127 
128 
129  }
130  else //case of discrete laplacian
131  {
132  //identify fluid nodes and mark as boundary the free ones
133  for(ModelPart::NodesContainerType::const_iterator in = ThisModelPart.NodesBegin(); in!=ThisModelPart.NodesEnd(); in++)
134  {
135  //marking wet nodes
136  if(in->FastGetSolutionStepValue(IS_STRUCTURE) )
137  if( (in->GetValue(NEIGHBOUR_ELEMENTS)).size() != 0)
138  in->FastGetSolutionStepValue(IS_FLUID) = 1.0;
139  else //it is not anymore of fluid
140  in->FastGetSolutionStepValue(IS_FLUID) = 0.0;
141  //marking as free surface the lonely nodes
142  else if( (in->GetValue(NEIGHBOUR_ELEMENTS)).size() == 0)
143  in->FastGetSolutionStepValue(IS_BOUNDARY) = 1.0;
144 
145  if( (in->GetValue(NEIGHBOUR_ELEMENTS)).size() == 0)
146  in->FastGetSolutionStepValue(PRESSURE) = 0.0;
147  }
148 
149  //identify the free surface
150  for(ModelPart::NodeIterator i = ThisModelPart.NodesBegin() ;
151  i != ThisModelPart.NodesEnd() ; ++i)
152  {
153  //reset the free surface
154  i->FastGetSolutionStepValue(IS_FREE_SURFACE) = 0;
155 
156  //identify the free surface and fix the pressure accordingly
157  if( i->FastGetSolutionStepValue(IS_BOUNDARY) != 0
158  &&
159  i->FastGetSolutionStepValue(IS_STRUCTURE) == 0)
160  {
161  i->FastGetSolutionStepValue(IS_FREE_SURFACE) = 1;
162  }
163  }
164 
165 
166 
167  }
168 
169  KRATOS_CATCH("");
170  }
171  //**********************************************************************************************
172  //**********************************************************************************************
173  void IdentifyFluidNodes(ModelPart& ThisModelPart)
174  {
175  KRATOS_TRY;
176 
177  for(ModelPart::ElementsContainerType::iterator i = ThisModelPart.ElementsBegin();
178  i!=ThisModelPart.ElementsEnd(); i++)
179  {
180  //calculating shape functions values
181  Geometry< Node >& geom = i->GetGeometry();
182 
183  for(unsigned int i = 0; i<geom.size(); i++)
184  geom[i].FastGetSolutionStepValue(IS_FLUID) = 1;
185 
186  }
187  KRATOS_CATCH("");
188  }
189 
190  //**********************************************************************************************
191  //**********************************************************************************************
192  void ApplyMinimalPressureConditions(std::vector< GlobalPointersVector< Node > >& connected_components)
193  {
194  KRATOS_TRY;
195 
196  //verify that the minimal conditions for pressure are applied
197  std::vector<bool> to_be_prescribed(connected_components.size());
198  array_1d<double,3> fixed_vel;
199  for(unsigned int i = 0; i<connected_components.size(); i++)
200  {
201  int boundary_nodes = 0;
202  int prescribed_vel_nodes = 0;
203  GlobalPointersVector< Node >& node_list = connected_components[i];
205  in != node_list.end(); in++)
206  {
207  //free the pressure
208  in->Free(PRESSURE);
209 
210  //cound boundary and fixed velocity nodes
211  if(in->FastGetSolutionStepValue(IS_BOUNDARY) == 1)
212  {
213  //count the nodes added
214  boundary_nodes += 1;
215 
216  //if it is structure add it to the fixed nodes
217  if(in->FastGetSolutionStepValue(IS_STRUCTURE) == 1)
218  prescribed_vel_nodes += 1;
219 
220  }
221  }
222 
223  //if all the boundary nodes have the velocity prescribed => it is needed to
224  //prescribe the pressure on 1 node
225  if(boundary_nodes == prescribed_vel_nodes)
226  {
227  bool one_is_prescribed = false;
229  in != node_list.end(); in++)
230  {
231  if( one_is_prescribed == false &&
232  in->FastGetSolutionStepValue(IS_BOUNDARY) == 1 )
233  {
234  std::cout << "fixed pressure on node " << in->Id() << std::endl;
235  one_is_prescribed = true;
236  in->Fix(PRESSURE);
237  }
238  }
239  }
240  }
241  KRATOS_CATCH("");
242  }
243 
244  //**********************************************************************************************
245  //**********************************************************************************************
246  double EstimateDeltaTime(double dt_min, double dt_max, ModelPart& ThisModelPart)
247  {
248  KRATOS_TRY
249 
250  array_1d<double,3> dx, dv;
251  double deltatime = dt_max;
252  double dvside, lside;
253 
254  for(ModelPart::ElementsContainerType::iterator i = ThisModelPart.ElementsBegin();
255  i!=ThisModelPart.ElementsEnd(); i++)
256  {
257  //calculating shape functions values
258  Geometry< Node >& geom = i->GetGeometry();
259 
260  for(unsigned int i1 = 0; i1 < geom.size()-1; i1++)
261  {
262  for(unsigned int i2 = i1 + 1; i2 < geom.size(); i2++)
263  {
264  dx[0] = geom[i2].X() - geom[i1].X();
265  dx[1] = geom[i2].Y() - geom[i1].Y();
266  dx[2] = geom[i2].Z() - geom[i1].Z();
267 
268  lside = inner_prod(dx,dx);
269 
270  noalias(dv) = geom[i2].FastGetSolutionStepValue(VELOCITY);
271  noalias(dv) -= geom[i1].FastGetSolutionStepValue(VELOCITY);
272 
273  dvside = inner_prod(dx,dv);
274 
275  double dt;
276  if(dvside < 0.0) //otherwise the side is "getting bigger" so the time step has not to be diminished
277  {
278  dt = fabs( lside/dvside );
279  if(dt < deltatime) deltatime = dt;
280  }
281 
282  }
283  }
284  }
285 
286  if(deltatime < dt_min)
287  {
288  std::cout << "ATTENTION dt_min is being used" << std::endl;
289  deltatime = dt_min;
290  }
291 
292 
293  return deltatime;
294 
295  KRATOS_CATCH("")
296  }
297  //**********************************************************************************************
298  //**********************************************************************************************
299  void MarkOuterNodes(const array_1d<double,3>& corner1, const array_1d<double,3>& corner2,
301  {
302  KRATOS_TRY;
303 
304  //add a big number to the id of the nodes to be erased
305  int n_erased = 0;
306  double xmax, xmin, ymax,ymin, zmax, zmin;
307 
308 
309 
310  if(corner1[0] > corner2[0])
311  {
312  xmax = corner1[0];
313  xmin = corner2[0];
314  }
315  else
316  {
317  xmax = corner2[0];
318  xmin = corner1[0];
319  }
320 
321  if(corner1[1] > corner2[1])
322  {
323  ymax = corner1[1];
324  ymin = corner2[1];
325  }
326  else
327  {
328  ymax = corner2[1];
329  ymin = corner1[1];
330  }
331 
332  if(corner1[2] > corner2[2])
333  {
334  zmax = corner1[2];
335  zmin = corner2[2];
336  }
337  else
338  {
339  zmax = corner2[2];
340  zmin = corner1[2];
341  }
342 
343 
344 
345  for(ModelPart::NodesContainerType::iterator in = rNodes.begin(); in!=rNodes.end(); in++)
346  {
347  bool erase = false;
348  double& x = in->X();
349  double& y = in->Y();
350  double& z = in->Z();
351 
352  if(x<xmin || x>xmax) erase = true;
353  else if(y<ymin || y>ymax) erase = true;
354  else if(z<zmin || z>zmax) erase = true;
355 
356  if(erase == true)
357  {
358  n_erased += 1;
359  in->Set(TO_ERASE, true);
360  }
361  }
362 
363  KRATOS_CATCH("")
364  }
365 
366 
367 
368  //**********************************************************************************************
369  //* //**********************************************************************************************
372  {
373  //KRATOS_WATCH("length calculation")
374  return sqrt((Point1[0]-Point2[0])*(Point1[0]-Point2[0]) + (Point1[1]-Point2[1])*(Point1[1]-Point2[1]) +(Point1[2]-Point2[2])*(Point1[2]-Point2[2]));
375  }
377  {
378  //Heron's formula
379  double a=Length(Point1, Point2);//sqrt((Point1[0]-Point2[0])*(Point1[0]-Point2[0]) + (Point1[1]-Point2[1])*(Point1[1]-Point2[1]) +(Point1[2]-Point2[2])*(Point1[2]-Point2[2]));
380  double b=Length(Point1, Point3);//sqrt((Point3[0]-Point2[0])*(Point3[0]-Point2[0]) + (Point3[1]-Point2[1])*(Point3[1]-Point2[1]) +(Point3[2]-Point2[2])*(Point3[2]-Point2[2]));
381  double c=Length(Point2, Point3);//sqrt((Point1[0]-Point3[0])*(Point1[0]-Point3[0]) + (Point1[1]-Point3[1])*(Point1[1]-Point3[1]) +(Point1[2]-Point3[2])*(Point1[2]-Point3[2]));
382  double p=0.5*(a+b+c);
383  return sqrt(p*(p-a)*(p-b)*(p-c));
384  }
385 
387  double CalculateFreeSurfaceArea(ModelPart& ThisModelPart, int domain_size)
388  {
389  if (domain_size!=3)
390  KRATOS_THROW_ERROR(std::logic_error,"error: This function is implemented for 3D only","");
391 
392 
393  std::vector<array_1d<double,3> > PointsOfFSTriangle;
394  PointsOfFSTriangle.reserve(3);
395  double total_fs_area=0.0;
396 
397  for(ModelPart::ElementsContainerType::iterator in = ThisModelPart.ElementsBegin();
398  in!=ThisModelPart.ElementsEnd(); in++)
399  {
400  //only for tetrahedras
401  if (in->GetGeometry().size()==4)
402  {
403  int n_fs=in->GetGeometry()[0].FastGetSolutionStepValue(IS_FREE_SURFACE);
404  n_fs+=in->GetGeometry()[1].FastGetSolutionStepValue(IS_FREE_SURFACE);
405  n_fs+=in->GetGeometry()[2].FastGetSolutionStepValue(IS_FREE_SURFACE);
406  n_fs+=in->GetGeometry()[3].FastGetSolutionStepValue(IS_FREE_SURFACE);
407 
408  if (n_fs==3)
409  {
410  int position=0;
411  for (int i=0; i<4; i++)
412  {
413 
414  if (in->GetGeometry()[i].FastGetSolutionStepValue(IS_FREE_SURFACE)==1.0)
415  {
416  PointsOfFSTriangle[position][0]=in->GetGeometry()[i].X();
417  PointsOfFSTriangle[position][1]=in->GetGeometry()[i].Y();
418  PointsOfFSTriangle[position][2]=in->GetGeometry()[i].Z();
419  position++;
420 
421  }
422  }
423  total_fs_area+=CalculateTriangleArea3D(PointsOfFSTriangle[0], PointsOfFSTriangle[1], PointsOfFSTriangle[2]);
424  }
425  }
426 
427  }
428 
429  return total_fs_area;
430  }
432  void CalculateNodalArea(ModelPart& ThisModelPart, int domain_size)
433  {
434 
435  KRATOS_TRY
436 
437  //set to zero the nodal area
438  for(ModelPart::NodesContainerType::iterator in = ThisModelPart.NodesBegin();
439  in!=ThisModelPart.NodesEnd(); in++)
440  {
441  in->FastGetSolutionStepValue(NODAL_AREA) = 0.00;
442  }
443 
444  if(domain_size == 2)
445  {
446  double area = 0.0;
447  for(ModelPart::ElementsContainerType::iterator i = ThisModelPart.ElementsBegin();
448  i!=ThisModelPart.ElementsEnd(); i++)
449  {
450  //calculating shape functions values
451  Geometry< Node >& geom = i->GetGeometry();
452 
454  area *= 0.333333333333333333333333333;
455 
456 
457  geom[0].FastGetSolutionStepValue(NODAL_AREA) += area;
458  geom[1].FastGetSolutionStepValue(NODAL_AREA) += area;
459  geom[2].FastGetSolutionStepValue(NODAL_AREA) += area;
460 
461  }
462  }
463  else if(domain_size == 3)
464  {
465  for(ModelPart::ElementsContainerType::iterator i = ThisModelPart.ElementsBegin();
466  i!=ThisModelPart.ElementsEnd(); i++)
467  {
468  double vol;
469  //calculating shape functions values
470  Geometry< Node >& geom = i->GetGeometry();
471  //counting number of structural nodes
472 
473  if (geom.size()==4) //not to calculate the nodal area of the membrane which is a 2d element in 3d
474  {
475 
477  vol *= 0.25;
478 
479  geom[0].FastGetSolutionStepValue(NODAL_AREA) += vol;
480  geom[1].FastGetSolutionStepValue(NODAL_AREA) += vol;
481  geom[2].FastGetSolutionStepValue(NODAL_AREA) += vol;
482  geom[3].FastGetSolutionStepValue(NODAL_AREA) += vol;
483 
484 
485 
486 
487  }
488  }
489  }
490  //r
491 
492 
493  KRATOS_CATCH("")
494  }
495 //##########################################################################################
496 
497 void MarkNodesTouchingWall(ModelPart& ThisModelPart, int domain_size, double factor)
498  {
499  KRATOS_TRY;
500 
501  if (domain_size == 2)
502  {
503 
504  for (ModelPart::ElementsContainerType::iterator i = ThisModelPart.ElementsBegin();
505  i != ThisModelPart.ElementsEnd(); i++)
506  {
507  double n_str = 0;
508 
509  //counting number on nodes at the wall
510  Geometry< Node >& geom = i->GetGeometry();
511  n_str = geom[0].FastGetSolutionStepValue(IS_BOUNDARY);
512  n_str += geom[1].FastGetSolutionStepValue(IS_BOUNDARY);
513  n_str += geom[2].FastGetSolutionStepValue(IS_BOUNDARY);
514  //if two walls are at the wall, we check if the third node is close to it or not by passing the alpha-shape
515  if (n_str == 2.0)
516  {
517  BoundedMatrix<double, 3, 2 > sort_coord = ZeroMatrix(3, 2);
518  int cnt = 1;
519  for (int i = 0; i < 3; ++i)
520  if (geom[i].FastGetSolutionStepValue(IS_BOUNDARY) == 0.0)
521  {
522  sort_coord(0, 0) = geom[i].X();
523  sort_coord(0, 1) = geom[i].Y();
524  }
525  else
526  {
527  sort_coord(cnt, 0) = geom[i].X();
528  sort_coord(cnt, 1) = geom[i].Y();
529  cnt++;
530  }
531 
534 
535  vec1[0] = sort_coord(0, 0) - sort_coord(1, 0);
536  vec1[1] = sort_coord(0, 1) - sort_coord(1, 1);
537 
538  vec2[0] = sort_coord(2, 0) - sort_coord(1, 0);
539  vec2[1] = sort_coord(2, 1) - sort_coord(1, 1);
540 
541  double outer_prod = 0.0;
542  outer_prod = vec2[1] * vec1[0] - vec1[1] * vec2[0];
543 
544  double length_measure = 0.0;
545  length_measure = vec2[0] * vec2[0] + vec2[1] * vec2[1];
546  length_measure = sqrt(length_measure);
547  outer_prod /= length_measure;
548 
549  //KRATOS_WATCH(fabs(outer_prod));
550  // RATOS_WATCH(factor*length_measure);
551 
552  if (fabs(outer_prod) < factor * length_measure)
553  {
554  for (int i = 0; i < 3; i++)
555  {
556  //if thats not the wall node, remove it
557  if (geom[i].FastGetSolutionStepValue(IS_BOUNDARY) == 0.0)
558  {
559  geom[i].Set(TO_ERASE, true);
560  //KRATOS_WATCH("NODE TOUCHING THE WALL - WILL BE ERASED!!!!")
561  }
562  }
563  }
564  }
565 
566  }
567  }
568  else
569  {
570  for (ModelPart::ElementsContainerType::iterator i = ThisModelPart.ElementsBegin();
571  i != ThisModelPart.ElementsEnd(); i++)
572  {
573  double n_str = 0;
574  double n_wall = 0;
575 
576  //counting number on nodes at the wall
577  Geometry< Node >& geom = i->GetGeometry();
578  if (geom.size() == 4)
579  {
580  for (int ii = 0; ii <= domain_size; ++ii)
581  n_str += geom[ii].FastGetSolutionStepValue(IS_BOUNDARY);
582  //n_str += geom[ii].FastGetSolutionStepValue(IS_STRUCTURE);
583 
584  for (int ii = 0; ii <= domain_size; ++ii)
585  n_wall += geom[ii].FastGetSolutionStepValue(IS_STRUCTURE);
586  //n_wall += geom[ii].FastGetSolutionStepValue(FIXED_WALL);
587 
588  //if two walls are at the wall, we check if the third node is close to it or not by passing the alpha-shape
589  //if (n_str == 3.0)
590  if (n_wall == 3.0)
591  {
592  BoundedMatrix<double, 4, 3 > sort_coord = ZeroMatrix(4, 3);
593  int cnt = 1;
594  for (int i = 0; i < 4; ++i)
595  {
596  //if (geom[i].FastGetSolutionStepValue(IS_STRUCTURE) == 0.0)
597 
598  //if (geom[i].FastGetSolutionStepValue(FIXED_WALL) == 0.0)
599  if (geom[i].FastGetSolutionStepValue(IS_BOUNDARY) == 0.0)
600  {
601  sort_coord(0, 0) = geom[i].X();
602  sort_coord(0, 1) = geom[i].Y();
603  sort_coord(0, 2) = geom[i].Z();
604  }
605  else
606  {
607  sort_coord(cnt, 0) = geom[i].X();
608  sort_coord(cnt, 1) = geom[i].Y();
609  sort_coord(cnt, 2) = geom[i].Z();
610  cnt++;
611  }
612  }
617 
618 
619  vec1[0] = sort_coord(0, 0) - sort_coord(1, 0);
620  vec1[1] = sort_coord(0, 1) - sort_coord(1, 1);
621  vec1[2] = sort_coord(0, 2) - sort_coord(1, 2);
622 
623  vec2[0] = sort_coord(2, 0) - sort_coord(1, 0);
624  vec2[1] = sort_coord(2, 1) - sort_coord(1, 1);
625  vec2[2] = sort_coord(2, 2) - sort_coord(1, 2);
626 
627  vec3[0] = sort_coord(3, 0) - sort_coord(1, 0);
628  vec3[1] = sort_coord(3, 1) - sort_coord(1, 1);
629  vec3[2] = sort_coord(3, 2) - sort_coord(1, 2);
630 
631  //this last vectoris only needed to have all the edges of the base
632  vec4[0] = sort_coord(1, 0) - sort_coord(3, 0);
633  vec4[1] = sort_coord(1, 1) - sort_coord(3, 1);
634  vec4[2] = sort_coord(1, 2) - sort_coord(3, 2);
635 
636  //Control the hight of the thetraedral element
637  //Volume of the tethraedra
638  double vol = (vec2[0] * vec3[1] * vec1[2] - vec2[0] * vec3[2] * vec1[1] +
639  vec2[1] * vec3[2] * vec1[0] - vec2[1] * vec3[0] * vec1[2] +
640  vec2[2] * vec3[0] * vec1[1] - vec2[2] * vec3[1] * vec1[0])*0.1666666666667;
641  //Area of the basis
643  outer_prod[0] = vec2[1] * vec3[2] - vec2[2] * vec3[1];
644  outer_prod[1] = vec2[2] * vec3[0] - vec2[0] * vec3[2];
645  outer_prod[2] = vec2[0] * vec3[1] - vec2[1] * vec3[0];
646  double area_base = norm_2(outer_prod);
647  area_base *= 0.5;
648  //height
649  if (area_base > 0.0000000000001)
650  vol /= area_base;
651  else
652  KRATOS_WATCH("Something strange: area of a wall triangular element --> zero");
653 
654  double length_measure1 = norm_2(vec2);
655  double length_measure = norm_2(vec3);
656  double length_measure2 = norm_2(vec4);
657 
658  //if (n_wall>1.0)
659  // factor*=3.0;
660 
661  if(length_measure1 < length_measure2)
662  {
663  if(length_measure1 < length_measure)
664  length_measure = length_measure1;
665  }
666  else
667  {
668  if(length_measure2 < length_measure)
669  length_measure = length_measure2;
670  }
671 
672  if (fabs(vol) < factor * length_measure)
673  {
674  for (int i = 0; i < 4; i++)
675  {
676  //if thats not the wall node, remove it
677 
678  //if (geom[i].FastGetSolutionStepValue(FIXED_WALL) == 0.0)
679  //if (geom[i].FastGetSolutionStepValue(IS_STRUCTURE) == 0.0)
680  if (geom[i].FastGetSolutionStepValue(IS_BOUNDARY) == 0.0 || geom[i].FastGetSolutionStepValue(IS_INTERFACE) == 1.0)
681  {
682  geom[i].Set(TO_ERASE, true);
683  KRATOS_WATCH("NODE TOUCHING THE WALL - WILL BE ERASED!!!!")
684  }
685  }
686  }
687  //if (n_wall>1.0)
688  // factor/=3.0;
689  }//interface elements
690  }//non_shell
691  }//all elements loop
692  }//domain_size==3
693  KRATOS_CATCH("")
694  }
695 
697 //**********************************************************************************************
698  //**********************************************************************************************
699 
700  void MarkExcessivelyCloseNodes(ModelPart::NodesContainerType& rNodes, const double admissible_distance_factor)
701  {
702  KRATOS_TRY;
703  //KRATOS_WATCH("INSSSSSSSSSSIDE MARK EXCESSIVELY");
704 
705  const double fact2 = admissible_distance_factor*admissible_distance_factor;
706 
707 
708 
709  ModelPart::NodeIterator NodesBegin = rNodes.begin();
710  int size = rNodes.size();
712  #pragma omp parallel for firstprivate(size,NodesBegin),private(in)
713  for (int k = 0; k < size; k++)
714  {
715  in = NodesBegin + k;
716 
717  if (in->FastGetSolutionStepValue(IS_STRUCTURE) == 0) //if it is not a wall node i can erase
718  {
719  double hnode2 = in->FastGetSolutionStepValue(NODAL_H);
720  hnode2 *= hnode2; //take the square
721 
722  //loop on neighbours and erase if they are too close
723  for (GlobalPointersVector< Node >::iterator i = in->GetValue(NEIGHBOUR_NODES).begin();
724  i != in->GetValue(NEIGHBOUR_NODES).end(); i++)
725  {
726  if (static_cast<bool> (i->Is(TO_ERASE)) == false) //we can erase the current node only if the neighb is not to be erased
727  {
728  double dx = i->X() - in->X();
729  double dy = i->Y() - in->Y();
730  double dz = i->Z() - in->Z();
731 
732  double dist2 = dx * dx + dy * dy + dz*dz;
733 
734  if (dist2 < fact2 * hnode2)
735  in->Set(TO_ERASE, true);
736  }
737  }
738  }
739  }
740  // }
741 
742  KRATOS_CATCH("")
743  }
744 
746  void MarkNodesCloseToFS(ModelPart& ThisModelPart, int domain_size)
747  {
748  if (domain_size==2)
749  {
750 
751  for(ModelPart::ElementsContainerType::iterator i = ThisModelPart.ElementsBegin();
752  i!=ThisModelPart.ElementsEnd(); i++)
753  {
754  int n_fs=0;
755 
756  //counting number on nodes at the wall
757  Geometry< Node >& geom = i->GetGeometry();
758  n_fs = int(geom[0].FastGetSolutionStepValue(IS_FREE_SURFACE));
759  n_fs+= int(geom[1].FastGetSolutionStepValue(IS_FREE_SURFACE));
760  n_fs+= int(geom[2].FastGetSolutionStepValue(IS_FREE_SURFACE));
761  //if two walls are of freee surface, we check if the third node is close to it or not by passing the alpha-shape
762  if (n_fs==2)
763  {
764  //if alpha shape tells to preserve
765  if (AlphaShape(1.4, geom)==false)
766  {
767  for (int i=0; i<3; i++)
768  {
769  //if thats not the wall node, remove it
770  if (geom[i].FastGetSolutionStepValue(IS_FREE_SURFACE)==0.0 && geom[i].FastGetSolutionStepValue(IS_FLUID)==1.0 && geom[i].FastGetSolutionStepValue(IS_STRUCTURE)==0.0)
771  {
772  geom[i].Set(TO_ERASE,true);
773  KRATOS_WATCH("NODE CLOSE TO THE FS - WILL BE ERASED!!!!")
774  }
775  }
776  }
777  }
778 
779  }
780  }
781  if (domain_size==3)
782  {
783  KRATOS_THROW_ERROR(std::logic_error, "NOt implemented in 3D!", "");
784 
785  }
786  }
787 
788  void MarkNodesCloseToWallForBladder(ModelPart& ThisModelPart, const double& crit_distance)
789 
790  {
791  for(ModelPart::NodesContainerType::iterator in = ThisModelPart.NodesBegin();
792  in!=ThisModelPart.NodesEnd(); in++)
793  {
794  if (in->FastGetSolutionStepValue(DISTANCE)>0.00 && in->FastGetSolutionStepValue(DISTANCE)<crit_distance && in->FastGetSolutionStepValue(IS_STRUCTURE)==0)
795  {
796  in->Set(TO_ERASE,true);
797  KRATOS_WATCH("NODE EXCESSIVELY CLOSE TO WALL!!!!! BLADDER FUNCTION!!!!!!!!!!!!!!!!!!!!!!!!!!111")
798  }
799  }
800  }
801 
802  void MarkNodesCloseToWall(ModelPart& ThisModelPart, int domain_size, double alpha_shape)
803  {
804  if (domain_size==2)
805  {
806 
807  for(ModelPart::ElementsContainerType::iterator i = ThisModelPart.ElementsBegin();
808  i!=ThisModelPart.ElementsEnd(); i++)
809  {
810  int n_str=0;
811 
812  //counting number on nodes at the wall
813  Geometry< Node >& geom = i->GetGeometry();
814  n_str = int(geom[0].FastGetSolutionStepValue(IS_STRUCTURE));
815  n_str+= int(geom[1].FastGetSolutionStepValue(IS_STRUCTURE));
816  n_str+= int(geom[2].FastGetSolutionStepValue(IS_STRUCTURE));
817  //if two walls are at the wall, we check if the third node is close to it or not by passing the alpha-shape
818  if (n_str==2)
819  {
820  //if alpha shape tells to preserve
821  if (AlphaShape(alpha_shape, geom)==false)
822  {
823  for (int i=0; i<3; i++)
824  {
825  //if thats not the wall node, remove it
826  if (geom[i].FastGetSolutionStepValue(IS_STRUCTURE)==0.0)
827  {
828  geom[i].Set(TO_ERASE,true);
829  //KRATOS_WATCH("NODE CLOSE TO THE WALL - WILL BE ERASED!!!!")
830  }
831  }
832  }
833  }
834 
835  }
836  }
837  if (domain_size==3)
838  {
839  //KRATOS_WATCH("Inside mark nodes close to wall process")
840  for(ModelPart::ElementsContainerType::iterator i = ThisModelPart.ElementsBegin();
841  i!=ThisModelPart.ElementsEnd(); i++)
842  {
843  int n_str=0;
844  int n_fl=0;
845  int n_lag=0;
846  int n_interf=0;
847  //counting number on nodes at the wall
848  Geometry< Node >& geom = i->GetGeometry();
849  for (unsigned int iii=0; iii<geom.size(); iii++)
850  {
851  n_lag += int(geom[iii].FastGetSolutionStepValue(IS_LAGRANGIAN_INLET));
852  n_str += int(geom[iii].FastGetSolutionStepValue(IS_STRUCTURE));
853  n_fl += int(geom[iii].FastGetSolutionStepValue(IS_FLUID));
854  n_interf += int(geom[iii].FastGetSolutionStepValue(IS_INTERFACE));
855  }
856 
857 
858  //if three nodes are at the wall, we check if the fourth node is close to it or not by passing the alpha-shape
859  //if (geom.size()==4.0 && n_str==3.0 && n_fl==4.0)
860  if (geom.size()==4 && n_interf==3 && n_lag==0)
861  {
862  //if alpha shape tells to preserve
863  if (AlphaShape3D(alpha_shape, geom)==false)
864  {
865  for (unsigned int iii=0; iii<geom.size(); iii++)
866  {
867  //if thats not the wall node, remove it
868  if (geom[iii].FastGetSolutionStepValue(IS_STRUCTURE)==0.0)
869  {
870  geom[iii].Set(TO_ERASE,true);
871  KRATOS_WATCH("NODE CLOSE TO THE WALL - WILL BE ERASED!!!!")
872  }
873  }
874  }
875  }
876 
877 
878  }
879  }
880 
881 
882 
883  }
884  void SetNodalHAtLagInlet(ModelPart& ThisModelPart, double factor)
885  {
886  for(ModelPart::ElementsContainerType::iterator i = ThisModelPart.ElementsBegin();
887  i!=ThisModelPart.ElementsEnd(); i++)
888  {
889  int n_lag=0;
890 
891  //counting number on nodes at the wall
892  Geometry< Node >& geom = i->GetGeometry();
893  for (unsigned int iii=0; iii<geom.size(); iii++)
894  {
895  n_lag += int(geom[iii].FastGetSolutionStepValue(IS_LAGRANGIAN_INLET));
896  }
897  if (geom.size()==4 && n_lag>0)
898  {
899  for (unsigned int iii=0; iii<geom.size(); iii++)
900  {
901  geom[iii].FastGetSolutionStepValue(NODAL_H)/=factor;
902  }
903 
904  }
905  }
906 
907  }
908  void RestoreNodalHAtLagInlet(ModelPart& ThisModelPart, double factor)
909  {
910  for(ModelPart::ElementsContainerType::iterator i = ThisModelPart.ElementsBegin();
911  i!=ThisModelPart.ElementsEnd(); i++)
912  {
913  int n_lag=0;
914 
915  //counting number on nodes at the wall
916  Geometry< Node >& geom = i->GetGeometry();
917  for (unsigned int iii=0; iii<geom.size(); iii++)
918  {
919  n_lag += int(geom[iii].FastGetSolutionStepValue(IS_LAGRANGIAN_INLET));
920  }
921  if (geom.size()==4 && n_lag>0)
922  {
923  for (unsigned int iii=0; iii<geom.size(); iii++)
924  {
925  //KRATOS_WATCH("before")
926  //KRATOS_WATCH(geom[iii].FastGetSolutionStepValue(NODAL_H))
927  geom[iii].FastGetSolutionStepValue(NODAL_H)*=factor;
928  //KRATOS_WATCH("after")
929  //KRATOS_WATCH(geom[iii].FastGetSolutionStepValue(NODAL_H))
930  }
931 
932  }
933  }
934 
935  }
936 
937 
938 
940  {
941 
942  for(ModelPart::NodesContainerType::iterator in = ThisModelPart.NodesBegin();
943  in!=ThisModelPart.NodesEnd(); in++)
944  {
945  if(in->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET)==0 && in->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET,1)==0 && in->FastGetSolutionStepValue(IS_FREE_SURFACE)==1.0 )
946  {
947  if (in->IsFixed(DISPLACEMENT_X)==true || in->IsFixed(DISPLACEMENT_Y)==true || in->IsFixed(DISPLACEMENT_Z)==true)
948  {
949  KRATOS_WATCH("This node is a BC node. So cant be erased")
950  }
951  else
952  {
953  in->Set(TO_ERASE,true);
954  KRATOS_WATCH("Marking free surface node for erasing (in this problem it is the one that passed through the membrane)!!!")
955  }
956  }
957 
958  }
959 
960  }
961 
963  {
964 
965 //delete lonely nodes //just to try: 19/07/2010
966  /*
967  for(ModelPart::NodesContainerType::iterator in = ThisModelPart.NodesBegin();
968  in!=ThisModelPart.NodesEnd(); in++)
969  {
970  in->Set(TO_ERASE,false);
971 
972  }
973  */
974 
975  for(ModelPart::NodesContainerType::iterator in = ThisModelPart.NodesBegin();
976  in!=ThisModelPart.NodesEnd(); in++)
977  {
978  if((in->GetValue(NEIGHBOUR_ELEMENTS)).size() == 0 && in->FastGetSolutionStepValue(IS_STRUCTURE)==0.0 && in->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET)!=1 && in->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET,1)!=1.0)
979  {
980  in->Set(TO_ERASE,true);
981  //KRATOS_WATCH("Marking lonelynodes!!!")
982  }
983 
984  }
985  /*
986  for(ModelPart::NodesContainerType::iterator in = ThisModelPart.NodesBegin();
987  in!=ThisModelPart.NodesEnd(); in++)
988  {
989  if((in->GetValue(NEIGHBOUR_ELEMENTS)).size() == 0 && in->FastGetSolutionStepValue(IS_STRUCTURE)==1.0)
990  {
991  in->FastGetSolutionStepValue(PRESSURE)==0;
992  if ((in)->GetDof(DISPLACEMENT_X).IsFixed())
993  in->FastGetSolutionStepValue(VELOCITY_X)==0;
994 
995  if ((in)->GetDof(DISPLACEMENT_Y).IsFixed())
996  in->FastGetSolutionStepValue(VELOCITY_Y)==0;
997 
998  if ((in)->GetDof(DISPLACEMENT_Z).IsFixed())
999  in->FastGetSolutionStepValue(VELOCITY_Z)==0;
1000 
1001 
1002  }
1003 
1004  }
1005  */
1006  }
1007 
1008  bool AlphaShape(double alpha_param, Geometry<Node >& pgeom)
1009  //bool AlphaShape(double alpha_param, Triangle2D<Node >& pgeom)
1010  {
1011  KRATOS_TRY
1012  BoundedMatrix<double,2,2> J; //local jacobian
1013  BoundedMatrix<double,2,2> Jinv; //local jacobian
1014  static array_1d<double,2> c; //center pos
1015  static array_1d<double,2> rhs; //center pos
1016 
1017  double x0 = pgeom[0].X();
1018  double x1 = pgeom[1].X();
1019  double x2 = pgeom[2].X();
1020 
1021  double y0 = pgeom[0].Y();
1022  double y1 = pgeom[1].Y();
1023  double y2 = pgeom[2].Y();
1024 
1025  J(0,0)=2.0*(x1-x0);
1026  J(0,1)=2.0*(y1-y0);
1027  J(1,0)=2.0*(x2-x0);
1028  J(1,1)=2.0*(y2-y0);
1029 
1030 
1031  double detJ = J(0,0)*J(1,1)-J(0,1)*J(1,0);
1032 
1033  Jinv(0,0) = J(1,1);
1034  Jinv(0,1) = -J(0,1);
1035  Jinv(1,0) = -J(1,0);
1036  Jinv(1,1) = J(0,0);
1037 
1039 
1040 
1041  if(detJ < 1e-12)
1042  {
1043  //std::cout << "detJ = " << detJ << std::endl;
1045  pgeom[0].GetSolutionStepValue(IS_BOUNDARY) = 1;
1046  pgeom[1].GetSolutionStepValue(IS_BOUNDARY) = 1;
1047  pgeom[2].GetSolutionStepValue(IS_BOUNDARY) = 1;
1048  return false;
1049  }
1050 
1051  else
1052  {
1053 
1054  double x0_2 = x0*x0 + y0*y0;
1055  double x1_2 = x1*x1 + y1*y1;
1056  double x2_2 = x2*x2 + y2*y2;
1057 
1058  //finalizing the calculation of the inverted matrix
1059  //std::cout<<"MATR INV"<<MatrixInverse(msJ)<<std::endl;
1060  Jinv /= detJ;
1061  //calculating the RHS
1062  rhs[0] = (x1_2 - x0_2);
1063  rhs[1] = (x2_2 - x0_2);
1064 
1065  //calculate position of the center
1066  noalias(c) = prod(Jinv,rhs);
1067 
1068  double radius = sqrt(pow(c[0]-x0,2)+pow(c[1]-y0,2));
1069 
1070  //calculate average h
1071  double h;
1072  h = pgeom[0].FastGetSolutionStepValue(NODAL_H);
1073  h += pgeom[1].FastGetSolutionStepValue(NODAL_H);
1074  h += pgeom[2].FastGetSolutionStepValue(NODAL_H);
1075  h *= 0.333333333;
1076  if (radius < h*alpha_param)
1077  {
1078  return true;
1079  }
1080  else
1081  {
1082  return false;
1083  }
1084  }
1085 
1086 
1087  KRATOS_CATCH("")
1088  }
1089  bool AlphaShape3D( double alpha_param, Geometry<Node >& geom )
1090  {
1091  KRATOS_TRY
1092 
1093  BoundedMatrix<double,3,3> J; //local jacobian
1094  BoundedMatrix<double,3,3> Jinv; //local jacobian
1095  array_1d<double,3> Rhs; //rhs
1097  double radius=0.0;
1098 
1099  const double x0 = geom[0].X();
1100  const double y0 = geom[0].Y();
1101  const double z0 = geom[0].Z();
1102  const double x1 = geom[1].X();
1103  const double y1 = geom[1].Y();
1104  const double z1 = geom[1].Z();
1105  const double x2 = geom[2].X();
1106  const double y2 = geom[2].Y();
1107  const double z2 = geom[2].Z();
1108  const double x3 = geom[3].X();
1109  const double y3 = geom[3].Y();
1110  const double z3 = geom[3].Z();
1111 
1112  //calculation of the jacobian
1113  J(0,0) = x1-x0;
1114  J(0,1) = y1-y0;
1115  J(0,2) = z1-z0;
1116  J(1,0) = x2-x0;
1117  J(1,1) = y2-y0;
1118  J(1,2) = z2-z0;
1119  J(2,0) = x3-x0;
1120  J(2,1) = y3-y0;
1121  J(2,2) = z3-z0;
1122 // KRATOS_WATCH("33333333333333333333333");
1123 
1124  //inverse of the jacobian
1125  //first column
1126  Jinv(0,0) = J(1,1)*J(2,2) - J(1,2)*J(2,1);
1127  Jinv(1,0) = -J(1,0)*J(2,2) + J(1,2)*J(2,0);
1128  Jinv(2,0) = J(1,0)*J(2,1) - J(1,1)*J(2,0);
1129  //second column
1130  Jinv(0,1) = -J(0,1)*J(2,2) + J(0,2)*J(2,1);
1131  Jinv(1,1) = J(0,0)*J(2,2) - J(0,2)*J(2,0);
1132  Jinv(2,1) = -J(0,0)*J(2,1) + J(0,1)*J(2,0);
1133  //third column
1134  Jinv(0,2) = J(0,1)*J(1,2) - J(0,2)*J(1,1);
1135  Jinv(1,2) = -J(0,0)*J(1,2) + J(0,2)*J(1,0);
1136  Jinv(2,2) = J(0,0)*J(1,1) - J(0,1)*J(1,0);
1137  //calculation of determinant (of the input matrix)
1138 
1139 // KRATOS_WATCH("44444444444444444444444444");
1140  double detJ = J(0,0)*Jinv(0,0)
1141  + J(0,1)*Jinv(1,0)
1142  + J(0,2)*Jinv(2,0);
1143 
1144  //volume = detJ * 0.16666666667;
1145 // KRATOS_WATCH("55555555555555555555555");
1146 
1147 
1148  double x0_2 = x0*x0 + y0*y0 + z0*z0;
1149  double x1_2 = x1*x1 + y1*y1 + z1*z1;
1150  double x2_2 = x2*x2 + y2*y2 + z2*z2;
1151  double x3_2 = x3*x3 + y3*y3 + z3*z3;
1152 
1153  //finalizing the calculation of the inverted matrix
1154  Jinv /= detJ;
1155 
1156  //calculating the RHS
1157  //calculating the RHS
1158  Rhs[0] = 0.5*(x1_2 - x0_2);
1159  Rhs[1] = 0.5*(x2_2 - x0_2);
1160  Rhs[2] = 0.5*(x3_2 - x0_2);
1161 
1162  //calculate position of the center
1163  noalias(xc) = prod(Jinv,Rhs);
1164  //calculate radius
1165  radius = pow(xc[0] - x0,2);
1166  radius += pow(xc[1] - y0,2);
1167  radius += pow(xc[2] - z0,2);
1168  radius = sqrt(radius);
1169 
1170  double h;
1171  h = geom[0].FastGetSolutionStepValue(NODAL_H);
1172  h += geom[1].FastGetSolutionStepValue(NODAL_H);
1173  h += geom[2].FastGetSolutionStepValue(NODAL_H);
1174  h += geom[3].FastGetSolutionStepValue(NODAL_H);
1175  h *= 0.250;
1176 
1177  if (radius < h*alpha_param)
1178  {
1179  return true;
1180  }
1181  else
1182  {
1183  return false;
1184  }
1185 
1186  KRATOS_CATCH("")
1187  }
1188 
1189  //**********************************************************************************************
1190  //**********************************************************************************************
1191  void Predict(ModelPart& ThisModelPart)
1192  {
1193  KRATOS_TRY;
1194 
1195  double dt = ThisModelPart.GetProcessInfo()[DELTA_TIME];
1196  array_1d<double,3> acc;
1197  for(ModelPart::NodesContainerType::iterator in = ThisModelPart.NodesBegin();
1198  in!=ThisModelPart.NodesEnd(); in++)
1199  {
1200  if((in->GetValue(NEIGHBOUR_ELEMENTS)).size() != 0
1201  && in->FastGetSolutionStepValue(IS_STRUCTURE) != 1 )
1202  {
1203  //calculate displacements
1204  array_1d<double,3>& disp = in->FastGetSolutionStepValue(DISPLACEMENT);
1205  noalias(disp) = in->FastGetSolutionStepValue(DISPLACEMENT,1);
1206  noalias(disp) += dt * in->FastGetSolutionStepValue(VELOCITY,1);
1207  }
1208  }
1209 
1210  KRATOS_CATCH("")
1211  }
1212 
1213  //**********************************************************************************************
1214  //**********************************************************************************************
1215  //imposes the velocity that corresponds to a
1216  void MoveLonelyNodes(ModelPart& ThisModelPart)
1217  {
1218  KRATOS_TRY;
1219  //KRATOS_WATCH("MOVING LONELY NODES")
1220  double Dt = ThisModelPart.GetProcessInfo()[DELTA_TIME];
1221 
1222  array_1d<double,3> DeltaDisp, acc;
1223 
1224  //const array_1d<double,3> body_force = ThisModelPart.ElementsBegin()->GetProperties()[BODY_FORCE];
1225  for(ModelPart::NodeIterator i = ThisModelPart.NodesBegin() ;
1226  i != ThisModelPart.NodesEnd() ; ++i)
1227  {
1228  if(
1229  (i)->FastGetSolutionStepValue(IS_STRUCTURE) == 0 && //if it is not a wall node
1230  (i)->GetValue(NEIGHBOUR_ELEMENTS).size() == 0 &&//and it is lonely
1231  ((i)->GetDof(DISPLACEMENT_X).IsFixed() == false || (i)->GetDof(DISPLACEMENT_Y).IsFixed() == false || (i)->GetDof(DISPLACEMENT_Z).IsFixed() == false) //and not the node of the wall, where the 0-displ is prescribed
1232 
1233  )
1234  {
1235  //i->Set(TO_ERASE,true);
1236  //set to zero the pressure
1237  (i)->FastGetSolutionStepValue(PRESSURE) = 0;
1238 
1239  const array_1d<double,3>& old_vel = (i)->FastGetSolutionStepValue(VELOCITY,1);
1240  array_1d<double,3>& vel = (i)->FastGetSolutionStepValue(VELOCITY);
1241  //array_1d<double,3>& acc = (i)->FastGetSolutionStepValue(ACCELERATION);
1242 
1243  noalias(acc) = (i)->FastGetSolutionStepValue(BODY_FORCE);
1244 
1245  noalias(vel) = old_vel;
1246  noalias(vel) += Dt * acc ;
1247 
1248  //calculate displacements
1249  noalias(DeltaDisp) = Dt * vel;
1250 
1251  array_1d<double,3>& disp = i->FastGetSolutionStepValue(DISPLACEMENT);
1252  noalias(disp) = i->FastGetSolutionStepValue(DISPLACEMENT,1);
1253  noalias(disp) += DeltaDisp;
1254 
1255 
1256  }
1257 
1258  }
1259 
1260  KRATOS_CATCH("")
1261  }
1263  /*
1264  void MarkLonelyNodesForErasing(ModelPart& ThisModelPart)
1265  {
1266  KRATOS_TRY;
1267 
1268  for(ModelPart::NodeIterator i = ThisModelPart.NodesBegin() ;
1269  i != ThisModelPart.NodesEnd() ; ++i)
1270  {
1271  if(
1272  (i)->FastGetSolutionStepValue(IS_STRUCTURE) == 0 && //if it is not a wall node
1273  (i)->GetValue(NEIGHBOUR_ELEMENTS).size() == 0 &&//and it is lonely
1274  ((i)->GetDof(DISPLACEMENT_X).IsFixed() == false || (i)->GetDof(DISPLACEMENT_Y).IsFixed() == false || (i)->GetDof(DISPLACEMENT_Z).IsFixed() == false) //and not the node of the wall, where the 0-displ is prescribed
1275 
1276  )
1277  {
1278 
1279  i->Set(TO_ERASE,true);
1280 
1281 
1282 
1283  }
1284 
1285  }
1286 
1287  KRATOS_CATCH("")
1288  }
1289  */
1290 
1291 
1292  //**********************************************************************************************
1293  //**********************************************************************************************
1294 
1295  //function for LAGRANGIAN INLET
1296  void SaveLagrangianInlet(ModelPart& fluid_model_part,ModelPart& lagrangian_inlet_model_part)
1297  {
1298  KRATOS_THROW_ERROR(std::logic_error,"Function SaveLagrangianInlet must be re-implemented (see ulf_utilities) according to new format of creating new nodes","");
1299 /*
1300  int last_id=fluid_model_part.Nodes().size();
1301 
1302  for(ModelPart::NodesContainerType::iterator i_node = fluid_model_part.NodesBegin(); i_node!=fluid_model_part.NodesEnd(); i_node++)
1303  {
1304  //add the node at the inlet IF the move
1305  if (i_node->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET) == 1.0)
1306 
1307  {
1308  NodeType::Pointer p_node(new NodeType(*i_node));
1309  last_id++;
1310  p_node->SetId(last_id);
1311 // p_node->Id()=last_id;
1312  //adding the COPY node
1313 // fluid_model_part.AddNode(p_node);
1314  lagrangian_inlet_model_part.AddNode(p_node);
1315  //and now remove the MASTER node from the fluid_model_part
1316 // fluid_model_part.RemoveNode(*(i_node.base()));
1317 
1318  //note, that EVERYTHING WILL BE DONE just to the FLUID_MODEL_PART, the lagrangian_model_part will just keep the master nodes
1319  //but nothing will be done to them - only their position will be saved
1320  }
1321  }
1322  last_id=fluid_model_part.Nodes().size();
1323  int iii=0;
1324  //reassign the Ids in the lagrangian_model_part nodes:
1325  for(ModelPart::NodesContainerType::iterator i = lagrangian_inlet_model_part.NodesBegin(); i!=lagrangian_inlet_model_part.NodesEnd(); i++)
1326  {
1327  iii++;
1328  i->SetId(iii);
1329 // i->Id()=iii;
1330  }
1331  */
1332  }
1333  //**********************************************************************************************
1334  //**********************************************************************************************
1335  void InjectNodesAtInlet(ModelPart& fluid_model_part,ModelPart& lagrangian_inlet_model_part, float vel_x, float vel_y, float vel_z, float h)//, double& injection_time)
1336  {
1337  KRATOS_THROW_ERROR(std::logic_error,"Function InjectNodesAtInlet must be re-implemented (see ulf_utilities) according to new format of creating new nodes","");
1338 
1339  /*
1340  //double time_step = fluid_model_part.GetProcessInfo()[TIME]/fluid_model_part.GetProcessInfo()[DELTA_TIME];
1341  double last_id=fluid_model_part.Nodes().size();
1342  //copying the nodes at the inlet
1343  double path;
1344  path=0.0;
1345  //double vel=sqrt(vel_x*vel_x+vel_y*vel_y+vel_z*vel_z);
1346  //KRATOS_WATCH(fluid_model_part.GetProcessInfo()[TIME_STEPS])
1347  //KRATOS_WATCH(fluid_model_part.GetProcessInfo()[TIME])
1348  //KRATOS_WATCH(time_step)
1349  //KRATOS_WATCH(vel*fluid_model_part.GetProcessInfo()[TIME])
1350  //KRATOS_WATCH(h*time_step)
1351 
1352  int n_lag_nodes=0;
1353  // int i=0;
1354  for(ModelPart::NodesContainerType::iterator i_node = fluid_model_part.NodesBegin(); i_node!=fluid_model_part.NodesEnd(); i_node++)
1355  {
1356  if (i_node->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET)==1.0)
1357  {
1358  if (i_node->X()>path)
1359  path=i_node->X();
1360  }
1361  //n_lag_nodes++;
1362  }
1363  //if (vel*fluid_model_part.GetProcessInfo()[TIME]>h)
1364  if (path>h)
1365 
1366  //(fluid_model_part.GetProcessInfo()[TIME_STEPS]))
1367 
1368  {
1369  //when the node reached the position such that the new ones have to be injected, we erase the IS_LAGRANGIAN_INLET flag from it
1370  //and let it free (its no more Dirichlet b.c. node)
1371  array_1d<double,10> pres;
1372  pres.resize(n_lag_nodes);
1373 
1374  for(ModelPart::NodesContainerType::iterator i_node = fluid_model_part.NodesBegin(); i_node!=fluid_model_part.NodesEnd(); i_node++)
1375  {
1376  if (i_node->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET)==1.0)
1377  {
1378  i_node->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET)=0.0;
1379  //KRATOS_WATCH("Freeing displ!!!")
1380  i_node->Free(DISPLACEMENT_X);
1381  i_node->Free(DISPLACEMENT_Y);
1382  i_node->Free(DISPLACEMENT_Z);
1383 
1384  //pres[i]=i_node->FastGetSolutionStepValue(PRESSURE);
1385  //i++;
1386  //i_node->FastGetSolutionStepValue(PRESSURE)=0.0;
1387  //i_node->FastGetSolutionStepValue(VELOCITY_Z)=i_node->FastGetSolutionStepValue(VELOCITY_Z,1);
1388  //i_node->FastGetSolutionStepValue(VELOCITY_X,1)=vel_x;
1389  //i_node->FastGetSolutionStepValue(VELOCITY_X)=vel_x;
1390  //i_node->FastGetSolutionStepValue(VELOCITY_Y)=vel_y;
1391  //i_node->FastGetSolutionStepValue(VELOCITY_Z)=vel_z;
1392  }
1393 
1394  }
1395 
1396  // i=0;
1397 
1398  for(ModelPart::NodesContainerType::iterator i_node = lagrangian_inlet_model_part.NodesBegin(); i_node!=lagrangian_inlet_model_part.NodesEnd(); i_node++)
1399  {
1400  NodeType::Pointer p_node(new NodeType(*i_node));
1401  last_id++;
1402  p_node->SetId(last_id);
1403 // p_node->Id()= int(last_id);
1404  //adding the COPY node
1405  fluid_model_part.AddNode(p_node);
1406  //i++;
1407  //p_node->FastGetSolutionStepValue(PRESSURE)=pres[i];
1408  //p_node->FastGetSolutionStepValue(PRESSURE)=0.0;
1409 
1410  //p_node->Fix(DISPLACEMENT_X);
1411  //p_node->Fix(DISPLACEMENT_Y);
1412  //p_node->Fix(DISPLACEMENT_Z);
1413  //note, that EVERYTHING WILL BE DONE just to the FLUID_MODEL_PART, the lagrangian_model_part will just keep the master nodes
1414  //but nothing will be done to them - only their position will be saved
1415 
1416  }
1417  }
1418 
1419  */
1420  }
1421  //**********************************************************************************************
1422  //**********************************************************************************************
1423  void MoveInletNodes(ModelPart& fluid_model_part, float vel_x, float vel_y, float vel_z)
1424  {
1425  double dt = fluid_model_part.GetProcessInfo()[DELTA_TIME];
1426  for(ModelPart::NodesContainerType::iterator i_node = fluid_model_part.NodesBegin(); i_node!=fluid_model_part.NodesEnd(); i_node++)
1427  {
1428  if (i_node->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET)==1)
1429  {
1430  i_node->FastGetSolutionStepValue(DISPLACEMENT_X)=i_node->FastGetSolutionStepValue(DISPLACEMENT_X, 1)+vel_x*dt;
1431  i_node->FastGetSolutionStepValue(VELOCITY_X)=vel_x;
1432  i_node->Fix(DISPLACEMENT_X);
1433  i_node->FastGetSolutionStepValue(DISPLACEMENT_Y)=i_node->FastGetSolutionStepValue(DISPLACEMENT_Y, 1)+vel_y*dt;
1434  i_node->FastGetSolutionStepValue(VELOCITY_Y)=vel_y;
1435  i_node->Fix(DISPLACEMENT_Y);
1436  i_node->FastGetSolutionStepValue(DISPLACEMENT_Z)=i_node->FastGetSolutionStepValue(DISPLACEMENT_Z, 1)+vel_z*dt;
1437  i_node->FastGetSolutionStepValue(VELOCITY_Z)=vel_z;
1438  i_node->Fix(DISPLACEMENT_Z);
1439  }
1440  //if its not a node of lag inolet - make sure that its free
1441 
1442  }
1443 
1444  }
1445 
1446  //**********************************************************************************************
1447  //**********************************************************************************************
1448  //ATTENTION:: returns a negative volume if inverted elements appear
1449  double CalculateVolume(ModelPart& ThisModelPart, int domain_size)
1450  {
1451  KRATOS_TRY;
1452  //KRATOS_WATCH("ENTERED calc vol")
1453  bool inverted_elements = false;
1454  //auxiliary vectors
1455  double Atot = 0.00;
1456  double Ael;
1457  //line added on 28th August in order to be able to use membrane elements, i.e. 3 noded elements in 3D
1458  unsigned int nstruct=0;
1459 
1460  if(domain_size == 2)
1461  {
1462  for(ModelPart::ElementsContainerType::iterator i = ThisModelPart.ElementsBegin();
1463  i!=ThisModelPart.ElementsEnd(); i++)
1464  {
1465  //calculating shape functions values
1466  Geometry< Node >& geom = i->GetGeometry();
1467  for (unsigned int kkk=0; kkk<(i->GetGeometry()).size(); kkk++)
1468  {
1469  //n_struct += int( im->GetGeometry()[i].FastGetSolutionStepValue(IS_STRUCTURE) );
1470  nstruct+= int(i->GetGeometry()[kkk].FastGetSolutionStepValue(IS_STRUCTURE));
1471  }
1472 
1473  if ( nstruct!= ( i->GetGeometry()).size() )
1474  {
1476  Atot += Ael;
1477  if(Ael <= 0)
1478  {
1479  inverted_elements = true;
1480  }
1481  }
1482  nstruct=0;
1483  }
1484 
1485  }
1486  else if (domain_size == 3)
1487  {
1488  for(ModelPart::ElementsContainerType::iterator i = ThisModelPart.ElementsBegin();
1489  i!=ThisModelPart.ElementsEnd(); i++)
1490  {
1491  //calculating shape functions values
1492  Geometry< Node >& geom = i->GetGeometry();
1493  for (unsigned int kkk=0; kkk<(i->GetGeometry()).size(); kkk++)
1494  {
1495  //n_struct += int( im->GetGeometry()[i].FastGetSolutionStepValue(IS_STRUCTURE) );
1496  nstruct+= int(i->GetGeometry()[kkk].FastGetSolutionStepValue(IS_STRUCTURE));
1497  }
1498 
1499 
1500  //if ( (i->GetGeometry()).size()==4 )
1501  if ( nstruct!= ( i->GetGeometry()).size() )
1502  {
1504  Atot += Ael;
1505  if(Ael <= 0) inverted_elements = true;
1506  }
1507  nstruct=0;
1508  }
1509 
1510  }
1511 
1512  //set to negative the volume if inverted elements appear
1513  if( inverted_elements == true)
1514  Atot = -Atot;
1515  //return the total area
1516  //KRATOS_WATCH("FINISHED calc vol LAST!!!!!!!! ")
1517  KRATOS_WATCH(Atot)
1518  return Atot;
1519 
1520  KRATOS_CATCH("");
1521  }
1522 
1523  //**********************************************************************************************
1524  //**********************************************************************************************
1525  void ReduceTimeStep(ModelPart& ThisModelPart, const double reduction_factor)
1526  {
1527  KRATOS_TRY;
1528  KRATOS_WATCH("INSIDE -REDUCE TIME STEP- process")
1529  double old_dt = ThisModelPart.GetProcessInfo()[DELTA_TIME];
1530  double new_dt = reduction_factor * old_dt;
1531  double time = ThisModelPart.GetProcessInfo()[TIME];
1532 
1533  double new_time = time - old_dt + new_dt;
1534  KRATOS_WATCH(time);
1535  KRATOS_WATCH(new_time);
1536  (ThisModelPart.GetProcessInfo()).SetCurrentTime(new_time);
1537  //and now we set the data values to the ones of the previous time
1538 
1539  unsigned int step_data_size = ThisModelPart.GetNodalSolutionStepDataSize();
1540  //KRATOS_WATCH(step_data_size)
1541  for(ModelPart::NodesContainerType::iterator i = ThisModelPart.NodesBegin();
1542  i!=ThisModelPart.NodesEnd(); i++)
1543  {
1544  //unsigned int buffer_size = i->GetBufferSize();
1545 
1546 
1547  //getting the data of the solution step
1548  double* step_data = i->SolutionStepData().Data(0);
1549  double* prev_step_data = i->SolutionStepData().Data(1);
1550 
1551 
1552  //setting it to the old one (we will intend solve the problem now with the reduced step), for every nodal variable
1553  for(unsigned int j= 0; j<step_data_size; j++)
1554  {
1555  step_data[j] = prev_step_data[j];
1556  }
1557 
1558  }
1559 
1560  KRATOS_CATCH("");
1561  }
1562 
1563  //**********************************************************************************************
1564  //**********************************************************************************************
1565  void NodalIncrementalPressureCalculation(const double k, ModelPart& ThisModelPart)
1566  {
1567  KRATOS_TRY;
1568 
1569  //double dt = ThisModelPart.GetProcessInfo()[DELTA_TIME];
1570 
1571  for(ModelPart::NodesContainerType::iterator i = ThisModelPart.NodesBegin();
1572  i!=ThisModelPart.NodesEnd(); i++)
1573  {
1574  if((i)->GetValue(NEIGHBOUR_NODES).size() != 0)
1575  {
1576  //const double& Aold_it = i->FastGetSolutionStepValue(NODAL_AREA,1);
1577  const double& A = i->FastGetSolutionStepValue(NODAL_AREA);
1578  const double& density = i->FastGetSolutionStepValue(DENSITY);
1579 
1580  //area at the beginning of the step - stored in the DataValueContainer
1581  const double& A0 = i->GetValue(NODAL_AREA);
1582 
1583  double pressure_increment = k*density*(A - A0)/A0;
1584 // i->FastGetSolutionStepValue(PRESSURE) = i->FastGetSolutionStepValue(PRESSURE,1)+ pressure_increment;
1585 // double pressure_increment = k*density*(A - Aold_it)/A0;
1586  i->FastGetSolutionStepValue(PRESSURE) += pressure_increment;
1587  }
1588  else
1589  {
1590  i->FastGetSolutionStepValue(PRESSURE) = 0.0;
1591  }
1592 
1593  }
1594 
1595  KRATOS_CATCH("");
1596  }
1597 
1598  //**********************************************************************************************
1599  //**********************************************************************************************
1600  void SaveNodalArea(ModelPart& ThisModelPart)
1601  {
1602  KRATOS_TRY;
1603 
1604  for(ModelPart::NodesContainerType::iterator i = ThisModelPart.NodesBegin();
1605  i!=ThisModelPart.NodesEnd(); i++)
1606  {
1607  i->FastGetSolutionStepValue(NODAL_AREA,1) = i->FastGetSolutionStepValue(NODAL_AREA);
1608  }
1609 
1610  KRATOS_CATCH("");
1611  }
1612 /*
1613  void ClearNodalPressureGrad(ModelPart& ThisModelPart)
1614  {
1615 
1616  KRATOS_TRY
1617 
1618  //set to zero the nodal area
1619  for(ModelPart::NodesContainerType::iterator in = ThisModelPart.NodesBegin();
1620  in!=ThisModelPart.NodesEnd(); in++)
1621  {
1622  array_1d<double,3>& pressure_grad = in->FastGetSolutionStepValue(PRESSURE_GRADIENT);
1623  pressure_grad[0] = 0.0;
1624  pressure_grad[1] = 0.0;
1625  pressure_grad[2] = 0.0;
1626 
1627  }
1628  KRATOS_CATCH("");
1629 
1630  }
1631  void CalculateNodalPressureGrad(ModelPart& ThisModelPart)
1632  {
1633 
1634  KRATOS_TRY
1635 
1636  //set to zero the nodal area
1637  for(ModelPart::NodesContainerType::iterator in = ThisModelPart.NodesBegin();
1638  in!=ThisModelPart.NodesEnd(); in++)
1639  {
1640  const double& area = in->FastGetSolutionStepValue(NODAL_AREA);
1641  array_1d<double,3>& pressure_grad = in->FastGetSolutionStepValue(PRESSURE_GRADIENT);
1642  pressure_grad /= area;
1643 
1644  }
1645  KRATOS_CATCH("");
1646 
1647  }
1648 
1649 */
1650 private:
1651 
1652  //aux vars
1653  static BoundedMatrix<double,3,3> msJ; //local jacobian
1654  static BoundedMatrix<double,3,3> msJinv; //inverse jacobian
1655  static array_1d<double,3> msc; //center pos
1656  static array_1d<double,3> ms_rhs; //center pos
1657 
1658 
1659 };
1660 
1661 } // namespace Kratos.
1662 
1663 #endif // KRATOS_ULF_UTILITIES_INCLUDED defined
1664 
1665 
Geometry base class.
Definition: geometry.h:71
SizeType size() const
Definition: geometry.h:518
static double CalculateVolume2D(const GeometryType &rGeometry)
This function computes the element's volume (with sign)
Definition: geometry_utilities.h:292
static double CalculateVolume3D(const GeometryType &rGeometry)
This function computes the element's volume (with sign)
Definition: geometry_utilities.h:226
This class is a vector which stores global pointers.
Definition: global_pointers_vector.h:61
boost::indirect_iterator< typename TContainerType::iterator > iterator
Definition: global_pointers_vector.h:79
Definition: amatrix_interface.h:41
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
SizeType GetNodalSolutionStepDataSize()
Definition: model_part.h:571
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
MeshType::NodeIterator NodeIterator
Definition: model_part.h:134
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
ElementIterator ElementsEnd(IndexType ThisIndex=0)
Definition: model_part.h:1179
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
This class defines the node.
Definition: node.h:65
Definition: ulf_utilities.h:81
void InjectNodesAtInlet(ModelPart &fluid_model_part, ModelPart &lagrangian_inlet_model_part, float vel_x, float vel_y, float vel_z, float h)
Definition: ulf_utilities.h:1335
void ReduceTimeStep(ModelPart &ThisModelPart, const double reduction_factor)
Definition: ulf_utilities.h:1525
void MarkNodesCloseToFS(ModelPart &ThisModelPart, int domain_size)
Definition: ulf_utilities.h:746
void Predict(ModelPart &ThisModelPart)
Definition: ulf_utilities.h:1191
void MarkNodesCloseToWall(ModelPart &ThisModelPart, int domain_size, double alpha_shape)
Definition: ulf_utilities.h:802
double CalculateFreeSurfaceArea(ModelPart &ThisModelPart, int domain_size)
Definition: ulf_utilities.h:387
void SaveLagrangianInlet(ModelPart &fluid_model_part, ModelPart &lagrangian_inlet_model_part)
Definition: ulf_utilities.h:1296
bool AlphaShape3D(double alpha_param, Geometry< Node > &geom)
Definition: ulf_utilities.h:1089
void IdentifyFluidNodes(ModelPart &ThisModelPart)
Definition: ulf_utilities.h:173
double CalculateTriangleArea3D(array_1d< double, 3 > &Point1, array_1d< double, 3 > &Point2, array_1d< double, 3 > &Point3)
Definition: ulf_utilities.h:376
void SaveNodalArea(ModelPart &ThisModelPart)
Definition: ulf_utilities.h:1600
void ApplyBoundaryConditions(ModelPart &ThisModelPart, int laplacian_type)
Definition: ulf_utilities.h:89
void DeleteFreeSurfaceNodesBladder(ModelPart &ThisModelPart)
Definition: ulf_utilities.h:939
double Length(array_1d< double, 3 > &Point1, array_1d< double, 3 > &Point2)
Definition: ulf_utilities.h:371
void MarkExcessivelyCloseNodes(ModelPart::NodesContainerType &rNodes, const double admissible_distance_factor)
Definition: ulf_utilities.h:700
double EstimateDeltaTime(double dt_min, double dt_max, ModelPart &ThisModelPart)
Definition: ulf_utilities.h:246
void MarkLonelyNodesForErasing(ModelPart &ThisModelPart)
Definition: ulf_utilities.h:962
double CalculateVolume(ModelPart &ThisModelPart, int domain_size)
Definition: ulf_utilities.h:1449
void ApplyMinimalPressureConditions(std::vector< GlobalPointersVector< Node > > &connected_components)
Definition: ulf_utilities.h:192
void RestoreNodalHAtLagInlet(ModelPart &ThisModelPart, double factor)
Definition: ulf_utilities.h:908
void NodalIncrementalPressureCalculation(const double k, ModelPart &ThisModelPart)
Definition: ulf_utilities.h:1565
void MarkNodesTouchingWall(ModelPart &ThisModelPart, int domain_size, double factor)
Definition: ulf_utilities.h:497
void MarkNodesCloseToWallForBladder(ModelPart &ThisModelPart, const double &crit_distance)
Definition: ulf_utilities.h:788
void MarkOuterNodes(const array_1d< double, 3 > &corner1, const array_1d< double, 3 > &corner2, ModelPart::NodesContainerType &rNodes)
Definition: ulf_utilities.h:299
void MoveLonelyNodes(ModelPart &ThisModelPart)
Definition: ulf_utilities.h:1216
bool AlphaShape(double alpha_param, Geometry< Node > &pgeom)
Definition: ulf_utilities.h:1008
void MoveInletNodes(ModelPart &fluid_model_part, float vel_x, float vel_y, float vel_z)
Definition: ulf_utilities.h:1423
Node NodeType
Definition: ulf_utilities.h:83
void CalculateNodalArea(ModelPart &ThisModelPart, int domain_size)
Definition: ulf_utilities.h:432
void SetNodalHAtLagInlet(ModelPart &ThisModelPart, double factor)
Definition: ulf_utilities.h:884
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_WATCH(variable)
Definition: define.h:806
#define KRATOS_TRY
Definition: define.h:109
dt
Definition: DEM_benchmarks.py:173
z
Definition: GenerateWind.py:163
Parameters GetValue(Parameters &rParameters, const std::string &rEntry)
Definition: add_kratos_parameters_to_python.cpp:53
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
TExpressionType::data_type norm_2(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression)
Definition: amatrix_interface.h:625
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
TExpression1Type::data_type inner_prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:592
AMatrix::VectorOuterProductExpression< TExpression1Type, TExpression2Type > outer_prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:582
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
REACTION_CHECK_STIFFNESS_FACTOR int
Definition: contact_structural_mechanics_application_variables.h:75
float zmax
Definition: cube_mesher.py:747
float xmax
Definition: cube_mesher.py:743
float ymax
Definition: cube_mesher.py:745
float xmin
Definition: cube_mesher.py:742
float zmin
Definition: cube_mesher.py:746
float ymin
Definition: cube_mesher.py:744
fluid_model_part
Definition: edgebased_PureConvection.py:18
int domain_size
Definition: face_heat.py:4
time
Definition: face_heat.py:85
Dt
Definition: face_heat.py:78
float density
Definition: face_heat.py:56
y
Other simbols definition.
Definition: generate_axisymmetric_navier_stokes_element.py:54
h
Definition: generate_droplet_dynamics.py:91
x2
Definition: generate_frictional_mortar_condition.py:122
rhs
Definition: generate_frictional_mortar_condition.py:297
x1
Definition: generate_frictional_mortar_condition.py:121
a
Definition: generate_stokes_twofluid_element.py:77
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
c
Definition: generate_weakly_compressible_navier_stokes_element.py:108
list node_list
Definition: mesh_to_mdpa_converter.py:39
float radius
Definition: mesh_to_mdpa_converter.py:18
vel
Definition: pure_conduction.py:76
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
float xc
Definition: rotating_cone.py:77
alpha_shape
Definition: script.py:120
J
Definition: sensitivityMatrix.py:58
A
Definition: sensitivityMatrix.py:70
p
Definition: sensitivityMatrix.py:52
x
Definition: sensitivityMatrix.py:49
integer i
Definition: TensorModule.f:17
e
Definition: run_cpp_mpi_tests.py:31
float factor
for node in (self.combined_model_part).Nodes: pold = node.GetSolutionStepValue(PRESSURE,...
Definition: ulf_PGLASS.py:254