Skip to content

Commit

Permalink
re-generate particles in initial adaptive refinement
Browse files Browse the repository at this point in the history
  • Loading branch information
jdannberg committed Jan 29, 2025
1 parent 70f4496 commit 9c83210
Show file tree
Hide file tree
Showing 6 changed files with 2,243 additions and 3 deletions.
6 changes: 6 additions & 0 deletions doc/modules/changes/20250129_jdannberg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Changed: ASPECT now re-generates particles in each adaptive
refinement cycle instead of only once after global refinement.
This means that particle locations during adaptive refinement
are chosen according to the generator instead of randomly.
<br>
(Juliane Dannberg, 2025/01/29)
11 changes: 8 additions & 3 deletions source/particle/manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -574,9 +574,14 @@ namespace aspect
void
Manager<dim>::setup_initial_state ()
{
// If we are in the first adaptive refinement cycle generate particles
if (this->get_pre_refinement_step() == 0)
generate_particles();
// We want to generate a new set of particles in each adaptive refinement
// cycle to get the right number of particles per cell and to accurately
// initialize their properties. Delete existing particles beforehand.
if (this->get_pre_refinement_step() > 0)
particle_handler->clear();

// Generate particles in each adaptive refinement cycle
generate_particles();

// And initialize the particle properties according to the initial
// conditions on the current mesh
Expand Down
21 changes: 21 additions & 0 deletions tests/particle_generator_reference_cell_adaptive.prm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Like particle_generator_reference_cell.prm but with initial adaptive
# refinement to test correct particle initialization.
# There should be 4 particles per direction within each cell.

set Dimension = 2

include $ASPECT_SOURCE_DIR/tests/particle_generator_reference_cell.prm

subsection Mesh refinement
set Initial adaptive refinement = 1
set Strategy = composition gradient
set Initial global refinement = 3
set Coarsening fraction = 0.6
set Refinement fraction = 0.15
set Adapt by fraction of cells = true
end

subsection Particles
set Load balancing strategy = remove and add particles
set Minimum particles per cell = 16
end
Loading

0 comments on commit 9c83210

Please sign in to comment.