Skip to content

Commit

Permalink
Code cleanup based on compile with -Wall
Browse files Browse the repository at this point in the history
Code cleanup based on -std f2003 and f2008 checks
Add -stand f08 to cheyenne_intel debug flags
Add -std f2008 to cheyenne_gnu debug flags
Code consistent with Fortran 2003 except for use of contiguous in
  1d evp code.
  • Loading branch information
apcraig committed Aug 9, 2022
1 parent f6d09e4 commit a95c35c
Show file tree
Hide file tree
Showing 36 changed files with 97 additions and 168 deletions.
4 changes: 0 additions & 4 deletions cicecore/cicedynB/analysis/ice_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1249,9 +1249,6 @@ subroutine runtime_diags (dt)
endif ! print_points
endif ! my_task = master_task

799 format (27x,a24)
800 format (a25,2x,f24.17)
801 format (a25,2x,1pe24.17)
899 format (27x,a24,2x,a24)
900 format (a25,2x,f24.17,2x,f24.17)
901 format (a25,2x,1pe24.17,2x,1pe24.17)
Expand Down Expand Up @@ -1709,7 +1706,6 @@ subroutine debug_ice(iblk, plabeld)
integer (kind=int_kind), intent(in) :: iblk

! local
integer (kind=int_kind) :: i, j, m
character(len=*), parameter :: subname='(debug_ice)'

if (istep1 >= debug_model_step) then
Expand Down
2 changes: 0 additions & 2 deletions cicecore/cicedynB/analysis/ice_diagnostics_bgc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,6 @@ subroutine bgc_diags
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)
1020 format (a30,2x,i6) ! integer

end subroutine bgc_diags
Expand Down Expand Up @@ -1068,7 +1067,6 @@ subroutine zsal_diags
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)
903 format (a25,5x,i4,1x,i4,1x,i4,1x,i4,7x,i4,1x,i4,1x,i4,1x,i4)

end subroutine zsal_diags

Expand Down
1 change: 0 additions & 1 deletion cicecore/cicedynB/analysis/ice_history_fsd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ subroutine init_hist_fsd_2D

integer (kind=int_kind) :: ns
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)'
Expand Down
2 changes: 1 addition & 1 deletion cicecore/cicedynB/analysis/ice_history_shared.F90
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ subroutine construct_filename(ncfile,suffix,ns)
iyear = myear
imonth = mmonth
iday = mday
isec = msec - dt
isec = int(msec - dt,int_kind)

! construct filename
if (write_ic) then
Expand Down
3 changes: 1 addition & 2 deletions cicecore/cicedynB/analysis/ice_history_snow.F90
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ subroutine accum_hist_snow (iblk)

use ice_arrays_column, only: meltsliq
use ice_blocks, only: block, nx_block, ny_block
use ice_domain, only: blocks_ice
use ice_flux, only: fsloss
use ice_history_shared, only: n2D, a2D, a3Dc, ncat_hist, &
accum_hist_field, nzslyr
Expand All @@ -275,7 +274,7 @@ subroutine accum_hist_snow (iblk)
! local variables

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

integer (kind=int_kind) :: &
nt_smice, nt_smliq, nt_rhos, nt_rsnw
Expand Down
6 changes: 3 additions & 3 deletions cicecore/cicedynB/dynamics/ice_dyn_evp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ subroutine evp (dt)
stress12_1, stress12_2, stress12_3, stress12_4, &
stresspT, stressmT, stress12T, &
stresspU, stressmU, stress12U
use ice_grid, only: hm, tmask, umask, umaskCD, nmask, emask, uvm, epm, npm, &
use ice_grid, only: tmask, umask, umaskCD, nmask, emask, uvm, epm, npm, &
iceumask, iceemask, icenmask, &
dxE, dxN, dxT, dxU, dyE, dyN, dyT, dyU, &
ratiodxN, ratiodxNr, ratiodyE, ratiodyEr, &
dxhy, dyhx, cxp, cyp, cxm, cym, &
tarear, uarear, earear, narear, grid_average_X2Y, tarea, uarea, &
tarear, uarear, earear, narear, grid_average_X2Y, uarea, &
grid_type, grid_ice, &
grid_atm_dynu, grid_atm_dynv, grid_ocn_dynu, grid_ocn_dynv
use ice_state, only: aice, vice, vsno, uvel, vvel, uvelN, vvelN, &
Expand Down Expand Up @@ -1408,7 +1408,7 @@ subroutine stress (nx_block, ny_block, &
csigmne, csigmnw, csigmse, csigmsw , &
csig12ne, csig12nw, csig12se, csig12sw , &
str12ew, str12we, str12ns, str12sn , &
strp_tmp, strm_tmp, tmp
strp_tmp, strm_tmp

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

Expand Down
3 changes: 1 addition & 2 deletions cicecore/cicedynB/dynamics/ice_dyn_evp_1d.F90
Original file line number Diff line number Diff line change
Expand Up @@ -779,8 +779,7 @@ subroutine stepu_last(NA_len, rhow, lb, ub, Cw, aiu, uocn, vocn, &

use ice_kinds_mod
use ice_constants, only : c0, c1
use ice_dyn_shared, only : brlx, revp, u0, cosw, sinw, &
seabed_stress
use ice_dyn_shared, only : brlx, revp, u0, cosw, sinw

implicit none

Expand Down
28 changes: 5 additions & 23 deletions cicecore/cicedynB/dynamics/ice_dyn_shared.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2326,7 +2326,7 @@ end subroutine visc_replpress
subroutine dyn_haloUpdate1(halo_info, halo_info_mask, field_loc, field_type, fld1)

use ice_boundary, only: ice_halo, ice_HaloUpdate
use ice_domain, only: nblocks, maskhalo_dyn, halo_dynbundle
use ice_domain, only: maskhalo_dyn, halo_dynbundle
use ice_timers, only: ice_timer_start, ice_timer_stop, timer_bound

type (ice_halo), intent(in) :: &
Expand All @@ -2342,12 +2342,6 @@ subroutine dyn_haloUpdate1(halo_info, halo_info_mask, field_loc, field_type, fld

! local variables

integer (kind=int_kind) :: &
iblk ! iblock

real (kind=dbl_kind), dimension (nx_block,ny_block,1,max_blocks) :: &
fldbundle ! work array for boundary updates

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

call ice_timer_start(timer_bound)
Expand All @@ -2370,7 +2364,7 @@ end subroutine dyn_haloUpdate1
subroutine dyn_haloUpdate2(halo_info, halo_info_mask, field_loc, field_type, fld1, fld2)

use ice_boundary, only: ice_halo, ice_HaloUpdate
use ice_domain, only: nblocks, maskhalo_dyn, halo_dynbundle
use ice_domain, only: maskhalo_dyn, halo_dynbundle
use ice_timers, only: ice_timer_start, ice_timer_stop, timer_bound

type (ice_halo), intent(in) :: &
Expand All @@ -2387,9 +2381,6 @@ subroutine dyn_haloUpdate2(halo_info, halo_info_mask, field_loc, field_type, fld

! local variables

integer (kind=int_kind) :: &
iblk ! iblock

real (kind=dbl_kind), dimension (nx_block,ny_block,2,max_blocks) :: &
fldbundle ! work array for boundary updates

Expand Down Expand Up @@ -2434,7 +2425,7 @@ end subroutine dyn_haloUpdate2
subroutine dyn_haloUpdate3(halo_info, halo_info_mask, field_loc, field_type, fld1, fld2, fld3)

use ice_boundary, only: ice_halo, ice_HaloUpdate
use ice_domain, only: nblocks, maskhalo_dyn, halo_dynbundle
use ice_domain, only: maskhalo_dyn, halo_dynbundle
use ice_timers, only: ice_timer_start, ice_timer_stop, timer_bound

type (ice_halo), intent(in) :: &
Expand All @@ -2452,9 +2443,6 @@ subroutine dyn_haloUpdate3(halo_info, halo_info_mask, field_loc, field_type, fld

! local variables

integer (kind=int_kind) :: &
iblk ! iblock

real (kind=dbl_kind), dimension (nx_block,ny_block,3,max_blocks) :: &
fldbundle ! work array for boundary updates

Expand Down Expand Up @@ -2503,7 +2491,7 @@ end subroutine dyn_haloUpdate3
subroutine dyn_haloUpdate4(halo_info, halo_info_mask, field_loc, field_type, fld1, fld2, fld3, fld4)

use ice_boundary, only: ice_halo, ice_HaloUpdate
use ice_domain, only: nblocks, maskhalo_dyn, halo_dynbundle
use ice_domain, only: maskhalo_dyn, halo_dynbundle
use ice_timers, only: ice_timer_start, ice_timer_stop, timer_bound

type (ice_halo), intent(in) :: &
Expand All @@ -2522,9 +2510,6 @@ subroutine dyn_haloUpdate4(halo_info, halo_info_mask, field_loc, field_type, fld

! local variables

integer (kind=int_kind) :: &
iblk ! iblock

real (kind=dbl_kind), dimension (nx_block,ny_block,4,max_blocks) :: &
fldbundle ! work array for boundary updates

Expand Down Expand Up @@ -2577,7 +2562,7 @@ end subroutine dyn_haloUpdate4
subroutine dyn_haloUpdate5(halo_info, halo_info_mask, field_loc, field_type, fld1, fld2, fld3, fld4, fld5)

use ice_boundary, only: ice_halo, ice_HaloUpdate
use ice_domain, only: nblocks, maskhalo_dyn, halo_dynbundle
use ice_domain, only: maskhalo_dyn, halo_dynbundle
use ice_timers, only: ice_timer_start, ice_timer_stop, timer_bound

type (ice_halo), intent(in) :: &
Expand All @@ -2597,9 +2582,6 @@ subroutine dyn_haloUpdate5(halo_info, halo_info_mask, field_loc, field_type, fld

! local variables

integer (kind=int_kind) :: &
iblk ! iblock

real (kind=dbl_kind), dimension (nx_block,ny_block,5,max_blocks) :: &
fldbundle ! work array for boundary updates

Expand Down
9 changes: 6 additions & 3 deletions cicecore/cicedynB/dynamics/ice_dyn_vp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ module ice_dyn_vp
dim_pgmres , & ! size of pgmres Krylov subspace
maxits_fgmres , & ! max nb of iteration for fgmres
maxits_pgmres , & ! max nb of iteration for pgmres
fpfunc_andacc , & ! fixed point function for Anderson acceleration: 1: g(x) = FMGRES(A(x),b(x)), 2: g(x) = x - A(x)x + b(x)
fpfunc_andacc , & ! fixed point function for Anderson acceleration: 1:
! g(x) = FMGRES(A(x),b(x)), 2: g(x) = x - A(x)x + b(x)
dim_andacc , & ! size of Anderson minimization matrix (number of saved previous residuals)
start_andacc ! acceleration delay factor (acceleration starts at this iteration)

Expand All @@ -87,7 +88,8 @@ module ice_dyn_vp
reltol_andacc ! relative tolerance for Anderson acceleration

character (len=char_len), public :: &
precond , & ! preconditioner for fgmres: 'ident' (identity), 'diag' (diagonal), 'pgmres' (Jacobi-preconditioned GMRES)
precond , & ! preconditioner for fgmres: 'ident' (identity), 'diag' (diagonal), 'pgmres'
! (Jacobi-preconditioned GMRES)
algo_nonlin , & ! nonlinear algorithm: 'picard' (Picard iteration), 'anderson' (Anderson acceleration)
ortho_type ! type of orthogonalization for FGMRES ('cgs' or 'mgs')

Expand Down Expand Up @@ -1095,7 +1097,8 @@ subroutine anderson_solver (icellt , icellu , &
endif
#else
! Anderson solver is not usable without LAPACK; abort
call abort_ice(error_message=subname // " CICE was not compiled with LAPACK, and Anderson solver was chosen (algo_nonlin = 'anderson')" , &
call abort_ice(error_message=subname // " CICE was not compiled with LAPACK, "// &
"and Anderson solver was chosen (algo_nonlin = 'anderson')" , &
file=__FILE__, line=__LINE__)
#endif
endif
Expand Down
1 change: 1 addition & 0 deletions cicecore/cicedynB/dynamics/ice_transport_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module ice_transport_driver
field_type_scalar, field_type_vector, &
field_loc_NEcorner, &
field_loc_Nface, field_loc_Eface
use ice_diagnostics, only: diagnostic_abort
use ice_fileunits, only: nu_diag
use ice_exit, only: abort_ice
use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted
Expand Down
3 changes: 2 additions & 1 deletion cicecore/cicedynB/general/ice_flux.F90
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,8 @@ subroutine alloc_flux
Tf (nx_block,ny_block,max_blocks), & ! freezing temperature (C)
qdp (nx_block,ny_block,max_blocks), & ! deep ocean heat flux (W/m^2), negative upward
hmix (nx_block,ny_block,max_blocks), & ! mixed layer depth (m)
daice_da (nx_block,ny_block,max_blocks), & ! data assimilation concentration increment rate (concentration s-1)(only used in hadgem drivers)
daice_da (nx_block,ny_block,max_blocks), & ! data assimilation concentration increment rate (concentration s-1)
! (only used in hadgem drivers)
fsens (nx_block,ny_block,max_blocks), & ! sensible heat flux (W/m^2)
flat (nx_block,ny_block,max_blocks), & ! latent heat flux (W/m^2)
fswabs (nx_block,ny_block,max_blocks), & ! shortwave flux absorbed in ice and ocean (W/m^2)
Expand Down
18 changes: 9 additions & 9 deletions cicecore/cicedynB/general/ice_flux_bgc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -138,22 +138,22 @@ subroutine alloc_flux_bgc
fdust (nx_block,ny_block,max_blocks), & ! ice-ocean dust flux (kg/m^2/s), positive to ocean
hin_old (nx_block,ny_block,ncat,max_blocks), & ! old ice thickness
dsnown (nx_block,ny_block,ncat,max_blocks), & ! change in snow thickness in category n (m)
HDO_ocn (nx_block,ny_block,max_blocks), & ! seawater concentration of HDO (kg/kg)
H2_16O_ocn (nx_block,ny_block,max_blocks), & ! seawater concentration of H2_16O (kg/kg)
H2_18O_ocn (nx_block,ny_block,max_blocks), & ! seawater concentration of H2_18O (kg/kg)
Qa_iso (nx_block,ny_block,icepack_max_iso,max_blocks), & ! isotope specific humidity (kg/kg)
Qref_iso (nx_block,ny_block,icepack_max_iso,max_blocks), & ! 2m atm reference isotope spec humidity (kg/kg)
fiso_atm (nx_block,ny_block,icepack_max_iso,max_blocks), & ! isotope deposition rate (kg/m^2 s)
fiso_evap (nx_block,ny_block,icepack_max_iso,max_blocks), & ! isotope evaporation rate (kg/m^2 s)
fiso_ocn (nx_block,ny_block,icepack_max_iso,max_blocks), & ! isotope flux to ocean (kg/m^2/s)
HDO_ocn (nx_block,ny_block,max_blocks), & ! seawater concentration of HDO (kg/kg)
H2_16O_ocn (nx_block,ny_block,max_blocks), & ! seawater concentration of H2_16O (kg/kg)
H2_18O_ocn (nx_block,ny_block,max_blocks), & ! seawater concentration of H2_18O (kg/kg)
Qa_iso (nx_block,ny_block,icepack_max_iso,max_blocks), & ! isotope specific humidity (kg/kg)
Qref_iso (nx_block,ny_block,icepack_max_iso,max_blocks), & ! 2m atm reference isotope spec humidity (kg/kg)
fiso_atm (nx_block,ny_block,icepack_max_iso,max_blocks), & ! isotope deposition rate (kg/m^2 s)
fiso_evap (nx_block,ny_block,icepack_max_iso,max_blocks), & ! isotope evaporation rate (kg/m^2 s)
fiso_ocn (nx_block,ny_block,icepack_max_iso,max_blocks), & ! isotope flux to ocean (kg/m^2/s)
faero_atm (nx_block,ny_block,icepack_max_aero,max_blocks), & ! aerosol deposition rate (kg/m^2 s)
faero_ocn (nx_block,ny_block,icepack_max_aero,max_blocks), & ! aerosol flux to ocean (kg/m^2/s)
zaeros (nx_block,ny_block,icepack_max_aero,max_blocks), & ! ocean aerosols (mmol/m^3)
flux_bio_atm(nx_block,ny_block,icepack_max_nbtrcr,max_blocks), & ! all bio fluxes to ice from atmosphere
flux_bio (nx_block,ny_block,icepack_max_nbtrcr,max_blocks), & ! all bio fluxes to ocean
flux_bio_ai (nx_block,ny_block,icepack_max_nbtrcr,max_blocks), & ! all bio fluxes to ocean, averaged over grid cell
algalN (nx_block,ny_block,icepack_max_algae,max_blocks), & ! ocean algal nitrogen (mmol/m^3) (diatoms, pico, phaeo)
falgalN (nx_block,ny_block,icepack_max_algae,max_blocks), & ! ice-ocean algal nitrogen flux (mmol/m^2/s) (diatoms, pico, phaeo)
falgalN (nx_block,ny_block,icepack_max_algae,max_blocks), & ! ice-ocn algalN flux (mmol/m^2/s) (diatoms, pico, phaeo)
doc (nx_block,ny_block,icepack_max_doc,max_blocks), & ! ocean doc (mmol/m^3) (saccharids, lipids, tbd )
fdoc (nx_block,ny_block,icepack_max_doc,max_blocks), & ! ice-ocean doc flux (mmol/m^2/s) (saccharids, lipids, tbd)
don (nx_block,ny_block,icepack_max_don,max_blocks), & ! ocean don (mmol/m^3) (proteins and amino acids)
Expand Down
Loading

0 comments on commit a95c35c

Please sign in to comment.