28 tmp2d = real2d(
"tmp", ncol, nlay);
29 for (
int igas = 1; igas <=
ngas; igas++) {
30 parallel_for(SimpleBounds<2>(nlay,ncol), YAKL_LAMBDA(
int ilay,
int icol)
32 tmp2d(icol,ilay) = gas_vmr(igas,icol,ilay);
38 SourceFuncLW lw_sources;
44 int constexpr max_gauss_pts = 4;
45 realHost2d gauss_Ds_host (
"gauss_Ds" ,max_gauss_pts,max_gauss_pts);
46 gauss_Ds_host(1,1) = 1.66_wp ; gauss_Ds_host(2,1) = 0._wp; gauss_Ds_host(3,1) = 0._wp; gauss_Ds_host(4,1) = 0._wp;
47 gauss_Ds_host(1,2) = 1.18350343_wp; gauss_Ds_host(2,2) = 2.81649655_wp; gauss_Ds_host(3,2) = 0._wp; gauss_Ds_host(4,2) = 0._wp;
48 gauss_Ds_host(1,3) = 1.09719858_wp; gauss_Ds_host(2,3) = 1.69338507_wp; gauss_Ds_host(3,3) = 4.70941630_wp; gauss_Ds_host(4,3) = 0._wp;
49 gauss_Ds_host(1,4) = 1.06056257_wp; gauss_Ds_host(2,4) = 1.38282560_wp; gauss_Ds_host(3,4) = 2.40148179_wp; gauss_Ds_host(4,4) = 7.15513024_wp;
51 realHost2d gauss_wts_host(
"gauss_wts",max_gauss_pts,max_gauss_pts);
52 gauss_wts_host(1,1) = 0.5_wp ; gauss_wts_host(2,1) = 0._wp ; gauss_wts_host(3,1) = 0._wp ; gauss_wts_host(4,1) = 0._wp ;
53 gauss_wts_host(1,2) = 0.3180413817_wp; gauss_wts_host(2,2) = 0.1819586183_wp; gauss_wts_host(3,2) = 0._wp ; gauss_wts_host(4,2) = 0._wp ;
54 gauss_wts_host(1,3) = 0.2009319137_wp; gauss_wts_host(2,3) = 0.2292411064_wp; gauss_wts_host(3,3) = 0.0698269799_wp; gauss_wts_host(4,3) = 0._wp ;
55 gauss_wts_host(1,4) = 0.1355069134_wp; gauss_wts_host(2,4) = 0.2034645680_wp; gauss_wts_host(3,4) = 0.1298475476_wp; gauss_wts_host(4,4) = 0.0311809710_wp;
57 real2d gauss_Ds (
"gauss_Ds" ,max_gauss_pts,max_gauss_pts);
58 real2d gauss_wts(
"gauss_wts",max_gauss_pts,max_gauss_pts);
59 gauss_Ds_host .deep_copy_to(gauss_Ds );
60 gauss_wts_host.deep_copy_to(gauss_wts);
63 OpticalProps1scl combined_optics;
64 combined_optics.alloc_1scl(ncol, nlay,
k_dist_lw);
65 bool1d top_at_1_g(
"top_at_1_g",1);
66 boolHost1d top_at_1_h(
"top_at_1_h",1);
68 real1d t_sfc(
"t_sfc", ncol);
69 parallel_for(SimpleBounds<1>(ncol), YAKL_LAMBDA (
int icol)
71 t_sfc(icol) = tint(icol,nlay+1);
72 top_at_1_g(1) = pmid(1, 1) < pmid (1, nlay);
74 top_at_1_g.deep_copy_to(top_at_1_h);
75 top_at_1 = top_at_1_h(1);
76 k_dist_lw.gas_optics(ncol, nlay, top_at_1, pmid, pint, tmid, t_sfc, gas_concs, combined_optics, lw_sources, real2d(), tint);
81 OpticalProps1scl aerosol_optics;
82 auto &aerosol_optics_tau = aerosol_optics.tau;
84 aerosol_optics.alloc_1scl(ncol, nlay,
k_dist_lw);
85 auto gpt_bnd = aerosol_optics.get_gpoint_bands();
86 parallel_for(SimpleBounds<3>(nlwgpts,nlay,ncol) , YAKL_LAMBDA (
int igpt,
int ilay,
int icol)
88 aerosol_optics_tau(icol,ilay,igpt) = aer_tau_bnd(icol,ilay,gpt_bnd(igpt));
91 aerosol_optics.alloc_1scl(ncol, nlay,
k_dist_lw.get_band_lims_wavenumber());
92 parallel_for(SimpleBounds<3>(nlwbands,nlay,ncol), YAKL_LAMBDA (
int ibnd,
int ilay,
int icol)
94 aerosol_optics_tau(icol,ilay,ibnd) = aer_tau_bnd(icol,ilay,ibnd);
97 aerosol_optics.increment(combined_optics);
100 FluxesByband fluxes_clrsky;
101 fluxes_clrsky.flux_up = real2d(
"clrsky_flux_up" , ncol, nlay+1);
102 fluxes_clrsky.flux_dn = real2d(
"clrsky_flux_dn" , ncol, nlay+1);
103 fluxes_clrsky.flux_net = real2d(
"clrsky_flux_net", ncol, nlay+1);
104 fluxes_clrsky.bnd_flux_up = real3d(
"clrsky_bnd_flux_up" , ncol, nlay+1, nlwbands);
105 fluxes_clrsky.bnd_flux_dn = real3d(
"clrsky_bnd_flux_dn" , ncol, nlay+1, nlwbands);
106 fluxes_clrsky.bnd_flux_net = real3d(
"clrsky_bnd_flux_net", ncol, nlay+1, nlwbands);
108 rte_lw(max_gauss_pts, gauss_Ds, gauss_wts, combined_optics, top_at_1, lw_sources, emis_sfc, fluxes_clrsky);
111 fluxes_clrsky.flux_up.deep_copy_to(clrsky_flux_up);
112 fluxes_clrsky.flux_dn.deep_copy_to(clrsky_flux_dn);
113 fluxes_clrsky.flux_net.deep_copy_to(clrsky_flux_net);
114 fluxes_clrsky.bnd_flux_up.deep_copy_to(clrsky_bnd_flux_up);
115 fluxes_clrsky.bnd_flux_dn.deep_copy_to(clrsky_bnd_flux_dn);
116 fluxes_clrsky.bnd_flux_net.deep_copy_to(clrsky_bnd_flux_net);
119 OpticalProps1scl cloud_optics;
120 cloud_optics.alloc_1scl(ncol, nlay,
k_dist_lw);
121 auto &cloud_optics_tau = cloud_optics.tau;
122 parallel_for(SimpleBounds<3>(nlwgpts,nlay,ncol) , YAKL_LAMBDA (
int igpt,
int ilay,
int icol) {
123 cloud_optics_tau(icol,ilay,igpt) = cld_tau_gpt(icol,ilay,igpt);
125 cloud_optics.increment(combined_optics);
128 FluxesByband fluxes_allsky;
129 fluxes_allsky.flux_up = real2d(
"allsky_flux_up" , ncol, nlay+1);
130 fluxes_allsky.flux_dn = real2d(
"allsky_flux_dn" , ncol, nlay+1);
131 fluxes_allsky.flux_net = real2d(
"allsky_flux_net", ncol, nlay+1);
132 fluxes_allsky.bnd_flux_up = real3d(
"allsky_bnd_flux_up" , ncol, nlay+1, nlwbands);
133 fluxes_allsky.bnd_flux_dn = real3d(
"allsky_bnd_flux_dn" , ncol, nlay+1, nlwbands);
134 fluxes_allsky.bnd_flux_net = real3d(
"allsky_bnd_flux_net", ncol, nlay+1, nlwbands);
136 rte_lw(max_gauss_pts, gauss_Ds, gauss_wts, combined_optics, top_at_1, lw_sources, emis_sfc, fluxes_allsky);
139 fluxes_allsky.flux_up.deep_copy_to(allsky_flux_up);
140 fluxes_allsky.flux_dn.deep_copy_to(allsky_flux_dn);
141 fluxes_allsky.flux_net.deep_copy_to(allsky_flux_net);
142 fluxes_allsky.bnd_flux_up.deep_copy_to(allsky_bnd_flux_up);
143 fluxes_allsky.bnd_flux_dn.deep_copy_to(allsky_bnd_flux_dn);
144 fluxes_allsky.bnd_flux_net.deep_copy_to(allsky_bnd_flux_net);