Skip to content

Commit

Permalink
Merge pull request #5940 from gassmoeller/remove_particle_update_ghos…
Browse files Browse the repository at this point in the history
…t_parameter

Remove particle update ghost parameter
  • Loading branch information
tjhei authored Jul 31, 2024
2 parents 7ea5a46 + 7600583 commit 8c3463e
Show file tree
Hide file tree
Showing 50 changed files with 25 additions and 72 deletions.
1 change: 0 additions & 1 deletion benchmarks/annulus/transient/transient_annulus.prm
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ subsection Particles
set Integration scheme = rk2
set Interpolation scheme = bilinear least squares
set List of particle properties = particle density
set Update ghost particles = true
set Particle generator name = random uniform
set Load balancing strategy = add particles
set Minimum particles per cell = 12
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ subsection Particles
set Integration scheme = rk2
set Interpolation scheme = cell average
set Maximum particles per cell = 16384
set Update ghost particles = true
set Particle generator name = reference cell

subsection Function
Expand Down
1 change: 0 additions & 1 deletion benchmarks/rigid_shear/steady-state/rigid_shear.prm
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ subsection Particles
set List of particle properties = function
set Integration scheme = rk2
set Interpolation scheme = bilinear least squares
set Update ghost particles = true
set Minimum particles per cell = 9
set Maximum particles per cell = 16384
set Particle generator name = reference cell
Expand Down
1 change: 0 additions & 1 deletion benchmarks/rigid_shear/transient/rigid_shear.prm
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ subsection Particles
set List of particle properties = function
set Integration scheme = rk2
set Interpolation scheme = bilinear least squares
set Update ghost particles = true
set Minimum particles per cell = 12
set Maximum particles per cell = 16384
set Particle generator name = random uniform
Expand Down
1 change: 0 additions & 1 deletion benchmarks/solcx/compositional_fields/solcx_particles.prm
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ subsection Particles
set Integration scheme = rk2
set Interpolation scheme = cell average
set Maximum particles per cell = 16384
set Update ghost particles = true
set Particle generator name = reference cell

subsection Function
Expand Down
1 change: 0 additions & 1 deletion benchmarks/solkz/compositional_fields/solkz_particles.prm
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ subsection Particles
set Integration scheme = rk2
set Interpolation scheme = cell average
set Maximum particles per cell = 16384
set Update ghost particles = true
set Particle generator name = reference cell

subsection Function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ subsection Particles
set Integration scheme = rk2 # or rk4
set Interpolation scheme = bilinear least squares # or cell average
set List of particle properties = function
set Update ghost particles = true
set Particle generator name = reference cell
set Load balancing strategy = none # not necessary for uniform mesh

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ subsection Particles
set Load balancing strategy = remove and add particles
set List of particle properties = initial composition, elastic stress
set Interpolation scheme = nearest neighbor
set Update ghost particles = true
set Particle generator name = random uniform

subsection Generator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ subsection Particles
set Load balancing strategy = remove and add particles
set List of particle properties = initial composition, viscoplastic strain invariants, elastic stress
set Interpolation scheme = cell average
set Update ghost particles = true
set Particle generator name = reference cell

subsection Generator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ subsection Particles
set Load balancing strategy = remove and add particles
set List of particle properties = initial composition, elastic stress
set Interpolation scheme = bilinear least squares
set Update ghost particles = true
set Particle generator name = random uniform

subsection Generator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ subsection Particles
set Load balancing strategy = remove and add particles
set List of particle properties = initial composition, elastic stress
set Interpolation scheme = bilinear least squares
set Update ghost particles = true
set Particle generator name = random uniform

subsection Generator
Expand Down
9 changes: 9 additions & 0 deletions contrib/utilities/update_scripts/prm_files/move_particles.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,15 @@ def move_particle_postprocess_parameters_back(parameters):

return parameters

def remove_update_ghost_particles_parameter(parameters):
""" Remove the parameter 'Update ghost particles'. """

# Find the "Update ghost particles" parameter and remove
if "Particles" in parameters:
if "Update ghost particles" in parameters["Particles"]["value"]:
del parameters["Particles"]["value"]["Update ghost particles"]

return parameters

def main(input_file, output_file):
"""Echo the input arguments to standard output"""
Expand All @@ -122,6 +130,7 @@ def main(input_file, output_file):
parameters = move_particle_parameters_to_own_subsection(parameters)
parameters = move_number_of_particles_to_correct_subsection(parameters)
parameters = move_particle_postprocess_parameters_back(parameters)
parameters = remove_update_ghost_particles_parameter(parameters)

aspect.write_parameter_file(parameters, output_file)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ end
subsection Particles
set List of particle properties = velocity, initial composition
set Interpolation scheme = cell average
set Update ghost particles = true
set Particle generator name = random uniform

subsection Generator
Expand Down
1 change: 0 additions & 1 deletion cookbooks/grain_size_ridge/doc/particles.part.prm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ subsection Particles
set Minimum particles per cell = 40
set Maximum particles per cell = 640
set Integration scheme = rk2
set Update ghost particles = true

subsection Interpolator
subsection Bilinear least squares
Expand Down
1 change: 0 additions & 1 deletion cookbooks/grain_size_ridge/grain_size_ridge.prm
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ subsection Particles
set Minimum particles per cell = 40
set Maximum particles per cell = 640
set Integration scheme = rk2
set Update ghost particles = true

subsection Interpolator
subsection Bilinear least squares
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ end

subsection Particles
set List of particle properties = position, velocity, initial composition, pT path, initial position
set Update ghost particles = true
set Particle generator name = reference cell
set Load balancing strategy = remove and add particles
set Minimum particles per cell = 80
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ subsection Particles
set List of particle properties = initial composition, velocity
set Particle generator name = random uniform
set Interpolation scheme = cell average
set Update ghost particles = true

subsection Generator
subsection Probability density function
Expand Down
5 changes: 5 additions & 0 deletions doc/modules/changes/20240625_gassmoeller
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Removed: The input parameter 'Update ghost particles' has been deprecated.
Ghost particles are now always updated. Existing parameter files can
be updated by the script in 'contrib/utilities/update_prm_files.sh'.
<br>
(Rene Gassmoeller, 2024/06/25)
9 changes: 0 additions & 9 deletions include/aspect/particle/world.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,15 +442,6 @@ namespace aspect
*/
unsigned int particle_weight;

/**
* Some particle interpolation algorithms require knowledge
* about particles in neighboring cells. To allow this,
* particles in ghost cells need to be exchanged between the
* processes neighboring this cell. This parameter determines
* whether this transport is happening.
*/
bool update_ghost_particles;

/**
* Get a map between subdomain id and the neighbor index. In other words
* the returned map answers the question: Given a subdomain id, which
Expand Down
3 changes: 0 additions & 3 deletions source/particle/interpolator/bilinear_least_squares.cc
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,6 @@ namespace aspect
prm.leave_subsection();
}
prm.leave_subsection();
const bool limiter_enabled_for_at_least_one_property = (use_linear_least_squares_limiter.n_selected_components() != 0);
AssertThrow(limiter_enabled_for_at_least_one_property == false || prm.get_bool("Update ghost particles") == true,
ExcMessage("If 'Use linear least squares limiter' is enabled for any particle property, then 'Update ghost particles' must be set to true"));
}
}
}
Expand Down
7 changes: 0 additions & 7 deletions source/particle/interpolator/quadratic_least_squares.cc
Original file line number Diff line number Diff line change
Expand Up @@ -610,13 +610,6 @@ namespace aspect
prm.leave_subsection();
}
prm.leave_subsection();

// In general n_selected_components() requests an argument of the ComponentMask's size since it could be initialized to be entirely true without a size.
// Here it is given a size equal to n_property_components, so that argument is not necessary.
const bool limiter_enabled_for_at_least_one_property = (use_quadratic_least_squares_limiter.n_selected_components() != 0);
AssertThrow(limiter_enabled_for_at_least_one_property == false || prm.get_bool("Update ghost particles") == true,
ExcMessage("If 'Use quadratic least squares limiter' is enabled for any particle property, then 'Update ghost particles' must be set to true"));

}
}
}
Expand Down
20 changes: 11 additions & 9 deletions source/particle/world.cc
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ namespace aspect
});
}

if (update_ghost_particles &&
dealii::Utilities::MPI::n_mpi_processes(this->get_mpi_communicator()) > 1)
if (dealii::Utilities::MPI::n_mpi_processes(this->get_mpi_communicator()) > 1)
{
auto do_ghost_exchange = [&] (typename parallel::distributed::Triangulation<dim> &)
{
Expand Down Expand Up @@ -604,8 +603,7 @@ namespace aspect
local_initialize_particles(particle_handler->begin(),
particle_handler->end());

if (update_ghost_particles &&
dealii::Utilities::MPI::n_mpi_processes(this->get_mpi_communicator()) > 1)
if (dealii::Utilities::MPI::n_mpi_processes(this->get_mpi_communicator()) > 1)
{
TimerOutput::Scope timer_section(this->get_computing_timer(), "Particles: Exchange ghosts");
particle_handler->exchange_ghost_particles();
Expand Down Expand Up @@ -1145,8 +1143,7 @@ namespace aspect

// Now that all particle information was updated, exchange the new
// ghost particles.
if (update_ghost_particles &&
dealii::Utilities::MPI::n_mpi_processes(this->get_mpi_communicator()) > 1)
if (dealii::Utilities::MPI::n_mpi_processes(this->get_mpi_communicator()) > 1)
{
TimerOutput::Scope timer_section(this->get_computing_timer(), "Particles: Exchange ghosts");
particle_handler->exchange_ghost_particles();
Expand Down Expand Up @@ -1234,13 +1231,15 @@ namespace aspect
"particle weight is recommended. Before adding the weights "
"of particles, each cell already carries a weight of 1000 to "
"account for the cost of field-based computations.");
prm.declare_entry ("Update ghost particles", "false",
prm.declare_entry ("Update ghost particles", "true",
Patterns::Bool (),
"Some particle interpolation algorithms require knowledge "
"about particles in neighboring cells. To allow this, "
"particles in ghost cells need to be exchanged between the "
"processes neighboring this cell. This parameter determines "
"whether this transport is happening.");
"whether this transport is happening. This parameter is "
"deprecated and will be removed in the future. Ghost particle "
"updates are always performed. Please set the parameter to `true'.");

Generator::declare_parameters<dim>(prm);
Integrator::declare_parameters<dim>(prm);
Expand Down Expand Up @@ -1292,7 +1291,10 @@ namespace aspect

particle_weight = prm.get_integer("Particle weight");

update_ghost_particles = prm.get_bool("Update ghost particles");
const bool update_ghost_particles = prm.get_bool("Update ghost particles");
AssertThrow(update_ghost_particles == true,
ExcMessage("The 'Update ghost particles' parameter is deprecated and will be removed in the future. "
"Ghost particle updates are always performed. Please set the parameter to `true'."));

const std::vector<std::string> strategies = Utilities::split_string_list(prm.get ("Load balancing strategy"));
AssertThrow(Utilities::has_unique_entries(strategies),
Expand Down
1 change: 0 additions & 1 deletion tests/annulus_transient.prm
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ subsection Particles
set Integration scheme = rk2
set Interpolation scheme = bilinear least squares
set List of particle properties = particle density
set Update ghost particles = true
set Particle generator name = random uniform
set Load balancing strategy = add particles
set Minimum particles per cell = 12
Expand Down
1 change: 0 additions & 1 deletion tests/grain_size_growth_one_cell_particles.prm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ subsection Particles
set List of particle properties = grain size
set Load balancing strategy = none
set Integration scheme = rk2
set Update ghost particles = true

subsection Generator
subsection Probability density function
Expand Down
1 change: 0 additions & 1 deletion tests/matrix_nonzeros_2.prm
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ end
subsection Particles
set List of particle properties = initial composition
set Interpolation scheme = cell average
set Update ghost particles = true

subsection Generator
subsection Probability density function
Expand Down
1 change: 0 additions & 1 deletion tests/matrix_nonzeros_3.prm
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ end
subsection Particles
set List of particle properties = initial composition
set Interpolation scheme = cell average
set Update ghost particles = true

subsection Generator
subsection Probability density function
Expand Down
1 change: 0 additions & 1 deletion tests/particle_interpolator_bilinear_3d.prm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ end
subsection Particles
set List of particle properties = initial composition
set Interpolation scheme = bilinear least squares
set Update ghost particles = true
set Particle generator name = reference cell

subsection Interpolator
Expand Down
1 change: 0 additions & 1 deletion tests/particle_interpolator_bilinear_3d_add_particles.prm
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ end
subsection Particles
set List of particle properties = initial composition
set Interpolation scheme = bilinear least squares
set Update ghost particles = true
set Load balancing strategy = add particles, repartition
set Minimum particles per cell = 4
set Particle generator name = reference cell
Expand Down
1 change: 0 additions & 1 deletion tests/particle_interpolator_bilinear_add_particles.prm
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ subsection Particles
set Minimum particles per cell = 50
set Maximum particles per cell = 16384
set Load balancing strategy = remove and add particles
set Update ghost particles = true
set Particle generator name = reference cell

subsection Function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ subsection Particles
set Integration scheme = rk2
set Interpolation scheme = bilinear least squares
set Maximum particles per cell = 16384
set Update ghost particles = true
set Particle generator name = reference cell

subsection Function
Expand Down
1 change: 0 additions & 1 deletion tests/particle_interpolator_bilinear_limiter.prm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ end
subsection Particles
set List of particle properties = velocity, initial composition, initial position #, integrated strain
set Interpolation scheme = bilinear least squares
set Update ghost particles = true
set Particle generator name = reference cell

subsection Generator
Expand Down
1 change: 0 additions & 1 deletion tests/particle_interpolator_cell_average.prm
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ end
subsection Particles
set List of particle properties = velocity, function, initial composition
set Interpolation scheme = cell average
set Update ghost particles = true
set Particle generator name = random uniform

subsection Function
Expand Down
1 change: 0 additions & 1 deletion tests/particle_interpolator_cell_average_2.prm
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ end

subsection Particles
set List of particle properties = initial composition
set Update ghost particles = true

subsection Generator
subsection Probability density function
Expand Down
1 change: 0 additions & 1 deletion tests/particle_interpolator_distance_weighted_average.prm
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ end
subsection Particles
set List of particle properties = velocity, function, initial composition
set Interpolation scheme = distance weighted average
set Update ghost particles = true
set Particle generator name = random uniform

subsection Function
Expand Down
1 change: 0 additions & 1 deletion tests/particle_interpolator_empty_cells.prm
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ end
subsection Particles
set List of particle properties = initial composition, initial position
set Interpolation scheme = cell average
set Update ghost particles = true
set Particle generator name = random uniform
set Minimum particles per cell = 2
set Maximum particles per cell = 100
Expand Down
1 change: 0 additions & 1 deletion tests/particle_interpolator_from_ghost_cells.prm
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ subsection Particles
set Minimum particles per cell = 2
set Maximum particles per cell = 100
set Load balancing strategy = none
set Update ghost particles = true

subsection Generator
subsection Probability density function
Expand Down
1 change: 0 additions & 1 deletion tests/particle_interpolator_harmonic_average_solkz.prm
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ subsection Particles
set Integration scheme = rk2
set Interpolation scheme = harmonic average
set Maximum particles per cell = 4096
set Update ghost particles = true
set Particle generator name = reference cell

# The initial condition is adapted from the original solkz benchmark by adding a constant
Expand Down
1 change: 0 additions & 1 deletion tests/particle_interpolator_nearest_neighbor.prm
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ end
subsection Particles
set List of particle properties = initial composition
set Interpolation scheme = nearest neighbor
set Update ghost particles = true
set Maximum particles per cell = 10
set Minimum particles per cell = 10
set Particle generator name = uniform box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ subsection Particles
set Minimum particles per cell = 10
set Maximum particles per cell = 16384
set Load balancing strategy = remove and add particles
set Update ghost particles = false
set Particle generator name = reference cell

subsection Function
Expand Down
Loading

0 comments on commit 8c3463e

Please sign in to comment.