diff --git a/doc/modules/changes/20250916_gassmoeller b/doc/modules/changes/20250916_gassmoeller deleted file mode 100644 index f24b737249c..00000000000 --- a/doc/modules/changes/20250916_gassmoeller +++ /dev/null @@ -1,7 +0,0 @@ -Fixed: ASPECT used several features that could fail in MPI -communication in case an assert was triggered. The model -would end up in a communication deadlock (a model that hangs -without output) instead of correctly crashing and producing -an error message. This was fixed. -
-(Rene Gassmoeller, 2025/09/16) diff --git a/include/aspect/compat.h b/include/aspect/compat.h index ead5c2e4cb9..efdbdeebabf 100644 --- a/include/aspect/compat.h +++ b/include/aspect/compat.h @@ -23,6 +23,7 @@ #include #include +#include // C++11 related includes. #include @@ -444,6 +445,51 @@ namespace aspect const double outer_radius); #endif + + /** + * A replacement class for TimerOutput::Scope that should avoid + * the deadlocking issues we have had for the latter. + * + * This class is modeled after the pattern used in deal.II's + * TimerOutput::Scope class but really just calls TimerOutput::enter_scope() + * in the constructor and TimerOutput::leave_scope() in the destructor whereas + * TimerOutput::Scope also checks whether there are pending exceptions + * in the destructor and only calls leave_scope() if there are not. + */ + class TimerScope + { + public: + /** + * Constructor that calls TimerOutput::enter_scope() with the given scope name. + */ + TimerScope(dealii::TimerOutput &timer_, + const std::string §ion_name_) + : timer(timer_) + , section_name(section_name_) + { + timer.enter_subsection(section_name); + } + + /** + * Destructor that calls TimerOutput::leave_scope(). + */ + ~TimerScope() + { + timer.leave_subsection(section_name); + } + + private: + /** + * Reference to the TimerOutput object + */ + dealii::TimerOutput &timer; + + /** + * Name of the section we need to exit + */ + const std::string section_name; + }; + } #endif diff --git a/source/mesh_deformation/fastscape.cc b/source/mesh_deformation/fastscape.cc index 3ea51b9f10a..bf2e9cf1b89 100644 --- a/source/mesh_deformation/fastscape.cc +++ b/source/mesh_deformation/fastscape.cc @@ -316,7 +316,7 @@ namespace aspect if (this->get_timestep_number() == 0) return; - this->get_computing_timer().enter_subsection("FastScape plugin"); + TimerScope timer_section(this->get_computing_timer(), "FastScape plugin"); const unsigned int current_timestep = this->get_timestep_number (); const double aspect_timestep_in_years = this->get_timestep() / year_in_seconds; @@ -890,7 +890,8 @@ namespace aspect Assert (Utilities::MPI::this_mpi_process(this->get_mpi_communicator()) == 0, ExcInternalError()); - this->get_computing_timer().enter_subsection("Execute FastScape"); + + TimerScope timer_section(this->get_computing_timer(), "Execute FastScape"); // Because on the first timestep we will create an initial VTK file before running FastScape // and a second after, we first set the visualization step to zero. @@ -1004,8 +1005,6 @@ namespace aspect #endif } } - - this->get_computing_timer().leave_subsection("Execute FastScape"); } diff --git a/source/mesh_deformation/interface.cc b/source/mesh_deformation/interface.cc index d1da84c7df6..65f3b01ab1d 100644 --- a/source/mesh_deformation/interface.cc +++ b/source/mesh_deformation/interface.cc @@ -563,7 +563,7 @@ namespace aspect { AssertThrow(sim.parameters.mesh_deformation_enabled, ExcInternalError()); - this->get_computing_timer().enter_subsection("Mesh deformation"); + TimerScope timer (sim.computing_timer, "Mesh deformation"); old_mesh_displacements = mesh_displacements; @@ -584,8 +584,6 @@ namespace aspect // After changing the mesh we need to rebuild things sim.rebuild_stokes_matrix = sim.rebuild_stokes_preconditioner = true; - - this->get_computing_timer().leave_subsection("Mesh deformation"); } @@ -1560,15 +1558,13 @@ namespace aspect if (this->simulator_is_past_initialization() == false || this->get_timestep_number() == 0) { - this->get_computing_timer().enter_subsection("Mesh deformation initialize"); + TimerScope timer (sim.computing_timer, "Mesh deformation initialize"); make_initial_constraints(); if (this->is_stokes_matrix_free()) compute_mesh_displacements_gmg(); else compute_mesh_displacements(); - - this->get_computing_timer().leave_subsection("Mesh deformation initialize"); } if (this->is_stokes_matrix_free()) diff --git a/source/particle/manager.cc b/source/particle/manager.cc index a1824757e20..76e305b3b99 100644 --- a/source/particle/manager.cc +++ b/source/particle/manager.cc @@ -131,9 +131,9 @@ namespace aspect Particles::ParticleHandler &to_particle_handler) const { { - this->get_computing_timer().enter_subsection("Particles: Copy"); + TimerScope timer_section(this->get_computing_timer(), "Particles: Copy"); + to_particle_handler.copy_from(from_particle_handler); - this->get_computing_timer().leave_subsection("Particles: Copy"); } } @@ -829,9 +829,8 @@ namespace aspect void Manager::generate_particles() { - this->get_computing_timer().enter_subsection("Particles: Generate"); + TimerScope timer_section(this->get_computing_timer(), "Particles: Generate"); generator->generate_particles(*particle_handler); - this->get_computing_timer().leave_subsection("Particles: Generate"); } @@ -843,7 +842,7 @@ namespace aspect // TODO: Change this loop over all cells to use the WorkStream interface if (property_manager->get_n_property_components() > 0) { - this->get_computing_timer().enter_subsection("Particles: Initialize properties"); + TimerScope timer_section(this->get_computing_timer(), "Particles: Initialize properties"); particle_handler->get_property_pool().reserve(2 * particle_handler->n_locally_owned_particles()); @@ -854,12 +853,9 @@ namespace aspect if (dealii::Utilities::MPI::n_mpi_processes(this->get_mpi_communicator()) > 1) { - this->get_computing_timer().enter_subsection("Particles: Exchange ghosts"); + TimerScope timer_section(this->get_computing_timer(), "Particles: Exchange ghosts"); particle_handler->exchange_ghost_particles(); - this->get_computing_timer().leave_subsection("Particles: Exchange ghosts"); } - - this->get_computing_timer().leave_subsection("Particles: Initialize properties"); } } @@ -873,7 +869,7 @@ namespace aspect if (property_manager->get_n_property_components() > 0) { - this->get_computing_timer().enter_subsection("Particles: Update properties"); + TimerScope timer_section(this->get_computing_timer(), "Particles: Update properties"); Assert(dealii::internal::FEPointEvaluation::is_fast_path_supported(this->get_mapping()) == true, ExcMessage("The particle system was optimized for deal.II mappings that support the fast evaluation path " @@ -922,8 +918,6 @@ namespace aspect } } - - this->get_computing_timer().leave_subsection("Particles: Update properties"); } } @@ -935,7 +929,7 @@ namespace aspect { { // TODO: Change this loop over all cells to use the WorkStream interface - this->get_computing_timer().enter_subsection("Particles: Advect"); + TimerScope timer_section(this->get_computing_timer(), "Particles: Advect"); Assert(dealii::internal::FEPointEvaluation::is_fast_path_supported(this->get_mapping()) == true, ExcMessage("The particle system was optimized for deal.II mappings that support the fast evaluation path " @@ -961,16 +955,12 @@ namespace aspect *evaluator); } } - - this->get_computing_timer().leave_subsection("Particles: Advect"); } { - this->get_computing_timer().enter_subsection("Particles: Sort"); + TimerScope timer_section(this->get_computing_timer(), "Particles: Sort"); // Find the cells that the particles moved to particle_handler->sort_particles_into_subdomains_and_cells(); - - this->get_computing_timer().leave_subsection("Particles: Sort"); } } @@ -998,9 +988,8 @@ namespace aspect // ghost particles. if (dealii::Utilities::MPI::n_mpi_processes(this->get_mpi_communicator()) > 1) { - this->get_computing_timer().enter_subsection("Particles: Exchange ghosts"); + TimerScope timer_section(this->get_computing_timer(), "Particles: Exchange ghosts"); particle_handler->exchange_ghost_particles(); - this->get_computing_timer().leave_subsection("Particles: Exchange ghosts"); } this->get_pcout() << " done." << std::endl; } @@ -1325,7 +1314,7 @@ namespace aspect } - this->get_computing_timer().enter_subsection("Particles: Initialization"); + TimerScope timer_section(this->get_computing_timer(), "Particles: Initialization"); // Create a generator object depending on what the parameters specify generator = Generator::create_particle_generator (prm); @@ -1359,7 +1348,6 @@ namespace aspect interpolator->parse_parameters(prm); interpolator->initialize(); - this->get_computing_timer().leave_subsection("Particles: Initialization"); } prm.leave_subsection (); } diff --git a/source/postprocess/current_surface.cc b/source/postprocess/current_surface.cc index 2e1875f7714..98b6091fed8 100644 --- a/source/postprocess/current_surface.cc +++ b/source/postprocess/current_surface.cc @@ -48,7 +48,7 @@ namespace aspect AssertThrow(dim==2, ExcMessage("Depth with mesh deformation currently only works with a 2D model.")); - this->get_computing_timer().enter_subsection("Geometry model surface update"); + TimerScope timer_section(this->get_computing_timer(), "Geometry model surface update"); // loop over all of the surface cells and save the elevation to a stored value. // This needs to be sent to 1 processor, sorted, and broadcast so that every processor knows the entire surface. @@ -129,8 +129,6 @@ namespace aspect // Create a surface function for the elevations. surface_function = std::make_unique>(coordinates, data_table); - this->get_computing_timer().leave_subsection("Geometry model surface update"); - return std::make_pair ("Storing deformed surface topography: ", "Done"); } diff --git a/source/simulator/assembly.cc b/source/simulator/assembly.cc index ec0199a692a..c8b723d54b4 100644 --- a/source/simulator/assembly.cc +++ b/source/simulator/assembly.cc @@ -472,7 +472,7 @@ namespace aspect else AssertThrow(false, ExcNotImplemented()); - computing_timer.enter_subsection("Build Stokes preconditioner"); + TimerScope timer (computing_timer, "Build Stokes preconditioner"); pcout << " Rebuilding Stokes preconditioner..." << std::flush; // first assemble the raw matrices necessary for the preconditioner @@ -588,8 +588,6 @@ namespace aspect rebuild_stokes_preconditioner = false; pcout << std::endl; - - computing_timer.leave_subsection("Build Stokes preconditioner"); } @@ -772,7 +770,8 @@ namespace aspect timer_section_name += " rhs"; } - computing_timer.enter_subsection(timer_section_name); + TimerScope timer (computing_timer, + timer_section_name); if (rebuild_stokes_matrix == true) system_matrix = 0; @@ -892,8 +891,6 @@ namespace aspect // record that we have just rebuilt the matrix rebuild_stokes_matrix = false; - - computing_timer.leave_subsection(timer_section_name); } @@ -904,9 +901,9 @@ namespace aspect LinearAlgebra::PreconditionILU &preconditioner, const double diagonal_strengthening) { - computing_timer.enter_subsection(advection_field.is_temperature() ? - "Build temperature preconditioner" : - "Build composition preconditioner"); + TimerScope timer (computing_timer, (advection_field.is_temperature() ? + "Build temperature preconditioner" : + "Build composition preconditioner")); const unsigned int block_idx = advection_field.block_index(introspection); @@ -915,10 +912,6 @@ namespace aspect data.ilu_atol = diagonal_strengthening; preconditioner.initialize (system_matrix.block(block_idx, block_idx), data); - - computing_timer.leave_subsection(advection_field.is_temperature() ? - "Build temperature preconditioner" : - "Build composition preconditioner"); } @@ -1222,9 +1215,9 @@ namespace aspect template void Simulator::assemble_advection_system (const AdvectionField &advection_field) { - computing_timer.enter_subsection(advection_field.is_temperature() ? - "Assemble temperature system" : - "Assemble composition system"); + TimerScope timer (computing_timer, (advection_field.is_temperature() ? + "Assemble temperature system" : + "Assemble composition system")); const unsigned int block_idx = advection_field.block_index(introspection); const unsigned int sparsity_block_idx = advection_field.sparsity_pattern_block_index(introspection); @@ -1331,10 +1324,6 @@ namespace aspect system_matrix.compress(VectorOperation::add); system_rhs.compress(VectorOperation::add); - - computing_timer.leave_subsection(advection_field.is_temperature() ? - "Assemble temperature system" : - "Assemble composition system"); } } diff --git a/source/simulator/checkpoint_restart.cc b/source/simulator/checkpoint_restart.cc index 82150ec7974..b6635a368d8 100644 --- a/source/simulator/checkpoint_restart.cc +++ b/source/simulator/checkpoint_restart.cc @@ -251,7 +251,7 @@ namespace aspect template void Simulator::create_snapshot() { - computing_timer.enter_subsection("Create snapshot"); + TimerScope timer (computing_timer, "Create snapshot"); // Take elapsed time from timer so that we can serialize it: total_walltime_until_last_snapshot += wall_timer.wall_time(); @@ -387,8 +387,6 @@ namespace aspect } pcout << "*** Snapshot " << checkpoint_path << " created!" << std::endl << std::endl; - - computing_timer.leave_subsection("Create snapshot"); } diff --git a/source/simulator/core.cc b/source/simulator/core.cc index 15a42e05329..163ecbacbee 100644 --- a/source/simulator/core.cc +++ b/source/simulator/core.cc @@ -270,7 +270,7 @@ namespace aspect } // now that we have output set up, we can start timer sections - computing_timer.enter_subsection("Initialization"); + TimerScope timer (computing_timer, "Initialization"); // if any plugin wants access to the Simulator by deriving from SimulatorAccess, initialize it and @@ -590,8 +590,6 @@ namespace aspect // now that all member variables have been set up, also // connect the functions that will actually do the assembly set_assemblers(); - - computing_timer.leave_subsection("Initialization"); } @@ -657,14 +655,12 @@ namespace aspect // constraints. Of course we need to force assembly too. if (rebuild_sparsity_and_matrices) { - computing_timer.enter_subsection("Setup matrices"); + TimerScope timer (computing_timer, "Setup matrices"); rebuild_sparsity_and_matrices = false; setup_system_matrix (introspection.index_sets.system_partitioning); setup_system_preconditioner (introspection.index_sets.system_partitioning); rebuild_stokes_matrix = rebuild_stokes_preconditioner = true; - - computing_timer.leave_subsection("Setup matrices"); } // notify different system components that we started the next time step @@ -1472,7 +1468,7 @@ namespace aspect { signals.edit_parameters_pre_setup_dofs(*this, parameters); - computing_timer.enter_subsection("Setup dof systems"); + TimerScope timer (computing_timer, "Setup dof systems"); dof_handler.distribute_dofs(finite_element); @@ -1581,8 +1577,6 @@ namespace aspect // Setup matrix-free dofs if (stokes_matrix_free) stokes_matrix_free->setup_dofs(); - - computing_timer.leave_subsection("Setup dof systems"); } @@ -1655,7 +1649,7 @@ namespace aspect void Simulator::postprocess () { - computing_timer.enter_subsection("Postprocessing"); + TimerScope timer (computing_timer, "Postprocessing"); pcout << " Postprocessing:" << std::endl; // run all the postprocessing routines and then write @@ -1689,8 +1683,6 @@ namespace aspect // finally, write the entire set of current results to disk output_statistics(); - - computing_timer.leave_subsection("Postprocessing"); } @@ -1715,7 +1707,7 @@ namespace aspect { - computing_timer.enter_subsection("Refine mesh structure, part 1"); + TimerScope timer (computing_timer, "Refine mesh structure, part 1"); Vector estimated_error_per_cell (triangulation.n_active_cells()); mesh_refinement_manager.execute (estimated_error_per_cell); @@ -1815,7 +1807,6 @@ namespace aspect if (!mesh_changed) { pcout << "Skipping mesh refinement, because the mesh did not change.\n" << std::endl; - computing_timer.leave_subsection("Refine mesh structure, part 1"); return; } @@ -1827,14 +1818,12 @@ namespace aspect triangulation.execute_coarsening_and_refinement (); if (MappingQCache *map = dynamic_cast*>(&(*mapping))) map->initialize(MappingQGeneric(4), triangulation); - - computing_timer.leave_subsection("Refine mesh structure, part 1"); } // leave the timed section setup_dofs (); { - computing_timer.enter_subsection("Refine mesh structure, part 2"); + TimerScope timer (computing_timer, "Refine mesh structure, part 2"); LinearAlgebra::BlockVector distributed_system; LinearAlgebra::BlockVector old_distributed_system; @@ -1919,8 +1908,6 @@ namespace aspect // calculate global volume after refining mesh global_volume = GridTools::volume (triangulation, *mapping); - - computing_timer.leave_subsection("Refine mesh structure, part 2"); } } @@ -2193,7 +2180,7 @@ namespace aspect if (parameters.resume_computation == false) { - computing_timer.enter_subsection("Setup initial conditions"); + TimerScope timer (computing_timer, "Setup initial conditions"); timestep_number = 0; time_step = old_time_step = 0; @@ -2212,8 +2199,6 @@ namespace aspect signals.post_set_initial_state (*this); } - - computing_timer.leave_subsection("Setup initial conditions"); } // Start the principal loop over time steps. At this point, everything diff --git a/source/simulator/helper_functions.cc b/source/simulator/helper_functions.cc index 67bec4ae0b6..0b8e6cae405 100644 --- a/source/simulator/helper_functions.cc +++ b/source/simulator/helper_functions.cc @@ -1607,7 +1607,7 @@ namespace aspect if (time_step == 0) return; - computing_timer.enter_subsection("Solve composition reactions"); + TimerScope timer (computing_timer, "Solve composition reactions"); // we need some temporary vectors to store our updates to composition and temperature in // while we do the time stepping, before we copy them over to the solution vector in the end @@ -1914,8 +1914,6 @@ namespace aspect << average_iteration_count << " substep(s)." << std::endl; - - computing_timer.leave_subsection("Solve composition reactions"); } diff --git a/source/simulator/initial_conditions.cc b/source/simulator/initial_conditions.cc index 25e9bf6f577..56028456892 100644 --- a/source/simulator/initial_conditions.cc +++ b/source/simulator/initial_conditions.cc @@ -253,7 +253,7 @@ namespace aspect template void Simulator::interpolate_particle_properties (const std::vector &advection_fields) { - computing_timer.enter_subsection("Particles: Interpolate"); + TimerScope timer (computing_timer, "Particles: Interpolate"); // below, we would want to call VectorTools::interpolate on the // entire FESystem. there currently is no way to restrict the @@ -473,7 +473,6 @@ namespace aspect Assert (particle_solution.block(b).l2_norm() == 0, ExcInternalError()); - computing_timer.leave_subsection("Particles: Interpolate"); } diff --git a/source/simulator/solver.cc b/source/simulator/solver.cc index ceba95be9b1..3d96409221d 100644 --- a/source/simulator/solver.cc +++ b/source/simulator/solver.cc @@ -444,10 +444,9 @@ namespace aspect // first build without diagonal strengthening: build_advection_preconditioner(advection_field, preconditioner, 0.); - computing_timer.enter_subsection(advection_field.is_temperature() ? - "Solve temperature system" : - "Solve composition system"); - + TimerScope timer (computing_timer, (advection_field.is_temperature() ? + "Solve temperature system" : + "Solve composition system")); if (advection_field.is_temperature()) { pcout << " Solving temperature system... " << std::flush; @@ -549,11 +548,6 @@ namespace aspect ))) { apply_limiter_to_dg_solutions(advection_field); - - computing_timer.leave_subsection(advection_field.is_temperature() ? - "Solve temperature system" : - "Solve composition system"); - // by applying the limiter we have modified the solution to no longer // satisfy the equation. Therefore the residual is meaningless and cannot // converge to zero in nonlinear iterations. Disable residual computation @@ -561,10 +555,6 @@ namespace aspect return 0.0; } - computing_timer.leave_subsection(advection_field.is_temperature() ? - "Solve temperature system" : - "Solve composition system"); - return initial_residual; } @@ -574,7 +564,7 @@ namespace aspect std::pair Simulator::solve_stokes (LinearAlgebra::BlockVector &solution_vector) { - computing_timer.enter_subsection("Solve Stokes system"); + TimerScope timer (computing_timer, "Solve Stokes system"); const std::string name = [&]() -> std::string { @@ -951,8 +941,6 @@ namespace aspect if (parameters.include_melt_transport) melt_handler->compute_melt_variables(system_matrix,solution_vector,system_rhs); - computing_timer.leave_subsection("Solve Stokes system"); - return {outputs.initial_nonlinear_residual, outputs.final_linear_residual }; diff --git a/source/simulator/solver/stokes_matrix_free_local_smoothing.cc b/source/simulator/solver/stokes_matrix_free_local_smoothing.cc index 9df74f2001b..c806921b5a7 100644 --- a/source/simulator/solver/stokes_matrix_free_local_smoothing.cc +++ b/source/simulator/solver/stokes_matrix_free_local_smoothing.cc @@ -1984,15 +1984,13 @@ namespace aspect template void StokesMatrixFreeHandlerLocalSmoothingImplementation::build_preconditioner() { - this->get_computing_timer().enter_subsection("Build Stokes preconditioner"); + TimerScope timer (this->get_computing_timer(), "Build Stokes preconditioner"); for (unsigned int level=0; level < this->get_triangulation().n_global_levels(); ++level) { mg_matrices_Schur_complement[level].compute_diagonal(); mg_matrices_A_block[level].compute_diagonal(); } - - this->get_computing_timer().leave_subsection("Build Stokes preconditioner"); } diff --git a/source/simulator/solver_schemes.cc b/source/simulator/solver_schemes.cc index e86aa22216d..715ba840e9f 100644 --- a/source/simulator/solver_schemes.cc +++ b/source/simulator/solver_schemes.cc @@ -154,7 +154,7 @@ namespace aspect // outputs into the prescribed field before we assemble and solve the equation if (parameters.temperature_method == Parameters::AdvectionFieldMethod::prescribed_field_with_diffusion) { - computing_timer.enter_subsection("Interpolate prescribed temperature"); + TimerScope timer (computing_timer, "Interpolate prescribed temperature"); interpolate_material_output_into_advection_field({adv_field}); @@ -162,8 +162,6 @@ namespace aspect // solution is the one that is used to assemble the diffusion system in // assemble_advection_system() for this solver scheme. old_solution.block(adv_field.block_index(introspection)) = solution.block(adv_field.block_index(introspection)); - - computing_timer.leave_subsection("Interpolate prescribed temperature"); } assemble_advection_system (adv_field); @@ -179,7 +177,7 @@ namespace aspect { const AdvectionField adv_field (AdvectionField::temperature()); - computing_timer.enter_subsection("Interpolate prescribed temperature"); + TimerScope timer (computing_timer, "Interpolate prescribed temperature"); interpolate_material_output_into_advection_field({adv_field}); @@ -190,8 +188,6 @@ namespace aspect adv_field.compositional_variable, dummy); - computing_timer.leave_subsection("Interpolate prescribed temperature"); - break; } @@ -277,7 +273,7 @@ namespace aspect // outputs into the prescribed field before we assemble and solve the equation if (method == Parameters::AdvectionFieldMethod::prescribed_field_with_diffusion) { - computing_timer.enter_subsection("Interpolate prescribed composition"); + TimerScope timer (computing_timer, "Interpolate prescribed composition"); interpolate_material_output_into_advection_field({adv_field}); @@ -285,8 +281,6 @@ namespace aspect // solution is the one that is used to assemble the diffusion system in // assemble_advection_system() for this solver scheme. old_solution.block(adv_field.block_index(introspection)) = solution.block(adv_field.block_index(introspection)); - - computing_timer.leave_subsection("Interpolate prescribed composition"); } assemble_advection_system (adv_field); @@ -379,7 +373,7 @@ namespace aspect if (fields_interpolated_from_material_output.size() > 0) { - computing_timer.enter_subsection("Interpolate prescribed composition"); + TimerScope timer (computing_timer, "Interpolate prescribed composition"); interpolate_material_output_into_advection_field(fields_interpolated_from_material_output); @@ -392,8 +386,6 @@ namespace aspect adv_field.compositional_variable, dummy); } - - computing_timer.leave_subsection("Interpolate prescribed composition"); } if (fields_advected_by_particles.size() > 0) @@ -954,7 +946,7 @@ namespace aspect assemble_and_solve_composition(); { - computing_timer.enter_subsection("Interpolate Stokes solution"); + TimerScope timer (computing_timer, "Interpolate Stokes solution"); // Assign Stokes solution LinearAlgebra::BlockVector distributed_stokes_solution (introspection.index_sets.system_partitioning, mpi_communicator); @@ -986,7 +978,6 @@ namespace aspect solution.block(block_p_f) = distributed_stokes_solution.block(block_p_f); } - computing_timer.leave_subsection("Interpolate Stokes solution"); } if (parameters.run_postprocessors_on_nonlinear_iterations) @@ -1236,7 +1227,7 @@ namespace aspect // Assign Stokes solution { - TimerOutput::Scope timer (computing_timer, "Interpolate Stokes solution"); + TimerScope timer (computing_timer, "Interpolate Stokes solution"); LinearAlgebra::BlockVector distributed_stokes_solution (introspection.index_sets.system_partitioning, mpi_communicator); diff --git a/source/volume_of_fluid/handler.cc b/source/volume_of_fluid/handler.cc index 06b34bb7886..3895e76231f 100644 --- a/source/volume_of_fluid/handler.cc +++ b/source/volume_of_fluid/handler.cc @@ -538,7 +538,7 @@ namespace aspect const unsigned int dir, const bool update_from_old) { - this->get_computing_timer().enter_subsection("Assemble volume of fluid system"); + TimerScope timer (sim.computing_timer, "Assemble volume of fluid system"); const unsigned int block0_idx = field_struct_for_field_index(0).volume_fraction.block_index; const unsigned int block_idx = field.volume_fraction.block_index; @@ -597,8 +597,6 @@ namespace aspect sim.system_matrix.compress(VectorOperation::add); sim.system_rhs.compress(VectorOperation::add); - - this->get_computing_timer().leave_subsection("Assemble volume of fluid system"); } diff --git a/source/volume_of_fluid/reconstruct.cc b/source/volume_of_fluid/reconstruct.cc index 2e11dc882b5..ecca602214f 100644 --- a/source/volume_of_fluid/reconstruct.cc +++ b/source/volume_of_fluid/reconstruct.cc @@ -34,7 +34,7 @@ namespace aspect LinearAlgebra::BlockVector initial_solution; - this->get_computing_timer().enter_subsection("Reconstruct VolumeOfFluid interfaces"); + TimerScope timer (sim.computing_timer, "Reconstruct VolumeOfFluid interfaces"); initial_solution.reinit(sim.system_rhs, false); @@ -413,8 +413,6 @@ namespace aspect solution.block(volume_of_fluidN_blockidx) = initial_solution.block(volume_of_fluidN_blockidx); solution.block(volume_of_fluidLS_blockidx) = initial_solution.block(volume_of_fluidLS_blockidx); - - this->get_computing_timer().leave_subsection("Reconstruct VolumeOfFluid interfaces"); } @@ -434,7 +432,7 @@ namespace aspect LinearAlgebra::BlockVector initial_solution; - this->get_computing_timer().enter_subsection("Compute VolumeOfFluid compositions"); + TimerScope timer (sim.computing_timer, "Compute VolumeOfFluid compositions"); initial_solution.reinit(sim.system_rhs, false); @@ -505,8 +503,6 @@ namespace aspect const unsigned int blockidx = composition_field.block_index(this->introspection()); solution.block(blockidx) = initial_solution.block(blockidx); - - this->get_computing_timer().leave_subsection("Compute VolumeOfFluid compositions"); } diff --git a/source/volume_of_fluid/solver.cc b/source/volume_of_fluid/solver.cc index 45e8b4d8054..9cdb4158f6c 100644 --- a/source/volume_of_fluid/solver.cc +++ b/source/volume_of_fluid/solver.cc @@ -33,7 +33,7 @@ namespace aspect { const unsigned int block_idx = field.volume_fraction.block_index; - this->get_computing_timer().enter_subsection("Solve volume of fluid system"); + TimerScope timer (sim.computing_timer, "Solve volume of fluid system"); this->get_pcout() << " Solving volume of fluid system... " << std::flush; const double tolerance = std::max(1e-50, @@ -91,8 +91,6 @@ namespace aspect // Do not add VolumeOfFluid solver iterations to statistics, duplication due to // dimensional splitting results in incorrect line formatting (lines of // data split inconsistently with missing values) - - this->get_computing_timer().leave_subsection("Solve volume of fluid system"); } }