Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
cls_pde_based_interface_reinitialization.cc
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2025-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
5
8
9#include <deal.II/dofs/dof_renumbering.h>
10
11#include <deal.II/lac/solver_control.h>
12#include <deal.II/lac/sparsity_tools.h>
13#include <deal.II/lac/trilinos_precondition.h>
14#include <deal.II/lac/trilinos_solver.h>
15
16#include <deal.II/numerics/vector_tools.h>
17
18template <int dim>
19void
21{
22 // Get MPI communicator
23 auto mpi_communicator = this->triangulation->get_mpi_communicator();
24
25 // Distribute and renumber DoFs
26 this->dof_handler->distribute_dofs(*this->fe);
27 DoFRenumbering::Cuthill_McKee(*this->dof_handler);
28
29 // Get locally owned and relevant DoFs
30 this->locally_owned_dofs = this->dof_handler->locally_owned_dofs();
32 DoFTools::extract_locally_relevant_dofs(*this->dof_handler);
33
34 // Constraints
37
38 // Sparsity pattern
39 DynamicSparsityPattern dsp(this->locally_relevant_dofs);
40 DoFTools::make_sparsity_pattern(*this->dof_handler,
41 dsp,
43 false);
44 SparsityTools::distribute_sparsity_pattern(dsp,
46 mpi_communicator,
48
49 // Reinitialize system matrix and right-hand side (rhs)
50 this->system_matrix.reinit(this->locally_owned_dofs,
52 dsp,
53 mpi_communicator);
54 this->system_rhs.reinit(this->locally_owned_dofs, mpi_communicator);
55
56 // Reinitialize solution vectors
57 this->present_solution->reinit(this->locally_owned_dofs,
59 mpi_communicator);
60 this->previous_solution.reinit(this->locally_owned_dofs,
62 mpi_communicator);
63 this->newton_update.reinit(this->locally_owned_dofs, mpi_communicator);
65 mpi_communicator);
67 mpi_communicator);
69
71 {
72 std::string subequation_string =
73 this->subequations_interface.get_subequation_string(
74 this->subequation_id);
75 this->pcout << " Number of " << subequation_string
76 << " degrees of freedom: " << this->dof_handler->n_dofs()
77 << std::endl;
78 }
79
80 // Provide DoFHandler and solutions to the subequations interface
81 this->subequations_interface.set_dof_handler(this->subequation_id,
82 this->dof_handler);
83 this->subequations_interface.set_solution(this->subequation_id,
84 this->present_solution);
85}
86
87
88template <int dim>
89void
91{
92 this->zero_constraints.clear();
93 this->zero_constraints.reinit(this->locally_owned_dofs,
95
96 DoFTools::make_hanging_node_constraints(*this->dof_handler,
97 this->zero_constraints);
98
99 for (auto const &[id, type] :
100 this->simulation_parameters.cls_boundary_conditions.type)
101 {
103 {
104 const auto &periodic_boundary =
105 this->simulation_parameters.cls_boundary_conditions
106 .periodic_boundaries.at(id);
107 DoFTools::make_periodicity_constraints(*this->dof_handler,
108 id,
109 periodic_boundary.neighbor_id,
110 periodic_boundary.direction,
111 this->zero_constraints);
112 }
113 }
114 for (auto const &[id, type] :
115 this->simulation_parameters.cls_boundary_conditions.type)
116 {
118 {
119 VectorTools::interpolate_boundary_values(
120 *this->dof_handler,
121 id,
122 Functions::ZeroFunction<dim>(),
123 this->zero_constraints);
124 }
125 }
126 this->zero_constraints.close();
127}
128
129
130template <int dim>
131void
133{
134 this->nonzero_constraints.clear();
135 this->nonzero_constraints.reinit(this->locally_owned_dofs,
137
138 DoFTools::make_hanging_node_constraints(*this->dof_handler,
139 this->nonzero_constraints);
140
141 for (auto const &[id, type] :
142 this->simulation_parameters.cls_boundary_conditions.type)
143 {
145 {
146 const auto &periodic_boundary =
147 this->simulation_parameters.cls_boundary_conditions
148 .periodic_boundaries.at(id);
149 DoFTools::make_periodicity_constraints(*this->dof_handler,
150 id,
151 periodic_boundary.neighbor_id,
152 periodic_boundary.direction,
153 this->nonzero_constraints);
154 }
155 }
156 for (auto const &[id, type] :
157 this->simulation_parameters.cls_boundary_conditions.type)
158 {
160 {
161 VectorTools::interpolate_boundary_values(
162 *this->dof_handler,
163 id,
164 *this->simulation_parameters.cls_boundary_conditions.phase_indicator
165 .at(id),
166 this->nonzero_constraints);
167 }
168 }
169 this->nonzero_constraints.close();
170}
171
172
173template <int dim>
174void
176{
177 // Get CLS DoFHandler
178 const DoFHandler<dim> &dof_handler_cls =
179 this->subequations_interface.get_cls_dof_handler();
180
181 // Interpolate CLS solution to PDE-based interface reinitialization
182 FETools::interpolate(dof_handler_cls,
183 this->subequations_interface.get_cls_solution(),
184 *this->dof_handler,
185 this->nonzero_constraints,
186 this->newton_update);
187
188 *this->present_solution = this->newton_update;
189 this->previous_solution =
190 *this->present_solution; // We only have 1 previous solution (bdf1)
192 this->previous_solution; // For steady-state criterion evaluation
193
194 // Initial condition
195 if (this->simulation_parameters.multiphysics.cls_parameters
196 .reinitialization_method.pde_based_interface_reinitialization
197 .output_reinitialization_steps)
198 {
199 this->pvdhandler.times_and_names.clear();
201 }
202}
203
204
205template <int dim>
206void
208{
209 // Reinitialize system matrix
210 this->system_matrix = 0;
211
212 // Get projected CLS phase gradient DoFHandler
213 const DoFHandler<dim> &dof_handler_cls_phase_indicator_gradient =
214 this->subequations_interface.get_dof_handler(
216
217 // Initialize FEValues for PDE-based interface reinitialization and CLS
218 // phase indicator gradient projection
219 FEValues<dim> fe_values_pde_based_reinitialization(*this->mapping,
220 *this->fe,
221 *this->cell_quadrature,
222 update_values |
223 update_gradients |
224 update_JxW_values);
225 FEValues<dim> fe_values_phase_gradient_projection(
226 *this->mapping,
227 dof_handler_cls_phase_indicator_gradient.get_fe(),
228 *this->cell_quadrature,
229 update_values);
230
231 // Initialize size of arrays
232 const unsigned int n_q_points =
233 fe_values_pde_based_reinitialization.get_quadrature().size();
234 const unsigned int n_dofs_per_cell =
235 fe_values_pde_based_reinitialization.get_fe().n_dofs_per_cell();
236
237 // Initialize local matrix
238 FullMatrix<double> local_matrix(n_dofs_per_cell, n_dofs_per_cell);
239
240 // Initialize local dof indices array
241 std::vector<types::global_dof_index> local_dof_indices(n_dofs_per_cell);
242
243 // Extractor for phase indicator gradient vector
244 FEValuesExtractors::Vector phase_indicator_gradients(0);
245
246 // Initialize phase indicator and projected phase gradient solution arrays
247 std::vector<double> present_phase_indicator_values(n_q_points);
248 std::vector<Tensor<1, dim>> present_phase_gradient_projection_values(
249 n_q_points);
250 std::vector<Tensor<1, dim>> present_reinitialized_phase_gradient_values(
251 n_q_points);
252
253 // Initialize shape function arrays
254 std::vector<double> phi(n_dofs_per_cell);
255 std::vector<Tensor<1, dim>> grad_phi(n_dofs_per_cell);
256
257 // Compute diffusivity coefficient with the smallest cell size
258 const double h_min = identify_minimum_cell_size(
259 *this->mapping,
260 this->subequations_interface.get_dof_handler(
262 *this->cell_quadrature,
263 this->triangulation->get_mpi_communicator());
264 const double diffusivity_coefficient = compute_diffusivity(h_min);
265
266 // BDF coefficients for pseudo time-stepping
269 const Vector<double> bdf_coefficient_vector =
271
272 // Get present phase gradient projection solution
273 auto &present_phase_gradient_projection_solution =
274 this->subequations_interface.get_solution(
276
277 // Assemble system matrix
278 for (const auto &cell : this->dof_handler->active_cell_iterators())
279 {
280 if (cell->is_locally_owned())
281 {
282 // Reinitialize local matrix
283 local_matrix = 0;
284
285 // Get phase gradient projection cell iterator
286 typename DoFHandler<dim>::active_cell_iterator
287 cls_phase_gradient_projection_cell(
288 &(*this->triangulation),
289 cell->level(),
290 cell->index(),
291 &dof_handler_cls_phase_indicator_gradient);
292
293 // Reinitialize FEValues with corresponding cell
294 fe_values_pde_based_reinitialization.reinit(cell);
295 fe_values_phase_gradient_projection.reinit(
296 cls_phase_gradient_projection_cell);
297
298 // Get vector of JxW
299 std::vector<double> JxW_vec =
300 fe_values_pde_based_reinitialization.get_JxW_values();
301
302 // Get present phase indicator and projected CLS phase gradient
303 fe_values_pde_based_reinitialization.get_function_values(
304 this->evaluation_point, present_phase_indicator_values);
305 fe_values_phase_gradient_projection[phase_indicator_gradients]
306 .get_function_values(present_phase_gradient_projection_solution,
307 present_phase_gradient_projection_values);
308
309 // Set tolerance to avoid division by zero
310 const double tolerance = 1e-12;
311
312 // Loop over quadrature points
313 for (unsigned int q = 0; q < n_q_points; ++q)
314 {
315 // Shape functions
316 for (unsigned int k = 0; k < n_dofs_per_cell; ++k)
317 {
318 phi[k] =
319 fe_values_pde_based_reinitialization.shape_value(k, q);
320 grad_phi[k] =
321 fe_values_pde_based_reinitialization.shape_grad(k, q);
322 }
323
324 // Extract phase indicator value and projected phase indicator
325 // gradient
326 const double phase_indicator = present_phase_indicator_values[q];
327 const Tensor<1, dim> projected_cls_phase_gradient =
328 present_phase_gradient_projection_values[q];
329
330 // Compute normal vector with projected phase gradient
331 const double projected_cls_phase_gradient_norm =
332 projected_cls_phase_gradient.norm() + tolerance;
333 const Tensor<1, dim> interface_normal =
334 (projected_cls_phase_gradient /
335 projected_cls_phase_gradient_norm);
336
337 // Local matrix assembly
338 for (unsigned int i = 0; i < n_dofs_per_cell; ++i)
339 {
340 for (unsigned int j = 0; j < n_dofs_per_cell; ++j)
341 {
342 local_matrix(i, j) +=
343 (
344 // Time-stepping term
345 phi[i] * phi[j] * bdf_coefficient_vector[0] -
346 // Compressive term
347 scalar_product(grad_phi[i],
348 (phi[j] -
349 2 * phase_indicator * phi[j]) *
350 interface_normal) +
351 // Diffusive term
352 scalar_product(grad_phi[i],
353 diffusivity_coefficient *
354 scalar_product(grad_phi[j],
355 interface_normal) *
356 interface_normal)) *
357 JxW_vec[q];
358 }
359 }
360 }
361 // Distribute the local contributions to the global system
362 cell->get_dof_indices(local_dof_indices);
363 this->zero_constraints.distribute_local_to_global(
364 local_matrix, local_dof_indices, this->system_matrix);
365 }
366 }
367 this->system_matrix.compress(VectorOperation::add);
368}
369
370
371template <int dim>
372void
374{
375 // Reinitialize system right-hand side (rhs)
376 this->system_rhs = 0;
377
378 // Get projected phase gradient DoFHandler
379 const DoFHandler<dim> &dof_handler_cls_phase_indicator_gradient =
380 this->subequations_interface.get_dof_handler(
382
383 // Initialize FEValues for PDE-based interface reinitialization and CLS phase
384 // indicator gradient projection
385 FEValues<dim> fe_values_pde_based_reinitialization(*this->mapping,
386 *this->fe,
387 *this->cell_quadrature,
388 update_values |
389 update_gradients |
390 update_JxW_values);
391 FEValues<dim> fe_values_phase_gradient_projection(
392 *this->mapping,
393 dof_handler_cls_phase_indicator_gradient.get_fe(),
394 *this->cell_quadrature,
395 update_values);
396
397 // Initialize size of arrays
398 const unsigned int n_q_points =
399 fe_values_pde_based_reinitialization.get_quadrature().size();
400 const unsigned int n_dofs_per_cell =
401 fe_values_pde_based_reinitialization.get_fe().n_dofs_per_cell();
402
403 // Initialize local rhs
404 Vector<double> local_rhs(n_dofs_per_cell);
405
406 // Initialize local dof indices array
407 std::vector<types::global_dof_index> local_dof_indices(n_dofs_per_cell);
408
409 // Extractor for phase indicator gradient vector
410 FEValuesExtractors::Vector phase_indicator_gradients(0);
411
412 // Initialize phase indicator and projected phase indicator gradient solution
413 // arrays
414 std::vector<double> present_phase_indicator_values(n_q_points);
415 std::vector<double> previous_phase_indicator_values(n_q_points);
416 std::vector<Tensor<1, dim>> present_cls_phase_gradient_projection_values(
417 n_q_points);
418 std::vector<Tensor<1, dim>> present_reinitialized_phase_gradient_values(
419 n_q_points);
420
421 // Initialize shape function arrays
422 std::vector<double> phi(n_dofs_per_cell);
423 std::vector<Tensor<1, dim>> grad_phi(n_dofs_per_cell);
424
425 // Compute diffusivity coefficient with the smallest cell size
426 const double h_min = identify_minimum_cell_size(
427 *this->mapping,
428 this->subequations_interface.get_dof_handler(
430 *this->cell_quadrature,
431 this->triangulation->get_mpi_communicator());
432 const double diffusivity_coefficient = compute_diffusivity(h_min);
433
434 // BDF coefficients for pseudo time-stepping
437 const Vector<double> bdf_coefficient_vector =
439
440 // Set tolerance to avoid division by zero
441 constexpr double tolerance = 1e-12;
442
443 for (const auto &cell : this->dof_handler->active_cell_iterators())
444 {
445 if (cell->is_locally_owned())
446 {
447 // Reinitialize local rhs
448 local_rhs = 0;
449
450 // Get phase gradient projection cell iterator
451 typename DoFHandler<dim>::active_cell_iterator
452 cls_phase_gradient_projection_cell(
453 &(*this->triangulation),
454 cell->level(),
455 cell->index(),
456 &dof_handler_cls_phase_indicator_gradient);
457
458 // Reinitialize FEValues with corresponding cells
459 fe_values_pde_based_reinitialization.reinit(cell);
460 fe_values_phase_gradient_projection.reinit(
461 cls_phase_gradient_projection_cell);
462
463 // Get vector of Jacobi determinant times the quadrature weights
464 std::vector<double> JxW_vec =
465 fe_values_pde_based_reinitialization.get_JxW_values();
466
467 // Get CLS phase indicator and projected phase gradient values
468 fe_values_pde_based_reinitialization.get_function_values(
469 this->evaluation_point, present_phase_indicator_values);
470 fe_values_pde_based_reinitialization.get_function_values(
471 this->previous_solution, previous_phase_indicator_values);
472 fe_values_phase_gradient_projection[phase_indicator_gradients]
473 .get_function_values(
474 this->subequations_interface.get_solution(
476 present_cls_phase_gradient_projection_values);
477 fe_values_pde_based_reinitialization.get_function_gradients(
478 this->evaluation_point,
479 present_reinitialized_phase_gradient_values);
480
481 // Loop over quadrature points
482 for (unsigned int q = 0; q < n_q_points; ++q)
483 {
484 // Shape functions
485 for (unsigned int k = 0; k < n_dofs_per_cell; ++k)
486 {
487 phi[k] =
488 fe_values_pde_based_reinitialization.shape_value(k, q);
489 grad_phi[k] =
490 fe_values_pde_based_reinitialization.shape_grad(k, q);
491 }
492
493 // Extract present and previous phase indicator values and
494 // projected phase gradient values
495 std::vector<double> phase_indicator_values(2);
496 phase_indicator_values[0] = present_phase_indicator_values[q];
497 const double phase_indicator = phase_indicator_values[0];
498 phase_indicator_values[1] = previous_phase_indicator_values[q];
499 const Tensor<1, dim> projected_cls_phase_gradient =
500 present_cls_phase_gradient_projection_values[q];
501 const Tensor<1, dim> reinitialized_phase_gradient =
502 present_reinitialized_phase_gradient_values[q];
503
504 // Compute normal vector with projected phase gradient
505 const double projected_cls_phase_gradient_norm =
506 projected_cls_phase_gradient.norm() + tolerance;
507 const Tensor<1, dim> interface_normal =
508 (projected_cls_phase_gradient /
509 projected_cls_phase_gradient_norm);
510
511 // Local rhs assembly
512 for (unsigned int i = 0; i < n_dofs_per_cell; ++i)
513 {
514 // Time-stepping term (bdf1)
515 for (unsigned int p = 0; p < 2; ++p)
516 {
517 local_rhs(i) -= bdf_coefficient_vector[p] *
518 (phase_indicator_values[p] * phi[i]) *
519 JxW_vec[q];
520 }
521 local_rhs(i) -=
522 (
523 // Compressive term
524 -scalar_product(grad_phi[i],
525 (phase_indicator -
526 Utilities::fixed_power<2>(
527 phase_indicator)) *
528 interface_normal) +
529 // Diffusive term
530 scalar_product(
531 grad_phi[i],
532 diffusivity_coefficient *
533 scalar_product(reinitialized_phase_gradient,
534 interface_normal) *
535 interface_normal)) *
536 JxW_vec[q];
537 }
538 }
539 // Distribute the local contributions to the global system
540 cell->get_dof_indices(local_dof_indices);
541 this->zero_constraints.distribute_local_to_global(local_rhs,
542 local_dof_indices,
543 this->system_rhs);
544 }
545 }
546 this->system_rhs.compress(VectorOperation::add);
547}
548
549
550template <int dim>
551void
553{
554 auto mpi_communicator = this->triangulation->get_mpi_communicator();
555
556 const AffineConstraints<double> &constraints_used = this->zero_constraints;
557
558 const bool verbose(
559 this->simulation_parameters.cls_subequations_linear_solvers
561 .verbosity != Parameters::Verbosity::quiet);
562
563 // Get residual conditions
564 const double absolute_residual =
565 this->simulation_parameters.cls_subequations_linear_solvers
567 .minimum_residual;
568 const double relative_residual =
569 this->simulation_parameters.cls_subequations_linear_solvers
571 .relative_residual;
572
573 // Set linear solver tolerance
574 const double rescale_metric = this->get_residual_rescale_metric();
575 const double current_residual = this->system_rhs.l2_norm() / rescale_metric;
576 const double linear_solver_tolerance =
577 std::max(relative_residual * current_residual, absolute_residual);
578 const double non_rescaled_linear_solver_tolerance =
579 linear_solver_tolerance * rescale_metric;
580
581 if (verbose)
582 {
583 this->pcout << " -Tolerance of iterative solver is: "
584 << linear_solver_tolerance << std::endl;
585 }
586
587 // ILU preconditioner
588 const unsigned int ilu_fill =
589 this->simulation_parameters.cls_subequations_linear_solvers
591 .ilu_precond_fill;
592 const double ilu_atol =
593 this->simulation_parameters.cls_subequations_linear_solvers
595 .ilu_precond_atol;
596 const double ilu_rtol =
597 this->simulation_parameters.cls_subequations_linear_solvers
599 .ilu_precond_rtol;
600 TrilinosWrappers::PreconditionILU::AdditionalData preconditionerOptions(
601 ilu_fill, ilu_atol, ilu_rtol, 0);
602
603 TrilinosWrappers::PreconditionILU ilu_preconditioner;
604
605 ilu_preconditioner.initialize(this->system_matrix, preconditionerOptions);
606
607 GlobalVectorType completely_distributed_solution(this->locally_owned_dofs,
608 mpi_communicator);
609
610 SolverControl solver_control(
611 this->simulation_parameters.cls_subequations_linear_solvers
613 .max_iterations,
614 non_rescaled_linear_solver_tolerance,
615 true,
616 true);
617
618 TrilinosWrappers::SolverGMRES::AdditionalData solver_parameters(
619 false,
620 this->simulation_parameters.cls_subequations_linear_solvers
622 .max_krylov_vectors);
623
624 TrilinosWrappers::SolverGMRES solver(solver_control, solver_parameters);
625
626 solver.solve(this->system_matrix,
627 completely_distributed_solution,
628 this->system_rhs,
629 ilu_preconditioner);
630
631 if (verbose)
632 {
633 this->pcout << " -Iterative solver took: " << solver_control.last_step()
634 << " steps to reach a residual norm of "
635 << solver_control.last_value() / rescale_metric << std::endl;
636 }
637
638 // Update constraints and newton vectors
639 constraints_used.distribute(completely_distributed_solution);
640 this->newton_update = completely_distributed_solution;
641}
642
643
644template <int dim>
645void
647{
648 // Check if all required solutions are valid
650
651 // Compute current time step
653 this->time_step_vector[0] = this->current_time_step;
654
655 // Set initial conditions from the CLS solution (step 0)
657
658 // Reinitialization steps counter
659 unsigned int step = 1;
660
661 // Define verbosity
662 const bool verbose(
664 this->simulation_parameters.cls_subequations_non_linear_solvers
666 .verbosity != Parameters::Verbosity::quiet);
667 std::string subequation_string =
668 this->subequations_interface.get_subequation_string(this->subequation_id);
669
670 if (verbose)
671 {
672 announce_string(this->pcout, "CLS PDE-based interface reinitialization");
673
674 this->pcout << "Current PDE-based reinitialization time step: "
675 << this->current_time_step << std::endl;
676 }
677
678 // For debugging purposes
679 if (this->simulation_parameters.multiphysics.cls_parameters
680 .reinitialization_method.pde_based_interface_reinitialization
681 .output_reinitialization_steps)
683
684 // Iterate until a stop criterion is met
685 while (continue_iterating(step))
686 {
687 if (verbose)
688 {
689 this->pcout << "-Solving " << subequation_string << ", step " << step
690 << std::endl;
691 }
692
693 // Update previous solution
694 this->previous_solution = *this->present_solution;
696
697 // Update non-zero constraints
699
700 // Solve non-linear equation
702
703 // For debugging purposes
704 if (this->simulation_parameters.multiphysics.cls_parameters
705 .reinitialization_method.pde_based_interface_reinitialization
706 .output_reinitialization_steps)
708
709 // Increment step number
710 step++;
711 }
712
713 if (verbose)
714 this->pcout << "The solver took: " << step - 1 << " reinitialization steps"
715 << std::endl;
716
717 this->subequations_interface.set_solution_valid(this->subequation_id);
718}
719
720template <int dim>
721void
723 const unsigned int step)
724{
725 auto mpi_communicator = this->triangulation->get_mpi_communicator();
726 const std::string folder =
727 this->simulation_parameters.simulation_control.output_folder +
728 "/pde-based-reinitialization-steps-output/";
729
730 const std::string file_name =
731 "pde-based-reinitialization-" +
732 this->simulation_parameters.simulation_control.output_name + "-it" +
733 Utilities::int_to_string(this->simulation_control->get_iteration_number(),
734 5);
735
736 std::vector<DataComponentInterpretation::DataComponentInterpretation>
737 data_component_interpretation(
738 1, DataComponentInterpretation::component_is_scalar);
739
740 std::vector<DataComponentInterpretation::DataComponentInterpretation>
741 vector_data_component_interpretation(
742 dim, DataComponentInterpretation::component_is_part_of_vector);
743
744 DataOut<dim> data_out;
745
746 // Attach solution data to DataOut object
747 data_out.attach_dof_handler(*this->dof_handler);
748 data_out.add_data_vector(*this->present_solution, "reinit_phase_indicator");
749 data_out.add_data_vector(this->subequations_interface.get_cls_dof_handler(),
750 this->subequations_interface.get_cls_solution(),
751 "cls_phase_indicator",
752 data_component_interpretation);
753 std::vector<std::string> cls_gradient_solution_names(dim,
754 "cls_phase_gradient");
755 data_out.add_data_vector(this->subequations_interface.get_dof_handler(
757 this->subequations_interface.get_solution(
759 cls_gradient_solution_names,
760 vector_data_component_interpretation);
761
762 data_out.build_patches(*this->mapping,
763 1, // subdivision
764 DataOut<dim>::curved_inner_cells);
765
767 this->pvdhandler,
768 data_out,
769 folder,
770 file_name,
771 step,
772 step,
773 this->simulation_parameters.simulation_control.group_files,
774 mpi_communicator);
775}
776
777
778template <int dim>
779void
781{
782 AssertThrow(this->subequations_interface.get_solution_validity(
784 PhaseGradientProjectionIsInvalid(
785 this->subequations_interface.get_subequation_string(
787 this->subequations_interface.get_subequation_string(
788 this->subequation_id)));
789}
790
Vector< double > calculate_bdf_coefficients(Parameters::SimulationControl::TimeSteppingMethod method, const std::vector< double > &time_steps)
Calculate the coefficients required for backward differentiation formula (BDF) integration of order .
Definition bdf.cc:42
double get_residual_rescale_metric() const override
Return the metric for residual rescaling. By default, should return 1. If the rescale_residual_by_vol...
void define_zero_constraints()
Define the zero constraints used to solve the problem.
void setup_dofs() override
Set up the DofHandler and the degree of freedom associated with the subequation.
void set_initial_conditions()
Sets-up the initial conditions associated with the subequation.
void assemble_system_rhs() override
Assemble the right-hand side (rhs).
void define_non_zero_constraints()
Define the non zero constraints used to solve the problem.
double compute_time_step()
Computes PDE-based reinitialization time step value with user-imposed CFL and minimum cell size.
bool continue_iterating(const unsigned int step_number)
Indicate if the PDE-based reinitialization should continue by checking if at least one of the two sto...
void check_dependencies_validity()
Check if the phase gradient and curvature L2 projections have been solved.
double compute_diffusivity(const double min_cell_size) const
Computes mesh-dependant diffusivity coefficient value.
std::shared_ptr< parallel::DistributedTriangulationBase< dim > > triangulation
void solve() override
Solve interface PDE-based reinitialization process until one of the stop criteria is met.
void write_output_results(const unsigned int step)
Write parallel VTU files of quantities of interest for the PDE-based interface reinitialization proce...
void solve_linear_system() override
Solve the linear system.
@ pde_based_interface_reinitialization
CLS PDE-based interface reinitialization.
@ phase_gradient_projection
CLS phase indicator gradient L2 projection.
double identify_minimum_cell_size(const Mapping< dim > &mapping, const DoFHandler< dim > &dof_handler, const Quadrature< dim > &cell_quadrature, const MPI_Comm &mpi_communicator)
Identify minimum cell size. The cell size corresponds to the diameter of a disk (2D) or sphere (3D) o...
Definition utilities.h:1044
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
void write_vtu_and_pvd(PVDHandler &pvd_handler, const DataOutInterface< dim, spacedim > &data_out, const std::string &folder, const std::string &file_prefix, const double time, const unsigned int iter, const unsigned int group_files, const MPI_Comm &mpi_communicator, const unsigned int digits=5)
Output the data out to "group_files" vtu files, with a pvtu file and a pvd to store the timing This f...
dealii::TrilinosWrappers::MPI::Vector GlobalVectorType
Definition vector.h:17