51 #if !defined(KRATOS_MOVE_PARTICLE_UTILITY_PFEM2_INCLUDED)
52 #define KRATOS_MOVE_PARTICLE_UTILITY_FLUID_PFEM2_INCLUDED
80 #include "utilities/geometry_utilities.h"
110 template<
unsigned int TDim>
135 : mr_model_part(
model_part) , mmaximum_number_of_particles(maximum_number_of_particles)
137 KRATOS_INFO(
"MoveParticleUtilityPfem2") <<
"Initializing utility" << std::endl;
143 mintialized_transfer_tool=
false;
144 mcalculation_domain_complete_displacement=
ZeroVector(3);
145 mcalculation_domain_added_displacement=
ZeroVector(3);
149 mDENSITY_AIR = CurrentProcessInfo[DENSITY_AIR];
150 mDENSITY_WATER = CurrentProcessInfo[DENSITY_WATER];
156 ModelPart::ElementsContainerType::iterator ielembegin = mr_model_part.
ElementsBegin();
157 for(
unsigned int ii=0; ii<mr_model_part.
Elements().size(); ii++)
159 ModelPart::ElementsContainerType::iterator ielem = ielembegin+ii;
162 mlast_elem_id= (mr_model_part.
ElementsEnd()-1)->Id();
165 ModelPart::NodesContainerType::iterator inodebegin = mr_model_part.
NodesBegin();
166 vector<unsigned int> node_partition;
168 int number_of_threads = omp_get_max_threads();
170 int number_of_threads = 1;
172 OpenMPUtils::CreatePartition(number_of_threads, mr_model_part.
Nodes().size(), node_partition);
174 #pragma omp parallel for
175 for(
int kkk=0; kkk<number_of_threads; kkk++)
177 for(
unsigned int ii=node_partition[kkk]; ii<node_partition[kkk+1]; ii++)
179 ModelPart::NodesContainerType::iterator pnode = inodebegin+ii;
182 position_node = pnode->Coordinates();
185 const double number_of_neighbours =
double(rneigh.
size());
189 position_difference = inode->Coordinates() - position_node;
190 double current_distance= sqrt(pow(position_difference[0],2)+pow(position_difference[1],2)+pow(position_difference[2],2));
193 distance += current_distance / number_of_neighbours;
196 pnode->FastGetSolutionStepValue(MEAN_SIZE)=distance;
205 vector<unsigned int> element_partition;
206 OpenMPUtils::CreatePartition(number_of_threads, mr_model_part.
Elements().size(), element_partition);
209 #pragma omp parallel for
210 for(
int kkk=0; kkk<number_of_threads; kkk++)
212 for(
unsigned int ii=element_partition[kkk]; ii<element_partition[kkk+1]; ii++)
214 ModelPart::ElementsContainerType::iterator ielem = ielembegin+ii;
218 Edge = ielem->GetGeometry()[1].Coordinates() - ielem->GetGeometry()[0].Coordinates();
219 elem_size = Edge[0]*Edge[0];
220 for (
unsigned int d = 1;
d < TDim;
d++)
221 elem_size += Edge[
d]*Edge[
d];
223 for (
unsigned int i = 2;
i < (TDim+1);
i++)
224 for(
unsigned int j = 0;
j <
i;
j++)
226 Edge = ielem->GetGeometry()[
i].Coordinates() - ielem->GetGeometry()[
j].Coordinates();
227 double Length = Edge[0]*Edge[0];
228 for (
unsigned int d = 1;
d < TDim;
d++)
229 Length += Edge[
d]*Edge[
d];
230 if (Length < elem_size) elem_size = Length;
232 elem_size = sqrt(elem_size);
233 ielem->SetValue(MEAN_SIZE, elem_size);
236 if constexpr (TDim==3)
237 ielem->SetValue(ENRICH_LHS_ROW_3D,
ZeroVector(4));
244 ielem->SetValue(ENRICH_LHS_ROW,
ZeroVector(3));
255 mnelems = mr_model_part.
Elements().size();
257 KRATOS_INFO(
"MoveParticleUtilityPfem2") <<
"About to resize vectors" << std::endl;
262 mparticles_vector.resize(mnelems*mmaximum_number_of_particles);
265 mnumber_of_particles_in_elems.resize(mnelems);
266 mnumber_of_particles_in_elems=
ZeroVector(mnelems);
269 mnumber_of_particles_in_elems_aux.resize(mnelems);
273 mpointers_to_particle_pointers_vectors.resize(mnelems);
274 KRATOS_INFO(
"MoveParticleUtilityPfem2") <<
"About to create particles" << std::endl;
278 for(
unsigned int ii=0; ii<mr_model_part.
Elements().size(); ii++)
280 ModelPart::ElementsContainerType::iterator ielem = ielembegin+ii;
284 mpointers_to_particle_pointers_vectors(ii) = &particle_pointers;
288 int & number_of_particles = ielem->GetValue(NUMBER_OF_FLUID_PARTICLES);
289 number_of_particles=0;
295 ComputeGaussPointPositions_initial(geom, pos,
N);
297 for (
unsigned int j = 0;
j < pos.size1();
j++)
302 pparticle.
X()=pos(
j,0);
303 pparticle.
Y()=pos(
j,1);
304 pparticle.
Z()=pos(
j,2);
313 for (
unsigned int k = 0;
k < (TDim+1);
k++)
315 noalias(
vel) += (
N(
j,
k) * geom[
k].FastGetSolutionStepValue(VELOCITY));
316 distance +=
N(
j,
k) * geom[
k].FastGetSolutionStepValue(DISTANCE);
324 particle_pointers(
j) = &pparticle;
325 number_of_particles++;
330 bool nonzero_mesh_velocity =
false;
332 for(ModelPart::NodesContainerType::iterator inode = mr_model_part.
NodesBegin();
333 inode!=mr_model_part.
NodesEnd(); inode++)
336 for(
unsigned int i = 0;
i!=3;
i++)
339 nonzero_mesh_velocity=
true;
341 if( nonzero_mesh_velocity==
true)
345 if ( nonzero_mesh_velocity==
true)
346 muse_mesh_velocity_to_convect =
true;
348 muse_mesh_velocity_to_convect =
false;
352 m_nparticles=particle_id;
353 KRATOS_INFO(
"MoveParticleUtilityPfem2") <<
"Number of particles created : " << m_nparticles << std::endl;
354 mparticle_printing_tool_initialized=
false;
373 paux.swap(mpBinsObjectDynamic);
376 KRATOS_INFO(
"MoveParticleUtilityPfem2") <<
"Finished mounting Bins" << std::endl;
388 mintialized_transfer_tool=
true;
389 const unsigned int max_results = 1000;
390 std::cout <<
"initializing transfer utility" << std::endl;
392 mcalculation_domain_complete_displacement=initial_domains_offset;
394 mtopographic_model_part_pointer = topographic_model_part;
401 paux.swap(mpTopographicBinsObjectDynamic);
404 std::cout <<
"Gathering Information From Topographic Domain for the first time" << std::endl;
405 if(ovewrite_particle_data==
false)
407 std::cout <<
"Not overwriting particle data (assuming correct initial conditions in calculation domain)" << std::endl;
411 std::cout <<
"Replacing particle information using the Topographic domain" << std::endl;
412 const int offset = CurrentProcessInfo[WATER_PARTICLE_POINTERS_OFFSET];
414 ModelPart::ElementsContainerType::iterator ielembegin = mr_model_part.
ElementsBegin();
415 vector<unsigned int> element_partition;
417 int number_of_threads = omp_get_max_threads();
419 int number_of_threads = 1;
421 OpenMPUtils::CreatePartition(number_of_threads, mr_model_part.
Elements().size(), element_partition);
423 #pragma omp parallel for
424 for(
int kkk=0; kkk<number_of_threads; kkk++)
429 for(
unsigned int ii=element_partition[kkk]; ii<element_partition[kkk+1]; ii++)
431 if (results.size()!=max_results)
432 results.resize(max_results);
434 ModelPart::ElementsContainerType::iterator ielem = ielembegin+ii;
435 Element::Pointer pelement(*it_begin_topo);
442 int & number_of_particles_in_elem=ielem->GetValue(NUMBER_OF_FLUID_PARTICLES);
445 for (
int iii=0; iii<number_of_particles_in_elem ; iii++ )
448 if (iii>mmaximum_number_of_particles)
455 if (erase_flag==
false)
457 OverwriteParticleDataUsingTopographicDomain(pparticle,pelement,mcalculation_domain_complete_displacement,result_begin, max_results);
477 if(mintialized_transfer_tool==
false)
479 const unsigned int max_results = 1000;
480 std::cout <<
"executing transfer tool" << std::endl;
482 mcalculation_domain_added_displacement = domains_added_displacement;
483 mcalculation_domain_complete_displacement += domains_added_displacement;
488 const int offset = CurrentProcessInfo[WATER_PARTICLE_POINTERS_OFFSET];
490 ModelPart::ElementsContainerType::iterator ielembegin = mr_model_part.
ElementsBegin();
491 vector<unsigned int> element_partition;
493 int number_of_threads = omp_get_max_threads();
495 int number_of_threads = 1;
497 OpenMPUtils::CreatePartition(number_of_threads, mr_model_part.
Elements().size(), element_partition);
499 #pragma omp parallel for
500 for(
int kkk=0; kkk<number_of_threads; kkk++)
505 Element::Pointer pelement(*it_begin_topo);
509 unsigned int freeparticle=0;
511 for(
unsigned int ii=element_partition[kkk]; ii<element_partition[kkk+1]; ii++)
513 if (results.size()!=max_results)
514 results.resize(max_results);
516 ModelPart::ElementsContainerType::iterator ielem = ielembegin+ii;
519 int & number_of_particles_in_elem=ielem->GetValue(NUMBER_OF_FLUID_PARTICLES);
520 if (number_of_particles_in_elem<(minimum_number_of_particles))
524 ComputeGaussPointPositionsForPreReseed(geom, pos,
N);
527 for (
unsigned int j = 0;
j < (pos.size1());
j++)
529 bool keep_looking =
true;
532 if (mparticles_vector[freeparticle].GetEraseFlag()==
true)
536 if (mparticles_vector[freeparticle].GetEraseFlag()==
true)
538 mparticles_vector[freeparticle].GetEraseFlag()=
false;
542 if (keep_looking==
false)
569 bool is_found = CalculatePosition(geom,pos(
j,0),pos(
j,1),pos(
j,2),aux2_N);
576 OverwriteParticleDataUsingTopographicDomain(pparticle,pelement,mcalculation_domain_complete_displacement,result_begin, max_results);
578 mparticles_vector[freeparticle] = pparticle;
579 element_particle_pointers(offset+number_of_particles_in_elem) = &mparticles_vector[freeparticle];
580 number_of_particles_in_elem++;
597 const double nodal_weight = 1.0/ (1.0 +
double (TDim) );
599 ModelPart::ElementsContainerType::iterator ielembegin = mr_model_part.
ElementsBegin();
600 vector<unsigned int> element_partition;
602 int number_of_threads = omp_get_max_threads();
604 int number_of_threads = 1;
606 OpenMPUtils::CreatePartition(number_of_threads, mr_model_part.
Elements().size(), element_partition);
608 if (muse_mesh_velocity_to_convect==
false)
610 #pragma omp parallel for
611 for(
int kkk=0; kkk<number_of_threads; kkk++)
613 for(
unsigned int ii=element_partition[kkk]; ii<element_partition[kkk+1]; ii++)
615 ModelPart::ElementsContainerType::iterator ielem = ielembegin+ii;
620 for (
unsigned int i=0;
i != (TDim+1) ;
i++)
621 vector_mean_velocity += geom[
i].FastGetSolutionStepValue(VELOCITY);
622 vector_mean_velocity *= nodal_weight;
624 const double mean_velocity = sqrt ( pow(vector_mean_velocity[0],2) + pow(vector_mean_velocity[1],2) + pow(vector_mean_velocity[2],2) );
625 ielem->SetValue(VELOCITY_OVER_ELEM_SIZE, mean_velocity / ( ielem->GetValue(MEAN_SIZE) ) );
631 #pragma omp parallel for
632 for(
int kkk=0; kkk<number_of_threads; kkk++)
634 for(
unsigned int ii=element_partition[kkk]; ii<element_partition[kkk+1]; ii++)
636 ModelPart::ElementsContainerType::iterator ielem = ielembegin+ii;
641 for (
unsigned int i=0;
i != (TDim+1) ;
i++)
642 vector_mean_velocity += geom[
i].FastGetSolutionStepValue(VELOCITY)-geom[
i].FastGetSolutionStepValue(MESH_VELOCITY);
643 vector_mean_velocity *= nodal_weight;
645 const double mean_velocity = sqrt ( pow(vector_mean_velocity[0],2) + pow(vector_mean_velocity[1],2) + pow(vector_mean_velocity[2],2) );
646 ielem->SetValue(VELOCITY_OVER_ELEM_SIZE, mean_velocity / ( ielem->GetValue(MEAN_SIZE) ) );
660 if (fully_reset_nodes)
662 ModelPart::NodesContainerType::iterator inodebegin = mr_model_part.
NodesBegin();
663 vector<unsigned int> node_partition;
665 int number_of_threads = omp_get_max_threads();
667 int number_of_threads = 1;
669 OpenMPUtils::CreatePartition(number_of_threads, mr_model_part.
Nodes().size(), node_partition);
671 #pragma omp parallel for
672 for(
int kkk=0; kkk<number_of_threads; kkk++)
674 for(
unsigned int ii=node_partition[kkk]; ii<node_partition[kkk+1]; ii++)
676 ModelPart::NodesContainerType::iterator inode = inodebegin+ii;
678 if (inode->IsFixed(VELOCITY_X))
680 inode->FastGetSolutionStepValue(VELOCITY_X)=inode->GetSolutionStepValue(VELOCITY_X,1);
682 if (inode->IsFixed(VELOCITY_Y))
684 inode->FastGetSolutionStepValue(VELOCITY_Y)=inode->GetSolutionStepValue(VELOCITY_Y,1);
686 if constexpr (TDim==3)
687 if (inode->IsFixed(VELOCITY_Z))
689 inode->FastGetSolutionStepValue(VELOCITY_Z)=inode->GetSolutionStepValue(VELOCITY_Z,1);
692 if (inode->IsFixed(PRESSURE))
693 inode->FastGetSolutionStepValue(PRESSURE)=inode->GetSolutionStepValue(PRESSURE,1);
694 inode->GetSolutionStepValue(PRESSURE,1)=inode->FastGetSolutionStepValue(PRESSURE);
700 ModelPart::NodesContainerType::iterator inodebegin = mr_model_part.
NodesBegin();
701 vector<unsigned int> node_partition;
703 int number_of_threads = omp_get_max_threads();
705 int number_of_threads = 1;
707 OpenMPUtils::CreatePartition(number_of_threads, mr_model_part.
Nodes().size(), node_partition);
709 #pragma omp parallel for
710 for(
int kkk=0; kkk<number_of_threads; kkk++)
712 for(
unsigned int ii=node_partition[kkk]; ii<node_partition[kkk+1]; ii++)
714 ModelPart::NodesContainerType::iterator inode = inodebegin+ii;
718 if (inode->IsFixed(VELOCITY_X) || inode->IsFixed(VELOCITY_Y) || inode->IsFixed(VELOCITY_Z) )
722 const double normal_scalar_sq = normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2];
727 for (
unsigned int j=0;
j!=3;
j++)
728 normal_velocity[
j] = fabs(normal_adimensionalized[
j])*original_velocity[
j];
730 if (inode->IsFixed(VELOCITY_X))
732 velocity[0] = original_velocity[0] - normal_velocity[0];
734 if (inode->IsFixed(VELOCITY_Y))
736 velocity[1] = original_velocity[1] - normal_velocity[1];
738 if constexpr (TDim==3)
739 if (inode->IsFixed(VELOCITY_Z))
741 velocity[2] = original_velocity[2] - normal_velocity[2];
746 if (inode->IsFixed(PRESSURE))
747 inode->FastGetSolutionStepValue(PRESSURE)=inode->GetSolutionStepValue(PRESSURE,1);
760 ModelPart::NodesContainerType::iterator inodebegin = mr_model_part.
NodesBegin();
761 vector<unsigned int> node_partition;
763 int number_of_threads = omp_get_max_threads();
765 int number_of_threads = 1;
767 OpenMPUtils::CreatePartition(number_of_threads, mr_model_part.
Nodes().size(), node_partition);
769 #pragma omp parallel for
770 for(
int kkk=0; kkk<number_of_threads; kkk++)
772 for(
unsigned int ii=node_partition[kkk]; ii<node_partition[kkk+1]; ii++)
774 ModelPart::NodesContainerType::iterator inode = inodebegin+ii;
781 const double normal_scalar_sq = normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2];
785 for (
unsigned int j=0;
j!=3;
j++)
786 normal_velocity[
j] = normal_adimensionalized[
j]*
velocity[
j];
788 const double dot_prod = normal_velocity[0]*
velocity[0] + normal_velocity[1]*
velocity[1] + normal_velocity[2]*
velocity[2];
791 normal_velocity*= -1.0;
795 else if (inode->IsFixed(VELOCITY_X) && inode->IsFixed(VELOCITY_Y) )
797 inode->FastGetSolutionStepValue(VELOCITY) = inode->GetSolutionStepValue(VELOCITY,1);
810 ModelPart::NodesContainerType::iterator inodebegin = mr_model_part.
NodesBegin();
811 vector<unsigned int> node_partition;
813 int number_of_threads = omp_get_max_threads();
815 int number_of_threads = 1;
817 OpenMPUtils::CreatePartition(number_of_threads, mr_model_part.
Nodes().size(), node_partition);
819 #pragma omp parallel for
820 for(
int kkk=0; kkk<number_of_threads; kkk++)
822 for(
unsigned int ii=node_partition[kkk]; ii<node_partition[kkk+1]; ii++)
824 ModelPart::NodesContainerType::iterator inode = inodebegin+ii;
825 inode->FastGetSolutionStepValue(DELTA_VELOCITY) = inode->FastGetSolutionStepValue(VELOCITY) - inode->FastGetSolutionStepValue(PROJECTED_VELOCITY) ;
836 ModelPart::NodesContainerType::iterator inodebegin = rNodes.begin();
837 vector<unsigned int> node_partition;
839 int number_of_threads = omp_get_max_threads();
841 int number_of_threads = 1;
843 OpenMPUtils::CreatePartition(number_of_threads, rNodes.size(), node_partition);
845 #pragma omp parallel for
846 for(
int kkk=0; kkk<number_of_threads; kkk++)
848 for(
unsigned int ii=node_partition[kkk]; ii<node_partition[kkk+1]; ii++)
850 ModelPart::NodesContainerType::iterator inode = inodebegin+ii;
851 noalias(inode->GetSolutionStepValue(OriginVariable,1)) = inode->FastGetSolutionStepValue(OriginVariable);
861 ModelPart::NodesContainerType::iterator inodebegin = rNodes.begin();
862 vector<unsigned int> node_partition;
864 int number_of_threads = omp_get_max_threads();
866 int number_of_threads = 1;
868 OpenMPUtils::CreatePartition(number_of_threads, rNodes.size(), node_partition);
870 #pragma omp parallel for
871 for(
int kkk=0; kkk<number_of_threads; kkk++)
873 for(
unsigned int ii=node_partition[kkk]; ii<node_partition[kkk+1]; ii++)
875 ModelPart::NodesContainerType::iterator inode = inodebegin+ii;
876 inode->GetSolutionStepValue(OriginVariable,1) = inode->FastGetSolutionStepValue(OriginVariable);
891 const int offset = CurrentProcessInfo[WATER_PARTICLE_POINTERS_OFFSET];
897 if (offset!=0) even_timestep=
false;
898 else even_timestep=
true;
900 const int post_offset = mmaximum_number_of_particles*
int(even_timestep);
904 double delta_t = CurrentProcessInfo[DELTA_TIME];
909 const unsigned int max_results = 10000;
916 vector<unsigned int> element_partition;
918 int number_of_threads = omp_get_max_threads();
920 int number_of_threads = 1;
922 OpenMPUtils::CreatePartition(number_of_threads, mr_model_part.
Elements().size(), element_partition);
924 ModelPart::ElementsContainerType::iterator ielembegin = mr_model_part.
ElementsBegin();
929 #pragma omp parallel for
930 for(
int kkk=0; kkk<number_of_threads; kkk++)
932 for(
unsigned int ii=element_partition[kkk]; ii<element_partition[kkk+1]; ii++)
934 ModelPart::ElementsContainerType::iterator old_element = ielembegin+ii;
936 int & number_of_particles = old_element->GetValue(NUMBER_OF_FLUID_PARTICLES);
938 mnumber_of_particles_in_elems_aux(ii)=number_of_particles;
939 mnumber_of_particles_in_elems(ii)=0;
945 bool nonzero_mesh_velocity =
false;
947 for(ModelPart::NodesContainerType::iterator inode = mr_model_part.
NodesBegin();
948 inode!=mr_model_part.
NodesEnd(); inode++)
951 for(
unsigned int i = 0;
i!=3;
i++)
954 nonzero_mesh_velocity=
true;
956 if( nonzero_mesh_velocity==
true)
960 if ( nonzero_mesh_velocity==
true)
961 muse_mesh_velocity_to_convect =
true;
963 muse_mesh_velocity_to_convect =
false;
965 KRATOS_INFO(
"MoveParticleUtilityPfem2") <<
"Convecting particles" << std::endl;
968 const bool local_use_mesh_velocity_to_convect = muse_mesh_velocity_to_convect;
970 #pragma omp parallel for
971 for(
int kkk=0; kkk<number_of_threads; kkk++)
978 elements_in_trajectory.
resize(20);
980 for(
unsigned int ielem=element_partition[kkk]; ielem<element_partition[kkk+1]; ielem++)
985 ModelPart::ElementsContainerType::iterator old_element = ielembegin+ielem;
986 const int old_element_id = old_element->Id();
988 ParticlePointerVector& old_element_particle_pointers = *mpointers_to_particle_pointers_vectors(old_element_id-1);
990 if ( (results.size()) !=max_results)
991 results.resize(max_results);
995 unsigned int number_of_elements_in_trajectory=0;
997 for(
int ii=0; ii<(mnumber_of_particles_in_elems_aux(ielem)); ii++)
1002 Element::Pointer pcurrent_element( *old_element.base() );
1005 if (erase_flag==
false){
1006 MoveParticle(pparticle,pcurrent_element,elements_in_trajectory,number_of_elements_in_trajectory,result_begin,max_results, mesh_displacement, discriminate_streamlines, local_use_mesh_velocity_to_convect);
1008 const int current_element_id = pcurrent_element->Id();
1010 int & number_of_particles_in_current_elem = mnumber_of_particles_in_elems(current_element_id-1);
1013 if (number_of_particles_in_current_elem<mmaximum_number_of_particles && erase_flag==
false)
1017 ParticlePointerVector& current_element_particle_pointers = *mpointers_to_particle_pointers_vectors(current_element_id-1);
1019 #pragma omp critical
1021 if (number_of_particles_in_current_elem<mmaximum_number_of_particles)
1024 current_element_particle_pointers(post_offset+number_of_particles_in_current_elem) = &pparticle;
1026 number_of_particles_in_current_elem++ ;
1027 if (number_of_particles_in_current_elem>mmaximum_number_of_particles)
1047 #pragma omp parallel for
1048 for(
int kkk=0; kkk<number_of_threads; kkk++)
1050 for(
unsigned int ii=element_partition[kkk]; ii<element_partition[kkk+1]; ii++)
1052 ModelPart::ElementsContainerType::iterator old_element = ielembegin+ii;
1054 old_element->GetValue(NUMBER_OF_FLUID_PARTICLES) = mnumber_of_particles_in_elems(ii);
1062 CurrentProcessInfo[WATER_PARTICLE_POINTERS_OFFSET] = post_offset;;
1076 KRATOS_INFO(
"MoveParticleUtilityPfem2") <<
"Projecting info to mesh" << std::endl;
1079 const int offset = CurrentProcessInfo[WATER_PARTICLE_POINTERS_OFFSET];
1090 ModelPart::NodesContainerType::iterator inodebegin = mr_model_part.
NodesBegin();
1091 vector<unsigned int> node_partition;
1093 int number_of_threads = omp_get_max_threads();
1095 int number_of_threads = 1;
1097 OpenMPUtils::CreatePartition(number_of_threads, mr_model_part.
Nodes().size(), node_partition);
1099 #pragma omp parallel for
1100 for(
int kkk=0; kkk<number_of_threads; kkk++)
1102 for(
unsigned int ii=node_partition[kkk]; ii<node_partition[kkk+1]; ii++)
1104 ModelPart::NodesContainerType::iterator inode = inodebegin+ii;
1105 inode->FastGetSolutionStepValue(DISTANCE)=0.0;
1106 inode->FastGetSolutionStepValue(PROJECTED_VELOCITY)=
ZeroVector(3);
1107 inode->FastGetSolutionStepValue(YP)=0.0;
1113 vector<unsigned int> element_partition;
1114 OpenMPUtils::CreatePartition(number_of_threads, mr_model_part.
Elements().size(), element_partition);
1116 ModelPart::ElementsContainerType::iterator ielembegin = mr_model_part.
ElementsBegin();
1117 #pragma omp parallel for
1118 for(
int kkk=0; kkk<number_of_threads; kkk++)
1120 for(
unsigned int ii=element_partition[kkk]; ii<element_partition[kkk+1]; ii++)
1122 ModelPart::ElementsContainerType::iterator ielem = ielembegin+ii;
1133 for (
int i=0 ;
i!=(TDim+1) ; ++
i)
1135 nodes_positions[
i*3+0]=geom[
i].X();
1136 nodes_positions[
i*3+1]=geom[
i].Y();
1137 nodes_positions[
i*3+2]=geom[
i].Z();
1143 int & number_of_particles_in_elem= ielem->
GetValue(NUMBER_OF_FLUID_PARTICLES);
1146 for (
int iii=0; iii<number_of_particles_in_elem ; iii++ )
1148 if (iii==mmaximum_number_of_particles)
1160 const float& particle_distance = pparticle.
GetDistance();
1163 bool is_found = CalculatePosition(nodes_positions,position[0],position[1],position[2],
N);
1164 if (is_found==
false)
1167 for (
int j=0 ;
j!=(TDim+1);
j++)
1168 if (
N[
j]<0.0 &&
N[
j]> -1
e-5)
1173 for (
int j=0 ;
j!=(TDim+1);
j++)
1186 nodes_addedweights[
j]+= weight;
1189 nodes_added_distance[
j] += weight*particle_distance;
1193 for (
int k=0 ;
k!=(TDim);
k++)
1203 for (
int i=0 ;
i!=(TDim+1) ; ++
i) {
1205 geom[
i].FastGetSolutionStepValue(DISTANCE) +=nodes_added_distance[
i];
1206 geom[
i].FastGetSolutionStepValue(PROJECTED_VELOCITY_X) +=nodes_addedvel[3*
i+0];
1207 geom[
i].FastGetSolutionStepValue(PROJECTED_VELOCITY_Y) +=nodes_addedvel[3*
i+1];
1208 geom[
i].FastGetSolutionStepValue(PROJECTED_VELOCITY_Z) +=nodes_addedvel[3*
i+2];
1210 geom[
i].FastGetSolutionStepValue(YP) +=nodes_addedweights[
i];
1211 geom[
i].UnSetLock();
1216 #pragma omp parallel for
1217 for(
int kkk=0; kkk<number_of_threads; kkk++)
1219 for(
unsigned int ii=node_partition[kkk]; ii<node_partition[kkk+1]; ii++)
1221 ModelPart::NodesContainerType::iterator inode = inodebegin+ii;
1222 double sum_weights = inode->FastGetSolutionStepValue(YP);
1223 if (sum_weights>0.00001)
1226 double &
dist = inode->FastGetSolutionStepValue(DISTANCE);
1228 inode->FastGetSolutionStepValue(PROJECTED_VELOCITY)=(inode->FastGetSolutionStepValue(PROJECTED_VELOCITY))/sum_weights;
1234 inode->FastGetSolutionStepValue(DISTANCE)=3.0;
1236 inode->FastGetSolutionStepValue(PROJECTED_VELOCITY)=inode->GetSolutionStepValue(VELOCITY,1);
1240 if (inode->IsFixed(DISTANCE))
1241 inode->FastGetSolutionStepValue(DISTANCE)=inode->GetSolutionStepValue(DISTANCE,1);
1257 std::cout <<
"projecting info to mesh (semi implicit)" << std::endl;
1260 const int offset = CurrentProcessInfo[WATER_PARTICLE_POINTERS_OFFSET];
1271 ModelPart::NodesContainerType::iterator inodebegin = mr_model_part.
NodesBegin();
1272 vector<unsigned int> node_partition;
1274 int number_of_threads = omp_get_max_threads();
1276 int number_of_threads = 1;
1278 OpenMPUtils::CreatePartition(number_of_threads, mr_model_part.
Nodes().size(), node_partition);
1280 #pragma omp parallel for
1281 for(
int kkk=0; kkk<number_of_threads; kkk++)
1283 for(
unsigned int ii=node_partition[kkk]; ii<node_partition[kkk+1]; ii++)
1285 ModelPart::NodesContainerType::iterator inode = inodebegin+ii;
1286 inode->FastGetSolutionStepValue(DISTANCE)=0.0;
1287 inode->FastGetSolutionStepValue(PROJECTED_VELOCITY)=
ZeroVector(3);
1288 inode->FastGetSolutionStepValue(YP)=0.0;
1294 vector<unsigned int> element_partition;
1295 OpenMPUtils::CreatePartition(number_of_threads, mr_model_part.
Elements().size(), element_partition);
1297 ModelPart::ElementsContainerType::iterator ielembegin = mr_model_part.
ElementsBegin();
1298 #pragma omp parallel for
1299 for(
int kkk=0; kkk<number_of_threads; kkk++)
1312 for(
unsigned int ii=element_partition[kkk]; ii<element_partition[kkk+1]; ii++)
1314 ModelPart::ElementsContainerType::iterator ielem = ielembegin+ii;
1329 const double elem_volume = geom.
Area();
1331 for (
int i=0 ;
i!=(TDim+1) ; ++
i)
1333 nodes_positions[
i*3+0]=geom[
i].X();
1334 nodes_positions[
i*3+1]=geom[
i].Y();
1335 nodes_positions[
i*3+2]=geom[
i].Z();
1340 int & number_of_particles_in_elem= ielem->
GetValue(NUMBER_OF_FLUID_PARTICLES);
1343 for (
int iii=0; iii<number_of_particles_in_elem ; iii++ )
1345 if (iii==mmaximum_number_of_particles)
1357 const float& particle_distance = pparticle.
GetDistance();
1360 bool is_found = CalculatePosition(nodes_positions,position[0],position[1],position[2],
N);
1361 if (is_found==
false)
1364 for (
int j=0 ;
j!=(TDim+1);
j++)
1365 if (
N[
j]<0.0 &&
N[
j]> -1
e-5)
1370 for (
int j=0 ;
j!=(TDim+1);
j++)
1373 for (
int k=0 ;
k!=(TDim+1);
k++)
1374 mass_matrix(
j,
k) += weight*
N(
k);
1379 rhs_d[
j] += weight *
double(particle_distance);
1384 double this_particle_weight = weight*elem_volume/(
double(number_of_particles_in_elem))*0.1;
1385 nodes_addedweights[
j]+= this_particle_weight;
1386 nodes_added_distance[
j] += this_particle_weight*particle_distance;
1387 for (
int k=0 ;
k!=(TDim);
k++)
1398 if constexpr (TDim==3)
1399 InvertMatrix( mass_matrix, inverse_mass_matrix);
1401 InvertMatrix3x3( mass_matrix, inverse_mass_matrix);
1404 if(number_of_particles_in_elem>(TDim*3))
1406 for (
int i=0 ;
i!=(TDim+1);
i++)
1408 for (
int j=0 ;
j!=(TDim+1);
j++)
1410 nodes_addedvel[3*
i+0] += inverse_mass_matrix(
i,
j)*rhs_x[
j]*elem_volume*(1.0/(
double(1+TDim)));
1411 nodes_addedvel[3*
i+1] += inverse_mass_matrix(
i,
j)*rhs_y[
j]*elem_volume*(1.0/(
double(1+TDim)));
1412 nodes_addedvel[3*
i+2] += inverse_mass_matrix(
i,
j)*rhs_z[
j]*elem_volume*(1.0/(
double(1+TDim)));
1413 nodes_added_distance[
i] += inverse_mass_matrix(
i,
j)*rhs_d[
j]*elem_volume*(1.0/(
double(1+TDim)));
1418 for (
int i=0 ;
i!=(TDim+1);
i++)
1419 nodes_addedweights[
i] += elem_volume*(1.0/(
double(1+TDim)));
1423 for (
int i=0 ;
i!=(TDim+1) ; ++
i) {
1425 geom[
i].FastGetSolutionStepValue(DISTANCE) +=nodes_added_distance[
i];
1426 geom[
i].FastGetSolutionStepValue(PROJECTED_VELOCITY_X) +=nodes_addedvel[3*
i+0];
1427 geom[
i].FastGetSolutionStepValue(PROJECTED_VELOCITY_Y) +=nodes_addedvel[3*
i+1];
1428 geom[
i].FastGetSolutionStepValue(PROJECTED_VELOCITY_Z) +=nodes_addedvel[3*
i+2];
1430 geom[
i].FastGetSolutionStepValue(YP) +=nodes_addedweights[
i];
1431 geom[
i].UnSetLock();
1436 #pragma omp parallel for
1437 for(
int kkk=0; kkk<number_of_threads; kkk++)
1439 for(
unsigned int ii=node_partition[kkk]; ii<node_partition[kkk+1]; ii++)
1441 ModelPart::NodesContainerType::iterator inode = inodebegin+ii;
1442 double sum_weights = inode->FastGetSolutionStepValue(YP);
1443 if (sum_weights>0.00001)
1446 double &
dist = inode->FastGetSolutionStepValue(DISTANCE);
1448 inode->FastGetSolutionStepValue(PROJECTED_VELOCITY)=(inode->FastGetSolutionStepValue(PROJECTED_VELOCITY))/sum_weights;
1454 inode->FastGetSolutionStepValue(DISTANCE)=3.0;
1456 inode->FastGetSolutionStepValue(PROJECTED_VELOCITY)=inode->GetSolutionStepValue(VELOCITY,1);
1460 if (inode->IsFixed(DISTANCE))
1461 inode->FastGetSolutionStepValue(DISTANCE)=inode->GetSolutionStepValue(DISTANCE,1);
1475 const int offset = CurrentProcessInfo[WATER_PARTICLE_POINTERS_OFFSET];
1478 ModelPart::ElementsContainerType::iterator ielembegin = mr_model_part.
ElementsBegin();
1481 vector<unsigned int> element_partition;
1483 int number_of_threads = omp_get_max_threads();
1485 int number_of_threads = 1;
1487 OpenMPUtils::CreatePartition(number_of_threads, mr_model_part.
Elements().size(), element_partition);
1489 #pragma omp parallel for
1490 for(
int kkk=0; kkk<number_of_threads; kkk++)
1492 for(
unsigned int ii=element_partition[kkk]; ii<element_partition[kkk+1]; ii++)
1495 ModelPart::ElementsContainerType::iterator ielem = ielembegin+ii;
1496 Element::Pointer pelement(*ielem.base());
1500 int & number_of_particles_in_elem=ielem->GetValue(NUMBER_OF_FLUID_PARTICLES);
1503 for (
int iii=0; iii<number_of_particles_in_elem ; iii++ )
1506 if (iii>mmaximum_number_of_particles)
1513 if (erase_flag==
false)
1515 AccelerateParticleUsingDeltaVelocity(pparticle,pelement,geom);
1534 while (
i != endit && (
i)->Id() != (candidate.lock())->Id())
1540 v.push_back(candidate);
1554 const int offset = CurrentProcessInfo[WATER_PARTICLE_POINTERS_OFFSET];
1555 const int max_results = 1000;
1558 unsigned int number_of_threads = OpenMPUtils::GetNumThreads();
1559 vector<unsigned int> elem_partition;
1560 int number_of_rows=mr_model_part.
Elements().size();
1561 elem_partition.resize(number_of_threads + 1);
1562 int elem_partition_size = number_of_rows / number_of_threads;
1563 elem_partition[0] = 0;
1564 elem_partition[number_of_threads] = number_of_rows;
1566 for (
unsigned int i = 1;
i < number_of_threads;
i++)
1567 elem_partition[
i] = elem_partition[
i - 1] + elem_partition_size;
1569 const bool local_use_mesh_velocity_to_convect = muse_mesh_velocity_to_convect;
1570 #pragma omp parallel firstprivate(elem_partition)
1574 ModelPart::ElementsContainerType::iterator it_begin = mr_model_part.
ElementsBegin() + elem_partition[
k];
1575 ModelPart::ElementsContainerType::iterator it_end = mr_model_part.
ElementsBegin() + elem_partition[
k+1] ;
1581 unsigned int freeparticle=0;
1584 for (ModelPart::ElementsContainerType::iterator ielem = it_begin; ielem != it_end; ielem++)
1586 results.resize(max_results);
1589 int & number_of_particles_in_elem=ielem->GetValue(NUMBER_OF_FLUID_PARTICLES);
1590 if (number_of_particles_in_elem<(minimum_number_of_particles))
1594 ComputeGaussPointPositionsForPreReseed(geom, pos,
N);
1597 for (
unsigned int j = 0;
j < (pos.size1());
j++)
1599 bool keep_looking =
true;
1602 if (mparticles_vector[freeparticle].GetEraseFlag()==
true)
1604 #pragma omp critical
1606 if (mparticles_vector[freeparticle].GetEraseFlag()==
true)
1608 mparticles_vector[freeparticle].GetEraseFlag()=
false;
1612 if (keep_looking==
false)
1626 bool is_found = CalculatePosition(geom,pos(
j,0),pos(
j,1),pos(
j,2),aux2_N);
1627 if (is_found==
false)
1636 Element::Pointer pelement( *ielem.base() );
1637 MoveParticle_inverse_way(pparticle, pelement, result_begin, max_results, local_use_mesh_velocity_to_convect);
1640 mparticles_vector[freeparticle] = pparticle;
1642 element_particle_pointers(offset+number_of_particles_in_elem) = &mparticles_vector[freeparticle];
1645 number_of_particles_in_elem++;
1664 void PostReseed(
int minimum_number_of_particles,
double mass_correction_factor )
1669 const int offset = CurrentProcessInfo[WATER_PARTICLE_POINTERS_OFFSET];
1671 if (mass_correction_factor>0.5) mass_correction_factor=0.5;
1672 if (mass_correction_factor<-0.5) mass_correction_factor=-0.5;
1680 const double threshold = mass_correction_factor*0.5;
1684 unsigned int number_of_threads = OpenMPUtils::GetNumThreads();
1686 vector<unsigned int> elem_partition;
1687 int number_of_rows=mr_model_part.
Elements().size();
1690 elem_partition.resize(number_of_threads + 1);
1691 int elem_partition_size = number_of_rows / number_of_threads;
1692 elem_partition[0] = 0;
1693 elem_partition[number_of_threads] = number_of_rows;
1695 for (
unsigned int i = 1;
i < number_of_threads;
i++)
1696 elem_partition[
i] = elem_partition[
i - 1] + elem_partition_size;
1704 #pragma omp parallel firstprivate(elem_partition)
1706 unsigned int reused_particles=0;
1708 unsigned int freeparticle = 0;
1711 ModelPart::ElementsContainerType::iterator it_begin = mr_model_part.
ElementsBegin() + elem_partition[
k];
1712 ModelPart::ElementsContainerType::iterator it_end = mr_model_part.
ElementsBegin() + elem_partition[
k+1] ;
1718 double sum_Ns_without_air_nodes;
1719 double mesh_distance;
1726 unsigned int number_of_reseeded_particles;
1732 for (ModelPart::ElementsContainerType::iterator ielem = it_begin; ielem != it_end; ielem++)
1736 int & number_of_particles_in_elem= ielem->GetValue(NUMBER_OF_FLUID_PARTICLES);
1741 if ( (number_of_particles_in_elem<(minimum_number_of_particles)))
1745 number_of_reseeded_particles=0;
1749 number_of_reseeded_particles= 3+2*TDim;
1750 ComputeGaussPointPositionsForPostReseed(geom, pos,
N);
1754 bool has_water_node=
false;
1755 bool has_air_node=
false;
1756 double mean_element_distance = 0.0;
1759 for (
unsigned int j = 0;
j < (TDim+1);
j++)
1761 mean_element_distance += (1.0/
double(TDim+1))*(geom[
j].FastGetSolutionStepValue(DISTANCE));
1762 if ((geom[
j].FastGetSolutionStepValue(DISTANCE))<0.0)
1763 has_water_node=
true;
1769 for (
unsigned int j = 0;
j < number_of_reseeded_particles;
j++)
1772 for (
unsigned int l = 0;
l < (TDim+1);
l++)
1774 distances[
j] +=
N(
j,
l) * geom[
l].FastGetSolutionStepValue(DISTANCE);
1779 if ( (has_air_node && has_water_node) )
1781 for (
unsigned int j = 0;
j < number_of_reseeded_particles ;
j++)
1784 is_water_particle[
j]=
false;
1786 is_water_particle[
j]=
true;
1789 else if (has_air_node)
1791 double water_fraction = 0.5 - 0.5*(mean_element_distance);
1792 if (water_fraction>0.9 && mass_correction_factor<0.0)
1793 mass_correction_factor = 0.0;
1794 unsigned int number_of_water_reseeded_particles =
double(number_of_reseeded_particles)*(1.01+mass_correction_factor*1.0)*water_fraction;
1796 BubbleSort(distances, positions, number_of_reseeded_particles);
1798 for (
unsigned int j = 0;
j < number_of_reseeded_particles ;
j++)
1800 int array_position = positions[
j]-1;
1801 if (array_position>3 && number_of_reseeded_particles==4)
1806 if ( (
j+1) <= number_of_water_reseeded_particles )
1807 is_water_particle[array_position]=
true;
1809 is_water_particle[array_position]=
false;
1814 for (
unsigned int j = 0;
j < number_of_reseeded_particles ;
j++)
1815 is_water_particle[
j]=
true;
1818 bool fix_distance =
false;
1819 unsigned int node_with_fixed_distance = 0;
1820 for (
unsigned int j = 0;
j < (TDim+1) ;
j++)
1822 if ((geom[
j].IsFixed(DISTANCE)))
1824 fix_distance =
true;
1825 node_with_fixed_distance =
j;
1831 bool is_water_for_all_particles=
true;
1832 if ((geom[node_with_fixed_distance].FastGetSolutionStepValue(DISTANCE))>0.0)
1833 is_water_for_all_particles=
false;
1835 for (
unsigned int j = 0;
j < number_of_reseeded_particles ;
j++)
1836 is_water_particle[
j]=is_water_for_all_particles;
1840 for (
unsigned int j = 0;
j < number_of_reseeded_particles;
j++)
1843 bool keep_looking =
true;
1846 if (mparticles_vector[freeparticle].GetEraseFlag()==
true)
1848 #pragma omp critical
1850 if (mparticles_vector[freeparticle].GetEraseFlag()==
true)
1852 mparticles_vector[freeparticle].GetEraseFlag()=
false;
1856 if (keep_looking==
false)
1876 bool is_found = CalculatePosition(geom,pos(
j,0),pos(
j,1),pos(
j,2),aux_N);
1877 if (is_found==
false)
1887 sum_Ns_without_air_nodes=0.0;
1891 mesh_distance = 0.0;
1894 for (
unsigned int l = 0;
l < (TDim+1);
l++)
1896 noalias(vel_complete) +=
N(
j,
l) * geom[
l].FastGetSolutionStepValue(VELOCITY);
1897 mesh_distance +=
N(
j,
l) * geom[
l].FastGetSolutionStepValue(DISTANCE);
1898 if ((geom[
l].FastGetSolutionStepValue(DISTANCE))<0.0)
1900 sum_Ns_without_air_nodes+=
N(
j,
l);
1901 noalias(vel_without_air_nodes) +=
N(
j,
l) * geom[
l].FastGetSolutionStepValue(VELOCITY);
1906 if (is_water_particle[
j])
1918 if (distance<0.0 && sum_Ns_without_air_nodes>0.01)
1919 vel = vel_without_air_nodes / sum_Ns_without_air_nodes ;
1926 mparticles_vector[freeparticle]=pparticle;
1927 element_particle_pointers(offset+number_of_particles_in_elem) = &mparticles_vector[freeparticle];
1928 number_of_particles_in_elem++;
1933 KRATOS_THROW_ERROR(std::logic_error,
"FINISHED THE LIST AND COULDNT FIND A FREE CELL FOR THE NEW PARTICLE!",
"");
1953 if(mparticle_printing_tool_initialized==
false)
1955 mfilter_factor=input_filter_factor;
1958 KRATOS_THROW_ERROR(std::logic_error,
"AN EMPTY MODEL PART IS REQUIRED FOR THE PRINTING OF PARTICLES",
"");
1964 for (
unsigned int i=0;
i!=((mmaximum_number_of_particles*mnelems)/mfilter_factor)+mfilter_factor;
i++)
1968 pnode->SetBufferSize(1);
1970 mparticle_printing_tool_initialized=
true;
1974 const double inactive_particle_position= -10.0;
1976 inactive_particle_position_vector(0)=inactive_particle_position;
1977 inactive_particle_position_vector(1)=inactive_particle_position;
1978 inactive_particle_position_vector(2)=inactive_particle_position;
1982 ModelPart::NodesContainerType::iterator inode = inodebegin+ii;
1983 inode->FastGetSolutionStepValue(DISTANCE) = 0.0;
1984 inode->FastGetSolutionStepValue(VELOCITY) =
ZeroVector(3);
1985 inode->FastGetSolutionStepValue(DISPLACEMENT) = inactive_particle_position_vector;
1991 for (
int i=0;
i!=mmaximum_number_of_particles*mnelems;
i++)
1996 ModelPart::NodesContainerType::iterator inode = inodebegin+
counter;
1997 inode->FastGetSolutionStepValue(DISTANCE) = pparticle.
GetDistance();
1998 inode->FastGetSolutionStepValue(VELOCITY) = pparticle.
GetVelocity();
1999 inode->FastGetSolutionStepValue(DISPLACEMENT) = pparticle.
Coordinates();
2012 const int first_particle_id=1000000;
2013 if(mparticle_printing_tool_initialized==
false)
2015 mfilter_factor=input_filter_factor;
2018 KRATOS_THROW_ERROR(std::logic_error,
"AN EMPTY MODEL PART IS REQUIRED FOR THE PRINTING OF PARTICLES",
"");
2024 for (
unsigned int i=0;
i!=((mmaximum_number_of_particles*mnelems)/mfilter_factor)+mfilter_factor;
i++)
2028 pnode->SetBufferSize(1);
2030 mparticle_printing_tool_initialized=
true;
2034 const double inactive_particle_position= -10.0;
2036 inactive_particle_position_vector(0)=inactive_particle_position;
2037 inactive_particle_position_vector(1)=inactive_particle_position;
2038 inactive_particle_position_vector(2)=inactive_particle_position;
2042 ModelPart::NodesContainerType::iterator inode = inodebegin+ii;
2043 inode->FastGetSolutionStepValue(DISTANCE) = 0.0;
2044 inode->FastGetSolutionStepValue(VELOCITY) =
ZeroVector(3);
2045 inode->FastGetSolutionStepValue(DISPLACEMENT) = inactive_particle_position_vector;
2051 const int offset = CurrentProcessInfo[WATER_PARTICLE_POINTERS_OFFSET];
2054 ModelPart::ElementsContainerType::iterator ielembegin = mr_model_part.
ElementsBegin();
2057 for(
unsigned int ii=0; ii<mr_model_part.
Elements().size(); ii++)
2059 ModelPart::ElementsContainerType::iterator ielem = ielembegin+ii;
2060 Element::Pointer pelement(*ielem.base());
2063 bool pure_air_elem=
true;
2064 for(
unsigned int j=0;
j<(TDim+1);
j++)
2066 if (geom[
j].FastGetSolutionStepValue(DISTANCE)<0.0)
2067 pure_air_elem=
false;
2071 if (pure_air_elem==
true)
2074 int & number_of_particles_in_elem=ielem->GetValue(NUMBER_OF_FLUID_PARTICLES);
2077 for (
int iii=0; iii<number_of_particles_in_elem ; iii++ )
2080 if (iii>mmaximum_number_of_particles)
2087 if (erase_flag==
false && pparticle.
GetDistance()<0.0)
2089 ModelPart::NodesContainerType::iterator inode = inodebegin+
counter;
2090 inode->FastGetSolutionStepValue(DISTANCE) = pparticle.
GetDistance();
2091 inode->FastGetSolutionStepValue(VELOCITY) = pparticle.
GetVelocity();
2092 inode->FastGetSolutionStepValue(DISPLACEMENT) = pparticle.
Coordinates();
2098 if (
counter>(max_number_of_printed_particles-30))
2111 ModelPart::ConditionsContainerType::iterator iconditionbegin = mr_model_part.
ConditionsBegin();
2112 vector<unsigned int> condition_partition;
2114 int number_of_threads = omp_get_max_threads();
2116 int number_of_threads = 1;
2119 OpenMPUtils::CreatePartition(number_of_threads, mr_model_part.
Conditions().size(), condition_partition);
2121 #pragma omp parallel for
2122 for(
int kkk=0; kkk<number_of_threads; kkk++)
2124 for(
unsigned int ii=condition_partition[kkk]; ii<condition_partition[kkk+1]; ii++)
2126 ModelPart::ConditionsContainerType::iterator icondition = iconditionbegin+ii;
2127 if ( icondition->GetValue(IS_INLET) > 0.5 )
2131 this->CalculateNormal(geom,normal);
2132 const double normal_lenght = sqrt(normal[0]*normal[0] + normal[1]*normal[1] + normal[2]*normal[2]);
2134 for (
unsigned int l = 0;
l < (TDim);
l++)
2137 geom[
l].FastGetSolutionStepValue(VELOCITY) =
velocity;
2138 geom[
l].UnSetLock();
2154 if(fabs(rotations[0])>0.000000001 || fabs(rotations[1])>0.000000001)
2155 KRATOS_THROW_ERROR(std::invalid_argument,
"ROTATIONS ONLY IMPLEMENTED AROUND Z AXIS! (xy plane) ",
"");
2157 const double cosinus_theta = cos(rotations[2]);
2158 const double sinus_theta = sin(rotations[2]);
2163 const int offset = CurrentProcessInfo[WATER_PARTICLE_POINTERS_OFFSET];
2166 ModelPart::ElementsContainerType::iterator ielembegin = mr_model_part.
ElementsBegin();
2169 vector<unsigned int> element_partition;
2171 int number_of_threads = omp_get_max_threads();
2173 int number_of_threads = 1;
2175 OpenMPUtils::CreatePartition(number_of_threads, mr_model_part.
Elements().size(), element_partition);
2177 #pragma omp parallel for
2178 for(
int kkk=0; kkk<number_of_threads; kkk++)
2180 for(
unsigned int ii=element_partition[kkk]; ii<element_partition[kkk+1]; ii++)
2183 ModelPart::ElementsContainerType::iterator ielem = ielembegin+ii;
2184 Element::Pointer pelement(*ielem.base());
2187 int & number_of_particles_in_elem=ielem->GetValue(NUMBER_OF_FLUID_PARTICLES);
2190 for (
int iii=0; iii<number_of_particles_in_elem ; iii++ )
2193 if (iii>mmaximum_number_of_particles)
2200 if (erase_flag==
false)
2203 const float vel_x =
vel[0];
2204 const float vel_y =
vel[1];
2205 vel[0] = cosinus_theta*vel_x + sinus_theta*vel_y;
2206 vel[1] = cosinus_theta*vel_y - sinus_theta*vel_x;
2215 ModelPart::NodesContainerType::iterator inodebegin = mr_model_part.
NodesBegin();
2216 vector<unsigned int> node_partition;
2217 OpenMPUtils::CreatePartition(number_of_threads, mr_model_part.
Nodes().size(), node_partition);
2219 #pragma omp parallel for
2220 for(
int kkk=0; kkk<number_of_threads; kkk++)
2222 for(
unsigned int ii=node_partition[kkk]; ii<node_partition[kkk+1]; ii++)
2224 ModelPart::NodesContainerType::iterator inode = inodebegin+ii;
2225 if (inode->IsFixed(VELOCITY_X)==
false)
2228 const double vel_x =
vel[0];
2229 const double vel_y =
vel[1];
2230 vel[0] = cosinus_theta*vel_x + sinus_theta*vel_y;
2231 vel[1] = cosinus_theta*vel_y - sinus_theta*vel_x;
2247 if(mr_model_part.
NodesBegin()->SolutionStepsDataHas(DISTANCE) ==
false)
KRATOS_THROW_ERROR(std::invalid_argument,
"missing DISTANCE variable on solution step data",
"");
2248 if(mr_model_part.
NodesBegin()->SolutionStepsDataHas(VELOCITY) ==
false)
KRATOS_THROW_ERROR(std::invalid_argument,
"missing VELOCITY variable on solution step data",
"");
2249 if(mr_model_part.
NodesBegin()->SolutionStepsDataHas(PRESSURE) ==
false)
KRATOS_THROW_ERROR(std::invalid_argument,
"missing PRESSURE variable on solution step data",
"");
2250 if(mr_model_part.
NodesBegin()->SolutionStepsDataHas(PROJECTED_VELOCITY) ==
false)
KRATOS_THROW_ERROR(std::invalid_argument,
"missing PROJECTED_VELOCITY variable on solution step data",
"");
2251 if(mr_model_part.
NodesBegin()->SolutionStepsDataHas(DELTA_VELOCITY) ==
false)
KRATOS_THROW_ERROR(std::invalid_argument,
"missing DELTA_VELOCITY variable on solution step data",
"");
2252 if(mr_model_part.
NodesBegin()->SolutionStepsDataHas(MESH_VELOCITY) ==
false)
KRATOS_THROW_ERROR(std::invalid_argument,
"missing MESH_VELOCITY variable on solution step data",
"");
2253 if(mr_model_part.
NodesBegin()->SolutionStepsDataHas(YP) ==
false)
KRATOS_THROW_ERROR(std::invalid_argument,
"missing YP variable on solution step data",
"");
2254 if(mr_model_part.
NodesBegin()->SolutionStepsDataHas(NORMAL) ==
false)
KRATOS_THROW_ERROR(std::invalid_argument,
"missing NORMAL variable on solution step data",
"");
2261 void MoveParticle( PFEM_Particle_Fluid & pparticle,
2262 Element::Pointer & pelement,
2264 unsigned int & number_of_elements_in_trajectory,
2266 const unsigned int MaxNumberOfResults,
2267 const array_1d<double,3> mesh_displacement,
2268 const bool discriminate_streamlines,
2269 const bool use_mesh_velocity_to_convect)
2272 ProcessInfo& CurrentProcessInfo = mr_model_part.
GetProcessInfo();
2273 double delta_t = CurrentProcessInfo[DELTA_TIME];
2274 array_1d<double,3> & gravity= CurrentProcessInfo[GRAVITY];
2275 unsigned int nsubsteps;
2279 bool KEEP_INTEGRATING=
false;
2284 array_1d<double,3>
vel;
2285 array_1d<double,3> vel_without_other_phase_nodes=
ZeroVector(3);
2286 array_1d<double,3> position;
2287 array_1d<double,3> mid_position;
2288 array_1d<double,TDim+1>
N;
2291 position = pparticle.Coordinates();
2293 const float particle_distance = pparticle.GetDistance();
2294 array_1d<float,3> particle_velocity = pparticle.GetVelocity();
2296 array_1d<double,3> last_useful_vel;
2297 double sum_Ns_without_other_phase_nodes;
2301 double only_integral = 0.0 ;
2303 is_found = FindNodeOnMesh(position,
N ,pelement,result_begin,MaxNumberOfResults);
2304 if(is_found ==
true)
2306 KEEP_INTEGRATING=
true;
2307 Geometry< Node >& geom = pelement->GetGeometry();
2309 vel_without_other_phase_nodes =
ZeroVector(3);
2310 sum_Ns_without_other_phase_nodes=0.0;
2313 if (particle_distance<0.0 && discriminate_streamlines==
true)
2315 for(
unsigned int j=0;
j<(TDim+1);
j++)
2317 if ((geom[
j].FastGetSolutionStepValue(DISTANCE))<0.0)
2319 sum_Ns_without_other_phase_nodes +=
N[
j];
2320 noalias(vel_without_other_phase_nodes) += geom[
j].FastGetSolutionStepValue(VELOCITY)*
N[
j];
2321 if (use_mesh_velocity_to_convect)
2322 noalias(vel_without_other_phase_nodes) -= geom[
j].FastGetSolutionStepValue(MESH_VELOCITY)*
N[
j];
2325 noalias(
vel) += geom[
j].FastGetSolutionStepValue(VELOCITY)*
N[
j];
2326 if (use_mesh_velocity_to_convect)
2327 noalias(
vel) -= geom[
j].FastGetSolutionStepValue(MESH_VELOCITY)*
N[
j];
2330 if (sum_Ns_without_other_phase_nodes>0.01)
2332 vel = vel_without_other_phase_nodes / sum_Ns_without_other_phase_nodes;
2337 vel = particle_velocity;
2338 if (use_mesh_velocity_to_convect)
2340 for(
unsigned int j=0;
j<(TDim+1);
j++)
2341 noalias(
vel) -= geom[
j].FastGetSolutionStepValue(MESH_VELOCITY)*
N[
j];
2347 for(
unsigned int j=0;
j<(TDim+1);
j++)
2349 noalias(
vel) += geom[
j].FastGetSolutionStepValue(VELOCITY)*
N[
j];
2350 if (use_mesh_velocity_to_convect)
2351 noalias(
vel) -= geom[
j].FastGetSolutionStepValue(MESH_VELOCITY)*
N[
j];
2359 nsubsteps = 10.0 * (
delta_t * pelement->GetValue(VELOCITY_OVER_ELEM_SIZE));
2364 only_integral = 1.0;
2367 position +=
vel*substep_dt;
2370 last_useful_vel=
vel;
2375 unsigned int check_from_element_number=0;
2378 for(
unsigned int i=0;
i<(nsubsteps-1);
i++)
2380 if (KEEP_INTEGRATING==
true)
2382 is_found = FindNodeOnMesh(position,
N ,pelement,elements_in_trajectory,number_of_elements_in_trajectory,check_from_element_number,result_begin,MaxNumberOfResults);
2383 if(is_found ==
true)
2385 Geometry< Node >& geom = pelement->GetGeometry();
2386 sum_Ns_without_other_phase_nodes=0.0;
2388 if (particle_distance<0.0 && discriminate_streamlines==
true)
2390 vel_without_other_phase_nodes =
ZeroVector(3);
2392 for(
unsigned int j=0;
j<TDim+1;
j++)
2394 if ((geom[
j].FastGetSolutionStepValue(DISTANCE))<0.0)
2396 sum_Ns_without_other_phase_nodes +=
N[
j];
2397 noalias(vel_without_other_phase_nodes) += geom[
j].FastGetSolutionStepValue(VELOCITY)*
N[
j];
2398 if (use_mesh_velocity_to_convect)
2399 noalias(vel_without_other_phase_nodes) -= geom[
j].FastGetSolutionStepValue(MESH_VELOCITY)*
N[
j];
2401 noalias(
vel) += geom[
j].FastGetSolutionStepValue(VELOCITY)*
N[
j];
2402 if (use_mesh_velocity_to_convect)
2403 noalias(
vel) -= geom[
j].FastGetSolutionStepValue(MESH_VELOCITY)*
N[
j];
2408 if (sum_Ns_without_other_phase_nodes>0.01)
2410 vel = vel_without_other_phase_nodes / sum_Ns_without_other_phase_nodes;
2415 particle_velocity += substep_dt * gravity;
2416 vel = particle_velocity;
2417 if (use_mesh_velocity_to_convect)
2419 for(
unsigned int j=0;
j<(TDim+1);
j++)
2420 noalias(
vel) -= geom[
j].FastGetSolutionStepValue(MESH_VELOCITY)*
N[
j];
2426 vel_without_other_phase_nodes =
ZeroVector(3);
2428 for(
unsigned int j=0;
j<(TDim+1);
j++)
2430 noalias(
vel) += geom[
j].FastGetSolutionStepValue(VELOCITY)*
N[
j];
2431 if (use_mesh_velocity_to_convect)
2432 noalias(
vel) -= geom[
j].FastGetSolutionStepValue(MESH_VELOCITY)*
N[
j];
2438 only_integral += 1.0;
2440 position+=
vel*substep_dt;
2445 KEEP_INTEGRATING=
false;
2458 position-=mesh_displacement;
2461 if (KEEP_INTEGRATING==
false) (pparticle.GetEraseFlag()=
true);
2462 else is_found = FindNodeOnMesh(position,
N ,pelement,result_begin,MaxNumberOfResults);
2464 if (is_found==
false) ( pparticle.GetEraseFlag()=
true);
2466 pparticle.Coordinates() = position;
2470 void AccelerateParticleUsingDeltaVelocity(
2471 PFEM_Particle_Fluid & pparticle,
2472 Element::Pointer & pelement,
2473 Geometry< Node >& geom)
2475 array_1d<double,TDim+1>
N;
2478 const double delta_t = CurrentProcessInfo[DELTA_TIME];
2479 array_1d<double,3> gravity = CurrentProcessInfo[GRAVITY];
2483 array_1d<double,3> coords = pparticle.Coordinates();
2484 float & particle_distance = pparticle.GetDistance();
2486 array_1d<double,3> delta_velocity =
ZeroVector(3);
2488 array_1d<double,3> delta_velocity_without_air =
ZeroVector(3);
2489 array_1d<double,3> delta_velocity_without_water =
ZeroVector(3);
2490 double sum_Ns_without_water_nodes = 0.0;
2491 double sum_Ns_without_air_nodes = 0.0;
2493 bool is_found = CalculatePosition(geom,coords[0],coords[1],coords[2],
N);
2494 if(is_found ==
false)
2497 for (
int j=0 ;
j!=(TDim+1);
j++)
2503 if (particle_distance>0.0)
2505 for(
unsigned int j=0;
j<(TDim+1);
j++)
2508 if ((geom[
j].FastGetSolutionStepValue(DISTANCE))>0.0)
2510 noalias(delta_velocity_without_water) += geom[
j].FastGetSolutionStepValue(DELTA_VELOCITY)*
N[
j];
2511 sum_Ns_without_air_nodes +=
N[
j];
2515 noalias(delta_velocity) += geom[
j].FastGetSolutionStepValue(DELTA_VELOCITY)*
N[
j];
2518 if (sum_Ns_without_water_nodes>0.01)
2528 for(
unsigned int j=0;
j<(TDim+1);
j++)
2530 if ((geom[
j].FastGetSolutionStepValue(DISTANCE))<0.0)
2532 noalias(delta_velocity_without_air) += geom[
j].FastGetSolutionStepValue(DELTA_VELOCITY)*
N[
j];
2533 sum_Ns_without_air_nodes +=
N[
j];
2536 noalias(delta_velocity) += geom[
j].FastGetSolutionStepValue(DELTA_VELOCITY)*
N[
j];
2539 if (sum_Ns_without_air_nodes>0.01)
2541 delta_velocity = delta_velocity_without_air/sum_Ns_without_air_nodes ;
2545 if (mDENSITY_WATER>(10.0*mDENSITY_AIR))
2547 delta_velocity=gravity*(1.0-mDENSITY_AIR/mDENSITY_WATER)*
delta_t;
2552 pparticle.GetVelocity() = pparticle.GetVelocity() + delta_velocity;
2555 void MoveParticle_inverse_way(
2556 PFEM_Particle_Fluid & pparticle,
2557 Element::Pointer & pelement,
2559 const unsigned int MaxNumberOfResults,
2560 const bool use_mesh_velocity_to_convect)
2564 double delta_t = CurrentProcessInfo[DELTA_TIME];
2565 unsigned int nsubsteps;
2569 bool KEEP_INTEGRATING=
false;
2572 array_1d<double,3>
vel;
2573 array_1d<double,3> particle_vel;
2574 array_1d<double,3> position;
2575 array_1d<double,3> mid_position;
2576 array_1d<double,TDim+1>
N;
2580 position = pparticle.Coordinates();
2583 float & distance = pparticle.GetDistance();
2584 double only_integral = 0.0 ;
2586 is_found = FindNodeOnMesh(position,
N ,pelement,result_begin,MaxNumberOfResults);
2587 if(is_found ==
true)
2589 KEEP_INTEGRATING=
true;
2590 Geometry< Node >& geom = pelement->GetGeometry();
2595 for(
unsigned int j=0;
j<(TDim+1);
j++)
2597 distance += geom[
j].FastGetSolutionStepValue(DISTANCE)*
N(
j);
2598 noalias(particle_vel) += geom[
j].FastGetSolutionStepValue(VELOCITY)*
N[
j];
2599 noalias(
vel) += geom[
j].FastGetSolutionStepValue(VELOCITY)*
N[
j];
2600 if (use_mesh_velocity_to_convect)
2601 noalias(
vel) -= geom[
j].FastGetSolutionStepValue(MESH_VELOCITY)*
N[
j];
2604 nsubsteps = 10.0 * (
delta_t * pelement->GetValue(VELOCITY_OVER_ELEM_SIZE));
2609 only_integral = 1.0;
2610 position -=
vel*substep_dt;
2612 for(
unsigned int i=0;
i<(nsubsteps-1);
i++)
2613 {
if (KEEP_INTEGRATING==
true) {
2614 is_found = FindNodeOnMesh(position,
N ,pelement,result_begin,MaxNumberOfResults);
2615 if(is_found ==
true)
2617 Geometry< Node >& geom = pelement->GetGeometry();
2624 for(
unsigned int j=0;
j<(TDim+1);
j++)
2626 noalias(particle_vel) += geom[
j].FastGetSolutionStepValue(VELOCITY)*
N[
j] ;
2627 noalias(
vel) += geom[
j].FastGetSolutionStepValue(VELOCITY)*
N[
j] ;
2628 distance += geom[
j].FastGetSolutionStepValue(DISTANCE)*
N(
j);
2629 if (use_mesh_velocity_to_convect)
2630 noalias(
vel) -= geom[
j].FastGetSolutionStepValue(MESH_VELOCITY)*
N[
j];
2634 only_integral += 1.0;
2635 position-=
vel*substep_dt;
2637 else KEEP_INTEGRATING=
false;
2656 pparticle.GetVelocity()=particle_vel;
2662 void OverwriteParticleDataUsingTopographicDomain(
2663 PFEM_Particle_Fluid & pparticle,
2664 Element::Pointer & pelement,
2665 array_1d<double,3> domains_offset,
2667 const unsigned int MaxNumberOfResults)
2669 array_1d<double,TDim+1>
N;
2672 array_1d<double,3> coords = pparticle.Coordinates()+domains_offset;
2673 float & particle_distance = pparticle.GetDistance();
2674 bool is_found = FindNodeOnTopographicMesh(coords,
N ,pelement,result_begin,MaxNumberOfResults);
2678 particle_distance= -1.0;
2682 particle_distance= 1.0;
2695 bool FindNodeOnMesh( array_1d<double,3>& position,
2696 array_1d<double,TDim+1>&
N,
2697 Element::Pointer & pelement,
2699 const unsigned int MaxNumberOfResults)
2703 const array_1d<double,3>& coords = position;
2704 array_1d<double,TDim+1> aux_N;
2706 Geometry<Node >& geom_default = pelement->GetGeometry();
2707 bool is_found_1 = CalculatePosition(geom_default,coords[0],coords[1],coords[2],
N);
2708 if(is_found_1 ==
true)
2737 for (
unsigned int i=0;
i!=(neighb_elems.
size());
i++)
2739 if(neighb_elems(
i).get()!=
nullptr)
2741 Geometry<Node >& geom = neighb_elems[
i].GetGeometry();
2742 bool is_found_2 = CalculatePosition(geom,coords[0],coords[1],coords[2],
N);
2745 pelement = neighb_elems[
i].shared_from_this();
2753 SizeType results_found = mpBinsObjectDynamic->SearchObjectsInCell(Point{coords}, result_begin, MaxNumberOfResults );
2755 if(results_found>0){
2759 Geometry<Node >& geom = (*(result_begin+
i))->GetGeometry();
2762 bool is_found = CalculatePosition(geom,coords[0],coords[1],coords[2],
N);
2764 if(is_found ==
true)
2766 pelement=Element::Pointer((*(result_begin+
i)));
2778 bool FindNodeOnMesh( array_1d<double,3>& position,
2779 array_1d<double,TDim+1>&
N,
2780 Element::Pointer & pelement,
2782 unsigned int & number_of_elements_in_trajectory,
2783 unsigned int & check_from_element_number,
2785 const unsigned int MaxNumberOfResults)
2789 const array_1d<double,3>& coords = position;
2790 array_1d<double,TDim+1> aux_N;
2792 Geometry<Node >& geom_default = pelement->GetGeometry();
2793 bool is_found_1 = CalculatePosition(geom_default,coords[0],coords[1],coords[2],
N);
2794 if(is_found_1 ==
true)
2800 for (
unsigned int i=(check_from_element_number);
i!=number_of_elements_in_trajectory;
i++)
2802 Geometry<Node >& geom = elements_in_trajectory[
i].GetGeometry();
2803 bool is_found_2 = CalculatePosition(geom,coords[0],coords[1],coords[2],aux_N);
2806 pelement = elements_in_trajectory[
i].shared_from_this();
2808 check_from_element_number =
i+1 ;
2838 for (
unsigned int i=0;
i!=(neighb_elems.
size());
i++)
2840 if(neighb_elems(
i).get()!=
nullptr)
2842 Geometry<Node >& geom = neighb_elems[
i].GetGeometry();
2843 bool is_found_2 = CalculatePosition(geom,coords[0],coords[1],coords[2],
N);
2846 pelement = neighb_elems[
i].shared_from_this();
2847 if (number_of_elements_in_trajectory<20)
2849 elements_in_trajectory(number_of_elements_in_trajectory)=pelement;
2850 number_of_elements_in_trajectory++;
2851 check_from_element_number = number_of_elements_in_trajectory;
2861 SizeType results_found = mpBinsObjectDynamic->SearchObjectsInCell(Point{coords}, result_begin, MaxNumberOfResults );
2868 Geometry<Node >& geom = (*(result_begin+
i))->GetGeometry();
2871 bool is_found = CalculatePosition(geom,coords[0],coords[1],coords[2],
N);
2873 if(is_found ==
true)
2875 pelement=Element::Pointer((*(result_begin+
i)));
2876 if (number_of_elements_in_trajectory<20)
2878 elements_in_trajectory(number_of_elements_in_trajectory)=pelement;
2879 number_of_elements_in_trajectory++;
2880 check_from_element_number = number_of_elements_in_trajectory;
2896 bool FindNodeOnTopographicMesh( array_1d<double,3>& position,
2897 array_1d<double,TDim+1>&
N,
2898 Element::Pointer & pelement,
2900 const unsigned int MaxNumberOfResults)
2904 const array_1d<double,3>& coords = position;
2905 array_1d<double,TDim+1> aux_N;
2909 Geometry<Node >& geom_default = pelement->GetGeometry();
2910 bool is_found_1 = CalculatePosition(geom_default,coords[0],coords[1],coords[2],
N);
2911 if(is_found_1 ==
true)
2919 for (
unsigned int i=0;
i!=(neighb_elems.
size());
i++)
2921 if(neighb_elems(
i).get()!=
nullptr)
2923 Geometry<Node >& geom = neighb_elems[
i].GetGeometry();
2924 bool is_found_2 = CalculatePosition(geom,coords[0],coords[1],coords[2],
N);
2927 pelement = neighb_elems[
i].shared_from_this();
2935 SizeType results_found = mpTopographicBinsObjectDynamic->SearchObjectsInCell(Point{coords}, result_begin, MaxNumberOfResults );
2938 if(results_found>0){
2942 Geometry<Node >& geom = (*(result_begin+
i))->GetGeometry();
2945 bool is_found = CalculatePosition(geom,coords[0],coords[1],coords[2],
N);
2947 if(is_found ==
true)
2949 pelement=Element::Pointer((*(result_begin+
i)));
2962 inline bool CalculatePosition(Geometry<Node >&geom,
2963 const double xc,
const double yc,
const double zc,
2964 array_1d<double, 3 > &
N
2967 double x0 = geom[0].X();
2968 double y0 = geom[0].Y();
2969 double x1 = geom[1].X();
2970 double y1 = geom[1].Y();
2971 double x2 = geom[2].X();
2972 double y2 = geom[2].Y();
2974 double area = CalculateVol(x0, y0,
x1, y1,
x2, y2);
2975 double inv_area = 0.0;
2981 inv_area = 1.0 / area;
2985 N[0] = CalculateVol(
x1, y1,
x2, y2,
xc,
yc) * inv_area;
2986 N[1] = CalculateVol(
x2, y2, x0, y0,
xc,
yc) * inv_area;
2987 N[2] = CalculateVol(x0, y0,
x1, y1,
xc,
yc) * inv_area;
2990 if (
N[0] >= 0.0 &&
N[1] >= 0.0 &&
N[2] >= 0.0 &&
N[0] <= 1.0 &&
N[1] <= 1.0 &&
N[2] <= 1.0)
2997 inline bool CalculatePosition(
const array_1d<
double,3*(TDim+1)>& nodes_positions,
2998 const double xc,
const double yc,
const double zc,
2999 array_1d<double, 3 > &
N
3002 const double& x0 = nodes_positions[0];
3003 const double& y0 = nodes_positions[1];
3004 const double&
x1 = nodes_positions[3];
3005 const double& y1 = nodes_positions[4];
3006 const double&
x2 = nodes_positions[6];
3007 const double& y2 = nodes_positions[7];
3009 double area = CalculateVol(x0, y0,
x1, y1,
x2, y2);
3010 double inv_area = 0.0;
3016 inv_area = 1.0 / area;
3020 N[0] = CalculateVol(
x1, y1,
x2, y2,
xc,
yc) * inv_area;
3021 N[1] = CalculateVol(
x2, y2, x0, y0,
xc,
yc) * inv_area;
3022 N[2] = CalculateVol(x0, y0,
x1, y1,
xc,
yc) * inv_area;
3025 if (
N[0] >= 0.0 &&
N[1] >= 0.0 &&
N[2] >= 0.0 &&
N[0] <= 1.0 &&
N[1] <= 1.0 &&
N[2] <= 1.0)
3035 inline bool CalculatePosition(Geometry<Node >&geom,
3036 const double xc,
const double yc,
const double zc,
3037 array_1d<double, 4 > &
N
3041 double x0 = geom[0].X();
3042 double y0 = geom[0].Y();
3043 double z0 = geom[0].Z();
3044 double x1 = geom[1].X();
3045 double y1 = geom[1].Y();
3046 double z1 = geom[1].Z();
3047 double x2 = geom[2].X();
3048 double y2 = geom[2].Y();
3049 double z2 = geom[2].Z();
3050 double x3 = geom[3].X();
3051 double y3 = geom[3].Y();
3052 double z3 = geom[3].Z();
3054 double vol = CalculateVol(x0, y0, z0,
x1, y1, z1,
x2, y2, z2, x3, y3, z3);
3056 double inv_vol = 0.0;
3057 if (vol < 0.000000000000000000000000000001)
3062 inv_vol = 1.0 / vol;
3065 N[0] = CalculateVol(
x1, y1, z1, x3, y3, z3,
x2, y2, z2,
xc,
yc, zc) * inv_vol;
3066 N[1] = CalculateVol(x0, y0, z0,
x1, y1, z1,
x2, y2, z2,
xc,
yc, zc) * inv_vol;
3067 N[2] = CalculateVol(x3, y3, z3,
x1, y1, z1, x0, y0, z0,
xc,
yc, zc) * inv_vol;
3068 N[3] = CalculateVol(x3, y3, z3, x0, y0, z0,
x2, y2, z2,
xc,
yc, zc) * inv_vol;
3071 if (
N[0] >= 0.0 &&
N[1] >= 0.0 &&
N[2] >= 0.0 &&
N[3] >= 0.0 &&
3072 N[0] <= 1.0 &&
N[1] <= 1.0 &&
N[2] <= 1.0 &&
N[3] <= 1.0)
3080 inline bool CalculatePosition(
const array_1d<
double,3*(TDim+1)>& nodes_positions,
3081 const double xc,
const double yc,
const double zc,
3082 array_1d<double, 4 > &
N
3086 const double& x0 = nodes_positions[0];
3087 const double& y0 = nodes_positions[1];
3088 const double& z0 = nodes_positions[2];
3089 const double&
x1 = nodes_positions[3];
3090 const double& y1 = nodes_positions[4];
3091 const double& z1 = nodes_positions[5];
3092 const double&
x2 = nodes_positions[6];
3093 const double& y2 = nodes_positions[7];
3094 const double& z2 = nodes_positions[8];
3095 const double& x3 = nodes_positions[9];
3096 const double& y3 = nodes_positions[10];
3097 const double& z3 = nodes_positions[11];
3099 double vol = CalculateVol(x0, y0, z0,
x1, y1, z1,
x2, y2, z2, x3, y3, z3);
3101 double inv_vol = 0.0;
3102 if (vol < 0.000000000000000000000000000001)
3107 inv_vol = 1.0 / vol;
3110 N[0] = CalculateVol(
x1, y1, z1, x3, y3, z3,
x2, y2, z2,
xc,
yc, zc) * inv_vol;
3111 N[1] = CalculateVol(x0, y0, z0,
x1, y1, z1,
x2, y2, z2,
xc,
yc, zc) * inv_vol;
3112 N[2] = CalculateVol(x3, y3, z3,
x1, y1, z1, x0, y0, z0,
xc,
yc, zc) * inv_vol;
3113 N[3] = CalculateVol(x3, y3, z3, x0, y0, z0,
x2, y2, z2,
xc,
yc, zc) * inv_vol;
3116 if (
N[0] >= 0.0 &&
N[1] >= 0.0 &&
N[2] >= 0.0 &&
N[3] >= 0.0 &&
3117 N[0] <= 1.0 &&
N[1] <= 1.0 &&
N[2] <= 1.0 &&
N[3] <= 1.0)
3124 inline double CalculateVol(
const double x0,
const double y0,
3125 const double x1,
const double y1,
3126 const double x2,
const double y2
3129 return 0.5 * ((
x1 - x0)*(y2 - y0)- (y1 - y0)*(
x2 - x0));
3134 inline double CalculateVol(
const double x0,
const double y0,
const double z0,
3135 const double x1,
const double y1,
const double z1,
3136 const double x2,
const double y2,
const double z2,
3137 const double x3,
const double y3,
const double z3
3140 double x10 =
x1 - x0;
3141 double y10 = y1 - y0;
3142 double z10 = z1 - z0;
3144 double x20 =
x2 - x0;
3145 double y20 = y2 - y0;
3146 double z20 = z2 - z0;
3148 double x30 = x3 - x0;
3149 double y30 = y3 - y0;
3150 double z30 = z3 - z0;
3152 double detJ = x10 * y20 * z30 - x10 * y30 * z20 + y10 * z20 * x30 - y10 * x20 * z30 + z10 * x20 * y30 - z10 * y20 * x30;
3153 return detJ * 0.1666666666666666666667;
3158 void ComputeGaussPointPositions_4(Geometry< Node >& geom, BoundedMatrix<double, 7, 3 > & pos,BoundedMatrix<double, 7, 3 > &
N)
3160 double one_third = 1.0 / 3.0;
3161 double one_sixt = 0.15;
3162 double two_third = 0.7;
3166 N(0, 2) = two_third;
3167 N(1, 0) = two_third;
3171 N(2, 1) = two_third;
3173 N(3, 0) = one_third;
3174 N(3, 1) = one_third;
3175 N(3, 2) = one_third;
3178 pos(0, 0) = one_sixt * geom[0].X() + one_sixt * geom[1].X() + two_third * geom[2].X();
3179 pos(0, 1) = one_sixt * geom[0].Y() + one_sixt * geom[1].Y() + two_third * geom[2].Y();
3180 pos(0, 2) = one_sixt * geom[0].Z() + one_sixt * geom[1].Z() + two_third * geom[2].Z();
3183 pos(1, 0) = two_third * geom[0].X() + one_sixt * geom[1].X() + one_sixt * geom[2].X();
3184 pos(1, 1) = two_third * geom[0].Y() + one_sixt * geom[1].Y() + one_sixt * geom[2].Y();
3185 pos(1, 2) = two_third * geom[0].Z() + one_sixt * geom[1].Z() + one_sixt * geom[2].Z();
3188 pos(2, 0) = one_sixt * geom[0].X() + two_third * geom[1].X() + one_sixt * geom[2].X();
3189 pos(2, 1) = one_sixt * geom[0].Y() + two_third * geom[1].Y() + one_sixt * geom[2].Y();
3190 pos(2, 2) = one_sixt * geom[0].Z() + two_third * geom[1].Z() + one_sixt * geom[2].Z();
3193 pos(3, 0) = one_third * geom[0].X() + one_third * geom[1].X() + one_third * geom[2].X();
3194 pos(3, 1) = one_third * geom[0].Y() + one_third * geom[1].Y() + one_third * geom[2].Y();
3195 pos(3, 2) = one_third * geom[0].Z() + one_third * geom[1].Z() + one_third * geom[2].Z();
3200 void ComputeGaussPointPositionsForPostReseed(Geometry< Node >& geom, BoundedMatrix<double, 7, 3 > & pos,BoundedMatrix<double, 7, 3 > &
N)
3202 double one_third = 1.0 / 3.0;
3203 double one_eight = 0.12;
3204 double three_quarters = 0.76;
3206 N(0, 0) = one_eight;
3207 N(0, 1) = one_eight;
3208 N(0, 2) = three_quarters;
3210 N(1, 0) = three_quarters;
3211 N(1, 1) = one_eight;
3212 N(1, 2) = one_eight;
3214 N(2, 0) = one_eight;
3215 N(2, 1) = three_quarters;
3216 N(2, 2) = one_eight;
3218 N(3, 0) = one_third;
3219 N(3, 1) = one_third;
3220 N(3, 2) = one_third;
3222 N(4, 0) = one_eight;
3227 N(5, 1) = one_eight;
3232 N(6, 2) = one_eight;
3236 pos(0, 0) = one_eight * geom[0].X() + one_eight * geom[1].X() + three_quarters * geom[2].X();
3237 pos(0, 1) = one_eight * geom[0].Y() + one_eight * geom[1].Y() + three_quarters * geom[2].Y();
3238 pos(0, 2) = one_eight * geom[0].Z() + one_eight * geom[1].Z() + three_quarters * geom[2].Z();
3241 pos(1, 0) = three_quarters * geom[0].X() + one_eight * geom[1].X() + one_eight * geom[2].X();
3242 pos(1, 1) = three_quarters * geom[0].Y() + one_eight * geom[1].Y() + one_eight * geom[2].Y();
3243 pos(1, 2) = three_quarters * geom[0].Z() + one_eight * geom[1].Z() + one_eight * geom[2].Z();
3246 pos(2, 0) = one_eight * geom[0].X() + three_quarters * geom[1].X() + one_eight * geom[2].X();
3247 pos(2, 1) = one_eight * geom[0].Y() + three_quarters * geom[1].Y() + one_eight * geom[2].Y();
3248 pos(2, 2) = one_eight * geom[0].Z() + three_quarters * geom[1].Z() + one_eight * geom[2].Z();
3251 pos(3, 0) = one_third * geom[0].X() + one_third * geom[1].X() + one_third * geom[2].X();
3252 pos(3, 1) = one_third * geom[0].Y() + one_third * geom[1].Y() + one_third * geom[2].Y();
3253 pos(3, 2) = one_third * geom[0].Z() + one_third * geom[1].Z() + one_third * geom[2].Z();
3256 pos(4, 0) = one_eight * geom[0].X() + 0.44 * geom[1].X() + 0.44 * geom[2].X();
3257 pos(4, 1) = one_eight * geom[0].Y() + 0.44 * geom[1].Y() + 0.44 * geom[2].Y();
3258 pos(4, 2) = one_eight * geom[0].Z() + 0.44 * geom[1].Z() + 0.44 * geom[2].Z();
3261 pos(5, 0) = 0.44 * geom[0].X() + one_eight * geom[1].X() + 0.44 * geom[2].X();
3262 pos(5, 1) = 0.44 * geom[0].Y() + one_eight * geom[1].Y() + 0.44 * geom[2].Y();
3263 pos(5, 2) = 0.44 * geom[0].Z() + one_eight * geom[1].Z() + 0.44 * geom[2].Z();
3266 pos(6, 0) = 0.44 * geom[0].X() + 0.44 * geom[1].X() + one_eight * geom[2].X();
3267 pos(6, 1) = 0.44 * geom[0].Y() + 0.44 * geom[1].Y() + one_eight * geom[2].Y();
3268 pos(6, 2) = 0.44 * geom[0].Z() + 0.44 * geom[1].Z() + one_eight * geom[2].Z();
3275 void ComputeGaussPointPositionsForPostReseed(Geometry< Node >& geom, BoundedMatrix<double, 9, 3 > & pos,BoundedMatrix<double, 9, 4 > &
N)
3277 double one_quarter = 0.25;
3278 double small_fraction = 0.1;
3279 double big_fraction = 0.7;
3280 double mid_fraction = 0.3;
3282 N(0, 0) = big_fraction;
3283 N(0, 1) = small_fraction;
3284 N(0, 2) = small_fraction;
3285 N(0, 3) = small_fraction;
3287 N(1, 0) = small_fraction;
3288 N(1, 1) = big_fraction;
3289 N(1, 2) = small_fraction;
3290 N(1, 3) = small_fraction;
3292 N(2, 0) = small_fraction;
3293 N(2, 1) = small_fraction;
3294 N(2, 2) = big_fraction;
3295 N(2, 3) = small_fraction;
3297 N(3, 0) = small_fraction;
3298 N(3, 1) = small_fraction;
3299 N(3, 2) = small_fraction;
3300 N(3, 3) = big_fraction;
3302 N(4, 0) = one_quarter;
3303 N(4, 1) = one_quarter;
3304 N(4, 2) = one_quarter;
3305 N(4, 3) = one_quarter;
3307 N(5, 0) = small_fraction;
3308 N(5, 1) = mid_fraction;
3309 N(5, 2) = mid_fraction;
3310 N(5, 3) = mid_fraction;
3312 N(6, 0) = mid_fraction;
3313 N(6, 1) = small_fraction;
3314 N(6, 2) = mid_fraction;
3315 N(6, 3) = mid_fraction;
3317 N(7, 0) = mid_fraction;
3318 N(7, 1) = mid_fraction;
3319 N(7, 2) = small_fraction;
3320 N(7, 3) = mid_fraction;
3322 N(8, 0) = mid_fraction;
3323 N(8, 1) = mid_fraction;
3324 N(8, 2) = mid_fraction;
3325 N(8, 3) = small_fraction;
3328 for (
unsigned int i=0;
i!=4;
i++)
3330 array_1d<double, 3 > & coordinates = geom[
i].Coordinates();
3331 for (
unsigned int j=0;
j!=9;
j++)
3333 for (
unsigned int k=0;
k!=3;
k++)
3334 pos(
j,
k) +=
N(
j,
i) * coordinates[
k];
3343 void ComputeGaussPointPositionsForPreReseed(Geometry< Node >& geom, BoundedMatrix<double, 3, 3 > & pos,BoundedMatrix<double, 3, 3 > &
N)
3359 pos(0, 0) = 0.5 * geom[0].X() + 0.25 * geom[1].X() + 0.25 * geom[2].X();
3360 pos(0, 1) = 0.5 * geom[0].Y() + 0.25 * geom[1].Y() + 0.25 * geom[2].Y();
3361 pos(0, 2) = 0.5 * geom[0].Z() + 0.25 * geom[1].Z() + 0.25 * geom[2].Z();
3364 pos(1, 0) = 0.25 * geom[0].X() + 0.5 * geom[1].X() + 0.25 * geom[2].X();
3365 pos(1, 1) = 0.25 * geom[0].Y() + 0.5 * geom[1].Y() + 0.25 * geom[2].Y();
3366 pos(1, 2) = 0.25 * geom[0].Z() + 0.5 * geom[1].Z() + 0.25 * geom[2].Z();
3369 pos(2, 0) = 0.25 * geom[0].X() + 0.25 * geom[1].X() + 0.5 * geom[2].X();
3370 pos(2, 1) = 0.25 * geom[0].Y() + 0.25 * geom[1].Y() + 0.5 * geom[2].Y();
3371 pos(2, 2) = 0.25 * geom[0].Z() + 0.25 * geom[1].Z() + 0.5 * geom[2].Z();
3375 void ComputeGaussPointPositionsForPreReseed(Geometry< Node >& geom, BoundedMatrix<double, 4, 3 > & pos,BoundedMatrix<double, 4, 4 > &
N)
3401 for (
unsigned int i=0;
i!=4;
i++)
3403 array_1d<double, 3 > & coordinates = geom[
i].Coordinates();
3404 for (
unsigned int j=0;
j!=4;
j++)
3406 for (
unsigned int k=0;
k!=3;
k++)
3407 pos(
j,
k) +=
N(
j,
i) * coordinates[
k];
3415 void ComputeGaussPointPositions_45(Geometry< Node >& geom, BoundedMatrix<double, 45, 3 > & pos,BoundedMatrix<double, 45, 3 > &
N)
3419 for (
unsigned int i=0;
i!=9;
i++)
3421 for (
unsigned int j=0;
j!=(9-
i);
j++)
3437 void ComputeGaussPointPositions_initial(Geometry< Node >& geom, BoundedMatrix<double, 15, 3 > & pos,BoundedMatrix<double, 15, 3 > &
N)
3441 for (
unsigned int i=0;
i!=5;
i++)
3443 for (
unsigned int j=0;
j!=(5-
i);
j++)
3459 void ComputeGaussPointPositions_initial(Geometry< Node >& geom, BoundedMatrix<double, 20, 3 > & pos,BoundedMatrix<double, 20, 4 > &
N)
3463 double fraction_increment;
3465 for (
unsigned int i=0;
i!=4;
i++)
3468 for (
unsigned int j=0;
j!=(4-
i);
j++)
3471 for (
unsigned int k=0;
k!=(4-
i-
j);
k++)
3477 fraction_increment = 0.27;
3496 void BubbleSort(array_1d<double,7> &distances , array_1d<int,7 > &positions,
unsigned int & arrange_number)
3502 int numLength = arrange_number;
3503 for(
i = 1; (
i <= numLength) && flag;
i++)
3506 for (
j=0;
j < (numLength -1);
j++)
3508 if (distances[
j+1] < distances[
j])
3510 temp = distances[
j];
3511 distances[
j] = distances[
j+1];
3512 distances[
j+1] =
temp;
3514 temp_position = positions[
j];
3515 positions[
j] = positions[
j+1];
3516 positions[
j+1] = temp_position;
3527 void BubbleSort(array_1d<double,9> &distances , array_1d<int,9 > &positions,
unsigned int & arrange_number)
3533 int numLength = arrange_number;
3534 for(
i = 1; (
i <= numLength) && flag;
i++)
3537 for (
j=0;
j < (numLength -1);
j++)
3539 if (distances[
j+1] < distances[
j])
3541 temp = distances[
j];
3542 distances[
j] = distances[
j+1];
3543 distances[
j+1] =
temp;
3545 temp_position = positions[
j];
3546 positions[
j] = positions[
j+1];
3547 positions[
j+1] = temp_position;
3557 bool InvertMatrix(
const T&
input, T& inverse)
3559 typedef permutation_matrix<std::size_t> pmatrix;
3565 pmatrix pm(
A.size1());
3568 int res = lu_factorize(
A, pm);
3573 inverse.assign(identity_matrix<double> (
A.size1()));
3576 lu_substitute(
A, pm, inverse);
3581 bool InvertMatrix3x3(
const BoundedMatrix<double, TDim+1 , TDim+1 >&
A, BoundedMatrix<double, TDim+1 , TDim+1 >& result)
3583 double determinant = +
A(0,0)*(
A(1,1)*
A(2,2)-
A(2,1)*
A(1,2))
3584 -
A(0,1)*(
A(1,0)*
A(2,2)-
A(1,2)*
A(2,0))
3585 +
A(0,2)*(
A(1,0)*
A(2,1)-
A(1,1)*
A(2,0));
3586 double invdet = 1/determinant;
3587 result(0,0) = (
A(1,1)*
A(2,2)-
A(2,1)*
A(1,2))*invdet;
3588 result(1,0) = -(
A(0,1)*
A(2,2)-
A(0,2)*
A(2,1))*invdet;
3589 result(2,0) = (
A(0,1)*
A(1,2)-
A(0,2)*
A(1,1))*invdet;
3590 result(0,1) = -(
A(1,0)*
A(2,2)-
A(1,2)*
A(2,0))*invdet;
3591 result(1,1) = (
A(0,0)*
A(2,2)-
A(0,2)*
A(2,0))*invdet;
3592 result(2,1) = -(
A(0,0)*
A(1,2)-
A(1,0)*
A(0,2))*invdet;
3593 result(0,2) = (
A(1,0)*
A(2,1)-
A(2,0)*
A(1,1))*invdet;
3594 result(1,2) = -(
A(0,0)*
A(2,1)-
A(2,0)*
A(0,1))*invdet;
3595 result(2,2) = (
A(0,0)*
A(1,1)-
A(1,0)*
A(0,1))*invdet;
3602 ModelPart* mtopographic_model_part_pointer;
3603 array_1d<double, 3 > mcalculation_domain_complete_displacement;
3604 array_1d<double, 3 > mcalculation_domain_added_displacement;
3605 bool mintialized_transfer_tool;
3606 bool muse_mesh_velocity_to_convect;
3609 double mDENSITY_WATER;
3610 double mDENSITY_AIR;
3614 double max_substep_dt;
3615 int mmaximum_number_of_particles;
3616 std::vector< PFEM_Particle_Fluid > mparticles_vector;
3619 bool mparticle_printing_tool_initialized;
3620 unsigned int mfilter_factor;
3621 unsigned int mlast_node_id;
3624 vector<int> mnumber_of_particles_in_elems;
3625 vector<int> mnumber_of_particles_in_elems_aux;
3626 vector<ParticlePointerVector*> mpointers_to_particle_pointers_vectors;
3628 typename BinsObjectDynamic<Configure>::Pointer mpBinsObjectDynamic;
3629 typename BinsObjectDynamic<Configure>::Pointer mpTopographicBinsObjectDynamic;
3632 void CalculateNormal(Geometry<Node >& pGeometry, array_1d<double,3>& An );
3637 void MoveParticleUtilityPFEM2<2>::CalculateNormal(Geometry<Node >& pGeometry, array_1d<double,3>& An )
3639 array_1d<double,2> v1;
3640 v1[0] = pGeometry[1].X() - pGeometry[0].X();
3641 v1[1] = pGeometry[1].Y() - pGeometry[0].Y();
3648 const unsigned int NumNodes = 2;
3649 array_1d<double,3> nodal_normal =
ZeroVector(3);
3650 for (
unsigned int iNode = 0; iNode < NumNodes; ++iNode)
3651 nodal_normal += pGeometry[iNode].FastGetSolutionStepValue(NORMAL);
3653 double dot_prod = nodal_normal[0]*An[0] + nodal_normal[1]*An[1];
3663 void MoveParticleUtilityPFEM2<3>::CalculateNormal(Geometry<Node >& pGeometry, array_1d<double,3>& An )
3665 array_1d<double,3> v1,v2;
3666 v1[0] = pGeometry[1].X() - pGeometry[0].X();
3667 v1[1] = pGeometry[1].Y() - pGeometry[0].Y();
3668 v1[2] = pGeometry[1].Z() - pGeometry[0].Z();
3670 v2[0] = pGeometry[2].X() - pGeometry[0].X();
3671 v2[1] = pGeometry[2].Y() - pGeometry[0].Y();
3672 v2[2] = pGeometry[2].Z() - pGeometry[0].Z();
3678 const unsigned int NumNodes = 3;
3679 array_1d<double,3> nodal_normal =
ZeroVector(3);
3680 for (
unsigned int iNode = 0; iNode < NumNodes; ++iNode)
3681 nodal_normal += pGeometry[iNode].FastGetSolutionStepValue(NORMAL);
3683 double dot_prod = nodal_normal[0]*An[0] + nodal_normal[1]*An[1] + nodal_normal[2]*An[2];
Short class definition.
Definition: bins_dynamic_objects.h:57
Geometry base class.
Definition: geometry.h:71
TVariableType::Type & GetValue(const TVariableType &rThisVariable)
Definition: geometry.h:627
virtual double Area() const
This method calculate and return area or surface area of this geometry depending to it's dimension.
Definition: geometry.h:1345
This class is a vector which stores global pointers.
Definition: global_pointers_vector.h:61
boost::indirect_iterator< typename TContainerType::iterator > iterator
Definition: global_pointers_vector.h:79
iterator begin()
Definition: global_pointers_vector.h:221
size_type size() const
Definition: global_pointers_vector.h:307
void resize(size_type new_dim) const
Definition: global_pointers_vector.h:366
iterator end()
Definition: global_pointers_vector.h:229
Definition: amatrix_interface.h:41
static T CrossProduct(const T &a, const T &b)
Performs the vector product of the two input vectors a,b.
Definition: math_utils.h:762
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
ConditionIterator ConditionsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1361
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
ElementIterator ElementsEnd(IndexType ThisIndex=0)
Definition: model_part.h:1179
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
ElementsContainerType::ContainerType & ElementsArray(IndexType ThisIndex=0)
Definition: model_part.h:1209
Definition: move_particle_utility_pfem2.h:112
void AccelerateParticlesWithoutMovingUsingDeltaVelocity()
Definition: move_particle_utility_pfem2.h:1469
void ResetBoundaryConditionsSlip()
Definition: move_particle_utility_pfem2.h:755
void MountBin()
Definition: move_particle_utility_pfem2.h:361
void PreReseedUsingTopographicDomain(const int minimum_number_of_particles, array_1d< double, 3 > domains_added_displacement)
Definition: move_particle_utility_pfem2.h:472
void AssignNodalVelocityUsingInletConditions(const double inlet_vel)
Definition: move_particle_utility_pfem2.h:2106
void TransferLagrangianToEulerian()
Definition: move_particle_utility_pfem2.h:1067
void CopyVectorVarToPreviousTimeStep(const Variable< array_1d< double, 3 > > &OriginVariable, ModelPart::NodesContainerType &rNodes)
Definition: move_particle_utility_pfem2.h:832
void CalculateDeltaVelocity()
Definition: move_particle_utility_pfem2.h:807
Configure::ContainerType ContainerType
Definition: move_particle_utility_pfem2.h:118
~MoveParticleUtilityPFEM2()
Definition: move_particle_utility_pfem2.h:358
SpatialContainersConfigure< TDim > Configure
Definition: move_particle_utility_pfem2.h:115
void IntializeTransferTool(ModelPart *topographic_model_part, array_1d< double, 3 > initial_domains_offset, bool ovewrite_particle_data)
Definition: move_particle_utility_pfem2.h:383
void ResetBoundaryConditions(bool fully_reset_nodes)
Definition: move_particle_utility_pfem2.h:656
void ExecuteParticlesPritingToolForDroppletsOnly(ModelPart &lagrangian_model_part, int input_filter_factor)
Definition: move_particle_utility_pfem2.h:2008
void TransferLagrangianToEulerianImp()
Definition: move_particle_utility_pfem2.h:1251
KRATOS_CLASS_POINTER_DEFINITION(MoveParticleUtilityPFEM2)
Configure::PointType PointType
Definition: move_particle_utility_pfem2.h:116
Configure::IteratorType IteratorType
Definition: move_particle_utility_pfem2.h:120
void ExecuteParticlesPritingTool(ModelPart &lagrangian_model_part, int input_filter_factor)
Definition: move_particle_utility_pfem2.h:1948
PointerVector< PFEM_Particle_Fluid, PFEM_Particle_Fluid *, std::vector< PFEM_Particle_Fluid * > > ParticlePointerVector
Definition: move_particle_utility_pfem2.h:124
void PostReseed(int minimum_number_of_particles, double mass_correction_factor)
Definition: move_particle_utility_pfem2.h:1664
void CopyScalarVarToPreviousTimeStep(const Variable< double > &OriginVariable, ModelPart::NodesContainerType &rNodes)
Definition: move_particle_utility_pfem2.h:857
void RotateParticlesAndDomainVelocities(array_1d< double, 3 > rotations)
Definition: move_particle_utility_pfem2.h:2148
void CalculateVelOverElemSize()
Definition: move_particle_utility_pfem2.h:591
Configure::ResultContainerType ResultContainerType
Definition: move_particle_utility_pfem2.h:121
void PreReseed(int minimum_number_of_particles)
Definition: move_particle_utility_pfem2.h:1548
MoveParticleUtilityPFEM2(ModelPart &model_part, int maximum_number_of_particles)
Definition: move_particle_utility_pfem2.h:134
void MoveParticles(const bool discriminate_streamlines)
Definition: move_particle_utility_pfem2.h:884
Configure::ResultIteratorType ResultIteratorType
Definition: move_particle_utility_pfem2.h:123
void AddUniqueWeakPointer(GlobalPointersVector< TDataType > &v, const typename TDataType::WeakPointer candidate)
Definition: move_particle_utility_pfem2.h:1530
static int ThisThread()
Wrapper for omp_get_thread_num().
Definition: openmp_utils.h:108
PFEM Particle class.
Definition: pfem_particle_fluidonly.h:103
bool & GetEraseFlag()
Definition: pfem_particle_fluidonly.h:191
array_1d< float, 3 > & GetVelocity()
Definition: pfem_particle_fluidonly.h:151
float & GetDistance()
Definition: pfem_particle_fluidonly.h:161
Point class.
Definition: point.h:59
CoordinatesArrayType const & Coordinates() const
Definition: point.h:215
double Y() const
Definition: point.h:187
double Z() const
Definition: point.h:193
double X() const
Definition: point.h:181
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
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_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_WATCH(variable)
Definition: define.h:806
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_INFO(label)
Definition: logger.h:250
Kratos::ModelPart ModelPart
Definition: kratos_wrapper.h:31
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
REACTION_CHECK_STIFFNESS_FACTOR INNER_LOOP_ITERATION DISTANCE_THRESHOLD ACTIVE_CHECK_FACTOR AUXILIAR_COORDINATES NORMAL_GAP WEIGHTED_GAP WEIGHTED_SCALAR_RESIDUAL bool
Definition: contact_structural_mechanics_application_variables.h:93
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
std::size_t SizeType
The definition of the size type.
Definition: mortar_classes.h:43
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
REACTION_CHECK_STIFFNESS_FACTOR int
Definition: contact_structural_mechanics_application_variables.h:75
TABLE_NUMBER_ANGULAR_VELOCITY TABLE_NUMBER_MOMENT I33 BEAM_INERTIA_ROT_UNIT_LENGHT_Y KRATOS_DEFINE_APPLICATION_VARIABLE(DEM_APPLICATION, double, BEAM_INERTIA_ROT_UNIT_LENGHT_Z) typedef std double
Definition: DEM_application_variables.h:182
float velocity
Definition: PecletTest.py:54
ProcessInfo
Definition: edgebased_PureConvection.py:116
float dist
Definition: edgebased_PureConvection.py:89
model_part
Definition: face_heat.py:14
res
Definition: generate_convection_diffusion_explicit_element.py:211
v
Definition: generate_convection_diffusion_explicit_element.py:114
input
Definition: generate_frictional_mortar_condition.py:435
x2
Definition: generate_frictional_mortar_condition.py:122
x1
Definition: generate_frictional_mortar_condition.py:121
threshold
Definition: isotropic_damage_automatic_differentiation.py:135
lagrangian_model_part
Definition: lagrangian_droplet_test.py:45
int d
Definition: ode_solve.py:397
vel
Definition: pure_conduction.py:76
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
int node_id
Definition: read_stl.py:12
float temp
Definition: rotating_cone.py:85
float xc
Definition: rotating_cone.py:77
float yc
Definition: rotating_cone.py:78
float delta_t
Definition: rotatingcone_PureConvectionBenchmarking.py:129
int counter
Definition: script_THERMAL_CORRECT.py:218
inlet_vel
Definition: script.py:181
A
Definition: sensitivityMatrix.py:70
N
Definition: sensitivityMatrix.py:29
integer i
Definition: TensorModule.f:17
integer l
Definition: TensorModule.f:17
e
Definition: run_cpp_mpi_tests.py:31
Configure::ResultIteratorType ResultIteratorType
Definition: transfer_utility.h:252