Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
parameters_cfd_dem.cc
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2020-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
5#include <core/utilities.h>
6
7#include <deal.II/base/exceptions.h>
8
9namespace Parameters
10{
11 namespace
12 {
13 /// Deprecated strings of the void fraction "quadrature rule" parameter
15 deprecated_quadrature_rule_names = {
17
18 /// Deprecated strings of the "drag coupling" parameter
19 const DeprecatedEnumNames<DragCoupling> deprecated_drag_coupling_names = {
20 {"implicit", DragCoupling::fully_implicit},
21 {"semi-implicit", DragCoupling::semi_implicit},
22 {"explicit", DragCoupling::fully_explicit}};
23
24 /// Deprecated strings of the "dem iteration control" parameter
26 deprecated_dem_iteration_control_names = {
27 {"number of iterations",
28 SubSimulationControlDEM::DEMSubIterationLogic::
29 fixed_number_of_iterations},
30 {"fraction of rayleigh time",
31 SubSimulationControlDEM::DEMSubIterationLogic::
32 fixed_fraction_of_rayleigh_time_step}};
33 } // namespace
34
35 template <int dim>
36 void
38 {
39 prm.enter_subsection("void fraction");
41 prm,
42 "mode",
43 mode,
44 "Choose the method for the calculation of the void fraction.");
45
46 prm.enter_subsection("function");
47 void_fraction.declare_parameters(prm);
48 prm.leave_subsection();
49
50 prm.declare_entry("read dem",
51 Patterns::Tools::Convert<bool>::to_string(read_dem),
52 Patterns::Bool(),
53 "Define particles using a DEM simulation results file.");
54
55 prm.declare_entry("dem file name",
57 Patterns::FileName(),
58 "File output dem prefix");
59
60 prm.declare_entry("l2 smoothing length",
61 Patterns::Tools::Convert<double>::to_string(
63 Patterns::Double(),
64 "The smoothing length for void fraction L2 projection");
65
66 prm.declare_entry(
67 "particle refinement factor",
68 Patterns::Tools::Convert<unsigned int>::to_string(
70 Patterns::Double(),
71 "The refinement factor used to calculate the number of pseudo-particles in the satellite point method");
72
73 prm.declare_entry(
74 "qcm smoothing length",
75 Patterns::Tools::Convert<double>::to_string(qcm_smoothing_length),
76 Patterns::Double(),
77 "The smoothing length of the QCM filter. With the spherical filter, half of this value is the averaging-sphere radius; with the gaussian filter, half of this value is the standard deviation sigma.");
78
79 prm.declare_entry(
80 "qcm sphere equal cell volume",
81 Patterns::Tools::Convert<bool>::to_string(qcm_sphere_equal_cell_volume),
82 Patterns::Bool(),
83 "Specify whether the virtual sphere has the same volume as the mesh element");
84
86 prm,
87 "qcm filter type",
89 "Filter kernel used by the QCM to weigh particle contributions. With 'spherical' (default), half of 'qcm smoothing length' is the averaging-sphere radius. With 'gaussian', half of 'qcm smoothing length' is the standard deviation sigma of the Gaussian; sigma should be small compared to the QCM neighbor-cell stencil reach to avoid silent truncation bias.");
90
92 prm,
93 "quadrature rule",
95 "Choose which quadrature rule to follow when distributing quadrature points for the QCM void fraction scheme.",
96 deprecated_quadrature_rule_names);
97
98 prm.declare_entry(
99 "n quadrature points",
100 Patterns::Tools::Convert<unsigned int>::to_string(n_quadrature_points),
101 Patterns::Integer(),
102 "Number of quadrature points per cell used in the QCM void fraction scheme");
103
104 prm.declare_entry(
105 "project particle velocity",
106 Patterns::Tools::Convert<bool>::to_string(project_particle_velocity),
107 Patterns::Bool(),
108 "Specify whether the particle velocity is projected using QCM");
109
110 prm.declare_entry(
111 "output qcm",
112 Patterns::Tools::Convert<bool>::to_string(output_qcm),
113 Patterns::Bool(),
114 "Output QCM quadrature points and QCM filter characteristics");
115
116 prm.leave_subsection();
117 }
118
119 template <int dim>
120 void
122 {
123 prm.enter_subsection("void fraction");
125 prm.enter_subsection("function");
126 void_fraction.parse_parameters(prm);
127 prm.leave_subsection();
128
129 read_dem = prm.get_bool("read dem");
130 dem_file_name = prm.get("dem file name");
131 l2_smoothing_length = prm.get_double("l2 smoothing length");
132 particle_refinement_factor = prm.get_integer("particle refinement factor");
133 qcm_smoothing_length = prm.get_double("qcm smoothing length");
134 qcm_sphere_equal_cell_volume = prm.get_bool("qcm sphere equal cell volume");
135
137 string_to_enum<Parameters::QCMFilterType>(prm.get("qcm filter type"));
138
140 prm.get("quadrature rule"),
141 deprecated_quadrature_rule_names,
142 "quadrature rule");
143
144 n_quadrature_points = prm.get_integer("n quadrature points");
145
146 project_particle_velocity = prm.get_bool("project particle velocity");
147
148 output_qcm = prm.get_bool("output qcm");
149
150 AssertThrow(
152 ExcMessage(
153 "The output of QCM quadrature points is only available when the void fraction mode is set to 'qcm'."));
154
155 prm.leave_subsection();
156 }
157
158 void
159 CFDDEM::declare_parameters(ParameterHandler &prm)
160 {
161 const CFDDEM defaults;
162 prm.enter_subsection("cfd-dem");
163 prm.declare_entry("grad div",
164 Patterns::Tools::Convert<bool>::to_string(
165 defaults.grad_div),
166 Patterns::Bool(),
167 "Choose whether or not to apply grad_div stabilization");
168 prm.declare_entry("void fraction time derivative",
169 Patterns::Tools::Convert<bool>::to_string(
171 Patterns::Bool(),
172 "Choose whether or not to implement d(epsilon)/dt ");
173 prm.declare_entry(
174 "interpolated void fraction",
175 Patterns::Tools::Convert<bool>::to_string(
177 Patterns::Bool(),
178 "Choose whether the void fraction is the one of the cell or the one interpolated at the particle position.");
179 prm.declare_entry("drag force",
180 Patterns::Tools::Convert<bool>::to_string(
181 defaults.drag_force),
182 Patterns::Bool(),
183 "Choose whether or not to apply drag force");
184 prm.declare_entry("buoyancy force",
185 Patterns::Tools::Convert<bool>::to_string(
186 defaults.buoyancy_force),
187 Patterns::Bool(),
188 "Choose whether or not to apply buoyancy force");
189 prm.declare_entry("shear force",
190 Patterns::Tools::Convert<bool>::to_string(
191 defaults.shear_force),
192 Patterns::Bool(),
193 "Choose whether or not to apply shear force");
194 prm.declare_entry("pressure force",
195 Patterns::Tools::Convert<bool>::to_string(
196 defaults.pressure_force),
197 Patterns::Bool(),
198 "Choose whether or not to apply pressure force");
199 prm.declare_entry("saffman lift force",
200 Patterns::Tools::Convert<bool>::to_string(
201 defaults.saffman_lift_force),
202 Patterns::Bool(),
203 "Choose whether or not to apply Saffman-Mei lift force");
204 prm.declare_entry("magnus lift force",
205 Patterns::Tools::Convert<bool>::to_string(
206 defaults.magnus_lift_force),
207 Patterns::Bool(),
208 "Choose whether or not to apply Magnus lift force");
209 prm.declare_entry(
210 "rotational viscous torque",
211 Patterns::Tools::Convert<bool>::to_string(
213 Patterns::Bool(),
214 "Choose whether or not to apply rotational viscous torque on particles");
215 prm.declare_entry(
216 "vortical viscous torque",
217 Patterns::Tools::Convert<bool>::to_string(
218 defaults.vortical_viscous_torque),
219 Patterns::Bool(),
220 "Choose whether or not to apply vortical viscous torque on particles");
222 prm,
223 "drag model",
224 defaults.drag_model,
225 "The drag model used to determine the drag coefficient.");
227 prm,
228 "dem iteration control",
229 defaults.dem_iteration_control,
230 "The strategy used to control the DEM iterations in CFD-DEM simulations.",
231 deprecated_dem_iteration_control_names);
232 prm.declare_entry("coupling frequency",
233 Patterns::Tools::Convert<unsigned int>::to_string(
234 defaults.coupling_frequency),
235 Patterns::Integer(1),
236 "dem-cfd coupling frequency");
237 prm.declare_entry(
238 "fraction rayleigh time",
239 Patterns::Tools::Convert<double>::to_string(
241 Patterns::Double(0., 1.),
242 "Fraction of Rayleigh time used to control the DEM iterations.");
244 "vans model",
245 defaults.vans_model,
246 "The volume averaged Navier Stokes model to be solved.");
247 prm.declare_entry(
248 "grad-div length scale",
249 Patterns::Tools::Convert<double>::to_string(defaults.cstar),
250 Patterns::Double(),
251 "Constant cs for the calculation of the grad-div stabilization (gamma = kinematic_viscosity + cs * velocity)");
252 prm.declare_entry(
253 "implicit stabilization",
254 Patterns::Tools::Convert<bool>::to_string(
255 defaults.implicit_stabilization),
256 Patterns::Bool(),
257 "Choose whether or not to use implicit or explicit stabilization");
258
259 prm.declare_entry(
260 "particle statistics",
261 Patterns::Tools::Convert<bool>::to_string(defaults.particle_statistics),
262 Patterns::Bool(),
263 "Outputs statistics about the particles such as their total kinetic energy, angular momentum, etc.");
264
266 prm,
267 "drag coupling",
268 defaults.drag_coupling,
269 "Formulation for the drag force. The default value is semi_implicit, which represents the legacy coupling method.",
270 deprecated_drag_coupling_names);
271
272 prm.declare_entry(
273 "project particle forces",
274 Patterns::Tools::Convert<bool>::to_string(
275 defaults.project_particle_forces),
276 Patterns::Bool(),
277 "In the VANS solver, specify whether the two-way coupling forces, including the drag, are calculated by projecting the forces acting on the particles onto the fluid grid using the QCM filter.");
278
279 prm.leave_subsection();
280 }
281
282 void
283 CFDDEM::parse_parameters(ParameterHandler &prm)
284 {
285 prm.enter_subsection("cfd-dem");
286 grad_div = prm.get_bool("grad div");
288 prm.get_bool("void fraction time derivative");
289 interpolated_void_fraction = prm.get_bool("interpolated void fraction");
290 drag_force = prm.get_bool("drag force");
291 buoyancy_force = prm.get_bool("buoyancy force");
292 shear_force = prm.get_bool("shear force");
293 pressure_force = prm.get_bool("pressure force");
294 saffman_lift_force = prm.get_bool("saffman lift force");
295 magnus_lift_force = prm.get_bool("magnus lift force");
296 rotational_viscous_torque = prm.get_bool("rotational viscous torque");
297 vortical_viscous_torque = prm.get_bool("vortical viscous torque");
298 coupling_frequency = prm.get_integer("coupling frequency");
299 fraction_of_rayleigh_time = prm.get_double("fraction rayleigh time");
300 cstar = prm.get_double("grad-div length scale");
301 implicit_stabilization = prm.get_bool("implicit stabilization");
302 particle_statistics = prm.get_bool("particle statistics");
303 project_particle_forces = prm.get_bool("project particle forces");
304
307 prm.get("dem iteration control"),
308 deprecated_dem_iteration_control_names,
309 "dem iteration control");
310
311 drag_model = string_to_enum<Parameters::DragModel>(prm.get("drag model"));
312
314 string_to_enum<Parameters::DragCoupling>(prm.get("drag coupling"),
315 deprecated_drag_coupling_names,
316 "drag coupling");
317
318 vans_model = string_to_enum<Parameters::VANSModel>(prm.get("vans model"));
319 prm.leave_subsection();
320 }
321} // namespace Parameters
322// Pre-compile the 2D and 3D
Parameters controlling the void fraction computation in CFD-DEM simulations.
std::string dem_file_name
File name of the DEM simulation checkpoint.
double l2_smoothing_length
Smoothing length for L2 projection of the void fraction.
VoidFractionMode mode
Void fraction computation method.
bool project_particle_velocity
Project particle velocity onto the fluid mesh.
virtual void parse_parameters(ParameterHandler &prm)
Parse the parameters from the parameter handler.
Functions::ParsedFunction< dim > void_fraction
Analytical void fraction function (used when mode is function).
bool read_dem
Read particle data from a DEM simulation checkpoint.
virtual void declare_parameters(ParameterHandler &prm)
Declare the parameters in the parameter handler.
unsigned int particle_refinement_factor
Refinement factor applied to the particle radius for void fraction.
bool output_qcm
Output QCM quadrature points and filter characteristics.
bool qcm_sphere_equal_cell_volume
Use a sphere volume equal to the cell volume in QCM.
VoidFractionQuadratureRule quadrature_rule
Quadrature rule used for void fraction integration.
unsigned int n_quadrature_points
Number of quadrature points per cell used for void fraction integration.
std::vector< std::pair< std::string, EnumType > > DeprecatedEnumNames
Deprecated strings of an enum parameter, each paired with the enumerator it stands for....
Definition utilities.h:765
EnumType string_to_enum(const std::string &name)
Return the enumerator whose identifier is name, e.g. to parse the value of a parameter entry into its...
Definition utilities.h:734
void declare_enum_entry(ParameterHandler &prm, const std::string &entry_name, const EnumType default_value, const std::string &description, const DeprecatedEnumNames< EnumType > &deprecated_names={}, const std::vector< EnumType > &allowed_values={})
Declare a parameter entry whose value is an enumerator. The default value, the accepted values and th...
Definition utilities.h:888
@ gauss_lobatto
Gauss-Lobatto quadrature rule.
@ qcm
Quadrature centered method.
@ semi_implicit
Semi-implicit drag coupling.
@ fully_implicit
Fully implicit drag coupling.
@ fully_explicit
Explicit drag coupling.
Parameter structures for CFD-DEM coupled simulations.
Parameters for the CFD-DEM coupled solver.
bool grad_div
Enable grad-div stabilization.
bool drag_force
Enable drag force on particles.
bool rotational_viscous_torque
Enable rotational viscous torque on particles.
static void declare_parameters(ParameterHandler &prm)
Declare the parameters in the parameter handler.
bool saffman_lift_force
Enable Saffman lift force on particles.
void parse_parameters(ParameterHandler &prm)
Parse the parameters from the parameter handler.
double cstar
Stabilization constant for the void fraction equation.
bool shear_force
Enable shear force on particles.
bool project_particle_forces
Project particle forces onto the fluid mesh.
bool buoyancy_force
Enable buoyancy force on particles.
bool particle_statistics
Enable output of particle statistics.
bool vortical_viscous_torque
Enable vortical viscous torque on particles.
bool interpolated_void_fraction
Use interpolated void fraction instead of cell-averaged values.
VANSModel vans_model
Volume-Averaged Navier-Stokes model formulation.
bool implicit_stabilization
Enable implicit stabilization of the void fraction.
SubSimulationControlDEM::DEMSubIterationLogic dem_iteration_control
Method used to control the DEM sub iterations.
bool pressure_force
Enable pressure gradient force on particles.
unsigned int coupling_frequency
Frequency of DEM-CFD coupling (in DEM time steps).
DragModel drag_model
Drag model used for particle-fluid interaction.
DragCoupling drag_coupling
Numerical coupling strategy for drag force computation.
bool magnus_lift_force
Enable Magnus lift force on particles.
bool void_fraction_time_derivative
Include the void fraction time derivative in the equations.