Skip to content

Commit

Permalink
Don't regrid runoff separately for ERA5. COSIMA/access-om2#242
Browse files Browse the repository at this point in the history
  • Loading branch information
nichannah committed Sep 14, 2021
1 parent 5c997f1 commit a111899
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 21 deletions.
6 changes: 3 additions & 3 deletions atm/src/atm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ program atm

use mod_oasis, only : OASIS_IN, OASIS_OUT
use forcing_config_mod, only : forcing_config_type => forcing_config
use forcing_field_mod, only : forcing_field_type => forcing_field, FORCING_FIELD_DOMAIN_LAND
use forcing_field_mod, only : forcing_field_type => forcing_field, FORCING_FIELD_REALM_LAND
use coupler_mod, only : coupler_type => coupler
use error_handler, only : assert
use ice_grid_proxy_mod, only : ice_grid_type => ice_grid_proxy
Expand Down Expand Up @@ -121,7 +121,7 @@ program atm
allocate(to_runoff_map(num_atm_to_ice_fields))
ri = 1
do i=1, num_atm_to_ice_fields
if (forcing_fields(i)%domain == FORCING_FIELD_DOMAIN_LAND) then
if (forcing_fields(i)%realm == FORCING_FIELD_REALM_LAND) then
to_runoff_map(i) = ri
ri = ri + 1
else
Expand All @@ -135,7 +135,7 @@ program atm
ri = to_runoff_map(i)
runoff_forcing_fields(ri)%coupling_name = &
forcing_fields(i)%coupling_name
runoff_forcing_fields(ri)%domain = forcing_fields(i)%domain
runoff_forcing_fields(ri)%realm = forcing_fields(i)%realm
allocate(runoff_forcing_fields(ri)%data_array(ice_shape(1), ice_shape(2)))
call coupler%init_field(runoff_forcing_fields(ri)%coupling_name, &
OASIS_OUT, &
Expand Down
24 changes: 12 additions & 12 deletions libforcing/src/forcing_field.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ module forcing_field_mod
implicit none
private

! Forcing fields can have a domain
integer, parameter, public :: FORCING_FIELD_DOMAIN_NONE = 0
integer, parameter, public :: FORCING_FIELD_DOMAIN_ATMOSPHERE = 10
integer, parameter, public :: FORCING_FIELD_DOMAIN_LAND = 20
! Forcing fields can have a realm
integer, parameter, public :: FORCING_FIELD_REALM_NONE = 0
integer, parameter, public :: FORCING_FIELD_REALM_ATMOSPHERE = 10
integer, parameter, public :: FORCING_FIELD_REALM_LAND = 20

type, public :: forcing_field
character(len=64), dimension(:), allocatable :: names
character(len=64) :: coupling_name
character(len=1024), dimension(:), allocatable :: filename_templates
integer :: domain
integer :: realm

integer :: dt
character(len=9) :: calendar
Expand All @@ -46,13 +46,13 @@ module forcing_field_mod

contains

subroutine forcing_field_init(self, name_list, filename_template_list, cname, domain, &
subroutine forcing_field_init(self, name_list, filename_template_list, cname, realm, &
start_date, product_name, loggerin, dt, calendar)
class(forcing_field), intent(inout) :: self
character(len=*), dimension(:), intent(in) :: name_list
character(len=*), dimension(:), intent(in) :: filename_template_list
character(len=*), intent(in) :: cname
character(len=*), intent(in) :: domain
character(len=*), intent(in) :: realm
type(datetime), intent(in) :: start_date
character(len=*), intent(in) :: product_name
type(logger_type), target, intent(in) :: loggerin
Expand All @@ -71,12 +71,12 @@ subroutine forcing_field_init(self, name_list, filename_template_list, cname, do
self%names(:) = name_list(:)
self%filename_templates(:) = filename_template_list(:)
self%coupling_name = cname
if (domain == 'atmosphere') then
self%domain = FORCING_FIELD_DOMAIN_ATMOSPHERE
if (realm == 'atmosphere') then
self%realm = FORCING_FIELD_REALM_ATMOSPHERE
else
call assert(trim(domain) == 'land', &
"Invalid domain value.")
self%domain = FORCING_FIELD_DOMAIN_LAND
call assert(trim(realm) == 'land', &
"Invalid realm value.")
self%realm = FORCING_FIELD_REALM_LAND
endif

self%product_name = trim(product_name)
Expand Down
6 changes: 3 additions & 3 deletions tests/ERA5/accessom2.nml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/

&date_manager_nml
forcing_start_date = '1980-12-30T00:00:00'
forcing_end_date = '2020-01-01T00:00:00'
restart_period = 1, 0, 0
forcing_start_date = '1981-01-01T00:00:00'
forcing_end_date = '1981-02-01T00:00:00'
restart_period = 0, 1, 0
/
2 changes: 1 addition & 1 deletion tests/ERA5/forcing.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
},
{
"coupling_field_name": "runof_ai",
"realm": "land",
"realm": "atmosphere",
"input_fields": [
{
"filename": "/g/data/rt52/era5/single-levels/reanalysis/mror/{{year}}/mror_era5_oper_sfc_{{year}}{{month}}{{start_day}}-{{year}}{{month}}{{end_day}}.nc",
Expand Down
6 changes: 4 additions & 2 deletions tests/ERA5/namcouple
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,14 @@ CONSERV LR SCALAR LATLON 10 FRACNNEI FIRST
##########
# Field 06 : runoff. Runoff is passed on the destination grid.
##########
runof_ai runof_i 297 3600 1 a2i.nc EXPORTED
runof_ai runof_i 297 3600 3 a2i.nc EXPORTED
cict cict LAG=0 SEQ=+1
P 0 P 0
#
LOCTRANS
LOCTRANS MAPPING SCRIPR
INSTANT
../test_data/ERA5_MOM1_conserve.nc dst
CONSERV LR SCALAR LATLON 10 FRACNNEI FIRST
##########
# Field 07 : near surface (2m) air temp
##########
Expand Down

0 comments on commit a111899

Please sign in to comment.