Skip to content

Commit

Permalink
More correct fix to ensure psfc is allocated when needed
Browse files Browse the repository at this point in the history
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.

I think that the previous fix wasn't correct when using xgrid, because I
think nothing is originally in fldbun_a in that case.
  • Loading branch information
billsacks committed Oct 18, 2024
1 parent de94803 commit 0bbdcd0
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions mediator/med_phases_aofluxes_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1644,21 +1644,16 @@ subroutine set_aoflux_in_pointers(fldbun_a, fldbun_o, aoflux_in, lsize, xgrid, r
if (chkerr(rc,__LINE__,u_FILE_u)) return
end if

if (FB_fldchk(fldbun_a, 'Sa_pslv', rc=rc)) then
if ((trim(coupling_mode) == 'cesm') .or. &
(trim(coupling_mode) == 'ufs.frac.aoflux' .and. trim(aoflux_code) == 'ccpp')) then
call fldbun_getfldptr(fldbun_a, 'Sa_pslv', aoflux_in%psfc, xgrid=xgrid, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
else
allocate(aoflux_in%psfc(lsize))
end if

! if either density or potential temperature are computed, will need bottom level pressure
if (compute_atm_dens .or. compute_atm_thbot) then
call fldbun_getfldptr(fldbun_a, 'Sa_pbot', aoflux_in%pbot, xgrid=xgrid, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (trim(coupling_mode) == 'ufs.frac.aoflux') then
call fldbun_getfldptr(fldbun_a, 'Sa_pslv', aoflux_in%psfc, xgrid=xgrid, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
end if
end if

if (flds_wiso) then
Expand Down

0 comments on commit 0bbdcd0

Please sign in to comment.