13 #ifndef KRATOS_MONOLITHIC_WALL_CONDITION_H
14 #define KRATOS_MONOLITHIC_WALL_CONDITION_H
68 template<
unsigned int TDim,
unsigned int TNumNodes = TDim >
130 GeometryType::Pointer pGeometry):
142 GeometryType::Pointer pGeometry,
143 PropertiesType::Pointer pProperties):
182 return Kratos::make_intrusive<MonolithicWallCondition>(NewId, GetGeometry().
Create(ThisNodes), pProperties);
186 GeometryType::Pointer pGeom,
187 PropertiesType::Pointer pProperties)
const override
189 return Kratos::make_intrusive< MonolithicWallCondition >(NewId, pGeom, pProperties);
202 Condition::Pointer pNewCondition =
Create(NewId, GetGeometry().
Create( rThisNodes ), pGetProperties() );
204 pNewCondition->SetData(this->GetData());
205 pNewCondition->SetFlags(this->GetFlags());
207 return pNewCondition;
218 const SizeType BlockSize = TDim + 1;
219 const SizeType LocalSize = BlockSize * TNumNodes;
221 if (rLeftHandSideMatrix.size1() != LocalSize)
222 rLeftHandSideMatrix.
resize(LocalSize,LocalSize);
224 if (rRightHandSideVector.size() != LocalSize)
225 rRightHandSideVector.
resize(LocalSize);
239 const SizeType BlockSize = TDim + 1;
240 const SizeType LocalSize = BlockSize * TNumNodes;
242 if (rLeftHandSideMatrix.size1() != LocalSize)
243 rLeftHandSideMatrix.
resize(LocalSize,LocalSize);
255 const SizeType BlockSize = TDim + 1;
256 const SizeType LocalSize = BlockSize * TNumNodes;
258 if (rRightHandSideVector.size() != LocalSize)
259 rRightHandSideVector.
resize(LocalSize);
270 this->CalculateLocalVelocityContribution(rDampingMatrix,RHS,rCurrentProcessInfo);
281 void CalculateLocalVelocityContribution(
MatrixType& rDampingMatrix,
301 for(
unsigned int i=0;
i<this->GetGeometry().size(); ++
i)
303 if(this->GetGeometry()[
i].SolutionStepsDataHas(VELOCITY) ==
false)
304 KRATOS_THROW_ERROR(std::invalid_argument,
"missing VELOCITY variable on solution step data for node ",this->GetGeometry()[
i].Id());
305 if(this->GetGeometry()[
i].SolutionStepsDataHas(PRESSURE) ==
false)
306 KRATOS_THROW_ERROR(std::invalid_argument,
"missing PRESSURE variable on solution step data for node ",this->GetGeometry()[
i].Id());
307 if(this->GetGeometry()[
i].SolutionStepsDataHas(MESH_VELOCITY) ==
false)
308 KRATOS_THROW_ERROR(std::invalid_argument,
"missing MESH_VELOCITY variable on solution step data for node ",this->GetGeometry()[
i].Id());
309 if(this->GetGeometry()[
i].SolutionStepsDataHas(ACCELERATION) ==
false)
310 KRATOS_THROW_ERROR(std::invalid_argument,
"missing ACCELERATION variable on solution step data for node ",this->GetGeometry()[
i].Id());
311 if(this->GetGeometry()[
i].SolutionStepsDataHas(EXTERNAL_PRESSURE) ==
false)
312 KRATOS_THROW_ERROR(std::invalid_argument,
"missing EXTERNAL_PRESSURE variable on solution step data for node ",this->GetGeometry()[
i].Id());
313 if(this->GetGeometry()[
i].HasDofFor(VELOCITY_X) ==
false ||
314 this->GetGeometry()[
i].HasDofFor(VELOCITY_Y) ==
false ||
315 this->GetGeometry()[
i].HasDofFor(VELOCITY_Z) ==
false)
316 KRATOS_THROW_ERROR(std::invalid_argument,
"missing VELOCITY component degree of freedom on node ",this->GetGeometry()[
i].Id());
317 if(this->GetGeometry()[
i].HasDofFor(PRESSURE) ==
false)
318 KRATOS_THROW_ERROR(std::invalid_argument,
"missing PRESSURE component degree of freedom on node ",this->GetGeometry()[
i].Id());
334 const ProcessInfo& rCurrentProcessInfo)
const override;
343 const ProcessInfo& CurrentProcessInfo)
const override;
352 int Step = 0)
const override
354 const SizeType LocalSize = (TDim + 1) * TNumNodes;
355 unsigned int LocalIndex = 0;
357 if (Values.size() != LocalSize)
358 Values.
resize(LocalSize,
false);
360 for (
unsigned int iNode = 0; iNode < TNumNodes; ++iNode)
362 const array_1d<double,3>& rVelocity = this->GetGeometry()[iNode].FastGetSolutionStepValue(VELOCITY, Step);
363 for (
unsigned int d = 0;
d < TDim; ++
d)
364 Values[LocalIndex++] = rVelocity[
d];
365 Values[LocalIndex++] = this->GetGeometry()[iNode].FastGetSolutionStepValue(PRESSURE, Step);
376 int Step = 0)
const override
378 const SizeType LocalSize = (TDim + 1) * TNumNodes;
379 unsigned int LocalIndex = 0;
381 if (Values.size() != LocalSize)
382 Values.
resize(LocalSize,
false);
384 for (
unsigned int iNode = 0; iNode < TNumNodes; ++iNode)
386 const array_1d<double,3>& rVelocity = this->GetGeometry()[iNode].FastGetSolutionStepValue(ACCELERATION, Step);
387 for (
unsigned int d = 0;
d < TDim; ++
d)
388 Values[LocalIndex++] = rVelocity[
d];
389 Values[LocalIndex++] = 0.0;
401 std::vector<double>& rValues,
411 std::vector<Vector>& rValues,
416 std::vector<Matrix>& rValues,
434 std::string
Info()
const override
436 std::stringstream buffer;
437 buffer <<
"MonolithicWallCondition" << TDim <<
"D";
444 rOStream <<
"MonolithicWallCondition";
448 void PrintData(std::ostream& rOStream)
const override {}
487 const size_t BlockSize = TDim + 1;
488 const double NodalFactor = 1.0 /
double(TDim);
490 double area = NodalFactor * rGeometry.
DomainSize();
493 for(
size_t itNode = 0; itNode < rGeometry.
PointsNumber(); ++itNode)
495 const NodeType& rConstNode = rGeometry[itNode];
496 const double y = rConstNode.
GetValue(Y_WALL);
497 if(
y > 0.0 && rConstNode.
Is(SLIP) )
500 const array_1d<double,3>& VelMesh = rGeometry[itNode].FastGetSolutionStepValue(MESH_VELOCITY);
502 const double Ikappa = 1.0/0.41;
503 const double B = 5.2;
504 const double limit_yplus = 10.9931899;
506 const double rho = rGeometry[itNode].FastGetSolutionStepValue(DENSITY);
507 const double nu = rGeometry[itNode].FastGetSolutionStepValue(VISCOSITY);
509 double wall_vel = 0.0;
510 for (
size_t d = 0;
d < TDim;
d++)
512 wall_vel += Vel[
d]*Vel[
d];
514 wall_vel = sqrt(wall_vel);
516 if (wall_vel > 1
e-12)
520 double utau = sqrt(wall_vel *
nu /
y);
521 double yplus =
y * utau /
nu;
524 if (yplus > limit_yplus)
532 unsigned int iter = 0;
534 const double tol = 1
e-6;
535 double uplus = Ikappa * log(yplus) +
B;
537 while(iter < 100 && fabs(dx) >
tol * utau)
540 double f = utau * uplus - wall_vel;
541 double df = uplus + Ikappa;
546 yplus =
y * utau /
nu;
547 uplus = Ikappa * log(yplus) +
B;
552 std::cout <<
"Warning: wall condition Newton-Raphson did not converge. Residual is " << dx << std::endl;
555 const double Tmp = area * utau * utau *
rho / wall_vel;
556 for (
size_t d = 0;
d < TDim;
d++)
558 size_t k = itNode*BlockSize+
d;
559 rLocalVector[
k] -= Vel[
d] * Tmp;
560 rLocalMatrix(
k,
k) += Tmp;
607 void save(
Serializer& rSerializer)
const override
659 template<
unsigned int TDim,
unsigned int TNumNodes >
667 template<
unsigned int TDim,
unsigned int TNumNodes >
672 rOStream << std::endl;
Base class for all Conditions.
Definition: condition.h:59
std::size_t SizeType
Definition: condition.h:94
std::vector< std::size_t > EquationIdVectorType
Definition: condition.h:98
std::vector< DofType::Pointer > DofsVectorType
Definition: condition.h:100
virtual int Check(const ProcessInfo &rCurrentProcessInfo) const
Definition: condition.h:854
Condition & operator=(Condition const &rOther)
Assignment operator.
Definition: condition.h:181
std::size_t IndexType
Definition: flags.h:74
bool Is(Flags const &rOther) const
Definition: flags.h:274
Geometry base class.
Definition: geometry.h:71
SizeType PointsNumber() const
Definition: geometry.h:528
virtual double DomainSize() const
This method calculate and return length, area or volume of this geometry depending to it's dimension.
Definition: geometry.h:1371
This object defines an indexed object.
Definition: indexed_object.h:54
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
Implements a wall condition for the monolithic formulation.
Definition: monolithic_wall_condition.h:70
MonolithicWallCondition(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Constructor using Properties.
Definition: monolithic_wall_condition.h:141
Properties PropertiesType
Definition: monolithic_wall_condition.h:80
Condition::Pointer Clone(IndexType NewId, NodesArrayType const &rThisNodes) const override
Definition: monolithic_wall_condition.h:200
~MonolithicWallCondition() override
Destructor.
Definition: monolithic_wall_condition.h:155
Condition::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, PropertiesType::Pointer pProperties) const override
It creates a new condition pointer.
Definition: monolithic_wall_condition.h:185
virtual void ApplyWallLaw(MatrixType &rLocalMatrix, VectorType &rLocalVector, const ProcessInfo &rCurrentProcessInfo)
Commpute the wall stress and add corresponding terms to the system contributions.
Definition: monolithic_wall_condition.h:482
void CalculateNormal(array_1d< double, 3 > &An)
PointerVectorSet< Dof< double >, IndexedObject > DofsArrayType
Definition: monolithic_wall_condition.h:98
void CalculateLeftHandSide(MatrixType &rLeftHandSideMatrix, const ProcessInfo &rCurrentProcessInfo) override
Return a matrix of the correct size, filled with zeros (for compatibility with time schemes).
Definition: monolithic_wall_condition.h:235
void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const override
Provides the global indices for each one of this element's local rows.
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: monolithic_wall_condition.h:448
int Check(const ProcessInfo &rCurrentProcessInfo) const override
Check that all data required by this condition is available and reasonable.
Definition: monolithic_wall_condition.h:287
MonolithicWallCondition(IndexType NewId=0)
Default constructor.
Definition: monolithic_wall_condition.h:108
MonolithicWallCondition & operator=(MonolithicWallCondition const &rOther)
Assignment operator.
Definition: monolithic_wall_condition.h:163
Geometry< NodeType > GeometryType
Definition: monolithic_wall_condition.h:82
void CalculateDampingMatrix(MatrixType &rDampingMatrix, const ProcessInfo &rCurrentProcessInfo) override
Definition: monolithic_wall_condition.h:266
void GetSecondDerivativesVector(Vector &Values, int Step=0) const override
Returns ACCELERATION_X, ACCELERATION_Y, (ACCELERATION_Z,) 0 for each node.
Definition: monolithic_wall_condition.h:375
std::size_t SizeType
Definition: monolithic_wall_condition.h:92
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(MonolithicWallCondition)
Pointer definition of MonolithicWallCondition.
Condition::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const override
Create a new MonolithicWallCondition object.
Definition: monolithic_wall_condition.h:180
Geometry< NodeType >::PointsArrayType NodesArrayType
Definition: monolithic_wall_condition.h:84
Node NodeType
Definition: monolithic_wall_condition.h:78
MonolithicWallCondition(MonolithicWallCondition const &rOther)
Copy constructor.
Definition: monolithic_wall_condition.h:149
void GetDofList(DofsVectorType &ConditionDofList, const ProcessInfo &CurrentProcessInfo) const override
Returns a list of the element's Dofs.
std::vector< std::size_t > EquationIdVectorType
Definition: monolithic_wall_condition.h:94
void GetFirstDerivativesVector(Vector &Values, int Step=0) const override
Returns VELOCITY_X, VELOCITY_Y, (VELOCITY_Z,) PRESSURE for each node.
Definition: monolithic_wall_condition.h:351
std::size_t IndexType
Definition: monolithic_wall_condition.h:90
Matrix MatrixType
Definition: monolithic_wall_condition.h:88
MonolithicWallCondition(IndexType NewId, const NodesArrayType &ThisNodes)
Constructor using an array of nodes.
Definition: monolithic_wall_condition.h:118
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Return local contributions of the correct size, filled with zeros (for compatibility with time scheme...
Definition: monolithic_wall_condition.h:214
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: monolithic_wall_condition.h:442
void CalculateRightHandSide(VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Return local right hand side of the correct size, filled with zeros (for compatibility with time sche...
Definition: monolithic_wall_condition.h:252
std::string Info() const override
Turn back information as a string.
Definition: monolithic_wall_condition.h:434
std::vector< Dof< double >::Pointer > DofsVectorType
Definition: monolithic_wall_condition.h:96
Vector VectorType
Definition: monolithic_wall_condition.h:86
MonolithicWallCondition(IndexType NewId, GeometryType::Pointer pGeometry)
Constructor using Geometry.
Definition: monolithic_wall_condition.h:129
This class defines the node.
Definition: node.h:65
TVariableType::Type & GetValue(const TVariableType &rThisVariable)
Definition: node.h:466
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
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
#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
Modeler::Pointer Create(const std::string &ModelerName, Model &rModel, const Parameters ModelParameters)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:30
pybind11::list CalculateOnIntegrationPoints(TObject &dummy, const Variable< TDataType > &rVariable, const ProcessInfo &rProcessInfo)
Definition: add_mesh_to_python.cpp:142
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
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
y
Other simbols definition.
Definition: generate_axisymmetric_navier_stokes_element.py:54
f
Definition: generate_convection_diffusion_explicit_element.py:112
rho
Definition: generate_droplet_dynamics.py:86
int tol
Definition: hinsberg_optimization.py:138
nu
Definition: isotropic_damage_automatic_differentiation.py:135
def load(f)
Definition: ode_solve.py:307
int d
Definition: ode_solve.py:397
int k
Definition: quadrature.py:595
B
Definition: sensitivityMatrix.py:76
integer i
Definition: TensorModule.f:17
e
Definition: run_cpp_mpi_tests.py:31