From dfeb025881fcaaf1ccbea68d0413949e1606c866 Mon Sep 17 00:00:00 2001 From: ablelly Date: Fri, 7 Jun 2019 19:51:19 +0200 Subject: Added a partial flag for particles in PML (we still have to implement the fact that the flag has to be read in the input file) --- Source/Initialization/WarpXInitData.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Source/Initialization/WarpXInitData.cpp') diff --git a/Source/Initialization/WarpXInitData.cpp b/Source/Initialization/WarpXInitData.cpp index 0f33d1a0f..4e0a6c20e 100644 --- a/Source/Initialization/WarpXInitData.cpp +++ b/Source/Initialization/WarpXInitData.cpp @@ -88,7 +88,7 @@ WarpX::InitDiagnostics () { const Real* current_lo = geom[0].ProbLo(); const Real* current_hi = geom[0].ProbHi(); Real dt_boost = dt[0]; - + // Find the positions of the lab-frame box that corresponds to the boosted-frame box at t=0 Real zmin_lab = current_lo[moving_window_dir]/( (1.+beta_boost)*gamma_boost ); Real zmax_lab = current_hi[moving_window_dir]/( (1.+beta_boost)*gamma_boost ); @@ -97,7 +97,7 @@ WarpX::InitDiagnostics () { zmax_lab, moving_window_v, dt_snapshots_lab, num_snapshots_lab, gamma_boost, - t_new[0], dt_boost, + t_new[0], dt_boost, moving_window_dir, geom[0])); } } @@ -118,10 +118,10 @@ WarpX::InitFromScratch () InitPML(); -#ifdef WARPX_DO_ELECTROSTATIC +#ifdef WARPX_DO_ELECTROSTATIC if (do_electrostatic) { getLevelMasks(masks); - + // the plus one is to convert from num_cells to num_nodes getLevelMasks(gather_masks, n_buffer + 1); } @@ -134,13 +134,13 @@ WarpX::InitPML () if (do_pml) { pml[0].reset(new PML(boxArray(0), DistributionMap(0), &Geom(0), nullptr, - pml_ncell, pml_delta, 0, do_dive_cleaning, do_moving_window)); + pml_ncell, pml_delta, 0, do_dive_cleaning, do_moving_window, 1)); //pml_has_particles)); for (int lev = 1; lev <= finest_level; ++lev) { pml[lev].reset(new PML(boxArray(lev), DistributionMap(lev), &Geom(lev), &Geom(lev-1), pml_ncell, pml_delta, refRatio(lev-1)[0], do_dive_cleaning, - do_moving_window)); + do_moving_window, 1)); //pml_has_particles)); } } } @@ -226,7 +226,7 @@ WarpX::InitOpenbc () Vector alllohi(6*nprocs,100000); MPI_Allgather(lohi, 6, MPI_INT, alllohi.data(), 6, MPI_INT, ParallelDescriptor::Communicator()); - + BoxList bl{IndexType::TheNodeType()}; for (int i = 0; i < nprocs; ++i) { @@ -252,7 +252,7 @@ WarpX::InitOpenbc () rho_openbc.copy(*rho, 0, 0, 1, rho->nGrow(), 0, gm.periodicity(), FabArrayBase::ADD); const Real* dx = gm.CellSize(); - + warpx_openbc_potential(rho_openbc[myproc].dataPtr(), phi_openbc[myproc].dataPtr(), dx); BoxArray nba = boxArray(lev); -- cgit v1.2.3 From 6dfb11f5875a8d172ba11b4b4bb612f45c6d1f75 Mon Sep 17 00:00:00 2001 From: ablelly Date: Fri, 7 Jun 2019 20:42:12 +0200 Subject: Added a flag for particles in PMLs --- Source/BoundaryConditions/PML.H | 2 ++ Source/BoundaryConditions/PML.cpp | 15 ++++++++------- Source/Initialization/WarpXInitData.cpp | 4 ++-- Source/WarpX.H | 7 ++++--- Source/WarpX.cpp | 1 + 5 files changed, 17 insertions(+), 12 deletions(-) (limited to 'Source/Initialization/WarpXInitData.cpp') diff --git a/Source/BoundaryConditions/PML.H b/Source/BoundaryConditions/PML.H index e74924a24..2dfbe7a14 100644 --- a/Source/BoundaryConditions/PML.H +++ b/Source/BoundaryConditions/PML.H @@ -151,9 +151,11 @@ private: std::array,3> pml_E_fp; std::array,3> pml_B_fp; + std::array,3> pml_J_fp; std::array,3> pml_E_cp; std::array,3> pml_B_cp; + std::array,3> pml_J_cp; std::unique_ptr pml_F_fp; std::unique_ptr pml_F_cp; diff --git a/Source/BoundaryConditions/PML.cpp b/Source/BoundaryConditions/PML.cpp index d3b98054c..bbfc4118b 100644 --- a/Source/BoundaryConditions/PML.cpp +++ b/Source/BoundaryConditions/PML.cpp @@ -365,12 +365,13 @@ PML::PML (const BoxArray& grid_ba, const DistributionMapping& grid_dm, if (pml_has_particles){ - // pml_J_fp[0].reset(new MultiFab(amrex::convert(ba,WarpX::Jx_nodal_flag), dm, 2, ngb)); - // pml_J_fp[1].reset(new MultiFab(amrex::convert(ba,WarpX::Jy_nodal_flag), dm, 2, ngb)); - // pml_J_fp[2].reset(new MultiFab(amrex::convert(ba,WarpX::Jz_nodal_flag), dm, 2, ngb)); - // pml_J_fp[0]->setVal(0.0); - // pml_J_fp[1]->setVal(0.0); - // pml_J_fp[2]->setVal(0.0); + pml_J_fp[0].reset(new MultiFab(amrex::convert(ba,WarpX::jx_nodal_flag), dm, 2, ngb)); //convert(ba,WarpX::Jx_nodal_flag) + pml_J_fp[1].reset(new MultiFab(amrex::convert(ba,WarpX::jy_nodal_flag), dm, 2, ngb)); //convert(ba,WarpX::Jy_nodal_flag) + pml_J_fp[2].reset(new MultiFab(amrex::convert(ba,WarpX::jz_nodal_flag), dm, 2, ngb)); //convert(ba,WarpX::Jz_nodal_flag) + pml_J_fp[0]->setVal(0.0); + pml_J_fp[1]->setVal(0.0); + pml_J_fp[2]->setVal(0.0); + amrex::Print() << "PML HAS PARTICLES "<< std::endl; } @@ -412,7 +413,7 @@ PML::PML (const BoxArray& grid_ba, const DistributionMapping& grid_dm, { pml_F_cp.reset(new MultiFab(amrex::convert(cba,IntVect::TheUnitVector()), cdm, 3, ngf)); pml_F_cp->setVal(0.0); - amrex::Print() << "PML HAS PARTICLES "<< std::endl; + } sigba_cp.reset(new MultiSigmaBox(cba, cdm, grid_cba, cgeom->CellSize(), ncell, delta)); diff --git a/Source/Initialization/WarpXInitData.cpp b/Source/Initialization/WarpXInitData.cpp index 4e0a6c20e..bc7c2219a 100644 --- a/Source/Initialization/WarpXInitData.cpp +++ b/Source/Initialization/WarpXInitData.cpp @@ -134,13 +134,13 @@ WarpX::InitPML () if (do_pml) { pml[0].reset(new PML(boxArray(0), DistributionMap(0), &Geom(0), nullptr, - pml_ncell, pml_delta, 0, do_dive_cleaning, do_moving_window, 1)); //pml_has_particles)); + pml_ncell, pml_delta, 0, do_dive_cleaning, do_moving_window, pml_has_particles)); //pml_has_particles)); for (int lev = 1; lev <= finest_level; ++lev) { pml[lev].reset(new PML(boxArray(lev), DistributionMap(lev), &Geom(lev), &Geom(lev-1), pml_ncell, pml_delta, refRatio(lev-1)[0], do_dive_cleaning, - do_moving_window, 1)); //pml_has_particles)); + do_moving_window, pml_has_particles)); //pml_has_particles)); } } } diff --git a/Source/WarpX.H b/Source/WarpX.H index 2580c5320..f14420c74 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -149,12 +149,12 @@ public: BilinearFilter bilinear_filter; amrex::Vector< std::unique_ptr > nci_godfrey_filter_exeybz; amrex::Vector< std::unique_ptr > nci_godfrey_filter_bxbyez; - + static int num_mirrors; amrex::Vector mirror_z; amrex::Vector mirror_z_width; amrex::Vector mirror_z_npoints; - + void applyMirrors(amrex::Real time); void ComputeDt (); @@ -485,6 +485,7 @@ private: int do_pml = 1; int pml_ncell = 10; int pml_delta = 10; + int pml_has_particles = 0; amrex::Vector > pml; amrex::Real moving_window_x = std::numeric_limits::max(); @@ -495,7 +496,7 @@ private: int warpx_do_continuous_injection = 0; int num_injected_species = -1; amrex::Vector injected_plasma_species; - + int do_electrostatic = 0; int n_buffer = 4; amrex::Real const_dt = 0.5e-11; diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index c2cf97f30..829f151b0 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -379,6 +379,7 @@ WarpX::ReadParameters () pp.query("do_pml", do_pml); pp.query("pml_ncell", pml_ncell); pp.query("pml_delta", pml_delta); + pp.query("pml_has_particles", pml_has_particles); pp.query("dump_openpmd", dump_openpmd); pp.query("dump_plotfiles", dump_plotfiles); -- cgit v1.2.3 From e53c2b72b6a44b2507377eae9f66fff3bc813f2c Mon Sep 17 00:00:00 2001 From: ablelly Date: Tue, 16 Jul 2019 18:29:37 +0200 Subject: Started to add flag do_pml_in_domain for the merge request. --- Source/BoundaryConditions/PML.H | 18 +++---- Source/BoundaryConditions/PML.cpp | 82 +++++++++++++++++++------------- Source/FieldSolver/WarpXPushFieldsEM.cpp | 2 +- Source/Initialization/WarpXInitData.cpp | 6 +-- Source/Parallelization/WarpXComm.cpp | 18 +++---- 5 files changed, 71 insertions(+), 55 deletions(-) (limited to 'Source/Initialization/WarpXInitData.cpp') diff --git a/Source/BoundaryConditions/PML.H b/Source/BoundaryConditions/PML.H index 62a378986..c64eb8193 100644 --- a/Source/BoundaryConditions/PML.H +++ b/Source/BoundaryConditions/PML.H @@ -81,7 +81,7 @@ struct SigmaBox SigmaVect sigma_star_cum_fac; std::string pml_type; // if pml normal to x : if pml Hi : pml_type={1,0,0}; if pml Lo: pml_type={-1,0,0} - std::array pml_type_array; + std::array pml_type_array; }; namespace amrex { @@ -128,7 +128,7 @@ class PML public: PML (const amrex::BoxArray& ba, const amrex::DistributionMapping& dm, const amrex::Geometry* geom, const amrex::Geometry* cgeom, - int ncell, int delta, int ref_ratio, int do_dive_cleaning, int do_moving_window, int pml_has_particles); + int ncell, int delta, int ref_ratio, int do_dive_cleaning, int do_moving_window, int pml_has_particles, int do_pml_in_domain); void ComputePMLFactors (amrex::Real dt); @@ -149,25 +149,25 @@ public: { return *sigba_cp; } void ExchangeB (const std::array& B_fp, - const std::array& B_cp); + const std::array& B_cp, int do_pml_in_domain); void ExchangeE (const std::array& E_fp, - const std::array& E_cp); + const std::array& E_cp, int do_pml_in_domain); void CopyJinPMLs (const std::array& j_fp, const std::array& j_cp); void CopyJinReg (const std::array& j_fp, const std::array& j_cp); void ExchangeB (PatchType patch_type, - const std::array& Bp); + const std::array& Bp, int do_pml_in_domain); void ExchangeE (PatchType patch_type, - const std::array& Ep); + const std::array& Ep, int do_pml_in_domain); void CopyJinPMLs (PatchType patch_type, const std::array& jp); void CopyJinReg (PatchType patch_type, const std::array& jp); - void ExchangeF (amrex::MultiFab* F_fp, amrex::MultiFab* F_cp); - void ExchangeF (PatchType patch_type, amrex::MultiFab* Fp); + void ExchangeF (amrex::MultiFab* F_fp, amrex::MultiFab* F_cp, int do_pml_in_domain); + void ExchangeF (PatchType patch_type, amrex::MultiFab* Fp, int do_pml_in_domain); void FillBoundary (); void FillBoundaryE (); @@ -205,7 +205,7 @@ private: static amrex::BoxArray MakeBoxArray (const amrex::Geometry& geom, const amrex::BoxArray& grid_ba, int ncell); - static void Exchange (amrex::MultiFab& pml, amrex::MultiFab& reg, const amrex::Geometry& geom); + static void Exchange (amrex::MultiFab& pml, amrex::MultiFab& reg, const amrex::Geometry& geom, int do_pml_in_domain); static void CopyRegInPMLs (amrex::MultiFab& pml, amrex::MultiFab& reg, const amrex::Geometry& geom); static void CopyPMLsInReg (amrex::MultiFab& pml, amrex::MultiFab& reg, const amrex::Geometry& geom); }; diff --git a/Source/BoundaryConditions/PML.cpp b/Source/BoundaryConditions/PML.cpp index 1f1cc80c3..c8d8585d8 100644 --- a/Source/BoundaryConditions/PML.cpp +++ b/Source/BoundaryConditions/PML.cpp @@ -474,10 +474,11 @@ MultiSigmaBox::ComputePMLFactorsE (const Real* dx, Real dt) PML::PML (const BoxArray& grid_ba, const DistributionMapping& grid_dm, const Geometry* geom, const Geometry* cgeom, - int ncell, int delta, int ref_ratio, int do_dive_cleaning, int do_moving_window, int pml_has_particles) + int ncell, int delta, int ref_ratio, int do_dive_cleaning, int do_moving_window, int pml_has_particles, int do_pml_in_domain) : m_geom(geom), m_cgeom(cgeom) { + Box domain0 = geom->Domain(); for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { if ( ! geom->isPeriodic(idim) ) { @@ -486,7 +487,11 @@ PML::PML (const BoxArray& grid_ba, const DistributionMapping& grid_dm, } const BoxArray grid_ba_reduced = BoxArray(grid_ba.boxList().intersect(domain0)); - const BoxArray& ba = MakeBoxArray(*geom, grid_ba_reduced, ncell); //MakeBoxArray(*geom, grid_ba, ncell); + // const BoxArray& ba = MakeBoxArray(*geom, grid_ba_reduced, ncell); + // + // const BoxArray& ba = MakeBoxArray(*geom, grid_ba, ncell); + const BoxArray& ba = (do_pml_in_domain)? MakeBoxArray(*geom, grid_ba_reduced, ncell) : MakeBoxArray(*geom, grid_ba, ncell); + if (ba.size() == 0) { m_ok = false; return; @@ -529,8 +534,13 @@ PML::PML (const BoxArray& grid_ba, const DistributionMapping& grid_dm, pml_F_fp->setVal(0.0); } + if (do_pml_in_domain){ + sigba_fp.reset(new MultiSigmaBox(ba, dm, grid_ba_reduced, geom->CellSize(), ncell, delta)); + } + else { + sigba_fp.reset(new MultiSigmaBox(ba, dm, grid_ba, geom->CellSize(), ncell, delta)); + } - sigba_fp.reset(new MultiSigmaBox(ba, dm, grid_ba_reduced, geom->CellSize(), ncell, delta)); if (cgeom) { @@ -541,7 +551,8 @@ PML::PML (const BoxArray& grid_ba, const DistributionMapping& grid_dm, BoxArray grid_cba = grid_ba; grid_cba.coarsen(ref_ratio); const BoxArray grid_cba_reduced = BoxArray(grid_cba.boxList().intersect(domain0)); - const BoxArray& cba = MakeBoxArray(*cgeom, grid_cba_reduced, ncell); + // const BoxArray& cba = MakeBoxArray(*cgeom, grid_cba_reduced, ncell); + const BoxArray& cba = (do_pml_in_domain) ? MakeBoxArray(*cgeom, grid_cba_reduced, ncell) : MakeBoxArray(*cgeom, grid_cba, ncell); DistributionMapping cdm{cba}; @@ -572,8 +583,13 @@ PML::PML (const BoxArray& grid_ba, const DistributionMapping& grid_dm, pml_j_cp[1]->setVal(0.0); pml_j_cp[2]->setVal(0.0); - // sigba_cp.reset(new MultiSigmaBox(cba, cdm, grid_cba, cgeom->CellSize(), ncell, delta)); - sigba_cp.reset(new MultiSigmaBox(cba, cdm, grid_cba_reduced, cgeom->CellSize(), ncell, delta)); + if (do_pml_in_domain){ + sigba_cp.reset(new MultiSigmaBox(cba, cdm, grid_cba_reduced, cgeom->CellSize(), ncell, delta)); + } + else { + sigba_cp.reset(new MultiSigmaBox(cba, cdm, grid_cba, cgeom->CellSize(), ncell, delta)); + } + } } @@ -701,53 +717,53 @@ PML::GetF_cp () void PML::ExchangeB (const std::array& B_fp, - const std::array& B_cp) + const std::array& B_cp, int do_pml_in_domain) { - ExchangeB(PatchType::fine, B_fp); - ExchangeB(PatchType::coarse, B_cp); + ExchangeB(PatchType::fine, B_fp, do_pml_in_domain); + ExchangeB(PatchType::coarse, B_cp, do_pml_in_domain); } void PML::ExchangeB (PatchType patch_type, - const std::array& Bp) + const std::array& Bp, int do_pml_in_domain) { if (patch_type == PatchType::fine && pml_B_fp[0] && Bp[0]) { - Exchange(*pml_B_fp[0], *Bp[0], *m_geom); - Exchange(*pml_B_fp[1], *Bp[1], *m_geom); - Exchange(*pml_B_fp[2], *Bp[2], *m_geom); + Exchange(*pml_B_fp[0], *Bp[0], *m_geom, do_pml_in_domain); + Exchange(*pml_B_fp[1], *Bp[1], *m_geom, do_pml_in_domain); + Exchange(*pml_B_fp[2], *Bp[2], *m_geom, do_pml_in_domain); } else if (patch_type == PatchType::coarse && pml_B_cp[0] && Bp[0]) { - Exchange(*pml_B_cp[0], *Bp[0], *m_cgeom); - Exchange(*pml_B_cp[1], *Bp[1], *m_cgeom); - Exchange(*pml_B_cp[2], *Bp[2], *m_cgeom); + Exchange(*pml_B_cp[0], *Bp[0], *m_cgeom, do_pml_in_domain); + Exchange(*pml_B_cp[1], *Bp[1], *m_cgeom, do_pml_in_domain); + Exchange(*pml_B_cp[2], *Bp[2], *m_cgeom, do_pml_in_domain); } } void PML::ExchangeE (const std::array& E_fp, - const std::array& E_cp) + const std::array& E_cp, int do_pml_in_domain) { - ExchangeE(PatchType::fine, E_fp); - ExchangeE(PatchType::coarse, E_cp); + ExchangeE(PatchType::fine, E_fp, do_pml_in_domain); + ExchangeE(PatchType::coarse, E_cp, do_pml_in_domain); } void PML::ExchangeE (PatchType patch_type, - const std::array& Ep) + const std::array& Ep, int do_pml_in_domain) { if (patch_type == PatchType::fine && pml_E_fp[0] && Ep[0]) { - Exchange(*pml_E_fp[0], *Ep[0], *m_geom); - Exchange(*pml_E_fp[1], *Ep[1], *m_geom); - Exchange(*pml_E_fp[2], *Ep[2], *m_geom); + Exchange(*pml_E_fp[0], *Ep[0], *m_geom, do_pml_in_domain); + Exchange(*pml_E_fp[1], *Ep[1], *m_geom, do_pml_in_domain); + Exchange(*pml_E_fp[2], *Ep[2], *m_geom, do_pml_in_domain); } else if (patch_type == PatchType::coarse && pml_E_cp[0] && Ep[0]) { - Exchange(*pml_E_cp[0], *Ep[0], *m_cgeom); - Exchange(*pml_E_cp[1], *Ep[1], *m_cgeom); - Exchange(*pml_E_cp[2], *Ep[2], *m_cgeom); + Exchange(*pml_E_cp[0], *Ep[0], *m_cgeom, do_pml_in_domain); + Exchange(*pml_E_cp[1], *Ep[1], *m_cgeom, do_pml_in_domain); + Exchange(*pml_E_cp[2], *Ep[2], *m_cgeom, do_pml_in_domain); } } @@ -804,19 +820,19 @@ PML::CopyJinReg (const std::array& j_fp, } void -PML::ExchangeF (MultiFab* F_fp, MultiFab* F_cp) +PML::ExchangeF (MultiFab* F_fp, MultiFab* F_cp, int do_pml_in_domain) { - ExchangeF(PatchType::fine, F_fp); - ExchangeF(PatchType::coarse, F_cp); + ExchangeF(PatchType::fine, F_fp, do_pml_in_domain); + ExchangeF(PatchType::coarse, F_cp, do_pml_in_domain); } void -PML::ExchangeF (PatchType patch_type, MultiFab* Fp) +PML::ExchangeF (PatchType patch_type, MultiFab* Fp, int do_pml_in_domain) { if (patch_type == PatchType::fine && pml_F_fp && Fp) { - Exchange(*pml_F_fp, *Fp, *m_geom); + Exchange(*pml_F_fp, *Fp, *m_geom, do_pml_in_domain); } else if (patch_type == PatchType::coarse && pml_F_cp && Fp) { - Exchange(*pml_F_cp, *Fp, *m_cgeom); + Exchange(*pml_F_cp, *Fp, *m_cgeom, do_pml_in_domain); } } @@ -864,7 +880,7 @@ PML::ExchangeF (PatchType patch_type, MultiFab* Fp) // } void -PML::Exchange (MultiFab& pml, MultiFab& reg, const Geometry& geom) +PML::Exchange (MultiFab& pml, MultiFab& reg, const Geometry& geom, int do_pml_in_domain) { const IntVect& ngr = reg.nGrowVect(); diff --git a/Source/FieldSolver/WarpXPushFieldsEM.cpp b/Source/FieldSolver/WarpXPushFieldsEM.cpp index 298b03dc6..8b749fc54 100644 --- a/Source/FieldSolver/WarpXPushFieldsEM.cpp +++ b/Source/FieldSolver/WarpXPushFieldsEM.cpp @@ -315,7 +315,7 @@ WarpX::EvolveE (int lev, PatchType patch_type, amrex::Real a_dt) if (do_pml && pml[lev]->ok()) { - if (F) pml[lev]->ExchangeF(patch_type, F); + if (F) pml[lev]->ExchangeF(patch_type, F, do_pml_in_domain); const auto& pml_B = (patch_type == PatchType::fine) ? pml[lev]->GetB_fp() : pml[lev]->GetB_cp(); const auto& pml_E = (patch_type == PatchType::fine) ? pml[lev]->GetE_fp() : pml[lev]->GetE_cp(); diff --git a/Source/Initialization/WarpXInitData.cpp b/Source/Initialization/WarpXInitData.cpp index 76704bcfe..5598b29fd 100644 --- a/Source/Initialization/WarpXInitData.cpp +++ b/Source/Initialization/WarpXInitData.cpp @@ -134,13 +134,13 @@ WarpX::InitPML () if (do_pml) { pml[0].reset(new PML(boxArray(0), DistributionMap(0), &Geom(0), nullptr, - pml_ncell, pml_delta, 0, do_dive_cleaning, do_moving_window, pml_has_particles)); //pml_has_particles)); + pml_ncell, pml_delta, 0, do_dive_cleaning, do_moving_window, pml_has_particles, do_pml_in_domain)); //pml_has_particles)); for (int lev = 1; lev <= finest_level; ++lev) { pml[lev].reset(new PML(boxArray(lev), DistributionMap(lev), &Geom(lev), &Geom(lev-1), pml_ncell, pml_delta, refRatio(lev-1)[0], do_dive_cleaning, - do_moving_window, pml_has_particles)); //pml_has_particles)); + do_moving_window, pml_has_particles, do_pml_in_domain)); //pml_has_particles)); } } } @@ -322,7 +322,7 @@ WarpX::InitLevelData (int lev, Real time) void WarpX::InitLevelDataFFT (int lev, Real time) { - + Efield_fp_fft[lev][0]->setVal(0.0); Efield_fp_fft[lev][1]->setVal(0.0); Efield_fp_fft[lev][2]->setVal(0.0); diff --git a/Source/Parallelization/WarpXComm.cpp b/Source/Parallelization/WarpXComm.cpp index 9d85783b0..7c00a5297 100644 --- a/Source/Parallelization/WarpXComm.cpp +++ b/Source/Parallelization/WarpXComm.cpp @@ -18,7 +18,7 @@ WarpX::ExchangeWithPmlB (int lev) Bfield_fp[lev][2].get() }, { Bfield_cp[lev][0].get(), Bfield_cp[lev][1].get(), - Bfield_cp[lev][2].get() }); + Bfield_cp[lev][2].get() }, do_pml_in_domain); } } @@ -31,7 +31,7 @@ WarpX::ExchangeWithPmlE (int lev) Efield_fp[lev][2].get() }, { Efield_cp[lev][0].get(), Efield_cp[lev][1].get(), - Efield_cp[lev][2].get() }); + Efield_cp[lev][2].get() }, do_pml_in_domain); } } @@ -40,7 +40,7 @@ WarpX::ExchangeWithPmlF (int lev) { if (do_pml && pml[lev]->ok()) { pml[lev]->ExchangeF(F_fp[lev].get(), - F_cp[lev].get()); + F_cp[lev].get(), do_pml_in_domain); } } @@ -252,7 +252,7 @@ WarpX::FillBoundaryE (int lev, PatchType patch_type) pml[lev]->ExchangeE(patch_type, { Efield_fp[lev][0].get(), Efield_fp[lev][1].get(), - Efield_fp[lev][2].get() }); + Efield_fp[lev][2].get() }, do_pml_in_domain); pml[lev]->FillBoundaryE(patch_type); } @@ -267,7 +267,7 @@ WarpX::FillBoundaryE (int lev, PatchType patch_type) pml[lev]->ExchangeE(patch_type, { Efield_cp[lev][0].get(), Efield_cp[lev][1].get(), - Efield_cp[lev][2].get() }); + Efield_cp[lev][2].get() }, do_pml_in_domain); pml[lev]->FillBoundaryE(patch_type); } @@ -294,7 +294,7 @@ WarpX::FillBoundaryB (int lev, PatchType patch_type) pml[lev]->ExchangeB(patch_type, { Bfield_fp[lev][0].get(), Bfield_fp[lev][1].get(), - Bfield_fp[lev][2].get() }); + Bfield_fp[lev][2].get() }, do_pml_in_domain); pml[lev]->FillBoundaryB(patch_type); } const auto& period = Geom(lev).periodicity(); @@ -308,7 +308,7 @@ WarpX::FillBoundaryB (int lev, PatchType patch_type) pml[lev]->ExchangeB(patch_type, { Bfield_cp[lev][0].get(), Bfield_cp[lev][1].get(), - Bfield_cp[lev][2].get() }); + Bfield_cp[lev][2].get() }, do_pml_in_domain); pml[lev]->FillBoundaryB(patch_type); } const auto& cperiod = Geom(lev-1).periodicity(); @@ -331,7 +331,7 @@ WarpX::FillBoundaryF (int lev, PatchType patch_type) { if (do_pml && pml[lev]->ok()) { - pml[lev]->ExchangeF(patch_type, F_fp[lev].get()); + pml[lev]->ExchangeF(patch_type, F_fp[lev].get(), do_pml_in_domain); pml[lev]->FillBoundaryF(patch_type); } @@ -342,7 +342,7 @@ WarpX::FillBoundaryF (int lev, PatchType patch_type) { if (do_pml && pml[lev]->ok()) { - pml[lev]->ExchangeF(patch_type, F_cp[lev].get()); + pml[lev]->ExchangeF(patch_type, F_cp[lev].get(), do_pml_in_domain); pml[lev]->FillBoundaryF(patch_type); } -- cgit v1.2.3 From afe646b66116f7d554b6c3874f818cb2249b2922 Mon Sep 17 00:00:00 2001 From: ablelly Date: Tue, 16 Jul 2019 19:10:56 +0200 Subject: Cleaned code. Flag `do_pml_in_domain` is working. --- Source/BoundaryConditions/PML.cpp | 18 +----------------- Source/FieldSolver/WarpXPushFieldsEM.cpp | 12 ++---------- Source/Initialization/WarpXInitData.cpp | 4 ++-- 3 files changed, 5 insertions(+), 29 deletions(-) (limited to 'Source/Initialization/WarpXInitData.cpp') diff --git a/Source/BoundaryConditions/PML.cpp b/Source/BoundaryConditions/PML.cpp index e7c6e7bb2..3888a59d0 100644 --- a/Source/BoundaryConditions/PML.cpp +++ b/Source/BoundaryConditions/PML.cpp @@ -144,42 +144,35 @@ SigmaBox::SigmaBox (const Box& box, const BoxArray& grids, const Real* dx, int n if (amrex::grow(grid_box, idim, ncell).intersects(box)) { direct_faces.push_back(kv.first); - amrex::Print()<<"direct_faces"< 1, Box gaps not wide enough?\n"); } } - amrex::Print()<<"pml_type = "< Date: Thu, 25 Jul 2019 20:00:16 +0200 Subject: [WIP] First tests for flags on pml. Spurious charges appearing where there use to be corners - source is still to be identified. --- Source/BoundaryConditions/PML.cpp | 34 +++++++++++++++++++++++---------- Source/Initialization/WarpXInitData.cpp | 5 +++-- 2 files changed, 27 insertions(+), 12 deletions(-) (limited to 'Source/Initialization/WarpXInitData.cpp') diff --git a/Source/BoundaryConditions/PML.cpp b/Source/BoundaryConditions/PML.cpp index 316a2bd2b..f880ebc56 100644 --- a/Source/BoundaryConditions/PML.cpp +++ b/Source/BoundaryConditions/PML.cpp @@ -119,6 +119,8 @@ SigmaBox::SigmaBox (const Box& box, const BoxArray& grids, const Real* dx, int n sigma_star_cum_fac[idim].m_hi = hi[idim]; } + amrex::Print()< 1, Box gaps not wide enough?\n"); } } + amrex::Print()<