Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
fluid_dynamics_block.cc
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2019-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4#include <core/bdf.h>
5#include <core/grids.h>
6#include <core/manifolds.h>
8#include <core/utilities.h>
9
14
15#include <deal.II/base/work_stream.h>
16
17#include <deal.II/dofs/dof_renumbering.h>
18#include <deal.II/dofs/dof_tools.h>
19
20#include <deal.II/fe/component_mask.h>
21
22#include <deal.II/grid/grid_tools.h>
23
24#include <deal.II/lac/full_matrix.h>
25
26#include <deal.II/numerics/vector_tools.h>
27
28// Constructor for class FluidDynamicsBlock
29template <int dim>
32 : NavierStokesBase<dim, GlobalBlockVectorType, std::vector<IndexSet>>(
33 p_nsparam)
34{}
35
36template <int dim>
41
42template <int dim>
43void
45{
46 // The block solver does not assemble the SDIRK time integration.
47 AssertThrow(
48 !time_stepping_is_sdirk(this->simulation_control->get_assembly_method()),
49 ExcMessage("SDIRK time-stepping methods are not supported by the block "
50 "fluid dynamics solver. Use a BDF method instead."));
51
52 this->assemblers.clear();
53
54 // Thermal buoyancy force
55 if (this->simulation_parameters.multiphysics.thermal_buoyancy_force)
56 {
57 if (this->simulation_parameters.multiphysics.CLS)
58 {
59 // CLS formulation includes density explicitly in the momentum
60 // equation
61 this->assemblers.emplace_back(
62 std::make_shared<ThermalBuoyancyAssemblyCLS<dim>>(
64 this->simulation_parameters.physical_properties_manager
65 .get_reference_temperature()));
66 }
67 else
68 {
69 this->assemblers.emplace_back(
70 std::make_shared<ThermalBuoyancyAssembly<dim>>(
72 this->simulation_parameters.physical_properties_manager
73 .get_reference_temperature()));
74 }
75 }
76
77 if (this->simulation_parameters.multiphysics.CLS)
78 {
79 // Time-stepping schemes
81 this->simulation_control->get_assembly_method()) &&
82 this->simulation_parameters.physical_properties_manager
83 .density_is_constant())
84 {
85 this->assemblers.emplace_back(
87 this->simulation_control));
88 }
89 else if (time_stepping_is_bdf(
90 this->simulation_control->get_assembly_method()))
91 {
92 this->assemblers.emplace_back(
93 std::make_shared<
95 this->simulation_control));
96 }
97
98 // Darcy force for phase change simulations
99 if (this->simulation_parameters.velocity_sources.permeability_model ==
101 {
102 AssertThrow(this->simulation_parameters.multiphysics.heat_transfer,
103 PhaseChangePermeabilityModelRequiresTemperature());
104 this->assemblers.emplace_back(
105 std::make_shared<PhaseChangeDarcyCLSAssembler<dim>>(
106 this->simulation_parameters.physical_properties_manager
107 .get_phase_change_parameters_vector(),
108 this->simulation_parameters.velocity_sources
109 .enable_darcy_multiply_by_density));
110 }
111 // Carman-Kozeny force for phase change simulations
112 else if (this->simulation_parameters.velocity_sources
113 .permeability_model ==
115 carman_kozeny_phase_change)
116 {
117 AssertThrow(this->simulation_parameters.multiphysics.heat_transfer,
118 PhaseChangePermeabilityModelRequiresTemperature());
119 this->assemblers.emplace_back(
121 this->simulation_parameters.velocity_sources
122 .fluid_with_phase_change,
123 this->simulation_parameters.velocity_sources
124 .carman_kozeny_permeability_area,
125 this->simulation_parameters.velocity_sources
126 .carman_kozeny_tolerance,
127 this->simulation_parameters.physical_properties_manager
128 .get_phase_change_parameters_vector()));
129 }
130
131 if (!this->simulation_parameters.physical_properties_manager
132 .density_is_constant())
133 {
134 this->assemblers.emplace_back(
135 std::make_shared<
138 }
139 else
140 {
141 // Core assembler
142 this->assemblers.emplace_back(
143 std::make_shared<GLSNavierStokesCLSAssemblerCore<dim>>(
145 }
146 }
147 else
148 {
149 // Time-stepping schemes
150 if (time_stepping_is_bdf(this->simulation_control->get_assembly_method()))
151 {
152 this->assemblers.emplace_back(
153 std::make_shared<GLSNavierStokesAssemblerBDF<dim>>(
154 this->simulation_control));
155 }
156
157 // Velocity sources term
158 if (this->simulation_parameters.velocity_sources.rotating_frame_type ==
160 {
161 this->assemblers.emplace_back(
162 std::make_shared<GLSNavierStokesAssemblerSRF<dim>>(
163 this->simulation_parameters.velocity_sources));
164 }
165
166 // Darcy force for phase change simulations in single phase
167 if (this->simulation_parameters.velocity_sources.permeability_model ==
169 {
170 AssertThrow(this->simulation_parameters.multiphysics.heat_transfer,
171 PhaseChangePermeabilityModelRequiresTemperature());
172 this->assemblers.emplace_back(
173 std::make_shared<PhaseChangeDarcyAssembly<dim>>(
174 this->simulation_parameters.physical_properties_manager
175 .get_physical_properties_parameters()
176 .fluids[0]
177 .phase_change_parameters));
178 }
179 // Carman-Kozeny force for phase change simulations in single phase
180 else if (this->simulation_parameters.velocity_sources
181 .permeability_model ==
183 carman_kozeny_phase_change)
184 {
185 AssertThrow(this->simulation_parameters.multiphysics.heat_transfer,
186 PhaseChangePermeabilityModelRequiresTemperature());
187 this->assemblers.emplace_back(
189 this->simulation_parameters.velocity_sources
190 .carman_kozeny_permeability_area[0],
191 this->simulation_parameters.velocity_sources
192 .carman_kozeny_tolerance[0],
193 this->simulation_parameters.physical_properties_manager
194 .get_physical_properties_parameters()
195 .fluids[0]
196 .phase_change_parameters.T_liquidus,
197
198 this->simulation_parameters.physical_properties_manager
199 .get_physical_properties_parameters()
200 .fluids[0]
201 .phase_change_parameters.T_solidus));
202 }
203
204 if (this->simulation_parameters.physical_properties_manager
205 .is_non_newtonian())
206 {
207 // Core assembler with non-Newtonian viscosity
208 this->assemblers.emplace_back(
210 this->simulation_control, gamma));
211 }
212 else
213 {
214 // Core default assembler
215 if ((this->simulation_parameters.stabilization
216 .use_default_stabilization == true) ||
217 this->simulation_parameters.stabilization.stabilization ==
219 this->assemblers.emplace_back(
220 std::make_shared<BlockNavierStokesAssemblerCore<dim>>(
221 this->simulation_control, gamma));
222
223 else
224 throw std::runtime_error(
225 "Using the GD solver with a stabilization other than the grad_div "
226 "stabilization will lead to an unstable block solver that is unable to converge");
227 }
228 }
229}
230
231template <int dim>
232void
234{
235 if (this->simulation_parameters.post_processing.calculate_average_velocities)
236 {
237 this->multiphysics->set_block_time_average_solution(
239 this->average_velocities->get_average_velocities());
240 }
241}
242
243template <int dim>
244void
246{
247 TimerOutput::Scope t(this->computing_timer, "Assemble matrix");
248 // this->simulation_control->set_assembly_method(this->time_stepping_method);
249
250 this->system_matrix = 0;
252
253 auto scratch_data = NavierStokesScratchData<dim>(
254 this->simulation_control,
255 this->simulation_parameters.physical_properties_manager,
256 *this->fe,
257 *this->cell_quadrature,
258 *this->mapping,
259 *this->face_quadrature);
260
261 if (this->simulation_parameters.multiphysics.CLS)
262 {
263 const DoFHandler<dim> &dof_handler_cls =
264 this->multiphysics->get_dof_handler(PhysicsID::CLS);
265 scratch_data.enable_cls(
266 dof_handler_cls.get_fe(),
267 *this->cell_quadrature,
268 *this->mapping,
269 this->simulation_parameters.multiphysics.cls_parameters.phase_filter);
270 }
271
272
273 WorkStream::run(
274 this->dof_handler->begin_active(),
275 this->dof_handler->end(),
276 *this,
279 scratch_data,
280 StabilizedMethodsTensorCopyData<dim>(this->fe->n_dofs_per_cell(),
281 this->cell_quadrature->size()));
282
283
284 system_matrix.compress(VectorOperation::add);
285
286 // Finally we move pressure mass matrix into a separate matrix:
287 pressure_mass_matrix.reinit(sparsity_pattern.block(1, 1));
288 pressure_mass_matrix.copy_from(system_matrix.block(1, 1));
289
290 // Note that settings this pressure block to zero is not identical to
291 // not assembling anything in this block, because this operation here
292 // will (incorrectly) delete diagonal entries that come in from
293 // hanging node constraints for pressure DoFs. This means that our
294 // whole system matrix will have rows that are completely
295 // zero. Luckily, FGMRES handles these rows without any problem.
296 system_matrix.block(1, 1) = 0;
297}
298
299
300
301template <int dim>
302void
304 const typename DoFHandler<dim>::active_cell_iterator &cell,
305 NavierStokesScratchData<dim> &scratch_data,
307{
308 copy_data.cell_is_local = cell->is_locally_owned();
309 if (!cell->is_locally_owned())
310 return;
311
312 scratch_data.reinit(
313 cell,
314 this->evaluation_point,
315 *this->previous_solutions,
316 this->sdirk_vectors.sum_over_previous_stages,
317 this->forcing_function,
318 this->flow_control.get_beta(),
319 this->simulation_parameters.stabilization.pressure_scaling_factor);
320 if (this->simulation_parameters.multiphysics.CLS)
321 {
322 const DoFHandler<dim> &dof_handler_cls =
323 this->multiphysics->get_dof_handler(PhysicsID::CLS);
324 typename DoFHandler<dim>::active_cell_iterator phase_cell(
325 &(*(this->triangulation)),
326 cell->level(),
327 cell->index(),
328 &dof_handler_cls);
329
330 scratch_data.reinit_cls(
331 phase_cell,
332 this->multiphysics->get_solution(PhysicsID::CLS),
333 this->multiphysics->get_filtered_solution(PhysicsID::CLS),
334 this->multiphysics->get_previous_solutions(PhysicsID::CLS));
335 }
336
337 if (this->simulation_parameters.multiphysics.heat_transfer)
338 {
339 const DoFHandler<dim> &dof_handler_ht =
340 this->multiphysics->get_dof_handler(PhysicsID::heat_transfer);
341 scratch_data.enable_heat_transfer(dof_handler_ht.get_fe(),
342 *this->cell_quadrature,
343 *this->mapping);
344 }
345
346 scratch_data.calculate_physical_properties();
347 copy_data.reset();
348
349
350 for (auto &assembler : this->assemblers)
351 {
352 assembler->assemble_matrix(scratch_data, copy_data);
353 }
354
355
356 cell->get_dof_indices(copy_data.local_dof_indices);
357}
358
359template <int dim>
360void
363{
364 if (!copy_data.cell_is_local)
365 return;
366
367 const AffineConstraints<double> &constraints_used = this->zero_constraints;
368 constraints_used.distribute_local_to_global(copy_data.local_matrix,
369 copy_data.local_dof_indices,
371}
372
373
374template <int dim>
375void
377{
378 TimerOutput::Scope t(this->computing_timer, "Assemble RHS");
379 // this->simulation_control->set_assembly_method(this->time_stepping_method);
380
381 this->system_rhs = 0;
383
384 auto scratch_data = NavierStokesScratchData<dim>(
385 this->simulation_control,
386 this->simulation_parameters.physical_properties_manager,
387 *this->fe,
388 *this->cell_quadrature,
389 *this->mapping,
390 *this->face_quadrature);
391
392 if (this->simulation_parameters.multiphysics.CLS)
393 {
394 const DoFHandler<dim> &dof_handler_cls =
395 this->multiphysics->get_dof_handler(PhysicsID::CLS);
396 scratch_data.enable_cls(
397 dof_handler_cls.get_fe(),
398 *this->cell_quadrature,
399 *this->mapping,
400 this->simulation_parameters.multiphysics.cls_parameters.phase_filter);
401 }
402
403 if (this->simulation_parameters.multiphysics.heat_transfer)
404 {
405 const DoFHandler<dim> &dof_handler_ht =
406 this->multiphysics->get_dof_handler(PhysicsID::heat_transfer);
407 scratch_data.enable_heat_transfer(dof_handler_ht.get_fe(),
408 *this->cell_quadrature,
409 *this->mapping);
410 }
411
412
413 WorkStream::run(
414 this->dof_handler->begin_active(),
415 this->dof_handler->end(),
416 *this,
419 scratch_data,
420 StabilizedMethodsTensorCopyData<dim>(this->fe->n_dofs_per_cell(),
421 this->cell_quadrature->size()));
422
423 this->system_rhs.compress(VectorOperation::add);
424
425 if (this->simulation_control->is_first_assembly())
426 this->simulation_control->provide_residual(this->system_rhs.l2_norm());
427}
428
429template <int dim>
430void
432{
433 if (this->simulation_parameters.linear_solver.at(PhysicsID::fluid_dynamics)
435 {
436 setup_ILU();
437 }
438 else if (this->simulation_parameters.linear_solver
440 .preconditioner ==
442 {
443 setup_AMG();
444 }
445 else
446 AssertThrow(
447 false,
448 ExcMessage(
449 "This linear solver does not support this preconditioner. Only <ilu> and <amg> preconditioners are supported."));
450}
451
452template <int dim>
453void
455 const typename DoFHandler<dim>::active_cell_iterator &cell,
456 NavierStokesScratchData<dim> &scratch_data,
458{
459 copy_data.cell_is_local = cell->is_locally_owned();
460 if (!cell->is_locally_owned())
461 return;
462
463 scratch_data.reinit(
464 cell,
465 this->evaluation_point,
466 *this->previous_solutions,
467 this->sdirk_vectors.sum_over_previous_stages,
468 this->forcing_function,
469 this->flow_control.get_beta(),
470 this->simulation_parameters.stabilization.pressure_scaling_factor);
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 typename DoFHandler<dim>::active_cell_iterator phase_cell(
477 &(*(this->triangulation)),
478 cell->level(),
479 cell->index(),
480 &dof_handler_cls);
481
482 scratch_data.reinit_cls(
483 phase_cell,
484 this->multiphysics->get_solution(PhysicsID::CLS),
485 this->multiphysics->get_filtered_solution(PhysicsID::CLS),
486 this->multiphysics->get_previous_solutions(PhysicsID::CLS));
487 }
488
489 if (this->simulation_parameters.multiphysics.heat_transfer)
490 {
491 const DoFHandler<dim> &dof_handler_ht =
492 this->multiphysics->get_dof_handler(PhysicsID::heat_transfer);
493
494 typename DoFHandler<dim>::active_cell_iterator temperature_cell(
495 &(*(this->triangulation)),
496 cell->level(),
497 cell->index(),
498 &dof_handler_ht);
499
500 scratch_data.reinit_heat_transfer(
501 temperature_cell,
502 this->multiphysics->get_solution(PhysicsID::heat_transfer),
503 this->multiphysics->get_previous_solutions(PhysicsID::heat_transfer));
504 }
505
506 scratch_data.calculate_physical_properties();
507 copy_data.reset();
508 for (auto &assembler : this->assemblers)
509 {
510 assembler->assemble_rhs(scratch_data, copy_data);
511 }
512
513
514 cell->get_dof_indices(copy_data.local_dof_indices);
515}
516
517
518
519template <int dim>
520void
523{
524 if (!copy_data.cell_is_local)
525 return;
526
527 const AffineConstraints<double> &constraints_used = this->zero_constraints;
528 constraints_used.distribute_local_to_global(copy_data.local_rhs,
529 copy_data.local_dof_indices,
530 this->system_rhs);
531}
532
533
534
535template <int dim>
536void
538{
539 system_matrix = 0;
540 auto &system_rhs = this->system_rhs;
541 system_rhs = 0;
542 FEValues<dim> fe_values(*this->mapping,
543 *this->fe,
544 *this->cell_quadrature,
545 update_values | update_quadrature_points |
546 update_JxW_values);
547 const unsigned int dofs_per_cell = this->fe->dofs_per_cell;
548 const unsigned int n_q_points = this->cell_quadrature->size();
549 FullMatrix<double> local_matrix(dofs_per_cell, dofs_per_cell);
550 Vector<double> local_rhs(dofs_per_cell);
551 std::vector<Vector<double>> initial_velocity(n_q_points,
552 Vector<double>(dim + 1));
553 std::vector<types::global_dof_index> local_dof_indices(dofs_per_cell);
554 const FEValuesExtractors::Vector velocities(0);
555 const FEValuesExtractors::Scalar pressure(dim);
556
557 Tensor<1, dim> rhs_initial_velocity_pressure;
558 double rhs_initial_pressure;
559
560 std::vector<Tensor<1, dim>> phi_u(dofs_per_cell);
561 std::vector<double> phi_p(dofs_per_cell);
562
563 for (const auto &cell : this->dof_handler->active_cell_iterators())
564 {
565 if (cell->is_locally_owned())
566 {
567 fe_values.reinit(cell);
568 local_matrix = 0;
569 local_rhs = 0;
570 this->simulation_parameters.initial_condition->uvwp.vector_value_list(
571 fe_values.get_quadrature_points(), initial_velocity);
572 for (unsigned int q = 0; q < n_q_points; ++q)
573 {
574 for (unsigned int k = 0; k < dofs_per_cell; ++k)
575 {
576 phi_p[k] = fe_values[pressure].value(k, q);
577 phi_u[k] = fe_values[velocities].value(k, q);
578 }
579
580 // Establish the rhs tensor operator
581 for (int i = 0; i < dim; ++i)
582 {
583 const unsigned int component_i =
584 this->fe->system_to_component_index(i).first;
585 rhs_initial_velocity_pressure[i] =
586 initial_velocity[q](component_i);
587 }
588 rhs_initial_pressure = initial_velocity[q](dim);
589
590 for (unsigned int i = 0; i < dofs_per_cell; ++i)
591 {
592 // Matrix assembly
593 for (unsigned int j = 0; j < dofs_per_cell; ++j)
594 {
595 local_matrix(i, j) +=
596 (phi_u[j] * phi_u[i]) * fe_values.JxW(q);
597 local_matrix(i, j) +=
598 (phi_p[j] * phi_p[i]) * fe_values.JxW(q);
599 }
600 local_rhs(i) += (phi_u[i] * rhs_initial_velocity_pressure +
601 phi_p[i] * rhs_initial_pressure) *
602 fe_values.JxW(q);
603 }
604 }
605
606 cell->get_dof_indices(local_dof_indices);
607 this->nonzero_constraints.distribute_local_to_global(
608 local_matrix,
609 local_rhs,
610 local_dof_indices,
612 system_rhs);
613 }
614 }
615 system_matrix.compress(VectorOperation::add);
616 system_rhs.compress(VectorOperation::add);
617}
618
619
620template <int dim>
621void
623{
624 TimerOutput::Scope t(this->computing_timer, "Setup DOFs");
625
626 system_matrix.clear();
627
628 this->dof_handler->distribute_dofs(*this->fe);
629 // DoFRenumbering::Cuthill_McKee(this->dof_handler);
630
631
632 std::vector<unsigned int> block_component(dim + 1, 0);
633 block_component[dim] = 1;
634 DoFRenumbering::component_wise(*this->dof_handler, block_component);
635
636
637 // To be used to replace the above part once 9.2 release is out and TRAVIS-CI
638 // version is updated
640 DoFTools::count_dofs_per_fe_block(*this->dof_handler, block_component);
641
642 unsigned int dof_u = dofs_per_block[0];
643 unsigned int dof_p = dofs_per_block[1];
644
645 this->locally_owned_dofs.resize(2);
646 this->locally_owned_dofs[0] =
647 this->dof_handler->locally_owned_dofs().get_view(0, dof_u);
648 this->locally_owned_dofs[1] =
649 this->dof_handler->locally_owned_dofs().get_view(dof_u, dof_u + dof_p);
650
651 IndexSet locally_relevant_dofs_acquisition;
652 locally_relevant_dofs_acquisition =
653 DoFTools::extract_locally_relevant_dofs(*this->dof_handler);
654 this->locally_relevant_dofs.resize(2);
655 this->locally_relevant_dofs[0] =
656 locally_relevant_dofs_acquisition.get_view(0, dof_u);
657 this->locally_relevant_dofs[1] =
658 locally_relevant_dofs_acquisition.get_view(dof_u, dof_u + dof_p);
659
660 // Non-zero constraints
662
663 // Check whether the boundary conditions specified in the parameter file are
664 // available for this solver
665 for (auto const &[id, type] :
666 this->simulation_parameters.boundary_conditions.type)
667 {
669 type ==
672 {
673 Assert(
674 false,
675 ExcMessage(
676 "The following boundary conditions are not supported by the lethe-fluid-block application: pressure, function weak, partial slip and outlet."));
677 }
678 }
679
680 // Zero constraints
682
683 // Operations on the following vectors (addition,
684 // multiplication, etc.) can only be done if these are reinitialized WITHOUT
685 // locally_relevant_dofs (i.e. without ghost DoFs). This is why most of them
686 // are reinitialized both with and without locally_relevant_dofs.
687 this->present_solution->reinit(this->locally_owned_dofs,
689 this->mpi_communicator);
691 this->mpi_communicator);
692 this->evaluation_point.reinit(this->locally_owned_dofs,
694 this->mpi_communicator);
695
696 // Initialize vector of previous solutions
697 for (auto &solution : *this->previous_solutions)
698 {
699 solution.reinit(this->locally_owned_dofs,
701 this->mpi_communicator);
702 }
703
704
705 if (this->simulation_control->is_sdirk())
706 {
707 // Reinitialize vectors used for the SDIRK methods
708 this->sdirk_vectors.sum_bi_ki.reinit(this->locally_owned_dofs,
710 this->mpi_communicator);
711 this->sdirk_vectors.local_sum_bi_ki.reinit(this->locally_owned_dofs,
712 this->mpi_communicator);
713 this->sdirk_vectors.sum_over_previous_stages.reinit(
714 this->locally_owned_dofs,
716 this->mpi_communicator);
717 this->sdirk_vectors.local_sum_over_previous_stages.reinit(
719 this->sdirk_vectors.locally_owned_for_calculation.reinit(
721
722 for (auto &solution : this->sdirk_vectors.previous_k_j_solutions)
723 {
724 solution.reinit(this->locally_owned_dofs,
726 this->mpi_communicator);
727 }
728 }
729
730
731 this->newton_update.reinit(this->locally_owned_dofs, this->mpi_communicator);
732 this->system_rhs.reinit(this->locally_owned_dofs, this->mpi_communicator);
733
734
736 this->locally_owned_dofs,
738 MPI_COMM_WORLD);
739
740 Table<2, DoFTools::Coupling> coupling(dim + 1, dim + 1);
741 for (int c = 0; c < dim + 1; ++c)
742 for (int d = 0; d < dim + 1; ++d)
743 if (!((c == dim) && (d == dim)))
744 coupling[c][d] = DoFTools::always;
745 else
746 coupling[c][d] = DoFTools::always;
747
748 DoFTools::make_sparsity_pattern(*this->dof_handler,
749 coupling,
752 true,
753 Utilities::MPI::this_mpi_process(
754 MPI_COMM_WORLD));
755
756 sparsity_pattern.compress();
757
759 pressure_mass_matrix.reinit(sparsity_pattern.block(1, 1));
760
761 if (this->simulation_parameters.post_processing.calculate_average_velocities)
762 {
763 AssertThrow(this->simulation_parameters.mesh_adaptation.type ==
765 ExcMessage(
766 "Time-averaging velocities and calculating reynolds "
767 "stresses are currently unavailable for mesh "
768 "adaptation."));
769
770 this->average_velocities->initialize_vectors(this->locally_owned_dofs,
772 this->mpi_communicator);
773 }
774
775
776 double global_volume =
777 GridTools::volume(*this->triangulation, *this->mapping);
778
779 this->pcout << " Number of active cells: "
780 << this->triangulation->n_global_active_cells() << std::endl
781 << " Number of degrees of freedom: "
782 << this->dof_handler->n_dofs() << std::endl;
783 this->pcout << " Volume of triangulation: " << global_volume
784 << std::endl;
785
786 this->multiphysics->set_dof_handler(PhysicsID::fluid_dynamics,
787 this->dof_handler);
788 this->multiphysics->set_mapping(PhysicsID::fluid_dynamics, this->mapping);
789 this->multiphysics->set_block_solution(PhysicsID::fluid_dynamics,
790 this->present_solution);
791 this->multiphysics->set_block_previous_solutions(PhysicsID::fluid_dynamics,
792 this->previous_solutions);
793}
794
795
796template <int dim>
797void
799{
800 *this->present_solution = value;
801}
802
803
804/**
805 * Set the initial condition using a L2 or a viscous solver
806 **/
807template <int dim>
808void
811 bool restart)
812{
813 if (restart)
814 {
815 this->pcout << "************************" << std::endl;
816 this->pcout << "---> Simulation Restart " << std::endl;
817 this->pcout << "************************" << std::endl;
818 this->read_checkpoint();
819 }
820 else if (initial_condition_type ==
822 {
824 solve_L2_system(1e-15, 1e-15);
825 *this->present_solution = this->newton_update;
826 this->finish_time_step();
827 }
828 else if (initial_condition_type ==
830 {
831 this->set_nodal_values();
832 this->finish_time_step();
833 }
834
835 else if (initial_condition_type ==
837 {
838 this->set_nodal_values();
839 std::shared_ptr<RheologicalModel> original_viscosity_model =
840 this->simulation_parameters.physical_properties_manager.get_rheology();
841
842 // Temporarily set the rheology to be newtonian with predefined viscosity
843 std::shared_ptr<Newtonian> temporary_rheology =
844 std::make_shared<Newtonian>(
845 this->simulation_parameters.initial_condition->kinematic_viscosity);
846
847 this->simulation_parameters.physical_properties_manager.set_rheology(
848 temporary_rheology);
849
850 // Temporarily solve a steady problem. The assembly method is restored
851 // afterwards, otherwise the time-stepping scheme of the simulation would
852 // remain steady for the rest of the simulation.
853 const auto original_assembly_method =
854 this->simulation_control->get_assembly_method();
855
856 this->simulation_control->set_assembly_method(
859 this->finish_time_step();
860
861 // Reset the assembly method to the one of the simulation
862 this->simulation_control->set_assembly_method(original_assembly_method);
863
864 this->simulation_parameters.physical_properties_manager.set_rheology(
865 original_viscosity_model);
866 }
867 else
868 {
869 throw std::runtime_error("GDNS - Initial condition could not be set");
870 }
871}
872
873template <int dim>
874void
876{
877 const double absolute_residual =
879 .minimum_residual;
880 const double relative_residual =
882 .relative_residual;
883
884 if (this->simulation_parameters.linear_solver.at(PhysicsID::fluid_dynamics)
886 solve_system_GMRES(absolute_residual, relative_residual);
887 else
888 AssertThrow(
891 ExcMessage(
892 "This linear solver is not allowed. Only <gmres> linear solver is allowed."));
894}
895
896template <int dim>
897void
899{
900 TimerOutput::Scope t(this->computing_timer, "Setup ILU");
901
902 //**********************************************
903 // Trillinos Wrapper ILU Preconditioner
904 //*********************************************
905 const unsigned int ilu_fill =
907 .ilu_precond_fill;
908 const double ilu_atol =
910 .ilu_precond_atol;
911 const double ilu_rtol =
913 .ilu_precond_rtol;
914
916 std::make_shared<TrilinosWrappers::PreconditionILU>();
918 std::make_shared<TrilinosWrappers::PreconditionILU>();
919
920 TrilinosWrappers::PreconditionILU::AdditionalData preconditionerOptions(
921 ilu_fill, ilu_atol, ilu_rtol, 0);
922 velocity_ilu_preconditioner->initialize(system_matrix.block(0, 0),
923 preconditionerOptions);
924
925 pressure_ilu_preconditioner->initialize(system_matrix.block(1, 1),
926 preconditionerOptions);
927 system_ilu_preconditioner = std::make_shared<
929 gamma,
930 this->simulation_parameters.physical_properties_manager
931 .get_kinematic_viscosity_scale(),
936 this->simulation_parameters.linear_solver.at(PhysicsID::fluid_dynamics));
937}
938
939template <int dim>
940void
942{
943 TimerOutput::Scope t(this->computing_timer, "Setup AMG");
944
945 //**********************************************
946 // Trillinos Wrapper AMG Preconditioner
947 //*********************************************
948
949 // Constant modes for velocity
950 std::vector<std::vector<bool>> velocity_constant_modes;
951 FEValuesExtractors::Vector velocities(0);
952
953 ComponentMask velocity_components = this->fe->component_mask(velocities);
954 velocity_constant_modes =
955 DoFTools::extract_constant_modes(*this->dof_handler, velocity_components);
956
957 // Constant modes for pressure
958 std::vector<std::vector<bool>> pressure_constant_modes;
959 FEValuesExtractors::Scalar pressure(dim);
960 ComponentMask pressure_components = this->fe->component_mask(pressure);
961 pressure_constant_modes =
962 DoFTools::extract_constant_modes(*this->dof_handler, pressure_components);
963
964 this->computing_timer.enter_subsection("AMG_velocity");
965 const bool elliptic_velocity = false;
966 bool higher_order_elements = false;
967 if (this->fe->degree > 1)
968 higher_order_elements = true;
969 const unsigned int n_cycles =
971 .amg_n_cycles;
972 const bool w_cycle =
974 .amg_w_cycles;
975 const double aggregation_threshold =
977 .amg_aggregation_threshold;
978 const unsigned int smoother_sweeps =
980 .amg_smoother_sweeps;
981 const unsigned int smoother_overlap =
983 .amg_smoother_overlap;
984 const bool output_details = false;
985 const char *smoother_type = "Chebyshev"; //"ILU";
986 const char *coarse_type = "Amesos-KLU"; //"ILU";
987
989 std::make_shared<TrilinosWrappers::PreconditionAMG>();
991 std::make_shared<TrilinosWrappers::PreconditionAMG>();
992
993 TrilinosWrappers::PreconditionAMG::AdditionalData
994 velocity_preconditioner_options(elliptic_velocity,
995 higher_order_elements,
996 n_cycles,
997 w_cycle,
998 aggregation_threshold,
999 velocity_constant_modes,
1000 smoother_sweeps,
1001 smoother_overlap,
1002 output_details,
1003 smoother_type,
1004 coarse_type);
1005
1006 Teuchos::ParameterList velocity_parameter_ml;
1007 std::unique_ptr<Epetra_MultiVector> velocity_distributed_constant_modes;
1008 velocity_preconditioner_options.set_parameters(
1009 velocity_parameter_ml,
1010 velocity_distributed_constant_modes,
1011 system_matrix.block(0, 0));
1012 velocity_amg_preconditioner->initialize(system_matrix.block(0, 0),
1013 velocity_parameter_ml);
1014 this->computing_timer.leave_subsection("AMG_velocity");
1015
1016 this->computing_timer.enter_subsection("AMG_pressure");
1017 const bool elliptic_pressure = true;
1018 higher_order_elements = false;
1019 if (this->pressure_fem_degree > 1)
1020 higher_order_elements = true;
1021 TrilinosWrappers::PreconditionAMG::AdditionalData
1022 pressure_preconditioner_options(elliptic_pressure,
1023 higher_order_elements,
1024 n_cycles,
1025 w_cycle,
1026 aggregation_threshold,
1027 pressure_constant_modes,
1028 smoother_sweeps,
1029 smoother_overlap,
1030 output_details,
1031 smoother_type,
1032 coarse_type);
1033 Teuchos::ParameterList pressure_parameter_ml;
1034 std::unique_ptr<Epetra_MultiVector> pressure_distributed_constant_modes;
1035 velocity_preconditioner_options.set_parameters(
1036 pressure_parameter_ml,
1037 pressure_distributed_constant_modes,
1038 system_matrix.block(0, 0));
1039 pressure_amg_preconditioner->initialize(system_matrix.block(1, 1),
1040 pressure_parameter_ml);
1041 this->computing_timer.leave_subsection("AMG_pressure");
1042
1043
1044 GlobalBlockVectorType completely_distributed_solution(
1046
1047
1048 system_amg_preconditioner = std::make_shared<
1050 gamma,
1051 this->simulation_parameters.physical_properties_manager
1052 .get_kinematic_viscosity_scale(),
1057 this->simulation_parameters.linear_solver.at(PhysicsID::fluid_dynamics));
1058}
1059
1060
1061
1062template <int dim>
1063void
1064FluidDynamicsBlock<dim>::solve_system_GMRES(const double absolute_residual,
1065 const double relative_residual)
1066{
1067 const AffineConstraints<double> &zero_constraints = this->zero_constraints;
1068 const double rescale_metric = this->get_residual_rescale_metric();
1069 const double current_residual = this->system_rhs.l2_norm() / rescale_metric;
1070 const double linear_solver_tolerance =
1071 std::max(relative_residual * current_residual, absolute_residual);
1072 if (this->simulation_parameters.linear_solver.at(PhysicsID::fluid_dynamics)
1073 .verbosity != Parameters::Verbosity::quiet)
1074 {
1075 this->pcout << " -Tolerance of iterative solver is : "
1076 << linear_solver_tolerance << std::endl;
1077 }
1078 const double non_rescaled_linear_solver_tolerance =
1079 linear_solver_tolerance * rescale_metric;
1080
1081 GlobalBlockVectorType completely_distributed_solution(
1083
1084 SolverControl solver_control(this->simulation_parameters.linear_solver
1086 .max_iterations,
1087 non_rescaled_linear_solver_tolerance,
1088 true,
1089 true);
1090
1091 SolverFGMRES<GlobalBlockVectorType> solver(solver_control);
1092
1094
1095 {
1096 TimerOutput::Scope t(this->computing_timer, "Solve linear system");
1097 if (this->simulation_parameters.linear_solver.at(PhysicsID::fluid_dynamics)
1099 solver.solve(this->system_matrix,
1100 this->newton_update,
1101 this->system_rhs,
1103 else if (this->simulation_parameters.linear_solver
1105 .preconditioner ==
1107 solver.solve(this->system_matrix,
1108 this->newton_update,
1109 this->system_rhs,
1111 else
1112 AssertThrow(
1113 this->simulation_parameters.linear_solver.at(PhysicsID::fluid_dynamics)
1114 .preconditioner ==
1116 this->simulation_parameters.linear_solver
1118 .preconditioner ==
1120 ExcMessage(
1121 "This linear solver does not support this preconditioner. Only <ilu> and <amg> preconditioners are supported."));
1122
1123 if (this->simulation_parameters.linear_solver.at(PhysicsID::fluid_dynamics)
1124 .verbosity != Parameters::Verbosity::quiet)
1125 {
1126 this->pcout << " -Iterative solver took : "
1127 << solver_control.last_step()
1128 << " steps to reach a residual norm of "
1129 << solver_control.last_value() / rescale_metric
1130 << std::endl;
1131 }
1132
1133 zero_constraints.distribute(this->newton_update);
1134 }
1135}
1136
1137template <int dim>
1138void
1140 double relative_residual)
1141{
1142 TimerOutput::Scope t(this->computing_timer, "Solve linear system");
1143
1144 const AffineConstraints<double> &nonzero_constraints =
1145 this->nonzero_constraints;
1146 const double rescale_metric = this->get_residual_rescale_metric();
1147 const double current_residual = this->system_rhs.l2_norm() / rescale_metric;
1148 const double linear_solver_tolerance =
1149 std::max(relative_residual * current_residual, absolute_residual);
1150 if (this->simulation_parameters.linear_solver.at(PhysicsID::fluid_dynamics)
1151 .verbosity != Parameters::Verbosity::quiet)
1152 {
1153 this->pcout << " -Tolerance of iterative solver is : "
1154 << linear_solver_tolerance << std::endl;
1155 }
1156 const double non_rescaled_linear_solver_tolerance =
1157 linear_solver_tolerance * rescale_metric;
1158
1159 GlobalBlockVectorType completely_distributed_solution(
1161
1162 SolverControl solver_control(this->simulation_parameters.linear_solver
1164 .max_iterations,
1165 non_rescaled_linear_solver_tolerance,
1166 true,
1167 true);
1168 SolverFGMRES<GlobalBlockVectorType> solver(solver_control);
1169 TrilinosWrappers::PreconditionILU pmass_preconditioner;
1170
1171 //**********************************************
1172 // Trillinos Wrapper ILU Preconditioner
1173 //*********************************************
1174 const unsigned int ilu_fill =
1175 this->simulation_parameters.linear_solver.at(PhysicsID::fluid_dynamics)
1176 .ilu_precond_fill;
1177 const double ilu_atol =
1178 this->simulation_parameters.linear_solver.at(PhysicsID::fluid_dynamics)
1179 .ilu_precond_atol;
1180 const double ilu_rtol =
1181 this->simulation_parameters.linear_solver.at(PhysicsID::fluid_dynamics)
1182 .ilu_precond_rtol;
1183 TrilinosWrappers::PreconditionILU::AdditionalData preconditionerOptions(
1184 ilu_fill, ilu_atol, ilu_rtol, 0);
1185 pmass_preconditioner.initialize(pressure_mass_matrix, preconditionerOptions);
1186
1187
1189 preconditioner(system_matrix, pmass_preconditioner, solver_control);
1190
1191 solver.solve(system_matrix,
1192 completely_distributed_solution,
1193 this->system_rhs,
1194 preconditioner);
1195
1196 if (this->simulation_parameters.linear_solver.at(PhysicsID::fluid_dynamics)
1197 .verbosity != Parameters::Verbosity::quiet)
1198 {
1199 this->pcout << " -Iterative solver took : " << solver_control.last_step()
1200 << " steps " << std::endl;
1201 }
1202
1203 nonzero_constraints.distribute(completely_distributed_solution);
1204 this->newton_update = completely_distributed_solution;
1205}
1206
1207template <int dim>
1208void
1210 unsigned int stage,
1212{
1213 // Copy the reference to some of the vectors to enhance readability below
1214 auto &previous_k_j_solutions = this->sdirk_vectors.previous_k_j_solutions;
1215 auto &sum_over_previous_stages = this->sdirk_vectors.sum_over_previous_stages;
1216 auto &local_sum_over_previous_stages =
1217 this->sdirk_vectors.local_sum_over_previous_stages;
1218 auto &locally_owned_for_calculation =
1219 this->sdirk_vectors.locally_owned_for_calculation;
1220
1221 // If a SDIRK method is selected, we need to solve as many
1222 // nonlinear systems as the number of stages.
1223
1224 // At each stage, the value of the (a_ij), (b_i) and (c_i)
1225 // coefficients are differents
1226
1227 SDIRKTable table = sdirk_table(method);
1228 SDIRKStageData stage_data(table, stage + 1);
1229 const double a_ii = stage_data.a_ij[stage];
1230
1231 // At each stage, we need to recompute sum(a_{ij} * k_j)
1232 // = sum_over_previous_stages
1233 local_sum_over_previous_stages = 0;
1234
1235 if (stage > 0)
1236 {
1237 // At the first stage, the sum_over_previous_stages is set to
1238 // 0. But for the next stages, we need to update this
1239 // sum_over_previous_stages
1240 for (unsigned int p = 0; p < stage; ++p)
1241 {
1242 locally_owned_for_calculation = previous_k_j_solutions[p];
1243 local_sum_over_previous_stages.add(stage_data.a_ij[p] / a_ii,
1244 locally_owned_for_calculation);
1245 }
1246 }
1247
1248 sum_over_previous_stages = local_sum_over_previous_stages;
1249}
1250
1251template <int dim>
1252void
1254 unsigned int stage,
1256 double time_step)
1257{
1258 // Copy the reference to some of the vectors to enhance readability below
1259 auto &present_solution = *this->present_solution;
1262 auto &local_sum_over_previous_stages =
1263 this->sdirk_vectors.local_sum_over_previous_stages;
1264 auto &locally_owned_for_calculation =
1265 this->sdirk_vectors.locally_owned_for_calculation;
1266 auto &previous_k_j_solutions = this->sdirk_vectors.previous_k_j_solutions;
1267 auto &sum_bi_ki = this->sdirk_vectors.sum_bi_ki;
1268 auto &local_sum_bi_ki = this->sdirk_vectors.local_sum_bi_ki;
1269
1270 SDIRKTable table = sdirk_table(method);
1271 SDIRKStageData stage_data(table, stage + 1);
1272 const double a_ii = stage_data.a_ij[stage];
1273
1274 // Once we have solved the nonlinear system for the velocity, we
1275 // want to store the value of the coefficient k_i for the final
1276 // sum b_i*k_i with k_i = (u*_{i} - u_{n})/(time_step*a_ii) -
1277 // sum_over_previous_stages
1278 locally_owned_for_calculation = previous_solutions[0];
1280 local_evaluation_point.add(-1.0, locally_owned_for_calculation);
1281 local_evaluation_point *= 1.0 / (time_step * a_ii);
1282 local_evaluation_point.add(-1.0, local_sum_over_previous_stages);
1283
1284 // We store the value of the present_k_i_solution in the
1285 // previous_k_j_solutions vector.
1286 previous_k_j_solutions[stage] = local_evaluation_point;
1287
1288 // We update the sum of b_i*k_i
1289 const double b_i = stage_data.b_i;
1290 local_sum_bi_ki.add(b_i, local_evaluation_point);
1291 sum_bi_ki = local_sum_bi_ki;
1292}
1293
1294template <int dim>
1295void
1297{
1298 // Copy the reference to some of the vectors to enhance readability below
1299 auto &present_solution = *this->present_solution;
1302 auto &sum_bi_ki = this->sdirk_vectors.sum_bi_ki;
1303 auto &local_sum_bi_ki = this->sdirk_vectors.local_sum_bi_ki;
1304
1305 // At each time iteration, we update the value of present_solution
1306 local_sum_bi_ki = sum_bi_ki;
1308 local_evaluation_point.add(time_step, local_sum_bi_ki);
1310}
1311
1312/*
1313 * Generic CFD Solver application
1314 * Handles the majority of the cases for the GD-NS solver
1315 */
1316template <int dim>
1317void
1319{
1321 *this->triangulation,
1322 this->simulation_parameters.mesh,
1323 this->simulation_parameters.manifolds_parameters,
1324 this->simulation_parameters.restart_parameters.restart,
1325 this->simulation_parameters.boundary_conditions.periodic_boundaries);
1326
1327 this->setup_dofs();
1328 this->box_refine_mesh(this->simulation_parameters.restart_parameters.restart);
1330 this->simulation_parameters.initial_condition->type,
1331 this->simulation_parameters.restart_parameters.restart);
1333
1334 while (this->simulation_control->integrate())
1335 {
1336 this->forcing_function->set_time(
1337 this->simulation_control->get_current_time());
1338
1339 this->simulation_control->print_progression(this->pcout);
1340 this->dynamic_flow_control();
1341
1342 if (this->simulation_control->is_at_start())
1343 {
1344 for (unsigned int i = 0;
1345 i <
1346 this->simulation_parameters.mesh_adaptation.initial_refinement;
1347 i++)
1348 NavierStokesBase<dim,
1350 std::vector<IndexSet>>::refine_mesh();
1351
1352 this->iterate();
1353 }
1354 else
1355 {
1357 refine_mesh();
1358 this->iterate();
1359 }
1360 this->postprocess(false);
1361 this->finish_time_step();
1362 }
1363
1364 this->finish_simulation();
1365}
1366
1367// Pre-compile the 2D and 3D Navier-Stokes solver to ensure that the library is
1368// valid before we actually compile the solver This greatly helps with debugging
1369template class FluidDynamicsBlock<2>;
1370template class FluidDynamicsBlock<3>;
Class that assembles the core of the Navier-Stokes equation. According to the following weak form: ...
virtual void multi_stage_postresolution(unsigned int stage, Parameters::SimulationControl::TimeSteppingMethod method, double time_step) override
Calculate from Update .
void solve_linear_system() override
void set_solution_vector(double value)
std::vector< types::global_dof_index > dofs_per_block
void multi_stage_preresolution(unsigned int stage, Parameters::SimulationControl::TimeSteppingMethod method) override
Update the sum_over_previous_stages variable to use it in the solver.
std::shared_ptr< TrilinosWrappers::PreconditionAMG > velocity_amg_preconditioner
virtual void update_multiphysics_time_average_solution() override
Update the average velocity field solution in the multiphysics interface.
std::shared_ptr< BlockSchurPreconditioner< TrilinosWrappers::PreconditionAMG > > system_amg_preconditioner
TrilinosWrappers::SparseMatrix pressure_mass_matrix
void assemble_local_system_matrix(const typename DoFHandler< dim >::active_cell_iterator &cell, NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data)
Assemble the local matrix for a given cell.
std::shared_ptr< BlockSchurPreconditioner< TrilinosWrappers::PreconditionILU > > system_ilu_preconditioner
void solve_L2_system(double relative_residual, double minimum_residual)
void copy_local_matrix_to_global_matrix(const StabilizedMethodsTensorCopyData< dim > &copy_data)
Copy local cell information to global matrix.
void assemble_system_rhs() override
Assemble the rhs associated with the solver.
virtual void update_multi_stage_solution(double time_step) override
void copy_local_rhs_to_global_rhs(const StabilizedMethodsTensorCopyData< dim > &copy_data)
Copy local cell rhs information to global rhs.
std::shared_ptr< TrilinosWrappers::PreconditionAMG > pressure_amg_preconditioner
TrilinosWrappers::BlockSparsityPattern sparsity_pattern
void setup_assemblers()
sets up the vector of assembler functions
virtual void set_initial_condition_fd(Parameters::FluidDynamicsInitialConditionType initial_condition_type, bool restart=false) override
Sets the initial condition for the solver.
std::shared_ptr< TrilinosWrappers::PreconditionILU > velocity_ilu_preconditioner
void solve_system_GMRES(const double relative_residual, const double minimum_residual)
FluidDynamicsBlock(SimulationParameters< dim > &nsparam)
void setup_preconditioner() override
Set up preconditioner. Not used for this solver but needed for other physics solvers.
TrilinosWrappers::BlockSparseMatrix system_matrix
void assemble_system_matrix() override
Assembles the matrix associated with the solver.
virtual void setup_dofs_fd() override
Initialize the dofs for fluid dynamics.
void assemble_local_system_rhs(const typename DoFHandler< dim >::active_cell_iterator &cell, NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data)
Assemble the local rhs for a given cell.
std::shared_ptr< TrilinosWrappers::PreconditionILU > pressure_ilu_preconditioner
Class that assembles the core of the Navier-Stokes equation with free surface using CLS modeling....
Class that assembles the transient time arising from BDF time integration for the Navier Stokes equat...
Class that assembles the coriolis and the centrifugal if a simulation is carried out in a rotating fr...
Assembles the transient time arising from BDF time integration for the Navier-Stokes equation with fr...
Assembles the core of the Navier-Stokes equation with free surface using CLS modeling....
virtual void set_initial_condition(const Parameters::FluidDynamicsInitialConditionType initial_condition_type, const bool restart=false)
std::shared_ptr< std::vector< GlobalBlockVectorType > > previous_solutions
std::vector< std::shared_ptr< NavierStokesAssemblerBase< dim > > > assemblers
NavierStokesBase(SimulationParameters< dim > &nsparam, const FluidDynamicsFormulation fluid_dynamics_formulation=FluidDynamicsFormulation::standard)
std::shared_ptr< AverageVelocities< dim, GlobalBlockVectorType, std::vector< IndexSet > > > average_velocities
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_heat_transfer(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 heat transfer auxiliary physic.
void enable_heat_transfer(const FiniteElement< dim > &fe, const Quadrature< dim > &quadrature, const Mapping< dim > &mapping)
enable_heat_transfer Enables the collection of the heat transfer data (Temperature field) by the scra...
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.
Assembler of the non-linear Carman-Kozeny permeability model for simulations with phase change.
Assembler of the non-linear Carman-Kozeny permeability model for CLS simulations with phase change.
Class that assembles a phase change Darcy forcing term. This term adds to the right hand-side of the...
Assembles a phase change Darcy forcing term for a CLS two-fluid simulation. The term is added to the...
void solve_governing_system()
Solve the global system of equations according to a given strategy, either linear or not.
std::vector< double > a_ij
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
Assembles the thermal buoyancy source term for CLS simulations. This assembler includes density expli...
Class that assembles a thermal buoyancy forcing term using the Boussinesq approximation....
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
@ pressure
Pressure scalar field from fluid dynamics.
@ fluid_dynamics
Fluid Dynamics (Velocity,Pressure).
@ CLS
@ heat_transfer
Heat transfer (Temperature).
void read_checkpoint(TimerOutput &computing_timer, const DEMSolverParameters< dim > &parameters, std::shared_ptr< SimulationControl > &simulation_control, PVDHandler &particles_pvdhandler, PVDHandler &grid_pvdhandler, parallel::distributed::Triangulation< dim > &triangulation, Particles::ParticleHandler< dim > &particle_handler, std::shared_ptr< Insertion< dim, PropertiesIndex > > &insertion_object, std::vector< std::shared_ptr< SerialSolid< dim - 1, dim > > > &solid_surfaces, CheckpointControl &checkpoint_controller)
Read a DEM simulation checkpoint, allowing the simulation to restart from where it stopped.
SDIRKTable sdirk_table(const Parameters::SimulationControl::TimeSteppingMethod method)
Construct the Butcher tableau (A, b, c) for a given SDIRK method.
@ ilu
Incomplete LU Factorization.
Structure representing a Butcher tableau for a SDIRK method.
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::BlockVector GlobalBlockVectorType
Definition vector.h:18