Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
e4663bd
Updates CDEPS to latest ESCOMP/master with HAFS coupling related chan…
BinLiu-NOAA Aug 4, 2021
bfbba9b
Update develop branch of cdeps to the most recent version of ESCOMP/C…
binli2337 Oct 18, 2021
5775513
Merge branch 'ESCOMP:master' into develop
binli2337 Nov 23, 2021
b1c8946
Add Fortran code used by GFS v16 data mode (#40)
binli2337 Dec 16, 2021
ad4282a
Update develop branch to include the most recent changes from ESCOMP/…
binli2337 Jan 20, 2022
4eb7f24
Merge branch 'master' into develop
binli2337 Mar 18, 2022
7e2dc6c
update datm/atm_comp_nuopc.F90
binli2337 Mar 18, 2022
f1ed1b8
Merge pull request #45 from binli2337/feature/update_cdeps
binli2337 Apr 29, 2022
c509d89
Update CDEPS to include the recent changes from ESCOMP/CDEPS (#47)
binli2337 Jul 26, 2022
20df7e1
Merge branch 'master' into feature/update_cdeps
binli2337 Aug 16, 2022
edaef5b
Merge pull request #49 from binli2337/feature/update_cdeps
junwang-noaa Aug 22, 2022
530c262
Update CDEPS (#50)
uturuncoglu Oct 27, 2022
8e9672d
Merge branch 'main' into update_cdeps
binli2337 Jan 30, 2023
0d073f8
update datm/datm_datamode_gfs_mod.F90
binli2337 Jan 30, 2023
94acf25
Merge pull request #52 from binli2337/update_cdeps
junwang-noaa Feb 21, 2023
30279a9
Merge branch 'ESCOMP:main' into develop
binli2337 May 4, 2023
2aa6bfb
Update CDEPS to include the GFS_HAFS datamode (#55)
binli2337 May 25, 2023
89603d1
Update CDEPS (#58)
uturuncoglu Jan 26, 2024
3d7067a
sync CDEPS with ESCOMP (#60)
uturuncoglu Feb 5, 2024
fbdf684
Create cplhist mode for dice (#62)
NickSzapiro-NOAA Jun 11, 2024
1f9eaaa
Unify gfs, cfsr, and gefs datm datamodes (#63)
NickSzapiro-NOAA Aug 27, 2024
26cb593
Merge ESCOMP/main into sync_escomp_2024-10
NickSzapiro-NOAA Oct 7, 2024
7a18189
Remove duplicate SIMPLE case statements (from merge)
NickSzapiro-NOAA Oct 7, 2024
395f9dd
Remove duplicate use datm_datamode_simple_mod in atm_comp_nuopc.F90
NickSzapiro-NOAA Oct 8, 2024
c9d1dac
Merge 'ESCOMP/main' into sync_escomp_2024-10
NickSzapiro-NOAA Dec 10, 2024
51f8cd2
Compile fixes
NickSzapiro-NOAA Dec 10, 2024
34d1eab
Sync with ESCOMP/CDEPS/main (2024-12-10)
NickSzapiro-NOAA Dec 16, 2024
c7ea491
Merge 'ESCOMP/main' into sync_escomp_2024-12-16
NickSzapiro-NOAA Dec 17, 2024
2eccb9f
Merge 'ESCOMP/main' into sync_escomp_2024-12-16
NickSzapiro-NOAA Dec 23, 2024
5868cdb
Merge ESCOMP/main into sync_escomp_202503
NickSzapiro-NOAA Mar 21, 2025
79edd44
Merge ESCOMP/main
NickSzapiro-NOAA Mar 21, 2025
132fa69
Sync with ESCOMP/CDEPS (2025-03-23)
NickSzapiro-NOAA Mar 27, 2025
18f4255
Merge ESCOMP/main into sync_escomp_202508
NickSzapiro-NOAA Aug 13, 2025
9f53664
Sync with ESCOMP/main (2025-08)
NickSzapiro-NOAA Aug 25, 2025
bcebd63
Merge ESCOMP/main into sync_escomp_202602
NickSzapiro-NOAA Feb 20, 2026
d466212
Fix merge errors
NickSzapiro-NOAA Feb 20, 2026
996aec0
Merge NickSzapiro-NOAA/generic_datamode
NickSzapiro-NOAA Jun 10, 2026
4ead37f
Merge generic_datamode again
NickSzapiro-NOAA Jun 10, 2026
ca4520d
Merge again NickSzapiro-NOAA/generic_datamode
NickSzapiro-NOAA Jun 10, 2026
9b4ab00
typo
NickSzapiro-NOAA Jun 10, 2026
da882d7
Move dshr_pio_init from dshr_mesh_init to dshr_init
NickSzapiro-NOAA Jun 11, 2026
ed0c192
Add flds_scalar_name
NickSzapiro-NOAA Jun 15, 2026
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,9 @@
*.out
*.app

# Externals
fox
share/genf90

# ignore pycache
__pycache__
13 changes: 0 additions & 13 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
# This is a git-fleximod adapted .gitmodules file. Any field with a name starting in fx is a git-fleximod
# specific field. See https://github.com/ESMCI/git-fleximod for details.

[submodule "fox"]
path = fox
url = https://github.com/ESMCI/fox.git
fxtag = 4.1.2.4
fxrequired = AlwaysRequired
fxDONOTUSEurl = https://github.com/ESMCI/fox.git

[submodule "genf90"]
path = share/genf90
url = https://github.com/PARALLELIO/genf90
fxtag = 4816965
fxrequired = AlwaysRequired
fxDONOTUSEurl = https://github.com/PARALLELIO/genf90
1 change: 0 additions & 1 deletion datm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ set(SRCFILES atm_comp_nuopc.F90
datm_pres_ndep_mod.F90
datm_pres_o3_mod.F90)


foreach(FILE ${SRCFILES})
if(EXISTS "${CASEROOT}/SourceMods/src.datm/${FILE}")
list(REMOVE_ITEM SRCFILES ${FILE})
Expand Down
8 changes: 4 additions & 4 deletions datm/atm_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)

! Obtain flds_scalar values, mpi values, multi-instance values and
! set logunit and set shr logging to my log file
call dshr_init(gcomp, 'ATM', mpicom, my_task, inst_index, inst_suffix, &
call dshr_init(gcomp, sdat, 'ATM', mpicom, my_task, inst_index, inst_suffix, &
flds_scalar_name, flds_scalar_num, flds_scalar_index_nx, flds_scalar_index_ny, &
logunit, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
Expand Down Expand Up @@ -425,7 +425,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
nlfilename, my_task, vm, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
case ('GENERIC')
call datamode_generic_advertise(fldsExport, sdat, rc)
call datamode_generic_advertise(exportState, fldsExport, sdat, flds_scalar_name, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end select

Expand Down Expand Up @@ -466,7 +466,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)

! Initialize mesh, restart flag, compid, and logunit
call ESMF_TraceRegionEnter('datm_strdata_init')
call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ATM', nx_global, ny_global, &
call dshr_mesh_init(gcomp, nullstr, logunit, 'ATM', nx_global, ny_global, &
model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

Expand Down Expand Up @@ -543,7 +543,7 @@ subroutine ModelAdvance(gcomp, rc)
type(ESMF_Time) :: nextTime
type(ESMF_TimeInterval) :: timeStep
real(r8) :: nextsw_cday
logical :: restart_write ! restart alarm is ringing
logical :: restart_write ! restart alarm is ringing
integer :: next_ymd ! model date
integer :: next_tod ! model sec into model date
integer :: yr, mon, day ! year, month, day
Expand Down
34 changes: 30 additions & 4 deletions datm/datm_datamode_era5_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@ module datm_datamode_era5_mod
real(r8), pointer :: Sa_z(:) => null()
real(r8), pointer :: Sa_u10m(:) => null()
real(r8), pointer :: Sa_v10m(:) => null()
real(r8), pointer :: Sa_u(:) => null()
real(r8), pointer :: Sa_v(:) => null()
real(r8), pointer :: Sa_wspd10m(:) => null()
real(r8), pointer :: Sa_wspd(:) => null()
real(r8), pointer :: Sa_t2m(:) => null()
real(r8), pointer :: Sa_tbot(:) => null()
real(r8), pointer :: Sa_tskn(:) => null()
real(r8), pointer :: Sa_q2m(:) => null()
real(r8), pointer :: Sa_shum(:) => null()
real(r8), pointer :: Sa_pslv(:) => null()
real(r8), pointer :: Sa_pbot(:) => null()
real(r8), pointer :: Faxa_rain(:) => null()
real(r8), pointer :: Faxa_rainc(:) => null()
real(r8), pointer :: Faxa_rainl(:) => null()
Expand Down Expand Up @@ -69,8 +75,10 @@ module datm_datamode_era5_mod
real(r8), pointer :: strm_Faxa_taux(:) => null()
real(r8), pointer :: strm_Faxa_tauy(:) => null()

real(r8) :: t2max ! units detector
real(r8) :: td2max ! units detector
real(r8) :: t2max ! units detector
real(r8) :: td2max ! units detector
real(r8) :: lwmax ! units detector
real(r8) :: precmax ! units detector

real(r8) , parameter :: tKFrz = SHR_CONST_TKFRZ
real(r8) , parameter :: rdair = SHR_CONST_RDAIR ! dry air gas constant ~ J/K/kg
Expand Down Expand Up @@ -102,11 +110,17 @@ subroutine datm_datamode_era5_advertise(exportState, fldsexport, flds_scalar_nam
call dshr_fldList_add(fldsExport, 'Sa_z' )
call dshr_fldList_add(fldsExport, 'Sa_u10m' )
call dshr_fldList_add(fldsExport, 'Sa_v10m' )
call dshr_fldList_add(fldsExport, 'Sa_u' )
call dshr_fldList_add(fldsExport, 'Sa_v' )
call dshr_fldList_add(fldsExport, 'Sa_wspd10m' )
call dshr_fldList_add(fldsExport, 'Sa_wspd' )
call dshr_fldList_add(fldsExport, 'Sa_t2m' )
call dshr_fldList_add(fldsExport, 'Sa_tbot' )
call dshr_fldList_add(fldsExport, 'Sa_tskn' )
call dshr_fldList_add(fldsExport, 'Sa_q2m' )
call dshr_fldList_add(fldsExport, 'Sa_shum' )
call dshr_fldList_add(fldsExport, 'Sa_pslv' )
call dshr_fldList_add(fldsExport, 'Sa_pbot' )
call dshr_fldList_add(fldsExport, 'Faxa_rain' )
call dshr_fldList_add(fldsExport, 'Faxa_rainc' )
call dshr_fldList_add(fldsExport, 'Faxa_rainl' )
Expand Down Expand Up @@ -192,16 +206,28 @@ subroutine datm_datamode_era5_init_pointers(exportState, sdat, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(exportState, 'Sa_v10m' , fldptr1=Sa_v10m , allowNullReturn=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(exportState, 'Sa_u' , fldptr1=Sa_u , allowNullReturn=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(exportState, 'Sa_v' , fldptr1=Sa_v , allowNullReturn=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(exportState, 'Sa_wspd10m' , fldptr1=Sa_wspd10m , allowNullReturn=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(exportState, 'Sa_wspd' , fldptr1=Sa_wspd , allowNullReturn=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(exportState, 'Sa_t2m' , fldptr1=Sa_t2m , allowNullReturn=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(exportState, 'Sa_tbot' , fldptr1=Sa_tbot , allowNullReturn=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(exportState, 'Sa_tskn' , fldptr1=Sa_tskn , allowNullReturn=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(exportState, 'Sa_q2m' , fldptr1=Sa_q2m , allowNullReturn=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(exportState, 'Sa_shum' , fldptr1=Sa_shum , allowNullReturn=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(exportState, 'Sa_pslv' , fldptr1=Sa_pslv , allowNullReturn=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(exportState, 'Sa_pbot' , fldptr1=Sa_pbot , allowNullReturn=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(exportState, 'Faxa_rain' , fldptr1=Faxa_rain , allowNullReturn=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call dshr_state_getfldptr(exportState, 'Faxa_rainc' , fldptr1=Faxa_rainc , allowNullReturn=.true., rc=rc)
Expand Down Expand Up @@ -352,7 +378,7 @@ subroutine datm_datamode_era5_advance(exportstate, mainproc, logunit, rc)
! local variables
logical :: first_time = .true.
integer :: n ! indices
integer :: lsize ! size of attr vect
integer :: lsize = 0 ! size of attr vect
real(r8) :: rtmp(2)
real(r8) :: t2, pslv
real(r8) :: e, qsat
Expand Down Expand Up @@ -389,7 +415,7 @@ subroutine datm_datamode_era5_advance(exportstate, mainproc, logunit, rc)
do n = 1, lsize
!--- bottom layer height ---
if (associated(Sa_z)) then
Sa_z(n) = 10.0_r8
Sa_z(n) = 10.0_r8
end if

!--- calculate wind speed ---
Expand Down
3 changes: 2 additions & 1 deletion dglc/glc_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
character(len=CS) :: cnum
character(len=ESMF_MAXSTR) :: model_datafiles_list ! colon separated string containing input datafiles
character(len=ESMF_MAXSTR) :: model_meshfiles_list ! colon separated string containing model meshfiles
type(shr_strdata_type) :: sdat_dummy
character(len=*),parameter :: subname=trim(module_name)//':(InitializeAdvertise) '
!-------------------------------------------------------------------------------

Expand All @@ -210,7 +211,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)

! Obtain flds_scalar values, mpi values, multi-instance values and
! set logunit and set shr logging to my log file
call dshr_init(gcomp, 'GLC', mpicom, my_task, inst_index, inst_suffix, &
call dshr_init(gcomp, sdat_dummy, 'GLC', mpicom, my_task, inst_index, inst_suffix, &
flds_scalar_name, flds_scalar_num, flds_scalar_index_nx, flds_scalar_index_ny, logunit, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

Expand Down
8 changes: 5 additions & 3 deletions dice/ice_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
integer :: bcasttmp(4)
real(r8) :: rbcasttmp(3)
type(ESMF_VM) :: vm
logical :: isPresent, isSet

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The variables isPresent and isSet are declared in InitializeAdvertise but never used. They should be removed to keep the code clean.

character(len=*),parameter :: subname=trim(modName)//':(InitializeAdvertise) '
!-------------------------------------------------------------------------------

Expand All @@ -197,7 +198,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)

! Obtain flds_scalar values, mpi values, multi-instance values and
! set logunit and set shr logging to my log file
call dshr_init(gcomp, 'ICE', mpicom, my_task, inst_index, inst_suffix, &
call dshr_init(gcomp, sdat, 'ICE', mpicom, my_task, inst_index, inst_suffix, &
flds_scalar_name, flds_scalar_num, flds_scalar_index_nx, flds_scalar_index_ny, &
logunit, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
Expand Down Expand Up @@ -240,6 +241,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
rbcasttmp(1) = flux_swpf
rbcasttmp(2) = flux_Qmin
rbcasttmp(3) = flux_Qacc0
if(export_all) bcasttmp(4) = 1
endif

! broadcast namelist input
Expand All @@ -254,7 +256,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_VMBroadcast(vm, restfilm, CX, main_task, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_VMBroadcast(vm, bcasttmp, 3, main_task, rc=rc)
call ESMF_VMBroadcast(vm, bcasttmp, 4, main_task, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_VMBroadcast(vm, rbcasttmp, 3, main_task, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
Expand Down Expand Up @@ -326,7 +328,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)

! Initialize mesh, restart flag, logunit
call ESMF_TraceRegionEnter('dice_strdata_init')
call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ICE', nx_global, ny_global, &
call dshr_mesh_init(gcomp, nullstr, logunit, 'ICE', nx_global, ny_global, &
model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

Expand Down
6 changes: 3 additions & 3 deletions dlnd/lnd_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)

! Obtain flds_scalar values, mpi values, multi-instance values and
! set logunit and set shr logging to my log file
call dshr_init(gcomp, 'LND', mpicom, my_task, inst_index, inst_suffix, &
call dshr_init(gcomp, sdat, 'LND', mpicom, my_task, inst_index, inst_suffix, &
flds_scalar_name, flds_scalar_num, flds_scalar_index_nx, flds_scalar_index_ny, &
logunit, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
Expand Down Expand Up @@ -223,7 +223,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_VMBroadcast(vm, restfilm, CX, main_task, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_VMBroadcast(vm, bcasttmp, 3, main_task, rc=rc)
call ESMF_VMBroadcast(vm, bcasttmp, 4, main_task, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

nx_global = bcasttmp(1)
Expand Down Expand Up @@ -288,7 +288,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)

! Initialize sdat
call ESMF_TraceRegionEnter('dlnd_strdata_init')
call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'LND', nx_global, ny_global, &
call dshr_mesh_init(gcomp, nullstr, logunit, 'LND', nx_global, ny_global, &
model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc)

! Initialize stream data type
Expand Down
7 changes: 4 additions & 3 deletions docn/ocn_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ end subroutine SetServices
!===============================================================================
subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
use shr_nl_mod, only: shr_nl_find_group_name

! input/output variables
type(ESMF_GridComp) :: gcomp
type(ESMF_State) :: importState, exportState
Expand Down Expand Up @@ -218,7 +218,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)

! Obtain flds_scalar values, mpi values, multi-instance values and
! set logunit and set shr logging to my log file
call dshr_init(gcomp, 'OCN', mpicom, my_task, inst_index, inst_suffix, &
call dshr_init(gcomp, sdat, 'OCN', mpicom, my_task, inst_index, inst_suffix, &
flds_scalar_name, flds_scalar_num, flds_scalar_index_nx, flds_scalar_index_ny, logunit, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

Expand Down Expand Up @@ -260,6 +260,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
if(skip_restart_read) bcasttmp(3) = 1
if(export_all) bcasttmp(4) = 1
rtmp(1) = sst_constant_value
if(export_all) bcasttmp(4) = 1
Comment on lines 262 to +263

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The statement if(export_all) bcasttmp(4) = 1 is duplicated on line 263, as it was already executed on line 261. This redundant statement should be removed.

       rtmp(1) = sst_constant_value

endif

! Broadcast namelist input
Expand Down Expand Up @@ -398,7 +399,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if

call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'OCN', nx_global, ny_global, &
call dshr_mesh_init(gcomp, nullstr, logunit, 'OCN', nx_global, ny_global, &
model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

Expand Down
6 changes: 3 additions & 3 deletions drof/rof_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)

! Obtain flds_scalar values, mpi values, multi-instance values and
! set logunit and set shr logging to my log file
call dshr_init(gcomp, 'ROF', mpicom, my_task, inst_index, inst_suffix, &
call dshr_init(gcomp, sdat, 'ROF', mpicom, my_task, inst_index, inst_suffix, &
flds_scalar_name, flds_scalar_num, flds_scalar_index_nx, flds_scalar_index_ny, &
logunit, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
Expand Down Expand Up @@ -235,7 +235,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_VMBroadcast(vm, restfilm, CX, main_task, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_VMBroadcast(vm, bcasttmp, 3, main_task, rc=rc)
call ESMF_VMBroadcast(vm, bcasttmp, 4, main_task, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

nx_global = bcasttmp(1)
Expand Down Expand Up @@ -287,7 +287,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)

! Initialize mesh, restart flag, logunit
call ESMF_TraceRegionEnter('drof_strdata_init')
call dshr_mesh_init(gcomp, sdat, nullstr, logunit, 'ROF', nx_global, ny_global, &
call dshr_mesh_init(gcomp, nullstr, logunit, 'ROF', nx_global, ny_global, &
model_meshfile, model_maskfile, model_mesh, model_mask, model_frac, restart_read, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

Expand Down
1 change: 0 additions & 1 deletion dshr/dshr_fldlist_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ subroutine dshr_fldlist_realize(state, fldLists, flds_scalar_name, flds_scalar_n
stdname = fldList%stdname

if (NUOPC_IsConnected(state, fieldName=stdname) .or. export_all) then

! Check field name since linked list might have empty string
if (trim(stdname) == '') then
fldList => fldList%next
Expand Down
18 changes: 16 additions & 2 deletions dshr/dshr_generic_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module dshr_generic_mod

use ESMF , only : ESMF_SUCCESS, ESMF_State, &
ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_LOGMSG_WARNING
use NUOPC , only : NUOPC_Advertise
use shr_kind_mod , only : r8=>shr_kind_r8, cl=>shr_kind_cl
use dshr_fldlist_mod, only : fldlist_type, dshr_fldlist_add
use dshr_strdata_mod, only : shr_strdata_type, shr_strdata_get_stream_pointer
Expand Down Expand Up @@ -32,13 +33,16 @@ module dshr_generic_mod
contains

! =======================================================================
subroutine datamode_generic_advertise(fldsExport, sdat, rc)
subroutine datamode_generic_advertise(exportState, fldsExport, sdat, flds_scalar_name, rc)
type(ESMF_State) , intent(inout) :: exportState
type(fldList_type), pointer :: fldsExport
type(shr_strdata_type), intent(in) :: sdat
character(len=*) , intent(in) :: flds_scalar_name
integer, intent(out), optional :: rc

integer :: i, n
character(len=CL) :: fieldName
type(fldlist_type), pointer :: fldList

if (present(rc)) rc = ESMF_SUCCESS
Comment on lines 41 to 47

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

In datamode_generic_advertise, rc is declared as an optional argument. However, it is passed directly to ChkErr(rc, ...) on line 71. If rc is not present, passing it to a non-optional dummy argument in ChkErr will cause undefined behavior or a runtime crash. To resolve this, either make rc non-optional (consistent with datamode_generic_init_pointers) or use a local status variable to capture the return code and check it.

    integer,        intent(out)           :: rc

    integer :: i, n
    character(len=CL) :: fieldName
    type(fldlist_type), pointer :: fldList

    rc = ESMF_SUCCESS


Expand All @@ -58,14 +62,24 @@ subroutine datamode_generic_advertise(fldsExport, sdat, rc)
endif
end do
endif
! Handle cpl_scalars
call dshr_fldList_add(fldsExport, trim(flds_scalar_name))

fldlist => fldsExport ! the head of the linked list
do while (associated(fldlist))
call NUOPC_Advertise(exportState, standardName=fldlist%stdname, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_LogWrite('(datm_comp_advertise): Fr_atm'//trim(fldList%stdname), ESMF_LOGMSG_INFO)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The log message hardcodes (datm_comp_advertise): Fr_atm, which is specific to the DATM component. Since dshr_generic_mod.F90 is a shared utility module, hardcoding component-specific strings reduces its reusability and can be misleading if used by other components. Consider using a generic prefix or passing the component name as an argument.

       call ESMF_LogWrite('(dshr_generic_advertise): '//trim(fldList%stdname), ESMF_LOGMSG_INFO)

fldList => fldList%next
enddo

end subroutine datamode_generic_advertise

! =======================================================================
subroutine datamode_generic_init_pointers(exportState, sdat, rc)
type(ESMF_State), intent(inout) :: exportState
type(shr_strdata_type), intent(in) :: sdat
integer, intent(out), :: rc
integer, intent(out) :: rc

integer :: i, n, total_vars, cache_idx
character(len=CL) :: fieldName
Expand Down
Loading