diff --git a/CMake/BuildERFExe.cmake b/CMake/BuildERFExe.cmake index dc9c4208c..e67a27fae 100644 --- a/CMake/BuildERFExe.cmake +++ b/CMake/BuildERFExe.cmake @@ -18,15 +18,8 @@ function(build_erf_lib erf_lib_name) target_compile_definitions(${erf_lib_name} PUBLIC ERF_USE_MOISTURE) if(ERF_ENABLE_MULTIBLOCK) - target_sources(${erf_lib_name} PRIVATE - ${SRC_DIR}/MultiBlock/ERF_MultiBlockContainer.cpp) target_compile_definitions(${erf_lib_name} PUBLIC ERF_USE_MULTIBLOCK) -# if(NOT ERF_MB_EXTERN) - target_sources(${erf_lib_name} PRIVATE - ${SRC_DIR}/MultiBlock/ERF_MultiBlockContainer.cpp) - target_include_directories(${erf_lib_name} PRIVATE $) -# endif() - endif() + endif() if(ERF_ENABLE_WARM_NO_PRECIP) target_compile_definitions(${erf_lib_name} PUBLIC ERF_USE_WARM_NO_PRECIP) @@ -91,10 +84,10 @@ function(build_erf_lib erf_lib_name) ${CMAKE_SOURCE_DIR}/Submodules/RRTMGP/cpp/extensions/fluxes_byband/mo_fluxes_byband_kernels.cpp ) - # The interface code needs to know about the RRTMGP includes + # The interface code needs to know about the RRTMGP includes target_compile_definitions(${erf_lib_name} PUBLIC ERF_USE_RRTMGP) - target_include_directories(${erf_lib_name} SYSTEM PUBLIC + target_include_directories(${erf_lib_name} SYSTEM PUBLIC ${CMAKE_SOURCE_DIR}/Submodules/RRTMGP/cpp/extensions/fluxes_byband ${CMAKE_SOURCE_DIR}/Submodules/RRTMGP/cpp/extensions/cloud_optics ${CMAKE_SOURCE_DIR}/Submodules/RRTMGP/cpp/examples @@ -161,7 +154,7 @@ function(build_erf_lib erf_lib_name) ${SRC_DIR}/PBL/ERF_ComputeDiffusivityMYNN25.cpp ${SRC_DIR}/PBL/ERF_ComputeDiffusivityYSU.cpp ${SRC_DIR}/SourceTerms/ERF_ApplySpongeZoneBCs.cpp - ${SRC_DIR}/SourceTerms/ERF_ApplySpongeZoneBCs_ReadFromFile.cpp + ${SRC_DIR}/SourceTerms/ERF_ApplySpongeZoneBCs_ReadFromFile.cpp ${SRC_DIR}/SourceTerms/ERF_make_buoyancy.cpp ${SRC_DIR}/SourceTerms/ERF_add_thin_body_sources.cpp ${SRC_DIR}/SourceTerms/ERF_make_mom_sources.cpp @@ -205,13 +198,6 @@ function(build_erf_lib erf_lib_name) ${SRC_DIR}/LandSurfaceModel/MM5/ERF_MM5.cpp ) - if(NOT "${erf_exe_name}" STREQUAL "erf_unit_tests") - target_sources(${erf_lib_name} - PRIVATE - ${SRC_DIR}/main.cpp - ) - endif() - include(AMReXBuildInfo) generate_buildinfo(${erf_lib_name} ${CMAKE_SOURCE_DIR}) if (${ERF_USE_INTERNAL_AMREX}) @@ -250,7 +236,7 @@ endif() target_include_directories(${erf_lib_name} PUBLIC $) target_include_directories(${erf_lib_name} PUBLIC $) target_include_directories(${erf_lib_name} PUBLIC $) - target_include_directories(${erf_lib_name} PUBLIC $) + target_include_directories(${erf_lib_name} PUBLIC $) target_include_directories(${erf_lib_name} PUBLIC $) target_include_directories(${erf_lib_name} PUBLIC $) target_include_directories(${erf_lib_name} PUBLIC $) @@ -261,7 +247,7 @@ endif() target_include_directories(${erf_lib_name} PUBLIC $) target_include_directories(${erf_lib_name} PUBLIC $) target_include_directories(${erf_lib_name} PUBLIC $) - + if(ERF_ENABLE_RRTMGP) target_link_libraries(${erf_lib_name} PUBLIC yakl) target_link_libraries(${erf_lib_name} PUBLIC rrtmgp) @@ -296,6 +282,13 @@ function(build_erf_exe erf_exe_name) set(SRC_DIR ${CMAKE_SOURCE_DIR}/Source) + if(NOT "${erf_exe_name}" STREQUAL "erf_unit_tests") + target_sources(${erf_exe_name} + PRIVATE + ${SRC_DIR}/main.cpp + ) + endif() + target_link_libraries(${erf_exe_name} PUBLIC ${erf_lib_name}) include(${CMAKE_SOURCE_DIR}/CMake/SetERFCompileFlags.cmake) set_erf_compile_flags(${erf_exe_name}) 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