Skip to content

Commit

Permalink
Merge commit 'refs/pull/1394/head' of https://github.com/erf-model/ERF
Browse files Browse the repository at this point in the history
…into MetGridBC
  • Loading branch information
wiersema1 committed Jan 24, 2024
2 parents f1d50fd + e8dfed2 commit bea6815
Show file tree
Hide file tree
Showing 4 changed files with 436 additions and 431 deletions.
10 changes: 5 additions & 5 deletions Exec/DevTests/MetGrid/inputs_fitch_flowmas
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ amr.max_level = 0 # maximum level number allowed

# CHECKPOINT FILES
erf.check_file = chk # root name of checkpoint file
erf.check_int = 1 # number of timesteps between checkpoints
erf.check_int = 25 # number of timesteps between checkpoints

# PLOTFILES
erf.plot_file_1 = plt # prefix of plotfile name
erf.plot_int_1 = 1 # number of timesteps between plotfiles
erf.plot_vars_1 = qv Rhoqv density dens_hse rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta z_phys mapfac pres_hse pert_pres KE QKE
erf.plot_int_1 = 25 # number of timesteps between plotfiles
erf.plot_vars_1 = density dens_hse rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta z_phys mapfac pres_hse pert_pres

# SOLVER CHOICE
erf.alpha_T = 1.0
Expand All @@ -50,10 +50,10 @@ erf.molec_diff_type = "None"
erf.les_type = "Smagorinsky"
erf.Cs = 0.1

erf.moisture_model = "Kessler"
erf.moisture_model = "NullMoist" #"Kessler"

# INITIALIZATION WITH ATM DATA
erf.metgrid_bdy_width = 5
erf.metgrid_bdy_width = 7
erf.metgrid_bdy_set_width = 1
erf.init_type = "metgrid"
erf.nc_init_file_0 = "met_em.d01.2015-04-01_00_00_00.nc" "met_em.d01.2015-04-01_08_00_00.nc"
Expand Down
135 changes: 114 additions & 21 deletions Source/TimeIntegration/TI_slow_rhs_fun.H
Original file line number Diff line number Diff line change
Expand Up @@ -198,21 +198,55 @@
}

#ifdef ERF_USE_NETCDF
// Populate RHS for relaxation zones if using real bcs
// Populate RHS for set zones if using real bcs
if (use_real_bcs) {
if (((init_type == "real") || (init_type == "metgrid")) && (level==0)) {
int width, set_width;
int set_width;
if (init_type == "real") {
width = wrfbdy_width;
set_width = wrfbdy_set_width;
} else if (init_type == "metgrid") {
width = metgrid_bdy_width;
set_width = metgrid_bdy_set_width;
}
wrfbdy_compute_interior_ghost_rhs(init_type, bdy_time_interval, start_bdy_time, new_stage_time, slow_dt,
width, set_width, fine_geom,
S_rhs, S_data, bdy_data_xlo, bdy_data_xhi,
bdy_data_ylo, bdy_data_yhi);
#ifdef _OPENMP
#pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
#endif
for ( MFIter mfi(S_rhs[IntVar::cons],amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi) {
const Array4<Real> rhs_cons = S_rhs[IntVar::cons].array(mfi);
const Array4<Real> rhs_xmom = S_rhs[IntVar::xmom].array(mfi);
const Array4<Real> rhs_ymom = S_rhs[IntVar::ymom].array(mfi);
const Array4<Real> rhs_zmom = S_rhs[IntVar::zmom].array(mfi);
{
Box tbx = mfi.tilebox();
Box domain = geom[level].Domain();
Box bx_xlo, bx_xhi, bx_ylo, bx_yhi;
compute_interior_ghost_bxs_xy(tbx, domain, set_width, 0,
bx_xlo, bx_xhi,
bx_ylo, bx_yhi);
wrfbdy_zero_rhs_in_set_region(Rho_comp, 2, bx_xlo, bx_xhi, bx_ylo, bx_yhi, rhs_cons);
}

{
Box tbx = mfi.tilebox(IntVect(1,0,0));
Box domain = geom[level].Domain();
domain.convert(S_rhs[IntVar::xmom].boxArray().ixType());
Box bx_xlo, bx_xhi, bx_ylo, bx_yhi;
compute_interior_ghost_bxs_xy(tbx, domain, set_width, 0,
bx_xlo, bx_xhi,
bx_ylo, bx_yhi);
wrfbdy_zero_rhs_in_set_region(0, 1, bx_xlo, bx_xhi, bx_ylo, bx_yhi, rhs_xmom);
}

{
Box tbx = mfi.tilebox(IntVect(0,1,0));
Box domain = geom[level].Domain();
domain.convert(S_rhs[IntVar::ymom].boxArray().ixType());
Box bx_xlo, bx_xhi, bx_ylo, bx_yhi;
compute_interior_ghost_bxs_xy(tbx, domain, set_width, 0,
bx_xlo, bx_xhi,
bx_ylo, bx_yhi);
wrfbdy_zero_rhs_in_set_region(0, 1, bx_xlo, bx_xhi, bx_ylo, bx_yhi, rhs_ymom);
}
} // mfi
}
}
#endif
Expand Down Expand Up @@ -332,6 +366,29 @@
fr_as_crse, fr_as_fine
);
}

#ifdef ERF_USE_NETCDF
// Populate RHS for relaxation zones if using real bcs
if (use_real_bcs) {
if (((init_type == "real") || (init_type == "metgrid")) && (level==0)) {
int width, set_width;
if (init_type == "real") {
width = wrfbdy_width;
set_width = wrfbdy_set_width;
} else if (init_type == "metgrid") {
width = metgrid_bdy_width;
set_width = metgrid_bdy_set_width;
}
if (width > set_width + 1)
wrfbdy_compute_interior_ghost_rhs(init_type,
bdy_time_interval, start_bdy_time, new_stage_time,
width, set_width, fine_geom, S_new,
bdy_data_xlo, bdy_data_xhi,
bdy_data_ylo, bdy_data_yhi);
}
}
#endif

}; // end slow_rhs_fun_post

#ifdef ERF_USE_POISSON_SOLVE
Expand Down Expand Up @@ -368,20 +425,56 @@
dptr_rayleigh_thetabar);

#ifdef ERF_USE_NETCDF
// Populate RHS for relaxation zones
if (((init_type == "real") || (init_type == "metgrid")) && level == 0) {
int width, set_width;
if (init_type == "real") {
width = wrfbdy_width;
set_width = wrfbdy_set_width;
} else if (init_type == "metgrid") {
width = metgrid_bdy_width;
set_width = metgrid_bdy_set_width;
// Populate RHS for set zones if using real bcs
if (use_real_bcs) {
if (((init_type == "real") || (init_type == "metgrid")) && (level==0)) {
int set_width;
if (init_type == "real") {
set_width = wrfbdy_set_width;
} else if (init_type == "metgrid") {
set_width = metgrid_bdy_set_width;
}
#ifdef _OPENMP
#pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
#endif
for ( MFIter mfi(S_rhs[IntVar::cons],amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi) {
const Array4<Real> rhs_cons = S_rhs[IntVar::cons].array(mfi);
const Array4<Real> rhs_xmom = S_rhs[IntVar::xmom].array(mfi);
const Array4<Real> rhs_ymom = S_rhs[IntVar::ymom].array(mfi);
const Array4<Real> rhs_zmom = S_rhs[IntVar::zmom].array(mfi);
{
Box tbx = mfi.tilebox();
Box domain = geom[level].Domain();
Box bx_xlo, bx_xhi, bx_ylo, bx_yhi;
compute_interior_ghost_bxs_xy(tbx, domain, set_width, 0,
bx_xlo, bx_xhi,
bx_ylo, bx_yhi);
wrfbdy_zero_rhs_in_set_region(Rho_comp, 2, bx_xlo, bx_xhi, bx_ylo, bx_yhi, rhs_cons);
}

{
Box tbx = mfi.tilebox(IntVect(1,0,0));
Box domain = geom[level].Domain();
domain.convert(S_rhs[IntVar::xmom].boxArray().ixType());
Box bx_xlo, bx_xhi, bx_ylo, bx_yhi;
compute_interior_ghost_bxs_xy(tbx, domain, set_width, 0,
bx_xlo, bx_xhi,
bx_ylo, bx_yhi);
wrfbdy_zero_rhs_in_set_region(0, 1, bx_xlo, bx_xhi, bx_ylo, bx_yhi, rhs_xmom);
}

{
Box tbx = mfi.tilebox(IntVect(0,1,0));
Box domain = geom[level].Domain();
domain.convert(S_rhs[IntVar::ymom].boxArray().ixType());
Box bx_xlo, bx_xhi, bx_ylo, bx_yhi;
compute_interior_ghost_bxs_xy(tbx, domain, set_width, 0,
bx_xlo, bx_xhi,
bx_ylo, bx_yhi);
wrfbdy_zero_rhs_in_set_region(0, 1, bx_xlo, bx_xhi, bx_ylo, bx_yhi, rhs_ymom);
}
} // mfi
}
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
Loading

0 comments on commit bea6815

Please sign in to comment.