10 #if !defined(KRATOS_PLANE_BOUNDING_BOX_H_INCLUDED )
11 #define KRATOS_PLANE_BOUNDING_BOX_H_INCLUDED
107 std::cout<<
"Calling Rigid Plane Wall BBX empty constructor" <<std::endl;
123 "point": [0.0, 0.0, 0.0],
124 "normal": [0.0, 0.0, 0.0],
127 "velocity": [0.0, 0.0, 0.0],
136 if(CustomParameters[
"parameters_list"].IsArray() ==
true && CustomParameters[
"parameters_list"].size() != 1)
144 Parameters BoxParameters = CustomParameters[
"parameters_list"][0];
166 for(
unsigned int i=0;
i<3;
i++)
196 std::cout<<
" [--PLANE WALL--] "<<std::endl;
205 std::cout<<
" [ERROR: Normal is Zero]"<<std::endl;
211 std::cout<<
" [--------] "<<std::endl;
293 bool is_inside =
false;
305 is_inside = ContactSearch(rPoint, PlanePoint);
321 bool is_inside =
false;
326 is_inside = ContactSearch(rValues, rCurrentProcessInfo);
347 for (
unsigned int i = 0;
i < 3;
i++)
349 rT1(
i) = T1(
i); rT2(
i) = T2(
i);
362 unsigned int NodeId = 0;
368 unsigned int InitialNodeId = NodeId;
371 std::vector<std::string> BoundaryModelPartsName;
379 if( i_mp->Is(BOUNDARY) || i_mp->Is(ACTIVE) ){
380 for(ModelPart::NodesContainerType::iterator i_node = i_mp->NodesBegin() ; i_node != i_mp->NodesEnd() ; ++i_node)
382 if( i_node->Id() == rModelPart.
Nodes().front().Id() ){
383 BoundaryModelPartsName.push_back(i_mp->Name());
412 double PlaneRadius =
norm_2(Upper-Lower);
419 angular_partitions = 2;
421 angular_partitions = 4;
424 for(
int k=0;
k<angular_partitions;
k++)
426 alpha = (2.0 * 3.14159262 *
k)/(
double)angular_partitions;
429 RotationAxis = DirectionX *
alpha;
432 RotatedDirectionY = DirectionY;
439 noalias(BasePoint) = PlaneCenter + PlaneRadius * RotatedDirectionY;
441 NodeType::Pointer pNode = this->
CreateNode(rModelPart, BasePoint, NodeId);
443 pNode->Set(RIGID,
true);
448 for(
unsigned int j=0;
j<BoundaryModelPartsName.size();
j++)
449 (pMainModelPart->
GetSubModelPart(BoundaryModelPartsName[
j])).AddNode( pNode );
456 std::cout<<
" CREATE a LINE mesh "<<std::endl;
460 std::cout<<
" CREATE a QUADRILATERAL mesh "<<std::endl;
485 virtual std::string
Info()
const override
487 return "PlaneBoundingBox";
491 virtual void PrintInfo(std::ostream& rOStream)
const override
497 virtual void PrintData(std::ostream& rOStream)
const override
542 if( i_mp->Is(ACTIVE) )
548 if( i_mp->Is(ACTIVE) )
554 unsigned int ElementId = 0;
560 unsigned int NodeId = 0;
568 GeometryType::Pointer pFace;
569 ElementType::Pointer pElement;
573 Properties::Pointer pProperties = Kratos::make_shared<Properties>(number_of_properties);
576 unsigned int Id = rInitialNodeId;
586 FaceNodesIds[0] = rInitialNodeId +
counter ;
587 FaceNodesIds[1] = rInitialNodeId +
counter + 1;
596 for(
unsigned int j=0;
j<2;
j++)
599 pFace = Kratos::make_shared<Line2D2<NodeType> >(FaceNodes);
600 pElement = Kratos::make_intrusive<Element>(ElementId, pFace, pProperties);
603 pElement->Set(ACTIVE,
false);
604 pComputingModelPart->AddElement(pElement);
606 Id = rInitialNodeId +
counter + 2;
628 if( i_mp->Is(ACTIVE) )
634 if( i_mp->Is(ACTIVE) )
640 unsigned int ElementId = 0;
646 unsigned int NodeId = 0;
654 GeometryType::Pointer pFace;
655 ElementType::Pointer pElement;
659 Properties::Pointer pProperties = Kratos::make_shared<Properties>(number_of_properties);
662 unsigned int Id = rInitialNodeId;
672 FaceNodesIds[0] = rInitialNodeId +
counter ;
673 FaceNodesIds[1] = rInitialNodeId +
counter + 1;
674 FaceNodesIds[2] = rInitialNodeId +
counter + 2;
675 FaceNodesIds[3] = rInitialNodeId +
counter + 3;
686 for(
unsigned int j=0;
j<4;
j++)
689 pFace = Kratos::make_shared<Quadrilateral3D4<NodeType> >(FaceNodes);
690 pElement = Kratos::make_intrusive<Element>(ElementId, pFace, pProperties);
693 pElement->Set(ACTIVE,
false);
694 pComputingModelPart->AddElement(pElement);
696 Id = rInitialNodeId +
counter + 3;
762 bool ContactSearch(BoundingBoxParameters& rValues,
const ProcessInfo& rCurrentProcessInfo)
766 const PointType& rPoint = rValues.GetPoint();
767 PointType& rNormal = rValues.GetNormal();
768 PointType& rTangent = rValues.GetTangent();
770 double& rGapNormal = rValues.GetGapNormal();
Base class for all Elements.
Definition: element.h:60
Geometry base class.
Definition: geometry.h:71
SizeType WorkingSpaceDimension() const
Definition: mesh.h:237
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
SubModelPartIterator SubModelPartsEnd()
Definition: model_part.h:1708
SubModelPartIterator SubModelPartsBegin()
Definition: model_part.h:1698
void AddNode(NodeType::Pointer pNewNode, IndexType ThisIndex=0)
Definition: model_part.cpp:211
SizeType NumberOfProperties(IndexType ThisIndex=0) const
Returns the number of properties of the mesh.
Definition: model_part.cpp:575
bool IsSubModelPart() const
Definition: model_part.h:1893
SubModelPartsContainerType::iterator SubModelPartIterator
Iterator over the sub model parts of this model part.
Definition: model_part.h:258
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
NodeType::Pointer pGetNode(IndexType NodeId, IndexType ThisIndex=0)
Definition: model_part.h:421
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
ModelPart & GetSubModelPart(std::string const &SubModelPartName)
Definition: model_part.cpp:2029
void AddElement(ElementType::Pointer pNewElement, IndexType ThisIndex=0)
Definition: model_part.cpp:917
ModelPart & GetParentModelPart()
Definition: model_part.cpp:2124
MeshType & GetMesh(IndexType ThisIndex=0)
Definition: model_part.h:1791
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
This class defines the node.
Definition: node.h:65
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
double GetDouble() const
This method returns the double contained in the current Parameter.
Definition: kratos_parameters.cpp:657
const std::string PrettyPrintJsonString() const
This method returns a string with the corresponding text to the equivalent *.json file (this version ...
Definition: kratos_parameters.cpp:415
int GetInt() const
This method returns the integer contained in the current Parameter.
Definition: kratos_parameters.cpp:666
void ValidateAndAssignDefaults(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing match the form prescribed by th...
Definition: kratos_parameters.cpp:1306
Short class definition.
Definition: plane_bounding_box.hpp:57
virtual void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: plane_bounding_box.hpp:497
virtual void GetParametricDirections(BoundingBoxParameters &rValues, Vector &rT1, Vector &rT2) override
Definition: plane_bounding_box.hpp:336
PlaneBoundingBox(PointType Point, PointType Normal, PointType Velocity, int Convexity)
Definition: plane_bounding_box.hpp:189
PlaneBoundingBox & operator=(PlaneBoundingBox const &rOther)
Assignment operator.
Definition: plane_bounding_box.hpp:227
ModelPart::ElementType ElementType
Definition: plane_bounding_box.hpp:66
void UpdateBoxPosition(const double &rCurrentTime) override
Definition: plane_bounding_box.hpp:268
NodesContainerType::Pointer NodesContainerTypePointer
Definition: plane_bounding_box.hpp:64
ElementType::GeometryType GeometryType
Definition: plane_bounding_box.hpp:67
PlaneBoundingBox(PlaneBoundingBox const &rOther)
Copy constructor.
Definition: plane_bounding_box.hpp:242
void CreateBoundingBoxBoundaryMesh(ModelPart &rModelPart, int linear_partitions=4, int angular_partitions=4) override
Definition: plane_bounding_box.hpp:358
PlaneBoundingBox()
Default constructor.
Definition: plane_bounding_box.hpp:103
Quaternion< double > QuaternionType
Definition: plane_bounding_box.hpp:65
bool IsInside(BoundingBoxParameters &rValues, const ProcessInfo &rCurrentProcessInfo) override
Definition: plane_bounding_box.hpp:317
ModelPart::NodesContainerType NodesContainerType
Definition: plane_bounding_box.hpp:63
PlaneBoundingBox(Parameters CustomParameters)
Definition: plane_bounding_box.hpp:115
virtual void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: plane_bounding_box.hpp:491
KRATOS_CLASS_POINTER_DEFINITION(PlaneBoundingBox)
Pointer definition of PlaneBoundingBox.
ModelPart::NodeType NodeType
Definition: plane_bounding_box.hpp:62
PlaneVariables mPlane
Definition: plane_bounding_box.hpp:518
virtual ~PlaneBoundingBox()
Destructor.
Definition: plane_bounding_box.hpp:252
virtual std::string Info() const override
Turn back information as a string.
Definition: plane_bounding_box.hpp:485
void CreateQuadrilateralBoundaryMesh(ModelPart &rModelPart, const unsigned int &rInitialNodeId)
Definition: plane_bounding_box.hpp:618
void CreateLinearBoundaryMesh(ModelPart &rModelPart, const unsigned int &rInitialNodeId)
Definition: plane_bounding_box.hpp:532
bool IsInside(const PointType &rPoint, double &rCurrentTime, double Radius=0) override
Definition: plane_bounding_box.hpp:288
array_1d< double, 3 > PointType
Definition: plane_bounding_box.hpp:61
Point class.
Definition: point.h:59
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
void reserve(size_type dim)
Definition: pointer_vector.h:319
void push_back(const TPointerType &x)
Definition: pointer_vector.h:270
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
void RotateVector3(const TVector3_A &a, TVector3_B &b) const
Definition: quaternion.h:325
static Quaternion FromRotationVector(double rx, double ry, double rz)
Definition: quaternion.h:427
Short class definition.
Definition: spatial_bounding_box.hpp:48
bool mRigidBodyCenterSupplied
Definition: spatial_bounding_box.hpp:1150
PointType GetBoxDisplacement(const double &rCurrentTime)
Definition: spatial_bounding_box.hpp:1181
void CalculateOrthonormalBase(PointType &rDirectionVectorX, PointType &rDirectionVectorY, PointType &rDirectionVectorZ)
Definition: spatial_bounding_box.hpp:1408
void ComputeContactTangent(BoundingBoxParameters &rValues, const ProcessInfo &rCurrentProcessInfo)
Definition: spatial_bounding_box.hpp:1274
NodeType::Pointer CreateNode(ModelPart &rModelPart, PointType &rPoint, const unsigned int &rNodeId)
Definition: spatial_bounding_box.hpp:1357
static unsigned int GetMaxNodeId(ModelPart &rModelPart)
Definition: spatial_bounding_box.hpp:1314
static unsigned int GetMaxElementId(ModelPart &rModelPart)
Definition: spatial_bounding_box.hpp:1334
BoundingBoxVariables mBox
Definition: spatial_bounding_box.hpp:1152
virtual SpatialBoundingBox & operator=(SpatialBoundingBox const &rOther)
Assignment operator.
Definition: spatial_bounding_box.hpp:540
BOOST_UBLAS_INLINE void clear()
Definition: array_1d.h:325
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
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
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
alpha
Definition: generate_convection_diffusion_explicit_element.py:113
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
int counter
Definition: script_THERMAL_CORRECT.py:218
integer i
Definition: TensorModule.f:17
Definition: plane_bounding_box.hpp:72
PointType Normal
Definition: plane_bounding_box.hpp:75
PointType Point
Definition: plane_bounding_box.hpp:74
void Initialize()
Definition: plane_bounding_box.hpp:80
Definition: spatial_bounding_box.hpp:61
void SetContactFace(int ContactFace)
Definition: spatial_bounding_box.hpp:178
void SetRadius(double Radius)
Definition: spatial_bounding_box.hpp:177
PointType InitialCenter
Definition: spatial_bounding_box.hpp:215
void UpdatePosition(PointType &Displacement)
Definition: spatial_bounding_box.hpp:260
int Convexity
Definition: spatial_bounding_box.hpp:210
PointType Velocity
Definition: spatial_bounding_box.hpp:221
PointType LowerPoint
Definition: spatial_bounding_box.hpp:218
double Radius
Definition: spatial_bounding_box.hpp:211
void Initialize()
Definition: spatial_bounding_box.hpp:229
PointType Center
Definition: spatial_bounding_box.hpp:219
PointType UpperPoint
Definition: spatial_bounding_box.hpp:217
void SetInitialValues()
Definition: spatial_bounding_box.hpp:253
Configure::PointType PointType
Definition: transfer_utility.h:245