Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
input_parameter_inspection.cc
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2020-2021, 2023-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
5
6using namespace dealii;
7
8template <int dim>
9void
11 const ConditionalOStream &pcout,
12 const std::vector<std::shared_ptr<Distribution>>
13 &size_distribution_object_container)
14{
15 // Getting the input parameters as local variable
16 const auto &parameters = dem_parameters;
17 auto physical_properties = dem_parameters.lagrangian_physical_properties;
18 double rayleigh_time_step = DBL_MAX;
19 for (unsigned int i = 0; i < physical_properties.particle_type_number; ++i)
20 {
21 double shear_modulus =
22 physical_properties.youngs_modulus_particle[i] /
23 (2.0 * (1.0 + physical_properties.poisson_ratio_particle[i]));
24
25 double min_diameter =
26 size_distribution_object_container.at(i)->find_min_diameter();
27
28 rayleigh_time_step = std::min(
29 M_PI_2 * min_diameter *
30 sqrt(physical_properties.density_particle[i] / shear_modulus) /
31 (0.1631 * physical_properties.poisson_ratio_particle[i] + 0.8766),
32 rayleigh_time_step);
33 }
34
35 const double time_step_rayleigh_ratio =
36 parameters.simulation_control.dt / rayleigh_time_step;
37 pcout << "DEM time step is " << time_step_rayleigh_ratio * 100
38 << "% of Rayleigh time step" << std::endl;
39
40 if (time_step_rayleigh_ratio > 0.15)
41 {
42 pcout << "Warning: It is recommended to decrease the time step"
43 << std::endl;
44 }
45 else if (time_step_rayleigh_ratio < 0.01)
46 {
47 pcout << "Warning: It is recommended to increase the time step"
48 << std::endl;
49 }
50
51 // Checking particle size range
52 for (unsigned int i = 0; i < physical_properties.particle_type_number; ++i)
53 {
54 if (size_distribution_object_container.at(i)->find_min_diameter() < 0.)
55 {
56 pcout
57 << "Warning: Requested particle size distribution for type: " << i
58 << " is not well-defined. Using requested distribution may lead to "
59 "changes in sampled particle sizes to avoid negative particle "
60 "diameters. You can consider decreasing the standard deviation of "
61 "size distribution or increasing the particle diameter instead."
62 << std::endl;
63 }
64 }
65
66 // Insertion parameters check
67 const double insertion_distance_per_particle =
68 0.5 * (parameters.insertion_info.distance_threshold - 1);
69
70 if (parameters.insertion_info.insertion_method ==
72 parameters.insertion_info.insertion_maximum_offset >=
73 insertion_distance_per_particle)
74 pcout
75 << "Warning: Particles may have collision at the insertion step. This can lead"
76 " to high initial velocities (due to initial overlap) or errors when using "
77 "less stable integration schemes. It is recommended to decrease the random "
78 "number range or to increase the insertion distance threshold."
79 << std::endl;
80
81 // Grid motion check
82 if (parameters.grid_motion.motion_type ==
84 {
85 if constexpr (dim == 2)
86 {
87 if (parameters.grid_motion.grid_rotational_axis != 0 &&
88 parameters.grid_motion.grid_rotational_axis != 1)
89 throw std::runtime_error(
90 "Specified grid rotational axis is not valid, use 0 for rotation around x"
91 " axis or 1 for rotation around y axis.");
92 }
93
94 if constexpr (dim == 3)
95 {
96 if (parameters.grid_motion.grid_rotational_axis != 0 &&
97 parameters.grid_motion.grid_rotational_axis != 1 &&
98 parameters.grid_motion.grid_rotational_axis != 2)
99 throw std::runtime_error(
100 "Specified grid rotational axis is not valid, use 0 for rotation around x"
101 " axis or 1 for rotation around y axis or 2 for rotation around z axis.");
102 }
103 }
104}
105
106template void
108 const ConditionalOStream &pcout,
109 const std::vector<std::shared_ptr<Distribution>>
110 &size_distribution_object_container);
111
112template void
114 const ConditionalOStream &pcout,
115 const std::vector<std::shared_ptr<Distribution>>
116 &size_distribution_object_container);
Handles all the parameters declared in the parameter handler file.
Parameters::Lagrangian::LagrangianPhysicalProperties lagrangian_physical_properties
@ volume
Insertion within a volume defined by a box.
template void input_parameter_inspection< 2 >(const DEMSolverParameters< 2 > &dem_parameters, const ConditionalOStream &pcout, const std::vector< std::shared_ptr< Distribution > > &size_distribution_object_container)
void input_parameter_inspection(const DEMSolverParameters< dim > &dem_parameters, const ConditionalOStream &pcout, const std::vector< std::shared_ptr< Distribution > > &size_distribution_object_container)
Check input parameters in the parameter handler to be in the correct range. Warnings or error would a...
template void input_parameter_inspection< 3 >(const DEMSolverParameters< 3 > &dem_parameters, const ConditionalOStream &pcout, const std::vector< std::shared_ptr< Distribution > > &size_distribution_object_container)