Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new CESM stream relaxation capability for sss and sst #342

Merged
merged 11 commits into from
May 15, 2024
24 changes: 1 addition & 23 deletions cesm/mod_cesm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,17 @@ module mod_cesm
use mod_constants, only: pi
use mod_time, only: nstep
use mod_xc
use mod_forcing, only: trxday, srxday, swa, nsf, lip, sop, eva, rnf, rfi, &
use mod_forcing, only: swa, nsf, lip, sop, eva, rnf, rfi, &
fmltfz, sfl, ztx, mty, ustarw, slp, abswnd, &
lamult, lasl, ustokes, vstokes, atmco2, atmbrf, &
flxdms, flxbrf
use mod_ben02, only: initai, rdcsic, rdctsf, fnlzai
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems these functions are no longer used anywhere in BLOM after this PR. Is that intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually there are calls to initai, rdcsic and rdctsf in mod_ben02.F in the routine inifrc_ben02clim

c --- Prepare interpolation of surface fields.
      call initai
c
c --- Read climatological sea-ice concentration.
      call rdcsic
c
c --- Read climatological surface temperature.
      call rdctsf

And inifrc_ben02clim is called from inifrc.F90 if expcnf is 'ben02clim' - so I don't think we can remove these routines unless ben02clim is a mode that will no longer be used. Am I missing something?

use mod_seaice, only: ficem
use mod_checksum, only: csdiag, chksummsk
#ifdef HAMOCC
use mo_control_bgc, only: use_bromo
#endif

implicit none

private

character(len = 256) :: &
Expand Down Expand Up @@ -117,30 +115,10 @@ subroutine inicon_cesm
end subroutine inicon_cesm

subroutine inifrc_cesm
! ---------------------------------------------------------------------------
! Initialize climatological fields for surface restoring and interpolation of
! CESM forcing fields.
! ---------------------------------------------------------------------------

! If SST restoring is requested, prepare interpolation of surface fields
! and read climatological sea-ice concentration and surface temperature.
if (trxday > 0._r8) then
call initai
call rdcsic
call rdctsf
endif

! If SSS restoring is requested, read climatological sea surface salinity.
if (srxday > 0._r8) call rdcsss

! Initialize diagnosing/application of relaxation fluxes.
call idarlx

! Deallocate memory used for interpolation of surface fields.
if (trxday > 0._r8) then
call fnlzai
endif

! Initialize time level indexes
l1ci = 1
l2ci = 1
Expand Down
25 changes: 11 additions & 14 deletions cesm/thermf_cesm.F
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ subroutine thermf_cesm(m,n,mm,nn,k1m,k1n)
. swa, nsf, hmltfz, lip, sop, eva, rnf, rfi,
. fmltfz, sfl, ustarw, surflx, surrlx,
. sswflx, salflx, brnflx, salrlx, ustar,
. t_rs_nonloc, s_rs_nonloc
. t_rs_nonloc, s_rs_nonloc,
. sss_stream, sst_stream, ice_stream
use mod_cesm, only: hmlt, frzpot, mltpot
use mod_utility, only: util1, util2, util3, util4
use mod_checksum, only: csdiag, chksummsk
Expand Down Expand Up @@ -207,14 +208,12 @@ subroutine thermf_cesm(m,n,mm,nn,k1m,k1n)
surrlx(i,j)=0.
c
c --- --- If trxday>0 , apply relaxation towards observed sst
if (trxday.gt.epsilt) then
sstc=intp1d(sstclm(i,j,l1mi),sstclm(i,j,l2mi),
. sstclm(i,j,l3mi),sstclm(i,j,l4mi),
. sstclm(i,j,l5mi),xmi)
rice=intp1d(ricclm(i,j,l1mi),ricclm(i,j,l2mi),
. ricclm(i,j,l3mi),ricclm(i,j,l4mi),
. ricclm(i,j,l5mi),xmi)
sstc=(1.-rice)*max(sstc,tice_f)+rice*tice_f
if (trxday > epsilt ) then

sstc = sst_stream(i,j)
rice = ice_stream(i,j)
sstc = (1.-rice)*max(sstc,tice_f) + rice*tice_f

if (vcoord_type_tag == isopyc_bulkml) then
dpmxl=dp(i,j,1+nn)+dp(i,j,2+nn)
hmxl=dpmxl/onem
Expand Down Expand Up @@ -269,10 +268,8 @@ subroutine thermf_cesm(m,n,mm,nn,k1m,k1n)
salrlx(i,j)=0.
c
c --- --- if srxday>0 , apply relaxation towards observed sss
if (srxday.gt.epsilt) then
sssc=intp1d(sssclm(i,j,l1mi),sssclm(i,j,l2mi),
. sssclm(i,j,l3mi),sssclm(i,j,l4mi),
. sssclm(i,j,l5mi),xmi)
if (srxday > epsilt ) then
sssc = sss_stream(i,j)
if (vcoord_type_tag == isopyc_bulkml) then
dpmxl=dp(i,j,1+nn)+dp(i,j,2+nn)
hmxl=dpmxl/onem
Expand Down Expand Up @@ -428,7 +425,7 @@ subroutine thermf_cesm(m,n,mm,nn,k1m,k1n)
enddo
enddo
c$OMP END PARALLEL DO
c
c
enddo
#endif
c
Expand Down
12 changes: 6 additions & 6 deletions cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def buildnml(case, caseroot, compname):
namelist_file += inst_string

# Create BLOM namelist
groups=['limits','diffusion','merdia','secdia','diaphy']
groups=['limits','diffusion','merdia','secdia','diaphy','stream_sss','stream_sst' ]

groups.append('cwmod')

Expand All @@ -261,14 +261,14 @@ def buildnml(case, caseroot, compname):
if "ecosys" in case.get_value("BLOM_TRACER_MODULES"):
groups.append("bgcparams")
"""
!!! The following line deletes all entries for group 'bgcparams'
!!! that are ONLY present in namelist_definition_blom.xml
!!! The following line deletes all entries for group 'bgcparams'
!!! that are ONLY present in namelist_definition_blom.xml
!!! and keeps entries provided through user_nl_blom
!!! This makes sure that i) only Fortran-hard coded values from mo_param_bgc.F90
!!! are used and that ii) user_nl_blom enables tuning these default parameters.
!!! Note that an entry in namelist_definition_blom.xml for the tuning parameter
!!! is still required, while its value can be set to None.
!!! This is an interim solution and the line below can be simply deleted, once
!!! Note that an entry in namelist_definition_blom.xml for the tuning parameter
!!! is still required, while its value can be set to None.
!!! This is an interim solution and the line below can be simply deleted, once
!!! xml is used as default for the bgcparams namelist as well.
"""
pg_blom.keep_usernml_only('bgcparams')
Expand Down
139 changes: 139 additions & 0 deletions cime_config/namelist_definition_blom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6670,4 +6670,143 @@
<desc>(ssster) [mol m-3]</desc>
</entry>

<!-- ========================= -->
<!-- namelist group: stream_sss -->
<!-- ========================= -->

<entry id="stream_sss_mesh_filename">
<type>char</type>
<category>stream_sss</category>
<group>stream_sss</group>
<desc>stream mesh file</desc>
<values>
<value>$DIN_LOC_ROOT/share/meshes/tnx1v4_20170601_cdf5_ESMFmesh.nc</value>
</values>
</entry>
<entry id="stream_sss_data_filename">
<type>char(10)</type>
<category>stream_sss</category>
<group>stream_sss</group>
<desc>
file name(s) containing salinity relaxation data
</desc>
<values>
<!-- <value>/cluster/work/users/mvertens/noresm/blom_sss_stream/run/sss.NCO2x4_f19_tn14_20190624.blom.hd.0001_cdf5.nc</value> -->
<value>/cluster/projects/nn10013k/adagj/sss_clim/sss_climatology_N1850_f19_tn14_20190621_1600-1699_cdf5.nc</value>
</values>
</entry>
<entry id="stream_sss_varname">
<type>char</type>
<category>stream_sss</category>
<group>stream_sss</group>
<desc>
variable name on stream file
</desc>
<values>
<value>sss</value>
</values>
</entry>
<entry id="stream_sss_year_first">
<type>integer</type>
<category>stream_sss</category>
<group>stream_sss</group>
<desc>
First year in stream to use
</desc>
<values>
<value>1</value>
</values>
</entry>
<entry id="stream_sss_year_last">
<type>integer</type>
<category>stream_sss</category>
<group>stream_sss</group>
<desc>
Last year in stream to use
</desc>
<values>
<value>1</value>
</values>
</entry>
<entry id="stream_sss_year_align">
<type>integer</type>
<category>stream_sss</category>
<group>stream_sss</group>
<desc>
Align stream_year_first with this model year
</desc>
<values>
<value>1</value>
</values>
</entry>

<!-- ========================= -->
<!-- namelist group: stream_sst -->
<!-- ========================= -->

<entry id="stream_sst_mesh_filename">
<type>char</type>
<category>stream_sst</category>
<group>stream_sst</group>
<desc>stream mesh file</desc>
<values>
<value>$DIN_LOC_ROOT/atm/cam/sst/sst_HadOIBl_bc_1x1_clim_c101029_ESMFmesh_120520.nc</value>
</values>
</entry>
<entry id="stream_sst_data_filename">
<type>char(10)</type>
<category>stream_sst</category>
<group>stream_sst</group>
<desc>
file name(s) containing sst relaxation data
</desc>
<values>
<value>$DIN_LOC_ROOT/atm/cam/sst/sst_HadOIBl_bc_1x1_1850_2017_c180507_cdf5.nc</value>
</values>
</entry>
<entry id="stream_sst_varname">
<type>char(2)</type>
<category>stream_sst</category>
<group>stream_sst</group>
<desc>
variable name on stream file
</desc>
<values>
<value>SST_cpl, ice_cov</value>
</values>
</entry>
<entry id="stream_sst_year_first">
<type>integer</type>
<category>stream_sst</category>
<group>stream_sst</group>
<desc>
First year in stream to use
</desc>
<values>
<value>1850</value>
</values>
</entry>
<entry id="stream_sst_year_last">
<type>integer</type>
<category>stream_sst</category>
<group>stream_sst</group>
<desc>
Last year in stream to use
</desc>
<values>
<value>1850</value>
</values>
</entry>
<entry id="stream_sst_year_align">
<type>integer</type>
<category>stream_sst</category>
<group>stream_sst</group>
<desc>
Align stream_year_first with this model year
</desc>
<values>
<value>1</value>
</values>
</entry>

</entry_id_pg>
Loading
Loading