Skip to content

Commit

Permalink
Update CICE from Consortium/main, add run-time and history-write logg…
Browse files Browse the repository at this point in the history
…ing (NOAA-EMC#65)
  • Loading branch information
DeniseWorthen authored Sep 7, 2023
1 parent d41c61d commit 2ed3c05
Show file tree
Hide file tree
Showing 39 changed files with 632 additions and 1,078 deletions.
43 changes: 35 additions & 8 deletions .github/workflows/test-cice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: GHActions
on:
push:
branches:
- master
- main
- 'CICE*'
- 'ghactions*'
pull_request:
Expand All @@ -27,8 +27,12 @@ jobs:
matrix:
# os: [macos-latest, ubuntu-latest]
os: [macos-latest]
# os: [macos-13]
# os: [ubuntu-latest]
include:
# - os: macos-13
# envdef: macos
# minicond: Miniconda3-latest-MacOSX-x86_64.sh
- os: macos-latest
envdef: macos
minicond: Miniconda3-latest-MacOSX-x86_64.sh
Expand Down Expand Up @@ -98,10 +102,26 @@ jobs:
conda env create -f configuration/scripts/machines/environment.yml
- name: check conda env
run: |
conda activate cice && which mpicc && which mpifort && which make
conda activate cice && which clang && which gfortran && which mpicc && which mpifort && which make
clang --version
gfortran --version
mpifort --version
mpicc --version
make --version
# echo "mpifort -v:"
# mpifort -v
# echo "mpifort --showme:compile:"
# mpifort --showme:compile
# echo "mpifort --showme:link:"
# mpifort --showme:link
# echo "mpifort --showme:command:"
# mpifort --showme:command
# echo "mpifort --showme:libdirs:"
# mpifort --showme:libdirs
# echo "mpifort --showme:libs:"
# mpifort --showme:libs
# echo "mpifort --showme:incdirs:"
# mpifort --showme:incdirs
- name: check setup case
run: |
cd $HOME/cice
Expand All @@ -110,12 +130,19 @@ jobs:
run: |
cd $HOME/cice
./cice.setup -m conda -e ${{ matrix.envdef }} --test smoke --testid c0
# - name: compile case
# run: |
# cd $HOME/cice
# ./cice.setup -m conda -e ${{ matrix.envdef }} -c case1
# cd case1
# ./cice.build
- name: run hello world unit test
run: |
cd $HOME/cice
./cice.setup -m conda -e ${{ matrix.envdef }} --test unittest --pes 2x1 -s helloworld --testid hw01
cd *helloworld*hw01
./cice.build
./cice.run
- name: check cice compile
run: |
cd $HOME/cice
./cice.setup -m conda -e ${{ matrix.envdef }} -c case1 --pes 2x2 -s diag1
cd case1
./cice.build
- name: download input data
run: |
cd $HOME/cice-dirs/input
Expand Down
225 changes: 3 additions & 222 deletions cicecore/cicedyn/analysis/ice_diagnostics_bgc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module ice_diagnostics_bgc

implicit none
private
public :: hbrine_diags, bgc_diags, zsal_diags
public :: hbrine_diags, bgc_diags

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

Expand Down Expand Up @@ -715,7 +715,7 @@ subroutine bgc_diags
endif
if (tr_bgc_N) then
write(nu_diag,*) '---------------------------------------------------'
write(nu_diag,900) 'tot algal growth (1/d) = ',pgrow_net(1),pgrow_net(2)
write(nu_diag,901) 'tot algal growth (1/d) = ',pgrow_net(1),pgrow_net(2)
do kk = 1,n_algae
write(nu_diag,*) ' algal conc. (mmol N/m^3) or flux (mmol N/m^2/d)'
write(nu_diag,1020) ' type:', kk
Expand Down Expand Up @@ -846,230 +846,11 @@ subroutine bgc_diags
802 format (f24.17,2x,f24.17)
803 format (a25,2x,a25)
900 format (a25,2x,f24.17,2x,f24.17)
901 format (a25,2x,g24.17,2x,g24.17)
1020 format (a30,2x,i6) ! integer

end subroutine bgc_diags

!=======================================================================
!
! Writes diagnostic info (max, min, global sums, etc) to standard out
!
! authors: Elizabeth C. Hunke, LANL
! Bruce P. Briegleb, NCAR
! Cecilia M. Bitz, UW
! Nicole Jeffery, LANL

subroutine zsal_diags

use ice_arrays_column, only: fzsal, fzsal_g, sice_rho, bTiz, &
iDi, bphi, dhbr_top, dhbr_bot, darcy_V
use ice_broadcast, only: broadcast_scalar, broadcast_array
use ice_diagnostics, only: npnt, print_points, pmloc, piloc, pjloc, &
pbloc
use ice_domain_size, only: nblyr, ncat, nilyr
use ice_state, only: aicen, aice, vice, trcr, trcrn, vicen, vsno

! local variables

integer (kind=int_kind) :: &
i, j, k, n, nn, iblk

! fields at diagnostic points
real (kind=dbl_kind), dimension(npnt) :: &
phinS, phinS1,&
phbrn,pdh_top1,pdh_bot1, psice_rho, pfzsal, &
pfzsal_g, pdarcy_V1

! vertical fields of category 1 at diagnostic points for bgc layer model
real (kind=dbl_kind), dimension(npnt,nblyr+2) :: &
pphin, pphin1
real (kind=dbl_kind), dimension(npnt,nblyr) :: &
pSin, pSice, pSin1

real (kind=dbl_kind), dimension(npnt,nblyr+1) :: &
pbTiz, piDin

real (kind=dbl_kind) :: &
rhosi, rhow, rhos

logical (kind=log_kind) :: tr_brine

integer (kind=int_kind) :: nt_fbri, nt_bgc_S, nt_sice
character(len=*), parameter :: subname = '(zsal_diags)'

call icepack_query_parameters(rhosi_out=rhosi, rhow_out=rhow, rhos_out=rhos)
call icepack_query_tracer_flags(tr_brine_out=tr_brine)
call icepack_query_tracer_indices(nt_fbri_out=nt_fbri, nt_bgc_S_out=nt_bgc_S, &
nt_sice_out=nt_sice)
call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
file=__FILE__, line=__LINE__)

!-----------------------------------------------------------------
! salinity and microstructure of the ice
!-----------------------------------------------------------------

if (print_points) then

!-----------------------------------------------------------------
! state of the ice and associated fluxes for 2 defined points
! NOTE these are computed for the last timestep only (not avg)
!-----------------------------------------------------------------

do n = 1, npnt
if (my_task == pmloc(n)) then
i = piloc(n)
j = pjloc(n)
iblk = pbloc(n)

pfzsal(n) = fzsal(i,j,iblk)
pfzsal_g(n) = fzsal_g(i,j,iblk)
phinS(n) = c0
phinS1(n) = c0
phbrn(n) = c0
psice_rho(n) = c0
pdh_top1(n) = c0
pdh_bot1(n) = c0
pdarcy_V1(n) = c0
do nn = 1,ncat
psice_rho(n) = psice_rho(n) + sice_rho(i,j,nn,iblk)*aicen(i,j,nn,iblk)
enddo
if (aice(i,j,iblk) > c0) &
psice_rho(n) = psice_rho(n)/aice(i,j,iblk)
if (tr_brine .and. aice(i,j,iblk) > c0) then
phinS(n) = trcr(i,j,nt_fbri,iblk)*vice(i,j,iblk)/aice(i,j,iblk)
phbrn(n) = (c1 - rhosi/rhow)*vice(i,j,iblk)/aice(i,j,iblk) &
- rhos/rhow *vsno(i,j,iblk)/aice(i,j,iblk)
endif
if (tr_brine .and. aicen(i,j,1,iblk)> c0) then
phinS1(n) = trcrn(i,j,nt_fbri,1,iblk) &
* vicen(i,j,1,iblk)/aicen(i,j,1,iblk)
pdh_top1(n) = dhbr_top(i,j,1,iblk)
pdh_bot1(n) = dhbr_bot(i,j,1,iblk)
pdarcy_V1(n) = darcy_V(i,j,1,iblk)
endif
do k = 1, nblyr+1
pbTiz(n,k) = c0
piDin(n,k) = c0
do nn = 1,ncat
pbTiz(n,k) = pbTiz(n,k) + bTiz(i,j,k,nn,iblk)*vicen(i,j,nn,iblk)
piDin(n,k) = piDin(n,k) + iDi(i,j,k,nn,iblk)*vicen(i,j,nn,iblk)
enddo
if (vice(i,j,iblk) > c0) then
pbTiz(n,k) = pbTiz(n,k)/vice(i,j,iblk)
piDin(n,k) = piDin(n,k)/vice(i,j,iblk)
endif
enddo ! k
do k = 1, nblyr+2
pphin(n,k) = c0
pphin1(n,k) = c0
if (aicen(i,j,1,iblk) > c0) pphin1(n,k) = bphi(i,j,k,1,iblk)
do nn = 1,ncat
pphin(n,k) = pphin(n,k) + bphi(i,j,k,nn,iblk)*vicen(i,j,nn,iblk)
enddo
if (vice(i,j,iblk) > c0) then
pphin(n,k) = pphin(n,k)/vice(i,j,iblk)
endif
enddo
do k = 1,nblyr
pSin(n,k) = c0
pSin1(n,k) = c0
pSin(n,k)= trcr(i,j,nt_bgc_S+k-1,iblk)
if (aicen(i,j,1,iblk) > c0) pSin1(n,k) = trcrn(i,j,nt_bgc_S+k-1,1,iblk)
enddo
do k = 1,nilyr
pSice(n,k) = trcr(i,j,nt_sice+k-1,iblk)
enddo
endif ! my_task = pmloc

call broadcast_scalar(phinS (n), pmloc(n))
call broadcast_scalar(phinS1 (n), pmloc(n))
call broadcast_scalar(phbrn (n), pmloc(n))
call broadcast_scalar(pdh_top1 (n), pmloc(n))
call broadcast_scalar(pdh_bot1 (n), pmloc(n))
call broadcast_scalar(psice_rho(n), pmloc(n))
call broadcast_scalar(pfzsal_g (n), pmloc(n))
call broadcast_scalar(pdarcy_V1(n), pmloc(n))
call broadcast_scalar(pfzsal (n), pmloc(n))
call broadcast_array (pbTiz (n,:), pmloc(n))
call broadcast_array (piDin (n,:), pmloc(n))
call broadcast_array (pphin (n,:), pmloc(n))
call broadcast_array (pphin1 (n,:), pmloc(n))
call broadcast_array (pSin (n,:), pmloc(n))
call broadcast_array (pSin1 (n,:), pmloc(n))
call broadcast_array (pSice (n,:), pmloc(n))
enddo ! npnt
endif ! print_points

!-----------------------------------------------------------------
! start spewing
!-----------------------------------------------------------------

if (my_task == master_task) then

call flush_fileunit(nu_diag)

!-----------------------------------------------------------------
! diagnostics for Arctic and Antarctic points
!-----------------------------------------------------------------

if (print_points) then

write(nu_diag,*) ' '
write(nu_diag,902) ' Brine height '
write(nu_diag,900) 'hbrin = ',phinS(1),phinS(2)
write(nu_diag,900) 'hbrin cat 1 = ',phinS1(1),phinS1(2)
write(nu_diag,900) 'Freeboard = ',phbrn(1),phbrn(2)
write(nu_diag,900) 'dhbrin cat 1 top = ',pdh_top1(1),pdh_top1(2)
write(nu_diag,900) 'dhbrin cat 1 bottom = ',pdh_bot1(1),pdh_bot1(2)
write(nu_diag,*) ' '
write(nu_diag,902) ' zSalinity '
write(nu_diag,900) 'Avg density (kg/m^3) = ',psice_rho(1),psice_rho(2)
write(nu_diag,900) 'Salt flux (kg/m^2/s) = ',pfzsal(1),pfzsal(2)
write(nu_diag,900) 'Grav. Drain. Salt flux = ',pfzsal_g(1),pfzsal_g(2)
write(nu_diag,900) 'Darcy V cat 1 (m/s) = ',pdarcy_V1(1),pdarcy_V1(2)
write(nu_diag,*) ' '
write(nu_diag,*) ' Top down bgc Layer Model'
write(nu_diag,*) ' '
write(nu_diag,803) 'bTiz(1) ice temp',' bTiz(2) ice temp '
write(nu_diag,*) '---------------------------------------------------'
write(nu_diag,802) ((pbTiz(n,k),n = 1,2), k = 1,nblyr+1)
write(nu_diag,*) ' '
write(nu_diag,803) 'iDi(1) diffusivity ','iDi(2) diffusivity '
write(nu_diag,*) '---------------------------------------------------'
write(nu_diag,802) ((piDin(n,k),n=1,2), k = 1,nblyr+1)
write(nu_diag,*) ' '
write(nu_diag,803) 'bphi(1) porosity ','bphi(2) porosity '
write(nu_diag,*) '---------------------------------------------------'
write(nu_diag,802) ((pphin(n,k),n=1,2), k = 1,nblyr+1)
write(nu_diag,*) ' '
write(nu_diag,803) 'phi1(1) porosity ','phi1(2) porosity '
write(nu_diag,*) '---------------------------------------------------'
write(nu_diag,802) ((pphin1(n,k),n=1,2), k = 1,nblyr+1)
write(nu_diag,*) ' '
write(nu_diag,803) 'zsal(1) cat 1 ','zsal(2) cat 1 '
write(nu_diag,*) '---------------------------------------------------'
write(nu_diag,802) ((pSin1(n,k),n=1,2), k = 1,nblyr)
write(nu_diag,*) ' '
write(nu_diag,803) 'zsal(1) Avg S ','zsal(2) Avg S '
write(nu_diag,*) '---------------------------------------------------'
write(nu_diag,802) ((pSin(n,k),n=1,2), k = 1,nblyr)
write(nu_diag,*) ' '
write(nu_diag,803) 'Sice(1) Ice S ','Sice(2) Ice S '
write(nu_diag,*) '---------------------------------------------------'
write(nu_diag,802) ((pSice(n,k),n=1,2), k = 1,nilyr)
write(nu_diag,*) ' '

endif ! print_points
endif ! my_task = master_task

802 format (f24.17,2x,f24.17)
803 format (a25,2x,a25)
900 format (a25,2x,f24.17,2x,f24.17)
902 format (a25,10x,f6.1,1x,f6.1,9x,f6.1,1x,f6.1)

end subroutine zsal_diags

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

end module ice_diagnostics_bgc
Expand Down
4 changes: 2 additions & 2 deletions cicecore/cicedyn/analysis/ice_history.F90
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ subroutine init_hist (dt)
logical (kind=log_kind) :: formdrag
logical (kind=log_kind) :: tr_iage, tr_FY, tr_lvl, tr_pond, tr_aero, tr_brine
logical (kind=log_kind) :: tr_fsd, tr_snow
logical (kind=log_kind) :: skl_bgc, solve_zsal, solve_zbgc, z_tracers
logical (kind=log_kind) :: skl_bgc, solve_zbgc, z_tracers
integer (kind=int_kind) :: n, ns, ns1, ns2
integer (kind=int_kind), dimension(max_nstrm) :: &
ntmp
Expand Down Expand Up @@ -222,7 +222,7 @@ subroutine init_hist (dt)
call icepack_query_parameters(rhofresh_out=rhofresh, Tffresh_out=Tffresh, &
secday_out=secday, rad_to_deg_out=rad_to_deg)
call icepack_query_parameters(formdrag_out=formdrag, skl_bgc_out=skl_bgc, &
solve_zsal_out=solve_zsal, solve_zbgc_out=solve_zbgc, z_tracers_out=z_tracers)
solve_zbgc_out=solve_zbgc, z_tracers_out=z_tracers)
call icepack_query_tracer_flags(tr_iage_out=tr_iage, tr_FY_out=tr_FY, &
tr_lvl_out=tr_lvl, tr_pond_out=tr_pond, tr_aero_out=tr_aero, &
tr_brine_out=tr_brine, tr_fsd_out=tr_fsd, tr_snow_out=tr_snow)
Expand Down
Loading

0 comments on commit 2ed3c05

Please sign in to comment.