Skip to content

Commit 0de751f

Browse files
authored
Merge pull request #514 from billsacks/allocate_psfc
Fix logic for adding psfc to aoflux_in ### Description of changes Fix the logic for adding psfc to aoflux_in, particularly needed for cases using the exchange grid. This is needed to avoid a segmentation fault in the call to flux_atmocn in SMS_Ld2.ne30pg3_t232.BMT1850.derecho_gnu.allactive-defaultio when running with aoflux_grid=xgrid. (This shows up when running with xgrid because the FB_fldchk can't be used in this situation - see details in my [comment below](#514 (comment)).) ### Specific notes Contributors other than yourself, if any: CMEPS Issues Fixed (include github issue #): Are changes expected to change answers? No Any User Interface Changes (namelist or namelist defaults changes)? No ### Testing performed SMS_Ld2.ne30pg3_t232.BMT1850.derecho_gnu.allactive-defaultio with aoflux_grid="xgrid", from cesm3_0_beta03 Also ran many other tests from the CESM prealpha and prebeta test suite.
2 parents 1355710 + d9255d5 commit 0de751f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

mediator/med_phases_aofluxes_mod.F90

+7-5
Original file line numberDiff line numberDiff line change
@@ -1644,7 +1644,13 @@ subroutine set_aoflux_in_pointers(fldbun_a, fldbun_o, aoflux_in, lsize, xgrid, r
16441644
if (chkerr(rc,__LINE__,u_FILE_u)) return
16451645
end if
16461646

1647-
if (FB_fldchk(fldbun_a, 'Sa_pslv', rc=rc)) then
1647+
! The following conditional captures the cases where aoflux_in%psfc is needed in calls
1648+
! to flux_atmocn / flux_atmocn_ccpp. Note that coupling_mode=='cesm' is equivalent to
1649+
! the CESMCOUPLED CPP token, and coupling_mode(1:3)=='ufs' is roughly equivalent to
1650+
! the UFS_AOFLUX CPP token (noting that we should only be in this subroutine if using
1651+
! one of the aoflux variants of the ufs coupling_mode).
1652+
if ((trim(coupling_mode) == 'cesm') .or. &
1653+
(coupling_mode(1:3) == 'ufs' .and. trim(aoflux_code) == 'ccpp')) then
16481654
call fldbun_getfldptr(fldbun_a, 'Sa_pslv', aoflux_in%psfc, xgrid=xgrid, rc=rc)
16491655
if (chkerr(rc,__LINE__,u_FILE_u)) return
16501656
end if
@@ -1653,10 +1659,6 @@ subroutine set_aoflux_in_pointers(fldbun_a, fldbun_o, aoflux_in, lsize, xgrid, r
16531659
if (compute_atm_dens .or. compute_atm_thbot) then
16541660
call fldbun_getfldptr(fldbun_a, 'Sa_pbot', aoflux_in%pbot, xgrid=xgrid, rc=rc)
16551661
if (chkerr(rc,__LINE__,u_FILE_u)) return
1656-
if (trim(coupling_mode) == 'ufs.frac.aoflux') then
1657-
call fldbun_getfldptr(fldbun_a, 'Sa_pslv', aoflux_in%psfc, xgrid=xgrid, rc=rc)
1658-
if (chkerr(rc,__LINE__,u_FILE_u)) return
1659-
end if
16601662
end if
16611663

16621664
if (flds_wiso) then

0 commit comments

Comments
 (0)