From d201adcde1fc50c1fd452ef60d7bf44ce643c12e Mon Sep 17 00:00:00 2001 From: Rene Gassmoeller Date: Thu, 28 May 2020 14:22:43 -0700 Subject: [PATCH] Address some comments --- examples/step-68/doc/results.dox | 6 +++--- examples/step-68/step-68.cc | 34 ++++++++++++++++---------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/examples/step-68/doc/results.dox b/examples/step-68/doc/results.dox index afb776f795..0eb5b337b4 100644 --- a/examples/step-68/doc/results.dox +++ b/examples/step-68/doc/results.dox @@ -6,7 +6,7 @@ line, the program will try to read the file "`parameters.prm`" by default, and will execute the two dimensional version of the code. Regardless of the specific parameter file name, if the specified file does not -exist, when you execute the program you will get an exception that no such file +exist when you execute the program you will get an exception that no such file can be found: @code @@ -63,9 +63,9 @@ Writing particle output file: interpolated-particles-2000 Writing background field file: background-2000 @endcode -We notice that, by default, the simulation runs the particle tracking with +We note that, by default, the simulation runs the particle tracking with an analytical velocity for 2000 iterations, then runs the particle tracking with -velocity interpolationn for the same duration. The results are written every +velocity interpolation for the same duration. The results are written every 10 iterations.

Motion of the particles

diff --git a/examples/step-68/step-68.cc b/examples/step-68/step-68.cc index d870baed36..7eb3943a7a 100644 --- a/examples/step-68/step-68.cc +++ b/examples/step-68/step-68.cc @@ -218,11 +218,6 @@ namespace Step68 // @sect3{The PatricleTracking class declaration} // We are now ready to introduce the main class of our tutorial program. - // Contrarily to some other steps, there is an additional function that is - // left public other than the constructor and the `run()` method, which is the - // cell_weight() function. This function is connected to the triangulation and - // must be callable from outside of the scope of this class. Everything else - // is left `private`, and accessed through the run method itself. template class ParticleTracking { @@ -231,16 +226,6 @@ namespace Step68 const bool interpolated_velocity); void run(); - // The cell_weight() function indicates to the triangulation how much - // computational work is expected to happen on this cell, and consequently - // how the domain needs to be partitioned so that every MPI rank receives a - // roughly equal amount of work (potentially not an equal number of cells). - unsigned int cell_weight( - const typename parallel::distributed::Triangulation::cell_iterator - &cell, - const typename parallel::distributed::Triangulation::CellStatus - status); - private: // The particles_generation function is responsible for the initial // generation of the particles on top of the background grid @@ -261,6 +246,18 @@ namespace Step68 void euler_interpolated(double dt); void euler_analytical(double dt); + // The cell_weight() function indicates to the triangulation how much + // computational work is expected to happen on this cell, and consequently + // how the domain needs to be partitioned so that every MPI rank receives a + // roughly equal amount of work (potentially not an equal number of cells). + // While the function is called from the outside, it is connected to the + // corresponding signal from inside this class, therefore it can be private. + unsigned int cell_weight( + const typename parallel::distributed::Triangulation::cell_iterator + &cell, + const typename parallel::distributed::Triangulation::CellStatus + status) const; + // The following two functions are responsible for outputting the simulation // results for the particles and for the velocity profile on the background // mesh, respectively. @@ -333,9 +330,10 @@ namespace Step68 unsigned int ParticleTracking::cell_weight( const typename parallel::distributed::Triangulation::cell_iterator & cell, - const typename parallel::distributed::Triangulation::CellStatus status) + const typename parallel::distributed::Triangulation::CellStatus status) const { - if (cell->is_active() && !cell->is_locally_owned()) + // Assign no weight to cells we do not own. + if (!cell->is_locally_owned()) return 0; // This determines how important particle work is compared to cell @@ -390,10 +388,12 @@ namespace Step68 // In order to consider the particles when repartitioning the triangulation // the algorithm needs to know three things: + // // 1. How much weight to assign to each cell (how many particles are in // there) // 2. How to pack the particles before shipping data around // 3. How to unpack the particles after repartitioning + // // Attach the correct functions to the signals inside // parallel::distributed::Triangulation, which will be called every time the // repartition() function is called. -- 2.39.5