Skip to content

Commit

Permalink
Only send new coupling fields in polar configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
darincomeau committed Feb 22, 2024
1 parent 1996751 commit 9ed1b01
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 58 deletions.
1 change: 0 additions & 1 deletion components/mpas-ocean/driver/ocn_comp_mct.F
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,6 @@ end subroutine xml_stream_get_attributes
if ( ierr /= 0 ) then
write(ocnLogUnit,*) 'Fail to set define dom fields '
endif

ent_type = 1 ! cells


Expand Down
1 change: 1 addition & 0 deletions driver-mct/cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
config['CPL_ALBAV'] = case.get_value('CPL_ALBAV')
config['CPL_EPBAL'] = case.get_value('CPL_EPBAL')
config['FLDS_WISO'] = case.get_value('FLDS_WISO')
config['FLDS_POLAR'] = case.get_value('FLDS_POLAR')
config['BUDGETS'] = case.get_value('BUDGETS')
config['MACH'] = case.get_value('MACH')
config['MPILIB'] = case.get_value('MPILIB')
Expand Down
12 changes: 12 additions & 0 deletions driver-mct/cime_config/config_component_e3sm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,18 @@
<desc>Turn on the passing of water isotope fields through the coupler</desc>
</entry>

<entry id="FLDS_POLAR">
<type>logical</type>
<valid_values>TRUE,FALSE</valid_values>
<default_value>FALSE</default_value>
<values match="last">
<value compset="%ISMF">TRUE</value>
</values>
<group>run_flags</group>
<file>env_run.xml</file>
<desc>Turn on the passing of polar fields through the coupler</desc>
</entry>

<entry id="TFREEZE_SALTWATER_OPTION">
<type>char</type>
<valid_values>minus1p8,linear_salt,mushy</valid_values>
Expand Down
12 changes: 12 additions & 0 deletions driver-mct/cime_config/namelist_definition_drv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,18 @@
</values>
</entry>

<entry id="flds_polar" modify_via_xml="FLDS_POLAR">
<type>logical</type>
<category>seq_flds</category>
<group>seq_cplflds_inparm</group>
<desc>
If set to .true. Polar fields will be passed from the ocean to the coupler.
</desc>
<values>
<value>$FLDS_POLAR</value>
</values>
</entry>

<entry id="flds_wiso" modify_via_xml="FLDS_WISO">
<type>logical</type>
<category>seq_flds</category>
Expand Down
37 changes: 16 additions & 21 deletions driver-mct/main/seq_diag_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,6 @@ module seq_diag_mct

integer :: index_i2x_Fioi_melth
integer :: index_i2x_Fioi_meltw
integer :: index_i2x_Fioi_bergh
integer :: index_i2x_Fioi_bergw
integer :: index_i2x_Fioi_salt
integer :: index_i2x_Faii_swnet
integer :: index_i2x_Fioi_swpen
Expand Down Expand Up @@ -1346,6 +1344,7 @@ subroutine seq_diag_ocn_mct( ocn, xao_o, frac_o, infodata, do_o2x, do_x2o, do_xa
real(r8) :: ca_i,ca_o,ca_c ! area of a grid cell
logical,save :: first_time = .true.
logical,save :: flds_wiso_ocn = .false.
logical,save :: flds_polar = .false.

!----- formats -----
character(*),parameter :: subName = '(seq_diag_ocn_mct) '
Expand Down Expand Up @@ -1379,11 +1378,14 @@ subroutine seq_diag_ocn_mct( ocn, xao_o, frac_o, infodata, do_o2x, do_x2o, do_xa
index_o2x_Fioo_frazil = mct_aVect_indexRA(o2x_o,'Fioo_frazil')
index_o2x_Fioo_q = mct_aVect_indexRA(o2x_o,'Fioo_q')
index_o2x_Faoo_h2otemp = mct_aVect_indexRA(o2x_o,'Faoo_h2otemp')
index_o2x_Foxo_ismw = mct_aVect_indexRA(o2x_o,'Foxo_ismw',perrWith='quiet')
index_o2x_Foxo_rrofl = mct_aVect_indexRA(o2x_o,'Foxo_rrofl',perrWith='quiet')
index_o2x_Foxo_rrofi = mct_aVect_indexRA(o2x_o,'Foxo_rrofi',perrWith='quiet')
index_o2x_Foxo_ismh = mct_aVect_indexRA(o2x_o,'Foxo_ismh',perrWith='quiet')
index_o2x_Foxo_rrofih = mct_aVect_indexRA(o2x_o,'Foxo_rrofih',perrWith='quiet')
index_o2x_Foxo_ismw = mct_aVect_indexRA(o2x_o,'Foxo_ismw',perrWith='quiet')
if ( index_o2x_Foxo_ismw /= 0 ) flds_polar = .true.
if ( flds_polar ) then
index_o2x_Foxo_rrofl = mct_aVect_indexRA(o2x_o,'Foxo_rrofl',perrWith='quiet')
index_o2x_Foxo_rrofi = mct_aVect_indexRA(o2x_o,'Foxo_rrofi',perrWith='quiet')
index_o2x_Foxo_ismh = mct_aVect_indexRA(o2x_o,'Foxo_ismh',perrWith='quiet')
index_o2x_Foxo_rrofih = mct_aVect_indexRA(o2x_o,'Foxo_rrofih',perrWith='quiet')
end if
end if

lSize = mct_avect_lSize(o2x_o)
Expand All @@ -1396,16 +1398,13 @@ subroutine seq_diag_ocn_mct( ocn, xao_o, frac_o, infodata, do_o2x, do_x2o, do_xa
nf = f_wfrz; budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) - (ca_o+ca_i)*max(0.0_r8,o2x_o%rAttr(index_o2x_Fioo_frazil,n))
nf = f_hfrz; budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) + (ca_o+ca_i)*max(0.0_r8,o2x_o%rAttr(index_o2x_Fioo_q,n))
nf = f_hh2ot; budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) + (ca_o+ca_i)*o2x_o%rAttr(index_o2x_Faoo_h2otemp,n)
nf = f_wpolar;budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) + ca_c*o2x_o%rAttr(index_o2x_Foxo_ismw,n)
nf = f_wpolar;budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) - (ca_o+ca_i)*o2x_o%rAttr(index_o2x_Foxo_rrofl,n)
nf = f_wpolar;budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) - (ca_o+ca_i)*o2x_o%rAttr(index_o2x_Foxo_rrofi,n)
! nf = f_wism; budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) + ca_c*o2x_o%rAttr(index_o2x_Foxo_ismw,n)
! nf = f_wrrof; budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) - (ca_o+ca_i)*o2x_o%rAttr(index_o2x_Foxo_rrofl,n)
! nf = f_wriof; budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) - (ca_o+ca_i)*o2x_o%rAttr(index_o2x_Foxo_rrofi,n)
nf = f_hpolar;budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) + ca_c*o2x_o%rAttr(index_o2x_Foxo_ismh,n)
nf = f_hpolar;budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) + ca_c*o2x_o%rAttr(index_o2x_Foxo_rrofih,n)
! nf = f_hism; budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) + ca_c*o2x_o%rAttr(index_o2x_Foxo_ismh,n)
! nf = f_hriof; budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) + ca_c*o2x_o%rAttr(index_o2x_Foxo_rrofih,n)
if (flds_polar) then
nf = f_wpolar;budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) + ca_c*o2x_o%rAttr(index_o2x_Foxo_ismw,n)
nf = f_wpolar;budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) - (ca_o+ca_i)*o2x_o%rAttr(index_o2x_Foxo_rrofl,n)
nf = f_wpolar;budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) - (ca_o+ca_i)*o2x_o%rAttr(index_o2x_Foxo_rrofi,n)
nf = f_hpolar;budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) - ca_c*o2x_o%rAttr(index_o2x_Foxo_ismh,n)
nf = f_hpolar;budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) + ca_c*o2x_o%rAttr(index_o2x_Foxo_rrofih,n)
end if
end do
end if

Expand Down Expand Up @@ -1635,8 +1634,6 @@ subroutine seq_diag_ice_mct( ice, frac_i, infodata, do_i2x, do_x2i)
if (present(do_i2x)) then
index_i2x_Fioi_melth = mct_aVect_indexRA(i2x_i,'Fioi_melth')
index_i2x_Fioi_meltw = mct_aVect_indexRA(i2x_i,'Fioi_meltw')
! index_i2x_Fioi_bergh = mct_aVect_indexRA(i2x_i,'PFioi_bergh')
! index_i2x_Fioi_bergw = mct_aVect_indexRA(i2x_i,'PFioi_bergw')
index_i2x_Fioi_swpen = mct_aVect_indexRA(i2x_i,'Fioi_swpen')
index_i2x_Faii_swnet = mct_aVect_indexRA(i2x_i,'Faii_swnet')
index_i2x_Faii_lwup = mct_aVect_indexRA(i2x_i,'Faii_lwup')
Expand Down Expand Up @@ -1672,9 +1669,7 @@ subroutine seq_diag_ice_mct( ice, frac_i, infodata, do_i2x, do_x2i)
nf = f_hlwup ; budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) + ca_i*i2x_i%rAttr(index_i2x_Faii_lwup,n)
nf = f_hlatv ; budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) + ca_i*i2x_i%rAttr(index_i2x_Faii_lat,n)
nf = f_hsen ; budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) + ca_i*i2x_i%rAttr(index_i2x_Faii_sen,n)
! nf = f_hberg ; budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) - (ca_o+ca_i)*i2x_i%rAttr(index_i2x_Fioi_bergh,n)
nf = f_wmelt ; budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) - ca_i*i2x_i%rAttr(index_i2x_Fioi_meltw,n)
! nf = f_wberg ; budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) - (ca_o+ca_i)*i2x_i%rAttr(index_i2x_Fioi_bergw,n)
nf = f_wevap ; budg_dataL(nf,ic,ip) = budg_dataL(nf,ic,ip) + ca_i*i2x_i%rAttr(index_i2x_Faii_evap,n)

if ( flds_wiso_ice )then
Expand Down
83 changes: 47 additions & 36 deletions driver-mct/shr/seq_flds_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,11 @@ subroutine seq_flds_set(nmlfile, ID, infodata)
logical :: flds_co2_dmsa
logical :: flds_bgc_oi
logical :: flds_wiso
logical :: flds_polar
integer :: glc_nec

namelist /seq_cplflds_inparm/ &
flds_co2a, flds_co2b, flds_co2c, flds_co2_dmsa, flds_wiso, glc_nec, &
flds_co2a, flds_co2b, flds_co2c, flds_co2_dmsa, flds_wiso, flds_polar, glc_nec, &
ice_ncat, seq_flds_i2o_per_cat, flds_bgc_oi, &
nan_check_component_fields, rof_heat, atm_flux_method, atm_gustiness, &
rof2ocn_nutrients, lnd_rof_two_way, ocn_rof_two_way, rof_sed
Expand Down Expand Up @@ -416,6 +417,7 @@ subroutine seq_flds_set(nmlfile, ID, infodata)
flds_co2_dmsa = .false.
flds_bgc_oi = .false.
flds_wiso = .false.
flds_polar = .false.
glc_nec = 0
ice_ncat = 1
seq_flds_i2o_per_cat = .false.
Expand Down Expand Up @@ -449,6 +451,7 @@ subroutine seq_flds_set(nmlfile, ID, infodata)
call shr_mpi_bcast(flds_co2_dmsa, mpicom)
call shr_mpi_bcast(flds_bgc_oi , mpicom)
call shr_mpi_bcast(flds_wiso , mpicom)
call shr_mpi_bcast(flds_polar , mpicom)
call shr_mpi_bcast(glc_nec , mpicom)
call shr_mpi_bcast(ice_ncat , mpicom)
call shr_mpi_bcast(seq_flds_i2o_per_cat, mpicom)
Expand Down Expand Up @@ -1583,45 +1586,53 @@ subroutine seq_flds_set(nmlfile, ID, infodata)
attname = 'PFioi_bergw'
call metadata_set(attname, longname, stdname, units)

! Water flux from ice shelf melt
call seq_flds_add(o2x_fluxes,"Foxo_ismw")
longname = 'Water flux due to basal melting of ice shelves'
stdname = 'basal_iceshelf_melt_flux'
units = 'kg m-2 s-1'
attname = 'Foxo_ismw'
call metadata_set(attname, longname, stdname, units)
!--------------------------------
! ocn<->cpl only exchange - Polar
!--------------------------------

! Heat flux from ice shelf melt
call seq_flds_add(o2x_fluxes,"Foxo_ismh")
longname = 'Heat flux due to basal melting of ice shelves'
stdname = 'basal_iceshelf_heat_flux'
units = 'W m-2'
attname = 'Foxo_ismh'
call metadata_set(attname, longname, stdname, units)
if (flds_polar) then

! Water flux from removed liquid runoff
call seq_flds_add(o2x_fluxes,"Foxo_rrofl")
longname = 'Water flux due to removed liqiud runoff'
stdname = 'removed_liquid_runoff_flux'
units = 'kg m-2 s-1'
attname = 'Foxo_rrofl'
call metadata_set(attname, longname, stdname, units)
! Water flux from ice shelf melt
call seq_flds_add(o2x_fluxes,"Foxo_ismw")
longname = 'Water flux due to basal melting of ice shelves'
stdname = 'basal_iceshelf_melt_flux'
units = 'kg m-2 s-1'
attname = 'Foxo_ismw'
call metadata_set(attname, longname, stdname, units)

! Water flux from removed solid runoff
call seq_flds_add(o2x_fluxes,"Foxo_rrofi")
longname = 'Water flux due to removed solid runoff'
stdname = 'removed_solid_runoff_flux'
units = 'kg m-2 s-1'
attname = 'Foxo_rrofi'
call metadata_set(attname, longname, stdname, units)
! Heat flux from ice shelf melt
call seq_flds_add(o2x_fluxes,"Foxo_ismh")
longname = 'Heat flux due to basal melting of ice shelves'
stdname = 'basal_iceshelf_heat_flux'
units = 'W m-2'
attname = 'Foxo_ismh'
call metadata_set(attname, longname, stdname, units)

! Heat flux from removed solid runoff
call seq_flds_add(o2x_fluxes,"Foxo_rrofih")
longname = 'Heat flux due to removed solid runoff'
stdname = 'removed_solid_runoff_heat_flux'
units = 'W m-2'
attname = 'Foxo_rrofih'
call metadata_set(attname, longname, stdname, units)
! Water flux from removed liquid runoff
call seq_flds_add(o2x_fluxes,"Foxo_rrofl")
longname = 'Water flux due to removed liqiud runoff'
stdname = 'removed_liquid_runoff_flux'
units = 'kg m-2 s-1'
attname = 'Foxo_rrofl'
call metadata_set(attname, longname, stdname, units)

! Water flux from removed solid runoff
call seq_flds_add(o2x_fluxes,"Foxo_rrofi")
longname = 'Water flux due to removed solid runoff'
stdname = 'removed_solid_runoff_flux'
units = 'kg m-2 s-1'
attname = 'Foxo_rrofi'
call metadata_set(attname, longname, stdname, units)

! Heat flux from removed solid runoff
call seq_flds_add(o2x_fluxes,"Foxo_rrofih")
longname = 'Heat flux due to removed solid runoff'
stdname = 'removed_solid_runoff_heat_flux'
units = 'W m-2'
attname = 'Foxo_rrofih'
call metadata_set(attname, longname, stdname, units)

end if

! Salt flux
call seq_flds_add(i2x_fluxes,"Fioi_salt")
Expand Down

0 comments on commit 9ed1b01

Please sign in to comment.