aboutsummaryrefslogtreecommitdiff
path: root/Source/Utils/WarpXUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Utils/WarpXUtil.cpp')
-rw-r--r--Source/Utils/WarpXUtil.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/Source/Utils/WarpXUtil.cpp b/Source/Utils/WarpXUtil.cpp
index d77a35b3a..277385d49 100644
--- a/Source/Utils/WarpXUtil.cpp
+++ b/Source/Utils/WarpXUtil.cpp
@@ -555,9 +555,15 @@ void CheckGriddingForRZSpectral ()
Vector<int> blocking_factor_x(max_level+1);
Vector<int> max_grid_size_x(max_level+1);
- // Set the radial block size to be equal to the radial grid size.
- blocking_factor_x[0] = n_cell[0];
- max_grid_size_x[0] = n_cell[0];
+ // Set the radial block size to be the power of 2 greater than or equal to
+ // the number of grid cells. The blocking_factor must be a power of 2
+ // and the max_grid_size should be a multiple of the blocking_factor.
+ int k = 1;
+ while (k < n_cell[0]) {
+ k *= 2;
+ }
+ blocking_factor_x[0] = k;
+ max_grid_size_x[0] = k;
for (int lev=1 ; lev <= max_level ; lev++) {
// For this to be correct, this needs to read in any user specified refinement ratios.