22#include <boost/archive/text_iarchive.hpp>
23#include <boost/archive/text_oarchive.hpp>
31template <
int dim,
typename PropertiesIndex>
39template <
int dim,
typename PropertiesIndex>
42template <
int dim,
typename PropertiesIndex>
51 .lagrangian_physical_properties;
69 dem_parameters.lagrangian_physical_properties.particle_type_number);
71 const auto parallel_triangulation =
72 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
78 *parallel_triangulation,
100 for (
unsigned int i = 0;
101 i <
dem_parameters.lagrangian_physical_properties.particle_type_number;
104 const double youngs_modulus =
106 .youngs_modulus_particle[i];
107 const double poisson_ratio =
108 dem_parameters.lagrangian_physical_properties.poisson_ratio_particle[i];
109 const double density =
110 dem_parameters.lagrangian_physical_properties.density_particle[i];
112 const double shear_modulus =
113 youngs_modulus / (2.0 * (1.0 + poisson_ratio));
115 const double min_diameter =
119 std::min(M_PI_2 * min_diameter * sqrt(density / shear_modulus) /
120 (0.1631 * poisson_ratio + 0.8766),
128 this->simulation_control->get_time_step(),
129 this->cfd_dem_simulation_parameters.cfd_dem.coupling_frequency,
131 this->cfd_dem_simulation_parameters.cfd_dem.fraction_of_rayleigh_time);
136 if (!
dem_parameters.boundary_conditions.periodic_boundaries.empty())
146 *parallel_triangulation,
160template <
int dim,
typename PropertiesIndex>
177template <
int dim,
typename PropertiesIndex>
178std::shared_ptr<Integrator<dim, PropertiesIndex>>
185 switch (integration_method)
188 return std::make_shared<
191 return std::make_shared<
194 throw(std::runtime_error(
"Invalid integration method."));
198template <
int dim,
typename PropertiesIndex>
202 this->
pcout <<
"Initializing DEM parameters" << std::endl;
204 const auto parallel_triangulation =
205 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
220 this->simulation_control->get_current_time());
227 std::min((GridTools::minimal_cell_diameter(*this->
triangulation) -
243 for (
const auto &pb_id :
256 *parallel_triangulation,
259 this->cfd_dem_simulation_parameters.cfd_parameters.mesh
260 .check_for_diamond_cells,
261 this->cfd_dem_simulation_parameters.cfd_parameters.mesh
262 .expand_particle_wall_contact_search,
275 this->
pcout <<
"Finished initializing DEM parameters" << std::endl
277 <<
" s" << std::endl;
280template <
int dim,
typename PropertiesIndex>
284 this->
pcout <<
"Reading DEM checkpoint" << std::endl;
290 std::string checkpoint_controller_object_filename =
291 prefix +
".checkpoint_controller";
293 "checkpoint file of the checkpoint controller, given by "
294 "'subsection void fraction' - 'set dem file name'");
295 std::ifstream iss_checkpoint_controller_obj(
296 checkpoint_controller_object_filename);
297 boost::archive::text_iarchive ia_checkpoint_controller_obj(
298 iss_checkpoint_controller_obj, boost::archive::no_header);
300 unsigned int checkpoint_id;
301 ia_checkpoint_controller_obj >> checkpoint_id;
304 prefix = prefix +
"_" + Utilities::int_to_string(checkpoint_id);
307 std::string particle_filename = prefix +
".particles";
309 "checkpoint file of the particles, given by "
310 "'subsection void fraction' - 'set dem file name'");
311 std::ifstream input(particle_filename.c_str());
314 std::getline(input, buffer);
315 std::istringstream iss(buffer);
316 boost::archive::text_iarchive ia(iss, boost::archive::no_header);
320 using DEMPropertiesIndex =
323 Particles::ParticleHandler<dim> temporary_particle_handler(
326 DEMPropertiesIndex::n_properties);
328 ia >> temporary_particle_handler;
330 const std::string filename = prefix +
".triangulation";
332 "checkpoint file of the triangulation, given by "
333 "'subsection void fraction' - 'set dem file name'");
335 if (
auto parallel_triangulation =
336 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
341 parallel_triangulation->load(filename.c_str());
344 temporary_particle_handler.deserialize();
349 ExcMessage(
"Cannot open snapshot mesh file or read the"
350 "triangulation stored there."));
357 *parallel_triangulation,
358 temporary_particle_handler,
363 throw std::runtime_error(
364 "VANS equations currently do not support triangulations other than parallel::distributed");
367 this->
pcout <<
"Finished reading DEM checkpoint" << std::endl
369 <<
" particles are in the simulation" << std::endl;
374template <
int dim,
typename PropertiesIndex>
375std::vector<OutputStructTableHandler>
378 std::vector<OutputStructTableHandler> table_output_structs;
384 std::string suffix =
".checkpoint";
386 table_output_structs.emplace_back(
389 return table_output_structs;
392template <
int dim,
typename PropertiesIndex>
401 std::string prefix_particles = prefix +
"_particles";
402 std::string prefix_grid = prefix +
"_lagrangian_postprocessing";
415 .lagrangian_post_processing_enabled)
422 std::ostringstream oss_particle_handler;
423 boost::archive::text_oarchive oa_particle_handler(
424 oss_particle_handler, boost::archive::no_header);
428 std::string particle_filename = prefix +
".particles";
429 std::ofstream output(particle_filename.c_str());
430 output << oss_particle_handler.str() << std::endl;
433 std::string insertion_object_filename = prefix +
".insertion_object";
434 std::ofstream oss_insertion_obj(insertion_object_filename);
435 boost::archive::text_oarchive oa_insertion_obj(oss_insertion_obj,
436 boost::archive::no_header);
440 std::vector<const GlobalVectorType *> sol_set_transfer;
449 std::vector<const GlobalVectorType *> av_set_transfer =
453 sol_set_transfer.insert(sol_set_transfer.end(),
454 av_set_transfer.begin(),
455 av_set_transfer.end());
459 SolutionTransfer<dim, GlobalVectorType> system_trans_vectors(
461 system_trans_vectors.prepare_for_serialization(sol_set_transfer);
464 std::vector<const GlobalVectorType *> vf_set_transfer;
465 vf_set_transfer.push_back(
467 for (
unsigned int i = 0;
471 vf_set_transfer.push_back(
478 SolutionTransfer<dim, GlobalVectorType> vf_system_trans_vectors(
480 vf_system_trans_vectors.prepare_for_serialization(vf_set_transfer);
482 if (
auto parallel_triangulation =
483 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
486 parallel_triangulation->save(prefix +
".triangulation");
490 const std::vector<OutputStructTableHandler> &table_output_structs_add =
495 const std::vector<OutputStructTableHandler> &table_output_structs =
500template <
int dim,
typename PropertiesIndex>
508 std::string prefix_particles = prefix +
"_particles";
509 std::string prefix_grid = prefix +
"_lagrangian_postprocessing";
515 if (this->
dem_parameters.post_processing.lagrangian_post_processing_enabled)
521 std::string particle_filename = prefix +
".particles";
523 "checkpoint file of the particles, given by "
524 "'subsection restart' - 'set filename'");
525 std::ifstream input(particle_filename.c_str());
528 std::getline(input, buffer);
529 std::istringstream iss(buffer);
530 boost::archive::text_iarchive ia(iss, boost::archive::no_header);
537 std::string insertion_object_filename = prefix +
".insertion_object";
538 if (std::filesystem::exists(insertion_object_filename))
540 std::ifstream iss_insertion_obj(insertion_object_filename);
541 boost::archive::text_iarchive ia_insertion_obj(iss_insertion_obj,
542 boost::archive::no_header);
546 const std::string filename = prefix +
".triangulation";
548 "checkpoint file of the triangulation, given by "
549 "'subsection restart' - 'set filename'");
553 if (
auto parallel_triangulation =
554 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
556 parallel_triangulation->load(filename.c_str());
561 ExcMessage(
"Cannot open snapshot mesh file or read the "
562 "triangulation stored there."));
577 std::vector<GlobalVectorType *> x_system(1 +
583 x_system[0] = &(distributed_system);
585 std::vector<GlobalVectorType> distributed_previous_solutions;
591 distributed_previous_solutions.emplace_back(
593 x_system[i + 1] = &distributed_previous_solutions[i];
596 SolutionTransfer<dim, GlobalVectorType> system_trans_vectors(
601 std::vector<GlobalVectorType *> sum_vectors =
604 x_system.insert(x_system.end(), sum_vectors.begin(), sum_vectors.end());
607 system_trans_vectors.deserialize(x_system);
618 std::vector<GlobalVectorType *> vf_system(
624 vf_system[0] = &(vf_distributed_system);
626 std::vector<GlobalVectorType> vf_distributed_previous_solutions;
628 vf_distributed_previous_solutions.reserve(
631 for (
unsigned int i = 0;
635 vf_distributed_previous_solutions.emplace_back(
637 this->mpi_communicator));
638 vf_system[i + 1] = &vf_distributed_previous_solutions[i];
641 SolutionTransfer<dim, GlobalVectorType> vf_system_trans_vectors(
644 vf_system_trans_vectors.deserialize(vf_system);
647 vf_distributed_system;
648 for (
unsigned int i = 0;
653 vf_distributed_previous_solutions[i];
664 this->particle_handler.deserialize();
668 std::vector<OutputStructTableHandler> table_output_structs_add =
674 std::vector<OutputStructTableHandler> table_output_structs =
679template <
int dim,
typename PropertiesIndex>
682 unsigned int counter)
716template <
int dim,
typename PropertiesIndex>
726 std::vector<const GlobalVectorType *> sol_set_transfer;
734 SolutionTransfer<dim, GlobalVectorType> system_trans_vectors(
736 system_trans_vectors.prepare_for_coarsening_and_refinement(sol_set_transfer);
747 std::vector<const GlobalVectorType *> vf_set_transfer;
748 vf_set_transfer.push_back(
750 for (
unsigned int i = 0;
754 vf_set_transfer.push_back(
759 SolutionTransfer<dim, GlobalVectorType> vf_system_trans_vectors(
761 vf_system_trans_vectors.prepare_for_coarsening_and_refinement(
767 this->
pcout <<
"-->Repartitioning triangulation" << std::endl;
769 const auto parallel_triangulation =
770 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
773 parallel_triangulation->repartition();
784 *parallel_triangulation,
787 this->cfd_dem_simulation_parameters.cfd_parameters.mesh
788 .check_for_diamond_cells,
789 this->cfd_dem_simulation_parameters.cfd_parameters.mesh
790 .expand_particle_wall_contact_search,
793 const auto average_minimum_maximum_cells =
794 Utilities::MPI::min_max_avg(parallel_triangulation->n_active_cells(),
795 this->mpi_communicator);
797 const auto average_minimum_maximum_particles = Utilities::MPI::min_max_avg(
798 this->
particle_handler.n_locally_owned_particles(), this->mpi_communicator);
800 this->
pcout <<
"Load balance finished" << std::endl;
802 <<
"Average, minimum and maximum number of particles on the processors are "
803 << average_minimum_maximum_particles.avg <<
" , "
804 << average_minimum_maximum_particles.min <<
" and "
805 << average_minimum_maximum_particles.max << std::endl;
807 <<
"Minimum and maximum number of cells owned by the processors are "
808 << average_minimum_maximum_cells.min <<
" and "
809 << average_minimum_maximum_cells.max << std::endl;
811 this->
pcout <<
"Setup DOFs" << std::endl;
828 std::vector<GlobalVectorType *> x_system(1 +
834 x_system[0] = &(distributed_system);
836 std::vector<GlobalVectorType> distributed_previous_solutions;
842 distributed_previous_solutions.emplace_back(
844 x_system[i + 1] = &distributed_previous_solutions[i];
847 system_trans_vectors.interpolate(x_system);
864 std::vector<GlobalVectorType *> vf_system(
870 vf_system[0] = &(vf_distributed_system);
872 std::vector<GlobalVectorType> vf_distributed_previous_solutions;
874 vf_distributed_previous_solutions.reserve(
877 for (
unsigned int i = 0;
881 vf_distributed_previous_solutions.emplace_back(
883 this->mpi_communicator));
884 vf_system[i + 1] = &vf_distributed_previous_solutions[i];
887 vf_system_trans_vectors.interpolate(vf_system);
890 vf_distributed_system;
891 for (
unsigned int i = 0;
896 vf_distributed_previous_solutions[i];
908template <
int dim,
typename PropertiesIndex>
913 particle != this->particle_handler.end();
916 auto particle_properties = particle->get_properties();
918 types::particle_index particle_id = particle->get_local_index();
920 force[particle_id][0] +=
921 particle_properties[PropertiesIndex::fem_force_two_way_coupling_x] +
922 particle_properties[PropertiesIndex::fem_force_one_way_coupling_x] +
923 particle_properties[PropertiesIndex::fem_drag_x];
924 force[particle_id][1] +=
925 particle_properties[PropertiesIndex::fem_force_two_way_coupling_y] +
926 particle_properties[PropertiesIndex::fem_force_one_way_coupling_y] +
927 particle_properties[PropertiesIndex::fem_drag_y];
928 force[particle_id][2] +=
929 particle_properties[PropertiesIndex::fem_force_two_way_coupling_z] +
930 particle_properties[PropertiesIndex::fem_force_one_way_coupling_z] +
931 particle_properties[PropertiesIndex::fem_drag_z];
935template <
int dim,
typename PropertiesIndex>
940 particle != this->particle_handler.end();
943 auto particle_properties = particle->get_properties();
945 types::particle_index particle_id = particle->get_local_index();
948 particle_properties[PropertiesIndex::fem_torque_x];
950 particle_properties[PropertiesIndex::fem_torque_y];
952 particle_properties[PropertiesIndex::fem_torque_z];
956template <
int dim,
typename PropertiesIndex>
965 const auto parallel_triangulation =
966 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
970 this->simulation_control->get_iteration_number() == 1)
973 *parallel_triangulation,
983template <
int dim,
typename PropertiesIndex>
1004 .calculate_particle_point_contact_force(
1009 if constexpr (dim == 3)
1012 .calculate_particle_line_contact_force(
1019template <
int dim,
typename PropertiesIndex>
1023 const std::string folder =
dem_parameters.simulation_control.output_folder;
1024 const std::string particles_solution_name =
1028 const unsigned int group_files =
1039 particles_solution_name,
1046template <
int dim,
typename PropertiesIndex>
1051 double number_of_list_built_since_last_log =
1054 std::max(number_of_list_built_since_last_log,
contact_list.max);
1056 std::min(number_of_list_built_since_last_log,
contact_list.min);
1086 TableHandler report;
1088 std::vector<std::string> column_names{
1089 "Variable",
"Min",
"Max",
"Average",
"Total"};
1091 for (
const std::string &column_name : column_names)
1092 report.declare_column(column_name);
1109 for (
unsigned int i = 1; i < column_names.size(); ++i)
1111 report.set_scientific(column_names[i],
true);
1112 report.set_precision(column_names[i],
1117 report.write_text(std::cout, dealii::TableHandler::org_mode_table);
1120 if (
dem_parameters.post_processing.lagrangian_post_processing_enabled &&
1121 this->simulation_control->is_output_iteration())
1123 const auto parallel_triangulation =
1124 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
1128 *parallel_triangulation,
1131 this->particle_handler,
1134 this->simulation_control->get_iteration_number(),
1135 this->mpi_communicator,
1140template <
int dim,
typename PropertiesIndex>
1145 this->
pcout <<
"Particle Summary" << std::endl;
1147 this->
pcout << std::setw(display_width) << std::left <<
"id, "
1148 << std::setw(display_width) << std::left <<
"x, "
1149 << std::setw(display_width) << std::left <<
"y, "
1150 << std::setw(display_width) << std::left <<
"z, "
1151 << std::setw(display_width) << std::left <<
"v_x, "
1152 << std::setw(display_width) << std::left <<
"v_y, "
1153 << std::setw(display_width) << std::left <<
"v_z";
1156 this->
pcout <<
", " << std::setw(display_width) << std::left <<
"T";
1158 this->
pcout << std::endl;
1165 std::map<int, Particles::ParticleIterator<dim>> global_particles;
1166 unsigned int current_id, current_id_max = 0;
1170 particle != this->particle_handler.end();
1173 current_id = particle->get_id();
1174 current_id_max = std::max(current_id, current_id_max);
1176 global_particles.insert({current_id, particle});
1180 unsigned int id_max =
1183 for (
unsigned int i = 0; i <= id_max; i++)
1185 for (
auto &iterator : global_particles)
1187 unsigned int id = iterator.first;
1190 auto particle = iterator.second;
1191 auto particle_properties = particle->get_properties();
1192 auto particle_location = particle->get_location();
1194 std::cout << std::setw(display_width) << std::left << id;
1195 for (
int d = 0; d < dim; ++d)
1196 std::cout << std::setw(display_width) << std::left
1197 << particle_location[d];
1198 std::cout << std::setw(display_width) << std::left
1199 << particle_properties[PropertiesIndex::v_x]
1200 << std::setw(display_width) << std::left
1201 << particle_properties[PropertiesIndex::v_y]
1202 << std::setw(display_width) << std::left
1203 << particle_properties[PropertiesIndex::v_z];
1206 std::cout << std::setw(display_width) << std::left
1207 << particle_properties[PropertiesIndex::T];
1209 std::cout << std::endl;
1217template <
int dim,
typename PropertiesIndex>
1228 if (!first_iteration)
1231 <<
"---------------------------------------------------------------"
1236template <
int dim,
typename PropertiesIndex>
1243 TimerOutput::Scope t(this->
computing_timer,
"total_volume_calculation");
1244 double total_volume_fluid, total_volume_particles;
1245 std::tie(total_volume_fluid, total_volume_particles) =
1248 *this->particle_projector.void_fraction_locally_relevant,
1249 *this->cell_quadrature,
1254 total_volume_fluid);
1256 total_volume_particles);
1260 this->
pcout <<
"Total volume of fluid: "
1262 .get_density_scale() *
1264 <<
" m^3" << std::endl;
1265 this->
pcout <<
"Total volume of particles: "
1267 .get_density_scale() *
1268 total_volume_particles
1269 <<
" m^3" << std::endl;
1274 this->simulation_parameters.post_processing.output_frequency ==
1276 this->this_mpi_process == 0)
1278 std::string filename =
1281 .phase_volumes_output_name +
1283 std::ofstream output(filename.c_str());
1292template <
int dim,
typename PropertiesIndex>
1297 this->simulation_parameters.simulation_control.method !=
1301 unsigned int flow_direction =
1306 *this->present_solution,
1307 *this->particle_projector.void_fraction_locally_relevant,
1309 *this->cell_quadrature,
1316 this->simulation_control->get_iteration_number());
1318 Tensor<1, 3> beta_particle;
1324 .particle_type_number == 1,
1325 ExcMessage(std::string(
1326 "Beta force calculation for particles is not implemented for multiple particle types.")));
1328 double fluid_density =
1330 .get_density_scale();
1331 double particle_density =
1332 dem_parameters.lagrangian_physical_properties.density_particle[0];
1342 this->simulation_control->get_iteration_number() > 0 &&
1343 this->this_mpi_process == 0)
1346 this->
pcout <<
"Fluid space-average velocity: " << average_velocity
1348 this->
pcout <<
"Fluid beta force: "
1351 this->
pcout <<
"Particle beta force: "
1352 << beta_particle[flow_direction] << std::endl;
1357template <
int dim,
typename PropertiesIndex>
1370 unsigned int number_of_particles =
1376 MOI.resize(number_of_particles);
1381 auto particle_properties = particle.get_properties();
1382 MOI[particle.get_local_index()] =
1383 0.1 * particle_properties[PropertiesIndex::mass] *
1384 particle_properties[PropertiesIndex::dp] *
1385 particle_properties[PropertiesIndex::dp];
1395template <
int dim,
typename PropertiesIndex>
1437 this->simulation_control->get_previous_time() +
1438 counter * dem_time_step);
1446 this->cfd_dem_simulation_parameters.cfd_dem.vortical_viscous_torque)
1472 const auto parallel_triangulation =
1473 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
1481 *parallel_triangulation,
1486 if (
dem_parameters.post_processing.particle_wall_collision_statistics)
1488 const double dem_current_time =
1503template <
int dim,
typename PropertiesIndex>
1545 this->cfd_dem_simulation_parameters.cfd_dem.vortical_viscous_torque)
1548 const auto parallel_triangulation =
1549 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
1557 *parallel_triangulation,
1563template <
int dim,
typename PropertiesIndex>
1583 this->
pcout <<
"DEM contact search at dem step " << counter << std::endl;
1597 this->particle_handler,
1598 (*this->triangulation).n_active_cells(),
1599 this->mpi_communicator);
1612 this->simulation_control->get_current_time(),
1633 this->simulation_control->get_current_time(),
1642template <
int dim,
typename PropertiesIndex>
1650 "To run a steady simulation of a fluid-particle mixture, the lethe-fluid-vans application should be used."));
1652 this->
computing_timer.enter_subsection(
"Read mesh, manifolds and particles");
1657 this->cfd_dem_simulation_parameters.cfd_parameters.manifolds_parameters,
1658 this->cfd_dem_simulation_parameters.cfd_parameters.restart_parameters
1660 this->cfd_dem_simulation_parameters.void_fraction->read_dem,
1661 this->cfd_dem_simulation_parameters.cfd_parameters.boundary_conditions
1662 .periodic_boundaries);
1668 !this->cfd_dem_simulation_parameters.cfd_parameters.restart_parameters
1672 this->
computing_timer.leave_subsection(
"Read mesh, manifolds and particles");
1678 this->cfd_dem_simulation_parameters.cfd_parameters.restart_parameters
1689 "qcm_quadrature_points",
1690 this->cfd_dem_simulation_parameters.cfd_parameters.simulation_control
1694 if (this->
multiphysics->get_active_physics().size() > 1)
1759 "Calculate particle-fluid projection");
1767 *this->present_solution,
1768 *this->previous_solutions,
1769 this->cfd_dem_simulation_parameters.dem_parameters
1770 .lagrangian_physical_properties.g,
1772 this->simulation_control,
1773 this->simulation_parameters.physical_properties_manager,
1775 *this->cell_quadrature,
1777 *this->face_quadrature));
1798 Vector<float> mobility_status(
1807 this->mpi_communicator,
1827 cfd_dem_prm.dem_iteration_control,
1828 this->simulation_control->get_time_step(),
1829 cfd_dem_prm.coupling_frequency,
1831 cfd_dem_prm.fraction_of_rayleigh_time);
1858 <<
" DEM iterations" << std::endl;
1868 ->FluidDynamicsVANS<dim, PropertiesIndex>::monitor_mass_conservation();
1875 if (
dem_parameters.post_processing.particle_wall_collision_statistics)
Solver class for coupled Computational Fluid Dynamics and Discrete Element Method (CFD-DEM) simulatio...
double maximum_particle_diameter
Maximum diameter among all particles in the simulation.
void add_fluid_particle_interaction_force()
Calculate and add fluid-particle interaction forces.
ParticleInteractionOutcomes< PropertiesIndex > contact_outcome
Container for particle interaction outcomes (forces and torques).
DEM::dem_data_structures< dim >::periodic_boundaries_cells_info periodic_boundaries_cells_information
Information about cells involved in periodic boundary conditions.
void dem_contact_build()
Perform contact detection and build contact lists.
std::vector< OutputStructTableHandler > gather_tables() override
Gather TableHandler objects for serialization during checkpointing.
std::vector< std::shared_ptr< Distribution > > size_distribution_object_container
Container for particle size distribution objects.
void add_fluid_particle_interaction_torque()
Calculate and add fluid-particle interaction torques.
virtual void solve() override
Engine of the CFD-DEM solver. Calls all the necessary functions to set parameters,...
void report_rayleigh_time_ratio()
Reports the ratio between the DEM time step and the Rayleigh time.
double rayleigh_time_step
Rayleigh time step.
DEM::ParticleProperties< dim, PropertiesIndex > properties_class
Particle properties handler for DEM simulation.
AdaptiveSparseContacts< dim, PropertiesIndex > sparse_contacts_object
Object for handling adaptive sparse contact detection algorithms.
unsigned int contact_search_total_number
Total number of contact searches since simulation start.
std::shared_ptr< Integrator< dim, PropertiesIndex > > integrator_object
Time integration scheme for particle motion equations.
void print_particles_summary()
Print final summary of particle simulation results.
dem_data_structures< dim >::solid_surfaces_mesh_information solid_surfaces_mesh_info
Mesh information for solid surfaces in contact with particles.
std::shared_ptr< ParticleWallContactForceBase< dim, PropertiesIndex > > particle_wall_contact_force_object
Contact force model for particle-wall interactions.
TableHandler table_phase_volumes
void postprocess_fd(bool first_iteration) override
Perform fluid dynamics post-processing after each iteration.
DEMSolverParameters< dim > dem_parameters
DEM simulation parameters container.
void read_checkpoint() override
Read CFD-DEM simulation checkpoint files.
std::shared_ptr< Integrator< dim, PropertiesIndex > > set_integrator_type()
Set up the time integration method for particle motion.
void report_particle_statistics()
Calculate and report particle statistics to the terminal.
const unsigned int n_mpi_processes
Total number of MPI processes.
std::vector< Tensor< 1, 3 > > & force
Reference to force vector from contact outcomes.
void check_contact_detection_method(unsigned int counter)
Check if contact detection is required and execute it if necessary.
void set_initial_condition(const Parameters::FluidDynamicsInitialConditionType initial_condition_type, const bool restart=false) override
Set the initial condition. The version in this class does not output the solution,...
unsigned int contact_search_counter
Counter for contact searches performed in the current CFD iteration.
CompletedCollisionLog< dim > collision_event_log
Object to store completed collision events.
const unsigned int this_mpi_process
Current MPI process identifier.
BoundaryCellsInformation< dim > boundary_cell_object
Information about boundary cells for contact detection.
std::vector< Tensor< 1, 3 > > & torque
Reference to torque vector from contact outcomes.
void dynamic_flow_control() override
Calculate dynamic flow control accounting for void fraction.
void particle_wall_contact_force()
Calculate contact forces between particles and walls.
PVDHandler grid_pvdhandler
PVD handler for grid visualization output.
std::shared_ptr< ParticleParticleContactForceBase< dim, PropertiesIndex > > particle_particle_contact_force_object
Contact force model for particle-particle interactions.
Tensor< 1, 3 > g
Gravitational acceleration vector.
void setup_distribution_type()
Initialize the particle size distribution and related parameters.
statistics contact_list
Statistics container for timing and contact list information.
void sort_particles_into_subdomains_and_cells()
Sort particles into subdomains and cells for efficient processing.
void synchronize_particle_velocities()
Carry out the closing half velocity step of a staggered integration scheme at the end of the DEM sub-...
void dem_setup_parameters()
Set up the various parameters related to the DEM simulation.
LagrangianLoadBalancing< dim, PropertiesIndex > load_balancing
Load balancing handler for distributing particles across MPI processes.
~CFDDEMSolver() override
Destructor for the CFD-DEM solver.
PeriodicBoundariesManipulator< dim > periodic_boundaries_object
Handler for periodic boundary condition manipulations.
DEMActionManager * dem_action_manager
Pointer to DEM action manager for handling DEM-specific operations.
void dem_iterator()
Execute a complete DEM iteration step.
std::shared_ptr< SubSimulationControlDEM > dem_simulation_control
void read_dem() override
Read DEM restart files from a previous simulation.
double neighborhood_threshold_squared
Squared threshold distance for neighborhood particle detection.
DEMContactManager< dim, PropertiesIndex > contact_manager
void initialize_dem_parameters()
Initialize fundamental DEM simulation parameters.
std::vector< double > displacement
Displacement vector for particle motion calculations.
OngoingCollisionLog< dim > ongoing_collision_log
Object to store ongoing collision information.
double smallest_contact_search_criterion
Smallest criterion used for contact search algorithms.
void postprocess_cfd_dem()
Perform CFD-DEM coupled post-processing after each iteration.
PVDHandler particles_pvdhandler
PVD handler for particle visualization output.
Visualization< dim, PropertiesIndex > visualization_object
Visualization handler for DEM output generation.
void write_dem_output_results()
Write DEM simulation results to output files.
void write_checkpoint() override
Write CFD-DEM simulation checkpoint files.
ParticlePointLineForce< dim, PropertiesIndex > particle_point_line_contact_force_object
Handler for point and line contact forces between particles.
CFDDEMSolver(CFDDEMSimulationParameters< dim > &nsparam)
Constructor for the CFD-DEM solver.
std::shared_ptr< Insertion< dim, PropertiesIndex > > insertion_object
Particle insertion method handler.
void insert_particles()
Check if particles need to be inserted and perform insertion.
void load_balance()
Check if load balancing is required and perform it if necessary.
std::vector< double > MOI
Moment of inertia values for all particles.
static DEMActionManager * get_action_manager()
Getter of the unique instance of the DEMActionManager.
Implementation of a classical explicit euler scheme for the integration of the particle motion....
virtual void update_multiphysics_time_average_solution() override
Updates the average velocity field solution in the multiphyscics interface.
CFDDEMSimulationParameters< dim > cfd_dem_simulation_parameters
Member Variables.
void vertices_cell_mapping()
Create mapping between vertices and cells.
ParticleProjector< dim, PropertiesIndex > particle_projector
Particle projector for calculating void fraction and particle effects.
virtual void finish_time_step_fd()
Complete operations at the end of a time step.
virtual void iterate() override
Execute a single VANS iteration.
FluidDynamicsVANS(CFDDEMSimulationParameters< dim > &nsparam)
Constructor for the VANS solver.
virtual void setup_dofs() override
Set up degrees of freedom and initialize void fraction field.
MappingQGeneric< dim > particle_mapping
Mapping object for particle position calculations and projections.
Particles::ParticleHandler< dim, dim > particle_handler
Particle handler for managing particle data and operations.
void calculate_void_fraction(const double time)
Calculate void fraction field based on particle positions.
void write_output_results(const GlobalVectorType &solution)
MPI_Comm mpi_communicator
virtual std::vector< OutputStructTableHandler > gather_tables()
Returns a vector of references to TableHandler objects that needs to be serialized/ deserialized for ...
IndexSet locally_owned_dofs
std::shared_ptr< GlobalVectorType > present_solution
virtual void refine_mesh()
Allow the refinement of the mesh according to one of the 2 methods proposed.
SimulationParameters< dim > simulation_parameters
bool average_velocities_are_enabled() const
void restore_average_velocities_after_checkpoint()
virtual void postprocess_fd(bool first_iteration)
TimerOutput computing_timer
std::shared_ptr< std::vector< GlobalVectorType > > previous_solutions
std::shared_ptr< SimulationControl > simulation_control
void update_boundary_conditions()
FlowControl< dim > flow_control
std::shared_ptr< MultiphysicsInterface< dim > > multiphysics
std::shared_ptr< AverageVelocities< dim, GlobalVectorType, IndexSet > > average_velocities
std::shared_ptr< DoFHandler< dim > > dof_handler
std::shared_ptr< parallel::DistributedTriangulationBase< dim > > triangulation
virtual void postprocess(bool first_iteration)
Class that stores the information required by the assembly procedure for a Navier-Stokes equation....
Numerical model parameters for DEM simulations.
enum Parameters::Lagrangian::ModelParameters::ContactDetectionMethod contact_detection_method
IntegrationMethod
Time integration method for particle motion.
unsigned int contact_detection_frequency
Frequency of particle-particle and particle-wall contact detection.
Postprocessing - Defines the parameters for the post-processing. In Lethe, post-processing implies th...
bool calculate_phase_volumes
std::string phase_volumes_output_name
prefix for the total volume output in cfd-dem simulation
Implementation of a classical velocity verlet scheme for the integration of the particle motion....
Building patches of particle properties for visualization. This function is taken from Aspect and dea...
void build_patches(Particles::ParticleHandler< dim > &particle_handler, const std::vector< std::pair< std::string, int > > &properties)
Build the patches of properties of particles for visualization.
A simple container for storing basic statistical values.
void check_file_exists(const std::string &file_name, const std::string &file_description)
Verify that a file that Lethe must read exists and can be opened, and raise an error stated in the us...
void serialize_tables_vector(const std::vector< OutputStructTableHandler > &table_output_structs, const MPI_Comm mpi_communicator)
Serializes all the TableHandler objects in table_output_structs.
void announce_string(const ConditionalOStream &pcout, const std::string &expression, const char delimiter='-')
Prints a string and then adds a line above and below made with dashes containing as many dashes as th...
void add_statistics_to_table_handler(const std::string &variable, const statistics &stats, TableHandler &table)
Add statistical values to a TableHandler.
void deserialize_tables_vector(std::vector< OutputStructTableHandler > &table_output_structs, const MPI_Comm mpi_communicator)
Deserializes all the TableHandler objects in table_output_structs.
void report_cell_size_to_particle_diameter_ratio(const parallel::DistributedTriangulationBase< dim > &triangulation, const double maximum_particle_diameter, const ConditionalOStream &pcout, const MPI_Comm &mpi_communicator)
Reports the ratio between the minimum cell size and the maximum particle diameter.
void setup_distributions(const LagrangianPhysicalProperties &lpp, std::vector< std::shared_ptr< Distribution > > &size_distribution_object_container, double &maximum_particle_diameter, const unsigned int mpi_process_id, const ConditionalOStream &pcout)
void read_mesh_and_manifolds(parallel::DistributedTriangulationBase< dim, spacedim > &triangulation, const Parameters::Mesh< dim, spacedim > &mesh_parameters, const Parameters::Manifolds &manifolds_parameters, bool restart, const Parameters::PeriodicBoundaries &periodic_boundaries)
Completely sets up a mesh and its manifolds.
void write_post_processing_results(const parallel::distributed::Triangulation< dim > &triangulation, PVDHandler &grid_pvdhandler, const DoFHandler< dim > &background_dh, const Particles::ParticleHandler< dim > &particle_handler, const DEMSolverParameters< dim > &dem_parameters, const double current_time, const unsigned int step_number, const MPI_Comm &mpi_communicator, AdaptiveSparseContacts< dim, PropertiesIndex > &sparse_contacts_object)
Carries out writing the cell data of the domain.
void log_collision_data(const DEMSolverParameters< dim > ¶meters, typename DEM::dem_data_structures< dim >::particle_wall_in_contact &particle_wall_pairs_in_contact, const double current_time, OngoingCollisionLog< dim > &ongoing_collision_log, CompletedCollisionLog< dim > &collision_event_log)
Logs the particle-wall contact statistics.
void write_collision_stats(const DEMSolverParameters< dim > ¶meters, const CompletedCollisionLog< dim > &collision_event_log, const MPI_Comm &mpi_communicator)
Writes the collision statistics to a file.
void integrate_temperature(Particles::ParticleHandler< dim > &particle_handler, const double dt, std::vector< double > &heat_transfer_rate, const std::vector< double > &heat_source)
Implementation of an explicit euler time-stepping scheme for the integration of the particles' temper...
constexpr bool has_thermal_properties
Whether a properties index set carries thermal properties.
std::conditional_t< has_thermal_properties< PropertiesIndex >, DEMMPProperties::PropertiesIndex, DEMProperties::PropertiesIndex > matching_dem_properties_index
The pure DEM index set matching a given index set.
statistics calculate_granular_statistics(const Particles::ParticleHandler< dim > &particle_handler, const MPI_Comm &mpi_communicator)
Calculate statistics on a DEM ParticleHandler. At the moment, the following statistics are supported:
@ rotational_kinetic_energy
@ translational_kinetic_energy
void convert_particle_handler(const parallel::distributed::Triangulation< dim > &triangulation, const Particles::ParticleHandler< dim > &ph_in, Particles::ParticleHandler< dim > &ph_out)
Converts an input particle handler with a given set of input properties into an output particle handl...
void set_wall_temperature_time(const Parameters::Lagrangian::BCDEM &boundary_conditions, const double time)
Set the time of the temperature functions of the walls of the grid with a temperature boundary condit...
double calculate_average_velocity(const DoFHandler< dim > &dof_handler, const VectorType &present_solution, const unsigned int &boundary_id, const Quadrature< dim - 1 > &face_quadrature_formula, const Mapping< dim > &mapping)
calculate_average_velocity. This function calculates average velocity from the volumetric flow rate a...
std::pair< double, double > calculate_fluid_and_particle_volumes(const DoFHandler< dim > &void_fraction_dof_handler, const VectorType &present_void_fraction_solution, const Quadrature< dim > &quadrature_formula, const Mapping< dim > &mapping)
This function calculates total volume of fluid and total volume of particles in cfd-dem simulation.
std::shared_ptr< Insertion< dim, PropertiesIndex > > set_insertion_type(std::vector< std::shared_ptr< Distribution > > &size_distribution_object_container, parallel::distributed::Triangulation< dim > &triangulation, DEMSolverParameters< dim > &dem_parameters, const double &maximum_particle_diameter)
Set up the particle insertion method for the simulation. Creates and configures the appropriate inser...
std::shared_ptr< ParticleParticleContactForceBase< dim, PropertiesIndex > > set_particle_particle_contact_force_model(const DEMSolverParameters< dim > &dem_parameters)
Return the particle-particle contact force model based on the spring-dashpot model and the rolling re...
std::shared_ptr< ParticleWallContactForceBase< dim, PropertiesIndex > > set_particle_wall_contact_force_model(const DEMSolverParameters< dim > &dem_parameters)
Return the particle-wall contact force model based on the spring-dashpot model and the rolling resist...
void write_vtu_and_pvd(PVDHandler &pvd_handler, const DataOutInterface< dim, spacedim > &data_out, const std::string &folder, const std::string &file_prefix, const double time, const unsigned int iter, const unsigned int group_files, const MPI_Comm &mpi_communicator, const unsigned int digits=5)
Output the data out to "group_files" vtu files, with a pvtu file and a pvd to store the timing This f...
dealii::TrilinosWrappers::MPI::Vector GlobalVectorType