Skip to content

Commit ac64286

Browse files
AMLattanziAaron Lattanzi
and
Aaron Lattanzi
authored
Radiation Debug (#1552)
* fix cmake compile for radiation. * Clean up for debug compile and bump YAKL hash to get NETCDF read fix. --------- Co-authored-by: Aaron Lattanzi <[email protected]>
1 parent d1375cd commit ac64286

12 files changed

+34
-43
lines changed

Source/Radiation/Aero_rad_props.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ void AerRadProps::aer_rad_props_lw (const bool& is_cmip6_volc,
309309
real2d r_lw_abs("r_lw_abs", ncol, nlev); // radius dependent mass-specific absorption coefficient
310310
real1d r_mu("r_mu", ncol); // log(geometric_mean_radius) domain samples of r_lw_abs(:,:)
311311
real2d mu("mu", ncol, nlev); // log(geometric_radius)
312-
real r_mu_min, r_mu_max, wmu, mutrunc;
313-
int nmu, kmu;
312+
//real r_mu_min, r_mu_max, wmu, mutrunc;
313+
//int nmu, kmu;
314314

315315
// for table lookup into rh grid
316316
real2d es("es", ncol, nlev); // saturation vapor pressure
@@ -327,7 +327,7 @@ void AerRadProps::aer_rad_props_lw (const bool& is_cmip6_volc,
327327

328328
//For cmip6 volcanic file
329329
int1d trop_level("trop_level", ncol);
330-
real lyr_thk;
330+
//real lyr_thk;
331331
real3d ext_cmip6_lw("ext_cmip6_lw", ncol, nlev, nlwbands);
332332
real3d ext_cmip6_lw_inv_m("ext_cmip6_lw_inv_m",ncol, nlev, nlwbands); //long wave extinction in the units of 1/m
333333

@@ -421,7 +421,7 @@ void AerRadProps::aer_rad_props_lw (const bool& is_cmip6_volc,
421421
{
422422
int ilev_tropp = trop_level(icol); //tropopause level
423423
if (ilev < ilev_tropp) {
424-
auto lyr_thk = zi(icol,ilev) - zi(icol,ilev+1);
424+
//auto lyr_thk = zi(icol,ilev) - zi(icol,ilev+1);
425425
// odap_aer(icol,ilev,ilw) = lyr_thk * ext_cmip6_lw_inv_m(icol,ilev,ilw);
426426
}
427427
});
@@ -675,7 +675,7 @@ void AerRadProps::get_volcanic_rad_props(const int& ncol,
675675
const real3d& tau_w,
676676
const real3d& tau_w_g,
677677
const real3d& tau_w_f) {
678-
int nswbands;
678+
//int nswbands;
679679
parallel_for(SimpleBounds<3>(nswbands, ncol,nlev), YAKL_LAMBDA (int iswband, int icol, int ilev) {
680680
real g = 0;
681681
if (scat(iswband) > 0.)

Source/Radiation/Ebert_curry.H

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class EbertCurry {
122122
real2d cldtau("cldtau",ncol,nlev);
123123

124124
// longwave liquid absorption coeff (m**2/g)
125-
const real kabsl = 0.090361;
125+
//const real kabsl = 0.090361;
126126

127127
// Optical properties for ice are valid only in the range of
128128
// 13 < rei < 130 micron (Ebert and Curry 92)

Source/Radiation/Mam4_aero.H

+1-2
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ class Mam4_aer {
326326
const real3d& fa, const real2d& clear_rh)
327327
{
328328
// local variables
329-
int ilev_tropp;
330329
real2d mass("mass",ncol,nlev); // layer mass
331330
real2d air_density("air_density",ncol,nlev); // (kg/m3)
332331

@@ -656,7 +655,7 @@ class Mam4_aer {
656655
}
657656
}
658657

659-
int nlwbands; // add by xyuan to be compiled
658+
//int nlwbands; // add by xyuan to be compiled
660659
for(auto ilw = 1; ilw <= nlwbands; ++ilw) {
661660
for(auto k = top_lev; k > nlev; --k) {
662661
// form bulk refractive index. Use volume mixing for infrared

Source/Radiation/Mam4_constituents.H

+6-6
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ class MamConstituents {
279279
inline
280280
void rad_cnst_init ()
281281
{
282-
int num_aerosols;
283-
constexpr bool stricttest = true;
282+
//int num_aerosols;
283+
//constexpr bool stricttest = true;
284284

285285
// memory to point to if zero value requested
286286
//allocate(zero_cols(pcols,pver))
@@ -567,7 +567,7 @@ class MamConstituents {
567567
const
568568
void rad_cnst_out (int list_idx)
569569
{
570-
int ncol;
570+
//int ncol;
571571
int idx;
572572
std::string name, cbname, source;
573573

@@ -645,7 +645,7 @@ class MamConstituents {
645645

646646
// Get data source
647647
auto source = aerlist.aer[aer_idx].source;
648-
auto idx = aerlist.aer[aer_idx].idx;
648+
//auto idx = aerlist.aer[aer_idx].idx;
649649
}
650650

651651
// Return pointer to mass mixing ratio for the modal aerosol specie from the specified
@@ -654,7 +654,7 @@ class MamConstituents {
654654
void rad_cnst_get_mam_mmr_by_idx (int list_idx, int mode_idx, int spec_idx,
655655
const std::string& phase, real2d& mmr)
656656
{
657-
int idx;
657+
//int idx;
658658
std::string source;
659659
modelist_t mlist;
660660

@@ -729,7 +729,7 @@ class MamConstituents {
729729
{
730730
modelist_t mlist;
731731
std::string source;
732-
int idx;
732+
//int idx;
733733

734734
if (list_idx >= 0 && list_idx <= N_DIAG) {
735735
mlist = ma_list[list_idx];

Source/Radiation/Modal_aero_wateruptake.H

-4
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@ class ModalAeroWateruptake {
4747

4848
real1d es("es",ncol); // saturation vapor pressure
4949
real1d qs("qs",ncol); // saturation specific humidity
50-
real cldn_thresh;
5150
real2d aerosol_water("aerosol_water",ncol,nlev); //sum of aerosol water (wat_a1 + wat_a2 + wat_a3 + wat_a4)
52-
bool history_aerosol; // Output the MAM aerosol variables and tendencies
53-
bool history_verbose; // produce verbose history output
5451
bool compute_wetdens;
5552

5653
std::string trnum; // used to hold mode number (as characters)
@@ -276,7 +273,6 @@ class ModalAeroWateruptake {
276273
{
277274
const real eps = 1.e-4;
278275
const real mw = 18.;
279-
const real pi = 3.14159;
280276
const real rhow = 1.;
281277
const real surften = 76.;
282278
const real tair = 273.;

Source/Radiation/Phys_prop.H

+14-12
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ class PhysProp {
485485
real2d flw_abs;
486486

487487
auto nrh = RadConstants::nrh;
488-
auto nbnd = prop.getDimSize( "lw_band" );
488+
//auto nbnd = prop.getDimSize( "lw_band" );
489489
auto nswbands = prop.getDimSize( "sw_band" );
490490

491491
prop.read( fsw_ext, "ext_sw");
@@ -578,9 +578,9 @@ class PhysProp {
578578
// Read optics data of type 'volcanic_radius'
579579
void volcanic_radius_optics_init (physprop_t& phys_prop, yakl::SimpleNetCDF& prop)
580580
{
581-
auto n_mu_samples = prop.getDimSize( "mu_samples" );
582-
auto nbnd = prop.getDimSize( "lw_band" );
583-
auto nswbands = prop.getDimSize( "sw_band" );
581+
//auto n_mu_samples = prop.getDimSize( "mu_samples" );
582+
//auto nbnd = prop.getDimSize( "lw_band" );
583+
//auto nswbands = prop.getDimSize( "sw_band" );
584584

585585
prop.read( phys_prop.r_sw_ext, "bext_sw");
586586
prop.read( phys_prop.r_sw_scat, "bsca_sw");
@@ -595,8 +595,8 @@ class PhysProp {
595595
// Read optics data of type 'volcanic'
596596
void volcanic_optics_init (physprop_t& phys_prop, yakl::SimpleNetCDF& prop)
597597
{
598-
auto nbnd = prop.getDimSize( "lw_band" );
599-
auto nswbands = prop.getDimSize( "sw_band" );
598+
//auto nbnd = prop.getDimSize( "lw_band" );
599+
//auto nswbands = prop.getDimSize( "sw_band" );
600600

601601
prop.read( phys_prop.sw_nonhygro_ext, "bext_sw");
602602
prop.read( phys_prop.sw_nonhygro_scat, "bsca_sw");
@@ -611,7 +611,7 @@ class PhysProp {
611611
void hygroscopic_optics_init (physprop_t& phys_prop, yakl::SimpleNetCDF& prop)
612612
{
613613
// temp data from hygroscopic file before interpolation onto cam-rh-mesh
614-
int nfilerh; // number of rh values in file
614+
//int nfilerh; // number of rh values in file
615615
real1d frh;
616616
real2d fsw_ext, fsw_ssa, fsw_asm, flw_abs;
617617

@@ -631,7 +631,7 @@ class PhysProp {
631631
prop.read( frh, "rh");
632632

633633
real1d fswe("",nrh), fsws("",nrh),
634-
fswa("",nrh), flwa("",nrh);
634+
fswa("",nrh), flwa("",nrh);
635635

636636
// interpolate onto cam's rh mesh
637637
parallel_for (SimpleBounds<2> (nswbands, nrh), YAKL_LAMBDA (int kbnd, int krh)
@@ -671,8 +671,8 @@ class PhysProp {
671671
// Read optics data of type 'nonhygro'
672672
void nonhygro_optics_init (physprop_t& phys_prop, yakl::SimpleNetCDF& prop)
673673
{
674-
auto nlwbands = prop.getDimSize( "lw_band" );
675-
auto nswbands = prop.getDimSize( "sw_band" );
674+
//auto nlwbands = prop.getDimSize( "lw_band" );
675+
//auto nswbands = prop.getDimSize( "sw_band" );
676676

677677
prop.read( phys_prop.sw_nonhygro_ext, "ext_sw");
678678
prop.read( phys_prop.sw_nonhygro_ssa, "ssa_sw");
@@ -833,9 +833,9 @@ class PhysProp {
833833
void aer_optics_log_rh (std::string name, const real1d& ext, const real1d& ssa, const real1d& asmin)
834834
{
835835
const int nrh_test = 36;
836-
int krh;
836+
//int krh;
837837
real1d rh_test("rh_test", nrh_test);
838-
auto nrh = ext.extent(0);
838+
//auto nrh = ext.extent(0);
839839

840840
parallel_for (SimpleBounds<1> (nrh_test), YAKL_LAMBDA (int krh_test)
841841
{
@@ -845,13 +845,15 @@ class PhysProp {
845845
// loop through test rh values
846846
parallel_for (SimpleBounds<1> (nrh_test), YAKL_LAMBDA (int krh_test)
847847
{
848+
/*
848849
// find corresponding rh index
849850
auto rh = rh_test(krh_test);
850851
auto krh = std::min(floor( (rh) * nrh ) + 1, static_cast<real>(nrh - 1));
851852
auto wrh = (rh) *nrh - krh;
852853
auto exti = ext(krh + 1) * (wrh + 1) - ext(krh) * wrh;
853854
auto ssai = ssa(krh + 1) * (wrh + 1) - ssa(krh) * wrh;
854855
auto asmi = asmin(krh + 1) * (wrh + 1) - asmin(krh) * wrh;
856+
*/
855857
});
856858
}
857859
};

Source/Radiation/Rad_constants.H

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class RadConstants {
188188
{
189189
real1d lower_boundaries("lower_boundaries", nlwbands);
190190
real1d upper_boundaries("upper_boundaries", nlwbands);
191-
int iband;
191+
//int iband;
192192

193193
// Get band boundaries
194194
get_lw_spectral_boundaries(lower_boundaries, upper_boundaries, units);

Source/Radiation/Radiation.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ void Radiation::initialize (const MultiFab& cons_in,
172172

173173
const auto& box3d = mfi.tilebox();
174174
auto nx = box3d.length(0);
175-
auto ny = box3d.length(1);
175+
//auto ny = box3d.length(1);
176176
// Get pressure, theta, temperature, density, and qt, qp
177177
amrex::ParallelFor( box3d, [=] AMREX_GPU_DEVICE (int i, int j, int k)
178178
{
@@ -283,7 +283,7 @@ void Radiation::run ()
283283
real3d gas_vmr("gas_vmr", ngas, ncol, nlev);
284284

285285
// Needed for shortwave aerosol;
286-
int nday, nnight; // Number of daylight columns
286+
//int nday, nnight; // Number of daylight columns
287287
int1d day_indices("day_indices", ncol), night_indices("night_indices", ncol); // Indicies of daylight coumns
288288

289289
// Flag to carry (QRS,QRL)*dp across time steps.
@@ -783,7 +783,7 @@ void Radiation::get_gas_vmr (const std::vector<std::string>& gas_names, const re
783783
const std::vector<real> mol_weight_gas = {18.01528, 44.0095, 47.9982, 44.0128,
784784
28.0101, 16.04246, 31.998, 28.0134}; // g/mol
785785
// Molar weight of air
786-
const real mol_weight_air = 28.97; // g/mol
786+
//const real mol_weight_air = 28.97; // g/mol
787787
// Defaults for gases that are not available (TODO: is this still accurate?)
788788
const real co_vol_mix_ratio = 1.0e-7;
789789
const real n2_vol_mix_ratio = 0.7906;

Source/Radiation/Run_shortwave_rrtmgp.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void Rrtmgp::run_shortwave_rrtmgp (int ngas, int ncol, int nlay,
3535
boolHost1d top_at_1_h("top_at_1_h",1);
3636
bool top_at_1;
3737
real2d toa_flux("toa_flux", ncol, nswgpts);
38-
k_dist_sw.gas_optics(ncol, nlay, &top_at_1, pmid, pint, tmid, gas_concs, combined_optics, toa_flux);
38+
k_dist_sw.gas_optics(ncol, nlay, &top_at_1, pmid, pint, tmid, gas_concs, combined_optics, toa_flux); // TODO: top_at_1 is not a valid address and this doesn't match longwave call
3939

4040
// Apply TOA flux scaling
4141
parallel_for(SimpleBounds<2>(nswgpts,ncol), YAKL_LAMBDA (int igpt, int icol) {

Source/Radiation/m2005_effradius.H

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void m2005_effradius (const real2d& ql, const real2d& nl, const real2d& qi,
9898

9999
// set the minimum droplet number as 20/cm3.
100100
// nlic = max(nlic,20.e6_r8/rho) ! sghan minimum in #/cm3
101-
auto tempnc = nlic/rho/1.0e6; // #/kg --> #/cm3
101+
//auto tempnc = nlic/rho/1.0e6; // #/kg --> #/cm3
102102

103103
// Should be the in-cloud dropelt number calculated as nlic*rho/1.0e6_r8 ????!!!! +++mhwang
104104
auto pgam = 0.0005714*(nlic*rho/1.e6) + 0.2714;

Source/TimeIntegration/ERF_slow_rhs_post.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,6 @@ void erf_slow_rhs_post (int level, int finest_level,
117117
tc.pbl_type == PBLType::MYNN25 ||
118118
tc.pbl_type == PBLType::YSU );
119119

120-
// Open bc will be imposed upon all vars (we only access cons here for simplicity)
121-
const bool xlo_open = (bc_ptr_h[BCVars::cons_bc].lo(0) == ERFBCType::open);
122-
const bool xhi_open = (bc_ptr_h[BCVars::cons_bc].hi(0) == ERFBCType::open);
123-
const bool ylo_open = (bc_ptr_h[BCVars::cons_bc].lo(1) == ERFBCType::open);
124-
const bool yhi_open = (bc_ptr_h[BCVars::cons_bc].hi(1) == ERFBCType::open);
125-
126120
const Box& domain = geom.Domain();
127121

128122
const GpuArray<Real, AMREX_SPACEDIM> dxInv = geom.InvCellSizeArray();

Submodules/YAKL

Submodule YAKL updated 140 files

0 commit comments

Comments
 (0)