From 6cca3160eb4bbdb75fe35b50f55235bf3a2512fb Mon Sep 17 00:00:00 2001 From: wiersema1 Date: Thu, 14 Nov 2024 11:13:28 -0800 Subject: [PATCH] Added assertions during initialization for init_type of "metgrid" and "real" that there are sufficient points in a relaxation zone for computing the laplacian. --- Source/Initialization/ERF_init_from_metgrid.cpp | 4 ++++ Source/Initialization/ERF_init_from_wrfinput.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/Source/Initialization/ERF_init_from_metgrid.cpp b/Source/Initialization/ERF_init_from_metgrid.cpp index 9ef04d428..913251734 100644 --- a/Source/Initialization/ERF_init_from_metgrid.cpp +++ b/Source/Initialization/ERF_init_from_metgrid.cpp @@ -35,6 +35,10 @@ ERF::init_from_metgrid (int lev) // At least two met_em files are necessary to calculate tendency terms. AMREX_ALWAYS_ASSERT(ntimes >= 2); + // At least three points are necessary if there is a relaxation zone. + if (real_width > real_set_width) + AMREX_ALWAYS_ASSERT(real_width-real_set_width >= 3); + // Size the SST and LANDMASK sst_lev[lev].resize(ntimes); lmask_lev[lev].resize(ntimes); diff --git a/Source/Initialization/ERF_init_from_wrfinput.cpp b/Source/Initialization/ERF_init_from_wrfinput.cpp index 9f43d8514..6c10f2005 100644 --- a/Source/Initialization/ERF_init_from_wrfinput.cpp +++ b/Source/Initialization/ERF_init_from_wrfinput.cpp @@ -305,6 +305,11 @@ ERF::init_from_wrfinput (int lev) if (nc_bdy_file.empty()) { amrex::Error("NetCDF boundary file name must be provided via input"); } + + // At least three points are necessary if there is a relaxation zone. + if (real_width > real_set_width) + AMREX_ALWAYS_ASSERT(real_width-real_set_width >= 3); + bdy_time_interval = read_from_wrfbdy(nc_bdy_file,geom[0].Domain(), bdy_data_xlo,bdy_data_xhi,bdy_data_ylo,bdy_data_yhi, real_width, start_bdy_time);