Skip to content

Commit 60d0d43

Browse files
committed
modify theta calculation for coupling exporter
1 parent 2862834 commit 60d0d43

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

components/eamxx/src/control/atmosphere_surface_coupling_exporter.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,12 @@ void SurfaceCouplingExporter::compute_eamxx_exports(const double dt, const bool
440440
const auto qv_i = ekat::subview(qv, i);
441441
const auto T_mid_i = ekat::subview(T_mid, i);
442442
const auto p_mid_i = ekat::subview(p_mid, i);
443+
const auto p_int_i = ekat::subview(p_int, i);
443444
const auto pseudo_density_i = ekat::subview(pseudo_density, i);
444445
const auto dz_i = ekat::subview(dz, i);
445446

446447
const auto s_p_mid_i = ekat::scalarize(p_mid_i);
448+
const auto s_p_int_i = ekat::scalarize(p_int_i);
447449
const auto s_T_mid_i = ekat::scalarize(T_mid_i);
448450
const auto z_int_i = ekat::subview(z_int, i);
449451
const auto z_mid_i = ekat::subview(z_mid, i);
@@ -487,7 +489,12 @@ void SurfaceCouplingExporter::compute_eamxx_exports(const double dt, const bool
487489
}
488490

489491
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);
491498
}
492499

493500
if (export_source(idx_Sa_pbot)==FROM_MODEL) {

components/eamxx/tests/single-process/surface_coupling/surface_coupling.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,16 @@ void test_exports(const FieldManager& fm,
361361
const Real T_int_bot = PF::calculate_surface_air_T(T_mid_i(nlevs-1),z_mid_i(nlevs-1));
362362

363363
Sa_z(i) = z_mid_i(nlevs-1);
364-
Sa_ptem(i) = PF::calculate_theta_from_T(T_mid_i(nlevs-1), p_mid_i(nlevs-1));
365364
Sa_dens(i) = PF::calculate_density(pseudo_density_i(nlevs-1), dz_i(nlevs-1));
366365
Sa_pslv(i) = PF::calculate_psl(T_int_bot, p_int_i(nlevs), phis(i));
367366

367+
// WARNING - THE FOLLOWING IS A HACK
368+
// To make the flux calculations within the component coupler consistent with EAM we need to
369+
// provide theta based on an exner function that evaluates to 1 at the bottom interface.
370+
// To accomplish this we calculate a theta that replaces the reference pressure (P0) for exner
371+
// with the pressure of the lowest interface level => p_int_i(nlevs)
372+
Sa_ptem(i) = T_mid_i(nlevs-1) / pow( p_mid_i(nlevs-1)/p_int_i(nlevs), PC::RD*PC::INV_CP);
373+
368374
if (not called_directly_after_init) {
369375
Faxa_rainl(i) = precip_liq_surf_mass(i)/dt*(1000.0/PC::RHO_H2O);
370376
Faxa_snowl(i) = precip_ice_surf_mass(i)/dt*(1000.0/PC::RHO_H2O);

0 commit comments

Comments
 (0)