Skip to content

Commit

Permalink
Merge branch 'main' into neweap
Browse files Browse the repository at this point in the history
  • Loading branch information
TillRasmussen committed Feb 19, 2022
2 parents 34b074c + d1e972a commit dbbad0d
Show file tree
Hide file tree
Showing 83 changed files with 1,506 additions and 688 deletions.
13 changes: 6 additions & 7 deletions cicecore/cicedynB/analysis/ice_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ subroutine runtime_diags (dt)
fisoon(n) = fisoon(n)*dt
fisoos(n) = fisoos(n)*dt

!$OMP PARALLEL DO PRIVATE(iblk,i,j)
!$OMP PARALLEL DO PRIVATE(iblk,i,j,k)
do iblk = 1, nblocks
do j = 1, ny_block
do i = 1, nx_block
Expand Down Expand Up @@ -1214,7 +1214,7 @@ subroutine init_mass_diags

if (tr_iso) then
do n=1,n_iso
!$OMP PARALLEL DO PRIVATE(iblk,i,j)
!$OMP PARALLEL DO PRIVATE(iblk,i,j,k)
do iblk = 1, nblocks
do j = 1, ny_block
do i = 1, nx_block
Expand Down Expand Up @@ -1317,7 +1317,6 @@ subroutine total_energy (work)
if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
file=__FILE__, line=__LINE__)

! MHRI: CHECK THIS OMP
!$OMP PARALLEL DO PRIVATE(iblk,i,j,n,k,ij,icells,indxi,indxj)
do iblk = 1, nblocks

Expand Down Expand Up @@ -1405,7 +1404,6 @@ subroutine total_salt (work)
if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
file=__FILE__, line=__LINE__)

! MHRI: CHECK THIS OMP
!$OMP PARALLEL DO PRIVATE(iblk,i,j,n,k,ij,icells,indxi,indxj)
do iblk = 1, nblocks

Expand Down Expand Up @@ -1513,7 +1511,8 @@ subroutine init_diags
if (abs(latpnt(n)) < c360 .and. abs(lonpnt(n)) < c360) then

! MDT, 09/2017: Comment out OpenMP directives since loop is not thread-safe
!!$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,latdis,londis,totdis)
! This is computing closest point, Could add a CRITICAL but it's just initialization
!!$XXXOMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,latdis,londis,totdis)
do iblk = 1, nblocks
this_block = get_block(blocks_ice(iblk),iblk)
ilo = this_block%ilo
Expand All @@ -1538,7 +1537,7 @@ subroutine init_diags
enddo ! i
enddo ! j
enddo ! iblk
!!$OMP END PARALLEL DO
!!$XXXOMP END PARALLEL DO

endif

Expand Down Expand Up @@ -1706,7 +1705,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
30 changes: 16 additions & 14 deletions cicecore/cicedynB/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 Expand Up @@ -1886,7 +1889,6 @@ subroutine accum_hist (dt)
! increment field
!---------------------------------------------------------------

! MHRI: CHECK THIS OMP ... Maybe ok after "dfresh,dfsalt" added
!$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)
Expand Down
31 changes: 17 additions & 14 deletions cicecore/cicedynB/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
30 changes: 16 additions & 14 deletions cicecore/cicedynB/analysis/ice_history_drag.F90
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ 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

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

call icepack_query_parameters(formdrag_out=formdrag)
Expand All @@ -79,26 +80,27 @@ subroutine init_hist_drag_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_drag_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_drag_nml open file '// &
trim(nml_filename), &
file=__FILE__, line=__LINE__)
endif

nml_error = 1
do while (nml_error > 0)
read(nu_nml, nml=icefields_drag_nml,iostat=nml_error)
if (nml_error > 0) read(nu_nml,*) ! for Nagware compiler
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_drag_nml')
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

call broadcast_scalar (f_Cdn_atm, master_task)
Expand Down
29 changes: 16 additions & 13 deletions cicecore/cicedynB/analysis/ice_history_fsd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ subroutine init_hist_fsd_2D
integer (kind=int_kind) :: nml_error ! namelist i/o error flag
real (kind=dbl_kind) :: secday
logical (kind=log_kind) :: tr_fsd, wave_spec

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

call icepack_query_tracer_flags(tr_fsd_out=tr_fsd)
Expand All @@ -95,25 +96,27 @@ subroutine init_hist_fsd_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_fsd_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_fsd_nml open file '// &
trim(nml_filename), &
file=__FILE__, line=__LINE__)
endif

nml_error = 1
do while (nml_error > 0)
read(nu_nml, nml=icefields_fsd_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_fsd_nml')
if (nml_error /= 0) then
call abort_ice(subname//'ERROR: icefields_fsd_nml reading ', &
file=__FILE__, line=__LINE__)
endif
close(nu_nml)
call release_fileunit(nu_nml)
endif

call broadcast_scalar (f_afsd, master_task)
Expand Down
29 changes: 16 additions & 13 deletions cicecore/cicedynB/analysis/ice_history_mechred.F90
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ subroutine init_hist_mechred_2D
integer (kind=int_kind) :: nml_error ! namelist i/o error flag
real (kind=dbl_kind) :: secday
logical (kind=log_kind) :: tr_lvl

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

call icepack_query_parameters(secday_out=secday)
Expand All @@ -101,25 +102,27 @@ subroutine init_hist_mechred_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_mechred_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_mechred_nml open file '// &
trim(nml_filename), &
file=__FILE__, line=__LINE__)
endif

nml_error = 1
do while (nml_error > 0)
read(nu_nml, nml=icefields_mechred_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_mechred_nml')
if (nml_error /= 0) then
call abort_ice(subname//'ERROR: icefields_mechred_nml reading ', &
file=__FILE__, line=__LINE__)
endif
close(nu_nml)
call release_fileunit(nu_nml)
endif

if (.not. tr_lvl) then
Expand Down
29 changes: 16 additions & 13 deletions cicecore/cicedynB/analysis/ice_history_pond.F90
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ subroutine init_hist_pond_2D
integer (kind=int_kind) :: ns
integer (kind=int_kind) :: nml_error ! namelist i/o error flag
logical (kind=log_kind) :: tr_pond

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

call icepack_query_tracer_flags(tr_pond_out=tr_pond)
Expand All @@ -84,25 +85,27 @@ subroutine init_hist_pond_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_pond_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_pond_nml open file '// &
trim(nml_filename), &
file=__FILE__, line=__LINE__)
endif

nml_error = 1
do while (nml_error > 0)
read(nu_nml, nml=icefields_pond_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_pond_nml')
if (nml_error /= 0) then
call abort_ice(subname//'ERROR: icefields_pond_nml reading ', &
file=__FILE__, line=__LINE__)
endif
close(nu_nml)
call release_fileunit(nu_nml)
endif

if (.not. tr_pond) then
Expand Down
Loading

0 comments on commit dbbad0d

Please sign in to comment.