10 #if !defined(KRATOS_INLET_MANAGEMENT_PROCESS_H_INCLUDED)
11 #define KRATOS_INLET_MANAGEMENT_PROCESS_H_INCLUDED
71 : mrModelPart(rModelPart),
72 mrRemesh(rRemeshingParameters)
74 KRATOS_INFO(
"InletManagementProcess") <<
" activated " << std::endl;
102 std::cout <<
" [ INLET MANAGEMENT PROCESS: " << std::endl;
105 std::cout <<
" ModelPart Supplied do not corresponds to the Meshing Domain: (" << mrModelPart.
Name() <<
" != " << mrRemesh.
SubModelPartName <<
")" << std::endl;
108 double currentTime = rCurrentProcessInfo[TIME];
109 double timeInterval = rCurrentProcessInfo[DELTA_TIME];
111 unsigned int numberOfLagrangianInletNodes = mrRemesh.
Info->NumberOfLagrangianInletNodes;
113 if (currentTime < 2 * timeInterval)
115 mrRemesh.
Info->RemovedNodes = 0;
117 std::cout <<
" First meshes: I repare the mesh without adding new nodes" << std::endl;
118 mrRemesh.
Info->InitialNumberOfNodes = mrRemesh.
Info->NumberOfNodes;
121 if (currentTime > 1.5 * timeInterval && numberOfLagrangianInletNodes > 0)
123 CheckAndCreateNewInletLayer();
131 std::cout <<
" INLET MANAGEMENT PROCESS ]; " << std::endl;
149 std::string
Info()
const override
151 return "InletManagementProcess";
157 rOStream <<
"InletManagementProcess";
194 void CheckAndCreateNewInletLayer()
200 std::cout <<
" CheckAndCreateNewInletLayer " << std::endl;
201 const unsigned int dimension = mrModelPart.ElementsBegin()->GetGeometry().WorkingSpaceDimension();
202 double maxSeparation = mrRemesh.
Refine->CriticalRadius;
204 std::vector<Node::Pointer> clonedNodes;
206 clonedNodes.resize(1);
207 unsigned int numberClonedNodes = 0;
208 unsigned int sizeClonedNodes = 0;
210 for (ModelPart::NodesContainerType::iterator i_node = mrModelPart.NodesBegin(); i_node != mrModelPart.NodesEnd(); i_node++)
212 if (i_node->Is(PFEMFlags::LAGRANGIAN_INLET))
217 if ((neighb_elems.
size() == 0 && rN.
size() == 0) || i_node->Is(RIGID))
220 const array_1d<double, 3> &inletDisplacement = i_node->FastGetSolutionStepValue(DISPLACEMENT);
221 double distanceFromOrigin = sqrt(inletDisplacement[0] * inletDisplacement[0] +
222 inletDisplacement[1] * inletDisplacement[1]);
225 distanceFromOrigin = sqrt(inletDisplacement[0] * inletDisplacement[0] +
226 inletDisplacement[1] * inletDisplacement[1] +
227 inletDisplacement[2] * inletDisplacement[2]);
230 if (distanceFromOrigin > maxSeparation)
233 if (i_node->Is(FLUID))
235 Node::Pointer pnode = i_node->Clone();
236 sizeClonedNodes = numberClonedNodes + 1;
237 clonedNodes.resize(sizeClonedNodes);
238 clonedNodes[numberClonedNodes] = pnode;
242 i_node->X() = i_node->X0();
243 i_node->Y() = i_node->Y0();
244 i_node->FastGetSolutionStepValue(DISPLACEMENT_X, 0) = 0;
245 i_node->FastGetSolutionStepValue(DISPLACEMENT_X, 1) = 0;
246 i_node->FastGetSolutionStepValue(DISPLACEMENT_Y, 0) = 0;
247 i_node->FastGetSolutionStepValue(DISPLACEMENT_Y, 1) = 0;
250 i_node->Z() = i_node->Z0();
251 i_node->FastGetSolutionStepValue(DISPLACEMENT_Z, 0) = 0;
252 i_node->FastGetSolutionStepValue(DISPLACEMENT_Z, 1) = 0;
260 for (
unsigned int i = 0;
i < sizeClonedNodes;
i++)
263 Node::Pointer pnode = clonedNodes[
i];
266 unsigned int id = NodeIdParent + 1;
268 if (NodeId > NodeIdParent)
273 pnode->Free(VELOCITY_X);
274 pnode->Free(VELOCITY_Y);
277 pnode->Free(VELOCITY_Z);
279 pnode->Reset(PFEMFlags::LAGRANGIAN_INLET);
282 pnode->Reset(BOUNDARY);
284 mrModelPart.AddNode(pnode);
290 void CountInletNodes()
295 unsigned int eulerianInletNodes = 0;
296 unsigned int lagrangianInletNodes = 0;
297 const unsigned int dimension = mrModelPart.ElementsBegin()->GetGeometry().WorkingSpaceDimension();
298 const double tolerance = -1
e-12;
300 for (ModelPart::NodesContainerType::iterator i_node = mrModelPart.NodesBegin(); i_node != mrModelPart.NodesEnd(); i_node++)
302 if (i_node->Is(PFEMFlags::EULERIAN_INLET))
304 const array_1d<double, 3> &inletVelocity = i_node->FastGetSolutionStepValue(VELOCITY);
305 const array_1d<double, 3> &inletNormal = i_node->FastGetSolutionStepValue(NORMAL);
306 const double inwardX = inletVelocity[0] * inletNormal[0];
307 const double inwardY = inletVelocity[1] * inletNormal[1];
310 if (inwardX < tolerance || inwardY < tolerance)
312 eulerianInletNodes += 1;
317 const double inwardZ = inletVelocity[2] * inletNormal[2];
318 if (inwardX < tolerance || inwardY < tolerance || inwardZ < tolerance)
320 eulerianInletNodes += 1;
324 else if (i_node->Is(PFEMFlags::LAGRANGIAN_INLET))
326 lagrangianInletNodes += 1;
329 mrRemesh.
Info->NumberOfEulerianInletNodes = eulerianInletNodes;
330 mrRemesh.
Info->NumberOfLagrangianInletNodes = lagrangianInletNodes;
378 rOStream << std::endl;
Base class for all Conditions.
Definition: condition.h:59
Geometry base class.
Definition: geometry.h:71
This class is a vector which stores global pointers.
Definition: global_pointers_vector.h:61
size_type size() const
Definition: global_pointers_vector.h:307
Refine Mesh Elements Process 2D and 3D.
Definition: inlet_management_process.hpp:47
ConditionType::GeometryType GeometryType
Definition: inlet_management_process.hpp:58
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: inlet_management_process.hpp:97
InletManagementProcess(ModelPart &rModelPart, MesherUtilities::MeshingParameters &rRemeshingParameters, int EchoLevel)
Default constructor.
Definition: inlet_management_process.hpp:68
virtual ~InletManagementProcess()
Destructor.
Definition: inlet_management_process.hpp:80
void PrintData(std::ostream &rOStream) const override
Print object's data.s.
Definition: inlet_management_process.hpp:161
GlobalPointersVector< Element > ElementWeakPtrVectorType
Definition: inlet_management_process.hpp:61
std::string Info() const override
Turn back information as a string.
Definition: inlet_management_process.hpp:149
ModelPart::ConditionType ConditionType
Definition: inlet_management_process.hpp:56
ModelPart::NodeType NodeType
Definition: inlet_management_process.hpp:55
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: inlet_management_process.hpp:155
void operator()()
This operator is provided to call the process as a function and simply calls the Execute method.
Definition: inlet_management_process.hpp:87
GlobalPointersVector< Node > NodeWeakPtrVectorType
Definition: inlet_management_process.hpp:60
KRATOS_CLASS_POINTER_DEFINITION(InletManagementProcess)
Pointer definition of Process.
ModelPart::PropertiesType PropertiesType
Definition: inlet_management_process.hpp:57
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
std::string & Name()
Definition: model_part.h:1811
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
This class defines the node.
Definition: node.h:65
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
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_INFO(label)
Definition: logger.h:250
static int EchoLevel
Definition: co_sim_EMPIRE_API.h:42
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
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
int dimension
Definition: isotropic_damage_automatic_differentiation.py:123
integer i
Definition: TensorModule.f:17
e
Definition: run_cpp_mpi_tests.py:31
Definition: mesher_utilities.hpp:631
MeshingInfoParameters::Pointer Info
Definition: mesher_utilities.hpp:681
RefiningParameters::Pointer Refine
Definition: mesher_utilities.hpp:684
std::string SubModelPartName
Definition: mesher_utilities.hpp:642
std::vector< int > NodalPreIds
Definition: mesher_utilities.hpp:668