ryujin 2.1.1 revision 6dc06e5864abd5d99e5d7ab641dbe621936411d9
time_loop.template.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3// Copyright (C) 2020 - 2024 by the ryujin authors
4//
5
6#pragma once
7
8#include "scope.h"
9#include "state_vector.h"
10#include "time_loop.h"
11#include "version_info.h"
12
13#include <deal.II/base/logstream.h>
14#include <deal.II/base/work_stream.h>
15#include <deal.II/numerics/vector_tools.h>
16#include <deal.II/numerics/vector_tools.templates.h>
17
18#include <filesystem>
19#include <fstream>
20#include <iomanip>
21
22using namespace dealii;
23
24namespace ryujin
25{
26 template <typename Description, int dim, typename Number>
28 : ParameterAcceptor("/A - TimeLoop")
29 , mpi_ensemble_(mpi_comm)
30 , hyperbolic_system_(mpi_ensemble_, "/B - Equation")
31 , parabolic_system_(mpi_ensemble_, "/B - Equation")
32 , discretization_(mpi_ensemble_, "/C - Discretization")
33 , offline_data_(mpi_ensemble_, discretization_, "/D - OfflineData")
34 , initial_values_(mpi_ensemble_,
35 "/E - InitialValues",
36 mpi_ensemble_,
37 offline_data_,
38 hyperbolic_system_,
39 parabolic_system_)
40 , hyperbolic_module_(mpi_ensemble_,
41 computing_timer_,
42 offline_data_,
43 hyperbolic_system_,
44 initial_values_,
45 "/F - HyperbolicModule")
46 , parabolic_module_(mpi_ensemble_,
47 computing_timer_,
48 offline_data_,
49 hyperbolic_system_,
50 parabolic_system_,
51 initial_values_,
52 "/G - ParabolicModule")
53 , time_integrator_(mpi_ensemble_,
54 offline_data_,
55 hyperbolic_module_,
56 parabolic_module_,
57 "/H - TimeIntegrator")
58 , mesh_adaptor_(mpi_ensemble_,
59 offline_data_,
60 hyperbolic_system_,
61 parabolic_system_,
62 hyperbolic_module_.initial_precomputed(),
63 hyperbolic_module_.alpha(),
64 "/I - MeshAdaptor")
65 , solution_transfer_(
66 mpi_ensemble_, offline_data_, hyperbolic_system_, parabolic_system_)
67 , postprocessor_(mpi_ensemble_,
68 offline_data_,
69 hyperbolic_system_,
70 parabolic_system_,
71 "/J - VTUOutput")
72 , vtu_output_(mpi_ensemble_,
73 offline_data_,
74 hyperbolic_system_,
75 parabolic_system_,
76 postprocessor_,
77 hyperbolic_module_.initial_precomputed(),
78 hyperbolic_module_.alpha(),
79 "/J - VTUOutput")
80 , quantities_(mpi_ensemble_,
81 offline_data_,
82 hyperbolic_system_,
83 parabolic_system_,
84 "/K - Quantities")
85 {
86 base_name_ = "test";
87 add_parameter("basename", base_name_, "Base name for all output files");
88
89 t_final_ = Number(5.);
90 add_parameter("final time", t_final_, "Final time");
91
92 enforce_t_final_ = false;
93 add_parameter("enforce final time",
94 enforce_t_final_,
95 "Boolean indicating whether the final time should be "
96 "enforced strictly. If set to true the last time step is "
97 "shortened so that the simulation ends precisely at t_final");
98
99 timer_granularity_ = Number(0.01);
100 add_parameter("timer granularity",
101 timer_granularity_,
102 "The timer granularity specifies the time interval after "
103 "which compute, output, postprocessing, and mesh adaptation "
104 "routines are run. This \"baseline tick\" is further "
105 "modified by the corresponding \"*_multiplier\" options");
106
107 enable_checkpointing_ = false;
108 add_parameter(
109 "enable checkpointing",
110 enable_checkpointing_,
111 "Write out checkpoints to resume an interrupted computation at timer "
112 "granularity intervals. The frequency is determined by \"timer "
113 "granularity\" and \"timer checkpoint multiplier\"");
114
115 enable_output_full_ = false;
116 add_parameter("enable output full",
117 enable_output_full_,
118 "Write out full pvtu records. The frequency is determined by "
119 "\"timer granularity\" and \"timer output full multiplier\"");
120
121 enable_output_levelsets_ = false;
122 add_parameter(
123 "enable output levelsets",
124 enable_output_levelsets_,
125 "Write out levelsets pvtu records. The frequency is determined by "
126 "\"timer granularity\" and \"timer output levelsets multiplier\"");
127
128 enable_compute_error_ = false;
129 add_parameter("enable compute error",
130 enable_compute_error_,
131 "Flag to control whether we compute the Linfty Linf_norm of "
132 "the difference to an analytic solution. Implemented only "
133 "for certain initial state configurations.");
134
135 enable_compute_quantities_ = false;
136 add_parameter(
137 "enable compute quantities",
138 enable_compute_quantities_,
139 "Flag to control whether we compute quantities of interest. The "
140 "frequency how often quantities are logged is determined by \"timer "
141 "granularity\" and \"timer compute quantities multiplier\"");
142
143 enable_mesh_adaptivity_ = false;
144 add_parameter(
145 "enable mesh adaptivity",
146 enable_mesh_adaptivity_,
147 "Flag to control whether we use an adaptive mesh refinement strategy. "
148 "The frequency how often we query MeshAdaptor::analyze() for deciding "
149 "on adapting the mesh is determined by \"timer granularity\" and "
150 "\"timer mesh refinement multiplier\"");
151
152 timer_checkpoint_multiplier_ = 1;
153 add_parameter("timer checkpoint multiplier",
154 timer_checkpoint_multiplier_,
155 "Multiplicative modifier applied to \"timer granularity\" "
156 "that determines the checkpointing granularity");
157
158 timer_output_full_multiplier_ = 1;
159 add_parameter("timer output full multiplier",
160 timer_output_full_multiplier_,
161 "Multiplicative modifier applied to \"timer granularity\" "
162 "that determines the full pvtu writeout granularity");
163
164 timer_output_levelsets_multiplier_ = 1;
165 add_parameter("timer output levelsets multiplier",
166 timer_output_levelsets_multiplier_,
167 "Multiplicative modifier applied to \"timer granularity\" "
168 "that determines the levelsets pvtu writeout granularity");
169
170 timer_compute_quantities_multiplier_ = 1;
171 add_parameter(
172 "timer compute quantities multiplier",
173 timer_compute_quantities_multiplier_,
174 "Multiplicative modifier applied to \"timer granularity\" that "
175 "determines the writeout granularity for quantities of interest");
176
177 std::copy(std::begin(View::component_names),
178 std::end(View::component_names),
179 std::back_inserter(error_quantities_));
180
181 add_parameter("error quantities",
182 error_quantities_,
183 "List of conserved quantities used in the computation of the "
184 "error norms.");
185
186 error_normalize_ = true;
187 add_parameter("error normalize",
188 error_normalize_,
189 "Flag to control whether the error should be normalized by "
190 "the corresponding norm of the analytic solution.");
191
192 resume_ = false;
193 add_parameter("resume", resume_, "Resume an interrupted computation");
194
195 resume_at_time_zero_ = false;
196 add_parameter("resume at time zero",
197 resume_at_time_zero_,
198 "Resume from the latest checkpoint but set the time to t=0.");
199
200 terminal_update_interval_ = 5;
201 add_parameter("terminal update interval",
202 terminal_update_interval_,
203 "Number of seconds after which output statistics are "
204 "recomputed and printed on the terminal");
205
206 terminal_show_rank_throughput_ = true;
207 add_parameter("terminal show rank throughput",
208 terminal_show_rank_throughput_,
209 "If set to true an average per rank throughput is computed "
210 "by dividing the total consumed CPU time (per rank) by the "
211 "number of threads (per rank). If set to false then a plain "
212 "average per thread \"CPU\" throughput value is computed by "
213 "using the umodified total accumulated CPU time.");
214
215 debug_filename_ = "";
216 add_parameter("debug filename",
217 debug_filename_,
218 "If set to a nonempty string then we output the contents of "
219 "this file at the end. This is mainly useful in the "
220 "testsuite to output files we wish to compare");
221 }
222
223
224 template <typename Description, int dim, typename Number>
226 {
227#ifdef DEBUG_OUTPUT
228 std::cout << "TimeLoop<dim, Number>::run()" << std::endl;
229#endif
230
231 {
232 base_name_ensemble_ = base_name_;
233 if (mpi_ensemble_.n_ensembles() > 1) {
234 print_info("setting up MPI ensemble");
235 base_name_ensemble_ += "-ensemble_" + dealii::Utilities::int_to_string(
236 mpi_ensemble_.ensemble(),
237 mpi_ensemble_.n_ensembles());
238 }
239 }
240
241 /* Attach log file and record runtime parameters: */
242
243 if (mpi_ensemble_.world_rank() == 0)
244 logfile_.open(base_name_ + ".log");
245
246 print_parameters(logfile_);
247
248 /*
249 * Prepare data structures:
250 */
251
252 Number t = 0.;
253 unsigned int timer_cycle = 0;
254 StateVector state_vector;
255
256 /* Create a small lambda for preparing compute kernels: */
257 const auto prepare_compute_kernels = [&]() {
258 print_info("preparing compute kernels");
259
260 unsigned int n_parabolic_state_vectors =
261 parabolic_system_.get().n_parabolic_state_vectors();
262
263 offline_data_.prepare(
264 problem_dimension, n_precomputed_values, n_parabolic_state_vectors);
265
266 hyperbolic_module_.prepare();
267 parabolic_module_.prepare();
268 time_integrator_.prepare();
269 mesh_adaptor_.prepare(/*needs current timepoint*/ t);
270 postprocessor_.prepare();
271 vtu_output_.prepare();
272 quantities_.prepare(base_name_ensemble_);
273 print_mpi_partition(logfile_);
274
275 if (mpi_ensemble_.ensemble_rank() == 0)
276 n_global_dofs_ = dealii::Utilities::MPI::sum(
277 offline_data_.dof_handler().n_dofs(),
278 mpi_ensemble_.ensemble_leader_communicator());
279 };
280
281 {
282 Scope scope(computing_timer_, "(re)initialize data structures");
283 print_info("initializing data structures");
284
285 if (resume_) {
286 print_info("resume: reading mesh and loading state vector");
287
288 read_checkpoint(state_vector,
289 base_name_ensemble_,
290 t,
291 timer_cycle,
292 prepare_compute_kernels);
293
294 if (resume_at_time_zero_) {
295 /* Reset the current time t and the output cycle count to zero: */
296 t = 0.;
297 timer_cycle = 0;
298 }
299
300 } else {
301 print_info("creating mesh and interpolating initial values");
302
303 discretization_.prepare(base_name_ensemble_);
304
305 prepare_compute_kernels();
306
307 Vectors::reinit_state_vector<Description>(state_vector, offline_data_);
308 std::get<0>(state_vector) =
309 initial_values_.get().interpolate_hyperbolic_vector();
310 }
311 }
312
313 /*
314 * In debug mode poison constrained degrees of freedom and precomputed
315 * values:
316 */
317 Vectors::debug_poison_constrained_dofs<Description>(state_vector,
318 offline_data_);
319 Vectors::debug_poison_precomputed_values<Description>(state_vector,
320 offline_data_);
321
322 unsigned int cycle = 1;
323 Number last_terminal_output = (terminal_update_interval_ == Number(0.)
324 ? std::numeric_limits<Number>::max()
325 : std::numeric_limits<Number>::lowest());
326
327 /*
328 * The honorable main loop:
329 */
330
331 print_info("entering main loop");
332 computing_timer_["time loop"].start();
333
334 constexpr Number relax =
335 Number(1.) - Number(10.) * std::numeric_limits<Number>::epsilon();
336
337 for (;; ++cycle) {
338
339#ifdef DEBUG_OUTPUT
340 std::cout << "\n\n### cycle = " << cycle << " ###\n\n" << std::endl;
341#endif
342
343 /* Accumulate quantities of interest: */
344
345 if (enable_compute_quantities_) {
346 Scope scope(computing_timer_,
347 "time step [X] - accumulate quantities");
348 quantities_.accumulate(state_vector, t);
349 }
350
351 /* Perform various tasks whenever we reach a timer tick: */
352
353 if (t >= relax * timer_cycle * timer_granularity_) {
354 if (enable_compute_error_) {
355 StateVector analytic;
356 {
357 /*
358 * FIXME: We interpolate the analytic solution at every timer
359 * tick. If we happen to actually not output anything then this
360 * is terribly inefficient...
361 */
362 Scope scope(computing_timer_,
363 "time step [X] - interpolate analytic solution");
364 Vectors::reinit_state_vector<Description>(analytic, offline_data_);
365 std::get<0>(analytic) =
366 initial_values_.get().interpolate_hyperbolic_vector(t);
367 }
368
369 /*
370 * FIXME: a call to output() will also write a checkpoint (if
371 * enabled). So as a workaround we simply call the output()
372 * function for the analytic solution first...
373 */
374 output(analytic,
375 base_name_ensemble_ + "-analytic_solution",
376 t,
377 timer_cycle);
378 }
379
380 output(state_vector, base_name_ensemble_ + "-solution", t, timer_cycle);
381
382 if (enable_compute_quantities_ &&
383 (timer_cycle % timer_compute_quantities_multiplier_ == 0)) {
384 Scope scope(computing_timer_,
385 "time step [X] - write out quantities");
386 quantities_.write_out(state_vector, t, timer_cycle);
387 }
388
389 ++timer_cycle;
390 }
391
392 /* Break if we have reached the final time. */
393
394 if (t >= relax * t_final_)
395 break;
396
397 /* Peform a mesh adaptation cycle: */
398
399 if (enable_mesh_adaptivity_) {
400 {
401 Scope scope(computing_timer_,
402 "time step [X] - analyze for mesh adaptation");
403
404 mesh_adaptor_.analyze(state_vector, t, cycle);
405 }
406
407 if (mesh_adaptor_.need_mesh_adaptation()) {
408 Scope scope(computing_timer_, "(re)initialize data structures");
409 print_info("performing mesh adaptation");
410
411 hyperbolic_module_.prepare_state_vector(state_vector, t);
412 adapt_mesh_and_transfer_state_vector(state_vector,
413 prepare_compute_kernels);
414 }
415 }
416
417 /* Perform a time step: */
418
419 const auto tau = time_integrator_.step(
420 state_vector,
421 t,
422 enforce_t_final_
423 ? std::min(t_final_, timer_cycle * timer_granularity_)
424 : std::numeric_limits<Number>::max());
425
426 t += tau;
427
428 /* Print and record cycle statistics: */
429 if (terminal_update_interval_ != Number(0.)) {
430
431 /* Do we need to update the log file? */
432 const bool write_to_log_file =
433 (t >= relax * timer_cycle * timer_granularity_);
434
435 /* Do we need to update the terminal? */
436 const auto wall_time = computing_timer_["time loop"].wall_time();
437 int update_terminal =
438 (wall_time >= last_terminal_output + terminal_update_interval_);
439
440 /* Broadcast boolean from rank 0 to all other ranks: */
441 const auto ierr = MPI_Bcast(&update_terminal,
442 1,
443 MPI_INT,
444 0,
445 mpi_ensemble_.world_communicator());
446 AssertThrowMPI(ierr);
447
448 if (write_to_log_file || update_terminal) {
449 print_cycle_statistics(
450 cycle, t, timer_cycle, /*logfile*/ write_to_log_file);
451 last_terminal_output = wall_time;
452 }
453 }
454 } /* end of loop */
455
456 /* We have actually performed one cycle less. */
457 --cycle;
458
459 computing_timer_["time loop"].stop();
460
461 if (terminal_update_interval_ != Number(0.)) {
462 /* Write final timing statistics to screen and logfile: */
463 print_cycle_statistics(
464 cycle, t, timer_cycle, /*logfile*/ true, /*final*/ true);
465 }
466
467 if (enable_compute_error_) {
468 /* Output final error: */
469 compute_error(state_vector, t);
470 }
471
472 if (mpi_ensemble_.world_rank() == 0 && debug_filename_ != "") {
473 std::ifstream f(debug_filename_);
474 if (f.is_open())
475 std::cout << f.rdbuf();
476 }
477
478#ifdef WITH_VALGRIND
479 CALLGRIND_DUMP_STATS;
480#endif
481 }
482
483
484 template <typename Description, int dim, typename Number>
485 template <typename Callable>
487 StateVector &state_vector,
488 const std::string &base_name,
489 Number &t,
490 unsigned int &output_cycle,
491 const Callable &prepare_compute_kernels)
492 {
493#ifdef DEBUG_OUTPUT
494 std::cout << "TimeLoop<dim, Number>::read_checkpoint()" << std::endl;
495#endif
496
497 AssertThrow(have_distributed_triangulation<dim>,
498 dealii::ExcMessage(
499 "read_checkpoint() is not implemented for "
500 "distributed::shared::Triangulation which we use in 1D"));
501
502 /*
503 * Initialize discretization, read in the mesh, and initialize everything:
504 */
505
506#if !DEAL_II_VERSION_GTE(9, 6, 0)
507 if constexpr (have_distributed_triangulation<dim>) {
508#endif
509 discretization_.refinement() = 0; /* do not refine */
510 discretization_.prepare(base_name);
511 discretization_.triangulation().load(base_name + "-checkpoint.mesh");
512#if !DEAL_II_VERSION_GTE(9, 6, 0)
513 }
514#endif
515
516 prepare_compute_kernels();
517
518 /*
519 * Read in and broadcast metadata:
520 */
521
522 std::string name = base_name + "-checkpoint";
523
524 unsigned int transfer_handle;
525 if (mpi_ensemble_.ensemble_rank() == 0) {
526 std::string meta = name + ".metadata";
527
528 std::ifstream file(meta, std::ios::binary);
529 boost::archive::binary_iarchive ia(file);
530 ia >> t >> output_cycle >> transfer_handle;
531 }
532
533 int ierr;
534 if constexpr (std::is_same_v<Number, double>)
535 ierr = MPI_Bcast(
536 &t, 1, MPI_DOUBLE, 0, mpi_ensemble_.ensemble_communicator());
537 else
538 ierr =
539 MPI_Bcast(&t, 1, MPI_FLOAT, 0, mpi_ensemble_.ensemble_communicator());
540 AssertThrowMPI(ierr);
541
542 ierr = MPI_Bcast(&output_cycle,
543 1,
544 MPI_UNSIGNED,
545 0,
546 mpi_ensemble_.ensemble_communicator());
547 AssertThrowMPI(ierr);
548
549 ierr = MPI_Bcast(&transfer_handle,
550 1,
551 MPI_UNSIGNED,
552 0,
553 mpi_ensemble_.ensemble_communicator());
554 AssertThrowMPI(ierr);
555
556 /* Now read in the state vector: */
557
558 Vectors::reinit_state_vector<Description>(state_vector, offline_data_);
559
560 solution_transfer_.set_handle(transfer_handle);
561 solution_transfer_.project(state_vector);
562 solution_transfer_.reset_handle();
563 }
564
565
566 template <typename Description, int dim, typename Number>
568 const StateVector &state_vector,
569 const std::string &base_name,
570 const Number &t,
571 const unsigned int &output_cycle)
572 {
573#ifdef DEBUG_OUTPUT
574 std::cout << "TimeLoop<dim, Number>::write_checkpoint()" << std::endl;
575#endif
576
577 AssertThrow(have_distributed_triangulation<dim>,
578 dealii::ExcMessage(
579 "write_checkpoint() is not implemented for "
580 "distributed::shared::Triangulation which we use in 1D"));
581
582 /* We need hyperbolic_module.prepare_state_vector() prior to this call! */
583 solution_transfer_.prepare_projection(state_vector);
584 const auto transfer_handle = solution_transfer_.get_handle();
585 solution_transfer_.reset_handle();
586
587 std::string name = base_name + "-checkpoint";
588
589 if (mpi_ensemble_.ensemble_rank() == 0) {
590 for (const std::string suffix :
591 {".mesh", ".mesh_fixed.data", ".mesh.info", ".metadata"})
592 if (std::filesystem::exists(name + suffix))
593 std::filesystem::rename(name + suffix, name + suffix + "~");
594 }
595
596#if !DEAL_II_VERSION_GTE(9, 6, 0)
597 if constexpr (have_distributed_triangulation<dim>) {
598#endif
599 const auto &triangulation = discretization_.triangulation();
600 triangulation.save(name + ".mesh");
601#if !DEAL_II_VERSION_GTE(9, 6, 0)
602 }
603#endif
604
605 /*
606 * Now, write out metadata on rank 0:
607 */
608
609 if (mpi_ensemble_.ensemble_rank() == 0) {
610 std::string meta = name + ".metadata";
611 std::ofstream file(meta, std::ios::binary | std::ios::trunc);
612 boost::archive::binary_oarchive oa(file);
613 oa << t << output_cycle << transfer_handle;
614 }
615
616 const int ierr = MPI_Barrier(mpi_ensemble_.ensemble_communicator());
617 AssertThrowMPI(ierr);
618 }
619
620
621 template <typename Description, int dim, typename Number>
622 template <typename Callable>
624 StateVector &state_vector, const Callable &prepare_compute_kernels)
625 {
626#ifdef DEBUG_OUTPUT
627 std::cout << "TimeLoop<dim, Number>::adapt_mesh_and_transfer_state_vector()"
628 << std::endl;
629#endif
630
631 AssertThrow(mpi_ensemble_.n_ensembles() == 1, dealii::ExcNotImplemented());
632
633 /*
634 * Mark cells for coarsening and refinement and set up triangulation:
635 */
636
637 auto &triangulation = discretization_.triangulation();
638 mesh_adaptor_.mark_cells_for_coarsening_and_refinement(triangulation);
639
640 triangulation.prepare_coarsening_and_refinement();
641
642 /* We need hyperbolic_module.prepare_state_vector() prior to this call! */
643 solution_transfer_.prepare_projection(state_vector);
644
645 /* Execute mesh adaptation and project old state to new state vector: */
646
647 triangulation.execute_coarsening_and_refinement();
648 prepare_compute_kernels();
649
650 Vectors::reinit_state_vector<Description>(state_vector, offline_data_);
651 solution_transfer_.project(state_vector);
652 solution_transfer_.reset_handle();
653 }
654
655
656 template <typename Description, int dim, typename Number>
657 void
659 const Number t)
660 {
661#ifdef DEBUG_OUTPUT
662 std::cout << "TimeLoop<dim, Number>::compute_error()" << std::endl;
663#endif
664
665 hyperbolic_module_.prepare_state_vector(state_vector, t);
666
667 Vector<Number> difference_per_cell(
668 discretization_.triangulation().n_active_cells());
669
670 Number linf_norm = 0.;
671 Number l1_norm = 0;
672 Number l2_norm = 0;
673
674 const auto analytic_U =
675 initial_values_.get().interpolate_hyperbolic_vector(t);
676 const auto &U = std::get<0>(state_vector);
677
678 ScalarVector analytic_component;
679 ScalarVector error_component;
680 analytic_component.reinit(offline_data_.scalar_partitioner());
681 error_component.reinit(offline_data_.scalar_partitioner());
682
683 /* Loop over all selected components: */
684 for (const auto &entry : error_quantities_) {
685 const auto &names = View::component_names;
686 const auto pos = std::find(std::begin(names), std::end(names), entry);
687 if (pos == std::end(names)) {
688 AssertThrow(
689 false,
690 dealii::ExcMessage("Unknown component name »" + entry + "«"));
691 __builtin_trap();
692 }
693
694 const auto index = std::distance(std::begin(names), pos);
695
696 analytic_U.extract_component(analytic_component, index);
697
698 /* Compute norms of analytic solution: */
699
700 Number linf_norm_analytic = 0.;
701 Number l1_norm_analytic = 0.;
702 Number l2_norm_analytic = 0.;
703
704 if (error_normalize_) {
705 linf_norm_analytic =
706 Utilities::MPI::max(analytic_component.linfty_norm(),
707 mpi_ensemble_.ensemble_communicator());
708
709 VectorTools::integrate_difference(
710 offline_data_.dof_handler(),
711 analytic_component,
712 Functions::ZeroFunction<dim, Number>(),
713 difference_per_cell,
714 QGauss<dim>(3),
715 VectorTools::L1_norm);
716
717 l1_norm_analytic =
718 Utilities::MPI::sum(difference_per_cell.l1_norm(),
719 mpi_ensemble_.ensemble_communicator());
720
721 VectorTools::integrate_difference(
722 offline_data_.dof_handler(),
723 analytic_component,
724 Functions::ZeroFunction<dim, Number>(),
725 difference_per_cell,
726 QGauss<dim>(3),
727 VectorTools::L2_norm);
728
729 l2_norm_analytic = Number(std::sqrt(
730 Utilities::MPI::sum(std::pow(difference_per_cell.l2_norm(), 2),
731 mpi_ensemble_.ensemble_communicator())));
732 }
733
734 /* Compute norms of error: */
735
736 U.extract_component(error_component, index);
737 /* Populate constrained dofs due to periodicity: */
738 offline_data_.affine_constraints().distribute(error_component);
739 error_component.update_ghost_values();
740 error_component -= analytic_component;
741
742 const Number linf_norm_error = Utilities::MPI::max(
743 error_component.linfty_norm(), mpi_ensemble_.ensemble_communicator());
744
745 VectorTools::integrate_difference(offline_data_.dof_handler(),
746 error_component,
747 Functions::ZeroFunction<dim, Number>(),
748 difference_per_cell,
749 QGauss<dim>(3),
750 VectorTools::L1_norm);
751
752 const Number l1_norm_error = Utilities::MPI::sum(
753 difference_per_cell.l1_norm(), mpi_ensemble_.ensemble_communicator());
754
755 VectorTools::integrate_difference(offline_data_.dof_handler(),
756 error_component,
757 Functions::ZeroFunction<dim, Number>(),
758 difference_per_cell,
759 QGauss<dim>(3),
760 VectorTools::L2_norm);
761
762 const Number l2_norm_error = Number(std::sqrt(
763 Utilities::MPI::sum(std::pow(difference_per_cell.l2_norm(), 2),
764 mpi_ensemble_.ensemble_communicator())));
765
766 if (error_normalize_) {
767 linf_norm += linf_norm_error / linf_norm_analytic;
768 l1_norm += l1_norm_error / l1_norm_analytic;
769 l2_norm += l2_norm_error / l2_norm_analytic;
770 } else {
771 linf_norm += linf_norm_error;
772 l1_norm += l1_norm_error;
773 l2_norm += l2_norm_error;
774 }
775 }
776
777 if (mpi_ensemble_.ensemble_rank() != 0)
778 return;
779
780 /*
781 * Sum up over all participating MPI ranks. Note: we only perform this
782 * operation on "peer" ranks zero:
783 */
784
785 if (mpi_ensemble_.n_ensembles() > 1) {
786 linf_norm = Utilities::MPI::sum(
787 linf_norm, mpi_ensemble_.ensemble_leader_communicator());
788 l1_norm = Utilities::MPI::sum(
789 l1_norm, mpi_ensemble_.ensemble_leader_communicator());
790 l2_norm = Utilities::MPI::sum(
791 l2_norm, mpi_ensemble_.ensemble_leader_communicator());
792 }
793
794 if (mpi_ensemble_.world_rank() != 0)
795 return;
796
797 logfile_ << std::endl << "Computed errors:" << std::endl << std::endl;
798 logfile_ << std::setprecision(16);
799
800 std::string description =
801 error_normalize_ ? "Normalized consolidated" : "Consolidated";
802
803 logfile_ << description + " Linf, L1, and L2 errors at final time \n";
804 logfile_ << std::setprecision(16);
805 logfile_ << "#dofs = " << n_global_dofs_ << std::endl;
806 logfile_ << "t = " << t << std::endl;
807 logfile_ << "Linf = " << linf_norm << std::endl;
808 logfile_ << "L1 = " << l1_norm << std::endl;
809 logfile_ << "L2 = " << l2_norm << std::endl;
810
811 std::cout << description + " Linf, L1, and L2 errors at final time \n";
812 std::cout << std::setprecision(16);
813 std::cout << "#dofs = " << n_global_dofs_ << std::endl;
814 std::cout << "t = " << t << std::endl;
815 std::cout << "Linf = " << linf_norm << std::endl;
816 std::cout << "L1 = " << l1_norm << std::endl;
817 std::cout << "L2 = " << l2_norm << std::endl;
818 }
819
820
821 template <typename Description, int dim, typename Number>
823 const std::string &name,
824 const Number t,
825 const unsigned int cycle)
826 {
827#ifdef DEBUG_OUTPUT
828 std::cout << "TimeLoop<dim, Number>::output(t = " << t << ")" << std::endl;
829#endif
830
831 const bool do_full_output =
832 (cycle % timer_output_full_multiplier_ == 0) && enable_output_full_;
833 const bool do_levelsets =
834 (cycle % timer_output_levelsets_multiplier_ == 0) &&
835 enable_output_levelsets_;
836 const bool do_checkpointing =
837 (cycle % timer_checkpoint_multiplier_ == 0) && enable_checkpointing_;
838
839 /* There is nothing to do: */
840 if (!(do_full_output || do_levelsets || do_checkpointing))
841 return;
842
843 hyperbolic_module_.prepare_state_vector(state_vector, t);
844
845 /* Data output: */
846 if (do_full_output || do_levelsets) {
847 Scope scope(computing_timer_, "time step [X] - perform vtu output");
848 print_info("scheduling output");
849
850 postprocessor_.compute(state_vector);
851 /*
852 * Workaround: Manually reset bounds during the first output cycle
853 * (which is often just a uniform flow field) to obtain a better
854 * normailization:
855 */
856 if (cycle == 0)
857 postprocessor_.reset_bounds();
858
859 vtu_output_.schedule_output(
860 state_vector, name, t, cycle, do_full_output, do_levelsets);
861 }
862
863 /* Checkpointing: */
864 if (do_checkpointing) {
865 Scope scope(computing_timer_, "time step [X] - perform checkpointing");
866 print_info("scheduling checkpointing");
867 write_checkpoint(state_vector, base_name_ensemble_, t, cycle);
868 }
869 }
870
871
872 /*
873 * Output and logging related functions:
874 */
875
876
877 template <typename Description, int dim, typename Number>
878 void
880 {
881 if (mpi_ensemble_.world_rank() != 0)
882 return;
883
884 /* Output commit and library information: */
885
887
888 /* Print run time parameters: */
889
890 stream << std::endl << "Run time parameters:" << std::endl << std::endl;
891 ParameterAcceptor::prm.print_parameters(
892 stream, ParameterHandler::OutputStyle::ShortPRM);
893 stream << std::endl;
894
895 /* Also print out parameters to a prm file: */
896
897 std::ofstream output(base_name_ + "-parameters.prm");
898 ParameterAcceptor::prm.print_parameters(output, ParameterHandler::ShortPRM);
899 }
900
901
902 template <typename Description, int dim, typename Number>
903 void
905 {
906 /*
907 * Fixme: this conversion to double is really not elegant. We should
908 * improve the Utilities::MPI::min_max_avg function in deal.II to
909 * handle different data types
910 */
911
912 // NOLINTBEGIN
913 std::vector<double> values = {
914 (double)offline_data_.n_export_indices(),
915 (double)offline_data_.n_locally_internal(),
916 (double)offline_data_.n_locally_owned(),
917 (double)offline_data_.n_locally_relevant(),
918 (double)offline_data_.n_export_indices() /
919 (double)offline_data_.n_locally_relevant(),
920 (double)offline_data_.n_locally_internal() /
921 (double)offline_data_.n_locally_relevant(),
922 (double)offline_data_.n_locally_owned() /
923 (double)offline_data_.n_locally_relevant()};
924 // NOLINTEND
925
926 const auto data =
927 Utilities::MPI::min_max_avg(values, mpi_ensemble_.world_communicator());
928
929 if (mpi_ensemble_.world_rank() != 0)
930 return;
931
932 std::ostringstream output;
933
934 unsigned int n =
935 dealii::Utilities::needed_digits(mpi_ensemble_.n_world_ranks());
936
937 const auto print_snippet = [&output, n](const std::string &name,
938 const auto &values) {
939 output << name << ": ";
940 // NOLINTBEGIN
941 output << std::setw(9) << (unsigned int)values.min //
942 << " [p" << std::setw(n) << values.min_index << "] " //
943 << std::setw(9) << (unsigned int)values.avg << " " //
944 << std::setw(9) << (unsigned int)values.max //
945 << " [p" << std::setw(n) << values.max_index << "]"; //
946 // NOLINTEND
947 };
948
949 const auto print_percentages = [&output, n](const auto &percentages) {
950 output << std::endl << " ";
951 output << " (" << std::setw(3) << std::setprecision(2)
952 << percentages.min * 100 << "% )"
953 << " [p" << std::setw(n) << percentages.min_index << "] "
954 << " (" << std::setw(3) << std::setprecision(2)
955 << percentages.avg * 100 << "% )"
956 << " "
957 << " (" << std::setw(3) << std::setprecision(2)
958 << percentages.max * 100 << "% )"
959 << " [p" << std::setw(n) << percentages.max_index << "]";
960 };
961
962 output << std::endl << std::endl << "Partition: ";
963 print_snippet("exp", data[0]);
964 print_percentages(data[4]);
965
966 output << std::endl << " ";
967 print_snippet("int", data[1]);
968 print_percentages(data[5]);
969
970 output << std::endl << " ";
971 print_snippet("own", data[2]);
972 print_percentages(data[6]);
973
974 output << std::endl << " ";
975 print_snippet("rel", data[3]);
976
977 stream << output.str() << std::endl;
978 }
979
980
981 template <typename Description, int dim, typename Number>
983 std::ostream &stream)
984 {
985 Utilities::System::MemoryStats stats;
986 Utilities::System::get_memory_stats(stats);
987
988 Utilities::MPI::MinMaxAvg data = Utilities::MPI::min_max_avg(
989 stats.VmRSS / 1024., mpi_ensemble_.world_communicator());
990
991 if (mpi_ensemble_.world_rank() != 0)
992 return;
993
994 std::ostringstream output;
995
996 unsigned int n =
997 dealii::Utilities::needed_digits(mpi_ensemble_.n_world_ranks());
998
999 output << "\nMemory: [MiB]" //
1000 << std::setw(8) << data.min //
1001 << " [p" << std::setw(n) << data.min_index << "] " //
1002 << std::setw(8) << data.avg << " " //
1003 << std::setw(8) << data.max //
1004 << " [p" << std::setw(n) << data.max_index << "]"; //
1005
1006 stream << output.str() << std::endl;
1007 }
1008
1009
1010 template <typename Description, int dim, typename Number>
1012 {
1013 std::vector<std::ostringstream> output(computing_timer_.size());
1014
1015 const auto equalize = [&]() {
1016 const auto ptr =
1017 std::max_element(output.begin(),
1018 output.end(),
1019 [](const auto &left, const auto &right) {
1020 return left.str().length() < right.str().length();
1021 });
1022 const auto length = ptr->str().length();
1023 for (auto &it : output)
1024 it << std::string(length - it.str().length() + 1, ' ');
1025 };
1026
1027 const auto print_wall_time = [&](auto &timer, auto &stream) {
1028 const auto wall_time = Utilities::MPI::min_max_avg(
1029 timer.wall_time(), mpi_ensemble_.world_communicator());
1030
1031 constexpr auto eps = std::numeric_limits<double>::epsilon();
1032 /*
1033 * Cut off at 99.9% to avoid silly percentages cluttering up the
1034 * output.
1035 */
1036 const auto skew_negative = std::max(
1037 100. * (wall_time.min - wall_time.avg) / wall_time.avg - eps, -99.9);
1038 const auto skew_positive = std::min(
1039 100. * (wall_time.max - wall_time.avg) / wall_time.avg + eps, 99.9);
1040
1041 stream << std::setprecision(2) << std::fixed << std::setw(8)
1042 << wall_time.avg << "s [sk: " << std::setprecision(1)
1043 << std::setw(5) << std::fixed << skew_negative << "%/"
1044 << std::setw(4) << std::fixed << skew_positive << "%]";
1045 unsigned int n =
1046 dealii::Utilities::needed_digits(mpi_ensemble_.n_world_ranks());
1047 stream << " [p" << std::setw(n) << wall_time.min_index << "/"
1048 << wall_time.max_index << "]";
1049 };
1050
1051 const auto cpu_time_statistics =
1052 Utilities::MPI::min_max_avg(computing_timer_["time loop"].cpu_time(),
1053 mpi_ensemble_.world_communicator());
1054 const double total_cpu_time = cpu_time_statistics.sum;
1055
1056 const auto print_cpu_time =
1057 [&](auto &timer, auto &stream, bool percentage) {
1058 const auto cpu_time = Utilities::MPI::min_max_avg(
1059 timer.cpu_time(), mpi_ensemble_.world_communicator());
1060
1061 stream << std::setprecision(2) << std::fixed << std::setw(9)
1062 << cpu_time.sum << "s ";
1063
1064 if (percentage)
1065 stream << "(" << std::setprecision(1) << std::setw(4)
1066 << 100. * cpu_time.sum / total_cpu_time << "%)";
1067 };
1068
1069 auto jt = output.begin();
1070 for (auto &it : computing_timer_)
1071 *jt++ << " " << it.first;
1072 equalize();
1073
1074 jt = output.begin();
1075 for (auto &it : computing_timer_)
1076 print_wall_time(it.second, *jt++);
1077 equalize();
1078
1079 jt = output.begin();
1080 bool compute_percentages = false;
1081 for (auto &it : computing_timer_) {
1082 print_cpu_time(it.second, *jt++, compute_percentages);
1083 if (it.first.starts_with("time loop"))
1084 compute_percentages = true;
1085 }
1086 equalize();
1087
1088 if (mpi_ensemble_.world_rank() != 0)
1089 return;
1090
1091 stream << std::endl << "Timer statistics:\n";
1092 for (auto &it : output)
1093 stream << it.str() << std::endl;
1094 }
1095
1096
1097 template <typename Description, int dim, typename Number>
1099 unsigned int cycle, Number t, std::ostream &stream, bool final_time)
1100 {
1101 /*
1102 * Fixme: The global state kept in this function should be refactored
1103 * into its own class object.
1104 */
1105 static struct Data {
1106 unsigned int cycle = 0;
1107 double t = 0.;
1108 double cpu_time_sum = 0.;
1109 double cpu_time_avg = 0.;
1110 double cpu_time_min = 0.;
1111 double cpu_time_max = 0.;
1112 double wall_time = 0.;
1113 } previous, current;
1114
1115 static double time_per_second_exp = 0.;
1116
1117 /* Update statistics: */
1118
1119 {
1120 previous = current;
1121
1122 current.cycle = cycle;
1123 current.t = t;
1124
1125 const auto wall_time_statistics =
1126 Utilities::MPI::min_max_avg(computing_timer_["time loop"].wall_time(),
1127 mpi_ensemble_.world_communicator());
1128 current.wall_time = wall_time_statistics.max;
1129
1130 const auto cpu_time_statistics =
1131 Utilities::MPI::min_max_avg(computing_timer_["time loop"].cpu_time(),
1132 mpi_ensemble_.world_communicator());
1133 current.cpu_time_sum = cpu_time_statistics.sum;
1134 current.cpu_time_avg = cpu_time_statistics.avg;
1135 current.cpu_time_min = cpu_time_statistics.min;
1136 current.cpu_time_max = cpu_time_statistics.max;
1137 }
1138
1139 if (final_time)
1140 previous = Data();
1141
1142 /* Take averages: */
1143
1144 double delta_cycles = current.cycle - previous.cycle;
1145 const double cycles_per_second =
1146 delta_cycles / (current.wall_time - previous.wall_time);
1147
1148 const auto efficiency = time_integrator_.efficiency();
1149 const auto n_dofs = static_cast<double>(n_global_dofs_);
1150
1151 const double wall_m_dofs_per_sec =
1152 delta_cycles * n_dofs / 1.e6 /
1153 (current.wall_time - previous.wall_time) * efficiency;
1154
1155 double cpu_m_dofs_per_sec = delta_cycles * n_dofs / 1.e6 /
1156 (current.cpu_time_sum - previous.cpu_time_sum) *
1157 efficiency;
1158#ifdef WITH_OPENMP
1159 if (terminal_show_rank_throughput_)
1160 cpu_m_dofs_per_sec *= MultithreadInfo::n_threads();
1161#endif
1162
1163 double cpu_time_skew = (current.cpu_time_max - current.cpu_time_min - //
1164 previous.cpu_time_max + previous.cpu_time_min) /
1165 delta_cycles;
1166 /* avoid printing small negative numbers: */
1167 cpu_time_skew = std::max(0., cpu_time_skew);
1168
1169 const double cpu_time_skew_percentage =
1170 cpu_time_skew * delta_cycles /
1171 (current.cpu_time_avg - previous.cpu_time_avg);
1172
1173 const double delta_time =
1174 (current.t - previous.t) / (current.cycle - previous.cycle);
1175 const double time_per_second =
1176 (current.t - previous.t) / (current.wall_time - previous.wall_time);
1177
1178 /* Print Jean-Luc and Martin metrics: */
1179
1180 std::ostringstream output;
1181
1182 /* clang-format off */
1183 output << std::endl;
1184
1185 output << "Throughput:\n "
1186 << (terminal_show_rank_throughput_? "RANK: " : "CPU : ")
1187 << std::setprecision(4) << std::fixed << cpu_m_dofs_per_sec
1188 << " MQ/s ("
1189 << std::scientific << 1. / cpu_m_dofs_per_sec * 1.e-6
1190 << " s/Qdof/substep)" << std::endl;
1191
1192 output << " [cpu time skew: "
1193 << std::setprecision(2) << std::scientific << cpu_time_skew
1194 << "s/cycle ("
1195 << std::setprecision(1) << std::setw(4) << std::setfill(' ') << std::fixed
1196 << 100. * cpu_time_skew_percentage
1197 << "%)]" << std::endl;
1198
1199 output << " WALL: "
1200 << std::setprecision(4) << std::fixed << wall_m_dofs_per_sec
1201 << " MQ/s ("
1202 << std::scientific << 1. / wall_m_dofs_per_sec * 1.e-6
1203 << " s/Qdof/substep) ("
1204 << std::setprecision(2) << std::fixed << cycles_per_second
1205 << " cycles/s)" << std::endl;
1206
1207 const auto &scheme = time_integrator_.time_stepping_scheme();
1208 output << " [ "
1209 << Patterns::Tools::Convert<TimeSteppingScheme>::to_string(scheme)
1210 << " with CFL = "
1211 << std::setprecision(2) << std::fixed << hyperbolic_module_.cfl()
1212 << " ("
1213 << std::setprecision(0) << std::fixed << hyperbolic_module_.n_restarts()
1214 << "/"
1215 << std::setprecision(0) << std::fixed << parabolic_module_.n_restarts()
1216 << " rsts) ("
1217 << std::setprecision(0) << std::fixed << hyperbolic_module_.n_warnings()
1218 << "/"
1219 << std::setprecision(0) << std::fixed << parabolic_module_.n_warnings()
1220 << " warn) ("
1221 << std::setprecision(0) << std::fixed << hyperbolic_module_.n_corrections()
1222 << "/"
1223 << std::setprecision(0) << std::fixed << parabolic_module_.n_corrections()
1224 << " corr) ]" << std::endl;
1225
1226 if constexpr (!ParabolicSystem::is_identity)
1227 parabolic_module_.print_solver_statistics(output);
1228
1229 output << " [ dt = "
1230 << std::scientific << std::setprecision(2) << delta_time
1231 << " ( "
1232 << time_per_second
1233 << " dt/s) ]" << std::endl;
1234 /* clang-format on */
1235
1236 /* and print an ETA */
1237 time_per_second_exp = 0.8 * time_per_second_exp + 0.2 * time_per_second;
1238 auto eta = static_cast<unsigned int>(std::max(t_final_ - t, Number(0.)) /
1239 time_per_second_exp);
1240
1241 output << "\n ETA : ";
1242
1243 const unsigned int days = eta / (24 * 3600);
1244 if (days > 0) {
1245 output << days << " d ";
1246 eta %= 24 * 3600;
1247 }
1248
1249 const unsigned int hours = eta / 3600;
1250 if (hours > 0) {
1251 output << hours << " h ";
1252 eta %= 3600;
1253 }
1254
1255 const unsigned int minutes = eta / 60;
1256 output << minutes << " min";
1257
1258 if (mpi_ensemble_.world_rank() != 0)
1259 return;
1260
1261 stream << output.str() << std::endl;
1262 }
1263
1264
1265 template <typename Description, int dim, typename Number>
1267 {
1268 if (mpi_ensemble_.world_rank() != 0)
1269 return;
1270
1271 std::cout << "[INFO] " << header << std::endl;
1272 }
1273
1274
1275 template <typename Description, int dim, typename Number>
1276 void
1278 const std::string &secondary,
1279 std::ostream &stream)
1280 {
1281 if (mpi_ensemble_.world_rank() != 0)
1282 return;
1283
1284 const int header_size = header.size();
1285 const auto padded_header =
1286 std::string(std::max(0, 34 - header_size) / 2, ' ') + header +
1287 std::string(std::max(0, 35 - header_size) / 2, ' ');
1288
1289 const int secondary_size = secondary.size();
1290 const auto padded_secondary =
1291 std::string(std::max(0, 34 - secondary_size) / 2, ' ') + secondary +
1292 std::string(std::max(0, 35 - secondary_size) / 2, ' ');
1293
1294 /* clang-format off */
1295 stream << "\n";
1296 stream << " ####################################################\n";
1297 stream << " #########" << padded_header << "#########\n";
1298 stream << " #########" << padded_secondary << "#########\n";
1299 stream << " ####################################################\n";
1300 stream << std::endl;
1301 /* clang-format on */
1302 }
1303
1304
1305 template <typename Description, int dim, typename Number>
1307 unsigned int cycle,
1308 Number t,
1309 unsigned int timer_cycle,
1310 bool write_to_logfile,
1311 bool final_time)
1312 {
1313 static const std::string vectorization_name = [] {
1314 constexpr auto width = VectorizedArray<Number>::size();
1315
1316 std::string result;
1317 if (width == 1)
1318 result = "scalar ";
1319 else
1320 result = std::to_string(width * 8 * sizeof(Number)) + " bit packed ";
1321
1322 if constexpr (std::is_same_v<Number, double>)
1323 return result + "double";
1324 else if constexpr (std::is_same_v<Number, float>)
1325 return result + "float";
1326 else
1327 __builtin_trap();
1328 }();
1329
1330 std::ostringstream output;
1331
1332 std::ostringstream primary;
1333 if (final_time) {
1334 primary << "FINAL (cycle " << Utilities::int_to_string(cycle, 6) << ")";
1335 } else {
1336 primary << "Cycle " << Utilities::int_to_string(cycle, 6) //
1337 << " (" << std::fixed << std::setprecision(1) //
1338 << t / t_final_ * 100 << "%)";
1339 }
1340
1341 std::ostringstream secondary;
1342 secondary << "at time t = " << std::setprecision(8) << std::fixed << t;
1343
1344 print_head(primary.str(), secondary.str(), output);
1345
1346 output << "Information: (HYP) " << hyperbolic_system_.get().problem_name;
1347 if constexpr (!ParabolicSystem::is_identity) {
1348 output << "\n (PAR) " << parabolic_system_.get().problem_name;
1349 }
1350 output << "\n [" << base_name_ << "] ";
1351 if (mpi_ensemble_.n_ensembles() > 1) {
1352 output << mpi_ensemble_.n_ensembles() << " ensembles ";
1353 }
1354 output << "with " //
1355 << n_global_dofs_ << " Qdofs on " //
1356 << mpi_ensemble_.n_world_ranks() << " ranks / " //
1357#ifdef WITH_OPENMP
1358 << MultithreadInfo::n_threads() << " threads <" //
1359#else
1360 << "[openmp disabled] <" //
1361#endif
1362 << vectorization_name //
1363 << ">\n Last output cycle " //
1364 << timer_cycle - 1 //
1365 << " at t = " << timer_granularity_ * (timer_cycle - 1) //
1366 << " (terminal update interval " << terminal_update_interval_ //
1367 << "s)\n";
1368
1369 print_memory_statistics(output);
1370 print_timers(output);
1371 print_throughput(cycle, t, output, final_time);
1372
1373 if (mpi_ensemble_.world_rank() == 0) {
1374#ifndef DEBUG_OUTPUT
1375 std::cout << "\033[2J\033[H";
1376#endif
1377 std::cout << output.str() << std::flush;
1378
1379 if (write_to_logfile) {
1380 logfile_ << "\n" << output.str() << std::flush;
1381 }
1382 }
1383 }
1384
1385} // namespace ryujin
void write_checkpoint(const StateVector &state_vector, const std::string &base_name, const Number &t, const unsigned int &output_cycle)
Vectors::ScalarVector< Number > ScalarVector
Definition: time_loop.h:63
void print_timers(std::ostream &stream)
void output(StateVector &state_vector, const std::string &name, const Number t, const unsigned int cycle)
void print_memory_statistics(std::ostream &stream)
void print_mpi_partition(std::ostream &stream)
void print_parameters(std::ostream &stream)
void compute_error(StateVector &state_vector, Number t)
void read_checkpoint(StateVector &state_vector, const std::string &base_name, Number &t, unsigned int &output_cycle, const Callable &prepare_compute_kernels)
TimeLoop(const MPI_Comm &mpi_comm)
typename View::StateVector StateVector
Definition: time_loop.h:61
void print_head(const std::string &header, const std::string &secondary, std::ostream &stream)
void print_throughput(unsigned int cycle, Number t, std::ostream &stream, bool final_time=false)
void print_cycle_statistics(unsigned int cycle, Number t, unsigned int output_cycle, bool write_to_logfile=false, bool final_time=false)
void print_info(const std::string &header)
void adapt_mesh_and_transfer_state_vector(StateVector &state_vector, const Callable &prepare_compute_kernels)
T pow(const T x, const T b)
void print_revision_and_version(std::ostream &stream)