10 #if !defined(KRATOS_REFINE_ELEMENTS_IN_EDGES_MESHER_PROCESS_H_INCLUDED )
11 #define KRATOS_REFINE_ELEMENTS_IN_EDGES_MESHER_PROCESS_H_INCLUDED
92 if( (
mrRemesh.
Refine->RefiningOptions.Is(MesherUtilities::REFINE_ADD_NODES) ||
93 mrRemesh.
Refine->RefiningOptions.Is(MesherUtilities::REFINE_INSERT_NODES) ) )
102 std::vector<Geometry< Node > > ListOfFacesToSplit;
107 std::vector<Node::Pointer> ListOfNewNodes;
133 std::string
Info()
const override
135 return "RefineElementsInEdgesMesherProcess";
141 rOStream <<
"RefineElementsInEdgesMesherProcess";
185 bool is_full_boundary =
false;
187 for(
auto i_elem(rElements.begin()); i_elem != rElements.end(); ++i_elem)
191 is_full_boundary =
true;
192 for(
unsigned int i=0;
i<rGeometry.
size(); ++
i)
194 if( rGeometry[
i].
IsNot(BOUNDARY) ){
195 is_full_boundary =
false;
200 if( is_full_boundary ){
201 rBoundaryEdgedElements.
push_back(*i_elem.base());
217 for(
auto& i_elem : rBoundaryEdgedElements)
222 bool accepted_face =
false;
223 for(
auto& i_nelem : nElements)
225 if(i_nelem.Id() != i_elem.Id())
227 accepted_face =
true;
234 unsigned int NumberNodesInFace = lnofa[face];
236 FaceNodes.
reserve(NumberNodesInFace);
238 unsigned int split_counter=0;
240 for(
unsigned int j=1;
j<=NumberNodesInFace; ++
j)
242 if(rGeometry[lpofa(
j,face)].
Is(TO_SPLIT))
244 FaceNodes.
push_back(rGeometry(lpofa(
j,face)));
248 if( 4.5 * this->mrRemesh.
Refine->CriticalRadius >
norm_2(FaceNodes[
counter].Coordinates()-FaceNodes[
counter-1].Coordinates()) ){
249 accepted_face =
false;
255 if(split_counter==NumberNodesInFace)
256 accepted_face =
false;
258 unsigned int free_surface = 0;
264 for(
unsigned int i=0;
i<FaceNodes.
size(); ++
i)
266 if(FaceNodes[
i].
Is(RIGID) && FaceNodes[
i].
Is(FREE_SURFACE)){
271 if(free_surface != 0){
272 accepted_face =
false;
280 rListOfFacesToSplit.push_back(InsideFace);
283 for(
unsigned int i=0;
i<FaceNodes.
size(); ++
i)
284 FaceNodes[
i].
Set(TO_SPLIT);
294 for(
auto& i_face : rListOfFacesToSplit)
296 for(
unsigned int i=0;
i<i_face.size(); ++
i)
298 i_face[
i].Set(TO_SPLIT,
false);
309 std::vector<Node::Pointer>& rListOfNewNodes,
334 std::vector<double> ShapeFunctionsN;
338 unsigned int size = 0;
341 for(
auto& i_face : rListOfFacesToSplit)
343 size = i_face.size();
345 ShapeFunctionsN.resize(size);
348 DataTransferUtilities.CalculateCenterAndSearchRadius( i_face[0].
X(), i_face[0].
Y(),
349 i_face[1].
X(), i_face[1].
Y(),
353 DataTransferUtilities.CalculateCenterAndSearchRadius( i_face[0].
X(), i_face[0].
Y(), i_face[0].
Z(),
354 i_face[1].
X(), i_face[1].
Y(), i_face[1].
Z(),
355 i_face[2].
X(), i_face[2].
Y(), i_face[2].
Z(),
360 pNode = Kratos::make_intrusive< Node >(
id,
xc,
yc, zc );
369 for(
auto& i_dof : ReferenceDofs)
375 (pNewDof)->FreeDof();
390 std::fill(ShapeFunctionsN.begin(), ShapeFunctionsN.end(), 1.0/
double(size));
393 DataTransferUtilities.Interpolate( i_face, ShapeFunctionsN,
VariablesList, pNode,
alpha );
396 pNode->AssignFlags(i_face[0]);
398 if( rModelPart.
Is(FLUID) )
401 if( rModelPart.
Is(SOLID) )
404 pNode->Set(NEW_ENTITY,
true);
405 pNode->Set(ACTIVE,
true);
408 pNode->Set(BOUNDARY,
false);
409 pNode->Set(FREE_SURFACE,
false);
410 pNode->Set(RIGID,
false);
411 pNode->Set(INLET,
false);
416 rListOfNewNodes.push_back(pNode);
429 pNode->SetValue(MODEL_PART_NAME,rModelPart.
Name());
432 pNode->FastGetSolutionStepValue(NODAL_H) =
mrRemesh.
Refine->CriticalSide*2.0;
435 const array_1d<double,3>& Displacement = pNode->FastGetSolutionStepValue(DISPLACEMENT);
436 pNode->X0() = pNode->X() - Displacement[0];
437 pNode->Y0() = pNode->Y() - Displacement[1];
438 pNode->Z0() = pNode->Z() - Displacement[2];
441 if( pNode->SolutionStepsDataHas(CONTACT_FORCE) )
442 pNode->FastGetSolutionStepValue(CONTACT_FORCE).
clear();
452 if(rListOfNewNodes.size())
455 for(
auto& i_node : rListOfNewNodes)
457 rModelPart.
Nodes().push_back(i_node);
533 rOStream << std::endl;
Base class for all Conditions.
Definition: condition.h:59
Dof represents a degree of freedom (DoF).
Definition: dof.h:86
void Set(const Flags ThisFlag)
Definition: flags.cpp:33
bool Is(Flags const &rOther) const
Definition: flags.h:274
bool IsNot(Flags const &rOther) const
Definition: flags.h:291
Geometry base class.
Definition: geometry.h:71
void push_back(PointPointerType x)
Definition: geometry.h:548
SizeType size() const
Definition: geometry.h:518
virtual void NodesInFaces(DenseMatrix< unsigned int > &rNodesInFaces) const
Definition: geometry.h:2195
virtual void NumberNodesInFaces(DenseVector< unsigned int > &rNumberNodesInFaces) const
Definition: geometry.h:2190
Definition: amatrix_interface.h:41
Short class definition.
Definition: mesh_data_transfer_utilities.hpp:46
The base class for processes passed to the solution scheme.
Definition: mesher_process.hpp:37
Short class definition.
Definition: mesher_utilities.hpp:49
static unsigned int GetMaxNodeId(ModelPart &rModelPart)
Definition: mesher_utilities.hpp:1408
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MeshType::ConditionsContainerType ConditionsContainerType
Condintions container. A vector set of Conditions with their Id's as key.
Definition: model_part.h:183
MeshType::ElementsContainerType ElementsContainerType
Element container. A vector set of Elements with their Id's as key.
Definition: model_part.h:168
std::string & Name()
Definition: model_part.h:1811
IndexType GetBufferSize() const
This method gets the suffer size of the model part database.
Definition: model_part.h:1876
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
ModelPart & GetParentModelPart()
Definition: model_part.cpp:2124
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
VariablesList & GetNodalSolutionStepVariablesList()
Definition: model_part.h:549
std::vector< std::unique_ptr< Dof< double > >> DofsContainerType
The DoF container type definition.
Definition: node.h:92
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
size_type size() const
Definition: pointer_vector.h:255
void reserve(size_type dim)
Definition: pointer_vector.h:319
void push_back(const TPointerType &x)
Definition: pointer_vector.h:270
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
Refine Mesh Elements Process 2D and 3D.
Definition: refine_elements_in_edges_mesher_process.hpp:39
ModelPart & mrModelPart
Definition: refine_elements_in_edges_mesher_process.hpp:164
virtual ~RefineElementsInEdgesMesherProcess()
Destructor.
Definition: refine_elements_in_edges_mesher_process.hpp:68
int mEchoLevel
Definition: refine_elements_in_edges_mesher_process.hpp:170
std::string Info() const override
Turn back information as a string.
Definition: refine_elements_in_edges_mesher_process.hpp:133
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: refine_elements_in_edges_mesher_process.hpp:139
MesherUtilities::MeshingParameters & mrRemesh
Definition: refine_elements_in_edges_mesher_process.hpp:166
void SelectFacesToSplit(ModelPart::ElementsContainerType &rBoundaryEdgedElements, std::vector< Geometry< Node > > &rListOfFacesToSplit)
Definition: refine_elements_in_edges_mesher_process.hpp:209
RefineElementsInEdgesMesherProcess(ModelPart &rModelPart, MesherUtilities::MeshingParameters &rRemeshingParameters, int EchoLevel)
Default constructor.
Definition: refine_elements_in_edges_mesher_process.hpp:57
virtual void SelectFullBoundaryEdgedElements(ModelPart &rModelPart, ModelPart::ElementsContainerType &rBoundaryEdgedElements)
Definition: refine_elements_in_edges_mesher_process.hpp:180
KRATOS_CLASS_POINTER_DEFINITION(RefineElementsInEdgesMesherProcess)
Pointer definition of Process.
void SetNewNodeVariables(ModelPart &rModelPart, Node::Pointer &pNode)
Definition: refine_elements_in_edges_mesher_process.hpp:424
ConditionType::GeometryType GeometryType
Definition: refine_elements_in_edges_mesher_process.hpp:49
MesherUtilities mMesherUtilities
Definition: refine_elements_in_edges_mesher_process.hpp:168
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: refine_elements_in_edges_mesher_process.hpp:145
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: refine_elements_in_edges_mesher_process.hpp:88
ModelPart::ConditionType ConditionType
Definition: refine_elements_in_edges_mesher_process.hpp:47
void GenerateNewNodes(ModelPart &rModelPart, std::vector< Node::Pointer > &rListOfNewNodes, std::vector< Geometry< Node > > &rListOfFacesToSplit)
Definition: refine_elements_in_edges_mesher_process.hpp:308
void SetNodesToModelPart(ModelPart &rModelPart, std::vector< Node::Pointer > &rListOfNewNodes)
Definition: refine_elements_in_edges_mesher_process.hpp:448
void operator()()
This operator is provided to call the process as a function and simply calls the Execute method.
Definition: refine_elements_in_edges_mesher_process.hpp:76
GlobalPointersVector< Element > ElementWeakPtrVectorType
Definition: refine_elements_in_edges_mesher_process.hpp:51
ModelPart::PropertiesType PropertiesType
Definition: refine_elements_in_edges_mesher_process.hpp:48
Holds a list of variables and their position in VariablesListDataValueContainer.
Definition: variables_list.h:50
BOOST_UBLAS_INLINE void clear()
Definition: array_1d.h:325
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
static int EchoLevel
Definition: co_sim_EMPIRE_API.h:42
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
TExpressionType::data_type norm_2(AMatrix::MatrixExpression< TExpressionType, TCategory > const &TheExpression)
Definition: amatrix_interface.h:625
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
alpha
Definition: generate_convection_diffusion_explicit_element.py:113
float radius
Definition: mesh_to_mdpa_converter.py:18
int j
Definition: quadrature.py:648
float xc
Definition: rotating_cone.py:77
float yc
Definition: rotating_cone.py:78
int counter
Definition: script_THERMAL_CORRECT.py:218
integer i
Definition: TensorModule.f:17
Definition: mesher_utilities.hpp:631
RefiningParameters::Pointer Refine
Definition: mesher_utilities.hpp:684