Skip to content

Commit

Permalink
fix aoflux routine for ufs
Browse files Browse the repository at this point in the history
  • Loading branch information
DeniseWorthen committed Apr 11, 2024
1 parent cce82b9 commit 05f05ce
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions mediator/med_phases_aofluxes_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1075,9 +1075,9 @@ subroutine med_aofluxes_update(gcomp, aoflux_in, aoflux_out, rc)
taux=aoflux_out%taux, tauy=aoflux_out%tauy, tref=aoflux_out%tref, qref=aoflux_out%qref, &
ocn_surface_flux_scheme=ocn_surface_flux_scheme, &
add_gusts=add_gusts, &
duu10n=aoflux_out%duu10n, &
duu10n=aoflux_out%duu10n, &
ugust_out = aoflux_out%ugust_out, &
u10res = aoflux_out%u10res, &
u10res = aoflux_out%u10res, &
ustar_sv=aoflux_out%ustar, re_sv=aoflux_out%re, ssq_sv=aoflux_out%ssq, &
missval=0.0_r8)

Expand All @@ -1102,7 +1102,7 @@ subroutine med_aofluxes_update(gcomp, aoflux_in, aoflux_out, rc)
ocn_surface_flux_scheme=ocn_surface_flux_scheme, &
sen=aoflux_out%sen, lat=aoflux_out%lat, lwup=aoflux_out%lwup, evap=aoflux_out%evap, &
taux=aoflux_out%taux, tauy=aoflux_out%tauy, tref=aoflux_out%tref, qref=aoflux_out%qref, &
duu10n=aoflux_out%duu10n, &
duu10n=aoflux_out%duu10n, &
missval=0.0_r8)
#ifdef UFS_AOFLUX
end if
Expand All @@ -1111,7 +1111,7 @@ subroutine med_aofluxes_update(gcomp, aoflux_in, aoflux_out, rc)
#endif

do n = 1,aoflux_in%lsize
if (aoflux_in%mask(n) /= 0) then
if (aoflux_in%mask(n) /= 0) then
aoflux_out%u10(n) = aoflux_out%u10res(n)
aoflux_out%u10_withGust(n) = sqrt(aoflux_out%duu10n(n))
end if
Expand Down Expand Up @@ -1601,8 +1601,10 @@ subroutine set_aoflux_in_pointers(fldbun_a, fldbun_o, aoflux_in, lsize, xgrid, r
if (chkerr(rc,__LINE__,u_FILE_u)) return
call fldbun_getfldptr(fldbun_a, 'Sa_shum', aoflux_in%shum, xgrid=xgrid, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call fldbun_getfldptr(fldbun_a, 'Faxa_rainc', aoflux_in%rainc, xgrid=xgrid, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (coupling_mode == 'cesm') then
call fldbun_getfldptr(fldbun_a, 'Faxa_rainc', aoflux_in%rainc, xgrid=xgrid, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
end if
end if

! extra fields for ufs.frac.aoflux
Expand Down Expand Up @@ -1714,13 +1716,6 @@ subroutine set_aoflux_out_pointers(fldbun, lsize, aoflux_out, xgrid, rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call fldbun_getfldptr(fldbun, 'So_duu10n', aoflux_out%duu10n, xgrid=xgrid, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

call fldbun_getfldptr(fldbun, 'So_ugustOut', aoflux_out%ugust_out, xgrid=xgrid, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call fldbun_getfldptr(fldbun, 'So_u10withGust', aoflux_out%u10_withGust, xgrid=xgrid, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call fldbun_getfldptr(fldbun, 'So_u10res', aoflux_out%u10res, xgrid=xgrid, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call fldbun_getfldptr(fldbun, 'Faox_taux', aoflux_out%taux, xgrid=xgrid, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call fldbun_getfldptr(fldbun, 'Faox_tauy', aoflux_out%tauy, xgrid=xgrid, rc=rc)
Expand Down Expand Up @@ -1750,8 +1745,18 @@ subroutine set_aoflux_out_pointers(fldbun, lsize, aoflux_out, xgrid, rc)
if (add_gusts) then
call fldbun_getfldptr(fldbun, 'So_ugustOut', aoflux_out%ugust_out, xgrid=xgrid, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
call fldbun_getfldptr(fldbun, 'So_u10withGust', aoflux_out%u10_withGust, xgrid=xgrid, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
else
allocate(aoflux_out%ugust_out(lsize)); aoflux_out%ugust_out(:) = 0._R8
allocate(aoflux_out%u10_withGust(lsize)); aoflux_out%u10_withGust(:) = 0._R8
end if

if (coupling_mode == 'cesm') then
call fldbun_getfldptr(fldbun, 'So_u10res', aoflux_out%u10res, xgrid=xgrid, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
else
allocate(aoflux_out%u10res(lsize)); aoflux_out%u10res(:) = 0._R8
end if

end subroutine set_aoflux_out_pointers
Expand Down

0 comments on commit 05f05ce

Please sign in to comment.