diff options
Diffstat (limited to 'Source/Evolve/WarpXEvolveES.cpp')
-rw-r--r-- | Source/Evolve/WarpXEvolveES.cpp | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/Source/Evolve/WarpXEvolveES.cpp b/Source/Evolve/WarpXEvolveES.cpp index effd6ec96..61a8a5f32 100644 --- a/Source/Evolve/WarpXEvolveES.cpp +++ b/Source/Evolve/WarpXEvolveES.cpp @@ -179,30 +179,6 @@ void WarpX::zeroOutBoundary(amrex::MultiFab& input_data, bndry_data.FillBoundary(); } -void WarpX::sumFineToCrseNodal(const amrex::MultiFab& fine, - amrex::MultiFab& crse, - const amrex::Geometry& cgeom, - const amrex::IntVect& ratio) { - const BoxArray& fine_BA = fine.boxArray(); - const DistributionMapping& fine_dm = fine.DistributionMap(); - BoxArray coarsened_fine_BA = fine_BA; - coarsened_fine_BA.coarsen(ratio); - - MultiFab coarsened_fine_data(coarsened_fine_BA, fine_dm, 1, 0); - coarsened_fine_data.setVal(0.0); - - for (MFIter mfi(coarsened_fine_data); mfi.isValid(); ++mfi) { - const Box& bx = mfi.validbox(); - const Box& crse_box = coarsened_fine_data[mfi].box(); - const Box& fine_box = fine[mfi].box(); - WRPX_SUM_FINE_TO_CRSE_NODAL(bx.loVect(), bx.hiVect(), ratio.getVect(), - coarsened_fine_data[mfi].dataPtr(), crse_box.loVect(), crse_box.hiVect(), - fine[mfi].dataPtr(), fine_box.loVect(), fine_box.hiVect()); - } - - crse.copy(coarsened_fine_data, cgeom.periodicity(), FabArrayBase::ADD); -} - void WarpX::fixRHSForSolve(Vector<std::unique_ptr<MultiFab> >& rhs, const Vector<std::unique_ptr<FabArray<BaseFab<int> > > >& masks) const { @@ -242,104 +218,3 @@ void WarpX::getLevelMasks(Vector<std::unique_ptr<FabArray<BaseFab<int> > > >& ma } } } - - -void WarpX::computePhi(const Vector<std::unique_ptr<MultiFab> >& rho, - Vector<std::unique_ptr<MultiFab> >& phi) const { - - - int num_levels = rho.size(); - Vector<std::unique_ptr<MultiFab> > rhs(num_levels); - for (int lev = 0; lev < num_levels; ++lev) { - phi[lev]->setVal(0.0, 2); - rhs[lev].reset(new MultiFab(rho[lev]->boxArray(), dmap[lev], 1, 0)); - MultiFab::Copy(*rhs[lev], *rho[lev], 0, 0, 1, 0); - rhs[lev]->mult(-1.0/PhysConst::ep0, 0); - } - - fixRHSForSolve(rhs, masks); - - bool nodal = true; - bool have_rhcc = false; - int nc = 0; - int Ncomp = 1; - int stencil = ND_CROSS_STENCIL; - int verbose = 0; - Vector<int> mg_bc(2*AMREX_SPACEDIM, 1); // this means Dirichlet - Real rel_tol = 1.0e-14; - Real abs_tol = 1.0e-14; - - Vector<Geometry> level_geom(1); - Vector<BoxArray> level_grids(1); - Vector<DistributionMapping> level_dm(1); - Vector<MultiFab*> level_phi(1); - Vector<MultiFab*> level_rhs(1); - - for (int lev = 0; lev < num_levels; ++lev) { - level_phi[0] = phi[lev].get(); - level_rhs[0] = rhs[lev].get(); - level_geom[0] = geom[lev]; - level_grids[0] = grids[lev]; - level_dm[0] = dmap[lev]; - - MGT_Solver solver(level_geom, mg_bc.dataPtr(), level_grids, - level_dm, nodal, - stencil, have_rhcc, nc, Ncomp, verbose); - - solver.set_nodal_const_coefficients(1.0); - - solver.solve_nodal(level_phi, level_rhs, rel_tol, abs_tol); - - if (lev < num_levels-1) { - - NoOpPhysBC cphysbc, fphysbc; -#if AMREX_SPACEDIM == 3 - int lo_bc[] = {BCType::int_dir, BCType::int_dir, BCType::int_dir}; - int hi_bc[] = {BCType::int_dir, BCType::int_dir, BCType::int_dir}; -#else - int lo_bc[] = {BCType::int_dir, BCType::int_dir}; - int hi_bc[] = {BCType::int_dir, BCType::int_dir}; -#endif - Vector<BCRec> bcs(1, BCRec(lo_bc, hi_bc)); - NodeBilinear mapper; - - amrex::InterpFromCoarseLevel(*phi[lev+1], 0.0, *phi[lev], - 0, 0, 1, geom[lev], geom[lev+1], - cphysbc, fphysbc, - IntVect(AMREX_D_DECL(2, 2, 2)), &mapper, bcs); - } - } - - for (int lev = 0; lev < num_levels; ++lev) { - const Geometry& gm = geom[lev]; - phi[lev]->FillBoundary(gm.periodicity()); - } -} - -void WarpX::computeE(Vector<std::array<std::unique_ptr<MultiFab>, 3> >& E, - const Vector<std::unique_ptr<MultiFab> >& phi) const { - - const int num_levels = E.size(); - for (int lev = 0; lev < num_levels; ++lev) { - const auto& gm = GetInstance().Geom(lev); - const Real* dx = gm.CellSize(); - for (MFIter mfi(*phi[lev]); mfi.isValid(); ++mfi) { - const Box& bx = mfi.validbox(); - - WRPX_COMPUTE_E_NODAL(bx.loVect(), bx.hiVect(), - (*phi[lev] )[mfi].dataPtr(), - (*E[lev][0])[mfi].dataPtr(), - (*E[lev][1])[mfi].dataPtr(), -#if AMREX_SPACEDIM == 3 - (*E[lev][2])[mfi].dataPtr(), -#endif - dx); - } - - E[lev][0]->FillBoundary(gm.periodicity()); - E[lev][1]->FillBoundary(gm.periodicity()); -#if AMREX_SPACEDIM == 3 - E[lev][2]->FillBoundary(gm.periodicity()); -#endif - } -} |