Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
fluid_dynamics_vans_matrix_free.cc
Go to the documentation of this file.
1
2// SPDX-FileCopyrightText: Copyright (c) 2023-2026 The Lethe Authors
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4
6#include <core/grids.h>
8#include <core/manifolds.h>
9#include <core/parameters.h>
11#include <core/utilities.h>
12
16
17#include <deal.II/grid/grid_tools.h>
18
19template <int dim>
29
30template <int dim>
31void
33 const unsigned int level)
34{
35 this->mg_operators[level] = std::make_shared<VANSOperator<dim, MGNumber>>(
37}
38
39template <int dim>
40template <typename PropertiesIndex>
41void
43 const std::shared_ptr<SimulationControl> &simulation_control,
44 FlowControl<dim> &flow_control,
45 const VectorType &present_solution,
46 const VectorType &time_derivative_previous_solutions,
47 const VectorType &time_derivative_void_fraction,
48 const ParticleProjector<dim, PropertiesIndex> &particle_projector)
49{
50 AssertThrow(
52 .enable_hessians_jacobian,
53 ExcMessage(
54 "The matrix-free VANS solver always requires the Hessian for the assembly of the matrix. Please \"set enable hessian jacobian = true\""));
55
56 AssertThrow(
58 .enable_hessians_residual,
59 ExcMessage(
60 "The matrix-free VANS solver always requires the Hessian for the assembly of the residual. Please \"set enable hessian residual = true\""));
61
62 if (this->simulation_parameters.linear_solver.at(PhysicsID::fluid_dynamics)
64 {
65 // ---------------------------------------------------------------------
66 // Local-smoothing branch.
67 //
68 // For LSMG the auxiliary fields all live on a single triangulation that
69 // has multigrid level DoFs distributed (enabled by
70 // ParticleProjector::enable_multigrid_level_dofs). For each auxiliary
71 // field we build one MGTransferMatrixFree, interpolate the fine vector
72 // to all triangulation levels, and then dispatch the level vectors to
73 // each level VANSOperator using the operator's own mg_level.
74 // ---------------------------------------------------------------------
75#if !DEAL_II_VERSION_GTE(9, 8, 0)
76 AssertThrow(
77 false,
78 ExcMessage(
79 "The VANS matrix-free solver with the LSMG preconditioner is not "
80 "supported with deal.II 9.7 or older: the multigrid transfer of the "
81 "auxiliary (particle-projected) fields relies on the behavior of "
82 "MGTransferMatrixFree that was only fixed in deal.II 9.8 (master). "
83 "Please either build against deal.II master, or switch to the GCMG "
84 "preconditioner for this simulation."));
85#endif
86
87 const auto &linear_solver_parameters =
89
90 // The combinations below have not been validated for the VANS LSMG path
91 // (they require additional plumbing in the auxiliary-field projections).
92 // They are explicitly forbidden as a first implementation step.
93 AssertThrow(
94 !linear_solver_parameters.mg_use_fe_q_iso_q1,
95 ExcMessage(
96 "The FE_Q_iso_Q1 coarse-grid option is not supported by the VANS "
97 "matrix-free solver with the LSMG preconditioner."));
98
99 AssertThrow(
100 !this->simulation_parameters.mortar_parameters.enable,
101 ExcMessage(
102 "Mortar coupling is not supported by the VANS matrix-free solver "
103 "with the LSMG preconditioner."));
104
105 AssertThrow(
106 linear_solver_parameters.mg_coarsening_type ==
108 ExcMessage(
109 "Only pure h-coarsening (set mg coarsening type = h) is currently "
110 "supported by the VANS matrix-free solver with the LSMG "
111 "preconditioner."));
112
113 // Identify the h-level range covered by the multigrid hierarchy. With
114 // pure h-coarsening, this is a contiguous range that we can read back
115 // from each level operator's MatrixFree object.
116 const unsigned int min_h_level = this->mg_operators[this->minlevel]
117 ->get_system_matrix_free()
118 .get_mg_level();
119 const unsigned int max_h_level = this->mg_operators[this->maxlevel]
120 ->get_system_matrix_free()
121 .get_mg_level();
122
123 AssertThrow(
124 min_h_level != numbers::invalid_unsigned_int &&
125 max_h_level != numbers::invalid_unsigned_int,
126 ExcMessage(
127 "VANS LSMG: level operators do not expose a valid mg_level. The "
128 "base setup_GMG was likely not run in LSMG mode."));
129
130 AssertThrow(max_h_level - min_h_level == this->maxlevel - this->minlevel,
131 ExcMessage(
132 "VANS LSMG: non-contiguous h-level range; only pure "
133 "h-coarsening is supported."));
134
135 // Build a transfer for each auxiliary field. The DoFHandler stored in
136 // the projector already has multigrid level DoFs distributed.
137 this->mg_transfer_ls_void_fraction = std::make_shared<LSTransferType>();
138 this->mg_transfer_ls_pf_force = std::make_shared<LSTransferType>();
139 this->mg_transfer_ls_pf_drag = std::make_shared<LSTransferType>();
141 std::make_shared<LSTransferType>();
143 std::make_shared<LSTransferType>();
144
145 // Build each transfer with a level-partitioner lambda. This stores
146 // per-level partitioners (locally owned + locally relevant level DoFs)
147 // inside the transfer, so that interpolate_to_mg auto-sizes its
148 // destination level vectors with the ghost layout our operator needs
149 // for cell-by-cell dof index lookups. This mirrors the GCMG pattern.
150 const auto make_level_partitioner = [](const DoFHandler<dim> &dh) {
151 return [&dh](const unsigned int l, MGVectorType &vec) {
152 vec.reinit(dh.locally_owned_mg_dofs(l),
153 DoFTools::extract_locally_relevant_level_dofs(dh, l),
154 dh.get_mpi_communicator());
155 };
156 };
157
158 this->mg_transfer_ls_void_fraction->build(
159 *particle_projector.dof_handler,
160 make_level_partitioner(*particle_projector.dof_handler));
161 this->mg_transfer_ls_pf_force->build(
164 make_level_partitioner(
166 .dof_handler));
167 this->mg_transfer_ls_pf_drag->build(
168 *particle_projector.fluid_drag_on_particles.dof_handler,
169 make_level_partitioner(
170 *particle_projector.fluid_drag_on_particles.dof_handler));
172 *particle_projector.particle_velocity.dof_handler,
173 make_level_partitioner(
174 *particle_projector.particle_velocity.dof_handler));
176 *particle_projector.momentum_transfer_coefficient.dof_handler,
177 make_level_partitioner(
178 *particle_projector.momentum_transfer_coefficient.dof_handler));
179
180 // Allocate level vectors indexed by triangulation level.
181 // interpolate_to_mg will reinit each entry from the level partitioner
182 // stored in the transfer above.
183 MGLevelObject<MGVectorType> mg_void_fraction_solution(min_h_level,
184 max_h_level);
185 MGLevelObject<MGVectorType> mg_time_derivative_void_fraction(min_h_level,
186 max_h_level);
187 MGLevelObject<MGVectorType> mg_pf_forces_solution(min_h_level,
188 max_h_level);
189 MGLevelObject<MGVectorType> mg_pf_drag_solution(min_h_level, max_h_level);
190 MGLevelObject<MGVectorType> mg_particle_velocity_solution(min_h_level,
191 max_h_level);
192 MGLevelObject<MGVectorType> mg_momentum_transfer_coefficient_solution(
193 min_h_level, max_h_level);
194
195 // The transfers require ghosted source vectors.
197 .particle_field_solution.update_ghost_values();
199 .update_ghost_values();
201 .update_ghost_values();
203 .update_ghost_values();
204
205 this->mg_transfer_ls_void_fraction->interpolate_to_mg(
206 *particle_projector.dof_handler,
207 mg_void_fraction_solution,
208 particle_projector.void_fraction_solution);
209
210 this->mg_transfer_ls_void_fraction->interpolate_to_mg(
211 *particle_projector.dof_handler,
212 mg_time_derivative_void_fraction,
213 time_derivative_void_fraction);
214
215 this->mg_transfer_ls_pf_force->interpolate_to_mg(
218 mg_pf_forces_solution,
221
222 this->mg_transfer_ls_pf_drag->interpolate_to_mg(
223 *particle_projector.fluid_drag_on_particles.dof_handler,
224 mg_pf_drag_solution,
226
227 this->mg_transfer_ls_particle_velocity->interpolate_to_mg(
228 *particle_projector.particle_velocity.dof_handler,
229 mg_particle_velocity_solution,
230 particle_projector.particle_velocity.particle_field_solution);
231
232 this->mg_transfer_ls_momentum_transfer_coefficient->interpolate_to_mg(
233 *particle_projector.momentum_transfer_coefficient.dof_handler,
234 mg_momentum_transfer_coefficient_solution,
235 particle_projector.momentum_transfer_coefficient
237
238 // Dispatch the level vectors to the corresponding VANSOperator.
239 for (unsigned int l = this->minlevel; l <= this->maxlevel; ++l)
240 {
241 const unsigned int h_level =
242 this->mg_operators[l]->get_system_matrix_free().get_mg_level();
243
244 mg_void_fraction_solution[h_level].update_ghost_values();
245 mg_time_derivative_void_fraction[h_level].update_ghost_values();
246 mg_pf_forces_solution[h_level].update_ghost_values();
247 mg_pf_drag_solution[h_level].update_ghost_values();
248 mg_particle_velocity_solution[h_level].update_ghost_values();
249 mg_momentum_transfer_coefficient_solution[h_level]
250 .update_ghost_values();
251
252 if (auto mf_operator = dynamic_cast<VANSOperator<dim, double> *>(
253 &(*this->mg_operators[l])))
254 {
255 mf_operator->compute_void_fraction(
256 *particle_projector.dof_handler,
257 mg_void_fraction_solution[h_level],
258 mg_time_derivative_void_fraction[h_level]);
259
260 mf_operator->compute_particle_fluid_interaction(
263 mg_pf_forces_solution[h_level],
264 *particle_projector.fluid_drag_on_particles.dof_handler,
265 mg_pf_drag_solution[h_level],
266 *particle_projector.particle_velocity.dof_handler,
267 mg_particle_velocity_solution[h_level],
268 *particle_projector.momentum_transfer_coefficient.dof_handler,
269 mg_momentum_transfer_coefficient_solution[h_level]);
270 }
271 }
272 }
273 else if (this->simulation_parameters.linear_solver
275 .preconditioner ==
277 {
278 const unsigned int min_level = this->minlevel;
279 const unsigned int max_level = this->maxlevel;
280
281 // Resize all of the dof handlers related to every field for the
282 // particle-fluid coupling
283 this->void_fraction_dof_handlers.resize(min_level, max_level);
284 this->pf_force_dof_handlers.resize(min_level, max_level);
285 this->pf_drag_dof_handlers.resize(min_level, max_level);
286 this->particle_velocity_dof_handlers.resize(min_level, max_level);
287 this->momentum_transfer_coefficient_dof_handlers.resize(min_level,
288 max_level);
289
290
291 for (unsigned int l = min_level; l <= max_level; l++)
292 {
293 // Void fraction
294 this->void_fraction_dof_handlers[l].reinit(
295 this->dof_handlers[l].get_triangulation());
296 this->void_fraction_dof_handlers[l].distribute_dofs(
297 particle_projector.dof_handler->get_fe());
298
299 // Particle-fluid force
300 this->pf_force_dof_handlers[l].reinit(
301 this->dof_handlers[l].get_triangulation());
302 this->pf_force_dof_handlers[l].distribute_dofs(
304 .dof_handler->get_fe());
305
306 // Particle-fluid drag
307 this->pf_drag_dof_handlers[l].reinit(
308 this->dof_handlers[l].get_triangulation());
309 this->pf_drag_dof_handlers[l].distribute_dofs(
310 particle_projector.fluid_drag_on_particles.dof_handler->get_fe());
311
312 // Particle velocity field
313 this->particle_velocity_dof_handlers[l].reinit(
314 this->dof_handlers[l].get_triangulation());
315 this->particle_velocity_dof_handlers[l].distribute_dofs(
316 particle_projector.particle_velocity.dof_handler->get_fe());
317
318 // Momentum exchange coefficient
320 this->dof_handlers[l].get_triangulation());
321 this->momentum_transfer_coefficient_dof_handlers[l].distribute_dofs(
323 ->get_fe());
324 }
325
326 this->transfers_void_fraction.resize(min_level, max_level);
327 this->transfers_pf_force.resize(min_level, max_level);
328 this->transfers_pf_drag.resize(min_level, max_level);
329 this->transfers_particle_velocity.resize(min_level, max_level);
330 this->transfers_momentum_transfer_coefficient.resize(min_level,
331 max_level);
332
333
334 for (unsigned int l = min_level; l < max_level; l++)
335 {
336 this->transfers_void_fraction[l + 1].reinit(
337 this->void_fraction_dof_handlers[l + 1],
339 {},
340 {});
341
342 this->transfers_pf_force[l + 1].reinit(
343 this->pf_force_dof_handlers[l + 1],
344 this->pf_force_dof_handlers[l],
345 {},
346 {});
347
348 this->transfers_pf_drag[l + 1].reinit(
349 this->pf_drag_dof_handlers[l + 1],
350 this->pf_drag_dof_handlers[l],
351 {},
352 {});
353
354 this->transfers_particle_velocity[l + 1].reinit(
357 {},
358 {});
359
360 this->transfers_momentum_transfer_coefficient[l + 1].reinit(
363 {},
364 {});
365 }
366
367 // Make the transfer operators for every field we will transfer
369 std::make_shared<MFNavierStokesVANSPreconditionGMG::GCTransferType>(
371
373 std::make_shared<MFNavierStokesVANSPreconditionGMG::GCTransferType>(
374 this->transfers_pf_force);
375
377 std::make_shared<MFNavierStokesVANSPreconditionGMG::GCTransferType>(
378 this->transfers_pf_drag);
379
381 std::make_shared<MFNavierStokesVANSPreconditionGMG::GCTransferType>(
383
385 std::make_shared<MFNavierStokesVANSPreconditionGMG::GCTransferType>(
387
388
389 // Build transfer operator for every field
390 this->mg_transfer_gc_void_fraction->build(
391 *particle_projector.dof_handler, [&](const auto l, auto &vec) {
392 vec.reinit(
393 this->void_fraction_dof_handlers[l].locally_owned_dofs(),
394 DoFTools::extract_locally_active_dofs(
395 this->void_fraction_dof_handlers[l]),
396 this->void_fraction_dof_handlers[l].get_mpi_communicator());
397 });
398
399 this->mg_transfer_gc_pf_force->build(
402 [&](const auto l, auto &vec) {
403 vec.reinit(this->pf_force_dof_handlers[l].locally_owned_dofs(),
404 DoFTools::extract_locally_active_dofs(
405 this->pf_force_dof_handlers[l]),
406 this->pf_force_dof_handlers[l].get_mpi_communicator());
407 });
408
409 this->mg_transfer_gc_pf_drag->build(
410 *particle_projector.fluid_drag_on_particles.dof_handler,
411 [&](const auto l, auto &vec) {
412 vec.reinit(this->pf_drag_dof_handlers[l].locally_owned_dofs(),
413 DoFTools::extract_locally_active_dofs(
414 this->pf_drag_dof_handlers[l]),
415 this->pf_drag_dof_handlers[l].get_mpi_communicator());
416 });
417
419 *particle_projector.particle_velocity.dof_handler,
420 [&](const auto l, auto &vec) {
421 vec.reinit(
422 this->particle_velocity_dof_handlers[l].locally_owned_dofs(),
423 DoFTools::extract_locally_active_dofs(
424 this->particle_velocity_dof_handlers[l]),
425 this->particle_velocity_dof_handlers[l].get_mpi_communicator());
426 });
427
429 *particle_projector.momentum_transfer_coefficient.dof_handler,
430 [&](const auto l, auto &vec) {
431 vec.reinit(this->momentum_transfer_coefficient_dof_handlers[l]
432 .locally_owned_dofs(),
433 DoFTools::extract_locally_active_dofs(
434 this->momentum_transfer_coefficient_dof_handlers[l]),
435 this->momentum_transfer_coefficient_dof_handlers[l]
436 .get_mpi_communicator());
437 });
438
439 // Create the MG Level Object for every field
440 MGLevelObject<MFNavierStokesVANSPreconditionGMG::MGVectorType>
441 mg_void_fraction_solution(this->minlevel, this->maxlevel);
442
443 MGLevelObject<MFNavierStokesVANSPreconditionGMG::MGVectorType>
444 mg_time_derivative_void_fraction(this->minlevel, this->maxlevel);
445
446 MGLevelObject<MFNavierStokesVANSPreconditionGMG::MGVectorType>
447 mg_pf_forces_solution(this->minlevel, this->maxlevel);
448
449 MGLevelObject<MFNavierStokesVANSPreconditionGMG::MGVectorType>
450 mg_pf_drag_solution(this->minlevel, this->maxlevel);
451
452 MGLevelObject<MFNavierStokesVANSPreconditionGMG::MGVectorType>
453 mg_particle_velocity_solution(this->minlevel, this->maxlevel);
454
455 MGLevelObject<MFNavierStokesVANSPreconditionGMG::MGVectorType>
456 mg_momentum_transfer_coefficient_solution(this->minlevel,
457 this->maxlevel);
458
459 // A deal.II vector is required here, so we take the deal.II vector
460 // solution from the particle projector instead of the Trillinos vector
461 // one. This is done for every field.
462
463 // Void fraction
464 this->mg_transfer_gc_void_fraction->interpolate_to_mg(
465 *particle_projector.dof_handler,
466 mg_void_fraction_solution,
467 particle_projector.void_fraction_solution);
468
469 this->mg_transfer_gc_void_fraction->interpolate_to_mg(
470 *particle_projector.dof_handler,
471 mg_time_derivative_void_fraction,
472 time_derivative_void_fraction);
473
475 .particle_field_solution.update_ghost_values();
476
477 // Particle-fluid force
478 this->mg_transfer_gc_pf_force->interpolate_to_mg(
481 mg_pf_forces_solution,
484
485 // Particle-fluid drag
487 .update_ghost_values();
488
489 this->mg_transfer_gc_pf_drag->interpolate_to_mg(
490 *particle_projector.fluid_drag_on_particles.dof_handler,
491 mg_pf_drag_solution,
493
494 // Particle-velocity
496 .update_ghost_values();
497
498 this->mg_transfer_gc_particle_velocity->interpolate_to_mg(
499 *particle_projector.particle_velocity.dof_handler,
500 mg_particle_velocity_solution,
501 particle_projector.particle_velocity.particle_field_solution);
502
503 // Momentum transfer coefficient
505 .update_ghost_values();
506
507 this->mg_transfer_gc_momentum_transfer_coefficient->interpolate_to_mg(
508 *particle_projector.momentum_transfer_coefficient.dof_handler,
509 mg_momentum_transfer_coefficient_solution,
510 particle_projector.momentum_transfer_coefficient
512
513
514 for (unsigned int l = min_level; l <= max_level; l++)
515 {
516 mg_void_fraction_solution[l].update_ghost_values();
517 mg_time_derivative_void_fraction[l].update_ghost_values();
518 mg_pf_forces_solution[l].update_ghost_values();
519 mg_pf_drag_solution[l].update_ghost_values();
520 mg_particle_velocity_solution[l].update_ghost_values();
521 mg_momentum_transfer_coefficient_solution[l].update_ghost_values();
522
523 if (auto mf_operator = dynamic_cast<VANSOperator<dim, double> *>(
524 &(*this->mg_operators[l])))
525 {
526 mf_operator->compute_void_fraction(
528 mg_void_fraction_solution[l],
529 mg_time_derivative_void_fraction[l]);
530
531 mf_operator->compute_particle_fluid_interaction(
532 this->pf_force_dof_handlers[l],
533 mg_pf_forces_solution[l],
534 this->pf_drag_dof_handlers[l],
535 mg_pf_drag_solution[l],
537 mg_particle_velocity_solution[l],
539 mg_momentum_transfer_coefficient_solution[l]);
540 }
541 }
542 }
543
545 simulation_control,
546 flow_control,
547 present_solution,
548 time_derivative_previous_solutions);
549}
550
551template <int dim, typename PropertiesIndex>
554 : FluidDynamicsMatrixFree<dim>(param.cfd_parameters,
560 PropertiesIndex::n_properties)
562 &(*this->triangulation),
563 param.void_fraction,
564 this->cfd_dem_simulation_parameters.cfd_parameters.linear_solver.at(
567 this->cfd_dem_simulation_parameters.cfd_parameters.fem_parameters
568 .void_fraction_degree,
569 this->cfd_dem_simulation_parameters.cfd_parameters.mesh.simplex,
570 this->pcout)
572{
573 // The matrix-free infrastructure relies on tensor-product (hex/quad)
574 // elements; simplex meshes are not supported by the VANS matrix-free
575 // solver nor by its multigrid preconditioners.
576 AssertThrow(
577 !this->cfd_dem_simulation_parameters.cfd_parameters.mesh.simplex,
578 ExcMessage("The VANS matrix-free solver does not support simplex meshes."));
579
580 // The VANS operator only implements the BDF time integration.
581 AssertThrow(
582 !time_stepping_is_sdirk(param.cfd_parameters.simulation_control.method),
583 ExcMessage(
584 "SDIRK time-stepping methods are not supported by the VANS matrix-free "
585 "solver. Use a BDF method instead."));
586
587 // After a mesh adaptation, the void fraction is recomputed on the new mesh,
588 // but its previous time steps are not transferred: they are reset to zero by
589 // setup_dofs(). Mesh adaptation is therefore only valid with the steady
590 // method, which does not use the previous void fractions.
591 AssertThrow(param.cfd_parameters.mesh_adaptation.type ==
593 param.cfd_parameters.simulation_control.method ==
595 NotSupportedMeshAdaptationMethod());
596
597 // Make the projected particle fields available to the other physics through
598 // the multiphysics interface.
599 this->multiphysics->enable_projected_particle_fields(
602 this->multiphysics->enable_projected_particle_fields(
604
605
606 unsigned int n_pbc = 0;
607 for (auto const &[id, type] :
608 cfd_dem_simulation_parameters.cfd_parameters.boundary_conditions.type)
609 {
611 {
612 if (n_pbc++ > 1)
613 {
614 throw std::runtime_error(
615 "GLS VANS solver does not support more than one periodic boundary condition.");
616 }
617 else
618 {
620 }
621 }
622 }
623
624 // The default MatrixFree solver sets a system_operator. We override the
625 // Navier-Stokes operator with the volume-averaged Navier-Stokes operator.
626 this->system_operator = std::make_shared<VANSOperator<dim, double>>(
628}
629
630template <int dim, typename PropertiesIndex>
631void
633{
635
636 // The LSMG preconditioner requires the auxiliary fields to be available on
637 // every triangulation level. We propagate the request to the projector so
638 // that distribute_mg_dofs() is called on every auxiliary DoFHandler.
639 particle_projector.enable_multigrid_level_dofs(
640 this->cfd_dem_simulation_parameters.cfd_parameters.linear_solver
643
644 particle_projector.setup_dofs();
645 particle_projector.setup_constraints(
646 this->cfd_dem_simulation_parameters.cfd_parameters.boundary_conditions);
647
648 // Initialize the time derivative of the void fraction.
650 this->particle_projector.dof_handler->locally_owned_dofs(),
651 DoFTools::extract_locally_relevant_dofs(
652 *this->particle_projector.dof_handler),
653 this->mpi_communicator);
654
655 // Provide the void fraction dof_handler and present solution to the
656 // multiphysics interface
657 this->multiphysics->set_dof_handler(PhysicsID::void_fraction,
658 particle_projector.dof_handler);
659 this->multiphysics->set_mapping(PhysicsID::void_fraction,
660 particle_projector.mapping);
661 this->multiphysics->set_solution(
663 particle_projector.void_fraction_locally_relevant);
664 this->multiphysics->set_previous_solutions(
665 PhysicsID::void_fraction, particle_projector.previous_void_fraction);
666
668 {
669 this->multiphysics->set_dof_handler(
671 particle_projector.particle_temperature.dof_handler);
673 particle_projector.mapping);
674 this->multiphysics->set_solution(
676 particle_projector.particle_temperature_locally_relevant);
677 }
678}
679
680template <int dim, typename PropertiesIndex>
681void
683{
684 AssertThrow(
685 dim == 3,
686 ExcMessage(
687 "The DEM coupling capabilities of the VANS solver only support 3D calculations. All of the CFD-DEM closure terms rely on the usage of 3D spherical particles and, consequently, 2D CFD-DEM simulations are currently not supported"));
688
689
690 std::string prefix =
691 this->cfd_dem_simulation_parameters.void_fraction->dem_file_name;
692
693 // Load checkpoint controller
694 std::string checkpoint_controller_object_filename =
695 prefix + ".checkpoint_controller";
696 check_file_exists(checkpoint_controller_object_filename,
697 "checkpoint file of the checkpoint controller, given by "
698 "'subsection void fraction' - 'set dem file name'");
699 std::ifstream iss_checkpoint_controller_obj(
700 checkpoint_controller_object_filename);
701 boost::archive::text_iarchive ia_checkpoint_controller_obj(
702 iss_checkpoint_controller_obj, boost::archive::no_header);
703
704 unsigned int checkpoint_id;
705 ia_checkpoint_controller_obj >> checkpoint_id;
706
707 // New prefix for the remaining files
708 prefix = prefix + "_" + Utilities::int_to_string(checkpoint_id);
709
710 // Gather particle serialization information
711 std::string particle_filename = prefix + ".particles";
712 check_file_exists(particle_filename,
713 "checkpoint file of the particles, given by "
714 "'subsection void fraction' - 'set dem file name'");
715 std::ifstream input(particle_filename.c_str());
716
717 std::string buffer;
718 std::getline(input, buffer);
719 std::istringstream iss(buffer);
720 boost::archive::text_iarchive ia(iss, boost::archive::no_header);
721
722 // Create a temporary particle_handler with the DEM properties of the
723 // simulation this one is restarted from
724 using DEMPropertiesIndex =
726
727 Particles::ParticleHandler<dim> temporary_particle_handler(
728 *this->triangulation, particle_mapping, DEMPropertiesIndex::n_properties);
729
730 ia >> temporary_particle_handler;
731
732 const std::string filename = prefix + ".triangulation";
733 check_file_exists(filename,
734 "checkpoint file of the triangulation, given by "
735 "'subsection void fraction' - 'set dem file name'");
736
737 if (auto parallel_triangulation =
738 dynamic_cast<parallel::distributed::Triangulation<dim> *>(
739 &*this->triangulation))
740 {
741 try
742 {
743 this->triangulation->load(filename.c_str());
744
745 // Deserialize particles have the triangulation has been read
746 temporary_particle_handler.deserialize();
747 }
748 catch (...)
749 {
750 AssertThrow(false,
751 ExcMessage("Cannot open snapshot mesh file or read the"
752 "triangulation stored there."));
753 }
754
755 // Fill the existing particle handler using the temporary one
756 // This is done during the dynamic cast for the convert_particle_handler
757 // function which requires a pararallel::distributed::triangulation
759 *parallel_triangulation, temporary_particle_handler, particle_handler);
760
761 // Exchange the ghost particles so that the particle handler is ready to
762 // be used to calculate the initial conditions of the void fraction or
763 // anything that requires the ghost particles.
764 particle_handler.exchange_ghost_particles(true);
765 }
766 else
767 {
768 throw std::runtime_error(
769 "The VANS application currently does not support "
770 "triangulations other than parallel::distributed");
771 }
772}
773
774template <int dim, typename PropertiesIndex>
775void
777{
778 // First we update the particle-fluid coupling terms.
779 // The base matrix-free operator is not aware of the various VANS
780 // coupling terms. We must do a cast here to ensure that the operator is
781 // of the right type.
782 if (auto mf_operator =
783 dynamic_cast<VANSOperator<dim, double> *>(this->system_operator.get()))
784 {
785 // If the coupling is implicit, we need to carry out the projection of
786 // the particle information onto the CFD mesh at every RHS evaluation
787 // since the momentum exchange term evolves.
788 if (cfd_dem_simulation_parameters.cfd_dem.drag_coupling ==
790 {
791 this->computing_timer.enter_subsection(
792 "Calculate particle-fluid forces projection");
793 particle_projector.calculate_particle_fluid_forces_projection(
794 this->cfd_dem_simulation_parameters.cfd_dem,
795 *this->dof_handler,
796 this->evaluation_point,
797 *this->previous_solutions,
798 this->cfd_dem_simulation_parameters.dem_parameters
799 .lagrangian_physical_properties.g,
801 this->simulation_control,
802 this->simulation_parameters.physical_properties_manager,
803 *this->fe,
804 *this->cell_quadrature,
805 *this->mapping,
806 *this->face_quadrature));
807 this->computing_timer.leave_subsection(
808 "Calculate particle-fluid forces projection");
809 }
810
811 this->computing_timer.enter_subsection("Prepare MF operator for VANS");
812 mf_operator->compute_particle_fluid_interaction(
813 *particle_projector.fluid_force_on_particles_two_way_coupling
814 .dof_handler,
815 particle_projector.fluid_force_on_particles_two_way_coupling
816 .particle_field_solution,
817 *particle_projector.fluid_drag_on_particles.dof_handler,
818 particle_projector.fluid_drag_on_particles.particle_field_solution,
819 *particle_projector.particle_velocity.dof_handler,
820 particle_projector.particle_velocity.particle_field_solution,
821 *particle_projector.momentum_transfer_coefficient.dof_handler,
822 particle_projector.momentum_transfer_coefficient
823 .particle_field_solution);
824 this->computing_timer.leave_subsection("Prepare MF operator for VANS");
825 }
826
827 TimerOutput::Scope t(this->computing_timer, "Assemble RHS");
828
829
830 // Update the precomputed values needed for the evaluation of the residual.
831 // This is needed, otherwise the line-search mechanism used in the Newton
832 // method might fail even though the Newton step should have been accepted
833 // due to a wrong evaluation of the residual and, consequently, a wrong
834 // evaluation of the step length.
835 this->evaluation_point.update_ghost_values();
836 this->system_operator->evaluate_non_linear_term_and_calculate_tau(
837 this->evaluation_point);
838
839 this->system_operator->evaluate_residual(this->system_rhs,
840 this->evaluation_point);
841
842 // If mortar is enabled, add RHS entries
843 if (this->simulation_parameters.mortar_parameters.enable)
844 {
845 this->system_operator->mortar_coupling_operator_mf->vmult_add(
846 this->system_rhs, this->evaluation_point);
847 this->system_rhs.compress(VectorOperation::add);
848 }
849
850 this->system_rhs *= -1.0;
851
852 // Provide residual to simulation control for stopping criterion when using
853 // steady bdf
854 if (this->simulation_control->is_first_assembly())
855 this->simulation_control->provide_residual(this->system_rhs.l2_norm());
856}
857
858template <int dim, typename PropertiesIndex>
859void
861{
862 // Void fraction percolation must be done before the time step is finished to
863 // ensure that the checkpointed information is correct
864 particle_projector.percolate_void_fraction();
865
867}
868
869template <int dim, typename PropertiesIndex>
870std::vector<OutputStruct<dim, LinearAlgebra::distributed::Vector<double>>>
872{
873 std::vector<OutputStruct<dim, LinearAlgebra::distributed::Vector<double>>>
874 solution_output_structs;
875
876 // Make sure all of the particle-related vectors have adequate ghost values.
877 particle_projector.void_fraction_solution.update_ghost_values();
878 particle_projector.fluid_drag_on_particles.particle_field_solution
879 .update_ghost_values();
880 particle_projector.particle_velocity.particle_field_solution
881 .update_ghost_values();
882 particle_projector.momentum_transfer_coefficient.particle_field_solution
883 .update_ghost_values();
884
885 std::vector<std::string> name = {"void_fraction"};
886 std::vector<DataComponentInterpretation::DataComponentInterpretation>
887 component_interpretation = {
888 DataComponentInterpretation::component_is_scalar};
889 solution_output_structs.emplace_back(
890 std::in_place_type<
891 OutputStructSolution<dim, LinearAlgebra::distributed::Vector<double>>>,
892 *particle_projector.dof_handler,
893 particle_projector.void_fraction_solution,
894 name,
895 component_interpretation);
896
897 // Since the information related to the particles are always 3-dimensional
898 // (e.g. the velocity of the particles, the drag, etc.) we prevent the output
899 // of the particle-laden information if the solver is running in 2D. The 2D
900 // capability of the CFD-DEM component of the VANS solver have never really
901 // been assessed and so running them is very uncertain at the time.
902 if constexpr (dim > 2)
903 {
904 std::vector<std::string> force_names(dim, "fluid_drag_on_particles");
905 std::vector<DataComponentInterpretation::DataComponentInterpretation>
906 force_component_interpretation(
907 dim, DataComponentInterpretation::component_is_part_of_vector);
908
909 solution_output_structs.emplace_back(
910 std::in_place_type<
912 LinearAlgebra::distributed::Vector<double>>>,
913 *particle_projector.fluid_drag_on_particles.dof_handler,
914 particle_projector.fluid_drag_on_particles.particle_field_solution,
915 force_names,
916 force_component_interpretation);
917
918 std::vector<std::string> particle_velocity_names(dim,
919 "particle_velocity");
920 std::vector<DataComponentInterpretation::DataComponentInterpretation>
921 particle_velocity_component_interpretation(
922 dim, DataComponentInterpretation::component_is_part_of_vector);
923
924 solution_output_structs.emplace_back(
925 std::in_place_type<
927 LinearAlgebra::distributed::Vector<double>>>,
928 *particle_projector.particle_velocity.dof_handler,
929 particle_projector.particle_velocity.particle_field_solution,
930 particle_velocity_names,
931 particle_velocity_component_interpretation);
932
933 std::vector<std::string> mtc_name(1, "momentum_transfer_coefficient");
934 std::vector<DataComponentInterpretation::DataComponentInterpretation>
935 mtc_component_interpretation(
936 1, DataComponentInterpretation::component_is_scalar);
937
938 solution_output_structs.emplace_back(
939 std::in_place_type<
941 LinearAlgebra::distributed::Vector<double>>>,
942 *particle_projector.momentum_transfer_coefficient.dof_handler,
943 particle_projector.momentum_transfer_coefficient
944 .particle_field_solution,
945 mtc_name,
946 mtc_component_interpretation);
947 }
948
949 // Output the cell indices if the QCM quadrature filters are written
950 if (this->cfd_dem_simulation_parameters.void_fraction->output_qcm)
951 {
952 Vector<float> cell_index(this->triangulation->n_active_cells());
953
954 for (const auto &cell : this->dof_handler->active_cell_iterators())
955 if (cell->is_locally_owned())
956 cell_index(cell->active_cell_index()) =
957 cell->global_active_cell_index();
958
959 solution_output_structs.emplace_back(
960 std::in_place_type<OutputStructCellVector>, cell_index, "cell_index");
961 }
962
963 return solution_output_structs;
964}
965
966template <int dim, typename PropertiesIndex>
967void
970{
972
973 // If the void fraction time derivative is disabled, we just leave it at zero.
974 if (cfd_dem_simulation_parameters.cfd_dem.void_fraction_time_derivative ==
975 false)
976 {
977 // Even though it is zero, we still need to update its ghost values.
978 time_derivative_void_fraction.update_ghost_values();
979 return;
980 }
981 // Time stepping information
982 const auto method = this->simulation_control->get_assembly_method();
983 // Vector for the BDF coefficients
984 const Vector<double> &bdf_coefs =
985 this->simulation_control->get_bdf_coefficients();
986
988 bdf_coefs[0], this->particle_projector.void_fraction_solution);
989 for (unsigned int p = 0; p < number_of_previous_solutions(method); ++p)
990 {
992 bdf_coefs[p + 1],
993 this->particle_projector.void_fraction_previous_solution[p]);
994 }
995
996 // After the void fraction time derivative is calculated, we update its ghost
997 // values.
998 time_derivative_void_fraction.update_ghost_values();
999}
1000
1001template <int dim, typename PropertiesIndex>
1002void
1004{
1005 this->computing_timer.enter_subsection("Read mesh, manifolds and particles");
1006
1008 *this->triangulation,
1009 this->cfd_dem_simulation_parameters.cfd_parameters.mesh,
1010 this->cfd_dem_simulation_parameters.cfd_parameters.manifolds_parameters,
1011 this->cfd_dem_simulation_parameters.cfd_parameters.restart_parameters
1012 .restart ||
1013 this->cfd_dem_simulation_parameters.void_fraction->read_dem,
1014 this->cfd_dem_simulation_parameters.cfd_parameters.boundary_conditions
1015 .periodic_boundaries);
1016
1017 if (this->cfd_dem_simulation_parameters.void_fraction->read_dem == true &&
1018 this->cfd_dem_simulation_parameters.cfd_parameters.restart_parameters
1019 .restart == false)
1020 read_dem();
1021
1022 this->computing_timer.leave_subsection("Read mesh, manifolds and particles");
1023
1024 this->setup_dofs();
1025
1026 // Initialize void fraction only when not restarting. On restart, the void
1027 // fraction is restored from the checkpoint in read_checkpoint(). Calling
1028 // initialize_void_fraction before read_checkpoint would crash because the
1029 // particle handler has not been deserialized yet.
1030 if (!this->simulation_parameters.restart_parameters.restart)
1031 particle_projector.initialize_void_fraction(
1032 this->simulation_control->get_current_time());
1033
1035 this->simulation_parameters.initial_condition->type,
1036 this->simulation_parameters.restart_parameters.restart);
1037
1038 // Only needed if other physics apart from fluid dynamics are enabled.
1039 if (this->multiphysics->get_active_physics().size() > 1)
1041
1042 while (this->simulation_control->integrate())
1043 {
1044 if (this->forcing_function)
1045 {
1046 this->forcing_function->set_time(
1047 this->simulation_control->get_current_time());
1048 // The forcing term is precomputed by the operator, it must be
1049 // recomputed for a time-dependent forcing function to be accounted
1050 // for.
1051 this->system_operator->compute_forcing_term();
1052 }
1053
1055 this->multiphysics->update_boundary_conditions();
1056
1057 this->simulation_control->print_progression(this->pcout);
1058 this->dynamic_flow_control();
1059
1060 if (!this->simulation_control->is_at_start())
1061 {
1062 this->refine_mesh();
1063 }
1064
1065 if (time_stepping_is_bdf(this->simulation_control->get_assembly_method()))
1066 {
1067 this->computing_timer.enter_subsection(
1068 "Calculate time derivative previous solutions");
1069
1071 this->time_derivative_previous_solutions.update_ghost_values();
1072 this->system_operator->evaluate_time_derivative_previous_solutions(
1074
1075 this->computing_timer.leave_subsection(
1076 "Calculate time derivative previous solutions");
1077
1078 if (this->simulation_parameters.flow_control.enable_flow_control)
1079 this->system_operator->update_beta_force(
1080 this->flow_control.get_beta());
1081 }
1082
1083 {
1084 TimerOutput::Scope t(this->computing_timer,
1085 "Calculate particle-fluid projection");
1086
1087 // Calculate the new void fraction
1088 particle_projector.calculate_void_fraction(
1089 this->simulation_control->get_current_time());
1090
1091 // and its derivative
1093
1094 particle_projector.calculate_particle_fluid_forces_projection(
1095 this->cfd_dem_simulation_parameters.cfd_dem,
1096 *this->dof_handler,
1097 *this->present_solution,
1098 *this->previous_solutions,
1099 cfd_dem_simulation_parameters.dem_parameters
1100 .lagrangian_physical_properties.g,
1102 this->simulation_control,
1103 this->simulation_parameters.physical_properties_manager,
1104 *this->fe,
1105 *this->cell_quadrature,
1106 *this->mapping,
1107 *this->face_quadrature));
1108
1109 // The base matrix-free operator is not aware of the various VANS
1110 // coupling term. We must do a cast here to ensure that the operator is
1111 // of the right type.
1112 if (auto mf_operator = dynamic_cast<VANSOperator<dim, double> *>(
1113 this->system_operator.get()))
1114 {
1115 TimerOutput::Scope t(this->computing_timer,
1116 "Prepare MF operator for VANS");
1117
1118 mf_operator->compute_void_fraction(
1119 *particle_projector.dof_handler,
1120 particle_projector.void_fraction_solution,
1121 this->time_derivative_void_fraction);
1122
1123 mf_operator->compute_particle_fluid_interaction(
1124 *particle_projector.fluid_force_on_particles_two_way_coupling
1125 .dof_handler,
1126 particle_projector.fluid_force_on_particles_two_way_coupling
1127 .particle_field_solution,
1128 *particle_projector.fluid_drag_on_particles.dof_handler,
1129 particle_projector.fluid_drag_on_particles
1130 .particle_field_solution,
1131 *particle_projector.particle_velocity.dof_handler,
1132 particle_projector.particle_velocity.particle_field_solution,
1133 *particle_projector.momentum_transfer_coefficient.dof_handler,
1134 particle_projector.momentum_transfer_coefficient
1135 .particle_field_solution);
1136 }
1137 }
1138
1139 this->iterate();
1140 this->postprocess(false);
1141 // The void fraction must be percolated at the end of the time step,
1142 // otherwise its time derivative is always evaluated with respect to the
1143 // initial void fraction.
1144 this->finish_time_step_fd();
1145
1146 if (this->simulation_parameters.timer.type ==
1148 this->print_mg_setup_times();
1149 }
1151 this->print_mg_setup_times();
1152
1153 this->finish_simulation();
1154}
1155
1156
1157template <int dim, typename PropertiesIndex>
1158void
1160{
1161 this->gmg_preconditioner =
1162 std::make_shared<MFNavierStokesVANSPreconditionGMG<dim>>(
1164 *this->dof_handler,
1166
1167 this->gmg_preconditioner->reinit(this->mapping,
1168 this->cell_quadrature,
1169 this->forcing_function,
1170 this->simulation_control,
1172 this->fe);
1173}
1174
1175template <int dim, typename PropertiesIndex>
1176void
1178{
1180 this->gmg_preconditioner.get())
1181 ->template initialize<PropertiesIndex>(
1182 this->simulation_control,
1183 this->flow_control,
1184 *this->present_solution,
1187 this->particle_projector);
1188}
1189
1190// Pre-compile the 2D and 3D solver to ensure that the
1191// library is valid before we actually compile the solver
1192template class FluidDynamicsVANSMatrixFree<
1193 2,
1195template class FluidDynamicsVANSMatrixFree<
1196 3,
1198template class FluidDynamicsVANSMatrixFree<
1199 2,
1201template class FluidDynamicsVANSMatrixFree<
1202 3,
unsigned int number_of_previous_solutions(const Parameters::SimulationControl::TimeSteppingMethod method)
Get the number of previous time steps for a specific BDF scheme.
Definition bdf.h:97
SimulationParameters< dim > cfd_parameters
Dynamic flow controller that drives the average velocity of the flow towards a target value.
void print_mg_setup_times()
Prints the setup times for the geometric multigrid preconditioner.
std::shared_ptr< PhysicalPropertiesManager > physical_properties_manager
Pointer to the physical properties object.
DoFHandler< dim > dof_handler_fe_q_iso_q1
Describes the layout of DoFs for FE_Q_iso_Q1 elements.
VectorType time_derivative_previous_solutions
Vector to store the time derivatives of the previous solutions at the end of each time step for time-...
virtual void update_multiphysics_time_average_solution() override
Update the average velocity field solution in the multiphyscics interface.
std::shared_ptr< NavierStokesOperatorBase< dim, double > > system_operator
Matrix-free operator in used for all the matrix-vector multiplications calls (vmult).
std::shared_ptr< MFNavierStokesPreconditionGMGBase< dim > > gmg_preconditioner
Geometric multigrid preconditioner.
void calculate_time_derivative_previous_solutions()
Calculate and store time derivatives of previous solutions according to time-stepping scheme to use t...
FluidDynamicsMatrixFree(SimulationParameters< dim > &nsparam, const FluidDynamicsFormulation fluid_dynamics_formulation=FluidDynamicsFormulation::standard)
Constructor that sets the finite element degree and system operator according to simulation parameter...
A solver for the Volume-Averaged incompressible Navier-Stokes equations implemented in a matrix-free ...
virtual void read_dem()
Read particles arising from a DEM simulation.
void evaluate_time_derivative_void_fraction()
Evaluate the time derivative of the void fraction. This evaluates the time-derivative as a solution v...
void solve() override
Solve the problem defined by simulation parameters by iterating through time or through the mesh refi...
virtual void finish_time_step_fd()
Finish the time step and manage the end of the time step for the void fraction.
bool has_periodic_boundaries
Member variables which are used to manage boundary conditions.
void create_GMG() override
Create geometric multigrid preconditioner.
ParticleProjector< dim, PropertiesIndex > particle_projector
CFDDEMSimulationParameters< dim > cfd_dem_simulation_parameters
Simulation parameters for CFD-DEM simulations.
void setup_dofs() override
Setup the degree of freedom of the flow solver and the degrees of freedom and constraints for the voi...
FluidDynamicsVANSMatrixFree(CFDDEMSimulationParameters< dim > &param)
Constructor that sets the finite element degree and system operator according to simulation parameter...
Particles::ParticleHandler< dim, dim > particle_handler
Particle-handler used to store particles in CFD-DEM simulations.
VectorType time_derivative_void_fraction
Vector to store the time derivative of the void fraction.
void assemble_system_rhs() override
Assembles the RHS of the VANS system of equation. This function also recalculates the particle-fluid ...
std::vector< OutputStruct< dim, LinearAlgebra::distributed::Vector< double > > > gather_output_hook() override
Add void fraction field to output files.
MappingQGeneric< dim > particle_mapping
Mapping used for the particles.
MGLevelObject< std::shared_ptr< OperatorType > > mg_operators
Level operators for the geometric multigrid.
SimulationParameters< dim > simulation_parameters
Simulation parameters.
unsigned int maxlevel
Max level of the multigrid hierarchy.
void initialize()
Initialize smoother, coarse grid solver and multigrid object needed for the geometric multigrid preco...
const DoFHandler< dim > & dof_handler
Describes the layout of DoFs and the type of FE.
unsigned int minlevel
Min level of the multigrid hierarchy.
DoFHandler< dim > dof_handler_fe_q_iso_q1
Describes the layout of DoFs for FE_Q_iso_Q1 elements.
MGLevelObject< DoFHandler< dim > > dof_handlers
DoF handlers for each of the levels of the global coarsening algorithm.
MFNavierStokesPreconditionGMG(const SimulationParameters< dim > &simulation_parameters, const DoFHandler< dim > &dof_handler, const DoFHandler< dim > &dof_handler_fe_q_iso_q1)
A geometric multigrid preconditioner implementation for incompressible VANS equations.
const CFDDEMSimulationParameters< dim > & cfd_dem_simulation_parameters
Reference to the simulation parameters.
typename MFNavierStokesPreconditionGMG< dim >::VectorType VectorType
Useful aliases to improve readability.
typename MFNavierStokesPreconditionGMG< dim >::MGVectorType MGVectorType
MGLevelObject< MGTwoLevelTransfer< dim, MGVectorType > > transfers_pf_force
std::shared_ptr< GCTransferType > mg_transfer_gc_momentum_transfer_coefficient
Transfer operator for global coarsening for the particle-fluid drag.
std::shared_ptr< GCTransferType > mg_transfer_gc_void_fraction
Transfer operator for global coarsening for the void fraction.
std::shared_ptr< LSTransferType > mg_transfer_ls_momentum_transfer_coefficient
std::shared_ptr< GCTransferType > mg_transfer_gc_pf_drag
Transfer operator for global coarsening for the particle-fluid drag.
MGLevelObject< DoFHandler< dim > > momentum_transfer_coefficient_dof_handlers
MGLevelObject< MGTwoLevelTransfer< dim, MGVectorType > > transfers_momentum_transfer_coefficient
void create_level_operator(const unsigned int level) override
Creates the operator on a given level.
MGLevelObject< MGTwoLevelTransfer< dim, MGVectorType > > transfers_particle_velocity
std::shared_ptr< LSTransferType > mg_transfer_ls_void_fraction
MGLevelObject< DoFHandler< dim > > pf_force_dof_handlers
std::shared_ptr< LSTransferType > mg_transfer_ls_particle_velocity
MGLevelObject< DoFHandler< dim > > void_fraction_dof_handlers
std::shared_ptr< GCTransferType > mg_transfer_gc_particle_velocity
Transfer operator for global coarsening for the particle velocity.
MFNavierStokesVANSPreconditionGMG(const CFDDEMSimulationParameters< dim > &param, const DoFHandler< dim > &dof_handler, const DoFHandler< dim > &dof_handler_fe_q_iso_q1)
Constructor.
std::shared_ptr< GCTransferType > mg_transfer_gc_pf_force
Transfer operator for global coarsening for the particle-fluid forces.
MGLevelObject< MGTwoLevelTransfer< dim, MGVectorType > > transfers_pf_drag
MGLevelObject< DoFHandler< dim > > particle_velocity_dof_handlers
std::shared_ptr< LSTransferType > mg_transfer_ls_pf_force
MGLevelObject< DoFHandler< dim > > pf_drag_dof_handlers
MGLevelObject< MGTwoLevelTransfer< dim, MGVectorType > > transfers_void_fraction
std::shared_ptr< LSTransferType > mg_transfer_ls_pf_drag
virtual void set_initial_condition(const Parameters::FluidDynamicsInitialConditionType initial_condition_type, const bool restart=false)
std::shared_ptr< LinearAlgebra::distributed::Vector< double > > present_solution
std::shared_ptr< parallel::DistributedTriangulationBase< dim > > triangulation
Class that stores the information required by the assembly procedure for a Navier-Stokes equation....
std::shared_ptr< DoFHandler< dim > > dof_handler
LinearAlgebra::distributed::Vector< double > particle_field_solution
deal.II vector for the particle field solution.
Particle information projection. This class manages the calculation of the projection of the particle...
std::shared_ptr< DoFHandler< dim > > dof_handler
ParticleFieldQCM< dim, 3, PropertiesIndex::fem_force_two_way_coupling_x > fluid_force_on_particles_two_way_coupling
ParticleFieldQCM< dim, 1, PropertiesIndex::momentum_transfer_coefficient > momentum_transfer_coefficient
LinearAlgebra::distributed::Vector< double > void_fraction_solution
deal.II vector for the void fraction
ParticleFieldQCM< dim, 3, PropertiesIndex::v_x > particle_velocity
ParticleFieldQCM< dim, 3, PropertiesIndex::fem_drag_x > fluid_drag_on_particles
Implements the matrix-free operator for the VANS equations.
void check_file_exists(const std::string &file_name, const std::string &file_description)
Verify that a file that Lethe must read exists and can be opened, and raise an error stated in the us...
Definition utilities.cc:225
DEM particle property definitions and output name management.
void read_mesh_and_manifolds(parallel::DistributedTriangulationBase< dim, spacedim > &triangulation, const Parameters::Mesh< dim, spacedim > &mesh_parameters, const Parameters::Manifolds &manifolds_parameters, bool restart, const Parameters::PeriodicBoundaries &periodic_boundaries)
Completely sets up a mesh and its manifolds.
Definition grids.cc:447
FluidDynamicsFormulation
Formulation of the fluid dynamics equations solved by a Navier-Stokes solver.
@ VANS
Volume-averaged Navier-Stokes (VANS) equations.
PhysicsID
Unique identifiers for each physics module in Lethe.
@ fluid_dynamics
Fluid Dynamics (Velocity,Pressure).
@ particle_temperature
@ void_fraction
PropertiesIndex
Particle property indices for CFD-DEM multiphysics simulations.
PropertiesIndex
Particle property indices for CFD-DEM simulations.
constexpr bool has_thermal_properties
Whether a properties index set carries thermal properties.
std::conditional_t< has_thermal_properties< PropertiesIndex >, DEMMPProperties::PropertiesIndex, DEMProperties::PropertiesIndex > matching_dem_properties_index
The pure DEM index set matching a given index set.
@ fully_implicit
Fully implicit drag coupling.
void convert_particle_handler(const parallel::distributed::Triangulation< dim > &triangulation, const Particles::ParticleHandler< dim > &ph_in, Particles::ParticleHandler< dim > &ph_out)
Converts an input particle handler with a given set of input properties into an output particle handl...
Struct containing information about the solution output. It is used to pass all the information requi...
@ lsmg
Local-Smoothing Geometric Multigrid.
@ gcmg
Global-Coarsening Multigrid.
bool time_stepping_is_bdf(const Parameters::SimulationControl::TimeSteppingMethod method)
Determines if the time integration method is within the bdf family.
bool time_stepping_is_sdirk(const Parameters::SimulationControl::TimeSteppingMethod method)
Determines if the time integration method is within the sdirk family.