Skip to content

Commit

Permalink
Update CICE to latest Consortium/main (NOAA-EMC#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeniseWorthen committed May 10, 2024
1 parent 2ce5a8b commit a616e29
Show file tree
Hide file tree
Showing 27 changed files with 2,519 additions and 2,528 deletions.
2 changes: 1 addition & 1 deletion cicecore/cicedyn/analysis/ice_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1706,7 +1706,7 @@ subroutine print_state(plabel,i,j,iblk)
! dynamics (transport and/or ridging) causes the floe size distribution to become non-normal
! if (tr_fsd) then
! if (abs(sum(trcrn(i,j,nt_fsd:nt_fsd+nfsd-1,n,iblk))-c1) > puny) &
! print*,'afsdn not normal', &
! write(nu_diag,*) 'afsdn not normal', &
! sum(trcrn(i,j,nt_fsd:nt_fsd+nfsd-1,n,iblk)), &
! trcrn(i,j,nt_fsd:nt_fsd+nfsd-1,n,iblk)
! endif
Expand Down
29 changes: 16 additions & 13 deletions cicecore/cicedyn/analysis/ice_history.F90
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ subroutine init_hist (dt)
integer (kind=int_kind), dimension(max_nstrm) :: &
ntmp
integer (kind=int_kind) :: nml_error ! namelist i/o error flag

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

!-----------------------------------------------------------------
Expand Down Expand Up @@ -121,25 +122,27 @@ subroutine init_hist (dt)
if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
file=__FILE__, line=__LINE__)

call get_fileunit(nu_nml)
if (my_task == master_task) then
open (nu_nml, file=nml_filename, status='old',iostat=nml_error)
write(nu_diag,*) subname,' Reading icefields_nml'

call get_fileunit(nu_nml)
open (nu_nml, file=trim(nml_filename), status='old',iostat=nml_error)
if (nml_error /= 0) then
nml_error = -1
else
nml_error = 1
call abort_ice(subname//'ERROR: icefields_nml open file '// &
trim(nml_filename), &
file=__FILE__, line=__LINE__)
endif

nml_error = 1
do while (nml_error > 0)
read(nu_nml, nml=icefields_nml,iostat=nml_error)
end do
if (nml_error == 0) close(nu_nml)
endif
call release_fileunit(nu_nml)

call broadcast_scalar(nml_error, master_task)
if (nml_error /= 0) then
close (nu_nml)
call abort_ice(subname//'ERROR: reading icefields_nml')
if (nml_error /= 0) then
call abort_ice(subname//'ERROR: icefields_nml reading ', &
file=__FILE__, line=__LINE__)
endif
close(nu_nml)
call release_fileunit(nu_nml)
endif

! histfreq options ('1','h','d','m','y')
Expand Down
31 changes: 17 additions & 14 deletions cicecore/cicedyn/analysis/ice_history_bgc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ subroutine init_hist_bgc_2D
tr_bgc_N, tr_bgc_C, tr_bgc_chl, &
tr_bgc_DON, tr_bgc_Fe, tr_bgc_hum, &
skl_bgc, solve_zsal, z_tracers
character(len=*), parameter :: subname = '(init_hist_bgc_2D)'

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

call icepack_query_parameters(skl_bgc_out=skl_bgc, &
solve_zsal_out=solve_zsal, z_tracers_out=z_tracers)
Expand All @@ -303,25 +304,27 @@ subroutine init_hist_bgc_2D
! read namelist
!-----------------------------------------------------------------

call get_fileunit(nu_nml)
if (my_task == master_task) then
open (nu_nml, file=nml_filename, status='old',iostat=nml_error)
write(nu_diag,*) subname,' Reading icefields_bgc_nml'

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

nml_error = 1
do while (nml_error > 0)
read(nu_nml, nml=icefields_bgc_nml,iostat=nml_error)
end do
if (nml_error == 0) close(nu_nml)
endif
call release_fileunit(nu_nml)

call broadcast_scalar(nml_error, master_task)
if (nml_error /= 0) then
close (nu_nml)
call abort_ice(subname//'ERROR: reading icefields_bgc_nml')
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

if (.not. tr_iso) then
Expand Down
80 changes: 31 additions & 49 deletions cicecore/cicedyn/analysis/ice_history_drag.F90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
!=======================================================================

! 2013 module for form drag parameters
! authors Michel Tsamados, David Schroeder, CPOM
! authors Michel Tsamados, David Schroeder, CPOM

module ice_history_drag

Expand All @@ -17,7 +17,7 @@ module ice_history_drag
implicit none
private
public :: accum_hist_drag, init_hist_drag_2D

!---------------------------------------------------------------
! flags: write to output file if true or histfreq value
!---------------------------------------------------------------
Expand All @@ -31,7 +31,7 @@ module ice_history_drag
!---------------------------------------------------------------

namelist / icefields_drag_nml / &
f_Cdn_atm, f_Cdn_ocn , &
f_Cdn_atm, f_Cdn_ocn , &
f_drag

!---------------------------------------------------------------
Expand All @@ -47,7 +47,7 @@ module ice_history_drag
n_Cdn_atm_skin , n_Cdn_atm_floe, &
n_Cdn_atm_pond , n_Cdn_atm_rdg, &
n_Cdn_ocn_skin , n_Cdn_ocn_floe, &
n_Cdn_ocn_keel , n_Cdn_atm_ratio
n_Cdn_ocn_keel , n_Cdn_atm_ratio

!=======================================================================

Expand All @@ -64,13 +64,10 @@ subroutine init_hist_drag_2D
use ice_calendar, only: nstreams
use ice_communicate, only: my_task, master_task
use ice_history_shared, only: tstr2D, tcstr, define_hist_field
use ice_fileunits, only: goto_nml

integer (kind=int_kind) :: ns
integer (kind=int_kind) :: nml_error ! namelist i/o error flag
logical (kind=log_kind) :: formdrag
character(len=char_len_long) :: tmpstr2 ! for namelist check
character(len=char_len) :: nml_name ! for namelist check

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

Expand All @@ -84,39 +81,24 @@ subroutine init_hist_drag_2D
!-----------------------------------------------------------------

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

! 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
call abort_ice(subname//'ERROR: '//trim(nml_name)//' open file '// &
call abort_ice(subname//'ERROR: icefields_drag_nml open file '// &
trim(nml_filename), &
file=__FILE__, line=__LINE__)
endif

! go to this namelist
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_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

if (nml_error /= 0) then
call abort_ice(subname//'ERROR: icefields_drag_nml reading ', &
file=__FILE__, line=__LINE__)
endif
close(nu_nml)
call release_fileunit(nu_nml)
endif
Expand All @@ -142,43 +124,43 @@ subroutine init_hist_drag_2D
"hdraft: draught", &
"none", c1, c0, &
ns, f_drag)

if (f_drag(1:1) /= 'x') &
call define_hist_field(n_hridge,"hridge","m",tstr2D, tcstr, &
"hridge: ridge height", &
"none", c1, c0, &
ns, f_drag)

if (f_drag(1:1) /= 'x') &
call define_hist_field(n_distrdg,"distrdg","m",tstr2D, tcstr, &
"distrdg: distance between ridges", &
"none", c1, c0, &
ns, f_drag)
ns, f_drag)

if (f_drag(1:1) /= 'x') &
call define_hist_field(n_hkeel,"hkeel","m",tstr2D, tcstr, &
"hkeel: keel depth", &
"none", c1, c0, &
ns, f_drag)

if (f_drag(1:1) /= 'x') &
call define_hist_field(n_dkeel,"dkeel","m",tstr2D, tcstr, &
"dkeel: distance between keels", &
"none", c1, c0, &
ns, f_drag)
ns, f_drag)

if (f_drag(1:1) /= 'x') &
call define_hist_field(n_lfloe,"lfloe","m",tstr2D, tcstr, &
"lfloe: floe length", &
"none", c1, c0, &
ns, f_drag)

if (f_drag(1:1) /= 'x') &
call define_hist_field(n_dfloe,"dfloe","m",tstr2D, tcstr, &
"dfloe: distance between floes", &
"none", c1, c0, &
ns, f_drag)

ns, f_drag)
if (f_Cdn_atm(1:1) /= 'x') &
call define_hist_field(n_Cdn_atm,"Cdn_atm","none",tstr2D, tcstr, &
"Ca: total ice-atm drag coefficient", &
Expand All @@ -190,49 +172,49 @@ subroutine init_hist_drag_2D
"Cdn_ocn: total ice-ocn drag coefficient", &
"none", c1, c0, &
ns, f_Cdn_ocn)

if (f_drag(1:1) /= 'x') &
call define_hist_field(n_Cdn_atm_skin,"Cdn_atm_skin","none", &
tstr2D, tcstr, &
"Cdn_atm_skin: neutral skin ice-atm drag coefficient", &
"none", c1, c0, &
ns, f_drag)

if (f_drag(1:1) /= 'x') &
call define_hist_field(n_Cdn_atm_floe,"Cdn_atm_floe","none", &
tstr2D, tcstr, &
"Cdn_atm_floe: neutral floe edge ice-atm drag coefficient", &
"none", c1, c0, &
ns, f_drag)

ns, f_drag)
if (f_drag(1:1) /= 'x') &
call define_hist_field(n_Cdn_atm_pond,"Cdn_atm_pond","none", &
tstr2D, tcstr, &
"Cdn_atm_pond: neutral pond edge ice-atm drag coefficient", &
"none", c1, c0, &
ns, f_drag)

if (f_drag(1:1) /= 'x') &
call define_hist_field(n_Cdn_atm_rdg,"Cdn_atm_rdg","none", &
tstr2D, tcstr, &
"Cdn_atm_rdg: neutral ridge ice-atm drag coefficient", &
"none", c1, c0, &
ns, f_drag)

if (f_drag(1:1) /= 'x') &
call define_hist_field(n_Cdn_ocn_skin,"Cdn_ocn_skin","none", &
tstr2D, tcstr, &
"Cdn_ocn_skin: neutral skin ice-ocn drag coefficient", &
"none", c1, c0, &
ns, f_drag)

if (f_drag(1:1) /= 'x') &
call define_hist_field(n_Cdn_ocn_floe,"Cdn_ocn_floe","none", &
tstr2D, tcstr, &
"Cdn_ocn_floe: neutral floe edge ice-ocn drag coefficient", &
"none", c1, c0, &
ns, f_drag)

ns, f_drag)
if (f_drag(1:1) /= 'x') &
call define_hist_field(n_Cdn_ocn_keel,"Cdn_ocn_keel","none", &
tstr2D, tcstr, &
Expand Down Expand Up @@ -299,21 +281,21 @@ subroutine accum_hist_drag (iblk)
call accum_hist_field(n_lfloe, iblk, lfloe(:,:,iblk), a2D)
call accum_hist_field(n_dfloe, iblk, dfloe(:,:,iblk), a2D)
call accum_hist_field(n_Cdn_atm_rdg, &
iblk, Cdn_atm_rdg(:,:,iblk), a2D)
iblk, Cdn_atm_rdg(:,:,iblk), a2D)
call accum_hist_field(n_Cdn_atm_floe, &
iblk, Cdn_atm_floe(:,:,iblk), a2D)
call accum_hist_field(n_Cdn_atm_pond, &
iblk, Cdn_atm_pond(:,:,iblk), a2D)
call accum_hist_field(n_Cdn_atm_skin, &
iblk, Cdn_atm_skin(:,:,iblk), a2D)
iblk, Cdn_atm_skin(:,:,iblk), a2D)
call accum_hist_field(n_Cdn_atm_ratio, &
iblk, Cdn_atm_ratio(:,:,iblk), a2D)
call accum_hist_field(n_Cdn_ocn_keel, &
iblk, Cdn_ocn_keel(:,:,iblk), a2D)
iblk, Cdn_ocn_keel(:,:,iblk), a2D)
call accum_hist_field(n_Cdn_ocn_floe, &
iblk, Cdn_ocn_floe(:,:,iblk), a2D)
call accum_hist_field(n_Cdn_ocn_skin, &
iblk, Cdn_ocn_skin(:,:,iblk), a2D)
iblk, Cdn_ocn_skin(:,:,iblk), a2D)
end if

endif ! if(allocated(a2D))
Expand Down
Loading

0 comments on commit a616e29

Please sign in to comment.