Skip to content

Commit

Permalink
Add subroutines used for CFSR data source (ESCOMP#5)
Browse files Browse the repository at this point in the history
Fortran subroutines used for CFSR data source are added.
The updated code can be compiled successfully on Hera.
  • Loading branch information
binli2337 authored Dec 11, 2020
1 parent 4fd370e commit d0a8444
Show file tree
Hide file tree
Showing 3 changed files with 372 additions and 0 deletions.
1 change: 1 addition & 0 deletions datm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ add_library(datm atm_comp_nuopc.F90
datm_datamode_clmncep_mod.F90
datm_datamode_core2_mod.F90
datm_datamode_jra_mod.F90
datm_datamode_cfsr_mod.F90
datm_datamode_era5_mod.F90)

add_dependencies(datm dshr streams)
Expand Down
22 changes: 22 additions & 0 deletions datm/atm_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ module atm_comp_nuopc
use datm_datamode_era5_mod , only : datm_datamode_era5_advance
use datm_datamode_era5_mod , only : datm_datamode_era5_restart_write
use datm_datamode_era5_mod , only : datm_datamode_era5_restart_read
use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_advertise
use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_init_pointers
use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_advance
use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_restart_write
use datm_datamode_cfsr_mod , only : datm_datamode_cfsr_restart_read

implicit none
private ! except
Expand Down Expand Up @@ -284,6 +289,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
trim(datamode) == 'CORE2_IAF' .or. &
trim(datamode) == 'CORE_IAF_JRA' .or. &
trim(datamode) == 'CLMNCEP' .or. &
trim(datamode) == 'CFSR' .or. &
trim(datamode) == 'ERA5') then
else
call shr_sys_abort(' ERROR illegal datm datamode = '//trim(datamode))
Expand All @@ -305,6 +311,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
case ('ERA5')
call datm_datamode_era5_advertise(exportState, fldsExport, flds_scalar_name, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
case ('CFSR')
call datm_datamode_cfsr_advertise(exportState, fldsExport, flds_scalar_name, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end select

end subroutine InitializeAdvertise
Expand Down Expand Up @@ -541,6 +550,9 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe
case('ERA5')
call datm_datamode_era5_init_pointers(exportState, sdat, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
case('CFSR')
call datm_datamode_cfsr_init_pointers(exportState, sdat, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end select

! Read restart if needed
Expand All @@ -554,6 +566,8 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe
call datm_datamode_clmncep_restart_read(restfilm, inst_suffix, logunit, my_task, mpicom, sdat)
case('ERA5')
call datm_datamode_era5_restart_read(restfilm, inst_suffix, logunit, my_task, mpicom, sdat)
case('CFSR')
call datm_datamode_cfsr_restart_read(restfilm, inst_suffix, logunit, my_task, mpicom, sdat)
end select
end if

Expand Down Expand Up @@ -598,6 +612,10 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe
call datm_datamode_era5_advance(exportstate, masterproc, logunit, mpicom, target_ymd, &
target_tod, sdat%model_calendar, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
case('CFSR')
call datm_datamode_cfsr_advance(exportstate, masterproc, logunit, mpicom, target_ymd, &
target_tod, sdat%model_calendar, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end select

! Write restarts if needed
Expand All @@ -619,6 +637,10 @@ subroutine datm_comp_run(importState, exportState, target_ymd, target_tod, targe
call datm_datamode_era5_restart_write(case_name, inst_suffix, target_ymd, target_tod, &
logunit, my_task, sdat)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
case('CFSR')
call datm_datamode_cfsr_restart_write(case_name, inst_suffix, target_ymd, target_tod, &
logunit, my_task, sdat)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end select
end if

Expand Down
Loading

0 comments on commit d0a8444

Please sign in to comment.