diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/Initialization/WarpXInitData.cpp | 30 | ||||
-rw-r--r-- | Source/Utils/WarpXUtil.cpp | 52 | ||||
-rw-r--r-- | Source/WarpX.H | 6 |
3 files changed, 15 insertions, 73 deletions
diff --git a/Source/Initialization/WarpXInitData.cpp b/Source/Initialization/WarpXInitData.cpp index 9e5dd6465..a29696a28 100644 --- a/Source/Initialization/WarpXInitData.cpp +++ b/Source/Initialization/WarpXInitData.cpp @@ -224,30 +224,14 @@ void WarpX::InitPML () { - // if periodicity defined in input, use existing pml interface - amrex::Vector<int> geom_periodicity(AMREX_SPACEDIM,0); - ParmParse pp_geometry("geometry"); - if (pp_geometry.queryarr("is_periodic", geom_periodicity)) { - for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { - if (geom_periodicity[idim] == 1) { - do_pml_Lo[idim] = 0; - do_pml_Hi[idim] = 0; - } + for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { + if (WarpX::field_boundary_lo[idim] == FieldBoundaryType::PML) { + do_pml = 1; + do_pml_Lo[idim] = 1; } - } else { - // setting do_pml = 0 as default and turning it on only when user-input is set to PML. - do_pml = 0; - do_pml_Lo = amrex::IntVect::TheZeroVector(); - do_pml_Hi = amrex::IntVect::TheZeroVector(); - for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { - if (WarpX::field_boundary_lo[idim] == FieldBoundaryType::PML) { - do_pml = 1; - do_pml_Lo[idim] = 1; - } - if (WarpX::field_boundary_hi[idim] == FieldBoundaryType::PML) { - do_pml = 1; - do_pml_Hi[idim] = 1; - } + if (WarpX::field_boundary_hi[idim] == FieldBoundaryType::PML) { + do_pml = 1; + do_pml_Hi[idim] = 1; } } if (finest_level > 0) do_pml = 1; diff --git a/Source/Utils/WarpXUtil.cpp b/Source/Utils/WarpXUtil.cpp index 112a66bd6..a88156f89 100644 --- a/Source/Utils/WarpXUtil.cpp +++ b/Source/Utils/WarpXUtil.cpp @@ -492,53 +492,7 @@ void ReadBCParams () ParmParse pp_algo("algo"); int maxwell_solver_id = GetAlgorithmInteger(pp_algo, "maxwell_solver"); if (pp_geometry.queryarr("is_periodic", geom_periodicity)) { - // set default field and particle boundary appropriately - for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { - if (geom_periodicity[idim] == 1) { - // set boundary to periodic based on user-defined periodicity - WarpX::field_boundary_lo[idim] = FieldBoundaryType::Periodic; - WarpX::field_boundary_hi[idim] = FieldBoundaryType::Periodic; - WarpX::particle_boundary_lo[idim] = ParticleBoundaryType::Periodic; - WarpX::particle_boundary_hi[idim] = ParticleBoundaryType::Periodic; - } else { - // if non-periodic and do_pml=0, then set default boundary to PEC - int pml_input = 1; - int silverMueller_input = 0; - pp_warpx.query("do_pml", pml_input); - pp_warpx.query("do_silver_mueller", silverMueller_input); - if (pml_input == 0 and silverMueller_input == 0) { - if (maxwell_solver_id == MaxwellSolverAlgo::PSATD) { - WarpX::field_boundary_lo[idim] = FieldBoundaryType::None; - WarpX::field_boundary_hi[idim] = FieldBoundaryType::None; - } else { - WarpX::field_boundary_lo[idim] = FieldBoundaryType::PEC; - WarpX::field_boundary_hi[idim] = FieldBoundaryType::PEC; - } -#ifdef WARPX_DIM_RZ - if (idim == 0) WarpX::field_boundary_lo[idim] = FieldBoundaryType::None; -#endif - } - } - } - // Temporarily setting default boundary to Damped until new boundary interface is introduced - if (maxwell_solver_id == MaxwellSolverAlgo::PSATD) { - ParmParse pp_psatd("psatd"); - int do_moving_window = 0; - pp_warpx.query("do_moving_window", do_moving_window); - if (do_moving_window == 1) { - std::string s; - pp_warpx.get("moving_window_dir", s); - int zdir; - if (s == "z" || s == "Z") { - zdir = AMREX_SPACEDIM-1; - WarpX::field_boundary_lo[zdir] = FieldBoundaryType::Damped; - WarpX::field_boundary_hi[zdir] = FieldBoundaryType::Damped; - } - } - } - return; - // When all boundary conditions are supported, the abort statement below will be introduced - //amrex::Abort("geometry.is_periodic is not supported. Please use `boundary.field_lo`, `boundary.field_hi` to specifiy field boundary conditions and 'boundary.particle_lo', 'boundary.particle_hi' to specify particle boundary conditions."); + amrex::Abort("geometry.is_periodic is not supported. Please use `boundary.field_lo`, `boundary.field_hi` to specifiy field boundary conditions and 'boundary.particle_lo', 'boundary.particle_hi' to specify particle boundary conditions."); } // particle boundary may not be explicitly specified for some applications bool particle_boundary_specified = false; @@ -628,6 +582,10 @@ void ReadBCParams () "Error : Field boundary at r=0 must be ``none``. \n"); #endif + // Appending periodicity information to input so that it can be used by amrex + // to set parameters necessary to define geometry and perform communication + // such as FillBoundary. The periodicity is 1 if user-define boundary condition is + // periodic else it is set to 0. pp_geometry.addarr("is_periodic", geom_periodicity); } diff --git a/Source/WarpX.H b/Source/WarpX.H index 371cc5663..a30262a25 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -1003,7 +1003,7 @@ private: amrex::Vector<std::unique_ptr<amrex::MultiFab> > charge_buf; // PML - int do_pml = 1; + int do_pml = 0; int do_silver_mueller = 0; int pml_ncell = 10; int pml_delta = 10; @@ -1012,8 +1012,8 @@ private: int do_pml_in_domain = 0; bool do_pml_dive_cleaning; // default set in WarpX.cpp bool do_pml_divb_cleaning; // default set in WarpX.cpp - amrex::IntVect do_pml_Lo = amrex::IntVect::TheUnitVector(); - amrex::IntVect do_pml_Hi = amrex::IntVect::TheUnitVector(); + amrex::IntVect do_pml_Lo = amrex::IntVect::TheZeroVector(); + amrex::IntVect do_pml_Hi = amrex::IntVect::TheZeroVector(); amrex::Vector<std::unique_ptr<PML> > pml; amrex::Real moving_window_x = std::numeric_limits<amrex::Real>::max(); |