226 Box domain =
m_geom.Domain();
228 Print () <<
"Noah-MP driver started at time step: " << nstep+1 << std::endl;
233 for (MFIter mfi(cons_in,
false); mfi.isValid(); ++mfi, ++idb) {
235 Box bx = mfi.tilebox();
238 if (bx.smallEnd(2) != domain.smallEnd(2)) {
continue; }
240 bx.makeSlab(2,domain.smallEnd(2));
244 const Array4<const Real>& U_PHY = xvel_in.const_array(mfi);
245 const Array4<const Real>& V_PHY = yvel_in.const_array(mfi);
246 const Array4<const Real>& QV_TH = cons_in.const_array(mfi);
269 FArrayBox tmp_u_phy(bx, 1, The_Pinned_Arena());
270 FArrayBox tmp_v_phy(bx, 1, The_Pinned_Arena());
271 FArrayBox tmp_t_phy(bx, 1, The_Pinned_Arena());
272 FArrayBox tmp_qv_curr(bx, 1, The_Pinned_Arena());
273 FArrayBox tmp_p8w(bx, 1, The_Pinned_Arena());
274 FArrayBox tmp_swdown(bx, 1, The_Pinned_Arena());
275 FArrayBox tmp_glw(bx, 1, The_Pinned_Arena());
276 FArrayBox tmp_coszen(bx, 1, The_Pinned_Arena());
277 FArrayBox tmp_hfx(bx, 1, The_Pinned_Arena());
278 FArrayBox tmp_lh(bx, 1, The_Pinned_Arena());
279 FArrayBox tmp_tau_ew(bx, 1, The_Pinned_Arena());
280 FArrayBox tmp_tau_ns(bx, 1, The_Pinned_Arena());
281 FArrayBox tmp_tsk(bx, 1, The_Pinned_Arena());
282 FArrayBox tmp_emiss(bx, 1, The_Pinned_Arena());
283 FArrayBox tmp_albsfcdir_vis(bx, 1, The_Pinned_Arena());
284 FArrayBox tmp_albsfcdir_nir(bx, 1, The_Pinned_Arena());
285 FArrayBox tmp_albsfcdif_vis(bx, 1, The_Pinned_Arena());
286 FArrayBox tmp_albsfcdif_nir(bx, 1, The_Pinned_Arena());
289 auto const& tmp_u_phy_arr = tmp_u_phy.array();
290 auto const& tmp_v_phy_arr = tmp_v_phy.array();
291 auto const& tmp_t_phy_arr = tmp_t_phy.array();
292 auto const& tmp_qv_curr_arr = tmp_qv_curr.array();
293 auto const& tmp_p8w_arr = tmp_p8w.array();
294 auto const& tmp_swdown_arr = tmp_swdown.array();
295 auto const& tmp_glw_arr = tmp_glw.array();
296 auto const& tmp_coszen_arr = tmp_coszen.array();
299 ParallelFor(bx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int ) noexcept
301 tmp_u_phy_arr(i,j,0) = 0.5*(U_PHY(i,j,0)+U_PHY(i+1,j ,0));
302 tmp_v_phy_arr(i,j,0) = 0.5*(V_PHY(i,j,0)+V_PHY(i ,j+1,0));
306 tmp_swdown_arr(i,j,0) = SWDOWN(i,j,0);
307 tmp_glw_arr(i,j,0) = GLW(i,j,0);
308 tmp_coszen_arr(i,j,0) = COSZEN(i,j,0);
312 Gpu::streamSynchronize();
316 const auto& h_u_arr = tmp_u_phy.const_array();
317 const auto& h_v_arr = tmp_v_phy.const_array();
318 const auto& h_t_arr = tmp_t_phy.const_array();
319 const auto& h_qv_arr = tmp_qv_curr.const_array();
320 const auto& h_p8w_arr = tmp_p8w.const_array();
321 const auto& h_swdown_arr = tmp_swdown.const_array();
322 const auto& h_glw_arr = tmp_glw.const_array();
323 const auto& h_coszen_arr = tmp_coszen.const_array();
325 LoopOnCpu(bx, [&] (
int i,
int j,
int ) noexcept
327 noahmpio->U_PHY(i,1,j) = h_u_arr(i,j,0);
328 noahmpio->V_PHY(i,1,j) = h_v_arr(i,j,0);
329 noahmpio->T_PHY(i,1,j) = h_t_arr(i,j,0);
330 noahmpio->QV_CURR(i,1,j) = h_qv_arr(i,j,0);
331 noahmpio->P8W(i,1,j) = h_p8w_arr(i,j,0);
332 noahmpio->SWDOWN(i,j) = h_swdown_arr(i,j,0);
333 noahmpio->GLW(i,j) = h_glw_arr(i,j,0);
334 noahmpio->COSZEN(i,j) = h_coszen_arr(i,j,0);
339 noahmpio->itimestep = nstep+1;
340 noahmpio->DriverMain();
343 auto h_hfx_arr = tmp_hfx.array();
344 auto h_lh_arr = tmp_lh.array();
345 auto h_tau_ew_arr = tmp_tau_ew.array();
346 auto h_tau_ns_arr = tmp_tau_ns.array();
347 auto h_tsk_arr = tmp_tsk.array();
348 auto h_emiss_arr = tmp_emiss.array();
349 auto h_albsfcdir_vis_arr = tmp_albsfcdir_vis.array();
350 auto h_albsfcdir_nir_arr = tmp_albsfcdir_nir.array();
351 auto h_albsfcdif_vis_arr = tmp_albsfcdif_vis.array();
352 auto h_albsfcdif_nir_arr = tmp_albsfcdif_nir.array();
354 LoopOnCpu(bx, [&] (
int i,
int j,
int ) noexcept
356 h_hfx_arr(i,j,0) = noahmpio->HFX(i,j);
357 h_lh_arr(i,j,0) = noahmpio->LH(i,j);
358 h_tau_ew_arr(i,j,0) = noahmpio->TAU_EW(i,j);
359 h_tau_ns_arr(i,j,0) = noahmpio->TAU_NS(i,j);
360 h_tsk_arr(i,j,0) = noahmpio->TSK(i,j);
361 h_emiss_arr(i,j,0) = noahmpio->EMISS(i,j);
362 h_albsfcdir_vis_arr(i,j,0) = noahmpio->ALBSFCDIRXY(i,1,j);
363 h_albsfcdir_nir_arr(i,j,0) = noahmpio->ALBSFCDIRXY(i,2,j);
364 h_albsfcdif_vis_arr(i,j,0) = noahmpio->ALBSFCDIFXY(i,1,j);
365 h_albsfcdif_nir_arr(i,j,0) = noahmpio->ALBSFCDIFXY(i,2,j);
369 auto const& tmp_hfx_arr = tmp_hfx.array();
370 auto const& tmp_lh_arr = tmp_lh.array();
371 auto const& tmp_tau_ew_arr = tmp_tau_ew.array();
372 auto const& tmp_tau_ns_arr = tmp_tau_ns.array();
373 auto const& tmp_tsk_arr = tmp_tsk.array();
374 auto const& tmp_emiss_arr = tmp_emiss.array();
375 auto const& tmp_albsfcdir_vis_arr = tmp_albsfcdir_vis.array();
376 auto const& tmp_albsfcdir_nir_arr = tmp_albsfcdir_nir.array();
377 auto const& tmp_albsfcdif_vis_arr = tmp_albsfcdif_vis.array();
378 auto const& tmp_albsfcdif_nir_arr = tmp_albsfcdif_nir.array();
382 ParallelFor(bx, [=] AMREX_GPU_DEVICE (
int i,
int j,
int ) noexcept
384 t_flux_arr(i,j,0) = tmp_hfx_arr(i,j,0)/(QV_TH(i,j,0,
Rho_comp)*
Cp_d);
385 q_flux_arr(i,j,0) = tmp_lh_arr(i,j,0)/(QV_TH(i,j,0,
Rho_comp)*
L_v);
386 tau13_arr(i,j,0) = tmp_tau_ew_arr(i,j,0)/QV_TH(i,j,0,
Rho_comp);
387 tau23_arr(i,j,0) = tmp_tau_ns_arr(i,j,0)/QV_TH(i,j,0,
Rho_comp);
388 TSK(i,j,0) = tmp_tsk_arr(i,j,0);
389 EMISS(i,j,0) = tmp_emiss_arr(i,j,0);
390 ALBSFCDIR_VIS(i,j,0) = tmp_albsfcdir_vis_arr(i,j,0);
391 ALBSFCDIR_NIR(i,j,0) = tmp_albsfcdir_nir_arr(i,j,0);
392 ALBSFCDIF_VIS(i,j,0) = tmp_albsfcdif_vis_arr(i,j,0);
393 ALBSFCDIF_NIR(i,j,0) = tmp_albsfcdif_nir_arr(i,j,0);
396 Print () <<
"Noah-MP driver completed" << std::endl;
constexpr amrex::Real Cp_d
Definition: ERF_Constants.H:12
constexpr amrex::Real L_v
Definition: ERF_Constants.H:16
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getPgivenRTh(const amrex::Real rhotheta, const amrex::Real qv=0.)
Definition: ERF_EOS.H:81
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getTgivenRandRTh(const amrex::Real rho, const amrex::Real rhotheta, const amrex::Real qv=0.0)
Definition: ERF_EOS.H:46
#define Rho_comp
Definition: ERF_IndexDefines.H:36
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:37
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:42
amrex::Array< FabPtr, LsmFlux_NOAHMP::NumVars > lsm_fab_flux
Definition: ERF_NOAHMP.H:205
NoahmpIO_vector noahmpio_vect
Definition: ERF_NOAHMP.H:208
amrex::Array< FabPtr, LsmData_NOAHMP::NumVars > lsm_fab_data
Definition: ERF_NOAHMP.H:202
amrex::Geometry m_geom
Definition: ERF_NOAHMP.H:184
@ sw_flux_dn
Definition: ERF_NOAHMP.H:32
@ sfc_emis
Definition: ERF_NOAHMP.H:26
@ sfc_alb_dir_vis
Definition: ERF_NOAHMP.H:27
@ sfc_alb_dif_nir
Definition: ERF_NOAHMP.H:30
@ lw_flux_dn
Definition: ERF_NOAHMP.H:33
@ cos_zenith_angle
Definition: ERF_NOAHMP.H:31
@ t_sfc
Definition: ERF_NOAHMP.H:25
@ sfc_alb_dir_nir
Definition: ERF_NOAHMP.H:28
@ sfc_alb_dif_vis
Definition: ERF_NOAHMP.H:29
@ t_flux
Definition: ERF_NOAHMP.H:41
@ tau13
Definition: ERF_NOAHMP.H:43
@ q_flux
Definition: ERF_NOAHMP.H:42
@ tau23
Definition: ERF_NOAHMP.H:44