Skip to content

Commit 46664e4

Browse files
authored
Merge pull request #42 from mvertens/feature/cam_computes_enthalpy
Enable new exchange of CAM computes enthalpy which is sent to BLOM
2 parents 257b47a + f322cd0 commit 46664e4

File tree

7 files changed

+448
-84
lines changed

7 files changed

+448
-84
lines changed

cime_config/buildnml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
162162
# ----------------------------------------------------
163163
# double check if ocn2glc_coupling is set correctly
164164
ocn2glc_coupling = nmlgen.get_value("ocn2glc_coupling")
165-
if "ocn2glc_coupling" == ".true.":
165+
if ocn2glc_coupling == ".true.":
166166
expect(case.get_value("COMP_OCN") == 'blom' or 'DOCN%MULTILEV' in case.get_value("COMPSET"),
167167
"ocn2glc_coupling is only allowed currently if the ocean component is BLOM or if DOCN%MULTILEV is in the compset")
168168

@@ -261,6 +261,24 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
261261
run_startdate = "".join(str(x) for x in case.get_value("RUN_STARTDATE").split("-"))
262262
nmlgen.set_value("start_ymd", value=run_startdate)
263263

264+
# --------------------------------
265+
# Overwrite: budget_table_version if atm computes enthalpy
266+
# --------------------------------
267+
component_computes_enthalpy_flux = nmlgen.get_value("component_computes_enthalpy_flux")
268+
if 'atm' in component_computes_enthalpy_flux:
269+
nmlgen.set_value("budget_table_version", value="v2")
270+
expect(
271+
case.get_value("COMP_ATM") != "cam" and
272+
case.get_value("COMP_OCN") == "mom6",
273+
"Only CAM and BLOM are currently allowed if cam computes enthalpy fluxes"
274+
)
275+
elif component_computes_enthalpy_flux == "med":
276+
expect(
277+
case.get_value("COMP_ATM") != "cam" and
278+
case.get_value("COMP_OCN") != "mom6",
279+
"Only CAM and MOM6 are currently allowed if mediator computes enthalpy fluxes"
280+
)
281+
264282
# --------------------------------
265283
# Overwrite: set tprof_option and tprof_n - if tprof_total is > 0
266284
# --------------------------------

cime_config/namelist_definition_drv.xml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,26 @@
663663
</values>
664664
</entry>
665665

666+
<!-- =========================================== -->
667+
<!-- All components enthalpy computation -->
668+
<!-- =========================================== -->
669+
670+
<entry id="component_computes_enthalpy_flux">
671+
<type>char</type>
672+
<category>control</category>
673+
<group>ALLCOMP_attributes</group>
674+
<valid_values>none,atm,med</valid_values>
675+
<desc>
676+
if none, no enthaply flux is computed to send to the ocean,
677+
if atm, the atm (in this case cam) computes enthalpy to send to the ocn (in this case BLOM)
678+
if med, the mediator computes computes enthalpy to send to the ocn (in this case MOM6)
679+
</desc>
680+
<values>
681+
<value>none</value>
682+
<value comp_ocn="mom6" comp_atm="cam">med</value>
683+
</values>
684+
</entry>
685+
666686
<!-- =========================================== -->
667687
<!-- MED general attributes -->
668688
<!-- =========================================== -->
@@ -980,14 +1000,13 @@
9801000
<type>char</type>
9811001
<category>budget</category>
9821002
<group>MED_attributes</group>
983-
<valid_values>v0,v1</valid_values>
1003+
<valid_values>v0,v1,v2</valid_values>
9841004
<desc>
985-
currently v0 refers to budgets using POP and v1 refers to budgets using MOM6
1005+
currently v0 refers to budgets using BLOM and v1 refers to budgets using MOM6
9861006
</desc>
9871007
<values>
9881008
<value>v0</value>
9891009
<value comp_ocn="mom">v1</value>
990-
<value comp_ocn="pop">v0</value>
9911010
</values>
9921011
</entry>
9931012

@@ -2462,10 +2481,9 @@
24622481
<category>expdef</category>
24632482
<group>ALLCOMP_attributes</group>
24642483
<desc>
2465-
index of scalar containing epbal precipitation factor from ocn (only for POP)
2484+
index of scalar containing epbal precipitation factor from ocn (only for BLOM)
24662485
</desc>
24672486
<values>
2468-
<value COMP_OCN="pop">4</value>
24692487
<value COMP_OCN="blom">4</value>
24702488
<value>0</value>
24712489
</values>

mediator/esmFldsExchange_cesm_mod.F90

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,9 +1315,10 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
13151315

13161316
if (phase == 'advertise') then
13171317
call addfld_to(compatm, 'Faxx_evap')
1318+
call addfld_to(compatm, 'Faox_evap')
13181319
call addfld_from(complnd, 'Fall_evap')
13191320
call addfld_from(compice, 'Faii_evap')
1320-
call addfld_aoflux( 'Faox_evap')
1321+
call addfld_aoflux('Faox_evap')
13211322
else
13221323
if (fldchk(is_local%wrap%FBexp(compatm), 'Faxx_evap', rc=rc)) then
13231324
if ( fldchk(is_local%wrap%FBImp(complnd,complnd), 'Fall_evap', rc=rc)) then
@@ -1336,6 +1337,8 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
13361337
end if
13371338
call addmrg_to(compatm , 'Faxx_evap', &
13381339
mrg_from=compmed, mrg_fld='Faox_evap', mrg_type='merge', mrg_fracname='ofrac')
1340+
! unmerged aoflux-only for correct hevap to ocean in cam_out
1341+
call addmrg_to(compatm, 'Faox_evap', mrg_from=compmed, mrg_fld='Faox_evap', mrg_type='copy')
13391342
end if
13401343
end if
13411344
end if
@@ -1892,6 +1895,33 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
18921895
mrg_from=compatm, mrg_fld='Faxa_swdn', mrg_type='copy')
18931896
end if
18941897
end if
1898+
!----------------------------------------------------------------------
1899+
! to ocn: downward material enthalpy flux from atm
1900+
! ---------------------------------------------------------------------
1901+
if (phase == 'advertise') then
1902+
call addfld_from(compatm, 'Faxa_hmat')
1903+
call addfld_to (compocn, 'Faxa_hmat')
1904+
call addfld_to (compocn, 'Faxa_hmat_oa') ! handled in prep_ocn
1905+
call addfld_from(compatm, 'Faxa_hlat')
1906+
call addfld_to (compocn, 'Faxa_hlat')
1907+
call addfld_to (compatm, 'Faxx_hrof') ! enthalpy of runoff, computed in med_phases_prep_ocn
1908+
else
1909+
if (fldchk(is_local%wrap%FBImp(compatm, compatm), 'Faxa_hmat', rc=rc) .and. &
1910+
fldchk(is_local%wrap%FBExp(compocn) , 'Faxa_hmat', rc=rc)) then
1911+
call addmap_from(compatm, 'Faxa_hmat', compocn, mapconsf, 'one', atm2ocn_map)
1912+
call addmrg_to (compocn, 'Faxa_hmat', mrg_from=compatm ,mrg_fld='Faxa_hmat' &
1913+
, mrg_type='copy_with_weights', mrg_fracname='ofrac')
1914+
end if
1915+
if (fldchk(is_local%wrap%FBImp(compatm, compatm), 'Faxa_hlat', rc=rc) .and. &
1916+
fldchk(is_local%wrap%FBExp(compocn) , 'Faxa_hlat', rc=rc)) then
1917+
call addmap_from(compatm, 'Faxa_hlat', compocn, mapconsf, 'one', atm2ocn_map)
1918+
call addmrg_to (compocn, 'Faxa_hlat', mrg_from=compatm ,mrg_fld='Faxa_hlat' &
1919+
, mrg_type='copy_with_weights', mrg_fracname='ofrac')
1920+
end if
1921+
!if (fldchk(is_local%wrap%FBExp(compatm),'Faxx_hrof', rc=rc)) &
1922+
! call addmap_from(compocn, 'Faxx_hrof', compatm, mapconsf, 'one', atm2ocn_map)
1923+
end if
1924+
18951925
! ---------------------------------------------------------------------
18961926
! to ocn: net shortwave radiation from med
18971927
! ---------------------------------------------------------------------
@@ -1932,15 +1962,15 @@ subroutine esmFldsExchange_cesm(gcomp, phase, rc)
19321962
end if
19331963

19341964
! import sw from atm by bands
1935-
if ( fldchk(is_local%wrap%FBImp(compatm,compatm), 'Faxa_swvdr', rc=rc) .and. &
1965+
if ((fldchk(is_local%wrap%FBImp(compatm,compatm), 'Faxa_swvdr', rc=rc) .and. &
19361966
fldchk(is_local%wrap%FBImp(compatm,compatm), 'Faxa_swvdf', rc=rc) .and. &
19371967
fldchk(is_local%wrap%FBImp(compatm,compatm), 'Faxa_swndr', rc=rc) .and. &
19381968
fldchk(is_local%wrap%FBImp(compatm,compatm), 'Faxa_swndr', rc=rc) .and. &
1939-
(fldchk(is_local%wrap%FBExp(compocn), 'Foxx_swnet' , rc=rc)) .or. &
1940-
(fldchk(is_local%wrap%FBExp(compocn), 'Foxx_swnet_vdr', rc=rc) .and. &
1941-
fldchk(is_local%wrap%FBExp(compocn), 'Foxx_swnet_vdf', rc=rc) .and. &
1942-
fldchk(is_local%wrap%FBExp(compocn), 'Foxx_swnet_idr', rc=rc) .and. &
1943-
fldchk(is_local%wrap%FBExp(compocn), 'Foxx_swnet_idf', rc=rc))) then
1969+
fldchk(is_local%wrap%FBExp(compocn) , 'Foxx_swnet', rc=rc)) .or. &
1970+
(fldchk(is_local%wrap%FBExp(compocn), 'Foxx_swnet_vdr', rc=rc) .and. &
1971+
fldchk(is_local%wrap%FBExp(compocn), 'Foxx_swnet_vdf', rc=rc) .and. &
1972+
fldchk(is_local%wrap%FBExp(compocn), 'Foxx_swnet_idr', rc=rc) .and. &
1973+
fldchk(is_local%wrap%FBExp(compocn), 'Foxx_swnet_idf', rc=rc))) then
19441974
call addmap_from(compatm, 'Faxa_swvdr', compocn, mapconsf, 'one', atm2ocn_map)
19451975
call addmap_from(compatm, 'Faxa_swvdf', compocn, mapconsf, 'one', atm2ocn_map)
19461976
call addmap_from(compatm, 'Faxa_swndr', compocn, mapconsf, 'one', atm2ocn_map)

mediator/fd_cesm.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,25 @@
300300
alias: mean_down_lw_flx
301301
canonical_units: W m-2
302302
description: atm import to med
303-
mean downward SW heat flux
303+
mean downward LW heat flux
304+
#
305+
- standard_name: Faxa_hmat
306+
alias: mean_down_hmat
307+
canonical_units: W m-2
308+
description: atm import to med
309+
mean downward material enthalpy flux
310+
#
311+
- standard_name: Faxa_hlat
312+
alias: mean_down_hlat
313+
canonical_units: W m-2
314+
description: atm import to med
315+
variable latent heat part of mat.enth.flx
316+
#
317+
- standard_name: Faxa_hmat_oa
318+
alias: mean_down_hmat_oa
319+
canonical_units: W m-2
320+
description: med export to ocn
321+
mean downw. mat. enth. flux, ocean average
304322
#
305323
- standard_name: Faxa_ndep
306324
canonical_units: kg(N)/m2/sec
@@ -1017,6 +1035,11 @@
10171035
canonical_units: W m-2
10181036
description: med export to ocn heat content of condensation
10191037
#
1038+
- standard_name: Faxx_hrof
1039+
alias: heat_content_rof
1040+
canonical_units: W m-2
1041+
description: med export to atm gl.avg. of mat.enthalpy of runoff
1042+
#
10201043
- standard_name: Foxx_hrofl
10211044
alias: heat_content_rofl
10221045
canonical_units: W m-2

0 commit comments

Comments
 (0)