Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
parameters.cc
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2019-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4#include <core/parameters.h>
5#include <core/shape.h>
7#include <core/utilities.h>
8
9#include <deal.II/base/exceptions.h>
10
11#include <algorithm>
12
14 PhaseChangeIntervalError,
15 double,
16 double,
17 << "Liquidus temperature : " << arg1
18 << " is not strictly superior to Solidus temperature: " << arg2
19 << " The liquidus temperature specific is below or equal to the solidus temperature."
20 << " The phase change specific heat model requires that T_liquidus>T_solidus.");
21
23 NumberOfFluidsError,
24 int,
25 << "Number of fluids: " << arg1
26 << " is not 1 (single phase simulation) or 2 (CLS/Cahn-Hilliard simulations). This is currently not supported.");
27
28DeclException1(NumberOfSolidsError,
29 int,
30 << "Number of solids: " << arg1
31 << " is larger than 1. This is currently not supported.");
32
33DeclException1(NumberOfUnresolvedDispersedPhasesError,
34 int,
35 << "Number of unresolved dispersed phases: " << arg1
36 << " is larger than 1. This is currently not supported.");
37
38DeclException1(NumberOfMaterialInteractionsError,
39 int,
40 << "Number of material interactions: " << arg1
41 << " is larger than 3. This is currently not supported.");
42
44 OrderOfFluidIDsError,
45 int,
46 int,
47 << "The first fluid's id is " << arg1 << " and the id of the second fluid is "
48 << arg2 << ". The first fluid's id should be lower than the second fluid's.");
49
51 MaterialInteractionTypeError,
52 "Invalid material interaction type. The choices are <fluid_fluid|fluid_solid|fluid_dispersed_phase>.");
53
55 TwoDimensionalLaserError,
56 unsigned int,
57 << "Laser beam orientation in : " << arg1
58 << "-dimensional simulations cannot be defined in the z direction");
59
60DeclException3(MultipleAdaptationSizeError,
61 std::string,
62 unsigned int,
63 unsigned int,
64 << "Error in 'mesh adaptation' : number of '" << arg1 << "' ("
65 << arg2 << ") does not correspond to the number of 'variables' ("
66 << arg3 << ")");
67
68DeclException3(ParameterStrictlyGreaterThanError,
69 std::string,
70 double,
71 double,
72 << "The parameter '" << arg1 << "' is set to: " << arg2
73 << ". However, it should be strictly greater than " << arg3
74 << ".");
75
77 ListSizeIncoherentWithDeclaredNumber,
78 std::string,
79 unsigned int,
80 std::string,
81 unsigned int,
82 << "'" << arg1 << "' was set to " << arg2 << " and the list '" << arg3
83 << "' has a size of " << arg4
84 << ". However, the list size should correspond to the number declared.");
85
86DeclException4(ListsSizeMismatch,
87 std::string,
88 std::string,
89 unsigned int,
90 unsigned int,
91 << "There is a size mismatch between 2 lists. The list '" << arg1
92 << "' and the list '" << arg2 << "' have respectively sizes of "
93 << arg3 << " and " << arg4
94 << ". However, they should be of the same size.");
95
96// DeclException
97
98namespace Parameters
99{
100
103 {
104 static const DeprecatedEnumNames<Verbosity> names = {
105 {"extra verbose", Verbosity::extra_verbose}};
106 return names;
107 }
108
109 const std::vector<Verbosity> &
111 {
112 static const std::vector<Verbosity> values = {Verbosity::quiet,
114 return values;
115 }
116
119 {
120 static const DeprecatedEnumNames<FluidIndicator> names = {
121 {"fluid 0", FluidIndicator::fluid_0},
122 {"fluid 1", FluidIndicator::fluid_1}};
123 return names;
124 }
125
126 const std::vector<FluidIndicator> &
128 {
129 static const std::vector<FluidIndicator> values = {FluidIndicator::fluid_0,
131 return values;
132 }
133
134 SizeOfSubsections
135 get_size_of_subsections(const std::string &file_name,
136 const bool require_subsection_size)
137 {
138 SizeOfSubsections sizes;
139 sizes.boundary_conditions =
140 get_max_subsection_size(file_name, require_subsection_size);
141 sizes.manifolds =
142 get_max_subsection_size(file_name, require_subsection_size);
143 return sizes;
144 }
145
146 namespace
147 {
148 /// Deprecated strings of the "bdf startup method" parameter
150 deprecated_bdf_startup_method_names = {
151 {"multiple step bdf",
153 {"initial solution",
155 } // namespace
156
157 void
159 {
160 const SimulationControl defaults;
161 prm.enter_subsection("simulation control");
162 {
164 "method",
165 defaults.method,
166 "The time integration scheme.");
167
169 prm,
170 "bdf startup method",
171 defaults.bdf_startup_method,
172 "The kind of method used to startup high order bdf methods.",
173 deprecated_bdf_startup_method_names);
174
175 prm.declare_entry("time step",
176 Patterns::Tools::Convert<double>::to_string(
177 defaults.dt),
178 Patterns::Double(),
179 "Time step value");
180 prm.declare_entry(
181 "time end",
182 Patterns::Tools::Convert<double>::to_string(defaults.time_end),
183 Patterns::Double(),
184 "Time value at which a transient simulation ends. Only used when the "
185 "end control is set to time");
186 prm.declare_entry(
187 "iteration end",
188 Patterns::Tools::Convert<unsigned int>::to_string(
189 defaults.iteration_end),
190 Patterns::Integer(0),
191 "Transient iteration number at which a transient simulation ends. "
192 "Only used when the end control is set to iteration");
193 prm.declare_entry("startup time scaling",
194 Patterns::Tools::Convert<double>::to_string(
195 defaults.startup_timestep_scaling),
196 Patterns::Double(),
197 "Scaling factor used in the iterations necessary to "
198 "start-up the BDF schemes.");
199 prm.declare_entry(
200 "adapt time step to respect CFL",
201 Patterns::Tools::Convert<bool>::to_string(defaults.adapt_with_cfl),
202 Patterns::Bool(),
203 "Adapt the time step to respect the maximum CFL condition. When multiple conditions are applied to the time step, this ensures that the CFL condition is also respected (Δt ≤ Δt_{CFL}). <true|false>");
204 prm.declare_entry(
205 "override time step on restart",
206 Patterns::Tools::Convert<bool>::to_string(
208 Patterns::Bool(),
209 "Override checkpointed time step upon restart <true|false>");
210 prm.declare_entry(
211 "time step independent of end time",
212 Patterns::Tools::Convert<bool>::to_string(
214 Patterns::Bool(),
215 "Ensures that the correct time step is kept when using adaptive time step simulations");
216 prm.declare_entry("number mesh adapt",
217 Patterns::Tools::Convert<unsigned int>::to_string(
218 defaults.number_mesh_adaptation),
219 Patterns::Integer(),
220 "Number of mesh adaptation (for steady simulations)");
221 prm.declare_entry("max cfl",
222 Patterns::Tools::Convert<double>::to_string(
223 defaults.maxCFL),
224 Patterns::Double(),
225 "Maximum CFL value");
226 prm.declare_entry("max time step",
227 Patterns::Tools::Convert<double>::to_string(
228 defaults.max_dt),
229 Patterns::Double(),
230 "Maximum time step value");
231 prm.declare_entry(
232 "adapt time step to respect CTR",
233 Patterns::Tools::Convert<bool>::to_string(
235 Patterns::Bool(),
236 "By setting to 'true', it ensures that the imposed maximum capillary time-step ratio (CTR) is respected throughout the simulation (Δt ≤ Δt_{CTR}). <true|false>");
237 prm.declare_entry(
238 "max capillary time-step ratio",
239 Patterns::Tools::Convert<double>::to_string(
241 Patterns::Double(0),
242 "The capillary time-step ratio (CTR) corresponds to the ratio of the time step over capillary time-step constraint (Δt/Δt_σ)");
243 prm.declare_entry("stop tolerance",
244 Patterns::Tools::Convert<double>::to_string(
245 defaults.stop_tolerance),
246 Patterns::Double(),
247 "Tolerance at which the simulation is stopped");
248
249 prm.declare_entry("adaptative time step scaling",
250 Patterns::Tools::Convert<double>::to_string(
252 Patterns::Double(),
253 "Adaptative time step scaling");
254 prm.declare_entry(
255 "output path",
256 defaults.output_folder,
257 Patterns::FileName(),
258 "Path of the folder where the output files are written");
259
260 prm.declare_entry("output name",
261 defaults.output_name,
262 Patterns::FileName(),
263 "File output prefix");
264
265
266 prm.declare_entry("output frequency",
267 Patterns::Tools::Convert<unsigned int>::to_string(
269 Patterns::Integer(),
270 "Output iteration frequency");
271
272 prm.declare_entry("output time frequency",
273 Patterns::Tools::Convert<double>::to_string(
274 defaults.output_time_frequency),
275 Patterns::Double(),
276 "Output time frequency");
277
278 prm.declare_entry(
279 "output boundaries",
280 Patterns::Tools::Convert<bool>::to_string(defaults.output_boundaries),
281 Patterns::Bool(),
282 "Output the boundaries of the domain along with their ID");
283
284 prm.declare_entry("log frequency",
285 Patterns::Tools::Convert<unsigned int>::to_string(
286 defaults.log_frequency),
287 Patterns::Integer(),
288 "log frequency");
289
290 prm.declare_entry("log precision",
291 Patterns::Tools::Convert<unsigned int>::to_string(
292 defaults.log_precision),
293 Patterns::Integer(),
294 "Display precision when writing to log",
295 "This setting percolates to all output to the log");
296
297 prm.declare_entry(
298 "output times",
299 Patterns::Tools::Convert<std::vector<double>>::to_string(
300 defaults.output_times_vector),
301 Patterns::List(Patterns::Double()),
302 "List of specific output times separated with a comma");
303
305 prm,
306 "end control",
307 defaults.end_control,
308 "The control for the end of a transient simulation. The end "
309 "condition is either a maximum time value (time end) or a maximum "
310 "number of transient iterations (iteration end).");
311
313 prm,
314 "output control",
315 defaults.output_control,
316 "The control for the output of the simulation results. "
317 "Results can be either outputted at constant iteration frequency or at constant time.");
318
319 prm.declare_entry(
320 "output time interval",
321 Patterns::Tools::Convert<std::vector<double>>::to_string(
322 defaults.output_time_interval),
323 Patterns::List(Patterns::Double()),
324 "Output files for a desired time interval");
325
326 prm.declare_entry("subdivision",
327 Patterns::Tools::Convert<unsigned int>::to_string(
328 defaults.subdivision),
329 Patterns::Integer(),
330 "Subdivision of mesh cell in postprocessing");
331
332 prm.declare_entry("group files",
333 Patterns::Tools::Convert<unsigned int>::to_string(
334 defaults.group_files),
335 Patterns::Integer(),
336 "Maximal number of vtu output files");
337 }
338 prm.leave_subsection();
339 }
340
341 void
343 {
344 prm.enter_subsection("simulation control");
345 {
346 method = string_to_enum<TimeSteppingMethod>(prm.get("method"));
348 string_to_enum<BDFStartupMethods>(prm.get("bdf startup method"),
349 deprecated_bdf_startup_method_names,
350 "bdf startup method");
351
352 end_control = string_to_enum<EndControl>(prm.get("end control"));
353
354 output_control = string_to_enum<OutputControl>(prm.get("output control"));
355 dt = prm.get_double("time step");
356 time_end = prm.get_double("time end");
357 iteration_end = prm.get_integer("iteration end");
358 adapt_with_cfl = prm.get_bool("adapt time step to respect CFL");
360 prm.get_bool("time step independent of end time");
361 maxCFL = prm.get_double("max cfl");
362 max_dt = prm.get_double("max time step");
364 prm.get_bool("adapt time step to respect CTR");
366 prm.get_double("max capillary time-step ratio");
367 stop_tolerance = prm.get_double("stop tolerance");
369 prm.get_double("adaptative time step scaling");
370 startup_timestep_scaling = prm.get_double("startup time scaling");
371 number_mesh_adaptation = prm.get_integer("number mesh adapt");
373 prm.get_bool("override time step on restart");
374
375 output_folder = prm.get("output path");
376 output_name = prm.get("output name");
377 std::erase(output_name, '/');
378 output_iteration_frequency = prm.get_integer("output frequency");
379 output_time_frequency = prm.get_double("output time frequency");
381 convert_string_to_vector<double>(prm, "output times");
383 convert_string_to_vector<double>(prm, "output time interval");
384 output_boundaries = prm.get_bool("output boundaries");
385
386 subdivision = prm.get_integer("subdivision");
387 group_files = prm.get_integer("group files");
388 log_frequency = prm.get_integer("log frequency");
389 log_precision = prm.get_integer("log precision");
392 }
393 prm.leave_subsection();
394 } // namespace Parameters
395
396 void
397 Timer::declare_parameters(ParameterHandler &prm)
398 {
399 const Timer defaults;
400 prm.enter_subsection("timer");
401 {
403 "type",
404 defaults.type,
405 "Clock monitoring methods.");
406 prm.declare_entry(
407 "write time in error table",
408 Patterns::Tools::Convert<bool>::to_string(
410 Patterns::Bool(),
411 "Boolean to define if the time is written in the error table");
412 }
413 prm.leave_subsection();
414 }
415
416 void
417 Timer::parse_parameters(ParameterHandler &prm)
418 {
419 prm.enter_subsection("timer");
420 {
421 type = string_to_enum<Type>(prm.get("type"));
422 write_time_in_error_table = prm.get_bool("write time in error table");
423 }
424 prm.leave_subsection();
425 }
426
427 void
429 {
430 const PowerLawParameters defaults;
431 prm.enter_subsection("power-law");
432 {
433 prm.declare_entry("K",
434 Patterns::Tools::Convert<double>::to_string(defaults.K),
435 Patterns::Double(),
436 "Fluid consistency index");
437 prm.declare_entry("n",
438 Patterns::Tools::Convert<double>::to_string(defaults.n),
439 Patterns::Double(),
440 "Flow behavior index");
441 prm.declare_entry("shear rate min",
442 Patterns::Tools::Convert<double>::to_string(
443 defaults.shear_rate_min),
444 Patterns::Double(),
445 "Minimal shear rate magnitude");
446 }
447 prm.leave_subsection();
448 }
449
450 void
452 const Dimensionality &dimensions)
453 {
454 prm.enter_subsection("power-law");
455 {
456 K = prm.get_double("K");
457 // K is in L^2 T^-1
458 K *= dimensions.viscosity_scaling;
459
460 // n is dimensionless
461 n = prm.get_double("n");
462
463 // The shear rate min is in T^-1
464 shear_rate_min = prm.get_double("shear rate min");
465 shear_rate_min *= dimensions.time;
466 }
467 prm.leave_subsection();
468 }
469
470 void
472 {
473 const CarreauParameters defaults;
474 prm.enter_subsection("carreau");
475 {
476 prm.declare_entry("viscosity_0",
477 Patterns::Tools::Convert<double>::to_string(
478 defaults.kinematic_viscosity_0),
479 Patterns::Double(),
480 "Kinematic viscosity at rest");
481 prm.declare_entry("viscosity_inf",
482 Patterns::Tools::Convert<double>::to_string(
483 defaults.kinematic_viscosity_inf),
484 Patterns::Double(),
485 "Kinematic viscosity for an infinite shear rate");
486 prm.declare_entry("lambda",
487 Patterns::Tools::Convert<double>::to_string(
488 defaults.lambda),
489 Patterns::Double(),
490 "Relaxation time");
491 prm.declare_entry("a",
492 Patterns::Tools::Convert<double>::to_string(defaults.a),
493 Patterns::Double(),
494 "Carreau parameter");
495 prm.declare_entry("n",
496 Patterns::Tools::Convert<double>::to_string(defaults.n),
497 Patterns::Double(),
498 "Power parameter");
499 }
500 prm.leave_subsection();
501 }
502
503 void
505 const Dimensionality &dimensions)
506 {
507 prm.enter_subsection("carreau");
508 {
509 kinematic_viscosity_0 = prm.get_double("viscosity_0");
510 kinematic_viscosity_inf = prm.get_double("viscosity_inf");
511
512 // Both kinematic viscosities are in L^2 T^-1
515
516 lambda = prm.get_double("lambda");
517
518 // lambda is in T
519 lambda *= 1. / dimensions.time;
520
521 // a and n are dimensionless
522 a = prm.get_double("a");
523 n = prm.get_double("n");
524 }
525 prm.leave_subsection();
526 }
527
528 void
529 NonNewtonian::declare_parameters(ParameterHandler &prm) const
530 {
531 prm.enter_subsection("non newtonian");
532 {
533 powerlaw_parameters.declare_parameters(prm);
534 carreau_parameters.declare_parameters(prm);
535 }
536 prm.leave_subsection();
537 }
538
539 void
540 NonNewtonian::parse_parameters(ParameterHandler &prm,
541 const Dimensionality &dimensions)
542 {
543 prm.enter_subsection("non newtonian");
544 {
545 powerlaw_parameters.parse_parameters(prm, dimensions);
546 carreau_parameters.parse_parameters(prm, dimensions);
547 }
548 prm.leave_subsection();
549 }
550
551
552 void
554 {
555 const ImmersedSolidTanhParameters defaults;
556 prm.enter_subsection("immersed solid tanh");
557 {
558 prm.declare_entry("tracer diffusivity inside",
559 Patterns::Tools::Convert<double>::to_string(
561 Patterns::Double(),
562 "Tracer diffusivity inside the immersed solid");
563 prm.declare_entry("tracer diffusivity outside",
564 Patterns::Tools::Convert<double>::to_string(
566 Patterns::Double(),
567 "Tracer diffusivity outside the immersed solid");
568 prm.declare_entry("tracer reaction constant inside",
569 Patterns::Tools::Convert<double>::to_string(
571 Patterns::Double(),
572 "Tracer reaction constant inside the immersed solid");
573 prm.declare_entry("tracer reaction constant outside",
574 Patterns::Tools::Convert<double>::to_string(
576 Patterns::Double(),
577 "Tracer reaction constant outside the immersed solid");
578 prm.declare_entry("thickness",
579 Patterns::Tools::Convert<double>::to_string(
580 defaults.thickness),
581 Patterns::Double(),
582 "Thickness to be used with the tanh function");
583 }
584 prm.leave_subsection();
585 }
586
587 void
589 ParameterHandler &prm,
590 const Dimensionality &dimensions)
591 {
592 prm.enter_subsection("immersed solid tanh");
593 {
594 tracer_diffusivity_inside = prm.get_double("tracer diffusivity inside");
595 tracer_diffusivity_outside = prm.get_double("tracer diffusivity outside");
597 prm.get_double("tracer reaction constant inside");
599 prm.get_double("tracer reaction constant outside");
600 thickness = prm.get_double("thickness");
601
602 // Diffusivity is in L^2 T^-1
605 }
606 prm.leave_subsection();
607 }
608
609 void
611 {
612 const ImmersedSolidGaussianParameters defaults;
613 prm.enter_subsection("immersed solid gaussian");
614 {
615 prm.declare_entry("tracer diffusivity interface",
616 Patterns::Tools::Convert<double>::to_string(
618 Patterns::Double(),
619 "Tracer diffusivity at the immersed solid interface");
620 prm.declare_entry("tracer diffusivity bulk",
621 Patterns::Tools::Convert<double>::to_string(
622 defaults.tracer_diffusivity_bulk),
623 Patterns::Double(),
624 "Tracer diffusivity in the phase bulk");
625 prm.declare_entry(
626 "tracer reaction constant interface",
627 Patterns::Tools::Convert<double>::to_string(
629 Patterns::Double(),
630 "Tracer reaction constant at the immersed solid interface");
631 prm.declare_entry("tracer reaction constant bulk",
632 Patterns::Tools::Convert<double>::to_string(
634 Patterns::Double(),
635 "Tracer reaction constant in the phase bulk");
636 prm.declare_entry("thickness",
637 Patterns::Tools::Convert<double>::to_string(
638 defaults.thickness),
639 Patterns::Double(),
640 "Thickness to be used with the Gaussian function");
641 }
642 prm.leave_subsection();
643 }
644
645 void
647 ParameterHandler &prm,
648 const Dimensionality &dimensions)
649 {
650 prm.enter_subsection("immersed solid gaussian");
651 {
653 prm.get_double("tracer diffusivity interface");
654 tracer_diffusivity_bulk = prm.get_double("tracer diffusivity bulk");
656 prm.get_double("tracer reaction constant interface");
658 prm.get_double("tracer reaction constant bulk");
659 thickness = prm.get_double("thickness");
660
661 // Diffusivity is in L^2 T^-1
664 }
665 prm.leave_subsection();
666 }
667
668 void
670 {
671 // Dry air's density, specific gas constant and normal temperature
672 // (20 °C, 1 atm) as defaults
674 prm.enter_subsection("isothermal_ideal_gas");
675 {
676 prm.declare_entry(
677 "density_ref",
678 Patterns::Tools::Convert<double>::to_string(defaults.density_ref),
679 Patterns::Double(),
680 "Reference density of the gas in SI units for isothermal ideal gas equation of state in density calculation");
681
682 prm.declare_entry(
683 "R",
684 Patterns::Tools::Convert<double>::to_string(defaults.R),
685 Patterns::Double(),
686 "Specific gas constant in SI units for isothermal ideal gas equation of state in density calculation");
687
688 prm.declare_entry(
689 "T",
690 Patterns::Tools::Convert<double>::to_string(defaults.T),
691 Patterns::Double(),
692 "Absolute temperature of the gas in kelvin (K) for isothermal ideal gas equation of state in density calculation");
693 }
694 prm.leave_subsection();
695 }
696
697 void
699 ParameterHandler &prm,
700 const Dimensionality &dimensions)
701 {
702 prm.enter_subsection("isothermal_ideal_gas");
703 {
704 // Isothermal ideal gas equation of state parameters
705 // The reference state density of the gas (rho_{ref}) is in M L^-3
706 density_ref = prm.get_double("density_ref");
707 density_ref *= dimensions.density_scaling;
708
709 // The specific gas constant (R) is in L^2 T^-2 theta^-1
710 R = prm.get_double("R");
711 R *= dimensions.specific_gas_constant_scaling;
712
713 // The absolute temperature (T) of the ideal gas is in theta^-1
714 T = prm.get_double("T");
715 T *= 1. / dimensions.temperature;
716 }
717 prm.leave_subsection();
718 }
719
720 void
721 SurfaceTensionParameters::declare_parameters(dealii::ParameterHandler &prm)
722 {
723 const SurfaceTensionParameters defaults;
724 prm.declare_entry(
725 "surface tension coefficient",
726 Patterns::Tools::Convert<double>::to_string(
728 Patterns::Double(),
729 "Surface tension coefficient for the corresponding pair of fluids or fluid-solid pair");
730 prm.declare_entry(
731 "reference state temperature",
732 Patterns::Tools::Convert<double>::to_string(defaults.T_0),
733 Patterns::Double(),
734 "Temperature of the reference state corresponding to the surface tension coefficient");
735 prm.declare_entry(
736 "temperature-driven surface tension gradient",
737 Patterns::Tools::Convert<double>::to_string(
738 defaults.surface_tension_gradient),
739 Patterns::Double(),
740 "Surface tension gradient with respect to the temperature for the corresponding pair of fluids or fluid-solid pair");
741 prm.declare_entry(
742 "solidus temperature",
743 Patterns::Tools::Convert<double>::to_string(defaults.T_solidus),
744 Patterns::Double(),
745 "Temperature of the solidus for the corresponding pair of fluids or fluid-solid pair");
746 prm.declare_entry(
747 "liquidus temperature",
748 Patterns::Tools::Convert<double>::to_string(defaults.T_liquidus),
749 Patterns::Double(),
750 "Temperature of the liquidus for the corresponding pair of fluids or fluid-solid pair");
751 }
752
753 void
755 const ParameterHandler &prm,
756 const Parameters::Dimensionality &dimensions)
757 {
758 surface_tension_coefficient = prm.get_double("surface tension coefficient");
760 T_0 = prm.get_double("reference state temperature");
761 T_0 *= 1. / dimensions.temperature;
763 prm.get_double("temperature-driven surface tension gradient");
765 T_solidus = prm.get_double("solidus temperature");
766 T_solidus *= 1. / dimensions.temperature;
767 T_liquidus = prm.get_double("liquidus temperature");
768 T_liquidus *= 1. / dimensions.temperature;
769 Assert(T_liquidus > T_solidus,
770 PhaseChangeIntervalError(T_liquidus, T_solidus));
771 }
772
773 void
775 dealii::ParameterHandler &prm)
776 {
777 const MobilityCahnHilliardParameters defaults;
778 prm.declare_entry(
779 "cahn hilliard mobility constant",
780 Patterns::Tools::Convert<double>::to_string(
782 Patterns::Double(),
783 "Cahn-Hilliard mobility constant for the corresponding pair of fluids");
784 }
785
786 void
788 const ParameterHandler &prm,
789 const Parameters::Dimensionality &dimensions)
790 {
792 prm.get_double("cahn hilliard mobility constant");
795 }
796
797 template <int dim>
798 void
800 dealii::ParameterHandler &prm,
801 const unsigned int max_number_of_constraints)
802 {
803 prm.enter_subsection("constrain stasis");
804 {
805 prm.declare_entry(
806 "enable",
807 Patterns::Tools::Convert<bool>::to_string(this->enable),
808 Patterns::Bool(),
809 "Enable/disable (true/false) the solid domain constraining feature.");
810
811 prm.declare_entry(
812 "enable domain restriction with plane",
813 Patterns::Tools::Convert<bool>::to_string(
815 Patterns::Bool(),
816 "Enable/disable (true/false) the definition of a plane for geometrical\n"
817 " restrictions on the domain where the solid domain constraining feature\n"
818 " is applied.");
819 prm.declare_entry("restriction plane point",
820 Patterns::Tools::Convert<Point<dim>>::to_string(
822 Patterns::List(Patterns::Double()),
823 "Domain restriction plane point coordinates.");
824 prm.declare_entry(
825 "restriction plane normal vector",
826 Patterns::Tools::Convert<Tensor<1, dim>>::to_string(
828 Patterns::List(Patterns::Double()),
829 "Domain restriction plane outward pointing normal vector.");
830
831 prm.declare_entry(
832 "number of constraints",
833 Patterns::Tools::Convert<unsigned int>::to_string(
835 Patterns::Integer(),
836 "Number of solid constraints (maximum of 1 per fluid).");
837
838 // Resize vectors
839 this->fluid_ids.resize(max_number_of_constraints);
841 max_number_of_constraints);
842 this->temperature_min_values.resize(max_number_of_constraints);
843 this->temperature_max_values.resize(max_number_of_constraints);
844
845 // Declare default entries
846 for (unsigned int c_id = 0; c_id < max_number_of_constraints; ++c_id)
847 {
848 prm.enter_subsection("constraint " + std::to_string(c_id));
849 {
851 }
852 prm.leave_subsection();
853 }
854 }
855 prm.leave_subsection();
856 }
857
858 template <int dim>
859 void
861 dealii::ParameterHandler &prm)
862 {
863 prm.declare_entry("fluid id",
864 "0",
865 Patterns::Integer(),
866 "Identifier of the fluid material that is constrained.");
867 prm.declare_entry("phase indicator tolerance",
868 "1e-4",
869 Patterns::Double(),
870 "Absolute filtered phase indicator tolerance used in "
871 "conjunction with CLS simulations to select the cells "
872 "on which the constraint is applied.");
873 prm.declare_entry("min temperature",
874 "-999",
875 Patterns::Double(),
876 "Minimum temperature value of the fluid for it be "
877 "considered as a solid.");
878 prm.declare_entry("max temperature",
879 "0",
880 Patterns::Double(),
881 "Maximum temperature value of the fluid for it be "
882 "considered as a solid.");
883 }
884
885 template <int dim>
886 void
887 ConstrainSolidDomain<dim>::parse_parameters(dealii::ParameterHandler &prm)
888 {
889 prm.enter_subsection("constrain stasis");
890 {
891 this->enable = prm.get_bool("enable");
892
893 // Restriction plane parameters
895 prm.get_bool("enable domain restriction with plane");
897 value_string_to_tensor<dim>(prm.get("restriction plane point"));
899 value_string_to_tensor<dim>(prm.get("restriction plane normal vector"));
900
901 this->number_of_constraints = prm.get_integer("number of constraints");
902
903 // Resize vectors
904 this->fluid_ids.resize(number_of_constraints);
908
909 // Parse parameters for each constraint
910 for (unsigned int c_id = 0; c_id < number_of_constraints; ++c_id)
911 {
912 prm.enter_subsection("constraint " + std::to_string(c_id));
913 {
915 }
916 prm.leave_subsection();
917 }
918 prm.leave_subsection();
919 }
920 }
921
922 template <int dim>
923 void
925 const dealii::ParameterHandler &prm,
926 const unsigned int constraint_id)
927 {
928 this->fluid_ids[constraint_id] = prm.get_integer("fluid id");
929 this->filtered_phase_indicator_tolerance[constraint_id] =
930 prm.get_double("phase indicator tolerance");
931 this->temperature_min_values[constraint_id] =
932 prm.get_double("min temperature");
933 this->temperature_max_values[constraint_id] =
934 prm.get_double("max temperature");
935 }
936
937 void
939 {
940 const Stabilization defaults;
941 prm.enter_subsection("stabilization");
942 {
943 prm.declare_entry(
944 "use default stabilization",
945 Patterns::Tools::Convert<bool>::to_string(
947 Patterns::Bool(),
948 "Use the default stabilization method provided by the solver");
950 prm,
951 "stabilization",
952 defaults.stabilization,
953 "Type of stabilization used for the Navier-Stokes equations.");
954
955 prm.declare_entry(
956 "heat transfer dcdd stabilization",
957 Patterns::Tools::Convert<bool>::to_string(
959 Patterns::Bool(),
960 "Apply Discontinuity-Capturing Directional Dissipation (DCDD) "
961 "stabilization term on heat transfer <true|false>");
962
963 prm.declare_entry(
964 "cls dcdd stabilization",
965 Patterns::Tools::Convert<bool>::to_string(
966 defaults.cls_dcdd_stabilization),
967 Patterns::Bool(),
968 "Apply Discontinuity-Capturing Directional Dissipation (DCDD) "
969 "stabilization term on the CLS phase indicator <true|false>");
970
971 prm.declare_entry(
972 "cls dcdd diffusion factor",
973 Patterns::Tools::Convert<double>::to_string(
974 defaults.dcdd_diffusion_coeff),
975 Patterns::Double(),
976 "Diffusion factor scaling the DCDD stabilization term in the CLS "
977 "equation");
978
979 prm.declare_entry(
980 "pressure scaling factor",
981 Patterns::Tools::Convert<double>::to_string(
982 defaults.pressure_scaling_factor),
983 Patterns::Double(),
984 "This parameter can be used to change the scale of pressure in the "
985 "Navier-Stokes equations. When the velocity and pressure scales are very "
986 "different, using this parameter allows to reduce the condition number"
987 " and reach a solution.");
988
990 prm,
991 "scalar limiter",
992 defaults.scalar_limiter,
993 "Type of scalar limiter. The limiters are only appropriate with the DG versions of the solvers and should only be used for advection-dominated problem.");
994 }
995 prm.leave_subsection();
996 }
997
998 void
999 Stabilization::parse_parameters(ParameterHandler &prm)
1000 {
1001 prm.enter_subsection("stabilization");
1002 {
1003 use_default_stabilization = prm.get_bool("use default stabilization");
1005 string_to_enum<NavierStokesStabilization>(prm.get("stabilization"));
1007 string_to_enum<ScalarLimiters>(prm.get("scalar limiter"));
1008
1009 // DCDD stabilization activation parameters
1011 prm.get_bool("heat transfer dcdd stabilization");
1012 cls_dcdd_stabilization = prm.get_bool("cls dcdd stabilization");
1013 dcdd_diffusion_coeff = prm.get_double("cls dcdd diffusion factor");
1014
1015 pressure_scaling_factor = prm.get_double("pressure scaling factor");
1016 }
1017 prm.leave_subsection();
1018 }
1019
1020 void
1021 PhaseChange::parse_parameters(ParameterHandler &prm,
1022 const Dimensionality &dimensions)
1023 {
1024 prm.enter_subsection("phase change");
1025 {
1026 T_solidus = prm.get_double("solidus temperature");
1027 // T_solidus has units of theta
1028 T_solidus *= 1 / dimensions.temperature;
1029
1030 T_liquidus = prm.get_double("liquidus temperature");
1031 // T_liquidus has units of theta
1032 T_liquidus *= 1 / dimensions.temperature;
1033
1034 latent_enthalpy = prm.get_double("latent enthalpy");
1035 // latent_enthalpy in M L^2 T^-2
1036 latent_enthalpy *= dimensions.enthalpy_scaling;
1037 cp_l = prm.get_double("specific heat liquid");
1038 // cp_l in L^2 theta^-1 T^-2
1039 cp_l *= dimensions.specific_heat_scaling;
1040 cp_s = prm.get_double("specific heat solid");
1041 // cp_s in L^2 theta^-1 T^-2
1042 cp_s *= dimensions.specific_heat_scaling;
1043 kinematic_viscosity_l = prm.get_double("viscosity liquid");
1044 // viscosity_l in L^2 T^-1
1046 kinematic_viscosity_s = prm.get_double("viscosity solid");
1047 // viscosity_l in L^2 T^-1
1049 thermal_conductivity_l = prm.get_double("thermal conductivity liquid");
1050 // thermal_conductivity_l is in M L T^-3 theta ^-1
1052 thermal_conductivity_s = prm.get_double("thermal conductivity solid");
1053 // thermal_conductivity_s is in M L T^-3 theta ^-1
1055 thermal_expansion_l = prm.get_double("thermal expansion liquid");
1056 // thermal_expansion_l is in theta^-1
1058 thermal_expansion_s = prm.get_double("thermal expansion solid");
1059 // thermal_expansion_l is in theta^-1
1061
1062 // Darcy penalty terms
1063 penalty_l = prm.get_double("Darcy penalty liquid");
1064 penalty_s = prm.get_double("Darcy penalty solid");
1065 }
1066
1067 Assert(T_liquidus > T_solidus,
1068 PhaseChangeIntervalError(T_liquidus, T_solidus));
1069
1070 prm.leave_subsection();
1071 }
1072
1073
1074 void
1075 PhaseChange::declare_parameters(ParameterHandler &prm)
1076 {
1077 const PhaseChange defaults;
1078 prm.enter_subsection("phase change");
1079 {
1080 prm.declare_entry("solidus temperature",
1081 Patterns::Tools::Convert<double>::to_string(
1082 defaults.T_solidus),
1083 Patterns::Double(),
1084 "Temperature of the solidus");
1085 prm.declare_entry("liquidus temperature",
1086 Patterns::Tools::Convert<double>::to_string(
1087 defaults.T_liquidus),
1088 Patterns::Double(),
1089 "Temperature of the liquidus");
1090 prm.declare_entry("latent enthalpy",
1091 Patterns::Tools::Convert<double>::to_string(
1092 defaults.latent_enthalpy),
1093 Patterns::Double(),
1094 "Enthalpy of the phase change");
1095
1096 prm.declare_entry("specific heat liquid",
1097 Patterns::Tools::Convert<double>::to_string(
1098 defaults.cp_l),
1099 Patterns::Double(),
1100 "Specific heat of the liquid phase");
1101
1102 prm.declare_entry("specific heat solid",
1103 Patterns::Tools::Convert<double>::to_string(
1104 defaults.cp_s),
1105 Patterns::Double(),
1106 "Specific heat of the solid phase");
1107
1108 prm.declare_entry("thermal conductivity liquid",
1109 Patterns::Tools::Convert<double>::to_string(
1110 defaults.thermal_conductivity_l),
1111 Patterns::Double(),
1112 "Thermal conductivity of the liquid phase");
1113
1114 prm.declare_entry("thermal conductivity solid",
1115 Patterns::Tools::Convert<double>::to_string(
1116 defaults.thermal_conductivity_s),
1117 Patterns::Double(),
1118 "Thermal conductivity of the solid phase");
1119
1120 prm.declare_entry("thermal expansion liquid",
1121 Patterns::Tools::Convert<double>::to_string(
1122 defaults.thermal_expansion_l),
1123 Patterns::Double(),
1124 "Thermal expansion coefficient of the liquid phase");
1125
1126 prm.declare_entry("thermal expansion solid",
1127 Patterns::Tools::Convert<double>::to_string(
1128 defaults.thermal_expansion_s),
1129 Patterns::Double(),
1130 "Thermal expansion coefficient of the solid phase");
1131
1132 prm.declare_entry("viscosity liquid",
1133 Patterns::Tools::Convert<double>::to_string(
1134 defaults.kinematic_viscosity_l),
1135 Patterns::Double(),
1136 "Kinematic viscosity of the liquid phase");
1137
1138 prm.declare_entry("viscosity solid",
1139 Patterns::Tools::Convert<double>::to_string(
1140 defaults.kinematic_viscosity_s),
1141 Patterns::Double(),
1142 "Kinematic viscosity of the solid phase");
1143
1144 prm.declare_entry("Darcy penalty liquid",
1145 Patterns::Tools::Convert<double>::to_string(
1146 defaults.penalty_l),
1147 Patterns::Double(),
1148 "Darcy penalty of the liquid phase");
1149
1150 prm.declare_entry("Darcy penalty solid",
1151 Patterns::Tools::Convert<double>::to_string(
1152 defaults.penalty_s),
1153 Patterns::Double(),
1154 "Darcy penalty of the solid phase");
1155 }
1156 prm.leave_subsection();
1157 }
1158
1159
1160
1161 void
1163 {
1164 fluids.resize(max_fluids);
1165 solids.resize(max_solids);
1168
1169 prm.enter_subsection("physical properties");
1170 {
1171 prm.declare_entry("number of fluids",
1172 Patterns::Tools::Convert<unsigned int>::to_string(
1174 Patterns::Integer(),
1175 "Number of fluids");
1176
1177 // Definition of the fluids in the simulation
1178 for (unsigned int i_fluid = 0; i_fluid < max_fluids; ++i_fluid)
1179 {
1180 fluids[i_fluid].declare_parameters(prm, "fluid", i_fluid);
1181 }
1182
1183 prm.declare_entry("number of solids",
1184 Patterns::Tools::Convert<unsigned int>::to_string(
1186 Patterns::Integer(),
1187 "Number of solids");
1188
1189 // Definition of the solids in the simulation
1190 for (unsigned int i_solid = 0; i_solid < max_solids; ++i_solid)
1191 {
1192 solids[i_solid].declare_parameters(prm, "solid", i_solid);
1193 }
1194
1195 // Definition of the unresolved dispersed phases in the simulation
1196 for (unsigned int i_dispersed_phase = 0;
1197 i_dispersed_phase < max_unresolved_dispersed_phases;
1198 ++i_dispersed_phase)
1199 {
1200 unresolved_dispersed_phases[i_dispersed_phase].declare_parameters(
1201 prm, "unresolved dispersed phase", i_dispersed_phase);
1202 }
1203
1204 prm.declare_entry("number of unresolved dispersed phases",
1205 Patterns::Tools::Convert<unsigned int>::to_string(
1207 Patterns::Integer(),
1208 "Number of unresolved dispersed phases");
1209
1210 prm.declare_entry(
1211 "reference temperature",
1212 Patterns::Tools::Convert<double>::to_string(reference_temperature),
1213 Patterns::Double(),
1214 "Reference temperature used for the calculation of physical properties and thermal expansion");
1215 }
1216
1217 // Definition of interactions between materials
1218 prm.declare_entry(
1219 "number of material interactions",
1220 Patterns::Tools::Convert<unsigned int>::to_string(
1222 Patterns::Integer(),
1223 "Number of material interactions (fluid-fluid, fluid-solid or fluid-dispersed phase)");
1224
1225 for (unsigned int i_material_interaction = 0;
1226 i_material_interaction < max_material_interactions;
1227 ++i_material_interaction)
1228 {
1229 material_interactions[i_material_interaction].declare_parameters(
1230 prm, i_material_interaction);
1231 }
1232
1233 prm.leave_subsection();
1234 }
1235
1236 void
1238 const Dimensionality &dimensions)
1239 {
1240 prm.enter_subsection("physical properties");
1241 {
1242 // Multiphase simulations parameters definition
1243 number_of_fluids = prm.get_integer("number of fluids");
1244 AssertThrow(number_of_fluids <= max_fluids,
1245 NumberOfFluidsError(number_of_fluids));
1246
1247 for (unsigned int i_fluid = 0; i_fluid < number_of_fluids; ++i_fluid)
1248 {
1249 fluids[i_fluid].parse_parameters(prm, "fluid", i_fluid, dimensions);
1250 }
1251
1252 // Multiphase simulations parameters definition
1253 number_of_solids = prm.get_integer("number of solids");
1254 for (unsigned int i_solid = 0; i_solid < number_of_solids; ++i_solid)
1255 {
1256 solids[i_solid].parse_parameters(prm, "solid", i_solid, dimensions);
1257 }
1258 AssertThrow(number_of_solids <= max_solids,
1259 NumberOfSolidsError(number_of_solids));
1260
1262 prm.get_integer("number of unresolved dispersed phases");
1265 NumberOfUnresolvedDispersedPhasesError(
1267 for (unsigned int i_dispersed_phase = 0;
1268 i_dispersed_phase < number_of_unresolved_dispersed_phases;
1269 ++i_dispersed_phase)
1270 {
1271 unresolved_dispersed_phases[i_dispersed_phase].parse_parameters(
1272 prm, "unresolved dispersed phase", i_dispersed_phase, dimensions);
1273 }
1274
1275 // Definition of interactions between materials
1277 prm.get_integer("number of material interactions");
1279 NumberOfMaterialInteractionsError(
1282 for (unsigned int i_material_interaction = 0;
1283 i_material_interaction < number_of_material_interactions;
1284 ++i_material_interaction)
1285 {
1286 material_interactions[i_material_interaction].parse_parameters(
1287 prm, i_material_interaction, dimensions);
1288
1289 // fluid-fluid interactions
1290 if (material_interactions[i_material_interaction]
1291 .material_interaction_type ==
1294 material_interactions[i_material_interaction]
1295 .fluid_fluid_interaction_with_material_interaction_id);
1296
1297 // fluid-solid interactions
1298 else if (material_interactions[i_material_interaction]
1299 .material_interaction_type ==
1302 material_interactions[i_material_interaction]
1303 .fluid_solid_interaction_with_material_interaction_id);
1304
1305 // fluid-dispersed phase interactions
1306 else if (material_interactions[i_material_interaction]
1307 .material_interaction_type ==
1311 .insert(
1312 material_interactions[i_material_interaction]
1313 .fluid_dispersed_phase_interaction_with_material_interaction_id);
1314
1315 else
1316 AssertThrow(false, MaterialInteractionTypeError());
1317 }
1318
1319 reference_temperature = prm.get_double("reference temperature");
1320 }
1321 prm.leave_subsection();
1322 }
1323
1324 namespace
1325 {
1326 /// Deprecated strings of the "rheological model" parameter
1328 deprecated_rheological_model_names = {
1330
1331 /// Deprecated strings of the "tracer diffusivity model" parameter
1333 deprecated_tracer_diffusivity_model_names = {
1334 {"immersed solid tanh",
1336 {"immersed solid gaussian",
1338
1339 /// Deprecated strings of the "tracer reaction constant model" parameter
1341 deprecated_tracer_reaction_prefactor_model_names = {
1342 {"immersed solid tanh",
1344 {"immersed solid gaussian",
1346 } // namespace
1347
1348 void
1349 Material::declare_parameters(ParameterHandler &prm,
1350 const std::string &material_prefix,
1351 const unsigned int id) const
1352 {
1353 prm.enter_subsection(material_prefix + " " +
1354 Utilities::int_to_string(id, 1));
1355 {
1356 prm.declare_entry("density",
1357 Patterns::Tools::Convert<double>::to_string(density),
1358 Patterns::Double(),
1359 "Density for the fluid corresponding to Phase = " +
1360 Utilities::int_to_string(id, 1));
1361 prm.declare_entry(
1362 "kinematic viscosity",
1363 Patterns::Tools::Convert<double>::to_string(kinematic_viscosity),
1364 Patterns::Double(),
1365 "Kinematic viscosity for the fluid corresponding to Phase = " +
1366 Utilities::int_to_string(id, 1));
1367 prm.declare_entry(
1368 "specific heat",
1369 Patterns::Tools::Convert<double>::to_string(specific_heat),
1370 Patterns::Double(),
1371 "Specific heat for the fluid corresponding to Phase = " +
1372 Utilities::int_to_string(id, 1));
1373 prm.declare_entry(
1374 "thermal conductivity",
1375 Patterns::Tools::Convert<double>::to_string(thermal_conductivity),
1376 Patterns::Double(),
1377 "Thermal conductivity for the fluid corresponding to Phase = " +
1378 Utilities::int_to_string(id, 1));
1379 prm.declare_entry(
1380 "thermal expansion",
1381 Patterns::Tools::Convert<double>::to_string(thermal_expansion),
1382 Patterns::Double(),
1383 "Thermal expansion coefficient for the fluid corresponding to Phase = " +
1384 Utilities::int_to_string(id, 1));
1385
1387 prm,
1388 "tracer diffusivity model",
1390 "Model used for the calculation of the tracer diffusivity.",
1391 deprecated_tracer_diffusivity_model_names);
1392
1393 prm.declare_entry(
1394 "tracer diffusivity",
1395 Patterns::Tools::Convert<double>::to_string(tracer_diffusivity),
1396 Patterns::Double(),
1397 "Tracer diffusivity for the fluid corresponding to Phase = " +
1398 Utilities::int_to_string(id, 1));
1399
1401 prm,
1402 "tracer reaction constant model",
1404 "Model used for the calculation of the tracer reaction constant.",
1405 deprecated_tracer_reaction_prefactor_model_names);
1406
1407 prm.declare_entry(
1408 "tracer reaction constant",
1409 Patterns::Tools::Convert<double>::to_string(tracer_reaction_constant),
1410 Patterns::Double(),
1411 "Tracer reaction constant for the fluid corresponding to Phase = " +
1412 Utilities::int_to_string(id, 1));
1413
1414 prm.declare_entry(
1415 "tracer reaction order",
1416 Patterns::Tools::Convert<double>::to_string(tracer_reaction_order),
1417 Patterns::Double(),
1418 "Tracer reaction order for the fluid corresponding to Phase = " +
1419 Utilities::int_to_string(id, 1));
1420
1421 prm.declare_entry(
1422 "tracer reaction threshold",
1423 Patterns::Tools::Convert<double>::to_string(tracer_reaction_threshold),
1424 Patterns::Double(),
1425 "Tracer reaction threshold for the fluid corresponding to Phase = " +
1426 Utilities::int_to_string(id, 1) + ". " +
1427 "Lower values are more realistic but lead to stiffer linear systems when n < 1. ");
1428
1429 // Declaration of the immersed solids models parameters
1430 immersed_solid_tanh_parameters.declare_parameters(prm);
1431 immersed_solid_gaussian_parameters.declare_parameters(prm);
1432
1434 "rheological model",
1436 "Rheological model.",
1437 deprecated_rheological_model_names);
1438
1439 non_newtonian_parameters.declare_parameters(prm);
1440
1441
1443 "density model",
1445 "Model used for the calculation of the density.");
1446
1447 isothermal_ideal_gas_density_parameters.declare_parameters(prm);
1448
1450 prm,
1451 "specific heat model",
1453 "Model used for the calculation of the specific heat.");
1454
1455 phase_change_parameters.declare_parameters(prm);
1456
1458 prm,
1459 "thermal conductivity model",
1461 "Model used for the calculation of the thermal conductivity.");
1462
1464 prm,
1465 "thermal expansion model",
1467 "Model used for the calculation of the thermal expansion coefficient.");
1468
1469 prm.declare_entry("k_A0",
1470 Patterns::Tools::Convert<double>::to_string(k_A0),
1471 Patterns::Double(),
1472 "k_A0 parameter for linear conductivity model");
1473
1474 prm.declare_entry("k_A1",
1475 Patterns::Tools::Convert<double>::to_string(k_A1),
1476 Patterns::Double(),
1477 "k_A1 parameter for linear conductivity model");
1478
1479 // ----------------------------------
1480 // Electromagnetic properties
1481 // ----------------------------------
1483 prm,
1484 "electric conductivity model",
1486 "Model used for the calculation of the electric conductivity.");
1487 prm.declare_entry(
1488 "electric conductivity",
1489 Patterns::Tools::Convert<double>::to_string(electric_conductivity),
1490 Patterns::Double(),
1491 "Electric conductivity for the material corresponding to: " +
1492 material_prefix + " " + Utilities::int_to_string(id, 1));
1493
1494 prm.declare_entry(
1495 "electric conductivity polynomial coefficients",
1496 Patterns::Tools::Convert<std::vector<double>>::to_string(
1498 Patterns::List(Patterns::Double(), 1),
1499 "Coefficients of the polynomial model for the electric conductivity of the material corresponding to: " +
1500 material_prefix + " " + Utilities::int_to_string(id, 1) +
1501 ". The coefficients are given in decreasing order of the polynomial degree and need to be separated by commas.");
1502
1504 prm,
1505 "electric permittivity model",
1507 "Model used for the calculation of the electric permittivity.");
1508 prm.declare_entry(
1509 "electric permittivity real part",
1510 Patterns::Tools::Convert<double>::to_string(electric_permittivity_real),
1511 Patterns::Double(),
1512 "Real part of the electric permittivity for the fluid corresponding to Phase = " +
1513 Utilities::int_to_string(id, 1));
1514 prm.declare_entry(
1515 "electric permittivity imag part",
1516 Patterns::Tools::Convert<double>::to_string(electric_permittivity_imag),
1517 Patterns::Double(),
1518 "Imaginary part of the electric permittivity for the fluid corresponding to Phase = " +
1519 Utilities::int_to_string(id, 1));
1520 prm.declare_entry(
1521 "electric permittivity real part polynomial coefficients",
1522 Patterns::Tools::Convert<std::vector<double>>::to_string(
1524 Patterns::List(Patterns::Double(), 1),
1525 "Coefficients of the polynomial model for the real part of the electric permittivity of the material corresponding to: " +
1526 material_prefix + " " + Utilities::int_to_string(id, 1) +
1527 ". The coefficients are given in decreasing order of the polynomial degree and need to be separated by commas.");
1528
1529 prm.declare_entry(
1530 "electric permittivity imag part polynomial coefficients",
1531 Patterns::Tools::Convert<std::vector<double>>::to_string(
1533 Patterns::List(Patterns::Double(), 1),
1534 "Coefficients of the polynomial model for the imaginary part of the electric permittivity of the material corresponding to: " +
1535 material_prefix + " " + Utilities::int_to_string(id, 1) +
1536 ". The coefficients are given in decreasing order of the polynomial degree and need to be separated by commas.");
1537
1539 prm,
1540 "magnetic permeability model",
1542 "Model used for the calculation of the magnetic permeability.");
1543 prm.declare_entry(
1544 "magnetic permeability real part",
1545 Patterns::Tools::Convert<double>::to_string(magnetic_permeability_real),
1546 Patterns::Double(),
1547 "Real part of the magnetic permeability for the fluid corresponding to Phase = " +
1548 Utilities::int_to_string(id, 1));
1549 prm.declare_entry(
1550 "magnetic permeability imag part",
1551 Patterns::Tools::Convert<double>::to_string(magnetic_permeability_imag),
1552 Patterns::Double(),
1553 "Imaginary part of the magnetic permeability for the fluid corresponding to Phase = " +
1554 Utilities::int_to_string(id, 1));
1555 prm.declare_entry(
1556 "magnetic permeability real part polynomial coefficients",
1557 Patterns::Tools::Convert<std::vector<double>>::to_string(
1559 Patterns::List(Patterns::Double(), 1),
1560 "Coefficients of the polynomial model for the real part of the magnetic permeability of the material corresponding to: " +
1561 material_prefix + " " + Utilities::int_to_string(id, 1) +
1562 ". The coefficients are given in decreasing order of the polynomial degree and need to be separated by commas.");
1563 prm.declare_entry(
1564 "magnetic permeability imag part polynomial coefficients",
1565 Patterns::Tools::Convert<std::vector<double>>::to_string(
1567 Patterns::List(Patterns::Double(), 1),
1568 "Coefficients of the polynomial model for the imaginary part of the magnetic permeability of the material corresponding to: " +
1569 material_prefix + " " + Utilities::int_to_string(id, 1) +
1570 ". The coefficients are given in decreasing order of the polynomial degree and need to be separated by commas.");
1571 }
1572 prm.leave_subsection();
1573 }
1574
1575 void
1576 Material::parse_parameters(ParameterHandler &prm,
1577 const std::string &material_prefix,
1578 const unsigned int id,
1579 const Parameters::Dimensionality &dimensions)
1580 {
1581 prm.enter_subsection(material_prefix + " " +
1582 Utilities::int_to_string(id, 1));
1583 {
1584 //---------------------------------------------------
1585 // Density
1586 //---------------------------------------------------
1587 density_model = string_to_enum<DensityModel>(prm.get("density model"));
1588 density = prm.get_double("density");
1589 // Density is in M L^-3, rescale
1590 density *= dimensions.density_scaling;
1591 isothermal_ideal_gas_density_parameters.parse_parameters(prm, dimensions);
1592
1593 //---------------------------------------------------
1594 // Kinematic viscosity and Rheology
1595 //---------------------------------------------------
1597 string_to_enum<RheologicalModel>(prm.get("rheological model"),
1598 deprecated_rheological_model_names,
1599 "rheological model");
1600
1601 kinematic_viscosity = prm.get_double("kinematic viscosity");
1602 // Kinematic viscosity is in L^2 T^-1, rescale
1604 non_newtonian_parameters.parse_parameters(prm, dimensions);
1605
1606 //--------------
1607 // Specific heat
1608 //--------------
1610 string_to_enum<SpecificHeatModel>(prm.get("specific heat model"));
1611 specific_heat = prm.get_double("specific heat");
1612
1613 // specific heat is in L^2 T^-2 theta^-1
1615
1616
1617 //----------------------
1618 // Thermal conductivity
1619 //----------------------
1621 prm.get("thermal conductivity model"));
1622
1623 thermal_conductivity = prm.get_double("thermal conductivity");
1624 // thermal conductivity is in M L T^-3 theta^-1
1626
1627
1628 // Linear conductivity model parameters
1629 k_A0 = prm.get_double("k_A0");
1630 // k_A0 is in M L T^-3 theta^-1
1631 k_A0 *= dimensions.thermal_conductivity_scaling;
1632
1633 k_A1 = prm.get_double("k_A1");
1634 // k_A1 is in M L T^-3 theta ^-2
1635 k_A1 *= dimensions.thermal_conductivity_scaling * dimensions.temperature;
1636
1637
1638 //------------------
1639 // Thermal expansion
1640 //------------------
1642 prm.get("thermal expansion model"));
1643
1644 thermal_expansion = prm.get_double("thermal expansion");
1645 // thermal expansion is in theta^-1
1646 thermal_expansion *= dimensions.temperature;
1647
1648 //-------------------
1649 // Tracer diffusivity
1650 //-------------------
1652 prm.get("tracer diffusivity model"),
1653 deprecated_tracer_diffusivity_model_names,
1654 "tracer diffusivity model");
1655 tracer_diffusivity = prm.get_double("tracer diffusivity");
1656 // Diffusivity is in L^2 T^-1
1658
1659 //-------------------
1660 // Tracer reaction constant
1661 //-------------------
1664 prm.get("tracer reaction constant model"),
1665 deprecated_tracer_reaction_prefactor_model_names,
1666 "tracer reaction constant model");
1667 tracer_reaction_constant = prm.get_double("tracer reaction constant");
1668 tracer_reaction_order = prm.get_double("tracer reaction order");
1669 tracer_reaction_threshold = prm.get_double("tracer reaction threshold");
1670
1671 // Parsing of the immersed solids models parameters
1672 immersed_solid_tanh_parameters.parse_parameters(prm, dimensions);
1673 immersed_solid_gaussian_parameters.parse_parameters(prm, dimensions);
1674
1675 //--------------------------------
1676 // Phase change properties
1677 //--------------------------------
1678 phase_change_parameters.parse_parameters(prm, dimensions);
1679
1680 //--------------------------------
1681 // Electromagnetic properties
1682 //--------------------------------
1684 prm.get("electric conductivity model"));
1686 {
1687 electric_conductivity = prm.get_double("electric conductivity");
1688 }
1689 else if (electric_conductivity_model ==
1691 {
1694 prm, "electric conductivity polynomial coefficients");
1695 }
1696
1698 prm.get("electric permittivity model"));
1700 {
1702 prm.get_double("electric permittivity real part");
1704 prm.get_double("electric permittivity imag part");
1705 }
1706 else if (electric_permittivity_model ==
1708 {
1711 prm, "electric permittivity real part polynomial coefficients");
1712
1715 prm, "electric permittivity imag part polynomial coefficients");
1716 }
1718 prm.get("magnetic permeability model"));
1720 {
1722 prm.get_double("magnetic permeability real part");
1724 prm.get_double("magnetic permeability imag part");
1725 }
1726 else if (magnetic_permeability_model ==
1728 {
1731 prm, "magnetic permeability real part polynomial coefficients");
1732
1735 prm, "magnetic permeability imag part polynomial coefficients");
1736 }
1737 }
1738 prm.leave_subsection();
1739 }
1740
1741 namespace
1742 {
1743 /// Deprecated strings of the material interaction "type" parameter
1745 deprecated_material_interactions_type_names = {
1746 {"fluid-fluid",
1748 {"fluid-solid",
1750
1751 /// Deprecated strings of the "surface tension model" parameter
1753 deprecated_surface_tension_model_names = {
1754 {"phase change",
1756 } // namespace
1757
1758 void
1760 const unsigned int id) const
1761 {
1762 prm.enter_subsection("material interaction " +
1763 Utilities::int_to_string(id, 1));
1764 {
1766 "type",
1768 "Type of materials interacting.",
1769 deprecated_material_interactions_type_names);
1770
1771 // Fluid-fluid interactions
1772 prm.enter_subsection("fluid-fluid interaction");
1773 {
1774 prm.declare_entry(
1775 "first fluid id",
1776 "0",
1777 Patterns::Integer(),
1778 "ID of the first fluid interacting with the second fluid. This value should be lower than the second fluid's id.");
1779 prm.declare_entry(
1780 "second fluid id",
1781 "1",
1782 Patterns::Integer(),
1783 "ID of the second fluid interacting with the first fluid. This value should be greater than the first fluid's id.");
1784
1785 // Surface tension interactions
1787 prm,
1788 "surface tension model",
1790 "Model used for the calculation of the surface tension coefficient.",
1791 deprecated_surface_tension_model_names);
1792 surface_tension_parameters.declare_parameters(prm);
1793
1794 // Cahn-Hilliard mobility
1796 prm,
1797 "cahn hilliard mobility model",
1799 "Model used for the calculation of the mobility in the Cahn-Hilliard equations.");
1800 mobility_cahn_hilliard_parameters.declare_parameters(prm);
1801 }
1802 prm.leave_subsection();
1803
1804 // Fluid-solid interactions
1805 prm.enter_subsection("fluid-solid interaction");
1806 {
1807 prm.declare_entry("fluid id",
1808 "0",
1809 Patterns::Integer(),
1810 "ID of the fluid interacting with the solid");
1811 prm.declare_entry("solid id",
1812 "0",
1813 Patterns::Integer(),
1814 "ID of the solid interacting with the fluid");
1815
1816 // Surface tension interactions
1818 prm,
1819 "surface tension model",
1821 "Model used for the calculation of the surface tension coefficient.",
1822 deprecated_surface_tension_model_names);
1823 surface_tension_parameters.declare_parameters(prm);
1824
1825 // Cahn-Hilliard mobility
1827 prm,
1828 "cahn hilliard mobility model",
1830 "Model used for the calculation of the mobility in the Cahn-Hilliard equations.");
1831 mobility_cahn_hilliard_parameters.declare_parameters(prm);
1832 }
1833 prm.leave_subsection();
1834
1835 // Fluid-dispersed phase interactions
1836 prm.enter_subsection("fluid-dispersed phase interaction");
1837 {
1838 prm.declare_entry(
1839 "fluid id",
1840 "0",
1841 Patterns::Integer(),
1842 "ID of the fluid hosting the unresolved dispersed phase");
1843 prm.declare_entry(
1844 "dispersed phase id",
1845 "0",
1846 Patterns::Integer(),
1847 "ID of the unresolved dispersed phase mixed with the fluid");
1848
1849 // Effective medium model
1851 prm,
1852 "electric permittivity effective medium model",
1854 "Model used for the calculation of the effective electric properties.");
1856 prm,
1857 "magnetic permeability effective medium model",
1859 "Model used for the calculation of the effective magnetic properties.");
1860 }
1861 prm.leave_subsection();
1862 }
1863 prm.leave_subsection();
1864 }
1865
1866 void
1868 ParameterHandler &prm,
1869 unsigned int id,
1870 const Parameters::Dimensionality &dimensions)
1871 {
1872 prm.enter_subsection("material interaction " +
1873 Utilities::int_to_string(id, 1));
1874 {
1876 prm.get("type"), deprecated_material_interactions_type_names, "type");
1877
1879 {
1880 prm.enter_subsection("fluid-fluid interaction");
1881 {
1882 std::pair<unsigned int, unsigned int> fluid_fluid_interaction;
1883 fluid_fluid_interaction.first = prm.get_integer("first fluid id");
1884 fluid_fluid_interaction.second = prm.get_integer("second fluid id");
1885 AssertThrow(fluid_fluid_interaction.first <=
1886 fluid_fluid_interaction.second,
1887 OrderOfFluidIDsError(fluid_fluid_interaction.first,
1888 fluid_fluid_interaction.second));
1890 fluid_fluid_interaction;
1892
1893 // Surface tension
1895 prm.get("surface tension model"),
1896 deprecated_surface_tension_model_names,
1897 "surface tension model");
1898 surface_tension_parameters.parse_parameters(prm, dimensions);
1899 // Cahn-Hilliard mobility
1902 prm.get("cahn hilliard mobility model"));
1903
1904 mobility_cahn_hilliard_parameters.parse_parameters(prm, dimensions);
1905 }
1906 prm.leave_subsection();
1907 }
1908 else if (material_interaction_type ==
1910 {
1911 prm.enter_subsection("fluid-solid interaction");
1912 std::pair<unsigned int, unsigned int> fluid_solid_interaction;
1913 fluid_solid_interaction.first = prm.get_integer("fluid id");
1914 fluid_solid_interaction.second = prm.get_integer("solid id");
1916 fluid_solid_interaction;
1918
1919 // Surface tension
1921 prm.get("surface tension model"),
1922 deprecated_surface_tension_model_names,
1923 "surface tension model");
1924 surface_tension_parameters.parse_parameters(prm, dimensions);
1925
1926 prm.leave_subsection();
1927 }
1928 else if (material_interaction_type ==
1930 {
1931 prm.enter_subsection("fluid-dispersed phase interaction");
1932 std::pair<unsigned int, unsigned int>
1933 fluid_dispersed_phase_interaction;
1934 fluid_dispersed_phase_interaction.first = prm.get_integer("fluid id");
1935 fluid_dispersed_phase_interaction.second =
1936 prm.get_integer("dispersed phase id");
1938 fluid_dispersed_phase_interaction;
1940 .second = id;
1941
1942 // Effective medium model
1945 prm.get("electric permittivity effective medium model"));
1948 prm.get("magnetic permeability effective medium model"));
1949 prm.leave_subsection();
1950 }
1951 else
1952 {
1953 AssertThrow(false, MaterialInteractionTypeError());
1954 }
1955 }
1956 prm.leave_subsection();
1957 }
1958
1959 void
1960 FEM::declare_parameters(ParameterHandler &prm)
1961 {
1962 const FEM defaults;
1963 prm.enter_subsection("FEM");
1964 {
1965 prm.declare_entry("velocity degree",
1966 Patterns::Tools::Convert<unsigned int>::to_string(
1967 defaults.velocity_degree),
1968 Patterns::Integer(0),
1969 "interpolation degree for velocity");
1970 prm.declare_entry("pressure degree",
1971 Patterns::Tools::Convert<unsigned int>::to_string(
1972 defaults.pressure_degree),
1973 Patterns::Integer(0),
1974 "interpolation degree for pressure");
1975 prm.declare_entry("void fraction degree",
1976 Patterns::Tools::Convert<unsigned int>::to_string(
1977 defaults.void_fraction_degree),
1978 Patterns::Integer(0),
1979 "interpolation degree for void fraction");
1980 prm.declare_entry("temperature degree",
1981 Patterns::Tools::Convert<unsigned int>::to_string(
1982 defaults.temperature_degree),
1983 Patterns::Integer(0),
1984 "interpolation degree for temperature");
1985 prm.declare_entry("tracer degree",
1986 Patterns::Tools::Convert<unsigned int>::to_string(
1987 defaults.tracer_degree),
1988 Patterns::Integer(0),
1989 "interpolation degree for tracer");
1990 prm.declare_entry("cls degree",
1991 Patterns::Tools::Convert<unsigned int>::to_string(
1992 defaults.CLS_degree),
1993 Patterns::Integer(0),
1994 "interpolation degree for cls");
1995 prm.declare_entry(
1996 "phase cahn hilliard degree",
1997 Patterns::Tools::Convert<unsigned int>::to_string(
1999 Patterns::Integer(),
2000 "interpolation degree phase parameter for the Cahn-Hilliard equations");
2001 prm.declare_entry(
2002 "potential cahn hilliard degree",
2003 Patterns::Tools::Convert<unsigned int>::to_string(
2005 Patterns::Integer(),
2006 "interpolation degree chemical potential for the Cahn-Hilliard equations");
2007 prm.declare_entry(
2008 "electromagnetics trial degree",
2009 Patterns::Tools::Convert<unsigned int>::to_string(
2011 Patterns::Integer(),
2012 "interpolation degree for the trial space of the electromagnetics physics (time-harmonic Maxwell equations).");
2013 prm.declare_entry(
2014 "electromagnetics test degree",
2015 Patterns::Tools::Convert<unsigned int>::to_string(
2017 Patterns::Integer(),
2018 "interpolation degree for the test space of the electromagnetics physics (time-harmonic Maxwell equations).");
2019
2020 prm.declare_entry(
2021 "solid velocity degree",
2022 Patterns::Tools::Convert<unsigned int>::to_string(
2023 defaults.solid_velocity_degree),
2024 Patterns::Integer(1),
2025 "interpolation degree of the solid velocity of the Euler-Euler model.");
2026 prm.declare_entry(
2027 "solid volume fraction degree",
2028 Patterns::Tools::Convert<unsigned int>::to_string(
2030 Patterns::Integer(1),
2031 "interpolation degree of the solid volume fraction of the Euler-Euler model.");
2032
2033 prm.declare_entry(
2034 "qmom degree",
2035 Patterns::Tools::Convert<unsigned int>::to_string(defaults.qmom_degree),
2036 Patterns::Integer(0),
2037 "interpolation degree of the discontinuous Galerkin discretization of the scalars and of the moments of the QMOM physics. A degree of 0 corresponds to a finite volume discretization.");
2038
2039 prm.declare_entry(
2040 "tracer uses dg",
2041 Patterns::Tools::Convert<bool>::to_string(defaults.tracer_uses_dg),
2042 Patterns::Bool(),
2043 "Switch tracer to Discontinuous Galerkin (DG) formulation");
2044
2045 prm.declare_entry(
2046 "cls uses dg",
2047 Patterns::Tools::Convert<bool>::to_string(defaults.CLS_uses_dg),
2048 Patterns::Bool(),
2049 "Switch CLS to Discontinuous Galerkin (DG) formulation");
2050
2051 prm.declare_entry(
2052 "enable bubble function velocity",
2053 Patterns::Tools::Convert<bool>::to_string(
2055 Patterns::Bool(),
2056 "Enable bubble enrichment function for the velocity field");
2057
2058 prm.declare_entry(
2059 "enable bubble function pressure",
2060 Patterns::Tools::Convert<bool>::to_string(
2062 Patterns::Bool(),
2063 "Enable bubble enrichment function for the pressure field");
2064 }
2065 prm.leave_subsection();
2066 }
2067
2068 void
2069 FEM::parse_parameters(ParameterHandler &prm)
2070 {
2071 prm.enter_subsection("FEM");
2073 velocity_degree = prm.get_integer("velocity degree");
2074 pressure_degree = prm.get_integer("pressure degree");
2075 void_fraction_degree = prm.get_integer("void fraction degree");
2076 temperature_degree = prm.get_integer("temperature degree");
2077 tracer_degree = prm.get_integer("tracer degree");
2078 tracer_uses_dg = prm.get_bool("tracer uses dg");
2079 CLS_degree = prm.get_integer("cls degree");
2080 CLS_uses_dg = prm.get_bool("cls uses dg");
2082 prm.get_integer("phase cahn hilliard degree");
2084 prm.get_integer("potential cahn hilliard degree");
2086 prm.get_integer("electromagnetics trial degree");
2088 prm.get_integer("electromagnetics test degree");
2090 prm.get_bool("enable bubble function velocity");
2092 prm.get_bool("enable bubble function pressure");
2093 solid_velocity_degree = prm.get_integer("solid velocity degree");
2095 prm.get_integer("solid volume fraction degree");
2096 qmom_degree = prm.get_integer("qmom degree");
2097 }
2098 prm.leave_subsection();
2099 }
2100
2101 void
2102 Forces::declare_parameters(ParameterHandler &prm)
2103 {
2104 const Forces defaults;
2105 prm.enter_subsection("forces");
2106 {
2108 prm,
2109 "verbosity",
2110 defaults.verbosity,
2111 "State whether from the non-linear solver should be printed.",
2114 prm.declare_entry("calculate force",
2115 Patterns::Tools::Convert<bool>::to_string(
2116 defaults.calculate_force),
2117 Patterns::Bool(),
2118 "Enable calculation of force");
2119 prm.declare_entry("calculate torque",
2120 Patterns::Tools::Convert<bool>::to_string(
2121 defaults.calculate_torque),
2122 Patterns::Bool(),
2123 "Enable calculation of torque");
2124 prm.declare_entry("force name",
2125 defaults.force_output_name,
2126 Patterns::FileName(),
2127 "File output force prefix");
2128 prm.declare_entry("torque name",
2129 defaults.torque_output_name,
2130 Patterns::FileName(),
2131 "File output torque prefix");
2132 prm.declare_entry("output precision",
2133 Patterns::Tools::Convert<unsigned int>::to_string(
2134 defaults.output_precision),
2135 Patterns::Integer(),
2136 "Precision of the values outputted.");
2137 prm.declare_entry("calculation frequency",
2138 Patterns::Tools::Convert<unsigned int>::to_string(
2139 defaults.calculation_frequency),
2140 Patterns::Integer(),
2141 "Calculation frequency");
2142 prm.declare_entry("output frequency",
2143 Patterns::Tools::Convert<unsigned int>::to_string(
2144 defaults.output_frequency),
2145 Patterns::Integer(),
2146 "Output frequency");
2147 }
2148 prm.leave_subsection();
2149 }
2150
2151 void
2152 Forces::parse_parameters(ParameterHandler &prm)
2153 {
2154 prm.enter_subsection("forces");
2155 {
2156 verbosity = string_to_enum<Verbosity>(prm.get("verbosity"),
2158 "verbosity");
2159 calculate_force = prm.get_bool("calculate force");
2160 calculate_torque = prm.get_bool("calculate torque");
2161 force_output_name = prm.get("force name");
2162 torque_output_name = prm.get("torque name");
2163 output_precision = prm.get_integer("output precision");
2164 calculation_frequency = prm.get_integer("calculation frequency");
2165 output_frequency = prm.get_integer("output frequency");
2166 }
2167 prm.leave_subsection();
2168 }
2169
2170 void
2172 {
2173 const Laser_FreeSurfaceRadiation defaults;
2174 prm.enter_subsection("free surface radiation");
2175 {
2176 prm.declare_entry(
2177 "enable",
2178 Patterns::Tools::Convert<bool>::to_string(defaults.enable_radiation),
2179 Patterns::Bool(),
2180 "Enable radiation at the free surface (air/metal interface) <true|false>");
2181 prm.declare_entry("Stefan-Boltzmann constant",
2182 Patterns::Tools::Convert<double>::to_string(
2183 defaults.Stefan_Boltzmann_constant),
2184 Patterns::Double(),
2185 "Stefan-Boltzmann constant");
2186 prm.declare_entry("emissivity",
2187 Patterns::Tools::Convert<double>::to_string(
2188 defaults.emissivity),
2189 Patterns::Double(),
2190 "Emissivity of the free surface (air/metal interface)");
2191 prm.declare_entry(
2192 "Tinf",
2193 Patterns::Tools::Convert<double>::to_string(defaults.Tinf),
2194 Patterns::Double(),
2195 "Temperature (Double) of environment for radiation term at the free surface (air/metal interface)");
2196 }
2197 prm.leave_subsection();
2198 }
2199
2200 void
2202 {
2203 prm.enter_subsection("free surface radiation");
2204 {
2205 enable_radiation = prm.get_bool("enable");
2206 Stefan_Boltzmann_constant = prm.get_double("Stefan-Boltzmann constant");
2207 emissivity = prm.get_double("emissivity");
2208 Tinf = prm.get_double("Tinf");
2209 }
2210 prm.leave_subsection();
2211 }
2212
2213 template <int dim>
2214 void
2215 Laser<dim>::declare_parameters(ParameterHandler &prm)
2216 {
2217 prm.enter_subsection("laser parameters");
2218 {
2219 prm.declare_entry("enable",
2220 Patterns::Tools::Convert<bool>::to_string(
2222 Patterns::Bool(),
2223 "Activate laser");
2224 declare_enum_entry(prm, "type", laser_type, "Type of laser model used.");
2225 prm.declare_entry(
2226 "enable angle of incidence dependence",
2227 Patterns::Tools::Convert<bool>::to_string(
2229 Patterns::Bool(),
2230 "Enable the multiplication of the laser heat flux by the cosine of the angle of incidence of the laser with respect to the surface.");
2231 prm.declare_entry("concentration factor",
2232 Patterns::Tools::Convert<double>::to_string(
2234 Patterns::Double(),
2235 "Concentration factor");
2236 prm.declare_entry("power",
2237 Patterns::Tools::Convert<double>::to_string(
2238 laser_power),
2239 Patterns::Double(),
2240 "Laser power");
2241 prm.declare_entry("absorptivity",
2242 Patterns::Tools::Convert<double>::to_string(
2244 Patterns::Double(),
2245 "Laser absorptivity");
2246 prm.declare_entry("penetration depth",
2247 Patterns::Tools::Convert<double>::to_string(
2249 Patterns::Double(),
2250 "Penetration depth");
2251 prm.declare_entry("beam radius",
2252 Patterns::Tools::Convert<double>::to_string(
2253 beam_radius),
2254 Patterns::Double(),
2255 "Laser beam radius");
2256 radiation.declare_parameters(prm);
2257
2258 prm.enter_subsection("path");
2259 laser_scan_path = std::make_shared<Functions::ParsedFunction<dim>>(dim);
2260 laser_scan_path->declare_parameters(prm, dim);
2261 prm.leave_subsection();
2262
2263 prm.declare_entry("start time",
2264 Patterns::Tools::Convert<double>::to_string(start_time),
2265 Patterns::Double(),
2266 "Start time of laser");
2267 prm.declare_entry("end time",
2268 Patterns::Tools::Convert<double>::to_string(end_time),
2269 Patterns::Double(),
2270 "End time of laser");
2271
2272 // Not derived from a member default: the beam orientation token is not
2273 // stored as such, but through beam_orientation_coordinate,
2274 // beam_direction and beam_axis, whose defaults correspond to "z-".
2275 prm.declare_entry("beam orientation",
2276 "z-",
2277 Patterns::Selection("x+|x-|y+|y-|z+|z-"),
2278 "Laser beam orientation "
2279 "Choices are <x+|x-|y+|y-|z+|z->.");
2280
2281 prm.declare_entry(
2282 "beam rotation angle",
2283 Patterns::Tools::Convert<double>::to_string(rotation_angle),
2284 Patterns::Double(),
2285 "Angle of rotation in rad of the beam axis with respect to the axis defined by the beam orientation parameter");
2286
2287 // Always three components, whereas rotation_axis is a Tensor<1, dim>
2288 // (only used in 3D, where its default matches this string).
2289 prm.declare_entry(
2290 "beam rotation axis",
2291 "0.0, 0.0, 1.0",
2292 Patterns::List(Patterns::Double()),
2293 "Axis around which the laser beam is rotated, only used in 3D");
2294 }
2295 prm.leave_subsection();
2296 }
2297
2298 template <int dim>
2299 void
2300 Laser<dim>::parse_parameters(ParameterHandler &prm)
2301 {
2302 prm.enter_subsection("laser parameters");
2303 {
2304 activate_laser = prm.get_bool("enable");
2305 laser_type = string_to_enum<LaserType>(prm.get("type"));
2307 prm.get_bool("enable angle of incidence dependence");
2308 concentration_factor = prm.get_double("concentration factor");
2309 laser_power = prm.get_double("power");
2310 laser_absorptivity = prm.get_double("absorptivity");
2311 penetration_depth = prm.get_double("penetration depth");
2312
2313 // Check if penetration depth is a strictly positive double.
2315 {
2317 penetration_depth > 0.0,
2318 ParameterStrictlyGreaterThanError("penetration depth",
2320 0.0));
2321 }
2322
2323 beam_radius = prm.get_double("beam radius");
2324 radiation.parse_parameters(prm);
2325
2326 prm.enter_subsection("path");
2327 laser_scan_path->parse_parameters(prm);
2328 laser_scan_path->set_time(0);
2329 prm.leave_subsection();
2330
2331 start_time = prm.get_double("start time");
2332 end_time = prm.get_double("end time");
2333
2334 std::string op;
2335 op = prm.get("beam orientation");
2336 if (op == "x+")
2337 {
2338 beam_direction = true;
2341 beam_axis[0] = 1;
2342 beam_axis[1] = 0;
2343 if constexpr (dim == 3)
2344 {
2346 beam_axis[2] = 0;
2347 }
2348 }
2349 else if (op == "x-")
2350 {
2351 beam_direction = false;
2354 beam_axis[0] = -1;
2355 beam_axis[1] = 0;
2356 if constexpr (dim == 3)
2357 {
2359 beam_axis[2] = 0;
2360 }
2361 }
2362 else if (op == "y+")
2363 {
2364 beam_direction = true;
2367 beam_axis[0] = 0;
2368 beam_axis[1] = 1;
2369 if constexpr (dim == 3)
2370 {
2372 beam_axis[2] = 0;
2373 }
2374 }
2375 else if (op == "y-")
2376 {
2377 beam_direction = false;
2380 beam_axis[0] = 0;
2381 beam_axis[1] = -1;
2382 if constexpr (dim == 3)
2383 {
2385 beam_axis[2] = 0;
2386 }
2387 }
2388 else if (op == "z+")
2389 {
2390 if constexpr (dim == 3)
2391 {
2392 beam_direction = true;
2396 beam_axis[0] = 0;
2397 beam_axis[1] = 0;
2398 beam_axis[2] = 1;
2399 }
2400 else if constexpr (dim == 2)
2401 Assert(dim == 2, TwoDimensionalLaserError(dim));
2402 }
2403 else if (op == "z-")
2404 {
2405 if constexpr (dim == 3)
2406 {
2407 beam_direction = false;
2411 beam_axis[0] = 0;
2412 beam_axis[1] = 0;
2413 beam_axis[2] = -1;
2414 }
2415 else if constexpr (dim == 2)
2416 Assert(dim == 2, TwoDimensionalLaserError(dim));
2417 }
2418 // Initial rotation axis and angle
2419 if constexpr (dim == 3)
2421 value_string_to_tensor<dim>(prm.get("beam rotation axis"));
2422
2423 rotation_angle = prm.get_double("beam rotation angle");
2424
2425 if constexpr (dim == 2)
2427 Physics::Transformations::Rotations::rotation_matrix_2d(
2429 if constexpr (dim == 3)
2431 Physics::Transformations::Rotations::rotation_matrix_3d(
2433
2435 }
2436 prm.leave_subsection();
2437 }
2438
2439 namespace
2440 {
2441 /// Variables for which an isocontour bounding box can be monitored
2442 const std::vector<Variable> isocontour_variables = {Variable::temperature,
2444
2445 /// Variables which can be evaluated at a probing point
2446 const std::vector<Variable> probing_point_variables = {
2451 } // namespace
2452
2453 template <int dim>
2454 void
2456 ParameterHandler &prm)
2457 {
2458 prm.enter_subsection("isocontour bounding box");
2459 {
2460 prm.declare_entry("number of isocontour bounding boxes",
2461 Patterns::Tools::Convert<unsigned int>::to_string(
2463 Patterns::Integer(0),
2464 "Number of monitored isocontours");
2465 prm.declare_entry(
2466 "variable",
2468 Patterns::List(Patterns::Selection(
2469 enum_to_selection<Variable>({}, isocontour_variables))),
2470 "Variable(s) of monitored isocontour(s). " +
2471 enum_to_choices<Variable>(isocontour_variables) +
2472 " Each entry corresponds to a different isocontour. "
2473 "When multiple isocontours are defined, the different variables must "
2474 "be separated by commas (e.g., ``set variable = phase, temperature, temperature``) "
2475 "and follow the same order as ``isovalue`` and ``bounding box filename``.");
2476 prm.declare_entry(
2477 "isovalue",
2478 "0.0",
2479 Patterns::List(Patterns::Double()),
2480 "Isovalue(s) of monitored isocontour(s). "
2481 "When multiple isocontours are defined, the different isovalues "
2482 "must be separated by commas (e.g., ``set isovalue = 0.5, 300, 500``) "
2483 "and follow the same order as ``variable`` and ``bounding box filename``.");
2484 prm.declare_entry(
2485 "bounding box filename",
2486 "isocontour_bounding_box",
2487 Patterns::List(Patterns::FileName()),
2488 "Filename(s) for outputted isocontour(s). "
2489 "When multiple isocontours are defined, the different filenames must be "
2490 "separated by commas (e.g., ``set bounding box filename = interface_bounding_box, solidus_bounding_box, liquidus_bounding_box``) "
2491 "and follow the same order as ``variable`` and ``isovalue``.");
2492 }
2493 prm.leave_subsection();
2494 }
2495
2496 template <int dim>
2497 void
2499 ParameterHandler &prm)
2500 {
2501 prm.enter_subsection("isocontour bounding box");
2502 {
2504 prm.get_integer("number of isocontour bounding boxes");
2505
2506 // Get lists and split them into a vector
2507 const std::string variables_list = prm.get("variable");
2508 std::vector<std::string> variables_vec =
2509 Utilities::split_string_list(variables_list);
2510 const std::string isovalue_list = prm.get("isovalue");
2511 std::vector<std::string> isovalue_vec =
2512 Utilities::split_string_list(isovalue_list);
2513 const std::string filename_list = prm.get("bounding box filename");
2514 std::vector<std::string> filename_vec =
2515 Utilities::split_string_list(filename_list);
2516
2517 // Check that sizes are coherent with each other
2519 AssertThrow(variables_vec.size() == number_of_isocontour_bounding_boxes,
2520 ListSizeIncoherentWithDeclaredNumber(
2521 "number of isocontour bounding boxes",
2523 "variable",
2524 variables_vec.size()));
2525 AssertThrow(variables_vec.size() == isovalue_vec.size(),
2526 ListsSizeMismatch("variable",
2527 "isovalue",
2528 variables_vec.size(),
2529 isovalue_vec.size()));
2530 AssertThrow(variables_vec.size() == filename_vec.size(),
2531 ListsSizeMismatch("variable",
2532 "bounding box filename",
2533 variables_vec.size(),
2534 filename_vec.size()));
2535
2537 {
2538 // Build map of isocontours
2539 for (unsigned int i = 0; i < variables_vec.size(); ++i)
2540 {
2541 // Initialize Isocontour
2542 Isocontour isocontour;
2543
2544 // Get isovalue and output filename
2545 isocontour.isovalue =
2546 Utilities::string_to_double(isovalue_vec[i]);
2547 isocontour.output_name = filename_vec[i];
2548
2549 // Parse variables
2551 {string_to_enum<Variable>(variables_vec[i]),
2552 std::make_pair(i, isocontour)});
2553 }
2554 }
2555 }
2556 prm.leave_subsection();
2557 }
2558
2559 template <int dim>
2560 void
2562 {
2563 prm.enter_subsection("probing points");
2564 {
2565 prm.declare_entry("number of probing points",
2566 Patterns::Tools::Convert<unsigned int>::to_string(
2568 Patterns::Integer(0),
2569 "Number of probing points");
2570
2571 const std::string default_point_entry_string =
2572 (dim == 2) ? "0., 0." : "0., 0., 0.";
2573
2574 for (unsigned int i = 0; i < max_number_of_probing_points; ++i)
2575 {
2576 prm.enter_subsection("probe " + Utilities::int_to_string(i));
2577 {
2578 prm.declare_entry(
2579 "location",
2580 default_point_entry_string,
2581 Patterns::List(Patterns::Double(), dim, dim),
2582 "Probe point location in the mesh's reference frame. "
2583 "The different components of the point must be separated by commas (e.g., ``set location = 0.0, 0.0, 0.0``). ");
2584 prm.declare_entry(
2585 "variable",
2587 Patterns::List(Patterns::Selection(
2588 enum_to_selection<Variable>({}, probing_point_variables))),
2589 "Variable(s) evaluated at the probing point. " +
2590 enum_to_choices<Variable>(probing_point_variables) +
2591 " When multiple variables are defined, the different variables must "
2592 "be separated by commas (e.g., ``set variable = velocity, pressure, temperature``).");
2593 prm.declare_entry("probing point filename",
2594 "probe_" + Utilities::int_to_string(i, 2),
2595 Patterns::FileName(),
2596 "Filename for outputted probing point values.");
2597 }
2598 prm.leave_subsection();
2599 }
2600 }
2601 prm.leave_subsection();
2602 }
2603
2604 template <int dim>
2605 void
2607 {
2608 prm.enter_subsection("probing points");
2609 {
2610 number_of_probing_points = prm.get_integer("number of probing points");
2612 ExcMessage(
2613 "The current maximum of probing points allowed is " +
2614 Utilities::int_to_string(max_number_of_probing_points) +
2615 ". Please adjust 'number of probing points'."));
2616
2617 for (unsigned int id = 0; id < number_of_probing_points; ++id)
2618 {
2619 prm.enter_subsection("probe " + Utilities::int_to_string(id));
2620 {
2621 const std::string variables_list = prm.get("variable");
2622 std::vector<std::string> variables_vec =
2623 Utilities::split_string_list(variables_list);
2624
2625 const Point<dim> point(
2626 value_string_to_tensor<dim>(prm.get("location")));
2627
2628 for (const std::string &variable : variables_vec)
2629 {
2631 id,
2632 point);
2633 }
2634
2635 const std::string filename = prm.get("probing point filename");
2636 probing_points_output_names.emplace_back(filename);
2637 }
2638 prm.leave_subsection();
2639 }
2640 }
2641 prm.leave_subsection();
2642 }
2643
2644 template <int dim>
2645 void
2647 {
2648 prm.enter_subsection("post-processing");
2649 {
2651 prm,
2652 "verbosity",
2653 verbosity,
2654 "State whether from the post-processing values should be printed.",
2657
2658 prm.declare_entry(
2659 "calculate kinetic energy",
2660 Patterns::Tools::Convert<bool>::to_string(calculate_kinetic_energy),
2661 Patterns::Bool(),
2662 "Enable calculation of total kinetic energy. The total kinetic "
2663 "energy is calculated from the volumetric integral of the kinetic energy over the domain.");
2664
2665 prm.declare_entry(
2666 "calculate enstrophy",
2667 Patterns::Tools::Convert<bool>::to_string(calculate_enstrophy),
2668 Patterns::Bool(),
2669 "Enable calculation of total enstrophy. The total enstrophy "
2670 "is calculated from the volumetric integral of the enstrophy over the domain.");
2671
2672 prm.declare_entry(
2673 "calculate pressure power",
2674 Patterns::Tools::Convert<bool>::to_string(calculate_pressure_power),
2675 Patterns::Bool(),
2676 "Enable calculation of the pressure power. The pressure power "
2677 "is calculated from the volumetric integral of u.grad(p) over the domain.");
2678
2679 prm.declare_entry(
2680 "calculate viscous dissipation",
2681 Patterns::Tools::Convert<bool>::to_string(
2683 Patterns::Bool(),
2684 "Enable calculation of the viscous dissipation. The viscous dissipation "
2685 "is calculated from the volumetric integral of grad(u).tau over the domain.");
2686
2687 prm.declare_entry("calculate apparent viscosity",
2688 Patterns::Tools::Convert<bool>::to_string(
2690 Patterns::Bool(),
2691 "Enable calculation of apparent viscosity");
2692
2693 prm.declare_entry("calculate average velocities",
2694 Patterns::Tools::Convert<bool>::to_string(
2696 Patterns::Bool(),
2697 "Enable calculation of average velocities.");
2698
2699 prm.declare_entry(
2700 "calculate average temperature and heat flux",
2701 Patterns::Tools::Convert<bool>::to_string(
2703 Patterns::Bool(),
2704 "Enable calculation of time average temperature and time average heat flux");
2705
2706 prm.declare_entry(
2707 "calculate pressure drop",
2708 Patterns::Tools::Convert<bool>::to_string(calculate_pressure_drop),
2709 Patterns::Bool(),
2710 "Enable calculation of pressure drop between two boundaries.");
2711
2712 prm.declare_entry("inlet boundary id",
2713 Patterns::Tools::Convert<unsigned int>::to_string(
2715 Patterns::Integer(),
2716 "Inlet boundary ID for pressure drop calculation");
2717
2718 prm.declare_entry("outlet boundary id",
2719 Patterns::Tools::Convert<unsigned int>::to_string(
2721 Patterns::Integer(),
2722 "Outlet boundary ID for pressure drop calculation");
2723
2724 prm.declare_entry("calculate flow rate",
2725 Patterns::Tools::Convert<bool>::to_string(
2727 Patterns::Bool(),
2728 "Enable calculation of flow rate at boundaries.");
2729
2730 prm.declare_entry(
2731 "calculate tracer flow rate",
2732 Patterns::Tools::Convert<bool>::to_string(calculate_tracer_flow_rate),
2733 Patterns::Bool(),
2734 "Enable calculation of tracer flow rate at boundaries.");
2735
2736 prm.declare_entry(
2737 "initial time for average velocity",
2738 Patterns::Tools::Convert<double>::to_string(
2740 Patterns::Double(),
2741 "Initial time to start calculations for average velocities");
2742
2743 prm.declare_entry(
2744 "initial time for average temperature and heat flux",
2745 Patterns::Tools::Convert<double>::to_string(
2747 Patterns::Double(),
2748 "Initial time to start calculations for average temperature");
2749
2750 prm.declare_entry("kinetic energy name",
2752 Patterns::FileName(),
2753 "File output kinetic energy");
2754
2755 prm.declare_entry("pressure drop name",
2757 Patterns::FileName(),
2758 "File output pressure drop");
2759
2760 prm.declare_entry("flow rate name",
2762 Patterns::FileName(),
2763 "File output volumetric flux");
2764
2765 prm.declare_entry("tracer flow rate name",
2767 Patterns::FileName(),
2768 "Output file name for tracer flow rate");
2769
2770 prm.declare_entry("enstrophy name",
2772 Patterns::FileName(),
2773 "File output enstrophy");
2774
2775 prm.declare_entry("pressure power name",
2777 Patterns::FileName(),
2778 "File output pressure power");
2779
2780 prm.declare_entry("viscous dissipation name",
2782 Patterns::FileName(),
2783 "File output viscous dissipation");
2784
2785 prm.declare_entry("apparent viscosity name",
2787 Patterns::FileName(),
2788 "File output apparent viscosity");
2789
2790 prm.declare_entry("output frequency",
2791 Patterns::Tools::Convert<unsigned int>::to_string(
2793 Patterns::Integer(),
2794 "Output frequency");
2795
2796 prm.declare_entry("calculation frequency",
2797 Patterns::Tools::Convert<unsigned int>::to_string(
2799 Patterns::Integer(),
2800 "Calculation frequency of post-processed quantities.");
2801
2802 prm.declare_entry("calculate tracer statistics",
2803 Patterns::Tools::Convert<bool>::to_string(
2805 Patterns::Bool(),
2806 "Enable calculation of tracer statistics.");
2807
2808 prm.declare_entry("tracer statistics name",
2810 Patterns::FileName(),
2811 "File name output tracer statistics");
2812
2813 prm.declare_entry(
2814 "calculate phase statistics",
2815 Patterns::Tools::Convert<bool>::to_string(calculate_phase_statistics),
2816 Patterns::Bool(),
2817 "Enable calculation of phase statistics: maximum, minimum, average and integral over the domain (Cahn-Hilliard).");
2818
2819 prm.declare_entry("phase statistics name",
2821 Patterns::FileName(),
2822 "File name output phase statistics (Cahn-Hilliard)");
2823
2824 prm.declare_entry("calculate temperature statistics",
2825 Patterns::Tools::Convert<bool>::to_string(
2827 Patterns::Bool(),
2828 "Enable calculation of temperature statistics.");
2829
2830 prm.declare_entry("temperature statistics name",
2832 Patterns::FileName(),
2833 "File name output temperature statistics");
2834
2836 "monitored fluid with phase change",
2838 "Fluid with phase change properties.",
2841
2842 prm.declare_entry(
2843 "calculate algebraic melt volume",
2844 Patterns::Tools::Convert<bool>::to_string(
2846 Patterns::Bool(),
2847 "Enable calculation of the algebraic (phase indicator and liquid fraction weighted) melt volume in the domain. In the case of CLS simulations, the fluid of interest is selected with 'monitored fluid with phase change.'");
2848
2849 prm.declare_entry("algebraic melt volume name",
2851 Patterns::FileName(),
2852 "Filename of the algebraic melt volume output file");
2853
2854 prm.declare_entry(
2855 "calculate geometric melt volume",
2856 Patterns::Tools::Convert<bool>::to_string(
2858 Patterns::Bool(),
2859 "Enable calculation of the geometric melt volume. "
2860 "The melt volume is computed as the volume of fluid over the 'melting temperature'. "
2861 "In the case of CLS simulations, the volume is the geometrical volume within the 'monitored fluid with phase change.'");
2862
2863 prm.declare_entry("geometric melt volume name",
2865 Patterns::FileName(),
2866 "Filename of the geometric melt volume output file");
2867
2868 prm.declare_entry(
2869 "melting temperature",
2870 Patterns::Tools::Convert<double>::to_string(melting_temperature),
2871 Patterns::Double(0),
2872 "Temperature used to define the melting point of the fluid for volume calculation.");
2873
2874 prm.declare_entry("calculate heat flux",
2875 Patterns::Tools::Convert<bool>::to_string(
2877 Patterns::Bool(),
2878 "Enable calculation of heat flux.");
2879
2880 prm.declare_entry("heat flux name",
2882 Patterns::FileName(),
2883 "File name output for the heat flux");
2884
2885
2887 "postprocessed fluid",
2889 "Fluid domain used for thermal postprocesses "
2890 "in the heat equation.",
2892
2893 prm.declare_entry(
2894 "calculate barycenter",
2895 Patterns::Tools::Convert<bool>::to_string(calculate_barycenter),
2896 Patterns::Bool(),
2897 "Enable calculation of the barycenter location and velocity of fluid 1 in CLS and Cahn-Hilliard simulations.");
2898
2899 prm.declare_entry(
2900 "barycenter name",
2902 Patterns::FileName(),
2903 "Name of barycenter information output file in CLS or Cahn-Hilliard simulations");
2904
2905 prm.declare_entry(
2906 "calculate mass conservation",
2907 Patterns::Tools::Convert<bool>::to_string(calculate_mass_conservation),
2908 Patterns::Bool(),
2909 "Enable calculation of the mass and momentum of both fluids in CLS simulations.");
2910
2911 prm.declare_entry(
2912 "mass conservation name",
2914 Patterns::FileName(),
2915 "Name of mass conservation output file in CLS simulations");
2916
2917 prm.declare_entry(
2918 "calculate phase energy",
2919 Patterns::Tools::Convert<bool>::to_string(calculate_phase_energy),
2920 Patterns::Bool(),
2921 "Enable calculation of phase energies, including: total energy, bulk energy, and interface energy");
2922
2923 prm.declare_entry(
2924 "phase energy name",
2926 Patterns::FileName(),
2927 "Name of energy output file in Cahn-Hilliard simulations. The file is stored in the output folder specified in the simulation control subsection");
2928
2929 prm.declare_entry(
2930 "calculate phase volumes",
2931 Patterns::Tools::Convert<bool>::to_string(calculate_phase_volumes),
2932 Patterns::Bool(),
2933 "Enable calculation of total volume each phases in cfd-dem simulation, including: total volume of fluid, and total volume of particles");
2934
2935 prm.declare_entry(
2936 "phase volumes name",
2938 Patterns::FileName(),
2939 "Name of phases volume output file in cfd-dem simulations. The file is stored in the output folder specified in the simulation control subsection");
2940
2941 prm.declare_entry("output qcriterion",
2942 Patterns::Tools::Convert<bool>::to_string(
2944 Patterns::Bool(),
2945 "Enable output of Q-criterion field <true|false>");
2946
2947 prm.declare_entry("output vorticity",
2948 Patterns::Tools::Convert<bool>::to_string(
2950 Patterns::Bool(),
2951 "Enable output of vorticity field <true|false>");
2952
2953 prm.declare_entry(
2954 "output velocity gradient",
2955 Patterns::Tools::Convert<bool>::to_string(output_velocity_gradient),
2956 Patterns::Bool(),
2957 "Enable output of velocity gradient field <true|false>");
2958
2959 isocontour_bounding_boxes.declare_parameters(prm);
2960 probing_points.declare_parameters(prm);
2961 }
2962 prm.leave_subsection();
2963 }
2964
2965 template <int dim>
2966 void
2968 {
2969 prm.enter_subsection("post-processing");
2970 {
2971 verbosity = string_to_enum<Verbosity>(prm.get("verbosity"),
2973 "verbosity");
2974
2975 calculate_kinetic_energy = prm.get_bool("calculate kinetic energy");
2976 calculate_enstrophy = prm.get_bool("calculate enstrophy");
2977 calculate_pressure_power = prm.get_bool("calculate pressure power");
2979 prm.get_bool("calculate viscous dissipation");
2981 prm.get_bool("calculate apparent viscosity");
2983 prm.get_bool("calculate average velocities");
2985 prm.get_bool("calculate average temperature and heat flux");
2986 calculate_pressure_drop = prm.get_bool("calculate pressure drop");
2987 inlet_boundary_id = prm.get_integer("inlet boundary id");
2988 outlet_boundary_id = prm.get_integer("outlet boundary id");
2989 calculate_flow_rate = prm.get_bool("calculate flow rate");
2990 calculate_tracer_flow_rate = prm.get_bool("calculate tracer flow rate");
2992 prm.get_double("initial time for average velocity");
2994 prm.get_double("initial time for average temperature and heat flux");
2995 kinetic_energy_output_name = prm.get("kinetic energy name");
2996 pressure_drop_output_name = prm.get("pressure drop name");
2997 flow_rate_output_name = prm.get("flow rate name");
2998 tracer_flow_rate_output_name = prm.get("tracer flow rate name");
2999 enstrophy_output_name = prm.get("enstrophy name");
3000 pressure_power_output_name = prm.get("pressure power name");
3001 viscous_dissipation_output_name = prm.get("viscous dissipation name");
3002 apparent_viscosity_output_name = prm.get("apparent viscosity name");
3003 output_frequency = prm.get_integer("output frequency");
3004 calculation_frequency = prm.get_integer("calculation frequency");
3005
3006 AssertThrow(
3008 ExcMessage(
3009 "The post-processing 'output frequency' must be a multiple of the 'calculation frequency'."));
3010
3011 calculate_tracer_statistics = prm.get_bool("calculate tracer statistics");
3012 tracer_output_name = prm.get("tracer statistics name");
3013 calculate_phase_statistics = prm.get_bool("calculate phase statistics");
3014 phase_output_name = prm.get("phase statistics name");
3016 prm.get_bool("calculate temperature statistics");
3019 "monitored fluid with phase change"),
3021 "monitored fluid with phase change");
3023 prm.get_bool("calculate algebraic melt volume");
3024 algebraic_melt_volume_output_name = prm.get("algebraic melt volume name");
3026 prm.get_bool("calculate geometric melt volume");
3027 geometric_melt_volume_output_name = prm.get("geometric melt volume name");
3028 melting_temperature = prm.get_double("melting temperature");
3029 temperature_output_name = prm.get("temperature statistics name");
3030 calculate_heat_flux = prm.get_bool("calculate heat flux");
3031 heat_flux_output_name = prm.get("heat flux name");
3032 calculate_barycenter = prm.get_bool("calculate barycenter");
3033 barycenter_output_name = prm.get("barycenter name");
3034 calculate_mass_conservation = prm.get_bool("calculate mass conservation");
3035 mass_conservation_output_name = prm.get("mass conservation name");
3036 calculate_phase_energy = prm.get_bool("calculate phase energy");
3037 phase_energy_output_name = prm.get("phase energy name");
3038 calculate_phase_volumes = prm.get_bool("calculate phase volumes");
3039 phase_volumes_output_name = prm.get("phase volumes name");
3040 output_q_criterion = prm.get_bool("output qcriterion");
3041 output_vorticity = prm.get_bool("output vorticity");
3042 output_velocity_gradient = prm.get_bool("output velocity gradient");
3043
3044 // Viscous dissipative fluid
3046 string_to_enum<FluidIndicator>(prm.get("postprocessed fluid"),
3048 "postprocessed fluid");
3049
3050 isocontour_bounding_boxes.parse_parameters(prm);
3051 probing_points.parse_parameters(prm);
3052 }
3053 prm.leave_subsection();
3054 }
3055
3056 void
3058 const std::string &physics_name)
3059 {
3060 const NonLinearSolver defaults;
3061 prm.enter_subsection("non-linear solver");
3062 {
3063 prm.enter_subsection(physics_name);
3064 {
3066 prm,
3067 "verbosity",
3068 defaults.verbosity,
3069 "State whether the outputs from the non-linear solver should be printed.",
3072
3074 prm,
3075 "solver",
3076 defaults.solver,
3077 "Non-linear solver that will be used."
3078 " The newton solver is a traditional newton solver with "
3079 "an analytical jacobian formulation. The jacobian matrix and the preconditioner "
3080 "are assembled every iteration. In the kinsol_newton method, the nonlinear solver "
3081 "Kinsol from the SUNDIALS library is used. This solver has an internal algorithm "
3082 "that decides whether to reassemble the Jacobian matrix or not.");
3083
3085 prm,
3086 "kinsol strategy",
3087 defaults.kinsol_strategy,
3088 "Strategy that will be used by the kinsol newton solver.");
3089
3090 prm.declare_entry("tolerance",
3091 Patterns::Tools::Convert<double>::to_string(
3092 defaults.tolerance),
3093 Patterns::Double(),
3094 "Newton solver tolerance");
3095 prm.declare_entry("max iterations",
3096 Patterns::Tools::Convert<unsigned int>::to_string(
3097 defaults.max_iterations),
3098 Patterns::Integer(),
3099 "Maximum number of Newton Iterations");
3100
3101 prm.declare_entry(
3102 "step tolerance",
3103 Patterns::Tools::Convert<double>::to_string(defaults.step_tolerance),
3104 Patterns::Double(),
3105 "Newton solver relative tolerance between steps."
3106 " If a newton iteration leads to a residual > step tolerance"
3107 " * previous residual then the theta relaxation"
3108 " is applied until this criteria is satisfied");
3109
3110 prm.declare_entry(
3111 "matrix tolerance",
3112 Patterns::Tools::Convert<double>::to_string(
3113 defaults.matrix_tolerance),
3114 Patterns::Double(),
3115 "This parameter controls the frequency at which the matrix is refreshed in the inexact Newton solvers. "
3116 "If the residual after a newton step < previous residual * matrix tolerance, the matrix is not re-assembled");
3117
3118 prm.declare_entry(
3119 "force rhs calculation",
3120 Patterns::Tools::Convert<bool>::to_string(
3121 defaults.force_rhs_calculation),
3122 Patterns::Bool(),
3123 "This is required if there is a fixed point component to the non-linear "
3124 "solver that is changed at the beginning of every newton iteration. "
3125 "This is notably the case of the sharp edge method. "
3126 "The default value of this parameter is false.");
3127
3128
3129 prm.declare_entry(
3130 "reuse matrix",
3131 Patterns::Tools::Convert<bool>::to_string(defaults.reuse_matrix),
3132 Patterns::Bool(),
3133 "Reuse the last jacobian matrix for the next non-linear problem solution");
3134
3135 prm.declare_entry(
3136 "reuse preconditioner",
3137 Patterns::Tools::Convert<bool>::to_string(
3138 defaults.reuse_preconditioner),
3139 Patterns::Bool(),
3140 "Reuse the last preconditioner for the next non-linear problem solution");
3141
3142 prm.declare_entry(
3143 "abort at convergence failure",
3144 Patterns::Tools::Convert<bool>::to_string(
3146 Patterns::Bool(),
3147 "Aborts Lethe by throwing an exception if non-linear solver convergence has failed");
3148 }
3149 prm.leave_subsection();
3150 }
3151 prm.leave_subsection();
3152 }
3153
3154 void
3156 const std::string &physics_name)
3157 {
3158 prm.enter_subsection("non-linear solver");
3159 {
3160 prm.enter_subsection(physics_name);
3161 {
3162 verbosity = string_to_enum<Verbosity>(prm.get("verbosity"),
3164 "verbosity");
3165
3166 solver = string_to_enum<SolverType>(prm.get("solver"));
3167
3169 string_to_enum<KinsolStrategy>(prm.get("kinsol strategy"));
3170
3171 tolerance = prm.get_double("tolerance");
3172 step_tolerance = prm.get_double("step tolerance");
3173 matrix_tolerance = prm.get_double("matrix tolerance");
3174 max_iterations = prm.get_integer("max iterations");
3175 force_rhs_calculation = prm.get_bool("force rhs calculation");
3176 reuse_matrix = prm.get_bool("reuse matrix");
3177 reuse_preconditioner = prm.get_bool("reuse preconditioner");
3179 prm.get_bool("abort at convergence failure");
3180 }
3181 prm.leave_subsection();
3182 }
3183 prm.leave_subsection();
3184 }
3185
3186 template <int dim, int spacedim>
3187 void
3189 {
3190 const Mesh defaults;
3191 prm.enter_subsection("mesh");
3192 {
3193 declare_enum_entry(prm, "type", defaults.type, "Type of mesh.");
3194
3195 prm.declare_entry("file name",
3196 defaults.file_name,
3197 Patterns::FileName(),
3198 "GMSH file name");
3199
3200 prm.declare_entry("initial refinement",
3201 Patterns::Tools::Convert<unsigned int>::to_string(
3202 defaults.initial_refinement),
3203 Patterns::Integer(),
3204 "Initial refinement of the mesh");
3205
3206 prm.declare_entry(
3207 "initial boundary refinement",
3208 Patterns::Tools::Convert<unsigned int>::to_string(
3210 Patterns::Integer(),
3211 "Initial refinement of the mesh at the boundaries specified by the user");
3212
3213 prm.declare_entry(
3214 "boundaries refined",
3215 "",
3216 Patterns::List(Patterns::Integer()),
3217 "Boundary ids of the boundaries to be initially refined");
3218
3219 prm.declare_entry(
3220 "enable target size",
3221 Patterns::Tools::Convert<bool>::to_string(
3222 defaults.refine_until_target_size),
3223 Patterns::Bool(),
3224 "Enable initial refinement until target size is reached.");
3225
3226 prm.declare_entry(
3227 "simplex",
3228 Patterns::Tools::Convert<bool>::to_string(defaults.simplex),
3229 Patterns::Bool(),
3230 "Indicates that the mesh used is a mesh made of only simplex elements.");
3231
3232 prm.declare_entry(
3233 "check diamond cells",
3234 Patterns::Tools::Convert<bool>::to_string(
3235 defaults.check_for_diamond_cells),
3236 Patterns::Bool(),
3237 "Enables checking the input grid for diamond-shaped cells.");
3238
3239 prm.declare_entry(
3240 "expand particle-wall contact search",
3241 Patterns::Tools::Convert<bool>::to_string(
3243 Patterns::Bool(),
3244 "Enables adding the boundary neighbor cells of boundary cells to the "
3245 "particle-wall contact search list. This feature should only be "
3246 "activated in geometries with concave boundaries. (For example, for "
3247 "particles flow inside a cylinder or sphere). In geometries with "
3248 "convex boundaries, this feature MUST NOT be activated");
3249
3250 prm.declare_entry("target size",
3251 Patterns::Tools::Convert<double>::to_string(
3252 defaults.target_size),
3253 Patterns::Double(),
3254 "Target size of the initial refinement");
3255
3256 prm.declare_entry("grid type", defaults.grid_type);
3257 prm.declare_entry("grid arguments", defaults.grid_arguments);
3258
3259 prm.declare_entry(
3260 "initial translation",
3261 Patterns::Tools::Convert<Tensor<1, spacedim>>::to_string(
3262 defaults.translation),
3263 Patterns::List(Patterns::Double()),
3264 "Component of the desired translation of the mesh at initialization.");
3265
3266 prm.declare_entry(
3267 "initial rotation axis",
3268 Patterns::Tools::Convert<Tensor<1, spacedim>>::to_string(
3269 defaults.rotation_axis),
3270 Patterns::List(Patterns::Double()),
3271 "Component of the desired rotation of the mesh at initialization.\n"
3272 "In 2D, this parameter is not used, and a counter-clockwise rotation around the origin \n "
3273 "of the coordinate system is applied according to the prescribed rotation angle.");
3274
3275 prm.declare_entry(
3276 "initial rotation angle",
3277 Patterns::Tools::Convert<double>::to_string(defaults.rotation_angle),
3278 Patterns::Double(),
3279 "Angle of rotation of the mesh at initialization around the axis in radian");
3280
3281 prm.declare_entry("scale",
3282 Patterns::Tools::Convert<double>::to_string(
3283 defaults.scale),
3284 Patterns::Double(0),
3285 "Scaling factor used for the mesh.");
3286 }
3287 prm.leave_subsection();
3288 }
3289
3290 template <int dim, int spacedim>
3291 void
3293 {
3294 prm.enter_subsection("mesh");
3295 {
3296 type = string_to_enum<Type>(prm.get("type"));
3297
3298 file_name = prm.get("file name");
3299
3300 initial_refinement = prm.get_integer("initial refinement");
3302 prm.get_integer("initial boundary refinement");
3303
3305 convert_string_to_vector<int>(prm, "boundaries refined");
3306
3307 grid_type = prm.get("grid type");
3308 grid_arguments = prm.get("grid arguments");
3309
3310 refine_until_target_size = prm.get_bool("enable target size");
3311 simplex = prm.get_bool("simplex");
3312 check_for_diamond_cells = prm.get_bool("check diamond cells");
3314 prm.get_bool("expand particle-wall contact search");
3315 AssertThrow(
3317 ExcMessage(
3318 "Lethe DEM does not currently support the simultaneous use of the 'check diamond "
3319 "cells' and 'expand particle-wall contact search' options. Please set one of "
3320 "these two options to false."));
3321
3322
3323 target_size = prm.get_double("target size");
3324
3325 // Initial translation
3326 translation =
3327 value_string_to_tensor<spacedim>(prm.get("initial translation"));
3328
3329 // Initial rotation axis and angle
3331 value_string_to_tensor<spacedim>(prm.get("initial rotation axis"));
3332 rotation_angle = prm.get_double("initial rotation angle");
3333
3334 // Scaling factor
3335 scale = prm.get_double("scale");
3336 }
3337 prm.leave_subsection();
3338 }
3339
3340 template <int dim, int spacedim>
3341 void
3343 {
3344 prm.enter_subsection("box refinement");
3345 {
3346 prm.declare_entry("number of refinement boxes",
3347 Patterns::Tools::Convert<unsigned int>::to_string(
3349 Patterns::Integer(0),
3350 "Number of refinement boxes specified");
3351 for (unsigned int i_box = 0; i_box < max_number_of_refinement_boxes;
3352 ++i_box)
3353 {
3354 prm.enter_subsection("box " + Utilities::int_to_string(i_box, 1));
3355 {
3356 (*refinement_boxes_meshes)[i_box].declare_parameters(prm);
3357 prm.declare_entry(
3358 "additional refinement",
3359 "0",
3360 Patterns::Integer(0),
3361 "Additional refinements of the principal mesh within the area delimited by the 'box' mesh.");
3362 }
3363 prm.leave_subsection();
3364 }
3365 }
3366 prm.leave_subsection();
3367 }
3368
3369 template <int dim, int spacedim>
3370 void
3372 {
3373 prm.enter_subsection("box refinement");
3374 {
3376 prm.get_integer("number of refinement boxes");
3377 AssertThrow(
3379 ExcMessage(
3380 "The current implementation limits the number of refinement boxes up to " +
3381 Utilities::int_to_string(max_number_of_refinement_boxes) +
3382 " refinement boxes.\n You have declared " +
3383 Utilities::int_to_string(number_of_refinement_boxes) +
3384 " refinement boxes.\n Please reduce the number of refinement boxes."));
3385
3386 for (unsigned int i_box = 0; i_box < number_of_refinement_boxes; ++i_box)
3387 {
3388 prm.enter_subsection("box " + Utilities::int_to_string(i_box, 1));
3389 {
3390 (*refinement_boxes_meshes)[i_box].parse_parameters(prm);
3392 prm.get_integer("additional refinement");
3393 }
3394 prm.leave_subsection();
3395 }
3396 }
3397 prm.leave_subsection();
3398 }
3399
3400 namespace
3401 {
3402 /// Deprecated strings of the "mg p coarsening type" parameter
3403 const DeprecatedEnumNames<
3404 MGTransferGlobalCoarseningTools::PolynomialCoarseningSequenceType>
3405 deprecated_mg_p_coarsening_type_names = {
3406 {"decrease by one",
3407 MGTransferGlobalCoarseningTools::PolynomialCoarseningSequenceType::
3408 decrease_by_one},
3409 {"go to one",
3410 MGTransferGlobalCoarseningTools::PolynomialCoarseningSequenceType::
3411 go_to_one}};
3412
3413 /// Deprecated strings of the "mg smoother preconditioner type" parameter
3415 deprecated_mg_smoother_preconditioner_type_names = {
3416 {"inverse diagonal",
3418 {"additive schwarz method",
3419 LinearSolver::MultigridSmootherPreconditionerType::
3420 additive_schwarz_method}};
3421 } // namespace
3422
3423 void
3425 const std::string &physics_name)
3426 {
3427 const LinearSolver defaults;
3428 prm.enter_subsection("linear solver");
3429 {
3430 prm.enter_subsection(physics_name);
3431 {
3433 prm,
3434 "verbosity",
3435 defaults.verbosity,
3436 "State whether output from solver runs should be printed.",
3439 prm,
3440 "method",
3441 defaults.solver,
3442 "The iterative solver for the linear system of equations.");
3443
3444 prm.declare_entry(
3445 "rescale residual",
3446 Patterns::Tools::Convert<bool>::to_string(
3448 Patterns::Bool(),
3449 "Rescale the residual by the square root of the volume of the triangulation");
3450 prm.declare_entry("relative residual",
3451 Patterns::Tools::Convert<double>::to_string(
3452 defaults.relative_residual),
3453 Patterns::Double(),
3454 "Linear solver residual");
3455 prm.declare_entry("minimum residual",
3456 Patterns::Tools::Convert<double>::to_string(
3457 defaults.minimum_residual),
3458 Patterns::Double(),
3459 "Linear solver minimum residual");
3460 prm.declare_entry("max iters",
3461 Patterns::Tools::Convert<int>::to_string(
3462 defaults.max_iterations),
3463 Patterns::Integer(),
3464 "Maximum solver iterations");
3465
3466 prm.declare_entry("max krylov vectors",
3467 Patterns::Tools::Convert<int>::to_string(
3468 defaults.max_krylov_vectors),
3469 Patterns::Integer(),
3470 "Maximum number of krylov vectors for GMRES");
3471
3472 prm.declare_entry(
3473 "enable hessians in jacobian",
3474 Patterns::Tools::Convert<bool>::to_string(
3475 defaults.enable_hessians_jacobian),
3476 Patterns::Bool(),
3477 "Turns off the terms involving the hessian in the Jacobian");
3478
3479 prm.declare_entry(
3480 "enable hessians in residual",
3481 Patterns::Tools::Convert<bool>::to_string(
3482 defaults.enable_hessians_residual),
3483 Patterns::Bool(),
3484 "Turns off the terms involving the hessian in the rhs");
3485
3487 "preconditioner",
3488 defaults.preconditioner,
3489 "The preconditioner for the linear solver.");
3490
3491
3492 prm.declare_entry("ilu preconditioner fill",
3493 Patterns::Tools::Convert<unsigned int>::to_string(
3494 defaults.ilu_precond_fill),
3495 Patterns::Integer(0),
3496 "Ilu preconditioner fill");
3497
3498 prm.declare_entry("ilu preconditioner absolute tolerance",
3499 Patterns::Tools::Convert<double>::to_string(
3500 defaults.ilu_precond_atol),
3501 Patterns::Double(),
3502 "Ilu preconditioner tolerance");
3503
3504 prm.declare_entry("ilu preconditioner relative tolerance",
3505 Patterns::Tools::Convert<double>::to_string(
3506 defaults.ilu_precond_rtol),
3507 Patterns::Double(),
3508 "Ilu relative tolerance");
3509
3510 prm.declare_entry("amg preconditioner ilu fill",
3511 Patterns::Tools::Convert<unsigned int>::to_string(
3512 defaults.amg_precond_ilu_fill),
3513 Patterns::Integer(0),
3514 "amg preconditioner ilu smoother fill");
3515
3516 prm.declare_entry("amg preconditioner ilu absolute tolerance",
3517 Patterns::Tools::Convert<double>::to_string(
3518 defaults.amg_precond_ilu_atol),
3519 Patterns::Double(),
3520 "amg preconditioner ilu smoother absolute tolerance");
3521
3522 prm.declare_entry("amg preconditioner ilu relative tolerance",
3523 Patterns::Tools::Convert<double>::to_string(
3524 defaults.amg_precond_ilu_rtol),
3525 Patterns::Double(),
3526 "amg preconditioner ilu smoother relative tolerance");
3527
3528 prm.declare_entry("amg aggregation threshold",
3529 Patterns::Tools::Convert<double>::to_string(
3530 defaults.amg_aggregation_threshold),
3531 Patterns::Double(),
3532 "amg aggregation threshold");
3533 prm.declare_entry("amg n cycles",
3534 Patterns::Tools::Convert<unsigned int>::to_string(
3535 defaults.amg_n_cycles),
3536 Patterns::Integer(),
3537 "amg number of cycles");
3538 prm.declare_entry("amg w cycles",
3539 Patterns::Tools::Convert<bool>::to_string(
3540 defaults.amg_w_cycles),
3541 Patterns::Bool(),
3542 "amg w cycling. If this is set to true, W cycling is "
3543 "used. Otherwise, V cycling is used.");
3544 prm.declare_entry("amg smoother sweeps",
3545 Patterns::Tools::Convert<unsigned int>::to_string(
3546 defaults.amg_smoother_sweeps),
3547 Patterns::Integer(),
3548 "amg smoother sweeps");
3549 prm.declare_entry("amg smoother overlap",
3550 Patterns::Tools::Convert<unsigned int>::to_string(
3551 defaults.amg_smoother_overlap),
3552 Patterns::Integer(),
3553 "amg smoother overlap");
3554 prm.declare_entry(
3555 "force linear solver continuation",
3556 Patterns::Tools::Convert<bool>::to_string(
3558 Patterns::Bool(),
3559 "A boolean that will force the linear solver to continue even if it fails");
3560
3561 prm.declare_entry("mg min level",
3562 Patterns::Tools::Convert<int>::to_string(
3563 defaults.mg_min_level),
3564 Patterns::Integer(),
3565 "mg min level");
3566
3567 prm.declare_entry("mg level min cells",
3568 Patterns::Tools::Convert<int>::to_string(
3569 defaults.mg_level_min_cells),
3570 Patterns::Integer(),
3571 "mg minimum number of cells for coarse level");
3572
3573 prm.declare_entry("mg int level",
3574 Patterns::Tools::Convert<int>::to_string(
3575 defaults.mg_int_level),
3576 Patterns::Integer(),
3577 "mg int level");
3578
3579 prm.declare_entry(
3580 "mg enable hessians in jacobian",
3581 Patterns::Tools::Convert<bool>::to_string(
3583 Patterns::Bool(),
3584 "Turns off the terms involving the hessian in the Jacobian of mg operators");
3585
3586 prm.declare_entry("mg smoother iterations",
3587 Patterns::Tools::Convert<int>::to_string(
3588 defaults.mg_smoother_iterations),
3589 Patterns::Integer(),
3590 "mg smoother iterations for lsmg or gcmg");
3591
3592 prm.declare_entry("mg smoother relaxation",
3593 Patterns::Tools::Convert<double>::to_string(
3594 defaults.mg_smoother_relaxation),
3595 Patterns::Double(),
3596 "mg smoother relaxation for lsmg or gcmg");
3597
3599 "mg smoother preconditioner type",
3601 "Preconditioner of smoother.",
3602 deprecated_mg_smoother_preconditioner_type_names);
3603
3604 prm.declare_entry("mg smoother chebyshev degree",
3605 Patterns::Tools::Convert<unsigned int>::to_string(
3607 Patterns::Integer(0),
3608 "polynomial degree of the Chebyshev smoother");
3609
3610 prm.declare_entry(
3611 "mg smoother chebyshev smoothing range",
3612 Patterns::Tools::Convert<double>::to_string(
3614 Patterns::Double(1.0),
3615 "smoothing range (lambda_max/lambda_min) of the Chebyshev smoother");
3616
3617 prm.declare_entry(
3618 "mg smoother chebyshev eig cg n iterations",
3619 Patterns::Tools::Convert<unsigned int>::to_string(
3621 Patterns::Integer(1),
3622 "cg/Lanczos iterations to estimate the maximum eigenvalue for the "
3623 "Chebyshev smoother");
3624
3625 prm.declare_entry("mg smoother eig estimation",
3626 Patterns::Tools::Convert<bool>::to_string(
3628 Patterns::Bool(),
3629 "estimate eigenvalues for relaxation parameter");
3630
3631 prm.declare_entry("eig estimation smoothing range",
3632 Patterns::Tools::Convert<double>::to_string(
3634 Patterns::Double(),
3635 "sets range between largest and smallest eig");
3636
3637 prm.declare_entry("eig estimation cg n iterations",
3638 Patterns::Tools::Convert<int>::to_string(
3640 Patterns::Integer(),
3641 "cg iterations performed to find eigenvalue");
3642
3644 prm,
3645 "eig estimation verbosity",
3646 defaults.eig_estimation_verbose,
3647 "State whether MG should print max and min eigenvalue.",
3650
3652 "mg coarse grid solver",
3653 defaults.mg_coarse_grid_solver,
3654 "The coarse grid solver for lsmg or gcmg.");
3655
3656 prm.declare_entry(
3657 "mg coarse grid use fe q iso q1",
3658 Patterns::Tools::Convert<bool>::to_string(
3659 defaults.mg_use_fe_q_iso_q1),
3660 Patterns::Bool(),
3661 "use elements with linear interpolation for coarse grid");
3662
3664 "mg coarsening type",
3665 defaults.mg_coarsening_type,
3666 "mg coarsening type for gcmg.");
3667
3669 "mg p coarsening type",
3670 defaults.mg_p_coarsening_type,
3671 "mg p coarsening type for gcmg.",
3672 deprecated_mg_p_coarsening_type_names);
3673
3674 prm.declare_entry("mg p min coarsening degree",
3675 Patterns::Tools::Convert<unsigned int>::to_string(
3677 Patterns::Integer(),
3678 "mg p minimum coarsening degree for gcmg");
3679
3680 prm.declare_entry("mg gmres max iterations",
3681 Patterns::Tools::Convert<int>::to_string(
3682 defaults.mg_gmres_max_iterations),
3683 Patterns::Integer(),
3684 "mg gmres iterations for lsmg or gcmg");
3685
3686 prm.declare_entry("mg gmres tolerance",
3687 Patterns::Tools::Convert<double>::to_string(
3688 defaults.mg_gmres_tolerance),
3689 Patterns::Double(),
3690 "mg gmres tolerance n for lsmg or gcmg");
3691
3692 prm.declare_entry("mg gmres reduce",
3693 Patterns::Tools::Convert<double>::to_string(
3694 defaults.mg_gmres_reduce),
3695 Patterns::Double(),
3696 "mg gmres reduce for lsmg or gcmg");
3697
3698 prm.declare_entry("mg gmres max krylov vectors",
3699 Patterns::Tools::Convert<int>::to_string(
3701 Patterns::Integer(),
3702 "mg gmres max krylov vectors for lsmg or gcmg");
3703
3705 "mg gmres preconditioner",
3706 defaults.mg_gmres_preconditioner,
3707 "The preconditioner for the mg gmres solver.",
3708 {},
3709 {PreconditionerType::amg, PreconditionerType::ilu});
3710
3711 prm.declare_entry("mg amg use default parameters",
3712 Patterns::Tools::Convert<bool>::to_string(
3714 Patterns::Bool(),
3715 "Use default parameters for Trilinos AMG");
3716
3718 prm,
3719 "mg verbosity",
3720 defaults.mg_verbosity,
3721 "State whether LSMG or GCMG should print information about levels.",
3723 }
3724 prm.leave_subsection();
3725 }
3726 prm.leave_subsection();
3727 }
3728 void
3729 LinearSolver::parse_parameters(ParameterHandler &prm,
3730 const std::string &physics_name)
3731 {
3732 prm.enter_subsection("linear solver");
3733 {
3734 prm.enter_subsection(physics_name);
3735 {
3736 solver = string_to_enum<SolverType>(prm.get("method"));
3737
3738 verbosity = string_to_enum<Verbosity>(prm.get("verbosity"),
3740 "verbosity");
3741
3742 rescale_residual_by_volume = prm.get_bool("rescale residual");
3743 relative_residual = prm.get_double("relative residual");
3744 minimum_residual = prm.get_double("minimum residual");
3745 max_iterations = prm.get_integer("max iters");
3746 max_krylov_vectors = prm.get_integer("max krylov vectors");
3747 enable_hessians_jacobian = prm.get_bool("enable hessians in jacobian");
3748 enable_hessians_residual = prm.get_bool("enable hessians in residual");
3749
3751 ExcNotImplemented());
3752
3754 string_to_enum<PreconditionerType>(prm.get("preconditioner"));
3755
3756
3757 ilu_precond_fill = prm.get_integer("ilu preconditioner fill");
3759 prm.get_double("ilu preconditioner absolute tolerance");
3761 prm.get_double("ilu preconditioner relative tolerance");
3762
3763 amg_precond_ilu_fill = prm.get_integer("amg preconditioner ilu fill");
3765 prm.get_double("amg preconditioner ilu absolute tolerance");
3767 prm.get_double("amg preconditioner ilu relative tolerance");
3768 amg_aggregation_threshold = prm.get_double("amg aggregation threshold");
3769 amg_n_cycles = prm.get_integer("amg n cycles");
3770 amg_w_cycles = prm.get_bool("amg w cycles");
3771 amg_smoother_sweeps = prm.get_integer("amg smoother sweeps");
3772 amg_smoother_overlap = prm.get_integer("amg smoother overlap");
3773
3775 prm.get_bool("force linear solver continuation");
3776
3777 mg_min_level = prm.get_integer("mg min level");
3778 mg_level_min_cells = prm.get_integer("mg level min cells");
3779 mg_int_level = prm.get_integer("mg int level");
3781 prm.get_bool("mg enable hessians in jacobian");
3783 ExcNotImplemented());
3784
3785 mg_smoother_iterations = prm.get_integer("mg smoother iterations");
3786 mg_smoother_relaxation = prm.get_double("mg smoother relaxation");
3787
3790 prm.get("mg smoother preconditioner type"),
3791 deprecated_mg_smoother_preconditioner_type_names,
3792 "mg smoother preconditioner type");
3793
3795 prm.get_integer("mg smoother chebyshev degree");
3797 prm.get_double("mg smoother chebyshev smoothing range");
3799 prm.get_integer("mg smoother chebyshev eig cg n iterations");
3800
3801 mg_smoother_eig_estimation = prm.get_bool("mg smoother eig estimation");
3803 prm.get_double("eig estimation smoothing range");
3805 prm.get_integer("eig estimation cg n iterations");
3806
3808 string_to_enum<Verbosity>(prm.get("eig estimation verbosity"),
3810 "eig estimation verbosity");
3811
3813 prm.get("mg coarse grid solver"));
3814
3815 mg_use_fe_q_iso_q1 = prm.get_bool("mg coarse grid use fe q iso q1");
3816
3817 this->mg_coarsening_type =
3819 prm.get("mg coarsening type"));
3820
3822 MGTransferGlobalCoarseningTools::PolynomialCoarseningSequenceType>(
3823 prm.get("mg p coarsening type"),
3824 deprecated_mg_p_coarsening_type_names,
3825 "mg p coarsening type");
3826
3828 prm.get_integer("mg p min coarsening degree");
3829
3830 AssertThrow((!mg_use_fe_q_iso_q1) ||
3831 (this->mg_coarsening_type ==
3833 ExcNotImplemented());
3834
3835 AssertThrow(
3839 ExcNotImplemented());
3840
3841 mg_gmres_max_iterations = prm.get_integer("mg gmres max iterations");
3842 mg_gmres_tolerance = prm.get_double("mg gmres tolerance");
3843 mg_gmres_reduce = prm.get_double("mg gmres reduce");
3845 prm.get_integer("mg gmres max krylov vectors");
3846
3848 prm.get("mg gmres preconditioner"));
3849
3851 prm.get_bool("mg amg use default parameters");
3852
3853 mg_verbosity = string_to_enum<Verbosity>(prm.get("mg verbosity"),
3855 "mg verbosity");
3856 }
3857 prm.leave_subsection();
3858 }
3859 prm.leave_subsection();
3860 }
3861
3862 namespace
3863 {
3864 /// Deprecated strings of the mesh adaptation "variable" parameter
3865 const DeprecatedEnumNames<Variable> deprecated_adaptation_variable_names = {
3866 {"electric field", Variable::electric_field},
3867 {"magnetic field", Variable::magnetic_field},
3868 {"electromagnetic fields", Variable::electromagnetic_fields}};
3869 } // namespace
3870
3871 void
3873 {
3874 const MeshAdaptation defaults;
3875 const MultipleAdaptationParameters variable_defaults;
3876 prm.enter_subsection("mesh adaptation");
3877 {
3878 prm.declare_entry("initial refinement steps",
3879 Patterns::Tools::Convert<unsigned int>::to_string(
3880 defaults.initial_refinement),
3881 Patterns::Integer(),
3882 "Number of pre-solve adaptive mesh refinement steps");
3883
3885 "type",
3886 defaults.type,
3887 "Type of mesh adaptation.");
3888
3889 prm.declare_entry(
3890 "error estimator",
3891 enum_to_string(variable_defaults.error_estimator),
3892 Patterns::List(Patterns::Selection(
3894 "Error estimator for adaptive mesh refinement. For multi-variables refinement, separate the different strategies with a comma. They should follow the same order as what is specified in the variable parameter. " +
3896
3897 prm.declare_entry(
3898 "fraction refinement",
3899 Patterns::Tools::Convert<double>::to_string(
3900 variable_defaults.refinement_fraction),
3901 Patterns::List(Patterns::Double()),
3902 "Fraction of refined elements. "
3903 "For multi-variables refinement, separate the different fractions with a comma "
3904 "(ex/ 'set fraction refinement = 0.1,0.1')");
3905
3906 prm.declare_entry(
3907 "fraction coarsening",
3908 Patterns::Tools::Convert<double>::to_string(
3909 variable_defaults.coarsening_fraction),
3910 Patterns::List(Patterns::Double()),
3911 "Fraction of coarsened elements. "
3912 "For multi-variables refinement, separate the different fractions with a comma "
3913 "(ex/ 'set fraction coarsening = 0.05,0.05')");
3914
3915 prm.declare_entry(
3916 "variable",
3918 Patterns::List(Patterns::Selection(
3919 enum_to_selection<Variable>(deprecated_adaptation_variable_names))),
3920 "Variable(s) for error estimation. " + enum_to_choices<Variable>() +
3921 " For multi-variables refinement, separate the different variables with a comma "
3922 "(ex/ 'set variable = velocity,temperature')");
3923
3925 prm,
3926 "fraction type",
3927 defaults.fractionType,
3928 "How the fraction of refinement/coarsening are interpreted.");
3929 prm.declare_entry("max number elements",
3930 Patterns::Tools::Convert<unsigned int>::to_string(
3931 defaults.maximum_number_elements),
3932 Patterns::Integer(),
3933 "Maximum number of elements");
3934 prm.declare_entry("max refinement level",
3935 Patterns::Tools::Convert<unsigned int>::to_string(
3936 defaults.maximum_refinement_level),
3937 Patterns::Integer(),
3938 "Maximum refinement level");
3939 prm.declare_entry("min refinement level",
3940 Patterns::Tools::Convert<unsigned int>::to_string(
3941 defaults.minimum_refinement_level),
3942 Patterns::Integer(),
3943 "Minimum refinement level");
3944 prm.declare_entry("frequency",
3945 Patterns::Tools::Convert<unsigned int>::to_string(
3946 defaults.frequency),
3947 Patterns::Integer(),
3948 "Frequency of the mesh refinement");
3949 prm.declare_entry(
3950 "mesh refinement controller",
3951 Patterns::Tools::Convert<bool>::to_string(
3953 Patterns::Bool(),
3954 "Enable a controller that will target a specific number of elements in the mesh equal to the maximum number of elements");
3955 prm.declare_entry("fix boundary refinement",
3956 Patterns::Tools::Convert<bool>::to_string(
3958 Patterns::Bool(),
3959 "Enable fix boundary refinement");
3960 prm.declare_entry("boundaries fixed",
3961 "",
3962 Patterns::List(Patterns::Integer()),
3963 "Boundary ids of the boundaries to be fixed");
3964 }
3965 prm.leave_subsection();
3966 }
3967
3968 void
3970 {
3971 prm.enter_subsection("mesh adaptation");
3972 {
3973 initial_refinement = prm.get_integer("initial refinement steps");
3974
3975 type = string_to_enum<Type>(prm.get("type"));
3976
3977 // Getting multivariables refinement parameters
3978 const std::string var_op = prm.get("variable");
3979 std::vector<std::string> var_vec = Utilities::split_string_list(var_op);
3980 const std::string strategy_op = prm.get("error estimator");
3981 std::vector<std::string> strategy_vec =
3982 Utilities::split_string_list(strategy_op);
3983 const std::string coars_op = prm.get("fraction coarsening");
3984 std::vector<std::string> coars_vec =
3985 Utilities::split_string_list(coars_op);
3986 const std::string refin_op = prm.get("fraction refinement");
3987 std::vector<std::string> refin_vec =
3988 Utilities::split_string_list(refin_op);
3989
3990 // Checking that the sizes are coherent
3991 AssertThrow(strategy_vec.size() == var_vec.size(),
3992 MultipleAdaptationSizeError("error estimator",
3993 strategy_vec.size(),
3994 var_vec.size()));
3995 AssertThrow(coars_vec.size() == var_vec.size(),
3996 MultipleAdaptationSizeError("fraction coarsening",
3997 coars_vec.size(),
3998 var_vec.size()));
3999 AssertThrow(refin_vec.size() == var_vec.size(),
4000 MultipleAdaptationSizeError("fraction refinement",
4001 refin_vec.size(),
4002 var_vec.size()));
4003
4004 // Create map of refinement variables
4005 for (std::vector<int>::size_type i = 0; i != var_vec.size(); ++i)
4006 {
4007 // Parsing variable for this index
4008 const Variable variable =
4009 string_to_enum<Variable>(var_vec[i],
4010 deprecated_adaptation_variable_names,
4011 "variable");
4012
4013 // Parsing strategy for this variable
4014 MultipleAdaptationParameters adaptation_parameters;
4015 adaptation_parameters.error_estimator =
4017 strategy_vec[i]);
4018
4019 adaptation_parameters.coarsening_fraction =
4020 Utilities::string_to_double(coars_vec[i]);
4021 adaptation_parameters.refinement_fraction =
4022 Utilities::string_to_double(refin_vec[i]);
4023
4024 // defining adaptation map for this variable
4025 variables[variable] = adaptation_parameters;
4026 }
4027 // Verify that the user did not specify both electric_field or
4028 // magnetic_field with electromagnetic_fields
4029 const bool has_em =
4031
4032 const bool has_e =
4034
4035 const bool has_h =
4037
4038 AssertThrow(!(has_em && (has_e || has_h)),
4039 ExcMessage(
4040 "Invalid mesh adaptation configuration: "
4041 "electromagnetic_fields is mutually exclusive with "
4042 "electric_field and magnetic_field."));
4043
4044 fractionType = string_to_enum<FractionType>(prm.get("fraction type"));
4045 maximum_number_elements = prm.get_integer("max number elements");
4046 maximum_refinement_level = prm.get_integer("max refinement level");
4047 minimum_refinement_level = prm.get_integer("min refinement level");
4048 frequency = prm.get_integer("frequency");
4050 mesh_controller_is_enabled = prm.get_bool("mesh refinement controller");
4051 is_boundary_refinement_fixed = prm.get_bool("fix boundary refinement");
4053 convert_string_to_vector<int>(prm, "boundaries fixed");
4054
4055 // Fixing the boundary refinement is a no-op when no boundary id is
4056 // given, since no cell would ever be matched. Warn the user instead of
4057 // silently ignoring the request.
4058 AssertThrow(
4060 ExcMessage(
4061 "The parameter 'fix boundary refinement' is enabled, but the "
4062 "parameter 'boundaries fixed' is empty. No boundary would be fixed. "
4063 "Specify the boundary IDs to fix using 'boundaries fixed'."));
4064 }
4065 prm.leave_subsection();
4066 }
4067
4068 void
4069 Testing::declare_parameters(ParameterHandler &prm)
4070 {
4071 const Testing defaults;
4072 prm.enter_subsection("test");
4073 {
4074 prm.declare_entry(
4075 "enable",
4076 Patterns::Tools::Convert<bool>::to_string(defaults.enabled),
4077 Patterns::Bool(),
4078 "Enable testing mode of a solver. Some solvers have a specific "
4079 "testing mode which enables the output of debug variables. This "
4080 "testing mode is generally used only for the automatic testing bench using ctest.");
4082 prm,
4083 "type",
4084 defaults.test_type,
4085 "Output type for testing mode. Currently, particles type will output "
4086 "each particle with some information and mobility_status or subdomain output results "
4087 "in deal.II format.");
4088 }
4089 prm.leave_subsection();
4090 }
4091
4092 void
4093 Testing::parse_parameters(ParameterHandler &prm)
4094 {
4095 prm.enter_subsection("test");
4096 {
4097 enabled = prm.get_bool("enable");
4098 if (enabled)
4099 {
4100 test_type = string_to_enum<TestType>(prm.get("type"));
4101 }
4102 }
4103 prm.leave_subsection();
4104 }
4105
4106 void
4107 Restart::declare_parameters(ParameterHandler &prm)
4108 {
4109 const Restart defaults;
4110 prm.enter_subsection("restart");
4111 {
4112 prm.declare_entry("filename",
4113 defaults.filename,
4114 Patterns::FileName(),
4115 "Prefix for the filename of checkpoints");
4116 prm.declare_entry(
4117 "restart",
4118 Patterns::Tools::Convert<bool>::to_string(defaults.restart),
4119 Patterns::Bool(),
4120 "Restart the simulation from the last checkpoint <true|false>");
4121 prm.declare_entry(
4122 "checkpoint",
4123 Patterns::Tools::Convert<bool>::to_string(defaults.checkpoint),
4124 Patterns::Bool(),
4125 "Enable checkpointing. Checkpointing creates a restart "
4126 "point from which the simulation can be restarted from.");
4127
4128 prm.declare_entry("frequency",
4129 Patterns::Tools::Convert<unsigned int>::to_string(
4130 defaults.frequency),
4131 Patterns::Integer(),
4132 "Frequency for checkpointing");
4133 }
4134 prm.leave_subsection();
4135 }
4136
4137 void
4138 Restart::parse_parameters(ParameterHandler &prm)
4139 {
4140 prm.enter_subsection("restart");
4141 {
4142 filename = prm.get("filename");
4143 checkpoint = prm.get_bool("checkpoint");
4144 restart = prm.get_bool("restart");
4145 frequency = prm.get_integer("frequency");
4146 }
4147 prm.leave_subsection();
4148 }
4149
4150 namespace
4151 {
4152 /// Deprecated strings of the "permeability model" parameter
4154 deprecated_permeability_model_names = {
4155 {"darcy phase change",
4157 {"carman-kozeny phase change",
4159 } // namespace
4160
4161 void
4163 {
4164 const VelocitySource defaults;
4165 prm.enter_subsection("velocity source");
4166 {
4168 prm,
4169 "rotating frame type",
4170 defaults.rotating_frame_type,
4171 "Rotating frame velocity-dependent source terms. "
4172 "The srf stands "
4173 "for single rotating frame and adds "
4174 "the coriolis and the centrifugal force to the Navier-Stokes equations.");
4175
4176 prm.declare_entry(
4177 "omega_x",
4178 Patterns::Tools::Convert<double>::to_string(defaults.omega_x),
4179 Patterns::Double(),
4180 "X component of the angular velocity vector of the frame of reference");
4181
4182 prm.declare_entry(
4183 "omega_y",
4184 Patterns::Tools::Convert<double>::to_string(defaults.omega_y),
4185 Patterns::Double(),
4186 "Y component of the angular velocity vector of the frame of reference");
4187
4188 prm.declare_entry(
4189 "omega_z",
4190 Patterns::Tools::Convert<double>::to_string(defaults.omega_z),
4191 Patterns::Double(),
4192 "Z component of the angular velocity vector of the frame of reference");
4193
4194 prm.declare_entry(
4195 "enable Darcy multiply by density",
4196 Patterns::Tools::Convert<bool>::to_string(
4198 Patterns::Bool(),
4199 "Enable the multiplication of the Darcy force term by the density for dimensional consistency when solving the pressure rather than the kinematic pressure in the momentum balance.");
4200
4202 "permeability model",
4203 defaults.permeability_model,
4204 "Permeability models for phase change modelling.",
4205 deprecated_permeability_model_names);
4206
4208 "Carman-Kozeny fluid with phase change",
4209 defaults.fluid_with_phase_change,
4210 "Select which fluids have phase change.",
4212
4213 prm.declare_entry(
4214 "Carman-Kozeny division tolerance",
4215 Patterns::Tools::Convert<double>::to_string(
4216 defaults.carman_kozeny_tolerance[0]),
4217 Patterns::List(Patterns::Double()),
4218 "This tolerance avoids a division by zero in the Carman-Kozeny source term. For multiple fluids with phase change, separate values with a comma.");
4219
4220 prm.declare_entry(
4221 "Carman-Kozeny permeability area",
4222 Patterns::Tools::Convert<double>::to_string(
4224 Patterns::List(Patterns::Double()),
4225 "This represents the permeability area of the pseudo-porous bed in the Carman-Kozeny source term. For multiple fluids with phase change, separate values with a comma.");
4226 }
4227 prm.leave_subsection();
4228 }
4229
4230 void
4232 {
4233 prm.enter_subsection("velocity source");
4234 {
4236 string_to_enum<RotatingFrameType>(prm.get("rotating frame type"));
4237
4239 string_to_enum<PermeabilityModel>(prm.get("permeability model"),
4240 deprecated_permeability_model_names,
4241 "permeability model");
4242
4244 prm.get("Carman-Kozeny fluid with phase change"),
4246 "Carman-Kozeny fluid with phase change");
4247
4248 const std::vector<double> permeability_area_values =
4250 "Carman-Kozeny permeability area");
4251 const std::vector<double> tolerance_values =
4253 "Carman-Kozeny division tolerance");
4254
4255 // Check that dimensions agree
4256 AssertThrow(permeability_area_values.size() == tolerance_values.size(),
4257 dealii::ExcDimensionMismatch(permeability_area_values.size(),
4258 tolerance_values.size()));
4259
4260 // One value per fluid with phase change, starting at fluid 0 unless
4261 // only fluid 1 changes phase. The other fluid keeps the in-class
4262 // defaults.
4263 const unsigned int expected_size =
4265 const unsigned int first_fluid =
4267 AssertThrow(
4268 permeability_area_values.size() == expected_size,
4269 ExcMessage(
4270 "The expected size of the 'Carman-Kozeny permeability area' list of " +
4271 std::to_string(expected_size) + " is not met."));
4272 AssertThrow(
4273 tolerance_values.size() == expected_size,
4274 ExcMessage(
4275 "The expected size of the 'Carman-Kozeny division tolerance' list of " +
4276 std::to_string(expected_size) + " is not met."));
4277 for (unsigned int i = 0; i < expected_size; ++i)
4278 {
4279 carman_kozeny_permeability_area[first_fluid + i] =
4280 permeability_area_values[i];
4281 carman_kozeny_tolerance[first_fluid + i] = tolerance_values[i];
4282 }
4283
4284 // Check that all values are strictly positive
4285 for (unsigned int i = 0; i < carman_kozeny_permeability_area.size(); ++i)
4286 {
4287 AssertThrow(
4289 ExcMessage(
4290 "The chosen value of 'Carman-Kozeny permeability area' has to be strictly positive."));
4291
4292 AssertThrow(
4294 ExcMessage(
4295 "The 'Carman-Kozeny division tolerance' should be strictly positive."));
4296 }
4297
4299 prm.get_bool("enable Darcy multiply by density");
4300
4301 AssertThrow(
4304 ExcMessage(
4305 "Inconsistency in parameters, 'enable Darcy multiply by density' is set to 'true', but 'permeability model' is not set to 'darcy_phase_change'."));
4306
4307 omega_x = prm.get_double("omega_x");
4308 omega_y = prm.get_double("omega_y");
4309 omega_z = prm.get_double("omega_z");
4310 }
4311 prm.leave_subsection();
4312 }
4313
4314 template <int dim>
4315 void
4317 unsigned int index)
4318 {
4319 prm.declare_entry(
4320 "integrate motion",
4321 "false",
4322 Patterns::Bool(),
4323 "Bool to define if the particle trajectory is integrated meaning its velocity and position will be updated at each time step according to the hydrodynamic force applied to it");
4324 prm.declare_entry(
4325 "mesh-based precalculations",
4326 "true",
4327 Patterns::Bool(),
4328 "Bool to define if precalculations should be performed between refinements. Precalculations can introduce shape deformation when the type is RBF and some nodes are located outside the background mesh.");
4329
4330 prm.enter_subsection("position");
4331 particles[index].f_position =
4332 std::make_shared<Functions::ParsedFunction<dim>>(dim);
4333 particles[index].f_position->declare_parameters(prm, dim);
4334 prm.leave_subsection();
4335
4336 prm.enter_subsection("orientation");
4337 particles[index].f_orientation =
4338 std::make_shared<Functions::ParsedFunction<dim>>(3);
4339 particles[index].f_orientation->declare_parameters(prm, 3);
4340 prm.leave_subsection();
4341
4342 prm.enter_subsection("velocity");
4343 particles[index].f_velocity =
4344 std::make_shared<Functions::ParsedFunction<dim>>(dim);
4345 particles[index].f_velocity->declare_parameters(prm, dim);
4346 prm.leave_subsection();
4347
4348 prm.enter_subsection("omega");
4349 particles[index].f_omega =
4350 std::make_shared<Functions::ParsedFunction<dim>>(3);
4351 particles[index].f_omega->declare_parameters(prm, 3);
4352 prm.leave_subsection();
4353
4355 prm,
4356 "type",
4358 "The type of shape considered. "
4359 "The parameter for a sphere is: radius. "
4360 "The parameters for a hyper rectangle are, in order: x half length, "
4361 "y half length, z half length. "
4362 "The parameters for an ellipsoid are, in order: x radius, "
4363 "y radius, z radius. "
4364 "The parameters for a torus are, in order: torus radius, "
4365 "torus thickness radius. "
4366 "The parameters for a cone are, in order: tan(base angle),"
4367 " height. "
4368 "The parameters for a cylinder are, in order: radius, half-length. "
4369 "It is aligned to the z axis by default. "
4370 "The parameters for a cylindrical tube are, in order: inside radius, "
4371 "outside radius, half-length. It is aligned to the z axis by default. "
4372 "The parameters for a cylindrical helix are, in order: helix radius, "
4373 "tube radius, helix total height, pitch (height between two consecutive "
4374 "loops). "
4375 "The parameters for a cut hollow sphere are, in order: sphere radius, "
4376 "cut thickness, wall thickness. "
4377 "The parameters for a death star are, in order: sphere radius, "
4378 "smaller sphere radius, distance between centers. "
4379 "The parameters for a superquadric are, in order: "
4380 "a, b, c, r, s, t, epsilon. "
4381 "The first three are half-lengths in x, y, and z. "
4382 "The next three are the blockiness in the x, y, and z directions. "
4383 "The last is the tolerance of the found surface. "
4384 "The parameter for an rbf is the file name. "
4385 "The parameter for a composite is the file name.",
4387
4388 prm.declare_entry("shape arguments",
4389 "1",
4390 Patterns::Anything(),
4391 "Arguments defining the geometry");
4392
4393 prm.declare_entry(
4394 "layer thickening",
4395 "0",
4396 Patterns::Double(),
4397 "Thickness (positive or negative) of uniform additional layer of solid on particle. "
4398 "A negative value will decrease the particle's thickness by subtracting a layer of specified width.");
4399
4400 prm.declare_entry(
4401 "pressure location",
4402 "0; 0; 0",
4403 Patterns::Anything(),
4404 "position relative to the center of the particle for the location of the point where the pressure is imposed inside the particle");
4405
4406
4407
4408 prm.enter_subsection("physical properties");
4409 {
4410 prm.declare_entry("density",
4411 "1",
4412 Patterns::Double(),
4413 "density of the particle ");
4414 prm.declare_entry(
4415 "volume",
4416 "0",
4417 Patterns::Double(),
4418 "The volume occupied by the particle. If it is left empty, the volume is automatically calculated if possible otherwise the volume of a sphere is used instead");
4419 prm.declare_entry(
4420 "inertia",
4421 "1 ;0 ;0 ;0 ;1 ;0 ;0 ;0 ;1",
4422 Patterns::Anything(),
4423 "Moments of inertia of the particle in the reference frame of the fluid. The entry sequence corresponds to : I_xx ;I_xy ;I_xz ;I_yx ;I_yy ;I_yz ;I_zx ;I_zy ;I_zz");
4424 prm.declare_entry("youngs modulus",
4425 "100000000",
4426 Patterns::Double(),
4427 "The Young's modulus of particle in case of contact");
4428 prm.declare_entry("poisson ratio",
4429 "0.3",
4430 Patterns::Double(),
4431 "The poisson ratio of particle in case of contact");
4432 prm.declare_entry(
4433 "restitution coefficient",
4434 "1",
4435 Patterns::Double(),
4436 "The restitution coefficient of particle in case of contact");
4437 prm.declare_entry(
4438 "friction coefficient",
4439 "0",
4440 Patterns::Double(),
4441 "The friction coefficient of particle in case of contact");
4442 prm.declare_entry(
4443 "rolling friction coefficient",
4444 "0",
4445 Patterns::Double(),
4446 "The rolling friction coefficient of particle in case of contact");
4447 prm.leave_subsection();
4448 }
4449 }
4450
4451 template <int dim>
4452 void
4454 {
4455 prm.enter_subsection("particles");
4456 {
4457 prm.declare_entry(
4458 "number of particles",
4459 Patterns::Tools::Convert<unsigned int>::to_string(nb_particles),
4460 Patterns::Integer(),
4461 "The number of particles represented by IB. The maximal number of particles is equal to 10 when defined individually. If particles are loaded from a file, this parameter is overridden, and there is no limit to the number of particles.");
4462
4463 prm.declare_entry(
4464 "assemble Navier-Stokes inside particles",
4465 Patterns::Tools::Convert<bool>::to_string(
4467 Patterns::Bool(),
4468 "Bool to define if you assemble the inside of particles with the NS equation.");
4469
4470 prm.enter_subsection("extrapolation function");
4471 {
4472 prm.declare_entry(
4473 "stencil degree",
4474 Patterns::Tools::Convert<unsigned int>::to_string(stencil_degree),
4475 Patterns::Integer(1),
4476 "The polynomial degree used in the extrapolation function");
4477 prm.declare_entry(
4478 "length ratio",
4479 Patterns::Tools::Convert<double>::to_string(length_ratio),
4480 Patterns::Double(),
4481 "The length ratio used to define the points for the IB stencil. See definition of epsilon_n in the paper on sharp IB.");
4482 prm.declare_entry(
4483 "enable extrapolation",
4484 Patterns::Tools::Convert<bool>::to_string(enable_extrapolation),
4485 Patterns::Bool(),
4486 "Bool to define if extrapolation should be enabled (default). If disabled, all velocity degrees of freedom "
4487 "in a cell will be set to the particle velocity if that cell is cut. Setting to false is intended for "
4488 "debugging purposes.");
4489
4490 prm.leave_subsection();
4491 }
4492
4493 prm.enter_subsection("input file");
4494 {
4495 prm.declare_entry(
4496 "load particles from file",
4497 Patterns::Tools::Convert<bool>::to_string(load_particles_from_file),
4498 Patterns::Bool(),
4499 "Bool to define if particles are loaded from an external file");
4500 prm.declare_entry("particles file",
4502 Patterns::FileName(),
4503 "The file name from which we load the particles");
4504 prm.leave_subsection();
4505 }
4506
4507 prm.enter_subsection("local mesh refinement");
4508 {
4509 prm.declare_entry(
4510 "initial refinement",
4511 Patterns::Tools::Convert<unsigned int>::to_string(initial_refinement),
4512 Patterns::Integer(),
4513 "Number of refinements around the particles before the start of the simulation ");
4514 prm.declare_entry(
4515 "enable distance based coarsening",
4516 Patterns::Tools::Convert<bool>::to_string(enable_coarsening),
4517 Patterns::Bool(),
4518 "Enable distance-based coarsening away from immersed boundary particles");
4519 prm.declare_entry(
4520 "refine mesh inside radius factor",
4521 Patterns::Tools::Convert<double>::to_string(
4523 Patterns::Double(),
4524 "The factor that multiplies the radius to define the inside bound for the refinement of the mesh");
4525 prm.declare_entry(
4526 "refine mesh outside radius factor",
4527 Patterns::Tools::Convert<double>::to_string(
4529 Patterns::Double(),
4530 "The factor that multiplies the radius to define the outside bound for the refinement of the mesh");
4531 prm.declare_entry(
4532 "coarsen mesh outside radius factor",
4533 Patterns::Tools::Convert<double>::to_string(
4535 Patterns::Double(),
4536 "The factor that multiplies the radius to define the outside bound beyond which distance-based coarsening is allowed");
4537 prm.declare_entry(
4538 "refinement zone extrapolation",
4539 Patterns::Tools::Convert<bool>::to_string(
4541 Patterns::Bool(),
4542 "This parameter enables the extrapolation in time of the refinement zone. This means that it will try to refine where the particle will be at the end of the time step instead of the initial position.");
4543 prm.leave_subsection();
4544 }
4545
4546 prm.enter_subsection("output");
4547 {
4548 prm.declare_entry(
4549 "calculate force",
4550 Patterns::Tools::Convert<bool>::to_string(calculate_force_ib),
4551 Patterns::Bool(),
4552 "Bool to define if the force is evaluated on each particle ");
4553 prm.declare_entry(
4554 "ib force output file",
4556 Patterns::FileName(),
4557 "The name of the file where the data on the force of each particle is stored");
4558 prm.declare_entry(
4559 "ib particles pvd file",
4561 Patterns::FileName(),
4562 "The output files of the pvd data for the ib particles");
4563 prm.declare_entry(
4564 "print DEM",
4565 Patterns::Tools::Convert<bool>::to_string(print_dem),
4566 Patterns::Bool(),
4567 "Bool to define if particles' information are printed on the terminal when particles' time step is finished");
4568 prm.declare_entry(
4569 "enable extra sharp interface vtu output field",
4570 Patterns::Tools::Convert<bool>::to_string(
4572 Patterns::Bool(),
4573 "This parameter enables the output of more information related to the particles in the vtu file.");
4574 prm.leave_subsection();
4575 }
4576
4577 prm.enter_subsection("DEM");
4578 {
4579 prm.declare_entry(
4580 "contact search radius factor",
4581 Patterns::Tools::Convert<double>::to_string(
4583 Patterns::Double(),
4584 "The factor that multiplies the radius to define the region of contact search around the particle");
4585 prm.declare_entry(
4586 "contact search frequency",
4587 Patterns::Tools::Convert<int>::to_string(contact_search_frequency),
4588 Patterns::Integer(),
4589 "The frequency of update in the contact candidates list");
4590 prm.declare_entry(
4591 "particle nonlinear tolerance",
4592 Patterns::Tools::Convert<double>::to_string(
4594 Patterns::Double(),
4595 "The nonlinear tolerance for the coupling of the particle dynamics and the fluid");
4596 prm.declare_entry("DEM coupling frequency",
4597 Patterns::Tools::Convert<unsigned int>::to_string(
4599 Patterns::Integer(),
4600 "The number of DEM time steps per CFD time step");
4601 prm.declare_entry("alpha",
4602 Patterns::Tools::Convert<double>::to_string(alpha),
4603 Patterns::Double(),
4604 "relaxation parameter");
4605
4606 prm.declare_entry("enable lubrication force",
4607 Patterns::Tools::Convert<bool>::to_string(
4609 Patterns::Bool(),
4610 "Bool to enable or disable the lubrication force");
4611 prm.declare_entry(
4612 "lubrication range max",
4613 Patterns::Tools::Convert<double>::to_string(lubrication_range_max),
4614 Patterns::Double(),
4615 "Gap require to consider the lubrication force. This value is multiplied the smallest cell size");
4616 prm.declare_entry(
4617 "lubrication range min",
4618 Patterns::Tools::Convert<double>::to_string(lubrication_range_min),
4619 Patterns::Double(),
4620 "Smallest gap considered for the lubrification force calculation. This value is multiplied by the smallest cell size");
4621
4622 prm.declare_entry(
4623 "explicit contact impulsion",
4624 Patterns::Tools::Convert<bool>::to_string(
4626 Patterns::Bool(),
4627 "Bool to enable or disable the use of explicit contact impulsion evaluation in the resolution of the coupling of the particle. When it is set to true, this parameter results in the code only performing the DEM calculation once per CFD time step and using the resulting contact impulsion to evaluate all the other Newton's iterations. This reduces the number of times the DEM calculation is made.");
4628
4629 prm.declare_entry(
4630 "explicit position integration",
4631 Patterns::Tools::Convert<bool>::to_string(
4633 Patterns::Bool(),
4634 "Bool to enable or disable the explicit position integration. This means that the particle position is obtained directly by the integration of the previous velocities only. This avoids multiple cut cell mapping for each newton iteration. Note that this limits the order of convergence in time to one.");
4635
4636 prm.declare_entry(
4637 "approximate radius for contact",
4638 Patterns::Tools::Convert<bool>::to_string(
4640 Patterns::Bool(),
4641 "Bool to turn on or off using the approximate radius of the particles during contact. If activated, the radius used in the contact calculation is constant and fixed to the effective radius of the shape. If not, the radius of curvature of the shape at the contact point is evaluated. For some shapes, this can be numerically expensive to evaluate.");
4642
4643
4644
4645 prm.enter_subsection("wall physical properties");
4646 {
4647 prm.declare_entry(
4648 "wall youngs modulus",
4649 Patterns::Tools::Convert<double>::to_string(wall_youngs_modulus),
4650 Patterns::Double(),
4651 "The wall Young's modulus if IB particles are in contact with it");
4652
4653 prm.declare_entry(
4654 "wall poisson ratio",
4655 Patterns::Tools::Convert<double>::to_string(wall_poisson_ratio),
4656 Patterns::Double(),
4657 "The wall poisson ratio if IB particles are in contact with it");
4658
4659 prm.declare_entry(
4660 "wall rolling friction coefficient",
4661 Patterns::Tools::Convert<double>::to_string(
4663 Patterns::Double(),
4664 "The wall rolling friction coefficient if IB particles are in contact with it");
4665
4666 prm.declare_entry(
4667 "wall friction coefficient",
4668 Patterns::Tools::Convert<double>::to_string(
4670 Patterns::Double(),
4671 "The wall friction coefficient if IB particles are in contact with it");
4672
4673 prm.declare_entry(
4674 "wall restitution coefficient",
4675 Patterns::Tools::Convert<double>::to_string(
4677 Patterns::Double(),
4678 "The wall restitution coefficient if IB particles are in contact with it");
4679 prm.leave_subsection();
4680 }
4681
4682 prm.enter_subsection("gravity");
4683 f_gravity->declare_parameters(prm, dim);
4684 prm.leave_subsection();
4685
4686 prm.leave_subsection();
4687 }
4688
4689 unsigned int max_ib_particles = 20;
4690 particles.resize(max_ib_particles);
4691 for (unsigned int i = 0; i < max_ib_particles; ++i)
4692 {
4693 std::string section = "particle info " + std::to_string(i);
4694 prm.enter_subsection(section);
4695 {
4696 declare_default_entry(prm, i);
4697 }
4698 prm.leave_subsection();
4699 }
4700 }
4701 prm.leave_subsection();
4702 }
4703
4704 template <int dim>
4705 void
4707 {
4708 using numbers::PI;
4709 prm.enter_subsection("particles");
4710 {
4711 prm.enter_subsection("extrapolation function");
4712 {
4713 stencil_degree = prm.get_integer("stencil degree");
4714 length_ratio = prm.get_double("length ratio");
4715 enable_extrapolation = prm.get_bool("enable extrapolation");
4716 prm.leave_subsection();
4717 }
4718
4719 prm.enter_subsection("input file");
4720 {
4721 load_particles_from_file = prm.get_bool("load particles from file");
4722 particles_file = prm.get("particles file");
4723 prm.leave_subsection();
4724 }
4725
4726 prm.enter_subsection("local mesh refinement");
4727 {
4728 initial_refinement = prm.get_integer("initial refinement");
4729 enable_coarsening = prm.get_bool("enable distance based coarsening");
4731 prm.get_double("refine mesh inside radius factor");
4733 prm.get_double("refine mesh outside radius factor");
4735 prm.get_double("coarsen mesh outside radius factor");
4737 prm.get_bool("refinement zone extrapolation");
4739 {
4740 AssertThrow(
4742 ExcMessage(
4743 "The parameter 'coarsen mesh outside radius factor' must be greater than or equal to 'refine mesh outside radius factor'."));
4744 }
4745 prm.leave_subsection();
4746 }
4747
4748 prm.enter_subsection("output");
4749 {
4750 calculate_force_ib = prm.get_bool("calculate force");
4751 ib_force_output_file = prm.get("ib force output file");
4752 print_dem = prm.get_bool("print DEM");
4754 prm.get_bool("enable extra sharp interface vtu output field");
4755 ib_particles_pvd_file = prm.get("ib particles pvd file");
4756 prm.leave_subsection();
4757 }
4758 prm.enter_subsection("DEM");
4759 {
4760 alpha = prm.get_double("alpha");
4761
4763 prm.get_double("contact search radius factor");
4765 throw(std::logic_error(
4766 "Error, the parameter 'contact search radius factor' cannot be < 1."));
4767 contact_search_frequency = prm.get_integer("contact search frequency");
4769 prm.get_double("particle nonlinear tolerance");
4770 coupling_frequency = prm.get_integer("DEM coupling frequency");
4771 enable_lubrication_force = prm.get_bool("enable lubrication force");
4772 lubrication_range_max = prm.get_double("lubrication range max");
4773 lubrication_range_min = prm.get_double("lubrication range min");
4775 prm.get_bool("explicit contact impulsion");
4777 prm.get_bool("explicit position integration");
4779 prm.get_bool("approximate radius for contact");
4780
4781 prm.enter_subsection("wall physical properties");
4782 {
4783 wall_youngs_modulus = prm.get_double("wall youngs modulus");
4784 wall_poisson_ratio = prm.get_double("wall poisson ratio");
4786 prm.get_double("wall rolling friction coefficient");
4788 prm.get_double("wall friction coefficient");
4790 prm.get_double("wall restitution coefficient");
4791 prm.leave_subsection();
4792 }
4793 f_gravity = std::make_shared<Functions::ParsedFunction<dim>>(dim);
4794 prm.enter_subsection("gravity");
4795 f_gravity->parse_parameters(prm);
4796 prm.leave_subsection();
4797 prm.leave_subsection();
4798 }
4799
4800 nb_particles = prm.get_integer("number of particles");
4801
4803 prm.get_bool("assemble Navier-Stokes inside particles");
4804
4805 particles.resize(nb_particles);
4806 for (unsigned int i = 0; i < nb_particles; ++i)
4807 {
4808 particles[i].initialize_all();
4809 std::string section = "particle info " + std::to_string(i);
4810 prm.enter_subsection(section);
4811
4812 particles[i].integrate_motion = prm.get_bool("integrate motion");
4813 particles[i].mesh_based_precalculations =
4814 prm.get_bool("mesh-based precalculations");
4815
4816 prm.enter_subsection("position");
4817 particles[i].f_position->parse_parameters(prm);
4818 particles[i].f_position->set_time(0);
4819 prm.leave_subsection();
4820 prm.enter_subsection("orientation");
4821 particles[i].f_orientation->parse_parameters(prm);
4822 particles[i].f_orientation->set_time(0);
4823 prm.leave_subsection();
4824
4825 prm.enter_subsection("velocity");
4826 particles[i].f_velocity->parse_parameters(prm);
4827 particles[i].f_velocity->set_time(0);
4828 prm.leave_subsection();
4829 prm.enter_subsection("omega");
4830 particles[i].f_omega->parse_parameters(prm);
4831 particles[i].f_omega->set_time(0);
4832 prm.leave_subsection();
4833 particles[i].position[0] =
4834 particles[i].f_position->value(particles[i].position, 0);
4835 particles[i].position[1] =
4836 particles[i].f_position->value(particles[i].position, 1);
4837 particles[i].orientation[0] =
4838 particles[i].f_orientation->value(particles[i].position, 0);
4839 particles[i].orientation[1] =
4840 particles[i].f_orientation->value(particles[i].position, 1);
4841 particles[i].orientation[2] =
4842 particles[i].f_orientation->value(particles[i].position, 2);
4843 particles[i].velocity[0] =
4844 particles[i].f_velocity->value(particles[i].position, 0);
4845 particles[i].velocity[1] =
4846 particles[i].f_velocity->value(particles[i].position, 1);
4847 particles[i].omega[0] =
4848 particles[i].f_omega->value(particles[i].position, 0);
4849 particles[i].omega[1] =
4850 particles[i].f_omega->value(particles[i].position, 1);
4851 particles[i].omega[2] =
4852 particles[i].f_omega->value(particles[i].position, 2);
4853
4854 particles[i].particle_id = i;
4855
4856 std::string pressure_location_str = prm.get("pressure location");
4857 std::vector<std::string> pressure_location_str_list(
4858 Utilities::split_string_list(pressure_location_str, ";"));
4859 std::vector<double> pressure_list =
4860 Utilities::string_to_double(pressure_location_str_list);
4861 particles[i].pressure_location[0] = pressure_list[0];
4862 particles[i].pressure_location[1] = pressure_list[1];
4863
4864
4865 if (dim == 3)
4866 {
4867 particles[i].position[2] =
4868 particles[i].f_position->value(particles[i].position, 2);
4869 particles[i].velocity[2] =
4870 particles[i].f_velocity->value(particles[i].position, 2);
4871 particles[i].pressure_location[2] = pressure_list[2];
4872 }
4873
4874 const typename Shape<dim>::ShapeType shape_type =
4876 prm.get("type"),
4878 "type");
4879 std::string shape_arguments_str = prm.get("shape arguments");
4880 particles[i].initialize_shape(enum_to_string(shape_type),
4881 shape_arguments_str);
4882
4883 particles[i].set_layer_thickening(prm.get_double("layer thickening"));
4884
4885 particles[i].radius = particles[i].shape->effective_radius;
4886 prm.enter_subsection("physical properties");
4887 {
4888 std::string inertia_str = prm.get("inertia");
4889 std::vector<std::string> inertia_str_list(
4890 Utilities::split_string_list(inertia_str, ";"));
4891 const std::vector<double> inertia_list =
4892 Utilities::string_to_double(inertia_str_list);
4893 if (inertia_str_list.size() == 9)
4894 {
4895 particles[i].inertia[0][0] = inertia_list[0];
4896 particles[i].inertia[0][1] = inertia_list[1];
4897 particles[i].inertia[0][2] = inertia_list[2];
4898 particles[i].inertia[1][0] = inertia_list[3];
4899 particles[i].inertia[1][1] = inertia_list[4];
4900 particles[i].inertia[1][2] = inertia_list[5];
4901 particles[i].inertia[2][0] = inertia_list[6];
4902 particles[i].inertia[2][1] = inertia_list[7];
4903 particles[i].inertia[2][2] = inertia_list[8];
4904 }
4905 else if (inertia_str_list.size() == 1)
4906 {
4907 // If only one inertia value is given, we assume that the
4908 // inertia is uniform in all axes.
4909 particles[i].inertia[0][0] = inertia_list[0];
4910 particles[i].inertia[0][1] = 0;
4911 particles[i].inertia[0][2] = 0;
4912 particles[i].inertia[1][0] = 0;
4913 particles[i].inertia[1][1] = inertia_list[0];
4914 particles[i].inertia[1][2] = 0;
4915 particles[i].inertia[2][0] = 0;
4916 particles[i].inertia[2][1] = 0;
4917 particles[i].inertia[2][2] = inertia_list[0];
4918 }
4919 else
4920 {
4921 throw(std::runtime_error(
4922 " Invalid inertia matrix. The inertia is given as a 3 by 3 matrix or a single value if the inertia is uniform around each axis."));
4923 }
4924
4925 particles[i].youngs_modulus = prm.get_double("youngs modulus");
4926 particles[i].restitution_coefficient =
4927 prm.get_double("restitution coefficient");
4928 particles[i].friction_coefficient =
4929 prm.get_double("friction coefficient");
4930 particles[i].poisson_ratio = prm.get_double("poisson ratio");
4931 particles[i].rolling_friction_coefficient =
4932 prm.get_double("rolling friction coefficient");
4933
4934 double volume = prm.get_double("volume");
4935 if (volume == 0)
4936 {
4937 // value is automatically defined.
4938 volume = particles[i].shape->displaced_volume();
4939 if (volume == 0)
4940 {
4941 if (dim == 2)
4942 {
4943 volume = PI * particles[i].radius * particles[i].radius;
4944 }
4945 else if (dim == 3)
4946 {
4947 volume = 4.0 / 3.0 * PI * particles[i].radius *
4948 particles[i].radius * particles[i].radius;
4949 }
4950 }
4951 }
4952 particles[i].volume = volume;
4953 particles[i].mass = particles[i].volume * prm.get_double("density");
4954
4955 particles[i].initialize_previous_solution();
4956 particles[i].set_position(particles[i].position);
4957 particles[i].set_orientation(particles[i].orientation);
4958
4959 prm.leave_subsection();
4960 }
4961 prm.leave_subsection();
4962 }
4963 prm.leave_subsection();
4964 }
4965 }
4966
4967 void
4969 {
4970 const DynamicFlowControl defaults;
4971 prm.enter_subsection("flow control");
4972 {
4973 prm.declare_entry("enable",
4974 Patterns::Tools::Convert<bool>::to_string(
4975 defaults.enable_flow_control),
4976 Patterns::Bool(),
4977 "Enable flow rate control");
4978 prm.declare_entry("average velocity",
4979 Patterns::Tools::Convert<double>::to_string(
4980 defaults.average_velocity_0),
4981 Patterns::Double(),
4982 "The target average velocity");
4983 prm.declare_entry("inlet boundary id",
4984 Patterns::Tools::Convert<unsigned int>::to_string(
4985 defaults.boundary_flow_id),
4986 Patterns::Integer(0),
4987 "Boundary id of the inlet flow");
4988 prm.declare_entry(
4989 "flow direction",
4990 Patterns::Tools::Convert<unsigned int>::to_string(
4991 defaults.flow_direction),
4992 Patterns::Integer(0, 2),
4993 "Flow direction at flow inlet (0 for x, 1 for y and 2 for z)");
4994 prm.declare_entry("initial beta",
4995 Patterns::Tools::Convert<double>::to_string(
4996 defaults.beta_0),
4997 Patterns::Double(),
4998 "Beta coefficient value for the first step time");
4999 prm.declare_entry("alpha",
5000 Patterns::Tools::Convert<double>::to_string(
5001 defaults.alpha),
5002 Patterns::Double(0.),
5003 "Relaxation coefficient for flow controller");
5004 prm.declare_entry("enable beta particle",
5005 Patterns::Tools::Convert<bool>::to_string(
5006 defaults.enable_beta_particle),
5007 Patterns::Bool(),
5008 "Enable beta force for particles");
5009 prm.declare_entry(
5010 "beta threshold",
5011 Patterns::Tools::Convert<double>::to_string(defaults.beta_threshold),
5012 Patterns::Double(0.),
5013 "Relative threshold on the change of the beta force below which the previous beta force is kept");
5015 prm,
5016 "verbosity",
5017 defaults.verbosity,
5018 "State whether from the flow control information should be printed.",
5021 }
5022 prm.leave_subsection();
5023 }
5024
5025 void
5027 {
5028 prm.enter_subsection("flow control");
5029 {
5030 // Enable flow control
5031 enable_flow_control = prm.get_bool("enable");
5032
5033 // Set the target value for the flow control and flow direction
5034 average_velocity_0 = prm.get_double("average velocity");
5035 flow_direction = prm.get_integer("flow direction");
5036 boundary_flow_id = prm.get_integer("inlet boundary id");
5037
5038 // Tuning parameters for the flow controller
5039 beta_0 = prm.get_double("initial beta");
5040 alpha = prm.get_double("alpha");
5041 beta_threshold = prm.get_double("beta threshold");
5042
5043 // Enable printing of flow control information
5044 verbosity = string_to_enum<Verbosity>(prm.get("verbosity"),
5046 "verbosity");
5047
5048 // Enable beta force for particles (CFD-DEM)
5049 enable_beta_particle = prm.get_bool("enable beta particle");
5050 }
5051
5052 prm.leave_subsection();
5053 }
5054
5055 void
5056 Evaporation::declare_parameters(dealii::ParameterHandler &prm)
5057 {
5058 const Evaporation defaults;
5059 prm.enter_subsection("evaporation");
5060 {
5062 prm,
5063 "evaporation mass flux model",
5065 "Model used for the calculation of the evaporative mass flux.");
5066 prm.declare_entry(
5067 "enable evaporative cooling",
5068 Patterns::Tools::Convert<bool>::to_string(
5070 Patterns::Bool(),
5071 "Enable the evaporative cooling at the free surface (gas/liquid interface) in the energy equation <true|false>");
5072 prm.declare_entry(
5073 "enable recoil pressure",
5074 Patterns::Tools::Convert<bool>::to_string(
5075 defaults.enable_recoil_pressure),
5076 Patterns::Bool(),
5077 "Enable the recoil pressure due to evaporation at the free surface (gas/liquid interface) in the momentum equation <true|false>");
5078 prm.declare_entry(
5079 "evaporation mass flux",
5080 Patterns::Tools::Convert<double>::to_string(
5081 defaults.evaporation_mass_flux),
5082 Patterns::Double(),
5083 "Evaporation mass flux used if the constant evaporation model is selected in M*L^-2*T^-1");
5084 prm.declare_entry(
5085 "evaporation coefficient",
5086 Patterns::Tools::Convert<double>::to_string(
5087 defaults.evaporation_coefficient),
5088 Patterns::Double(),
5089 "Evaporation coefficient corresponding to the ratio between the net mass flux (evaporation-condensation) and the mass flux of evaporation");
5090 prm.declare_entry(
5091 "recoil pressure coefficient",
5092 Patterns::Tools::Convert<double>::to_string(
5094 Patterns::Double(),
5095 "Recoil pressure coefficient corresponding to the factor applied to the saturation pressure to compute the recoil pressure in an out of equilibrium evaporation");
5096 prm.declare_entry("molar mass",
5097 Patterns::Tools::Convert<double>::to_string(
5098 defaults.molar_mass),
5099 Patterns::Double(),
5100 "Molar mass of the material in M*N^-1");
5101 prm.declare_entry("boiling temperature",
5102 Patterns::Tools::Convert<double>::to_string(
5103 defaults.boiling_temperature),
5104 Patterns::Double(),
5105 "Boiling temperature in Theta");
5106 prm.declare_entry("evaporation latent heat",
5107 Patterns::Tools::Convert<double>::to_string(
5108 defaults.latent_heat_evaporation),
5109 Patterns::Double(),
5110 "Latent heat of evaporation in L^2*T^-2");
5111 prm.declare_entry("ambient pressure",
5112 Patterns::Tools::Convert<double>::to_string(
5113 defaults.ambient_pressure),
5114 Patterns::Double(),
5115 "Pressure of the ambient gas in M*L^-1*T^-2");
5116 prm.declare_entry("ambient gas density",
5117 Patterns::Tools::Convert<double>::to_string(
5118 defaults.ambient_gas_density),
5119 Patterns::Double(),
5120 "Ambient gas density in M*L^-3");
5121 prm.declare_entry("liquid density",
5122 Patterns::Tools::Convert<double>::to_string(
5123 defaults.liquid_density),
5124 Patterns::Double(),
5125 "Liquid density in M*L^-3");
5126 prm.declare_entry("universal gas constant",
5127 Patterns::Tools::Convert<double>::to_string(
5128 defaults.universal_gas_constant),
5129 Patterns::Double(),
5130 "Universal gas constant in M*L^2*T^-2*Theta^-1*N^-1");
5131 }
5132 prm.leave_subsection();
5133 }
5134
5135 void
5136 Evaporation::parse_parameters(ParameterHandler &prm)
5137 {
5138 prm.enter_subsection("evaporation");
5139 {
5142 prm.get("evaporation mass flux model"));
5143
5144 enable_evaporation_cooling = prm.get_bool("enable evaporative cooling");
5145 enable_recoil_pressure = prm.get_bool("enable recoil pressure");
5146
5147 evaporation_mass_flux = prm.get_double("evaporation mass flux");
5148 evaporation_coefficient = prm.get_double("evaporation coefficient");
5150 prm.get_double("recoil pressure coefficient");
5151 molar_mass = prm.get_double("molar mass");
5152 boiling_temperature = prm.get_double("boiling temperature");
5153 latent_heat_evaporation = prm.get_double("evaporation latent heat");
5154 ambient_pressure = prm.get_double("ambient pressure");
5155 ambient_gas_density = prm.get_double("ambient gas density");
5156 liquid_density = prm.get_double("liquid density");
5157 universal_gas_constant = prm.get_double("universal gas constant");
5158 }
5159 prm.leave_subsection();
5160 }
5161
5162 template <int dim>
5163 void
5164 Mortar<dim>::declare_parameters(ParameterHandler &prm)
5165 {
5166 prm.enter_subsection("mortar");
5167 {
5168 prm.declare_entry("enable",
5169 Patterns::Tools::Convert<bool>::to_string(enable),
5170 Patterns::Bool(),
5171 "Enable mortar interface <true|false>");
5173 "interface type",
5175 "Type of mortar interface.");
5176 rotor_mesh = std::make_shared<Mesh<dim>>();
5177 rotor_mesh->declare_parameters(prm);
5178 prm.declare_entry("rotor boundary id",
5179 Patterns::Tools::Convert<unsigned int>::to_string(
5181 Patterns::Integer(),
5182 "Rotor boundary ID # of the mortar matching interface");
5183 prm.declare_entry(
5184 "stator boundary id",
5185 Patterns::Tools::Convert<unsigned int>::to_string(stator_boundary_id),
5186 Patterns::Integer(),
5187 "Stator boundary ID # of the mortar matching interface");
5188 prm.declare_entry("center of rotation",
5189 Patterns::Tools::Convert<Point<dim>>::to_string(
5191 Patterns::List(Patterns::Double()),
5192 "Center of rotation coordinates of rotor domain");
5193
5194 prm.declare_entry("rotation axis direction",
5195 Patterns::Tools::Convert<unsigned int>::to_string(
5197 Patterns::Integer(0, 2),
5198 "Direction of the rotation axis. Choices are <0|1|2>.");
5199
5200 prm.enter_subsection("rotor rotation angle");
5201 rotor_rotation_angle = std::make_shared<Functions::ParsedFunction<dim>>();
5202 rotor_rotation_angle->declare_parameters(prm);
5203 prm.leave_subsection();
5204
5205 prm.enter_subsection("rotor angular velocity");
5207 std::make_shared<Functions::ParsedFunction<dim>>();
5208 rotor_angular_velocity->declare_parameters(prm);
5209 prm.leave_subsection();
5210
5211 prm.declare_entry("penalty factor",
5212 Patterns::Tools::Convert<double>::to_string(sip_factor),
5213 Patterns::Double(),
5214 "Penalty factor for mortar elements");
5215 prm.declare_entry("oversampling factor",
5216 Patterns::Tools::Convert<unsigned int>::to_string(
5218 Patterns::Integer(),
5219 "Oversampling factor for quadrature points");
5220 prm.declare_entry("radius tolerance",
5221 Patterns::Tools::Convert<double>::to_string(
5223 Patterns::Double(),
5224 "Tolerance used for the interface radius computation");
5225 prm.declare_entry("cell weight",
5226 Patterns::Tools::Convert<unsigned int>::to_string(
5227 cell_weight),
5228 Patterns::Integer(),
5229 "Cell weight for load balancing of mortar cells");
5231 prm,
5232 "verbosity",
5233 verbosity,
5234 "State whether from the mortar information should be printed.",
5236 }
5237 prm.leave_subsection();
5238 }
5239
5240 template <int dim>
5241 void
5242 Mortar<dim>::parse_parameters(ParameterHandler &prm)
5243 {
5244 prm.enter_subsection("mortar");
5245 {
5246 enable = prm.get_bool("enable");
5247 interface_type = string_to_enum<InterfaceType>(prm.get("interface type"));
5248 rotor_mesh->parse_parameters(prm);
5249 rotor_boundary_id = prm.get_integer("rotor boundary id");
5250 stator_boundary_id = prm.get_integer("stator boundary id");
5252 value_string_to_tensor<dim>(prm.get("center of rotation"));
5253 rotation_axis_direction = prm.get_integer("rotation axis direction");
5254 prm.enter_subsection("rotor rotation angle");
5255 rotor_rotation_angle->parse_parameters(prm);
5256 rotor_rotation_angle->set_time(0);
5257 prm.leave_subsection();
5258
5259 prm.enter_subsection("rotor angular velocity");
5260 rotor_angular_velocity->parse_parameters(prm);
5261 rotor_angular_velocity->set_time(0);
5262 prm.leave_subsection();
5263
5264 sip_factor = prm.get_double("penalty factor");
5265 oversampling_factor = prm.get_integer("oversampling factor");
5266 radius_tolerance = prm.get_double("radius tolerance");
5267 cell_weight = prm.get_integer("cell weight");
5268
5269 // Enable printing of mortar information
5270 verbosity = string_to_enum<Verbosity>(prm.get("verbosity"),
5272 "verbosity");
5273 }
5274 prm.leave_subsection();
5275 }
5276
5277 // Explicitly instantiate template classes and structs
5278 template class Laser<2>;
5279 template class Laser<3>;
5280 template class PostProcessing<2>;
5281 template class PostProcessing<3>;
5282 template class IBParticles<2>;
5283 template class IBParticles<3>;
5284 template class Mesh<1>;
5285 template class Mesh<1, 2>;
5286 template class Mesh<2>;
5287 template class Mesh<2, 3>;
5288 template class Mesh<3>;
5289 template struct MeshBoxRefinement<2>;
5290 template struct MeshBoxRefinement<3>;
5291 template struct ConstrainSolidDomain<2>;
5292 template struct ConstrainSolidDomain<3>;
5293 template struct Mortar<2>;
5294 template struct Mortar<3>;
5295
5296} // namespace Parameters
Class used to rescale physical properties for cases where the main dimensions of the problems (Length...
void declare_parameters(ParameterHandler &prm)
Declare the parameters.
unsigned int nb_particles
bool enable_extra_sharp_interface_vtu_output_field
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
bool time_extrapolation_of_refinement_zone
void declare_default_entry(ParameterHandler &prm, unsigned int index)
Declare the default parameters.
unsigned int coupling_frequency
std::string ib_force_output_file
std::vector< IBParticle< dim > > particles
bool explicit_contact_impulsion_calculation
double refinement_inside_distance_factor
std::shared_ptr< Functions::ParsedFunction< dim > > f_gravity
unsigned int initial_refinement
unsigned int stencil_degree
bool explicit_position_integration_calculation
std::string ib_particles_pvd_file
double refinement_outside_distance_factor
double wall_rolling_friction_coefficient
Laser parameters - Defines the parameters for the laser heat source.
bool enable_angle_of_incidence_dependence
unsigned int perpendicular_plane_coordinate_one
enum Parameters::Laser::LaserType laser_type
unsigned int beam_orientation_coordinate
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
std::shared_ptr< Functions::ParsedFunction< dim > > laser_scan_path
Tensor< 1, dim > rotation_axis
Tensor< 2, dim > rotation_matrix
unsigned int perpendicular_plane_coordinate_two
double concentration_factor
Tensor< 1, dim > beam_axis
Laser_FreeSurfaceRadiation radiation
void declare_parameters(ParameterHandler &prm)
Declare the parameters.
double laser_absorptivity
enum Parameters::MaterialInteractions::MaterialInteractionsType material_interaction_type
std::pair< std::pair< unsigned int, unsigned int >, unsigned int > fluid_fluid_interaction_with_material_interaction_id
Definition parameters.h:802
EffectiveMediumModelType magnetic_permeability_effective_medium_model
Definition parameters.h:798
void parse_parameters(ParameterHandler &prm, const unsigned int id, const Parameters::Dimensionality &dimensions)
Parse the parameters.
MobilityCahnHilliardParameters mobility_cahn_hilliard_parameters
Definition parameters.h:783
enum Parameters::MaterialInteractions::MobilityCahnHilliardModel mobility_cahn_hilliard_model
void declare_parameters(ParameterHandler &prm, unsigned int id) const
Declare the parameters.
SurfaceTensionParameters surface_tension_parameters
Definition parameters.h:775
std::pair< std::pair< unsigned int, unsigned int >, unsigned int > fluid_solid_interaction_with_material_interaction_id
Definition parameters.h:804
EffectiveMediumModelType electric_permittivity_effective_medium_model
Definition parameters.h:796
std::pair< std::pair< unsigned int, unsigned int >, unsigned int > fluid_dispersed_phase_interaction_with_material_interaction_id
Definition parameters.h:806
enum Parameters::MaterialInteractions::SurfaceTensionModel surface_tension_model
double tracer_reaction_constant
Definition parameters.h:640
enum Parameters::Material::MagneticPermeabilityModel magnetic_permeability_model
enum Parameters::Material::DensityModel density_model
double magnetic_permeability_real
Magnetic_permeability.
Definition parameters.h:741
double tracer_reaction_threshold
Definition parameters.h:646
IsothermalIdealGasDensityParameters isothermal_ideal_gas_density_parameters
Definition parameters.h:666
enum Parameters::Material::RheologicalModel rheological_model
ImmersedSolidGaussianParameters immersed_solid_gaussian_parameters
Definition parameters.h:726
enum Parameters::Material::ThermalExpansionModel thermal_expansion_model
void parse_parameters(ParameterHandler &prm, const std::string &material_prefix, const unsigned int id, const Dimensionality &dimensions)
Parse the parameters for a material.
void declare_parameters(ParameterHandler &prm, const std::string &material_prefix, unsigned int id) const
Declare the parameters for a material.
double electric_permittivity_real
Electric_permittivity.
Definition parameters.h:747
enum Parameters::Material::TracerDiffusivityModel tracer_diffusivity_model
ImmersedSolidTanhParameters immersed_solid_tanh_parameters
Definition parameters.h:722
enum Parameters::Material::ElectricConductivityModel electric_conductivity_model
std::vector< double > electric_permittivity_imag_polynomial_coefficients
Definition parameters.h:750
double electric_conductivity
Electric_conductivity.
Definition parameters.h:737
enum Parameters::Material::ThermalConductivityModel thermal_conductivity_model
enum Parameters::Material::SpecificHeatModel specific_heat_model
std::vector< double > magnetic_permeability_real_polynomial_coefficients
Definition parameters.h:743
PhaseChange phase_change_parameters
Definition parameters.h:649
std::vector< double > electric_conductivity_polynomial_coefficients
Definition parameters.h:738
double electric_permittivity_imag
Definition parameters.h:748
double magnetic_permeability_imag
Definition parameters.h:742
NonNewtonian non_newtonian_parameters
Definition parameters.h:659
enum Parameters::Material::ElectricPermittivityModel electric_permittivity_model
std::vector< double > magnetic_permeability_imag_polynomial_coefficients
Definition parameters.h:744
std::vector< double > electric_permittivity_real_polynomial_coefficients
Definition parameters.h:749
enum Parameters::Material::TracerReactionPrefactorModel tracer_reaction_prefactor_model
Mesh - Parameters that control mesh reading and mesh generation.
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
static void declare_parameters(ParameterHandler &prm)
Declare the parameters.
unsigned int initial_refinement_at_boundaries
bool simplex
Allow the use of a simplex mesh.
std::string file_name
File name of the mesh.
Tensor< 1, spacedim > translation
double target_size
Target size when automatically refining initial mesh.
Tensor< 1, spacedim > rotation_axis
bool refine_until_target_size
Enable fixing initial refinement from a target size.
std::vector< int > boundaries_to_refine
List of boundary ids to refine.
bool check_for_diamond_cells
Enable checking the input grid for diamond-shaped cells.
unsigned int initial_refinement
Initial refinement level of primitive mesh.
std::string grid_arguments
Arguments of the GridTools.
bool expand_particle_wall_contact_search
std::string grid_type
Name of the grid in GridTools.
double scale
Rescale the grid by the scale factor.
std::map< std::pair< unsigned int, unsigned int >, unsigned int > fluid_dispersed_phase_interactions_with_material_interaction_ids
Definition parameters.h:869
void parse_parameters(ParameterHandler &prm, const Dimensionality &dimensions=Dimensionality())
Parse the parameters.
static constexpr unsigned int max_material_interactions
Definition parameters.h:863
static constexpr unsigned int max_solids
Definition parameters.h:851
void declare_parameters(ParameterHandler &prm)
Declare the parameters.
std::vector< Material > unresolved_dispersed_phases
Definition parameters.h:855
std::map< std::pair< unsigned int, unsigned int >, unsigned int > fluid_solid_interactions_with_material_interaction_ids
Definition parameters.h:867
static constexpr unsigned int max_unresolved_dispersed_phases
Definition parameters.h:857
unsigned int number_of_unresolved_dispersed_phases
Definition parameters.h:856
std::vector< Material > fluids
Definition parameters.h:844
std::vector< Material > solids
Definition parameters.h:849
unsigned int number_of_material_interactions
Definition parameters.h:862
std::map< std::pair< unsigned int, unsigned int >, unsigned int > fluid_fluid_interactions_with_material_interaction_ids
Definition parameters.h:865
std::vector< MaterialInteractions > material_interactions
Definition parameters.h:861
static constexpr unsigned int max_fluids
Definition parameters.h:846
Postprocessing - Defines the parameters for the post-processing. In Lethe, post-processing implies th...
unsigned int inlet_boundary_id
The inlet boundary ID for pressure drop calculation.
bool calculate_pressure_drop
Enable pressure drop post-processing.
bool calculate_geometric_melt_volume
Enable calculation of geometric melt volume in phase change problems.
unsigned int outlet_boundary_id
The outlet boundary ID for pressure drop calculation.
double initial_time_for_average_temp_and_hf
std::string barycenter_output_name
Prefix for the CLS and Cahn-Hilliard barycenter output.
std::string phase_energy_output_name
Prefix for the energy output in Cahn-Hilliard simulations.
bool output_q_criterion
Enable output of Q-criterion field.
std::string phase_output_name
Prefix for the phase output.
std::string kinetic_energy_output_name
Prefix for kinetic energy output.
std::string mass_conservation_output_name
Prefix for the CLS mass conservation output.
bool output_velocity_gradient
Enable output of velocity gradient field.
Verbosity verbosity
Verbosity level of the post-processed quantities.
bool calculate_pressure_power
Enable pressure power post-processing.
bool calculate_mass_conservation
Enable mass conservation calculation for both fluids in CLS simulations.
std::string algebraic_melt_volume_output_name
Prefix for the algebraic melt volume output.
std::string pressure_power_output_name
Prefix for the pressure power output.
bool calculate_phase_statistics
Enable phase statistics.
bool calculate_kinetic_energy
Enable total kinetic energy post-processing.
unsigned int calculation_frequency
Frequency of the calculation of post-processed quantities.
bool calculate_flow_rate
Enable flow rate post-processing.
bool calculate_tracer_statistics
Enable tracer statistics.
Parameters::FluidIndicator postprocessed_fluid
Fluid domain, used when post-processing a multiphase simulation.
bool calculate_enstrophy
Enable total enstrophy post-processing.
std::string apparent_viscosity_output_name
Prefix for the apparent viscosity output.
void declare_parameters(ParameterHandler &prm)
Declare the parameters.
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
std::string geometric_melt_volume_output_name
Prefix for the geometric melt volume output.
Parameters::FluidIndicator monitored_fluid_with_phase_change
FluidIndicator corresponding to the fluid which has phase change.
bool calculate_tracer_flow_rate
Enable tracer flow rate post-processing.
bool calculate_temperature_statistics
Enable temperature statistics.
bool calculate_viscous_dissipation
Enable viscous dissipation post-processing.
unsigned int output_frequency
Frequency of the output.
IsocontourBoundingBoxes isocontour_bounding_boxes
Contains all isocontour bounding boxes.
bool calculate_phase_energy
Enable energies calculation on the domain in Cahn-Hilliard simulations.
std::string tracer_flow_rate_output_name
Prefix for tracer flow rate output.
ProbingPoints probing_points
Contains all probing points.
std::string enstrophy_output_name
Prefix for the enstrophy output.
std::string viscous_dissipation_output_name
Prefix for the viscous dissipation output.
std::string temperature_output_name
Prefix for the temperature output.
double initial_time_for_average_velocities
Set initial time to start calculations for velocities.
std::string pressure_drop_output_name
Prefix for pressure drop output.
bool calculate_algebraic_melt_volume
Enable calculation of algebraic melt volume in phase change problems.
bool calculate_apparent_viscosity
Enable calculating apparent viscosity.
double melting_temperature
Melting temperature iso-value.
bool calculate_average_velocities
Enable velocity post-processing.
std::string flow_rate_output_name
Prefix for flow rate output.
bool calculate_heat_flux
Enable heat flux calculation.
std::string heat_flux_output_name
Prefix for the total heat flux output.
bool calculate_average_temp_and_hf
Enable average temperature and average heat flux post-processing.
std::string tracer_output_name
Prefix for the tracer output.
bool output_vorticity
Enable output of vorticity field.
std::string phase_volumes_output_name
prefix for the total volume output in cfd-dem simulation
ShapeType
enum class that associate an integer index tp each type of shape. The enumerator names are the values...
Definition shape.h:61
Tensor< 1, spacedim > value_string_to_tensor(const std::string &value_string)
Return the tensor corresponding to the value_string. If the dimension correspondence of the value_str...
Definition utilities.h:956
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
std::string enum_to_string(const EnumType value)
Return the name of an enumerator, e.g. to derive the default value string of a parameter entry from t...
Definition utilities.h:705
std::vector< T > convert_string_to_vector(const ParameterHandler &prm, const std::string &entry_string)
Return the vector of size N of entry @entry_string. If the entry is specified in the ....
Definition utilities.h:1330
int get_max_subsection_size(const std::string &file_name, const bool require_subsection_size=true)
Extract the maximum value between the number of boundary conditions and the number of manifolds from ...
Definition utilities.cc:736
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
std::string enum_to_selection(const DeprecatedEnumNames< EnumType > &deprecated_names={}, const std::vector< EnumType > &allowed_values={})
Return the selection string (e.g. "quiet|verbose|extra_verbose") of an enum parameter,...
Definition utilities.h:807
std::string enum_to_choices(const std::vector< EnumType > &allowed_values={})
Return the sentence listing the choices of an enum parameter (e.g. "Choices are <quiet|verbose|extra_...
Definition utilities.h:854
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
Variable
Solution fields of the different physics that are used as an indicator for multiple purposes (e....
@ electromagnetic_fields
Combination of both electric and magnetic fields from electromagnetics.
@ phase
Phase indicator scalar field from CLS.
@ magnetic_field
Magnetic field vector field from electromagnetics.
@ electric_field
Electric field vector field from electromagnetics.
@ velocity
Velocity vector field from fluid dynamics.
@ pressure
Pressure scalar field from fluid dynamics.
@ temperature
Temperature scalar field from heat transfer.
const std::vector< Verbosity > & quiet_or_verbose()
Return the verbosity levels accepted by the parameters which do not support Verbosity::extra_verbose.
const DeprecatedEnumNames< FluidIndicator > & deprecated_fluid_indicator_names()
Return the deprecated strings of the parameters parsed into a FluidIndicator, which remain accepted i...
SizeOfSubsections get_size_of_subsections(const std::string &file_name, const bool require_subsection_size=true)
Extract the maximum number of all variable size sections within the parameter file.
const std::vector< FluidIndicator > & single_fluid_indicators()
Return the fluid indicators accepted by the parameters which designate a single fluid.
const DeprecatedEnumNames< Verbosity > & deprecated_verbosity_names()
Return the deprecated strings of the parameters parsed into a Verbosity, which remain accepted in par...
const DeprecatedEnumNames< typename Shape< dim >::ShapeType > & deprecated_shape_type_names()
Return the deprecated strings of the shape types, which remain accepted in parameter files,...
DeclException1(NumberOfFluidsError, int,<< "Number of fluids: "<< arg1<< " is not 1 (single phase simulation) or 2 (CLS/Cahn-Hilliard simulations). This is currently not supported.")
DeclException4(ListSizeIncoherentWithDeclaredNumber, std::string, unsigned int, std::string, unsigned int,<< "'"<< arg1<< "' was set to "<< arg2<< " and the list '"<< arg3<< "' has a size of "<< arg4<< ". However, the list size should correspond to the number declared.")
DeclException3(MultipleAdaptationSizeError, std::string, unsigned int, unsigned int,<< "Error in 'mesh adaptation' : number of '"<< arg1<< "' ("<< arg2<< ") does not correspond to the number of 'variables' ("<< arg3<< ")")
DeclException2(PhaseChangeIntervalError, double, double,<< "Liquidus temperature : "<< arg1<< " is not strictly superior to Solidus temperature: "<< arg2<< " The liquidus temperature specific is below or equal to the solidus temperature."<< " The phase change specific heat model requires that T_liquidus>T_solidus.")
DeclExceptionMsg(MaterialInteractionTypeError, "Invalid material interaction type. The choices are <fluid_fluid|fluid_solid|fluid_dispersed_phase>.")
Carreau model to solve for non-Newtonian flows.
Definition parameters.h:361
void parse_parameters(ParameterHandler &prm, const Dimensionality &dimensions)
Parse the Carreau rheology parameters.
static void declare_parameters(ParameterHandler &prm)
Declare the Carreau rheology parameters.
Set of parameters constraining a certain portion of a fluid domain to null velocity and pressure fiel...
Definition parameters.h:911
std::vector< unsigned int > fluid_ids
Identifiers of fluids that are constrained.
Definition parameters.h:919
std::vector< double > filtered_phase_indicator_tolerance
Definition parameters.h:923
std::vector< double > temperature_max_values
Upper threshold values of the constraining field (temperature).
Definition parameters.h:929
static void declare_default_entries(ParameterHandler &prm)
Declare the default parameters for each constraint.
std::vector< double > temperature_min_values
Lower threshold values of the constraining field (temperature).
Definition parameters.h:926
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
Tensor< 1, dim > restriction_plane_normal_vector
Definition parameters.h:941
void parse_constraint_parameters(const ParameterHandler &prm, const unsigned int constraint_id)
Parse parameters for each constraint.
unsigned int number_of_constraints
Total number of constraints (maximum of 1 per fluid).
Definition parameters.h:916
bool enable
Enable/disable (true/false) the solid domain constraining feature.
Definition parameters.h:913
void declare_parameters(ParameterHandler &prm, const unsigned int max_number_of_constraints)
Declare the parameters.
FlowControl - Set average velocity on a boundary (CFD) or the domain (CFD-DEM).
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
static void declare_parameters(ParameterHandler &prm)
Declare the default parameters.
Evaporation - Defines the subparameters for the evaporation cooling and recoil pressure at the free s...
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
static void declare_parameters(ParameterHandler &prm)
Declare the default parameters.
enum Parameters::Evaporation::EvaporativeMassFluxModelType evaporative_mass_flux_model_type
FEM - The finite element section controls the properties of the finite element method....
unsigned int electromagnetics_test_degree
unsigned int void_fraction_degree
unsigned int solid_volume_fraction_degree
static void declare_parameters(ParameterHandler &prm)
Declare the parameters.
unsigned int velocity_degree
unsigned int solid_velocity_degree
Polynomial degree of the solid velocity of the Euler-Euler model.
unsigned int tracer_degree
bool enable_bubble_function_velocity
unsigned int temperature_degree
unsigned int electromagnetics_trial_degree
unsigned int CLS_degree
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
unsigned int phase_cahn_hilliard_degree
unsigned int potential_cahn_hilliard_degree
unsigned int pressure_degree
unsigned int qmom_degree
bool enable_bubble_function_pressure
Forces - Defines the parameters for the force calculation on boundaries of the domain.
unsigned int calculation_frequency
std::string torque_output_name
unsigned int output_frequency
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
unsigned int output_precision
std::string force_output_name
static void declare_parameters(ParameterHandler &prm)
Declare the parameters.
Gaussian-based physical properties model to handle properties at the interface of immersed solids and...
Definition parameters.h:457
static void declare_parameters(ParameterHandler &prm)
Declare the immersed-solid Gaussian model parameters.
void parse_parameters(ParameterHandler &prm, const Dimensionality &dimensions)
Parse the immersed-solid Gaussian model parameters.
Tanh-based physical properties model to handle properties in/out of immersed solids.
Definition parameters.h:425
void parse_parameters(ParameterHandler &prm, const Dimensionality &dimensions)
Parse the immersed-solid tanh model parameters.
static void declare_parameters(ParameterHandler &prm)
Declare the immersed-solid tanh model parameters.
Isothermal ideal gas model to solve for isothermal weakly compressible fluid flows.
Definition parameters.h:489
void parse_parameters(ParameterHandler &prm, const Dimensionality &dimensions)
Parse the isothermal ideal-gas density parameters.
double density_ref
Reference state density of the gas in kg/m^3.
Definition parameters.h:491
static void declare_parameters(ParameterHandler &prm)
Declare the isothermal ideal-gas density parameters.
double R
Specific gas constant in J/kg/K.
Definition parameters.h:493
double T
Absolute temperature of the ideal gas in K.
Definition parameters.h:495
Laser_FreeSurfaceRadiation - Defines the subparameters for the radiation sink at the free surface (ai...
static void declare_parameters(ParameterHandler &prm)
Declare the parameters.
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
LinearSolver - Parameters that control the solution of the linear system of equations that arise from...
MultigridCoarseningSequenceType mg_coarsening_type
double amg_precond_ilu_rtol
ILU relative tolerance for smoother.
bool amg_w_cycles
AMG W_cycle.
double amg_aggregation_threshold
AMG aggregation threshold.
double mg_gmres_tolerance
MG coarse-grid solver tolerance.
unsigned int amg_precond_ilu_fill
ILU fill for smoother.
bool enable_hessians_jacobian
Enable hessians in jacobian.
unsigned int mg_p_min_coarsening_degree
Minimum polynomial degree for p coarsening sequence.
CoarseGridSolverType mg_coarse_grid_solver
bool mg_enable_hessians_jacobian
MG enable hessians in jacobian.
MGTransferGlobalCoarseningTools::PolynomialCoarseningSequenceType mg_p_coarsening_type
Type of p coarsening sequence.
unsigned int ilu_precond_fill
ILU fill.
int mg_gmres_max_iterations
MG coarse-grid solver maximum number of iterations.
double ilu_precond_rtol
ILU relative tolerance.
PreconditionerType preconditioner
double mg_smoother_relaxation
MG smoother relaxation parameter.
double relative_residual
Relative residuals of the iterative solver.
int max_iterations
Maximum number of iterations.
int max_krylov_vectors
Maximum number of krylov vectors.
int eig_estimation_cg_n_iterations
MG number of cg iterations to find eigenvalue.
bool mg_amg_use_default_parameters
MG use default parameters for AMG.
int mg_gmres_max_krylov_vectors
MG coarse-grid solver maximum number of krylov vectors.
bool mg_smoother_eig_estimation
MG eigenvalue estimation for smoother relaxation parameter.
unsigned int mg_smoother_chebyshev_degree
Chebyshev smoother polynomial degree.
unsigned int amg_smoother_overlap
AMG Smoother overlap.
double minimum_residual
Minimum residual of the iterative solver.
MultigridSmootherPreconditionerType mg_smoother_preconditioner_type
unsigned int amg_n_cycles
AMG number of cycles.
double mg_gmres_reduce
MG coarse-grid solver reduce.
int mg_min_level
MG min level.
Verbosity mg_verbosity
MG information about levels.
int mg_int_level
MG intermediate level.
unsigned int mg_smoother_chebyshev_eig_cg_n_iterations
Chebyshev smoother eigenvalue-estimation CG/Lanczos iterations.
PreconditionerType mg_gmres_preconditioner
MG coarse-grid solver preconditioner.
double eig_estimation_smoothing_range
MG smoothing range to set range between eigenvalues.
unsigned int amg_smoother_sweeps
AMG Smoother sweeps.
Verbosity verbosity
Verbosity of linear solver.
static void declare_parameters(ParameterHandler &prm, const std::string &physics_name)
Declare the parameters.
@ lsmg
Local-Smoothing Geometric Multigrid.
double ilu_precond_atol
ILU absolute tolerance.
int mg_level_min_cells
MG minimum number of cells per level.
double mg_smoother_chebyshev_smoothing_range
Chebyshev smoother smoothing range (lambda_max / lambda_min).
bool mg_use_fe_q_iso_q1
MG use FE_Q_iso_Q1 elements for coarse grid.
bool enable_hessians_residual
Enable hessians in residual.
double amg_precond_ilu_atol
ILU absolute tolerance for smoother.
void parse_parameters(ParameterHandler &prm, const std::string &physics_name)
Parse the parameters.
bool force_linear_solver_continuation
Block linear solver to throw error.
int mg_smoother_iterations
MG smoother number of iterations.
Verbosity eig_estimation_verbose
MG print max, min, eigenvalues.
MeshAdaption - Parameters that control dynamic mesh adaptation. Dynamic mesh adaptation in Lethe is v...
enum Parameters::MeshAdaptation::Type type
std::map< Variable, MultipleAdaptationParameters > variables
static void declare_parameters(ParameterHandler &prm)
Declare the parameters.
enum Parameters::MeshAdaptation::FractionType fractionType
unsigned int initial_refinement
unsigned int maximum_number_elements
unsigned int maximum_refinement_level
std::vector< int > boundaries_to_fix
unsigned int minimum_refinement_level
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
unsigned int number_of_refinement_boxes
Number of boxes delimiting refinement regions.
void declare_parameters(ParameterHandler &prm)
Declare the parameters.
std::vector< unsigned int > box_additional_refinements
Vector of additional refinement values of the different boxes.
const unsigned int max_number_of_refinement_boxes
MobilityCahnHilliardParameters - Defines parameters for the mobility models used in the Cahn-Hilliard...
Definition parameters.h:562
static void declare_parameters(ParameterHandler &prm)
Declare the parameters.
void parse_parameters(const ParameterHandler &prm, const Parameters::Dimensionality &dimensions)
Parse the parameters.
Mortar - Defines parameters used to construct mortar elements.
Point< dim > center_of_rotation
Center of rotation of the rotor domain.
bool enable
Indicates whether mortar elements are enabled.
std::shared_ptr< Functions::ParsedFunction< dim > > rotor_angular_velocity
Angular velocity of the rotor domain.
void declare_parameters(ParameterHandler &prm)
Declare the default parameters.
unsigned int stator_boundary_id
Boundary ID # of the stator at the rotor-stator interface.
double sip_factor
Penalty factor for mortar elements.
unsigned int rotor_boundary_id
Boundary ID # of the rotor at the rotor-stator interface.
unsigned int cell_weight
Cell weight for load balancing of cells with mortar interfaces.
Verbosity verbosity
Type of verbosity for mortar.
unsigned int rotation_axis_direction
Rotation axis direction.
std::shared_ptr< Functions::ParsedFunction< dim > > rotor_rotation_angle
Rotation angle of the rotor domain in radians.
unsigned int oversampling_factor
Oversampling factor for quadrature points.
double radius_tolerance
Tolerance used for rotor-stator interface radius computation.
std::shared_ptr< Mesh< dim > > rotor_mesh
Mesh parameters for the rotor part.
enum Parameters::Mortar::InterfaceType interface_type
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
Mesh Adaptation Parameters that can differ for each refinement variable.
enum Parameters::MultipleAdaptationParameters::ErrorEstimator error_estimator
NonLinearSolver - Parameter that controls the solution of the non-linear problems.
KinsolStrategy kinsol_strategy
static void declare_parameters(ParameterHandler &prm, const std::string &physics_name)
Declare the parameters.
void parse_parameters(ParameterHandler &prm, const std::string &physics_name)
Parse the parameters.
void declare_parameters(ParameterHandler &prm) const
Declare the parameters for the selected non-Newtonian model.
PowerLawParameters powerlaw_parameters
Definition parameters.h:400
CarreauParameters carreau_parameters
Definition parameters.h:399
void parse_parameters(ParameterHandler &prm, const Dimensionality &dimensions)
Parse the parameters for the selected non-Newtonian model.
Phase change model for melting/freezing liquids The model assumes that the phase change occurs betwee...
Definition parameters.h:264
double thermal_conductivity_l
Thermal conductivity of liquid - Units in W/(m*K).
Definition parameters.h:281
double cp_l
Specific heat of liquid - Units in J/(kg*K).
Definition parameters.h:275
double T_liquidus
Liquidus temperature - Units in K.
Definition parameters.h:269
double penalty_l
Darcy penalty of liquid - Units in 1/(s).
Definition parameters.h:299
double thermal_conductivity_s
Thermal conductivity of solid - Units in W/(m*K).
Definition parameters.h:284
double kinematic_viscosity_l
kinematic viscosity of liquid - Units in m^2/(s)
Definition parameters.h:293
void parse_parameters(ParameterHandler &prm, const Dimensionality &dimensions)
Parse the phase change parameters.
double cp_s
Specific heat of solid - Units in J/(kg*K).
Definition parameters.h:278
static void declare_parameters(ParameterHandler &prm)
Declare the phase change parameters.
double thermal_expansion_l
Thermal expansion coefficient of liquid - Units in 1/K.
Definition parameters.h:287
double penalty_s
Darcy penalty of solid - Units in 1/(s).
Definition parameters.h:302
double T_solidus
Solidus temperature - Units in K.
Definition parameters.h:266
double kinematic_viscosity_s
kinematic viscosity of solid - Units in m^2/(s)
Definition parameters.h:296
double thermal_expansion_s
Thermal expansion coefficient of solid - Units in 1/K.
Definition parameters.h:290
double latent_enthalpy
Latent enthalpy for the phase change - Units in J/kg.
Definition parameters.h:272
void declare_parameters(ParameterHandler &prm)
Declare the parameters in the parameter handler.
unsigned int number_of_isocontour_bounding_boxes
Number of monitored isocontours.
std::multimap< Variable, std::pair< unsigned int, Isocontour > > ids_and_isocontours_per_variable
void parse_parameters(ParameterHandler &prm)
Parse the parameters from the parameter handler.
void declare_parameters(ParameterHandler &prm)
Declare the parameters in the parameter handler.
unsigned int max_number_of_probing_points
Maximum number of probing points.
void parse_parameters(ParameterHandler &prm)
Parse the parameters from the parameter handler.
void add_probing_point(const Variable &variable, const unsigned int &id, const Point< dim > &point)
Adds an entry to probing_points_per_variable.
std::vector< std::string > probing_points_output_names
Probing point output names ordered by ID.
unsigned int number_of_probing_points
Number of probing points.
Power-law rheological model to solve for non-Newtonian flows.
Definition parameters.h:328
static void declare_parameters(ParameterHandler &prm)
Declare the power-law rheology parameters.
void parse_parameters(ParameterHandler &prm, const Dimensionality &dimensions)
Parse the power-law rheology parameters.
Restart - Controls writing and reading simulation checkpoints.
unsigned int frequency
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
std::string filename
static void declare_parameters(ParameterHandler &prm)
Declare the parameters.
SimulationControl - Defines the parameter that control the flow of the simulation as well as the freq...
Definition parameters.h:87
unsigned int subdivision
Subdivisions of the results in the output.
Definition parameters.h:231
unsigned int log_frequency
Frequency of the log output to the terminal.
Definition parameters.h:225
enum Parameters::SimulationControl::OutputControl output_control
double output_time_frequency
Time frequency of the output (for time output control).
Definition parameters.h:211
static void declare_parameters(ParameterHandler &prm)
Declare the simulation control parameters.
unsigned int group_files
Number of vtu files written at an output step.
Definition parameters.h:234
unsigned int number_mesh_adaptation
Definition parameters.h:172
enum Parameters::SimulationControl::EndControl end_control
unsigned int output_iteration_frequency
Frequency of the output (for iteration output control).
Definition parameters.h:208
enum Parameters::SimulationControl::BDFStartupMethods bdf_startup_method
void parse_parameters(ParameterHandler &prm)
Parse the simulation control parameters.
std::vector< double > output_times_vector
Output at specific times (for time output control).
Definition parameters.h:214
unsigned int log_precision
Display precision of the log output to the terminal.
Definition parameters.h:228
std::vector< double > output_time_interval
Time window for file output (for both iteration and time output control).
Definition parameters.h:217
bool output_boundaries
Enable output of the boundaries in a separate VTU file.
Definition parameters.h:222
enum Parameters::SimulationControl::TimeSteppingMethod method
Stabilization - Defines parameters for an advanced control over the stabilization strategy used by th...
Definition parameters.h:988
static void declare_parameters(ParameterHandler &prm)
Declare the parameters.
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
enum Parameters::Stabilization::ScalarLimiters scalar_limiter
enum Parameters::Stabilization::NavierStokesStabilization stabilization
bool use_default_stabilization
Defines if default stabilization parameters should be used.
Definition parameters.h:990
SurfaceTensionParameters - Defines parameters for surface tension models.
Definition parameters.h:521
void parse_parameters(const ParameterHandler &prm, const Parameters::Dimensionality &dimensions)
Parse the parameters.
static void declare_parameters(ParameterHandler &prm)
Declare the parameters.
Testing - Some solvers have a specific testing mode that can be enabled to output more variables to t...
enum Parameters::Testing::TestType test_type
static void declare_parameters(ParameterHandler &prm)
Declare the parameters.
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
Timer - Defines the parameters that control the timing of the simulation. Lethe supports advanced tim...
static void declare_parameters(ParameterHandler &prm)
Declare the parameters.
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
bool write_time_in_error_table
VelocitySource - Adds velocity-dependent source term to the Navier-Stokes equations with the appropri...
std::vector< double > carman_kozeny_permeability_area
Permeability area of the pseudo-porous bed (solid phase).
PermeabilityModel permeability_model
Type of permeability model applied to the Navier-Stokes equations.
std::vector< double > carman_kozeny_tolerance
Tolerance in the Carman-Kozeny source term that avoids division by zero.
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
static void declare_parameters(ParameterHandler &prm)
Declare the parameters.
FluidIndicator fluid_with_phase_change
Indicates which fluids are with liquid-solid phase change.
RotatingFrameType rotating_frame_type