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

implement ocean albedos for UFS #395

Merged
merged 29 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4511994
update CMEPS (#82)
DeniseWorthen Feb 1, 2023
cef1277
add back bilnr_nstod mapping
DeniseWorthen Feb 25, 2023
91bcb84
Modify CMEPS for ufsdev_ruclsm (#84)
RatkoVasic-NOAA Mar 31, 2023
75fed2b
Merge branch 'NOAA-EMC:emc/develop' into feature/add_unstr
DeniseWorthen Apr 1, 2023
fe2c158
new clm lake variables (#77)
SamuelTrahanNOAA Apr 26, 2023
6776c24
Merge remote-tracking branch 'ESCOMP/main' into feature/updcmeps
DeniseWorthen May 9, 2023
66c0d0f
Merge remote-tracking branch 'ESCOMP/main' into feature/updcmeps
DeniseWorthen May 11, 2023
fd9151a
Merge remote-tracking branch 'ESCOMP/main' into feature/updcmeps
DeniseWorthen May 12, 2023
ebc63bb
allow ufs to use check nan feature
DeniseWorthen May 12, 2023
a25075d
fix comments
DeniseWorthen May 12, 2023
fd9872f
Merge remote-tracking branch 'ESCOMP/main' into feature/updcmeps
DeniseWorthen May 15, 2023
f568cfc
Merge remote-tracking branch 'ESCOMP/main' into feature/updcmeps
DeniseWorthen May 17, 2023
6a642a6
get ufs to work w/ ocnalb
DeniseWorthen May 24, 2023
a34f315
Merge remote-tracking branch 'ESCOMP/main' into feature/updcmeps
DeniseWorthen May 24, 2023
d75d75e
remove file accidentally committed
DeniseWorthen May 26, 2023
a4d615e
add config variables for ufs use case
DeniseWorthen May 30, 2023
19042cf
Merge branch 'feature/updcmeps' into feature/fixsw
DeniseWorthen May 31, 2023
b6fd22c
add configuration options for albedo calcs
DeniseWorthen Jun 12, 2023
cec8db8
Update CMEPS (#88)
DeniseWorthen Jun 14, 2023
acbddd2
Merge branch 'emc/develop' into feature/fixsw
DeniseWorthen Jun 14, 2023
9923d6d
use evap from atm (#96)
DeniseWorthen Jul 7, 2023
5a3bd1c
Merge branch 'NOAA-EMC:emc/develop' into feature/fixsw
DeniseWorthen Jul 25, 2023
7b7d232
remove TODOs
DeniseWorthen Jul 27, 2023
4e09c3a
use log_error, not log_info
DeniseWorthen Jul 27, 2023
9bcf425
remove TODO
DeniseWorthen Jul 27, 2023
427ebeb
add missing return error check for FldsExchange
DeniseWorthen Jul 29, 2023
957a0fb
address comments
DeniseWorthen Jul 31, 2023
f5894d4
Merge branch 'main' into feature/fixsw
jedwards4b Aug 4, 2023
ec41c2f
revert changes for swnet in prep_ocn
DeniseWorthen Aug 7, 2023
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
20 changes: 15 additions & 5 deletions mediator/esmFldsExchange_nems_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ subroutine esmFldsExchange_nems(gcomp, phase, rc)
use esmFlds , only : addmap_from => med_fldList_addmap_from
use esmFlds , only : addfld_aoflux => med_fldList_addfld_aoflux
use esmFlds , only : addmap_aoflux => med_fldList_addmap_aoflux
use esmFlds , only : addfld_ocnalb => med_fldList_addfld_ocnalb
use esmFlds , only : addmap_ocnalb => med_fldList_addmap_ocnalb

! input/output parameters:
type(ESMF_GridComp) :: gcomp
Expand Down Expand Up @@ -172,6 +174,14 @@ subroutine esmFldsExchange_nems(gcomp, phase, rc)
call addfld_from(compice, 'mean_sw_pen_to_ocn')
end if

! Advertise the ocean albedos. These are not sent to the ATM in UFS.
if (phase == 'advertise') then
call addfld_ocnalb('So_avsdr')
call addfld_ocnalb('So_avsdf')
call addfld_ocnalb('So_anidr')
call addfld_ocnalb('So_anidf')
end if

!=====================================================================
! FIELDS TO ATMOSPHERE (compatm)
!=====================================================================
Expand Down Expand Up @@ -306,7 +316,7 @@ subroutine esmFldsExchange_nems(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBexp(compatm) , 'Sw_z0', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compwav,compwav), 'Sw_z0', rc=rc)) then
call addmap_from(compwav, 'Sw_z0', compatm, mapnstod_consf, 'one', 'unset')
call addmap_from(compwav, 'Sw_z0', compatm, mapbilnr_nstod, 'one', 'unset')
call addmrg_to(compatm, 'Sw_z0', mrg_from=compwav, mrg_fld='Sw_z0', mrg_type='copy')
end if
end if
Expand Down Expand Up @@ -453,13 +463,13 @@ subroutine esmFldsExchange_nems(gcomp, phase, rc)
! to ocn: evaporation water flux (custom merge in med_phases_prep_ocn)
if (phase == 'advertise') then
if (is_local%wrap%comp_present(compatm) .and. is_local%wrap%comp_present(compocn)) then
call addfld_from(compatm, 'Faxa_lat')
call addfld_from(compatm, 'Faxa_evap')
call addfld_to(compocn, 'Faxa_evap')
end if
else
if ( fldchk(is_local%wrap%FBexp(compocn) , 'Faxa_evap', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compatm,compatm), 'Faxa_lat' , rc=rc)) then
call addmap_from(compatm, 'Faxa_lat', compocn, mapconsf_aofrac, 'aofrac', 'unset')
fldchk(is_local%wrap%FBImp(compatm,compatm), 'Faxa_evap' , rc=rc)) then
call addmap_from(compatm, 'Faxa_evap', compocn, mapconsf_aofrac, 'aofrac', 'unset')
end if
end if
else if (trim(coupling_mode) == 'nems_orig_data' .or. trim(coupling_mode) == 'nems_frac_aoflux') then
Expand Down Expand Up @@ -698,7 +708,7 @@ subroutine esmFldsExchange_nems(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBexp(compwav) , trim(fldname), rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compatm,compatm), trim(fldname), rc=rc)) then
call addmap_from(compatm, trim(fldname), compwav, mapnstod_consf, 'one', 'unset')
call addmap_from(compatm, trim(fldname), compwav, mapbilnr_nstod, 'one', 'unset')
call addmrg_to(compwav, trim(fldname), mrg_from=compatm, mrg_fld=trim(fldname), mrg_type='copy')
end if
end if
Expand Down
17 changes: 8 additions & 9 deletions mediator/med.F90
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ subroutine AdvertiseFields(gcomp, importState, exportState, clock, rc)
use NUOPC , only : NUOPC_CompAttributeGet, NUOPC_CompAttributeSet, NUOPC_CompAttributeAdd
use esmFlds, only : med_fldlist_init1, med_fld_GetFldInfo, med_fldList_entry_type
use med_phases_history_mod, only : med_phases_history_init
use med_methods_mod , only : mediator_checkfornans
use med_methods_mod , only : mediator_checkfornans

! input/output variables
type(ESMF_GridComp) :: gcomp
Expand Down Expand Up @@ -921,7 +921,7 @@ subroutine AdvertiseFields(gcomp, importState, exportState, clock, rc)
call NUOPC_CompAttributeGet(gcomp, name="check_for_nans", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if(isPresent .and. isSet) then
read(cvalue, *) mediator_checkfornans
read(cvalue, *) mediator_checkfornans
else
mediator_checkfornans = .false.
endif
Expand Down Expand Up @@ -1804,7 +1804,8 @@ subroutine DataInitialize(gcomp, rc)
call esmFldsExchange_cesm(gcomp, phase='initialize', rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
else if (trim(coupling_mode(1:4)) == 'nems') then
call esmFldsExchange_nems(gcomp, phase='initialize', rc=rc)
call esmFldsExchange_nems(gcomp, phase='initialize', rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
DeniseWorthen marked this conversation as resolved.
Show resolved Hide resolved
else if (trim(coupling_mode) == 'hafs') then
call esmFldsExchange_hafs(gcomp, phase='initialize', rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
Expand Down Expand Up @@ -1939,14 +1940,12 @@ subroutine DataInitialize(gcomp, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

!----------------------------------------------------------
! Initialize ocean albedos (this is needed for cesm and hafs)
! Initialize ocean albedos
!----------------------------------------------------------

if (trim(coupling_mode(1:5)) /= 'nems_') then
if (is_local%wrap%comp_present(compocn) .or. is_local%wrap%comp_present(compatm)) then
call med_phases_ocnalb_run(gcomp, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if
if (is_local%wrap%comp_present(compocn) .or. is_local%wrap%comp_present(compatm)) then
call med_phases_ocnalb_run(gcomp, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if

!---------------------------------------
Expand Down
9 changes: 6 additions & 3 deletions mediator/med_io_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module med_io_mod
use NUOPC , only : NUOPC_FieldDictionaryGetEntry
use NUOPC , only : NUOPC_FieldDictionaryHasEntry
use pio , only : file_desc_t, iosystem_desc_t
use med_internalstate_mod , only : logunit, med_id
use med_internalstate_mod , only : logunit, med_id, maintask
use med_constants_mod , only : dbug_flag => med_constants_dbug_flag
use med_methods_mod , only : FB_getFieldN => med_methods_FB_getFieldN
use med_methods_mod , only : FB_getFldPtr => med_methods_FB_getFldPtr
Expand Down Expand Up @@ -75,7 +75,7 @@ module med_io_mod
character(*),parameter :: prefix = "med_io_"
character(*),parameter :: modName = "(med_io_mod) "
character(*),parameter :: version = "cmeps0"

integer :: pio_iotype
integer :: pio_ioformat
type(iosystem_desc_t), pointer :: io_subsystem
Expand Down Expand Up @@ -1737,7 +1737,10 @@ subroutine med_io_read_init_iodesc(FB, name1, pioid, iodesc, rc)
deallocate(dof)

deallocate(minIndexPTile, maxIndexPTile)

else
if(maintask) write(logunit,*) trim(subname),' ERROR: '//trim(name1)//' is not present, aborting '
DeniseWorthen marked this conversation as resolved.
Show resolved Hide resolved
call ESMF_LogWrite(trim(subname)//' ERROR: '//trim(name1)//' is not present, aborting ', ESMF_LOGMSG_ERROR)
rc = ESMF_FAILURE
end if ! end if rcode check

end subroutine med_io_read_init_iodesc
Expand Down
3 changes: 2 additions & 1 deletion mediator/med_map_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ subroutine med_map_RouteHandles_initfrom_esmflds(gcomp, flds_scalar_name, llogun
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (maintask) then
write(logunit,'(a)') trim(subname)//' created field_NormOne for '&
//compname(n1)//'->'//compname(n2)//' with mapping '//trim(mapnames(mapindex))
//trim(compname(n1))//'->'//trim(compname(n2))//' with mapping '&
//trim(mapnames(mapindex))
end if
end if
end do ! end of loop over map_indiex mappers
Expand Down
2 changes: 1 addition & 1 deletion mediator/med_phases_history_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module med_phases_history_mod
use med_io_mod , only : med_io_write, med_io_wopen, med_io_enddef, med_io_close
use perf_mod , only : t_startf, t_stopf
use pio , only : file_desc_t

implicit none
private

Expand Down
Loading
Loading