From 0a2e9b1013ed6d4094d00030b1f241283b32c2c7 Mon Sep 17 00:00:00 2001 From: Mukul Dave Date: Fri, 11 Oct 2024 17:00:13 -0700 Subject: [PATCH] remove multiblock container and evolve stuff --- Source/ERF.H | 10 ++--- Source/ERF.cpp | 99 --------------------------------------------- Source/main.cpp | 104 ------------------------------------------------ 3 files changed, 5 insertions(+), 208 deletions(-) diff --git a/Source/ERF.H b/Source/ERF.H index 9f3f71d28..0a8230110 100644 --- a/Source/ERF.H +++ b/Source/ERF.H @@ -368,9 +368,6 @@ public: // Advance a block specified number of time steps void Evolve_MB (int MBstep, int max_block_step); - // Advance a block specified number of time steps - void Evolve_MB (MultiBlockContainer* mbc, int MBstep, int max_block_step); - // get the current time values amrex::Real get_t_old() {return t_old[0];} amrex::Real get_t_new() {return t_new[0];} @@ -383,15 +380,14 @@ public: // Public data copy for MB std::vector domain_p; - MultiBlockContainer *m_mbc = nullptr; amrex::Vector > vars_new; amrex::Vector > vars_old; // Velocity time averaged field amrex::Vector> vel_t_avg; amrex::Vector t_avg_cnt; - #endif + std::string pp_prefix {"erf"}; void fill_from_bndryregs (const amrex::Vector& mfs, @@ -947,6 +943,10 @@ private: #endif +#ifdef ERF_USE_MULTIBLOCK + MultiBlockContainer *m_mbc = nullptr; +#endif + static int verbose; static int mg_verbose; static bool use_heffte; diff --git a/Source/ERF.cpp b/Source/ERF.cpp index 332b068c6..db10aefb4 100644 --- a/Source/ERF.cpp +++ b/Source/ERF.cpp @@ -14,14 +14,6 @@ #include #include -#ifdef ERF_USE_MULTIBLOCK -#ifndef ERF_MB_EXTERN // enter only if multiblock does not involve an external class -#include -#else -#include -#endif -#endif - using namespace amrex; Real ERF::startCPUTime = 0.0; @@ -568,17 +560,6 @@ ERF::InitData () { BL_PROFILE_VAR("ERF::InitData()", InitData); InitData_pre(); -#if 0 -#ifdef ERF_USE_MULTIBLOCK -#ifndef ERF_MB_EXTERN // enter only if multiblock does not involve an external class - // Multiblock: hook to set BL & comms once ba/dm are known - if(domain_p[0].bigEnd(0) < 500 ) { - m_mbc->SetBoxLists(); - m_mbc->SetBlockCommMetaData(); - } -#endif -#endif -#endif InitData_post(); BL_PROFILE_VAR_STOP(InitData); } @@ -2010,86 +1991,6 @@ ERF::ERF (const RealBox& rb, int max_level_in, } #endif -#ifdef ERF_USE_MULTIBLOCK -// advance solution over specified block steps -void -ERF::Evolve_MB (int MBstep, int max_block_step) -{ - Real cur_time = t_new[0]; - - int step; - - // Take one coarse timestep by calling timeStep -- which recursively calls timeStep - // for finer levels (with or without subcycling) - for (int Bstep(0); Bstep < max_block_step && cur_time < stop_time; ++Bstep) - { - step = Bstep + MBstep - 1; - - Print() << "\nCoarse STEP " << step+1 << " starts ..." << std::endl; - - ComputeDt(step); - - // Make sure we have read enough of the boundary plane data to make it through this timestep - if (input_bndry_planes) - { - m_r2d->read_input_files(cur_time,dt[0],m_bc_extdir_vals); - } - - int lev = 0; - int iteration = 1; - timeStep(lev, cur_time, iteration); - -#ifndef ERF_MB_EXTERN - // DEBUG - // Multiblock: hook for erf2 to fill from erf1 - if(domain_p[0].bigEnd(0) < 500) { - for (int var_idx = 0; var_idx < Vars::NumTypes; ++var_idx) - m_mbc->FillPatchBlocks(var_idx,var_idx); - } -#endif - - cur_time += dt[0]; - - Print() << "Coarse STEP " << step+1 << " ends." << " TIME = " << cur_time - << " DT = " << dt[0] << std::endl; - - post_timestep(step, cur_time, dt[0]); - - if (writeNow(cur_time, dt[0], step+1, m_plot_int_1, m_plot_per_1)) { - last_plot_file_step_1 = step+1; - WritePlotFile(1,plot_var_names_1); - } - - if (writeNow(cur_time, dt[0], step+1, m_plot_int_2, m_plot_per_2)) { - last_plot_file_step_2 = step+1; - WritePlotFile(2,plot_var_names_2); - } - - if (writeNow(cur_time, dt[0], step+1, m_check_int, m_check_per)) { - last_check_file_step = step+1; -#ifdef ERF_USE_NETCDF - if (check_type == "netcdf") { - WriteNCCheckpointFile(); - } -#endif - if (check_type == "native") { - WriteCheckpointFile(); - } - } - -#ifdef AMREX_MEM_PROFILING - { - std::ostringstream ss; - ss << "[STEP " << step+1 << "]"; - MemProfiler::report(ss.str()); - } -#endif - - if (cur_time >= stop_time - 1.e-6*dt[0]) break; - } -} -#endif - bool ERF::writeNow(const Real cur_time, const Real dt_lev, const int nstep, const int plot_int, const Real plot_per) { diff --git a/Source/main.cpp b/Source/main.cpp index aaf932679..4cd2ee0b3 100644 --- a/Source/main.cpp +++ b/Source/main.cpp @@ -7,14 +7,6 @@ //#include "IO.H" #include "ERF.H" -#ifdef ERF_USE_MULTIBLOCK -#ifndef ERF_MB_EXTERN // enter only if multiblock does not involve an external class -#include -#else -#include -#endif -#endif - #ifdef ERF_USE_WW3_COUPLING #include #include @@ -124,101 +116,6 @@ int main (int argc, char* argv[]) // wallclock time const Real strt_total = amrex::second(); -#ifdef ERF_USE_MULTIBLOCK - { - // Vector of constructor parameters for MultiBlock - std::vector rb_v; - std::vector max_level_v; - std::vector coord_v; - std::vector> n_cell_v; - std::vector> is_per_v; - std::vector> ref_rat_v; - std::vector prefix_v; - int max_step{1}; - - // Local constructor parameters for vector - RealBox rb; - int max_level{0}; - int coord{0}; - amrex::Vector n_cell = {1,1,1}; - amrex::Array is_per = {1,1,1}; - amrex::Vector ref_rat = {amrex::IntVect(1,1,1)}; - - // Parse max steps for the block - { - ParmParse pp; - pp.query("max_step", max_step); - } - - // Parse data for erf1 constructor - { - ParmParse pp("erf1"); - amrex::Vector lo = {0.,0.,0.}; - amrex::Vector hi = {0.,0.,0.}; - amrex::Vector periodicity = {1,1,1}; - pp.queryarr("prob_lo",lo); - pp.queryarr("prob_hi",hi); - rb.setLo(lo); - rb.setHi(hi); - pp.query("max_level",max_level); - pp.query("coord",coord); - pp.queryarr("n_cell",n_cell); - pp.queryarr("is_periodic",periodicity); - { - for( int i(0); i lo = {0.,0.,0.}; - amrex::Vector hi = {0.,0.,0.}; - amrex::Vector periodicity = {1,1,1}; - pp.queryarr("prob_lo",lo); - pp.queryarr("prob_hi",hi); - rb.setLo(lo); - rb.setHi(hi); - pp.query("max_level",max_level); - pp.query("coord",coord); - pp.queryarr("n_cell",n_cell); - pp.queryarr("is_periodic",periodicity); - { - for( int i(0); i