diff options
author | 2021-11-19 10:24:48 -0800 | |
---|---|---|
committer | 2021-11-19 10:24:48 -0800 | |
commit | 808e9ed8c7d862673cbf5fbcf61834d4b2234edb (patch) | |
tree | 127165fb4e27759460238be85aba5eba33684f75 /Source/Utils/WarpXUtil.cpp | |
parent | 8ea3f2fc419605e65fddad2d8d024882480a009f (diff) | |
download | WarpX-808e9ed8c7d862673cbf5fbcf61834d4b2234edb.tar.gz WarpX-808e9ed8c7d862673cbf5fbcf61834d4b2234edb.tar.zst WarpX-808e9ed8c7d862673cbf5fbcf61834d4b2234edb.zip |
RZ PSATD, make blocking_factor a power of 2 (#2572)
* With RZ PSATD, make blocking_factor a power of 2
* Fix typo
Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com>
Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com>
Diffstat (limited to 'Source/Utils/WarpXUtil.cpp')
-rw-r--r-- | Source/Utils/WarpXUtil.cpp | 12 |
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. |