@@ -440,10 +440,12 @@ void SurfaceCouplingExporter::compute_eamxx_exports(const double dt, const bool
440
440
const auto qv_i = ekat::subview (qv, i);
441
441
const auto T_mid_i = ekat::subview (T_mid, i);
442
442
const auto p_mid_i = ekat::subview (p_mid, i);
443
+ const auto p_int_i = ekat::subview (p_int, i);
443
444
const auto pseudo_density_i = ekat::subview (pseudo_density, i);
444
445
const auto dz_i = ekat::subview (dz, i);
445
446
446
447
const auto s_p_mid_i = ekat::scalarize (p_mid_i);
448
+ const auto s_p_int_i = ekat::scalarize (p_int_i);
447
449
const auto s_T_mid_i = ekat::scalarize (T_mid_i);
448
450
const auto z_int_i = ekat::subview (z_int, i);
449
451
const auto z_mid_i = ekat::subview (z_mid, i);
@@ -487,7 +489,12 @@ void SurfaceCouplingExporter::compute_eamxx_exports(const double dt, const bool
487
489
}
488
490
489
491
if (export_source (idx_Sa_ptem)==FROM_MODEL) {
490
- Sa_ptem (i) = PF::calculate_theta_from_T (s_T_mid_i (num_levs-1 ), s_p_mid_i (num_levs-1 ));
492
+ // WARNING - THE FOLLOWING IS A HACK
493
+ // To make the flux calculations within the component coupler consistent with EAM we need to
494
+ // provide theta based on an exner function that evaluates to 1 at the bottom interface.
495
+ // To accomplish this we calculate a theta that replaces the reference pressure (P0) for exner
496
+ // with the pressure of the lowest interface level => s_p_int_i(num_levs)
497
+ Sa_ptem (i) = s_T_mid_i (num_levs-1 ) / pow ( s_p_mid_i (num_levs-1 )/s_p_int_i (num_levs), PC::RD*PC::INV_CP);
491
498
}
492
499
493
500
if (export_source (idx_Sa_pbot)==FROM_MODEL) {
0 commit comments