Skip to content

Commit

Permalink
WIP cleaned up errors from prior merge with development branch updates
Browse files Browse the repository at this point in the history
  • Loading branch information
wiersema1 committed Aug 27, 2023
1 parent 65265ae commit 3a745c6
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 58 deletions.
6 changes: 3 additions & 3 deletions Exec/DevTests/MetGrid/inputs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion Source/TimeIntegration/TI_fast_rhs_fun.H
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
16 changes: 8 additions & 8 deletions Source/TimeIntegration/TI_slow_rhs_fun.H
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
69 changes: 38 additions & 31 deletions Source/Utils/InteriorGhostCells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<MultiFab>& S_rhs,
Vector<MultiFab>& S_data,
Vector<Vector<FArrayBox>>& bdy_data_xlo,
Vector<Vector<FArrayBox>>& bdy_data_xhi,
Vector<Vector<FArrayBox>>& bdy_data_ylo,
Vector<Vector<FArrayBox>>& 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<MultiFab>& S_rhs,
Vector<MultiFab>& S_data,
Vector<Vector<FArrayBox>>& bdy_data_xlo,
Vector<Vector<FArrayBox>>& bdy_data_xhi,
Vector<Vector<FArrayBox>>& bdy_data_ylo,
Vector<Vector<FArrayBox>>& bdy_data_yhi)
{
BL_PROFILE_REGION("wrfbdy_compute_interior_ghost_RHS()");

Expand All @@ -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<int> var_map = {Vars::xvel, Vars::yvel, Vars::cons, Vars::cons};
Expand All @@ -150,13 +152,15 @@ compute_interior_ghost_RHS(const std::string& init_type,
// Variable icomp map
Vector<int> 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)
Expand All @@ -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
Expand Down Expand Up @@ -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
//==========================================================
Expand Down Expand Up @@ -334,7 +342,6 @@ compute_interior_ghost_RHS(const std::string& init_type,
});
} // ivar


// Velocity to momentum
//==========================================================
for (int ivar(ivarU); ivar <= ivarV; ivar++)
Expand Down
29 changes: 14 additions & 15 deletions Source/Utils/Utils.H
Original file line number Diff line number Diff line change
Expand Up @@ -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<amrex::MultiFab>& S_rhs,
amrex::Vector<amrex::MultiFab>& S_data,
amrex::Vector<amrex::Vector<amrex::FArrayBox>>& bdy_data_xlo,
amrex::Vector<amrex::Vector<amrex::FArrayBox>>& bdy_data_xhi,
amrex::Vector<amrex::Vector<amrex::FArrayBox>>& bdy_data_ylo,
amrex::Vector<amrex::Vector<amrex::FArrayBox>>& 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<amrex::MultiFab>& S_rhs,
amrex::Vector<amrex::MultiFab>& S_data,
amrex::Vector<amrex::Vector<amrex::FArrayBox>>& bdy_data_xlo,
amrex::Vector<amrex::Vector<amrex::FArrayBox>>& bdy_data_xhi,
amrex::Vector<amrex::Vector<amrex::FArrayBox>>& bdy_data_ylo,
amrex::Vector<amrex::Vector<amrex::FArrayBox>>& bdy_data_yhi);

/*
* Compute moist relaxation region RHS with wrfbdy
Expand Down

0 comments on commit 3a745c6

Please sign in to comment.