Skip to content

Update era datamode cdeps#3

Open
ezhilsabareesh8 wants to merge 9 commits intocdeps1.0.92-xfrom
update-era-datamode-cdeps
Open

Update era datamode cdeps#3
ezhilsabareesh8 wants to merge 9 commits intocdeps1.0.92-xfrom
update-era-datamode-cdeps

Conversation

@ezhilsabareesh8
Copy link

Description of changes

This PR addresses issue #548 and updates datm/datm_datamode_era5_mod.F90 to support ERA5 forcing for ACCESS-OM3 configs.

The ERA5 datamode now aligns with the available ERA5 variables and computes required CDEPS fields internally. In particular, humidity (Sa_q2m, Sa_shum) is derived from ERA5 2 m temperature, dewpoint temperature, and pressure, and atmospheric density (Sa_dens) is computed internally from pressure, temperature, and humidity.

Additional atmospheric state fields expected by the mediator are now advertised in the ERA5 datamode:

Sa_u
Sa_v
Sa_tbot
Sa_ptem
Sa_dens
Sa_shum
Sa_pbot

Additional stream pointers were also added for precipitation and snow fluxes expected by the mediator:

Faxa_rain
Faxa_rainc
Faxa_rainl
Faxa_snowc
Faxa_snowl

These fields are currently read as stream pointers now (it was null before) which are required for mediator.

Specific notes

CDEPS Issues Fixed (include github issue #): ACCESS-NRI/access-om3-configs#548

Any User Interface Changes (namelist or namelist defaults changes): Changes made in datm.streams.xml

@ezhilsabareesh8 ezhilsabareesh8 marked this pull request as ready for review March 13, 2026 05:09
Copy link
Collaborator

@anton-seaice anton-seaice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't go through everything, but in this section:

! Error checks
if (.not. associated(strm_Sa_tdew)) then
call shr_log_error(subname//'ERROR: strm_Sa_tdew must be associated for era5 datamode')
return
end if
if (associated(Sa_wspd10m) .and. .not. associated(strm_Sa_u10m)) then
call shr_log_error(subname//'ERROR: strm_Sa_u10m must be associated for era5 datamode', rc=rc)
return
end if
if (associated(Sa_wspd10m) .and. .not. associated(strm_Sa_v10m)) then
call shr_log_error(subname//'ERROR: strm_Sa_v10m must be associated for era5 datamode', rc=rc)
return
end if
if (associated(Sa_t2m) .and. .not. associated(strm_Sa_t2m)) then
call shr_log_error(subname//'ERROR: strm_Sa_t2m must be associated for era5 datamode', rc=rc)
return
end if
if (associated(Sa_t2m) .and. associated(Sa_pslv) .and. (associated(Sa_q2m) .or. associated(Sa_shum)) .and. .not. associated(strm_Sa_pslv)) then
call shr_log_error(subname//'ERROR: strm_Sa_pslv must be associated for era5 datamode', rc=rc)
return
end if
if (associated(Faxa_swdn)) then
if (.not. associated(strm_Faxa_swdn)) then
call shr_log_error(subname//'ERROR: strm_Faxa_swdn must be associated for era5 datamode', rc=rc)
return
end if
end if
if ( associated(Faxa_swvdr) .or. associated(Faxa_swndr) .or. associated(Faxa_swvdf) .or. associated(Faxa_swndf)) then
if (.not. associated(strm_Faxa_swdn)) then
call shr_log_error(subname//'ERROR: strm_Faxa_swdn must be associated for era5 datamode', rc=rc)
return
end if
end if
if (associated(Faxa_swvdr) .and. .not. associated(strm_Faxa_swvdr)) then
call shr_log_error(subname//'ERROR: strm_Faxa_swvdr must be associated for era5 datamode', rc=rc)
return
end if
if (associated(Faxa_swndr) .and. .not. associated(strm_Faxa_swndr)) then
call shr_log_error(subname//'ERROR: strm_Faxa_swndr must be associated for era5 datamode', rc=rc)
return
end if
if (associated(Faxa_swvdf) .and. .not. associated(strm_Faxa_swvdf)) then
call shr_log_error(subname//'ERROR: strm_Faxa_swvdf must be associated for era5 datamode', rc=rc)
return
end if
if (associated(Faxa_swndf) .and. .not. associated(strm_Faxa_swndf)) then
call shr_log_error(subname//'ERROR: strm_Faxa_swndf must be associated for era5 datamode', rc=rc)
return
end if
if (associated(Faxa_lwdn) .and. .not. associated(strm_Faxa_lwdn)) then
call shr_log_error(subname//'ERROR: strm_Faxa_lwdn must be associated for era5 datamode', rc=rc)
return
end if
if (associated(Faxa_lwnet) .and. .not. associated(strm_Faxa_lwnet)) then
call shr_log_error(subname//'ERROR: strm_Faxa_lwnet must be associated for era5 datamode', rc=rc)
return
end if
if (associated(Faxa_swnet) .and. .not. associated(strm_Faxa_swnet)) then
call shr_log_error(subname//'ERROR: strm_Faxa_swnet must be associated for era5 datamode', rc=rc)
return
end if
if (associated(Faxa_sen) .and. .not. associated(strm_Faxa_sen)) then
call shr_log_error(subname//'ERROR: strm_Faxa_sen must be associated for era5 datamode', rc=rc)
return
end if
if (associated(Faxa_lat) .and. .not. associated(strm_Faxa_lat)) then
call shr_log_error(subname//'ERROR: strm_Faxa_lat must be associated for era5 datamode', rc=rc)
return
end if
if (associated(Faxa_rain) .and. .not. associated(strm_Faxa_rain)) then
call shr_log_error(subname//'ERROR: strm_Faxa_rain must be associated for era5 datamode', rc=rc)
return
end if
if (associated(Faxa_rainc) .and. .not. associated(strm_Faxa_rainc)) then
call shr_log_error(subname//'ERROR: strm_Faxa_rainc must be associated for era5 datamode', rc=rc)
return
end if
if (associated(Faxa_rainl) .and. .not. associated(strm_Faxa_rainl)) then
call shr_log_error(subname//'ERROR: strm_Faxa_rainl must be associated for era5 datamode', rc=rc)
return
end if
if (associated(Faxa_snowc) .and. .not. associated(strm_Faxa_snowc)) then
call shr_log_error(subname//'ERROR: strm_Faxa_snowc must be associated for era5 datamode', rc=rc)
return
end if
if (associated(Faxa_snowl) .and. .not. associated(strm_Faxa_snowl)) then
call shr_log_error(subname//'ERROR: strm_Faxa_snowl must be associated for era5 datamode', rc=rc)
return
end if
if (associated(Faxa_taux) .and. .not. associated(strm_Faxa_taux)) then
call shr_log_error(subname//'ERROR: strm_Faxa_taux must be associated for era5 datamode', rc=rc)
return
end if
if (associated(Faxa_tauy) .and. .not. associated(strm_Faxa_tauy)) then
call shr_log_error(subname//'ERROR: strm_Faxa_tauy must be associated for era5 datamode', rc=rc)
return
end if

we should modify it to only require the fields we actually need.

I think the fields we need are:

rainc, rainl, snowc, snowl, lwdn, swdn,swvdr, swvdf, swndr, swndf, slp_10, t_10, tdew, u_10 and v_10

and then allow these fields to not exist :

prsn, rain, lwnet, swnet, lat, taux, tauy, tskn,


! local variables
logical :: first_time = .true.
logical, save :: first_time = .true.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the save isn't required here, when a value is supplied in definitions then save is the default behaviour

@anton-seaice
Copy link
Collaborator

Could you make PR for generating the streams file as well please ?

It make sense to look at it at the same time

From med.log, shows the connected fields

(merge_to_ocn): Si_ifrac(ocn) = Si_ifrac(ice)
(merge_to_ocn): Foxx_lwnet(ocn) = ofrac*Faxa_lwdn(atm)
(merge_to_ocn): Faxa_rain(ocn) = ofrac*Faxa_rainc:Faxa_rainl(atm)
(merge_to_ocn): Faxa_snow(ocn) = ofrac*Faxa_snowc:Faxa_snowl(atm)
(merge_to_ocn): Sa_pslv(ocn) = Sa_pslv(atm)
(merge_to_ocn): Foxx_taux(ocn) = ifrac*Fioi_taux(ice)
(merge_to_ocn): Foxx_tauy(ocn) = ifrac*Fioi_tauy(ice)
(merge_to_ocn): Fioi_meltw(ocn) = ifrac*Fioi_meltw(ice)
(merge_to_ocn): Fioi_melth(ocn) = ifrac*Fioi_melth(ice)
(merge_to_ocn): Fioi_salt(ocn) = ifrac*Fioi_salt(ice)
(merge_to_ocn): Foxx_rofl(ocn) = Forr_rofl(rof)
(merge_to_ocn): Foxx_rofi(ocn) = Forr_rofi(rof)
(merge_to_ice): Faxa_lwdn(ice) = Faxa_lwdn(atm)
(merge_to_ice): Faxa_swndr(ice) = Faxa_swndr(atm)
(merge_to_ice): Faxa_swvdr(ice) = Faxa_swvdr(atm)
(merge_to_ice): Faxa_swndf(ice) = Faxa_swndf(atm)
(merge_to_ice): Faxa_swvdf(ice) = Faxa_swvdf(atm)
(merge_to_ice): Faxa_rain(ice) = Faxa_rainc:Faxa_rainl(atm)
(merge_to_ice): Faxa_snow(ice) = Faxa_snowc:Faxa_snowl(atm)
(merge_to_ice): Sa_z(ice) = Sa_z(atm)
(merge_to_ice): Sa_pbot(ice) = Sa_pbot(atm)
(merge_to_ice): Sa_tbot(ice) = Sa_tbot(atm)
(merge_to_ice): Sa_ptem(ice) = Sa_ptem(atm)
(merge_to_ice): Sa_dens(ice) = Sa_dens(atm)
(merge_to_ice): Sa_u(ice) = Sa_u(atm)
(merge_to_ice): Sa_v(ice) = Sa_v(atm)
(merge_to_ice): Sa_shum(ice) = Sa_shum(atm)
(merge_to_ice): So_t(ice) = So_t(ocn)
(merge_to_ice): So_s(ice) = So_s(ocn)
(merge_to_ice): So_u(ice) = So_u(ocn)
(merge_to_ice): So_v(ice) = So_v(ocn)
(merge_to_ice): So_dhdx(ice) = So_dhdx(ocn)
(merge_to_ice): So_dhdy(ice) = So_dhdy(ocn)
(merge_to_ice): Fioo_q(ice) = Fioo_q(ocn)

@anton-seaice
Copy link
Collaborator

we should modify it to only require the fields we actually need.

See

! initialize stream pointers
call shr_strdata_get_stream_pointer( sdat, 'Faxa_prec' , strm_Faxa_prec , rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call shr_strdata_get_stream_pointer( sdat, 'Faxa_prrn' , strm_Faxa_prrn , rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call shr_strdata_get_stream_pointer( sdat, 'Faxa_prsn' , strm_Faxa_prsn , rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if ( .not. ((associated(strm_Faxa_prec) & !jra 55
.or. (associated(strm_Faxa_prrn) .and. associated(strm_Faxa_prsn))))) & !jra55do
call shr_log_error(subName//"ERROR: strm_Faxa_prec or (strm_Faxa_prrn and strm_Faxa_prsn) "//&
"must be associated for jra datamode", rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call shr_strdata_get_stream_pointer( sdat, 'Faxa_swdn' , strm_Faxa_swdn , requirePointer=.true., &
errmsg=subname//'ERROR: strm_Faxa_swdn must be associated for jra datamode', rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call shr_strdata_get_stream_pointer( sdat, 'Faxa_lwdn' , strm_Faxa_lwdn , requirePointer=.true., &
errmsg=subname//'ERROR: strm_Faxa_lwdn must be associated for jra datamode', rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call shr_strdata_get_stream_pointer( sdat, 'Sa_pslv' , strm_Sa_pslv , requirePointer=.true., &
errmsg=subname//'ERROR: strm_Sa_pslv must be associated for jra datamode', rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call shr_strdata_get_stream_pointer( sdat, 'Sa_tbot' , strm_Sa_tbot , requirePointer=.true., &
errmsg=subname//'ERROR: strm_Sa_tbot must be associated for jra datamode', rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call shr_strdata_get_stream_pointer( sdat, 'Sa_u' , strm_Sa_u , requirePointer=.true., &
errmsg=subname//'ERROR: strm_Sa_u must be associated for jra datamode', rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call shr_strdata_get_stream_pointer( sdat, 'Sa_v' , strm_Sa_v , requirePointer=.true., &
errmsg=subname//'ERROR: strm_Sa_v must be associated for jra datamode', rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call shr_strdata_get_stream_pointer( sdat, 'Sa_shum' , strm_Sa_shum , requirePointer=.true., &
errmsg=subname//'ERROR: strm_Sa_shum must be associated for jra datamode', rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

Where only some streams use requirePointer=True

and for other streams, there is logic saying one or another stream is required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants