Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for exchange grid with add_gusts false: Only add gust fields if add_gusts is true #501

Merged
merged 1 commit into from
Sep 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 31 additions & 20 deletions mediator/esmFldsExchange_cesm_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ module esmFldsExchange_cesm_mod
logical :: flds_co2c ! Pass CO2 from ATM to surface (OCN/LND) and back from them to ATM
logical :: flds_wiso ! Pass water isotop fields
logical :: flds_r2l_stream_channel_depths ! Pass channel depths from ROF to LND
logical :: add_gusts ! Whether to include fields related to the gustiness parameterization

character(*), parameter :: u_FILE_u = &
__FILE__
Expand Down Expand Up @@ -232,6 +233,11 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
read(cvalue,*) flds_r2l_stream_channel_depths

! are fields related to the gustiness parameterization enabled?
call NUOPC_CompAttributeGet(gcomp, name='add_gusts', value=cvalue, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
read(cvalue,*) add_gusts

! write diagnostic output
if (maintask) then
write(logunit,'(a)' ) ' flds_co2a: prognostic and diagnostic CO2 at lowest atm level is sent to lnd and ocn'
Expand All @@ -246,6 +252,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
write(logunit,'(a,l7)') trim(subname)//' flds_wiso = ',flds_wiso
write(logunit,'(a,l7)') trim(subname)//' flds_i2o_per_cat = ',flds_i2o_per_cat
write(logunit,'(a,l7)') trim(subname)//' flds_r2l_stream_channel_depths = ',flds_r2l_stream_channel_depths
write(logunit,'(a,l7)') trim(subname)//' add_gusts = ', add_gusts
write(logunit,'(a,l7)') trim(subname)//' mapuv_with_cart3d = ',mapuv_with_cart3d
end if

Expand Down Expand Up @@ -1414,35 +1421,39 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
! ---------------------------------------------------------------------
! to atm: unmerged ugust_out from ocn
! ---------------------------------------------------------------------
if (phase == 'advertise') then
call addfld_aoflux('So_ugustOut')
call addfld_to(compatm, 'So_ugustOut')
else
if ( fldchk(is_local%wrap%FBexp(compatm), 'So_ugustOut', rc=rc)) then
if (fldchk(is_local%wrap%FBMed_aoflux_o, 'So_ugustOut', rc=rc)) then
if (trim(is_local%wrap%aoflux_grid) == 'ogrid') then
call addmap_aoflux('So_ugustOut', compatm, mapconsf, 'ofrac', ocn2atm_map)
if (add_gusts) then
if (phase == 'advertise') then
call addfld_aoflux('So_ugustOut')
call addfld_to(compatm, 'So_ugustOut')
else
if ( fldchk(is_local%wrap%FBexp(compatm), 'So_ugustOut', rc=rc)) then
if (fldchk(is_local%wrap%FBMed_aoflux_o, 'So_ugustOut', rc=rc)) then
if (trim(is_local%wrap%aoflux_grid) == 'ogrid') then
call addmap_aoflux('So_ugustOut', compatm, mapconsf, 'ofrac', ocn2atm_map)
end if
call addmrg_to(compatm , 'So_ugustOut', &
mrg_from=compmed, mrg_fld='So_ugustOut', mrg_type='merge', mrg_fracname='ofrac')
end if
call addmrg_to(compatm , 'So_ugustOut', &
mrg_from=compmed, mrg_fld='So_ugustOut', mrg_type='merge', mrg_fracname='ofrac')
end if
end if
end if

! ---------------------------------------------------------------------
! to atm: 10 m winds including/excluding gust component
! ---------------------------------------------------------------------
if (phase == 'advertise') then
call addfld_aoflux('So_u10withGust')
call addfld_to(compatm, 'So_u10withGust')
else
if ( fldchk(is_local%wrap%FBexp(compatm), 'So_u10withGust', rc=rc)) then
if (fldchk(is_local%wrap%FBMed_aoflux_o, 'So_u10withGust', rc=rc)) then
if (trim(is_local%wrap%aoflux_grid) == 'ogrid') then
call addmap_aoflux('So_u10withGust', compatm, mapconsf, 'ofrac', ocn2atm_map)
if (add_gusts) then
if (phase == 'advertise') then
call addfld_aoflux('So_u10withGust')
call addfld_to(compatm, 'So_u10withGust')
else
if ( fldchk(is_local%wrap%FBexp(compatm), 'So_u10withGust', rc=rc)) then
if (fldchk(is_local%wrap%FBMed_aoflux_o, 'So_u10withGust', rc=rc)) then
if (trim(is_local%wrap%aoflux_grid) == 'ogrid') then
call addmap_aoflux('So_u10withGust', compatm, mapconsf, 'ofrac', ocn2atm_map)
end if
call addmrg_to(compatm , 'So_u10withGust', &
mrg_from=compmed, mrg_fld='So_u10withGust', mrg_type='merge', mrg_fracname='ofrac')
end if
call addmrg_to(compatm , 'So_u10withGust', &
mrg_from=compmed, mrg_fld='So_u10withGust', mrg_type='merge', mrg_fracname='ofrac')
end if
end if
end if
Expand Down
Loading