45 #if !defined(KRATOS_LAGRANGIAN_INLET_PROCESS_INCLUDED )
46 #define KRATOS_LAGRANGIAN_INLET_PROCESS_INCLUDED
112 minsertion_time = 0.00;
113 minsertion_time_step = insertion_time_step;
146 if(minsertion_time == 0.00)
148 minsertion_time_step = EstimateInsertionTime();
149 minsertion_time =
time + minsertion_time_step;
153 if(
time >= minsertion_time)
157 int new_nodes_number = 0;
158 for(ModelPart::NodesContainerType::iterator in = mr_model_part.
NodesBegin(); in!=mr_model_part.
NodesEnd(); in++)
160 if(in->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET) == 1)
161 new_nodes_number += 1;
164 if(new_nodes_number != 0)
167 int old_size = mr_model_part.
Nodes().size();
168 (mr_model_part.
Nodes()).reserve(old_size + new_nodes_number);
170 for(
int i = 0;
i<old_size;
i++)
172 ModelPart::NodesContainerType::iterator in = mr_model_part.
NodesBegin() +
i;
174 if(in->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET) == 1)
177 in->FastGetSolutionStepValue(IS_STRUCTURE) = 0;
178 in->FastGetSolutionStepValue(IS_BOUNDARY) = 0;
179 in->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET) = 0;
180 in->FastGetSolutionStepValue(IS_FREE_SURFACE) = 0;
181 in->Free(DISPLACEMENT_X);
182 in->Free(DISPLACEMENT_Y);
183 in->Free(DISPLACEMENT_Z);
189 int id = mr_model_part.
Nodes().size();
192 double init_pos_x=in->X()-in->FastGetSolutionStepValue(DISPLACEMENT_X);
193 double init_pos_y=in->Y()-in->FastGetSolutionStepValue(DISPLACEMENT_Y);
194 double init_pos_z=in->Z()-in->FastGetSolutionStepValue(DISPLACEMENT_Z);
200 Node::Pointer new_node = mr_model_part.
CreateNewNode(
id, init_pos_x, init_pos_y, init_pos_z);
202 new_node->SetBufferSize(mr_model_part.
NodesBegin()->GetBufferSize() );
205 for(Node::DofsContainerType::iterator iii = reference_dofs.begin(); iii != reference_dofs.end(); iii++)
210 (p_new_dof)->FreeDof();
233 new_node->FastGetSolutionStepValue(DISPLACEMENT)+=
d;
238 new_node->FastGetSolutionStepValue(VELOCITY) =
inlet_vel;
239 in->FastGetSolutionStepValue(VELOCITY) =
inlet_vel;
241 new_node->FastGetSolutionStepValue(NODAL_AREA) = in->FastGetSolutionStepValue(NODAL_AREA);
242 new_node->FastGetSolutionStepValue(PRESSURE,1) = in->FastGetSolutionStepValue(PRESSURE,1);
243 new_node->FastGetSolutionStepValue(PRESSURE) = in->FastGetSolutionStepValue(PRESSURE);
244 new_node->FastGetSolutionStepValue(BULK_MODULUS) = in->FastGetSolutionStepValue(BULK_MODULUS);
245 new_node->FastGetSolutionStepValue(VISCOSITY) = in->FastGetSolutionStepValue(VISCOSITY);
246 new_node->FastGetSolutionStepValue(DENSITY) = in->FastGetSolutionStepValue(DENSITY);
247 new_node->FastGetSolutionStepValue(BODY_FORCE) = in->FastGetSolutionStepValue(BODY_FORCE);
248 new_node->FastGetSolutionStepValue(IS_FLUID)=1.0;
249 new_node->FastGetSolutionStepValue(IS_BOUNDARY)=1.0;
251 new_node->Fix(DISPLACEMENT_X);
252 new_node->Fix(DISPLACEMENT_Y);
253 new_node->Fix(DISPLACEMENT_Z);
256 new_node->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET) = 1;
257 double nodal_h = in->FastGetSolutionStepValue(NODAL_H);
258 new_node->FastGetSolutionStepValue(NODAL_H) = nodal_h;
262 minsertion_time_step = EstimateInsertionTime();
266 minsertion_time =
time + minsertion_time_step;
273 for(ModelPart::NodesContainerType::iterator in = mr_model_part.
NodesBegin(); in!=mr_model_part.
NodesEnd(); in++)
275 if(in->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET) == 1)
282 in->FastGetSolutionStepValue(DISPLACEMENT)=inc_disp+old_disp;
284 in->FastGetSolutionStepValue(VELOCITY)=
inlet_vel;
285 in->Fix(DISPLACEMENT_X);
286 in->Fix(DISPLACEMENT_Y);
287 in->Fix(DISPLACEMENT_Z);
312 std::string
Info()
const override
314 return "LagrangianInletProcess";
320 rOStream <<
"LagrangianInletProcess";
382 double minsertion_time_step;
383 double minsertion_time;
390 double EstimateInsertionTime()
394 double dt_estimate = 100.0;
396 for(ModelPart::NodesContainerType::iterator in = mr_model_part.
NodesBegin(); in!=mr_model_part.
NodesEnd(); in++)
398 if(in->FastGetSolutionStepValue(IS_LAGRANGIAN_INLET) == 1)
403 double nodal_h = in->FastGetSolutionStepValue(NODAL_H);
407 double dtcandidate = nodal_h / normv;
409 if( dtcandidate < dt_estimate)
410 dt_estimate = dtcandidate;
468 rOStream << std::endl;
Dof represents a degree of freedom (DoF).
Definition: dof.h:86
Short class definition.
Definition: lagrangian_inlet_process.h:95
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: lagrangian_inlet_process.h:139
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: lagrangian_inlet_process.h:318
KRATOS_CLASS_POINTER_DEFINITION(LagrangianInletProcess)
Pointer definition of LagrangianInletProcess.
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: lagrangian_inlet_process.h:324
~LagrangianInletProcess() override
Destructor.
Definition: lagrangian_inlet_process.h:120
void operator()()
Definition: lagrangian_inlet_process.h:129
std::string Info() const override
Turn back information as a string.
Definition: lagrangian_inlet_process.h:312
LagrangianInletProcess(ModelPart &model_part, double insertion_time_step, array_1d< double, 3 > inlet_vel)
Default constructor.
Definition: lagrangian_inlet_process.h:108
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
NodeType::Pointer CreateNewNode(int Id, double x, double y, double z, VariablesList::Pointer pNewVariablesList, IndexType ThisIndex=0)
Definition: model_part.cpp:270
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
std::vector< std::unique_ptr< Dof< double > >> DofsContainerType
The DoF container type definition.
Definition: node.h:92
The base class for all processes in Kratos.
Definition: process.h:49
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_WATCH(variable)
Definition: define.h:806
#define KRATOS_TRY
Definition: define.h:109
dt
Definition: DEM_benchmarks.py:173
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
time
Definition: face_heat.py:85
model_part
Definition: face_heat.py:14
v
Definition: generate_convection_diffusion_explicit_element.py:114
int d
Definition: ode_solve.py:397
inlet_vel
Definition: script.py:181
integer i
Definition: TensorModule.f:17