14 #if !defined(KRATOS_VMS_H_INCLUDED )
15 #define KRATOS_VMS_H_INCLUDED
32 #include "utilities/geometry_utilities.h"
101 template<
unsigned int TDim,
102 unsigned int TNumNodes = TDim + 1 >
185 VMS(
IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties) :
186 Element(NewId, pGeometry, pProperties)
212 PropertiesType::Pointer pProperties)
const override
214 return Kratos::make_intrusive< VMS<TDim, TNumNodes> >(NewId,
GetGeometry().
Create(ThisNodes), pProperties);
218 GeometryType::Pointer pGeom,
219 PropertiesType::Pointer pProperties)
const override
221 return Kratos::make_intrusive< VMS<TDim, TNumNodes> >(NewId, pGeom, pProperties);
238 const unsigned int LocalSize = (TDim + 1) * TNumNodes;
241 if (rLeftHandSideMatrix.size1() != LocalSize)
242 rLeftHandSideMatrix.
resize(LocalSize, LocalSize,
false);
258 const unsigned int LocalSize = (TDim + 1) * TNumNodes;
260 if (rLeftHandSideMatrix.size1() != LocalSize)
261 rLeftHandSideMatrix.
resize(LocalSize, LocalSize,
false);
279 const unsigned int LocalSize = (TDim + 1) * TNumNodes;
282 if (rRightHandSideVector.size() != LocalSize)
283 rRightHandSideVector.
resize(LocalSize,
false);
301 const ProcessInfo& r_const_process_info = rCurrentProcessInfo;
302 if (r_const_process_info[OSS_SWITCH] == 1)
311 double TauOne, TauTwo;
312 this->
CalculateTau(TauOne,TauTwo,AdvVel,ElemSize,Density,Viscosity,rCurrentProcessInfo);
314 this->
AddProjectionToRHS(rRightHandSideVector, AdvVel, Density, TauOne, TauTwo,
N, DN_DX, Area,rCurrentProcessInfo[DELTA_TIME]);
328 const unsigned int LocalSize = (TDim + 1) * TNumNodes;
331 if (rMassMatrix.size1() != LocalSize)
332 rMassMatrix.
resize(LocalSize, LocalSize,
false);
334 rMassMatrix =
ZeroMatrix(LocalSize, LocalSize);
347 double Coeff = Density * Area / TNumNodes;
354 const ProcessInfo& r_const_process_info = rCurrentProcessInfo;
355 if (r_const_process_info[OSS_SWITCH] != 1)
365 double TauOne, TauTwo;
366 this->
CalculateTau(TauOne,TauTwo,AdvVel,ElemSize,Density,Viscosity,rCurrentProcessInfo);
386 const unsigned int LocalSize = (TDim + 1) * TNumNodes;
390 if (rDampingMatrix.size1() != LocalSize)
391 rDampingMatrix.
resize(LocalSize, LocalSize,
false);
413 double TauOne, TauTwo;
414 this->
CalculateTau(TauOne,TauTwo,AdvVel,ElemSize,Density,Viscosity,rCurrentProcessInfo);
422 for (
unsigned int iNode = 0; iNode < TNumNodes; ++iNode)
425 for (
unsigned int d = 0;
d < TDim; ++
d)
427 U[LocalIndex] = rVel[
d];
430 U[LocalIndex] = this->
GetGeometry()[iNode].FastGetSolutionStepValue(PRESSURE);
434 noalias(rRightHandSideVector) -=
prod(rDampingMatrix, U);
458 if (rVariable == ERROR_RATIO)
461 this->
SetValue(ERROR_RATIO,rOutput);
463 else if (rVariable == NODAL_AREA)
472 for (
unsigned int i = 0;
i < TNumNodes; ++
i)
475 this->
GetGeometry()[
i].FastGetSolutionStepValue(NODAL_AREA) += Area *
N[
i];
497 if (rVariable == ADVPROJ)
515 double ElementalMassRes(0);
519 if (rCurrentProcessInfo[OSS_SWITCH] == 1)
522 for (
unsigned int i = 0;
i < TNumNodes; ++
i)
526 for (
unsigned int d = 0;
d < TDim; ++
d)
527 rAdvProj[
d] +=
N[
i] * ElementalMomRes[
d];
529 this->
GetGeometry()[
i].FastGetSolutionStepValue(DIVPROJ) +=
N[
i] * ElementalMassRes;
530 this->
GetGeometry()[
i].FastGetSolutionStepValue(NODAL_AREA) += Area *
N[
i];
536 rOutput = ElementalMomRes;
538 else if (rVariable == SUBSCALE_VELOCITY)
556 double ElementalMassRes(0.0);
560 if (rCurrentProcessInfo[OSS_SWITCH] == 1)
567 for (
unsigned int i = 0;
i < TNumNodes; ++
i)
574 for (
unsigned int d = 0;
d < TDim; ++
d)
575 rMomRHS[
d] +=
N[
i] * ElementalMomRes[
d];
577 rMassRHS +=
N[
i] * ElementalMassRes;
580 this->
GetGeometry()[
i].FastGetSolutionStepValue(NODAL_AREA) += Area *
N[
i];
583 for(
unsigned int j = 0;
j < TNumNodes; ++
j)
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);
589 for(
unsigned int d = 0;
d < TDim; ++
d)
590 rMomRHS[
d] -= Weight * this->
GetGeometry()[
i].FastGetSolutionStepValue(ADVPROJ)[
d];
591 rMassRHS -= Weight * this->
GetGeometry()[
i].FastGetSolutionStepValue(DIVPROJ);
598 rOutput = ElementalMomRes;
611 const ProcessInfo& rCurrentProcessInfo)
const override;
619 const ProcessInfo& rCurrentProcessInfo)
const override;
664 std::vector<double>& rValues,
667 if (rVariable == TAUONE || rVariable == TAUTWO || rVariable == MU || rVariable == TAU)
684 double TauOne, TauTwo;
685 this->
CalculateTau(TauOne,TauTwo,AdvVel,ElemSize,Density,Viscosity,rCurrentProcessInfo);
688 rValues.resize(1,
false);
689 if (rVariable == TAUONE)
693 else if (rVariable == TAUTWO)
697 else if (rVariable == MU)
699 rValues[0] = Viscosity;
701 else if (rVariable == TAU)
704 rValues[0] = Viscosity*NormS;
707 else if (rVariable == EQ_STRAIN_RATE)
714 rValues.resize(1,
false);
717 else if(rVariable == SUBSCALE_PRESSURE)
734 double TauOne, TauTwo;
735 this->
CalculateTau(TauOne,TauTwo,AdvVel,ElemSize,Density,Viscosity,rCurrentProcessInfo);
738 for(
unsigned int i=0;
i < TNumNodes;
i++)
740 for(
unsigned int d = 0;
d < TDim;
d++)
741 DivU -= DN_DX(
i,
d) * this->
GetGeometry()[
i].FastGetSolutionStepValue(VELOCITY)[
d];
744 rValues.resize(1,
false);
745 rValues[0] = TauTwo * DivU;
746 if(rCurrentProcessInfo[OSS_SWITCH]==1)
749 for(
unsigned int i=0;
i < TNumNodes;
i++)
751 Proj +=
N[
i]*this->
GetGeometry()[
i].FastGetSolutionStepValue(DIVPROJ);
753 rValues[0] -= TauTwo*Proj;
756 else if (rVariable == NODAL_AREA && TDim == 3)
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];
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);
778 else if (rVariable == ERROR_RATIO)
780 rValues.resize(1,
false);
785 rValues.resize(1,
false);
793 rValues[0] = const_this->
GetValue(rVariable);
807 std::vector<Vector>& rValues,
814 std::vector<Matrix>& rValues,
841 if(ErrorCode != 0)
return ErrorCode;
866 if (this->
GetGeometry().WorkingSpaceDimension() == 2)
890 std::string
Info()
const override
892 std::stringstream buffer;
893 buffer <<
"VMS #" <<
Id();
900 rOStream <<
"VMS" << TDim <<
"D";
948 const double ElemSize,
949 const double Density,
950 const double Viscosity,
954 double AdvVelNorm = 0.0;
955 for (
unsigned int d = 0;
d < TDim; ++
d)
956 AdvVelNorm += rAdvVel[
d] * rAdvVel[
d];
958 AdvVelNorm = sqrt(AdvVelNorm);
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;
978 const double ElemSize,
979 const double Density,
980 const double Viscosity)
983 double AdvVelNorm = 0.0;
984 for (
unsigned int d = 0;
d < TDim; ++
d)
985 AdvVelNorm += rAdvVel[
d] * rAdvVel[
d];
987 AdvVelNorm = sqrt(AdvVelNorm);
989 double InvTau = 2.0*Density*AdvVelNorm / ElemSize + 4.0*Viscosity/ (ElemSize * ElemSize);
990 TauOne = 1.0 / InvTau;
995 const double Density,
999 double Coef = Density * Weight;
1007 for (
unsigned int iNode = 0; iNode < TNumNodes; ++iNode)
1009 for (
unsigned int d = 0;
d < TDim; ++
d)
1011 F[LocalIndex++] += Coef * rShapeFunc[iNode] * BodyForce[
d];
1020 const double Density,
1021 const double TauOne,
1022 const double TauTwo,
1025 const double Weight,
1026 const double DeltaTime = 1.0)
1028 const unsigned int BlockSize = TDim + 1;
1034 double DivProj = 0.0;
1041 unsigned int FirstRow = 0;
1043 for (
unsigned int i = 0;
i < TNumNodes;
i++)
1045 for (
unsigned int d = 0;
d < TDim;
d++)
1047 RHS[FirstRow+
d] -= Weight * (Density * AGradN[
i] * MomProj[
d] + rShapeDeriv(
i,
d) * DivProj);
1048 RHS[FirstRow+TDim] -= Weight * rShapeDeriv(
i,
d) * MomProj[
d];
1050 FirstRow += BlockSize;
1064 unsigned int DofIndex = 0;
1065 for (
unsigned int iNode = 0; iNode < TNumNodes; ++iNode)
1067 for (
unsigned int d = 0;
d < TDim; ++
d)
1069 rLHSMatrix(DofIndex, DofIndex) += Mass;
1078 const double Density,
1079 const double Weight)
1081 const unsigned int BlockSize = TDim + 1;
1083 double Coef = Density * Weight;
1084 unsigned int FirstRow(0), FirstCol(0);
1088 for (
unsigned int i = 0;
i < TNumNodes; ++
i)
1091 for (
unsigned int j = 0;
j < TNumNodes; ++
j)
1094 K = Coef * rShapeFunc[
i] * rShapeFunc[
j];
1096 for (
unsigned int d = 0;
d < TDim; ++
d)
1098 rLHSMatrix(FirstRow +
d, FirstCol +
d) +=
K;
1101 FirstCol += BlockSize;
1104 FirstRow += BlockSize;
1124 const double Density,
1126 const double TauOne,
1129 const double Weight)
1131 const unsigned int BlockSize = TDim + 1;
1133 double Coef = Weight * TauOne;
1134 unsigned int FirstRow(0), FirstCol(0);
1142 for (
unsigned int i = 0;
i < TNumNodes; ++
i)
1145 for (
unsigned int j = 0;
j < TNumNodes; ++
j)
1148 K = Coef * Density * AGradN[
i] * Density * rShapeFunc[
j];
1150 for (
unsigned int d = 0;
d < TDim; ++
d)
1152 rLHSMatrix(FirstRow +
d, FirstCol +
d) +=
K;
1154 rLHSMatrix(FirstRow + TDim, FirstCol +
d) += Coef * Density * rShapeDeriv(
i,
d) * rShapeFunc[
j];
1157 FirstCol += BlockSize;
1160 FirstRow += BlockSize;
1168 const double Density,
1169 const double Viscosity,
1171 const double TauOne,
1172 const double TauTwo,
1175 const double Weight)
1177 const unsigned int BlockSize = TDim + 1;
1184 unsigned int FirstRow(0), FirstCol(0);
1185 double K, G, PDivV,
L, qF;
1189 BodyForce *= Density;
1191 for (
unsigned int i = 0;
i < TNumNodes; ++
i)
1193 for (
unsigned int j = 0;
j < TNumNodes; ++
j)
1198 K = Density * rShapeFunc[
i] * AGradN[
j];
1200 K += TauOne * Density * AGradN[
i] * Density * AGradN[
j];
1206 for (
unsigned int m = 0;
m < TDim; ++
m)
1212 G = TauOne * Density * AGradN[
i] * rShapeDeriv(
j,
m);
1213 PDivV = rShapeDeriv(
i,
m) * rShapeFunc[
j];
1216 rDampingMatrix(FirstRow +
m, FirstCol + TDim) += Weight * (G - PDivV);
1218 rDampingMatrix(FirstCol + TDim, FirstRow +
m) += Weight * (G + PDivV);
1221 L += rShapeDeriv(
i,
m) * rShapeDeriv(
j,
m);
1223 for (
unsigned int n = 0;
n < TDim; ++
n)
1226 rDampingMatrix(FirstRow +
m, FirstCol +
n) += Weight * TauTwo * rShapeDeriv(
i,
m) * rShapeDeriv(
j,
n);
1232 for (
unsigned int d = 0;
d < TDim; ++
d)
1233 rDampingMatrix(FirstRow +
d, FirstCol +
d) +=
K;
1236 rDampingMatrix(FirstRow + TDim, FirstCol + TDim) += Weight * TauOne *
L;
1240 FirstCol += BlockSize;
1245 for (
unsigned int d = 0;
d < TDim; ++
d)
1247 rDampRHS[FirstRow +
d] += Weight * TauOne * Density * AGradN[
i] * BodyForce[
d];
1248 qF += rShapeDeriv(
i,
d) * BodyForce[
d];
1250 rDampRHS[FirstRow + TDim] += Weight * TauOne * qF;
1253 FirstRow += BlockSize;
1258 this->
AddViscousTerm(rDampingMatrix,rShapeDeriv,Viscosity*Weight);
1268 const double Density,
1270 double& rElementalMassRes,
1273 const double Weight)
1280 for (
unsigned int i = 0;
i < TNumNodes; ++
i)
1286 const double& rPressure = this->
GetGeometry()[
i].FastGetSolutionStepValue(PRESSURE);
1289 for (
unsigned int d = 0;
d < TDim; ++
d)
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];
1308 const double Density,
1312 const double Weight)
1319 for (
unsigned int i = 0;
i < TNumNodes; ++
i)
1326 const double& rPressure = this->
GetGeometry()[
i].FastGetSolutionStepValue(PRESSURE);
1329 for (
unsigned int d = 0;
d < TDim; ++
d)
1331 rElementalMomRes[
d] += Weight * (Density * (rShapeFunc[
i] * (rBodyForce[
d] - rAcceleration[
d]) - AGradN[
i] * rVelocity[
d]) - rShapeDeriv(
i,
d) * rPressure);
1347 const double Density,
1351 const double Weight)
1358 for (
unsigned int i = 0;
i < TNumNodes; ++
i)
1365 const double& rPressure = this->
GetGeometry()[
i].FastGetSolutionStepValue(PRESSURE);
1368 for (
unsigned int d = 0;
d < TDim; ++
d)
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];
1398 const double Csmag = (
static_cast< const VMS<TDim> *
>(
this) )->GetValue(C_SMAGORINSKY);
1399 double Viscosity = 0.0;
1405 double LengthScale = Csmag*ElemSize;
1406 LengthScale *= LengthScale;
1407 Viscosity += 2.0*LengthScale*StrainRate;
1410 return Density*Viscosity;
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));
1454 const std::size_t Step)
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));
1476 for (
unsigned int iNode = 0; iNode < TNumNodes; ++iNode)
1479 rResult[iNode] = rVelocity[0] * rShapeDeriv(iNode, 0);
1480 for (
unsigned int d = 1;
d < TDim; ++
d)
1481 rResult[iNode] += rVelocity[
d] * rShapeDeriv(iNode,
d);
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);
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);
1547 const double Weight);
1562 const double Weight)
1569 const unsigned int BlockSize = TDim + 1;
1570 const unsigned int StrainSize = (TDim*TNumNodes)/2;
1573 for(
unsigned int i=0;
i<TNumNodes;
i++)
1575 int base_index = TDim*
i;
1576 int aux_index = BlockSize*
i;
1577 for(
unsigned int j=0;
j<TDim;
j++)
1579 aux[base_index+
j] = aux_index+
j;
1583 for(
unsigned int k=0;
k< StrainSize;
k++)
1585 for(
unsigned int l=0;
l< StrainSize;
l++)
1587 const double Ckl =
C(
k,
l);
1588 for (
unsigned int i = 0;
i < TDim*TNumNodes; ++
i)
1590 const double Bki=
B(
k,
i);
1591 for (
unsigned int j = 0;
j < TDim*TNumNodes; ++
j)
1593 rDampingMatrix(aux[
i],aux[
j]) += Bki*Ckl*
B(
l,
j);
1604 const double Weight)
1610 for (
unsigned int n = 0;
n < TNumNodes;
n++)
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];
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());
1624 for (
unsigned int n = 1;
n < TNumNodes;
n++)
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;
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);
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;
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);
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) );
1659 double Gkk = G(0,0);
1660 for (
unsigned int d = 1;
d < TDim;
d++)
1664 const double Ce = 1.0;
1667 double ksgs = -4*AvgDeltaSq*GijSij/(Ce*Ce*Gkk);
1670 unsigned int RowIndex = 0;
1671 unsigned int ColIndex = 0;
1673 for (
unsigned int i = 0;
i < TNumNodes;
i++)
1675 for (
unsigned int j = 0;
j < TNumNodes;
j++)
1677 for (
unsigned int d = 0;
d < TDim;
d++)
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;
1712 const double Viscosity);
1743 if ( rProcessInfo[OSS_SWITCH] != 1 )
1746 ElementalMomRes *= TauOne;
1751 ElementalMomRes *= TauOne;
1755 double ErrorRatio(0.0);
1759 for (
unsigned int i = 0;
i < TDim; ++
i)
1761 ErrorRatio += ElementalMomRes[
i] * ElementalMomRes[
i];
1764 ErrorRatio = sqrt(ErrorRatio*Area);
1802 void save(
Serializer& rSerializer)
const override
1858 template<
unsigned int TDim,
1859 unsigned int TNumNodes >
1867 template<
unsigned int TDim,
1868 unsigned int TNumNodes >
1873 rOStream << std::endl;
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