Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Exec/ERF_Prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ Problem::update_rhotheta_sources (const Real& time,
{
if (src->empty()) return;

const int khi = geom.Domain().bigEnd()[2];
const int khi = geom.Domain().bigEnd()[2];

// If the z coordinate varies in time and or space, then the the height
// needs to be calculated at each time step. Here, we assume that only
Expand Down
17 changes: 11 additions & 6 deletions Source/BoundaryConditions/ERF_SurfaceLayer.H
Original file line number Diff line number Diff line change
Expand Up @@ -439,23 +439,28 @@ public:

// 2D MFs for U*, T*, T_surf
//--------------------------------------------------------
#ifdef AMREX_USE_FLOAT
amrex::Real bogus_val = amrex::Real(1.234e10);
#else
amrex::Real bogus_val = amrex::Real(1.234e30);
#endif
u_star[lev] = std::make_unique<amrex::MultiFab>(ba_flux, dm, ncomp, ng);
u_star[lev]->setVal(1.E34);
u_star[lev]->setVal(bogus_val);

w_star[lev] = std::make_unique<amrex::MultiFab>(ba_flux, dm, ncomp, ng);
w_star[lev]->setVal(1.E34);
w_star[lev]->setVal(bogus_val);

t_star[lev] = std::make_unique<amrex::MultiFab>(ba_flux, dm, ncomp, ng);
t_star[lev]->setVal(0.0); // default to neutral
t_star[lev]->setVal(zero); // default to neutral

q_star[lev] = std::make_unique<amrex::MultiFab>(ba_flux, dm, ncomp, ng);
q_star[lev]->setVal(0.0); // default to dry
q_star[lev]->setVal(zero); // default to dry

olen[lev] = std::make_unique<amrex::MultiFab>(ba_flux, dm, ncomp, ng);
olen[lev]->setVal(1.E34);
olen[lev]->setVal(bogus_val);

pblh[lev] = std::make_unique<amrex::MultiFab>(ba_flux, dm, ncomp, ng);
pblh[lev]->setVal(1.E34);
pblh[lev]->setVal(bogus_val);

t_surf[lev] = std::make_unique<amrex::MultiFab>(ba_flux, dm, ncomp, ng);
t_surf[lev]->setVal(default_land_surf_temp);
Expand Down
16 changes: 10 additions & 6 deletions Source/EB/ERF_EBMOSTStress.H
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ struct moeng_flux_eb
amrex::Real wsp_mean = umm_arr(i,j,0);
wsp_mean = std::max(wsp_mean, WSMIN);

amrex::Real wsp = sqrt(velx*velx+vely*vely);
amrex::Real wsp = std::sqrt(velx*velx+vely*vely);
amrex::Real num1 = wsp * (qv_mean-qv_surf);
amrex::Real num2 = wsp_mean * (qv-qv_mean);

Expand Down Expand Up @@ -407,7 +407,7 @@ struct moeng_flux_eb
wsp_mean = std::max(wsp_mean, WSMIN);

// Use tangential velocity magnitude instead of Cartesian
amrex::Real wsp = sqrt(velx_tangent*velx_tangent+vely_tangent*vely_tangent);
amrex::Real wsp = std::sqrt(velx_tangent*velx_tangent+vely_tangent*vely_tangent);
amrex::Real num1 = wsp * (theta_mean-theta_surf);
amrex::Real num2 = wsp_mean * (theta-theta_mean);

Expand Down Expand Up @@ -613,7 +613,7 @@ struct moeng_flux_eb
// multiplying the modeled shear stress (rho*ustar^2) with
// a factor of umean/wsp_mean for directionality; this factor
// modifies the denominator from what is in Moeng amrex::Real(1984.)
amrex::Real wsp = sqrt(velx_tangent*velx_tangent+vely_tangent*vely_tangent);
amrex::Real wsp = std::sqrt(velx_tangent*velx_tangent+vely_tangent*vely_tangent);
amrex::Real num1 = wsp * umean;
amrex::Real num2 = wsp_mean * (velx_tangent-umean);

Expand Down Expand Up @@ -818,7 +818,7 @@ struct moeng_flux_eb
// multiplying the modeled shear stress (rho*ustar^2) with
// a factor of vmean/wsp_mean for directionality; this factor
// modifies the denominator from what is in Moeng amrex::Real(1984.)
amrex::Real wsp = sqrt(velx_tangent*velx_tangent+vely_tangent*vely_tangent);
amrex::Real wsp = std::sqrt(velx_tangent*velx_tangent+vely_tangent*vely_tangent);
amrex::Real num1 = wsp * vmean;
amrex::Real num2 = wsp_mean * (vely_tangent-vmean);

Expand All @@ -829,7 +829,11 @@ struct moeng_flux_eb
}

private:
const amrex::Real eps = 1e-15;
#ifdef AMREX_USE_FLOAT
const amrex::Real eps = amrex::Real(1e-6);
#else
const amrex::Real eps = amrex::Real(1e-12);
#endif
const amrex::Real WSMIN = amrex::Real(0.1); // minimum wind speed
};
#endif
#endif
12 changes: 6 additions & 6 deletions Source/ERF.H
Original file line number Diff line number Diff line change
Expand Up @@ -758,14 +758,14 @@ private:
amrex::Vector<amrex::FArrayBox*> z_vel_lateral,
amrex::Vector<amrex::FArrayBox*> T_lateral);

static amrex::Real start_bdy_time;
static amrex::Real final_bdy_time;
static double start_bdy_time;
static double final_bdy_time;

static amrex::Real start_low_time;
static amrex::Real final_low_time;
static double start_low_time;
static double final_low_time;

static amrex::Real bdy_time_interval;
static amrex::Real low_time_interval;
static double bdy_time_interval;
static double low_time_interval;

// *** *** FArrayBox's for holding the SURFACE data
// amrex::IArrayBox NC_IVGTYP_fab; // Vegetation type (IVGTYP); Discrete numbers;
Expand Down
26 changes: 13 additions & 13 deletions Source/ERF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ Real ERF::start_time = zero;
Real ERF::stop_time = std::numeric_limits<amrex::Real>::max();

#ifdef ERF_USE_NETCDF
Real ERF::start_bdy_time = zero;
Real ERF::final_bdy_time = -one;
double ERF::start_bdy_time = zero;
double ERF::final_bdy_time = -one;

Real ERF::start_low_time = zero;
Real ERF::final_low_time = -one;
double ERF::start_low_time = zero;
double ERF::final_low_time = -one;

Real ERF::bdy_time_interval = std::numeric_limits<amrex::Real>::max();
Real ERF::low_time_interval = std::numeric_limits<amrex::Real>::max();
double ERF::bdy_time_interval = std::numeric_limits<amrex::Real>::max();
double ERF::low_time_interval = std::numeric_limits<amrex::Real>::max();
#endif

// Time step control
Expand Down Expand Up @@ -871,7 +871,7 @@ ERF::post_timestep (int nstep, double time, Real dt_lev0)
if ( rad_datalog_int > 0 &&
(((nstep+1) % rad_datalog_int == 0) || (nstep==0)) ) {
if (rad[0]->hasDatalog()) {
rad[0]->WriteDataLog(time+start_time);
rad[0]->WriteDataLog(static_cast<Real>(time+start_time));
}
}
}
Expand Down Expand Up @@ -1125,7 +1125,7 @@ ERF::InitData_post ()
bdy_data_xlo,bdy_data_xhi,bdy_data_ylo,bdy_data_yhi,
start_bdy_time, final_bdy_time);

Real time_since_start_bdy = t_new[0] + start_time - start_bdy_time;
double time_since_start_bdy = t_new[0] + start_time - start_bdy_time;
int n_time_old = static_cast<int>(time_since_start_bdy / bdy_time_interval);
MultiFab r_hse(base_state[0], make_alias, BaseState::r0_comp, 1);
Array<MultiFab*, AMREX_SPACEDIM> area_vec = {ax[0].get(), ay[0].get(), az[0].get()};
Expand Down Expand Up @@ -1164,7 +1164,7 @@ ERF::InitData_post ()
sst_lev[lev].resize(low_data_zlo.size());
tsk_lev[lev].resize(low_data_zlo.size());

Real time_since_start_low = t_new[0] + start_time - start_low_time;
double time_since_start_low = t_new[0] + start_time - start_low_time;
int n_time_old = static_cast<int>(time_since_start_low / low_time_interval);

int ntimes = std::min(n_time_old+3, static_cast<int>(low_data_zlo.size()));
Expand Down Expand Up @@ -2003,7 +2003,7 @@ ERF::Interp2DArrays (int lev, const BoxArray& my_ba2d, const DistributionMapping
sst_lev[lev].resize(sst_lev[lev-1].size());
}
#ifdef ERF_USE_NETCDF
Real time_since_start_low = t_new[0] + start_time - start_low_time;
double time_since_start_low = t_new[0] + start_time - start_low_time;
int n_time_old = static_cast<int>(time_since_start_low / low_time_interval);
int ntimes_to_interp = std::min(n_time_old+3, static_cast<int>(sst_lev[lev-1].size()));
#else
Expand All @@ -2030,7 +2030,7 @@ ERF::Interp2DArrays (int lev, const BoxArray& my_ba2d, const DistributionMapping
tsk_lev[lev].resize(tsk_lev[lev-1].size());
}
#ifdef ERF_USE_NETCDF
Real time_since_start_low = t_new[0] + start_time - start_low_time;
double time_since_start_low = t_new[0] + start_time - start_low_time;
int n_time_old = static_cast<int>(time_since_start_low / low_time_interval);
int ntimes_to_interp = std::min(n_time_old+3, static_cast<int>(tsk_lev[lev-1].size()));
#else
Expand Down Expand Up @@ -2107,7 +2107,7 @@ ERF::Interp2DArrays (int lev, const BoxArray& my_ba2d, const DistributionMapping
if (sst_lev[lev][0]) {
// Call FillPatchTwoLevels which ASSUMES that all ghost cells at lev-1 have already been filled
#ifdef ERF_USE_NETCDF
Real time_since_start_low = t_new[0] + start_time - start_low_time;
double time_since_start_low = t_new[0] + start_time - start_low_time;
int n_time_old = static_cast<int>(time_since_start_low / low_time_interval);
int ntimes_to_interp = std::min(n_time_old+3, static_cast<int>(sst_lev[lev-1].size()));
#else
Expand All @@ -2131,7 +2131,7 @@ ERF::Interp2DArrays (int lev, const BoxArray& my_ba2d, const DistributionMapping
if (tsk_lev[lev][0]) {
// Call FillPatchTwoLevels which ASSUMES that all ghost cells at lev-1 have already been filled
#ifdef ERF_USE_NETCDF
Real time_since_start_low = t_new[0] + start_time - start_low_time;
double time_since_start_low = t_new[0] + start_time - start_low_time;
int n_time_old = static_cast<int>(time_since_start_low / low_time_interval);
int ntimes_to_interp = std::min(n_time_old+3, static_cast<int>(tsk_lev[lev-1].size()));
#else
Expand Down
8 changes: 4 additions & 4 deletions Source/IO/ERF_ReadFromWRFBdy.H
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

#ifdef ERF_USE_NETCDF

amrex::Real
double
read_times_from_wrfbdy (const std::string& nc_bdy_file,
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,
amrex::Real& start_bdy_time, amrex::Real& final_bdy_time);
double& start_bdy_time, double& final_bdy_time);

void
read_and_convert_from_wrfbdy (const int itime, const std::string& nc_bdy_file,
Expand All @@ -33,13 +33,13 @@ read_and_convert_from_wrfbdy (const int itime, const std::string& nc_bdy_file,
amrex::Array<amrex::MultiFab*, AMREX_SPACEDIM>& area_vec,
const amrex::Geometry& geom, const bool& use_moist,
const amrex::Vector<amrex::BCRec>& domain_bcs_type_h,
int real_width, amrex::Real bdy_time_interval,
int real_width, double bdy_time_interval,
bool is_anelastic, bool do_conversion = true);

amrex::Real
read_times_from_wrflow (const std::string& nc_low_file,
amrex::Vector<amrex::Vector<amrex::FArrayBox>>& low_data_zlo,
amrex::Real& start_low_time, amrex::Real& final_low_time);
double& start_low_time, double& final_low_time);

void
read_from_wrflow (const int itime,
Expand Down
9 changes: 4 additions & 5 deletions Source/IO/ERF_ReadFromWRFBdy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ namespace WRFBdyTypes {
};
}

Real
double
read_times_from_wrfbdy (const std::string& nc_bdy_file,
Vector<Vector<FArrayBox>>& bdy_data_xlo,
Vector<Vector<FArrayBox>>& bdy_data_xhi,
Vector<Vector<FArrayBox>>& bdy_data_ylo,
Vector<Vector<FArrayBox>>& bdy_data_yhi,
Real& start_bdy_time,
Real& final_bdy_time)
double& start_bdy_time,
double& final_bdy_time)
{
Print() << "Loading boundary data from NetCDF file " << std::endl;

Expand Down Expand Up @@ -163,7 +163,6 @@ convert_wrfbdy_data (const int itime,
int ihi = domain.bigEnd()[0];
int jlo = domain.smallEnd()[1];
int jhi = domain.bigEnd()[1];
int klo = domain.smallEnd()[2];
int khi = domain.bigEnd()[2];

// PH bounds limiting
Expand Down Expand Up @@ -468,7 +467,7 @@ read_and_convert_from_wrfbdy (const int itime, const std::string& nc_bdy_file,
const Geometry& geom,
const bool& use_moist,
const Vector<BCRec>& domain_bcs_type_h,
int real_width, Real bdy_time_interval,
int real_width, double bdy_time_interval,
bool is_anelastic, bool do_conversion)
{
int ioproc = ParallelDescriptor::IOProcessorNumber(); // I/O rank
Expand Down
4 changes: 2 additions & 2 deletions Source/IO/ERF_ReadFromWRFLow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ using namespace amrex;

#ifdef ERF_USE_NETCDF

Real
double
read_times_from_wrflow (const std::string& nc_low_file,
Vector<Vector<FArrayBox>>& low_data_zlo,
Real& start_low_time, Real& final_low_time)
double& start_low_time, double& final_low_time)
{
Print() << "Loading lower boundary data from NetCDF file " << std::endl;

Expand Down
2 changes: 1 addition & 1 deletion Source/TimeIntegration/ERF_TimeStep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ERF::timeStep (int lev, double time, int /*iteration*/)
Array<MultiFab*, AMREX_SPACEDIM> area_vec = {ax[lev].get(), ay[lev].get(), az[lev].get()};

int ntimes = bdy_data_xlo.size();
Real time_since_start_bdy = time + start_time - start_bdy_time;
double time_since_start_bdy = time + start_time - start_bdy_time;
int n_time_old = std::min(static_cast<int>( (time_since_start_bdy ) / bdy_time_interval), ntimes-1);
int n_time_new = std::min(static_cast<int>( (time_since_start_bdy+dt[lev]) / bdy_time_interval), ntimes-1);

Expand Down
Loading