From 1afaedc66b46a7ec5840ec5f63e2f38f8d68db41 Mon Sep 17 00:00:00 2001 From: Laura Prieto Saavedra Date: Thu, 4 Jul 2024 17:37:11 -0400 Subject: [PATCH 1/8] Add more sections for time output --- source/solvers/gls_navier_stokes.cc | 10 +++++++ source/solvers/mf_navier_stokes.cc | 41 ++++++++++++++++++++++------ source/solvers/navier_stokes_base.cc | 20 +++++++------- 3 files changed, 52 insertions(+), 19 deletions(-) diff --git a/source/solvers/gls_navier_stokes.cc b/source/solvers/gls_navier_stokes.cc index 3a80a54445..a8ae497edc 100644 --- a/source/solvers/gls_navier_stokes.cc +++ b/source/solvers/gls_navier_stokes.cc @@ -1123,6 +1123,8 @@ GLSNavierStokesSolver::set_initial_condition_fd( Parameters::InitialConditionType initial_condition_type, bool restart) { + TimerOutput::Scope t(this->computing_timer, "Set initial conditions"); + if (restart) { this->pcout << "************************" << std::endl; @@ -1608,7 +1610,15 @@ GLSNavierStokesSolver::solve_system_GMRES(const bool initial_step, << solver_control.last_value() << std::endl; } } + + this->computing_timer.enter_subsection( + "Distribute constraints after linear solve"); + constraints_used.distribute(completely_distributed_solution); + + this->computing_timer.leave_subsection( + "Distribute constraints after linear solve"); + auto &newton_update = this->newton_update; newton_update = completely_distributed_solution; success = true; diff --git a/source/solvers/mf_navier_stokes.cc b/source/solvers/mf_navier_stokes.cc index e558ab60da..17ec03c5d4 100644 --- a/source/solvers/mf_navier_stokes.cc +++ b/source/solvers/mf_navier_stokes.cc @@ -1456,6 +1456,8 @@ template void MFNavierStokesSolver::solve() { + this->computing_timer.enter_subsection("Read mesh and manifolds"); + read_mesh_and_manifolds( *this->triangulation, this->simulation_parameters.mesh, @@ -1463,6 +1465,8 @@ MFNavierStokesSolver::solve() this->simulation_parameters.restart_parameters.restart, this->simulation_parameters.boundary_conditions); + this->computing_timer.leave_subsection("Read mesh and manifolds"); + this->setup_dofs(); this->set_initial_condition( this->simulation_parameters.initial_condition->type, @@ -1503,11 +1507,17 @@ MFNavierStokesSolver::solve() if (is_bdf(this->simulation_control->get_assembly_method())) { + this->computing_timer.enter_subsection( + "Calculate time derivative previous solutions"); + calculate_time_derivative_previous_solutions(); this->time_derivative_previous_solutions.update_ghost_values(); this->system_operator->evaluate_time_derivative_previous_solutions( this->time_derivative_previous_solutions); + this->computing_timer.leave_subsection( + "Calculate time derivative previous solutions"); + if (this->simulation_parameters.flow_control.enable_flow_control) this->system_operator->update_beta_force( this->flow_control.get_beta()); @@ -1702,6 +1712,8 @@ MFNavierStokesSolver::set_initial_condition_fd( Parameters::InitialConditionType initial_condition_type, bool restart) { + TimerOutput::Scope t(this->computing_timer, "Set initial conditions"); + if (restart) { this->pcout << "************************" << std::endl; @@ -1933,9 +1945,7 @@ void MFNavierStokesSolver::assemble_system_matrix() { // Required for compilation but not used for matrix free solvers. - this->computing_timer.enter_subsection("Assemble matrix"); - - this->computing_timer.leave_subsection("Assemble matrix"); + TimerOutput::Scope t(this->computing_timer, "Assemble matrix"); } template @@ -1959,6 +1969,9 @@ template void MFNavierStokesSolver::update_multiphysics_time_average_solution() { + TimerOutput::Scope t(this->computing_timer, + "Update multiphysics average solution"); + if (this->simulation_parameters.post_processing.calculate_average_velocities) { TrilinosWrappers::MPI::Vector temp_average_velocities( @@ -1996,7 +2009,7 @@ template void MFNavierStokesSolver::setup_GMG() { - this->computing_timer.enter_subsection("Setup GMG"); + TimerOutput::Scope t(this->computing_timer, "Setup GMG"); if (!gmg_preconditioner) gmg_preconditioner = std::make_shared>( @@ -2013,15 +2026,13 @@ MFNavierStokesSolver::setup_GMG() this->flow_control, this->present_solution, this->time_derivative_previous_solutions); - - this->computing_timer.leave_subsection("Setup GMG"); } template void MFNavierStokesSolver::setup_ILU() { - this->computing_timer.enter_subsection("Setup ILU"); + TimerOutput::Scope t(this->computing_timer, "Setup ILU"); int current_preconditioner_fill_level = this->simulation_parameters.linear_solver.at(PhysicsID::fluid_dynamics) @@ -2039,8 +2050,6 @@ MFNavierStokesSolver::setup_ILU() ilu_preconditioner->initialize(system_operator->get_system_matrix(), preconditionerOptions); - - this->computing_timer.leave_subsection("Setup ILU"); } @@ -2085,6 +2094,9 @@ template void MFNavierStokesSolver::update_solutions_for_multiphysics() { + TimerOutput::Scope t(this->computing_timer, + "Update solutions for multiphysics"); + // Provide the fluid dynamics dof_handler to the multiphysics interface this->multiphysics->set_dof_handler(PhysicsID::fluid_dynamics, &this->dof_handler); @@ -2301,9 +2313,14 @@ void MFNavierStokesSolver::setup_preconditioner() { this->present_solution.update_ghost_values(); + + this->computing_timer.enter_subsection("Evaluate non linear term and tau"); + this->system_operator->evaluate_non_linear_term_and_calculate_tau( this->present_solution); + this->computing_timer.leave_subsection("Evaluate non linear term and tau"); + if (this->simulation_parameters.linear_solver.at(PhysicsID::fluid_dynamics) .preconditioner == Parameters::LinearSolver::PreconditionerType::ilu) setup_ILU(); @@ -2444,7 +2461,13 @@ MFNavierStokesSolver::solve_system_GMRES(const bool initial_step, << solver_control.last_value() << std::endl; } + this->computing_timer.enter_subsection( + "Distribute constraints after linear solve"); + constraints_used.distribute(this->newton_update); + + this->computing_timer.leave_subsection( + "Distribute constraints after linear solve"); } template class MFNavierStokesSolver<2>; diff --git a/source/solvers/navier_stokes_base.cc b/source/solvers/navier_stokes_base.cc index cb241c36f7..75c40c34f0 100644 --- a/source/solvers/navier_stokes_base.cc +++ b/source/solvers/navier_stokes_base.cc @@ -520,6 +520,9 @@ NavierStokesBase::finish_time_step() if (simulation_parameters.simulation_control.method != Parameters::SimulationControl::TimeSteppingMethod::steady) { + TimerOutput::Scope t(this->computing_timer, + "Calculate CFL and percolate time vectors"); + percolate_time_vectors_fd(); const double CFL = calculate_CFL(this->dof_handler, this->present_solution, @@ -1202,8 +1205,9 @@ template void NavierStokesBase::postprocess_fd(bool firstIter) { - auto &present_solution = this->present_solution; + TimerOutput::Scope t(this->computing_timer, "Postprocessing"); + auto &present_solution = this->present_solution; // Enstrophy if (this->simulation_parameters.post_processing.calculate_enstrophy) @@ -1341,8 +1345,7 @@ NavierStokesBase::postprocess_fd(bool firstIter) if (this->simulation_parameters.post_processing.calculate_kinetic_energy) { - TimerOutput::Scope t(this->computing_timer, "kinetic_energy_calculation"); - double kE = calculate_kinetic_energy(this->dof_handler, + double kE = calculate_kinetic_energy(this->dof_handler, present_solution, *this->cell_quadrature, *this->mapping); @@ -1375,9 +1378,7 @@ NavierStokesBase::postprocess_fd(bool firstIter) // Calculate apparent viscosity if (this->simulation_parameters.post_processing.calculate_apparent_viscosity) { - TimerOutput::Scope t(this->computing_timer, - "apparent_viscosity_calculation"); - double apparent_viscosity = calculate_apparent_viscosity( + double apparent_viscosity = calculate_apparent_viscosity( this->dof_handler, this->present_solution, *this->cell_quadrature, @@ -1416,8 +1417,7 @@ NavierStokesBase::postprocess_fd(bool firstIter) // Calculate pressure drop between two boundaries if (this->simulation_parameters.post_processing.calculate_pressure_drop) { - TimerOutput::Scope t(this->computing_timer, "pressure_drop_calculation"); - double pressure_drop, total_pressure_drop; + double pressure_drop, total_pressure_drop; std::tie(pressure_drop, total_pressure_drop) = calculate_pressure_drop( this->dof_handler, *this->mapping, @@ -1475,8 +1475,6 @@ NavierStokesBase::postprocess_fd(bool firstIter) simulation_control->get_current_time()); this->flow_rate_table.set_scientific("time", true); - TimerOutput::Scope t(this->computing_timer, "flow_rate_calculation"); - if (this->simulation_parameters.post_processing.verbosity == Parameters::Verbosity::verbose) { @@ -2610,6 +2608,8 @@ void NavierStokesBase::output_newton_update_norms( const unsigned int display_precision) { + TimerOutput::Scope t(this->computing_timer, "Output Newton update norms"); + if constexpr (std::is_same_v || std::is_same_v>) From 3695b8bcd68ffadd4f69c43b92f83e482cff413c Mon Sep 17 00:00:00 2001 From: Laura Prieto Saavedra Date: Thu, 4 Jul 2024 17:45:48 -0400 Subject: [PATCH 2/8] Update multiphysics solutions only if necessary --- source/solvers/mf_navier_stokes.cc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/source/solvers/mf_navier_stokes.cc b/source/solvers/mf_navier_stokes.cc index 17ec03c5d4..274264047f 100644 --- a/source/solvers/mf_navier_stokes.cc +++ b/source/solvers/mf_navier_stokes.cc @@ -1471,7 +1471,10 @@ MFNavierStokesSolver::solve() this->set_initial_condition( this->simulation_parameters.initial_condition->type, this->simulation_parameters.restart_parameters.restart); - this->update_multiphysics_time_average_solution(); + + // Only needed if other physics apart from fluid dynamics are enabled. + if (this->multiphysics->get_active_physics().size() > 1) + this->update_multiphysics_time_average_solution(); while (this->simulation_control->integrate()) { @@ -1524,8 +1527,10 @@ MFNavierStokesSolver::solve() } // Provide the fluid dynamics dof_handler, present solution and previous - // solution to the multiphysics interface - update_solutions_for_multiphysics(); + // solution to the multiphysics interface only if other physics + // apart from fluid dynamics are enabled + if (this->multiphysics->get_active_physics().size() > 1) + update_solutions_for_multiphysics(); this->iterate(); this->postprocess(false); @@ -1673,8 +1678,10 @@ MFNavierStokesSolver::setup_dofs_fd() this->locally_relevant_dofs, this->mpi_communicator); - // Provide relevant solution to multiphysics interface - update_solutions_for_multiphysics(); + // Provide relevant solution to multiphysics interface only if other physics + // apart from fluid dynamics are enabled. + if (this->multiphysics->get_active_physics().size() > 1) + update_solutions_for_multiphysics(); } template From a6f4d71a4f25f22169c7e16f1d4fd15967010ef0 Mon Sep 17 00:00:00 2001 From: Laura Prieto Saavedra Date: Thu, 4 Jul 2024 17:50:04 -0400 Subject: [PATCH 3/8] Add read mesh time stamp for MB --- source/solvers/gls_navier_stokes.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/solvers/gls_navier_stokes.cc b/source/solvers/gls_navier_stokes.cc index a8ae497edc..bce1903e85 100644 --- a/source/solvers/gls_navier_stokes.cc +++ b/source/solvers/gls_navier_stokes.cc @@ -1794,6 +1794,8 @@ template void GLSNavierStokesSolver::solve() { + this->computing_timer.enter_subsection("Read mesh and manifolds"); + read_mesh_and_manifolds( *this->triangulation, this->simulation_parameters.mesh, @@ -1801,6 +1803,8 @@ GLSNavierStokesSolver::solve() this->simulation_parameters.restart_parameters.restart, this->simulation_parameters.boundary_conditions); + this->computing_timer.leave_subsection("Read mesh and manifolds"); + this->setup_dofs(); this->enable_dynamic_zero_constraints_fd(); this->box_refine_mesh(this->simulation_parameters.restart_parameters.restart); From 865cc2f06dabaef961e570bacabde5411619fe98 Mon Sep 17 00:00:00 2001 From: Laura Prieto Saavedra Date: Fri, 5 Jul 2024 15:20:14 -0400 Subject: [PATCH 4/8] Separate post-processing timers and make uniform --- source/dem/read_checkpoint.cc | 2 +- source/dem/write_checkpoint.cc | 2 +- source/fem-dem/cfd_dem_coupling.cc | 4 +-- source/solvers/navier_stokes_base.cc | 37 ++++++++++++++++++++++------ 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/source/dem/read_checkpoint.cc b/source/dem/read_checkpoint.cc index e56017b869..6b9feca94a 100644 --- a/source/dem/read_checkpoint.cc +++ b/source/dem/read_checkpoint.cc @@ -15,7 +15,7 @@ read_checkpoint( std::shared_ptr> &insertion_object, std::vector>> &solid_surfaces) { - TimerOutput::Scope timer(computing_timer, "read_checkpoint"); + TimerOutput::Scope timer(computing_timer, "Read checkpoint"); std::string prefix = parameters.restart.filename; simulation_control->read(prefix); particles_pvdhandler.read(prefix); diff --git a/source/dem/write_checkpoint.cc b/source/dem/write_checkpoint.cc index 97fc34ae31..bd7976af66 100644 --- a/source/dem/write_checkpoint.cc +++ b/source/dem/write_checkpoint.cc @@ -17,7 +17,7 @@ write_checkpoint( const ConditionalOStream &pcout, MPI_Comm &mpi_communicator) { - TimerOutput::Scope timer(computing_timer, "write_checkpoint"); + TimerOutput::Scope timer(computing_timer, "Write checkpoint"); pcout << "Writing restart file" << std::endl; diff --git a/source/fem-dem/cfd_dem_coupling.cc b/source/fem-dem/cfd_dem_coupling.cc index 017fe808de..cb0a9ef1bb 100644 --- a/source/fem-dem/cfd_dem_coupling.cc +++ b/source/fem-dem/cfd_dem_coupling.cc @@ -207,7 +207,7 @@ template void CFDDEMSolver::write_checkpoint() { - TimerOutput::Scope timer(this->computing_timer, "write_checkpoint"); + TimerOutput::Scope timer(this->computing_timer, "Write checkpoint"); std::string prefix = this->simulation_parameters.simulation_control.output_folder + @@ -290,7 +290,7 @@ template void CFDDEMSolver::read_checkpoint() { - TimerOutput::Scope timer(this->computing_timer, "read_checkpoint"); + TimerOutput::Scope timer(this->computing_timer, "Read checkpoint"); std::string prefix = this->simulation_parameters.simulation_control.output_folder + this->simulation_parameters.restart_parameters.filename; diff --git a/source/solvers/navier_stokes_base.cc b/source/solvers/navier_stokes_base.cc index 75c40c34f0..fa627cf034 100644 --- a/source/solvers/navier_stokes_base.cc +++ b/source/solvers/navier_stokes_base.cc @@ -1205,13 +1205,13 @@ template void NavierStokesBase::postprocess_fd(bool firstIter) { - TimerOutput::Scope t(this->computing_timer, "Postprocessing"); - auto &present_solution = this->present_solution; // Enstrophy if (this->simulation_parameters.post_processing.calculate_enstrophy) { + TimerOutput::Scope t(this->computing_timer, "Calculate enstrophy"); + double enstrophy = calculate_enstrophy(this->dof_handler, present_solution, *this->cell_quadrature, @@ -1248,6 +1248,8 @@ NavierStokesBase::postprocess_fd(bool firstIter) // Pressure power if (this->simulation_parameters.post_processing.calculate_pressure_power) { + TimerOutput::Scope t(this->computing_timer, "Calculate pressure power"); + const double pressure_power = calculate_pressure_power(this->dof_handler, present_solution, @@ -1286,6 +1288,9 @@ NavierStokesBase::postprocess_fd(bool firstIter) // Viscous dissipation if (this->simulation_parameters.post_processing.calculate_viscous_dissipation) { + TimerOutput::Scope t(this->computing_timer, + "Calculate viscous dissipation"); + const double viscous_dissipation = calculate_viscous_dissipation( this->dof_handler, present_solution, @@ -1329,6 +1334,9 @@ NavierStokesBase::postprocess_fd(bool firstIter) // tolerance. if (this->simulation_parameters.post_processing.calculate_average_velocities) { + TimerOutput::Scope t(this->computing_timer, + "Calculate average velocities"); + // Calculate average velocities when the time reaches the initial time. // time >= initial time with the epsilon as tolerance. const double dt = simulation_control->get_time_step(); @@ -1345,6 +1353,8 @@ NavierStokesBase::postprocess_fd(bool firstIter) if (this->simulation_parameters.post_processing.calculate_kinetic_energy) { + TimerOutput::Scope t(this->computing_timer, "Calculate kinetic energy"); + double kE = calculate_kinetic_energy(this->dof_handler, present_solution, *this->cell_quadrature, @@ -1378,6 +1388,9 @@ NavierStokesBase::postprocess_fd(bool firstIter) // Calculate apparent viscosity if (this->simulation_parameters.post_processing.calculate_apparent_viscosity) { + TimerOutput::Scope t(this->computing_timer, + "Calculate apparent viscosity"); + double apparent_viscosity = calculate_apparent_viscosity( this->dof_handler, this->present_solution, @@ -1417,6 +1430,8 @@ NavierStokesBase::postprocess_fd(bool firstIter) // Calculate pressure drop between two boundaries if (this->simulation_parameters.post_processing.calculate_pressure_drop) { + TimerOutput::Scope t(this->computing_timer, "Calculate pressure drop"); + double pressure_drop, total_pressure_drop; std::tie(pressure_drop, total_pressure_drop) = calculate_pressure_drop( this->dof_handler, @@ -1471,6 +1486,8 @@ NavierStokesBase::postprocess_fd(bool firstIter) // Calculate flow rate at every boundary if (this->simulation_parameters.post_processing.calculate_flow_rate) { + TimerOutput::Scope t(this->computing_timer, "Calculate flow rate"); + this->flow_rate_table.add_value("time", simulation_control->get_current_time()); this->flow_rate_table.set_scientific("time", true); @@ -1529,6 +1546,8 @@ NavierStokesBase::postprocess_fd(bool firstIter) } } + // this->computing_timer.leave_subsection("Postprocessing"); + if (!firstIter) { // Calculate forces on the boundary conditions @@ -1564,6 +1583,9 @@ NavierStokesBase::postprocess_fd(bool firstIter) // Calculate error with respect to analytical solution if (this->simulation_parameters.analytical_solution->calculate_error()) { + TimerOutput::Scope t(this->computing_timer, + "Calculate error w.r.t. analytical solution"); + // Update the time of the exact solution to the actual time this->exact_solution->set_time( simulation_control->get_current_time()); @@ -1693,7 +1715,7 @@ template void NavierStokesBase::read_checkpoint() { - TimerOutput::Scope timer(this->computing_timer, "read_checkpoint"); + TimerOutput::Scope timer(this->computing_timer, "Read checkpoint"); std::string prefix = this->simulation_parameters.simulation_control.output_folder + this->simulation_parameters.restart_parameters.filename; @@ -2403,7 +2425,7 @@ template void NavierStokesBase::write_output_forces() { - TimerOutput::Scope t(this->computing_timer, "output_forces"); + TimerOutput::Scope t(this->computing_timer, "Output forces"); if (this->this_mpi_process == 0) { for (unsigned int boundary_id = 0; @@ -2425,7 +2447,7 @@ template void NavierStokesBase::write_output_torques() { - TimerOutput::Scope t(this->computing_timer, "output_torques"); + TimerOutput::Scope t(this->computing_timer, "Output torques"); if (this->this_mpi_process == 0) { for (unsigned int boundary_id = 0; @@ -2447,7 +2469,7 @@ template void NavierStokesBase::write_checkpoint() { - TimerOutput::Scope timer(this->computing_timer, "write_checkpoint"); + TimerOutput::Scope timer(this->computing_timer, "Write checkpoint"); std::string prefix = this->simulation_parameters.simulation_control.output_folder + this->simulation_parameters.restart_parameters.filename; @@ -2608,7 +2630,8 @@ void NavierStokesBase::output_newton_update_norms( const unsigned int display_precision) { - TimerOutput::Scope t(this->computing_timer, "Output Newton update norms"); + TimerOutput::Scope t(this->computing_timer, + "Calculate and output norms after Newton its"); if constexpr (std::is_same_v || std::is_same_v Date: Fri, 5 Jul 2024 15:20:52 -0400 Subject: [PATCH 5/8] Only report initial conditions time for end timer --- source/solvers/gls_navier_stokes.cc | 3 ++- source/solvers/mf_navier_stokes.cc | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/solvers/gls_navier_stokes.cc b/source/solvers/gls_navier_stokes.cc index bce1903e85..62f3e37a08 100644 --- a/source/solvers/gls_navier_stokes.cc +++ b/source/solvers/gls_navier_stokes.cc @@ -1123,7 +1123,8 @@ GLSNavierStokesSolver::set_initial_condition_fd( Parameters::InitialConditionType initial_condition_type, bool restart) { - TimerOutput::Scope t(this->computing_timer, "Set initial conditions"); + if (this->simulation_parameters.timer.type == Parameters::Timer::Type::end) + TimerOutput::Scope t(this->computing_timer, "Set initial conditions"); if (restart) { diff --git a/source/solvers/mf_navier_stokes.cc b/source/solvers/mf_navier_stokes.cc index 274264047f..8a6b5a763c 100644 --- a/source/solvers/mf_navier_stokes.cc +++ b/source/solvers/mf_navier_stokes.cc @@ -1719,7 +1719,8 @@ MFNavierStokesSolver::set_initial_condition_fd( Parameters::InitialConditionType initial_condition_type, bool restart) { - TimerOutput::Scope t(this->computing_timer, "Set initial conditions"); + if (this->simulation_parameters.timer.type == Parameters::Timer::Type::end) + TimerOutput::Scope t(this->computing_timer, "Set initial conditions"); if (restart) { From 4626cde39a5facafa6565765ca6792bd298e8c61 Mon Sep 17 00:00:00 2001 From: Laura Prieto Saavedra Date: Fri, 5 Jul 2024 15:21:31 -0400 Subject: [PATCH 6/8] Update documentation --- doc/source/parameters/cfd/timer.rst | 40 +++++++++++++++++------------ 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/doc/source/parameters/cfd/timer.rst b/doc/source/parameters/cfd/timer.rst index 3d3e560628..19f448a24e 100644 --- a/doc/source/parameters/cfd/timer.rst +++ b/doc/source/parameters/cfd/timer.rst @@ -18,29 +18,35 @@ The following table shows an example of the output of the timer: .. code-block:: text - +---------------------------------------------+------------+------------+ - | Total wallclock time elapsed since start | 11.5s | | - | | | | - | Section | no. calls | wall time | % of total | - +---------------------------------+-----------+------------+------------+ - | assemble_rhs | 4 | 2.28s | 20% | - | assemble_system | 4 | 7.78s | 68% | - | output | 2 | 1.21s | 11% | - | setup_ILU | 4 | 0.164s | 1.4% | - | solve_linear_system | 4 | 0.0812s | 0.71% | - +---------------------------------+-----------+------------+------------+ + +---------------------------------------------------------+------------+------------+ + | Total wallclock time elapsed since start | 16.1s | | + | | | | + | Section | no. calls | wall time | % of total | + +---------------------------------------------+-----------+------------+------------+ + | Assemble RHS | 9 | 5.72s | 36% | + | Assemble matrix | 7 | 7.59s | 47% | + | Calculate and output norms after Newton its | 8 | 0.318s | 2% | + | Distribute constraints after linear solve | 7 | 0.00887s | 0% | + | Output VTU | 2 | 0.765s | 4.8% | + | Read mesh and manifolds | 1 | 0.296s | 1.8% | + | Set initial conditions | 1 | 0.243s | 1.5% | + | Setup DOFs | 1 | 0.727s | 4.5% | + | Setup ILU | 7 | 0.104s | 0.65% | + | Solve linear system | 7 | 0.267s | 1.7% | + +---------------------------------------------+-----------+------------+------------+ -For every block of functions, Lethe reports the number of calls, the wall time spent and the percentage of time spent in the function. It is important to monitor this when running a simulation. +For every block of functions, Lethe reports the number of calls, the wall time spent and the percentage of time spent in the function. It is important to monitor this when running a simulation. The most important ones from a user perspective in most of the simulations are: -* ``assemble_rhs`` refers to the assembly of the right-hand side of the equation, that is the residual of the equation. +* ``Assemble RHS`` refers to the assembly of the right-hand side of the equation, that is the residual of the equation. -* ``assemble_system`` refers to the time spent assembling the matrix associated with the equation. +* ``Assemble matrix`` refers to the time spent assembling the matrix associated with the equation. -* ``output`` refers to the output of the ``.vtu``, ``.pvtu`` and ``.pvd`` files. +* ``Output VTU`` refers to the output of the ``.vtu``, ``.pvtu`` and ``.pvd`` files. -* ``setup_ILU`` or ``setup_AMG`` describe the time spent to set-up the preconditioner. +* ``Read mesh and manifolds`` refers to the time it takes to create a ``dealii`` triangulation or read a ``gmsh`` one, and attach corresponding manifolds. -* ``solve_linear_system`` refers to the time spent solving the linear system of equations, without the time required to assemble the preconditioner. +* ``Setup ILU`` describe the time spent to set-up the preconditioner. Other options are ``Setup AMG`` and ``Setup GMG``. +* ``Solve linear system`` refers to the time spent solving the linear system of equations, without the time required to assemble the preconditioner. Depending on the type of simulation, there may be other categories that appear in the timer. This is useful to monitor the functions responsible for taking up most of the simulation time. From 63d9a1f595d88729f9c41fb8ce9ad563d0df6016 Mon Sep 17 00:00:00 2001 From: Laura Prieto Saavedra Date: Fri, 5 Jul 2024 15:32:51 -0400 Subject: [PATCH 7/8] Update documentation timer example --- doc/source/parameters/cfd/timer.rst | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/doc/source/parameters/cfd/timer.rst b/doc/source/parameters/cfd/timer.rst index 19f448a24e..123a11e358 100644 --- a/doc/source/parameters/cfd/timer.rst +++ b/doc/source/parameters/cfd/timer.rst @@ -19,20 +19,18 @@ The following table shows an example of the output of the timer: .. code-block:: text +---------------------------------------------------------+------------+------------+ - | Total wallclock time elapsed since start | 16.1s | | + | Total wallclock time elapsed since start | 1.11s | | | | | | | Section | no. calls | wall time | % of total | +---------------------------------------------+-----------+------------+------------+ - | Assemble RHS | 9 | 5.72s | 36% | - | Assemble matrix | 7 | 7.59s | 47% | - | Calculate and output norms after Newton its | 8 | 0.318s | 2% | - | Distribute constraints after linear solve | 7 | 0.00887s | 0% | - | Output VTU | 2 | 0.765s | 4.8% | - | Read mesh and manifolds | 1 | 0.296s | 1.8% | - | Set initial conditions | 1 | 0.243s | 1.5% | - | Setup DOFs | 1 | 0.727s | 4.5% | - | Setup ILU | 7 | 0.104s | 0.65% | - | Solve linear system | 7 | 0.267s | 1.7% | + | Assemble RHS | 9 | 0.275s | 25% | + | Assemble matrix | 7 | 0.293s | 26% | + | Calculate and output norms after Newton its | 8 | 0.0135s | 1.2% | + | Output VTU | 2 | 0.0491s | 4.4% | + | Read mesh and manifolds | 1 | 0.00733s | 0.66% | + | Setup DOFs | 1 | 0.0144s | 1.3% | + | Setup ILU | 7 | 0.0801s | 7.2% | + | Solve linear system | 7 | 0.369s | 33% | +---------------------------------------------+-----------+------------+------------+ For every block of functions, Lethe reports the number of calls, the wall time spent and the percentage of time spent in the function. It is important to monitor this when running a simulation. The most important ones from a user perspective in most of the simulations are: From 26cb46c3516ee71df88aeed9ba927fb481fe7898 Mon Sep 17 00:00:00 2001 From: Laura Prieto Saavedra Date: Mon, 8 Jul 2024 09:18:00 -0400 Subject: [PATCH 8/8] Add entry in changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae3d001132..1ccc3c6b10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to the Lethe project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/). +## [Master] - 2024-07-08 + +### Changed + +- MINOR The timer output for the lethe-fluid and lethe-fluid-matrix-free applications contains now more detailed elements. Including post-processing capabilities that were not timed, the time spent in reading mesh and manifolds, and setting the initial conditions. [#1187](https://github.com/chaos-polymtl/lethe/pull/1187) + ## [Master] - 2024-07-05 ### Changed