Skip to content

Commit

Permalink
Merge pull request ESCOMP#341 from mvertens/feature/cplhist_and_ocnim…
Browse files Browse the repository at this point in the history
…port

changes needed for CDEPS PR ESCOMP#213
  • Loading branch information
jedwards4b authored Feb 1, 2023
2 parents 96f1b73 + 70d6913 commit cb36640
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 36 deletions.
31 changes: 0 additions & 31 deletions cime_config/config_component_cesm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -466,37 +466,6 @@
<!-- averaged history frequencies -->
<!-- ===================================================================== -->

<entry id="AVGHIST_OPTION">
<type>char</type>
<valid_values>none,never,nsteps,nseconds,nminutes,nhours,ndays,nmonths,nyears,date,end</valid_values>
<default_value>never</default_value>
<values match="last">
<value compset="_DOCN%IAF">nmonths</value>
</values>
<group>med_history</group>
<file>env_run.xml</file>
<desc>Sets mediator average history file frequency (like REST_OPTION)</desc>
</entry>
<entry id="AVGHIST_N">
<type>char</type>
<valid_values></valid_values>
<default_value>-999</default_value>
<values match="last">
<value compset="_DOCN%IAF">1</value>
</values>
<group>med_history</group>
<file>env_run.xml</file>
<desc>Sets mediator average history file frequency (like REST_N)</desc>
</entry>
<entry id="AVGHIST_DATE">
<type>integer</type>
<valid_values></valid_values>
<default_value>-999</default_value>
<group>med_history</group>
<file>env_run.xml</file>
<desc>yyyymmdd format, sets mediator average history date (like REST_DATE)</desc>
</entry>

<entry id="BUDGETS">
<type>logical</type>
<valid_values>TRUE,FALSE</valid_values>
Expand Down
65 changes: 65 additions & 0 deletions cime_config/namelist_definition_drv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1801,6 +1801,71 @@
<!-- MED ocn history files -->
<!-- ======================================= -->

<!-- MED histaux ocn2med file1 -->
<entry id="histaux_ocn2med_file1_enabled">
<type>logical</type>
<category>aux_hist</category>
<group>MED_attributes</group>
<desc>Auxiliary mediator ocn2med average history output every day.</desc>
<values>
<value>.false.</value>
</values>
</entry>
<entry id="histaux_ocn2med_file1_flds">
<type>char</type>
<category>aux_hist</category>
<group>MED_attributes</group>
<desc>Auxiliary mediator ocn2med average history output every day.</desc>
<values>
<value>So_bldepth:So_t:So_u:So_v</value>
</values>
</entry>
<entry id="histaux_ocn2med_file1_history_option">
<type>char</type>
<category>aux_hist</category>
<group>MED_attributes</group>
<desc>history option type</desc>
<values>
<value>ndays</value>
</values>
</entry>
<entry id="histaux_ocn2med_file1_history_n">
<type>char</type>
<category>aux_hist</category>
<group>MED_attributes</group>
<desc>history option type</desc>
<values>
<value>1</value>
</values>
</entry>
<entry id="histaux_ocn2med_file1_doavg">
<type>logical</type>
<category>aux_hist</category>
<group>MED_attributes</group>
<desc>If true, use time average for aux file output.</desc>
<values>
<value>.true.</value>
</values>
</entry>
<entry id="histaux_ocn2med_file1_auxname">
<type>char</type>
<category>aux_hist</category>
<group>MED_attributes</group>
<desc>Auxiliary name identifier in history name</desc>
<values>
<value>ocn.24h.avg</value>
</values>
</entry>
<entry id="histaux_ocn2med_file1_ntperfile">
<type>integer</type>
<category>aux_hist</category>
<group>MED_attributes</group>
<desc>Number of time sames per file.</desc>
<values>
<value>30</value>
</values>
</entry>

<entry id="history_option_ocn_inst">
<type>char</type>
<category>time</category>
Expand Down
3 changes: 2 additions & 1 deletion cime_config/runseq/driver_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ def __compute_ocn(self, case, coupling_times):
# TODO: check of data model prognostic flag is on - this is a new xml variable
# If the prognostic flag is on, then should set med_to_wav to True
docn_mode = case.get_value("DOCN_MODE")
med_to_ocn = ('som' in docn_mode or 'interannual' in docn_mode)
docn_import_fields = case.get_value("DOCN_IMPORT_FIELDS")
med_to_ocn = ('som' in docn_mode or 'interannual' in docn_mode or docn_import_fields != 'none')

return (run_ocn, med_to_ocn, coupling_times["ocn_cpl_dt"])

Expand Down
12 changes: 9 additions & 3 deletions cime_config/runseq/runseq_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def gen_runseq(case, coupling_times):
runseq.add_action("MED med_phases_aofluxes_run" , run_ocn and run_atm and (med_to_ocn or med_to_atm))
runseq.add_action("MED med_phases_prep_ocn_accum" , med_to_ocn)
runseq.add_action("MED med_phases_ocnalb_run" , (run_ocn and run_atm and (med_to_ocn or med_to_atm)) and not xcompset)
runseq.add_action("MED med_phases_diag_ocn" , run_ocn and diag_mode)
runseq.add_action("MED med_phases_diag_ocn" , run_ocn and diag_mode)

if (cpl_seq_option == 'OPTION1'):
if ocn_cpl_time != atm_cpl_time:
Expand All @@ -104,11 +104,17 @@ def gen_runseq(case, coupling_times):
if ocn_cpl_time != atm_cpl_time:
runseq.leave_time_loop(inner_loop, addextra_atsign=True)

if (cpl_seq_option == 'TIGHT'):
runseq.add_action("MED med_phases_aofluxes_run" , med_to_ocn)
runseq.add_action("MED med_phases_prep_ocn_accum" , med_to_ocn)
runseq.add_action("MED med_phases_prep_ocn_avg" , med_to_ocn and ocn_outer_loop)
runseq.add_action("MED -> OCN :remapMethod=redist", med_to_ocn and ocn_outer_loop)

runseq.add_action("MED med_phases_prep_lnd" , med_to_lnd)
runseq.add_action("MED -> LND :remapMethod=redist" , med_to_lnd)

runseq.add_action("MED med_phases_prep_ice" , med_to_ice)
runseq.add_action("MED -> ICE :remapMethod=redist" , med_to_ice)
runseq.add_action("MED med_phases_prep_ice" , med_to_ice)
runseq.add_action("MED -> ICE :remapMethod=redist" , med_to_ice)

runseq.add_action("MED med_phases_prep_wav_accum" , med_to_wav)
runseq.add_action("MED med_phases_prep_wav_avg" , med_to_wav)
Expand Down
8 changes: 7 additions & 1 deletion mediator/med_phases_prep_ocn_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@ subroutine med_phases_prep_ocn_custom_cesm(gcomp, rc)

rc = ESMF_SUCCESS

call t_startf('MED:'//subname)
if (dbug_flag > 20) then
call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO)
end if
Expand All @@ -383,6 +382,13 @@ subroutine med_phases_prep_ocn_custom_cesm(gcomp, rc)
call ESMF_GridCompGetInternalState(gcomp, is_local, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! Check that the necessary export field is present
if ( .not. FB_fldchk(is_local%wrap%FBExp(compocn), 'Foxx_swnet', rc=rc)) then
return
end if

call t_startf('MED:'//subname)

!---------------------------------------
! Compute netsw for ocean
!---------------------------------------
Expand Down

0 comments on commit cb36640

Please sign in to comment.