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.
vms.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ \.
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Jordi Cotela
11 //
12 
13 
14 #if !defined(KRATOS_VMS_H_INCLUDED )
15 #define KRATOS_VMS_H_INCLUDED
16 
17 // System includes
18 #include <string>
19 #include <iostream>
20 
21 
22 // External includes
23 
24 
25 // Project includes
26 #include "containers/array_1d.h"
27 #include "includes/checks.h"
28 #include "includes/define.h"
29 #include "includes/element.h"
30 #include "includes/serializer.h"
31 #include "includes/cfd_variables.h"
32 #include "utilities/geometry_utilities.h"
33 
34 // Application includes
36 
37 namespace Kratos
38 {
39 
42 
45 
49 
53 
57 
61 
63 
101 template< unsigned int TDim,
102  unsigned int TNumNodes = TDim + 1 >
103 class VMS : public Element
104 {
105 public:
108 
111 
114 
116  typedef Node NodeType;
117 
123 
126 
129 
131 
133 
134  typedef std::size_t IndexType;
135 
136  typedef std::size_t SizeType;
137 
138  typedef std::vector<std::size_t> EquationIdVectorType;
139 
140  typedef std::vector< Dof<double>::Pointer > DofsVectorType;
141 
143 
146 
150 
151  //Constructors.
152 
154 
157  VMS(IndexType NewId = 0) :
158  Element(NewId)
159  {}
160 
162 
166  VMS(IndexType NewId, const NodesArrayType& ThisNodes) :
167  Element(NewId, ThisNodes)
168  {}
169 
171 
175  VMS(IndexType NewId, GeometryType::Pointer pGeometry) :
176  Element(NewId, pGeometry)
177  {}
178 
180 
185  VMS(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties) :
186  Element(NewId, pGeometry, pProperties)
187  {}
188 
190  ~VMS() override
191  {}
192 
193 
197 
198 
202 
204 
211  Element::Pointer Create(IndexType NewId, NodesArrayType const& ThisNodes,
212  PropertiesType::Pointer pProperties) const override
213  {
214  return Kratos::make_intrusive< VMS<TDim, TNumNodes> >(NewId, GetGeometry().Create(ThisNodes), pProperties);
215  }
216 
217  Element::Pointer Create(IndexType NewId,
218  GeometryType::Pointer pGeom,
219  PropertiesType::Pointer pProperties) const override
220  {
221  return Kratos::make_intrusive< VMS<TDim, TNumNodes> >(NewId, pGeom, pProperties);
222  }
223 
225 
234  void CalculateLocalSystem(MatrixType& rLeftHandSideMatrix,
235  VectorType& rRightHandSideVector,
236  const ProcessInfo& rCurrentProcessInfo) override
237  {
238  const unsigned int LocalSize = (TDim + 1) * TNumNodes;
239 
240  // Check sizes and initialize matrix
241  if (rLeftHandSideMatrix.size1() != LocalSize)
242  rLeftHandSideMatrix.resize(LocalSize, LocalSize, false);
243 
244  noalias(rLeftHandSideMatrix) = ZeroMatrix(LocalSize, LocalSize);
245 
246  // Calculate RHS
247  this->CalculateRightHandSide(rRightHandSideVector, rCurrentProcessInfo);
248  }
249 
251 
255  void CalculateLeftHandSide(MatrixType& rLeftHandSideMatrix,
256  const ProcessInfo& rCurrentProcessInfo) override
257  {
258  const unsigned int LocalSize = (TDim + 1) * TNumNodes;
259 
260  if (rLeftHandSideMatrix.size1() != LocalSize)
261  rLeftHandSideMatrix.resize(LocalSize, LocalSize, false);
262 
263  noalias(rLeftHandSideMatrix) = ZeroMatrix(LocalSize, LocalSize);
264  }
265 
267 
276  void CalculateRightHandSide(VectorType& rRightHandSideVector,
277  const ProcessInfo& rCurrentProcessInfo) override
278  {
279  const unsigned int LocalSize = (TDim + 1) * TNumNodes;
280 
281  // Check sizes and initialize
282  if (rRightHandSideVector.size() != LocalSize)
283  rRightHandSideVector.resize(LocalSize, false);
284 
285  noalias(rRightHandSideVector) = ZeroVector(LocalSize);
286 
287  // Calculate this element's geometric parameters
288  double Area;
291  GeometryUtils::CalculateGeometryData(this->GetGeometry(), DN_DX, N, Area);
292 
293  // Calculate this element's fluid properties
294  double Density;
295  this->EvaluateInPoint(Density, DENSITY, N);
296 
297  // Calculate Momentum RHS contribution
298  this->AddMomentumRHS(rRightHandSideVector, Density, N, Area);
299 
300  // For OSS: Add projection of residuals to RHS
301  const ProcessInfo& r_const_process_info = rCurrentProcessInfo;
302  if (r_const_process_info[OSS_SWITCH] == 1)
303  {
304  array_1d<double, 3 > AdvVel;
305  this->GetAdvectiveVel(AdvVel, N);
306 
307  double ElemSize = this->ElementSize(Area);
308  double Viscosity = this->EffectiveViscosity(Density,N,DN_DX,ElemSize,rCurrentProcessInfo);
309 
310  // stabilization parameters
311  double TauOne, TauTwo;
312  this->CalculateTau(TauOne,TauTwo,AdvVel,ElemSize,Density,Viscosity,rCurrentProcessInfo);
313 
314  this->AddProjectionToRHS(rRightHandSideVector, AdvVel, Density, TauOne, TauTwo, N, DN_DX, Area,rCurrentProcessInfo[DELTA_TIME]);
315  }
316  }
317 
319 
326  void CalculateMassMatrix(MatrixType& rMassMatrix, const ProcessInfo& rCurrentProcessInfo) override
327  {
328  const unsigned int LocalSize = (TDim + 1) * TNumNodes;
329 
330  // Resize and set to zero
331  if (rMassMatrix.size1() != LocalSize)
332  rMassMatrix.resize(LocalSize, LocalSize, false);
333 
334  rMassMatrix = ZeroMatrix(LocalSize, LocalSize);
335 
336  // Get the element's geometric parameters
337  double Area;
340  GeometryUtils::CalculateGeometryData(this->GetGeometry(), DN_DX, N, Area);
341 
342  // Calculate this element's fluid properties
343  double Density;
344  this->EvaluateInPoint(Density, DENSITY, N);
345 
346  // Add 'classical' mass matrix (lumped)
347  double Coeff = Density * Area / TNumNodes; //Optimize!
348  this->CalculateLumpedMassMatrix(rMassMatrix, Coeff);
349 
350  /* For ASGS: add dynamic stabilization terms.
351  These terms are not used in OSS, as they belong to the finite element
352  space and cancel out with their projections.
353  */
354  const ProcessInfo& r_const_process_info = rCurrentProcessInfo;
355  if (r_const_process_info[OSS_SWITCH] != 1)
356  {
357  double ElemSize = this->ElementSize(Area);
358  double Viscosity = this->EffectiveViscosity(Density,N,DN_DX,ElemSize,rCurrentProcessInfo);
359 
360  // Get Advective velocity
361  array_1d<double, 3 > AdvVel;
362  this->GetAdvectiveVel(AdvVel, N);
363 
364  // stabilization parameters
365  double TauOne, TauTwo;
366  this->CalculateTau(TauOne,TauTwo,AdvVel,ElemSize,Density,Viscosity,rCurrentProcessInfo);
367 
368  // Add dynamic stabilization terms ( all terms involving a delta(u) )
369  this->AddMassStabTerms(rMassMatrix, Density, AdvVel, TauOne, N, DN_DX, Area);
370  }
371  }
372 
374 
383  VectorType& rRightHandSideVector,
384  const ProcessInfo& rCurrentProcessInfo) override
385  {
386  const unsigned int LocalSize = (TDim + 1) * TNumNodes;
387 
388  // Resize and set to zero the matrix
389  // Note that we don't clean the RHS because it will already contain body force (and stabilization) contributions
390  if (rDampingMatrix.size1() != LocalSize)
391  rDampingMatrix.resize(LocalSize, LocalSize, false);
392 
393  noalias(rDampingMatrix) = ZeroMatrix(LocalSize, LocalSize);
394 
395  // Get this element's geometric properties
396  double Area;
399  GeometryUtils::CalculateGeometryData(this->GetGeometry(), DN_DX, N, Area);
400 
401  // Calculate this element's fluid properties
402  double Density;
403  this->EvaluateInPoint(Density, DENSITY, N);
404 
405  double ElemSize = this->ElementSize(Area);
406  double Viscosity = this->EffectiveViscosity(Density,N,DN_DX,ElemSize,rCurrentProcessInfo);
407 
408  // Get Advective velocity
409  array_1d<double, 3 > AdvVel;
410  this->GetAdvectiveVel(AdvVel, N);
411 
412  // stabilization parameters
413  double TauOne, TauTwo;
414  this->CalculateTau(TauOne,TauTwo,AdvVel,ElemSize,Density,Viscosity,rCurrentProcessInfo);
415 
416  this->AddIntegrationPointVelocityContribution(rDampingMatrix, rRightHandSideVector, Density, Viscosity, AdvVel, TauOne, TauTwo, N, DN_DX, Area);
417 
418  // Now calculate an additional contribution to the residual: r -= rDampingMatrix * (u,p)
419  VectorType U = ZeroVector(LocalSize);
420  int LocalIndex = 0;
421 
422  for (unsigned int iNode = 0; iNode < TNumNodes; ++iNode)
423  {
424  array_1d< double, 3 > & rVel = this->GetGeometry()[iNode].FastGetSolutionStepValue(VELOCITY);
425  for (unsigned int d = 0; d < TDim; ++d) // Velocity Dofs
426  {
427  U[LocalIndex] = rVel[d];
428  ++LocalIndex;
429  }
430  U[LocalIndex] = this->GetGeometry()[iNode].FastGetSolutionStepValue(PRESSURE); // Pressure Dof
431  ++LocalIndex;
432  }
433 
434  noalias(rRightHandSideVector) -= prod(rDampingMatrix, U);
435  }
436 
437  void FinalizeNonLinearIteration(const ProcessInfo& rCurrentProcessInfo) override
438  {
439  }
440 
442 
454  void Calculate(const Variable<double>& rVariable,
455  double& rOutput,
456  const ProcessInfo& rCurrentProcessInfo) override
457  {
458  if (rVariable == ERROR_RATIO)
459  {
460  rOutput = this->SubscaleErrorEstimate(rCurrentProcessInfo);
461  this->SetValue(ERROR_RATIO,rOutput);
462  }
463  else if (rVariable == NODAL_AREA)
464  {
465  // Get the element's geometric parameters
466  double Area;
469  GeometryUtils::CalculateGeometryData(this->GetGeometry(), DN_DX, N, Area);
470 
471  // Carefully write results to nodal variables, to avoid parallelism problems
472  for (unsigned int i = 0; i < TNumNodes; ++i)
473  {
474  this->GetGeometry()[i].SetLock(); // So it is safe to write in the node in OpenMP
475  this->GetGeometry()[i].FastGetSolutionStepValue(NODAL_AREA) += Area * N[i];
476  this->GetGeometry()[i].UnSetLock(); // Free the node for other threads
477  }
478  }
479  }
480 
482 
493  void Calculate(const Variable<array_1d<double, 3 > >& rVariable,
494  array_1d<double, 3 > & rOutput,
495  const ProcessInfo& rCurrentProcessInfo) override
496  {
497  if (rVariable == ADVPROJ) // Compute residual projections for OSS
498  {
499  // Get the element's geometric parameters
500  double Area;
503  GeometryUtils::CalculateGeometryData(this->GetGeometry(), DN_DX, N, Area);
504 
505  // Calculate this element's fluid properties
506  double Density;
507  this->EvaluateInPoint(Density, DENSITY, N);
508 
509  // Get Advective velocity
510  array_1d<double, 3 > AdvVel;
511  this->GetAdvectiveVel(AdvVel, N);
512 
513  // Output containers
514  array_1d< double, 3 > ElementalMomRes = ZeroVector(3);
515  double ElementalMassRes(0);
516 
517  this->AddProjectionResidualContribution(AdvVel, Density, ElementalMomRes, ElementalMassRes, N, DN_DX, Area);
518 
519  if (rCurrentProcessInfo[OSS_SWITCH] == 1)
520  {
521  // Carefully write results to nodal variables, to avoid parallelism problems
522  for (unsigned int i = 0; i < TNumNodes; ++i)
523  {
524  this->GetGeometry()[i].SetLock(); // So it is safe to write in the node in OpenMP
525  array_1d< double, 3 > & rAdvProj = this->GetGeometry()[i].FastGetSolutionStepValue(ADVPROJ);
526  for (unsigned int d = 0; d < TDim; ++d)
527  rAdvProj[d] += N[i] * ElementalMomRes[d];
528 
529  this->GetGeometry()[i].FastGetSolutionStepValue(DIVPROJ) += N[i] * ElementalMassRes;
530  this->GetGeometry()[i].FastGetSolutionStepValue(NODAL_AREA) += Area * N[i];
531  this->GetGeometry()[i].UnSetLock(); // Free the node for other threads
532  }
533  }
534 
536  rOutput = ElementalMomRes;
537  }
538  else if (rVariable == SUBSCALE_VELOCITY)
539  {
540  // Get the element's geometric parameters
541  double Area;
544  GeometryUtils::CalculateGeometryData(this->GetGeometry(), DN_DX, N, Area);
545 
546  // Calculate this element's fluid properties
547  double Density;
548  this->EvaluateInPoint(Density, DENSITY, N);
549 
550  // Get Advective velocity
551  array_1d<double, 3 > AdvVel;
552  this->GetAdvectiveVel(AdvVel, N);
553 
554  // Output containers
555  array_1d< double, 3 > ElementalMomRes = ZeroVector(3);
556  double ElementalMassRes(0.0);
557 
558  this->AddProjectionResidualContribution(AdvVel, Density, ElementalMomRes, ElementalMassRes, N, DN_DX, Area);
559 
560  if (rCurrentProcessInfo[OSS_SWITCH] == 1)
561  {
562  /* Projections of the elemental residual are computed with
563  * Newton-Raphson iterations of type M(lumped) dx = ElemRes - M(consistent) * x
564  */
565  const double Weight = ConsistentMassCoef(Area); // Consistent mass matrix is Weigth * ( Ones(TNumNodes,TNumNodes) + Identity(TNumNodes,TNumNodes) )
566  // Carefully write results to nodal variables, to avoid parallelism problems
567  for (unsigned int i = 0; i < TNumNodes; ++i)
568  {
569  this->GetGeometry()[i].SetLock(); // So it is safe to write in the node in OpenMP
570 
571  // Add elemental residual to RHS
572  array_1d< double, 3 > & rMomRHS = this->GetGeometry()[i].GetValue(ADVPROJ);
573  double& rMassRHS = this->GetGeometry()[i].GetValue(DIVPROJ);
574  for (unsigned int d = 0; d < TDim; ++d)
575  rMomRHS[d] += N[i] * ElementalMomRes[d];
576 
577  rMassRHS += N[i] * ElementalMassRes;
578 
579  // Write nodal area
580  this->GetGeometry()[i].FastGetSolutionStepValue(NODAL_AREA) += Area * N[i];
581 
582  // Substract M(consistent)*x(i-1) from RHS
583  for(unsigned int j = 0; j < TNumNodes; ++j) // RHS -= Weigth * Ones(TNumNodes,TNumNodes) * x(i-1)
584  {
585  for(unsigned int d = 0; d < TDim; ++d)
586  rMomRHS[d] -= Weight * this->GetGeometry()[j].FastGetSolutionStepValue(ADVPROJ)[d];
587  rMassRHS -= Weight * this->GetGeometry()[j].FastGetSolutionStepValue(DIVPROJ);
588  }
589  for(unsigned int d = 0; d < TDim; ++d) // RHS -= Weigth * Identity(TNumNodes,TNumNodes) * x(i-1)
590  rMomRHS[d] -= Weight * this->GetGeometry()[i].FastGetSolutionStepValue(ADVPROJ)[d];
591  rMassRHS -= Weight * this->GetGeometry()[i].FastGetSolutionStepValue(DIVPROJ);
592 
593  this->GetGeometry()[i].UnSetLock(); // Free the node for other threads
594  }
595  }
596 
598  rOutput = ElementalMomRes;
599  }
600  }
601 
602  // The following methods have different implementations depending on TDim
604 
611  const ProcessInfo& rCurrentProcessInfo) const override;
612 
614 
618  void GetDofList(DofsVectorType& rElementalDofList,
619  const ProcessInfo& rCurrentProcessInfo) const override;
620 
622 
626  void GetFirstDerivativesVector(Vector& Values, int Step = 0) const override;
627 
629 
633  void GetSecondDerivativesVector(Vector& Values, int Step = 0) const override;
634 
636 
646  const Variable<array_1d<double, 3 > >& rVariable,
647  std::vector<array_1d<double, 3 > >& rOutput,
648  const ProcessInfo& rCurrentProcessInfo) override;
649 
651 
663  const Variable<double>& rVariable,
664  std::vector<double>& rValues,
665  const ProcessInfo& rCurrentProcessInfo) override
666  {
667  if (rVariable == TAUONE || rVariable == TAUTWO || rVariable == MU || rVariable == TAU)
668  {
669  double Area;
672  GeometryUtils::CalculateGeometryData(this->GetGeometry(), DN_DX, N, Area);
673 
674  array_1d<double, 3 > AdvVel;
675  this->GetAdvectiveVel(AdvVel, N);
676 
677  double Density;
678  this->EvaluateInPoint(Density,DENSITY,N);
679 
680  double ElemSize = this->ElementSize(Area);
681  double Viscosity = this->EffectiveViscosity(Density,N,DN_DX,ElemSize,rCurrentProcessInfo);
682 
683  // stabilization parameters
684  double TauOne, TauTwo;
685  this->CalculateTau(TauOne,TauTwo,AdvVel,ElemSize,Density,Viscosity,rCurrentProcessInfo);
686 
687 
688  rValues.resize(1, false);
689  if (rVariable == TAUONE)
690  {
691  rValues[0] = TauOne;
692  }
693  else if (rVariable == TAUTWO)
694  {
695  rValues[0] = TauTwo;
696  }
697  else if (rVariable == MU)
698  {
699  rValues[0] = Viscosity;
700  }
701  else if (rVariable == TAU)
702  {
703  double NormS = this->EquivalentStrainRate(DN_DX);
704  rValues[0] = Viscosity*NormS;
705  }
706  }
707  else if (rVariable == EQ_STRAIN_RATE)
708  {
709  double Area;
712  GeometryUtils::CalculateGeometryData(this->GetGeometry(), DN_DX, N, Area);
713 
714  rValues.resize(1, false);
715  rValues[0] = this->EquivalentStrainRate(DN_DX);
716  }
717  else if(rVariable == SUBSCALE_PRESSURE)
718  {
719  double Area;
722  GeometryUtils::CalculateGeometryData(this->GetGeometry(), DN_DX, N, Area);
723 
724  array_1d<double, 3 > AdvVel;
725  this->GetAdvectiveVel(AdvVel, N);
726 
727  double Density;
728  this->EvaluateInPoint(Density,DENSITY,N);
729 
730  double ElemSize = this->ElementSize(Area);
731  double Viscosity = this->EffectiveViscosity(Density,N,DN_DX,ElemSize,rCurrentProcessInfo);
732 
733  // stabilization parameters
734  double TauOne, TauTwo;
735  this->CalculateTau(TauOne,TauTwo,AdvVel,ElemSize,Density,Viscosity,rCurrentProcessInfo);
736 
737  double DivU = 0.0;
738  for(unsigned int i=0; i < TNumNodes; i++)
739  {
740  for(unsigned int d = 0; d < TDim; d++)
741  DivU -= DN_DX(i,d) * this->GetGeometry()[i].FastGetSolutionStepValue(VELOCITY)[d];
742  }
743 
744  rValues.resize(1, false);
745  rValues[0] = TauTwo * DivU;
746  if(rCurrentProcessInfo[OSS_SWITCH]==1)
747  {
748  double Proj = 0.0;
749  for(unsigned int i=0; i < TNumNodes; i++)
750  {
751  Proj += N[i]*this->GetGeometry()[i].FastGetSolutionStepValue(DIVPROJ);
752  }
753  rValues[0] -= TauTwo*Proj;
754  }
755  }
756  else if (rVariable == NODAL_AREA && TDim == 3)
757  {
758  MatrixType J = ZeroMatrix(3,3);
759  const array_1d<double,3>& X0 = this->GetGeometry()[0].Coordinates();
760  const array_1d<double,3>& X1 = this->GetGeometry()[1].Coordinates();
761  const array_1d<double,3>& X2 = this->GetGeometry()[2].Coordinates();
762  const array_1d<double,3>& X3 = this->GetGeometry()[3].Coordinates();
763 
764  J(0,0) = X1[0]-X0[0];
765  J(0,1) = X2[0]-X0[0];
766  J(0,2) = X3[0]-X0[0];
767  J(1,0) = X1[1]-X0[1];
768  J(1,1) = X2[1]-X0[1];
769  J(1,2) = X3[1]-X0[1];
770  J(2,0) = X1[2]-X0[2];
771  J(2,1) = X2[2]-X0[2];
772  J(2,2) = X3[2]-X0[2];
773 
774  double DetJ = J(0,0)*( J(1,1)*J(2,2) - J(1,2)*J(2,1) ) + J(0,1)*( J(1,2)*J(2,0) - J(1,0)*J(2,2) ) + J(0,2)*( J(1,0)*J(2,1) - J(1,1)*J(2,0) );
775  rValues.resize(1, false);
776  rValues[0] = DetJ;
777  }
778  else if (rVariable == ERROR_RATIO)
779  {
780  rValues.resize(1,false);
781  rValues[0] = this->SubscaleErrorEstimate(rCurrentProcessInfo);
782  }
783  else // Default behaviour (returns elemental data)
784  {
785  rValues.resize(1, false);
786  /*
787  The cast is done to avoid modification of the element's data. Data modification
788  would happen if rVariable is not stored now (would initialize a pointer to &rVariable
789  with associated value of 0.0). This is catastrophic if the variable referenced
790  goes out of scope.
791  */
792  const VMS<TDim, TNumNodes>* const_this = static_cast<const VMS<TDim, TNumNodes>*> (this);
793  rValues[0] = const_this->GetValue(rVariable);
794  }
795  }
796 
799  const Variable<array_1d<double, 6 > >& rVariable,
800  std::vector<array_1d<double, 6 > >& rValues,
801  const ProcessInfo& rCurrentProcessInfo) override
802  {}
803 
806  const Variable<Vector>& rVariable,
807  std::vector<Vector>& rValues,
808  const ProcessInfo& rCurrentProcessInfo) override
809  {}
810 
813  const Variable<Matrix>& rVariable,
814  std::vector<Matrix>& rValues,
815  const ProcessInfo& rCurrentProcessInfo) override
816  {}
817 
821 
825 
827 
835  int Check(const ProcessInfo& rCurrentProcessInfo) const override
836  {
837  KRATOS_TRY
838 
839  // Perform basic element checks
840  int ErrorCode = Kratos::Element::Check(rCurrentProcessInfo);
841  if(ErrorCode != 0) return ErrorCode;
842 
843  // Checks on nodes
844 
845  // Check that the element's nodes contain all required SolutionStepData and Degrees of freedom
846  for(unsigned int i=0; i<this->GetGeometry().size(); ++i)
847  {
848  const auto &rNode = this->GetGeometry()[i];
849  KRATOS_CHECK_VARIABLE_IN_NODAL_DATA(VELOCITY,rNode);
850  KRATOS_CHECK_VARIABLE_IN_NODAL_DATA(PRESSURE,rNode);
851  KRATOS_CHECK_VARIABLE_IN_NODAL_DATA(MESH_VELOCITY,rNode);
852  KRATOS_CHECK_VARIABLE_IN_NODAL_DATA(ACCELERATION,rNode);
854  KRATOS_CHECK_VARIABLE_IN_NODAL_DATA(VISCOSITY,rNode);
855  KRATOS_CHECK_VARIABLE_IN_NODAL_DATA(BODY_FORCE,rNode);
856  // Not checking OSS related variables NODAL_AREA, ADVPROJ, DIVPROJ, which are only required as SolutionStepData if OSS_SWITCH == 1
857 
858  KRATOS_CHECK_DOF_IN_NODE(VELOCITY_X,rNode);
859  KRATOS_CHECK_DOF_IN_NODE(VELOCITY_Y,rNode);
860  if constexpr (TDim == 3) KRATOS_CHECK_DOF_IN_NODE(VELOCITY_Z,rNode);
861  KRATOS_CHECK_DOF_IN_NODE(PRESSURE,rNode);
862  }
863  // Not checking OSS related variables NODAL_AREA, ADVPROJ, DIVPROJ, which are only required as SolutionStepData if OSS_SWITCH == 1
864 
865  // If this is a 2D problem, check that nodes are in XY plane
866  if (this->GetGeometry().WorkingSpaceDimension() == 2)
867  {
868  for (unsigned int i=0; i<this->GetGeometry().size(); ++i)
869  {
870  if (this->GetGeometry()[i].Z() != 0.0)
871  KRATOS_ERROR << "Node " << this->GetGeometry()[i].Id() << "has non-zero Z coordinate." << std::endl;
872  }
873  }
874 
875  return 0;
876 
877  KRATOS_CATCH("");
878  }
879 
883 
884 
888 
890  std::string Info() const override
891  {
892  std::stringstream buffer;
893  buffer << "VMS #" << Id();
894  return buffer.str();
895  }
896 
898  void PrintInfo(std::ostream& rOStream) const override
899  {
900  rOStream << "VMS" << TDim << "D";
901  }
902 
903 // /// Print object's data.
904 // virtual void PrintData(std::ostream& rOStream) const;
905 
909 
910 
912 
913 protected:
916 
917 
921 
922 
926 
927 
931 
933 
945  virtual void CalculateTau(double& TauOne,
946  double& TauTwo,
947  const array_1d< double, 3 > & rAdvVel,
948  const double ElemSize,
949  const double Density,
950  const double Viscosity,
951  const ProcessInfo& rCurrentProcessInfo)
952  {
953  // Compute mean advective velocity norm
954  double AdvVelNorm = 0.0;
955  for (unsigned int d = 0; d < TDim; ++d)
956  AdvVelNorm += rAdvVel[d] * rAdvVel[d];
957 
958  AdvVelNorm = sqrt(AdvVelNorm);
959 
960  double InvTau = Density * ( rCurrentProcessInfo[DYNAMIC_TAU] / rCurrentProcessInfo[DELTA_TIME] + 2.0*AdvVelNorm / ElemSize ) + 4.0*Viscosity/ (ElemSize * ElemSize);
961  TauOne = 1.0 / InvTau;
962  TauTwo = Viscosity + 0.5 * Density * ElemSize * AdvVelNorm;
963  }
964 
966 
976  virtual void CalculateStaticTau(double& TauOne,
977  const array_1d< double, 3 > & rAdvVel,
978  const double ElemSize,
979  const double Density,
980  const double Viscosity)
981  {
982  // Compute mean advective velocity norm
983  double AdvVelNorm = 0.0;
984  for (unsigned int d = 0; d < TDim; ++d)
985  AdvVelNorm += rAdvVel[d] * rAdvVel[d];
986 
987  AdvVelNorm = sqrt(AdvVelNorm);
988 
989  double InvTau = 2.0*Density*AdvVelNorm / ElemSize + 4.0*Viscosity/ (ElemSize * ElemSize);
990  TauOne = 1.0 / InvTau;
991  }
992 
994  virtual void AddMomentumRHS(VectorType& F,
995  const double Density,
996  const array_1d<double, TNumNodes>& rShapeFunc,
997  const double Weight)
998  {
999  double Coef = Density * Weight;
1000 
1001  array_1d<double, 3 > BodyForce = ZeroVector(3);
1002  this->EvaluateInPoint(BodyForce, BODY_FORCE, rShapeFunc);
1003 
1004  // Add the results to the velocity components (Local Dofs are vx, vy, [vz,] p for each node)
1005  int LocalIndex = 0;
1006 
1007  for (unsigned int iNode = 0; iNode < TNumNodes; ++iNode)
1008  {
1009  for (unsigned int d = 0; d < TDim; ++d)
1010  {
1011  F[LocalIndex++] += Coef * rShapeFunc[iNode] * BodyForce[d];
1012  }
1013  ++LocalIndex; // Skip pressure Dof
1014  }
1015  }
1016 
1018  virtual void AddProjectionToRHS(VectorType& RHS,
1019  const array_1d<double, 3 > & rAdvVel,
1020  const double Density,
1021  const double TauOne,
1022  const double TauTwo,
1023  const array_1d<double, TNumNodes>& rShapeFunc,
1024  const BoundedMatrix<double, TNumNodes, TDim>& rShapeDeriv,
1025  const double Weight,
1026  const double DeltaTime = 1.0)
1027  {
1028  const unsigned int BlockSize = TDim + 1;
1029 
1031  this->GetConvectionOperator(AGradN, rAdvVel, rShapeDeriv); // Get a * grad(Ni)
1032 
1033  array_1d<double,3> MomProj = ZeroVector(3);
1034  double DivProj = 0.0;
1035  this->EvaluateInPoint(MomProj,ADVPROJ,rShapeFunc);
1036  this->EvaluateInPoint(DivProj,DIVPROJ,rShapeFunc);
1037 
1038  MomProj *= TauOne;
1039  DivProj *= TauTwo;
1040 
1041  unsigned int FirstRow = 0;
1042 
1043  for (unsigned int i = 0; i < TNumNodes; i++)
1044  {
1045  for (unsigned int d = 0; d < TDim; d++)
1046  {
1047  RHS[FirstRow+d] -= Weight * (Density * AGradN[i] * MomProj[d] + rShapeDeriv(i,d) * DivProj); // TauOne * ( a * Grad(v) ) * MomProjection + TauTwo * Div(v) * MassProjection
1048  RHS[FirstRow+TDim] -= Weight * rShapeDeriv(i,d) * MomProj[d]; // TauOne * Grad(q) * MomProjection
1049  }
1050  FirstRow += BlockSize;
1051  }
1052  }
1053 
1055 
1062  const double Mass)
1063  {
1064  unsigned int DofIndex = 0;
1065  for (unsigned int iNode = 0; iNode < TNumNodes; ++iNode)
1066  {
1067  for (unsigned int d = 0; d < TDim; ++d)
1068  {
1069  rLHSMatrix(DofIndex, DofIndex) += Mass;
1070  ++DofIndex;
1071  }
1072  ++DofIndex; // Skip pressure Dof
1073  }
1074  }
1075 
1077  const array_1d<double,TNumNodes>& rShapeFunc,
1078  const double Density,
1079  const double Weight)
1080  {
1081  const unsigned int BlockSize = TDim + 1;
1082 
1083  double Coef = Density * Weight;
1084  unsigned int FirstRow(0), FirstCol(0);
1085  double K; // Temporary results
1086 
1087  // Note: Dof order is (vx,vy,[vz,]p) for each node
1088  for (unsigned int i = 0; i < TNumNodes; ++i)
1089  {
1090  // Loop over columns
1091  for (unsigned int j = 0; j < TNumNodes; ++j)
1092  {
1093  // Delta(u) * TauOne * [ AdvVel * Grad(v) ] in velocity block
1094  K = Coef * rShapeFunc[i] * rShapeFunc[j];
1095 
1096  for (unsigned int d = 0; d < TDim; ++d) // iterate over dimensions for velocity Dofs in this node combination
1097  {
1098  rLHSMatrix(FirstRow + d, FirstCol + d) += K;
1099  }
1100  // Update column index
1101  FirstCol += BlockSize;
1102  }
1103  // Update matrix indices
1104  FirstRow += BlockSize;
1105  FirstCol = 0;
1106  }
1107  }
1108 
1109 
1111 
1123  void AddMassStabTerms(MatrixType& rLHSMatrix,
1124  const double Density,
1125  const array_1d<double, 3 > & rAdvVel,
1126  const double TauOne,
1127  const array_1d<double, TNumNodes>& rShapeFunc,
1128  const BoundedMatrix<double, TNumNodes, TDim>& rShapeDeriv,
1129  const double Weight)
1130  {
1131  const unsigned int BlockSize = TDim + 1;
1132 
1133  double Coef = Weight * TauOne;
1134  unsigned int FirstRow(0), FirstCol(0);
1135  double K; // Temporary results
1136 
1137  // If we want to use more than one Gauss point to integrate the convective term, this has to be evaluated once per integration point
1139  this->GetConvectionOperator(AGradN, rAdvVel, rShapeDeriv); // Get a * grad(Ni)
1140 
1141  // Note: Dof order is (vx,vy,[vz,]p) for each node
1142  for (unsigned int i = 0; i < TNumNodes; ++i)
1143  {
1144  // Loop over columns
1145  for (unsigned int j = 0; j < TNumNodes; ++j)
1146  {
1147  // Delta(u) * TauOne * [ AdvVel * Grad(v) ] in velocity block
1148  K = Coef * Density * AGradN[i] * Density * rShapeFunc[j];
1149 
1150  for (unsigned int d = 0; d < TDim; ++d) // iterate over dimensions for velocity Dofs in this node combination
1151  {
1152  rLHSMatrix(FirstRow + d, FirstCol + d) += K;
1153  // Delta(u) * TauOne * Grad(q) in q * Div(u) block
1154  rLHSMatrix(FirstRow + TDim, FirstCol + d) += Coef * Density * rShapeDeriv(i, d) * rShapeFunc[j];
1155  }
1156  // Update column index
1157  FirstCol += BlockSize;
1158  }
1159  // Update matrix indices
1160  FirstRow += BlockSize;
1161  FirstCol = 0;
1162  }
1163  }
1164 
1167  VectorType& rDampRHS,
1168  const double Density,
1169  const double Viscosity,
1170  const array_1d< double, 3 > & rAdvVel,
1171  const double TauOne,
1172  const double TauTwo,
1173  const array_1d< double, TNumNodes >& rShapeFunc,
1174  const BoundedMatrix<double, TNumNodes, TDim >& rShapeDeriv,
1175  const double Weight)
1176  {
1177  const unsigned int BlockSize = TDim + 1;
1178 
1179  // If we want to use more than one Gauss point to integrate the convective term, this has to be evaluated once per integration point
1181  this->GetConvectionOperator(AGradN, rAdvVel, rShapeDeriv); // Get a * grad(Ni)
1182 
1183  // Build the local matrix and RHS
1184  unsigned int FirstRow(0), FirstCol(0); // position of the first term of the local matrix that corresponds to each node combination
1185  double K, G, PDivV, L, qF; // Temporary results
1186 
1187  array_1d<double,3> BodyForce = ZeroVector(3);
1188  this->EvaluateInPoint(BodyForce,BODY_FORCE,rShapeFunc);
1189  BodyForce *= Density;
1190 
1191  for (unsigned int i = 0; i < TNumNodes; ++i) // iterate over rows
1192  {
1193  for (unsigned int j = 0; j < TNumNodes; ++j) // iterate over columns
1194  {
1195  // Calculate the part of the contributions that is constant for each node combination
1196 
1197  // Velocity block
1198  K = Density * rShapeFunc[i] * AGradN[j]; // Convective term: v * ( a * Grad(u) )
1199  //K = 0.5 * Density * (rShapeFunc[i] * AGradN[j] - AGradN[i] * rShapeFunc[j]); // Skew-symmetric convective term 1/2( v*grad(u)*u - grad(v) uu )
1200  K += TauOne * Density * AGradN[i] * Density * AGradN[j]; // Stabilization: (a * Grad(v)) * TauOne * (a * Grad(u))
1201  K *= Weight;
1202 
1203  // q-p stabilization block (reset result)
1204  L = 0;
1205 
1206  for (unsigned int m = 0; m < TDim; ++m) // iterate over v components (vx,vy[,vz])
1207  {
1208  // Velocity block
1209  //K += Weight * Viscosity * rShapeDeriv(i, m) * rShapeDeriv(j, m); // Diffusive term: Viscosity * Grad(v) * Grad(u)
1210 
1211  // v * Grad(p) block
1212  G = TauOne * Density * AGradN[i] * rShapeDeriv(j, m); // Stabilization: (a * Grad(v)) * TauOne * Grad(p)
1213  PDivV = rShapeDeriv(i, m) * rShapeFunc[j]; // Div(v) * p
1214 
1215  // Write v * Grad(p) component
1216  rDampingMatrix(FirstRow + m, FirstCol + TDim) += Weight * (G - PDivV);
1217  // Use symmetry to write the q * Div(u) component
1218  rDampingMatrix(FirstCol + TDim, FirstRow + m) += Weight * (G + PDivV);
1219 
1220  // q-p stabilization block
1221  L += rShapeDeriv(i, m) * rShapeDeriv(j, m); // Stabilization: Grad(q) * TauOne * Grad(p)
1222 
1223  for (unsigned int n = 0; n < TDim; ++n) // iterate over u components (ux,uy[,uz])
1224  {
1225  // Velocity block
1226  rDampingMatrix(FirstRow + m, FirstCol + n) += Weight * TauTwo * rShapeDeriv(i, m) * rShapeDeriv(j, n); // Stabilization: Div(v) * TauTwo * Div(u)
1227  }
1228 
1229  }
1230 
1231  // Write remaining terms to velocity block
1232  for (unsigned int d = 0; d < TDim; ++d)
1233  rDampingMatrix(FirstRow + d, FirstCol + d) += K;
1234 
1235  // Write q-p stabilization block
1236  rDampingMatrix(FirstRow + TDim, FirstCol + TDim) += Weight * TauOne * L;
1237 
1238 
1239  // Update reference column index for next iteration
1240  FirstCol += BlockSize;
1241  }
1242 
1243  // Operate on RHS
1244  qF = 0.0;
1245  for (unsigned int d = 0; d < TDim; ++d)
1246  {
1247  rDampRHS[FirstRow + d] += Weight * TauOne * Density * AGradN[i] * BodyForce[d]; // ( a * Grad(v) ) * TauOne * (Density * BodyForce)
1248  qF += rShapeDeriv(i, d) * BodyForce[d];
1249  }
1250  rDampRHS[FirstRow + TDim] += Weight * TauOne * qF; // Grad(q) * TauOne * (Density * BodyForce)
1251 
1252  // Update reference indices
1253  FirstRow += BlockSize;
1254  FirstCol = 0;
1255  }
1256 
1257 // this->AddBTransCB(rDampingMatrix,rShapeDeriv,Viscosity*Weight);
1258  this->AddViscousTerm(rDampingMatrix,rShapeDeriv,Viscosity*Weight);
1259  }
1260 
1261 
1263 
1268  const double Density,
1269  array_1d< double, 3 > & rElementalMomRes,
1270  double& rElementalMassRes,
1271  const array_1d< double, TNumNodes >& rShapeFunc,
1272  const BoundedMatrix<double, TNumNodes, TDim >& rShapeDeriv,
1273  const double Weight)
1274  {
1275  // If we want to use more than one Gauss point to integrate the convective term, this has to be evaluated once per integration point
1277  this->GetConvectionOperator(AGradN, rAdvVel, rShapeDeriv); // Get a * grad(Ni)
1278 
1279  // Compute contribution to Kij * Uj, with Kij = Ni * Residual(Nj); Uj = (v,p)Node_j (column vector)
1280  for (unsigned int i = 0; i < TNumNodes; ++i) // Iterate over element nodes
1281  {
1282 
1283  // Variable references
1284  const array_1d< double, 3 > & rVelocity = this->GetGeometry()[i].FastGetSolutionStepValue(VELOCITY);
1285  const array_1d< double, 3 > & rBodyForce = this->GetGeometry()[i].FastGetSolutionStepValue(BODY_FORCE);
1286  const double& rPressure = this->GetGeometry()[i].FastGetSolutionStepValue(PRESSURE);
1287 
1288  // Compute this node's contribution to the residual (evaluated at inegration point)
1289  for (unsigned int d = 0; d < TDim; ++d)
1290  {
1291  rElementalMomRes[d] += Weight * (Density * (rShapeFunc[i] * rBodyForce[d] - AGradN[i] * rVelocity[d]) - rShapeDeriv(i, d) * rPressure);
1292  rElementalMassRes -= Weight * rShapeDeriv(i, d) * rVelocity[d];
1293  }
1294  }
1295  }
1296 
1298 
1308  const double Density,
1309  array_1d< double, 3 > & rElementalMomRes,
1310  const array_1d< double, TNumNodes >& rShapeFunc,
1311  const BoundedMatrix<double, TNumNodes, TDim >& rShapeDeriv,
1312  const double Weight)
1313  {
1314  // If we want to use more than one Gauss point to integrate the convective term, this has to be evaluated once per integration point
1316  this->GetConvectionOperator(AGradN, rAdvVel, rShapeDeriv); // Get a * grad(Ni)
1317 
1318  // Compute contribution to Kij * Uj, with Kij = Ni * Residual(Nj); Uj = (v,p)Node_j (column vector)
1319  for (unsigned int i = 0; i < TNumNodes; ++i) // Iterate over element nodes
1320  {
1321 
1322  // Variable references
1323  const array_1d< double, 3 > & rVelocity = this->GetGeometry()[i].FastGetSolutionStepValue(VELOCITY);
1324  const array_1d< double, 3 > & rAcceleration = this->GetGeometry()[i].FastGetSolutionStepValue(ACCELERATION);
1325  const array_1d< double, 3 > & rBodyForce = this->GetGeometry()[i].FastGetSolutionStepValue(BODY_FORCE);
1326  const double& rPressure = this->GetGeometry()[i].FastGetSolutionStepValue(PRESSURE);
1327 
1328  // Compute this node's contribution to the residual (evaluated at inegration point)
1329  for (unsigned int d = 0; d < TDim; ++d)
1330  {
1331  rElementalMomRes[d] += Weight * (Density * (rShapeFunc[i] * (rBodyForce[d] - rAcceleration[d]) - AGradN[i] * rVelocity[d]) - rShapeDeriv(i, d) * rPressure);
1332  }
1333  }
1334  }
1335 
1337 
1347  const double Density,
1348  array_1d< double, 3 > & rElementalMomRes,
1349  const array_1d< double, TNumNodes >& rShapeFunc,
1350  const BoundedMatrix<double, TNumNodes, TDim >& rShapeDeriv,
1351  const double Weight)
1352  {
1353  // If we want to use more than one Gauss point to integrate the convective term, this has to be evaluated once per integration point
1355  this->GetConvectionOperator(AGradN, rAdvVel, rShapeDeriv); // Get a * grad(Ni)
1356 
1357  // Compute contribution to Kij * Uj, with Kij = Ni * Residual(Nj); Uj = (v,p)Node_j (column vector)
1358  for (unsigned int i = 0; i < TNumNodes; ++i) // Iterate over element nodes
1359  {
1360 
1361  // Variable references
1362  const array_1d< double, 3 > & rVelocity = this->GetGeometry()[i].FastGetSolutionStepValue(VELOCITY);
1363  const array_1d< double, 3 > & rBodyForce = this->GetGeometry()[i].FastGetSolutionStepValue(BODY_FORCE);
1364  const array_1d< double, 3 > & rProjection = this->GetGeometry()[i].FastGetSolutionStepValue(ADVPROJ);
1365  const double& rPressure = this->GetGeometry()[i].FastGetSolutionStepValue(PRESSURE);
1366 
1367  // Compute this node's contribution to the residual (evaluated at inegration point)
1368  for (unsigned int d = 0; d < TDim; ++d)
1369  {
1370  rElementalMomRes[d] += Weight * (Density * (rShapeFunc[i] * rBodyForce[d] - AGradN[i] * rVelocity[d]) - rShapeDeriv(i, d) * rPressure);
1371  rElementalMomRes[d] -= Weight * rShapeFunc[i] * rProjection[d];
1372  }
1373  }
1374  }
1375 
1376 
1392  virtual double EffectiveViscosity(double Density,
1395  double ElemSize,
1396  const ProcessInfo &rProcessInfo)
1397  {
1398  const double Csmag = (static_cast< const VMS<TDim> * >(this) )->GetValue(C_SMAGORINSKY);
1399  double Viscosity = 0.0;
1400  this->EvaluateInPoint(Viscosity,VISCOSITY,rN);
1401 
1402  if (Csmag > 0.0)
1403  {
1404  double StrainRate = this->EquivalentStrainRate(rDN_DX); // (2SijSij)^0.5
1405  double LengthScale = Csmag*ElemSize;
1406  LengthScale *= LengthScale; // square
1407  Viscosity += 2.0*LengthScale*StrainRate;
1408  }
1409 
1410  return Density*Viscosity;
1411  }
1412 
1413 
1414 
1425 
1426 
1428 
1434  virtual void GetAdvectiveVel(array_1d< double, 3 > & rAdvVel,
1435  const array_1d< double, TNumNodes >& rShapeFunc)
1436  {
1437  // Compute the weighted value of the advective velocity in the (Gauss) Point
1438  GeometryType& rGeom = this->GetGeometry();
1439  rAdvVel = rShapeFunc[0] * (rGeom[0].FastGetSolutionStepValue(VELOCITY) - rGeom[0].FastGetSolutionStepValue(MESH_VELOCITY));
1440  for (unsigned int iNode = 1; iNode < TNumNodes; ++iNode)
1441  rAdvVel += rShapeFunc[iNode] * (rGeom[iNode].FastGetSolutionStepValue(VELOCITY) - rGeom[iNode].FastGetSolutionStepValue(MESH_VELOCITY));
1442  }
1443 
1445 
1452  virtual void GetAdvectiveVel(array_1d< double, 3 > & rAdvVel,
1453  const array_1d< double, TNumNodes >& rShapeFunc,
1454  const std::size_t Step)
1455  {
1456  // Compute the weighted value of the advective velocity in the (Gauss) Point
1457  GeometryType& rGeom = this->GetGeometry();
1458  rAdvVel = rShapeFunc[0] * (rGeom[0].FastGetSolutionStepValue(VELOCITY, Step) - rGeom[0].FastGetSolutionStepValue(MESH_VELOCITY, Step));
1459  for (unsigned int iNode = 1; iNode < TNumNodes; ++iNode)
1460  rAdvVel += rShapeFunc[iNode] * (rGeom[iNode].FastGetSolutionStepValue(VELOCITY, Step) - rGeom[iNode].FastGetSolutionStepValue(MESH_VELOCITY, Step));
1461  }
1462 
1464 
1472  const array_1d< double, 3 > & rVelocity,
1473  const BoundedMatrix<double, TNumNodes, TDim >& rShapeDeriv)
1474  {
1475  // Evaluate (and weight) the a * Grad(Ni) operator in the integration point, for each node i
1476  for (unsigned int iNode = 0; iNode < TNumNodes; ++iNode) // Loop over nodes
1477  {
1478  // Initialize result
1479  rResult[iNode] = rVelocity[0] * rShapeDeriv(iNode, 0);
1480  for (unsigned int d = 1; d < TDim; ++d) // loop over components
1481  rResult[iNode] += rVelocity[d] * rShapeDeriv(iNode, d);
1482  }
1483  }
1484 
1486 
1495  virtual void EvaluateInPoint(double& rResult,
1496  const Variable< double >& rVariable,
1497  const array_1d< double, TNumNodes >& rShapeFunc)
1498  {
1499  // Compute the weighted value of the nodal variable in the (Gauss) Point
1500  GeometryType& rGeom = this->GetGeometry();
1501  rResult = rShapeFunc[0] * rGeom[0].FastGetSolutionStepValue(rVariable);
1502  for (unsigned int iNode = 1; iNode < TNumNodes; ++iNode)
1503  rResult += rShapeFunc[iNode] * rGeom[iNode].FastGetSolutionStepValue(rVariable);
1504  }
1505 
1506 
1508 
1516  virtual void EvaluateInPoint(array_1d< double, 3 > & rResult,
1517  const Variable< array_1d< double, 3 > >& rVariable,
1518  const array_1d< double, TNumNodes >& rShapeFunc)
1519  {
1520  // Compute the weighted value of the nodal variable in the (Gauss) Point
1521  GeometryType& rGeom = this->GetGeometry();
1522  rResult = rShapeFunc[0] * rGeom[0].FastGetSolutionStepValue(rVariable);
1523  for (unsigned int iNode = 1; iNode < TNumNodes; ++iNode)
1524  rResult += rShapeFunc[iNode] * rGeom[iNode].FastGetSolutionStepValue(rVariable);
1525  }
1526 
1528 
1535  double ElementSize(const double);
1536 
1537 
1539 
1545  virtual void AddViscousTerm(MatrixType& rDampingMatrix,
1546  const BoundedMatrix<double, TNumNodes, TDim >& rShapeDeriv,
1547  const double Weight);
1548 
1550 
1560  void AddBTransCB(MatrixType& rDampingMatrix,
1561  const BoundedMatrix<double, TNumNodes, TDim >& rShapeDeriv,
1562  const double Weight)
1563  {
1564  BoundedMatrix<double, (TDim * TNumNodes)/2, TDim*TNumNodes > B;
1565  BoundedMatrix<double, (TDim * TNumNodes)/2, (TDim*TNumNodes)/2 > C;
1566  this->CalculateB(B,rShapeDeriv);
1567  this->CalculateC(C,Weight);
1568 
1569  const unsigned int BlockSize = TDim + 1;
1570  const unsigned int StrainSize = (TDim*TNumNodes)/2;
1571 
1572  DenseVector<unsigned int> aux(TDim*TNumNodes);
1573  for(unsigned int i=0; i<TNumNodes; i++)
1574  {
1575  int base_index = TDim*i;
1576  int aux_index = BlockSize*i;
1577  for(unsigned int j=0; j<TDim; j++)
1578  {
1579  aux[base_index+j] = aux_index+j;
1580  }
1581  }
1582 
1583  for(unsigned int k=0; k< StrainSize; k++)
1584  {
1585  for(unsigned int l=0; l< StrainSize; l++)
1586  {
1587  const double Ckl = C(k,l);
1588  for (unsigned int i = 0; i < TDim*TNumNodes; ++i) // iterate over v components (vx,vy[,vz])
1589  {
1590  const double Bki=B(k,i);
1591  for (unsigned int j = 0; j < TDim*TNumNodes; ++j) // iterate over u components (ux,uy[,uz])
1592  {
1593  rDampingMatrix(aux[i],aux[j]) += Bki*Ckl*B(l,j);
1594  }
1595 
1596  }
1597 
1598  }
1599  }
1600  }
1601 
1604  const double Weight)
1605  {
1606  const GeometryType& rGeom = this->GetGeometry();
1607 
1608  // Velocity gradient
1609  MatrixType GradU = ZeroMatrix(TDim,TDim);
1610  for (unsigned int n = 0; n < TNumNodes; n++)
1611  {
1612  const array_1d<double,3>& rVel = this->GetGeometry()[n].FastGetSolutionStepValue(VELOCITY);
1613  for (unsigned int i = 0; i < TDim; i++)
1614  for (unsigned int j = 0; j < TDim; j++)
1615  GradU(i,j) += rDN_DX(n,j)*rVel[i];
1616  }
1617 
1618  // Element lengths
1619  array_1d<double,3> Delta;
1620  Delta[0] = std::fabs(rGeom[TNumNodes-1].X()-rGeom[0].X());
1621  Delta[1] = std::fabs(rGeom[TNumNodes-1].Y()-rGeom[0].Y());
1622  Delta[2] = std::fabs(rGeom[TNumNodes-1].Z()-rGeom[0].Z());
1623 
1624  for (unsigned int n = 1; n < TNumNodes; n++)
1625  {
1626  double hx = std::fabs(rGeom[n].X()-rGeom[n-1].X());
1627  if (hx > Delta[0]) Delta[0] = hx;
1628  double hy = std::fabs(rGeom[n].Y()-rGeom[n-1].Y());
1629  if (hy > Delta[1]) Delta[1] = hy;
1630  double hz = std::fabs(rGeom[n].Z()-rGeom[n-1].Z());
1631  if (hz > Delta[2]) Delta[2] = hz;
1632  }
1633 
1634  double AvgDeltaSq = Delta[0];
1635  for (unsigned int d = 1; d < TDim; d++)
1636  AvgDeltaSq *= Delta[d];
1637  AvgDeltaSq = std::pow(AvgDeltaSq,2./TDim);
1638 
1639  Delta[0] = Delta[0]*Delta[0]/12.0;
1640  Delta[1] = Delta[1]*Delta[1]/12.0;
1641  Delta[2] = Delta[2]*Delta[2]/12.0;
1642 
1643  // Gij
1644  MatrixType G = ZeroMatrix(TDim,TDim);
1645  for (unsigned int i = 0; i < TDim; i++)
1646  for (unsigned int j = 0; j < TDim; j++)
1647  for (unsigned int d = 0; d < TDim; d++)
1648  G(i,j) += Delta[d]*GradU(i,d)*GradU(j,d);
1649 
1650  // Gij:Sij
1651  double GijSij = 0.0;
1652  for (unsigned int i = 0; i < TDim; i++)
1653  for (unsigned int j = 0; j < TDim; j++)
1654  GijSij += 0.5*G(i,j)*( GradU(i,j) + GradU(j,i) );
1655 
1656  if (GijSij < 0.0) // Otherwise model term is clipped
1657  {
1658  // Gkk
1659  double Gkk = G(0,0);
1660  for (unsigned int d = 1; d < TDim; d++)
1661  Gkk += G(d,d);
1662 
1663  // C_epsilon
1664  const double Ce = 1.0;
1665 
1666  // ksgs
1667  double ksgs = -4*AvgDeltaSq*GijSij/(Ce*Ce*Gkk);
1668 
1669  // Assembly of model term
1670  unsigned int RowIndex = 0;
1671  unsigned int ColIndex = 0;
1672 
1673  for (unsigned int i = 0; i < TNumNodes; i++)
1674  {
1675  for (unsigned int j = 0; j < TNumNodes; j++)
1676  {
1677  for (unsigned int d = 0; d < TDim; d++)
1678  {
1679  double Aux = rDN_DX(i,d) * Delta[0] * G(d,0)*rDN_DX(j,0);
1680  for (unsigned int k = 1; k < TDim; k++)
1681  Aux += rDN_DX(i,d) *Delta[k] * G(d,k)*rDN_DX(j,k);
1682  rDampingMatrix(RowIndex+d,ColIndex+d) += Weight * 2.0*ksgs * Aux;
1683  }
1684 
1685  ColIndex += TDim;
1686  }
1687  RowIndex += TDim;
1688  ColIndex = 0;
1689  }
1690  }
1691 
1692  }
1693 
1695 
1700  void CalculateB( BoundedMatrix<double, (TDim * TNumNodes) / 2, TDim * TNumNodes >& rB,
1701  const BoundedMatrix<double, TNumNodes, TDim >& rShapeDeriv);
1702 
1704 
1711  virtual void CalculateC( BoundedMatrix<double, (TDim * TNumNodes) / 2, (TDim * TNumNodes) / 2 >& rC,
1712  const double Viscosity);
1713 
1714  double ConsistentMassCoef(const double Area);
1715 
1716 
1717  double SubscaleErrorEstimate(const ProcessInfo& rProcessInfo)
1718  {
1719  // Get the element's geometric parameters
1720  double Area;
1723  GeometryUtils::CalculateGeometryData(this->GetGeometry(), DN_DX, N, Area);
1724 
1725  // Calculate this element's fluid properties
1726  double Density;
1727  this->EvaluateInPoint(Density, DENSITY, N);
1728 
1729  double ElemSize = this->ElementSize(Area);
1730  double Viscosity = this->EffectiveViscosity(Density,N,DN_DX,ElemSize,rProcessInfo);
1731 
1732  // Get Advective velocity
1733  array_1d<double, 3 > AdvVel;
1734  this->GetAdvectiveVel(AdvVel, N);
1735 
1736  // Output container
1737  array_1d< double, 3 > ElementalMomRes = ZeroVector(3);
1738 
1739  // Calculate stabilization parameter. Note that to estimate the subscale velocity, the dynamic coefficient in TauOne is assumed zero.
1740  double TauOne;
1741  this->CalculateStaticTau(TauOne,AdvVel,ElemSize,Density,Viscosity);
1742 
1743  if ( rProcessInfo[OSS_SWITCH] != 1 ) // ASGS
1744  {
1745  this->ASGSMomResidual(AdvVel,Density,ElementalMomRes,N,DN_DX,1.0);
1746  ElementalMomRes *= TauOne;
1747  }
1748  else // OSS
1749  {
1750  this->OSSMomResidual(AdvVel,Density,ElementalMomRes,N,DN_DX,1.0);;
1751  ElementalMomRes *= TauOne;
1752  }
1753 
1754  // Error estimation ( ||U'|| / ||Uh_gauss|| ), taking ||U'|| = TauOne ||MomRes||
1755  double ErrorRatio(0.0);//, UNorm(0.0);
1756  //array_1d< double, 3 > UGauss = ZeroVector(3);
1757  //this->EvaluateInPoint(UGauss,VELOCITY,N);
1758 
1759  for (unsigned int i = 0; i < TDim; ++i)
1760  {
1761  ErrorRatio += ElementalMomRes[i] * ElementalMomRes[i];
1762  //UNorm += UGauss[i] * UGauss[i];
1763  }
1764  ErrorRatio = sqrt(ErrorRatio*Area);// / UNorm);
1765  //ErrorRatio /= Density;
1766  //this->SetValue(ERROR_RATIO, ErrorRatio);
1767  return ErrorRatio;
1768  }
1769 
1773 
1774 
1778 
1779 
1783 
1784 
1786 
1787 private:
1790 
1791 
1795 
1799 
1800  friend class Serializer;
1801 
1802  void save(Serializer& rSerializer) const override
1803  {
1805  }
1806 
1807  void load(Serializer& rSerializer) override
1808  {
1810  }
1811 
1815 
1816 
1820 
1821 
1825 
1826 
1830 
1831 
1835 
1837  VMS & operator=(VMS const& rOther);
1838 
1840  VMS(VMS const& rOther);
1841 
1843 
1844 }; // Class VMS
1845 
1847 
1850 
1851 
1855 
1856 
1858 template< unsigned int TDim,
1859  unsigned int TNumNodes >
1860 inline std::istream& operator >>(std::istream& rIStream,
1861  VMS<TDim, TNumNodes>& rThis)
1862 {
1863  return rIStream;
1864 }
1865 
1867 template< unsigned int TDim,
1868  unsigned int TNumNodes >
1869 inline std::ostream& operator <<(std::ostream& rOStream,
1870  const VMS<TDim, TNumNodes>& rThis)
1871 {
1872  rThis.PrintInfo(rOStream);
1873  rOStream << std::endl;
1874  rThis.PrintData(rOStream);
1875 
1876  return rOStream;
1877 }
1879 
1881 
1882 } // namespace Kratos.
1883 
1884 #endif // KRATOS_VMS_H_INCLUDED defined
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
Base class for all Elements.
Definition: element.h:60
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: element.h:1135
virtual int Check(const ProcessInfo &rCurrentProcessInfo) const
Definition: element.h:904
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
std::size_t IndexType
Definition: flags.h:74
TVariableType::Type & GetValue(const TVariableType &rThisVariable)
Definition: geometrical_object.h:248
GeometryType & GetGeometry()
Returns the reference of the geometry.
Definition: geometrical_object.h:158
void SetValue(const TVariableType &rThisVariable, typename TVariableType::Type const &rValue)
Definition: geometrical_object.h:238
Geometry base class.
Definition: geometry.h:71
SizeType size() const
Definition: geometry.h:518
IndexType const & Id() const
Id of this Geometry.
Definition: geometry.h:964
TVariableType::Type & GetValue(const TVariableType &rThisVariable)
Definition: geometry.h:627
virtual Pointer Create(PointsArrayType const &rThisPoints) const
Creates a new geometry pointer.
Definition: geometry.h:813
static void CalculateGeometryData(const GeometryType &rGeometry, BoundedMatrix< double, 4, 3 > &rDN_DX, array_1d< double, 4 > &rN, double &rVolume)
This function is designed to compute the shape function derivatives, shape functions and volume in 3D...
Definition: geometry_utilities.h:176
This object defines an indexed object.
Definition: indexed_object.h:54
IndexType Id() const
Definition: indexed_object.h:107
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
This class defines the node.
Definition: node.h:65
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.h:72
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
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
A stabilized element for the incompressible Navier-Stokes equations.
Definition: vms.h:104
void CalculateMassMatrix(MatrixType &rMassMatrix, const ProcessInfo &rCurrentProcessInfo) override
Computes local contributions to the mass matrix.
Definition: vms.h:326
std::vector< Dof< double >::Pointer > DofsVectorType
Definition: vms.h:140
virtual void GetAdvectiveVel(array_1d< double, 3 > &rAdvVel, const array_1d< double, TNumNodes > &rShapeFunc)
Write the advective velocity evaluated at this point to an array.
Definition: vms.h:1434
PointerVectorSet< Dof< double >, IndexedObject > DofsArrayType
Definition: vms.h:142
virtual void EvaluateInPoint(array_1d< double, 3 > &rResult, const Variable< array_1d< double, 3 > > &rVariable, const array_1d< double, TNumNodes > &rShapeFunc)
Write the value of a variable at a point inside the element to a double.
Definition: vms.h:1516
VMS(IndexType NewId, const NodesArrayType &ThisNodes)
Constructor using an array of nodes.
Definition: vms.h:166
Geometry< NodeType >::PointsArrayType NodesArrayType
definition of nodes container type, redefined from GeometryType
Definition: vms.h:128
IndexedObject BaseType
base type: an IndexedObject that automatically has a unique number
Definition: vms.h:113
int Check(const ProcessInfo &rCurrentProcessInfo) const override
Checks the input and that all required Kratos variables have been registered.
Definition: vms.h:835
double ElementSize(const double)
Return an estimate for the element size h, used to calculate the stabilization parameters.
void GetFirstDerivativesVector(Vector &Values, int Step=0) const override
Returns VELOCITY_X, VELOCITY_Y, (VELOCITY_Z,) PRESSURE for each node.
void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const override
Provides the global indices for each one of this element's local rows.
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: vms.h:898
void Calculate(const Variable< double > &rVariable, double &rOutput, const ProcessInfo &rCurrentProcessInfo) override
Implementation of Calculate to compute an error estimate.
Definition: vms.h:454
void FinalizeNonLinearIteration(const ProcessInfo &rCurrentProcessInfo) override
Definition: vms.h:437
void CalculateLocalVelocityContribution(MatrixType &rDampingMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Computes the local contribution associated to 'new' velocity and pressure values.
Definition: vms.h:382
virtual void EvaluateInPoint(double &rResult, const Variable< double > &rVariable, const array_1d< double, TNumNodes > &rShapeFunc)
Write the value of a variable at a point inside the element to a double.
Definition: vms.h:1495
std::size_t SizeType
Definition: vms.h:136
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Provides local contributions from body forces and OSS projection terms.
Definition: vms.h:234
void CalculateLumpedMassMatrix(MatrixType &rLHSMatrix, const double Mass)
Add lumped mass matrix.
Definition: vms.h:1061
void CalculateOnIntegrationPoints(const Variable< Matrix > &rVariable, std::vector< Matrix > &rValues, const ProcessInfo &rCurrentProcessInfo) override
Empty implementation of unused CalculateOnIntegrationPoints overloads to avoid compilation warning.
Definition: vms.h:812
VMS(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Constuctor using geometry and properties.
Definition: vms.h:185
Properties PropertiesType
Definition: vms.h:122
double SubscaleErrorEstimate(const ProcessInfo &rProcessInfo)
Definition: vms.h:1717
void GetDofList(DofsVectorType &rElementalDofList, const ProcessInfo &rCurrentProcessInfo) const override
Returns a list of the element's Dofs.
virtual void AddMomentumRHS(VectorType &F, const double Density, const array_1d< double, TNumNodes > &rShapeFunc, const double Weight)
Add the momentum equation contribution to the RHS (body forces)
Definition: vms.h:994
virtual void GetAdvectiveVel(array_1d< double, 3 > &rAdvVel, const array_1d< double, TNumNodes > &rShapeFunc, const std::size_t Step)
Write the advective velocity evaluated at this point to an array.
Definition: vms.h:1452
virtual void AddProjectionToRHS(VectorType &RHS, const array_1d< double, 3 > &rAdvVel, const double Density, const double TauOne, const double TauTwo, const array_1d< double, TNumNodes > &rShapeFunc, const BoundedMatrix< double, TNumNodes, TDim > &rShapeDeriv, const double Weight, const double DeltaTime=1.0)
Add OSS projection terms to the RHS.
Definition: vms.h:1018
std::size_t IndexType
Definition: vms.h:134
void CalculateOnIntegrationPoints(const Variable< Vector > &rVariable, std::vector< Vector > &rValues, const ProcessInfo &rCurrentProcessInfo) override
Empty implementation of unused CalculateOnIntegrationPoints overloads to avoid compilation warning.
Definition: vms.h:805
BoundedMatrix< double, TNumNodes, TDim > ShapeFunctionDerivativesType
Definition: vms.h:145
~VMS() override
Destructor.
Definition: vms.h:190
void CalculateLeftHandSide(MatrixType &rLeftHandSideMatrix, const ProcessInfo &rCurrentProcessInfo) override
Returns a zero matrix of appropiate size (provided for compatibility with scheme)
Definition: vms.h:255
void Calculate(const Variable< array_1d< double, 3 > > &rVariable, array_1d< double, 3 > &rOutput, const ProcessInfo &rCurrentProcessInfo) override
Implementation of Calculate to compute the local OSS projections.
Definition: vms.h:493
Element::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const override
Create a new element of this type.
Definition: vms.h:211
virtual void CalculateTau(double &TauOne, double &TauTwo, const array_1d< double, 3 > &rAdvVel, const double ElemSize, const double Density, const double Viscosity, const ProcessInfo &rCurrentProcessInfo)
Calculate Stabilization parameters.
Definition: vms.h:945
void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Provides local contributions from body forces and projections to the RHS.
Definition: vms.h:276
void AddConsistentMassMatrixContribution(MatrixType &rLHSMatrix, const array_1d< double, TNumNodes > &rShapeFunc, const double Density, const double Weight)
Definition: vms.h:1076
VMS(IndexType NewId, GeometryType::Pointer pGeometry)
Constructor using a geometry object.
Definition: vms.h:175
void ModulatedGradientDiffusion(MatrixType &rDampingMatrix, const BoundedMatrix< double, TNumNodes, TDim > &rDN_DX, const double Weight)
Definition: vms.h:1602
void ASGSMomResidual(const array_1d< double, 3 > &rAdvVel, const double Density, array_1d< double, 3 > &rElementalMomRes, const array_1d< double, TNumNodes > &rShapeFunc, const BoundedMatrix< double, TNumNodes, TDim > &rShapeDeriv, const double Weight)
Assemble the contribution from an integration point to the element's residual.
Definition: vms.h:1307
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(VMS)
Pointer definition of VMS.
double EquivalentStrainRate(const BoundedMatrix< double, TNumNodes, TDim > &rDN_DX) const
EquivalentStrainRate Calculate the second invariant of the strain rate tensor GammaDot = (2SijSij)^0....
virtual void CalculateC(BoundedMatrix< double,(TDim *TNumNodes)/2,(TDim *TNumNodes)/2 > &rC, const double Viscosity)
Calculate a matrix that provides the stress given the strain rate.
Matrix MatrixType
Definition: vms.h:132
Geometry< NodeType > GeometryType
definition of the geometry type with given NodeType
Definition: vms.h:125
void AddMassStabTerms(MatrixType &rLHSMatrix, const double Density, const array_1d< double, 3 > &rAdvVel, const double TauOne, const array_1d< double, TNumNodes > &rShapeFunc, const BoundedMatrix< double, TNumNodes, TDim > &rShapeDeriv, const double Weight)
Add mass-like stabilization terms to LHS.
Definition: vms.h:1123
VMS(IndexType NewId=0)
Default constuctor.
Definition: vms.h:157
void AddBTransCB(MatrixType &rDampingMatrix, const BoundedMatrix< double, TNumNodes, TDim > &rShapeDeriv, const double Weight)
Adds the contribution of the viscous term to the momentum equation (alternate).
Definition: vms.h:1560
void CalculateOnIntegrationPoints(const Variable< double > &rVariable, std::vector< double > &rValues, const ProcessInfo &rCurrentProcessInfo) override
Obtain a double elemental variable, evaluated on gauss points.
Definition: vms.h:662
virtual void CalculateStaticTau(double &TauOne, const array_1d< double, 3 > &rAdvVel, const double ElemSize, const double Density, const double Viscosity)
Calculate momentum stabilization parameter (without time term).
Definition: vms.h:976
double ConsistentMassCoef(const double Area)
Vector VectorType
Definition: vms.h:130
void OSSMomResidual(const array_1d< double, 3 > &rAdvVel, const double Density, array_1d< double, 3 > &rElementalMomRes, const array_1d< double, TNumNodes > &rShapeFunc, const BoundedMatrix< double, TNumNodes, TDim > &rShapeDeriv, const double Weight)
Assemble the contribution from an integration point to the element's residual.
Definition: vms.h:1346
void AddProjectionResidualContribution(const array_1d< double, 3 > &rAdvVel, const double Density, array_1d< double, 3 > &rElementalMomRes, double &rElementalMassRes, const array_1d< double, TNumNodes > &rShapeFunc, const BoundedMatrix< double, TNumNodes, TDim > &rShapeDeriv, const double Weight)
Assemble the contribution from an integration point to the element's residual.
Definition: vms.h:1267
virtual double EffectiveViscosity(double Density, const array_1d< double, TNumNodes > &rN, const BoundedMatrix< double, TNumNodes, TDim > &rDN_DX, double ElemSize, const ProcessInfo &rProcessInfo)
EffectiveViscosity Calculate the viscosity at given integration point, using Smagorinsky if enabled.
Definition: vms.h:1392
void CalculateOnIntegrationPoints(const Variable< array_1d< double, 3 > > &rVariable, std::vector< array_1d< double, 3 > > &rOutput, const ProcessInfo &rCurrentProcessInfo) override
Obtain an array_1d<double,3> elemental variable, evaluated on gauss points.
virtual void AddViscousTerm(MatrixType &rDampingMatrix, const BoundedMatrix< double, TNumNodes, TDim > &rShapeDeriv, const double Weight)
Adds the contribution of the viscous term to the momentum equation.
std::vector< std::size_t > EquationIdVectorType
Definition: vms.h:138
void AddIntegrationPointVelocityContribution(MatrixType &rDampingMatrix, VectorType &rDampRHS, const double Density, const double Viscosity, const array_1d< double, 3 > &rAdvVel, const double TauOne, const double TauTwo, const array_1d< double, TNumNodes > &rShapeFunc, const BoundedMatrix< double, TNumNodes, TDim > &rShapeDeriv, const double Weight)
Add a the contribution from a single integration point to the velocity contribution.
Definition: vms.h:1166
Element::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, PropertiesType::Pointer pProperties) const override
It creates a new element pointer.
Definition: vms.h:217
Node NodeType
definition of node type (default is: Node)
Definition: vms.h:116
void GetConvectionOperator(array_1d< double, TNumNodes > &rResult, const array_1d< double, 3 > &rVelocity, const BoundedMatrix< double, TNumNodes, TDim > &rShapeDeriv)
Write the convective operator evaluated at this point (for each nodal funciton) to an array.
Definition: vms.h:1471
void CalculateOnIntegrationPoints(const Variable< array_1d< double, 6 > > &rVariable, std::vector< array_1d< double, 6 > > &rValues, const ProcessInfo &rCurrentProcessInfo) override
Empty implementation of unused CalculateOnIntegrationPoints overloads to avoid compilation warning.
Definition: vms.h:798
void CalculateB(BoundedMatrix< double,(TDim *TNumNodes)/2, TDim *TNumNodes > &rB, const BoundedMatrix< double, TNumNodes, TDim > &rShapeDeriv)
Calculate the strain rate matrix.
void GetSecondDerivativesVector(Vector &Values, int Step=0) const override
Returns ACCELERATION_X, ACCELERATION_Y, (ACCELERATION_Z,) 0 for each node.
std::string Info() const override
Turn back information as a string.
Definition: vms.h:890
array_1d< double, TNumNodes > ShapeFunctionsType
Definition: vms.h:144
#define KRATOS_SERIALIZE_SAVE_BASE_CLASS(Serializer, BaseType)
Definition: define.h:812
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_SERIALIZE_LOAD_BASE_CLASS(Serializer, BaseType)
Definition: define.h:815
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_CHECK_DOF_IN_NODE(TheVariable, TheNode)
Definition: checks.h:176
#define KRATOS_CHECK_VARIABLE_IN_NODAL_DATA(TheVariable, TheNode)
Definition: checks.h:171
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
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
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
TABLE_NUMBER_ANGULAR_VELOCITY TABLE_NUMBER_MOMENT I33 BEAM_INERTIA_ROT_UNIT_LENGHT_Y KRATOS_DEFINE_APPLICATION_VARIABLE(DEM_APPLICATION, double, BEAM_INERTIA_ROT_UNIT_LENGHT_Z) typedef std double
Definition: DEM_application_variables.h:182
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
X2
Definition: generate_frictional_mortar_condition.py:120
X1
Definition: generate_frictional_mortar_condition.py:119
int C
Definition: generate_hyper_elastic_simo_taylor_neo_hookean.py:27
F
Definition: hinsberg_optimization.py:144
def load(f)
Definition: ode_solve.py:307
int L
Definition: ode_solve.py:390
int d
Definition: ode_solve.py:397
int n
manufactured solution and derivatives (u=0 at z=0 dudz=0 at z=domain_height)
Definition: ode_solve.py:402
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
int m
Definition: run_marine_rain_substepping.py:8
J
Definition: sensitivityMatrix.py:58
N
Definition: sensitivityMatrix.py:29
K
Definition: sensitivityMatrix.py:73
B
Definition: sensitivityMatrix.py:76
integer i
Definition: TensorModule.f:17
integer l
Definition: TensorModule.f:17