40 #ifndef KRATOS_FS_WERNER_WENGLE_WALL_CONDITION_H
41 #define KRATOS_FS_WERNER_WENGLE_WALL_CONDITION_H
100 template<
unsigned int TDim,
unsigned int TNumNodes = TDim>
160 :
Condition(NewId, ThisNodes), mInitializeWasPerformed(false), mpElement()
170 :
Condition(NewId, pGeometry), mInitializeWasPerformed(false), mpElement()
181 PropertiesType::Pointer pProperties)
182 :
Condition(NewId, pGeometry, pProperties), mInitializeWasPerformed(false), mpElement()
188 mInitializeWasPerformed(rOther.mInitializeWasPerformed), mpElement(rOther.mpElement)
204 mInitializeWasPerformed = rOther.mInitializeWasPerformed;
205 mpElement = rOther.mpElement;
221 PropertiesType::Pointer pProperties)
const override
223 return Kratos::make_intrusive<FSWernerWengleWallCondition>(NewId,
GetGeometry().
Create(ThisNodes), pProperties);
234 GeometryType::Pointer pGeom,
235 PropertiesType::Pointer pProperties)
const override
237 return Kratos::make_intrusive<FSWernerWengleWallCondition>(NewId, pGeom, pProperties);
251 if (mInitializeWasPerformed)
256 mInitializeWasPerformed =
true;
263 mpElement = this->
GetValue(NEIGHBOUR_ELEMENTS)(0);
266 Edge = rElemGeom[1].Coordinates() - rElemGeom[0].Coordinates();
267 mMinEdgeLength = Edge[0] * Edge[0];
270 mMinEdgeLength += Edge[
d] * Edge[
d];
277 Edge = rElemGeom[
j].Coordinates() - rElemGeom[
k].Coordinates();
278 EdgeLength = Edge[0] * Edge[0];
282 EdgeLength += Edge[
d] * Edge[
d];
285 mMinEdgeLength = (EdgeLength < mMinEdgeLength) ? EdgeLength : mMinEdgeLength;
288 mMinEdgeLength = sqrt(mMinEdgeLength);
314 if (mInitializeWasPerformed ==
false)
319 if (rCurrentProcessInfo[FRACTIONAL_STEP] == 1)
322 const SizeType LocalSize = TDim * TNumNodes;
324 if (rLeftHandSideMatrix.size1() != LocalSize)
326 rLeftHandSideMatrix.
resize(LocalSize, LocalSize);
328 if (rRightHandSideVector.size() != LocalSize)
330 rRightHandSideVector.
resize(LocalSize);
337 this->
ApplyWallLaw(rLeftHandSideMatrix, rRightHandSideVector);
339 else if (rCurrentProcessInfo[FRACTIONAL_STEP] == 5)
342 const SizeType LocalSize = TNumNodes;
344 if (rLeftHandSideMatrix.size1() != LocalSize)
346 rLeftHandSideMatrix.
resize(LocalSize, LocalSize);
348 if (rRightHandSideVector.size() != LocalSize)
350 rRightHandSideVector.
resize(LocalSize);
356 if (this->
Is(INTERFACE))
357 this->
ApplyIACPenalty(rLeftHandSideMatrix, rRightHandSideVector, rCurrentProcessInfo);
361 if (rLeftHandSideMatrix.size1() != 0)
363 rLeftHandSideMatrix.
resize(0,0,
false);
366 if (rRightHandSideVector.size() != 0)
368 rRightHandSideVector.
resize(0,
false);
391 if(this->
GetGeometry()[
i].SolutionStepsDataHas(VELOCITY) ==
false)
393 if(this->
GetGeometry()[
i].SolutionStepsDataHas(MESH_VELOCITY) ==
false)
395 if(this->
GetGeometry()[
i].SolutionStepsDataHas(DENSITY) ==
false)
397 if(this->
GetGeometry()[
i].SolutionStepsDataHas(VISCOSITY) ==
false)
399 if(this->
GetGeometry()[
i].SolutionStepsDataHas(NORMAL) ==
false)
401 if(this->
GetGeometry()[
i].HasDofFor(VELOCITY_X) ==
false ||
402 this->
GetGeometry()[
i].HasDofFor(VELOCITY_Y) ==
false ||
421 const ProcessInfo& rCurrentProcessInfo)
const override;
429 const ProcessInfo& rCurrentProcessInfo)
const override;
438 const SizeType LocalSize = TDim * TNumNodes;
439 unsigned int LocalIndex = 0;
441 if (Values.size() != LocalSize)
443 Values.
resize(LocalSize,
false);
446 for (
unsigned int i = 0;
i < TNumNodes; ++
i)
449 for (
unsigned int d = 0;
d < TDim; ++
d)
451 Values[LocalIndex++] = rVelocity[
d];
468 std::vector<double>& rValues,
479 std::vector<Vector>& rValues,
485 std::vector<Matrix>& rValues,
497 std::string
Info()
const override
499 std::stringstream buffer;
500 buffer <<
"FSWernerWengleWallCondition" << TDim <<
"D";
506 { rOStream <<
"FSWernerWengleWallCondition";}
536 return mpElement->shared_from_this();
539 template<
class TVariableType >
546 rResult = rShapeFunc[0] * rGeom[0].FastGetSolutionStepValue(Var);
550 rResult += rShapeFunc[
i] * rGeom[
i].FastGetSolutionStepValue(Var);
569 const double A = 8.3;
570 const double Alpha = 1.0 / 7.0;
571 const double Small = 1.0e-12;
572 const unsigned int BlockSize = TDim;
573 double WallHeight, Area,
rho,
nu, WallVelMag, WallVelCut,
tmp, WallStress, WallForce;
578 WallHeight = (WallHeight > Small * mMinEdgeLength) ? WallHeight : Small * mMinEdgeLength;
579 WallVelMag =
norm_2(WallVel);
581 if (WallVelMag > Small)
587 WallVelCut =
nu * pow(
A, 2.0/(1.0-
Alpha)) / (2.0 * WallHeight);
590 if (WallVelMag <= WallVelCut)
592 WallStress = 2.0 *
rho *
nu * WallVelMag / WallHeight;
602 WallForce = (Area /
static_cast<double>(TNumNodes)) * WallStress;
607 if(rNode.
GetValue(Y_WALL) != 0.0 && rNode.
Is(SLIP))
611 WallVel /= (
tmp > Small) ?
tmp : 1.0;
613 for (
unsigned int d=0;
d < TDim;
d++)
615 unsigned int k =
i * BlockSize +
d;
616 rLocalVector[
k] -= WallVel[
d] * WallForce;
635 const double Area =
norm_2(rNormal);
636 const double DiagonalTerm = Area /
static_cast<double>(TNumNodes)
637 / (rCurrentProcessInfo[DENSITY] * rCurrentProcessInfo[BDF_COEFFICIENTS][0]);
641 rLeftHandSideMatrix(iNode,iNode) += DiagonalTerm;
662 bool mInitializeWasPerformed;
663 double mMinEdgeLength;
672 void save(
Serializer& rSerializer)
const override
675 rSerializer.
save(
"mInitializeWasPerformed",mInitializeWasPerformed);
676 rSerializer.
save(
"mMinEdgeLength",mMinEdgeLength);
677 rSerializer.
save(
"mpElement",mpElement);
683 rSerializer.
load(
"mInitializeWasPerformed",mInitializeWasPerformed);
684 rSerializer.
load(
"mMinEdgeLength",mMinEdgeLength);
685 rSerializer.
load(
"mpElement",mpElement);
722 template<
unsigned int TDim,
unsigned int TNumNodes>
730 template<
unsigned int TDim,
unsigned int TNumNodes>
735 rOStream << std::endl;
Base class for all Conditions.
Definition: condition.h:59
std::size_t SizeType
Definition: condition.h:94
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
Implements a power-law wall model.
Definition: fs_werner_wengle_wall_condition.h:102
Properties PropertiesType
Definition: fs_werner_wengle_wall_condition.h:112
void CalculateLocalSystem(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo) override
Calculate wall stress term for all nodes with SLIP set.
Definition: fs_werner_wengle_wall_condition.h:308
std::vector< Dof< double >::Pointer > DofsVectorType
Definition: fs_werner_wengle_wall_condition.h:138
Geometry< NodeType >::GeometriesArrayType GeometriesArrayType
Definition: fs_werner_wengle_wall_condition.h:120
GeometryType::ShapeFunctionsGradientsType ShapeFunctionDerivativesArrayType
Definition: fs_werner_wengle_wall_condition.h:130
Kratos::Vector ShapeFunctionsType
Definition: fs_werner_wengle_wall_condition.h:140
FSWernerWengleWallCondition(IndexType NewId, GeometryType::Pointer pGeometry)
Constructor using Geometry.
Definition: fs_werner_wengle_wall_condition.h:169
Geometry< NodeType >::PointType PointType
Definition: fs_werner_wengle_wall_condition.h:116
Geometry< NodeType > GeometryType
Definition: fs_werner_wengle_wall_condition.h:114
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: fs_werner_wengle_wall_condition.h:505
void GetValuesVector(Vector &Values, int Step=0) const override
Returns VELOCITY_X, VELOCITY_Y, (VELOCITY_Z) for each node.
Definition: fs_werner_wengle_wall_condition.h:436
ElementPointerType pGetElement()
Definition: fs_werner_wengle_wall_condition.h:534
void EquationIdVector(EquationIdVectorType &rResult, const ProcessInfo &rCurrentProcessInfo) const override
Provides the global indices for each one of this condition's local rows.
std::size_t SizeType
Definition: fs_werner_wengle_wall_condition.h:134
Matrix MatrixType
Definition: fs_werner_wengle_wall_condition.h:128
FSWernerWengleWallCondition(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties)
Constructor using Properties.
Definition: fs_werner_wengle_wall_condition.h:180
Geometry< NodeType >::PointsArrayType NodesArrayType
Definition: fs_werner_wengle_wall_condition.h:118
Element::WeakPointer ElementWeakPointerType
Definition: fs_werner_wengle_wall_condition.h:122
std::string Info() const override
Turn back information as a string.
Definition: fs_werner_wengle_wall_condition.h:497
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: fs_werner_wengle_wall_condition.h:509
void GetDofList(DofsVectorType &rConditionDofList, const ProcessInfo &rCurrentProcessInfo) const override
Returns a list of the condition's Dofs.
void CalculateLeftHandSide(MatrixType &rLeftHandSideMatrix, const ProcessInfo &rCurrentProcessInfo) override
Definition: fs_werner_wengle_wall_condition.h:294
Condition::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, PropertiesType::Pointer pProperties) const override
Create a new FSWernerWengleWallCondition object.
Definition: fs_werner_wengle_wall_condition.h:232
FSWernerWengleWallCondition(FSWernerWengleWallCondition const &rOther)
Copy constructor.
Definition: fs_werner_wengle_wall_condition.h:187
Node NodeType
Definition: fs_werner_wengle_wall_condition.h:110
std::vector< std::size_t > EquationIdVectorType
Definition: fs_werner_wengle_wall_condition.h:136
void CalculateWallParameters(double &rWallHeight, array_1d< double, 3 > &rWallVel, double &rArea)
Calculate input parameters to wall model.
void EvaluateInPoint(TVariableType &rResult, const Kratos::Variable< TVariableType > &Var, const ShapeFunctionsType &rShapeFunc)
Definition: fs_werner_wengle_wall_condition.h:540
void ApplyIACPenalty(MatrixType &rLeftHandSideMatrix, VectorType &rRightHandSideVector, const ProcessInfo &rCurrentProcessInfo)
Apply an IAC penalty term.
Definition: fs_werner_wengle_wall_condition.h:629
void ApplyWallLaw(MatrixType &rLocalMatrix, VectorType &rLocalVector)
Compute the wall stress and add corresponding terms to the system contributions.
Definition: fs_werner_wengle_wall_condition.h:567
~FSWernerWengleWallCondition() override
Destructor.
Definition: fs_werner_wengle_wall_condition.h:193
Condition::Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const override
Create a new FSWernerWengleWallCondition object.
Definition: fs_werner_wengle_wall_condition.h:219
std::size_t IndexType
Definition: fs_werner_wengle_wall_condition.h:132
Element::Pointer ElementPointerType
Definition: fs_werner_wengle_wall_condition.h:124
FSWernerWengleWallCondition(IndexType NewId, const NodesArrayType &ThisNodes)
Constructor using an array of nodes.
Definition: fs_werner_wengle_wall_condition.h:159
FSWernerWengleWallCondition(IndexType NewId=0)
Default constructor.
Definition: fs_werner_wengle_wall_condition.h:150
void CalculateOnIntegrationPoints(const Variable< array_1d< double, 3 > > &rVariable, std::vector< array_1d< double, 3 > > &rValues, const ProcessInfo &rCurrentProcessInfo) override
Definition: fs_werner_wengle_wall_condition.cpp:199
KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(FSWernerWengleWallCondition)
Pointer definition of FSWernerWengleWallCondition.
Vector VectorType
Definition: fs_werner_wengle_wall_condition.h:126
int Check(const ProcessInfo &rCurrentProcessInfo) const override
Check that all data required by this condition is available and reasonable.
Definition: fs_werner_wengle_wall_condition.h:376
FSWernerWengleWallCondition & operator=(FSWernerWengleWallCondition const &rOther)
Copy constructor.
Definition: fs_werner_wengle_wall_condition.h:201
void Initialize(const ProcessInfo &rCurrentProcessInfo) override
Find the condition's parent element.
Definition: fs_werner_wengle_wall_condition.h:241
std::size_t IndexType
Definition: flags.h:74
bool Is(Flags const &rOther) const
Definition: flags.h:274
TVariableType::Type & GetValue(const TVariableType &rThisVariable)
Definition: geometrical_object.h:248
GeometryType & GetGeometry()
Returns the reference of the geometry.
Definition: geometrical_object.h:158
Geometry base class.
Definition: geometry.h:71
SizeType PointsNumber() const
Definition: geometry.h:528
SizeType size() const
Definition: geometry.h:518
IndexType const & Id() const
Id of this Geometry.
Definition: geometry.h:964
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
TVariableType::Type & FastGetSolutionStepValue(const TVariableType &rThisVariable)
Definition: node.h:435
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
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
void load(std::string const &rTag, TDataType &rObject)
Definition: serializer.h:207
void save(std::string const &rTag, std::array< TDataType, TDataSize > const &rObject)
Definition: serializer.h:545
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
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
TExpressionType::data_type norm_2(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression)
Definition: amatrix_interface.h:625
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
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
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
rho
Definition: generate_droplet_dynamics.py:86
tuple tmp
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:98
nu
Definition: isotropic_damage_automatic_differentiation.py:135
def load(f)
Definition: ode_solve.py:307
int d
Definition: ode_solve.py:397
def Alpha(n, j)
Definition: quadrature.py:93
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
A
Definition: sensitivityMatrix.py:70
N
Definition: sensitivityMatrix.py:29
integer i
Definition: TensorModule.f:17