15 #if !defined(KRATOS_STOKES_ELEMENT_SYMBOLIC_3D_INCLUDED )
16 #define KRATOS_STOKES_ELEMENT_SYMBOLIC_3D_INCLUDED
29 #include "utilities/geometry_utilities.h"
70 template <
unsigned int TNumNodes,
unsigned int TDim>
99 Stokes3D(
IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
100 :
Element(NewId, pGeometry, pProperties)
119 return Kratos::make_intrusive< Stokes3D >(NewId,
GetGeometry().
Create(ThisNodes), pProperties);
123 GeometryType::Pointer pGeom,
124 PropertiesType::Pointer pProperties)
const override
126 return Kratos::make_intrusive< Stokes3D >(NewId, pGeom, pProperties);
134 const unsigned int NumNodes = 4;
135 const unsigned int Dim = 3;
136 const int ndofs = Dim + 1;
137 const unsigned int MatrixSize = NumNodes*ndofs;
139 if (rLeftHandSideMatrix.size1() != MatrixSize)
140 rLeftHandSideMatrix.
resize(MatrixSize, MatrixSize,
false);
142 if (rRightHandSideVector.size() != MatrixSize)
143 rRightHandSideVector.
resize(MatrixSize,
false);
161 const Vector& BDFVector = rCurrentProcessInfo[BDF_COEFFICIENTS];
162 data.bdf0 = BDFVector[0];
163 data.bdf1 = BDFVector[1];
164 data.bdf2 = BDFVector[2];
165 data.dyn_tau_coeff = rCurrentProcessInfo[DYNAMIC_TAU] *
data.bdf0;
168 for (
unsigned int i = 0;
i < NumNodes;
i++)
175 for(
unsigned int k=0;
k<Dim;
k++)
194 for(
unsigned int igauss = 0; igauss<1; igauss++)
204 noalias(rLeftHandSideMatrix) = lhs_local;
205 noalias(rRightHandSideVector) = rhs_local;
208 rLeftHandSideMatrix *= Volume;
209 rRightHandSideVector *= Volume;
227 const unsigned int NumNodes = 4;
228 const unsigned int Dim = 3;
229 const int ndofs = Dim + 1;
230 const unsigned int MatrixSize = NumNodes*ndofs;
232 if (rRightHandSideVector.size() != MatrixSize)
233 rRightHandSideVector.
resize(MatrixSize,
false);
247 const Vector& BDFVector = rCurrentProcessInfo[BDF_COEFFICIENTS];
248 data.bdf0 = BDFVector[0];
249 data.bdf1 = BDFVector[1];
250 data.bdf2 = BDFVector[2];
251 data.dyn_tau_coeff = rCurrentProcessInfo[DYNAMIC_TAU] *
data.bdf0;
254 for (
unsigned int i = 0;
i < NumNodes;
i++)
261 for(
unsigned int k=0;
k<Dim;
k++)
279 for(
unsigned int igauss = 0; igauss<1; igauss++)
288 noalias(rRightHandSideVector) += rhs_local;
291 rRightHandSideVector *= Volume;
306 const unsigned int NumNodes = 4;
309 if (rResult.size() != NumNodes*(Dim+1))
310 rResult.resize(NumNodes*(Dim+1),
false);
312 for(
unsigned int i=0;
i<NumNodes;
i++)
314 rResult[
i*(Dim+1) ] =
GetGeometry()[
i].GetDof(VELOCITY_X).EquationId();
315 rResult[
i*(Dim+1)+1] =
GetGeometry()[
i].GetDof(VELOCITY_Y).EquationId();
316 rResult[
i*(Dim+1)+2] =
GetGeometry()[
i].GetDof(VELOCITY_Z).EquationId();
317 rResult[
i*(Dim+1)+3] =
GetGeometry()[
i].GetDof(PRESSURE).EquationId();
333 const unsigned int NumNodes = 4;
336 if (ElementalDofList.size() != NumNodes*(Dim+1))
337 ElementalDofList.resize(NumNodes*(Dim+1));
339 for(
unsigned int i=0;
i<NumNodes;
i++)
341 ElementalDofList[
i*(Dim+1) ] =
GetGeometry()[
i].pGetDof(VELOCITY_X);
342 ElementalDofList[
i*(Dim+1)+1] =
GetGeometry()[
i].pGetDof(VELOCITY_Y);
343 ElementalDofList[
i*(Dim+1)+2] =
GetGeometry()[
i].pGetDof(VELOCITY_Z);
344 ElementalDofList[
i*(Dim+1)+3] =
GetGeometry()[
i].pGetDof(PRESSURE);
365 if(ErrorCode != 0)
return ErrorCode;
371 if(this->
GetGeometry()[
i].SolutionStepsDataHas(VELOCITY) ==
false)
373 if(this->
GetGeometry()[
i].SolutionStepsDataHas(PRESSURE) ==
false)
375 if(this->
GetGeometry()[
i].HasDofFor(VELOCITY_X) ==
false ||
376 this->
GetGeometry()[
i].HasDofFor(VELOCITY_Y) ==
false ||
385 KRATOS_ERROR <<
"The constitutive law was not set. Cannot proceed.";
400 if(rVariable == HEAT_FLUX)
402 const unsigned int NumNodes = 4;
403 const unsigned int Dim = 3;
414 for (
unsigned int i = 0;
i < NumNodes;
i++)
418 for(
unsigned int k=0;
k<Dim;
k++)
434 strain[3] =
DN(0,0)*
v(0,1) +
DN(0,1)*
v(0,0) +
DN(1,0)*
v(1,1) +
DN(1,1)*
v(1,0) +
DN(2,0)*
v(2,1) +
DN(2,1)*
v(2,0) +
DN(3,0)*
v(3,1) +
DN(3,1)*
v(3,0);
435 strain[4] =
DN(0,1)*
v(0,2) +
DN(0,2)*
v(0,1) +
DN(1,1)*
v(1,2) +
DN(1,2)*
v(1,1) +
DN(2,1)*
v(2,2) +
DN(2,2)*
v(2,1) +
DN(3,1)*
v(3,2) +
DN(3,2)*
v(3,1);
436 strain[5] =
DN(0,0)*
v(0,2) +
DN(0,2)*
v(0,0) +
DN(1,0)*
v(1,2) +
DN(1,2)*
v(1,0) +
DN(2,0)*
v(2,2) +
DN(2,2)*
v(2,0) +
DN(3,0)*
v(3,2) +
DN(3,2)*
v(3,0);
443 ConstitutiveLawOptions.
Set(ConstitutiveLaw::COMPUTE_STRESS);
444 ConstitutiveLawOptions.
Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR,
false);
481 std::string
Info()
const override
490 rOStream <<
Info() <<
Id();
528 template<
unsigned int TNumNodes,
unsigned int TDim>
532 for(
unsigned int i=0;
i<TNumNodes;
i++)
535 for(
unsigned int k=0;
k<TDim;
k++)
537 h_inv += DN_DX(
i,
k)*DN_DX(
i,
k);
541 h = sqrt(
h)/
static_cast<double>(TNumNodes);
548 Ncontainer(0,0) = 0.58541020; Ncontainer(0,1) = 0.13819660; Ncontainer(0,2) = 0.13819660; Ncontainer(0,3) = 0.13819660;
549 Ncontainer(1,0) = 0.13819660; Ncontainer(1,1) = 0.58541020; Ncontainer(1,2) = 0.13819660; Ncontainer(1,3) = 0.13819660;
550 Ncontainer(2,0) = 0.13819660; Ncontainer(2,1) = 0.13819660; Ncontainer(2,2) = 0.58541020; Ncontainer(2,3) = 0.13819660;
551 Ncontainer(3,0) = 0.13819660; Ncontainer(3,1) = 0.13819660; Ncontainer(3,2) = 0.13819660; Ncontainer(3,3) = 0.58541020;
557 const double one_sixt = 1.0/6.0;
558 const double two_third = 2.0/3.0;
559 Ncontainer(0,0) = one_sixt; Ncontainer(0,1) = one_sixt; Ncontainer(0,2) = two_third;
560 Ncontainer(1,0) = one_sixt; Ncontainer(1,1) = two_third; Ncontainer(1,2) = one_sixt;
561 Ncontainer(2,0) = two_third; Ncontainer(2,1) = one_sixt; Ncontainer(2,2) = one_sixt;
566 const unsigned int nnodes = 4;
567 const unsigned int dim = 3;
588 strain[3] =
DN(0,0)*
v(0,1) +
DN(0,1)*
v(0,0) +
DN(1,0)*
v(1,1) +
DN(1,1)*
v(1,0) +
DN(2,0)*
v(2,1) +
DN(2,1)*
v(2,0) +
DN(3,0)*
v(3,1) +
DN(3,1)*
v(3,0);
589 strain[4] =
DN(0,1)*
v(0,2) +
DN(0,2)*
v(0,1) +
DN(1,1)*
v(1,2) +
DN(1,2)*
v(1,1) +
DN(2,1)*
v(2,2) +
DN(2,2)*
v(2,1) +
DN(3,1)*
v(3,2) +
DN(3,2)*
v(3,1);
590 strain[5] =
DN(0,0)*
v(0,2) +
DN(0,2)*
v(0,0) +
DN(1,0)*
v(1,2) +
DN(1,2)*
v(1,0) +
DN(2,0)*
v(2,2) +
DN(2,2)*
v(2,0) +
DN(3,0)*
v(3,2) +
DN(3,2)*
v(3,0);
610 ConstitutiveLawOptions.
Set(ConstitutiveLaw::COMPUTE_STRESS);
611 ConstitutiveLawOptions.
Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR);
668 void save(
Serializer& rSerializer)
const override
Base class for all Elements.
Definition: element.h:60
PropertiesType & GetProperties()
Definition: element.h:1024
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
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
void Set(const Flags ThisFlag)
Definition: flags.cpp:33
GeometryType & GetGeometry()
Returns the reference of the geometry.
Definition: geometrical_object.h:158
SizeType size() const
Definition: geometry.h:518
IndexType const & Id() const
Id of this Geometry.
Definition: geometry.h:964
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
IndexType Id() const
Definition: indexed_object.h:107
Definition: amatrix_interface.h:41
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
Definition: stokes_3D.h:62
Stokes3D(IndexType NewId, GeometryType::Pointer pGeometry)
Default constructor.
Definition: stokes_3D.h:95
void ComputeGaussPointRHSContribution(array_1d< double, 16 > &rhs, const element_data< 4, 3 > &data)
Definition: stokes_3D.cpp:454
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Definition: stokes_3D.h:130
virtual void ComputeConstitutiveResponse(element_data< 4, 3 > &data, const ProcessInfo &rCurrentProcessInfo)
Definition: stokes_3D.h:564
Stokes3D(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Definition: stokes_3D.h:99
void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const override
Definition: stokes_3D.h:302
void Calculate(const Variable< double > &rVariable, double &Output, const ProcessInfo &rCurrentProcessInfo) override
Definition: stokes_3D.h:394
int Check(const ProcessInfo &rCurrentProcessInfo) const override
Checks the input and that all required Kratos variables have been registered.
Definition: stokes_3D.h:359
~Stokes3D() override
Destructor.
Definition: stokes_3D.h:104
ConstitutiveLaw::Pointer mp_constitutive_law
Definition: stokes_3D.h:653
Element::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const override
It creates a new element pointer.
Definition: stokes_3D.h:116
void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Definition: stokes_3D.h:223
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: stokes_3D.h:488
void GetShapeFunctionsOnGauss(BoundedMatrix< double, 4, 4 > &Ncontainer)
Definition: stokes_3D.h:546
void GetShapeFunctionsOnGauss(BoundedMatrix< double, 3, 3 > &Ncontainer)
Definition: stokes_3D.h:555
Stokes3D()
Definition: stokes_3D.h:521
Element::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, PropertiesType::Pointer pProperties) const override
It creates a new element pointer.
Definition: stokes_3D.h:122
double ComputeH(BoundedMatrix< double, TNumNodes, TDim > &DN_DX, const double Volume)
Definition: stokes_3D.h:529
void GetDofList(DofsVectorType &ElementalDofList, const ProcessInfo &rCurrentProcessInfo) const override
Definition: stokes_3D.h:329
void Initialize(const ProcessInfo &rCurrentProcessInfo) override
Definition: stokes_3D.h:624
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(Stokes3D)
Counted pointer of.
void ComputeGaussPointLHSContribution(BoundedMatrix< double, 16, 16 > &lhs, const element_data< 4, 3 > &data)
Definition: stokes_3D.cpp:7
std::string Info() const override
Turn back information as a string.
Definition: stokes_3D.h:481
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
#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
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
TExpression1Type::data_type inner_prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:592
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
AMatrix::MatrixRow< const TExpressionType > row(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression, std::size_t RowIndex)
Definition: amatrix_interface.h:649
v
Definition: generate_convection_diffusion_explicit_element.py:114
DN
Definition: generate_convection_diffusion_explicit_element.py:98
h
Definition: generate_droplet_dynamics.py:91
rhs
Definition: generate_frictional_mortar_condition.py:297
lhs
Definition: generate_frictional_mortar_condition.py:297
int strain_size
Definition: generate_hyper_elastic_simo_taylor_neo_hookean.py:16
strain
HERE WE MUST SUBSTITUTE EXPRESSIONS.
Definition: generate_stokes_twofluid_element.py:104
data
Definition: mesh_to_mdpa_converter.py:59
def load(f)
Definition: ode_solve.py:307
vel
Definition: pure_conduction.py:76
int k
Definition: quadrature.py:595
body_force
Definition: script_ELASTIC.py:102
int dim
Definition: sensitivityMatrix.py:25
int nnodes
Definition: sensitivityMatrix.py:24
integer i
Definition: TensorModule.f:17
Definition: constitutive_law.h:189
void SetConstitutiveMatrix(VoigtSizeMatrixType &rConstitutiveMatrix)
Definition: constitutive_law.h:403
void SetStrainVector(StrainVectorType &rStrainVector)
Definition: constitutive_law.h:401
Flags & GetOptions()
Definition: constitutive_law.h:412
void SetStressVector(StressVectorType &rStressVector)
Definition: constitutive_law.h:402
void SetShapeFunctionsValues(const Vector &rShapeFunctionsValues)
Definition: constitutive_law.h:396
Definition: stokes_3D.h:72
BoundedMatrix< double, TNumNodes, TDim > f
Definition: stokes_3D.h:73
double h
Definition: stokes_3D.h:85
array_1d< double, TNumNodes > p
Definition: stokes_3D.h:74
BoundedMatrix< double, TNumNodes, TDim > vnn
Definition: stokes_3D.h:73
double dyn_tau_coeff
Definition: stokes_3D.h:86
double bdf1
Definition: stokes_3D.h:83
BoundedMatrix< double, TNumNodes, TDim > DN_DX
Definition: stokes_3D.h:76
array_1d< double, TNumNodes > N
Definition: stokes_3D.h:77
double bdf2
Definition: stokes_3D.h:84
BoundedMatrix< double, TNumNodes, TDim > vn
Definition: stokes_3D.h:73
BoundedMatrix< double, TNumNodes, TDim > v
Definition: stokes_3D.h:73
Vector stress
Definition: stokes_3D.h:80
array_1d< double, TNumNodes > rho
Definition: stokes_3D.h:74
double bdf0
Definition: stokes_3D.h:82
Matrix C
Definition: stokes_3D.h:79