Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
parameters_multiphysics.cc
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2021-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
5#include <core/utilities.h>
6
7#include <deal.II/base/exceptions.h>
8#include <deal.II/base/parameter_handler.h>
9#include <deal.II/base/parsed_function.h>
10#include <deal.II/base/utilities.h>
11
12#include <algorithm>
13#include <cctype>
14#include <memory>
15#include <string>
16#include <vector>
17
19 SharpeningThresholdError,
20 double,
21 << "Sharpening threshold : " << arg1 << " is smaller than 0 or larger than 1."
22 << std::endl
23 << "Projection-based interface sharpening model requires a sharpening threshold between 0 and 1.");
24
26 SharpeningThresholdErrorMaxDeviation,
27 double,
28 << "Sharpening threshold max deviation : " << arg1
29 << " is smaller than 0 or larger than 0.5." << std::endl
30 << "Adaptive projection-based interface sharpening requires a maximum deviation of the"
31 << " sharpening threshold between 0.0 and 0.5. See documentation for further details");
32
34 ReinitializationMethodFrequencyError,
35 int,
36 << "Reinitialization method frequency : " << arg1
37 << " is equal or smaller than 0." << std::endl
38 << "Interface reinitialization method requires an frequency larger than 0.");
39
41 QMOMScalarNamesCountError,
42 std::size_t,
43 unsigned int,
44 << "The \"scalar names\" of the QMOM subsection has " << arg1
45 << " names, but the \"number of scalars\" is " << arg2 << "." << std::endl
46 << "Give one name per scalar, or no name to use scalar_0, scalar_1, ...");
47
49 QMOMScalarNameError,
50 std::string,
51 << "The scalar name \"" << arg1 << "\" of the QMOM subsection is invalid."
52 << std::endl
53 << "Scalar names may only contain letters, digits and underscores.");
54
55DeclException2(QMOMProcessConflictError,
56 std::string,
57 std::string,
58 << "The \"" << arg1
59 << "\" of the QMOM subsection contradicts the \"" << arg2
60 << "\" process, which imposes it." << std::endl
61 << "Remove \"" << arg1
62 << "\" from the parameter file, or set the "
63 << "process to generic.");
64
66 QMOMDistributionExpressionsCountError,
67 std::string,
68 unsigned int,
69 unsigned int,
70 << "The \"" << arg1
71 << "\" particle size distribution of the QMOM physics expects " << arg2
72 << " expressions, but " << arg3 << " are given." << std::endl
73 << "Give the number density, in particles per m^3, followed by the "
74 << "parameters of the distribution.");
75
76namespace Parameters
77{
78 namespace
79 {
80 /// Deprecated strings of the "transformation type" parameter
82 deprecated_transformation_type_names = {
83 {"piecewise polynomial",
85
86 /// Deprecated strings of the interface reinitialization method "type"
87 /// parameter
89 deprecated_reinitialization_method_type_names = {
90 {"projection-based interface sharpening",
92 {"pde-based interface reinitialization",
94 {"geometric interface reinitialization",
96
97 /// Deprecated strings of the "electromagnetic scaling type" parameter
99 deprecated_electromagnetic_scaling_type_names = {
100 {"electric field",
102 {"magnetic field",
104
105 /**
106 * @brief Check whether a QMOM scalar name is valid. The names are used as
107 * field names in the output files, so they may only contain letters,
108 * digits and underscores.
109 *
110 * @param[in] scalar_name Name of the scalar.
111 *
112 * @return Whether the name is non-empty and only contains letters, digits
113 * and underscores.
114 */
115 bool
116 is_valid_scalar_name(const std::string &scalar_name)
117 {
118 const auto is_valid_character = [](const char character) {
119 return std::isalnum(static_cast<unsigned char>(character)) != 0 ||
120 character == '_';
121 };
122 return !scalar_name.empty() &&
123 std::ranges::all_of(scalar_name, is_valid_character);
124 }
125 } // namespace
126} // namespace Parameters
127
128template <int dim>
129void
131{
132 prm.enter_subsection("multiphysics");
133 {
134 prm.declare_entry("fluid dynamics",
135 Patterns::Tools::Convert<bool>::to_string(fluid_dynamics),
136 Patterns::Bool(),
137 "Fluid flow calculation <true|false>");
138
139 prm.declare_entry("heat transfer",
140 Patterns::Tools::Convert<bool>::to_string(heat_transfer),
141 Patterns::Bool(),
142 "Thermic calculation <true|false>");
143
144 prm.declare_entry("tracer",
145 Patterns::Tools::Convert<bool>::to_string(tracer),
146 Patterns::Bool(),
147 "Passive tracer calculation <true|false>");
148
149 prm.declare_entry("cls",
150 Patterns::Tools::Convert<bool>::to_string(CLS),
151 Patterns::Bool(),
152 "CLS calculation <true|false>");
153
154 prm.declare_entry("cahn hilliard",
155 Patterns::Tools::Convert<bool>::to_string(cahn_hilliard),
156 Patterns::Bool(),
157 "Cahn-Hilliard calculation <true|false>");
158
159 prm.declare_entry(
160 "electromagnetics",
161 Patterns::Tools::Convert<bool>::to_string(electromagnetics),
162 Patterns::Bool(),
163 "Time harmonic electromagnetics calculation <true|false>");
164
165 prm.declare_entry("continuum solid dynamics",
166 Patterns::Tools::Convert<bool>::to_string(
168 Patterns::Bool(),
169 "Euler-Euler solid phase calculation <true|false>");
170
171 prm.declare_entry(
172 "qmom",
173 Patterns::Tools::Convert<bool>::to_string(qmom),
174 Patterns::Bool(),
175 "Quadrature method of moments calculation (requires QMOMKit) "
176 "<true|false>");
177
178 // subparameters for heat_transfer
179 prm.declare_entry("viscous dissipation",
180 Patterns::Tools::Convert<bool>::to_string(
182 Patterns::Bool(),
183 "Viscous dissipation in heat equation <true|false>");
184
185 prm.declare_entry("thermal buoyancy force",
186 Patterns::Tools::Convert<bool>::to_string(
188 Patterns::Bool(),
189 "Thermal buoyancy force calculation <true|false>");
190 prm.declare_entry("microwave heating",
191 Patterns::Tools::Convert<bool>::to_string(
193 Patterns::Bool(),
194 "Microwave heating calculation <true|false>");
195 }
196 prm.leave_subsection();
197
198 cls_parameters.declare_parameters(prm);
199 cahn_hilliard_parameters.declare_parameters(prm);
200 time_harmonic_maxwell_parameters.declare_parameters(prm);
201 qmom_parameters.declare_parameters(prm);
202}
203
204template <int dim>
205void
207 ParameterHandler &prm,
208 const Dimensionality &dimensions)
209{
210 prm.enter_subsection("multiphysics");
211 {
212 fluid_dynamics = prm.get_bool("fluid dynamics");
213 heat_transfer = prm.get_bool("heat transfer");
214 tracer = prm.get_bool("tracer");
215 CLS = prm.get_bool("cls");
216 cahn_hilliard = prm.get_bool("cahn hilliard");
217 electromagnetics = prm.get_bool("electromagnetics");
218 continuum_solid_dynamics = prm.get_bool("continuum solid dynamics");
219 qmom = prm.get_bool("qmom");
220
221 // subparameters for heat_transfer
222 viscous_dissipation = prm.get_bool("viscous dissipation");
223 thermal_buoyancy_force = prm.get_bool("thermal buoyancy force");
224 microwave_heating = prm.get_bool("microwave heating");
225 }
226 prm.leave_subsection();
227 cls_parameters.parse_parameters(prm);
228 cahn_hilliard_parameters.parse_parameters(prm, dimensions);
229 time_harmonic_maxwell_parameters.parse_parameters(prm, dimensions);
230 qmom_parameters.parse_parameters(prm);
231}
232
233void
234Parameters::CLS::declare_parameters(ParameterHandler &prm) const
235{
236 prm.enter_subsection("CLS");
237 {
238 reinitialization_method.declare_parameters(prm);
239 surface_tension_force.declare_parameters(prm);
240 phase_filter.declare_parameters(prm);
241
243 "viscous dissipative fluid",
245 "Fluid to which the viscous dissipation is applied "
246 "in the heat equation.",
248
249 prm.declare_entry(
250 "diffusivity",
251 Patterns::Tools::Convert<double>::to_string(diffusivity),
252 Patterns::Double(),
253 "Diffusivity (diffusion coefficient in L^2/s) in the phase indicator transport equation. "
254 "Default value is 0 to have pure advection.");
255
256 prm.declare_entry(
257 "compressible",
258 Patterns::Tools::Convert<bool>::to_string(compressible),
259 Patterns::Bool(),
260 "Enable phase compressibility in the CLS equation. This leads to the inclusion of the phase * div(u) term in the CLS equation. "
261 "It should be set to false when the phases are incompressible");
262 }
263 prm.leave_subsection();
264}
265
266void
268{
269 prm.enter_subsection("CLS");
270 {
271 reinitialization_method.parse_parameters(prm);
272 surface_tension_force.parse_parameters(prm);
273 phase_filter.parse_parameters(prm);
274
275 // Viscous dissipative fluid
277 string_to_enum<FluidIndicator>(prm.get("viscous dissipative fluid"),
279 "viscous dissipative fluid");
280
281 diffusivity = prm.get_double("diffusivity");
282
283 compressible = prm.get_bool("compressible");
284 }
285 prm.leave_subsection();
286}
287
288void
290 ParameterHandler &prm) const
291{
292 prm.enter_subsection("interface reinitialization method");
293 {
295 "type",
297 "CLS interface reinitialization method.",
298 deprecated_reinitialization_method_type_names);
299
300 prm.declare_entry(
301 "frequency",
302 Patterns::Tools::Convert<int>::to_string(frequency),
303 Patterns::Integer(0),
304 "Reinitialization frequency (number of time steps) at which the "
305 "interface reinitialization process will be applied to the CLS "
306 "phase indicator field.");
308 prm,
309 "verbosity",
310 verbosity,
311 "States whether the output from the interface reinitialization method "
312 "should be printed.",
314
315 sharpening.declare_parameters(prm);
316 pde_based_interface_reinitialization.declare_parameters(prm);
317 geometric_interface_reinitialization.declare_parameters(prm);
318 }
319 prm.leave_subsection();
320}
321
322void
324{
325 prm.enter_subsection("interface reinitialization method");
326 {
329 prm.get("type"), deprecated_reinitialization_method_type_names, "type");
332 sharpening.enable = true;
333 else if (this->reinitialization_method_type ==
336 else if (this->reinitialization_method_type ==
339
340 this->frequency = prm.get_integer("frequency");
341 Assert(this->frequency > 0,
342 ReinitializationMethodFrequencyError(this->frequency));
343
344 this->verbosity = string_to_enum<Verbosity>(prm.get("verbosity"),
346 "verbosity");
347
348 this->sharpening.parse_parameters(prm);
349 this->pde_based_interface_reinitialization.parse_parameters(prm);
350 this->geometric_interface_reinitialization.parse_parameters(prm);
351 }
352 prm.leave_subsection();
353}
354
355void
357{
358 const CLS_InterfaceSharpening defaults;
359 prm.enter_subsection("projection-based interface sharpening");
360 {
362 prm,
363 "type",
364 defaults.type,
365 "CLS interface sharpening type, "
366 "if constant the sharpening threshold is the same throughout the simulation, "
367 "if adaptive the sharpening threshold is determined by binary search, "
368 "to ensure mass conservation of the monitored phase.");
369
370 // Parameters for constant sharpening
371 prm.declare_entry(
372 "threshold",
373 Patterns::Tools::Convert<double>::to_string(defaults.threshold),
374 Patterns::Double(),
375 "Interface sharpening threshold that represents the phase indicator at which "
376 "the interphase is considered located");
377
378 // Parameters for adaptive sharpening
379 prm.declare_entry(
380 "threshold max deviation",
381 Patterns::Tools::Convert<double>::to_string(
382 defaults.threshold_max_deviation),
383 Patterns::Double(),
384 "Maximum deviation (from the base value of 0.5) considered in the search "
385 "algorithm to ensure mass conservation. "
386 "A threshold max deviation of 0.20 results in a search interval from 0.30 to 0.70");
387
388 prm.declare_entry(
389 "max iterations",
390 Patterns::Tools::Convert<int>::to_string(defaults.max_iterations),
391 Patterns::Integer(),
392 "Maximum number of iteration in the bissection algorithm that ensures mass conservation");
393
394 prm.declare_entry(
395 "monitoring",
396 Patterns::Tools::Convert<bool>::to_string(defaults.monitoring),
397 Patterns::Bool(),
398 "Enable conservation monitoring in multiphase fluid simulations <true|false>");
399
400 prm.declare_entry(
401 "tolerance",
402 Patterns::Tools::Convert<double>::to_string(defaults.tolerance),
403 Patterns::Double(),
404 "Tolerance on the mass conservation of the monitored fluid, used with adaptive sharpening");
405
407 prm,
408 "monitored fluid",
409 defaults.monitored_fluid,
410 "Fluid for which conservation is monitored, used with adaptive sharpening.",
413
414 // This parameter must be larger than 1 for interface sharpening. Choosing
415 // values less than 1 leads to interface smoothing instead of sharpening.
416 prm.declare_entry(
417 "interface sharpness",
418 Patterns::Tools::Convert<double>::to_string(defaults.interface_sharpness),
419 Patterns::Double(),
420 "Sharpness of the moving interface (parameter alpha in the interface sharpening model)");
421 }
422 prm.leave_subsection();
423}
424
425void
427{
428 prm.enter_subsection("projection-based interface sharpening");
429 {
430 interface_sharpness = prm.get_double("interface sharpness");
431
432 // Sharpening type
434
435 // Parameters for constant sharpening
436 threshold = prm.get_double("threshold");
437
438 // Parameters for adaptive sharpening
439 threshold_max_deviation = prm.get_double("threshold max deviation");
440 max_iterations = prm.get_integer("max iterations");
441 monitoring = prm.get_bool("monitoring");
442 tolerance = prm.get_double("tolerance");
443
444 // Monitored fluid
446 string_to_enum<FluidIndicator>(prm.get("monitored fluid"),
448 "monitored fluid");
449
450 // Error definitions
451 Assert(threshold > 0.0 && threshold < 1.0,
452 SharpeningThresholdError(threshold));
453
455 SharpeningThresholdErrorMaxDeviation(threshold_max_deviation));
456 }
457 prm.leave_subsection();
458}
459
460void
462{
463 const CLS_SurfaceTensionForce defaults;
464 prm.enter_subsection("surface tension force");
465 {
466 prm.declare_entry("enable",
467 Patterns::Tools::Convert<bool>::to_string(
468 defaults.enable),
469 Patterns::Bool(),
470 "Enable surface tension force calculation <true|false>");
471
472 prm.declare_entry("output auxiliary fields",
473 Patterns::Tools::Convert<bool>::to_string(
475 Patterns::Bool(),
476 "Output the phase indicator gradient and curvature");
477
478 prm.declare_entry(
479 "phase indicator gradient diffusion factor",
480 Patterns::Tools::Convert<double>::to_string(
482 Patterns::Double(),
483 "Factor applied to the filter for phase indicator gradient calculations to damp high-frequency errors");
484
485 prm.declare_entry(
486 "curvature diffusion factor",
487 Patterns::Tools::Convert<double>::to_string(
489 Patterns::Double(),
490 "Factor applied to the filter for curvature calculations to damp high-frequency errors");
491
493 prm,
494 "verbosity",
495 defaults.verbosity,
496 "State whether the output from the surface tension force calculations should be printed.",
499
500
501 prm.declare_entry("enable marangoni effect",
502 Patterns::Tools::Convert<bool>::to_string(
503 defaults.enable_marangoni_effect),
504 Patterns::Bool(),
505 "Enable marangoni effect calculation <true|false>");
506 }
507 prm.leave_subsection();
508}
509
510void
512{
513 prm.enter_subsection("surface tension force");
514 {
515 enable = prm.get_bool("enable");
517 prm.get_double("phase indicator gradient diffusion factor");
518 curvature_diffusion_factor = prm.get_double("curvature diffusion factor");
519
520 output_cls_auxiliary_fields = prm.get_bool("output auxiliary fields");
521
522 verbosity = string_to_enum<Verbosity>(prm.get("verbosity"),
524 "verbosity");
525
526 enable_marangoni_effect = prm.get_bool("enable marangoni effect");
527 }
528 prm.leave_subsection();
529}
530
531void
533{
534 const CLS_PhaseFilter defaults;
535 prm.enter_subsection("phase filtration");
536 {
538 prm,
539 "type",
540 defaults.type,
541 "CLS phase indicator filtration type, "
542 "if <none> is selected, the phase won't be filtered; "
543 "if <tanh> is selected, the filtered phase will be a result of the "
544 "following function: \\alpha_f = 0.5 \\tanh(\\beta(\\alpha-0.5)) + 0.5; "
545 "where \\beta is a parameter influencing the interface thickness that "
546 "must be defined.",
547 {},
548 {Parameters::FilterType::none, Parameters::FilterType::tanh});
549 prm.declare_entry(
550 "beta",
551 Patterns::Tools::Convert<double>::to_string(defaults.beta),
552 Patterns::Double(),
553 "This parameter appears in the tanh filter function. It influence "
554 "the thickness and the shape of the interface. For higher values of "
555 "beta, a thinner and 'sharper/pixelated' interface will be seen.");
557 "verbosity",
558 defaults.verbosity,
559 "States whether the filtered data should be printed.",
562 }
563 prm.leave_subsection();
564}
565
566void
568{
569 prm.enter_subsection("phase filtration");
570 {
571 // filter type
573
574 // beta
575 beta = prm.get_double("beta");
576
577 // Verbosity
578 verbosity = string_to_enum<Verbosity>(prm.get("verbosity"),
580 "verbosity");
581 }
582 prm.leave_subsection();
583}
584
585void
587 dealii::ParameterHandler &prm)
588{
590 prm.enter_subsection("PDE-based interface reinitialization");
591 {
592 prm.declare_entry(
593 "output reinitialization steps",
594 Patterns::Tools::Convert<bool>::to_string(
596 Patterns::Bool(),
597 "Enables pvtu format outputs of the PDE-based interface reinitialization "
598 "steps <true|false>");
599 prm.declare_entry(
600 "diffusivity multiplier",
601 Patterns::Tools::Convert<double>::to_string(
602 defaults.diffusivity_multiplier),
603 Patterns::Double(),
604 "Factor that multiplies the mesh-size in the mesh-dependant diffusion "
605 "coefficient of the PDE-based interface reinitialization.");
606 prm.declare_entry(
607 "diffusivity power",
608 Patterns::Tools::Convert<double>::to_string(defaults.diffusivity_power),
609 Patterns::Double(),
610 "Power value applied to the mesh-size in the mesh-dependant diffusion "
611 "coefficient of the PDE-based interface reinitialization.");
612 prm.declare_entry("steady-state criterion",
613 Patterns::Tools::Convert<double>::to_string(
614 defaults.steady_state_criterion),
615 Patterns::Double(),
616 "Tolerance for the artificial time-stepping scheme.");
617 prm.declare_entry("max steps number",
618 Patterns::Tools::Convert<double>::to_string(
619 defaults.max_steps_number),
620 Patterns::Integer(),
621 "Maximum number of reinitialization steps.");
622 prm.declare_entry(
623 "artificial time-step factor",
624 Patterns::Tools::Convert<double>::to_string(defaults.dtau_factor),
625 Patterns::Double(),
626 "Factor multiplying the artificial time step in the PDE-based "
627 "interface reinitialization.");
628 }
629 prm.leave_subsection();
630}
631
632void
634 dealii::ParameterHandler &prm)
635{
636 prm.enter_subsection("PDE-based interface reinitialization");
637 {
639 prm.get_bool("output reinitialization steps");
640 this->diffusivity_multiplier = prm.get_double("diffusivity multiplier");
641 this->diffusivity_power = prm.get_double("diffusivity power");
642 this->dtau_factor = prm.get_double("artificial time-step factor");
643 this->steady_state_criterion = prm.get_double("steady-state criterion");
644 this->max_steps_number = prm.get_integer("max steps number");
645 }
646 prm.leave_subsection();
647}
648
649void
651 dealii::ParameterHandler &prm)
652{
654 prm.enter_subsection("geometric interface reinitialization");
655 {
656 prm.declare_entry(
657 "output signed distance",
658 Patterns::Tools::Convert<bool>::to_string(
659 defaults.output_signed_distance),
660 Patterns::Bool(),
661 "Enables pvtu format outputs of the geometric interface reinitialization "
662 "steps <true|false>");
663 prm.declare_entry("max reinitialization distance",
664 Patterns::Tools::Convert<double>::to_string(
666 Patterns::Double(),
667 "Maximum reinitialization distance value");
669 prm,
670 "transformation type",
671 defaults.transformation_type,
672 "Transformation function used to get the phase indicator from the signed "
673 "distance.",
674 deprecated_transformation_type_names);
675 prm.declare_entry("tanh thickness",
676 Patterns::Tools::Convert<double>::to_string(
677 defaults.tanh_thickness),
678 Patterns::Double(),
679 "Interface thickness for the tanh transformation");
680 }
681 prm.leave_subsection();
682}
683
684void
686 dealii::ParameterHandler &prm)
687{
688 prm.enter_subsection("geometric interface reinitialization");
689 {
690 this->output_signed_distance = prm.get_bool("output signed distance");
692 prm.get_double("max reinitialization distance");
693 this->transformation_type =
695 prm.get("transformation type"),
696 deprecated_transformation_type_names,
697 "transformation type");
698 this->tanh_thickness = prm.get_double("tanh thickness");
699 }
700 prm.leave_subsection();
701}
702
703void
705{
706 const CahnHilliard_PhaseFilter defaults;
707 prm.enter_subsection("phase filtration");
708 {
710 prm,
711 "type",
712 defaults.type,
713 "CahnHilliard phase filtration type, "
714 "if <none> is selected, the phase won't be filtered; "
715 "if <clip> is selected, the phase order values above 1 (respectively below -1) will be brought back to 1 (respectively -1); "
716 "if <tanh> is selected, the filtered phase will be a result of the "
717 "following function: \\alpha_f = \\tanh(\\beta\\alpha); "
718 "where beta is a parameter influencing the interface thickness that "
719 "must be defined.");
720 prm.declare_entry(
721 "beta",
722 Patterns::Tools::Convert<double>::to_string(defaults.beta),
723 Patterns::Double(),
724 "This parameter appears in the tanh filter function. It influence "
725 "the thickness and the shape of the interface. For higher values of "
726 "beta, a thinner and 'sharper/pixelated' interface will be seen.");
728 "verbosity",
729 defaults.verbosity,
730 "States whether the filtered data should be printed.",
733 }
734 prm.leave_subsection();
735}
736
737void
739{
740 prm.enter_subsection("phase filtration");
741 {
742 // filter type
744
745 // beta
746 beta = prm.get_double("beta");
747
748 // Verbosity
749 verbosity = string_to_enum<Verbosity>(prm.get("verbosity"),
751 "verbosity");
752 }
753 prm.leave_subsection();
754}
755
756void
758{
759 prm.enter_subsection("cahn hilliard");
760 {
761 cahn_hilliard_phase_filter.declare_parameters(prm);
762
763 prm.declare_entry(
764 "potential smoothing coefficient",
765 Patterns::Tools::Convert<double>::to_string(
767 Patterns::Double(),
768 "Smoothing coefficient for the chemical potential in the Cahn-Hilliard equations.");
769
770 prm.enter_subsection("epsilon");
771 {
773 prm,
774 "method",
776 "Epsilon is either set to two times the characteristic length (automatic) of the element or user defined on all the domain (manual).");
777
778 prm.declare_entry(
779 "value",
780 Patterns::Tools::Convert<double>::to_string(epsilon),
781 Patterns::Double(),
782 "Parameter linked to the interface thickness. Should always be bigger than the characteristic size of the smallest element");
783
785 prm,
786 "verbosity",
788 "Display the value of epsilon for each time iteration if set to verbose.");
789 }
790 prm.leave_subsection();
791 }
792 prm.leave_subsection();
793}
794
795void
797 const Dimensionality &dimensions)
798{
799 prm.enter_subsection("cahn hilliard");
800 {
801 cahn_hilliard_phase_filter.parse_parameters(prm);
802
804 prm.get_double("potential smoothing coefficient");
805
806 prm.enter_subsection("epsilon");
807 {
810
813
814 epsilon = prm.get_double("value");
816 }
817 prm.leave_subsection();
818 }
819 prm.leave_subsection();
820}
821
822void
824{
825 const QMOMPhaseEvolution defaults;
826 prm.enter_subsection("phase evolution");
827 {
828 prm.declare_entry("enable adaptive node count",
829 Patterns::Tools::Convert<bool>::to_string(
831 Patterns::Bool(),
832 "Enable adaptive quadrature node count <true|false>");
833 }
834 prm.leave_subsection();
835}
836
837void
839{
840 prm.enter_subsection("phase evolution");
841 {
842 enable_adaptive_node_count = prm.get_bool("enable adaptive node count");
843 }
844 prm.leave_subsection();
845}
846
847void
848Parameters::QMOM::declare_parameters(ParameterHandler &prm) const
849{
850 const QMOM defaults;
851 prm.enter_subsection("QMOM");
852 {
854 "process",
855 defaults.process,
856 "Process simulated. A process other than generic "
857 "imposes the scalars and the number of moments.");
858
859 prm.declare_entry("number of scalars",
860 Patterns::Tools::Convert<unsigned int>::to_string(
861 defaults.number_of_scalars),
862 Patterns::Integer(0),
863 "Number of scalars transported together with the "
864 "moments");
865
866 prm.declare_entry("scalar names",
867 "",
868 Patterns::List(Patterns::Anything()),
869 "Comma-separated names of the scalars, used for the "
870 "output. If empty, the scalars are named scalar_0, "
871 "scalar_1, ...");
872
873 prm.declare_entry("number of moments",
874 Patterns::Tools::Convert<unsigned int>::to_string(
875 defaults.number_of_moments),
876 Patterns::Integer(1),
877 "Number of transported raw moments. The quadrature has "
878 "half as many nodes, rounded up.");
879
881 "splitting scheme",
882 defaults.splitting_scheme,
883 "Operator splitting scheme between the physical-space "
884 "transport and the phase-space evolution");
885
886 prm.declare_entry("enable nucleation",
887 Patterns::Tools::Convert<bool>::to_string(
888 defaults.enable_nucleation),
889 Patterns::Bool(),
890 "Include the nucleation source <true|false>");
891
892 prm.declare_entry("enable coalescence",
893 Patterns::Tools::Convert<bool>::to_string(
894 defaults.enable_coalescence),
895 Patterns::Bool(),
896 "Include the coalescence source <true|false>");
897
898 prm.declare_entry("enable growth",
899 Patterns::Tools::Convert<bool>::to_string(
900 defaults.enable_growth),
901 Patterns::Bool(),
902 "Include the growth source <true|false>");
903
904 phase_evolution.declare_parameters(prm);
905 lipid_nanoparticle_production.declare_parameters(prm);
906 physical_constants.declare_parameters(prm);
907 }
908 prm.leave_subsection();
909}
910
911void
913{
914 prm.enter_subsection("QMOM");
915 {
916 process = string_to_enum<QMOMProcess>(prm.get("process"));
917 number_of_scalars = prm.get_integer("number of scalars");
918 number_of_moments = prm.get_integer("number of moments");
919 scalar_names = Utilities::split_string_list(prm.get("scalar names"));
920
921 // A process other than generic imposes its scalars and its number of
922 // moments. The entries of the parameter file are ignored, but must not
923 // contradict the process.
924 std::vector<std::string> process_scalar_names;
925 unsigned int process_number_of_moments = number_of_moments;
926 switch (process)
927 {
929 break;
931 process_scalar_names = {"ethanol_concentration",
932 "free_lipids_concentration"};
933 process_number_of_moments = 8; // 4-node quadrature
934 break;
935 }
937 {
938 const QMOM defaults;
939 AssertThrow(number_of_scalars == defaults.number_of_scalars ||
940 number_of_scalars == process_scalar_names.size(),
941 QMOMProcessConflictError("number of scalars",
943 AssertThrow(scalar_names.empty() ||
944 scalar_names == process_scalar_names,
945 QMOMProcessConflictError("scalar names",
947 AssertThrow(number_of_moments == defaults.number_of_moments ||
948 number_of_moments == process_number_of_moments,
949 QMOMProcessConflictError("number of moments",
951 number_of_scalars = process_scalar_names.size();
952 scalar_names = process_scalar_names;
953 number_of_moments = process_number_of_moments;
954 }
956
957 if (scalar_names.empty())
958 for (unsigned int i_scalar = 0; i_scalar < number_of_scalars; ++i_scalar)
959 scalar_names.emplace_back("scalar_" + std::to_string(i_scalar));
960 AssertThrow(scalar_names.size() == number_of_scalars,
961 QMOMScalarNamesCountError(scalar_names.size(),
963 for (const std::string &scalar_name : scalar_names)
964 AssertThrow(is_valid_scalar_name(scalar_name),
965 QMOMScalarNameError(scalar_name));
966
968 prm.get("splitting scheme"));
969
970 enable_nucleation = prm.get_bool("enable nucleation");
971 enable_coalescence = prm.get_bool("enable coalescence");
972 enable_growth = prm.get_bool("enable growth");
973
974 phase_evolution.parse_parameters(prm);
975 lipid_nanoparticle_production.parse_parameters(prm);
976 physical_constants.parse_parameters(prm);
977 }
978 prm.leave_subsection();
979}
980
981void
983 ParameterHandler &prm) const
984{
985 const QMOMLipidNanoparticleProduction defaults;
986 prm.enter_subsection("lipid nanoparticle production");
987 {
988 prm.declare_entry("operating temperature",
989 Patterns::Tools::Convert<double>::to_string(
990 defaults.operating_temperature),
991 Patterns::Double(0.),
992 "Operating temperature [K]");
993
994 prm.declare_entry(
995 "flow rate ratio",
996 Patterns::Tools::Convert<double>::to_string(defaults.flow_rate_ratio),
997 Patterns::Double(0.),
998 "Ratio of the aqueous phase flow rate to the organic phase flow rate [-]");
999
1000 prm.declare_entry(
1001 "total flow rate",
1002 Patterns::Tools::Convert<double>::to_string(defaults.total_flow_rate),
1003 Patterns::Double(0.),
1004 "Total flow rate of the aqueous and organic phases [m^3/s]");
1005
1006 prm.declare_entry(
1007 "mixing time scale",
1008 Patterns::Tools::Convert<double>::to_string(defaults.mixing_time_scale),
1009 Patterns::Double(0.),
1010 "Mixing time scale of the aqueous and organic phases [s]");
1011
1012 prm.declare_entry(
1013 "initial concentration organic",
1014 Patterns::Tools::Convert<double>::to_string(
1016 Patterns::Double(0.),
1017 "Initial lipid concentration in the organic phase [mol/m^3]");
1018
1019 prm.declare_entry("ion concentration mixture",
1020 Patterns::Tools::Convert<double>::to_string(
1021 defaults.ion_concentration_mixture),
1022 Patterns::Double(0.),
1023 "Ion concentration in the mixture [mol/m^3]");
1024
1025 prm.declare_entry("density aqueous",
1026 Patterns::Tools::Convert<double>::to_string(
1027 defaults.density_aqueous),
1028 Patterns::Double(0.),
1029 "Density of the aqueous phase [kg/m^3]");
1030
1031 prm.declare_entry("molar mass aqueous",
1032 Patterns::Tools::Convert<double>::to_string(
1033 defaults.molar_mass_aqueous),
1034 Patterns::Double(0.),
1035 "Molar mass of the aqueous phase [kg/mol]");
1036
1037 prm.declare_entry(
1038 "mole fraction solubility aqueous",
1039 Patterns::Tools::Convert<double>::to_string(
1041 Patterns::Double(0., 1.),
1042 "Mole fraction solubility of the lipid in the pure aqueous phase [-]");
1043
1044 prm.declare_entry("permittivity aqueous",
1045 Patterns::Tools::Convert<double>::to_string(
1046 defaults.permittivity_aqueous),
1047 Patterns::Double(0.),
1048 "Relative permittivity of the aqueous phase [-]");
1049
1050 prm.declare_entry("density organic",
1051 Patterns::Tools::Convert<double>::to_string(
1052 defaults.density_organic),
1053 Patterns::Double(0.),
1054 "Density of the organic phase [kg/m^3]");
1055
1056 prm.declare_entry("molar mass organic",
1057 Patterns::Tools::Convert<double>::to_string(
1058 defaults.molar_mass_organic),
1059 Patterns::Double(0.),
1060 "Molar mass of the organic phase [kg/mol]");
1061
1062 prm.declare_entry(
1063 "mole fraction solubility organic",
1064 Patterns::Tools::Convert<double>::to_string(
1066 Patterns::Double(0., 1.),
1067 "Mole fraction solubility of the lipid in the pure organic phase [-]");
1068
1069 prm.declare_entry("permittivity organic",
1070 Patterns::Tools::Convert<double>::to_string(
1071 defaults.permittivity_organic),
1072 Patterns::Double(0.),
1073 "Relative permittivity of the organic phase [-]");
1074
1075 prm.declare_entry(
1076 "viscosity mixture",
1077 Patterns::Tools::Convert<double>::to_string(defaults.viscosity_mixture),
1078 Patterns::Double(0.),
1079 "Dynamic viscosity of the aqueous and organic mixture [Pa s]");
1080
1081 prm.declare_entry(
1082 "shape factor",
1083 Patterns::Tools::Convert<double>::to_string(defaults.shape_factor),
1084 Patterns::Double(0.),
1085 "Volume shape factor of the particles, pi/6 for spheres [-]");
1086 }
1087 prm.leave_subsection();
1088}
1089
1090void
1092 ParameterHandler &prm)
1093{
1094 prm.enter_subsection("lipid nanoparticle production");
1095 {
1096 operating_temperature = prm.get_double("operating temperature");
1097 flow_rate_ratio = prm.get_double("flow rate ratio");
1098 total_flow_rate = prm.get_double("total flow rate");
1099 mixing_time_scale = prm.get_double("mixing time scale");
1101 prm.get_double("initial concentration organic");
1102 ion_concentration_mixture = prm.get_double("ion concentration mixture");
1103 density_aqueous = prm.get_double("density aqueous");
1104 molar_mass_aqueous = prm.get_double("molar mass aqueous");
1106 prm.get_double("mole fraction solubility aqueous");
1107 permittivity_aqueous = prm.get_double("permittivity aqueous");
1108 density_organic = prm.get_double("density organic");
1109 molar_mass_organic = prm.get_double("molar mass organic");
1111 prm.get_double("mole fraction solubility organic");
1112 permittivity_organic = prm.get_double("permittivity organic");
1113 viscosity_mixture = prm.get_double("viscosity mixture");
1114 shape_factor = prm.get_double("shape factor");
1115 }
1116 prm.leave_subsection();
1117}
1118
1119void
1121 ParameterHandler &prm) const
1122{
1123 const QMOMPhysicalConstants defaults;
1124 prm.enter_subsection("physical constants");
1125 {
1126 prm.declare_entry("boltzmann constant",
1127 Patterns::Tools::Convert<double>::to_string(
1128 defaults.boltzmann_constant),
1129 Patterns::Double(0.),
1130 "Boltzmann constant [J/K]");
1131
1132 prm.declare_entry("avogadro number",
1133 Patterns::Tools::Convert<double>::to_string(
1134 defaults.avogadro_number),
1135 Patterns::Double(0.),
1136 "Avogadro number [1/mol]");
1137
1138 prm.declare_entry("elementary charge",
1139 Patterns::Tools::Convert<double>::to_string(
1140 defaults.elementary_charge),
1141 Patterns::Double(0.),
1142 "Elementary charge [C]");
1143
1144 prm.declare_entry("permittivity vacuum",
1145 Patterns::Tools::Convert<double>::to_string(
1146 defaults.permittivity_vacuum),
1147 Patterns::Double(0.),
1148 "Vacuum permittivity [F/m]");
1149 }
1150 prm.leave_subsection();
1151}
1152
1153void
1155{
1156 prm.enter_subsection("physical constants");
1157 {
1158 boltzmann_constant = prm.get_double("boltzmann constant");
1159 avogadro_number = prm.get_double("avogadro number");
1160 elementary_charge = prm.get_double("elementary charge");
1161 permittivity_vacuum = prm.get_double("permittivity vacuum");
1162 }
1163 prm.leave_subsection();
1164}
1165
1166unsigned int
1168 const QMOMDistributionType distribution_type)
1169{
1170 switch (distribution_type)
1171 {
1173 return 0;
1179 return 2;
1182 return 1;
1183 }
1184 AssertThrow(false, ExcInternalError());
1185 return 0;
1186}
1187
1188template <int dim>
1189void
1191{
1192 prm.enter_subsection("scalars");
1193 {
1194 // The number of scalars is not known yet: a single expression is declared
1195 // by default, which is valid for a single scalar and ignored without
1196 // scalars
1197 Functions::ParsedFunction<dim>::declare_parameters(prm);
1198 }
1199 prm.leave_subsection();
1200
1201 prm.enter_subsection("distribution");
1202 {
1204 "type",
1206 "Family of the particle size distribution from which "
1207 "the moments are computed.");
1208 Functions::ParsedFunction<dim>::declare_parameters(prm);
1209 }
1210 prm.leave_subsection();
1211}
1212
1213template <int dim>
1214void
1216{
1217 // The expressions are split as in FunctionParser, so that the number of
1218 // components of each function matches the number of expressions
1219 const auto count_expressions = [&prm]() {
1220 return static_cast<unsigned int>(
1221 Utilities::split_string_list(prm.get("Function expression"), ';').size());
1222 };
1223
1224 prm.enter_subsection("scalars");
1225 {
1226 scalars =
1227 std::make_shared<Functions::ParsedFunction<dim>>(count_expressions());
1228 scalars->parse_parameters(prm);
1229 }
1230 prm.leave_subsection();
1231
1232 prm.enter_subsection("distribution");
1233 {
1235 const unsigned int n_expressions = count_expressions();
1237 {
1238 const unsigned int n_expected_expressions =
1240 AssertThrow(n_expressions == n_expected_expressions,
1241 QMOMDistributionExpressionsCountError(
1242 prm.get("type"), n_expected_expressions, n_expressions));
1243 }
1244 distribution =
1245 std::make_shared<Functions::ParsedFunction<dim>>(n_expressions);
1246 distribution->parse_parameters(prm);
1247 }
1248 prm.leave_subsection();
1249}
1250
1251template <int dim>
1252void
1254{
1255 scalars->set_time(time);
1256 distribution->set_time(time);
1257}
1258
1259template <int dim>
1260void
1262 ParameterHandler &prm) const
1263{
1264 prm.enter_subsection("time harmonic maxwell");
1265 {
1266 prm.enter_subsection("time coupling strategy");
1267 {
1269 "type",
1271 "The type of time coupling strategy to use.");
1272
1273 prm.declare_entry(
1274 "coupling iteration",
1275 Patterns::Tools::Convert<unsigned int>::to_string(coupling_iteration),
1276 Patterns::Integer(1),
1277 "Coupling parameter for the time coupling strategy based on "
1278 "iteration, this parameter represents the number of time iterations "
1279 "between two consecutive resolutions of the electromagnetic fields.");
1280
1281 prm.declare_entry(
1282 "coupling time",
1283 Patterns::Tools::Convert<double>::to_string(coupling_time),
1284 Patterns::Double(DBL_MIN),
1285 "Coupling parameter for the time coupling strategy based on time. "
1286 "This parameter represents the real time interval between two "
1287 "consecutive resolutions of the electromagnetic fields.");
1288
1289 prm.declare_entry(
1290 "coupling threshold",
1291 Patterns::Tools::Convert<double>::to_string(coupling_threshold),
1292 Patterns::Double(0),
1293 "Coupling parameter for the time coupling strategy based on a "
1294 "threshold. This parameter represents the change in the "
1295 "electromagnetic properties of the medium (i.e., permittivity, "
1296 "permeability or conductivity) that triggers the recomputation of "
1297 "the electromagnetic fields.)");
1298 }
1299 prm.leave_subsection();
1300
1301
1302 prm.declare_entry(
1303 "electromagnetic frequency",
1304 Patterns::Tools::Convert<double>::to_string(electromagnetic_frequency),
1305 Patterns::Double(0),
1306 "Frequency of the time harmonic electromagnetic wave excitation (in Hz).");
1307
1309 prm,
1310 "electromagnetic scaling type",
1312 "The type of electromagnetic scaling to apply to the solution of the time-harmonic Maxwell solver after solving the linear system. This is relevant when the user wants to recover the physical solution in dimensional units instead of the dimensionless solution used for better conditioning of the linear system.",
1313 deprecated_electromagnetic_scaling_type_names);
1314
1315 prm.declare_entry(
1316 "electric field amplitude",
1317 Patterns::Tools::Convert<double>::to_string(electric_field_amplitude),
1318 Patterns::Double(0),
1319 "The amplitude of the electric field used for the normalization of the solution in [V/m].");
1320
1321 prm.declare_entry(
1322 "magnetic field amplitude",
1323 Patterns::Tools::Convert<double>::to_string(magnetic_field_amplitude),
1324 Patterns::Double(0),
1325 "The amplitude of the magnetic field used for the normalization of the solution in [A/m].");
1326
1327 prm.declare_entry("number of waveguide inlets",
1328 Patterns::Tools::Convert<unsigned int>::to_string(
1330 Patterns::Integer(0),
1331 "Number of waveguide inlets in the simulation.");
1332
1333 // Declare a fixed maximum number of waveguide inlets.
1334 // Only the ones specified by "number of waveguide inlets" will be
1335 // parsed. This is necessary because declare_parameters runs before the
1336 // file is read, so we can't know the actual number of inlets at
1337 // declaration time.
1338 constexpr unsigned int max_waveguide_inlets = 10;
1339
1340 for (unsigned int inlet = 0; inlet < max_waveguide_inlets; ++inlet)
1341 {
1342 prm.enter_subsection("waveguide inlet " + std::to_string(inlet));
1343 {
1344 prm.declare_entry(
1345 "port boundary id",
1346 "0",
1347 Patterns::Integer(0),
1348 "The boundary id where the waveguide inlet is applied.");
1349
1350 prm.declare_entry(
1351 "waveguide power",
1352 "1",
1353 Patterns::Double(0),
1354 "The power of the waveguide mode excitation in Watts. This is used to compute the amplitude of the electromagnetic wave at the inlet in dimensional units.");
1355
1356 prm.enter_subsection("waveguide mode");
1357 {
1359 prm,
1360 "mode type",
1362 "The waveguide mode excitation for a rectangular waveguide can be either Transverse Electric (TE) or Transverse Magnetic (TM).");
1363
1364 prm.declare_entry(
1365 "mode order m",
1366 "1",
1367 Patterns::Integer(0),
1368 "The mode order m in the first transverse direction of the rectangular waveguide.");
1369
1370 prm.declare_entry(
1371 "mode order n",
1372 "0",
1373 Patterns::Integer(0),
1374 "The mode order n in the second transverse direction of the rectangular waveguide.");
1375 }
1376 prm.leave_subsection();
1377
1378 const unsigned int num_corners = Utilities::fixed_power<2>(dim - 1);
1379 for (unsigned int corner = 0; corner < num_corners; ++corner)
1380 {
1381 if constexpr (dim == 2)
1382 {
1383 prm.declare_entry("corner " + std::to_string(corner),
1384 "0, 0",
1385 Patterns::List(Patterns::Double(), 2, 2),
1386 "Coordinates of corner " +
1387 std::to_string(corner));
1388 }
1389 else if constexpr (dim == 3)
1390 {
1391 prm.declare_entry("corner " + std::to_string(corner),
1392 "0, 0, 0",
1393 Patterns::List(Patterns::Double(), 3, 3),
1394 "Coordinates of corner " +
1395 std::to_string(corner));
1396 }
1397 }
1398 }
1399 prm.leave_subsection();
1400 }
1401 }
1402 prm.leave_subsection();
1403}
1404
1405template <int dim>
1406void
1408 ParameterHandler &prm,
1409 const Dimensionality &dimensions)
1410{
1411 prm.enter_subsection("time harmonic maxwell");
1412 {
1413 prm.enter_subsection("time coupling strategy");
1414 {
1417 prm.get("type"));
1418
1420 prm.get_integer("coupling iteration");
1421 TimeHarmonicMaxwell::coupling_time = prm.get_double("coupling time");
1423 prm.get_double("coupling threshold");
1424 }
1425 prm.leave_subsection();
1426
1428 prm.get_double("electromagnetic frequency") *
1430
1433 prm.get("electromagnetic scaling type"),
1434 deprecated_electromagnetic_scaling_type_names,
1435 "electromagnetic scaling type");
1436
1437 // The user always provides the electric and magnetic field amplitudes
1438 // in dimensional units (V/m and A/m respectively). The scaling factors
1439 // will be applied in the time_harmonic_maxwell class.
1441 prm.get_double("electric field amplitude");
1442
1444 prm.get_double("magnetic field amplitude");
1445
1447 prm.get_integer("number of waveguide inlets");
1448
1449 // Ensure that the number of waveguide inlets is smaller than the
1450 // maximum declared in declare_parameters.
1451 AssertThrow(
1453 ExcMessage(
1454 "The number of waveguide inlets specified exceeds "
1455 "the maximum allowed. Please increase the value "
1456 "of max_waveguide_inlets in the code declare_parameters section of the TimeHarmonicMaxwell class."));
1457
1458 // Resize vectors to hold the correct number of inlets
1465
1466 for (unsigned int inlet = 0; inlet < number_of_waveguide_inlets; ++inlet)
1467 {
1468 prm.enter_subsection("waveguide inlet " + std::to_string(inlet));
1469 {
1471 prm.get_integer("port boundary id");
1472
1474 prm.get_double("waveguide power");
1475
1476 // Check that the waveguide power is not zero which would imply no
1477 // excitation at the inlet.
1478 AssertThrow(
1480 ExcMessage(
1481 "The waveguide power for the inlet " + std::to_string(inlet) +
1482 " is zero. Please check the waveguide power parameter in the input prm file for this inlet. If you really want to have no excitation but an open boundary condition at this inlet, you should change the boundary condition type to the impedance boundary condition with zero excitation and the desired admittance."));
1483
1484 prm.enter_subsection("waveguide mode");
1485 {
1487 string_to_enum<Parameters::WaveguideMode>(prm.get("mode type"));
1488
1490 prm.get_integer("mode order m");
1491
1493 prm.get_integer("mode order n");
1494
1495 // Check that the choice of mode orders is valid
1496 if (TimeHarmonicMaxwell::mode_order_m[inlet] == 0 &&
1498 {
1499 throw(std::runtime_error(
1500 "Invalid waveguide mode orders m and n. "
1501 "At least one of the two mode orders must be non-zero."));
1502 }
1503 }
1504 prm.leave_subsection();
1505
1506 const unsigned int num_corners = Utilities::fixed_power<2>(dim - 1);
1507 std::array<Tensor<1, dim>, num_corners> tmp_corners;
1508
1509 for (unsigned int corner = 0; corner < num_corners; ++corner)
1510 {
1511 const std::string corner_name =
1512 "corner " + std::to_string(corner);
1513 const Tensor<1, dim> corner_value =
1514 value_string_to_tensor<dim>(prm.get(corner_name));
1515
1516 tmp_corners[corner] = corner_value;
1517 }
1518
1519 // In 3D, verify that the provided corners define a coplanar
1520 // quadrilateral. This is not useful in 2D as any 2 points are
1521 // always collinear.
1522 if constexpr (dim == 3)
1523 {
1524 const Tensor<1, dim> vec1 =
1525 tmp_corners[1] -
1526 tmp_corners[0]; // Vector from corner 1 to corner 2
1527 const Tensor<1, dim> vec2 =
1528 tmp_corners[2] -
1529 tmp_corners[0]; // Vector from corner 1 to corner 3
1530 const Tensor<1, dim> vec3 =
1531 tmp_corners[3] -
1532 tmp_corners[0]; // Vector from corner 1 to corner 4
1533
1534 // The triple scalar product (determinant) scales as the
1535 // volume of the parallelepiped defined by the three vectors.
1536 // So we make the it dimensionless by a characteristic volume
1537 // (product of the norms of the three vectors). This way we
1538 // can set a tolerance that is independent of the actual size
1539 // of the waveguide.
1540 const double determinant =
1541 scalar_product(vec3, cross_product_3d(vec1, vec2)) /
1542 (vec1.norm() * vec2.norm() * vec3.norm());
1543
1544 const double tolerance = 1e-10;
1545
1546 AssertThrow(std::abs(determinant) < tolerance,
1547 ExcMessage(
1548 "The provided corners for waveguide inlet " +
1549 std::to_string(inlet) +
1550 " do not define a coplanar quadrilateral. "
1551 "Please check the corner coordinates."));
1552 }
1553
1554 TimeHarmonicMaxwell::waveguide_corners.push_back(tmp_corners);
1555 }
1556 prm.leave_subsection();
1557 }
1558
1559 // Check that there is at least one waveguide inlet if the user use the
1560 // `power` electromagnetic scaling type.
1561 AssertThrow(
1565 ExcMessage(
1566 "The power-based electromagnetic scaling type requires at least one waveguide inlet to be defined. Please check the number of waveguide inlets specified in the input prm file."));
1567 }
1568 prm.leave_subsection();
1569}
1570
1573template struct Parameters::Multiphysics<2>;
1574template struct Parameters::Multiphysics<3>;
1575template struct Parameters::QMOMFunctions<2>;
1576template struct Parameters::QMOMFunctions<3>;
Class used to rescale physical properties for cases where the main dimensions of the problems (Length...
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
EnumType string_to_enum(const std::string &name)
Return the enumerator whose identifier is name, e.g. to parse the value of a parameter entry into its...
Definition utilities.h:734
void declare_enum_entry(ParameterHandler &prm, const std::string &entry_name, const EnumType default_value, const std::string &description, const DeprecatedEnumNames< EnumType > &deprecated_names={}, const std::vector< EnumType > &allowed_values={})
Declare a parameter entry whose value is an enumerator. The default value, the accepted values and th...
Definition utilities.h:888
@ TE
Transverse Electric mode.
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...
unsigned int get_number_of_distribution_parameters(const QMOMDistributionType distribution_type)
Number of parameters of a particle size distribution family, not counting the number density.
QMOMDistributionType
Family of the particle size distribution from which the moments of the QMOM physics are computed....
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...
DeclException3(QMOMDistributionExpressionsCountError, std::string, unsigned int, unsigned int,<< "The \""<< arg1<< "\" particle size distribution of the QMOM physics expects "<< arg2<< " expressions, but "<< arg3<< " are given."<< std::endl<< "Give the number density, in particles per m^3, followed by the "<< "parameters of the distribution.")
DeclException1(SharpeningThresholdError, double,<< "Sharpening threshold : "<< arg1<< " is smaller than 0 or larger than 1."<< std::endl<< "Projection-based interface sharpening model requires a sharpening threshold between 0 and 1.")
DeclException2(QMOMScalarNamesCountError, std::size_t, unsigned int,<< "The \"scalar names\" of the QMOM subsection has "<< arg1<< " names, but the \"number of scalars\" is "<< arg2<< "."<< std::endl<< "Give one name per scalar, or no name to use scalar_0, scalar_1, ...")
Parameters for geometric reinitialization of the interface used with the CLS solver.
double max_reinitialization_distance
Maximum reinitialization distance value.
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
static void declare_parameters(ParameterHandler &prm)
Declare the parameters.
double tanh_thickness
Interface thickness for the tanh transformation.
bool output_signed_distance
Enables/Disables the output of the signed distance field.
CLS_InterfaceSharpening - Defines the parameters for interface sharpening in the CLS solver.
void parse_parameters(ParameterHandler &prm)
Parsesthe CLS interface-sharpening parameters.
static void declare_parameters(ParameterHandler &prm)
Declare the CLS interface-sharpening parameters.
Parameters for PDE-based reinitialization of the interface used with the CLS solver.
static void declare_parameters(ParameterHandler &prm)
Declare the parameters.
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
double steady_state_criterion
Steady-state criterion used for the artificial time-stepping scheme.
double max_steps_number
Maximum number of reinitialization steps.
Parameters for the phase filtration.
void parse_parameters(ParameterHandler &prm)
Parse the CLS phase-filter parameters.
static void declare_parameters(ParameterHandler &prm)
Declare the CLS phase-filter parameters.
Parameters::CLS_InterfaceSharpening sharpening
Interface sharpening parameters.
Parameters::CLS_PDEBasedInterfaceReinitialization pde_based_interface_reinitialization
PDE-based interface reinitialization parameters.
Parameters::Verbosity verbosity
Type of verbosity of the PDE-based interface reinitialization solver.
void declare_parameters(ParameterHandler &prm) const
Declare the parameters.
Parameters::ReinitializationMethodType reinitialization_method_type
Reinitialization method type.
void parse_parameters(ParameterHandler &prm)
Parse the parameters.
Parameters::CLS_GeometricInterfaceReinitialization geometric_interface_reinitialization
Geometric interface reinitialization parameters.
Parameters for the calculation of surface tension force in the CLS solver.
static void declare_parameters(ParameterHandler &prm)
Declare the CLS surface-tension force parameters.
void parse_parameters(ParameterHandler &prm)
Parse the CLS surface-tension force parameters.
Parameters::FluidIndicator viscous_dissipative_fluid
Parameters::CLS_SurfaceTensionForce surface_tension_force
void declare_parameters(ParameterHandler &prm) const
Declare the CLS parameters.
void parse_parameters(ParameterHandler &prm)
Parse the CLS parameters.
Parameters::CLS_PhaseFilter phase_filter
Parameters::CLS_ReinitializationMethod reinitialization_method
CahnHilliard_PhaseFilter - Defines the parameters for the phase filtration of CahnHilliard physics.
static void declare_parameters(ParameterHandler &prm)
Declare the Cahn-Hilliard phase-filter parameters.
void parse_parameters(ParameterHandler &prm)
Parse the Cahn-Hilliard phase-filter parameters.
void parse_parameters(ParameterHandler &prm, const Dimensionality &dimensions)
Parse the Cahn-Hilliard parameters.
void declare_parameters(ParameterHandler &prm) const
Declare the Cahn-Hilliard parameters.
Parameters::EpsilonVerbosity epsilon_verbosity
Parameters::EpsilonSetMethod epsilon_set_method
Parameters::CahnHilliard_PhaseFilter cahn_hilliard_phase_filter
Multiphysics - the parameters for multiphysics simulations and handles sub-physics parameters.
Parameters::CahnHilliard cahn_hilliard_parameters
void declare_parameters(ParameterHandler &prm) const
Declare the multiphysics parameters.
void parse_parameters(ParameterHandler &prm, const Dimensionality &dimensions)
Parse the multiphysics parameters.
Parameters::TimeHarmonicMaxwell< dim > time_harmonic_maxwell_parameters
Functions of space and time prescribing the fields of the QMOM physics. They are used for the initial...
void parse_parameters(ParameterHandler &prm)
Parse the "scalars" and "distribution" subsections of the current subsection. The number of component...
std::shared_ptr< Functions::ParsedFunction< dim > > scalars
Scalars, one component per scalar.
void set_time(const double time)
Set the time of all the functions.
std::shared_ptr< Functions::ParsedFunction< dim > > distribution
QMOMDistributionType distribution_type
Family of the particle size distribution.
static void declare_parameters(ParameterHandler &prm)
Declare the "scalars" and "distribution" subsections in the current subsection. All the functions are...
Process parameters of the lipid nanoparticle (LNP) production simulated with the QMOM physics: operat...
double molar_mass_aqueous
Molar mass of the aqueous phase [kg/mol].
double density_organic
Density of the organic phase [kg/m^3].
double mole_fraction_solubility_aqueous
Mole fraction solubility of the lipid in the pure aqueous phase [-].
double initial_concentration_organic
Initial lipid concentration in the organic phase [mol/m^3].
double permittivity_aqueous
Relative permittivity of the aqueous phase [-].
double mole_fraction_solubility_organic
Mole fraction solubility of the lipid in the pure organic phase [-].
double total_flow_rate
Total flow rate of the aqueous and organic phases [m^3/s].
double ion_concentration_mixture
Ion concentration in the mixture [mol/m^3].
void parse_parameters(ParameterHandler &prm)
Parse the "lipid nanoparticle production" subsection.
double molar_mass_organic
Molar mass of the organic phase [kg/mol].
double density_aqueous
Density of the aqueous phase [kg/m^3].
double operating_temperature
Operating temperature [K].
double viscosity_mixture
Dynamic viscosity of the aqueous and organic mixture [Pa s].
double shape_factor
Volume shape factor of the particles, pi/6 for spheres [-].
void declare_parameters(ParameterHandler &prm) const
Declare the "lipid nanoparticle production" subsection.
double flow_rate_ratio
Ratio of the aqueous phase flow rate to the organic phase flow rate [-].
double mixing_time_scale
Mixing time scale of the aqueous and organic phases [s].
double permittivity_organic
Relative permittivity of the organic phase [-].
Parameters of the phase-space evolution of the QMOM moments, which is delegated to QMOMKit.
void parse_parameters(ParameterHandler &prm)
Parse the "phase evolution" subsection.
void declare_parameters(ParameterHandler &prm) const
Declare the "phase evolution" subsection.
bool enable_adaptive_node_count
Enable the adaptive number of quadrature nodes.
Physical constants used by the QMOM physics, in SI units. Their default values are the exact values o...
double elementary_charge
Elementary charge [C].
double boltzmann_constant
Boltzmann constant [J/K].
double avogadro_number
Avogadro number [1/mol].
void parse_parameters(ParameterHandler &prm)
Parse the "physical constants" subsection.
double permittivity_vacuum
Vacuum permittivity [F/m].
void declare_parameters(ParameterHandler &prm) const
Declare the "physical constants" subsection.
Parameters of the quadrature method of moments (QMOM) physics, declared in the "QMOM" subsection.
std::vector< std::string > scalar_names
bool enable_growth
Include the growth source.
unsigned int number_of_scalars
Number of scalars transported together with the moments.
QMOMLipidNanoparticleProduction lipid_nanoparticle_production
void declare_parameters(ParameterHandler &prm) const
Declare the "QMOM" subsection.
QMOMPhysicalConstants physical_constants
Physical constants ("physical constants" subsection).
bool enable_nucleation
Include the nucleation source.
QMOMSplittingScheme splitting_scheme
bool enable_coalescence
Include the coalescence source.
unsigned int number_of_moments
Number of transported raw moments M_0 to M_{number_of_moments - 1}.
void parse_parameters(ParameterHandler &prm)
Parse the "QMOM" subsection.
QMOMPhaseEvolution phase_evolution
Phase-space evolution ("phase evolution" subsection).
TimeHarmonicMaxwell - Defines the parameters for time-harmonic Maxwell simulations.
std::vector< unsigned int > mode_order_n
std::vector< std::array< Tensor< 1, dim >, Utilities::fixed_power< 2 >(dim - 1)> > waveguide_corners
std::vector< Parameters::WaveguideMode > waveguide_mode
Parameters::TimeHarmonicMaxwellCouplingStrategy time_coupling_strategy
std::vector< unsigned int > mode_order_m
void declare_parameters(ParameterHandler &prm) const
Declare the time-harmonic Maxwell parameters.
void parse_parameters(ParameterHandler &prm, const Dimensionality &dimensions)
Parse the time-harmonic Maxwell parameters.
Parameters::ElectromagneticScalingType electromagnetic_scaling_type