diff --git a/Src/EB/AMReX_EB2_3D_C.cpp b/Src/EB/AMReX_EB2_3D_C.cpp index 1f47f77e919..76fec00037f 100644 --- a/Src/EB/AMReX_EB2_3D_C.cpp +++ b/Src/EB/AMReX_EB2_3D_C.cpp @@ -372,7 +372,7 @@ int build_faces (Box const& bx, Array4 const& cell, GpuArray const& dx, GpuArray const& problo, bool cover_multiple_cuts, - bool plt_multiple_cuts, Array4 const& multicut_arr) noexcept + bool plt_multiple_cuts, Array4 const& mt_fcx, Array4 const& mt_fcy, Array4 const& mt_fcz) noexcept { Gpu::Buffer nmulticuts = {0}; int* hp = nmulticuts.hostData(); @@ -388,7 +388,7 @@ int build_faces (Box const& bx, Array4 const& cell, const Real dzinv = 1.0_rt/dx[2]; const Box& xbx = amrex::grow(amrex::surroundingNodes(bx,0),1); - AMREX_HOST_DEVICE_FOR_3D ( xbx, i, j, k, + AMREX_HOST_DEVICE_FOR_3D ( xbx, i, j, k, // this is face index { if (fx(i,j,k) == Type::regular) { apx(i,j,k) = 1.0_rt; @@ -465,9 +465,9 @@ int build_faces (Box const& bx, Array4 const& cell, if (ncuts > 2) { Gpu::Atomic::Add(dp,1); if (plt_multiple_cuts){ - multicut_arr(i,j,k) = ncuts; + mt_fcx(i,j,k,0) = 10.0; - #ifdef AMREX_USE_GPU + #ifndef AMREX_USE_GPU amrex::PrintToFile("loc_multicuts") << "fx: (x,y,z) = (" << problo[0]+(i)*dx[0] << ","<< problo[1]+(j)*dx[1] << "," << problo[2]+(k)*dx[2] << ") \n"; #endif } @@ -580,9 +580,9 @@ int build_faces (Box const& bx, Array4 const& cell, if (ncuts > 2) { Gpu::Atomic::Add(dp,1); if (plt_multiple_cuts){ - multicut_arr(i,j,k) = ncuts; + mt_fcy(i,j,k,0) = 10.0; - #ifdef AMREX_USE_GPU + #ifndef AMREX_USE_GPU amrex::PrintToFile("loc_multicuts") << "fy: (x,y,z) = (" << problo[0]+(i)*dx[0] << ","<< problo[1]+(j)*dx[1] << "," << problo[2]+(k)*dx[2] << ") \n"; #endif } @@ -695,9 +695,9 @@ int build_faces (Box const& bx, Array4 const& cell, if (ncuts > 2) { Gpu::Atomic::Add(dp,1); if (plt_multiple_cuts){ - multicut_arr(i,j,k) = ncuts; + mt_fcz(i,j,k,0) = 10.0; - #ifdef AMREX_USE_GPU + #ifndef AMREX_USE_GPU amrex::PrintToFile("loc_multicuts") << "fz: (x,y,z) = (" << problo[0]+(i)*dx[0] << ","<< problo[1]+(j)*dx[1] << "," << problo[2]+(k)*dx[2] << ") \n"; #endif } diff --git a/Src/EB/AMReX_EB2_C.H b/Src/EB/AMReX_EB2_C.H index fecea96ae09..9afc045e265 100644 --- a/Src/EB/AMReX_EB2_C.H +++ b/Src/EB/AMReX_EB2_C.H @@ -56,7 +56,7 @@ int build_faces (Box const& bx, Array4 const& cell, GpuArray const& dx, GpuArray const& problo, bool cover_multiple_cuts, - bool plt_multiple_cuts, Array4 const& multicut_arr) noexcept; //EY + bool plt_multiple_cuts, Array4 const& mt_fcx, Array4 const& mt_fcy, Array4 const& mt_fcz) noexcept; //EY void build_cells (Box const& bx, Array4 const& cell, Array4 const& fx, Array4 const& fy, diff --git a/Src/EB/AMReX_EB2_Level.H b/Src/EB/AMReX_EB2_Level.H index 3a1af1ed8df..f372eb91803 100644 --- a/Src/EB/AMReX_EB2_Level.H +++ b/Src/EB/AMReX_EB2_Level.H @@ -102,7 +102,12 @@ protected: IndexSpace const* m_parent; //EY - MultiFab multicut_count; + Vector multicut_mf; // test in progress + Array multicut_face; // store on face-centered + + MultiFab multicut_fcx; + MultiFab multicut_fcy; + MultiFab multicut_fcz; private: template friend class GShopLevel; @@ -299,13 +304,23 @@ GShopLevel::define_fine (G const& gshop, const Geometry& geom, m_bndrycent.define(m_grids, m_dmap, AMREX_SPACEDIM, ng, mf_info); m_bndrynorm.define(m_grids, m_dmap, AMREX_SPACEDIM, ng, mf_info); //EY - multicut_count.define(m_grids, m_dmap, 1, ng, mf_info); + // amrex::Print() << "MAKE VECTOR MULTIFAB MF" << "\n"; + // multicut_mf[0].define(m_grids, m_dmap, 1, 0, mf_info, MultiCutFab()); // this should be a leveldata + // amrex::Print() << "AFTER VECTOR MULTIFAB MF" << "\n"; + + multicut_fcx.define(m_grids, m_dmap, 1, ng, mf_info); //this is cell-centered values storage + multicut_fcy.define(m_grids, m_dmap, 1, ng, mf_info); // need to be fora similar to m_areafrac + multicut_fcz.define(m_grids, m_dmap, 1, ng, mf_info); // should be a face-centered boxes for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { m_areafrac[idim].define(amrex::convert(m_grids, IntVect::TheDimensionVector(idim)), m_dmap, 1, ng, mf_info); m_facecent[idim].define(amrex::convert(m_grids, IntVect::TheDimensionVector(idim)), m_dmap, AMREX_SPACEDIM-1, ng, mf_info); + // EY: multicuts------------------------------------------------------------------------ + multicut_face[idim].define(amrex::convert(m_grids, IntVect::TheDimensionVector(idim)), + m_dmap, AMREX_SPACEDIM-1, ng, mf_info); + //-------------------------------------------------------------------------------------- IntVect edge_type{1}; edge_type[idim] = 0; m_edgecent[idim].define(amrex::convert(m_grids, edge_type), m_dmap, 1, ng, mf_info); } @@ -365,8 +380,16 @@ GShopLevel::define_fine (G const& gshop, const Geometry& geom, Array4 const& bar = m_bndryarea.array(mfi); Array4 const& bct = m_bndrycent.array(mfi); Array4 const& bnm = m_bndrynorm.array(mfi); - //EY: - Array4 const& multicut_arr = multicut_count.array(mfi); + //EY: multicuts------------------------------------------------------- + //Individual MFs + Array4 const& multicut_arr_x = multicut_fcx.array(mfi); + Array4 const& multicut_arr_y = multicut_fcy.array(mfi); + Array4 const& multicut_arr_z = multicut_fcz.array(mfi); + //face center MF + AMREX_D_TERM(Array4 const& mt_fcx = multicut_face[0].array(mfi);, + Array4 const& mt_fcy = multicut_face[1].array(mfi);, + Array4 const& mt_fcz = multicut_face[2].array(mfi);); + //---------------------------------------------------------------------- AMREX_D_TERM(Array4 const& apx = m_areafrac[0].array(mfi);, Array4 const& apy = m_areafrac[1].array(mfi);, @@ -429,7 +452,7 @@ GShopLevel::define_fine (G const& gshop, const Geometry& geom, nmc = build_faces(vbx, cfg, ftx, fty, ftz, xdg, ydg, zdg, lst, xip, yip, zip, apx, apy, apz, fcx, fcy, fcz, - xm2, ym2, zm2, dx, problo, cover_multiple_cuts, plt_multiple_cuts, multicut_arr); + xm2, ym2, zm2, dx, problo, cover_multiple_cuts, plt_multiple_cuts, multicut_arr_x, multicut_arr_y, multicut_arr_z); cellflagtmp.resize(m_cellflag[mfi].box()); Elixir cellflagtmp_eli = cellflagtmp.elixir(); @@ -490,15 +513,23 @@ GShopLevel::define_fine (G const& gshop, const Geometry& geom, nsmallcells += nsm; nmulticuts += nmc; } - // EY: Here -> make plot file - if (plt_multiple_cuts) - { - WriteSingleLevelPlotfile("plt", multicut_count, {"multicut"}, geom, 0.0, 0); - amrex::Abort("amrex::EB2::build_faces: more than 2 cuts not supported"); - } } ParallelAllReduce::Sum({nsmallcells,nmulticuts}, ParallelContext::CommunicatorSub()); + // EY: Here -> make plot file + if (plt_multiple_cuts) + { + int finest_level = 0; + int lev = finest_level; + amrex::Print() << "MAKE PLOT FILE FOR MULTICUTS" << "\n"; + + WriteSingleLevelPlotfile("plt.x", multicut_fcx, {"multicut_x"}, geom, 0.0, 0); + WriteSingleLevelPlotfile("plt.y", multicut_fcy, {"multicut_y"}, geom, 0.0, 0); + WriteSingleLevelPlotfile("plt.z", multicut_fcz, {"multicut_z"}, geom, 0.0, 0); + + amrex::Abort("amrex::EB2::build_faces: more than 2 cuts not supported"); + } + if (nsmallcells == 0 && nmulticuts == 0) { break; } else {