27#include <boost/archive/text_iarchive.hpp>
28#include <boost/archive/text_oarchive.hpp>
35template <
int dim,
typename PropertiesIndex>
41template <
int dim,
typename PropertiesIndex>
49 Utilities::MPI::this_mpi_process(this->mpi_communicator),
58template <
int dim,
typename PropertiesIndex>
67 .lagrangian_physical_properties;
85 dem_parameters.lagrangian_physical_properties.particle_type_number);
87 const auto parallel_triangulation =
88 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
94 *parallel_triangulation,
115 for (
unsigned int i = 0;
116 i <
dem_parameters.lagrangian_physical_properties.particle_type_number;
119 const double youngs_modulus =
121 .youngs_modulus_particle[i];
122 const double poisson_ratio =
123 dem_parameters.lagrangian_physical_properties.poisson_ratio_particle[i];
124 const double density =
125 dem_parameters.lagrangian_physical_properties.density_particle[i];
126 const double shear_modulus =
127 youngs_modulus / (2.0 * (1.0 + poisson_ratio));
128 const double min_diameter =
132 std::min(M_PI_2 * min_diameter * sqrt(density / shear_modulus) /
133 (0.1631 * poisson_ratio + 0.8766),
140 this->simulation_control->get_time_step(),
141 this->cfd_dem_simulation_parameters.cfd_dem.coupling_frequency,
143 this->cfd_dem_simulation_parameters.cfd_dem.fraction_of_rayleigh_time);
147 if (!
dem_parameters.boundary_conditions.periodic_boundaries.empty())
157 *parallel_triangulation,
171template <
int dim,
typename PropertiesIndex>
172std::shared_ptr<Integrator<dim, PropertiesIndex>>
179 switch (integration_method)
182 return std::make_shared<
185 return std::make_shared<
188 throw(std::runtime_error(
"Invalid integration method."));
192template <
int dim,
typename PropertiesIndex>
196 this->
pcout <<
"Initializing DEM parameters" << std::endl;
198 const auto parallel_triangulation =
199 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
214 this->simulation_control->get_current_time());
221 std::min((GridTools::minimal_cell_diameter(*this->
triangulation) -
237 for (
const auto &pb_id :
251 *parallel_triangulation,
254 this->cfd_dem_simulation_parameters.cfd_parameters.mesh
255 .check_for_diamond_cells,
256 this->cfd_dem_simulation_parameters.cfd_parameters.mesh
257 .expand_particle_wall_contact_search,
272 this->
pcout <<
"Finished initializing DEM parameters" << std::endl
273 <<
"DEM time step is "
278template <
int dim,
typename PropertiesIndex>
282 this->
pcout <<
"Reading DEM checkpoint" << std::endl;
288 std::string checkpoint_controller_object_filename =
289 prefix +
".checkpoint_controller";
291 "checkpoint file of the checkpoint controller, given by "
292 "'subsection void fraction' - 'set dem file name'");
293 std::ifstream iss_checkpoint_controller_obj(
294 checkpoint_controller_object_filename);
295 boost::archive::text_iarchive ia_checkpoint_controller_obj(
296 iss_checkpoint_controller_obj, boost::archive::no_header);
298 unsigned int checkpoint_id;
299 ia_checkpoint_controller_obj >> checkpoint_id;
302 prefix = prefix +
"_" + Utilities::int_to_string(checkpoint_id);
305 std::string particle_filename = prefix +
".particles";
307 "checkpoint file of the particles, given by "
308 "'subsection void fraction' - 'set dem file name'");
309 std::ifstream input(particle_filename.c_str());
312 std::getline(input, buffer);
313 std::istringstream iss(buffer);
314 boost::archive::text_iarchive ia(iss, boost::archive::no_header);
318 using DEMPropertiesIndex =
321 Particles::ParticleHandler<dim> temporary_particle_handler(
324 DEMPropertiesIndex::n_properties);
326 ia >> temporary_particle_handler;
328 const std::string filename = prefix +
".triangulation";
330 "checkpoint file of the triangulation, given by "
331 "'subsection void fraction' - 'set dem file name'");
333 if (
auto parallel_triangulation =
334 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
339 parallel_triangulation->load(filename.c_str());
342 temporary_particle_handler.deserialize();
347 ExcMessage(
"Cannot open snapshot mesh file or read the"
348 "triangulation stored there."));
355 *parallel_triangulation,
356 temporary_particle_handler,
361 throw std::runtime_error(
362 "VANS equations currently do not support triangulations other than parallel::distributed");
365 this->
pcout <<
"Finished reading DEM checkpoint" << std::endl
367 <<
" particles are in the simulation" << std::endl;
372template <
int dim,
typename PropertiesIndex>
373std::vector<OutputStructTableHandler>
376 std::vector<OutputStructTableHandler> table_output_structs;
382 std::string suffix =
".checkpoint";
384 table_output_structs.emplace_back(
387 return table_output_structs;
390template <
int dim,
typename PropertiesIndex>
394 using VectorType = LinearAlgebra::distributed::Vector<double>;
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 VectorType *> sol_set_transfer;
449 std::vector<const VectorType *> 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, VectorType> system_trans_vectors(*this->
dof_handler);
460 system_trans_vectors.prepare_for_serialization(sol_set_transfer);
463 std::vector<const VectorType *> vf_set_transfer;
465 for (
unsigned int i = 0;
469 vf_set_transfer.push_back(
476 SolutionTransfer<dim, VectorType> vf_system_trans_vectors(
478 vf_system_trans_vectors.prepare_for_serialization(vf_set_transfer);
480 if (
auto parallel_triangulation =
481 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
484 parallel_triangulation->save(prefix +
".triangulation");
488 const std::vector<OutputStructTableHandler> &table_output_structs_add =
493 const std::vector<OutputStructTableHandler> &table_output_structs =
498template <
int dim,
typename PropertiesIndex>
503 using VectorType = LinearAlgebra::distributed::Vector<double>;
507 std::string prefix_particles = prefix +
"_particles";
508 std::string prefix_grid = prefix +
"_lagrangian_postprocessing";
514 if (this->
dem_parameters.post_processing.lagrangian_post_processing_enabled)
520 std::string particle_filename = prefix +
".particles";
522 "checkpoint file of the particles, given by "
523 "'subsection restart' - 'set filename'");
524 std::ifstream input(particle_filename.c_str());
527 std::getline(input, buffer);
528 std::istringstream iss(buffer);
529 boost::archive::text_iarchive ia(iss, boost::archive::no_header);
536 std::string insertion_object_filename = prefix +
".insertion_object";
537 if (std::filesystem::exists(insertion_object_filename))
539 std::ifstream iss_insertion_obj(insertion_object_filename);
540 boost::archive::text_iarchive ia_insertion_obj(iss_insertion_obj,
541 boost::archive::no_header);
545 const std::string filename = prefix +
".triangulation";
547 "checkpoint file of the triangulation, given by "
548 "'subsection restart' - 'set filename'");
552 if (
auto parallel_triangulation =
553 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
555 parallel_triangulation->load(filename.c_str());
560 ExcMessage(
"Cannot open snapshot mesh file or read the "
561 "triangulation stored there."));
582 x_system[0] = &(distributed_system);
584 std::vector<VectorType> distributed_previous_solutions;
590 distributed_previous_solutions.emplace_back(
594 x_system[i + 1] = &distributed_previous_solutions[i];
597 SolutionTransfer<dim, VectorType> system_trans_vectors(*this->
dof_handler);
601 std::vector<VectorType *> sum_vectors =
604 x_system.insert(x_system.end(), sum_vectors.begin(), sum_vectors.end());
607 system_trans_vectors.deserialize(x_system);
629 std::vector<VectorType *> vf_system(
634 this->particle_projector.locally_relevant_dofs,
635 this->mpi_communicator);
637 vf_system[0] = &(vf_distributed_system);
639 std::vector<VectorType> vf_distributed_previous_solutions;
641 vf_distributed_previous_solutions.reserve(
644 for (
unsigned int i = 0;
648 vf_distributed_previous_solutions.emplace_back(
650 this->particle_projector.locally_relevant_dofs,
651 this->mpi_communicator));
652 vf_system[i + 1] = &vf_distributed_previous_solutions[i];
655 SolutionTransfer<dim, VectorType> vf_system_trans_vectors(
658 vf_system_trans_vectors.deserialize(vf_system);
666 this->particle_projector.void_fraction_solution);
672 for (
unsigned int i = 0;
677 vf_distributed_previous_solutions[i];
683 this->particle_projector.void_fraction_previous_solution[i]);
706 for (
unsigned int i = 0;
710 .update_ghost_values();
719 this->particle_handler.deserialize();
723 std::vector<OutputStructTableHandler> table_output_structs_add =
729 std::vector<OutputStructTableHandler> table_output_structs =
736 this->particle_handler.sort_particles_into_subdomains_and_cells();
737 this->particle_handler.exchange_ghost_particles(
true);
740template <
int dim,
typename PropertiesIndex>
743 unsigned int counter)
779template <
int dim,
typename PropertiesIndex>
789 using VectorType = LinearAlgebra::distributed::Vector<double>;
792 std::vector<const VectorType *> sol_set_transfer;
802 SolutionTransfer<dim, VectorType> system_trans_vectors(*this->
dof_handler);
803 system_trans_vectors.prepare_for_coarsening_and_refinement(sol_set_transfer);
815 std::vector<const VectorType *> vf_set_transfer;
819 for (
unsigned int i = 0;
824 .update_ghost_values();
825 vf_set_transfer.push_back(
830 SolutionTransfer<dim, VectorType> vf_system_trans_vectors(
832 vf_system_trans_vectors.prepare_for_coarsening_and_refinement(
839 this->
pcout <<
"-->Repartitioning triangulation" << std::endl;
841 const auto parallel_triangulation =
842 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
845 parallel_triangulation->repartition();
856 *parallel_triangulation,
859 this->cfd_dem_simulation_parameters.cfd_parameters.mesh
860 .check_for_diamond_cells,
861 this->cfd_dem_simulation_parameters.cfd_parameters.mesh
862 .expand_particle_wall_contact_search,
865 const auto average_minimum_maximum_cells =
866 Utilities::MPI::min_max_avg(parallel_triangulation->n_active_cells(),
867 this->mpi_communicator);
869 const auto average_minimum_maximum_particles = Utilities::MPI::min_max_avg(
870 this->
particle_handler.n_locally_owned_particles(), this->mpi_communicator);
872 this->
pcout <<
"Load balance finished" << std::endl;
874 <<
"Average, minimum and maximum number of particles on the processors are "
875 << average_minimum_maximum_particles.avg <<
" , "
876 << average_minimum_maximum_particles.min <<
" and "
877 << average_minimum_maximum_particles.max << std::endl;
879 <<
"Minimum and maximum number of cells owned by the processors are "
880 << average_minimum_maximum_cells.min <<
" and "
881 << average_minimum_maximum_cells.max << std::endl;
883 this->
pcout <<
"Setup DOFs" << std::endl;
902 x_system[0] = &(distributed_system);
904 std::vector<VectorType> distributed_previous_solutions;
910 distributed_previous_solutions.emplace_back(
914 x_system[i + 1] = &distributed_previous_solutions[i];
917 system_trans_vectors.interpolate(x_system);
919 distributed_system.update_ghost_values();
924 distributed_previous_solutions[i].update_ghost_values();
937 std::vector<VectorType *> vf_system(
942 this->particle_projector.locally_relevant_dofs,
943 this->mpi_communicator);
945 vf_system[0] = &(vf_distributed_system);
947 std::vector<VectorType> vf_distributed_previous_solutions;
949 vf_distributed_previous_solutions.reserve(
952 for (
unsigned int i = 0;
956 vf_distributed_previous_solutions.emplace_back(
958 this->particle_projector.locally_relevant_dofs,
959 this->mpi_communicator));
960 vf_system[i + 1] = &vf_distributed_previous_solutions[i];
963 vf_system_trans_vectors.interpolate(vf_system);
975 vf_distributed_system.update_ghost_values();
987 this->particle_projector.void_fraction_solution);
993 for (
unsigned int i = 0;
1001 vf_distributed_previous_solutions[i].update_ghost_values();
1004 vf_distributed_previous_solutions[i];
1006#ifndef LETHE_USE_LDV
1010 this->particle_projector.void_fraction_previous_solution[i]);
1022template <
int dim,
typename PropertiesIndex>
1033 particle != this->particle_handler.end();
1036 auto particle_properties = particle->get_properties();
1038 types::particle_index particle_id = particle->get_local_index();
1040 force[particle_id][0] +=
1041 particle_properties[PropertiesIndex::fem_force_two_way_coupling_x] +
1042 particle_properties[PropertiesIndex::fem_force_one_way_coupling_x] +
1043 particle_properties[PropertiesIndex::fem_drag_x];
1044 force[particle_id][1] +=
1045 particle_properties[PropertiesIndex::fem_force_two_way_coupling_y] +
1046 particle_properties[PropertiesIndex::fem_force_one_way_coupling_y] +
1047 particle_properties[PropertiesIndex::fem_drag_y];
1048 force[particle_id][2] +=
1049 particle_properties[PropertiesIndex::fem_force_two_way_coupling_z] +
1050 particle_properties[PropertiesIndex::fem_force_one_way_coupling_z] +
1051 particle_properties[PropertiesIndex::fem_drag_z];
1052 torque[particle_id][0] +=
1053 particle_properties[PropertiesIndex::fem_torque_x];
1054 torque[particle_id][1] +=
1055 particle_properties[PropertiesIndex::fem_torque_y];
1056 torque[particle_id][2] +=
1057 particle_properties[PropertiesIndex::fem_torque_z];
1061template <
int dim,
typename PropertiesIndex>
1070 const auto parallel_triangulation =
1071 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
1075 this->simulation_control->get_iteration_number() == 1)
1078 *parallel_triangulation,
1088template <
int dim,
typename PropertiesIndex>
1110 .calculate_particle_point_contact_force(
1115 if constexpr (dim == 3)
1118 .calculate_particle_line_contact_force(
1125template <
int dim,
typename PropertiesIndex>
1129 const std::string folder =
dem_parameters.simulation_control.output_folder;
1130 const std::string particles_solution_name =
1134 const unsigned int group_files =
1145 particles_solution_name,
1153template <
int dim,
typename PropertiesIndex>
1160 double number_of_list_built_since_last_log =
1163 std::max(number_of_list_built_since_last_log,
contact_list.max);
1165 std::min(number_of_list_built_since_last_log,
contact_list.min);
1195 TableHandler report;
1197 std::vector<std::string> column_names{
1198 "Variable",
"Min",
"Max",
"Average",
"Total"};
1200 for (
const std::string &column_name : column_names)
1201 report.declare_column(column_name);
1218 for (
unsigned int i = 1; i < column_names.size(); ++i)
1220 report.set_scientific(column_names[i],
true);
1221 report.set_precision(column_names[i],
1226 report.write_text(std::cout, dealii::TableHandler::org_mode_table);
1229 if (
dem_parameters.post_processing.lagrangian_post_processing_enabled &&
1230 this->simulation_control->is_output_iteration())
1232 const auto parallel_triangulation =
1233 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
1237 *parallel_triangulation,
1240 this->particle_handler,
1243 this->simulation_control->get_iteration_number(),
1244 this->mpi_communicator,
1249template <
int dim,
typename PropertiesIndex>
1260 if (!first_iteration)
1263 <<
"---------------------------------------------------------------"
1268template <
int dim,
typename PropertiesIndex>
1275 TimerOutput::Scope t(this->
computing_timer,
"total_volume_calculation");
1276 double total_volume_fluid, total_volume_particles;
1277 std::tie(total_volume_fluid, total_volume_particles) =
1280 *this->particle_projector.void_fraction_locally_relevant,
1281 *this->cell_quadrature,
1286 total_volume_fluid);
1288 total_volume_particles);
1292 this->
pcout <<
"Total volume of fluid: "
1294 .get_density_scale() *
1296 <<
" m^3" << std::endl;
1297 this->
pcout <<
"Total volume of particles: "
1299 .get_density_scale() *
1300 total_volume_particles
1301 <<
" m^3" << std::endl;
1306 this->simulation_parameters.post_processing.output_frequency ==
1308 this->this_mpi_process == 0)
1310 std::string filename =
1313 .phase_volumes_output_name +
1315 std::ofstream output(filename.c_str());
1325template <
int dim,
typename PropertiesIndex>
1330 this->simulation_parameters.simulation_control.method !=
1334 unsigned int flow_direction =
1339 *this->present_solution,
1340 this->particle_projector.void_fraction_solution,
1342 *this->cell_quadrature,
1349 this->simulation_control->get_iteration_number());
1351 Tensor<1, 3> beta_particle;
1357 .particle_type_number == 1,
1358 ExcMessage(std::string(
1359 "Beta force calculation for particles is not implemented for multiple particle types.")));
1361 double fluid_density =
1363 .get_density_scale();
1364 double particle_density =
1365 dem_parameters.lagrangian_physical_properties.density_particle[0];
1375 this->simulation_control->get_iteration_number() > 0 &&
1376 this->this_mpi_process == 0)
1379 this->
pcout <<
"Fluid space-average velocity: " << average_velocity
1381 this->
pcout <<
"Fluid beta force: "
1384 this->
pcout <<
"Particle beta force: "
1385 << beta_particle[flow_direction] << std::endl;
1391template <
int dim,
typename PropertiesIndex>
1405 unsigned int number_of_particles =
1411 MOI.resize(number_of_particles);
1416 auto particle_properties = particle.get_properties();
1417 MOI[particle.get_local_index()] =
1418 0.1 * particle_properties[PropertiesIndex::mass] *
1419 particle_properties[PropertiesIndex::dp] *
1420 particle_properties[PropertiesIndex::dp];
1428template <
int dim,
typename PropertiesIndex>
1470 this->simulation_control->get_previous_time() +
1471 counter * dem_time_step);
1504 const auto parallel_triangulation =
1505 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
1513 *parallel_triangulation,
1517 auto dem_current_time =
1521 if (
dem_parameters.post_processing.particle_wall_collision_statistics)
1534template <
int dim,
typename PropertiesIndex>
1574 const auto parallel_triangulation =
1575 dynamic_cast<parallel::distributed::Triangulation<dim> *
>(
1583 *parallel_triangulation,
1589template <
int dim,
typename PropertiesIndex>
1608 this->
pcout <<
"DEM contact search at dem step " << counter << std::endl;
1622 this->particle_handler,
1623 (*this->triangulation).n_active_cells(),
1624 this->mpi_communicator);
1637 this->simulation_control->get_current_time(),
1658 this->simulation_control->get_current_time(),
1667template <
int dim,
typename PropertiesIndex>
1671 this->
computing_timer.enter_subsection(
"Read mesh, manifolds and particles");
1676 this->cfd_dem_simulation_parameters.cfd_parameters.manifolds_parameters,
1677 this->cfd_dem_simulation_parameters.cfd_parameters.restart_parameters
1679 this->cfd_dem_simulation_parameters.void_fraction->read_dem,
1680 this->cfd_dem_simulation_parameters.cfd_parameters.boundary_conditions
1681 .periodic_boundaries);
1687 !this->cfd_dem_simulation_parameters.cfd_parameters.restart_parameters
1691 this->
computing_timer.leave_subsection(
"Read mesh, manifolds and particles");
1697 this->cfd_dem_simulation_parameters.cfd_parameters.restart_parameters
1710 "qcm_quadrature_points",
1711 this->cfd_dem_simulation_parameters.cfd_parameters.simulation_control
1716 if (this->
multiphysics->get_active_physics().size() > 1)
1794 "Calculate particle-fluid forces projection");
1798 *this->present_solution,
1799 *this->previous_solutions,
1800 this->cfd_dem_simulation_parameters.dem_parameters
1801 .lagrangian_physical_properties.g,
1803 this->simulation_control,
1804 this->simulation_parameters.physical_properties_manager,
1806 *this->cell_quadrature,
1808 *this->face_quadrature));
1810 "Calculate particle-fluid forces projection");
1820 "Prepare MF operator for VANS");
1822 mf_operator->compute_void_fraction(
1824 this->particle_projector.void_fraction_solution,
1825 this->time_derivative_void_fraction);
1827 mf_operator->compute_particle_fluid_interaction(
1830 this->particle_projector.fluid_force_on_particles_two_way_coupling
1831 .particle_field_solution,
1832 *this->particle_projector.fluid_drag_on_particles.dof_handler,
1833 this->particle_projector.fluid_drag_on_particles
1834 .particle_field_solution,
1835 *this->particle_projector.particle_velocity.dof_handler,
1836 this->particle_projector.particle_velocity.particle_field_solution,
1837 *this->particle_projector.momentum_transfer_coefficient.dof_handler,
1838 this->particle_projector.momentum_transfer_coefficient
1839 .particle_field_solution);
1842 "Prepare MF operator for VANS");
1857 cfd_dem_prm.dem_iteration_control,
1858 this->simulation_control->get_time_step(),
1859 cfd_dem_prm.coupling_frequency,
1861 cfd_dem_prm.fraction_of_rayleigh_time);
1888 <<
" DEM iterations" << std::endl;
Solver class for coupled Computational Fluid Dynamics and Discrete Element Method (CFD-DEM) simulatio...
void particle_wall_contact_force()
Calculate contact forces between particles and walls.
double smallest_contact_search_criterion
Smallest criterion used for contact search algorithms.
void write_checkpoint() override
Write CFD-DEM simulation checkpoint files.
unsigned int contact_search_counter
Counter for contact searches performed in the current CFD iteration.
void postprocess_fd(bool first_iteration) override
Perform fluid dynamics post-processing after each iteration.
PVDHandler particles_pvdhandler
PVD handler for particle visualization output.
DEM::dem_data_structures< dim >::periodic_boundaries_cells_info periodic_boundaries_cells_information
Information about cells involved in periodic boundary conditions.
ParticleInteractionOutcomes< PropertiesIndex > contact_outcome
Container for particle interaction outcomes (forces and torques).
void read_dem() override
Read DEM restart files from a previous simulation.
std::shared_ptr< ParticleParticleContactForceBase< dim, PropertiesIndex > > particle_particle_contact_force_object
Contact force model for particle-particle interactions.
void add_fluid_particle_interaction()
Calculate and add fluid-particle interaction forces and torques.
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,...
double rayleigh_time_step
Rayleigh time step.
std::vector< double > MOI
Moment of inertia values for all particles.
void postprocess_cfd_dem()
Perform CFD-DEM coupled post-processing after each iteration.
void load_balance()
Check if load balancing is required and perform it if necessary.
std::shared_ptr< SubSimulationControlDEM > dem_simulation_control
DEMSolverParameters< dim > dem_parameters
DEM simulation parameters container.
dem_data_structures< dim >::solid_surfaces_mesh_information solid_surfaces_mesh_info
Mesh information for solid surfaces in contact with particles.
void report_rayleigh_time_ratio()
Reports the ratio between the DEM time step and the Rayleigh time.
double maximum_particle_diameter
Maximum diameter among all particles in the simulation.
std::vector< double > displacement
Displacement vector for particle motion calculations.
AdaptiveSparseContacts< dim, PropertiesIndex > sparse_contacts_object
Object for handling adaptive sparse contact detection algorithms.
void read_checkpoint() override
Read CFD-DEM simulation checkpoint files.
void dynamic_flow_control() override
Calculate dynamic flow control accounting for void fraction.
std::vector< std::shared_ptr< Distribution > > size_distribution_object_container
Container for particle size distribution objects.
std::shared_ptr< Insertion< dim, PropertiesIndex > > insertion_object
Particle insertion method handler.
double neighborhood_threshold_squared
Squared threshold distance for neighborhood particle detection.
statistics contact_list
Statistics container for timing and contact list information.
void solve() override
Engine of the CFD-DEM solver. Calls all the necessary functions to set parameters,...
unsigned int contact_search_total_number
Total number of contact searches since simulation start.
void setup_distribution_type()
Initialize the particle size distribution and related parameters.
void report_particle_statistics()
Calculate and report particle statistics to the terminal.
TableHandler table_phase_volumes
PeriodicBoundariesManipulator< dim > periodic_boundaries_object
Handler for periodic boundary condition manipulations.
void insert_particles()
Check if particles need to be inserted and perform insertion.
void synchronize_particle_velocities()
Carry out the closing half velocity step of a staggered integration scheme at the end of the DEM sub-...
std::shared_ptr< Integrator< dim, PropertiesIndex > > integrator_object
Time integration scheme for particle motion equations.
void dem_setup_parameters()
Set up the various parameters related to the DEM simulation.
void check_contact_detection_method(unsigned int counter)
Check if contact detection is required and execute it if necessary.
void sort_particles_into_subdomains_and_cells()
Sort particles into subdomains and cells for efficient processing.
DEMContactManager< dim, PropertiesIndex > contact_manager
LagrangianLoadBalancing< dim, PropertiesIndex > load_balancing
Load balancing handler for distributing particles across MPI processes.
CFDDEMMatrixFree(CFDDEMSimulationParameters< dim > ¶m)
Constructor for the CFD-DEM matrix-free solver.
DEMActionManager * dem_action_manager
Pointer to DEM action manager for handling DEM-specific operations.
OngoingCollisionLog< dim > ongoing_collision_log
Object to store ongoing collision information.
CompletedCollisionLog< dim > collision_event_log
Object to store completed collision events.
ParticlePointLineForce< dim, PropertiesIndex > particle_point_line_contact_force_object
Handler for point and line contact forces between particles.
std::vector< OutputStructTableHandler > gather_tables() override
Gather TableHandler objects for serialization during checkpointing.
void dem_iterator()
Execute a DEM time step.
std::shared_ptr< ParticleWallContactForceBase< dim, PropertiesIndex > > particle_wall_contact_force_object
Contact force model for particle-wall interactions.
void initialize_dem_parameters()
Initialize fundamental DEM simulation parameters.
BoundaryCellsInformation< dim > boundary_cell_object
Information about boundary cells for contact detection.
Tensor< 1, 3 > g
Gravitational acceleration vector.
std::shared_ptr< Integrator< dim, PropertiesIndex > > set_integrator_type()
Set up the time integration method for particle motion.
PVDHandler grid_pvdhandler
PVD handler for grid visualization output.
DEM::ParticleProperties< dim, PropertiesIndex > properties_class
Particle properties handler for DEM simulation.
void dem_contact_build()
Perform contact detection and build contact lists.
void write_dem_output_results()
Write DEM simulation results to output files.
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....
void print_mg_setup_times()
Prints the setup times for the geometric multigrid preconditioner.
VectorType time_derivative_previous_solutions
Vector to store the time derivatives of the previous solutions at the end of each time step for time-...
virtual void update_multiphysics_time_average_solution() override
Update the average velocity field solution in the multiphyscics interface.
std::shared_ptr< NavierStokesOperatorBase< dim, double > > system_operator
Matrix-free operator in used for all the matrix-vector multiplications calls (vmult).
void calculate_time_derivative_previous_solutions()
Calculate and store time derivatives of previous solutions according to time-stepping scheme to use t...
LinearAlgebra::distributed::Vector< double > VectorType
void evaluate_time_derivative_void_fraction()
Evaluate the time derivative of the void fraction. This evaluates the time-derivative as a solution v...
virtual void finish_time_step_fd()
Finish the time step and manage the end of the time step for the void fraction.
ParticleProjector< dim, PropertiesIndex > particle_projector
CFDDEMSimulationParameters< dim > cfd_dem_simulation_parameters
Simulation parameters for CFD-DEM simulations.
void setup_dofs() override
Setup the degree of freedom of the flow solver and the degrees of freedom and constraints for the voi...
FluidDynamicsVANSMatrixFree(CFDDEMSimulationParameters< dim > ¶m)
Constructor that sets the finite element degree and system operator according to simulation parameter...
Particles::ParticleHandler< dim, dim > particle_handler
Particle-handler used to store particles in CFD-DEM simulations.
MappingQGeneric< dim > particle_mapping
Mapping used for the particles.
void write_output_results(const LinearAlgebra::distributed::Vector< double > &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< LinearAlgebra::distributed::Vector< double > > present_solution
virtual void refine_mesh()
const unsigned int this_mpi_process
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< LinearAlgebra::distributed::Vector< double > > > 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, LinearAlgebra::distributed::Vector< double >, IndexSet > > average_velocities
IndexSet locally_relevant_dofs
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
Implements the matrix-free operator for the VANS equations.
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 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...
Controls smaller simulation blocks within simulations.
GlobalVectorType VectorType
bool time_stepping_is_bdf(const Parameters::SimulationControl::TimeSteppingMethod method)
Determines if the time integration method is within the bdf family.
void convert_vector_dealii_to_trilinos(dealii::TrilinosWrappers::MPI::Vector &out, const dealii::LinearAlgebra::distributed::Vector< number > &in)
Helper function that allows to convert deal.II vectors to Trilinos vectors.