Skip to content

Commit

Permalink
Merge remote-tracking branch 'ESCOMP/main' into bugfix/aoflux4ufs
Browse files Browse the repository at this point in the history
  • Loading branch information
DeniseWorthen committed Apr 11, 2024
2 parents 4e19850 + 3b1e50b commit cce82b9
Show file tree
Hide file tree
Showing 14 changed files with 768 additions and 599 deletions.
17 changes: 14 additions & 3 deletions cesm/flux_atmocn/shr_flux_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
& ocn_surface_flux_scheme, &
& add_gusts, &
& duu10n, &
& ugust_out, &
& ugust_out, &
& u10res, &
& ustar_sv ,re_sv ,ssq_sv, &
& missval)

Expand Down Expand Up @@ -194,6 +195,7 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
real(R8),intent(out) :: qref (nMax) ! diag: 2m ref humidity (kg/kg)
real(R8),intent(out) :: duu10n(nMax) ! diag: 10m wind speed squared (m/s)^2
real(R8),intent(out) :: ugust_out(nMax) ! diag: gustiness addition to U10 (m/s)
real(R8),intent(out) :: u10res(nMax) ! diag: gustiness addition to U10 (m/s)

real(R8),intent(out),optional :: ustar_sv(nMax) ! diag: ustar
real(R8),intent(out),optional :: re_sv (nMax) ! diag: sqrt of exchange coefficient (water)
Expand Down Expand Up @@ -243,6 +245,7 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
real(R8) :: cp ! specific heat of moist air
real(R8) :: fac ! vertical interpolation factor
real(R8) :: spval ! local missing value
real(R8) :: wind0 ! resolved large-scale 10m wind (no gust added)
!!++ COARE only
real(R8) :: zo,zot,zoq ! roughness lengths
real(R8) :: hsb,hlb ! sens & lat heat flxs at zbot
Expand Down Expand Up @@ -343,23 +346,28 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &

!--- compute some needed quantities ---
if (add_gusts) then
vmag = max(seq_flux_atmocn_minwind, sqrt( (ubot(n)-us(n))**2 + (vbot(n)-vs(n))**2) + ugust(min(rainc(n),6.94444e-4_r8)) )
vmag = max(seq_flux_atmocn_minwind, sqrt( (ubot(n)-us(n))**2 + (vbot(n)-vs(n))**2 + (1.0_R8*ugust(min(rainc(n),6.94444e-4_r8))**2)) )
ugust_out(n) = ugust(min(rainc(n),6.94444e-4_r8))
else
vmag = max(seq_flux_atmocn_minwind, sqrt( (ubot(n)-us(n))**2 + (vbot(n)-vs(n))**2) )
ugust_out(n) = 0.0_r8
end if
wind0 = max(seq_flux_atmocn_minwind, sqrt( (ubot(n)-us(n))**2 + (vbot(n)-vs(n))**2) )

if (use_coldair_outbreak_mod) then
! Cold Air Outbreak Modification:
! Increase windspeed for negative tbot-ts
! based on Mahrt & Sun 1995,MWR

if (tdiff(n).lt.td0) then
! if add_gusts wind0 and vmag are different, both need this factor.
vscl=min((1._R8+alpha*(abs(tdiff(n)-td0)**0.5_R8/abs(vmag))),maxscl)
vmag=vmag*vscl
vscl=min((1._R8+alpha*(abs(tdiff(n)-td0)**0.5_R8/abs(wind0))),maxscl)
wind0=wind0*vscl
endif
endif

ssq = 0.98_R8 * qsat(ts(n)) / rbot(n) ! sea surf hum (kg/kg)
delt = thbot(n) - ts(n) ! pot temp diff (K)
delq = qbot(n) - ssq ! spec hum dif (kg/kg)
Expand Down Expand Up @@ -460,6 +468,7 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
qref(n) = qbot(n) - delq*fac

duu10n(n) = u10n*u10n ! 10m wind speed squared
u10res(n) = u10n * (wind0/vmag) ! resolved 10m wind

!------------------------------------------------------------
! optional diagnostics, needed for water tracer fluxes (dcn)
Expand All @@ -472,6 +481,7 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
!------------------------------------------------------------
! no valid data here -- out of domain
!------------------------------------------------------------

sen (n) = spval ! sensible heat flux (W/m^2)
lat (n) = spval ! latent heat flux (W/m^2)
lwup (n) = spval ! long-wave upward heat flux (W/m^2)
Expand All @@ -484,7 +494,8 @@ SUBROUTINE flux_atmOcn(logunit, nMax ,zbot ,ubot ,vbot ,thbot , &
tref (n) = spval ! 2m reference height temperature (K)
qref (n) = spval ! 2m reference height humidity (kg/kg)
duu10n(n) = spval ! 10m wind speed squared (m/s)^2
ugust_out(n) = spval ! gustiness addition (m/s)
ugust_out(n) = spval ! gustiness addition (m/s)
u10res(n) = spval ! 10m resolved wind (no gusts) (m/s)

if (present(ustar_sv)) ustar_sv(n) = spval
if (present(re_sv )) re_sv (n) = spval
Expand Down
6 changes: 4 additions & 2 deletions cime_config/buildexe
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ def _main_func():
# always relink
if os.path.isfile(exename):
os.remove(exename)

exename = os.path.relpath(exename, bld_root)
cmd = "{} exec_se -j {} EXEC_SE={} COMP_NAME=driver {} -f {} "\
.format(gmake, gmake_j, exename, gmake_args, makefile)

pio = os.environ.get("PIO")
if pio:
os.environ["PIO_LIBDIR"] = os.path.join(pio,"lib")

rc, out, err = run_cmd(cmd,from_dir=bld_root)
expect(rc==0,"Command {} failed rc={}\nout={}\nerr={}".format(cmd,rc,out,err))
Expand Down
2 changes: 2 additions & 0 deletions cime_config/config_component_cesm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@
<default_value>1</default_value>
<values match="last">
<value compset="_DLND.*_CISM\d">1</value>
<value compset="_DGLC">1</value>
<value compset="_SGLC">$ATM_NCPL</value>
<value compset="_XGLC">$ATM_NCPL</value>
<value compset="_MOM6">1</value>
Expand Down Expand Up @@ -537,6 +538,7 @@
<default_value>FALSE</default_value>
<values match="last">
<value compset="_CLM.+CISM\d">TRUE</value>
<value compset="_CLM.+DGLC%">TRUE</value>
<!-- Turn on two-way coupling for TG compsets - even though there are no
feedbacks for a TG compset, this will give us additional diagnostics -->
<value compset="_DLND.+CISM\d">TRUE</value>
Expand Down
223 changes: 74 additions & 149 deletions cime_config/namelist_definition_drv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2086,6 +2086,80 @@
</values>
</entry>

<!-- ======================================= -->
<!-- MED auxiliary wav2med history files -->
<!-- ======================================= -->

<entry id="histaux_wav2med_file1_enabled">
<type>logical</type>
<category>aux_hist</category>
<group>ALLCOMP_attributes</group>
<values>
<value>.false.</value>
</values>
<desc>Auxiliary mediator wav2med average history output every day.
Note that ww3dev will use this configuration variable and send
the fields needed for wav2med auxiliary file</desc>
</entry>
<entry id="histaux_wav2med_file1_flds">
<type>char</type>
<category>aux_hist</category>
<group>MED_attributes</group>
<values>
<value>Sw_hs_avg:Sw_Tm1_avg:Sw_thm_avg:Sw_u_avg:Sw_v_avg:Sw_ustokes_avg:Sw_vstokes_avg:Sw_tusx_avg:Sw_tusy_avg:Sw_thp0_avg:Sw_fp0_avg:Sw_phs0_avg:Sw_phs1_avg:Sw_pdir0_avg:Sw_pdir1_avg:Sw_pTm10_avg:Sw_pTm11_avg</value>
</values>
<desc>Auxiliary mediator wav2med file1 colon delimited output
fields. NOTE: these are assumed to be time averaged over a day in
the WW3 cap - so the settings of histaux_wav2med_file1_history_n
and histaux_wav2med_file1_history_option should be 1 and ndays,
respectively.</desc>
</entry>
<entry id="histaux_wav2med_file1_history_option">
<type>char</type>
<category>aux_hist</category>
<group>MED_attributes</group>
<values>
<value>ndays</value>
</values>
<desc>Auxiliary mediator wav2med file1 output option</desc>
</entry>
<entry id="histaux_wav2med_file1_history_n">
<type>integer</type>
<category>aux_hist</category>
<group>MED_attributes</group>
<values>
<value>1</value>
</values>
<desc>Auxiliary mediator wav2med file1 output frequency (used for option type)</desc>
</entry>
<entry id="histaux_wav2med_file1_doavg">
<type>logical</type>
<category>aux_hist</category>
<group>MED_attributes</group>
<values>
<value>.false.</value>
</values>
<desc>Auxiliary mediator wav2med file1 time averaged flag for file output.
If this flag is set to .false. only instantaneous output will be created in the auxiliary file.</desc>
</entry>
<entry id="histaux_wav2med_file1_auxname">
<type>char</type>
<category>aux_hist</category>
<group>MED_attributes</group>
<values>
<value>wav.24h.avg</value>
</values>
</entry>
<entry id="histaux_wav2med_file1_ntperfile">
<type>integer</type>
<category>aux_hist</category>
<group>MED_attributes</group>
<desc>Number of time samples per file.</desc>
<values>
<value>30</value>
</values>
</entry>

<!-- =========================== -->
<!-- MED mapping attributes -->
<!-- =========================== -->
Expand Down Expand Up @@ -2635,24 +2709,6 @@
</values>
</entry>

<!-- <entry id="esp_run_on_pause" modify_via_xml="ESP_RUN_ON_PAUSE"> -->
<!-- <type>logical</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- true => ESP component runs after driver 'pause cycle' If any -->
<!-- component 'pauses' (see PAUSE_OPTION, -->
<!-- PAUSE_N and DATA_ASSIMILATION_XXX XML -->
<!-- variables), the ESP component (if present) will be run to -->
<!-- process the component 'pause' (restart) files and set any -->
<!-- required 'resume' signals. If true, esp_cpl_dt and -->
<!-- esp_cpl_offset settings are ignored. default: true -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>.true.</value> -->
<!-- </values> -->
<!-- </entry> -->

<entry id="calendar" modify_via_xml="CALENDAR">
<type>char</type>
<category>time</category>
Expand Down Expand Up @@ -2874,137 +2930,6 @@
</values>
</entry>

<!-- <entry id="pause_option" modify_via_xml="PAUSE_OPTION"> -->
<!-- <type>char</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <valid_values>none,never,nsteps,nseconds,nminutes,nhours,ndays,monthly,nmonths,nyears</valid_values> -->
<!-- <desc> -->
<!-- sets the pause frequency with pause_n -->
<!-- pause_option alarms are: -->
<!-- [none/never], turns option off -->
<!-- [nsteps] , pauses every pause_n nsteps , relative to start or last pause time -->
<!-- [nseconds] , pauses every pause_n nseconds, relative to start or last pause time -->
<!-- [nminutes] , pauses every pause_n nminutes, relative to start or last pause time -->
<!-- [nhours] , pauses every pause_n nhours , relative to start or last pause time -->
<!-- [ndays] , pauses every pause_n ndays , relative to start or last pause time -->
<!-- [nmonths] , pauses every pause_n nmonths , relative to start or last pause time -->
<!-- [monthly] , pauses every month , relative to start or last pause time -->
<!-- [nyear] , pauses every pause_n nyears , relative to start or last pause time -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_OPTION</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- <entry id="pause_n" modify_via_xml="PAUSE_N"> -->
<!-- <type>integer</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- Sets the pause frequency with pause_option -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_N</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- <entry id="pause_active_atm" modify_via_xml="PAUSE_ACTIVE_ATM"> -->
<!-- <type>logical</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- Whether Pause signals are active for component atm -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_ACTIVE_ATM</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- <entry id="pause_active_cpl" modify_via_xml="PAUSE_ACTIVE_CPL"> -->
<!-- <type>logical</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- Whether Pause signals are active for component CPL -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_ACTIVE_CPL</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- <entry id="pause_active_ocn" modify_via_xml="PAUSE_ACTIVE_OCN"> -->
<!-- <type>logical</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- Whether Pause signals are active for component ocn -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_ACTIVE_OCN</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- <entry id="pause_active_wav" modify_via_xml="PAUSE_ACTIVE_WAV"> -->
<!-- <type>logical</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- Whether Pause signals are active for component wav -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_ACTIVE_WAV</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- <entry id="pause_active_glc" modify_via_xml="PAUSE_ACTIVE_GLC"> -->
<!-- <type>logical</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- Whether Pause signals are active for component glc -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_ACTIVE_GLC</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- <entry id="pause_active_rof" modify_via_xml="PAUSE_ACTIVE_ROF"> -->
<!-- <type>logical</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- Whether Pause signals are active for component rof -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_ACTIVE_ROF</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- <entry id="pause_active_ice" modify_via_xml="PAUSE_ACTIVE_ICE"> -->
<!-- <type>logical</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- Whether Pause signals are active for component ice -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_ACTIVE_ICE</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- <entry id="pause_active_lnd" modify_via_xml="PAUSE_ACTIVE_LND"> -->
<!-- <type>logical</type> -->
<!-- <category>time</category> -->
<!-- <group>CLOCK_attributes</group> -->
<!-- <desc> -->
<!-- Whether Pause signals are active for component lnd -->
<!-- </desc> -->
<!-- <values> -->
<!-- <value>$PAUSE_ACTIVE_LND</value> -->
<!-- </values> -->
<!-- </entry> -->

<!-- =========================== -->
<!-- PELAYOUT attributes -->
<!-- =========================== -->
Expand Down
8 changes: 7 additions & 1 deletion cime_config/runseq/driver_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __compute_glc(self, case, coupling_times):
med_to_glc = False
elif (comp_glc == 'cism'):
if not case.get_value("CISM_EVOLVE"):
med_to_glc = False
run_glc = False

# If CISM is not evolving only get data back from cism at the initial time
# However will still need to call the exchange at the end if the stop_option
Expand All @@ -77,6 +77,12 @@ def __compute_glc(self, case, coupling_times):
glc_coupling_time = stop_n * 86400
else:
glc_coupling_time = 86400
elif (comp_glc == 'dglc'):
glc_coupling_time = coupling_times["glc_cpl_dt"]
stop_option = case.get_value('STOP_OPTION')
stop_n = case.get_value('STOP_N')
if stop_option == 'nsteps':
glc_coupling_time = stop_n*coupling_times["atm_cpl_dt"]
elif (comp_glc == 'xglc'):
glc_coupling_time = coupling_times["glc_cpl_dt"]
else:
Expand Down
6 changes: 4 additions & 2 deletions cime_config/runseq/runseq_TG.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ def gen_runseq(case, coupling_times):
runseq.add_action ("MED med_phases_post_lnd" , run_lnd)
runseq.add_action ("MED med_phases_prep_glc" , med_to_glc)
runseq.add_action ("MED -> GLC :remapMethod=redist" , med_to_glc)
runseq.add_action ("GLC" , run_glc and med_to_glc)
runseq.add_action ("GLC -> MED :remapMethod=redist" , run_glc)
runseq.add_action ("GLC" , run_glc)
# Need to do GLC -> MED even if not running GLC; otherwise, we get a
# failure in InitializeRealize ("Object being used before creation")
runseq.add_action ("GLC -> MED :remapMethod=redist" , med_to_glc)
runseq.add_action ("MED med_phases_history_write" , True)

runseq.leave_time_loop(True)
Expand Down
Loading

0 comments on commit cce82b9

Please sign in to comment.