Skip to content

Commit 44fdf6e

Browse files
authored
Merge pull request #150 from ajnonaka/PEC_mask_bug
fix PEC + parser sigma logic bug
2 parents f0b24f5 + 5ddce87 commit 44fdf6e

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

Source/FieldSolver/FiniteDifferenceSolver/MacroscopicProperties/MacroscopicProperties.cpp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,16 @@ MacroscopicProperties::InitData ()
264264

265265
// call this before setting sigma in the rest of the domain since this zeros sigma once the PEC mask is defined
266266
if (warpx.use_PEC_mask) {
267+
268+
// read in the layer(s) from the numpy file(s)
269+
if (m_sigma_s == "parse_sigma_npy_file" || m_sigma_s == "parse_sigma_both") {
270+
InitializeMacroMultiFabFromNumpy(m_sigma_mf.get(), m_sigma_npy_filename, lev, m_npy_k_index, m_sigma_npy_value);
271+
if (!m_sigma_npy_filename2.empty()) {
272+
InitializeMacroMultiFabFromNumpy(m_sigma_mf.get(), m_sigma_npy_filename2, lev, m_npy_k_index2, m_sigma_npy_value);
273+
}
274+
} else {
275+
amrex::Abort("warpx.use_PEC_mask requies a npy file);
276+
}
267277
// get pointer to PEC mask in WarpX class
268278
amrex::MultiFab * PECx = warpx.get_pointer_PEC_fp(lev,0);
269279
amrex::MultiFab * PECy = warpx.get_pointer_PEC_fp(lev,1);
@@ -293,11 +303,13 @@ MacroscopicProperties::InitData ()
293303
InitializeMacroMultiFabUsingParser(m_sigma_mf.get(), m_sigma_parser->compile<3>(), lev);
294304
}
295305
296-
// Step 2: Overwrite with numpy mask in valid region if provided
297-
if (m_sigma_s == "parse_sigma_npy_file" || m_sigma_s == "parse_sigma_both") {
298-
InitializeMacroMultiFabFromNumpy(m_sigma_mf.get(), m_sigma_npy_filename, lev, m_npy_k_index, m_sigma_npy_value);
299-
if (!m_sigma_npy_filename2.empty()) {
300-
InitializeMacroMultiFabFromNumpy(m_sigma_mf.get(), m_sigma_npy_filename2, lev, m_npy_k_index2, m_sigma_npy_value);
306+
// Step 2: If not using PEC mask, overwrite with numpy mask in valid region if provided
307+
if (!warpx.use_PEC_mask) {
308+
if (m_sigma_s == "parse_sigma_npy_file" || m_sigma_s == "parse_sigma_both") {
309+
InitializeMacroMultiFabFromNumpy(m_sigma_mf.get(), m_sigma_npy_filename, lev, m_npy_k_index, m_sigma_npy_value);
310+
if (!m_sigma_npy_filename2.empty()) {
311+
InitializeMacroMultiFabFromNumpy(m_sigma_mf.get(), m_sigma_npy_filename2, lev, m_npy_k_index2, m_sigma_npy_value);
312+
}
301313
}
302314
}
303315

0 commit comments

Comments
 (0)