Skip to content

Commit

Permalink
Update CICE for latest Consortium/main (NOAA-EMC#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeniseWorthen committed Sep 22, 2023
1 parent bbf899a commit 630d1b3
Show file tree
Hide file tree
Showing 53 changed files with 6,653 additions and 21,300 deletions.
20 changes: 20 additions & 0 deletions cice.setup
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,27 @@ if ( ${dosuite} == 0 ) then
set sets = ""
else
<<<<<<< HEAD
set tarrays = `echo ${testsuite} | sed 's/,/ /g' | fmt -1 | sort -u`
=======
# generate unique set of suites in tarrays in order they are set
set tarrays0 = `echo ${testsuite} | sed 's/,/ /g' | fmt -1 `
#echo "${0}: tarrays0 = ${tarrays0}"
set tarrays = $tarrays0[1]
foreach t1 ( ${tarrays0} )
set found = 0
foreach t2 ( ${tarrays} )
if ( ${t1} == ${t2} ) then
set found = 1
endif
end
if ( ${found} == 0 ) then
set tarrays = ( ${tarrays} ${t1} )
endif
end
#echo "${0}: tarrays = ${tarrays}"
set testsuitecnt = 0
>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))
foreach tarray ( ${tarrays} )
if (-e ${tarray}) then
cat ${tarray} >> $tsfile
Expand Down
45 changes: 37 additions & 8 deletions cicecore/cicedyn/analysis/ice_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ module ice_diagnostics
totms , & ! total ice/snow water mass (sh)
totmin , & ! total ice water mass (nh)
totmis , & ! total ice water mass (sh)
totsn , & ! total salt mass (nh)
totss , & ! total salt mass (sh)
toten , & ! total ice/snow energy (J)
totes ! total ice/snow energy (J)

Expand Down Expand Up @@ -152,14 +154,16 @@ subroutine runtime_diags (dt)
rhofresh, lfresh, lvap, ice_ref_salinity, Tffresh

character (len=char_len) :: &
snwredist
snwredist, saltflux_option

! hemispheric state quantities
real (kind=dbl_kind) :: &
umaxn, hmaxn, shmaxn, arean, snwmxn, extentn, shmaxnt, &
umaxs, hmaxs, shmaxs, areas, snwmxs, extents, shmaxst, &
etotn, mtotn, micen, msnwn, pmaxn, ketotn, &
etots, mtots, mices, msnws, pmaxs, ketots, &
stotn, &
stots, &
urmsn, albtotn, arean_alb, mpndn, ptotn, spondn, &
urmss, albtots, areas_alb, mpnds, ptots, sponds

Expand Down Expand Up @@ -233,7 +237,7 @@ subroutine runtime_diags (dt)
awtvdr_out=awtvdr, awtidr_out=awtidr, awtvdf_out=awtvdf, awtidf_out=awtidf, &
rhofresh_out=rhofresh, lfresh_out=lfresh, lvap_out=lvap, &
ice_ref_salinity_out=ice_ref_salinity,snwredist_out=snwredist, &
snwgrain_out=snwgrain)
snwgrain_out=snwgrain, saltflux_option_out=saltflux_option)
call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
file=__FILE__, line=__LINE__)
Expand Down Expand Up @@ -513,6 +517,15 @@ subroutine runtime_diags (dt)
etots = global_sum(work1, distrb_info, &
field_loc_center, tareas)

! total salt volume
call total_salt (work2)

stotn = global_sum(work2, distrb_info, &
field_loc_center, tarean)
stots = global_sum(work2, distrb_info, &
field_loc_center, tareas)


!-----------------------------------------------------------------
! various fluxes
!-----------------------------------------------------------------
Expand Down Expand Up @@ -763,12 +776,22 @@ subroutine runtime_diags (dt)
swerrs = (fswnets - fswdns) / (fswnets - c1)

! salt mass
msltn = micen*ice_ref_salinity*p001
mslts = mices*ice_ref_salinity*p001
if (saltflux_option == 'prognostic') then
! compute the total salt mass
msltn = stotn*rhoi*p001
mslts = stots*rhoi*p001

! change in salt mass
delmsltn = rhoi*(stotn-totsn)*p001
delmslts = rhoi*(stots-totss)*p001
else
msltn = micen*ice_ref_salinity*p001
mslts = mices*ice_ref_salinity*p001

! change in salt mass
delmsltn = delmxn*ice_ref_salinity*p001
delmslts = delmxs*ice_ref_salinity*p001
! change in salt mass
delmsltn = delmxn*ice_ref_salinity*p001
delmslts = delmxs*ice_ref_salinity*p001
endif

! salt error
serrn = (sfsaltn + delmsltn) / (msltn + c1)
Expand Down Expand Up @@ -1229,7 +1252,7 @@ subroutine init_mass_diags
rhoi, rhos, rhofresh

real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks) :: &
work1
work1, work2

character(len=*), parameter :: subname = '(init_mass_diags)'

Expand Down Expand Up @@ -1264,6 +1287,12 @@ subroutine init_mass_diags
toten = global_sum(work1, distrb_info, field_loc_center, tarean)
totes = global_sum(work1, distrb_info, field_loc_center, tareas)

! north/south salt
call total_salt (work2)
totsn = global_sum(work2, distrb_info, field_loc_center, tarean)
totss = global_sum(work2, distrb_info, field_loc_center, tareas)


if (print_points) then
do n = 1, npnt
if (my_task == pmloc(n)) then
Expand Down
31 changes: 31 additions & 0 deletions cicecore/cicedyn/analysis/ice_history.F90
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,11 @@ subroutine init_hist (dt)
character(len=char_len) :: description
character(len=char_len_long) :: tmpstr2 ! for namelist check
character(len=char_len) :: nml_name ! text namelist name
<<<<<<< HEAD
=======
>>>>>>> 27dfd1b6 (Update CICE to latest Consortium/main (#45)):cicecore/cicedynB/analysis/ice_history.F90
=======
>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))

character(len=*), parameter :: subname = '(init_hist)'

Expand Down Expand Up @@ -241,6 +244,7 @@ subroutine init_hist (dt)
file=__FILE__, line=__LINE__)

if (my_task == master_task) then
<<<<<<< HEAD
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history.F90
nml_name = 'icefields_nml'
write(nu_diag,*) subname,' Reading ', trim(nml_name)
Expand All @@ -252,17 +256,29 @@ subroutine init_hist (dt)
call abort_ice(subname//'ERROR: '//trim(nml_name)//' open file '// &
=======
write(nu_diag,*) subname,' Reading icefields_nml'
=======
nml_name = 'icefields_nml'
write(nu_diag,*) subname,' Reading ', trim(nml_name)
>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))

! open file
call get_fileunit(nu_nml)
open (nu_nml, file=trim(nml_filename), status='old',iostat=nml_error)
if (nml_error /= 0) then
<<<<<<< HEAD
call abort_ice(subname//'ERROR: icefields_nml open file '// &
>>>>>>> 27dfd1b6 (Update CICE to latest Consortium/main (#45)):cicecore/cicedynB/analysis/ice_history.F90
=======
call abort_ice(subname//'ERROR: '//trim(nml_name)//' open file '// &
>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))
trim(nml_filename), &
file=__FILE__, line=__LINE__)
endif

<<<<<<< HEAD
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history.F90
=======
>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))
! seek to this namelist
call goto_nml(nu_nml,trim(nml_name),nml_error)
if (nml_error /= 0) then
Expand All @@ -271,8 +287,11 @@ subroutine init_hist (dt)
endif

! read namelist
<<<<<<< HEAD
=======
>>>>>>> 27dfd1b6 (Update CICE to latest Consortium/main (#45)):cicecore/cicedynB/analysis/ice_history.F90
=======
>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))
nml_error = 1
do while (nml_error > 0)
read(nu_nml, nml=icefields_nml,iostat=nml_error)
Expand All @@ -285,6 +304,7 @@ subroutine init_hist (dt)
trim(tmpstr2), file=__FILE__, line=__LINE__)
endif
end do
<<<<<<< HEAD
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history.F90

=======
Expand All @@ -293,6 +313,9 @@ subroutine init_hist (dt)
file=__FILE__, line=__LINE__)
endif
>>>>>>> 27dfd1b6 (Update CICE to latest Consortium/main (#45)):cicecore/cicedynB/analysis/ice_history.F90
=======

>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))
close(nu_nml)
call release_fileunit(nu_nml)
endif
Expand Down Expand Up @@ -1365,20 +1388,28 @@ subroutine init_hist (dt)
"sig1 is instantaneous" // trim(description), c1, c0, &
ns1, f_sig1)

<<<<<<< HEAD
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history.F90
call define_hist_field(n_sig2,"sig2","1",gridstr2d, gridstr, &
=======
call define_hist_field(n_sig2,"sig2","1",ustr2D, ucstr, &
>>>>>>> 968a0edc (Add wave-cice coupling; update to Consortium main (#51)):cicecore/cicedynB/analysis/ice_history.F90
=======
call define_hist_field(n_sig2,"sig2","1",gridstr2d, gridstr, &
>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))
"norm. principal stress 2", &
"sig2 is instantaneous" // trim(description), c1, c0, &
ns1, f_sig2)

<<<<<<< HEAD
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history.F90
call define_hist_field(n_sigP,"sigP","N/m",gridstr2d, gridstr, &
=======
call define_hist_field(n_sigP,"sigP","1",ustr2D, ucstr, &
>>>>>>> 968a0edc (Add wave-cice coupling; update to Consortium main (#51)):cicecore/cicedynB/analysis/ice_history.F90
=======
call define_hist_field(n_sigP,"sigP","1",gridstr2d, gridstr, &
>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))
"ice pressure", &
"sigP is instantaneous" // trim(description), c1, c0, &
ns1, f_sigP)
Expand Down
31 changes: 25 additions & 6 deletions cicecore/cicedyn/analysis/ice_history_bgc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ subroutine init_hist_bgc_2D
use ice_communicate, only: my_task, master_task
use ice_history_shared, only: tstr2D, tcstr, define_hist_field, &
f_fsalt, f_fsalt_ai, f_sice
use ice_fileunits, only: goto_nml

integer (kind=int_kind) :: n, ns
integer (kind=int_kind) :: nml_error ! namelist i/o error flag
Expand All @@ -283,6 +284,9 @@ subroutine init_hist_bgc_2D
tr_bgc_DON, tr_bgc_Fe, tr_bgc_hum, &
skl_bgc, solve_zsal, z_tracers

character(len=char_len) :: nml_name ! for namelist check
character(len=char_len_long) :: tmpstr2 ! for namelist check

character(len=*), parameter :: subname = '(init_hist_bgc_2D)'

call icepack_query_parameters(skl_bgc_out=skl_bgc, &
Expand All @@ -305,24 +309,39 @@ subroutine init_hist_bgc_2D
!-----------------------------------------------------------------

if (my_task == master_task) then
write(nu_diag,*) subname,' Reading icefields_bgc_nml'
nml_name = 'icefields_bgc_nml'
write(nu_diag,*) subname,' Reading ', trim(nml_name)

! check if can open file
call get_fileunit(nu_nml)
open (nu_nml, file=trim(nml_filename), status='old',iostat=nml_error)
if (nml_error /= 0) then
call abort_ice(subname//'ERROR: icefields_bgc_nml open file '// &
call abort_ice(subname//'ERROR: '//trim(nml_name)//' open file '// &
trim(nml_filename), &
file=__FILE__, line=__LINE__)
endif

! seek to namelist in file
call goto_nml(nu_nml,trim(nml_name),nml_error)
if (nml_error /= 0) then
call abort_ice(subname//'ERROR: searching for '// trim(nml_name), &
file=__FILE__, line=__LINE__)
endif

! read namelist
nml_error = 1
do while (nml_error > 0)
read(nu_nml, nml=icefields_bgc_nml,iostat=nml_error)
! check if error
if (nml_error /= 0) then
! backspace and re-read erroneous line
backspace(nu_nml)
read(nu_nml,fmt='(A)') tmpstr2
call abort_ice(subname//'ERROR: ' // trim(nml_name) // ' reading ' // &
trim(tmpstr2), file=__FILE__, line=__LINE__)
endif
end do
if (nml_error /= 0) then
call abort_ice(subname//'ERROR: icefields_bgc_nml reading ', &
file=__FILE__, line=__LINE__)
endif

close(nu_nml)
call release_fileunit(nu_nml)
endif
Expand Down
33 changes: 33 additions & 0 deletions cicecore/cicedyn/analysis/ice_history_drag.F90
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,16 @@ subroutine init_hist_drag_2D
integer (kind=int_kind) :: ns
integer (kind=int_kind) :: nml_error ! namelist i/o error flag
logical (kind=log_kind) :: formdrag
<<<<<<< HEAD
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history_drag.F90
character(len=char_len_long) :: tmpstr2 ! for namelist check
character(len=char_len) :: nml_name ! for namelist check
=======
>>>>>>> 27dfd1b6 (Update CICE to latest Consortium/main (#45)):cicecore/cicedynB/analysis/ice_history_drag.F90
=======
character(len=char_len_long) :: tmpstr2 ! for namelist check
character(len=char_len) :: nml_name ! for namelist check
>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))

character(len=*), parameter :: subname = '(init_hist_drag_2D)'

Expand All @@ -87,6 +92,7 @@ subroutine init_hist_drag_2D
!-----------------------------------------------------------------

if (my_task == master_task) then
<<<<<<< HEAD
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history_drag.F90
nml_name = 'icefields_drag_nml'
write(nu_diag,*) subname,' Reading ', trim(nml_name)
Expand All @@ -98,17 +104,29 @@ subroutine init_hist_drag_2D
call abort_ice(subname//'ERROR: '//trim(nml_name)//' open file '// &
=======
write(nu_diag,*) subname,' Reading icefields_drag_nml'
=======
nml_name = 'icefields_drag_nml'
write(nu_diag,*) subname,' Reading ', trim(nml_name)
>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))

! open namelist file
call get_fileunit(nu_nml)
open (nu_nml, file=trim(nml_filename), status='old',iostat=nml_error)
if (nml_error /= 0) then
<<<<<<< HEAD
call abort_ice(subname//'ERROR: icefields_drag_nml open file '// &
>>>>>>> 27dfd1b6 (Update CICE to latest Consortium/main (#45)):cicecore/cicedynB/analysis/ice_history_drag.F90
=======
call abort_ice(subname//'ERROR: '//trim(nml_name)//' open file '// &
>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))
trim(nml_filename), &
file=__FILE__, line=__LINE__)
endif

<<<<<<< HEAD
<<<<<<< HEAD:cicecore/cicedyn/analysis/ice_history_drag.F90
=======
>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))
! go to this namelist
call goto_nml(nu_nml,trim(nml_name),nml_error)
if (nml_error /= 0) then
Expand All @@ -117,6 +135,7 @@ subroutine init_hist_drag_2D
endif

! read namelist
<<<<<<< HEAD
nml_error = 1
do while (nml_error > 0)
read(nu_nml, nml=icefields_drag_nml,iostat=nml_error)
Expand All @@ -131,15 +150,29 @@ subroutine init_hist_drag_2D
end do

=======
=======
>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))
nml_error = 1
do while (nml_error > 0)
read(nu_nml, nml=icefields_drag_nml,iostat=nml_error)
! check if error
if (nml_error /= 0) then
! backspace and re-read erroneous line
backspace(nu_nml)
read(nu_nml,fmt='(A)') tmpstr2
call abort_ice(subname//'ERROR: ' // trim(nml_name) // ' reading ' // &
trim(tmpstr2), file=__FILE__, line=__LINE__)
endif
end do
<<<<<<< HEAD
if (nml_error /= 0) then
call abort_ice(subname//'ERROR: icefields_drag_nml reading ', &
file=__FILE__, line=__LINE__)
endif
>>>>>>> 27dfd1b6 (Update CICE to latest Consortium/main (#45)):cicecore/cicedynB/analysis/ice_history_drag.F90
=======

>>>>>>> e628a9a6 (Update CICE for latest Consortium/main (#56))
close(nu_nml)
call release_fileunit(nu_nml)
endif
Expand Down
Loading

0 comments on commit 630d1b3

Please sign in to comment.