Skip to content

Commit

Permalink
Merge remote-tracking branch 'Consortium/main' into feature/updcice
Browse files Browse the repository at this point in the history
  • Loading branch information
DeniseWorthen committed Nov 29, 2021
2 parents d83c67b + 2b85126 commit 55bf9f4
Show file tree
Hide file tree
Showing 53 changed files with 1,178 additions and 555 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Travis-CI](https://travis-ci.org/CICE-Consortium/CICE.svg?branch=master)](https://travis-ci.org/CICE-Consortium/CICE)
<!--- [![Travis-CI](https://travis-ci.org/CICE-Consortium/CICE.svg?branch=main)](https://travis-ci.org/CICE-Consortium/CICE) --->
[![GHActions](https://github.com/CICE-Consortium/CICE/workflows/GHActions/badge.svg)](https://github.com/CICE-Consortium/CICE/actions)
[![Documentation Status](https://readthedocs.org/projects/cice-consortium-cice/badge/?version=master)](http://cice-consortium-cice.readthedocs.io/en/master/?badge=master)
[![Documentation Status](https://readthedocs.org/projects/cice-consortium-cice/badge/?version=main)](http://cice-consortium-cice.readthedocs.io/en/main/?badge=main)
[![lcov](https://img.shields.io/endpoint?url=https://apcraig.github.io/coverage.json)](https://apcraig.github.io)

<!--- [![codecov](https://codecov.io/gh/apcraig/Test_CICE_Icepack/branch/master/graph/badge.svg)](https://codecov.io/gh/apcraig/Test_CICE_Icepack) --->
Expand Down
80 changes: 68 additions & 12 deletions cice.setup
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/csh -f

#set pd0 = `date -u "+%s%N"`

set ICE_SANDBOX = `pwd`
set ICE_VERSION = unknown
if (-e cicecore/version.txt) then
Expand Down Expand Up @@ -480,6 +482,7 @@ else
exit -1
endif
cp -f ${ICE_SCRIPTS}/tests/report_results.csh ${tsdir}
cp -f ${ICE_SCRIPTS}/tests/create_fails.csh ${tsdir}
cp -f ${ICE_SCRIPTS}/tests/poll_queue.csh ${tsdir}
cat >! ${tsdir}/suite.submit << EOF0
Expand Down Expand Up @@ -823,8 +826,8 @@ EOF
# set default test output as failure
if (${docase} == 0) then
echo "#---" >! test_output
echo "FAIL ${testname_noid} build" >> test_output
echo "FAIL ${testname_noid} run" >> test_output
echo "PEND ${testname_noid} build" >> test_output
echo "PEND ${testname_noid} run" >> test_output
endif
# from basic script dir to case
Expand Down Expand Up @@ -919,7 +922,7 @@ EOF
echo "ICE_GRID = ${grid} (${ICE_DECOMP_NXGLOB}x${ICE_DECOMP_NYGLOB}) blocksize=${ICE_DECOMP_BLCKX}x${ICE_DECOMP_BLCKY}x${ICE_DECOMP_MXBLCKS}"
echo "ICE_DECOMP = ${ICE_DECOMP_DECOMP} ${ICE_DECOMP_DSHAPE}"
if ($fbfbcomp != ${spval}) then
echo "ICE_BFBCOMP = ${fbfbcomp}"
echo "ICE_BFBCOMP = ${fbfbcomp}"
endif
#------------------------------------------------------------
Expand All @@ -933,9 +936,21 @@ EOF
if (-e ${fimods}) rm ${fimods}
if (-e ${fsmods}) rm ${fsmods}
# Use an existing ice_in file from the suite if it exists
# to reduce time spent in parse_namelist
set skip_parse_namelist = spval
if (${dosuite} == 1) then
set iceinfn = ../ice_in_save_${grid}${soptions}
if (-e ${iceinfn}) then
echo "use ${iceinfn}"
cp ${iceinfn} ice_in
set skip_parse_namelist = true
endif
endif
# Set decomp info in namelist
cat >! ${fimods} << EOF1
# cice.setup settings
nprocs = ${task}
nx_global = ${ICE_DECOMP_NXGLOB}
ny_global = ${ICE_DECOMP_NYGLOB}
Expand Down Expand Up @@ -964,7 +979,6 @@ EOF1
cat >! ${fsmods} << EOF1
# cice.setup settings
setenv ICE_SANDBOX ${ICE_SANDBOX}
setenv ICE_SCRIPTS ${ICE_SCRIPTS}
setenv ICE_CASENAME ${casename}
Expand Down Expand Up @@ -1033,42 +1047,59 @@ EOF1
foreach name (${grid} $setsx)
set found = 0
if (-e ${ICE_SCRIPTS}/options/set_nml.${name}) then
cat >> ${fimods} << EOF2
# set_nml.${name}
EOF2
cat ${ICE_SCRIPTS}/options/set_nml.${name} >> ${fimods}
cat >> ${fimods} << EOF2
if ("${skip_parse_namelist}" == "true") then
# need to make sure the decomp info from the set_nml is picked up. each case
# has a slightly different decomp that is independent of the ice_in_save file.
# compute that then overwrite by set_nml as needed.
grep -i "distribution_type" ${ICE_SCRIPTS}/options/set_nml.${name} >> ${fimods}
grep -i "processor_shape" ${ICE_SCRIPTS}/options/set_nml.${name} >> ${fimods}
cat >> ${fimods} << EOF2
# using saved ice_in
EOF2
else
cat ${ICE_SCRIPTS}/options/set_nml.${name} >> ${fimods}
cat >> ${fimods} << EOF2
EOF2
endif
echo "adding namelist mods set_nml.${name}"
echo "`date` ${0} adding namelist modes set_nml.${name}" >> ${casedir}/README.case
set found = 1
endif
if (-e ${ICE_SCRIPTS}/options/set_env.${name}) then
cat >> ${fsmods} << EOF2
# set_env.${name}
EOF2
cat ${ICE_SCRIPTS}/options/set_env.${name} >> ${fsmods}
cat >> ${fsmods} << EOF2
EOF2
echo "adding env mods set_env.${name}"
echo "`date` ${0} adding namelist modes set_env.${name}" >> ${casedir}/README.case
set found = 1
endif
if (${found} == 0) then
echo "${0}: ERROR, ${ICE_SCRIPTS}/options/set_[nml,env].${name} not found"
exit -1
endif
end
#set pd1 = `date -u "+%s%N"`
#@ pdd = ( $pd1 - $pd0 ) / 1000000
#echo "tcxp b4 parse $pdd"
${casescr}/parse_settings.sh cice.settings ${fsmods}
if ($status != 0) then
echo "${0}: ERROR, parse_settings.sh aborted"
exit -1
endif
${casescr}/parse_namelist.sh ice_in ${fimods}
if ($status != 0) then
echo "${0}: ERROR, parse_namelist.sh aborted"
Expand All @@ -1077,6 +1108,20 @@ EOF2
source ./cice.settings
source ./env.${machcomp} -nomodules || exit 2
${casescr}/parse_namelist_from_env.sh ice_in
if ($status != 0) then
echo "${0}: ERROR, parse_namelist_from_env.sh aborted"
exit -1
endif
#set pd1 = `date -u "+%s%N"`
#@ pdd = ( $pd1 - $pd0 ) / 1000000
#echo "tcxp after parse $pdd"
# Save ice_in in the suite to reduce time spent in parse_namelist
if (${dosuite} == 1) then
if !(-e ${iceinfn}) then
cp ice_in ${iceinfn}
endif
endif
#------------------------------------------------------------
# Generate run script
Expand Down Expand Up @@ -1144,7 +1189,9 @@ if (\${dobuild} == true) then
endif
endif
if (\${dosubmit} == true) then
./cice.submit | tee -a ../suite.jobs
set jobid = \`./cice.submit\`
echo "\$jobid"
echo "\$jobid \${ICE_TESTNAME} " >> ../suite.jobs
else if (\${dorun} == true) then
./cice.test
endif
Expand All @@ -1159,6 +1206,10 @@ EOF
echo ""
endif
#set pd1 = `date -u "+%s%N"`
#@ pdd = ( $pd1 - $pd0 ) / 1000000
#echo "tcxp case done $pdd"
# This is the foreach end for the testsuite
end
# This is the foreach end for the envnames
Expand All @@ -1173,6 +1224,7 @@ if ( ${dosuite} == 1 ) then
cat >> ${tsdir}/suite.submit << EOF0
set nonomatch && rm -f ciceexe.* && unset nonomatch
set nonomatch && rm -f ice_in_save* && unset nonomatch
EOF0
Expand Down Expand Up @@ -1215,6 +1267,10 @@ endif
#---------------------------------------------
#set pd1 = `date -u "+%s%N"`
#@ pdd = ( $pd1 - $pd0 ) / 1000000
#echo "tcxp done $pdd"
echo " "
echo "${0} done"
echo " "
Expand Down
58 changes: 40 additions & 18 deletions cicecore/cicedynB/analysis/ice_history.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1624,6 +1624,8 @@ subroutine init_hist (dt)
write(nu_diag,*) 'The following variables will be ', &
'written to the history tape: '
write(nu_diag,101) 'description','units','variable','frequency','x'
if (num_avail_hist_fields_tot == 0) &
write(nu_diag,*) '*** WARNING: NO HISTORY FIELDS WILL BE WRITTEN ***'
do n=1,num_avail_hist_fields_tot
if (avail_hist_fields(n)%vhistfreq_n /= 0) &
write(nu_diag,100) avail_hist_fields(n)%vdesc, &
Expand Down Expand Up @@ -1888,13 +1890,16 @@ subroutine accum_hist (dt)
!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block, &
!$OMP k,n,qn,ns,sn,rho_ocn,rho_ice,Tice,Sbr,phi,rhob,dfresh,dfsalt, &
!$OMP worka,workb,worka3,Tinz4d,Sinz4d,Tsnz4d)

do iblk = 1, nblocks
this_block = get_block(blocks_ice(iblk),iblk)
ilo = this_block%ilo
ihi = this_block%ihi
jlo = this_block%jlo
jhi = this_block%jhi

if (allocated(a2D)) then

workb(:,:) = aice_init(:,:,iblk)

! if (f_example(1:1) /= 'x') &
Expand Down Expand Up @@ -2879,6 +2884,10 @@ subroutine accum_hist (dt)
call accum_hist_field(n_siforceintstry, iblk, worka(:,:), a2D)
endif

endif ! if (allocated(a2D))

if (allocated(a3Dc)) then

! 3D category fields
if (f_aicen (1:1) /= 'x') &
call accum_hist_field(n_aicen-n2D, iblk, ncat_hist, &
Expand Down Expand Up @@ -2959,6 +2968,10 @@ subroutine accum_hist (dt)
call accum_hist_field(n_siitdsnthick-n2D, iblk, ncat_hist, worka3(:,:,:), a3Dc)
endif

endif ! if (allocated(a3Dc))

if (allocated(a4Di)) then

! example for 3D field (x,y,z)
! if (f_field3dz (1:1) /= 'x') &
! call accum_hist_field(n_field3dz-n3Dccum, iblk, nzilyr, &
Expand Down Expand Up @@ -2996,6 +3009,10 @@ subroutine accum_hist (dt)
Sinz4d(:,:,1:nzilyr,1:ncat_hist), a4Di)
endif

endif ! if (allocated(a3Dc))

if (allocated(a4Ds)) then

if (f_Tsnz (1:1) /= 'x') then
Tsnz4d(:,:,:,:) = c0
do n = 1, ncat_hist
Expand All @@ -3012,25 +3029,30 @@ subroutine accum_hist (dt)
Tsnz4d(:,:,1:nzslyr,1:ncat_hist), a4Ds)
endif

! Calculate aggregate surface melt flux by summing category values
if (f_fmeltt_ai(1:1) /= 'x') then
do ns = 1, nstreams
if (n_fmeltt_ai(ns) /= 0) then
worka(:,:) = c0
do j = jlo, jhi
do i = ilo, ihi
if (tmask(i,j,iblk)) then
do n=1,ncat_hist
worka(i,j) = worka(i,j) + a3Dc(i,j,n,n_fmelttn_ai(ns)-n2D,iblk)
enddo ! n
endif ! tmask
enddo ! i
enddo ! j
a2D(:,:,n_fmeltt_ai(ns),iblk) = worka(:,:)
endif
enddo
endif
endif ! if (allocated(a4Ds))

if (allocated(a3Dc) .and. allocated(a2D)) then

! Calculate aggregate surface melt flux by summing category values
if (f_fmeltt_ai(1:1) /= 'x') then
do ns = 1, nstreams
if (n_fmeltt_ai(ns) /= 0) then
worka(:,:) = c0
do j = jlo, jhi
do i = ilo, ihi
if (tmask(i,j,iblk)) then
do n=1,ncat_hist
worka(i,j) = worka(i,j) + a3Dc(i,j,n,n_fmelttn_ai(ns)-n2D,iblk)
enddo ! n
endif ! tmask
enddo ! i
enddo ! j
a2D(:,:,n_fmeltt_ai(ns),iblk) = worka(:,:)
endif
enddo
endif

endif
!---------------------------------------------------------------
! accumulate other history output
!---------------------------------------------------------------
Expand Down
Loading

0 comments on commit 55bf9f4

Please sign in to comment.