Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
fluid_dynamics_vans.cc
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2020-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
5#include <core/grids.h>
8#include <core/utilities.h>
9
13
14#include <deal.II/base/work_stream.h>
15
16// Constructor for class FluidDynamicsVANS
17template <int dim, typename PropertiesIndex>
20 : FluidDynamicsMatrixBased<dim>(nsparam.cfd_parameters,
26 PropertiesIndex::n_properties)
28 &(*this->triangulation),
29 nsparam.void_fraction,
30 this->cfd_dem_simulation_parameters.cfd_parameters.linear_solver.at(
33 this->cfd_dem_simulation_parameters.cfd_parameters.fem_parameters
34 .void_fraction_degree,
35 this->cfd_dem_simulation_parameters.cfd_parameters.mesh.simplex,
36 this->pcout)
38{
39 // After a mesh adaptation, the void fraction is recomputed on the new mesh,
40 // but its previous time steps are not transferred: they are reset to zero by
41 // setup_dofs(). Mesh adaptation is therefore only valid with the steady
42 // method, which does not use the previous void fractions.
43 AssertThrow(nsparam.cfd_parameters.mesh_adaptation.type ==
45 nsparam.cfd_parameters.simulation_control.method ==
47 NotSupportedMeshAdaptationMethod());
48
49 // Make the projected particle fields available to the other physics through
50 // the multiphysics interface.
51 this->multiphysics->enable_projected_particle_fields(
54 this->multiphysics->enable_projected_particle_fields(
56
57 unsigned int n_pbc = 0;
58 for (auto const &[id, type] :
59 cfd_dem_simulation_parameters.cfd_parameters.boundary_conditions.type)
60 {
62 {
63 if (n_pbc++ > 1)
64 {
65 throw std::runtime_error(
66 "GLS VANS solver does not support more than one periodic boundary condition.");
67 }
68 else
69 {
71 }
72 }
73 }
74}
75
76template <int dim, typename PropertiesIndex>
81
82template <int dim, typename PropertiesIndex>
83void
85{
87
88 particle_projector.setup_dofs();
89 particle_projector.setup_constraints(
90 this->cfd_dem_simulation_parameters.cfd_parameters.boundary_conditions);
91
92 // Provide the void fraction dof_handler and present solution to the
93 // multiphysics interface
94 this->multiphysics->set_dof_handler(PhysicsID::void_fraction,
95 particle_projector.dof_handler);
96 this->multiphysics->set_mapping(PhysicsID::void_fraction,
97 particle_projector.mapping);
98 this->multiphysics->set_solution(
100 particle_projector.void_fraction_locally_relevant);
101 this->multiphysics->set_previous_solutions(
102 PhysicsID::void_fraction, particle_projector.previous_void_fraction);
103
105 {
106 this->multiphysics->set_dof_handler(
108 particle_projector.particle_temperature.dof_handler);
110 particle_projector.mapping);
111 this->multiphysics->set_solution(
113 particle_projector.particle_temperature_locally_relevant);
114 }
115}
116
117template <int dim, typename PropertiesIndex>
118void
120{
121 // Void fraction percolation must be done before the time step is finished to
122 // ensure that the checkpointed information is correct
123 particle_projector.percolate_void_fraction();
124
126}
127
128template <int dim, typename PropertiesIndex>
129void
131{
132 std::string prefix =
133 this->cfd_dem_simulation_parameters.void_fraction->dem_file_name;
134
135 // Load checkpoint controller
136 std::string checkpoint_controller_object_filename =
137 prefix + ".checkpoint_controller";
138 check_file_exists(checkpoint_controller_object_filename,
139 "checkpoint file of the checkpoint controller, given by "
140 "'subsection void fraction' - 'set dem file name'");
141 std::ifstream iss_checkpoint_controller_obj(
142 checkpoint_controller_object_filename);
143 boost::archive::text_iarchive ia_checkpoint_controller_obj(
144 iss_checkpoint_controller_obj, boost::archive::no_header);
145
146 unsigned int checkpoint_id;
147 ia_checkpoint_controller_obj >> checkpoint_id;
148
149 // New prefix for the remaining files
150 prefix = prefix + "_" + Utilities::int_to_string(checkpoint_id);
151
152 // Gather particle serialization information
153 std::string particle_filename = prefix + ".particles";
154 check_file_exists(particle_filename,
155 "checkpoint file of the particles, given by "
156 "'subsection void fraction' - 'set dem file name'");
157 std::ifstream input(particle_filename.c_str());
158
159 std::string buffer;
160 std::getline(input, buffer);
161 std::istringstream iss(buffer);
162 boost::archive::text_iarchive ia(iss, boost::archive::no_header);
163
164 // Create a temporary particle_handler with the DEM properties of the
165 // simulation this one is restarted from
166 using DEMPropertiesIndex =
168
169 Particles::ParticleHandler<dim> temporary_particle_handler(
170 *this->triangulation, particle_mapping, DEMPropertiesIndex::n_properties);
171
172 ia >> temporary_particle_handler;
173
174 const std::string filename = prefix + ".triangulation";
175 check_file_exists(filename,
176 "checkpoint file of the triangulation, given by "
177 "'subsection void fraction' - 'set dem file name'");
178
179 if (auto parallel_triangulation =
180 dynamic_cast<parallel::distributed::Triangulation<dim> *>(
181 &*this->triangulation))
182 {
183 try
184 {
185 this->triangulation->load(filename.c_str());
186
187 // Deserialize particles have the triangulation has been read
188 temporary_particle_handler.deserialize();
189 }
190 catch (...)
191 {
192 AssertThrow(false,
193 ExcMessage("Cannot open snapshot mesh file or read the"
194 "triangulation stored there."));
195 }
196
197 // Fill the existing particle handler using the temporary one
198 // This is done during the dynamic cast for the convert_particle_handler
199 // function which requires a pararallel::distributed::triangulation
201 *parallel_triangulation, temporary_particle_handler, particle_handler);
202 }
203 else
204 {
205 throw std::runtime_error(
206 "VANS equations currently do not support "
207 "triangulations other than parallel::distributed");
208 }
209}
210
211template <int dim, typename PropertiesIndex>
212void
214 const double time)
215{
216 TimerOutput::Scope t(this->computing_timer, "Calculate void fraction");
217 particle_projector.calculate_void_fraction(time);
218}
219
220template <int dim, typename PropertiesIndex>
221void
223{
224 // Find all the cells around each vertex
225 TimerOutput::Scope t(this->computing_timer, "Map vertices to cell");
226
229
233}
234// Do an iteration with the NavierStokes Solver
235// Handles the fact that we may or may not be at a first
236// iteration with the solver and sets the initial conditions
237template <int dim, typename PropertiesIndex>
238void
240{
241 announce_string(this->pcout, "Volume-Averaged Fluid Dynamics");
242
243 // Solve and percolate the auxiliary physics that should be treated BEFORE
244 // the fluid dynamics
245 this->multiphysics->solve(
246 false, this->simulation_parameters.simulation_control.method);
247 this->multiphysics->percolate_time_vectors(false);
248
249 if (this->simulation_parameters.multiphysics.fluid_dynamics)
250 {
251 this->forcing_function->set_time(
252 this->simulation_control->get_current_time());
253
255
256 // If the auxiliary physics need to be solved after the fluid dynamics,
257 // the vans solver requires to update the value here. This is due
258 // to the different type of vectors. This is copied from the
259 // navier_stokes_base.cc file logic.
260 if (this->multiphysics->get_active_physics().size() > 1)
261 {
263 }
264 }
265 else
266 {
267 // The fluid dynamics is not to be solved, but rather specified. Update
268 // the velocity and the pressure fields and move on.
270 }
271
272 // Solve and percolate the auxiliary physics that should be treated AFTER
273 // the fluid dynamics
274 this->multiphysics->solve(
275 true, this->simulation_parameters.simulation_control.method);
276 this->multiphysics->percolate_time_vectors(true);
277}
278
279template <int dim, typename PropertiesIndex>
280void
282{
283 // The VANS assemblers only implement the BDF time integration.
284 AssertThrow(
285 !time_stepping_is_sdirk(this->simulation_control->get_assembly_method()),
286 ExcMessage("SDIRK time-stepping methods are not supported by the VANS "
287 "solver. Use a BDF method instead."));
288
289 this->assemblers.clear();
291
292 if (this->check_existance_of_bc(
294 {
295 this->assemblers.push_back(
296 std::make_shared<WeakDirichletBoundaryCondition<dim>>(
297 this->simulation_control,
298 this->simulation_parameters.boundary_conditions));
299 }
300 if (this->check_existance_of_bc(
302 {
303 this->assemblers.push_back(
305 this->simulation_control,
306 this->simulation_parameters.boundary_conditions));
307 }
308 if (this->check_existance_of_bc(
310 {
311 this->assemblers.push_back(std::make_shared<OutletBoundaryCondition<dim>>(
312 this->simulation_control,
313 this->simulation_parameters.boundary_conditions));
314 }
315 if (this->check_existance_of_bc(
317 {
318 this->assemblers.push_back(
319 std::make_shared<PressureBoundaryCondition<dim>>(
320 this->simulation_control,
321 this->simulation_parameters.boundary_conditions));
322 }
323
324 if (this->cfd_dem_simulation_parameters.cfd_dem.drag_force == true)
325 {
326 // Particle_Fluid Interactions Assembler
327 if (this->cfd_dem_simulation_parameters.cfd_dem.drag_model ==
329 {
330 // DiFelice Model drag Assembler
333 this->cfd_dem_simulation_parameters.cfd_dem));
334 }
335
336 if (this->cfd_dem_simulation_parameters.cfd_dem.drag_model ==
338 {
339 // Rong Model drag Assembler
342 this->cfd_dem_simulation_parameters.cfd_dem));
343 }
344
345 if (this->cfd_dem_simulation_parameters.cfd_dem.drag_model ==
347 {
348 // Dallavalle Model drag Assembler
351 this->cfd_dem_simulation_parameters.cfd_dem));
352 }
353
354 if (this->cfd_dem_simulation_parameters.cfd_dem.drag_model ==
356 {
357 // Koch and Hill Model drag Assembler
360 this->cfd_dem_simulation_parameters.cfd_dem));
361 }
362 if (this->cfd_dem_simulation_parameters.cfd_dem.drag_model ==
364 {
365 // Beetstra drag model assembler
368 this->cfd_dem_simulation_parameters.cfd_dem));
369 }
370 if (this->cfd_dem_simulation_parameters.cfd_dem.drag_model ==
372 {
373 // Gidaspow Model drag Assembler
376 this->cfd_dem_simulation_parameters.cfd_dem));
377 }
378 }
379
380 if (this->cfd_dem_simulation_parameters.cfd_dem.saffman_lift_force == true)
381 // Saffman Mei Lift Force Assembler
384
385 if (this->cfd_dem_simulation_parameters.cfd_dem.magnus_lift_force == true)
386 // Magnus Lift Force Assembler
389
390 if (this->cfd_dem_simulation_parameters.cfd_dem.rotational_viscous_torque ==
391 true)
392 // Viscous Torque Assembler
395
396 if (this->cfd_dem_simulation_parameters.cfd_dem.vortical_viscous_torque ==
397 true)
398 // Vortical Torque Assembler
401
402 if (this->cfd_dem_simulation_parameters.cfd_dem.buoyancy_force == true)
403 // Buoyancy Force Assembler
406 this->cfd_dem_simulation_parameters.dem_parameters
407 .lagrangian_physical_properties.g));
408
409 if (this->cfd_dem_simulation_parameters.cfd_dem.pressure_force == true)
410 // Pressure Force
413 this->cfd_dem_simulation_parameters.cfd_dem));
414
415 if (this->cfd_dem_simulation_parameters.cfd_dem.shear_force == true)
416 // Shear Force
419 this->cfd_dem_simulation_parameters.cfd_dem));
420
421 // Time-stepping schemes
422 if (time_stepping_is_bdf(this->simulation_control->get_assembly_method()))
423 {
424 this->assemblers.push_back(std::make_shared<VANSAssemblerBDF<dim>>(
426 }
427
428 // Fluid_Particle Interactions Assembler
429 if (this->cfd_dem_simulation_parameters.cfd_dem.project_particle_forces)
430 {
431 this->assemblers.push_back(
432 std::make_shared<VANSAssemblerFPIProjection<dim>>(
433 this->cfd_dem_simulation_parameters.cfd_dem));
434 }
435 else
436 {
437 this->assemblers.push_back(std::make_shared<VANSAssemblerFPI<dim>>(
438 this->cfd_dem_simulation_parameters.cfd_dem));
439 }
440
441 // The core assembler should always be the last assembler to be called
442 // in the stabilized formulation as to have all strong residual and
443 // jacobian stored. Core assembler
444 if (this->cfd_dem_simulation_parameters.cfd_dem.vans_model ==
446 this->assemblers.push_back(std::make_shared<VANSAssemblerCoreModelA<dim>>(
448
449 if (this->cfd_dem_simulation_parameters.cfd_dem.vans_model ==
451 this->assemblers.push_back(std::make_shared<VANSAssemblerCoreModelB<dim>>(
453}
454
455template <int dim, typename PropertiesIndex>
456void
458{
459 TimerOutput::Scope t(this->computing_timer, "Assemble matrix");
460 this->system_matrix = 0;
461
463
464 auto scratch_data = NavierStokesScratchData<dim>(
465 this->simulation_control,
466 this->simulation_parameters.physical_properties_manager,
467 *this->fe,
468 *this->cell_quadrature,
469 *this->mapping,
470 *this->face_quadrature);
471
472 if (this->simulation_parameters.multiphysics.CLS)
473 {
474 const DoFHandler<dim> &dof_handler_cls =
475 this->multiphysics->get_dof_handler(PhysicsID::CLS);
476 scratch_data.enable_cls(
477 dof_handler_cls.get_fe(),
478 *this->cell_quadrature,
479 *this->mapping,
480 this->simulation_parameters.multiphysics.cls_parameters.phase_filter);
481
482 if (this->simulation_parameters.multiphysics.cls_parameters
483 .surface_tension_force.enable)
484 {
485 const DoFHandler<dim>
486 &projected_phase_indicator_gradient_dof_handler =
487 this->multiphysics
488 ->get_projected_phase_indicator_gradient_dof_handler();
489 const DoFHandler<dim> &curvature_dof_handler =
490 this->multiphysics->get_curvature_dof_handler();
491 scratch_data.enable_projected_phase_indicator_gradient(
492 projected_phase_indicator_gradient_dof_handler.get_fe(),
493 *this->cell_quadrature,
494 *this->mapping);
495 scratch_data.enable_curvature(curvature_dof_handler.get_fe(),
496 *this->cell_quadrature,
497 *this->mapping);
498 }
499 }
500
501 scratch_data.enable_void_fraction(*particle_projector.fe,
502 *this->cell_quadrature,
503 *this->mapping);
504 if (this->cfd_dem_simulation_parameters.cfd_dem.project_particle_forces)
505 {
506 scratch_data.enable_particle_field_projection(
507 *this->cell_quadrature,
508 *this->mapping,
509 *particle_projector.fluid_drag_on_particles.fe,
510 *particle_projector.fluid_force_on_particles_two_way_coupling.fe,
511 *particle_projector.particle_velocity.fe,
512 *particle_projector.momentum_transfer_coefficient.fe);
513 }
514 scratch_data.enable_particle_fluid_interactions(
515 particle_handler.n_global_max_particles_per_cell(),
516 this->cfd_dem_simulation_parameters.cfd_dem.interpolated_void_fraction);
517
518 WorkStream::run(
519 this->dof_handler->begin_active(),
520 this->dof_handler->end(),
521 *this,
524 scratch_data,
525 StabilizedMethodsTensorCopyData<dim>(this->fe->n_dofs_per_cell(),
526 this->cell_quadrature->size()));
527 this->system_matrix.compress(VectorOperation::add);
528}
529
530template <int dim, typename PropertiesIndex>
531void
533 const typename DoFHandler<dim>::active_cell_iterator &cell,
534 NavierStokesScratchData<dim> &scratch_data,
536{
537 copy_data.cell_is_local = cell->is_locally_owned();
538 if (!cell->is_locally_owned())
539 return;
540
541 scratch_data.reinit(
542 cell,
543 this->evaluation_point,
544 *this->previous_solutions,
545 this->sdirk_vectors.sum_over_previous_stages,
546 this->forcing_function,
547 this->flow_control.get_beta(),
548 this->simulation_parameters.stabilization.pressure_scaling_factor);
549
550 std::optional<typename DoFHandler<dim>::active_cell_iterator> phase_cell;
551
552 if (this->simulation_parameters.multiphysics.CLS)
553 {
554 phase_cell.emplace(&(*(this->triangulation)),
555 cell->level(),
556 cell->index(),
557 &this->multiphysics->get_dof_handler(PhysicsID::CLS));
558
559 scratch_data.reinit_cls(
560 *phase_cell,
561 this->multiphysics->get_solution(PhysicsID::CLS),
562 this->multiphysics->get_filtered_solution(PhysicsID::CLS),
563 this->multiphysics->get_previous_solutions(PhysicsID::CLS));
564 }
565
566 typename DoFHandler<dim>::active_cell_iterator void_fraction_cell(
567 &(*(this->triangulation)),
568 cell->level(),
569 cell->index(),
570 &(*this->particle_projector.dof_handler));
571
572 scratch_data.reinit_void_fraction(
573 void_fraction_cell,
574 *this->particle_projector.void_fraction_locally_relevant,
575 *this->particle_projector.previous_void_fraction);
576
577 scratch_data.calculate_physical_properties();
578
579 if (this->simulation_parameters.multiphysics.CLS)
580 {
581 scratch_data.template reinit_particle_fluid_interactions<PropertiesIndex>(
582 cell,
583 void_fraction_cell,
584 *phase_cell,
585 this->evaluation_point,
586 (*this->previous_solutions)[0],
587 *this->particle_projector.void_fraction_locally_relevant,
589 cfd_dem_simulation_parameters.cfd_dem.drag_coupling,
590 this->multiphysics->get_filtered_solution(PhysicsID::CLS));
591 }
592 else
593 {
594 scratch_data.template reinit_particle_fluid_interactions<PropertiesIndex>(
595 cell,
596 void_fraction_cell,
597 this->evaluation_point,
598 (*this->previous_solutions)[0],
599 *this->particle_projector.void_fraction_locally_relevant,
601 cfd_dem_simulation_parameters.cfd_dem.drag_coupling);
602 }
603
604 for (auto &pf_assembler : particle_fluid_assemblers)
605 {
606 pf_assembler->calculate_particle_fluid_interactions(scratch_data);
607 }
608 if (this->cfd_dem_simulation_parameters.cfd_dem.project_particle_forces)
609 {
610 typename DoFHandler<dim>::active_cell_iterator particle_drag_cell(
611 &(*(this->triangulation)),
612 cell->level(),
613 cell->index(),
614 &(*this->particle_projector.fluid_drag_on_particles.dof_handler));
615
616 typename DoFHandler<dim>::active_cell_iterator
617 particle_two_way_coupling_force_cell(
618 &(*(this->triangulation)),
619 cell->level(),
620 cell->index(),
621 &(*this->particle_projector.fluid_force_on_particles_two_way_coupling
622 .dof_handler));
623
624 typename DoFHandler<dim>::active_cell_iterator particle_velocity_cell(
625 &(*(this->triangulation)),
626 cell->level(),
627 cell->index(),
628 &(*this->particle_projector.particle_velocity.dof_handler));
629
630 typename DoFHandler<dim>::active_cell_iterator
631 particle_momentum_transfer_coefficient_cell(
632 &(*(this->triangulation)),
633 cell->level(),
634 cell->index(),
635 &(*this->particle_projector.momentum_transfer_coefficient
636 .dof_handler));
637
639 particle_drag_cell,
640 particle_two_way_coupling_force_cell,
641 particle_velocity_cell,
642 particle_momentum_transfer_coefficient_cell,
643 particle_projector.fluid_drag_on_particles.particle_field_solution,
644 particle_projector.fluid_force_on_particles_two_way_coupling
645 .particle_field_solution,
646 particle_projector.particle_velocity.particle_field_solution,
647 particle_projector.momentum_transfer_coefficient
648 .particle_field_solution,
649 cfd_dem_simulation_parameters.cfd_dem.drag_coupling);
650 }
651
652 copy_data.reset();
653
654 for (auto &assembler : this->assemblers)
655 {
656 assembler->assemble_matrix(scratch_data, copy_data);
657 }
658
659 cell->get_dof_indices(copy_data.local_dof_indices);
660}
661
662template <int dim, typename PropertiesIndex>
663void
666{
667 if (!copy_data.cell_is_local)
668 return;
669
670 const AffineConstraints<double> &constraints_used = this->zero_constraints;
671 constraints_used.distribute_local_to_global(copy_data.local_matrix,
672 copy_data.local_dof_indices,
673 this->system_matrix);
674}
675
676template <int dim, typename PropertiesIndex>
677void
679{
680 this->computing_timer.enter_subsection("Assemble RHS");
681 auto scratch_data = NavierStokesScratchData<dim>(
682 this->simulation_control,
683 this->simulation_parameters.physical_properties_manager,
684 *this->fe,
685 *this->cell_quadrature,
686 *this->mapping,
687 *this->face_quadrature);
688 this->computing_timer.leave_subsection("Assemble RHS");
689
690 if (this->cfd_dem_simulation_parameters.cfd_dem.project_particle_forces)
691 {
692 scratch_data.enable_particle_field_projection(
693 *this->cell_quadrature,
694 *this->mapping,
695 *particle_projector.fluid_drag_on_particles.fe,
696 *particle_projector.fluid_force_on_particles_two_way_coupling.fe,
697 *particle_projector.particle_velocity.fe,
698 *particle_projector.momentum_transfer_coefficient.fe);
699 if (this->cfd_dem_simulation_parameters.cfd_dem.drag_coupling ==
701 {
702 TimerOutput::Scope t(this->computing_timer,
703 "Calculate particle-fluid projection");
704 this->particle_projector.calculate_particle_fluid_forces_projection(
705 this->cfd_dem_simulation_parameters.cfd_dem,
706 *this->dof_handler,
707 *this->present_solution,
708 *this->previous_solutions,
709 this->cfd_dem_simulation_parameters.dem_parameters
710 .lagrangian_physical_properties.g,
712 this->simulation_control,
713 this->simulation_parameters.physical_properties_manager,
714 *this->fe,
715 *this->cell_quadrature,
716 *this->mapping,
717 *this->face_quadrature));
718 }
719 }
720
721 TimerOutput::Scope t(this->computing_timer, "Assemble RHS");
722 this->system_rhs = 0;
723
725
726 if (this->simulation_parameters.multiphysics.CLS)
727 {
728 const DoFHandler<dim> &dof_handler_cls =
729 this->multiphysics->get_dof_handler(PhysicsID::CLS);
730 scratch_data.enable_cls(
731 dof_handler_cls.get_fe(),
732 *this->cell_quadrature,
733 *this->mapping,
734 this->simulation_parameters.multiphysics.cls_parameters.phase_filter);
735 }
736 scratch_data.enable_void_fraction(*particle_projector.fe,
737 *this->cell_quadrature,
738 *this->mapping);
739 scratch_data.enable_particle_fluid_interactions(
740 particle_handler.n_global_max_particles_per_cell(),
741 this->cfd_dem_simulation_parameters.cfd_dem.interpolated_void_fraction);
742
743 WorkStream::run(
744 this->dof_handler->begin_active(),
745 this->dof_handler->end(),
746 *this,
749 scratch_data,
750 StabilizedMethodsTensorCopyData<dim>(this->fe->n_dofs_per_cell(),
751 this->cell_quadrature->size()));
752
753 this->system_rhs.compress(VectorOperation::add);
754
755 if (this->simulation_control->is_first_assembly())
756 this->simulation_control->provide_residual(this->system_rhs.l2_norm());
757}
758
759template <int dim, typename PropertiesIndex>
760void
762 const typename DoFHandler<dim>::active_cell_iterator &cell,
763 NavierStokesScratchData<dim> &scratch_data,
765{
766 copy_data.cell_is_local = cell->is_locally_owned();
767 if (!cell->is_locally_owned())
768 return;
769
770 scratch_data.reinit(
771 cell,
772 this->evaluation_point,
773 *this->previous_solutions,
774 this->sdirk_vectors.sum_over_previous_stages,
775 this->forcing_function,
776 this->flow_control.get_beta(),
777 this->simulation_parameters.stabilization.pressure_scaling_factor);
778
779 std::optional<typename DoFHandler<dim>::active_cell_iterator> phase_cell;
780
781 if (this->simulation_parameters.multiphysics.CLS)
782 {
783 phase_cell.emplace(&(*(this->triangulation)),
784 cell->level(),
785 cell->index(),
786 &this->multiphysics->get_dof_handler(PhysicsID::CLS));
787
788 scratch_data.reinit_cls(
789 *phase_cell,
790 this->multiphysics->get_solution(PhysicsID::CLS),
791 this->multiphysics->get_filtered_solution(PhysicsID::CLS),
792 this->multiphysics->get_previous_solutions(PhysicsID::CLS));
793 }
794
795 typename DoFHandler<dim>::active_cell_iterator void_fraction_cell(
796 &(*(this->triangulation)),
797 cell->level(),
798 cell->index(),
799 &(*this->particle_projector.dof_handler));
800
801 scratch_data.reinit_void_fraction(
802 void_fraction_cell,
803 *this->particle_projector.void_fraction_locally_relevant,
804 *this->particle_projector.previous_void_fraction);
805
806 scratch_data.calculate_physical_properties();
807
808 if (this->simulation_parameters.multiphysics.CLS)
809 {
810 scratch_data.template reinit_particle_fluid_interactions<PropertiesIndex>(
811 cell,
812 void_fraction_cell,
813 *phase_cell,
814 this->evaluation_point,
815 (*this->previous_solutions)[0],
816 *this->particle_projector.void_fraction_locally_relevant,
818 cfd_dem_simulation_parameters.cfd_dem.drag_coupling,
819 this->multiphysics->get_filtered_solution(PhysicsID::CLS));
820 }
821 else
822 {
823 scratch_data.template reinit_particle_fluid_interactions<PropertiesIndex>(
824 cell,
825 void_fraction_cell,
826 this->evaluation_point,
827 (*this->previous_solutions)[0],
828 *this->particle_projector.void_fraction_locally_relevant,
830 cfd_dem_simulation_parameters.cfd_dem.drag_coupling);
831 }
832 for (auto &pf_assembler : particle_fluid_assemblers)
833 {
834 pf_assembler->calculate_particle_fluid_interactions(scratch_data);
835 }
836
837 if (this->cfd_dem_simulation_parameters.cfd_dem.project_particle_forces)
838 {
839 typename DoFHandler<dim>::active_cell_iterator particle_drag_cell(
840 &(*(this->triangulation)),
841 cell->level(),
842 cell->index(),
843 &(*this->particle_projector.fluid_drag_on_particles.dof_handler));
844
845 typename DoFHandler<dim>::active_cell_iterator
846 particle_two_way_coupling_force_cell(
847 &(*(this->triangulation)),
848 cell->level(),
849 cell->index(),
850 &(*this->particle_projector.fluid_force_on_particles_two_way_coupling
851 .dof_handler));
852
853 typename DoFHandler<dim>::active_cell_iterator particle_velocity_cell(
854 &(*(this->triangulation)),
855 cell->level(),
856 cell->index(),
857 &(*this->particle_projector.particle_velocity.dof_handler));
858
859 typename DoFHandler<dim>::active_cell_iterator
860 particle_momentum_transfer_coefficient_cell(
861 &(*(this->triangulation)),
862 cell->level(),
863 cell->index(),
864 &(*this->particle_projector.momentum_transfer_coefficient
865 .dof_handler));
866
868 particle_drag_cell,
869 particle_two_way_coupling_force_cell,
870 particle_velocity_cell,
871 particle_momentum_transfer_coefficient_cell,
872 particle_projector.fluid_drag_on_particles.particle_field_solution,
873 particle_projector.fluid_force_on_particles_two_way_coupling
874 .particle_field_solution,
875 particle_projector.particle_velocity.particle_field_solution,
876 particle_projector.momentum_transfer_coefficient
877 .particle_field_solution,
878 cfd_dem_simulation_parameters.cfd_dem.drag_coupling);
879 }
880
881 copy_data.reset();
882
883 for (auto &assembler : this->assemblers)
884 {
885 assembler->assemble_rhs(scratch_data, copy_data);
886 }
887
888 cell->get_dof_indices(copy_data.local_dof_indices);
889}
890
891template <int dim, typename PropertiesIndex>
892void
895{
896 if (!copy_data.cell_is_local)
897 return;
898
899 const AffineConstraints<double> &constraints_used = this->zero_constraints;
900 constraints_used.distribute_local_to_global(copy_data.local_rhs,
901 copy_data.local_dof_indices,
902 this->system_rhs);
903}
904
905template <int dim, typename PropertiesIndex>
906std::vector<OutputStruct<dim, GlobalVectorType>>
908{
909 std::vector<OutputStruct<dim, GlobalVectorType>> solution_output_structs;
910 solution_output_structs.emplace_back(
912 *this->particle_projector.dof_handler,
913 *this->particle_projector.void_fraction_locally_relevant,
914 std::vector<std::string>{"void_fraction"},
915 std::vector<DataComponentInterpretation::DataComponentInterpretation>{
916 DataComponentInterpretation::component_is_scalar});
917
918 if (this->cfd_dem_simulation_parameters.void_fraction->output_qcm)
919 {
920 // Output the cell indices if the QCM quadrature filters are
921 // written
922 Vector<float> cell_index(this->triangulation->n_active_cells());
923
924 for (const auto &cell : this->dof_handler->active_cell_iterators())
925 if (cell->is_locally_owned())
926 cell_index(cell->active_cell_index()) =
927 cell->global_active_cell_index();
928 solution_output_structs.emplace_back(
929 std::in_place_type<OutputStructCellVector>, cell_index, "cell_index");
930 }
931
932 if (this->cfd_dem_simulation_parameters.void_fraction
933 ->project_particle_velocity)
934 {
935 std::vector<std::string> names(dim, "particle_velocity");
936 std::vector<DataComponentInterpretation::DataComponentInterpretation>
937 data_interpretation(
938 dim, DataComponentInterpretation::component_is_part_of_vector);
939
940#ifndef LETHE_USE_LDV
941 // Since the particle velocity field is now only a deal.II distributed
942 // vector, we create a temporary GlobalVectorType (a Trilinos vector) and
943 // copy the content into it.
944 GlobalVectorType particle_velocity;
945 particle_velocity.reinit(
946 particle_projector.particle_velocity.locally_owned_dofs,
947 particle_projector.particle_velocity.locally_relevant_dofs,
948 this->mpi_communicator);
949
950 GlobalVectorType particle_velocity_locally_owned;
951 particle_velocity.reinit(
952 particle_projector.particle_velocity.locally_owned_dofs,
953 this->mpi_communicator);
954
956 particle_velocity_locally_owned,
957 particle_projector.particle_velocity.particle_field_solution);
958
959 particle_velocity = particle_velocity_locally_owned;
960
961 solution_output_structs.emplace_back(
963 *particle_projector.particle_velocity.dof_handler,
964 particle_velocity,
965 names,
966 data_interpretation);
967
968 if (this->cfd_dem_simulation_parameters.cfd_dem.project_particle_forces)
969 {
970 GlobalVectorType fluid_drag_on_particles;
971 fluid_drag_on_particles.reinit(
972 particle_projector.particle_velocity.locally_owned_dofs,
973 particle_projector.particle_velocity.locally_relevant_dofs,
974 this->mpi_communicator);
975
976 GlobalVectorType fluid_drag_on_particles_locally_owned;
977 fluid_drag_on_particles.reinit(
978 particle_projector.particle_velocity.locally_owned_dofs,
979 this->mpi_communicator);
980
982 fluid_drag_on_particles_locally_owned,
983 particle_projector.fluid_drag_on_particles.particle_field_solution);
984
985 fluid_drag_on_particles = fluid_drag_on_particles_locally_owned;
986 solution_output_structs.emplace_back(
988 *this->particle_projector.fluid_drag_on_particles.dof_handler,
989 fluid_drag_on_particles,
990 std::vector<std::string>(dim, "Particle_drag"),
991 std::vector<
992 DataComponentInterpretation::DataComponentInterpretation>(
993 dim, DataComponentInterpretation::component_is_part_of_vector));
994
995 GlobalVectorType fluid_force_on_particles_two_way_coupling;
996 fluid_force_on_particles_two_way_coupling.reinit(
997 particle_projector.particle_velocity.locally_owned_dofs,
998 particle_projector.particle_velocity.locally_relevant_dofs,
999 this->mpi_communicator);
1000
1002 fluid_force_on_particles_two_way_coupling_locally_owned;
1003 fluid_force_on_particles_two_way_coupling.reinit(
1004 particle_projector.particle_velocity.locally_owned_dofs,
1005 this->mpi_communicator);
1006
1008 fluid_force_on_particles_two_way_coupling_locally_owned,
1009 particle_projector.fluid_force_on_particles_two_way_coupling
1010 .particle_field_solution);
1011
1012 fluid_force_on_particles_two_way_coupling =
1013 fluid_force_on_particles_two_way_coupling_locally_owned;
1014
1015 solution_output_structs.emplace_back(
1017 *this->particle_projector.fluid_force_on_particles_two_way_coupling
1018 .dof_handler,
1019 fluid_force_on_particles_two_way_coupling,
1020 std::vector<std::string>(dim, "Particle_two_way_coupling_force"),
1021 std::vector<
1022 DataComponentInterpretation::DataComponentInterpretation>(
1023 dim, DataComponentInterpretation::component_is_part_of_vector));
1024 }
1025#else
1026 solution_output_structs.emplace_back(
1028 *particle_projector.particle_velocity.dof_handler,
1029 particle_projector.particle_velocity.particle_field_solution,
1030 names,
1031 data_interpretation);
1032
1033 solution_output_structs.emplace_back(
1035 *this->particle_projector.fluid_drag_on_particles.dof_handler,
1036 this->particle_projector.fluid_drag_on_particles
1037 .particle_field_solution,
1038 std::vector<std::string>(dim, "Particle_drag"),
1039 std::vector<DataComponentInterpretation::DataComponentInterpretation>(
1040 dim, DataComponentInterpretation::component_is_part_of_vector));
1041
1042 solution_output_structs.emplace_back(
1044 *this->particle_projector.fluid_force_on_particles_two_way_coupling
1045 .dof_handler,
1046 this->particle_projector.fluid_force_on_particles_two_way_coupling
1047 .particle_field_solution,
1048 std::vector<std::string>(dim, "Particle_two_way_coupling_force"),
1049 std::vector<DataComponentInterpretation::DataComponentInterpretation>(
1050 dim, DataComponentInterpretation::component_is_part_of_vector));
1051#endif
1052 }
1053
1054
1055 return solution_output_structs;
1056}
1057
1058template <int dim, typename PropertiesIndex>
1059void
1061{
1062 QGauss<dim> quadrature_formula(this->number_quadrature_points);
1063
1064 FEValues<dim> fe_values(*this->mapping,
1065 *this->fe,
1066 quadrature_formula,
1067 update_values | update_quadrature_points |
1068 update_JxW_values | update_gradients |
1069 update_hessians);
1070
1071 FEValues<dim> fe_values_void_fraction(*this->mapping,
1072 *this->particle_projector.fe,
1073 quadrature_formula,
1074 update_values |
1075 update_quadrature_points |
1076 update_JxW_values | update_gradients);
1077
1078 const FEValuesExtractors::Vector velocities(0);
1079
1080 const unsigned int n_q_points = quadrature_formula.size();
1081
1082 std::vector<double> present_void_fraction_values(n_q_points);
1083 std::vector<Tensor<1, dim>> present_void_fraction_gradients(n_q_points);
1084 // Values at previous time step for transient schemes for void
1085 // fraction
1086 std::vector<double> p1_void_fraction_values(n_q_points);
1087 std::vector<double> p2_void_fraction_values(n_q_points);
1088 std::vector<double> p3_void_fraction_values(n_q_points);
1089
1090 std::vector<Tensor<1, dim>> present_velocity_values(n_q_points);
1091 std::vector<Tensor<2, dim>> present_velocity_gradients(n_q_points);
1092
1093 // Values of the force function, the last component of which is the external
1094 // mass source
1095 std::vector<Vector<double>> rhs_force(n_q_points, Vector<double>(dim + 1));
1096
1097 double continuity = 0;
1098 double max_local_continuity = 0;
1099 double local_mass_source = 0;
1100
1101 std::vector<double> time_steps_vector =
1102 this->simulation_control->get_time_steps_vector();
1103
1104 const auto scheme = this->simulation_control->get_assembly_method();
1105 const Vector<double> &bdf_coefs =
1106 this->simulation_control->get_bdf_coefficients();
1107
1108 for (const auto &cell : this->dof_handler->active_cell_iterators())
1109 {
1110 if (cell->is_locally_owned())
1111 {
1112 typename DoFHandler<dim>::active_cell_iterator void_fraction_cell(
1113 &(*this->triangulation),
1114 cell->level(),
1115 cell->index(),
1116 &(*this->particle_projector.dof_handler));
1117 fe_values_void_fraction.reinit(void_fraction_cell);
1118
1119 // Gather void fraction (values, gradient)
1120 fe_values_void_fraction.get_function_values(
1121 *this->particle_projector.void_fraction_locally_relevant,
1122 present_void_fraction_values);
1123 fe_values_void_fraction.get_function_gradients(
1124 *this->particle_projector.void_fraction_locally_relevant,
1125 present_void_fraction_gradients);
1126
1127 fe_values.reinit(cell);
1128
1129 // Gather velocity (values and gradient)
1130 auto &evaluation_point = this->evaluation_point;
1131 fe_values[velocities].get_function_values(evaluation_point,
1132 present_velocity_values);
1133 fe_values[velocities].get_function_gradients(
1134 evaluation_point, present_velocity_gradients);
1135
1136 // Gather the external mass source at the quadrature point location
1137 std::vector<Point<dim>> quadrature_points =
1138 fe_values.get_quadrature_points();
1139
1140 this->forcing_function->vector_value_list(quadrature_points,
1141 rhs_force);
1142
1143 // Gather the previous time steps depending on the number of
1144 // stages of the time integration scheme for the void fraction
1145
1146 if (scheme !=
1148 {
1149 fe_values_void_fraction.get_function_values(
1150 this->particle_projector.previous_void_fraction->at(0),
1151 p1_void_fraction_values);
1152
1153 if (scheme ==
1155 fe_values_void_fraction.get_function_values(
1156 this->particle_projector.previous_void_fraction->at(1),
1157 p2_void_fraction_values);
1158
1159 if (scheme ==
1161 fe_values_void_fraction.get_function_values(
1162 this->particle_projector.previous_void_fraction->at(2),
1163 p3_void_fraction_values);
1164 }
1165
1166 local_mass_source = 0;
1167
1168 for (unsigned int q = 0; q < n_q_points; ++q)
1169 {
1170 // Calculate external mass source
1171 const unsigned int component_mass =
1172 this->fe->system_to_component_index(dim).first;
1173 double external_mass_source = rhs_force[q](component_mass);
1174
1175 // Calculate the divergence of the velocity
1176 const double present_velocity_divergence =
1177 trace(present_velocity_gradients[q]);
1178
1179 // Evaluation of global mass conservation
1180 local_mass_source =
1181 (present_velocity_values[q] *
1182 present_void_fraction_gradients[q] +
1183 present_void_fraction_values[q] * present_velocity_divergence -
1184 external_mass_source) *
1185 fe_values_void_fraction.JxW(q);
1186
1187 if (scheme ==
1190 steady_bdf)
1191 local_mass_source +=
1192 (bdf_coefs[0] * present_void_fraction_values[q] +
1193 bdf_coefs[1] * p1_void_fraction_values[q]) *
1194 fe_values_void_fraction.JxW(q);
1195
1196 if (scheme ==
1198 local_mass_source +=
1199 (bdf_coefs[0] * present_void_fraction_values[q] +
1200 bdf_coefs[1] * p1_void_fraction_values[q] +
1201 bdf_coefs[2] * p2_void_fraction_values[q]) *
1202 fe_values_void_fraction.JxW(q);
1203
1204 if (scheme ==
1206 local_mass_source +=
1207 (bdf_coefs[0] * present_void_fraction_values[q] +
1208 bdf_coefs[1] * p1_void_fraction_values[q] +
1209 bdf_coefs[2] * p2_void_fraction_values[q] +
1210 bdf_coefs[3] * p3_void_fraction_values[q]) *
1211 fe_values_void_fraction.JxW(q);
1212
1213 continuity += local_mass_source;
1214 }
1215
1216 max_local_continuity =
1217 std::max(max_local_continuity, abs(local_mass_source));
1218 }
1219 }
1220
1221 continuity = Utilities::MPI::sum(continuity, this->mpi_communicator);
1222 max_local_continuity =
1223 Utilities::MPI::max(max_local_continuity, this->mpi_communicator);
1224
1225 this->pcout << "Global continuity equation error: " << continuity << " s^-1"
1226 << std::endl;
1227 this->pcout << "Max local continuity error: " << max_local_continuity
1228 << " s^-1" << std::endl;
1229}
1230
1231template <int dim, typename PropertiesIndex>
1232void
1234{
1236 *this->triangulation,
1237 this->cfd_dem_simulation_parameters.cfd_parameters.mesh,
1238 this->cfd_dem_simulation_parameters.cfd_parameters.manifolds_parameters,
1239 this->cfd_dem_simulation_parameters.cfd_parameters.restart_parameters
1240 .restart ||
1241 this->cfd_dem_simulation_parameters.void_fraction->read_dem,
1242 this->cfd_dem_simulation_parameters.cfd_parameters.boundary_conditions
1243 .periodic_boundaries);
1244
1245 if (this->cfd_dem_simulation_parameters.void_fraction->read_dem == true &&
1246 this->cfd_dem_simulation_parameters.cfd_parameters.restart_parameters
1247 .restart == false)
1248 read_dem();
1249
1250 this->setup_dofs();
1251
1253 this->cfd_dem_simulation_parameters.cfd_parameters.initial_condition->type,
1254 this->cfd_dem_simulation_parameters.cfd_parameters.restart_parameters
1255 .restart);
1256
1257 // Only needed if other physics apart from fluid dynamics are enabled.
1258 if (this->multiphysics->get_active_physics().size() > 1)
1260
1261 particle_handler.exchange_ghost_particles(true);
1262
1263 while (this->simulation_control->integrate())
1264 {
1265 this->simulation_control->print_progression(this->pcout);
1266
1267 // We allow the physics to update their boundary conditions
1268 // according to their own parameters
1270 this->multiphysics->update_boundary_conditions();
1271
1272 this->dynamic_flow_control();
1273
1274 if (this->simulation_control->is_at_start())
1275 {
1277 particle_projector.initialize_void_fraction(
1278 this->simulation_control->get_current_time());
1279 this->iterate();
1280 }
1281 else
1282 {
1285 calculate_void_fraction(this->simulation_control->get_current_time());
1286 this->iterate();
1287 }
1288
1289 this->postprocess(false);
1292 }
1293
1294 this->finish_simulation();
1295}
1296
1297// Pre-compile the 2D and 3D solver to ensure that the
1298// library is valid before we actually compile the solver
SimulationParameters< dim > cfd_parameters
TrilinosWrappers::SparseMatrix system_matrix
virtual void update_multiphysics_time_average_solution() override
Updates the average velocity field solution in the multiphyscics interface.
FluidDynamicsMatrixBased(SimulationParameters< dim > &nsparam, const FluidDynamicsFormulation fluid_dynamics_formulation=FluidDynamicsFormulation::standard)
Construct the matrix-based Navier-Stokes solver.
Solver class for Volume-Averaged Navier-Stokes (VANS) equations with GLS stabilization.
CFDDEMSimulationParameters< dim > cfd_dem_simulation_parameters
Member Variables.
void vertices_cell_mapping()
Create mapping between vertices and cells.
ParticleProjector< dim, PropertiesIndex > particle_projector
Particle projector for calculating void fraction and particle effects.
virtual void finish_time_step_fd()
Complete operations at the end of a time step.
std::vector< std::shared_ptr< ParticleFluidAssemblerBase< dim, PropertiesIndex > > > particle_fluid_assemblers
Vector of assembler objects for particle-fluid interaction terms.
std::map< unsigned int, std::set< typename DoFHandler< dim >::active_cell_iterator > > vertices_to_periodic_cell
virtual void iterate() override
Execute a single VANS iteration.
void assemble_local_system_rhs(const typename DoFHandler< dim >::active_cell_iterator &cell, NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
Assemble the local right-hand side vector for a given cell.
virtual void read_dem()
Read DEM data for particle-fluid coupling.
void assemble_system_matrix() override
Assemble the global system matrix for the VANS equations.
std::map< unsigned int, std::set< typename DoFHandler< dim >::active_cell_iterator > > vertices_to_cell
Mapping from vertex indices to sets of cells containing each vertex.
void assemble_local_system_matrix(const typename DoFHandler< dim >::active_cell_iterator &cell, NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
Assemble the local system matrix for a given cell.
FluidDynamicsVANS(CFDDEMSimulationParameters< dim > &nsparam)
Constructor for the VANS solver.
virtual void setup_dofs() override
Set up degrees of freedom and initialize void fraction field.
virtual std::vector< OutputStruct< dim, GlobalVectorType > > gather_output_hook() override
Gather additional output fields for visualization.
void copy_local_rhs_to_global_rhs(const StabilizedMethodsTensorCopyData< dim > &copy_data) override
Copy local right-hand side contributions to the global vector.
MappingQGeneric< dim > particle_mapping
Mapping object for particle position calculations and projections.
Particles::ParticleHandler< dim, dim > particle_handler
Particle handler for managing particle data and operations.
~FluidDynamicsVANS()
Destructor for the VANS solver.
virtual void monitor_mass_conservation()
Monitor mass conservation in the VANS system.
void copy_local_matrix_to_global_matrix(const StabilizedMethodsTensorCopyData< dim > &copy_data) override
Copy local matrix contributions to the global system matrix.
void setup_assemblers() override
Set up the vector of assembler functions for VANS equations.
bool has_periodic_boundaries
Flag indicating whether the domain has periodic boundary conditions.
void assemble_system_rhs() override
Assemble the global right-hand side vector for the VANS equations.
void calculate_void_fraction(const double time)
Calculate void fraction field based on particle positions.
virtual void solve() override
Main solver loop for the VANS equations.
std::shared_ptr< Quadrature< dim > > cell_quadrature
virtual void set_initial_condition(const Parameters::FluidDynamicsInitialConditionType initial_condition_type, const bool restart=false)
virtual void refine_mesh()
Allow the refinement of the mesh according to one of the 2 methods proposed.
bool check_existance_of_bc(BoundaryConditions::FluidDynamicsBoundaryType bc)
std::shared_ptr< std::vector< GlobalVectorType > > previous_solutions
std::shared_ptr< Function< dim > > forcing_function
std::shared_ptr< SimulationControl > simulation_control
std::vector< std::shared_ptr< NavierStokesAssemblerBase< dim > > > assemblers
std::shared_ptr< MultiphysicsInterface< dim > > multiphysics
std::shared_ptr< DoFHandler< dim > > dof_handler
std::shared_ptr< parallel::DistributedTriangulationBase< dim > > triangulation
Class that stores the information required by the assembly procedure for a Navier-Stokes equation....
void calculate_physical_properties()
Calculates the physical properties. This function calculates the physical properties that may be requ...
void reinit(const typename DoFHandler< dim >::active_cell_iterator &cell, const VectorType &current_solution, const std::vector< VectorType > &previous_solutions, const VectorType &sum_over_previous_stages, const std::shared_ptr< Function< dim > > &forcing_function, const Tensor< 1, dim > &beta_force, const double pressure_scaling_factor)
Reinitializes the content of the scratch.
void reinit_void_fraction(const typename DoFHandler< dim >::active_cell_iterator &cell, const VectorType &current_solution, const std::vector< VectorType > &previous_solutions)
Reinitialize the content of the scratch for the void fraction.
void reinit_cls(const typename DoFHandler< dim >::active_cell_iterator &cell, const VectorType &current_solution, const VectorType &current_filtered_solution, const std::vector< VectorType > &previous_solutions)
Reinitialize the content of the scratch for the cls.
void calculate_particle_fields_values(const typename DoFHandler< dim >::active_cell_iterator &particle_drag_cell, const typename DoFHandler< dim >::active_cell_iterator &particle_two_way_coupling_force_cell, const typename DoFHandler< dim >::active_cell_iterator &particle_velocity_cell, const typename DoFHandler< dim >::active_cell_iterator &particle_momentum_transfer_coefficient_cell, const VectorType &particle_fluid_drag, const VectorType &particle_fluid_force_two_way_coupling, const VectorType &particle_velocity, const VectorType &particle_momentum_transfer_coefficient, const Parameters::DragCoupling &drag_coupling)
Calculates the particle forces and velocities that were projected on the fluid dofs at the quadrature...
Class that assembles the weak formulation of an outlet boundary condition according to the following ...
Class that assembles the special case of partial slip condition using the weak formulation of a Diric...
void solve_governing_system()
Solve the global system of equations according to a given strategy, either linear or not.
Class that assembles a Neumann boundary condition. According to the following weak form: (p-mu*grad_u...
Class responsible for storing the information calculated using the assembly of stabilized Tensor<1,...
Definition copy_data.h:166
FullMatrix< double > local_matrix
Definition copy_data.h:204
void reset()
Resets the cell_matrix, cell_rhs, strong_residual and strong_jacobian to zero.
Definition copy_data.h:190
std::vector< types::global_dof_index > local_dof_indices
Definition copy_data.h:206
Assembler for the transient term arising from BDF time integration for the VANS equations.
Assembler for the drag force using the Beetstra model.
Assembler for the buoyancy force on particles in the VANS equations.
Assembler for the core of Model A of the Volume-Averaged Navier-Stokes (VANS) equations.
Assembler for the core of Model B of the Volume-Averaged Navier-Stokes (VANS) equations.
Assembler for the drag force using the Dallavalle model.
Assembler for the drag force using the Di Felice model.
Assembler for the fluid-particle interactions (FPI) in the VANS equations when the forces are project...
Assembler for the fluid-particle interactions (FPI) in the VANS equations, such as the drag force.
Assembler for the drag force using the Gidaspow model.
Assembler for the drag force using the Koch and Hill drag model.
Assembler for the lift force using the Magnus model.
Assembler for the pressure force on particles.
Assembler for the drag force using the Rong model.
Assembler for the lift force using the Saffman-Mei model.
Assembler for the shear force on particles.
Assembler for the viscous dissipative torque due to particle rotation as defined by Derksen (2004).
Assembler for the viscous dissipative torque due to fluid vorticity as defined by Derksen (2004).
Class that assembles the weak formulation of a Dirichlet boundary condition using the Nitsche method....
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
void announce_string(const ConditionalOStream &pcout, const std::string &expression, const char delimiter='-')
Prints a string and then adds a line above and below made with dashes containing as many dashes as th...
Definition utilities.h:500
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.
@ CLS
@ particle_temperature
@ void_fraction
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.
void vertices_cell_mapping(const DoFHandler< dim > &dof_handler, std::map< unsigned int, std::set< typename DoFHandler< dim >::active_cell_iterator > > &vertices_cell_map)
Map the vertex index to the cells that includes that vertex.
void vertices_cell_mapping_with_periodic_boundaries(const DoFHandler< dim > &dof_handler, std::map< unsigned int, std::set< typename DoFHandler< dim >::active_cell_iterator > > &vertices_cell_map)
Map the vertex index to the cells on periodic boundaries that includes the periodic coinciding vertex...
@ modelA
Model A: volume-averaged continuity and momentum equations.
@ modelB
Model B: alternative VANS formulation.
@ dallavalle
Dallavalle - Valid only for dilute flows.
@ 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...
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.
dealii::TrilinosWrappers::MPI::Vector GlobalVectorType
Definition vector.h:17
void convert_vector_dealii_to_trilinos(dealii::TrilinosWrappers::MPI::Vector &out, const dealii::LinearAlgebra::distributed::Vector< number > &in)
Helper function that allows to convert deal.II vectors to Trilinos vectors.
Definition vector.h:39