From 3a745c65a69039a58aeb72c28509d1d328322ae6 Mon Sep 17 00:00:00 2001 From: wiersema1 Date: Sun, 27 Aug 2023 08:53:24 -0700 Subject: [PATCH] WIP cleaned up errors from prior merge with development branch updates --- Exec/DevTests/MetGrid/inputs | 6 +-- Source/TimeIntegration/TI_fast_rhs_fun.H | 4 +- Source/TimeIntegration/TI_slow_rhs_fun.H | 16 +++--- Source/Utils/InteriorGhostCells.cpp | 69 +++++++++++++----------- Source/Utils/Utils.H | 29 +++++----- 5 files changed, 66 insertions(+), 58 deletions(-) diff --git a/Exec/DevTests/MetGrid/inputs b/Exec/DevTests/MetGrid/inputs index f9770ced0..afdd66ac7 100644 --- a/Exec/DevTests/MetGrid/inputs +++ b/Exec/DevTests/MetGrid/inputs @@ -6,8 +6,8 @@ amrex.fpe_trap_zero = 1 amrex.fpe_trap_overflow = 1 # PROBLEM SIZE & GEOMETRY -geometry.prob_extent = 28000 16000 40000 -amr.n_cell = 140 80 31 +geometry.prob_extent = 28000 16000 8000 +amr.n_cell = 140 80 100 geometry.is_periodic = 0 0 0 @@ -52,7 +52,7 @@ erf.les_type = "Smagorinsky" #erf.les_type = "Deardorff" erf.Cs = 0.1 -erf.terrain_z_levels = 0 130 354 583 816 1054 1549 2068 2615 3193 3803 4450 5142 5892 6709 7603 8591 9702 10967 12442 14230 16610 18711 20752 22133 23960 26579 28493 31236 33699 36068 40000 +#erf.terrain_z_levels = 0 130 354 583 816 1054 1549 2068 2615 3193 3803 4450 5142 5892 6709 7603 8591 9702 10967 12442 14230 16610 18711 20752 22133 23960 26579 28493 31236 33699 36068 40000 # INITIALIZATION WITH ATM DATA erf.init_type = "metgrid" diff --git a/Source/TimeIntegration/TI_fast_rhs_fun.H b/Source/TimeIntegration/TI_fast_rhs_fun.H index ed1435f68..ed34109bd 100644 --- a/Source/TimeIntegration/TI_fast_rhs_fun.H +++ b/Source/TimeIntegration/TI_fast_rhs_fun.H @@ -142,7 +142,9 @@ auto fast_rhs_fun = [&](int fast_step, int n_sub, #ifdef ERF_USE_NETCDF // Update vars in set zone (relaxation already updated) - if (((init_type == "real") || (init_type == "metgrid")) && level == 0 && wrfbdy_set_width>0) + if ((level == 0) && + (((init_type == "real") && (wrfbdy_set_width>0)) || + ((init_type == "metgrid") && (metgrid_bdy_set_width>0)))) { if (fast_step == 0 ) { update_interior_ghost(dtau, wrfbdy_set_width, boxes_at_level[level], S_slow_rhs, S_old, S_data); } else { diff --git a/Source/TimeIntegration/TI_slow_rhs_fun.H b/Source/TimeIntegration/TI_slow_rhs_fun.H index 648c2d90a..2917c3b1f 100644 --- a/Source/TimeIntegration/TI_slow_rhs_fun.H +++ b/Source/TimeIntegration/TI_slow_rhs_fun.H @@ -203,10 +203,10 @@ width = metgrid_bdy_width; set_width = metgrid_bdy_set_width; } - compute_interior_ghost_RHS(init_type, bdy_time_interval, start_bdy_time, new_stage_time, slow_dt, - width-1, set_width, fine_geom, - S_rhs, S_data, bdy_data_xlo, bdy_data_xhi, - bdy_data_ylo, bdy_data_yhi, start_bdy_time); + wrfbdy_compute_interior_ghost_RHS(init_type, bdy_time_interval, start_bdy_time, new_stage_time, slow_dt, + width-1, set_width, fine_geom, + S_rhs, S_data, bdy_data_xlo, bdy_data_xhi, + bdy_data_ylo, bdy_data_yhi); } #endif @@ -360,10 +360,10 @@ set_width = metgrid_bdy_set_width; } amrex::Print() << " DJW[TI_slow_rhs_fun.H]: start_bdy_time \t" << start_bdy_time << std::endl; - compute_interior_ghost_RHS(init_type, bdy_time_interval, start_bdy_time, new_stage_time, slow_dt, - width-1, set_width, fine_geom, - S_rhs, S_data, bdy_data_xlo, bdy_data_xhi, - bdy_data_ylo, bdy_data_yhi, start_bdy_time); + wrfbdy_compute_interior_ghost_RHS(init_type, bdy_time_interval, start_bdy_time, new_stage_time, slow_dt, + width-1, set_width, fine_geom, + S_rhs, S_data, bdy_data_xlo, bdy_data_xhi, + bdy_data_ylo, bdy_data_yhi); } #endif diff --git a/Source/Utils/InteriorGhostCells.cpp b/Source/Utils/InteriorGhostCells.cpp index 1bf4bbedf..350e9c231 100644 --- a/Source/Utils/InteriorGhostCells.cpp +++ b/Source/Utils/InteriorGhostCells.cpp @@ -106,21 +106,20 @@ compute_interior_ghost_bxs_xy(const Box& bx, * @param[in] start_bdy_time time of the first boundary data read in */ void -compute_interior_ghost_RHS(const std::string& init_type, - const Real& bdy_time_interval, - const Real& start_bdy_time, - const Real& time, - const Real& delta_t, - const int& width, - const int& set_width, - const Geometry& geom, - Vector& S_rhs, - Vector& S_data, - Vector>& bdy_data_xlo, - Vector>& bdy_data_xhi, - Vector>& bdy_data_ylo, - Vector>& bdy_data_yhi, - const Real start_bdy_time) +wrfbdy_compute_interior_ghost_RHS(const std::string& init_type, + const Real& bdy_time_interval, + const Real& start_bdy_time, + const Real& time, + const Real& delta_t, + const int& width, + const int& set_width, + const Geometry& geom, + Vector& S_rhs, + Vector& S_data, + Vector>& bdy_data_xlo, + Vector>& bdy_data_xhi, + Vector>& bdy_data_ylo, + Vector>& bdy_data_yhi) { BL_PROFILE_REGION("wrfbdy_compute_interior_ghost_RHS()"); @@ -142,6 +141,9 @@ compute_interior_ghost_RHS(const std::string& init_type, FArrayBox V_xlo, V_xhi, V_ylo, V_yhi; FArrayBox R_xlo, R_xhi, R_ylo, R_yhi; FArrayBox T_xlo, T_xhi, T_ylo, T_yhi; +#if defined(ERF_USE_MOISTURE) || defined(ERF_USE_WARM_NO_PRECIP) + FArrayBox Q_xlo, Q_xhi, Q_ylo, Q_yhi; +#endif // Variable index map (WRFBdyVars -> Vars) Vector var_map = {Vars::xvel, Vars::yvel, Vars::cons, Vars::cons}; @@ -150,13 +152,15 @@ compute_interior_ghost_RHS(const std::string& init_type, // Variable icomp map Vector comp_map = {0, 0, Rho_comp, RhoTheta_comp}; -#if defined(ERF_USE_MOISTURE) - var_map.push_back( Vars::cons ); - comp_map.push_back( RhoQt_comp ); -#elif defined(ERF_USE_WARM_NO_PRECIP) - var_map.push_back( Vars::cons ); - comp_map.push_back( RhoQv_comp ); -#endif +//#if defined(ERF_USE_MOISTURE) +// var_map.push_back( Vars::cons ); +// ivar_map.push_back( IntVar::cons ); +// comp_map.push_back( RhoQt_comp ); +//#elif defined(ERF_USE_WARM_NO_PRECIP) +// var_map.push_back( Vars::cons ); +// ivar_map.push_back( IntVar::cons ); +// comp_map.push_back( RhoQv_comp ); +//#endif int BdyEnd, ivarU, ivarV, ivarR, ivarT; #if defined(ERF_USE_MOISTURE) || defined(ERF_USE_WARM_NO_PRECIP) @@ -168,20 +172,20 @@ compute_interior_ghost_RHS(const std::string& init_type, ivarV = WRFBdyVars::V; ivarR = WRFBdyVars::R; ivarT = WRFBdyVars::T; -#if defined(ERF_USE_MOISTURE) || defined(ERF_USE_WARM_NO_PRECIP) - BdyEnd += 1; - ivarQV = WRFBdyVars::QV; -#endif +//#if defined(ERF_USE_MOISTURE) || defined(ERF_USE_WARM_NO_PRECIP) +// BdyEnd += 1; +// ivarQV = WRFBdyVars::QV; +//#endif } else if (init_type == "metgrid") { BdyEnd = MetGridBdyVars::NumTypes-1; ivarU = MetGridBdyVars::U; ivarV = MetGridBdyVars::V; ivarR = MetGridBdyVars::R; ivarT = MetGridBdyVars::T; -#if defined(ERF_USE_MOISTURE) || defined(ERF_USE_WARM_NO_PRECIP) - BdyEnd += 1; - ivarQV = MetGridBdyVars::QV; -#endif +//#if defined(ERF_USE_MOISTURE) || defined(ERF_USE_WARM_NO_PRECIP) +// BdyEnd += 1; +// ivarQV = MetGridBdyVars::QV; +//#endif } // Size the FABs @@ -238,6 +242,10 @@ compute_interior_ghost_RHS(const std::string& init_type, Elixir T_xlo_eli = T_xlo.elixir(); Elixir T_xhi_eli = T_xhi.elixir(); Elixir T_ylo_eli = T_ylo.elixir(); Elixir T_yhi_eli = T_yhi.elixir(); +#if defined(ERF_USE_MOISTURE) || defined(ERF_USE_WARM_NO_PRECIP) + Elixir Q_xlo_eli = Q_xlo.elixir(); Elixir Q_xhi_eli = Q_xhi.elixir(); + Elixir Q_ylo_eli = Q_ylo.elixir(); Elixir Q_yhi_eli = Q_yhi.elixir(); +#endif // Populate FABs from boundary interpolation //========================================================== @@ -334,7 +342,6 @@ compute_interior_ghost_RHS(const std::string& init_type, }); } // ivar - // Velocity to momentum //========================================================== for (int ivar(ivarU); ivar <= ivarV; ivar++) diff --git a/Source/Utils/Utils.H b/Source/Utils/Utils.H index 1ce08bcd0..8f65a4677 100644 --- a/Source/Utils/Utils.H +++ b/Source/Utils/Utils.H @@ -259,21 +259,20 @@ compute_Laplacian_relaxation (const amrex::Real& delta_t, /* * Compute relaxation region RHS with wrfbdy or metgrid forcing */ -void compute_interior_ghost_RHS(const std::string& init_type, - const amrex::Real& bdy_time_interval, - const amrex::Real& start_bdy_time, - const amrex::Real& time, - const amrex::Real& delta_t, - const int& width, - const int& set_width, - const amrex::Geometry& geom, - amrex::Vector& S_rhs, - amrex::Vector& S_data, - amrex::Vector>& bdy_data_xlo, - amrex::Vector>& bdy_data_xhi, - amrex::Vector>& bdy_data_ylo, - amrex::Vector>& bdy_data_yhi, - const amrex::Real start_bdy_time); +void wrfbdy_compute_interior_ghost_RHS(const std::string& init_type, + const amrex::Real& bdy_time_interval, + const amrex::Real& start_bdy_time, + const amrex::Real& time, + const amrex::Real& delta_t, + const int& width, + const int& set_width, + const amrex::Geometry& geom, + amrex::Vector& S_rhs, + amrex::Vector& S_data, + amrex::Vector>& bdy_data_xlo, + amrex::Vector>& bdy_data_xhi, + amrex::Vector>& bdy_data_ylo, + amrex::Vector>& bdy_data_yhi); /* * Compute moist relaxation region RHS with wrfbdy