diff --git a/Source/Initialization/WarpXInitData.cpp b/Source/Initialization/WarpXInitData.cpp index eea5f088dc1..0e63dd81238 100644 --- a/Source/Initialization/WarpXInitData.cpp +++ b/Source/Initialization/WarpXInitData.cpp @@ -785,7 +785,7 @@ WarpX::InitLevelData (int lev, Real /*time*/) // Externally imposed fields are only initialized until the user-defined maxlevel_extEMfield_init. // The default maxlevel_extEMfield_init value is the total number of levels in the simulation - if ( ( B_ext_grid_s == "constant" && (lev > maxlevel_extEMfield_init) ) + if ( ( B_ext_grid_s == "constant" && (lev <= maxlevel_extEMfield_init) ) || B_ext_grid_s == "default") { Bfield_fp[lev][i]->setVal(B_external_grid[i]); @@ -803,7 +803,7 @@ WarpX::InitLevelData (int lev, Real /*time*/) } // Externally imposed fields are only initialized until the user-defined maxlevel_extEMfield_init. // The default maxlevel_extEMfield_init value is the total number of levels in the simulation - if ( ( E_ext_grid_s == "constant" && (lev > maxlevel_extEMfield_init) ) + if ( ( E_ext_grid_s == "constant" && (lev <= maxlevel_extEMfield_init) ) || E_ext_grid_s == "default") { Efield_fp[lev][i]->setVal(E_external_grid[i]); @@ -830,7 +830,7 @@ WarpX::InitLevelData (int lev, Real /*time*/) // provided in the input file. // Externally imposed fields are only initialized until the user-defined maxlevel_extEMfield_init. // The default maxlevel_extEMfield_init value is the total number of levels in the simulation - if (B_ext_grid_s == "parse_b_ext_grid_function" && (lev > maxlevel_extEMfield_init)) { + if (B_ext_grid_s == "parse_b_ext_grid_function" && (lev <= maxlevel_extEMfield_init)) { #ifdef WARPX_DIM_RZ WARPX_ABORT_WITH_MESSAGE( @@ -896,7 +896,7 @@ WarpX::InitLevelData (int lev, Real /*time*/) // provided in the input file. // Externally imposed fields are only initialized until the user-defined maxlevel_extEMfield_init. // The default maxlevel_extEMfield_init value is the total number of levels in the simulation - if (E_ext_grid_s == "parse_e_ext_grid_function" && (lev > maxlevel_extEMfield_init)) { + if (E_ext_grid_s == "parse_e_ext_grid_function" && (lev <= maxlevel_extEMfield_init)) { #ifdef WARPX_DIM_RZ WARPX_ABORT_WITH_MESSAGE(