ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
internal Namespace Reference

Functions

void initial_fluxes (int nz, int nlay, int nbands, FluxesByband &fluxes)
 
void expand_day_fluxes (const FluxesByband &daytime_fluxes, FluxesByband &expanded_fluxes, const int1d &day_indices)
 
void reordered (const real1d &array_in, const int1d &new_indexing, const real1d &array_out)
 

Function Documentation

◆ expand_day_fluxes()

void internal::expand_day_fluxes ( const FluxesByband &  daytime_fluxes,
FluxesByband &  expanded_fluxes,
const int1d &  day_indices 
)
55  {
56  auto ncol = size(daytime_fluxes.bnd_flux_up, 1);
57  auto nlev = size(daytime_fluxes.bnd_flux_up, 2);
58  auto nbnds = size(daytime_fluxes.bnd_flux_up, 3);
59 
60  int1d nday_1d("nday_1d", 1),nday_host("nday_host",1);
61  yakl::memset(nday_1d, 0);
62  parallel_for(SimpleBounds<1>(ncol), YAKL_LAMBDA (int icol)
63  {
64  if (day_indices(icol) > 0) nday_1d(1)++;
65  //printf("daynight indices(check): %d, %d, %d\n",icol,day_indices(icol),nday_1d(1));
66  });
67 
68  nday_1d.deep_copy_to(nday_host);
69  auto nday = nday_host(1);
70  AMREX_ASSERT_WITH_MESSAGE((nday>0) && (nday<=ncol), "RADIATION: Invalid number of days!");
71  parallel_for(SimpleBounds<3>(nday, nlev, nbnds), YAKL_LAMBDA (int iday, int ilev, int ibnd)
72  {
73  // Map daytime index to proper column index
74  auto icol = day_indices(iday);
75  //auto icol = iday;
76  // Expand broadband fluxes
77  expanded_fluxes.flux_up(icol,ilev) = daytime_fluxes.flux_up(iday,ilev);
78  expanded_fluxes.flux_dn(icol,ilev) = daytime_fluxes.flux_dn(iday,ilev);
79  expanded_fluxes.flux_net(icol,ilev) = daytime_fluxes.flux_net(iday,ilev);
80  expanded_fluxes.flux_dn_dir(icol,ilev) = daytime_fluxes.flux_dn_dir(iday,ilev);
81 
82  // Expand band-by-band fluxes
83  expanded_fluxes.bnd_flux_up(icol,ilev,ibnd) = daytime_fluxes.bnd_flux_up(iday,ilev,ibnd);
84  expanded_fluxes.bnd_flux_dn(icol,ilev,ibnd) = daytime_fluxes.bnd_flux_dn(iday,ilev,ibnd);
85  expanded_fluxes.bnd_flux_net(icol,ilev,ibnd) = daytime_fluxes.bnd_flux_net(iday,ilev,ibnd);
86  expanded_fluxes.bnd_flux_dn_dir(icol,ilev,ibnd) = daytime_fluxes.bnd_flux_dn_dir(iday,ilev,ibnd);
87  });
88  }

Referenced by Radiation::radiation_driver_sw().

Here is the caller graph for this function:

◆ initial_fluxes()

void internal::initial_fluxes ( int  nz,
int  nlay,
int  nbands,
FluxesByband &  fluxes 
)
40  {
41  fluxes.flux_up = real2d("flux_up" , nz, nlay+1);
42  fluxes.flux_dn = real2d("flux_dn" , nz, nlay+1);
43  fluxes.flux_net = real2d("flux_net" , nz, nlay+1);
44  fluxes.flux_dn_dir = real2d("flux_dn_dir", nz, nlay+1);
45 
46  fluxes.bnd_flux_up = real3d("flux_up" , nz, nlay+1, nbands);
47  fluxes.bnd_flux_dn = real3d("flux_dn" , nz, nlay+1, nbands);
48  fluxes.bnd_flux_net = real3d("flux_net" , nz, nlay+1, nbands);
49  fluxes.bnd_flux_dn_dir = real3d("flux_dn_dir", nz, nlay+1, nbands);
50  }

Referenced by Radiation::radiation_driver_sw(), and Radiation::run().

Here is the caller graph for this function:

◆ reordered()

void internal::reordered ( const real1d &  array_in,
const int1d &  new_indexing,
const real1d &  array_out 
)
92  {
93  // Reorder array based on input index mapping, which maps old indices to new
94  parallel_for(SimpleBounds<1>(size(array_in, 1)), YAKL_LAMBDA (int i)
95  {
96  array_out(i) = array_in(new_indexing(i));
97  });
98  }

Referenced by Radiation::run().

Here is the caller graph for this function: