Skip to content

Commit

Permalink
ensure to init level > max level to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
RevathiJambunathan committed Sep 28, 2023
1 parent 40bd951 commit e3d5808
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Source/Initialization/WarpXInitData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -752,10 +752,20 @@ WarpX::InitLevelData (int lev, Real /*time*/)
// Note that if the external fields are not provided, the fields, E and B, on all levels
// will still be initialized with the default value of 0.
if ( (B_ext_grid_s == "constant") || (B_ext_grid_s == "parse_b_ext_grid_function")) {
if (lev > maxlevel_extEMfield_init) continue;
if (lev > maxlevel_extEMfield_init) {
Bfield_fp[lev][0]->setVal(0.);
Bfield_fp[lev][1]->setVal(0.);
Bfield_fp[lev][2]->setVal(0.);
return;
}
}
if ( (E_ext_grid_s == "constant") || (E_ext_grid_s == "parse_e_ext_grid_function")) {
if (lev > maxlevel_extEMfield_init) continue;
if (lev > maxlevel_extEMfield_init) {
Efield_fp[lev][0]->setVal(0.);
Efield_fp[lev][1]->setVal(0.);
Efield_fp[lev][2]->setVal(0.);
return;
}
}

// if the input string is "constant", the values for the
Expand Down

0 comments on commit e3d5808

Please sign in to comment.