diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml
index 938e0e31..33add8b2 100644
--- a/cime_config/config_component.xml
+++ b/cime_config/config_component.xml
@@ -1389,14 +1389,6 @@
rof2lnd flux mapping file
-
- char
- idmap
- run_domain
- env_run.xml
- rof2ocn flux mapping file
-
-
char
idmap
@@ -1413,54 +1405,6 @@
rof2ocn runoff mapping file
-
- char
- idmap
- run_domain
- env_run.xml
- glc2ice runoff mapping file
-
-
-
- char
- idmap
- run_domain
- env_run.xml
- glc2ocn runoff mapping file for liquid runoff
-
-
-
- char
- idmap
- run_domain
- env_run.xml
- glc2ocn runoff mapping file for ice runoff
-
-
-
- char
- idmap
- run_domain
- env_run.xml
- ocn2wav state mapping file
-
-
-
- char
- idmap
- run_domain
- env_run.xml
- ice2wav state mapping file
-
-
-
- char
- idmap
- run_domain
- env_run.xml
- wav2ocn state mapping file
-
-
char
1.0e-02
diff --git a/cime_config/namelist_definition_drv.xml b/cime_config/namelist_definition_drv.xml
index 03dfcbe5..ce3ed5a1 100644
--- a/cime_config/namelist_definition_drv.xml
+++ b/cime_config/namelist_definition_drv.xml
@@ -2256,54 +2256,6 @@
-
- char
- mapping
- abs
- MED_attributes
-
- glc2ocn runoff mapping file for liquid runoff
-
-
- $GLC2OCN_LIQ_RMAPNAME
-
-
-
- char
- mapping
- abs
- MED_attributes
-
- glc to ice runoff conservative mapping file
-
-
- $GLC2ICE_RMAPNAME
-
-
-
- char
- mapping
- abs
- MED_attributes
-
- glc2ocn runoff mapping file for ice runoff
-
-
- $GLC2OCN_ICE_RMAPNAME
-
-
-
- char
- mapping
- abs
- MED_attributes
-
- runoff to ocn area overlap conservative mapping file
-
-
- $ROF2OCN_FMAPNAME
-
-
char
mapping
@@ -2328,42 +2280,6 @@
$ROF2OCN_ICE_RMAPNAME
-
- char
- mapping
- abs
- MED_attributes
-
- ocn to wav state mapping file for states
-
-
- $OCN2WAV_SMAPNAME
-
-
-
- char
- mapping
- abs
- MED_attributes
-
- ice to wav state mapping file for states
-
-
- $ICE2WAV_SMAPNAME
-
-
-
- char
- mapping
- abs
- MED_attributes
-
- wav to ocn state mapping file for states
-
-
- $WAV2OCN_SMAPNAME
-
-
diff --git a/mediator/esmFldsExchange_cesm_mod.F90 b/mediator/esmFldsExchange_cesm_mod.F90
index 47d0ae1a..86f513d7 100644
--- a/mediator/esmFldsExchange_cesm_mod.F90
+++ b/mediator/esmFldsExchange_cesm_mod.F90
@@ -5,10 +5,49 @@ module esmFldsExchange_cesm_mod
! fields exchanged between components and their associated routing,
! mapping and merging
!
- ! Merging arguments:
- ! mrg_fromN = source component index that for the field to be merged
- ! mrg_fldN = souce field name to be merged
- ! mrg_typeN = merge type ('copy', 'copy_with_weights', 'sum', 'sum_with_weights', 'merge')
+ ! -----------------------------------------------------------------------------------------
+ ! subroutine med_fldList_addmrg_to(index, fldname, mrg_from, mrg_fld, mrg_type, mrg_fracname, rc)
+ ! integer , intent(in) :: index
+ ! character(len=*), intent(in) :: fldname
+ ! integer , intent(in) :: mrg_from
+ ! character(len=*), intent(in) :: mrg_fld
+ ! character(len=*), intent(in) :: mrg_type
+ ! character(len=*), intent(in) , optional :: mrg_fracname
+ ! integer , intent(out), optional :: rc
+ !
+ ! index : destination component index that merging will occur to
+ ! fldname : field name in mediator export field bundle for destination component
+ ! mrg_from : source component index that will contribute to the merge
+ ! mrg_fld : field name fom source component field bundle that will be used in merge
+ ! mrg_type : one of ['copy', 'copy_with_weights', 'sum', 'sum_with_weights', 'merge']
+ ! mrg_fracname : if mrg_type is copy_with_weights or merge -
+ ! fraction name in fraction field bundle to use in merge
+ !
+ ! -----------------------------------------------------------------------------------------
+ ! subroutine med_fldList_addmap_from(index, fldname, destcomp, maptype, mapnorm, mapfile)
+ ! integer , intent(in) :: index
+ ! character(len=*) , intent(in) :: fldname
+ ! integer , intent(in) :: destcomp
+ ! integer , intent(in) :: maptype
+ ! character(len=*) , intent(in) :: mapnorm
+ ! character(len=*) , intent(in), optional :: mapfile
+ !
+ ! index : source component index that mapping will occur from
+ ! fldname : field name in mediator import field for source component
+ ! destcomp : destination component index
+ ! maptype : mapping type (see med_internal_state_mod.F90 for the supported mapping types)
+ ! if maptype is mapfcopy - create a redistribution route handle
+ ! mapnorm : normalization type, one of ['unset', 'one', 'none', fracname]
+ ! fracname - is the field name of the field in the fraction field bundle corresponding to the
+ ! source field that will be used for normalization
+ ! 'one' - implies that the mapped field is divided by mapping 'one' from the source to the
+ ! destination mesh
+ ! 'none' - do not use any normalization - use if maytype is not mapfcopy
+ ! 'unset' - do not use any normalization - only used if maptype is mapfcopy
+ ! mapfile : if mapfile is idmap - create a redistribution route nhandle
+ ! if mapfile is unset then create the mapping route handle at run time
+ !
+ ! -----------------------------------------------------------------------------------------
! NOTE:
! mrg_from(compmed) can either be for mediator computed fields for atm/ocn fluxes or for ocn albedos
!
@@ -28,26 +67,23 @@ module esmFldsExchange_cesm_mod
public :: esmFldsExchange_cesm
! currently required mapping files
- character(len=CX) :: glc2ice_rmap ='unset'
- character(len=CX) :: glc2ocn_liq_rmap ='unset'
- character(len=CX) :: glc2ocn_ice_rmap ='unset'
- character(len=CX) :: rof2ocn_fmap ='unset'
character(len=CX) :: rof2ocn_ice_rmap ='unset'
character(len=CX) :: rof2ocn_liq_rmap ='unset'
- character(len=CX) :: wav2ocn_smap ='unset'
- character(len=CX) :: ice2wav_smap ='unset'
- character(len=CX) :: ocn2wav_smap ='unset'
+ character(len=CX) :: rof2lnd_map = 'unset'
+ character(len=CX) :: lnd2rof_map = 'unset'
! no mapping files (value is 'idmap' or 'unset')
- character(len=CX) :: atm2ice_map='unset'
- character(len=CX) :: atm2ocn_map='unset'
- character(len=CX) :: atm2lnd_map='unset'
- character(len=CX) :: ice2atm_map='unset'
- character(len=CX) :: ocn2atm_map='unset'
- character(len=CX) :: lnd2atm_map='unset'
- character(len=CX) :: lnd2rof_map='unset'
- character(len=CX) :: rof2lnd_map='unset'
- character(len=CX) :: atm2wav_map='unset'
+ character(len=CX) :: atm2ice_map = 'unset'
+ character(len=CX) :: atm2ocn_map = 'unset'
+ character(len=CX) :: atm2lnd_map = 'unset'
+ character(len=CX) :: atm2wav_map = 'unset'
+ character(len=CX) :: ice2atm_map = 'unset'
+ character(len=CX) :: ice2wav_map = 'unset'
+ character(len=CX) :: lnd2atm_map = 'unset'
+ character(len=CX) :: ocn2atm_map = 'unset'
+ character(len=CX) :: ocn2wav_map = 'unset'
+ character(len=CX) :: rof2ocn_map = 'unset'
+ character(len=CX) :: wav2ocn_map = 'unset'
logical :: mapuv_with_cart3d ! Map U/V vector wind fields from ATM to OCN/ICE by rotating in Cartesian 3D space and then back
logical :: flds_i2o_per_cat ! Ice thickness category fields passed to OCN
@@ -76,12 +112,11 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
use med_internalstate_mod , only : compice, comprof, compwav, compglc, ncomps
use med_internalstate_mod , only : mapbilnr, mapconsf, mapconsd, mappatch, mappatch_uv3d, mapbilnr_nstod
use med_internalstate_mod , only : mapfcopy, mapnstod, mapnstod_consd, mapnstod_consf
- use med_internalstate_mod , only : map_glc2ocn_ice, map_glc2ocn_liq, map_rof2ocn_ice, map_rof2ocn_liq
+ use med_internalstate_mod , only : map_rof2ocn_ice, map_rof2ocn_liq
use esmFlds , only : addfld_ocnalb => med_fldList_addfld_ocnalb
use esmFlds , only : addfld_aoflux => med_fldList_addfld_aoflux
use esmFlds , only : addmap_aoflux => med_fldList_addmap_aoflux
use esmFlds , only : addmap_ocnalb => med_fldList_addmap_ocnalb
-
use esmFlds , only : addfld_to => med_fldList_addfld_to
use esmFlds , only : addfld_from => med_fldList_addfld_from
use esmFlds , only : addmap_from => med_fldList_addmap_from
@@ -95,7 +130,12 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
! local variables:
type(InternalState) :: is_local
integer :: n, ns
+ character(len=CL) :: atm_mesh_name
+ character(len=CL) :: lnd_mesh_name
+ character(len=CL) :: ice_mesh_name
+ character(len=CL) :: ocn_mesh_name
character(len=CL) :: cvalue
+ character(len=CS) :: mrgfld_source
logical :: wav_coupling_to_cice
logical :: ocn2glc_coupling
character(len=*) , parameter :: subname=' (esmFldsExchange_cesm) '
@@ -121,51 +161,37 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
if (phase == 'advertise') then
- ! mapping to atm
- call NUOPC_CompAttributeGet(gcomp, name='ice2atm_map', value=ice2atm_map, rc=rc)
- if (chkerr(rc,__LINE__,u_FILE_u)) return
- if (maintask) write(logunit, '(a)') trim(subname)//'ice2atm_map = '// trim(ice2atm_map)
- call NUOPC_CompAttributeGet(gcomp, name='lnd2atm_map', value=lnd2atm_map, rc=rc)
- if (chkerr(rc,__LINE__,u_FILE_u)) return
- if (maintask) write(logunit, '(a)') trim(subname)//'lnd2atm_map = '// trim(lnd2atm_map)
- call NUOPC_CompAttributeGet(gcomp, name='ocn2atm_map', value=ocn2atm_map, rc=rc)
- if (chkerr(rc,__LINE__,u_FILE_u)) return
- if (maintask) write(logunit, '(a)') trim(subname)//'ocn2atm_map = '// trim(ocn2atm_map)
+ ! determine if atm and lnd have the same mesh
+ call NUOPC_CompAttributeGet(gcomp, name='mesh_atm', value=atm_mesh_name, rc=rc)
+ if (ChkErr(rc,__LINE__,u_FILE_u)) return
+ call NUOPC_CompAttributeGet(gcomp, name='mesh_lnd', value=lnd_mesh_name, rc=rc)
+ if (ChkErr(rc,__LINE__,u_FILE_u)) return
+ call NUOPC_CompAttributeGet(gcomp, name='mesh_ice', value=ice_mesh_name, rc=rc)
+ if (ChkErr(rc,__LINE__,u_FILE_u)) return
+ call NUOPC_CompAttributeGet(gcomp, name='mesh_ocn', value=ocn_mesh_name, rc=rc)
+ if (ChkErr(rc,__LINE__,u_FILE_u)) return
+ if (trim(atm_mesh_name) == trim(lnd_mesh_name)) then
+ atm2lnd_map = 'idmap'
+ lnd2atm_map = 'idmap'
+ end if
+ if (trim(atm_mesh_name) == trim(ocn_mesh_name)) then
+ atm2ocn_map = 'idmap'
+ ocn2atm_map = 'idmap'
+ end if
+ if (trim(atm_mesh_name) == trim(ice_mesh_name)) then
+ atm2ice_map = 'idmap'
+ ice2atm_map = 'idmap'
+ end if
- ! mapping to lnd
- call NUOPC_CompAttributeGet(gcomp, name='atm2lnd_map', value=atm2lnd_map, rc=rc)
- if (chkerr(rc,__LINE__,u_FILE_u)) return
- if (maintask) write(logunit, '(a)') trim(subname)//'atm2lnd_map = '// trim(atm2lnd_map)
+ ! mapping rof=>lnd and lnd=>rof - the following two maps are needed for MIZUROUTE
call NUOPC_CompAttributeGet(gcomp, name='rof2lnd_map', value=rof2lnd_map, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (maintask) write(logunit, '(a)') trim(subname)//'rof2lnd_map = '// trim(rof2lnd_map)
-
- ! mapping to ice
- call NUOPC_CompAttributeGet(gcomp, name='atm2ice_map', value=atm2ice_map, rc=rc)
- if (chkerr(rc,__LINE__,u_FILE_u)) return
- if (maintask) write(logunit, '(a)') trim(subname)//'atm2ice_map = '// trim(atm2ice_map)
- call NUOPC_CompAttributeGet(gcomp, name='glc2ice_rmapname', value=glc2ice_rmap, rc=rc)
- if (chkerr(rc,__LINE__,u_FILE_u)) return
- if (maintask) write(logunit, '(a)') trim(subname)//'glc2ice_rmapname = '// trim(glc2ice_rmap)
-
- ! mapping to ocn
- call NUOPC_CompAttributeGet(gcomp, name='atm2ocn_map', value=atm2ocn_map, rc=rc)
- if (chkerr(rc,__LINE__,u_FILE_u)) return
- if (maintask) write(logunit, '(a)') trim(subname)//'atm2ocn_map = '// trim(atm2ocn_map)
- call NUOPC_CompAttributeGet(gcomp, name='glc2ocn_liq_rmapname', value=glc2ocn_liq_rmap, rc=rc)
- if (chkerr(rc,__LINE__,u_FILE_u)) return
- if (maintask) write(logunit, '(a)') trim(subname)//'glc2ocn_liq_rmapname = '// trim(glc2ocn_liq_rmap)
- call NUOPC_CompAttributeGet(gcomp, name='glc2ocn_ice_rmapname', value=glc2ocn_ice_rmap, rc=rc)
- if (chkerr(rc,__LINE__,u_FILE_u)) return
- if (maintask) write(logunit, '(a)') trim(subname)//'glc2ocn_ice_rmapname = '// trim(glc2ocn_ice_rmap)
- call NUOPC_CompAttributeGet(gcomp, name='wav2ocn_smapname', value=wav2ocn_smap, rc=rc)
- if (chkerr(rc,__LINE__,u_FILE_u)) return
- if (maintask) write(logunit, '(a)') trim(subname)//'wav2ocn_smapname = '// trim(wav2ocn_smap)
-
- call NUOPC_CompAttributeGet(gcomp, name='rof2ocn_fmapname', value=rof2ocn_fmap, rc=rc)
+ call NUOPC_CompAttributeGet(gcomp, name='lnd2rof_map', value=lnd2rof_map, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
- if (maintask) write(logunit, '(a)') trim(subname)//'rof2ocn_fmapname = '// trim(rof2ocn_fmap)
+ if (maintask) write(logunit, '(a)') trim(subname)//'lnd2rof_map = '// trim(lnd2rof_map)
+ ! mapping to rof => ocn with custom mapping
call NUOPC_CompAttributeGet(gcomp, name='rof2ocn_liq_rmapname', value=rof2ocn_liq_rmap, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (maintask) write(logunit, '(a)') trim(subname)//'rof2ocn_liq_rmapname = '// trim(rof2ocn_liq_rmap)
@@ -173,23 +199,6 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (maintask) write(logunit, '(a)') trim(subname)//'rof2ocn_ice_rmapname = '// trim(rof2ocn_ice_rmap)
- ! mapping to rof
- call NUOPC_CompAttributeGet(gcomp, name='lnd2rof_map', value=lnd2rof_map, rc=rc)
- if (chkerr(rc,__LINE__,u_FILE_u)) return
- if (maintask) write(logunit, '(a)') trim(subname)//'lnd2rof_map = '// trim(lnd2rof_map)
-
- ! mapping to wav
- call NUOPC_CompAttributeGet(gcomp, name='atm2wav_map', value=atm2wav_map, rc=rc)
- if (chkerr(rc,__LINE__,u_FILE_u)) return
- if (maintask) write(logunit,'(a)') trim(subname)//'atm2wav_map = '// trim(atm2wav_map)
-
- call NUOPC_CompAttributeGet(gcomp, name='ice2wav_smapname', value=ice2wav_smap, rc=rc)
- if (chkerr(rc,__LINE__,u_FILE_u)) return
- if (maintask) write(logunit,'(a)') trim(subname)//'ice2wav_smapname = '// trim(ice2wav_smap)
- call NUOPC_CompAttributeGet(gcomp, name='ocn2wav_smapname', value=ocn2wav_smap, rc=rc)
- if (chkerr(rc,__LINE__,u_FILE_u)) return
- if (maintask) write(logunit,'(a)') trim(subname)//'ocn2wav_smapname = '// trim(ocn2wav_smap)
-
! uv cart3d mapping
call NUOPC_CompAttributeGet(gcomp, name='mapuv_with_cart3d', value=cvalue, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
@@ -215,7 +224,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
call NUOPC_CompAttributeGet(gcomp, name='flds_wiso', value=cvalue, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
read(cvalue,*) flds_wiso
- ! are water isotope exchanges enabled?
+
call NUOPC_CompAttributeGet(gcomp, name='flds_r2l_stream_channel_depths', value=cvalue, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
read(cvalue,*) flds_r2l_stream_channel_depths
@@ -1568,7 +1577,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBImp(complnd, complnd), 'Fall_voc', rc=rc) .and. &
fldchk(is_local%wrap%FBExp(compatm) , 'Fall_voc', rc=rc)) then
- call addmap_from(complnd, 'Fall_voc', compatm, mapconsf, 'one', atm2lnd_map)
+ call addmap_from(complnd, 'Fall_voc', compatm, mapconsf, 'lfrin', lnd2atm_map)
call addmrg_to(compatm, 'Fall_voc', &
mrg_from=complnd, mrg_fld='Fall_voc', mrg_type='merge', mrg_fracname='lfrac')
end if
@@ -1583,7 +1592,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBImp(complnd, complnd), 'Fall_fire', rc=rc) .and. &
fldchk(is_local%wrap%FBExp(compatm) , 'Fall_fire', rc=rc)) then
- call addmap_from(complnd, 'Fall_fire', compatm, mapconsf, 'one', lnd2atm_map)
+ call addmap_from(complnd, 'Fall_fire', compatm, mapconsf, 'lfrin', lnd2atm_map)
call addmrg_to(compatm, 'Fall_fire', &
mrg_from=complnd, mrg_fld='Fall_fire', mrg_type='merge', mrg_fracname='lfrac')
end if
@@ -1595,7 +1604,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBImp(complnd, complnd), 'Sl_fztop', rc=rc) .and. &
fldchk(is_local%wrap%FBExp(compatm) , 'Sl_fztop', rc=rc)) then
- call addmap_from(complnd, 'Sl_fztop', compatm, mapconsf, 'one', lnd2atm_map)
+ call addmap_from(complnd, 'Sl_fztop', compatm, mapconsf, 'lfrin', lnd2atm_map)
call addmrg_to(compatm, 'Sl_fztop', mrg_from=complnd, mrg_fld='Sl_fztop', mrg_type='copy')
end if
end if
@@ -1608,11 +1617,28 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBImp(complnd, complnd), 'Sl_ddvel', rc=rc) .and. &
fldchk(is_local%wrap%FBExp(compatm) , 'Sl_ddvel', rc=rc)) then
- call addmap_from(complnd, 'Sl_ddvel', compatm, mapconsf, 'one', lnd2atm_map)
+ call addmap_from(complnd, 'Sl_ddvel', compatm, mapconsf, 'lfrin', lnd2atm_map)
call addmrg_to(compatm, 'Sl_ddvel', mrg_from=complnd, mrg_fld='Sl_ddvel', mrg_type='copy')
end if
end if
+ !-----------------------------------------------------------------------------
+ ! to atm: dms from ocean
+ !-----------------------------------------------------------------------------
+ if (phase == 'advertise') then
+ call addfld_from(compocn, 'Faoo_dms_ocn')
+ call addfld_to(compatm, 'Faoo_dms_ocn')
+ else
+ ! Note that Faoo_dmds should not be weighted by ifrac - since
+ ! it will be weighted by ifrac in the merge to the atm
+ if ( fldchk(is_local%wrap%FBImp(compocn,compocn), 'Faoo_dms_ocn', rc=rc) .and. &
+ fldchk(is_local%wrap%FBexp(compatm) , 'Faoo_dms_ocn', rc=rc)) then
+ call addmap_from(complnd, 'Faoo_dms_ocn', compocn, mapconsf, 'lfrac', ocn2atm_map)
+ call addmrg_to(compatm , 'Faoo_dms_ocn', &
+ mrg_from=compmed, mrg_fld='Faoo_dms_ocn', mrg_type='merge', mrg_fracname='ofrac')
+ end if
+ end if
+
!=====================================================================
! FIELDS TO OCEAN (compocn)
!=====================================================================
@@ -2187,134 +2213,94 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
end if
!-----------------------------
- ! to ocn: liquid runoff from rof and glc components
- ! to ocn: frozen runoff flux from rof and glc components
+ ! to ocn: liquid runoff from rof originating from lnd
+ ! to ocn: liquid runoff from rof originating from glc
+ ! to ocn: ice runoff from rof originating from lnd
+ ! to ocn: ice runoff from rof originating from glc
! to ocn: waterflux back to ocn due to flooding from rof
!-----------------------------
if (phase == 'advertise') then
! Note that Flrr_flood below needs to be added to
- ! fldlistFr(comprof) in order to be mapped correctly but the ocean
- ! does not receive it so it is advertised but it will! not be connected
- do ns = 1, is_local%wrap%num_icesheets
- call addfld_from(compglc(ns), 'Fogg_rofl')
- end do
+ ! fldlistFr(comprof) in order to be mapped correctly to the ocean but the ocean
+ ! does not receive it so it is advertised but it will not be connected
call addfld_from(comprof, 'Forr_rofl')
- call addfld_to(compocn, 'Foxx_rofl')
- call addfld_to(compocn, 'Flrr_flood')
- do ns = 1, is_local%wrap%num_icesheets
- call addfld_from(compglc(ns), 'Fogg_rofi')
- end do
call addfld_from(comprof, 'Forr_rofi')
+ call addfld_from(comprof, 'Forr_rofl_glc')
+ call addfld_from(comprof, 'Forr_rofi_glc')
+ call addfld_to(compocn, 'Foxx_rofl')
call addfld_to(compocn, 'Foxx_rofi')
+ call addfld_to(compocn, 'Forr_rofl_glc')
+ call addfld_to(compocn, 'Forr_rofi_glc')
+ call addfld_to(compocn, 'Flrr_flood')
else
- if ( fldchk(is_local%wrap%FBExp(compocn), 'Foxx_rofl' , rc=rc)) then
- ! liquid from river and possibly flood from river to ocean
- if (fldchk(is_local%wrap%FBImp(comprof, comprof), 'Forr_rofl' , rc=rc)) then
- if (trim(rof2ocn_liq_rmap) == 'unset') then
- call addmap_from(comprof, 'Forr_rofl', compocn, mapconsd, 'one', 'unset')
- else
- call addmap_from(comprof, 'Forr_rofl', compocn, map_rof2ocn_liq, 'none', rof2ocn_liq_rmap)
- end if
- if (fldchk(is_local%wrap%FBImp(comprof, comprof), 'Flrr_flood', rc=rc)) then
- call addmap_from(comprof, 'Flrr_flood', compocn, mapconsd, 'one', rof2ocn_fmap)
- call addmrg_to(compocn, 'Foxx_rofl', mrg_from=comprof, mrg_fld='Forr_rofl:Flrr_flood', mrg_type='sum')
- else
- call addmrg_to(compocn, 'Foxx_rofl', mrg_from=comprof, mrg_fld='Forr_rofl', mrg_type='sum')
- end if
+ ! Liquid runoff from land and glc - mapping
+ if (fldchk(is_local%wrap%FBImp(comprof, comprof), 'Forr_rofl' , rc=rc)) then
+ if ( fldchk(is_local%wrap%FBExp(compocn), 'Foxx_rofl' , rc=rc)) then
+ if (trim(rof2ocn_liq_rmap) == 'unset') then
+ call addmap_from(comprof, 'Forr_rofl', compocn, mapconsd, 'one', 'unset')
+ else
+ call addmap_from(comprof, 'Forr_rofl', compocn, map_rof2ocn_liq, 'none', rof2ocn_liq_rmap)
end if
- ! liquid from glc to ocean
- do ns = 1, is_local%wrap%num_icesheets
- if (fldchk(is_local%wrap%FBImp(compglc(ns), compglc(ns)), 'Fogg_rofl' , rc=rc)) then
- ! TODO: this custom map needs to be different for every ice sheet - how will this be handled?
- call addmap_from(compglc(ns), 'Fogg_rofl', compocn, map_glc2ocn_liq, 'one' , glc2ocn_liq_rmap)
- call addmrg_to(compocn, 'Foxx_rofl', mrg_from=compglc(ns), mrg_fld='Fogg_rofl', mrg_type='sum')
- end if
- end do
- end if
- if ( fldchk(is_local%wrap%FBExp(compocn), 'Foxx_rofi' , rc=rc)) then
- ! ice from river to ocean
- if (fldchk(is_local%wrap%FBImp(comprof, comprof), 'Forr_rofi' , rc=rc)) then
- if (trim(rof2ocn_ice_rmap) == 'unset') then
- call addmap_from(comprof, 'Forr_rofi', compocn, mapconsd, 'one', 'unset')
- else
- call addmap_from(comprof, 'Forr_rofi', compocn, map_rof2ocn_ice, 'none', rof2ocn_ice_rmap)
- end if
- call addmrg_to(compocn, 'Foxx_rofi', mrg_from=comprof, mrg_fld='Forr_rofi', mrg_type='sum')
+ end if
+ end if
+ if (fldchk(is_local%wrap%FBImp(comprof, comprof), 'Flrr_flood', rc=rc)) then
+ if ( fldchk(is_local%wrap%FBExp(compocn), 'Foxx_rofl' , rc=rc)) then
+ call addmap_from(comprof, 'Flrr_flood', compocn, mapconsd, 'one', rof2ocn_map)
+ end if
+ end if
+ if ( fldchk(is_local%wrap%FBImp(comprof, comprof), 'Forr_rofl_glc', rc=rc)) then
+ if (fldchk(is_local%wrap%FBExp(compocn), 'Forr_rofl_glc', rc=rc) .or. &
+ fldchk(is_local%wrap%FBExp(compocn), 'Foxx_rofl', rc=rc)) then
+ if (trim(rof2ocn_liq_rmap) == 'unset') then
+ call addmap_from(comprof, 'Forr_rofl_glc', compocn, mapconsd, 'one', 'unset')
+ else
+ call addmap_from(comprof, 'Forr_rofl_glc', compocn, map_rof2ocn_liq, 'none', rof2ocn_liq_rmap)
end if
- ! ice from glc to ocean
- do ns = 1, is_local%wrap%num_icesheets
- if (fldchk(is_local%wrap%FBImp(compglc(ns), compglc(ns)), 'Fogg_rofi' , rc=rc)) then
- ! TODO: this custom map needs to be different for every ice sheet - how will this be handled?
- call addmap_from(compglc(ns), 'Fogg_rofi', compocn, map_glc2ocn_ice, 'one', glc2ocn_ice_rmap)
- call addmrg_to(compocn, 'Foxx_rofi', mrg_from=compglc(ns), mrg_fld='Fogg_rofi', mrg_type='sum')
- end if
- end do
- end if
- end if
+ end if
+ end if
- if (flds_wiso) then
- if (phase == 'advertise') then
- do ns = 1, is_local%wrap%num_icesheets
- call addfld_from(compglc(ns), 'Fogg_rofl_wiso')
- end do
- call addfld_from(comprof, 'Forr_rofl_wiso')
- call addfld_to(compocn, 'Foxx_rofl_wiso')
- call addfld_to(compocn, 'Flrr_flood_wiso')
- do ns = 1, is_local%wrap%num_icesheets
- call addfld_from(compglc(ns), 'Fogg_rofi_wiso')
- end do
- call addfld_from(comprof, 'Forr_rofi_wiso')
- call addfld_to(compocn, 'Foxx_rofi_wiso')
- else
- if ( fldchk(is_local%wrap%FBExp(compocn), 'Foxx_rofl_wiso' , rc=rc)) then
- ! liquid from river and possibly flood from river to ocean
- if (fldchk(is_local%wrap%FBImp(comprof, comprof), 'Forr_rofl_wiso' , rc=rc)) then
- if (trim(rof2ocn_liq_rmap) == 'unset') then
- call addmap_from(comprof, 'Forr_rofl_wiso', compocn, mapconsd, 'none', 'unset')
- else
- call addmap_from(comprof, 'Forr_rofl_wiso', compocn, map_rof2ocn_liq, 'none', rof2ocn_liq_rmap)
- end if
- if (fldchk(is_local%wrap%FBImp(comprof, comprof), 'Flrr_flood_wiso', rc=rc)) then
- call addmap_from(comprof, 'Flrr_flood_wiso', compocn, mapconsd, 'one', rof2ocn_fmap)
- call addmrg_to(compocn, 'Foxx_rofl_wiso', &
- mrg_from=comprof, mrg_fld='Forr_rofl:Flrr_flood', mrg_type='sum')
- else
- call addmrg_to(compocn, 'Foxx_rofl_wiso', &
- mrg_from=comprof, mrg_fld='Forr_rofl', mrg_type='sum')
- end if
- end if
- ! liquid from glc to ocean
- do ns = 1, is_local%wrap%num_icesheets
- if (fldchk(is_local%wrap%FBImp(compglc(ns), compglc(ns)), 'Fogg_rofl_wiso' , rc=rc)) then
- ! TODO: this custom map needs to be different for every ice sheet - how will this be handled?
- call addmap_from(compglc(ns), 'Fogg_rofl_wiso', compocn, map_glc2ocn_liq, 'one' , glc2ocn_liq_rmap)
- call addmrg_to(compocn, 'Foxx_rofl_wiso', &
- mrg_from=compglc(ns), mrg_fld='Fogg_rofl_wiso', mrg_type='sum')
- end if
- end do
- end if
- if ( fldchk(is_local%wrap%FBExp(compocn), 'Foxx_rofi_wiso' , rc=rc)) then
- ! ice from river to ocean
- if (fldchk(is_local%wrap%FBImp(comprof, comprof), 'Forr_rofi_wiso' , rc=rc)) then
- if (trim(rof2ocn_ice_rmap) == 'unset') then
- call addmap_from(comprof, 'Forr_rofi_wiso', compocn, mapconsd, 'none', 'unset')
- else
- call addmap_from(comprof, 'Forr_rofi_wiso', compocn, map_rof2ocn_ice, 'none', rof2ocn_ice_rmap)
- end if
- call addmrg_to(compocn, 'Foxx_rofi_wiso', mrg_from=comprof, mrg_fld='Forr_rofi', mrg_type='sum')
- end if
- ! ice from glc to ocean
- do ns = 1, is_local%wrap%num_icesheets
- if (fldchk(is_local%wrap%FBImp(compglc(ns), compglc(ns)), 'Fogg_rofi_wiso' , rc=rc)) then
- ! TODO: this custom map needs to be different for every ice sheet - how will this be handled?
- call addmap_from(compglc(ns), 'Fogg_rofi_wiso', compocn, map_glc2ocn_ice, 'one', glc2ocn_ice_rmap)
- call addmrg_to(compocn, 'Foxx_rofi_wiso', &
- mrg_from=compglc(ns), mrg_fld='Fogg_rofi_wiso', mrg_type='sum')
- end if
- end do
+ ! Liquid runoff from land and glc - merging
+ if ( fldchk(is_local%wrap%FBExp(compocn), 'Foxx_rofl' , rc=rc)) then
+ mrgfld_source = 'Forr_rofl'
+ if (fldchk(is_local%wrap%FBImp(comprof, comprof), 'Flrr_flood', rc=rc)) then
+ mrgfld_source = trim(mrgfld_source) //':Flrr_flood'
+ end if
+ if (fldchk(is_local%wrap%FBImp(comprof, comprof), 'Forr_rofl_glc', rc=rc)) then
+ mrgfld_source = trim(mrgfld_source) //':Forr_rofl_glc'
+ end if
+ call addmrg_to(compocn, 'Foxx_rofl', mrg_from=comprof, mrg_fld=trim(mrgfld_source), mrg_type='sum')
+ end if
+
+ ! Frozen runoff from land and glc - mapping
+ if (fldchk(is_local%wrap%FBImp(comprof, comprof), 'Forr_rofi' , rc=rc)) then
+ if ( fldchk(is_local%wrap%FBExp(compocn), 'Foxx_rofi' , rc=rc)) then
+ if (trim(rof2ocn_ice_rmap) == 'unset') then
+ call addmap_from(comprof, 'Forr_rofi', compocn, mapconsd, 'one', 'unset')
+ else
+ call addmap_from(comprof, 'Forr_rofi', compocn, map_rof2ocn_ice, 'none', rof2ocn_ice_rmap)
end if
- end if
+ end if
+ end if
+ if ( fldchk(is_local%wrap%FBImp(comprof, comprof), 'Forr_rofi_glc', rc=rc)) then
+ if (fldchk(is_local%wrap%FBExp(compocn), 'Forr_rofi_glc', rc=rc) .or. &
+ fldchk(is_local%wrap%FBExp(compocn), 'Foxx_rofi', rc=rc)) then
+ if (trim(rof2ocn_ice_rmap) == 'unset') then
+ call addmap_from(comprof, 'Forr_rofi_glc', compocn, mapconsd, 'one', 'unset')
+ else
+ call addmap_from(comprof, 'Forr_rofi_glc', compocn, map_rof2ocn_ice, 'none', rof2ocn_ice_rmap)
+ end if
+ end if
+ end if
+
+ ! Frozen runoff from land and glc - merging
+ if ( fldchk(is_local%wrap%FBExp(compocn), 'Foxx_rofi' , rc=rc)) then
+ mrgfld_source = 'Forr_rofi'
+ if (fldchk(is_local%wrap%FBImp(comprof, comprof), 'Forr_rofi_glc', rc=rc)) then
+ mrgfld_source = trim(mrgfld_source) //':Forr_rofi_glc'
+ end if
+ call addmrg_to(compocn, 'Foxx_rofi', mrg_from=comprof, mrg_fld=trim(mrgfld_source), mrg_type='sum')
+ end if
end if
!-----------------------------
@@ -2350,7 +2336,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBExp(compocn) , 'Sw_lamult', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compwav, compwav), 'Sw_lamult', rc=rc)) then
- call addmap_from(compwav, 'Sw_lamult', compocn, mapbilnr_nstod, 'one', wav2ocn_smap)
+ call addmap_from(compwav, 'Sw_lamult', compocn, mapbilnr_nstod, 'one', wav2ocn_map)
call addmrg_to(compocn, 'Sw_lamult', mrg_from=compwav, mrg_fld='Sw_lamult', mrg_type='copy')
end if
end if
@@ -2363,7 +2349,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBExp(compocn) , 'Sw_ustokes', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compwav, compwav), 'Sw_ustokes', rc=rc)) then
- call addmap_from(compwav, 'Sw_ustokes', compocn, mapbilnr_nstod, 'one', wav2ocn_smap)
+ call addmap_from(compwav, 'Sw_ustokes', compocn, mapbilnr_nstod, 'one', wav2ocn_map)
call addmrg_to(compocn, 'Sw_ustokes', mrg_from=compwav, mrg_fld='Sw_ustokes', mrg_type='copy')
end if
end if
@@ -2376,7 +2362,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBExp(compocn) , 'Sw_vstokes', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compwav, compwav), 'Sw_vstokes', rc=rc)) then
- call addmap_from(compwav, 'Sw_vstokes', compocn, mapbilnr_nstod, 'one', wav2ocn_smap)
+ call addmap_from(compwav, 'Sw_vstokes', compocn, mapbilnr_nstod, 'one', wav2ocn_map)
call addmrg_to(compocn, 'Sw_vstokes', mrg_from=compwav, mrg_fld='Sw_vstokes', mrg_type='copy')
end if
end if
@@ -2389,7 +2375,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBExp(compocn) , 'Sw_hstokes', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compwav, compwav), 'Sw_hstokes', rc=rc)) then
- call addmap_from(compwav, 'Sw_hstokes', compocn, mapbilnr_nstod, 'one', wav2ocn_smap)
+ call addmap_from(compwav, 'Sw_hstokes', compocn, mapbilnr_nstod, 'one', wav2ocn_map)
call addmrg_to(compocn, 'Sw_hstokes', mrg_from=compwav, mrg_fld='Sw_hstokes', mrg_type='copy')
end if
end if
@@ -2402,7 +2388,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBExp(compocn) , 'Sw_pstokes_x', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compwav, compwav), 'Sw_pstokes_x', rc=rc)) then
- call addmap_from(compwav, 'Sw_pstokes_x', compocn, mapbilnr_nstod, 'one', wav2ocn_smap)
+ call addmap_from(compwav, 'Sw_pstokes_x', compocn, mapbilnr_nstod, 'one', wav2ocn_map)
call addmrg_to(compocn, 'Sw_pstokes_x', mrg_from=compwav, mrg_fld='Sw_pstokes_x', mrg_type='copy')
end if
end if
@@ -2415,7 +2401,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBExp(compocn) , 'Sw_pstokes_y', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compwav, compwav), 'Sw_pstokes_y', rc=rc)) then
- call addmap_from(compwav, 'Sw_pstokes_y', compocn, mapbilnr_nstod, 'one', wav2ocn_smap)
+ call addmap_from(compwav, 'Sw_pstokes_y', compocn, mapbilnr_nstod, 'one', wav2ocn_map)
call addmrg_to(compocn, 'Sw_pstokes_y', mrg_from=compwav, mrg_fld='Sw_pstokes_y', mrg_type='copy')
end if
end if
@@ -2858,54 +2844,6 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
end if
end if
- ! ---------------------------------------------------------------------
- ! to ice: frozen runoff from rof and glc
- ! ---------------------------------------------------------------------
- if (phase == 'advertise') then
- call addfld_from(comprof, 'Firr_rofi') ! water flux into sea ice due to runoff (frozen)
- do ns = 1, is_local%wrap%num_icesheets
- call addfld_from(compglc(ns), 'Figg_rofi') ! glc frozen runoff_iceberg flux to ice
- end do
- call addfld_to(compice, 'Fixx_rofi') ! total frozen water flux into sea ice
- else
- if ( fldchk(is_local%wrap%FBExp(compice), 'Fixx_rofi', rc=rc)) then
- if (fldchk(is_local%wrap%FBImp(comprof, comprof), 'Forr_rofi', rc=rc)) then
- call addmap_from(comprof, 'Forr_rofi', compice, mapconsf, 'none', rof2ocn_ice_rmap)
- call addmrg_to(compice, 'Fixx_rofi', mrg_from=comprof, mrg_fld='Firr_rofi', mrg_type='sum')
- end if
- do ns = 1, is_local%wrap%num_icesheets
- if (fldchk(is_local%wrap%FBImp(compglc(ns), compglc(ns)), 'Figg_rofi', rc=rc)) then
- call addmap_from(compglc(ns), 'Figg_rofi', compice, mapconsf, 'one' , glc2ice_rmap)
- call addmrg_to(compice, 'Fixx_rofi', mrg_from=compglc(ns), mrg_fld='Figg_rofi', mrg_type='sum')
- end if
- end do
- end if
- end if
- if (flds_wiso) then
- if (phase == 'advertise') then
- call addfld_from(comprof, 'Firr_rofi_wiso') ! water flux into sea ice due to runoff (frozen)
- do ns = 1, is_local%wrap%num_icesheets
- call addfld_from(compglc(ns), 'Figg_rofi_wiso') ! glc frozen runoff_iceberg flux to ice
- end do
- call addfld_to(compice, 'Fixx_rofi_wiso') ! total frozen water flux into sea ice
- else
- if ( fldchk(is_local%wrap%FBExp(compice), 'Fixx_rofi_wiso', rc=rc)) then
- if (fldchk(is_local%wrap%FBImp(comprof, comprof), 'Forr_rofi_wiso', rc=rc)) then
- call addmap_from(comprof, 'Forr_rofi_wiso', compice, mapconsf, 'none', rof2ocn_ice_rmap)
- call addmrg_to(compice, 'Fixx_rofi_wiso', &
- mrg_from=comprof, mrg_fld='Firr_rofi_wiso', mrg_type='sum')
- end if
- do ns = 1, is_local%wrap%num_icesheets
- if (fldchk(is_local%wrap%FBImp(compglc(ns), compglc(ns)), 'Figg_rofi_wiso', rc=rc)) then
- call addmap_from(compglc(ns), 'Figg_rofi_wiso', compice, mapconsf, 'one' , glc2ice_rmap)
- call addmrg_to(compice, 'Fixx_rofi_wiso', &
- mrg_from=compglc(ns), mrg_fld='Figg_rofi_wiso', mrg_type='sum')
- end if
- end do
- end if
- end if
- end if
-
! ---------------------------------------------------------------------
! to ice: wave elevation spectrum (field with ungridded dimensions)
! ---------------------------------------------------------------------
@@ -2937,7 +2875,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
if ( fldchk(is_local%wrap%FBexp(compwav) , 'Si_ifrac', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compice,compice ), 'Si_ifrac', rc=rc)) then
! By default will be using a custom map - but if one is not available, use a generated bilinear instead
- call addmap_from(compice, 'Si_ifrac', compwav, mapbilnr, 'one', ice2wav_smap)
+ call addmap_from(compice, 'Si_ifrac', compwav, mapbilnr, 'one', ice2wav_map)
call addmrg_to(compwav, 'Si_ifrac', mrg_from=compice, mrg_fld='Si_ifrac', mrg_type='copy')
end if
end if
@@ -2951,7 +2889,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if (fldchk(is_local%wrap%FBexp(compwav) , 'Si_thick', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compice,compice ), 'Si_thick', rc=rc)) then
- call addmap_from(compice, 'Si_thick', compwav, mapbilnr, 'one', ice2wav_smap)
+ call addmap_from(compice, 'Si_thick', compwav, mapbilnr, 'one', ice2wav_map)
call addmrg_to(compwav, 'Si_thick', mrg_from=compice, mrg_fld='Si_thick', mrg_type='copy')
end if
end if
@@ -2966,7 +2904,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if (fldchk(is_local%wrap%FBexp(compwav) , 'Si_floediam', rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compice,compice ), 'Si_floediam', rc=rc)) then
- call addmap_from(compice, 'Si_floediam', compwav, mapbilnr, 'one', ice2wav_smap)
+ call addmap_from(compice, 'Si_floediam', compwav, mapbilnr, 'one', ice2wav_map)
call addmrg_to(compwav, 'Si_floediam', mrg_from=compice, mrg_fld='Si_floediam', mrg_type='copy')
end if
end if
@@ -2980,8 +2918,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
else
if ( fldchk(is_local%wrap%FBImp(compocn, compocn), 'So_t', rc=rc) .and. &
fldchk(is_local%wrap%FBExp(compwav) , 'So_t', rc=rc)) then
- ! By default will be using a custom map - but if one is not available, use a generated bilinear instead
- call addmap_from(compocn, 'So_t', compwav, mapbilnr, 'one', ocn2wav_smap)
+ call addmap_from(compocn, 'So_t', compwav, mapbilnr, 'one', ocn2wav_map)
call addmrg_to(compwav, 'So_t', mrg_from=compocn, mrg_fld='So_t', mrg_type='copy')
end if
end if
@@ -2995,7 +2932,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
if ( fldchk(is_local%wrap%FBImp(compocn, compocn), 'So_u', rc=rc) .and. &
fldchk(is_local%wrap%FBExp(compwav) , 'So_u', rc=rc)) then
! By default will be using a custom map - but if one is not available, use a generated bilinear instead
- call addmap_from(compocn, 'So_u', compwav, mapbilnr, 'one', ocn2wav_smap)
+ call addmap_from(compocn, 'So_u', compwav, mapbilnr, 'one', ocn2wav_map)
call addmrg_to(compwav, 'So_u', mrg_from=compocn, mrg_fld='So_u', mrg_type='copy')
end if
end if
@@ -3006,7 +2943,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
if ( fldchk(is_local%wrap%FBImp(compocn, compocn), 'So_v', rc=rc) .and. &
fldchk(is_local%wrap%FBExp(compwav) , 'So_v', rc=rc)) then
! By default will be using a custom map - but if one is not available, use a generated bilinear instead
- call addmap_from(compocn, 'So_v', compwav, mapbilnr, 'one', ocn2wav_smap)
+ call addmap_from(compocn, 'So_v', compwav, mapbilnr, 'one', ocn2wav_map)
call addmrg_to(compwav, 'So_v', mrg_from=compocn, mrg_fld='So_v', mrg_type='copy')
end if
end if
@@ -3021,7 +2958,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
if ( fldchk(is_local%wrap%FBImp(compocn, compocn), 'So_bldepth', rc=rc) .and. &
fldchk(is_local%wrap%FBExp(compwav) , 'So_bldepth', rc=rc)) then
! By default will be using a custom map - but if one is not available, use a generated bilinear instead
- call addmap_from(compocn, 'So_bldepth', compwav, mapbilnr, 'one', ocn2wav_smap)
+ call addmap_from(compocn, 'So_bldepth', compwav, mapbilnr, 'one', ocn2wav_map)
call addmrg_to(compwav, 'So_bldepth', mrg_from=compocn, mrg_fld='So_bldepth', mrg_type='copy')
end if
end if
@@ -3090,6 +3027,51 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
! FIELDS TO RIVER (comprof)
!=====================================================================
+ ! ---------------------------------------------------------------------
+ ! to rof: liquid and ice from glc
+ ! ---------------------------------------------------------------------
+ do ns = 1, is_local%wrap%num_icesheets
+ if (phase == 'advertise') then
+ call addfld_from(compglc(ns), 'Fgrg_rofl')
+ call addfld_from(compglc(ns), 'Fgrg_rofi')
+ call addfld_to(comprof, 'Fgrg_rofl')
+ call addfld_to(comprof, 'Fgrg_rofi')
+ else
+ ! Note: we are assuming that the rof mesh has a mask of one everywhere
+ if ( fldchk(is_local%wrap%FBImp(compglc(ns), compglc(ns)), 'Fgrg_rofl', rc=rc) .and. &
+ fldchk(is_local%wrap%FBExp(comprof) , 'Fgrg_rofl', rc=rc)) then
+ call addmap_from(compglc(ns), 'Fgrg_rofl', comprof, mapconsd, 'gfrac' , 'unset')
+ ! Custom merge in med_phases_prep_rof
+ end if
+ if (fldchk(is_local%wrap%FBImp(compglc(ns), compglc(ns)), 'Fgrg_rofi', rc=rc) .and. &
+ fldchk(is_local%wrap%FBExp(comprof) , 'Fgrg_rofi', rc=rc)) then
+ call addmap_from(compglc(ns), 'Fgrg_rofi', comprof, mapconsd, 'gfrac', 'unset')
+ ! Custom merge in med_phases_prep_rof
+ end if
+ end if
+ end do
+
+ ! ---------------------------------------------------------------------
+ ! to rof: liquid and ice from glc water isoptopes
+ ! ---------------------------------------------------------------------
+ do ns = 1, is_local%wrap%num_icesheets
+ if (phase == 'advertise') then
+ call addfld_from(compglc(ns), 'Fgrg_rofl_wiso')
+ call addfld_from(compglc(ns), 'Fgrg_rofi_wiso')
+ call addfld_to(comprof, 'Fgrg_rofl_wiso')
+ call addfld_to(comprof, 'Fgrg_rofi_wiso')
+ else
+ if (fldchk(is_local%wrap%FBImp(compglc(ns), compglc(ns)), 'Fgrg_rofl_wiso' , rc=rc)) then
+ call addmap_from(compglc(ns), 'Fgrg_rofl_wiso', comprof, mapconsd, 'one' , 'unset')
+ ! TODO: implement custom merge
+ end if
+ if (fldchk(is_local%wrap%FBImp(compglc(ns), compglc(ns)), 'Fgrg_rofi_wiso' , rc=rc)) then
+ call addmap_from(compglc(ns), 'Fgrg_rofi_wiso', comprof, mapconsd, 'one', 'unset')
+ ! TODO: implement custom merge
+ end if
+ end if
+ end do
+
! ---------------------------------------------------------------------
! to rof: water flux from land (liquid surface)
! ---------------------------------------------------------------------
@@ -3206,7 +3188,7 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
!-----------------------------
! to glc: from ocn
!-----------------------------
- if (ocn2glc_coupling) then
+ if (is_local%wrap%ocn2glc_coupling) then
if (phase == 'advertise') then
call addfld_from(compocn, 'So_t_depth')
call addfld_from(compocn, 'So_s_depth')
@@ -3380,25 +3362,6 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
end if
endif
- !=====================================================================
- ! DMS EXCHANGE
- !=====================================================================
-
- ! Get dms flux from ocn and send to atm
- if (phase == 'advertise') then
- call addfld_from(compocn, 'Faoo_dms_ocn')
- call addfld_to(compatm, 'Faoo_dms_ocn')
- else
- ! Note that Faoo_dmds should not be weighted by ifrac - since
- ! it will be weighted by ifrac in the merge to the atm
- if ( fldchk(is_local%wrap%FBImp(compocn,compocn), 'Faoo_dms_ocn', rc=rc) .and. &
- fldchk(is_local%wrap%FBexp(compatm) , 'Faoo_dms_ocn', rc=rc)) then
- call addmap_from(complnd, 'Faoo_dms_ocn', compocn, mapconsf, 'lfrac', ocn2atm_map)
- call addmrg_to(compatm , 'Faoo_dms_ocn', &
- mrg_from=compmed, mrg_fld='Faoo_dms_ocn', mrg_type='merge', mrg_fracname='ofrac')
- end if
- end if
-
end subroutine esmFldsExchange_cesm
end module esmFldsExchange_cesm_mod
diff --git a/mediator/fd_cesm.yaml b/mediator/fd_cesm.yaml
index 88b4a515..50200efa 100644
--- a/mediator/fd_cesm.yaml
+++ b/mediator/fd_cesm.yaml
@@ -585,6 +585,22 @@
# Note that the fields sent from glc->med do NOT have elevation classes,
# but the fields from med->lnd are broken into multiple elevation classes
#
+ - standard_name: Fgrg_rofi
+ canonical_units: kg m-2 s-1
+ description: glc import tomed - glacier frozen_runoff_flux_to_ocean
+ #
+ - standard_name: Fgrg_rofi_wiso
+ canonical_units: kg m-2 s-1
+ description: glc import to med - glacier_frozen_runoff_flux_to_ocean for 16O, 18O, HDO
+ #
+ - standard_name: Fgrg_rofl
+ canonical_units: kg m-2 s-1
+ description: glc import to med - glacier liquid runoff flux to ocean
+ #
+ - standard_name: Fgrg_rofl_wiso
+ canonical_units: kg m-2 s-1
+ description: glc import to med - glacier_frozen_runoff_flux_to_ocean for 16O, 18O, HDO
+ #
- standard_name: Figg_rofi
canonical_units: kg m-2 s-1
description: glc import to med - glc frozen runoff_iceberg flux to ice
@@ -635,22 +651,6 @@
canonical_units: m
description: glc export from med (elevation classes 1->glc_nec)
#
- - standard_name: Fogg_rofi
- canonical_units: kg m-2 s-1
- description: glc export from med - glacier_frozen_runoff_flux_to_ocean
- #
- - standard_name: Fogg_rofi_wiso
- canonical_units: kg m-2 s-1
- description: glc export from med - glacier_frozen_runoff_flux_to_ocean for 16O, 18O, HDO
- #
- - standard_name: Fogg_rofl
- canonical_units: kg m-2 s-1
- description: glc export from med - glacier liquid runoff flux to ocean
- #
- - standard_name: Fogg_rofl_wiso
- canonical_units: kg m-2 s-1
- description: glc export from med - glacier_frozen_runoff_flux_to_ocean for 16O, 18O, HDO
- #
#-----------------------------------
# section: ice import to med
#-----------------------------------
@@ -1172,6 +1172,10 @@
canonical_units: kg m-2 s-1
description: river export to ocean - water flux due to runoff (frozen)
#
+ - standard_name: Forr_rofi_glc
+ canonical_units: kg m-2 s-1
+ description: river export to ocean - water flux due to runoff originating from glc (frozen)
+ #
- standard_name: Forr_rofi_wiso
canonical_units: kg m-2 s-1
description: river import to med - water flux due to runoff (frozen) for 16O, 18O, HDO
@@ -1180,29 +1184,13 @@
canonical_units: kg m-2 s-1
description: river import to med - water flux due to runoff (liquid)
#
- - standard_name: Forr_rofl_wiso
- canonical_units: kg m-2 s-1
- description: river import to med - water flux due to runoff (frozen) for 16O, 18O, HDO
- #
- - standard_name: Firr_rofi
- canonical_units: kg m-2 s-1
- description: river export - water flux into sea ice due to runoff (frozen)
- #
- - standard_name: Firr_rofi_wiso
+ - standard_name: Forr_rofl_glc
canonical_units: kg m-2 s-1
- description: river export - water flux into sea ice due to runoff (frozen) for 16O, 18O, HDO
+ description: river import to med - water flux due to runoff originating from glc (liquid)
#
- #-----------------------------------
- # section: river export from med (computed in med)
- #-----------------------------------
- #
- - standard_name: Fixx_rofi
- canonical_units: kg m-2 s-1
- description: frozen runoff to ice from river and lnd-ice
- #
- - standard_name: Fixx_rofi_wiso
+ - standard_name: Forr_rofl_wiso
canonical_units: kg m-2 s-1
- description: frozen runoff to ice from river and lnd-ice for 16O, 18O, HDO
+ description: river import to med - water flux due to runoff (frozen) for 16O, 18O, HDO
#
#-----------------------------------
# section: wav import to med
diff --git a/mediator/med_diag_mod.F90 b/mediator/med_diag_mod.F90
index 8ea6651e..b527dc27 100644
--- a/mediator/med_diag_mod.F90
+++ b/mediator/med_diag_mod.F90
@@ -1197,8 +1197,15 @@ subroutine med_phases_diag_rof( gcomp, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call diag_rof(is_local%wrap%FBImp(comprof,comprof), 'Forr_rofi' , f_watr_ioff, ic, areas, budget_local, minus=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
- call diag_rof(is_local%wrap%FBImp(comprof,comprof), 'Firr_rofi' , f_watr_ioff, ic, areas, budget_local, minus=.true., rc=rc)
- if (ChkErr(rc,__LINE__,u_FILE_u)) return
+
+ if ( fldbun_fldchk(is_local%wrap%FBImp(comprof,comprof), 'Forr_rofl_glc', rc=rc)) then
+ call diag_rof(is_local%wrap%FBImp(comprof,comprof), 'Forr_rofi_glc' , f_watr_roff, ic, areas, budget_local, minus=.true., rc=rc)
+ if (ChkErr(rc,__LINE__,u_FILE_u)) return
+ end if
+ if ( fldbun_fldchk(is_local%wrap%FBImp(comprof,comprof), 'Forr_rofi_glc', rc=rc)) then
+ call diag_rof(is_local%wrap%FBImp(comprof,comprof), 'Forr_rofi_glc' , f_watr_ioff, ic, areas, budget_local, minus=.true., rc=rc)
+ if (ChkErr(rc,__LINE__,u_FILE_u)) return
+ end if
if (flds_wiso) then
call diag_rof_wiso(is_local%wrap%FBExp(comprof), 'Forr_flood_wiso', &
@@ -1231,6 +1238,14 @@ subroutine med_phases_diag_rof( gcomp, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call diag_rof(is_local%wrap%FBExp(comprof), 'Flrl_rofi' , f_watr_ioff, ic, areas, budget_local, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
+ if (fldbun_fldchk(is_local%wrap%FBExp(comprof), 'Fgrg_rofl', rc=rc)) then
+ call diag_rof(is_local%wrap%FBExp(comprof), 'Fgrg_rofl' , f_watr_roff, ic, areas, budget_local, rc=rc)
+ if (ChkErr(rc,__LINE__,u_FILE_u)) return
+ end if
+ if (fldbun_fldchk(is_local%wrap%FBExp(comprof), 'Fgrg_rofi', rc=rc)) then
+ call diag_rof(is_local%wrap%FBExp(comprof), 'Fgrg_rofi' , f_watr_ioff, ic, areas, budget_local, rc=rc)
+ if (ChkErr(rc,__LINE__,u_FILE_u)) return
+ end if
if (flds_wiso) then
call diag_rof_wiso(is_local%wrap%FBExp(comprof), 'Flrl_rofl_wiso', &
@@ -1352,9 +1367,9 @@ subroutine med_phases_diag_glc( gcomp, rc)
do ns = 1,is_local%wrap%num_icesheets
areas => is_local%wrap%mesh_info(compglc(ns))%areas
- call diag_glc(is_local%wrap%FBImp(compglc(ns),compglc(ns)), 'Fogg_rofl', f_watr_roff, ic, areas, budget_local, minus=.true., rc=rc)
+ call diag_glc(is_local%wrap%FBImp(compglc(ns),compglc(ns)), 'Fgrg_rofl', f_watr_roff, ic, areas, budget_local, minus=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
- call diag_glc(is_local%wrap%FBImp(compglc(ns),compglc(ns)), 'Fogg_rofi', f_watr_ioff, ic, areas, budget_local, minus=.true., rc=rc)
+ call diag_glc(is_local%wrap%FBImp(compglc(ns),compglc(ns)), 'Fgrg_rofi', f_watr_ioff, ic, areas, budget_local, minus=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call diag_glc(is_local%wrap%FBImp(compglc(ns),compglc(ns)), 'Figg_rofi', f_watr_ioff, ic, areas, budget_local, minus=.true., rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
@@ -1533,11 +1548,21 @@ subroutine med_phases_diag_ocn( gcomp, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call diag_ocn(is_local%wrap%FBExp(compocn), 'Faxa_snow' , f_watr_snow , ic, areas, sfrac, budget_local, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
+
call diag_ocn(is_local%wrap%FBExp(compocn), 'Foxx_rofl' , f_watr_roff , ic, areas, sfrac, budget_local, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call diag_ocn(is_local%wrap%FBExp(compocn), 'Foxx_rofi' , f_watr_ioff , ic, areas, sfrac, budget_local, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
+ if ( fldbun_fldchk(is_local%wrap%FBExp(compocn), 'Forr_rofl_glc' , rc=rc)) then
+ call diag_ocn(is_local%wrap%FBExp(compocn), 'Forr_rofl_glc' , f_watr_roff , ic, areas, sfrac, budget_local, rc=rc)
+ if (ChkErr(rc,__LINE__,u_FILE_u)) return
+ end if
+ if ( fldbun_fldchk(is_local%wrap%FBExp(compocn), 'Forr_rofi_glc' , rc=rc)) then
+ call diag_ocn(is_local%wrap%FBExp(compocn), 'Forr_rofi_glc' , f_watr_ioff , ic, areas, sfrac, budget_local, rc=rc)
+ if (ChkErr(rc,__LINE__,u_FILE_u)) return
+ end if
+
if (flds_wiso) then
call diag_ocn_wiso(is_local%wrap%FBMed_aoflux_o, 'Faox_evap_wiso', &
f_watr_evap_16O, f_watr_evap_18O, f_watr_evap_HDO, ic, areas, ofrac, budget_local, rc=rc)
@@ -1893,8 +1918,6 @@ subroutine med_phases_diag_ice_med2ice( gcomp, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call diag_ice_send(is_local%wrap%FBExp(compice), 'Faxa_snow', f_watr_snow, areas, lats, ifrac, budget_local, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
- call diag_ice_send(is_local%wrap%FBExp(compice), 'Fixx_rofi', f_watr_ioff, areas, lats, ifrac, budget_local, rc=rc)
- if (ChkErr(rc,__LINE__,u_FILE_u)) return
if ( fldbun_fldchk(is_local%wrap%FBExp(compice), 'Fioo_q', rc=rc)) then
call fldbun_getdata1d(is_local%wrap%FBExp(compice), 'Fioo_q', data, rc=rc)
@@ -1913,14 +1936,12 @@ subroutine med_phases_diag_ice_med2ice( gcomp, rc)
ic = c_inh_send
budget_local(f_heat_latf,ic,ip) = -budget_local(f_watr_snow,ic,ip)*shr_const_latice
- budget_local(f_heat_ioff,ic,ip) = -budget_local(f_watr_ioff,ic,ip)*shr_const_latice
if (trim(budget_table_version) == 'v0') then
budget_local(f_watr_frz ,ic,ip) = budget_local(f_heat_frz ,ic,ip)*HFLXtoWFLX
end if
ic = c_ish_send
budget_local(f_heat_latf,ic,ip) = -budget_local(f_watr_snow,ic,ip)*shr_const_latice
- budget_local(f_heat_ioff,ic,ip) = -budget_local(f_watr_ioff,ic,ip)*shr_const_latice
if (trim(budget_table_version) == 'v0') then
budget_local(f_watr_frz ,ic,ip) = budget_local(f_heat_frz ,ic,ip)*HFLXtoWFLX
end if
diff --git a/mediator/med_internalstate_mod.F90 b/mediator/med_internalstate_mod.F90
index fb35645d..21b480a4 100644
--- a/mediator/med_internalstate_mod.F90
+++ b/mediator/med_internalstate_mod.F90
@@ -451,9 +451,6 @@ subroutine med_internalstate_coupling(gcomp, rc)
med_coupling_allowed(compice,compocn) = .true.
med_coupling_allowed(comprof,compocn) = .true.
med_coupling_allowed(compwav,compocn) = .true.
- do ns = 1,is_local%wrap%num_icesheets
- med_coupling_allowed(compglc(ns),compocn) = .true.
- end do
! to ice
med_coupling_allowed(compatm,compice) = .true.
@@ -466,6 +463,9 @@ subroutine med_internalstate_coupling(gcomp, rc)
! to river
med_coupling_allowed(complnd,comprof) = .true.
+ do ns = 1,is_local%wrap%num_icesheets
+ med_coupling_allowed(compglc(ns),comprof) = .true.
+ end do
! to wave
med_coupling_allowed(compatm,compwav) = .true.
diff --git a/mediator/med_phases_post_glc_mod.F90 b/mediator/med_phases_post_glc_mod.F90
index ac32ae8b..959f2873 100644
--- a/mediator/med_phases_post_glc_mod.F90
+++ b/mediator/med_phases_post_glc_mod.F90
@@ -68,7 +68,7 @@ module med_phases_post_glc_mod
logical :: cism_evolve = .false.
logical :: glc2lnd_coupling = .false.
- logical :: glc2ocn_coupling = .false.
+ logical :: glc2rof_coupling = .false.
logical :: glc2ice_coupling = .false.
character(*) , parameter :: u_FILE_u = &
@@ -120,8 +120,8 @@ subroutine med_phases_post_glc(gcomp, rc)
end do
! determine if there will be any glc to ocn coupling
do ns = 1,is_local%wrap%num_icesheets
- if (is_local%wrap%med_coupling_active(compglc(ns),compocn)) then
- glc2ocn_coupling = .true.
+ if (is_local%wrap%med_coupling_active(compglc(ns),comprof)) then
+ glc2rof_coupling = .true.
exit
end if
end do
@@ -134,7 +134,7 @@ subroutine med_phases_post_glc(gcomp, rc)
end do
if (maintask) then
write(logunit,'(a,L1)') trim(subname) // 'glc2lnd_coupling is ',glc2lnd_coupling
- write(logunit,'(a,L1)') trim(subname) // 'glc2ocn_coupling is ',glc2ocn_coupling
+ write(logunit,'(a,L1)') trim(subname) // 'glc2rof_coupling is ',glc2rof_coupling
write(logunit,'(a,L1)') trim(subname) // 'glc2ice_coupling is ',glc2ice_coupling
end if
@@ -152,19 +152,19 @@ subroutine med_phases_post_glc(gcomp, rc)
end if
!---------------------------------------
- ! glc->ocn mapping
- ! merging with rof->ocn fields is done in med_phases_prep_ocn
+ ! glc->rof mapping
!---------------------------------------
- if (glc2ocn_coupling) then
+
+ if (glc2rof_coupling) then
do ns = 1,is_local%wrap%num_icesheets
- if (is_local%wrap%med_coupling_active(compglc(ns),compocn)) then
+ if (is_local%wrap%med_coupling_active(compglc(ns),comprof)) then
call med_map_field_packed( &
FBSrc=is_local%wrap%FBImp(compglc(ns),compglc(ns)), &
- FBDst=is_local%wrap%FBImp(compglc(ns),compocn), &
+ FBDst=is_local%wrap%FBImp(compglc(ns),comprof), &
FBFracSrc=is_local%wrap%FBFrac(compglc(ns)), &
- field_normOne=is_local%wrap%field_normOne(compglc(ns),compocn,:), &
- packed_data=is_local%wrap%packed_data(compglc(ns),compocn,:), &
- routehandles=is_local%wrap%RH(compglc(ns),compocn,:), rc=rc)
+ field_normOne=is_local%wrap%field_normOne(compglc(ns),comprof,:), &
+ packed_data=is_local%wrap%packed_data(compglc(ns),comprof,:), &
+ routehandles=is_local%wrap%RH(compglc(ns),comprof,:), rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if
end do
diff --git a/mediator/med_phases_prep_rof_mod.F90 b/mediator/med_phases_prep_rof_mod.F90
index 55b2dae8..f0ec87c3 100644
--- a/mediator/med_phases_prep_rof_mod.F90
+++ b/mediator/med_phases_prep_rof_mod.F90
@@ -12,7 +12,7 @@ module med_phases_prep_rof_mod
use med_kind_mod , only : CX=>SHR_KIND_CX, CS=>SHR_KIND_CS, CL=>SHR_KIND_CL, R8=>SHR_KIND_R8
use ESMF , only : ESMF_FieldBundle, ESMF_Field
- use med_internalstate_mod , only : complnd, comprof, mapconsf, mapconsd, mapfcopy
+ use med_internalstate_mod , only : complnd, compglc, comprof, mapconsf, mapfcopy
use med_internalstate_mod , only : InternalState, maintask, logunit
use med_constants_mod , only : dbug_flag => med_constants_dbug_flag
use med_constants_mod , only : czero => med_constants_czero
@@ -23,6 +23,7 @@ module med_phases_prep_rof_mod
use med_methods_mod , only : fldbun_reset => med_methods_FB_reset
use med_methods_mod , only : fldbun_average => med_methods_FB_average
use med_methods_mod , only : field_getdata1d => med_methods_Field_getdata1d
+ use med_methods_mod , only : fldbun_fldchk => med_methods_FB_fldchk
use med_methods_mod , only : FB_check_for_nans => med_methods_FB_check_for_nans
use perf_mod , only : t_startf, t_stopf
@@ -61,6 +62,8 @@ module med_phases_prep_rof_mod
type(ESMF_FieldBundle), public :: FBlndAccum2rof_l
type(ESMF_FieldBundle), public :: FBlndAccum2rof_r
+ character(len=9) :: fldnames_fr_glc(2) = (/'Fgrg_rofl', 'Fgrg_rofi'/)
+
character(*) , parameter :: u_FILE_u = &
__FILE__
@@ -276,11 +279,11 @@ subroutine med_phases_prep_rof(gcomp, rc)
! local variables
type(InternalState) :: is_local
- integer :: n
+ integer :: n,ns,nf
integer :: count
logical :: exists
- real(r8), pointer :: dataptr(:)
- real(r8), pointer :: dataptr1d(:)
+ real(r8), pointer :: dataptr_in(:)
+ real(r8), pointer :: dataptr_out(:)
type(ESMF_Field) :: lfield
type(med_fldList_type), pointer :: fldList
character(len=*),parameter :: subname='(med_phases_prep_rof_mod: med_phases_prep_rof)'
@@ -319,12 +322,12 @@ subroutine med_phases_prep_rof(gcomp, rc)
if (exists) then
call ESMF_FieldBundleGet(FBlndAccum2rof_l, fieldName=trim(lnd2rof_flds(n)), field=lfield, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
- call field_getdata1d(lfield, dataptr1d, rc=rc)
+ call field_getdata1d(lfield, dataptr_out, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (count == 0) then
- dataptr1d(:) = czero
+ dataptr_out(:) = czero
else
- dataptr1d(:) = dataptr1d(:) / real(count, r8)
+ dataptr_out(:) = dataptr_out(:) / real(count, r8)
end if
end if
end do
@@ -359,12 +362,12 @@ subroutine med_phases_prep_rof(gcomp, rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
else
! This will ensure that no irrig is sent from the land
- call fldbun_getdata1d(FBlndAccum2rof_r, irrig_flux_field, dataptr, rc)
- dataptr(:) = czero
+ call fldbun_getdata1d(FBlndAccum2rof_r, irrig_flux_field, dataptr_out, rc)
+ dataptr_out(:) = czero
end if
!---------------------------------------
- ! auto merges to create FBExp(comprof) - assumes that all data is coming from FBlndAccum2rof_r
+ ! create FBExp(comprof)
!---------------------------------------
if (dbug_flag > 1) then
@@ -373,10 +376,35 @@ subroutine med_phases_prep_rof(gcomp, rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
end if
+ ! data coming from FBlndAccum2rof_r
call med_merge_auto(compsrc=complnd, FBout=is_local%wrap%FBExp(comprof), &
FBfrac=is_local%wrap%FBFrac(comprof), FBin=FBlndAccum2rof_r, fldListTo=fldList, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
+ ! custom merge for glc->rof
+ ! glc->rof is mapped in med_phases_post_glc
+ do ns = 1,is_local%wrap%num_icesheets
+ if (is_local%wrap%med_coupling_active(compglc(ns),comprof)) then
+ do nf = 1,size(fldnames_fr_glc)
+ if ( fldbun_fldchk(is_local%wrap%FBImp(compglc(ns),comprof), fldnames_fr_glc(nf), rc=rc) .and. &
+ fldbun_fldchk(is_local%wrap%FBExp(comprof), fldnames_fr_glc(nf), rc=rc) ) then
+ call fldbun_getdata1d(is_local%wrap%FBImp(compglc(ns),comprof), &
+ trim(fldnames_fr_glc(nf)), dataptr_in, rc)
+ if (chkerr(rc,__LINE__,u_FILE_u)) return
+ call fldbun_getdata1d(is_local%wrap%FBExp(comprof), &
+ trim(fldnames_fr_glc(nf)), dataptr_out , rc)
+ if (chkerr(rc,__LINE__,u_FILE_u)) return
+ ! Determine export data
+ if (ns == 1) then
+ dataptr_out(:) = dataptr_in(:)
+ else
+ dataptr_out(:) = dataptr_out(:) + dataptr_in(:)
+ end if
+ end if
+ end do
+ end if
+ end do
+
! Check for nans in fields export to rof
call FB_check_for_nans(is_local%wrap%FBExp(comprof), maintask, logunit, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
@@ -402,9 +430,9 @@ subroutine med_phases_prep_rof(gcomp, rc)
if (exists) then
call ESMF_FieldBundleGet(FBlndAccum2rof_l, fieldName=trim(lnd2rof_flds(n)), field=lfield, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
- call field_getdata1d(lfield, dataptr1d, rc=rc)
+ call field_getdata1d(lfield, dataptr_out, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
- dataptr1d(:) = czero
+ dataptr_out(:) = czero
end if
end do