From b79573f6f9e89e30c05060f4514a62c959319998 Mon Sep 17 00:00:00 2001 From: mhrib Date: Thu, 13 Sep 2018 13:51:00 +0000 Subject: [PATCH 1/8] Allocatable dynamics version using namelist --- cicecore/cicedynB/dynamics/ice_dyn_eap.F90 | 39 ++- cicecore/cicedynB/dynamics/ice_dyn_shared.F90 | 21 +- cicecore/cicedynB/general/ice_flux.F90 | 234 ++++++++++++++++-- cicecore/cicedynB/general/ice_flux_bgc.F90 | 77 ++++-- cicecore/cicedynB/general/ice_forcing.F90 | 50 +++- cicecore/cicedynB/general/ice_forcing_bgc.F90 | 49 +++- cicecore/cicedynB/general/ice_state.F90 | 49 +++- .../cicedynB/infrastructure/ice_blocks.F90 | 7 +- .../cicedynB/infrastructure/ice_domain.F90 | 25 +- cicecore/cicedynB/infrastructure/ice_grid.F90 | 80 +++++- cicecore/drivers/cesm/CICE_InitMod.F90 | 22 +- cicecore/drivers/cice/CICE_InitMod.F90 | 24 +- cicecore/drivers/hadgem3/CICE_InitMod.F90 | 24 +- cicecore/shared/ice_arrays_column.F90 | 151 ++++++++--- cicecore/shared/ice_domain_size.F90 | 16 +- 15 files changed, 725 insertions(+), 143 deletions(-) diff --git a/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 b/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 index 537c7e408..b03780753 100644 --- a/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 +++ b/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 @@ -34,7 +34,8 @@ module ice_dyn_eap implicit none private - public :: eap, init_eap, write_restart_eap, read_restart_eap + public :: eap, init_eap, write_restart_eap, read_restart_eap, & + alloc_dyn_eap ! Look-up table needed for calculating structure tensor integer (int_kind), parameter :: & @@ -45,12 +46,12 @@ module ice_dyn_eap real (kind=dbl_kind), dimension (nx_yield,ny_yield,na_yield) :: & s11r, s12r, s22r, s11s, s12s, s22s - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks) :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable :: & a11_1, a11_2, a11_3, a11_4, & ! components of a12_1, a12_2, a12_3, a12_4 ! structure tensor ! history - real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension(:,:,:), allocatable, public :: & e11 , & ! components of strain rate tensor (1/s) e12 , & e22 , & @@ -67,6 +68,38 @@ module ice_dyn_eap contains +!======================================================================= +! +! Allocate space for all variables +! + subroutine alloc_dyn_eap + + integer (int_kind) :: ierr + + allocate( a11_1 (nx_block,ny_block,max_blocks), & + a11_2 (nx_block,ny_block,max_blocks), & + a11_3 (nx_block,ny_block,max_blocks), & + a11_4 (nx_block,ny_block,max_blocks), & + a12_1 (nx_block,ny_block,max_blocks), & + a12_2 (nx_block,ny_block,max_blocks), & + a12_3 (nx_block,ny_block,max_blocks), & + a12_4 (nx_block,ny_block,max_blocks), & + e11 (nx_block,ny_block,max_blocks), & + e12 (nx_block,ny_block,max_blocks), & + e22 (nx_block,ny_block,max_blocks), & + yieldstress11(nx_block,ny_block,max_blocks), & + yieldstress12(nx_block,ny_block,max_blocks), & + yieldstress22(nx_block,ny_block,max_blocks), & + s11 (nx_block,ny_block,max_blocks), & + s12 (nx_block,ny_block,max_blocks), & + s22 (nx_block,ny_block,max_blocks), & + a11 (nx_block,ny_block,max_blocks), & + a12 (nx_block,ny_block,max_blocks), & + stat=ierr) + if (ierr/=0) call abort_ice('(alloc_dyn_eap): Out of memory') + + end subroutine alloc_dyn_eap + !======================================================================= ! ! Elastic-anisotropic-plastic dynamics driver diff --git a/cicecore/cicedynB/dynamics/ice_dyn_shared.F90 b/cicecore/cicedynB/dynamics/ice_dyn_shared.F90 index c9331844c..53114ee45 100644 --- a/cicecore/cicedynB/dynamics/ice_dyn_shared.F90 +++ b/cicecore/cicedynB/dynamics/ice_dyn_shared.F90 @@ -22,7 +22,8 @@ module ice_dyn_shared implicit none private public :: init_evp, set_evp_parameters, stepu, principal_stress, & - dyn_prep1, dyn_prep2, dyn_finish, basal_stress_coeff + dyn_prep1, dyn_prep2, dyn_finish, basal_stress_coeff, & + alloc_dyn_shared ! namelist parameters @@ -61,7 +62,7 @@ module ice_dyn_shared real (kind=dbl_kind), allocatable, public :: & fcor_blk(:,:,:) ! Coriolis parameter (1/s) - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & uvel_init, & ! x-component of velocity (m/s), beginning of timestep vvel_init ! y-component of velocity (m/s), beginning of timestep @@ -76,6 +77,22 @@ module ice_dyn_shared contains +!======================================================================= +! +! Allocate space for all variables +! + subroutine alloc_dyn_shared + + integer (int_kind) :: ierr + + allocate( & + uvel_init (nx_block,ny_block,max_blocks), & ! x-component of velocity (m/s), beginning of timestep + vvel_init (nx_block,ny_block,max_blocks), & ! y-component of velocity (m/s), beginning of timestep + stat=ierr) + if (ierr/=0) call abort_ice('(alloc_dyn_shared): Out of memory') + + end subroutine alloc_dyn_shared + !======================================================================= ! Initialize parameters and variables needed for the evp dynamics diff --git a/cicecore/cicedynB/general/ice_flux.F90 b/cicecore/cicedynB/general/ice_flux.F90 index 195db2807..c3ff97be6 100644 --- a/cicecore/cicedynB/general/ice_flux.F90 +++ b/cicecore/cicedynB/general/ice_flux.F90 @@ -27,13 +27,13 @@ module ice_flux implicit none private public :: init_coupler_flux, init_history_therm, init_history_dyn, & - init_flux_ocn, init_flux_atm, scale_fluxes + init_flux_ocn, init_flux_atm, scale_fluxes, alloc_flux !----------------------------------------------------------------- ! Dynamics component !----------------------------------------------------------------- - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & ! in from atmos (if .not.calc_strair) strax , & ! wind stress components (N/m^2) @@ -57,7 +57,7 @@ module ice_flux ! diagnostic - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & sig1 , & ! normalized principal stress component sig2 , & ! normalized principal stress component sigP , & ! internal ice pressure (N/m) @@ -80,7 +80,7 @@ module ice_flux opening ! rate of opening due to divergence/shear (1/s) real (kind=dbl_kind), & - dimension (nx_block,ny_block,ncat,max_blocks), public :: & + dimension (:,:,:,:), allocatable, public :: & ! ridging diagnostics in categories dardg1ndt, & ! rate of area loss by ridging ice (1/s) dardg2ndt, & ! rate of area gain by new ridges (1/s) @@ -96,19 +96,19 @@ module ice_flux ! restart - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & ! ice stress tensor in each corner of T cell (kg/s^2) stressp_1, stressp_2, stressp_3, stressp_4 , & ! sigma11+sigma22 stressm_1, stressm_2, stressm_3, stressm_4 , & ! sigma11-sigma22 stress12_1,stress12_2,stress12_3,stress12_4 ! sigma12 logical (kind=log_kind), & - dimension (nx_block,ny_block,max_blocks), public :: & + dimension (:,:,:), allocatable, public :: & iceumask ! ice extent mask (U-cell) ! internal - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & fm , & ! Coriolis param. * mass in U-cell (kg/s) Tbu ! coefficient for basal stress (N/m^2) @@ -118,7 +118,7 @@ module ice_flux ! in from atmosphere (if calc_Tsfc) - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & zlvl , & ! atm level height (m) uatm , & ! wind velocity components (m/s) vatm , & @@ -139,7 +139,7 @@ module ice_flux ! not per ice area. When in standalone mode, these are per ice area. real (kind=dbl_kind), & - dimension (nx_block,ny_block,ncat,max_blocks), public :: & + dimension (:,:,:,:), allocatable, public :: & fsurfn_f , & ! net flux to top surface, excluding fcondtop fcondtopn_f, & ! downward cond flux at top surface (W m-2) fsensn_f , & ! sensible heat flux (W m-2) @@ -147,13 +147,13 @@ module ice_flux ! in from atmosphere - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & frain , & ! rainfall rate (kg/m^2 s) fsnow ! snowfall rate (kg/m^2 s) ! in from ocean - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & sss , & ! sea surface salinity (ppt) sst , & ! sea surface temperature (C) frzmlt , & ! freezing/melting potential (W/m^2) @@ -167,7 +167,7 @@ module ice_flux ! out to atmosphere (if calc_Tsfc) ! note Tsfc is in ice_state.F - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & fsens , & ! sensible heat flux (W/m^2) flat , & ! latent heat flux (W/m^2) fswabs , & ! shortwave flux absorbed in ice and ocean (W/m^2) @@ -179,7 +179,7 @@ module ice_flux evap ! evaporative water flux (kg/m^2/s) ! albedos aggregated over categories (if calc_Tsfc) - real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & alvdr , & ! visible, direct (fraction) alidr , & ! near-ir, direct (fraction) alvdf , & ! visible, diffuse (fraction) @@ -202,13 +202,13 @@ module ice_flux alidf_init ! near-ir, diffuse (fraction) real (kind=dbl_kind), & - dimension(nx_block,ny_block,max_blocks,max_nstrm), public :: & + dimension(:,:,:,:), allocatable, public :: & albcnt ! counter for zenith angle ! out to ocean ! (Note CICE_IN_NEMO does not use these for coupling. ! It uses fresh_ai,fsalt_ai,fhocn_ai and fswthru_ai) - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & fpond , & ! fresh water flux to ponds (kg/m^2/s) fresh , & ! fresh water flux to ocean (kg/m^2/s) fsalt , & ! salt flux to ocean (kg/m^2/s) @@ -218,7 +218,7 @@ module ice_flux ! internal real (kind=dbl_kind), & - dimension (nx_block,ny_block,max_blocks), public :: & + dimension (:,:,:), allocatable, public :: & fswfac , & ! for history scale_factor! scaling factor for shortwave components @@ -227,21 +227,21 @@ module ice_flux l_mpond_fresh ! if true, include freshwater feedback from meltponds ! when running in ice-ocean or coupled configuration - real (kind=dbl_kind), dimension (nx_block,ny_block,ncat,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:,:), allocatable, public :: & meltsn , & ! snow melt in category n (m) melttn , & ! top melt in category n (m) meltbn , & ! bottom melt in category n (m) congeln , & ! congelation ice formation in category n (m) snoicen ! snow-ice formation in category n (m) - real (kind=dbl_kind), dimension (nx_block,ny_block,ncat,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:,:), allocatable, public :: & keffn_top ! effective thermal conductivity of the top ice layer ! on categories (W/m^2/K) ! quantities passed from ocean mixed layer to atmosphere ! (for running with CAM) - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & strairx_ocn , & ! stress on ocean by air, x-direction strairy_ocn , & ! stress on ocean by air, y-direction fsens_ocn , & ! sensible heat flux (W/m^2) @@ -257,7 +257,7 @@ module ice_flux ! diagnostic - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & fsurf , & ! net surface heat flux (excluding fcondtop)(W/m^2) fcondtop,&! top surface conductive flux (W/m^2) fbot, & ! heat flux at bottom surface of ice (excluding excess) (W/m^2) @@ -277,7 +277,7 @@ module ice_flux frazil_diag ! frazil ice growth diagnostic (m/step-->cm/day) real (kind=dbl_kind), & - dimension (nx_block,ny_block,ncat,max_blocks), public :: & + dimension (:,:,:,:), allocatable, public :: & fsurfn, & ! category fsurf fcondtopn,& ! category fcondtop fsensn, & ! category sensible heat flux @@ -290,14 +290,14 @@ module ice_flux ! (The others suffer from problem of incorrect values at grid boxes ! that change from an ice free state to an icy state.) - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & fresh_ai, & ! fresh water flux to ocean (kg/m^2/s) fsalt_ai, & ! salt flux to ocean (kg/m^2/s) fhocn_ai, & ! net heat flux to ocean (W/m^2) fswthru_ai ! shortwave penetrating to ocean (W/m^2) ! Used with data assimilation in hadgem drivers - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks) :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & fresh_da, & ! fresh water flux to ocean due to data assim (kg/m^2/s) fsalt_da ! salt flux to ocean due to data assimilation(kg/m^2/s) @@ -305,14 +305,14 @@ module ice_flux ! internal !----------------------------------------------------------------- - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & rside , & ! fraction of ice that melts laterally fsw , & ! incoming shortwave radiation (W/m^2) coszen , & ! cosine solar zenith angle, < 0 for sun below horizon rdg_conv, & ! convergence term for ridging (1/s) rdg_shear ! shear term for ridging (1/s) - real (kind=dbl_kind), dimension(nx_block,ny_block,nilyr+1,max_blocks), public :: & + real (kind=dbl_kind), dimension(:,:,:,:), allocatable, public :: & salinz ,& ! initial salinity profile (ppt) Tmltz ! initial melting temperature (^oC) @@ -320,6 +320,190 @@ module ice_flux contains +!======================================================================= +! +! Allocate space for all variables +! + subroutine alloc_flux + + integer (int_kind) :: ierr + + allocate( & + strax (nx_block,ny_block,max_blocks), & ! wind stress components (N/m^2) + stray (nx_block,ny_block,max_blocks), & ! + uocn (nx_block,ny_block,max_blocks), & ! ocean current, x-direction (m/s) + vocn (nx_block,ny_block,max_blocks), & ! ocean current, y-direction (m/s) + ss_tltx (nx_block,ny_block,max_blocks), & ! sea surface slope, x-direction (m/m) + ss_tlty (nx_block,ny_block,max_blocks), & ! sea surface slope, y-direction + hwater (nx_block,ny_block,max_blocks), & ! water depth for basal stress calc (landfast ice) + strairxT (nx_block,ny_block,max_blocks), & ! stress on ice by air, x-direction + strairyT (nx_block,ny_block,max_blocks), & ! stress on ice by air, y-direction + strocnxT (nx_block,ny_block,max_blocks), & ! ice-ocean stress, x-direction + strocnyT (nx_block,ny_block,max_blocks), & ! ice-ocean stress, y-direction + sig1 (nx_block,ny_block,max_blocks), & ! normalized principal stress component + sig2 (nx_block,ny_block,max_blocks), & ! normalized principal stress component + sigP (nx_block,ny_block,max_blocks), & ! internal ice pressure (N/m) + taubx (nx_block,ny_block,max_blocks), & ! basal stress (x) (N/m^2) + tauby (nx_block,ny_block,max_blocks), & ! basal stress (y) (N/m^2) + strairx (nx_block,ny_block,max_blocks), & ! stress on ice by air, x-direction + strairy (nx_block,ny_block,max_blocks), & ! stress on ice by air, y-direction + strocnx (nx_block,ny_block,max_blocks), & ! ice-ocean stress, x-direction + strocny (nx_block,ny_block,max_blocks), & ! ice-ocean stress, y-direction + strtltx (nx_block,ny_block,max_blocks), & ! stress due to sea surface slope, x-direction + strtlty (nx_block,ny_block,max_blocks), & ! stress due to sea surface slope, y-direction + strintx (nx_block,ny_block,max_blocks), & ! divergence of internal ice stress, x (N/m^2) + strinty (nx_block,ny_block,max_blocks), & ! divergence of internal ice stress, y (N/m^2) + daidtd (nx_block,ny_block,max_blocks), & ! ice area tendency due to transport (1/s) + dvidtd (nx_block,ny_block,max_blocks), & ! ice volume tendency due to transport (m/s) + dagedtd (nx_block,ny_block,max_blocks), & ! ice age tendency due to transport (s/s) + dardg1dt (nx_block,ny_block,max_blocks), & ! rate of area loss by ridging ice (1/s) + dardg2dt (nx_block,ny_block,max_blocks), & ! rate of area gain by new ridges (1/s) + dvirdgdt (nx_block,ny_block,max_blocks), & ! rate of ice volume ridged (m/s) + opening (nx_block,ny_block,max_blocks), & ! rate of opening due to divergence/shear (1/s) + stressp_1 (nx_block,ny_block,max_blocks), & ! sigma11+sigma22 + stressp_2 (nx_block,ny_block,max_blocks), & ! sigma11+sigma22 + stressp_3 (nx_block,ny_block,max_blocks), & ! sigma11+sigma22 + stressp_4 (nx_block,ny_block,max_blocks), & ! sigma11+sigma22 + stressm_1 (nx_block,ny_block,max_blocks), & ! sigma11-sigma22 + stressm_2 (nx_block,ny_block,max_blocks), & ! sigma11-sigma22 + stressm_3 (nx_block,ny_block,max_blocks), & ! sigma11-sigma22 + stressm_4 (nx_block,ny_block,max_blocks), & ! sigma11-sigma22 + stress12_1 (nx_block,ny_block,max_blocks), & ! sigma12 + stress12_2 (nx_block,ny_block,max_blocks), & ! sigma12 + stress12_3 (nx_block,ny_block,max_blocks), & ! sigma12 + stress12_4 (nx_block,ny_block,max_blocks), & ! sigma12 + iceumask (nx_block,ny_block,max_blocks), & ! ice extent mask (U-cell) + fm (nx_block,ny_block,max_blocks), & ! Coriolis param. * mass in U-cell (kg/s) + Tbu (nx_block,ny_block,max_blocks), & ! coefficient for basal stress (landfast ice) + zlvl (nx_block,ny_block,max_blocks), & ! atm level height (m) + uatm (nx_block,ny_block,max_blocks), & ! wind velocity components (m/s) + vatm (nx_block,ny_block,max_blocks), & + wind (nx_block,ny_block,max_blocks), & ! wind speed (m/s) + potT (nx_block,ny_block,max_blocks), & ! air potential temperature (K) + Tair (nx_block,ny_block,max_blocks), & ! air temperature (K) + Qa (nx_block,ny_block,max_blocks), & ! specific humidity (kg/kg) + rhoa (nx_block,ny_block,max_blocks), & ! air density (kg/m^3) + swvdr (nx_block,ny_block,max_blocks), & ! sw down, visible, direct (W/m^2) + swvdf (nx_block,ny_block,max_blocks), & ! sw down, visible, diffuse (W/m^2) + swidr (nx_block,ny_block,max_blocks), & ! sw down, near IR, direct (W/m^2) + swidf (nx_block,ny_block,max_blocks), & ! sw down, near IR, diffuse (W/m^2) + flw (nx_block,ny_block,max_blocks), & ! incoming longwave radiation (W/m^2) + frain (nx_block,ny_block,max_blocks), & ! rainfall rate (kg/m^2 s) + fsnow (nx_block,ny_block,max_blocks), & ! snowfall rate (kg/m^2 s) + sss (nx_block,ny_block,max_blocks), & ! sea surface salinity (ppt) + sst (nx_block,ny_block,max_blocks), & ! sea surface temperature (C) + frzmlt (nx_block,ny_block,max_blocks), & ! freezing/melting potential (W/m^2) + frzmlt_init(nx_block,ny_block,max_blocks), & ! frzmlt used in current time step (W/m^2) + 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) + 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) + fswint_ai (nx_block,ny_block,max_blocks), & ! SW absorbed in ice interior below surface (W/m^2) + flwout (nx_block,ny_block,max_blocks), & ! outgoing longwave radiation (W/m^2) + Tref (nx_block,ny_block,max_blocks), & ! 2m atm reference temperature (K) + Qref (nx_block,ny_block,max_blocks), & ! 2m atm reference spec humidity (kg/kg) + Uref (nx_block,ny_block,max_blocks), & ! 10m atm reference wind speed (m/s) + evap (nx_block,ny_block,max_blocks), & ! evaporative water flux (kg/m^2/s) + alvdr (nx_block,ny_block,max_blocks), & ! visible, direct (fraction) + alidr (nx_block,ny_block,max_blocks), & ! near-ir, direct (fraction) + alvdf (nx_block,ny_block,max_blocks), & ! visible, diffuse (fraction) + alidf (nx_block,ny_block,max_blocks), & ! near-ir, diffuse (fraction) + alvdr_ai (nx_block,ny_block,max_blocks), & ! visible, direct (fraction) + alidr_ai (nx_block,ny_block,max_blocks), & ! near-ir, direct (fraction) + alvdf_ai (nx_block,ny_block,max_blocks), & ! visible, diffuse (fraction) + alidf_ai (nx_block,ny_block,max_blocks), & ! near-ir, diffuse (fraction) + albice (nx_block,ny_block,max_blocks), & ! bare ice albedo + albsno (nx_block,ny_block,max_blocks), & ! snow albedo + albpnd (nx_block,ny_block,max_blocks), & ! melt pond albedo + apeff_ai (nx_block,ny_block,max_blocks), & ! effective pond area used for radiation calculation + snowfrac (nx_block,ny_block,max_blocks), & ! snow fraction used in radiation + alvdr_init (nx_block,ny_block,max_blocks), & ! visible, direct (fraction) + alidr_init (nx_block,ny_block,max_blocks), & ! near-ir, direct (fraction) + alvdf_init (nx_block,ny_block,max_blocks), & ! visible, diffuse (fraction) + alidf_init (nx_block,ny_block,max_blocks), & ! near-ir, diffuse (fraction) + fpond (nx_block,ny_block,max_blocks), & ! fresh water flux to ponds (kg/m^2/s) + fresh (nx_block,ny_block,max_blocks), & ! fresh water flux to ocean (kg/m^2/s) + fsalt (nx_block,ny_block,max_blocks), & ! salt flux to ocean (kg/m^2/s) + fhocn (nx_block,ny_block,max_blocks), & ! net heat flux to ocean (W/m^2) + fswthru (nx_block,ny_block,max_blocks), & ! shortwave penetrating to ocean (W/m^2) + fswfac (nx_block,ny_block,max_blocks), & ! for history + scale_factor (nx_block,ny_block,max_blocks), & ! scaling factor for shortwave components + strairx_ocn(nx_block,ny_block,max_blocks), & ! stress on ocean by air, x-direction + strairy_ocn(nx_block,ny_block,max_blocks), & ! stress on ocean by air, y-direction + fsens_ocn (nx_block,ny_block,max_blocks), & ! sensible heat flux (W/m^2) + flat_ocn (nx_block,ny_block,max_blocks), & ! latent heat flux (W/m^2) + flwout_ocn (nx_block,ny_block,max_blocks), & ! outgoing longwave radiation (W/m^2) + evap_ocn (nx_block,ny_block,max_blocks), & ! evaporative water flux (kg/m^2/s) + alvdr_ocn (nx_block,ny_block,max_blocks), & ! visible, direct (fraction) + alidr_ocn (nx_block,ny_block,max_blocks), & ! near-ir, direct (fraction) + alvdf_ocn (nx_block,ny_block,max_blocks), & ! visible, diffuse (fraction) + alidf_ocn (nx_block,ny_block,max_blocks), & ! near-ir, diffuse (fraction) + Tref_ocn (nx_block,ny_block,max_blocks), & ! 2m atm reference temperature (K) + Qref_ocn (nx_block,ny_block,max_blocks), & ! 2m atm reference spec humidity (kg/kg) + fsurf (nx_block,ny_block,max_blocks), & ! net surface heat flux (excluding fcondtop)(W/m^2) + fcondtop (nx_block,ny_block,max_blocks), & ! top surface conductive flux (W/m^2) + fbot (nx_block,ny_block,max_blocks), & ! heat flux at bottom surface of ice (excluding excess) (W/m^2) + congel (nx_block,ny_block,max_blocks), & ! basal ice growth (m/step-->cm/day) + frazil (nx_block,ny_block,max_blocks), & ! frazil ice growth (m/step-->cm/day) + snoice (nx_block,ny_block,max_blocks), & ! snow-ice formation (m/step-->cm/day) + meltt (nx_block,ny_block,max_blocks), & ! top ice melt (m/step-->cm/day) + melts (nx_block,ny_block,max_blocks), & ! snow melt (m/step-->cm/day) + meltb (nx_block,ny_block,max_blocks), & ! basal ice melt (m/step-->cm/day) + meltl (nx_block,ny_block,max_blocks), & ! lateral ice melt (m/step-->cm/day) + dsnow (nx_block,ny_block,max_blocks), & ! change in snow thickness (m/step-->cm/day) + daidtt (nx_block,ny_block,max_blocks), & ! ice area tendency thermo. (s^-1) + dvidtt (nx_block,ny_block,max_blocks), & ! ice volume tendency thermo. (m/s) + dagedtt (nx_block,ny_block,max_blocks), & ! ice age tendency thermo. (s/s) + mlt_onset (nx_block,ny_block,max_blocks), & ! day of year that sfc melting begins + frz_onset (nx_block,ny_block,max_blocks), & ! day of year that freezing begins (congel or frazil) + frazil_diag(nx_block,ny_block,max_blocks), & ! frazil ice growth diagnostic (m/step-->cm/day) + fresh_ai (nx_block,ny_block,max_blocks), & ! fresh water flux to ocean (kg/m^2/s) + fsalt_ai (nx_block,ny_block,max_blocks), & ! salt flux to ocean (kg/m^2/s) + fhocn_ai (nx_block,ny_block,max_blocks), & ! net heat flux to ocean (W/m^2) + fswthru_ai (nx_block,ny_block,max_blocks), & ! shortwave penetrating to ocean (W/m^2) + fresh_da (nx_block,ny_block,max_blocks), & ! fresh water flux to ocean due to data assim (kg/m^2/s) + fsalt_da (nx_block,ny_block,max_blocks), & ! salt flux to ocean due to data assimilation(kg/m^2/s) + rside (nx_block,ny_block,max_blocks), & ! fraction of ice that melts laterally + fsw (nx_block,ny_block,max_blocks), & ! incoming shortwave radiation (W/m^2) + coszen (nx_block,ny_block,max_blocks), & ! cosine solar zenith angle, < 0 for sun below horizon + rdg_conv (nx_block,ny_block,max_blocks), & ! convergence term for ridging (1/s) + rdg_shear (nx_block,ny_block,max_blocks), & ! shear term for ridging (1/s) + dardg1ndt (nx_block,ny_block,ncat,max_blocks), & ! rate of area loss by ridging ice (1/s) + dardg2ndt (nx_block,ny_block,ncat,max_blocks), & ! rate of area gain by new ridges (1/s) + dvirdgndt (nx_block,ny_block,ncat,max_blocks), & ! rate of ice volume ridged (m/s) + aparticn (nx_block,ny_block,ncat,max_blocks), & ! participation function + krdgn (nx_block,ny_block,ncat,max_blocks), & ! mean ridge thickness/thickness of ridging ice + ardgn (nx_block,ny_block,ncat,max_blocks), & ! fractional area of ridged ice + vrdgn (nx_block,ny_block,ncat,max_blocks), & ! volume of ridged ice + araftn (nx_block,ny_block,ncat,max_blocks), & ! rafting ice area + vraftn (nx_block,ny_block,ncat,max_blocks), & ! rafting ice volume + aredistn (nx_block,ny_block,ncat,max_blocks), & ! redistribution function: fraction of new ridge area + vredistn (nx_block,ny_block,ncat,max_blocks), & ! redistribution function: fraction of new ridge volume + fsurfn_f (nx_block,ny_block,ncat,max_blocks), & ! net flux to top surface, excluding fcondtop + fcondtopn_f(nx_block,ny_block,ncat,max_blocks), & ! downward cond flux at top surface (W m-2) + fsensn_f (nx_block,ny_block,ncat,max_blocks), & ! sensible heat flux (W m-2) + flatn_f (nx_block,ny_block,ncat,max_blocks), & ! latent heat flux (W m-2) + meltsn (nx_block,ny_block,ncat,max_blocks), & ! snow melt in category n (m) + melttn (nx_block,ny_block,ncat,max_blocks), & ! top melt in category n (m) + meltbn (nx_block,ny_block,ncat,max_blocks), & ! bottom melt in category n (m) + congeln (nx_block,ny_block,ncat,max_blocks), & ! congelation ice formation in category n (m) + snoicen (nx_block,ny_block,ncat,max_blocks), & ! snow-ice formation in category n (m) + keffn_top (nx_block,ny_block,ncat,max_blocks), & ! effective thermal conductivity of the top ice layer + fsurfn (nx_block,ny_block,ncat,max_blocks), & ! category fsurf + fcondtopn (nx_block,ny_block,ncat,max_blocks), & ! category fcondtop + fsensn (nx_block,ny_block,ncat,max_blocks), & ! category sensible heat flux + flatn (nx_block,ny_block,ncat,max_blocks), & ! category latent heat flux + albcnt (nx_block,ny_block,max_blocks,max_nstrm), & ! counter for zenith angle + salinz (nx_block,ny_block,nilyr+1,max_blocks), & ! initial salinity profile (ppt) + Tmltz (nx_block,ny_block,nilyr+1,max_blocks), & ! initial melting temperature (^oC) + stat=ierr) + if (ierr/=0) call abort_ice('(alloc_flux): Out of memory') + + end subroutine alloc_flux + !======================================================================= ! Initialize all fluxes exchanged with flux coupler diff --git a/cicecore/cicedynB/general/ice_flux_bgc.F90 b/cicecore/cicedynB/general/ice_flux_bgc.F90 index 203780264..1f6878607 100644 --- a/cicecore/cicedynB/general/ice_flux_bgc.F90 +++ b/cicecore/cicedynB/general/ice_flux_bgc.F90 @@ -20,32 +20,32 @@ module ice_flux_bgc implicit none private - public :: bgcflux_ice_to_ocn + public :: bgcflux_ice_to_ocn, alloc_flux_bgc ! in from atmosphere real (kind=dbl_kind), & !coupling variable for both tr_aero and tr_zaero - dimension (nx_block,ny_block,icepack_max_aero,max_blocks), public :: & + dimension (:,:,:,:), allocatable, public :: & faero_atm ! aerosol deposition rate (kg/m^2 s) real (kind=dbl_kind), & - dimension (nx_block,ny_block,icepack_max_nbtrcr,max_blocks), public :: & + dimension (:,:,:,:), allocatable, public :: & flux_bio_atm ! all bio fluxes to ice from atmosphere ! in from ocean real (kind=dbl_kind), & - dimension (nx_block,ny_block,icepack_max_aero,max_blocks), public :: & + dimension (:,:,:,:), allocatable, public :: & faero_ocn ! aerosol flux to ocean (kg/m^2/s) ! out to ocean real (kind=dbl_kind), & - dimension (nx_block,ny_block,icepack_max_nbtrcr,max_blocks), public :: & + dimension (:,:,:,:), allocatable, public :: & flux_bio , & ! all bio fluxes to ocean flux_bio_ai ! all bio fluxes to ocean, averaged over grid cell - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & fzsal_ai, & ! salt flux to ocean from zsalinity (kg/m^2/s) fzsal_g_ai ! gravity drainage salt flux to ocean (kg/m^2/s) @@ -54,11 +54,11 @@ module ice_flux_bgc logical (kind=log_kind), public :: & cpl_bgc ! switch to couple BGC via drivers - real (kind=dbl_kind), dimension (nx_block,ny_block,ncat,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:,:), allocatable, public :: & hin_old , & ! old ice thickness dsnown ! change in snow thickness in category n (m) - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & nit , & ! ocean nitrate (mmol/m^3) amm , & ! ammonia/um (mmol/m^3) sil , & ! silicate (mmol/m^3) @@ -73,33 +73,82 @@ module ice_flux_bgc fhum , & ! ice-ocean humic material carbon (mmol/m^2/s), positive to ocean fdust ! ice-ocean dust flux (kg/m^2/s), positive to ocean - real (kind=dbl_kind), dimension (nx_block,ny_block,icepack_max_algae, max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:,:), allocatable, public :: & algalN , & ! ocean algal nitrogen (mmol/m^3) (diatoms, pico, phaeo) falgalN ! ice-ocean algal nitrogen flux (mmol/m^2/s) (diatoms, pico, phaeo) - real (kind=dbl_kind), dimension (nx_block,ny_block,icepack_max_doc, max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:,:), allocatable, public :: & doc , & ! ocean doc (mmol/m^3) (saccharids, lipids, tbd ) fdoc ! ice-ocean doc flux (mmol/m^2/s) (saccharids, lipids, tbd) - real (kind=dbl_kind), dimension (nx_block,ny_block,icepack_max_don, max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:,:), allocatable, public :: & don , & ! ocean don (mmol/m^3) (proteins and amino acids) fdon ! ice-ocean don flux (mmol/m^2/s) (proteins and amino acids) - real (kind=dbl_kind), dimension (nx_block,ny_block,icepack_max_dic, max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:,:), allocatable, public :: & dic , & ! ocean dic (mmol/m^3) fdic ! ice-ocean dic flux (mmol/m^2/s) - real (kind=dbl_kind), dimension (nx_block,ny_block,icepack_max_fe, max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:,:), allocatable, public :: & fed, fep , & ! ocean dissolved and particulate fe (nM) ffed, ffep ! ice-ocean dissolved and particulate fe flux (umol/m^2/s) - real (kind=dbl_kind), dimension (nx_block,ny_block,icepack_max_aero, max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:,:), allocatable, public :: & zaeros ! ocean aerosols (mmol/m^3) !======================================================================= contains +!======================================================================= +! +! Allocate space for all variables +! + subroutine alloc_flux_bgc + + integer (int_kind) :: ierr + + allocate( & + fzsal_ai (nx_block,ny_block,max_blocks), & ! salt flux to ocean from zsalinity (kg/m^2/s) + fzsal_g_ai (nx_block,ny_block,max_blocks), & ! gravity drainage salt flux to ocean (kg/m^2/s) + nit (nx_block,ny_block,max_blocks), & ! ocean nitrate (mmol/m^3) + amm (nx_block,ny_block,max_blocks), & ! ammonia/um (mmol/m^3) + sil (nx_block,ny_block,max_blocks), & ! silicate (mmol/m^3) + dmsp (nx_block,ny_block,max_blocks), & ! dmsp (mmol/m^3) + dms (nx_block,ny_block,max_blocks), & ! dms (mmol/m^3) + hum (nx_block,ny_block,max_blocks), & ! humic material carbon (mmol/m^3) + fnit (nx_block,ny_block,max_blocks), & ! ice-ocean nitrate flux (mmol/m^2/s), positive to ocean + famm (nx_block,ny_block,max_blocks), & ! ice-ocean ammonia/um flux (mmol/m^2/s), positive to ocean + fsil (nx_block,ny_block,max_blocks), & ! ice-ocean silicate flux (mmol/m^2/s), positive to ocean + fdmsp (nx_block,ny_block,max_blocks), & ! ice-ocean dmsp (mmol/m^2/s), positive to ocean + fdms (nx_block,ny_block,max_blocks), & ! ice-ocean dms (mmol/m^2/s), positive to ocean + fhum (nx_block,ny_block,max_blocks), & ! ice-ocean humic material carbon (mmol/m^2/s), positive to ocean + 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) + 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) + 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) + fdon (nx_block,ny_block,icepack_max_don,max_blocks), & ! ice-ocean don flux (mmol/m^2/s) (proteins and amino acids) + dic (nx_block,ny_block,icepack_max_dic,max_blocks), & ! ocean dic (mmol/m^3) + fdic (nx_block,ny_block,icepack_max_dic,max_blocks), & ! ice-ocean dic flux (mmol/m^2/s) + fed (nx_block,ny_block,icepack_max_fe, max_blocks), & ! ocean dissolved fe (nM) + fep (nx_block,ny_block,icepack_max_fe, max_blocks), & ! ocean particulate fe (nM) + ffed (nx_block,ny_block,icepack_max_fe, max_blocks), & ! ice-ocean dissolved fe flux (umol/m^2/s) + ffep (nx_block,ny_block,icepack_max_fe, max_blocks), & ! ice-ocean particulate fe flux (umol/m^2/s) + stat=ierr) + if (ierr/=0) call abort_ice('(alloc_flux_bgc): Out of memory') + + end subroutine alloc_flux_bgc + !======================================================================= ! Initialize some fluxes sent to coupler for use by the atm model diff --git a/cicecore/cicedynB/general/ice_forcing.F90 b/cicecore/cicedynB/general/ice_forcing.F90 index 07c8d3177..240d692f1 100644 --- a/cicecore/cicedynB/general/ice_forcing.F90 +++ b/cicecore/cicedynB/general/ice_forcing.F90 @@ -43,7 +43,7 @@ module ice_forcing implicit none private - public :: init_forcing_atmo, init_forcing_ocn, & + public :: init_forcing_atmo, init_forcing_ocn, alloc_forcing, & get_forcing_atmo, get_forcing_ocn, & read_clim_data, read_clim_data_nc, & interpolate_data, interp_coeff_monthly, & @@ -87,10 +87,10 @@ module ice_forcing oldrecnum = 0 , & ! old record number (save between steps) oldrecnum4X = 0 ! - real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks) :: & + real (kind=dbl_kind), dimension(:,:,:), allocatable :: & cldf ! cloud fraction - real (kind=dbl_kind), dimension(nx_block,ny_block,2,max_blocks) :: & + real (kind=dbl_kind), dimension(:,:,:,:), allocatable :: & fsw_data, & ! field values at 2 temporal data points cldf_data, & fsnow_data, & @@ -113,7 +113,7 @@ module ice_forcing frain_data real (kind=dbl_kind), & - dimension(nx_block,ny_block,2,max_blocks,ncat) :: & + dimension(:,:,:,:,:), allocatable :: & topmelt_data, & botmelt_data @@ -143,7 +143,7 @@ module ice_forcing frcidf = 0.17_dbl_kind ! frac of incoming sw in near IR diffuse band real (kind=dbl_kind), & - dimension (nx_block,ny_block,max_blocks,nfld,12) :: & + dimension (:,:,:,:,:), allocatable :: & ocn_frc_m ! ocn data for 12 months logical (kind=log_kind), public :: & @@ -162,6 +162,43 @@ module ice_forcing contains +!======================================================================= +! +! Allocate space for all variables +! + subroutine alloc_forcing + integer (int_kind) :: ierr + + allocate ( & + cldf(nx_block,ny_block, max_blocks), & ! cloud fraction + fsw_data(nx_block,ny_block,2,max_blocks), & ! field values at 2 temporal data points + cldf_data(nx_block,ny_block,2,max_blocks), & + fsnow_data(nx_block,ny_block,2,max_blocks), & + Tair_data(nx_block,ny_block,2,max_blocks), & + uatm_data(nx_block,ny_block,2,max_blocks), & + vatm_data(nx_block,ny_block,2,max_blocks), & + wind_data(nx_block,ny_block,2,max_blocks), & + strax_data(nx_block,ny_block,2,max_blocks), & + stray_data(nx_block,ny_block,2,max_blocks), & + Qa_data(nx_block,ny_block,2,max_blocks), & + rhoa_data(nx_block,ny_block,2,max_blocks), & + potT_data(nx_block,ny_block,2,max_blocks), & + zlvl_data(nx_block,ny_block,2,max_blocks), & + flw_data(nx_block,ny_block,2,max_blocks), & + sst_data(nx_block,ny_block,2,max_blocks), & + sss_data(nx_block,ny_block,2,max_blocks), & + uocn_data(nx_block,ny_block,2,max_blocks), & + vocn_data(nx_block,ny_block,2,max_blocks), & + sublim_data(nx_block,ny_block,2,max_blocks), & + frain_data(nx_block,ny_block,2,max_blocks), & + topmelt_data(nx_block,ny_block,2,max_blocks,ncat), & + botmelt_data(nx_block,ny_block,2,max_blocks,ncat), & + ocn_frc_m(nx_block,ny_block, max_blocks,nfld,12), & ! ocn data for 12 months + stat=ierr) + if (ierr/=0) call abort_ice('(alloc_forcing): Out of Memory') + + end subroutine alloc_forcing + !======================================================================= subroutine init_forcing_atmo @@ -171,6 +208,9 @@ subroutine init_forcing_atmo character(len=*), parameter :: subname = '(init_forcing_atmo)' + ! Allocate forcing arrays + call alloc_forcing() + fyear = fyear_init + mod(nyr-1,ycycle) ! current year fyear_final = fyear_init + ycycle - 1 ! last year in forcing cycle diff --git a/cicecore/cicedynB/general/ice_forcing_bgc.F90 b/cicecore/cicedynB/general/ice_forcing_bgc.F90 index 308654a42..e2245b578 100644 --- a/cicecore/cicedynB/general/ice_forcing_bgc.F90 +++ b/cicecore/cicedynB/general/ice_forcing_bgc.F90 @@ -28,16 +28,42 @@ module ice_forcing_bgc implicit none private - public :: get_forcing_bgc, get_atm_bgc, fzaero_data, & + public :: get_forcing_bgc, get_atm_bgc, fzaero_data, alloc_forcing_bgc, & init_bgc_data, faero_data, faero_default, faero_optics integer (kind=int_kind) :: & bgcrecnum = 0 ! old record number (save between steps) + real (kind=dbl_kind), dimension(:,:,:), allocatable :: & + nitdat , & ! data value toward which nitrate is restored + sildat ! data value toward which silicate is restored + + real (kind=dbl_kind), dimension(:,:,:,:), allocatable, save :: & + nit_data, & ! field values at 2 temporal data points + sil_data + !======================================================================= contains +!======================================================================= +! +! Allocate space for forcing_bgc variables +! + subroutine alloc_forcing_bgc + + integer (int_kind) :: ierr + + allocate( & + nitdat (nx_block,ny_block,max_blocks), & ! data value toward which nitrate is restored + sildat (nx_block,ny_block,max_blocks), & ! data value toward which silicate is restored + nit_data(nx_block,ny_block,2,max_blocks), & ! field values at 2 temporal data points + sil_data(nx_block,ny_block,2,max_blocks), & + stat=ierr) + if (ierr/=0) call abort_ice('(alloc_forcing_bgc): Out of memory') + + end subroutine alloc_forcing_bgc + !======================================================================= ! ! Read and interpolate annual climatologies of silicate and nitrate. @@ -73,14 +99,6 @@ subroutine get_forcing_bgc met_file, & ! netcdf filename fieldname ! field name in netcdf file - real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks) :: & - nitdat , & ! data value toward which nitrate is restored - sildat ! data value toward which silicate is restored - - real (kind=dbl_kind), dimension(nx_block,ny_block,2,max_blocks), save :: & - nit_data, & ! field values at 2 temporal data points - sil_data - real (kind=dbl_kind), dimension(2), save :: & sil_data_p , & ! field values at 2 temporal data points nit_data_p ! field values at 2 temporal data points @@ -488,7 +506,7 @@ subroutine faero_data #ifdef ncdf ! local parameters - real (kind=dbl_kind), dimension(nx_block,ny_block,2,max_blocks), & + real (kind=dbl_kind), dimension(:,:,:,:), allocatable, & save :: & aero1_data , & ! field values at 2 temporal data points aero2_data , & ! field values at 2 temporal data points @@ -508,6 +526,11 @@ subroutine faero_data character(len=*), parameter :: subname = '(faero_data)' + allocate( aero1_data(nx_block,ny_block,2,max_blocks), & + aero2_data(nx_block,ny_block,2,max_blocks), & + aero3_data(nx_block,ny_block,2,max_blocks) ) + + !------------------------------------------------------------------- ! monthly data ! @@ -564,6 +587,7 @@ subroutine faero_data where (faero_atm(:,:,:,:) > 1.e20) faero_atm(:,:,:,:) = c0 + deallocate( aero1_data, aero2_data, aero3_data ) #endif end subroutine faero_data @@ -584,7 +608,7 @@ subroutine fzaero_data #ifdef ncdf ! local parameters - real (kind=dbl_kind), dimension(nx_block,ny_block,2,max_blocks), & + real (kind=dbl_kind), dimension(:,:,:,:), allocatable, & save :: & aero_data ! field values at 2 temporal data points @@ -610,6 +634,8 @@ subroutine fzaero_data if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) + allocate( aero_data(nx_block,ny_block,2,max_blocks) ) + !------------------------------------------------------------------- ! monthly data ! @@ -656,6 +682,7 @@ subroutine fzaero_data where (faero_atm(:,:,nlt_zaero(1),:) > 1.e20) faero_atm(:,:,nlt_zaero(1),:) = c0 + deallocate( aero_data ) #endif end subroutine fzaero_data diff --git a/cicecore/cicedynB/general/ice_state.F90 b/cicecore/cicedynB/general/ice_state.F90 index d5dafece1..b8529785c 100644 --- a/cicecore/cicedynB/general/ice_state.F90 +++ b/cicecore/cicedynB/general/ice_state.F90 @@ -45,20 +45,20 @@ module ice_state implicit none private - public :: bound_state + public :: bound_state, alloc_state !----------------------------------------------------------------- ! state of the ice aggregated over all categories !----------------------------------------------------------------- - real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), & + real (kind=dbl_kind), dimension(:,:,:), allocatable, & public :: & aice , & ! concentration of ice vice , & ! volume per unit area of ice (m) vsno ! volume per unit area of snow (m) real (kind=dbl_kind), & - dimension(nx_block,ny_block,max_ntrcr,max_blocks), public :: & + dimension(:,:,:,:), allocatable, public :: & trcr ! ice tracers ! 1: surface temperature of ice/snow (C) @@ -66,18 +66,18 @@ module ice_state ! state of the ice for each category !----------------------------------------------------------------- - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), & + real (kind=dbl_kind), dimension (:,:,:), allocatable, & public:: & aice0 ! concentration of open water real (kind=dbl_kind), & - dimension (nx_block,ny_block,ncat,max_blocks), public :: & + dimension (:,:,:,:), allocatable, public :: & aicen , & ! concentration of ice vicen , & ! volume per unit area of ice (m) vsnon ! volume per unit area of snow (m) real (kind=dbl_kind), public, & - dimension (nx_block,ny_block,max_ntrcr,ncat,max_blocks) :: & + dimension (:,:,:,:,:), allocatable :: & trcrn ! tracers ! 1: surface temperature of ice/snow (C) @@ -104,7 +104,7 @@ module ice_state ! dynamic variables closely related to the state of the ice !----------------------------------------------------------------- - real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), & + real (kind=dbl_kind), dimension(:,:,:), allocatable, & public :: & uvel , & ! x-component of velocity (m/s) vvel , & ! y-component of velocity (m/s) @@ -116,12 +116,12 @@ module ice_state ! ice state at start of time step, saved for later in the step !----------------------------------------------------------------- - real (kind=dbl_kind), dimension(nx_block,ny_block,max_blocks), & + real (kind=dbl_kind), dimension(:,:,:), allocatable, & public :: & aice_init ! initial concentration of ice, for diagnostics real (kind=dbl_kind), & - dimension(nx_block,ny_block,ncat,max_blocks), public :: & + dimension(:,:,:,:), allocatable, public :: & aicen_init , & ! initial ice concentration, for linear ITD vicen_init , & ! initial ice volume (m), for linear ITD vsnon_init ! initial snow volume (m), for aerosol @@ -130,6 +130,37 @@ module ice_state contains +!======================================================================= +! +! Allocate space for all state variables +! + subroutine alloc_state + integer (int_kind) :: ierr + + allocate ( & + aice (nx_block,ny_block,max_blocks) , & ! concentration of ice + vice (nx_block,ny_block,max_blocks) , & ! volume per unit area of ice (m) + vsno (nx_block,ny_block,max_blocks) , & ! volume per unit area of snow (m) + aice0 (nx_block,ny_block,max_blocks) , & ! concentration of open water + uvel (nx_block,ny_block,max_blocks) , & ! x-component of velocity (m/s) + vvel (nx_block,ny_block,max_blocks) , & ! y-component of velocity (m/s) + divu (nx_block,ny_block,max_blocks) , & ! strain rate I component, velocity divergence (1/s) + shear (nx_block,ny_block,max_blocks) , & ! strain rate II component (1/s) + strength (nx_block,ny_block,max_blocks) , & ! ice strength (N/m) + aice_init (nx_block,ny_block,max_blocks) , & ! initial concentration of ice, for diagnostics + aicen (nx_block,ny_block,ncat,max_blocks) , & ! concentration of ice + vicen (nx_block,ny_block,ncat,max_blocks) , & ! volume per unit area of ice (m) + vsnon (nx_block,ny_block,ncat,max_blocks) , & ! volume per unit area of snow (m) + aicen_init(nx_block,ny_block,ncat,max_blocks) , & ! initial ice concentration, for linear ITD + vicen_init(nx_block,ny_block,ncat,max_blocks) , & ! initial ice volume (m), for linear ITD + vsnon_init(nx_block,ny_block,ncat,max_blocks) , & ! initial snow volume (m), for aerosol + trcr (nx_block,ny_block,max_ntrcr,max_blocks) , & ! ice tracers: 1: surface temperature of ice/snow (C) + trcrn (nx_block,ny_block,max_ntrcr,ncat,max_blocks) , & ! tracers: 1: surface temperature of ice/snow (C) + stat=ierr) + if (ierr/=0) call abort_ice('(alloc_state): Out of memory') + + end subroutine alloc_state + !======================================================================= ! ! Get ghost cell values for ice state variables in each thickness category. diff --git a/cicecore/cicedynB/infrastructure/ice_blocks.F90 b/cicecore/cicedynB/infrastructure/ice_blocks.F90 index 326dbebf8..431741e2b 100644 --- a/cicecore/cicedynB/infrastructure/ice_blocks.F90 +++ b/cicecore/cicedynB/infrastructure/ice_blocks.F90 @@ -43,9 +43,8 @@ module ice_blocks integer (int_kind), parameter, public :: & nghost = 1 ! number of ghost cells around each block - integer (int_kind), parameter, public :: &! size of block domain in - nx_block = block_size_x + 2*nghost, &! x,y dir including ghost - ny_block = block_size_y + 2*nghost ! cells + integer (int_kind), public :: &! size of block domain in + nx_block, ny_block ! x,y dir including ghost ! predefined directions for neighbor id routine ! Note: the directions that are commented out are implemented in @@ -147,6 +146,8 @@ subroutine create_blocks(nx_global, ny_global, ew_boundary_type, & ! !---------------------------------------------------------------------- + nx_block = block_size_x + 2*nghost ! size of block domain in x,y dir + ny_block = block_size_y + 2*nghost ! including ghost cells nblocks_x = (nx_global-1)/block_size_x + 1 nblocks_y = (ny_global-1)/block_size_y + 1 nblocks_tot = nblocks_x*nblocks_y diff --git a/cicecore/cicedynB/infrastructure/ice_domain.F90 b/cicecore/cicedynB/infrastructure/ice_domain.F90 index 259ba985d..030bc63c5 100644 --- a/cicecore/cicedynB/infrastructure/ice_domain.F90 +++ b/cicecore/cicedynB/infrastructure/ice_domain.F90 @@ -93,7 +93,7 @@ subroutine init_domain_blocks use ice_distribution, only: processor_shape use ice_domain_size, only: ncat, nilyr, nslyr, max_blocks, & - nx_global, ny_global + nx_global, ny_global, block_size_x, block_size_y !---------------------------------------------------------------------- ! @@ -113,6 +113,11 @@ subroutine init_domain_blocks !---------------------------------------------------------------------- namelist /domain_nml/ nprocs, & + max_blocks, & + block_size_x, & + block_size_y, & + nx_global, & + ny_global, & processor_shape, & distribution_type, & distribution_wght, & @@ -139,6 +144,11 @@ subroutine init_domain_blocks maskhalo_dyn = .false. ! if true, use masked halos for dynamics maskhalo_remap = .false. ! if true, use masked halos for transport maskhalo_bound = .false. ! if true, use masked halos for bound_state + max_blocks = -1 ! max number of blocks per processor + block_size_x = -1 ! size of block in first horiz dimension + block_size_y = -1 ! size of block in second horiz dimension + nx_global = -1 ! NXGLOB, i-axis size + ny_global = -1 ! NYGLOB, j-axis size call get_fileunit(nu_nml) if (my_task == master_task) then @@ -170,6 +180,19 @@ subroutine init_domain_blocks call broadcast_scalar(maskhalo_dyn, master_task) call broadcast_scalar(maskhalo_remap, master_task) call broadcast_scalar(maskhalo_bound, master_task) + if (my_task == master_task) then + if (max_blocks < 1) then + max_blocks=( ((nx_global-1)/block_size_x + 1) * & + ((ny_global-1)/block_size_y + 1) ) / nprocs + write(nu_diag,'(/,a52,i6,/)') & + '(ice_domain): max_block < 1: max_block estimated to ',max_blocks + endif + endif + call broadcast_scalar(max_blocks, master_task) + call broadcast_scalar(block_size_x, master_task) + call broadcast_scalar(block_size_y, master_task) + call broadcast_scalar(nx_global, master_task) + call broadcast_scalar(ny_global, master_task) !---------------------------------------------------------------------- ! diff --git a/cicecore/cicedynB/infrastructure/ice_grid.F90 b/cicecore/cicedynB/infrastructure/ice_grid.F90 index 1ea454d45..ea5aaddb3 100644 --- a/cicecore/cicedynB/infrastructure/ice_grid.F90 +++ b/cicecore/cicedynB/infrastructure/ice_grid.F90 @@ -35,7 +35,7 @@ module ice_grid private public :: init_grid1, init_grid2, & t2ugrid_vector, u2tgrid_vector, & - to_ugrid, to_tgrid + to_ugrid, to_tgrid, alloc_grid character (len=char_len_long), public :: & grid_format , & ! file format ('bin'=binary or 'nc'=netcdf) @@ -45,7 +45,7 @@ module ice_grid grid_type ! current options are rectangular (default), ! displaced_pole, tripole, regional - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & dxt , & ! width of T-cell through the middle (m) dyt , & ! height of T-cell through the middle (m) dxu , & ! width of U-cell through the middle (m) @@ -69,7 +69,7 @@ module ice_grid ocn_gridcell_frac ! only relevant for lat-lon grids ! gridcell value of [1 - (land fraction)] (T-cell) - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & cyp , & ! 1.5*HTE - 0.5*HTE cxp , & ! 1.5*HTN - 0.5*HTN cym , & ! 0.5*HTE - 1.5*HTE @@ -78,14 +78,14 @@ module ice_grid dyhx ! 0.5*(HTN - HTN) ! Corners of grid boxes for history output - real (kind=dbl_kind), dimension (4,nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:,:), allocatable, public :: & lont_bounds, & ! longitude of gridbox corners for T point latt_bounds, & ! latitude of gridbox corners for T point lonu_bounds, & ! longitude of gridbox corners for U point latu_bounds ! latitude of gridbox corners for U point ! geometric quantities used for remapping transport - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & xav , & ! mean T-cell value of x yav , & ! mean T-cell value of y xxav , & ! mean T-cell value of xx @@ -98,21 +98,21 @@ module ice_grid ! yyyav ! mean T-cell value of yyy real (kind=dbl_kind), & - dimension (2,2,nx_block,ny_block,max_blocks), public :: & + dimension (:,:,:,:,:), allocatable, public :: & mne, & ! matrices used for coordinate transformations in remapping mnw, & ! ne = northeast corner, nw = northwest, etc. mse, & msw ! masks - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & hm , & ! land/boundary mask, thickness (T-cell) bm , & ! task/block id uvm , & ! land/boundary mask, velocity (U-cell) kmt ! ocean topography mask for bathymetry (T-cell) logical (kind=log_kind), & - dimension (nx_block,ny_block,max_blocks), public :: & + dimension (:,:,:), allocatable, public :: & tmask , & ! land/boundary mask, thickness (T-cell) umask , & ! land/boundary mask, velocity (U-cell) lmask_n, & ! northern hemisphere mask @@ -123,13 +123,75 @@ module ice_grid dxrect = 30.e5_dbl_kind ,&! uniform HTN (cm) dyrect = 30.e5_dbl_kind ! uniform HTE (cm) - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & rndex_global ! global index for local subdomain (dbl) !======================================================================= contains +!======================================================================= +! +! Allocate space for all variables +! + subroutine alloc_grid + + integer (int_kind) :: ierr + + allocate( & + dxt (nx_block,ny_block,max_blocks), & ! width of T-cell through the middle (m) + dyt (nx_block,ny_block,max_blocks), & ! height of T-cell through the middle (m) + dxu (nx_block,ny_block,max_blocks), & ! width of U-cell through the middle (m) + dyu (nx_block,ny_block,max_blocks), & ! height of U-cell through the middle (m) + HTE (nx_block,ny_block,max_blocks), & ! length of eastern edge of T-cell (m) + HTN (nx_block,ny_block,max_blocks), & ! length of northern edge of T-cell (m) + tarea (nx_block,ny_block,max_blocks), & ! area of T-cell (m^2) + uarea (nx_block,ny_block,max_blocks), & ! area of U-cell (m^2) + tarear (nx_block,ny_block,max_blocks), & ! 1/tarea + uarear (nx_block,ny_block,max_blocks), & ! 1/uarea + tinyarea (nx_block,ny_block,max_blocks), & ! puny*tarea + tarean (nx_block,ny_block,max_blocks), & ! area of NH T-cells + tareas (nx_block,ny_block,max_blocks), & ! area of SH T-cells + ULON (nx_block,ny_block,max_blocks), & ! longitude of velocity pts (radians) + ULAT (nx_block,ny_block,max_blocks), & ! latitude of velocity pts (radians) + TLON (nx_block,ny_block,max_blocks), & ! longitude of temp pts (radians) + TLAT (nx_block,ny_block,max_blocks), & ! latitude of temp pts (radians) + ANGLE (nx_block,ny_block,max_blocks), & ! for conversions between POP grid and lat/lon + ANGLET (nx_block,ny_block,max_blocks), & ! ANGLE converted to T-cells + bathymetry(nx_block,ny_block,max_blocks),& ! ocean depth, for grounding keels and bergs (m) + ocn_gridcell_frac(nx_block,ny_block,max_blocks),& ! only relevant for lat-lon grids + cyp (nx_block,ny_block,max_blocks), & ! 1.5*HTE - 0.5*HTE + cxp (nx_block,ny_block,max_blocks), & ! 1.5*HTN - 0.5*HTN + cym (nx_block,ny_block,max_blocks), & ! 0.5*HTE - 1.5*HTE + cxm (nx_block,ny_block,max_blocks), & ! 0.5*HTN - 1.5*HTN + dxhy (nx_block,ny_block,max_blocks), & ! 0.5*(HTE - HTE) + dyhx (nx_block,ny_block,max_blocks), & ! 0.5*(HTN - HTN) + xav (nx_block,ny_block,max_blocks), & ! mean T-cell value of x + yav (nx_block,ny_block,max_blocks), & ! mean T-cell value of y + xxav (nx_block,ny_block,max_blocks), & ! mean T-cell value of xx + yyav (nx_block,ny_block,max_blocks), & ! mean T-cell value of yy + hm (nx_block,ny_block,max_blocks), & ! land/boundary mask, thickness (T-cell) + bm (nx_block,ny_block,max_blocks), & ! task/block id + uvm (nx_block,ny_block,max_blocks), & ! land/boundary mask, velocity (U-cell) + kmt (nx_block,ny_block,max_blocks), & ! ocean topography mask for bathymetry (T-cell) + tmask (nx_block,ny_block,max_blocks), & ! land/boundary mask, thickness (T-cell) + umask (nx_block,ny_block,max_blocks), & ! land/boundary mask, velocity (U-cell) + lmask_n (nx_block,ny_block,max_blocks), & ! northern hemisphere mask + lmask_s (nx_block,ny_block,max_blocks), & ! southern hemisphere mask + rndex_global(nx_block,ny_block,max_blocks), & ! global index for local subdomain (dbl) + lont_bounds(4,nx_block,ny_block,max_blocks), & ! longitude of gridbox corners for T point + latt_bounds(4,nx_block,ny_block,max_blocks), & ! latitude of gridbox corners for T point + lonu_bounds(4,nx_block,ny_block,max_blocks), & ! longitude of gridbox corners for U point + latu_bounds(4,nx_block,ny_block,max_blocks), & ! latitude of gridbox corners for U point + mne (2,2,nx_block,ny_block,max_blocks), & ! matrices used for coordinate transformations in remapping + mnw (2,2,nx_block,ny_block,max_blocks), & ! ne = northeast corner, nw = northwest, etc. + mse (2,2,nx_block,ny_block,max_blocks), & + msw (2,2,nx_block,ny_block,max_blocks), & + stat=ierr) + if (ierr/=0) call abort_ice('(alloc_grid): Out of memory') + + end subroutine alloc_grid + !======================================================================= ! Distribute blocks across processors. The distribution is optimized diff --git a/cicecore/drivers/cesm/CICE_InitMod.F90 b/cicecore/drivers/cesm/CICE_InitMod.F90 index e4af39753..70d5af3ce 100644 --- a/cicecore/drivers/cesm/CICE_InitMod.F90 +++ b/cicecore/drivers/cesm/CICE_InitMod.F90 @@ -58,22 +58,22 @@ end subroutine CICE_Initialize subroutine cice_init(mpicom_ice) use ice_arrays_column, only: hin_max, c_hi_range, zfswin, trcrn_sw, & - ocean_bio_all, ice_bio_net, snow_bio_net + ocean_bio_all, ice_bio_net, snow_bio_net, alloc_arrays_column use ice_calendar, only: dt, dt_dyn, write_ic, & init_calendar, calendar, time use ice_communicate, only: init_communicate, my_task, master_task use ice_diagnostics, only: init_diags use ice_domain, only: init_domain_blocks use ice_domain_size, only: ncat - use ice_dyn_eap, only: init_eap - use ice_dyn_shared, only: kdyn, init_evp + use ice_dyn_eap, only: init_eap, alloc_dyn_eap + use ice_dyn_shared, only: kdyn, init_evp, alloc_dyn_shared use ice_flux, only: init_coupler_flux, init_history_therm, & - init_history_dyn, init_flux_atm, init_flux_ocn + init_history_dyn, init_flux_atm, init_flux_ocn, alloc_flux use ice_forcing, only: init_forcing_ocn, init_forcing_atmo, & - get_forcing_atmo, get_forcing_ocn + get_forcing_atmo, get_forcing_ocn, alloc_forcing use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, & - faero_data, faero_default, faero_optics - use ice_grid, only: init_grid1, init_grid2 + faero_data, faero_default, faero_optics, alloc_forcing_bgc + use ice_grid, only: init_grid1, init_grid2, alloc_grid use ice_history, only: init_hist, accum_hist use ice_restart_shared, only: restart, runid, runtype use ice_init, only: input_data, init_state @@ -110,6 +110,12 @@ subroutine cice_init(mpicom_ice) call init_domain_blocks ! set up block decomposition call init_grid1 ! domain distribution + call alloc_grid ! allocate grid + call alloc_arrays_column ! allocate column arrays + call alloc_state ! allocate state + call alloc_dyn_shared ! allocate dyn shared (init_uvel,init_vvel) + call alloc_flux_bgc ! allocate flux_bgc + call alloc_flux ! allocate flux call init_ice_timers ! initialize all timers call ice_timer_start(timer_total) ! start timing entire run call init_grid2 ! grid variables @@ -118,6 +124,7 @@ subroutine cice_init(mpicom_ice) call init_hist (dt) ! initialize output history file if (kdyn == 2) then + call alloc_dyn_eap ! allocate dyn_eap arrays call init_eap (dt_dyn) ! define eap dynamics parameters, variables else ! for both kdyn = 0 or 1 call init_evp (dt_dyn) ! define evp dynamics parameters, variables @@ -181,6 +188,7 @@ subroutine cice_init(mpicom_ice) ! if (tr_zaero) call fzaero_data ! data file (gx1) if (tr_aero .or. tr_zaero) call faero_default ! default values + if (skl_bgc .or. z_tracers) call alloc_forcing_bgc ! allocate biogeochemistry arrays if (skl_bgc .or. z_tracers) call get_forcing_bgc ! biogeochemistry #endif #endif diff --git a/cicecore/drivers/cice/CICE_InitMod.F90 b/cicecore/drivers/cice/CICE_InitMod.F90 index 07043693e..567ab2a7c 100644 --- a/cicecore/drivers/cice/CICE_InitMod.F90 +++ b/cicecore/drivers/cice/CICE_InitMod.F90 @@ -59,23 +59,25 @@ end subroutine CICE_Initialize subroutine cice_init + use ice_state, only: alloc_state + use ice_flux_bgc, only: alloc_flux_bgc use ice_arrays_column, only: hin_max, c_hi_range, zfswin, trcrn_sw, & - ocean_bio_all, ice_bio_net, snow_bio_net + ocean_bio_all, ice_bio_net, snow_bio_net, alloc_arrays_column use ice_calendar, only: dt, dt_dyn, time, istep, istep1, write_ic, & init_calendar, calendar use ice_communicate, only: init_communicate, my_task, master_task use ice_diagnostics, only: init_diags use ice_domain, only: init_domain_blocks use ice_domain_size, only: ncat - use ice_dyn_eap, only: init_eap - use ice_dyn_shared, only: kdyn, init_evp, basalstress + use ice_dyn_eap, only: init_eap, alloc_dyn_eap + use ice_dyn_shared, only: kdyn, init_evp, basalstress, alloc_dyn_shared use ice_flux, only: init_coupler_flux, init_history_therm, & - init_history_dyn, init_flux_atm, init_flux_ocn + init_history_dyn, init_flux_atm, init_flux_ocn, alloc_flux use ice_forcing, only: init_forcing_ocn, init_forcing_atmo, & - get_forcing_atmo, get_forcing_ocn + get_forcing_atmo, get_forcing_ocn, alloc_forcing use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, & - faero_data, faero_default, faero_optics - use ice_grid, only: init_grid1, init_grid2 + faero_data, faero_default, faero_optics, alloc_forcing_bgc + use ice_grid, only: init_grid1, init_grid2, alloc_grid use ice_history, only: init_hist, accum_hist use ice_restart_shared, only: restart, runid, runtype use ice_init, only: input_data, init_state @@ -106,6 +108,12 @@ subroutine cice_init call init_domain_blocks ! set up block decomposition call init_grid1 ! domain distribution + call alloc_grid ! allocate grid arrays + call alloc_arrays_column ! allocate column arrays + call alloc_state ! allocate state arrays + call alloc_dyn_shared ! allocate dyn shared arrays + call alloc_flux_bgc ! allocate flux_bgc arrays + call alloc_flux ! allocate flux arrays call init_ice_timers ! initialize all timers call ice_timer_start(timer_total) ! start timing entire run call init_grid2 ! grid variables @@ -114,6 +122,7 @@ subroutine cice_init call init_hist (dt) ! initialize output history file if (kdyn == 2) then + call alloc_dyn_eap ! allocate dyn_eap arrays call init_eap (dt_dyn) ! define eap dynamics parameters, variables else ! for both kdyn = 0 or 1 call init_evp (dt_dyn) ! define evp dynamics parameters, variables @@ -182,6 +191,7 @@ subroutine cice_init ! if (tr_zaero) call fzaero_data ! data file (gx1) if (tr_aero .or. tr_zaero) call faero_default ! default values + if (skl_bgc .or. z_tracers) call alloc_forcing_bgc ! allocate biogeochemistry arrays if (skl_bgc .or. z_tracers) call get_forcing_bgc ! biogeochemistry #endif #endif diff --git a/cicecore/drivers/hadgem3/CICE_InitMod.F90 b/cicecore/drivers/hadgem3/CICE_InitMod.F90 index 70a2ea707..e72a396d2 100644 --- a/cicecore/drivers/hadgem3/CICE_InitMod.F90 +++ b/cicecore/drivers/hadgem3/CICE_InitMod.F90 @@ -58,23 +58,25 @@ end subroutine CICE_Initialize subroutine cice_init + use ice_state, only: alloc_state + use ice_flux_bgc, only: alloc_flux_bgc use ice_arrays_column, only: hin_max, c_hi_range, zfswin, trcrn_sw, & - ocean_bio_all, ice_bio_net, snow_bio_net + ocean_bio_all, ice_bio_net, snow_bio_net, alloc_arrays_column use ice_calendar, only: dt, dt_dyn, time, istep, istep1, write_ic, & init_calendar, calendar use ice_communicate, only: init_communicate, my_task, master_task use ice_diagnostics, only: init_diags use ice_domain, only: init_domain_blocks use ice_domain_size, only: ncat - use ice_dyn_eap, only: init_eap - use ice_dyn_shared, only: kdyn, init_evp, basalstress + use ice_dyn_eap, only: init_eap, alloc_dyn_eap + use ice_dyn_shared, only: kdyn, init_evp, basalstress, alloc_dyn_shared use ice_flux, only: init_coupler_flux, init_history_therm, & - init_history_dyn, init_flux_atm, init_flux_ocn + init_history_dyn, init_flux_atm, init_flux_ocn, alloc_flux use ice_forcing, only: init_forcing_ocn, init_forcing_atmo, & - get_forcing_atmo, get_forcing_ocn + get_forcing_atmo, get_forcing_ocn, alloc_forcing use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, & - faero_data, faero_default, faero_optics - use ice_grid, only: init_grid1, init_grid2 + faero_data, faero_default, faero_optics, alloc_forcing_bgc + use ice_grid, only: init_grid1, init_grid2, alloc_grid use ice_history, only: init_hist, accum_hist use ice_restart_shared, only: restart, runid, runtype use ice_init, only: input_data, init_state @@ -105,6 +107,12 @@ subroutine cice_init call init_domain_blocks ! set up block decomposition call init_grid1 ! domain distribution + call alloc_grid ! allocate grid + call alloc_arrays_column ! allocate column arrays + call alloc_state ! allocate state + call alloc_dyn_shared ! allocate dyn shared (init_uvel,init_vvel) + call alloc_flux_bgc ! allocate flux_bgc + call alloc_flux ! allocate flux call init_ice_timers ! initialize all timers call ice_timer_start(timer_total) ! start timing entire run call init_grid2 ! grid variables @@ -113,6 +121,7 @@ subroutine cice_init call init_hist (dt) ! initialize output history file if (kdyn == 2) then + call alloc_dyn_eap ! allocate dyn_eap arrays call init_eap (dt_dyn) ! define eap dynamics parameters, variables else ! for both kdyn = 0 or 1 call init_evp (dt_dyn) ! define evp dynamics parameters, variables @@ -185,6 +194,7 @@ subroutine cice_init ! if (tr_zaero) call fzaero_data ! data file (gx1) if (tr_aero .or. tr_zaero) call faero_default ! default values + if (skl_bgc .or. z_tracers) call alloc_forcing_bgc ! Allocate biogeochemistry arrays if (skl_bgc .or. z_tracers) call get_forcing_bgc ! biogeochemistry #endif #endif diff --git a/cicecore/shared/ice_arrays_column.F90 b/cicecore/shared/ice_arrays_column.F90 index 64f5df00b..c5bc243f1 100644 --- a/cicecore/shared/ice_arrays_column.F90 +++ b/cicecore/shared/ice_arrays_column.F90 @@ -18,10 +18,11 @@ module ice_arrays_column icepack_nmodal1, icepack_nmodal2 implicit none + public :: alloc_arrays_column ! icepack_atmo.F90 real (kind=dbl_kind), public, & - dimension (nx_block,ny_block,max_blocks) :: & + dimension (:,:,:), allocatable :: & Cdn_atm , & ! atm drag coefficient Cdn_ocn , & ! ocn drag coefficient ! form drag @@ -65,14 +66,14 @@ module ice_arrays_column ! icepack_meltpond_lvl.F90 real (kind=dbl_kind), public, & - dimension (nx_block,ny_block,ncat,max_blocks) :: & + dimension (:,:,:,:), allocatable :: & dhsn, & ! depth difference for snow on sea ice and pond ice ffracn ! fraction of fsurfn used to melt ipond ! icepack_shortwave.F90 ! category albedos real (kind=dbl_kind), & - dimension (nx_block,ny_block,ncat,max_blocks), public :: & + dimension (:,:,:,:), allocatable, public :: & alvdrn , & ! visible direct albedo (fraction) alidrn , & ! near-ir direct albedo (fraction) alvdfn , & ! visible diffuse albedo (fraction) @@ -80,32 +81,32 @@ module ice_arrays_column ! albedo components for history real (kind=dbl_kind), & - dimension (nx_block,ny_block,ncat,max_blocks), public :: & + dimension (:,:,:,:), allocatable, public :: & albicen, & ! bare ice albsnon, & ! snow albpndn, & ! pond apeffn ! effective pond area used for radiation calculation - real (kind=dbl_kind), dimension (nx_block,ny_block,ncat,max_blocks), & + real (kind=dbl_kind), dimension (:,:,:,:), allocatable, & public :: & snowfracn ! Category snow fraction used in radiation ! shortwave components real (kind=dbl_kind), & - dimension (nx_block,ny_block,nilyr,ncat,max_blocks), public :: & + dimension (:,:,:,:,:), allocatable, public :: & Iswabsn ! SW radiation absorbed in ice layers (W m-2) real (kind=dbl_kind), & - dimension (nx_block,ny_block,nslyr,ncat,max_blocks), public :: & + dimension (:,:,:,:,:), allocatable, public :: & Sswabsn ! SW radiation absorbed in snow layers (W m-2) - real (kind=dbl_kind), dimension (nx_block,ny_block,ncat,max_blocks), & + real (kind=dbl_kind), dimension (:,:,:,:), allocatable, & public :: & fswsfcn , & ! SW absorbed at ice/snow surface (W m-2) fswthrun , & ! SW through ice to ocean (W/m^2) fswintn ! SW absorbed in ice interior, below surface (W m-2) - real (kind=dbl_kind), dimension (nx_block,ny_block,nilyr+1,ncat,max_blocks), & + real (kind=dbl_kind), dimension (:,:,:,:,:), allocatable, & public :: & fswpenln ! visible SW entering ice layers (W m-2) @@ -138,27 +139,27 @@ module ice_arrays_column icgrid , & ! interface grid for CICE (shortwave variable) swgrid ! grid for ice tracers used in dEdd scheme - real (kind=dbl_kind), dimension (nx_block,ny_block,ncat,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:,:), allocatable, public :: & first_ice_real ! .true. = c1, .false. = c0 logical (kind=log_kind), & - dimension (nx_block,ny_block,ncat,max_blocks), public :: & + dimension (:,:,:,:), allocatable, public :: & first_ice ! distinguishes ice that disappears (e.g. melts) ! and reappears (e.g. transport) in a grid cell ! during a single time step from ice that was ! there the entire time step (true until ice forms) real (kind=dbl_kind), & - dimension (nx_block,ny_block,icepack_max_nbtrcr,max_blocks), public :: & + dimension (:,:,:,:), allocatable, public :: & ocean_bio ! contains all the ocean bgc tracer concentrations ! diagnostic fluxes real (kind=dbl_kind), & - dimension (nx_block,ny_block,icepack_max_nbtrcr,max_blocks), public :: & + dimension (:,:,:,:), allocatable, public :: & fbio_snoice, & ! fluxes from snow to ice fbio_atmice ! fluxes from atm to ice - real (kind=dbl_kind), dimension (nx_block,ny_block,icepack_max_nbtrcr, max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:,:), allocatable, public :: & ocean_bio_all ! fixed order, all values even for tracers false ! N(1:icepack_max_algae) = 1:icepack_max_algae ! Nit = icepack_max_algae + 1 @@ -184,76 +185,76 @@ module ice_arrays_column ! humic == 2*icepack_max_algae + icepack_max_doc + 8 + icepack_max_dic + icepack_max_don + 2*icepack_max_fe ! + icepack_max_aero - integer (kind=int_kind), dimension(nx_block, ny_block,icepack_max_algae, max_blocks), public :: & + integer (kind=int_kind), dimension(:,:,:,:), allocatable, public :: & algal_peak ! vertical location of algal maximum, 0 if no maximum real (kind=dbl_kind), & - dimension (nx_block,ny_block,nblyr+1,ncat,max_blocks), public :: & + dimension (:,:,:,:,:), allocatable, public :: & Zoo ! N losses accumulated in timestep (ie. zooplankton/bacteria) ! mmol/m^3 real (kind=dbl_kind), & - dimension (nx_block,ny_block,ncat,max_blocks), public :: & + dimension (:,:,:,:), allocatable, public :: & dhbr_top , & ! brine top change dhbr_bot ! brine bottom change real (kind=dbl_kind), & - dimension (nx_block,ny_block,max_blocks), public :: & + dimension (:,:,:), allocatable, public :: & grow_net , & ! Specific growth rate (/s) per grid cell PP_net , & ! Total production (mg C/m^2/s) per grid cell hbri ! brine height, area-averaged for comparison with hi (m) real (kind=dbl_kind), & - dimension (nx_block,ny_block,nblyr+2,ncat,max_blocks), public :: & + dimension (:,:,:,:,:), allocatable, public :: & bphi , & ! porosity of layers bTiz ! layer temperatures interpolated on bio grid (C) real (kind=dbl_kind), & - dimension (nx_block,ny_block,ncat,max_blocks), public :: & + dimension (:,:,:,:), allocatable, public :: & darcy_V ! darcy velocity positive up (m/s) - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & zsal_tot , & ! Total ice salinity in per grid cell (g/m^2) chl_net , & ! Total chla (mg chla/m^2) per grid cell NO_net ! Total nitrate per grid cell - logical (kind=log_kind), dimension (nx_block,ny_block,max_blocks), public :: & + logical (kind=log_kind), dimension (:,:,:), allocatable, public :: & Rayleigh_criteria ! .true. means Ra_c was reached - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & Rayleigh_real ! .true. = c1, .false. = c0 real (kind=dbl_kind), & - dimension (nx_block,ny_block,ncat,max_blocks), public :: & + dimension (:,:,:,:), allocatable, public :: & sice_rho ! avg sea ice density (kg/m^3) ! ech: diagnostic only? real (kind=dbl_kind), & - dimension (nx_block,ny_block,ncat,max_blocks), public :: & + dimension (:,:,:,:), allocatable, public :: & fzsaln, & ! category fzsal(kg/m^2/s) fzsaln_g ! salt flux from gravity drainage only - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & fzsal , & ! Total flux of salt to ocean at time step for conservation fzsal_g ! Total gravity drainage flux - real (kind=dbl_kind), dimension (nx_block,ny_block,nblyr+1,ncat,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:,:,:), allocatable, public :: & zfswin ! Shortwave flux into layers interpolated on bio grid (W/m^2) - real (kind=dbl_kind), dimension (nx_block,ny_block,nblyr+1,ncat,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:,:,:), allocatable, public :: & iDi , & ! igrid Diffusivity (m^2/s) iki ! Ice permeability (m^2) - real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), public :: & + real (kind=dbl_kind), dimension (:,:,:), allocatable, public :: & upNO , & ! nitrate uptake rate (mmol/m^2/d) times aice upNH ! ammonium uptake rate (mmol/m^2/d) times aice real (kind=dbl_kind), & - dimension(nx_block,ny_block,max_ntrcr, ncat, max_blocks), public :: & + dimension(:,:,:,:,:), allocatable, public :: & trcrn_sw ! bgc tracers active in the delta-Eddington shortwave ! calculation on the shortwave grid (swgrid) real (kind=dbl_kind), & - dimension (nx_block,ny_block,icepack_max_nbtrcr, max_blocks), public :: & + dimension (:,:,:,:), allocatable, public :: & ice_bio_net , & ! depth integrated tracer (mmol/m^2) snow_bio_net ! depth integrated snow tracer (mmol/m^2) @@ -271,6 +272,94 @@ module ice_arrays_column R_C2N , & ! algal C to N (mole/mole) R_chl2N ! 3 algal chlorophyll to N (mg/mmol) +!======================================================================= + + contains + +!======================================================================= + + subroutine alloc_arrays_column + ! Allocate column arrays + use ice_exit, only: abort_ice + integer (int_kind) :: ierr + + allocate( & + Cdn_atm (nx_block,ny_block,max_blocks), & ! atm drag coefficient + Cdn_ocn (nx_block,ny_block,max_blocks), & ! ocn drag coefficient + hfreebd (nx_block,ny_block,max_blocks), & ! freeboard (m) + hdraft (nx_block,ny_block,max_blocks), & ! draft of ice + snow column (Stoessel1993) + hridge (nx_block,ny_block,max_blocks), & ! ridge height + distrdg (nx_block,ny_block,max_blocks), & ! distance between ridges + hkeel (nx_block,ny_block,max_blocks), & ! keel depth + dkeel (nx_block,ny_block,max_blocks), & ! distance between keels + lfloe (nx_block,ny_block,max_blocks), & ! floe length + dfloe (nx_block,ny_block,max_blocks), & ! distance between floes + Cdn_atm_skin (nx_block,ny_block,max_blocks), & ! neutral skin drag coefficient + Cdn_atm_floe (nx_block,ny_block,max_blocks), & ! neutral floe edge drag coefficient + Cdn_atm_pond (nx_block,ny_block,max_blocks), & ! neutral pond edge drag coefficient + Cdn_atm_rdg (nx_block,ny_block,max_blocks), & ! neutral ridge drag coefficient + Cdn_ocn_skin (nx_block,ny_block,max_blocks), & ! skin drag coefficient + Cdn_ocn_floe (nx_block,ny_block,max_blocks), & ! floe edge drag coefficient + Cdn_ocn_keel (nx_block,ny_block,max_blocks), & ! keel drag coefficient + Cdn_atm_ratio(nx_block,ny_block,max_blocks), & ! ratio drag atm / neutral drag atm + grow_net (nx_block,ny_block,max_blocks), & ! Specific growth rate (/s) per grid cell + PP_net (nx_block,ny_block,max_blocks), & ! Total production (mg C/m^2/s) per grid cell + hbri (nx_block,ny_block,max_blocks), & ! brine height, area-averaged for comparison with hi (m) + zsal_tot (nx_block,ny_block,max_blocks), & ! Total ice salinity in per grid cell (g/m^2) + chl_net (nx_block,ny_block,max_blocks), & ! Total chla (mg chla/m^2) per grid cell + NO_net (nx_block,ny_block,max_blocks), & ! Total nitrate per grid cell + Rayleigh_criteria & + (nx_block,ny_block,max_blocks), & ! .true. means Ra_c was reached + Rayleigh_real(nx_block,ny_block,max_blocks), & ! .true. = c1, .false. = c0 + fzsal (nx_block,ny_block,max_blocks), & ! Total flux of salt to ocean at time step for conservation + fzsal_g (nx_block,ny_block,max_blocks), & ! Total gravity drainage flux + upNO (nx_block,ny_block,max_blocks), & ! nitrate uptake rate (mmol/m^2/d) times aice + upNH (nx_block,ny_block,max_blocks), & ! ammonium uptake rate (mmol/m^2/d) times aice + dhsn (nx_block,ny_block,ncat,max_blocks), & ! depth difference for snow on sea ice and pond ice + ffracn (nx_block,ny_block,ncat,max_blocks), & ! fraction of fsurfn used to melt ipond + alvdrn (nx_block,ny_block,ncat,max_blocks), & ! visible direct albedo (fraction) + alidrn (nx_block,ny_block,ncat,max_blocks), & ! near-ir direct albedo (fraction) + alvdfn (nx_block,ny_block,ncat,max_blocks), & ! visible diffuse albedo (fraction) + alidfn (nx_block,ny_block,ncat,max_blocks), & ! near-ir diffuse albedo (fraction) + albicen (nx_block,ny_block,ncat,max_blocks), & ! bare ice + albsnon (nx_block,ny_block,ncat,max_blocks), & ! snow + albpndn (nx_block,ny_block,ncat,max_blocks), & ! pond + apeffn (nx_block,ny_block,ncat,max_blocks), & ! effective pond area used for radiation calculation + snowfracn (nx_block,ny_block,ncat,max_blocks), & ! Category snow fraction used in radiation + fswsfcn (nx_block,ny_block,ncat,max_blocks), & ! SW absorbed at ice/snow surface (W m-2) + fswthrun (nx_block,ny_block,ncat,max_blocks), & ! SW through ice to ocean (W/m^2) + fswintn (nx_block,ny_block,ncat,max_blocks), & ! SW absorbed in ice interior, below surface (W m-2) + first_ice_real & + (nx_block,ny_block,ncat,max_blocks), & ! .true. = c1, .false. = c0 + first_ice (nx_block,ny_block,ncat,max_blocks), & ! distinguishes ice that disappears (e.g. melts) and reappears (e.g. transport) + dhbr_top (nx_block,ny_block,ncat,max_blocks), & ! brine top change + dhbr_bot (nx_block,ny_block,ncat,max_blocks), & ! brine bottom change + darcy_V (nx_block,ny_block,ncat,max_blocks), & ! darcy velocity positive up (m/s) + sice_rho (nx_block,ny_block,ncat,max_blocks), & ! avg sea ice density (kg/m^3) ! ech: diagnostic only? + fzsaln (nx_block,ny_block,ncat,max_blocks), & ! category fzsal(kg/m^2/s) + fzsaln_g (nx_block,ny_block,ncat,max_blocks), & ! salt flux from gravity drainage only + ocean_bio (nx_block,ny_block,icepack_max_nbtrcr,max_blocks), & ! contains all the ocean bgc tracer concentrations + fbio_snoice (nx_block,ny_block,icepack_max_nbtrcr,max_blocks), & ! fluxes from snow to ice + fbio_atmice (nx_block,ny_block,icepack_max_nbtrcr,max_blocks), & ! fluxes from atm to ice + ocean_bio_all(nx_block,ny_block,icepack_max_nbtrcr,max_blocks), & ! fixed order, all values even for tracers false + ice_bio_net (nx_block,ny_block,icepack_max_nbtrcr,max_blocks), & ! depth integrated tracer (mmol/m^2) + snow_bio_net (nx_block,ny_block,icepack_max_nbtrcr,max_blocks), & ! depth integrated snow tracer (mmol/m^2) + trcrn_sw (nx_block,ny_block,max_ntrcr,ncat,max_blocks), & ! bgc tracers active in the delta-Eddington shortwave + Iswabsn (nx_block,ny_block,nilyr,ncat,max_blocks), & ! SW radiation absorbed in ice layers (W m-2) + Sswabsn (nx_block,ny_block,nslyr,ncat,max_blocks), & ! SW radiation absorbed in snow layers (W m-2) + fswpenln (nx_block,ny_block,nilyr+1,ncat,max_blocks), & ! visible SW entering ice layers (W m-2) + Zoo (nx_block,ny_block,nblyr+1,ncat,max_blocks), & ! N losses accumulated in timestep (ie. zooplankton/bacteria) + zfswin (nx_block,ny_block,nblyr+1,ncat,max_blocks), & ! Shortwave flux into layers interpolated on bio grid (W/m^2) + iDi (nx_block,ny_block,nblyr+1,ncat,max_blocks), & ! igrid Diffusivity (m^2/s) + iki (nx_block,ny_block,nblyr+1,ncat,max_blocks), & ! Ice permeability (m^2) + bphi (nx_block,ny_block,nblyr+2,ncat,max_blocks), & ! porosity of layers + bTiz (nx_block,ny_block,nblyr+2,ncat,max_blocks), & ! layer temperatures interpolated on bio grid (C) + algal_peak (nx_block,ny_block,icepack_max_algae,max_blocks), & ! vertical location of algal maximum, 0 if no maximum + stat=ierr) + if (ierr/=0) call abort_ice('(alloc_arrays_column): Out of Memory') + + end subroutine alloc_arrays_column + !======================================================================= end module ice_arrays_column diff --git a/cicecore/shared/ice_domain_size.F90 b/cicecore/shared/ice_domain_size.F90 index 77d0692f1..7d4ec0eac 100644 --- a/cicecore/shared/ice_domain_size.F90 +++ b/cicecore/shared/ice_domain_size.F90 @@ -19,9 +19,14 @@ module ice_domain_size implicit none private + integer (kind=int_kind), public :: & + max_blocks , & ! max number of blocks per processor + block_size_x, & ! size of block in first horiz dimension + block_size_y, & ! size of block in second horiz dimension + nx_global , & ! i-axis size + ny_global ! j-axis size + integer (kind=int_kind), parameter, public :: & - nx_global = NXGLOB , & ! i-axis size - ny_global = NYGLOB , & ! j-axis size ncat = NICECAT , & ! number of categories nilyr = NICELYR , & ! number of ice layers per category nslyr = NSNWLYR , & ! number of snow layers per category @@ -60,10 +65,6 @@ module ice_domain_size + 1 , & ! for unused tracer flags max_nstrm = 5 ! max number of history output streams - integer (kind=int_kind), parameter, public :: & - block_size_x = BLCKX , & ! size of block in first horiz dimension - block_size_y = BLCKY ! size of block in second horiz dimension - !*** The model will inform the user of the correct !*** values for the parameter below. A value higher than !*** necessary will not cause the code to fail, but will @@ -73,9 +74,6 @@ module ice_domain_size !*** max_blocks = (nx_global/block_size_x)*(ny_global/block_size_y)/ !*** num_procs - integer (kind=int_kind), parameter, public :: & - max_blocks = MXBLCKS ! max number of blocks per processor - !======================================================================= end module ice_domain_size From 45b3bfb1f3f847763fb1ca2f83861f301a7e2b95 Mon Sep 17 00:00:00 2001 From: mhrib Date: Thu, 13 Sep 2018 14:21:54 +0000 Subject: [PATCH 2/8] Updated ice_in according to "Allocated Dynamics" --- configuration/scripts/ice_in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configuration/scripts/ice_in b/configuration/scripts/ice_in index ea31277c5..015cffe66 100644 --- a/configuration/scripts/ice_in +++ b/configuration/scripts/ice_in @@ -153,6 +153,11 @@ &domain_nml nprocs = 4 + max_blocks = -1 + block_size_x = 25 + block_size_y = 29 + nx_global = 100 + ny_global = 116 processor_shape = 'slenderX2' distribution_type = 'cartesian' distribution_wght = 'latitude' From 85143bf4f6c634c072bbbee71835488275704b5e Mon Sep 17 00:00:00 2001 From: apcraig Date: Mon, 17 Sep 2018 16:48:22 +0000 Subject: [PATCH 3/8] update scripts to automatically set namelist associated with grids and blocks --- cice.setup | 22 ++++++++++++------- configuration/scripts/cice.build | 7 ++---- configuration/scripts/cice.settings | 14 ++++++------ configuration/scripts/ice_in | 6 ++--- ...settings.sh => parse_namelist_from_env.sh} | 9 ++++---- 5 files changed, 30 insertions(+), 28 deletions(-) rename configuration/scripts/{parse_namelist_from_settings.sh => parse_namelist_from_env.sh} (61%) diff --git a/cice.setup b/cice.setup index b41d287b3..048b0fc35 100755 --- a/cice.setup +++ b/cice.setup @@ -518,7 +518,7 @@ foreach compiler ( $ncompilers ) end # from basic script dir to casescr - foreach file (parse_namelist.sh parse_settings.sh parse_namelist_from_settings.sh cice_decomp.csh cice.run.setup.csh cice.test.setup.csh) + foreach file (parse_namelist.sh parse_settings.sh parse_namelist_from_env.sh cice_decomp.csh cice.run.setup.csh cice.test.setup.csh) if !(-e ${ICE_SCRIPTS}/$file) then echo "${0}: ERROR, ${ICE_SCRIPTS}/$file not found" exit -1 @@ -603,6 +603,7 @@ foreach compiler ( $ncompilers ) echo "ICE_COMPILER = ${compiler}" echo "ICE_PES = ${task}x${thrd}" echo "ICE_GRID = ${grid} (${ICE_DECOMP_NXGLOB}x${ICE_DECOMP_NYGLOB}) blocksize=${ICE_DECOMP_BLCKX}x${ICE_DECOMP_BLCKY}x${ICE_DECOMP_MXBLCKS}" + echo "ICE_DECOMP = ${ICE_DECOMP_DECOMP} ${ICE_DECOMP_DSHAPE}" #------------------------------------------------------------ # Copy in and update cice.settings and ice_in files @@ -618,7 +619,12 @@ foreach compiler ( $ncompilers ) cat >! ${fimods} << EOF1 # cice.setup settings -nprocs = ${task} +nprocs = ${task} +nx_global = ${ICE_DECOMP_NXGLOB} +ny_global = ${ICE_DECOMP_NYGLOB} +block_size_x = ${ICE_DECOMP_BLCKX} +block_size_y = ${ICE_DECOMP_BLCKY} +max_blocks = ${ICE_DECOMP_MXBLCKS} distribution_type = '${ICE_DECOMP_DECOMP}' processor_shape = '${ICE_DECOMP_DSHAPE}' version_name = '${ICE_VERSION}' @@ -651,13 +657,13 @@ setenv ICE_COMPILER ${compiler} setenv ICE_MACHCOMP ${machcomp} setenv ICE_RUNDIR ${ICE_MACHINE_WKDIR}/${casename} setenv ICE_GRID ${grid} -setenv ICE_NXGLOB ${ICE_DECOMP_NXGLOB} -setenv ICE_NYGLOB ${ICE_DECOMP_NYGLOB} +#setenv ICE_NXGLOB ${ICE_DECOMP_NXGLOB} # moved to namelist +#setenv ICE_NYGLOB ${ICE_DECOMP_NYGLOB} # moved to namelist setenv ICE_NTASKS ${task} setenv ICE_NTHRDS ${thrd} -setenv ICE_MXBLCKS ${ICE_DECOMP_MXBLCKS} -setenv ICE_BLCKX ${ICE_DECOMP_BLCKX} -setenv ICE_BLCKY ${ICE_DECOMP_BLCKY} +#setenv ICE_MXBLCKS ${ICE_DECOMP_MXBLCKS} # moved to namelist +#setenv ICE_BLCKX ${ICE_DECOMP_BLCKX} # moved to namelist +#setenv ICE_BLCKY ${ICE_DECOMP_BLCKY} # moved to namelist setenv ICE_BASELINE ${basedir_tmp} setenv ICE_BASEGEN ${baseGen} setenv ICE_BASECOM ${baseCom} @@ -754,7 +760,7 @@ EOF2 ${casescr}/parse_namelist.sh ice_in ${fimods} source ./cice.settings source ./env.${machcomp} || exit 2 - ${casescr}/parse_namelist_from_settings.sh ice_in cice.settings + ${casescr}/parse_namelist_from_env.sh ice_in #------------------------------------------------------------ # Generate run script diff --git a/configuration/scripts/cice.build b/configuration/scripts/cice.build index f8657f8ee..bacb4c60e 100755 --- a/configuration/scripts/cice.build +++ b/configuration/scripts/cice.build @@ -25,7 +25,8 @@ endif if !(-d ${ICE_OBJDIR}) mkdir -p ${ICE_OBJDIR} cd ${ICE_OBJDIR} -setenv ICE_CPPDEFS "-DNXGLOB=${ICE_NXGLOB} -DNYGLOB=${ICE_NYGLOB} -DBLCKX=${ICE_BLCKX} -DBLCKY=${ICE_BLCKY} -DMXBLCKS=${ICE_MXBLCKS} -DNICELYR=${NICELYR} -DNSNWLYR=${NSNWLYR} -DNICECAT=${NICECAT} -DTRAGE=${TRAGE} -DTRFY=${TRFY} -DTRLVL=${TRLVL} -DTRPND=${TRPND} -DTRBRI=${TRBRI} -DNTRAERO=${NTRAERO} -DTRZS=${TRZS} -DNBGCLYR=${NBGCLYR} -DTRALG=${TRALG} -DTRBGCZ=${TRBGCZ} -DTRDOC=${TRDOC} -DTRDOC=${TRDOC} -DTRDIC=${TRDIC} -DTRDON=${TRDON} -DTRFED=${TRFED} -DTRFEP=${TRFEP} -DTRZAERO=${TRZAERO} -DTRBGCS=${TRBGCS} -DNUMIN=${NUMIN} -DNUMAX=${NUMAX}" +#setenv ICE_CPPDEFS "-DNXGLOB=${ICE_NXGLOB} -DNYGLOB=${ICE_NYGLOB} -DBLCKX=${ICE_BLCKX} -DBLCKY=${ICE_BLCKY} -DMXBLCKS=${ICE_MXBLCKS} -DNICELYR=${NICELYR} -DNSNWLYR=${NSNWLYR} -DNICECAT=${NICECAT} -DTRAGE=${TRAGE} -DTRFY=${TRFY} -DTRLVL=${TRLVL} -DTRPND=${TRPND} -DTRBRI=${TRBRI} -DNTRAERO=${NTRAERO} -DTRZS=${TRZS} -DNBGCLYR=${NBGCLYR} -DTRALG=${TRALG} -DTRBGCZ=${TRBGCZ} -DTRDOC=${TRDOC} -DTRDOC=${TRDOC} -DTRDIC=${TRDIC} -DTRDON=${TRDON} -DTRFED=${TRFED} -DTRFEP=${TRFEP} -DTRZAERO=${TRZAERO} -DTRBGCS=${TRBGCS} -DNUMIN=${NUMIN} -DNUMAX=${NUMAX}" +setenv ICE_CPPDEFS "-DNICELYR=${NICELYR} -DNSNWLYR=${NSNWLYR} -DNICECAT=${NICECAT} -DTRAGE=${TRAGE} -DTRFY=${TRFY} -DTRLVL=${TRLVL} -DTRPND=${TRPND} -DTRBRI=${TRBRI} -DNTRAERO=${NTRAERO} -DTRZS=${TRZS} -DNBGCLYR=${NBGCLYR} -DTRALG=${TRALG} -DTRBGCZ=${TRBGCZ} -DTRDOC=${TRDOC} -DTRDOC=${TRDOC} -DTRDIC=${TRDIC} -DTRDON=${TRDON} -DTRFED=${TRFED} -DTRFEP=${TRFEP} -DTRZAERO=${TRZAERO} -DTRBGCS=${TRBGCS} -DNUMIN=${NUMIN} -DNUMAX=${NUMAX}" if ($DITTO == 'yes') then setenv ICE_CPPDEFS "${ICE_CPPDEFS} -DREPRODUCIBLE" @@ -64,10 +65,6 @@ echo " " echo ICE_GRID = ${ICE_GRID} echo ICE_NTASK = ${ICE_NTASKS} echo ICE_NTHRD = ${ICE_NTHRDS} -echo "global N, block_size" -echo "x ${ICE_NXGLOB}, ${ICE_BLCKX}" -echo "y ${ICE_NYGLOB}, ${ICE_BLCKY}" -echo "max_blocks = ${ICE_MXBLCKS}" echo "ICE_CPPDEFS = ${ICE_CPPDEFS}" echo "Filepath = " cat ${ICE_OBJDIR}/Filepath diff --git a/configuration/scripts/cice.settings b/configuration/scripts/cice.settings index c4b71ef4a..f5cd9c7e8 100755 --- a/configuration/scripts/cice.settings +++ b/configuration/scripts/cice.settings @@ -17,15 +17,15 @@ setenv ICE_IOTYPE netcdf # set to none if netcdf library is unavailable setenv ICE_CLEANBUILD true setenv ICE_QUIETMODE false setenv ICE_GRID undefined -setenv ICE_NXGLOB undefined -setenv ICE_NYGLOB undefined +#setenv ICE_NXGLOB undefined # moved to namelist +#setenv ICE_NYGLOB undefined # moved to namelist setenv ICE_NTASKS undefined setenv ICE_NTHRDS undefined -setenv ICE_BLCKX undefined -setenv ICE_BLCKY undefined -setenv ICE_MXBLCKS undefined -setenv ICE_TEST undefined # Define if this is a test case -setenv ICE_TESTNAME undefined # Define if this is a test case +#setenv ICE_BLCKX undefined # moved to namelist +#setenv ICE_BLCKY undefined # moved to namelist +#setenv ICE_MXBLCKS undefined # moved to namelist +setenv ICE_TEST undefined +setenv ICE_TESTNAME undefined setenv ICE_BASELINE undefined setenv ICE_BASEGEN undefined setenv ICE_BASECOM undefined diff --git a/configuration/scripts/ice_in b/configuration/scripts/ice_in index 015cffe66..b804afd65 100644 --- a/configuration/scripts/ice_in +++ b/configuration/scripts/ice_in @@ -153,11 +153,11 @@ &domain_nml nprocs = 4 - max_blocks = -1 - block_size_x = 25 - block_size_y = 29 nx_global = 100 ny_global = 116 + block_size_x = 25 + block_size_y = 29 + max_blocks = -1 processor_shape = 'slenderX2' distribution_type = 'cartesian' distribution_wght = 'latitude' diff --git a/configuration/scripts/parse_namelist_from_settings.sh b/configuration/scripts/parse_namelist_from_env.sh similarity index 61% rename from configuration/scripts/parse_namelist_from_settings.sh rename to configuration/scripts/parse_namelist_from_env.sh index 3139d1879..4d829450f 100755 --- a/configuration/scripts/parse_namelist_from_settings.sh +++ b/configuration/scripts/parse_namelist_from_env.sh @@ -1,15 +1,14 @@ #!/bin/bash -f -if [[ "$#" -ne 2 ]]; then - echo "$0 ERROR: requires 2 arguments, the namelist and settings" +if [[ "$#" -ne 1 ]]; then + echo "$0 ERROR: requires 1 argument, the namelist to modify" exit -1 fi filename=$1 -filemods=$2 -#echo "$0 $1 $2" -echo "running parse_namelist_from_settings.sh" +#echo "$0 $1" +echo "running parse_namelist_from_env.sh" sed -i.sedbak -e 's|ICE_SANDBOX|'"${ICE_SANDBOX}"'|g' $filename sed -i.sedbak -e 's|ICE_MACHINE_INPUTDATA|'"${ICE_MACHINE_INPUTDATA}"'|g' $filename From 64ddc41171cf58c1cb391219d8cfee15362e7b66 Mon Sep 17 00:00:00 2001 From: Tony Craig Date: Thu, 20 Sep 2018 05:41:05 -0700 Subject: [PATCH 4/8] fix uarea initialization related to NYGLOB cpp (#1) --- cicecore/cicedynB/dynamics/ice_dyn_shared.F90 | 3 +- cicecore/cicedynB/general/ice_init.F90 | 15 ++++++--- cicecore/cicedynB/infrastructure/ice_grid.F90 | 31 +++++++++---------- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/cicecore/cicedynB/dynamics/ice_dyn_shared.F90 b/cicecore/cicedynB/dynamics/ice_dyn_shared.F90 index 53114ee45..64c569c10 100644 --- a/cicecore/cicedynB/dynamics/ice_dyn_shared.F90 +++ b/cicecore/cicedynB/dynamics/ice_dyn_shared.F90 @@ -11,6 +11,7 @@ module ice_dyn_shared use ice_kinds_mod + use ice_communicate, only: my_task, master_task use ice_constants, only: c0, c1, p01, p001 use ice_blocks, only: nx_block, ny_block use ice_domain_size, only: max_blocks @@ -101,7 +102,6 @@ end subroutine alloc_dyn_shared subroutine init_evp (dt) use ice_blocks, only: nx_block, ny_block - use ice_communicate, only: my_task, master_task use ice_constants, only: c0, c2, omega use ice_domain, only: nblocks use ice_domain_size, only: max_blocks @@ -187,7 +187,6 @@ end subroutine init_evp subroutine set_evp_parameters (dt) - use ice_communicate, only: my_task, master_task use ice_constants, only: p25, c1, c2, c4, p5 use ice_domain, only: distrb_info use ice_global_reductions, only: global_minval, global_maxval diff --git a/cicecore/cicedynB/general/ice_init.F90 b/cicecore/cicedynB/general/ice_init.F90 index f3a654330..e88d2320b 100644 --- a/cicecore/cicedynB/general/ice_init.F90 +++ b/cicecore/cicedynB/general/ice_init.F90 @@ -191,9 +191,10 @@ subroutine input_data abort_flag = 0 call icepack_query_parameters(puny_out=puny) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname//'Icepack Abort0', & - file=__FILE__, line=__LINE__) +! nu_diag not yet defined +! call icepack_warnings_flush(nu_diag) +! if (icepack_warnings_aborted()) call abort_ice(error_message=subname//'Icepack Abort0', & +! file=__FILE__, line=__LINE__) days_per_year = 365 ! number of days in a year use_leap_years= .false.! if true, use leap years (Feb 29) @@ -878,7 +879,13 @@ subroutine input_data write(nu_diag,1020) ' kitd = ', kitd write(nu_diag,1020) ' kcatbound = ', & kcatbound - write(nu_diag,1020) ' kdyn = ', kdyn + if (kdyn == 1) then + write(nu_diag,1020) ' kdyn = evp ', kdyn + elseif (kdyn == 2) then + write(nu_diag,1020) ' kdyn = eap ', kdyn + else + write(nu_diag,1020) ' kdyn = ', kdyn + endif write(nu_diag,1020) ' ndtd = ', ndtd write(nu_diag,1020) ' ndte = ', ndte write(nu_diag,1010) ' revised_evp = ', & diff --git a/cicecore/cicedynB/infrastructure/ice_grid.F90 b/cicecore/cicedynB/infrastructure/ice_grid.F90 index ea5aaddb3..eb7fdece3 100644 --- a/cicecore/cicedynB/infrastructure/ice_grid.F90 +++ b/cicecore/cicedynB/infrastructure/ice_grid.F90 @@ -1491,26 +1491,23 @@ subroutine primary_grid_lengths_HTE(work_g) endif if (my_task == master_task) then - do j = 1, ny_global - do i = 1, nx_global - work_g(i,j) = work_g(i,j) * cm_to_m ! HTE - enddo - enddo - do j = 1, ny_global-1 + do j = 1, ny_global + do i = 1, nx_global + work_g(i,j) = work_g(i,j) * cm_to_m ! HTE + enddo + enddo + do j = 1, ny_global-1 do i = 1, nx_global work_g2(i,j) = p5*(work_g(i,j) + work_g(i,j+1)) ! dyu enddo - enddo - ! extrapolate to obtain dyu along j=ny_global - ! for CESM: use NYGLOB to prevent a compile time out of bounds - ! error when ny_global=1 as in the se dycore; this code is not - ! exersized in prescribed mode. -#if (NYGLOB>2) - do i = 1, nx_global - work_g2(i,ny_global) = c2*work_g(i,ny_global-1) & - - work_g(i,ny_global-2) ! dyu - enddo -#endif + enddo + ! extrapolate to obtain dyu along j=ny_global + if (ny_global > 1) then + do i = 1, nx_global + work_g2(i,ny_global) = c2*work_g(i,ny_global-1) & + - work_g(i,ny_global-2) ! dyu + enddo + endif endif call scatter_global(HTE, work_g, master_task, distrb_info, & field_loc_Eface, field_type_scalar) From 0c4af683fd48c5eb55365d9224d58811a7b90158 Mon Sep 17 00:00:00 2001 From: Tony Craig Date: Thu, 20 Sep 2018 13:03:52 -0700 Subject: [PATCH 5/8] update pgi optimzation to address reproducibility problems (#2) --- cicecore/cicedynB/general/ice_init.F90 | 5 +++-- configuration/scripts/machines/Macros.conrad_pgi | 2 +- configuration/scripts/machines/Macros.gordon_pgi | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cicecore/cicedynB/general/ice_init.F90 b/cicecore/cicedynB/general/ice_init.F90 index e88d2320b..47c7076e3 100644 --- a/cicecore/cicedynB/general/ice_init.F90 +++ b/cicecore/cicedynB/general/ice_init.F90 @@ -880,9 +880,9 @@ subroutine input_data write(nu_diag,1020) ' kcatbound = ', & kcatbound if (kdyn == 1) then - write(nu_diag,1020) ' kdyn = evp ', kdyn + write(nu_diag,1021) ' kdyn = ','evp ', kdyn elseif (kdyn == 2) then - write(nu_diag,1020) ' kdyn = eap ', kdyn + write(nu_diag,1021) ' kdyn = ','eap ', kdyn else write(nu_diag,1020) ' kdyn = ', kdyn endif @@ -1121,6 +1121,7 @@ subroutine input_data 1005 format (a30,2x,f9.6) ! float 1010 format (a30,2x,l6) ! logical 1020 format (a30,2x,i6) ! integer + 1021 format (a30,2x,a8,i6) ! char, int 1030 format (a30, a8) ! character 1040 format (a30,2x,6i6) ! integer 1050 format (a30,2x,6a6) ! character diff --git a/configuration/scripts/machines/Macros.conrad_pgi b/configuration/scripts/machines/Macros.conrad_pgi index 702c84a8d..be6fb1ef2 100644 --- a/configuration/scripts/machines/Macros.conrad_pgi +++ b/configuration/scripts/machines/Macros.conrad_pgi @@ -14,7 +14,7 @@ FFLAGS_NOOPT:= -O0 ifeq ($(ICE_BLDDEBUG), true) FFLAGS += -O0 -g -Mbounds -Mchkptr else - FFLAGS += -O2 + FFLAGS += -O -g endif ifeq ($(ICE_COMMDIR), mpi) diff --git a/configuration/scripts/machines/Macros.gordon_pgi b/configuration/scripts/machines/Macros.gordon_pgi index ea0c4ee58..1403cf13a 100644 --- a/configuration/scripts/machines/Macros.gordon_pgi +++ b/configuration/scripts/machines/Macros.gordon_pgi @@ -14,7 +14,7 @@ FFLAGS_NOOPT:= -O0 ifeq ($(ICE_BLDDEBUG), true) FFLAGS += -O0 -g -Mbounds -Mchkptr else - FFLAGS += -O2 + FFLAGS += -O -g endif ifeq ($(ICE_COMMDIR), mpi) From 2e6e3511d15eecb5e772286d90ae285fa11afc33 Mon Sep 17 00:00:00 2001 From: Tony Craig Date: Fri, 21 Sep 2018 10:18:21 -0700 Subject: [PATCH 6/8] mods for nag compiler failure (#3) --- cicecore/cicedynB/infrastructure/ice_grid.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cicecore/cicedynB/infrastructure/ice_grid.F90 b/cicecore/cicedynB/infrastructure/ice_grid.F90 index eb7fdece3..671d7adea 100644 --- a/cicecore/cicedynB/infrastructure/ice_grid.F90 +++ b/cicecore/cicedynB/infrastructure/ice_grid.F90 @@ -1232,8 +1232,8 @@ subroutine rectgrid ! land in the upper left and lower right corners, ! otherwise open boundaries - imid = aint(real(nx_global)/c2,kind=int_kind) - jmid = aint(real(ny_global)/c2,kind=int_kind) + imid = nint(aint(real(nx_global)/c2)) + jmid = nint(aint(real(ny_global)/c2)) do j = 3,ny_global-2 do i = 3,nx_global-2 From 8e408cf3d0a2ad442896e77d5d17267d3976df2b Mon Sep 17 00:00:00 2001 From: Tony Craig Date: Sun, 23 Sep 2018 23:30:28 -0700 Subject: [PATCH 7/8] Update to Consortium master bbec5d1e (#4) * update pgi compiler optimization to address reproducibility problems * Dummy and unused variables. (#180) * Remove some dummy arguments and unused variables. * Dummy variable cleanup * Cleanup * Remove icepack from commit * Reset icepack master * Fix * Fix * Update icepack * fix * Fix flush ifdef logic * Uninitialized variables. * Additional initialization * Update dummy * more dummy fixes * More hobart changes * Update Hobart Intel settings * Additional Hobart Intel changes * Update icepack * Some tweaks to dummy variables * Remove some initialization code. * Only remove istat checks in one routine. * update icepack (#188) --- .../cicedynB/analysis/ice_diagnostics.F90 | 83 +++++----- .../cicedynB/analysis/ice_diagnostics_bgc.F90 | 45 ++---- cicecore/cicedynB/analysis/ice_history.F90 | 15 +- .../cicedynB/analysis/ice_history_bgc.F90 | 13 +- .../cicedynB/analysis/ice_history_drag.F90 | 7 +- .../cicedynB/analysis/ice_history_mechred.F90 | 1 - .../cicedynB/analysis/ice_history_pond.F90 | 1 - .../cicedynB/analysis/ice_history_shared.F90 | 6 +- cicecore/cicedynB/dynamics/ice_dyn_eap.F90 | 149 +++++++++--------- cicecore/cicedynB/dynamics/ice_dyn_evp.F90 | 4 +- cicecore/cicedynB/dynamics/ice_dyn_shared.F90 | 12 +- .../dynamics/ice_transport_driver.F90 | 34 ++-- .../cicedynB/dynamics/ice_transport_remap.F90 | 15 +- cicecore/cicedynB/general/ice_flux.F90 | 12 +- cicecore/cicedynB/general/ice_flux_bgc.F90 | 1 - cicecore/cicedynB/general/ice_forcing.F90 | 143 ++++------------- cicecore/cicedynB/general/ice_forcing_bgc.F90 | 26 +-- cicecore/cicedynB/general/ice_init.F90 | 18 +-- cicecore/cicedynB/general/ice_state.F90 | 6 +- cicecore/cicedynB/general/ice_step_mod.F90 | 66 ++++---- .../infrastructure/comm/mpi/ice_boundary.F90 | 16 +- .../infrastructure/comm/mpi/ice_broadcast.F90 | 2 - .../comm/mpi/ice_communicate.F90 | 2 - .../infrastructure/comm/mpi/ice_exit.F90 | 1 - .../comm/mpi/ice_gather_scatter.F90 | 2 - .../comm/mpi/ice_global_reductions.F90 | 8 +- .../infrastructure/comm/mpi/ice_timers.F90 | 1 - .../comm/serial/ice_boundary.F90 | 5 - .../comm/serial/ice_broadcast.F90 | 2 - .../comm/serial/ice_communicate.F90 | 2 - .../infrastructure/comm/serial/ice_exit.F90 | 1 - .../comm/serial/ice_gather_scatter.F90 | 2 - .../comm/serial/ice_global_reductions.F90 | 2 - .../infrastructure/comm/serial/ice_timers.F90 | 1 - .../cicedynB/infrastructure/ice_blocks.F90 | 1 - .../cicedynB/infrastructure/ice_domain.F90 | 5 +- cicecore/cicedynB/infrastructure/ice_grid.F90 | 31 ++-- .../infrastructure/ice_read_write.F90 | 94 ++++++----- .../infrastructure/ice_restart_driver.F90 | 50 ++---- .../cicedynB/infrastructure/ice_restoring.F90 | 15 +- .../io/io_binary/ice_history_write.F90 | 1 - .../io/io_binary/ice_restart.F90 | 2 +- .../io/io_netcdf/ice_history_write.F90 | 5 +- .../io/io_netcdf/ice_restart.F90 | 14 +- .../io/io_pio/ice_history_write.F90 | 1 - .../infrastructure/io/io_pio/ice_restart.F90 | 2 - cicecore/drivers/cesm/CICE_FinalMod.F90 | 1 - cicecore/drivers/cesm/CICE_InitMod.F90 | 1 - cicecore/drivers/cesm/CICE_RunMod.F90 | 1 - cicecore/drivers/cesm/CICE_RunMod.F90_debug | 1 - cicecore/drivers/cesm/ice_prescribed_mod.F90 | 1 - cicecore/drivers/cice/CICE.F90 | 2 - cicecore/drivers/cice/CICE_FinalMod.F90 | 1 - cicecore/drivers/cice/CICE_InitMod.F90 | 17 +- cicecore/drivers/cice/CICE_RunMod.F90 | 48 ++++-- cicecore/drivers/cice/CICE_RunMod.F90_debug | 1 - cicecore/drivers/hadgem3/CICE.F90 | 1 - cicecore/drivers/hadgem3/CICE_FinalMod.F90 | 1 - cicecore/drivers/hadgem3/CICE_InitMod.F90 | 1 - cicecore/drivers/hadgem3/CICE_RunMod.F90 | 1 - cicecore/shared/ice_arrays_column.F90 | 1 - cicecore/shared/ice_calendar.F90 | 1 - cicecore/shared/ice_constants.F90 | 1 - cicecore/shared/ice_distribution.F90 | 96 ++++++++++- cicecore/shared/ice_domain_size.F90 | 1 - cicecore/shared/ice_fileunits.F90 | 9 +- cicecore/shared/ice_init_column.F90 | 112 ++++++------- cicecore/shared/ice_kinds_mod.F90 | 1 - cicecore/shared/ice_restart_column.F90 | 7 +- cicecore/shared/ice_restart_shared.F90 | 4 - cicecore/shared/ice_spacecurve.F90 | 4 +- .../scripts/machines/Macros.hobart_intel | 6 +- .../scripts/machines/Macros.hobart_nag | 4 +- .../scripts/machines/env.hobart_intel | 2 +- configuration/scripts/machines/env.hobart_nag | 2 +- doc/source/master_list.bib | 2 - icepack | 2 +- 77 files changed, 577 insertions(+), 681 deletions(-) diff --git a/cicecore/cicedynB/analysis/ice_diagnostics.F90 b/cicecore/cicedynB/analysis/ice_diagnostics.F90 index 37f2c2fc8..a7f92e944 100644 --- a/cicecore/cicedynB/analysis/ice_diagnostics.F90 +++ b/cicecore/cicedynB/analysis/ice_diagnostics.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_diagnostics.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! Diagnostic information output during run @@ -14,7 +13,7 @@ module ice_diagnostics use ice_kinds_mod use ice_communicate, only: my_task, master_task use ice_constants, only: c0 - use ice_calendar, only: diagfreq, istep1, istep + use ice_calendar, only: istep1 use ice_fileunits, only: nu_diag use ice_fileunits, only: flush_fileunit use ice_exit, only: abort_ice @@ -86,7 +85,7 @@ module ice_diagnostics ! printing info for routine print_state ! iblkp, ip, jp, mtask identify the grid cell to print - character (char_len) :: plabel +! character (char_len) :: plabel integer (kind=int_kind), parameter, public :: & check_step = 999999999, & ! begin printing at istep1=check_step iblkp = 1, & ! block number @@ -116,14 +115,14 @@ subroutine runtime_diags (dt) use ice_domain_size, only: ncat, n_aero, max_blocks use ice_flux, only: alvdr, alidr, alvdf, alidf, evap, fsnow, frazil, & fswabs, fswthru, flw, flwout, fsens, fsurf, flat, frzmlt_init, frain, fpond, & - coszen, fhocn_ai, fsalt_ai, fresh_ai, frazil_diag, & + fhocn_ai, fsalt_ai, fresh_ai, frazil_diag, & update_ocn_f, Tair, Qa, fsw, fcondtop, meltt, meltb, meltl, snoice, & dsnow, congel, sst, sss, Tf, fhocn, & swvdr, swvdf, swidr, swidf, & alvdr_init, alvdf_init, alidr_init, alidf_init use ice_flux_bgc, only: faero_atm, faero_ocn use ice_global_reductions, only: global_sum, global_sum_prod, global_maxval - use ice_grid, only: lmask_n, lmask_s, tarean, tareas, grid_type + use ice_grid, only: lmask_n, lmask_s, tarean, tareas use ice_state ! everything #ifdef CESMCOUPLED use ice_prescribed_mod, only: prescribed_ice @@ -1216,7 +1215,7 @@ subroutine total_salt (work) use ice_blocks, only: nx_block, ny_block use ice_domain, only: nblocks - use ice_domain_size, only: ncat, nilyr, nslyr, max_blocks + use ice_domain_size, only: ncat, nilyr, max_blocks use ice_grid, only: tmask use ice_state, only: vicen, trcrn @@ -1595,7 +1594,7 @@ subroutine print_points_state(plabel,ilabel) real (kind=dbl_kind) :: & eidebug, esdebug, & - qi, qs, Tsnow, & + qi, qs, & puny integer (kind=int_kind) :: m, n, k, i, j, iblk, nt_Tsfc, nt_qice, nt_qsno @@ -1675,41 +1674,41 @@ subroutine print_points_state(plabel,ilabel) write(nu_diag,*) trim(llabel),'uvel=',uvel(i,j,iblk) write(nu_diag,*) trim(llabel),'vvel=',vvel(i,j,iblk) - ! write(nu_diag,*) ' ' - ! write(nu_diag,*) 'atm states and fluxes' - ! write(nu_diag,*) ' uatm = ',uatm (i,j,iblk) - ! write(nu_diag,*) ' vatm = ',vatm (i,j,iblk) - ! write(nu_diag,*) ' potT = ',potT (i,j,iblk) - ! write(nu_diag,*) ' Tair = ',Tair (i,j,iblk) - ! write(nu_diag,*) ' Qa = ',Qa (i,j,iblk) - ! write(nu_diag,*) ' rhoa = ',rhoa (i,j,iblk) - ! write(nu_diag,*) ' swvdr = ',swvdr(i,j,iblk) - ! write(nu_diag,*) ' swvdf = ',swvdf(i,j,iblk) - ! write(nu_diag,*) ' swidr = ',swidr(i,j,iblk) - ! write(nu_diag,*) ' swidf = ',swidf(i,j,iblk) - ! write(nu_diag,*) ' flw = ',flw (i,j,iblk) - ! write(nu_diag,*) ' frain = ',frain(i,j,iblk) - ! write(nu_diag,*) ' fsnow = ',fsnow(i,j,iblk) - ! write(nu_diag,*) ' ' - ! write(nu_diag,*) 'ocn states and fluxes' - ! write(nu_diag,*) ' frzmlt = ',frzmlt (i,j,iblk) - ! write(nu_diag,*) ' sst = ',sst (i,j,iblk) - ! write(nu_diag,*) ' sss = ',sss (i,j,iblk) - ! write(nu_diag,*) ' Tf = ',Tf (i,j,iblk) - ! write(nu_diag,*) ' uocn = ',uocn (i,j,iblk) - ! write(nu_diag,*) ' vocn = ',vocn (i,j,iblk) - ! write(nu_diag,*) ' strtltx = ',strtltx(i,j,iblk) - ! write(nu_diag,*) ' strtlty = ',strtlty(i,j,iblk) - ! write(nu_diag,*) ' ' - ! write(nu_diag,*) 'srf states and fluxes' - ! write(nu_diag,*) ' Tref = ',Tref (i,j,iblk) - ! write(nu_diag,*) ' Qref = ',Qref (i,j,iblk) - ! write(nu_diag,*) ' Uref = ',Uref (i,j,iblk) - ! write(nu_diag,*) ' fsens = ',fsens (i,j,iblk) - ! write(nu_diag,*) ' flat = ',flat (i,j,iblk) - ! write(nu_diag,*) ' evap = ',evap (i,j,iblk) - ! write(nu_diag,*) ' flwout = ',flwout(i,j,iblk) - ! write(nu_diag,*) ' ' + write(nu_diag,*) ' ' + write(nu_diag,*) 'atm states and fluxes' + write(nu_diag,*) ' uatm = ',uatm (i,j,iblk) + write(nu_diag,*) ' vatm = ',vatm (i,j,iblk) + write(nu_diag,*) ' potT = ',potT (i,j,iblk) + write(nu_diag,*) ' Tair = ',Tair (i,j,iblk) + write(nu_diag,*) ' Qa = ',Qa (i,j,iblk) + write(nu_diag,*) ' rhoa = ',rhoa (i,j,iblk) + write(nu_diag,*) ' swvdr = ',swvdr(i,j,iblk) + write(nu_diag,*) ' swvdf = ',swvdf(i,j,iblk) + write(nu_diag,*) ' swidr = ',swidr(i,j,iblk) + write(nu_diag,*) ' swidf = ',swidf(i,j,iblk) + write(nu_diag,*) ' flw = ',flw (i,j,iblk) + write(nu_diag,*) ' frain = ',frain(i,j,iblk) + write(nu_diag,*) ' fsnow = ',fsnow(i,j,iblk) + write(nu_diag,*) ' ' + write(nu_diag,*) 'ocn states and fluxes' + write(nu_diag,*) ' frzmlt = ',frzmlt (i,j,iblk) + write(nu_diag,*) ' sst = ',sst (i,j,iblk) + write(nu_diag,*) ' sss = ',sss (i,j,iblk) + write(nu_diag,*) ' Tf = ',Tf (i,j,iblk) + write(nu_diag,*) ' uocn = ',uocn (i,j,iblk) + write(nu_diag,*) ' vocn = ',vocn (i,j,iblk) + write(nu_diag,*) ' strtltx = ',strtltx(i,j,iblk) + write(nu_diag,*) ' strtlty = ',strtlty(i,j,iblk) + write(nu_diag,*) ' ' + write(nu_diag,*) 'srf states and fluxes' + write(nu_diag,*) ' Tref = ',Tref (i,j,iblk) + write(nu_diag,*) ' Qref = ',Qref (i,j,iblk) + write(nu_diag,*) ' Uref = ',Uref (i,j,iblk) + write(nu_diag,*) ' fsens = ',fsens (i,j,iblk) + write(nu_diag,*) ' flat = ',flat (i,j,iblk) + write(nu_diag,*) ' evap = ',evap (i,j,iblk) + write(nu_diag,*) ' flwout = ',flwout(i,j,iblk) + write(nu_diag,*) ' ' endif ! my_task enddo ! ncnt diff --git a/cicecore/cicedynB/analysis/ice_diagnostics_bgc.F90 b/cicecore/cicedynB/analysis/ice_diagnostics_bgc.F90 index b020aaf86..fa965dfe0 100644 --- a/cicecore/cicedynB/analysis/ice_diagnostics_bgc.F90 +++ b/cicecore/cicedynB/analysis/ice_diagnostics_bgc.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_diagnostics_bgc.F90 1447 2016-04-28 18:09:53Z afrobert@nps.edu $ !======================================================================= ! Diagnostic information output during run @@ -14,12 +13,11 @@ module ice_diagnostics_bgc use ice_kinds_mod use ice_communicate, only: my_task, master_task use ice_constants, only: c0, mps_to_cmpdy, c100, p5, c1 - use ice_calendar, only: diagfreq, istep1, istep use ice_fileunits, only: nu_diag use ice_fileunits, only: flush_fileunit use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted - use icepack_intfc, only: icepack_max_algae, icepack_max_aero, icepack_max_dic + use icepack_intfc, only: icepack_max_algae, icepack_max_aero use icepack_intfc, only: icepack_max_doc, icepack_max_don, icepack_max_fe use icepack_intfc, only: icepack_query_parameters, icepack_query_tracer_flags use icepack_intfc, only: icepack_query_tracer_indices @@ -42,18 +40,14 @@ module ice_diagnostics_bgc ! Cecilia M. Bitz, UW ! Nicole Jeffery, LANL - subroutine hbrine_diags (dt) + subroutine hbrine_diags use ice_arrays_column, only: darcy_V use ice_broadcast, only: broadcast_scalar, broadcast_array - use ice_diagnostics, only: npnt, print_points, pmloc, piloc, pjloc, pbloc, & - plat, plon - use ice_domain_size, only: ncat, nltrcr, nilyr + use ice_diagnostics, only: npnt, print_points, pmloc, piloc, pjloc, pbloc + use ice_domain_size, only: nilyr use ice_state, only: aice, aicen, vicen, vice, trcr, trcrn - real (kind=dbl_kind), intent(in) :: & - dt ! time step - ! local variables integer (kind=int_kind) :: & @@ -161,25 +155,21 @@ end subroutine hbrine_diags ! authors: Elizabeth C. Hunke, LANL ! Nicole Jeffery, LANL - subroutine bgc_diags (dt) + subroutine bgc_diags use ice_arrays_column, only: ocean_bio, zfswin, fbio_atmice, fbio_snoice, & Zoo, grow_net, ice_bio_net, trcrn_sw use ice_broadcast, only: broadcast_scalar, broadcast_array use ice_diagnostics, only: npnt, print_points, pmloc, piloc, pjloc, pbloc - use ice_domain_size, only: ncat, nltrcr, nblyr, n_algae, n_zaero, & - n_dic, n_doc, n_don, n_fed, n_fep, nilyr, nslyr + use ice_domain_size, only: ncat, nblyr, n_algae, n_zaero, & + n_doc, n_don, n_fed, n_fep, nilyr, nslyr use ice_flux_bgc, only: flux_bio, flux_bio_atm - use ice_state, only:aice, vicen, vice, trcr - use ice_timers, only: timer_bgc, ice_timer_start, ice_timer_stop - - real (kind=dbl_kind), intent(in) :: & - dt ! time step + use ice_state, only: vicen, vice, trcr ! local variables integer (kind=int_kind) :: & - i, j, k, n, nn, ii,jj, iblk,kk, klev + i, j, k, n, nn, iblk,kk, klev ! fields at diagnostic points real (kind=dbl_kind), dimension(npnt) :: & pNit_sk, pAm_sk, pSil_sk, phum_sk, & @@ -870,24 +860,20 @@ end subroutine bgc_diags ! Cecilia M. Bitz, UW ! Nicole Jeffery, LANL - subroutine zsal_diags (dt) + subroutine zsal_diags use ice_arrays_column, only: fzsal, fzsal_g, sice_rho, bTiz, & iDi, bphi, dhbr_top, dhbr_bot, darcy_V - use ice_blocks, only: nx_block, ny_block use ice_broadcast, only: broadcast_scalar, broadcast_array use ice_diagnostics, only: npnt, print_points, pmloc, piloc, pjloc, & - pbloc, plat, plon - use ice_domain_size, only: max_blocks, nblyr, ncat, nilyr + pbloc + use ice_domain_size, only: nblyr, ncat, nilyr use ice_state, only: aicen, aice, vice, trcr, trcrn, vicen, vsno - real (kind=dbl_kind), intent(in) :: & - dt ! time step - ! local variables integer (kind=int_kind) :: & - i, j, k, n, nn, ii,jj, iblk + i, j, k, n, nn, iblk ! fields at diagnostic points real (kind=dbl_kind), dimension(npnt) :: & @@ -897,16 +883,13 @@ subroutine zsal_diags (dt) ! vertical fields of category 1 at diagnostic points for bgc layer model real (kind=dbl_kind), dimension(npnt,nblyr+2) :: & - pphin, pgrid, pphin1 + 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), dimension (nx_block,ny_block,max_blocks) :: & - work1, work2 - real (kind=dbl_kind) :: & rhosi, rhow, rhos diff --git a/cicecore/cicedynB/analysis/ice_history.F90 b/cicecore/cicedynB/analysis/ice_history.F90 index 221aa43b5..f06559608 100644 --- a/cicecore/cicedynB/analysis/ice_history.F90 +++ b/cicecore/cicedynB/analysis/ice_history.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_history.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! Driver for core history output @@ -69,7 +68,7 @@ subroutine init_hist (dt) histfreq_n, nstreams use ice_domain_size, only: max_blocks, max_nstrm use ice_dyn_shared, only: kdyn - use ice_flux, only: mlt_onset, frz_onset, albcnt, taubx, tauby + use ice_flux, only: mlt_onset, frz_onset, albcnt use ice_history_shared ! everything use ice_history_mechred, only: init_hist_mechred_2D, init_hist_mechred_3Dc use ice_history_pond, only: init_hist_pond_2D, init_hist_pond_3Dc @@ -1208,9 +1207,9 @@ subroutine accum_hist (dt) taubx, tauby, strocnx, strocny, fm, daidtt, dvidtt, daidtd, dvidtd, fsurf, & fcondtop, fsurfn, fcondtopn, flatn, fsensn, albcnt, & stressp_1, stressm_1, stress12_1, & - stressp_2, stressm_2, stress12_2, & - stressp_3, stressm_3, stress12_3, & - stressp_4, stressm_4, stress12_4, sig1, sig2, sigP, & + stressp_2, & + stressp_3, & + stressp_4, sig1, sig2, sigP, & mlt_onset, frz_onset, dagedtt, dagedtd, fswint_ai, keffn_top, & snowfrac, alvdr_ai, alvdf_ai, alidr_ai, alidf_ai use ice_arrays_column, only: snowfracn @@ -1240,9 +1239,7 @@ subroutine accum_hist (dt) real (kind=dbl_kind) :: & qn , & ! temporary variable for enthalpy - sn , & ! temporary variable for salinity - Tmlts , & ! temporary variable for melting temperature - Tn ! temporary variable for ice temperature + sn ! temporary variable for salinity real (kind=dbl_kind), dimension (nx_block,ny_block) :: & worka, workb @@ -1331,7 +1328,7 @@ subroutine accum_hist (dt) !--------------------------------------------------------------- !$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block, & - !$OMP k,n,qn,ns,worka,workb,Tinz4d,Sinz4d,Tsnz4d) + !$OMP k,n,qn,ns,sn,worka,workb,Tinz4d,Sinz4d,Tsnz4d) do iblk = 1, nblocks this_block = get_block(blocks_ice(iblk),iblk) ilo = this_block%ilo diff --git a/cicecore/cicedynB/analysis/ice_history_bgc.F90 b/cicecore/cicedynB/analysis/ice_history_bgc.F90 index a0cc6baf2..6106ca016 100644 --- a/cicecore/cicedynB/analysis/ice_history_bgc.F90 +++ b/cicecore/cicedynB/analysis/ice_history_bgc.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_history_bgc.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! Biogeochemistry history output ! @@ -21,7 +20,7 @@ module ice_history_bgc use icepack_intfc, only: icepack_query_tracer_flags, & icepack_query_tracer_indices, icepack_query_parameters, & icepack_query_parameters - use ice_domain_size, only: max_nstrm, n_aero, nblyr, & + use ice_domain_size, only: max_nstrm, n_aero, & n_algae, n_dic, n_doc, n_don, n_zaero, n_fed, n_fep implicit none @@ -1730,8 +1729,6 @@ end subroutine init_hist_bgc_2D subroutine init_hist_bgc_3Dc - use ice_broadcast, only: broadcast_scalar - use ice_broadcast, only: broadcast_scalar use ice_calendar, only: nstreams use ice_history_shared, only: tstr3Dc, tcstr, define_hist_field @@ -1816,14 +1813,14 @@ subroutine accum_hist_bgc (iblk) R_C2N, R_chl2N use ice_blocks, only: block, get_block, nx_block, ny_block use ice_domain, only: blocks_ice - use ice_domain_size, only: ncat, nblyr + use ice_domain_size, only: nblyr use ice_flux, only: sss use ice_flux_bgc, only: faero_atm, faero_ocn, flux_bio, flux_bio_ai, & fzsal_ai, fzsal_g_ai - use ice_history_shared, only: n2D, a2D, a3Dc, n3Dccum, & - n3Dzcum, n3Dbcum, n3Dacum, a3Db, a3Da, & + use ice_history_shared, only: n2D, a2D, a3Dc, & + n3Dzcum, n3Dbcum, a3Db, a3Da, & ncat_hist, accum_hist_field, nzblyr, nzalyr - use ice_state, only: trcrn, trcr, aicen, aice, vice, vicen + use ice_state, only: trcrn, trcr, aicen, aice, vicen integer (kind=int_kind), intent(in) :: & iblk ! block index diff --git a/cicecore/cicedynB/analysis/ice_history_drag.F90 b/cicecore/cicedynB/analysis/ice_history_drag.F90 index 1b4e13721..605de2307 100644 --- a/cicecore/cicedynB/analysis/ice_history_drag.F90 +++ b/cicecore/cicedynB/analysis/ice_history_drag.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_history_drag.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! 2013 module for form drag parameters @@ -8,10 +7,9 @@ module ice_history_drag use ice_kinds_mod use ice_domain_size, only: max_nstrm - use ice_constants, only: c0, c1, c100, mps_to_cmpdy + use ice_constants, only: c0, c1 use ice_fileunits, only: nu_nml, nml_filename, & get_fileunit, release_fileunit - use ice_fileunits, only: nu_diag use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted @@ -230,8 +228,7 @@ end subroutine init_hist_drag_2D subroutine accum_hist_drag (iblk) - use ice_history_shared, only: n2D, a2D, a3Dc, ncat_hist, & - accum_hist_field + use ice_history_shared, only: a2D, accum_hist_field use ice_arrays_column, only: hfreebd, hdraft, hridge, distrdg, hkeel, & dkeel, lfloe, dfloe, Cdn_atm, Cdn_atm_skin, Cdn_atm_floe, & Cdn_atm_pond, Cdn_atm_rdg, Cdn_atm_ratio, Cdn_ocn_skin, & diff --git a/cicecore/cicedynB/analysis/ice_history_mechred.F90 b/cicecore/cicedynB/analysis/ice_history_mechred.F90 index c990e3487..78edd7a31 100644 --- a/cicecore/cicedynB/analysis/ice_history_mechred.F90 +++ b/cicecore/cicedynB/analysis/ice_history_mechred.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_history_mechred.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! Mechanical redistribution history output diff --git a/cicecore/cicedynB/analysis/ice_history_pond.F90 b/cicecore/cicedynB/analysis/ice_history_pond.F90 index 3fe8ae35a..02844dbea 100644 --- a/cicecore/cicedynB/analysis/ice_history_pond.F90 +++ b/cicecore/cicedynB/analysis/ice_history_pond.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_history_pond.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! Melt pond history output diff --git a/cicecore/cicedynB/analysis/ice_history_shared.F90 b/cicecore/cicedynB/analysis/ice_history_shared.F90 index 43f9b79c0..97ad37a1b 100644 --- a/cicecore/cicedynB/analysis/ice_history_shared.F90 +++ b/cicecore/cicedynB/analysis/ice_history_shared.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_history_shared.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! ! Output files: netCDF or binary data, Fortran unformatted dumps @@ -25,7 +24,6 @@ module ice_history_shared use ice_kinds_mod - use ice_fileunits, only: nu_diag,ice_stderr use ice_domain_size, only: ncat, nilyr, nslyr, nblyr, max_nstrm use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted @@ -466,7 +464,7 @@ module ice_history_shared subroutine construct_filename(ncfile,suffix,ns) - use ice_calendar, only: time, sec, nyr, month, daymo, & + use ice_calendar, only: sec, nyr, month, daymo, & mday, write_ic, histfreq, histfreq_n, & year_init, new_year, new_month, new_day, & dt @@ -560,7 +558,7 @@ subroutine define_hist_field(id, vname, vunit, vcoord, vcellmeas, & vdesc, vcomment, cona, conb, & ns, vhistfreq) - use ice_calendar, only: histfreq, histfreq_n, nstreams + use ice_calendar, only: histfreq, histfreq_n use ice_domain_size, only: max_nstrm integer (int_kind), dimension(max_nstrm), intent(out) :: & diff --git a/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 b/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 index b03780753..b2202369d 100644 --- a/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 +++ b/cicecore/cicedynB/dynamics/ice_dyn_eap.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_dyn_eap.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! ! Elastic-anisotropic sea ice dynamics model @@ -22,7 +21,7 @@ module ice_dyn_eap use ice_blocks, only: nx_block, ny_block use ice_domain_size, only: max_blocks, ncat use ice_constants, only: c0, c1, c2, c3, c12, p1, p2, p5, & - p001, p025, p027, p05, p055, p111, p166, p222, p25, p333 + p001, p027, p055, p111, p166, p222, p25, p333 use ice_fileunits, only: nu_diag, nu_dump_eap, nu_restart_eap use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted @@ -126,7 +125,7 @@ subroutine eap (dt) cosw, sinw, denom1, uvel_init, vvel_init, arlx1i, & dyn_prep1, dyn_prep2, stepu, dyn_finish, & basal_stress_coeff, basalstress - use ice_flux, only: rdg_conv, rdg_shear, strairxT, strairyT, & + use ice_flux, only: rdg_conv, strairxT, strairyT, & strairx, strairy, uocn, vocn, ss_tltx, ss_tlty, iceumask, fm, & strtltx, strtlty, strocnx, strocny, strintx, strinty, taubx, tauby, & strocnxT, strocnyT, strax, stray, & @@ -134,8 +133,11 @@ subroutine eap (dt) stressp_1, stressp_2, stressp_3, stressp_4, & stressm_1, stressm_2, stressm_3, stressm_4, & stress12_1, stress12_2, stress12_3, stress12_4 +#ifdef CICE_IN_NEMO + use ice_flux, only: strax, stray +#endif use ice_grid, only: tmask, umask, dxt, dyt, dxhy, dyhx, cxp, cyp, cxm, cym, & - tarear, uarear, tinyarea, to_ugrid, t2ugrid_vector, u2tgrid_vector + tarear, uarear, to_ugrid, t2ugrid_vector, u2tgrid_vector use ice_state, only: aice, vice, vsno, uvel, vvel, divu, shear, & aice_init, aice0, aicen, vicen, strength ! use ice_timers, only: timer_dynamics, timer_bound, & @@ -208,7 +210,7 @@ subroutine eap (dt) do j = 1, ny_block do i = 1, nx_block rdg_conv (i,j,iblk) = c0 - rdg_shear(i,j,iblk) = c0 +! rdg_shear(i,j,iblk) = c0 divu (i,j,iblk) = c0 shear(i,j,iblk) = c0 e11(i,j,iblk) = c0 @@ -429,7 +431,6 @@ subroutine eap (dt) cxp (:,:,iblk), cyp (:,:,iblk), & cxm (:,:,iblk), cym (:,:,iblk), & tarear (:,:,iblk), strength (:,:,iblk), & - a11 (:,:,iblk), a12 (:,:,iblk), & a11_1 (:,:,iblk), a11_2 (:,:,iblk), & a11_3 (:,:,iblk), a11_4 (:,:,iblk), & a12_1 (:,:,iblk), a12_2 (:,:,iblk), & @@ -448,7 +449,8 @@ subroutine eap (dt) yieldstress11 (:,:,iblk), & yieldstress12 (:,:,iblk), & yieldstress22 (:,:,iblk), & - rdg_conv (:,:,iblk), rdg_shear (:,:,iblk), & +! rdg_conv (:,:,iblk), rdg_shear (:,:,iblk), & + rdg_conv (:,:,iblk), & strtmp (:,:,:)) ! call ice_timer_stop(timer_tmp1) ! dynamics @@ -562,10 +564,8 @@ end subroutine eap subroutine init_eap (dt) use ice_blocks, only: nx_block, ny_block - use ice_communicate, only: my_task, master_task use ice_domain, only: nblocks use ice_dyn_shared, only: init_evp - use ice_restart_shared, only: runtype real (kind=dbl_kind), intent(in) :: & dt ! time step @@ -573,21 +573,21 @@ subroutine init_eap (dt) ! local variables integer (kind=int_kind) :: & - i, j, k, & + i, j, & iblk ! block index real (kind=dbl_kind), parameter :: & eps6 = 1.0e-6_dbl_kind integer (kind=int_kind) :: & - ix, iy, ip, iz, n, ia + ix, iy, iz, ia integer (kind=int_kind), parameter :: & nz = 100 real (kind=dbl_kind) :: & - ainit, xinit, yinit, pinit, zinit, & - da, dx, dy, dp, dz, a1, & + ainit, xinit, yinit, zinit, & + da, dx, dy, dz, & pi, pih, piq, phi character(len=*), parameter :: subname = '(init_eap)' @@ -749,10 +749,11 @@ FUNCTION s11kr(x,y,z,phi) real (kind=dbl_kind) :: & n1t2i11, n1t2i12, n1t2i21, n1t2i22, & n2t1i11, n2t1i12, n2t1i21, n2t1i22, & - t1t2i11, t1t2i12, t1t2i21, t1t2i22, & - t2t1i11, t2t1i12, t2t1i21, t2t1i22, & +! t1t2i11, t1t2i12, t1t2i21, t1t2i22, & +! t2t1i11, t2t1i12, t2t1i21, t2t1i22, & d11, d12, d22, & - IIn1t2, IIn2t1, IIt1t2, & + IIn1t2, IIn2t1, & +! IIt1t2, & Hen1t2, Hen2t1, & pih, puny character(len=*), parameter :: subname = '(s11kr)' @@ -772,14 +773,14 @@ FUNCTION s11kr(x,y,z,phi) n2t1i12 = cos(z-pih+p) * sin(z-p) n2t1i21 = sin(z-pih+p) * cos(z-p) n2t1i22 = sin(z-pih+p) * sin(z-p) - t1t2i11 = cos(z-p) * cos(z+p) - t1t2i12 = cos(z-p) * sin(z+p) - t1t2i21 = sin(z-p) * cos(z+p) - t1t2i22 = sin(z-p) * sin(z+p) - t2t1i11 = cos(z+p) * cos(z-p) - t2t1i12 = cos(z+p) * sin(z-p) - t2t1i21 = sin(z+p) * cos(z-p) - t2t1i22 = sin(z+p) * sin(z-p) +! t1t2i11 = cos(z-p) * cos(z+p) +! t1t2i12 = cos(z-p) * sin(z+p) +! t1t2i21 = sin(z-p) * cos(z+p) +! t1t2i22 = sin(z-p) * sin(z+p) +! t2t1i11 = cos(z+p) * cos(z-p) +! t2t1i12 = cos(z+p) * sin(z-p) +! t2t1i21 = sin(z+p) * cos(z-p) +! t2t1i22 = sin(z+p) * sin(z-p) ! In expression of tensor d, with this formulatin d(x)=-d(x+pi) ! Solution, when diagonalizing always check sgn(a11-a22) if > then keep x else x=x-pi/2 d11 = cos(y)*cos(y)*(cos(x)+sin(x)*tan(y)*tan(y)) @@ -787,7 +788,7 @@ FUNCTION s11kr(x,y,z,phi) d22 = cos(y)*cos(y)*(sin(x)+cos(x)*tan(y)*tan(y)) IIn1t2 = n1t2i11 * d11 + (n1t2i12 + n1t2i21) * d12 + n1t2i22 * d22 IIn2t1 = n2t1i11 * d11 + (n2t1i12 + n2t1i21) * d12 + n2t1i22 * d22 - IIt1t2 = t1t2i11 * d11 + (t1t2i12 + t1t2i21) * d12 + t1t2i22 * d22 +! IIt1t2 = t1t2i11 * d11 + (t1t2i12 + t1t2i21) * d12 + t1t2i22 * d22 if (-IIn1t2>=puny) then Hen1t2 = c1 @@ -819,10 +820,11 @@ FUNCTION s12kr(x,y,z,phi) real (kind=dbl_kind) :: & n1t2i11, n1t2i12, n1t2i21, n1t2i22, & n2t1i11, n2t1i12, n2t1i21, n2t1i22, & - t1t2i11, t1t2i12, t1t2i21, t1t2i22, & - t2t1i11, t2t1i12, t2t1i21, t2t1i22, & +! t1t2i11, t1t2i12, t1t2i21, t1t2i22, & +! t2t1i11, t2t1i12, t2t1i21, t2t1i22, & d11, d12, d22, & - IIn1t2, IIn2t1, IIt1t2, & + IIn1t2, IIn2t1, & +! IIt1t2, & Hen1t2, Hen2t1, & pih, puny character(len=*), parameter :: subname = '(s12kr)' @@ -842,20 +844,20 @@ FUNCTION s12kr(x,y,z,phi) n2t1i12 = cos(z-pih+p) * sin(z-p) n2t1i21 = sin(z-pih+p) * cos(z-p) n2t1i22 = sin(z-pih+p) * sin(z-p) - t1t2i11 = cos(z-p) * cos(z+p) - t1t2i12 = cos(z-p) * sin(z+p) - t1t2i21 = sin(z-p) * cos(z+p) - t1t2i22 = sin(z-p) * sin(z+p) - t2t1i11 = cos(z+p) * cos(z-p) - t2t1i12 = cos(z+p) * sin(z-p) - t2t1i21 = sin(z+p) * cos(z-p) - t2t1i22 = sin(z+p) * sin(z-p) +! t1t2i11 = cos(z-p) * cos(z+p) +! t1t2i12 = cos(z-p) * sin(z+p) +! t1t2i21 = sin(z-p) * cos(z+p) +! t1t2i22 = sin(z-p) * sin(z+p) +! t2t1i11 = cos(z+p) * cos(z-p) +! t2t1i12 = cos(z+p) * sin(z-p) +! t2t1i21 = sin(z+p) * cos(z-p) +! t2t1i22 = sin(z+p) * sin(z-p) d11 = cos(y)*cos(y)*(cos(x)+sin(x)*tan(y)*tan(y)) d12 = cos(y)*cos(y)*tan(y)*(-cos(x)+sin(x)) d22 = cos(y)*cos(y)*(sin(x)+cos(x)*tan(y)*tan(y)) IIn1t2 = n1t2i11 * d11 + (n1t2i12 + n1t2i21) * d12 + n1t2i22 * d22 IIn2t1 = n2t1i11 * d11 + (n2t1i12 + n2t1i21) * d12 + n2t1i22 * d22 - IIt1t2 = t1t2i11 * d11 + (t1t2i12 + t1t2i21) * d12 + t1t2i22 * d22 +! IIt1t2 = t1t2i11 * d11 + (t1t2i12 + t1t2i21) * d12 + t1t2i22 * d22 if (-IIn1t2>=puny) then Hen1t2 = c1 @@ -889,10 +891,11 @@ FUNCTION s22kr(x,y,z,phi) real (kind=dbl_kind) :: & n1t2i11, n1t2i12, n1t2i21, n1t2i22, & n2t1i11, n2t1i12, n2t1i21, n2t1i22, & - t1t2i11, t1t2i12, t1t2i21, t1t2i22, & - t2t1i11, t2t1i12, t2t1i21, t2t1i22, & +! t1t2i11, t1t2i12, t1t2i21, t1t2i22, & +! t2t1i11, t2t1i12, t2t1i21, t2t1i22, & d11, d12, d22, & - IIn1t2, IIn2t1, IIt1t2, & + IIn1t2, IIn2t1, & +! IIt1t2, & Hen1t2, Hen2t1, & pih, puny character(len=*), parameter :: subname = '(s22kr)' @@ -912,20 +915,20 @@ FUNCTION s22kr(x,y,z,phi) n2t1i12 = cos(z-pih+p) * sin(z-p) n2t1i21 = sin(z-pih+p) * cos(z-p) n2t1i22 = sin(z-pih+p) * sin(z-p) - t1t2i11 = cos(z-p) * cos(z+p) - t1t2i12 = cos(z-p) * sin(z+p) - t1t2i21 = sin(z-p) * cos(z+p) - t1t2i22 = sin(z-p) * sin(z+p) - t2t1i11 = cos(z+p) * cos(z-p) - t2t1i12 = cos(z+p) * sin(z-p) - t2t1i21 = sin(z+p) * cos(z-p) - t2t1i22 = sin(z+p) * sin(z-p) +! t1t2i11 = cos(z-p) * cos(z+p) +! t1t2i12 = cos(z-p) * sin(z+p) +! t1t2i21 = sin(z-p) * cos(z+p) +! t1t2i22 = sin(z-p) * sin(z+p) +! t2t1i11 = cos(z+p) * cos(z-p) +! t2t1i12 = cos(z+p) * sin(z-p) +! t2t1i21 = sin(z+p) * cos(z-p) +! t2t1i22 = sin(z+p) * sin(z-p) d11 = cos(y)*cos(y)*(cos(x)+sin(x)*tan(y)*tan(y)) d12 = cos(y)*cos(y)*tan(y)*(-cos(x)+sin(x)) d22 = cos(y)*cos(y)*(sin(x)+cos(x)*tan(y)*tan(y)) IIn1t2 = n1t2i11 * d11 + (n1t2i12 + n1t2i21) * d12 + n1t2i22 * d22 IIn2t1 = n2t1i11 * d11 + (n2t1i12 + n2t1i21) * d12 + n2t1i22 * d22 - IIt1t2 = t1t2i11 * d11 + (t1t2i12 + t1t2i21) * d12 + t1t2i22 * d22 +! IIt1t2 = t1t2i11 * d11 + (t1t2i12 + t1t2i21) * d12 + t1t2i22 * d22 if (-IIn1t2>=puny) then Hen1t2 = c1 @@ -957,8 +960,10 @@ FUNCTION s11ks(x,y,z,phi) real (kind=dbl_kind) :: & n1t2i11, n1t2i12, n1t2i21, n1t2i22, & n2t1i11, n2t1i12, n2t1i21, n2t1i22, & - t1t2i11, t1t2i12, t1t2i21, t1t2i22, & - t2t1i11, t2t1i12, t2t1i21, t2t1i22, & + t1t2i11, & + t1t2i12, t1t2i21, t1t2i22, & + t2t1i11, & +! t2t1i12, t2t1i21, t2t1i22, & d11, d12, d22, & IIn1t2, IIn2t1, IIt1t2, & Hen1t2, Hen2t1, & @@ -985,9 +990,9 @@ FUNCTION s11ks(x,y,z,phi) t1t2i21 = sin(z-p) * cos(z+p) t1t2i22 = sin(z-p) * sin(z+p) t2t1i11 = cos(z+p) * cos(z-p) - t2t1i12 = cos(z+p) * sin(z-p) - t2t1i21 = sin(z+p) * cos(z-p) - t2t1i22 = sin(z+p) * sin(z-p) +! t2t1i12 = cos(z+p) * sin(z-p) +! t2t1i21 = sin(z+p) * cos(z-p) +! t2t1i22 = sin(z+p) * sin(z-p) d11 = cos(y)*cos(y)*(cos(x)+sin(x)*tan(y)*tan(y)) d12 = cos(y)*cos(y)*tan(y)*(-cos(x)+sin(x)) d22 = cos(y)*cos(y)*(sin(x)+cos(x)*tan(y)*tan(y)) @@ -1026,7 +1031,8 @@ FUNCTION s12ks(x,y,z,phi) n1t2i11, n1t2i12, n1t2i21, n1t2i22, & n2t1i11, n2t1i12, n2t1i21, n2t1i22, & t1t2i11, t1t2i12, t1t2i21, t1t2i22, & - t2t1i11, t2t1i12, t2t1i21, t2t1i22, & +! t2t1i11, t2t1i22, & + t2t1i12, t2t1i21, & d11, d12, d22, & IIn1t2, IIn2t1, IIt1t2, & Hen1t2, Hen2t1, & @@ -1052,10 +1058,10 @@ FUNCTION s12ks(x,y,z,phi) t1t2i12 = cos(z-p) * sin(z+p) t1t2i21 = sin(z-p) * cos(z+p) t1t2i22 = sin(z-p) * sin(z+p) - t2t1i11 = cos(z+p) * cos(z-p) +! t2t1i11 = cos(z+p) * cos(z-p) t2t1i12 = cos(z+p) * sin(z-p) t2t1i21 = sin(z+p) * cos(z-p) - t2t1i22 = sin(z+p) * sin(z-p) +! t2t1i22 = sin(z+p) * sin(z-p) d11 = cos(y)*cos(y)*(cos(x)+sin(x)*tan(y)*tan(y)) d12 = cos(y)*cos(y)*tan(y)*(-cos(x)+sin(x)) d22 = cos(y)*cos(y)*(sin(x)+cos(x)*tan(y)*tan(y)) @@ -1096,7 +1102,8 @@ FUNCTION s22ks(x,y,z,phi) n1t2i11, n1t2i12, n1t2i21, n1t2i22, & n2t1i11, n2t1i12, n2t1i21, n2t1i22, & t1t2i11, t1t2i12, t1t2i21, t1t2i22, & - t2t1i11, t2t1i12, t2t1i21, t2t1i22, & +! t2t1i11, t2t1i12, t2t1i21, & + t2t1i22, & d11, d12, d22, & IIn1t2, IIn2t1, IIt1t2, & Hen1t2, Hen2t1, & @@ -1122,9 +1129,9 @@ FUNCTION s22ks(x,y,z,phi) t1t2i12 = cos(z-p) * sin(z+p) t1t2i21 = sin(z-p) * cos(z+p) t1t2i22 = sin(z-p) * sin(z+p) - t2t1i11 = cos(z+p) * cos(z-p) - t2t1i12 = cos(z+p) * sin(z-p) - t2t1i21 = sin(z+p) * cos(z-p) +! t2t1i11 = cos(z+p) * cos(z-p) +! t2t1i12 = cos(z+p) * sin(z-p) +! t2t1i21 = sin(z+p) * cos(z-p) t2t1i22 = sin(z+p) * sin(z-p) d11 = cos(y)*cos(y)*(cos(x)+sin(x)*tan(y)*tan(y)) d12 = cos(y)*cos(y)*tan(y)*(-cos(x)+sin(x)) @@ -1168,7 +1175,6 @@ subroutine stress_eap (nx_block, ny_block, & cxp, cyp, & cxm, cym, & tarear, strength, & - a11, a12, & a11_1, a11_2, a11_3, a11_4, & a12_1, a12_2, a12_3, a12_4, & stressp_1, stressp_2, & @@ -1185,7 +1191,8 @@ subroutine stress_eap (nx_block, ny_block, & yieldstress11, & yieldstress12, & yieldstress22, & - rdg_conv, rdg_shear, & +! rdg_conv, rdg_shear, & + rdg_conv, & strtmp) !echmod tmp @@ -1230,7 +1237,7 @@ subroutine stress_eap (nx_block, ny_block, & real (kind=dbl_kind), dimension (nx_block,ny_block), & intent(inout) :: & - a11, a12, a11_1, a11_2, a11_3, a11_4, & ! structure tensor + a11_1, a11_2, a11_3, a11_4, & ! structure tensor a12_1, a12_2, a12_3, a12_4 ! structure tensor real (kind=dbl_kind), dimension (nx_block,ny_block), & @@ -1246,8 +1253,8 @@ subroutine stress_eap (nx_block, ny_block, & yieldstress11, & ! components of yield stress tensor (kg/s^2) yieldstress12, & yieldstress22, & - rdg_conv , & ! convergence term for ridging (1/s) - rdg_shear ! shear term for ridging (1/s) + rdg_conv ! convergence term for ridging (1/s) +! rdg_shear ! shear term for ridging (1/s) real (kind=dbl_kind), dimension(nx_block,ny_block,8), & intent(out) :: & @@ -1609,9 +1616,6 @@ subroutine update_stress_rdg (ksub, ndte, divu, tension, & a22, Q11, Q12, Qd11, Qd12, & Q11Q11, Q11Q12, Q12Q12, & dtemp11, dtemp12, dtemp22, & - fxinvdx, fyinvdy, fainvda, & - mfxinvdx, mfyinvdy, mfainvda, & - fff, ffm, fmm, mmm, mmf, mff, fmf, mfm, & rotstemp11r, rotstemp12r, rotstemp22r, & rotstemp11s, rotstemp12s, rotstemp22s, & sig11, sig12, sig22, & @@ -1619,7 +1623,7 @@ subroutine update_stress_rdg (ksub, ndte, divu, tension, & invstressconviso, & gamma, alpha, x, y, dx, dy, da, & invdx, invdy, invda, invsin, & - invleng, dtemp1, dtemp2, atempprime, a, & + invleng, dtemp1, dtemp2, atempprime, & puny, pi, pi2, piq real (kind=dbl_kind), parameter :: & @@ -1989,11 +1993,6 @@ subroutine write_restart_eap () ! local variables - integer (kind=int_kind) :: & - iyear, imonth, iday ! year, month, day - - character(len=char_len_long) :: filename - logical (kind=log_kind) :: diag character(len=*), parameter :: subname = '(write_restart_eap)' diff --git a/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 b/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 index 11313ef6f..1b64ff966 100644 --- a/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 +++ b/cicecore/cicedynB/dynamics/ice_dyn_evp.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_dyn_evp.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! ! Elastic-viscous-plastic sea ice dynamics model @@ -88,6 +87,9 @@ subroutine evp (dt) stressp_1, stressp_2, stressp_3, stressp_4, & stressm_1, stressm_2, stressm_3, stressm_4, & stress12_1, stress12_2, stress12_3, stress12_4 +#ifdef CICE_IN_NEMO + use ice_flux, only: strax, stray +#endif use ice_grid, only: tmask, umask, dxt, dyt, dxhy, dyhx, cxp, cyp, cxm, cym, & tarear, uarear, tinyarea, to_ugrid, t2ugrid_vector, u2tgrid_vector, & grid_type diff --git a/cicecore/cicedynB/dynamics/ice_dyn_shared.F90 b/cicecore/cicedynB/dynamics/ice_dyn_shared.F90 index 64c569c10..dc381c01e 100644 --- a/cicecore/cicedynB/dynamics/ice_dyn_shared.F90 +++ b/cicecore/cicedynB/dynamics/ice_dyn_shared.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_dyn_shared.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! Elastic-viscous-plastic sea ice dynamics model code shared with other @@ -105,12 +104,12 @@ subroutine init_evp (dt) use ice_constants, only: c0, c2, omega use ice_domain, only: nblocks use ice_domain_size, only: max_blocks - use ice_flux, only: rdg_conv, rdg_shear, iceumask, fm, & + use ice_flux, only: rdg_conv, rdg_shear, iceumask, & stressp_1, stressp_2, stressp_3, stressp_4, & stressm_1, stressm_2, stressm_3, stressm_4, & stress12_1, stress12_2, stress12_3, stress12_4 use ice_state, only: uvel, vvel, divu, shear - use ice_grid, only: ULAT, ULON + use ice_grid, only: ULAT real (kind=dbl_kind), intent(in) :: & dt ! time step @@ -187,10 +186,11 @@ end subroutine init_evp subroutine set_evp_parameters (dt) - use ice_constants, only: p25, c1, c2, c4, p5 + use ice_communicate, only: my_task, master_task + use ice_constants, only: p25, c1, c2, p5 use ice_domain, only: distrb_info - use ice_global_reductions, only: global_minval, global_maxval - use ice_grid, only: dxt, dyt, tmask, tarea + use ice_global_reductions, only: global_minval + use ice_grid, only: dxt, dyt, tmask real (kind=dbl_kind), intent(in) :: & dt ! time step diff --git a/cicecore/cicedynB/dynamics/ice_transport_driver.F90 b/cicecore/cicedynB/dynamics/ice_transport_driver.F90 index 628aef1c5..5a5414f14 100644 --- a/cicecore/cicedynB/dynamics/ice_transport_driver.F90 +++ b/cicecore/cicedynB/dynamics/ice_transport_driver.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_transport_driver.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! ! Drivers for remapping and upwind ice transport @@ -16,7 +15,7 @@ module ice_transport_driver use ice_kinds_mod use ice_communicate, only: my_task, master_task use ice_constants, only: c0, c1, p5, & - field_loc_center, field_loc_NEcorner, & + field_loc_center, & field_type_scalar, field_type_vector, & field_loc_Nface, field_loc_Eface use ice_fileunits, only: nu_diag @@ -230,7 +229,7 @@ subroutine transport_remap (dt) use ice_blocks, only: nx_block, ny_block, block, get_block, nghost use ice_state, only: aice0, aicen, vicen, vsnon, trcrn, & uvel, vvel, bound_state - use ice_grid, only: tarea, HTE, HTN + use ice_grid, only: tarea use ice_calendar, only: istep1 use ice_timers, only: ice_timer_start, ice_timer_stop, & timer_advect, timer_bound @@ -1000,7 +999,7 @@ subroutine tracers_to_state (nx_block, ny_block, & integer (kind=int_kind) :: & nt_qsno ,&! - i, j, k, n ,&! standard indices + i, j, n ,&! standard indices it, kt ,&! tracer indices icells ,&! number of cells with ice ij @@ -1758,20 +1757,11 @@ subroutine upwind_field (nx_block, ny_block, & integer (kind=int_kind) :: & i, j, n ! standard indices - real (kind=dbl_kind) :: & - upwind, y1, y2, a, h ! function - real (kind=dbl_kind), dimension (nx_block,ny_block) :: & worka, workb character(len=*), parameter :: subname = '(upwind_field)' - !------------------------------------------------------------------- - ! Define upwind function - !------------------------------------------------------------------- - - upwind(y1,y2,a,h) = p5*dt*h*((a+abs(a))*y1+(a-abs(a))*y2) - !------------------------------------------------------------------- ! upwind transport !------------------------------------------------------------------- @@ -1781,9 +1771,9 @@ subroutine upwind_field (nx_block, ny_block, & do j = 1, jhi do i = 1, ihi worka(i,j)= & - upwind(phi(i,j,n),phi(i+1,j,n),uee(i,j),HTE(i,j)) + upwind(phi(i,j,n),phi(i+1,j,n),uee(i,j),HTE(i,j),dt) workb(i,j)= & - upwind(phi(i,j,n),phi(i,j+1,n),vnn(i,j),HTN(i,j)) + upwind(phi(i,j,n),phi(i,j+1,n),vnn(i,j),HTN(i,j),dt) enddo enddo @@ -1799,6 +1789,20 @@ subroutine upwind_field (nx_block, ny_block, & end subroutine upwind_field +!======================================================================= + + !------------------------------------------------------------------- + ! Define upwind function + !------------------------------------------------------------------- + + real(kind=dbl_kind) function upwind(y1,y2,a,h,dt) + + real(kind=dbl_kind), intent(in) :: y1,y2,a,h,dt + + upwind = p5*dt*h*((a+abs(a))*y1+(a-abs(a))*y2) + + end function upwind + !======================================================================= end module ice_transport_driver diff --git a/cicecore/cicedynB/dynamics/ice_transport_remap.F90 b/cicecore/cicedynB/dynamics/ice_transport_remap.F90 index 9aacdcbe7..efa5a2e51 100644 --- a/cicecore/cicedynB/dynamics/ice_transport_remap.F90 +++ b/cicecore/cicedynB/dynamics/ice_transport_remap.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_transport_remap.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! ! Transports quantities using the second-order conservative remapping @@ -31,7 +30,7 @@ module ice_transport_remap use ice_kinds_mod - use ice_communicate, only: my_task, master_task + use ice_communicate, only: my_task use ice_constants, only: c0, c1, c2, c12, p333, p4, p5, p6, & eps13, eps16, & field_loc_center, field_type_scalar, & @@ -327,7 +326,7 @@ subroutine horizontal_remap (dt, ntrace, & use ice_domain, only: nblocks, blocks_ice, halo_info, maskhalo_remap use ice_blocks, only: block, get_block, nghost, nx_block, ny_block use ice_grid, only: HTE, HTN, dxu, dyu, & - tarea, tarear, hm, & + tarear, hm, & xav, yav, xxav, yyav ! xyav, xxxav, xxyav, xyyav, yyyav use ice_calendar, only: istep1 @@ -1118,7 +1117,7 @@ subroutine construct_fields (nx_block, ny_block, & real (kind=dbl_kind) :: & puny, & - w1, w2, w3, w4, w5, w6, w7 ! work variables + w1, w2, w3, w7 ! work variables character(len=*), parameter :: subname = '(construct_fields)' @@ -1279,10 +1278,10 @@ subroutine construct_fields (nx_block, ny_block, & + mx(i,j)*tc(i,j,nt) w3 = mc(i,j)*ty(i,j,nt) & + my(i,j)*tc(i,j,nt) - w4 = mx(i,j)*tx(i,j,nt) - w5 = mx(i,j)*ty(i,j,nt) & - + my(i,j)*tx(i,j,nt) - w6 = my(i,j)*ty(i,j,nt) +! w4 = mx(i,j)*tx(i,j,nt) +! w5 = mx(i,j)*ty(i,j,nt) & +! + my(i,j)*tx(i,j,nt) +! w6 = my(i,j)*ty(i,j,nt) w7 = c1 / (mm(i,j)*tm(i,j,nt)) !echmod: grid arrays = 0 mtxav(i,j,nt) = (w1*xav (i,j) + w2*xxav (i,j)) & diff --git a/cicecore/cicedynB/general/ice_flux.F90 b/cicecore/cicedynB/general/ice_flux.F90 index c3ff97be6..83250131b 100644 --- a/cicecore/cicedynB/general/ice_flux.F90 +++ b/cicecore/cicedynB/general/ice_flux.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_flux.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! Flux variable declarations; these include fields sent from the coupler @@ -514,7 +513,6 @@ end subroutine alloc_flux subroutine init_coupler_flux use ice_arrays_column, only: Cdn_atm - use ice_constants, only: p001 use ice_flux_bgc, only: flux_bio_atm, flux_bio, faero_atm, & fnit, famm, fsil, fdmsp, fdms, fhum, fdust, falgalN, & fdoc, fdon, fdic, ffed, ffep @@ -629,6 +627,7 @@ subroutine init_coupler_flux uocn (:,:,:) = c0 ! surface ocean currents (m/s) vocn (:,:,:) = c0 frzmlt(:,:,:) = c0 ! freezing/melting potential (W/m^2) +! frzmlt_init(:,:,:) = c0 ! freezing/melting potential (W/m^2) sss (:,:,:) = 34.0_dbl_kind ! sea surface salinity (ppt) do iblk = 1, size(Tf,3) @@ -657,6 +656,7 @@ subroutine init_coupler_flux fsens (:,:,:) = c0 flat (:,:,:) = c0 fswabs (:,:,:) = c0 +! fswint_ai(:,:,:) = c0 flwout (:,:,:) = -stefan_boltzmann*Tffresh**4 ! in case atm model diagnoses Tsfc from flwout evap (:,:,:) = c0 @@ -676,6 +676,7 @@ subroutine init_coupler_flux strocnyT(:,:,:) = c0 ! ice-ocean stress, y-direction (T-cell) fresh (:,:,:) = c0 fsalt (:,:,:) = c0 +! fpiond (:,:,:) = c0 fhocn (:,:,:) = c0 fswthru (:,:,:) = c0 fresh_da(:,:,:) = c0 ! data assimilation @@ -701,6 +702,7 @@ subroutine init_coupler_flux coszen (:,:,:) = c0 ! Cosine of the zenith angle fsw (:,:,:) = c0 ! shortwave radiation (W/m^2) +! fswfac (:,:,:) = c0 scale_factor(:,:,:) = c1 ! shortwave scaling factor wind (:,:,:) = sqrt(uatm(:,:,:)**2 & + vatm(:,:,:)**2) ! wind speed, (m/s) @@ -763,6 +765,7 @@ subroutine init_flux_ocn fresh (:,:,:) = c0 fsalt (:,:,:) = c0 +! fpond (:,:,:) = c0 fhocn (:,:,:) = c0 fswthru (:,:,:) = c0 faero_ocn(:,:,:,:) = c0 @@ -812,6 +815,7 @@ subroutine init_history_therm fsurf (:,:,:) = c0 fcondtop(:,:,:)= c0 congel (:,:,:) = c0 +! fbot (:,:,:) = c0 frazil (:,:,:) = c0 snoice (:,:,:) = c0 dsnow (:,:,:) = c0 @@ -847,6 +851,7 @@ subroutine init_history_therm Cdn_ocn(:,:,:) = dragio Cdn_atm(:,:,:) = (vonkar/log(zref/iceruf)) & * (vonkar/log(zref/iceruf)) ! atmo drag for RASM +! Cdn_atm_ratio(:,:,:)= c0 if (formdrag) then Cdn_atm_rdg (:,:,:) = c0 @@ -878,7 +883,7 @@ end subroutine init_history_therm subroutine init_history_dyn - use ice_state, only: aice, vice, trcr + use ice_state, only: aice, vice, trcr, strength logical (kind=log_kind) :: & tr_iage @@ -898,6 +903,7 @@ subroutine init_history_dyn sig2 (:,:,:) = c0 taubx (:,:,:) = c0 tauby (:,:,:) = c0 +! strength (:,:,:) = c0 strocnx (:,:,:) = c0 strocny (:,:,:) = c0 strairx (:,:,:) = c0 diff --git a/cicecore/cicedynB/general/ice_flux_bgc.F90 b/cicecore/cicedynB/general/ice_flux_bgc.F90 index 1f6878607..3dc7d4146 100644 --- a/cicecore/cicedynB/general/ice_flux_bgc.F90 +++ b/cicecore/cicedynB/general/ice_flux_bgc.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: $ !======================================================================= ! Flux variable declarations for biogeochemistry diff --git a/cicecore/cicedynB/general/ice_forcing.F90 b/cicecore/cicedynB/general/ice_forcing.F90 index 240d692f1..8db628c93 100644 --- a/cicecore/cicedynB/general/ice_forcing.F90 +++ b/cicecore/cicedynB/general/ice_forcing.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_forcing.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! ! Reads and interpolates forcing data for atmosphere and ocean quantities. @@ -20,7 +19,7 @@ module ice_forcing use ice_blocks, only: nx_block, ny_block use ice_domain_size, only: ncat, max_blocks, nx_global, ny_global use ice_communicate, only: my_task, master_task - use ice_calendar, only: istep, istep1, time, time_forc, year_init, & + use ice_calendar, only: istep, istep1, time, time_forc, & sec, mday, month, nyr, yday, daycal, dayyr, & daymo, days_per_year use ice_fileunits, only: nu_diag, nu_forcing @@ -37,7 +36,6 @@ module ice_forcing use ice_constants, only: field_loc_center, field_type_scalar, & field_type_vector, field_loc_NEcorner use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted - use icepack_intfc, only: icepack_liquidus_temperature use icepack_intfc, only: icepack_sea_freezing_temperature use icepack_intfc, only: icepack_query_tracer_indices, icepack_query_parameters @@ -56,13 +54,11 @@ module ice_forcing fyear_final ! last year in cycle character (char_len_long) :: & ! input data file names - height_file, & uwind_file, & vwind_file, & wind_file, & strax_file, & stray_file, & - potT_file, & tair_file, & humid_file, & rhoa_file, & @@ -71,7 +67,6 @@ module ice_forcing rain_file, & sst_file, & sss_file, & - pslv_file, & sublim_file, & snow_file @@ -102,8 +97,6 @@ module ice_forcing stray_data, & Qa_data, & rhoa_data, & - potT_data, & - zlvl_data, & flw_data, & sst_data, & sss_data, & @@ -182,8 +175,6 @@ subroutine alloc_forcing stray_data(nx_block,ny_block,2,max_blocks), & Qa_data(nx_block,ny_block,2,max_blocks), & rhoa_data(nx_block,ny_block,2,max_blocks), & - potT_data(nx_block,ny_block,2,max_blocks), & - zlvl_data(nx_block,ny_block,2,max_blocks), & flw_data(nx_block,ny_block,2,max_blocks), & sst_data(nx_block,ny_block,2,max_blocks), & sss_data(nx_block,ny_block,2,max_blocks), & @@ -244,9 +235,9 @@ subroutine init_forcing_atmo elseif (trim(atm_data_type) == 'monthly') then call monthly_files(fyear) elseif (trim(atm_data_type) == 'oned') then - call oned_files(fyear) + call oned_files elseif (trim(atm_data_type) == 'ISPOL') then - call ISPOL_files(fyear) + call ISPOL_files endif end subroutine init_forcing_atmo @@ -300,6 +291,11 @@ subroutine init_forcing_ocn(dt) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) +! sst_data(:,:,:,:) = c0 +! sss_data(:,:,:,:) = c0 +! uocn_data(:,:,:,:) = c0 +! vocn_data(:,:,:,:) = c0 + nbits = 64 ! double precision data if (restore_sst .or. restore_bgc) then @@ -618,7 +614,7 @@ subroutine get_forcing_ocn (dt) call ocn_data_hadgem(dt) elseif (trim(sst_data_type) == 'oned' .or. & trim(sss_data_type) == 'oned') then - call ocn_data_oned(dt) + call ocn_data_oned endif end subroutine get_forcing_ocn @@ -657,7 +653,7 @@ subroutine read_data (flag, recd, yr, ixm, ixx, ixp, & maxrec ! maximum record value real (kind=dbl_kind), dimension(nx_block,ny_block,2,max_blocks), & - intent(out) :: & + intent(inout) :: & field_data ! 2 values needed for interpolation integer (kind=int_kind), intent(in) :: & @@ -956,7 +952,7 @@ subroutine read_clim_data (readflag, recd, ixm, ixx, ixp, & field_type ! type of field (scalar, vector, angle) real (kind=dbl_kind), dimension(nx_block,ny_block,2,max_blocks), & - intent(out) :: & + intent(inout) :: & field_data ! 2 values needed for interpolation ! local variables @@ -1048,7 +1044,6 @@ subroutine read_clim_data_nc (readflag, recd, ixm, ixx, ixp, & ! local variables integer (kind=int_kind) :: & - nbits , & ! = 32 for single precision, 64 for double nrec , & ! record number to read arg , & ! value of time argument in field_data fid ! file id for netCDF routines @@ -1057,8 +1052,6 @@ subroutine read_clim_data_nc (readflag, recd, ixm, ixx, ixp, & call ice_timer_start(timer_readwrite) ! reading/writing - nbits = 64 ! double precision data - if (istep1 > check_step) dbug = .true. !! debugging if (my_task==master_task .and. (dbug)) & @@ -1307,7 +1300,6 @@ subroutine prepare_forcing (nx_block, ny_block, & ilo,ihi,jlo,jhi ! beginning and end of physical domain real (kind=dbl_kind), dimension(nx_block,ny_block), intent(in) :: & - Tair , & ! air temperature (K) ANGLET , & ! ANGLE converted to T-cells Tsfc , & ! ice skin temperature sst , & ! sea surface temperature @@ -1320,6 +1312,7 @@ subroutine prepare_forcing (nx_block, ny_block, & cldf , & ! cloud fraction frain , & ! rainfall rate (kg/m^2 s) fsnow , & ! snowfall rate (kg/m^2 s) + Tair , & ! air temperature (K) Qa , & ! specific humidity (kg/kg) rhoa , & ! air density (kg/m^3) uatm , & ! wind velocity components (m/s) @@ -1341,13 +1334,13 @@ subroutine prepare_forcing (nx_block, ny_block, & i, j real (kind=dbl_kind) :: workx, worky, & - precip_factor, zlvl0, secday, Tffresh + precip_factor, zlvl0, secday, Tffresh, puny logical (kind=log_kind) :: calc_strair character(len=*), parameter :: subname = '(prepare_forcing)' - call icepack_query_parameters(Tffresh_out=Tffresh) + call icepack_query_parameters(Tffresh_out=Tffresh, puny_out=puny) call icepack_query_parameters(secday_out=secday) call icepack_query_parameters(calc_strair_out=calc_strair) call icepack_warnings_flush(nu_diag) @@ -1368,6 +1361,9 @@ subroutine prepare_forcing (nx_block, ny_block, & rhoa (i,j) = max(rhoa(i,j),c0) Qa (i,j) = max(Qa(i,j),c0) +! if (rhoa(i,j) .lt. puny) rhoa(i,j) = 1.3_dbl_kind +! if (Tair(i,j) .lt. puny) Tair(i,j) = Tffresh +! if (Qa(i,j) .lt. puny) Qa(i,j) = 0.0035_dbl_kind enddo ! i enddo ! j @@ -2428,7 +2424,6 @@ subroutine hadgem_data use ice_domain, only: nblocks use ice_flux, only: fsnow, frain, uatm, vatm, strax, stray, wind, & fsw, flw, Tair, rhoa, Qa, fcondtopn_f, fsurfn_f, flatn_f - use ice_state, only: aice, aicen integer (kind=int_kind) :: & i, j , & ! horizontal indices @@ -2900,8 +2895,6 @@ end subroutine monthly_data subroutine oned_data - use ice_blocks, only: block, get_block - use ice_domain, only: nblocks, blocks_ice use ice_flux, only: uatm, vatm, Tair, fsw, fsnow, Qa, rhoa, frain #ifdef ncdf @@ -2924,13 +2917,6 @@ subroutine oned_data integer (kind=int_kind) :: & status ! status flag - integer (kind=int_kind) :: & - iblk, & ! block index - ilo,jlo ! beginning of physical domain - - type (block) :: & - this_block ! block information for current block - real (kind=dbl_kind) :: & ! used to determine specific humidity Temp , & ! air temperature (K) rh , & ! relative humidity (%) @@ -2951,11 +2937,6 @@ subroutine oned_data diag = .false. ! write diagnostic information - do iblk = 1, nblocks - this_block = get_block(blocks_ice(iblk),iblk) - ilo = this_block%ilo - jlo = this_block%jlo - if (trim(atm_data_format) == 'nc') then ! read nc file ! hourly data beginning Jan 1, 1989, 01:00 @@ -3021,18 +3002,13 @@ subroutine oned_data cldf (:,:,:) = p25 ! cloud fraction frain(:,:,:) = c0 ! this is available in hourlymet_rh file - enddo ! nblocks - #endif end subroutine oned_data !======================================================================= - subroutine oned_files(yr) - - integer (kind=int_kind), intent(in) :: & - yr ! current forcing year + subroutine oned_files character(len=*), parameter :: subname = '(oned_files)' @@ -3080,7 +3056,7 @@ subroutine ocn_data_clim (dt) ! author: Elizabeth C. Hunke and William H. Lipscomb, LANL use ice_domain, only: nblocks - use ice_flux, only: Tf, sss, sst, uocn, vocn, ss_tltx, ss_tlty + use ice_flux, only: sss, sst real (kind=dbl_kind), intent(in) :: & dt ! time step @@ -3700,16 +3676,11 @@ end subroutine ocn_data_ncar ! ocean data for oned configuration ! Current (released) values are the same as the defaults (ice_flux.F90) - subroutine ocn_data_oned(dt) + subroutine ocn_data_oned use ice_flux, only: sss, sst, Tf, uocn, vocn, ss_tltx, ss_tlty, & qdp, hmix, frzmlt - real (kind=dbl_kind), intent(in) :: & - dt ! time step - - integer :: i, j, iblk - character(len=*), parameter :: subname = '(ocn_data_oned)' sss (:,:,:) = 34.0_dbl_kind ! sea surface salinity (ppt) @@ -3744,10 +3715,9 @@ subroutine ocn_data_hadgem(dt) real (kind=dbl_kind), intent(in) :: & dt ! time step - - integer (kind=int_kind) :: & - i, j , & ! horizontal indices - iblk , & ! block index + + integer (kind=int_kind) :: & + i, j, iblk , & ixm,ixp , & ! record numbers for neighboring months maxrec , & ! maximum record number recslot , & ! spline slot for current record @@ -3874,7 +3844,7 @@ subroutine ocn_data_hadgem(dt) ! and change units !----------------------------------------------------------------- - !$OMP PARALLEL DO PRIVATE(iblk,i,j) + !$OMP PARALLEL DO PRIVATE(iblk,i,j,workx,worky) do iblk = 1, nblocks do j = 1, ny_block do i = 1, nx_block @@ -3949,7 +3919,7 @@ subroutine read_data_nc_point (flag, recd, yr, ixm, ixx, ixp, & field_type ! type of field (scalar, vector, angle) real (kind=dbl_kind), dimension(2), & - intent(out) :: & + intent(inout) :: & field_data ! 2 values needed for interpolation character(len=*), parameter :: subname = '(read_data_nc_point)' @@ -3964,6 +3934,8 @@ subroutine read_data_nc_point (flag, recd, yr, ixm, ixx, ixp, & call ice_timer_start(timer_readwrite) ! reading/writing + field_data = c0 ! to satisfy intent(out) attribute + if (istep1 > check_step) dbug = .true. !! debugging if (my_task==master_task .and. (dbug)) then @@ -4071,10 +4043,7 @@ end subroutine read_data_nc_point !======================================================================= - subroutine ISPOL_files(yr) - - integer (kind=int_kind), intent(in) :: & - yr ! current forcing year + subroutine ISPOL_files character(len=*), parameter :: subname = '(ISPOL_files)' @@ -4121,12 +4090,8 @@ subroutine ISPOL_data ! authors: Nicole Jeffery, LANL ! - use ice_global_reductions, only: global_minval, global_maxval - use ice_domain, only: nblocks, distrb_info, blocks_ice - use ice_flux, only: uatm, vatm, Tair, fsw, Qa, qdp, rhoa, & + use ice_flux, only: uatm, vatm, Tair, fsw, Qa, rhoa, & frain, fsnow, flw - use ice_grid, only: tmask - use ice_diagnostics, only: latpnt, lonpnt #ifdef ncdf use netcdf #endif @@ -4137,29 +4102,9 @@ subroutine ISPOL_data met_file, & ! netcdf filename fieldname ! field name in netcdf file - integer (kind=int_kind) :: & - fid ! file id for netCDF file - - real (kind=dbl_kind):: & - work ! temporary variable - - real (kind=dbl_kind) :: & - vmin, vmax - - logical (kind=log_kind) :: diag - integer (kind=int_kind) :: & status ! status flag - integer (kind=int_kind) :: & - iblk ! block index - - real (kind=dbl_kind) :: & ! used to determine specific humidity - Temp , & ! air temperature (K) - rh , & ! relative humidity (%) - Psat , & ! saturation vapour pressure (hPa) - ws ! saturation mixing ratio - real (kind=dbl_kind), dimension(2), save :: & Tair_data_p , & ! air temperature (K) for interpolation Qa_data_p, fsnow_data_p, & @@ -4179,38 +4124,24 @@ subroutine ISPOL_data ! for interpolation of hourly data integer (kind=int_kind) :: & - i, j, k , & ixm,ixx,ixp , & ! record numbers for neighboring months recnum , & ! record number recnum4X , & ! record number maxrec , & ! maximum record number recslot , & ! spline slot for current record - dataloc , & ! = 1 for data located in middle of time interval + dataloc ! = 1 for data located in middle of time interval ! = 2 for date located at end of time interval - sec_day ! fix time to noon - real (kind=dbl_kind) :: & - hour_angle, & - solar_time, & - declin , & - cosZ , & - year_day , & - e, d , & - sw0 , & - deg2rad , & - fsw_pnt , & - sumsw0 , & secday , & Qa_pnt real (kind=dbl_kind) :: & sec1hr ! number of seconds in 1 hour - logical (kind=log_kind) :: readm, read1 + logical (kind=log_kind) :: read1 character(len=*), parameter :: subname = '(ISPOL_data)' - diag = .false. ! write diagnostic information call icepack_query_parameters(secday_out=secday) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & @@ -4394,7 +4325,6 @@ subroutine ocn_data_ispol_init ! ! authors: Nicole Jeffery, LANL ! - use ice_domain, only: nblocks, distrb_info use ice_gather_scatter use ice_read_write #ifdef ncdf @@ -4403,9 +4333,7 @@ subroutine ocn_data_ispol_init integer (kind=int_kind) :: & n , & ! field index - m , & ! month index - nrec, & ! record number for direct access - nbits + m ! month index character(char_len) :: & vname(nfld) ! variable names to search for in file @@ -4417,13 +4345,10 @@ subroutine ocn_data_ispol_init work integer (kind=int_kind) :: & - fid , & ! file id - dimid ! dimension id + fid ! file id integer (kind=int_kind) :: & - status , & ! status flag - nlat , & ! number of longitudes of data - nlon ! number of latitudes of data + status ! status flag character(len=*), parameter :: subname = '(ocn_data_ispol_init)' diff --git a/cicecore/cicedynB/general/ice_forcing_bgc.F90 b/cicecore/cicedynB/general/ice_forcing_bgc.F90 index e2245b578..d202e0b76 100644 --- a/cicecore/cicedynB/general/ice_forcing_bgc.F90 +++ b/cicecore/cicedynB/general/ice_forcing_bgc.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_forcing.F90 973 2015-04-15 21:07:21Z akt $ !======================================================================= ! ! Reads and interpolates forcing data for biogeochemistry @@ -12,11 +11,11 @@ module ice_forcing_bgc use ice_blocks, only: nx_block, ny_block use ice_domain_size, only: max_blocks use ice_communicate, only: my_task, master_task - use ice_calendar, only: dt, istep, sec, mday, month, daymo + use ice_calendar, only: dt, istep, sec, mday, month use ice_fileunits, only: nu_diag use ice_arrays_column, only: restore_bgc, & bgc_data_dir, sil_data_type, nit_data_type, fe_data_type - use ice_constants, only: c0, p01, p1 + use ice_constants, only: c0, p1 use ice_constants, only: field_loc_center, field_type_scalar use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted @@ -84,7 +83,7 @@ subroutine get_forcing_bgc read_data_nc_point, c1intp, c2intp integer (kind=int_kind) :: & - i, j, k,iblk, & ! horizontal indices + i, j, iblk, & ! horizontal indices ixm,ixp, ixx, & ! record numbers for neighboring months maxrec , & ! maximum record number recslot , & ! spline slot for current record @@ -92,7 +91,6 @@ subroutine get_forcing_bgc recnum , & ! record number dataloc , & ! = 1 for data located in middle of time interval ! = 2 for date located at end of time interval - sec_day , & ! fix time to noon ks ! bgc tracer index (bio_index_o) character (char_len_long) :: & @@ -410,8 +408,8 @@ end subroutine get_forcing_bgc subroutine get_atm_bgc - use ice_blocks, only: nx_block, ny_block, block, get_block - use ice_domain, only: nblocks, distrb_info, blocks_ice + use ice_blocks, only: block, get_block + use ice_domain, only: nblocks, blocks_ice use ice_domain_size, only: n_zaero use ice_flux_bgc, only: flux_bio_atm, faero_atm @@ -600,7 +598,6 @@ end subroutine faero_data subroutine fzaero_data - use ice_domain_size, only: n_zaero use ice_blocks, only: nx_block, ny_block use ice_flux_bgc, only: faero_atm use ice_forcing, only: interp_coeff_monthly, read_clim_data_nc, interpolate_data @@ -708,8 +705,7 @@ subroutine init_bgc_data (fed1,fep1) ! local parameters integer (kind=int_kind) :: & - fid , & ! file id for netCDF file - nbits + fid ! file id for netCDF file logical (kind=log_kind) :: diag @@ -719,8 +715,6 @@ subroutine init_bgc_data (fed1,fep1) character(len=*), parameter :: subname = '(init_bgc_data)' - nbits = 64 ! double precision data - !------------------------------------------------------------------- ! Annual average data from Tagliabue, 2012 (top 50 m average ! poisson grid filled on gx1v6 @@ -777,7 +771,7 @@ end subroutine init_bgc_data subroutine faero_optics use ice_broadcast, only: broadcast_array - use ice_read_write, only: ice_open_nc, ice_read_nc, ice_close_nc + use ice_read_write, only: ice_open_nc, ice_close_nc use ice_communicate, only: my_task, master_task use ice_arrays_column, only: & kaer_tab, & ! aerosol mass extinction cross section (m2/kg) @@ -799,16 +793,13 @@ subroutine faero_optics status , & ! status output from netcdf routines n, k ! index - integer (kind=int_kind), dimension(4):: & - start, count - real (kind=dbl_kind) :: & amin, amax, asum ! min, max values and sum of input array integer (kind=int_kind) :: & fid ! file id for netCDF file - logical (kind=log_kind) :: diag, modal_aero + logical (kind=log_kind) :: modal_aero character (char_len_long) :: & optics_file, & ! netcdf filename @@ -891,7 +882,6 @@ subroutine faero_optics #ifdef ncdf if (modal_aero) then - diag = .true. ! write diagnostic information optics_file = & '/usr/projects/climate/njeffery/DATA/CAM/snicar/snicar_optics_5bnd_mam_c140303.nc' diff --git a/cicecore/cicedynB/general/ice_init.F90 b/cicecore/cicedynB/general/ice_init.F90 index 47c7076e3..330419198 100644 --- a/cicecore/cicedynB/general/ice_init.F90 +++ b/cicecore/cicedynB/general/ice_init.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_init.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! parameter and variable initializations @@ -57,7 +56,7 @@ subroutine input_data use ice_diagnostics, only: diag_file, print_global, print_points, latpnt, lonpnt use ice_domain_size, only: max_nstrm, nilyr, nslyr, max_ntrcr, ncat, n_aero use ice_calendar, only: year_init, istep0, histfreq, histfreq_n, & - dumpfreq, dumpfreq_n, diagfreq, nstreams, & + dumpfreq, dumpfreq_n, diagfreq, & npt, dt, ndtd, days_per_year, use_leap_years, & write_ic, dump_last use ice_arrays_column, only: oceanmixed_ice @@ -92,7 +91,6 @@ subroutine input_data n ! loop index character (len=6) :: chartmp - character (len=32) :: str logical :: exists @@ -1222,7 +1220,7 @@ subroutine init_state use ice_domain, only: nblocks, blocks_ice use ice_domain_size, only: ncat, nilyr, nslyr, max_ntrcr, n_aero use ice_flux, only: sst, Tf, Tair, salinz, Tmltz - use ice_grid, only: tmask, ULON, ULAT, TLON, TLAT + use ice_grid, only: tmask, ULON, TLAT use ice_state, only: trcr_depend, aicen, trcrn, vicen, vsnon, & aice0, aice, vice, vsno, trcr, aice_init, bound_state, & n_trcr_strata, nt_strata, trcr_base @@ -1343,6 +1341,8 @@ subroutine init_state enddo endif + trcr_base = c0 + do it = 1, ntrcr ! mask for base quantity on which tracers are carried if (trcr_depend(it) == 0) then ! area @@ -1405,8 +1405,8 @@ subroutine init_state ilo, ihi, jlo, jhi, & iglob, jglob, & ice_ic, tmask(:,:, iblk), & - ULON (:,:, iblk), ULAT (:,:, iblk), & - TLON (:,:, iblk), TLAT (:,:, iblk), & + ULON (:,:, iblk), & + TLAT (:,:, iblk), & Tair (:,:, iblk), sst (:,:, iblk), & Tf (:,:, iblk), & salinz(:,:,:, iblk), Tmltz(:,:,:, iblk), & @@ -1482,8 +1482,8 @@ subroutine set_state_var (nx_block, ny_block, & ilo, ihi, jlo, jhi, & iglob, jglob, & ice_ic, tmask, & - ULON, ULAT, & - TLON, TLAT, & + ULON, & + TLAT, & Tair, sst, & Tf, & salinz, Tmltz, & @@ -1512,8 +1512,6 @@ subroutine set_state_var (nx_block, ny_block, & real (kind=dbl_kind), dimension (nx_block,ny_block), & intent(in) :: & ULON , & ! longitude of velocity pts (radians) - ULAT , & ! latitude of velocity pts (radians) - TLON , & ! longitude of temperature pts (radians) TLAT ! latitude of temperature pts (radians) real (kind=dbl_kind), dimension (nx_block,ny_block), intent(in) :: & diff --git a/cicecore/cicedynB/general/ice_state.F90 b/cicecore/cicedynB/general/ice_state.F90 index b8529785c..27211f49e 100644 --- a/cicecore/cicedynB/general/ice_state.F90 +++ b/cicecore/cicedynB/general/ice_state.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_state.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! ! Primary state variables in various configurations @@ -37,11 +36,8 @@ module ice_state use ice_kinds_mod - use ice_domain_size, only: max_blocks, ncat, max_ntrcr, n_aero + use ice_domain_size, only: max_blocks, ncat, max_ntrcr use ice_blocks, only: nx_block, ny_block - use ice_fileunits, only: nu_diag - use ice_exit, only: abort_ice - use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted implicit none private diff --git a/cicecore/cicedynB/general/ice_step_mod.F90 b/cicecore/cicedynB/general/ice_step_mod.F90 index 45d9fe3e3..083cbd5eb 100644 --- a/cicecore/cicedynB/general/ice_step_mod.F90 +++ b/cicecore/cicedynB/general/ice_step_mod.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_step_mod.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! ! Contains CICE component driver routines common to all drivers. @@ -49,22 +48,19 @@ module ice_step_mod ! ! authors: Elizabeth Hunke, LANL - subroutine prep_radiation (dt, iblk) + subroutine prep_radiation (iblk) use ice_blocks, only: block, get_block use ice_domain, only: blocks_ice use ice_domain_size, only: ncat, nilyr, nslyr use ice_flux, only: scale_factor, swvdr, swvdf, swidr, swidf, & - alvdr_ai, alvdf_ai, alidr_ai, alidf_ai, fswfac, & + alvdr_ai, alvdf_ai, alidr_ai, alidf_ai, & alvdr_init, alvdf_init, alidr_init, alidf_init use ice_arrays_column, only: fswsfcn, fswintn, fswthrun, & fswpenln, Sswabsn, Iswabsn use ice_state, only: aice, aicen use ice_timers, only: ice_timer_start, ice_timer_stop, timer_sw - real (kind=dbl_kind), intent(in) :: & - dt ! time step - integer (kind=int_kind), intent(in) :: & iblk ! block index @@ -74,8 +70,6 @@ subroutine prep_radiation (dt, iblk) ilo,ihi,jlo,jhi, & ! beginning and end of physical domain i, j ! horizontal indices - real (kind=dbl_kind) :: netsw - type (block) :: & this_block ! block information for current block @@ -83,6 +77,11 @@ subroutine prep_radiation (dt, iblk) call ice_timer_start(timer_sw) ! shortwave +! alvdr_init(:,:,:) = c0 +! alvdf_init(:,:,:) = c0 +! alidr_init(:,:,:) = c0 +! alidf_init(:,:,:) = c0 + this_block = get_block(blocks_ice(iblk),iblk) ilo = this_block%ilo ihi = this_block%ihi @@ -138,9 +137,7 @@ subroutine step_therm1 (dt, iblk) hfreebd, hdraft, hridge, distrdg, hkeel, dkeel, lfloe, dfloe, & fswsfcn, fswintn, fswthrun, Sswabsn, Iswabsn use ice_blocks, only: block, get_block, nx_block, ny_block - use ice_calendar, only: yday, istep1 - use ice_communicate, only: my_task - use ice_diagnostics, only: diagnostic_abort + use ice_calendar, only: yday use ice_domain, only: blocks_ice use ice_domain_size, only: ncat, nilyr, nslyr, n_aero use ice_flux, only: frzmlt, sst, Tf, strocnxT, strocnyT, rside, fbot, & @@ -149,10 +146,10 @@ subroutine step_therm1 (dt, iblk) flw, fsnow, fpond, sss, mlt_onset, frz_onset, & frain, Tair, strairxT, strairyT, fsurf, fcondtop, fsens, & flat, fswabs, flwout, evap, Tref, Qref, Uref, fresh, fsalt, fhocn, & - fswthru, meltt, melts, meltb, meltl, congel, snoice, & + fswthru, meltt, melts, meltb, congel, snoice, & flatn_f, fsensn_f, fsurfn_f, fcondtopn_f use ice_flux_bgc, only: dsnown, faero_atm, faero_ocn - use ice_grid, only: lmask_n, lmask_s + use ice_grid, only: lmask_n, lmask_s, tmask use ice_state, only: aice, aicen, aice_init, aicen_init, vicen_init, & vice, vicen, vsno, vsnon, trcrn, uvel, vvel, vsnon_init @@ -279,6 +276,7 @@ subroutine step_therm1 (dt, iblk) enddo endif ! tr_aero + if (tmask(i,j,iblk)) & call icepack_step_therm1(dt, ncat, nilyr, nslyr, n_aero, & aicen_init (i,j,:,iblk), & vicen_init (i,j,:,iblk), vsnon_init (i,j,:,iblk), & @@ -385,9 +383,7 @@ subroutine step_therm2 (dt, iblk) use ice_arrays_column, only: hin_max, fzsal, ocean_bio, & first_ice, bgrid, cgrid, igrid use ice_blocks, only: block, get_block - use ice_calendar, only: istep1, yday - use ice_communicate, only: my_task - use ice_diagnostics, only: diagnostic_abort + use ice_calendar, only: yday use ice_domain, only: blocks_ice use ice_domain_size, only: ncat, nilyr, nslyr, n_aero, nblyr, nltrcr use ice_flux, only: fresh, frain, fpond, frzmlt, frazil, frz_onset, & @@ -534,7 +530,7 @@ subroutine update_state (dt, daidt, dvidt, dagedt, offset) ! Aggregate the updated state variables (includes ghost cells). !----------------------------------------------------------------- - if (tmask(i,j,iblk)) & +! if (tmask(i,j,iblk)) & call icepack_aggregate (ncat, aicen(i,j,:,iblk), & trcrn(i,j,1:ntrcr,:,iblk), & vicen(i,j,:,iblk), vsnon(i,j, :,iblk), & @@ -629,10 +625,8 @@ end subroutine step_dyn_horiz subroutine step_dyn_ridge (dt, ndtd, iblk) use ice_arrays_column, only: hin_max, fzsal, first_ice - use ice_blocks, only: block, get_block, nx_block, ny_block - use ice_calendar, only: istep1 - use ice_diagnostics, only: diagnostic_abort - use ice_domain, only: blocks_ice, nblocks + use ice_blocks, only: block, get_block + use ice_domain, only: blocks_ice use ice_domain_size, only: ncat, nilyr, nslyr, n_aero, nblyr use ice_flux, only: & rdg_conv, rdg_shear, dardg1dt, dardg2dt, & @@ -642,7 +636,7 @@ subroutine step_dyn_ridge (dt, ndtd, iblk) use ice_flux_bgc, only: flux_bio, faero_ocn use ice_grid, only: tmask use ice_state, only: trcrn, vsnon, aicen, vicen, & - aice, trcr, vice, vsno, aice0, trcr_depend, n_trcr_strata, & + aice, aice0, trcr_depend, n_trcr_strata, & trcr_base, nt_strata use ice_timers, only: ice_timer_start, ice_timer_stop, timer_column, & timer_ridge @@ -930,6 +924,8 @@ subroutine ocean_mixed_layer (dt, iblk) use ice_arrays_column, only: Cdn_atm, Cdn_atm_ratio use ice_blocks, only: nx_block, ny_block + use ice_blocks, only: block, get_block + use ice_domain, only: blocks_ice use ice_flux, only: sst, Tf, Qa, uatm, vatm, wind, potT, rhoa, zlvl, & frzmlt, fhocn, fswthru, flw, flwout_ocn, fsens_ocn, flat_ocn, evap_ocn, & alvdr_ocn, alidr_ocn, alvdf_ocn, alidf_ocn, swidf, swvdf, swidr, swvdr, & @@ -945,15 +941,13 @@ subroutine ocean_mixed_layer (dt, iblk) ! local variables - real (kind=dbl_kind) :: & - albocn,& ! - TsfK , & ! surface temperature (K) - swabs ! surface absorbed shortwave heat flux (W/m^2) + real (kind=dbl_kind) :: albocn real (kind=dbl_kind), parameter :: & frzmlt_max = c1000 ! max magnitude of frzmlt (W/m^2) integer (kind=int_kind) :: & + ilo,ihi,jlo,jhi, & ! beginning and end of physical domain i, j , & ! horizontal indices ij ! combined ij index @@ -969,6 +963,9 @@ subroutine ocean_mixed_layer (dt, iblk) integer (kind=int_kind), dimension(nx_block*ny_block) :: & indxi, indxj ! compressed indices for ocean cells + type (block) :: & + this_block ! block information for current block + character(len=*), parameter :: subname = '(ocn_mixed_layer)' !----------------------------------------------------------------- @@ -986,8 +983,18 @@ subroutine ocean_mixed_layer (dt, iblk) icells = 0 indxi(:) = 0 indxj(:) = 0 + +! this_block = get_block(blocks_ice(iblk),iblk) +! ilo = this_block%ilo +! ihi = this_block%ihi +! jlo = this_block%jlo +! jhi = this_block%jhi + +! do j = jlo, jhi +! do i = ilo, ihi do j = 1, ny_block do i = 1, nx_block + if (tmask(i,j,iblk)) then icells = icells + 1 indxi(icells) = i @@ -1083,7 +1090,7 @@ end subroutine ocean_mixed_layer subroutine biogeochemistry (dt, iblk) use ice_arrays_column, only: upNO, upNH, iDi, iki, zfswin, & - trcrn_sw, zsal_tot, darcy_V, grow_net, & + zsal_tot, darcy_V, grow_net, & PP_net, hbri,dhbr_bot, dhbr_top, Zoo,& fbio_snoice, fbio_atmice, ocean_bio, & first_ice, fswpenln, bphi, bTiz, ice_bio_net, & @@ -1091,8 +1098,6 @@ subroutine biogeochemistry (dt, iblk) ocean_bio_all, sice_rho, fzsal, fzsal_g, & bgrid, igrid, icgrid, cgrid use ice_blocks, only: block, get_block - use ice_calendar, only: istep1 - use ice_diagnostics, only: diagnostic_abort use ice_domain, only: blocks_ice use ice_domain_size, only: nblyr, nilyr, nslyr, n_algae, n_zaero, ncat, & n_doc, n_dic, n_don, n_fed, n_fep @@ -1114,9 +1119,8 @@ subroutine biogeochemistry (dt, iblk) integer (kind=int_kind) :: & i, j , & ! horizontal indices - k , & ! vertical index ilo,ihi,jlo,jhi, & ! beginning and end of physical domain - n, mm ! tracer index + mm ! tracer index type (block) :: & this_block ! block information for current block diff --git a/cicecore/cicedynB/infrastructure/comm/mpi/ice_boundary.F90 b/cicecore/cicedynB/infrastructure/comm/mpi/ice_boundary.F90 index f34487900..24222e3f0 100644 --- a/cicecore/cicedynB/infrastructure/comm/mpi/ice_boundary.F90 +++ b/cicecore/cicedynB/infrastructure/comm/mpi/ice_boundary.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_boundary.F90 1228 2017-05-23 21:33:34Z tcraig $ !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| module ice_boundary @@ -21,7 +20,6 @@ module ice_boundary field_loc_center, field_loc_NEcorner, & field_loc_Nface, field_loc_Eface use ice_global_reductions, only: global_maxval - use ice_fileunits, only: nu_diag use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted @@ -194,7 +192,6 @@ function ice_HaloCreate(dist, nsBoundaryType, ewBoundaryType, & logical (log_kind) :: & resize, &! flag for resizing buffers - tripoleFlag, &! flag for allocating tripole buffers tripoleBlock, &! flag for identifying north tripole blocks tripoleTFlag ! flag for processing tripole buffer as T-fold @@ -225,7 +222,6 @@ function ice_HaloCreate(dist, nsBoundaryType, ewBoundaryType, & tripoleRows = nghost+1 if (nsBoundaryType == 'tripole' .or. nsBoundaryType == 'tripoleT') then - tripoleFlag = .true. tripoleTFlag = (nsBoundaryType == 'tripoleT') if (tripoleTflag) tripoleRows = tripoleRows+1 @@ -244,7 +240,6 @@ function ice_HaloCreate(dist, nsBoundaryType, ewBoundaryType, & endif else - tripoleFlag = .false. tripoleTFlag = .false. endif halo%tripoleTFlag = tripoleTFlag @@ -5131,7 +5126,7 @@ subroutine ice_HaloUpdate_stress(array1, array2, halo, & ! local variables integer (int_kind) :: & - i,j,n,nmsg, &! dummy loop indices + n,nmsg, &! dummy loop indices ierr, &! error or status flag for MPI,alloc nxGlobal, &! global domain size in x (tripole) iSrc,jSrc, &! source addresses for message @@ -5150,8 +5145,7 @@ subroutine ice_HaloUpdate_stress(array1, array2, halo, & rcvStatus ! MPI status flags real (dbl_kind) :: & - fill, &! value to use for unknown points - x1,x2,xavg ! scalars for enforcing symmetry at U pts + fill ! value to use for unknown points integer (int_kind) :: len ! length of messages @@ -5508,7 +5502,6 @@ subroutine ice_HaloMsgCreate(halo, srcBlock, srcProc, srcLocalID, & integer (int_kind) :: & msgIndx, &! message counter and index into msg array - blockIndx, &! block counter and index into msg array bufSize, &! size of message buffer ibSrc, ieSrc, jbSrc, jeSrc, &! phys domain info for source block ibDst, ieDst, jbDst, jeDst, &! phys domain info for dest block @@ -6734,6 +6727,11 @@ subroutine ice_HaloDestroy(halo) deallocate(halo%sendAddr, stat=istat) deallocate(halo%recvAddr, stat=istat) + if (istat > 0) then + call abort_ice( & + 'ice_HaloDestroy: error deallocating') + return + endif end subroutine ice_HaloDestroy !*********************************************************************** diff --git a/cicecore/cicedynB/infrastructure/comm/mpi/ice_broadcast.F90 b/cicecore/cicedynB/infrastructure/comm/mpi/ice_broadcast.F90 index e1461b5d7..9ae56f60c 100644 --- a/cicecore/cicedynB/infrastructure/comm/mpi/ice_broadcast.F90 +++ b/cicecore/cicedynB/infrastructure/comm/mpi/ice_broadcast.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_broadcast.F90 1228 2017-05-23 21:33:34Z tcraig $ !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| module ice_broadcast @@ -11,7 +10,6 @@ module ice_broadcast use ice_kinds_mod use ice_communicate, only: mpiR8, mpir4, MPI_COMM_ICE - use ice_fileunits, only: nu_diag use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted diff --git a/cicecore/cicedynB/infrastructure/comm/mpi/ice_communicate.F90 b/cicecore/cicedynB/infrastructure/comm/mpi/ice_communicate.F90 index bf522dce7..6483f2a99 100644 --- a/cicecore/cicedynB/infrastructure/comm/mpi/ice_communicate.F90 +++ b/cicecore/cicedynB/infrastructure/comm/mpi/ice_communicate.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_communicate.F90 1228 2017-05-23 21:33:34Z tcraig $ !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| module ice_communicate @@ -10,7 +9,6 @@ module ice_communicate ! Oct. 2004: Adapted from POP version by William H. Lipscomb, LANL use ice_kinds_mod - use ice_fileunits, only: nu_diag use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted diff --git a/cicecore/cicedynB/infrastructure/comm/mpi/ice_exit.F90 b/cicecore/cicedynB/infrastructure/comm/mpi/ice_exit.F90 index 15ca05fd0..92bb1c0e7 100644 --- a/cicecore/cicedynB/infrastructure/comm/mpi/ice_exit.F90 +++ b/cicecore/cicedynB/infrastructure/comm/mpi/ice_exit.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_exit.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! ! Exit the model. diff --git a/cicecore/cicedynB/infrastructure/comm/mpi/ice_gather_scatter.F90 b/cicecore/cicedynB/infrastructure/comm/mpi/ice_gather_scatter.F90 index 963e47034..af520d999 100644 --- a/cicecore/cicedynB/infrastructure/comm/mpi/ice_gather_scatter.F90 +++ b/cicecore/cicedynB/infrastructure/comm/mpi/ice_gather_scatter.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_gather_scatter.F90 1228 2017-05-23 21:33:34Z tcraig $ !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| module ice_gather_scatter @@ -26,7 +25,6 @@ module ice_gather_scatter nblocks_x, nblocks_y, nghost use ice_distribution, only: distrb use ice_domain_size, only: nx_global, ny_global - use ice_fileunits, only: nu_diag use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted diff --git a/cicecore/cicedynB/infrastructure/comm/mpi/ice_global_reductions.F90 b/cicecore/cicedynB/infrastructure/comm/mpi/ice_global_reductions.F90 index c27ec2f19..c315d99b9 100644 --- a/cicecore/cicedynB/infrastructure/comm/mpi/ice_global_reductions.F90 +++ b/cicecore/cicedynB/infrastructure/comm/mpi/ice_global_reductions.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_global_reductions.F90 1228 2017-05-23 21:33:34Z tcraig $ !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| module ice_global_reductions @@ -13,10 +12,13 @@ module ice_global_reductions ! and global_sum_prod_dbl by T Craig NCAR use ice_kinds_mod - use ice_blocks, only: block, get_block, nblocks_tot, nx_block, ny_block + use ice_blocks, only: block, get_block, nx_block, ny_block +#ifdef REPRODUCIBLE + use ice_blocks, only: nblocks_tot +#endif use ice_communicate, only: my_task, mpiR8, mpiR4, master_task use ice_constants, only: field_loc_Nface, field_loc_NEcorner - use ice_fileunits, only: bfbflag, nu_diag + use ice_fileunits, only: bfbflag use ice_exit, only: abort_ice use ice_distribution, only: distrb, ice_distributionGet, & ice_distributionGetBlockID diff --git a/cicecore/cicedynB/infrastructure/comm/mpi/ice_timers.F90 b/cicecore/cicedynB/infrastructure/comm/mpi/ice_timers.F90 index 387935bcf..8edd0e281 100644 --- a/cicecore/cicedynB/infrastructure/comm/mpi/ice_timers.F90 +++ b/cicecore/cicedynB/infrastructure/comm/mpi/ice_timers.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_timers.F90 1228 2017-05-23 21:33:34Z tcraig $ !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| module ice_timers diff --git a/cicecore/cicedynB/infrastructure/comm/serial/ice_boundary.F90 b/cicecore/cicedynB/infrastructure/comm/serial/ice_boundary.F90 index 9ab0c7513..9775a9dad 100644 --- a/cicecore/cicedynB/infrastructure/comm/serial/ice_boundary.F90 +++ b/cicecore/cicedynB/infrastructure/comm/serial/ice_boundary.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_boundary.F90 1228 2017-05-23 21:33:34Z tcraig $ !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| module ice_boundary @@ -21,7 +20,6 @@ module ice_boundary field_loc_center, field_loc_NEcorner, & field_loc_Nface, field_loc_Eface use ice_global_reductions, only: global_maxval - use ice_fileunits, only: nu_diag use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted @@ -148,7 +146,6 @@ function ice_HaloCreate(dist, nsBoundaryType, ewBoundaryType, & sendCount, recvCount ! count number of words to each proc logical (log_kind) :: & - tripoleFlag, &! flag for allocating tripole buffers tripoleBlock, &! flag for identifying north tripole blocks tripoleTFlag ! flag for processing tripole buffer as T-fold @@ -178,7 +175,6 @@ function ice_HaloCreate(dist, nsBoundaryType, ewBoundaryType, & tripoleRows = nghost+1 if (nsBoundaryType == 'tripole' .or. nsBoundaryType == 'tripoleT') then - tripoleFlag = .true. tripoleTFlag = (nsBoundaryType == 'tripoleT') if (tripoleTflag) tripoleRows = tripoleRows+1 northMsgSize = tripoleRows*blockSizeX @@ -198,7 +194,6 @@ function ice_HaloCreate(dist, nsBoundaryType, ewBoundaryType, & endif else - tripoleFlag = .false. tripoleTFlag = .false. northMsgSize = nghost*blockSizeX endif diff --git a/cicecore/cicedynB/infrastructure/comm/serial/ice_broadcast.F90 b/cicecore/cicedynB/infrastructure/comm/serial/ice_broadcast.F90 index 0c778a300..8532f23b7 100644 --- a/cicecore/cicedynB/infrastructure/comm/serial/ice_broadcast.F90 +++ b/cicecore/cicedynB/infrastructure/comm/serial/ice_broadcast.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_broadcast.F90 1228 2017-05-23 21:33:34Z tcraig $ !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| module ice_broadcast @@ -12,7 +11,6 @@ module ice_broadcast ! Oct. 2004: Adapted from POP version by William H. Lipscomb, LANL use ice_kinds_mod - use ice_fileunits, only: nu_diag use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted diff --git a/cicecore/cicedynB/infrastructure/comm/serial/ice_communicate.F90 b/cicecore/cicedynB/infrastructure/comm/serial/ice_communicate.F90 index 31e221460..76c84395e 100644 --- a/cicecore/cicedynB/infrastructure/comm/serial/ice_communicate.F90 +++ b/cicecore/cicedynB/infrastructure/comm/serial/ice_communicate.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_communicate.F90 1228 2017-05-23 21:33:34Z tcraig $ !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| module ice_communicate @@ -11,7 +10,6 @@ module ice_communicate ! Oct. 2004: Adapted from POP version by William H. Lipscomb, LANL use ice_kinds_mod - use ice_fileunits, only: nu_diag use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted diff --git a/cicecore/cicedynB/infrastructure/comm/serial/ice_exit.F90 b/cicecore/cicedynB/infrastructure/comm/serial/ice_exit.F90 index 0f7c7bf31..eb1b331af 100644 --- a/cicecore/cicedynB/infrastructure/comm/serial/ice_exit.F90 +++ b/cicecore/cicedynB/infrastructure/comm/serial/ice_exit.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_exit.F90 700 2013-08-15 19:17:39Z eclare $ !======================================================================= ! ! Exit the model. diff --git a/cicecore/cicedynB/infrastructure/comm/serial/ice_gather_scatter.F90 b/cicecore/cicedynB/infrastructure/comm/serial/ice_gather_scatter.F90 index b8a9c6c35..e08496a17 100644 --- a/cicecore/cicedynB/infrastructure/comm/serial/ice_gather_scatter.F90 +++ b/cicecore/cicedynB/infrastructure/comm/serial/ice_gather_scatter.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_gather_scatter.F90 1228 2017-05-23 21:33:34Z tcraig $ !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| module ice_gather_scatter @@ -19,7 +18,6 @@ module ice_gather_scatter nblocks_x, nblocks_y, nblocks_tot use ice_distribution, only: distrb use ice_domain_size, only: nx_global, ny_global - use ice_fileunits, only: nu_diag use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted diff --git a/cicecore/cicedynB/infrastructure/comm/serial/ice_global_reductions.F90 b/cicecore/cicedynB/infrastructure/comm/serial/ice_global_reductions.F90 index 65201d603..6768d67bf 100644 --- a/cicecore/cicedynB/infrastructure/comm/serial/ice_global_reductions.F90 +++ b/cicecore/cicedynB/infrastructure/comm/serial/ice_global_reductions.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_global_reductions.F90 1228 2017-05-23 21:33:34Z tcraig $ !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| module ice_global_reductions @@ -16,7 +15,6 @@ module ice_global_reductions use ice_distribution, only: distrb, ice_distributionGet, & ice_distributionGetBlockID use ice_domain_size, only: nx_global - use ice_fileunits, only: nu_diag use ice_exit, only: abort_ice use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted diff --git a/cicecore/cicedynB/infrastructure/comm/serial/ice_timers.F90 b/cicecore/cicedynB/infrastructure/comm/serial/ice_timers.F90 index e1f414146..9a8e20a83 100644 --- a/cicecore/cicedynB/infrastructure/comm/serial/ice_timers.F90 +++ b/cicecore/cicedynB/infrastructure/comm/serial/ice_timers.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_timers.F90 1228 2017-05-23 21:33:34Z tcraig $ !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| module ice_timers diff --git a/cicecore/cicedynB/infrastructure/ice_blocks.F90 b/cicecore/cicedynB/infrastructure/ice_blocks.F90 index 431741e2b..b95ad6acb 100644 --- a/cicecore/cicedynB/infrastructure/ice_blocks.F90 +++ b/cicecore/cicedynB/infrastructure/ice_blocks.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_blocks.F90 1228 2017-05-23 21:33:34Z tcraig $ !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| module ice_blocks diff --git a/cicecore/cicedynB/infrastructure/ice_domain.F90 b/cicecore/cicedynB/infrastructure/ice_domain.F90 index 030bc63c5..58acd9735 100644 --- a/cicecore/cicedynB/infrastructure/ice_domain.F90 +++ b/cicecore/cicedynB/infrastructure/ice_domain.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_domain.F90 1228 2017-05-23 21:33:34Z tcraig $ !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| module ice_domain @@ -14,7 +13,7 @@ module ice_domain ! and not used anyhow). use ice_kinds_mod - use ice_constants, only: shlat, nhlat, c180 + use ice_constants, only: shlat, nhlat use ice_communicate, only: my_task, master_task, get_num_procs use ice_broadcast, only: broadcast_scalar, broadcast_array use ice_blocks, only: block, get_block, create_blocks, nghost, & @@ -41,7 +40,7 @@ module ice_domain nblocks ! actual number of blocks on this processor integer (int_kind), dimension(:), pointer, public :: & - blocks_ice ! block ids for local blocks + blocks_ice => null() ! block ids for local blocks type (distrb), public :: & distrb_info ! block distribution info diff --git a/cicecore/cicedynB/infrastructure/ice_grid.F90 b/cicecore/cicedynB/infrastructure/ice_grid.F90 index 671d7adea..02447bf71 100644 --- a/cicecore/cicedynB/infrastructure/ice_grid.F90 +++ b/cicecore/cicedynB/infrastructure/ice_grid.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_grid.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! Spatial grids, masks, and boundary conditions @@ -204,7 +203,6 @@ subroutine init_grid1 use ice_blocks, only: nx_block, ny_block use ice_broadcast, only: broadcast_array use ice_constants, only: c1 - use ice_domain_size, only: max_blocks integer (kind=int_kind) :: & fid_grid, & ! file id for netCDF grid file @@ -355,9 +353,11 @@ subroutine init_grid2 else call popgrid ! read POP grid lengths directly endif +#ifdef CESMCOUPLED elseif (trim(grid_type) == 'latlon') then call latlongrid ! lat lon grid for sequential CESM (CAM mode) return +#endif elseif (trim(grid_type) == 'cpom_grid') then call cpomgrid ! cpom model orca1 type grid else @@ -368,6 +368,8 @@ subroutine init_grid2 ! T-grid cell and U-grid cell quantities !----------------------------------------------------------------- +! tarea(:,:,:) = c0 + !$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block) do iblk = 1, nblocks this_block = get_block(blocks_ice(iblk),iblk) @@ -703,7 +705,7 @@ subroutine popgrid_nc #ifdef ncdf use ice_blocks, only: nx_block, ny_block - use ice_constants, only: c0, c1, p5, p25, & + use ice_constants, only: c0, c1, & field_loc_center, field_loc_NEcorner, & field_type_scalar, field_type_angle use ice_domain_size, only: max_blocks @@ -826,6 +828,7 @@ subroutine popgrid_nc #endif end subroutine popgrid_nc +#ifdef CESMCOUPLED !======================================================================= ! Read in kmt file that matches CAM lat-lon grid and has single column @@ -838,9 +841,7 @@ subroutine latlongrid #ifdef ncdf ! use ice_boundary use ice_domain_size -#ifdef CESMCOUPLED use ice_scam, only : scmlat, scmlon, single_column -#endif use ice_constants, only: c0, c1, p5, p25, & field_loc_center, field_type_scalar, radius use netcdf @@ -891,7 +892,6 @@ subroutine latlongrid ! - Read in lon/lat centers in degrees from kmt file ! - Read in ocean from "kmt" file (1 for ocean, 0 for land) !----------------------------------------------------------------- -#ifdef CESMCOUPLED call icepack_query_parameters(pi_out=pi, puny_out=puny) call icepack_warnings_flush(nu_diag) @@ -1098,10 +1098,10 @@ subroutine latlongrid !$OMP END PARALLEL DO call makemask -#endif #endif end subroutine latlongrid +#endif !======================================================================= @@ -1114,7 +1114,6 @@ subroutine rectgrid use ice_blocks, only: nx_block, ny_block use ice_constants, only: c0, c1, c2, radius, cm_to_m, & field_loc_center, field_loc_NEcorner, field_type_scalar - use ice_domain_size, only: max_blocks integer (kind=int_kind) :: & i, j, iblk, & @@ -1393,11 +1392,9 @@ end subroutine cpomgrid subroutine primary_grid_lengths_HTN(work_g) - use ice_blocks, only: nx_block, ny_block use ice_constants, only: p5, c2, cm_to_m, & field_loc_center, field_loc_NEcorner, & field_loc_Nface, field_type_scalar - use ice_domain_size, only: max_blocks real (kind=dbl_kind), dimension(:,:) :: work_g ! global array holding HTN @@ -1465,11 +1462,9 @@ end subroutine primary_grid_lengths_HTN subroutine primary_grid_lengths_HTE(work_g) - use ice_blocks, only: nx_block, ny_block use ice_constants, only: p5, c2, cm_to_m, & field_loc_center, field_loc_NEcorner, & field_loc_Eface, field_type_scalar - use ice_domain_size, only: max_blocks real (kind=dbl_kind), dimension(:,:) :: work_g ! global array holding HTE @@ -1573,6 +1568,8 @@ subroutine makemask !----------------------------------------------------------------- bm = c0 +! uvm = c0 + !$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block) do iblk = 1, nblocks this_block = get_block(blocks_ice(iblk),iblk) @@ -2007,6 +2004,9 @@ subroutine gridbox_corners ! (1) SW corner, (2) SE corner, (3) NE corner, (4) NW corner !------------------------------------------------------------- +! latu_bounds(:,:,:,:) = c0 +! lonu_bounds(:,:,:,:) = c0 + !$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block) do iblk = 1, nblocks this_block = get_block(blocks_ice(iblk),iblk) @@ -2044,6 +2044,8 @@ subroutine gridbox_corners endif work1(:,:,:) = latu_bounds(2,:,:,:) +! work_g2 = c0 + call gather_global(work_g2, work1, master_task, distrb_info) if (my_task == master_task) then do j = 1, ny_global @@ -2348,17 +2350,12 @@ end subroutine get_bathymetry subroutine read_basalstress_bathy ! use module - use ice_blocks, only: block, get_block, nx_block, ny_block - use ice_domain, only: nblocks, blocks_ice, halo_info, maskhalo_dyn - use ice_domain_size, only: max_blocks use ice_read_write use ice_communicate, only: my_task, master_task use ice_constants, only: field_loc_center, field_type_scalar ! local variables integer (kind=int_kind) :: & - i, j, & ! index inside block - iblk, & ! block index fid_init ! file id for netCDF init file character (char_len_long) :: & ! input data file names diff --git a/cicecore/cicedynB/infrastructure/ice_read_write.F90 b/cicecore/cicedynB/infrastructure/ice_read_write.F90 index 4ca2f6360..20eff9765 100644 --- a/cicecore/cicedynB/infrastructure/ice_read_write.F90 +++ b/cicecore/cicedynB/infrastructure/ice_read_write.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_read_write.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! Routines for opening, reading and writing external files @@ -560,7 +559,6 @@ end subroutine ice_read_global ! (subroutine ice_HaloUpdate need not be called). subroutine ice_read_ext(nu, nrec, work, atype, diag, & - field_loc, field_type, & ignore_eof, hit_eof) use ice_gather_scatter, only: scatter_global_ext @@ -580,10 +578,6 @@ subroutine ice_read_ext(nu, nrec, work, atype, diag, & logical (kind=log_kind), intent(in) :: & diag ! if true, write diagnostic output - integer (kind=int_kind), optional, intent(in) :: & - field_loc, & ! location of field on staggered grid - field_type ! type of field (scalar, vector, angle) - logical (kind=log_kind), optional, intent(in) :: ignore_eof logical (kind=log_kind), optional, intent(out) :: hit_eof @@ -1082,16 +1076,16 @@ subroutine ice_read_nc_xy(fid, nrec, varname, work, diag, & ! netCDF file diagnostics: integer (kind=int_kind) :: & varid , & ! variable id - status, & ! status output from netcdf routines - ndim, nvar, & ! sizes of netcdf file - id, & ! dimension index - dimlen ! size of dimension + status ! status output from netcdf routines +! ndim, nvar, & ! sizes of netcdf file +! id, & ! dimension index +! dimlen ! dimension size real (kind=dbl_kind) :: & amin, amax, asum ! min, max values and sum of input array - character (char_len) :: & - dimname ! dimension name +! character (char_len) :: & +! dimname ! dimension name real (kind=dbl_kind), dimension(:,:), allocatable :: & work_g1 @@ -1254,18 +1248,18 @@ subroutine ice_read_nc_xyz(fid, nrec, varname, work, diag, & #ifdef ncdf ! netCDF file diagnostics: integer (kind=int_kind) :: & - varid , & ! variable id - status, & ! status output from netcdf routines - ndim, nvar, & ! sizes of netcdf file - id, & ! dimension index n, & ! ncat index - dimlen ! size of dimension + varid , & ! variable id + status ! status output from netcdf routines +! ndim, nvar, & ! sizes of netcdf file +! id, & ! dimension index +! dimlen ! size of dimension real (kind=dbl_kind) :: & amin, amax, asum ! min, max values and sum of input array - character (char_len) :: & - dimname ! dimension name +! character (char_len) :: & +! dimname ! dimension name real (kind=dbl_kind), dimension(:,:,:), allocatable :: & work_g1 @@ -1399,8 +1393,8 @@ end subroutine ice_read_nc_xyz ! Read a netCDF file ! Adapted by Alison McLaren, Met Office from ice_read - subroutine ice_read_nc_point(fid, nrec, varname, work, diag, & - field_loc, field_type) + subroutine ice_read_nc_point(fid, nrec, varname, work, diag, & + field_loc, field_type) integer (kind=int_kind), intent(in) :: & fid , & ! file id @@ -1412,14 +1406,14 @@ subroutine ice_read_nc_point(fid, nrec, varname, work, diag, & character (char_len), intent(in) :: & varname ! field name in netcdf file - real (kind=dbl_kind), & - intent(out) :: & - work ! output variable (real, 8-byte) - integer (kind=int_kind), optional, intent(in) :: & field_loc, & ! location of field on staggered grid field_type ! type of field (scalar, vector, angle) + real (kind=dbl_kind), & + intent(out) :: & + work ! output variable (real, 8-byte) + ! local variables character(len=*), parameter :: subname = '(ice_read_nc_point)' @@ -1492,7 +1486,7 @@ end subroutine ice_read_nc_point ! Adapted by Nicole Jeffery, LANL subroutine ice_read_nc_z(fid, nrec, varname, work, diag, & - field_loc, field_type) + field_loc, field_type) use ice_domain_size, only: nilyr @@ -1506,14 +1500,14 @@ subroutine ice_read_nc_z(fid, nrec, varname, work, diag, & character (char_len), intent(in) :: & varname ! field name in netcdf file - real (kind=dbl_kind), dimension(nilyr), & - intent(out) :: & - work ! output array (real, 8-byte) - integer (kind=int_kind), optional, intent(in) :: & field_loc, & ! location of field on staggered grid field_type ! type of field (scalar, vector, angle) + real (kind=dbl_kind), dimension(nilyr), & + intent(out) :: & + work ! output array (real, 8-byte) + ! local variables real (kind=dbl_kind), dimension(:), allocatable :: & @@ -1617,10 +1611,10 @@ subroutine ice_write_nc_xy(fid, nrec, varid, work, diag, & #ifdef ncdf ! netCDF file diagnostics: integer (kind=int_kind) :: & - status, & ! status output from netcdf routines - ndim, nvar, & ! sizes of netcdf file - id, & ! dimension index - dimlen ! size of dimension + status ! status output from netcdf routines +! ndim, nvar, & ! sizes of netcdf file +! id, & ! dimension index +! dimlen ! size of dimension real (kind=dbl_kind) :: & amin, amax, asum ! min, max values and sum of input array @@ -1737,11 +1731,11 @@ subroutine ice_write_nc_xyz(fid, nrec, varid, work, diag, & #ifdef ncdf ! netCDF file diagnostics: integer (kind=int_kind) :: & - status, & ! status output from netcdf routines - ndim, nvar, & ! sizes of netcdf file - id, & ! dimension index n, & ! ncat index - dimlen ! size of dimension + status ! status output from netcdf routines +! ndim, nvar, & ! sizes of netcdf file +! id, & ! dimension index +! dimlen ! size of dimension real (kind=dbl_kind) :: & amin, amax, asum ! min, max values and sum of input array @@ -1865,16 +1859,16 @@ subroutine ice_read_global_nc (fid, nrec, varname, work_g, diag) ! netCDF file diagnostics: integer (kind=int_kind) :: & varid, & ! netcdf id for field - status, & ! status output from netcdf routines - ndim, nvar, & ! sizes of netcdf file - id, & ! dimension index - dimlen ! size of dimension + status ! status output from netcdf routines +! ndim, nvar, & ! sizes of netcdf file +! id, & ! dimension index +! dimlen ! size of dimension real (kind=dbl_kind) :: & amin, amax, asum ! min, max values and sum of input array - character (char_len) :: & - dimname ! dimension name +! character (char_len) :: & +! dimname ! dimension name ! #ifdef ORCA_GRID real (kind=dbl_kind), dimension(:,:), allocatable :: & @@ -2017,16 +2011,16 @@ subroutine ice_read_nc_uv(fid, nrec, nzlev, varname, work, diag, & ! netCDF file diagnostics: integer (kind=int_kind) :: & varid , & ! variable id - status, & ! status output from netcdf routines - ndim, nvar, & ! sizes of netcdf file - id, & ! dimension index - dimlen ! size of dimension + status ! status output from netcdf routines +! ndim, nvar, & ! sizes of netcdf file +! id, & ! dimension index +! dimlen ! size of dimension real (kind=dbl_kind) :: & amin, amax, asum ! min, max values and sum of input array - character (char_len) :: & - dimname ! dimension name +! character (char_len) :: & +! dimname ! dimension name real (kind=dbl_kind), dimension(:,:), allocatable :: & work_g1 diff --git a/cicecore/cicedynB/infrastructure/ice_restart_driver.F90 b/cicecore/cicedynB/infrastructure/ice_restart_driver.F90 index 6f36087dc..86bc598a0 100644 --- a/cicecore/cicedynB/infrastructure/ice_restart_driver.F90 +++ b/cicecore/cicedynB/infrastructure/ice_restart_driver.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_restart_driver.F90 607 2013-03-29 15:49:42Z eclare $ !======================================================================= ! Read and write ice model restart files @@ -23,9 +22,8 @@ module ice_restart_driver use ice_constants, only: c0, c1, p5, & field_loc_center, field_loc_NEcorner, & field_type_scalar, field_type_vector - use ice_restart_shared, only: & - restart, restart_ext, restart_dir, restart_file, pointer_file, & - runid, runtype, use_restart_time, restart_format, lcdf64, lenstr + use ice_restart_shared, only: restart_dir, pointer_file, & + runid, use_restart_time, lenstr use ice_restart use ice_exit, only: abort_ice use ice_fileunits, only: nu_diag, nu_rst_pointer, nu_restart, nu_dump @@ -53,17 +51,16 @@ module ice_restart_driver subroutine dumpfile(filename_spec) use ice_blocks, only: nx_block, ny_block - use ice_calendar, only: sec, month, mday, nyr, istep1, & - time, time_forc, year_init - use ice_communicate, only: my_task, master_task use ice_domain, only: nblocks use ice_domain_size, only: nilyr, nslyr, ncat, max_blocks use ice_flux, only: scale_factor, swvdr, swvdf, swidr, swidf, & - strocnxT, strocnyT, sst, frzmlt, iceumask, coszen, & + strocnxT, strocnyT, sst, frzmlt, iceumask, & stressp_1, stressp_2, stressp_3, stressp_4, & stressm_1, stressm_2, stressm_3, stressm_4, & stress12_1, stress12_2, stress12_3, stress12_4 - use ice_read_write, only: ice_open, ice_write +#ifdef CESMCOUPLED + use ice_flux, only: coszen +#endif use ice_state, only: aicen, vicen, vsnon, trcrn, uvel, vvel character(len=char_len_long), intent(in), optional :: filename_spec @@ -71,11 +68,8 @@ subroutine dumpfile(filename_spec) ! local variables integer (kind=int_kind) :: & - i, j, k, n, iblk, & ! counting indices - nt_Tsfc, nt_sice, nt_qice, nt_qsno, & - iyear, imonth, iday ! year, month, day - - character(len=char_len_long) :: filename + i, j, k, iblk, & ! counting indices + nt_Tsfc, nt_sice, nt_qice, nt_qsno logical (kind=log_kind) :: diag @@ -204,21 +198,21 @@ end subroutine dumpfile subroutine restartfile (ice_ic) use ice_boundary, only: ice_HaloUpdate_stress - use ice_broadcast, only: broadcast_scalar use ice_blocks, only: nghost, nx_block, ny_block - use ice_calendar, only: istep0, istep1, time, time_forc, calendar, npt + use ice_calendar, only: istep0, npt use ice_communicate, only: my_task, master_task - use ice_domain, only: nblocks, distrb_info, halo_info - use ice_domain_size, only: nilyr, nslyr, ncat, nx_global, ny_global, & + use ice_domain, only: nblocks, halo_info + use ice_domain_size, only: nilyr, nslyr, ncat, & max_ntrcr, max_blocks use ice_flux, only: scale_factor, swvdr, swvdf, swidr, swidf, & - strocnxT, strocnyT, sst, frzmlt, iceumask, coszen, & + strocnxT, strocnyT, sst, frzmlt, iceumask, & stressp_1, stressp_2, stressp_3, stressp_4, & stressm_1, stressm_2, stressm_3, stressm_4, & stress12_1, stress12_2, stress12_3, stress12_4 - use ice_gather_scatter, only: scatter_global_stress +#ifdef CESMCOUPLED + use ice_flux, only: coszen +#endif use ice_grid, only: tmask, grid_type - use ice_read_write, only: ice_open, ice_read, ice_read_global use ice_state, only: trcr_depend, aice, vice, vsno, trcr, & aice0, aicen, vicen, vsnon, trcrn, aice_init, uvel, vvel, & trcr_base, nt_strata, n_trcr_strata @@ -228,15 +222,8 @@ subroutine restartfile (ice_ic) ! local variables integer (kind=int_kind) :: & - i, j, k, n, iblk, & ! counting indices - nt_Tsfc, nt_sice, nt_qice, nt_qsno, & - iignore ! dummy variable - - real (kind=real_kind) :: & - rignore ! dummy variable - - character(len=char_len_long) :: & - filename, filename0 + i, j, k, iblk, & ! counting indices + nt_Tsfc, nt_sice, nt_qice, nt_qsno logical (kind=log_kind) :: & diag @@ -244,9 +231,6 @@ subroutine restartfile (ice_ic) real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks) :: & work1 - real (kind=dbl_kind), dimension(:,:), allocatable :: & - work_g1, work_g2 - character (len=3) :: nchar character(len=*), parameter :: subname = '(restartfile)' diff --git a/cicecore/cicedynB/infrastructure/ice_restoring.F90 b/cicecore/cicedynB/infrastructure/ice_restoring.F90 index 27de6ab05..5ac3253a8 100644 --- a/cicecore/cicedynB/infrastructure/ice_restoring.F90 +++ b/cicecore/cicedynB/infrastructure/ice_restoring.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_restoring.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! ! Reads and interpolates forcing data for atmosphere and ocean quantities. @@ -9,11 +8,10 @@ module ice_restoring use ice_kinds_mod use ice_blocks, only: nx_block, ny_block - use ice_constants, only: c0, c1, c2, p2, p5 - use ice_domain_size, only: ncat, max_blocks, max_ntrcr + use ice_constants, only: c0, c1, c2, p2 + use ice_domain_size, only: ncat, max_blocks use ice_forcing, only: trestore, trest - use ice_state, only: aicen, vicen, vsnon, trcrn, bound_state, & - aice_init, aice0, aice, vice, vsno, trcr, trcr_depend + use ice_state, only: aicen, vicen, vsnon, trcrn use ice_timers, only: ice_timer_start, ice_timer_stop, timer_bound use ice_exit, only: abort_ice use ice_fileunits, only: nu_diag @@ -126,7 +124,7 @@ subroutine ice_HaloRestore_init ilo, ihi, jlo, jhi, & iglob, jglob, & iblock, jblock, & - Tair (:,:, iblk), sst (:,:, iblk), & + Tair (:,:, iblk), & Tf (:,:, iblk), & salinz(:,:,:, iblk), Tmltz(:,:,:, iblk), & tmask(:,:, iblk), & @@ -290,7 +288,7 @@ subroutine set_restore_var (nx_block, ny_block, & ilo, ihi, jlo, jhi, & iglob, jglob, & iblock, jblock, & - Tair, sst, & + Tair, & Tf, & salinz, Tmltz, & tmask, aicen, & @@ -315,8 +313,7 @@ subroutine set_restore_var (nx_block, ny_block, & real (kind=dbl_kind), dimension (nx_block,ny_block), intent(in) :: & Tair , & ! air temperature (K) - Tf , & ! freezing temperature (C) - sst ! sea surface temperature (C) ! currently not used + Tf ! freezing temperature (C) real (kind=dbl_kind), dimension (nx_block,ny_block,nilyr), & intent(in) :: & diff --git a/cicecore/cicedynB/infrastructure/io/io_binary/ice_history_write.F90 b/cicecore/cicedynB/infrastructure/io/io_binary/ice_history_write.F90 index 9e83da25b..e72f050ce 100644 --- a/cicecore/cicedynB/infrastructure/io/io_binary/ice_history_write.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_binary/ice_history_write.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_history_write.F90 567 2013-01-07 02:57:36Z eclare $ !======================================================================= ! ! Writes history in binary format diff --git a/cicecore/cicedynB/infrastructure/io/io_binary/ice_restart.F90 b/cicecore/cicedynB/infrastructure/io/io_binary/ice_restart.F90 index 7cc566c26..eaa513e91 100644 --- a/cicecore/cicedynB/infrastructure/io/io_binary/ice_restart.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_binary/ice_restart.F90 @@ -650,7 +650,7 @@ subroutine read_restart_field(nu,nrec,work,atype,vname,ndim3, & if (present(field_loc)) then do n=1,ndim3 if (restart_ext) then - call ice_read_ext(nu,nrec,work2,atype,diag,field_loc,field_type) + call ice_read_ext(nu,nrec,work2,atype,diag) else call ice_read(nu,nrec,work2,atype,diag,field_loc,field_type) endif diff --git a/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_history_write.F90 b/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_history_write.F90 index eb090cfac..855e607a3 100644 --- a/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_history_write.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_history_write.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_history_write.F90 567 2013-01-07 02:57:36Z eclare $ !======================================================================= ! ! Writes history in netCDF format @@ -79,7 +78,7 @@ subroutine ice_write_hist (ns) integer (kind=int_kind), dimension(5) :: dimidcz integer (kind=int_kind), dimension(3) :: dimid_nverts integer (kind=int_kind), dimension(5) :: dimidex - real (kind=real_kind) :: ltime +! real (kind=real_kind) :: ltime real (kind=dbl_kind) :: ltime2 character (char_len) :: title character (char_len_long) :: ncfile(max_nstrm) @@ -126,7 +125,7 @@ subroutine ice_write_hist (ns) if (my_task == master_task) then - ltime=time/int(secday) +! ltime=time/int(secday) ltime2=time/int(secday) call construct_filename(ncfile(ns),'nc',ns) diff --git a/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_restart.F90 b/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_restart.F90 index 9b888fa25..7e9e93e01 100644 --- a/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_restart.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_netcdf/ice_restart.F90 @@ -10,8 +10,8 @@ module ice_restart use ice_kinds_mod use netcdf use ice_restart_shared, only: & - restart, restart_ext, restart_dir, restart_file, pointer_file, & - runid, runtype, use_restart_time, restart_format, lcdf64, lenstr + restart_ext, restart_dir, restart_file, pointer_file, & + runid, use_restart_time, lcdf64, lenstr use ice_fileunits, only: nu_diag, nu_rst_pointer use ice_exit, only: abort_ice use icepack_intfc, only: icepack_query_parameters @@ -38,9 +38,8 @@ module ice_restart subroutine init_restart_read(ice_ic) use ice_calendar, only: sec, month, mday, nyr, istep0, istep1, & - time, time_forc, year_init, npt + time, time_forc, npt use ice_communicate, only: my_task, master_task - use ice_domain, only: nblocks character(len=char_len_long), intent(in), optional :: ice_ic @@ -178,8 +177,6 @@ subroutine init_restart_write(filename_spec) filename = trim(filename_spec) else iyear = nyr + year_init - 1 - imonth = month - iday = mday write(filename,'(a,a,a,i4.4,a,i2.2,a,i2.2,a,i5.5)') & restart_dir(1:lenstr(restart_dir)), & @@ -621,7 +618,7 @@ subroutine read_restart_field(nu,nrec,work,atype,vname,ndim3, & use ice_blocks, only: nx_block, ny_block use ice_domain_size, only: max_blocks, ncat - use ice_read_write, only: ice_read, ice_read_nc + use ice_read_write, only: ice_read_nc integer (kind=int_kind), intent(in) :: & nu , & ! unit number (not used for netcdf) @@ -706,7 +703,7 @@ subroutine write_restart_field(nu,nrec,work,atype,vname,ndim3,diag) use ice_blocks, only: nx_block, ny_block use ice_domain_size, only: max_blocks, ncat - use ice_read_write, only: ice_write, ice_write_nc + use ice_read_write, only: ice_write_nc integer (kind=int_kind), intent(in) :: & nu , & ! unit number @@ -729,7 +726,6 @@ subroutine write_restart_field(nu,nrec,work,atype,vname,ndim3,diag) ! local variables integer (kind=int_kind) :: & - n, & ! dimension counter varid, & ! variable id status ! status variable from netCDF routine diff --git a/cicecore/cicedynB/infrastructure/io/io_pio/ice_history_write.F90 b/cicecore/cicedynB/infrastructure/io/io_pio/ice_history_write.F90 index 80567fb64..4372ab213 100644 --- a/cicecore/cicedynB/infrastructure/io/io_pio/ice_history_write.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_pio/ice_history_write.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_history_write.F90 567 2013-01-07 02:57:36Z eclare $ !======================================================================= ! ! Writes history in netCDF format diff --git a/cicecore/cicedynB/infrastructure/io/io_pio/ice_restart.F90 b/cicecore/cicedynB/infrastructure/io/io_pio/ice_restart.F90 index ddd5c0ecd..64a6bea86 100644 --- a/cicecore/cicedynB/infrastructure/io/io_pio/ice_restart.F90 +++ b/cicecore/cicedynB/infrastructure/io/io_pio/ice_restart.F90 @@ -1,5 +1,3 @@ - -! SVN:$Id: ice_restart.F90 607 2013-03-29 15:49:42Z eclare $ !======================================================================= ! ! Read and write ice model restart files using pio interfaces. diff --git a/cicecore/drivers/cesm/CICE_FinalMod.F90 b/cicecore/drivers/cesm/CICE_FinalMod.F90 index 42b3f4794..05e3da174 100644 --- a/cicecore/drivers/cesm/CICE_FinalMod.F90 +++ b/cicecore/drivers/cesm/CICE_FinalMod.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: CICE_FinalMod.F90 744 2013-09-27 22:53:24Z eclare $ !======================================================================= ! ! This module contains routines for the final exit of the CICE model, diff --git a/cicecore/drivers/cesm/CICE_InitMod.F90 b/cicecore/drivers/cesm/CICE_InitMod.F90 index 70d5af3ce..7c22d551c 100644 --- a/cicecore/drivers/cesm/CICE_InitMod.F90 +++ b/cicecore/drivers/cesm/CICE_InitMod.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: CICE_InitMod.F90 960 2015-04-01 23:11:41Z eclare $ !======================================================================= ! ! This module contains the CICE initialization routine that sets model diff --git a/cicecore/drivers/cesm/CICE_RunMod.F90 b/cicecore/drivers/cesm/CICE_RunMod.F90 index 43870e1bb..9a41ac707 100644 --- a/cicecore/drivers/cesm/CICE_RunMod.F90 +++ b/cicecore/drivers/cesm/CICE_RunMod.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: CICE_RunMod.F90 960 2015-04-01 23:11:41Z eclare $ !======================================================================= ! ! Main driver for time stepping of CICE. diff --git a/cicecore/drivers/cesm/CICE_RunMod.F90_debug b/cicecore/drivers/cesm/CICE_RunMod.F90_debug index f7fd521aa..c055a8cf5 100644 --- a/cicecore/drivers/cesm/CICE_RunMod.F90_debug +++ b/cicecore/drivers/cesm/CICE_RunMod.F90_debug @@ -1,4 +1,3 @@ -! SVN:$Id: CICE_RunMod.F90 960 2015-04-01 23:11:41Z eclare $ !======================================================================= ! ! Main driver for time stepping of CICE. diff --git a/cicecore/drivers/cesm/ice_prescribed_mod.F90 b/cicecore/drivers/cesm/ice_prescribed_mod.F90 index 1475e0f56..d6bf2a3fc 100644 --- a/cicecore/drivers/cesm/ice_prescribed_mod.F90 +++ b/cicecore/drivers/cesm/ice_prescribed_mod.F90 @@ -12,7 +12,6 @@ ! Regridding and data cycling capabilities are included. ! ! !REVISION HISTORY: -! SVN:$Id: ice_prescribed_mod.F90 40 2006-12-01 19:09:30Z eclare $ ! ! 2010-May-15 - Tony Craig and Mariana Vertenstein - updated to latest streams ! 2006-Aug-22 - D. Bailey, E. Hunke, modified to fit with CICE diff --git a/cicecore/drivers/cice/CICE.F90 b/cicecore/drivers/cice/CICE.F90 index f46e97dc1..689cf80d5 100644 --- a/cicecore/drivers/cice/CICE.F90 +++ b/cicecore/drivers/cice/CICE.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: CICE.F90 1229 2017-05-24 02:22:58Z eclare $ !======================================================================= ! Copyright (c) 2017, Los Alamos National Security, LLC ! All rights reserved. @@ -73,7 +72,6 @@ subroutine debug_ice(iblk, plabeld) use ice_calendar, only: istep1 use ice_communicate, only: my_task use ice_diagnostics, only: check_step, iblkp, ip, jp, mtask, print_state - use ice_domain, only: nblocks use ice_blocks, only: nx_block, ny_block character (char_len), intent(in) :: plabeld diff --git a/cicecore/drivers/cice/CICE_FinalMod.F90 b/cicecore/drivers/cice/CICE_FinalMod.F90 index 7ce8c907c..c76be767f 100644 --- a/cicecore/drivers/cice/CICE_FinalMod.F90 +++ b/cicecore/drivers/cice/CICE_FinalMod.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: CICE_FinalMod.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! ! This module contains routines for the final exit of the CICE model, diff --git a/cicecore/drivers/cice/CICE_InitMod.F90 b/cicecore/drivers/cice/CICE_InitMod.F90 index 567ab2a7c..92d6d0852 100644 --- a/cicecore/drivers/cice/CICE_InitMod.F90 +++ b/cicecore/drivers/cice/CICE_InitMod.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: CICE_InitMod.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! ! This module contains the CICE initialization routine that sets model @@ -59,10 +58,9 @@ end subroutine CICE_Initialize subroutine cice_init + use ice_arrays_column, only: hin_max, c_hi_range, alloc_arrays_column use ice_state, only: alloc_state use ice_flux_bgc, only: alloc_flux_bgc - use ice_arrays_column, only: hin_max, c_hi_range, zfswin, trcrn_sw, & - ocean_bio_all, ice_bio_net, snow_bio_net, alloc_arrays_column use ice_calendar, only: dt, dt_dyn, time, istep, istep1, write_ic, & init_calendar, calendar use ice_communicate, only: init_communicate, my_task, master_task @@ -76,7 +74,7 @@ subroutine cice_init use ice_forcing, only: init_forcing_ocn, init_forcing_atmo, & get_forcing_atmo, get_forcing_ocn, alloc_forcing use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, & - faero_data, faero_default, faero_optics, alloc_forcing_bgc + faero_default, faero_optics, alloc_forcing_bgc use ice_grid, only: init_grid1, init_grid2, alloc_grid use ice_history, only: init_hist, accum_hist use ice_restart_shared, only: restart, runid, runtype @@ -98,7 +96,7 @@ subroutine cice_init call icepack_configure() ! initialize icepack call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(subname, & + if (icepack_warnings_aborted()) call abort_ice(trim(subname), & file=__FILE__,line= __LINE__) call input_data ! namelist variables @@ -142,7 +140,7 @@ subroutine cice_init if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & file=__FILE__, line=__LINE__) - call calendar(time) ! determine the initial date +! call calendar(time) ! determine the initial date call init_forcing_ocn(dt) ! initialize sss and sst from data call init_state ! initialize the ice state @@ -158,7 +156,7 @@ subroutine cice_init call icepack_query_parameters(skl_bgc_out=skl_bgc, z_tracers_out=z_tracers) call icepack_query_tracer_flags(tr_aero_out=tr_aero, tr_zaero_out=tr_zaero) call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(subname, & + if (icepack_warnings_aborted()) call abort_ice(trim(subname), & file=__FILE__,line= __LINE__) if (tr_aero .or. tr_zaero) call faero_optics !initialize aerosol optical @@ -219,7 +217,6 @@ subroutine init_restart use ice_domain_size, only: ncat, max_ntrcr, n_aero use ice_dyn_eap, only: read_restart_eap use ice_dyn_shared, only: kdyn - use ice_flux, only: sss use ice_grid, only: tmask use ice_init, only: ice_ic use ice_init_column, only: init_age, init_FY, init_lvl, & @@ -233,7 +230,7 @@ subroutine init_restart restart_aero, read_restart_aero, & restart_hbrine, read_restart_hbrine, & restart_zsal, restart_bgc - use ice_restart_driver, only: restartfile, restartfile_v4 + use ice_restart_driver, only: restartfile use ice_restart_shared, only: runtype, restart use ice_state ! almost everything @@ -306,7 +303,7 @@ subroutine init_restart call read_restart_lvl else do iblk = 1, nblocks - call init_lvl(trcrn(:,:,nt_alvl,:,iblk), & + call init_lvl(iblk,trcrn(:,:,nt_alvl,:,iblk), & trcrn(:,:,nt_vlvl,:,iblk)) enddo ! iblk endif diff --git a/cicecore/drivers/cice/CICE_RunMod.F90 b/cicecore/drivers/cice/CICE_RunMod.F90 index 4515b6f43..05cb998da 100644 --- a/cicecore/drivers/cice/CICE_RunMod.F90 +++ b/cicecore/drivers/cice/CICE_RunMod.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: CICE_RunMod.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! ! Main driver for time stepping of CICE. @@ -46,7 +45,7 @@ subroutine CICE_Run use ice_calendar, only: istep, istep1, time, dt, stop_now, calendar use ice_forcing, only: get_forcing_atmo, get_forcing_ocn - use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, fzaero_data, & + use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, & faero_default use ice_flux, only: init_flux_atm, init_flux_ocn use ice_timers, only: ice_timer_start, ice_timer_stop, & @@ -135,7 +134,6 @@ subroutine ice_step use ice_diagnostics, only: init_mass_diags, runtime_diags use ice_diagnostics_bgc, only: hbrine_diags, zsal_diags, bgc_diags use ice_domain, only: halo_info, nblocks - use ice_domain_size, only: nslyr use ice_dyn_eap, only: write_restart_eap use ice_dyn_shared, only: kdyn use ice_flux, only: scale_factor, init_history_therm, & @@ -149,7 +147,6 @@ subroutine ice_step write_restart_bgc, write_restart_hbrine use ice_restart_driver, only: dumpfile use ice_restoring, only: restore_ice, ice_HaloRestore - use ice_state, only: trcrn use ice_step_mod, only: prep_radiation, step_therm1, step_therm2, & update_state, step_dyn_horiz, step_dyn_ridge, step_radiation, & biogeochemistry @@ -206,7 +203,7 @@ subroutine ice_step ! Scale radiation fields !----------------------------------------------------------------- - if (calc_Tsfc) call prep_radiation (dt, iblk) + if (calc_Tsfc) call prep_radiation (iblk) !----------------------------------------------------------------- ! thermodynamics and biogeochemistry @@ -284,9 +281,9 @@ subroutine ice_step call ice_timer_start(timer_diags) ! diagnostics if (mod(istep,diagfreq) == 0) then call runtime_diags(dt) ! log file - if (solve_zsal) call zsal_diags(dt) - if (skl_bgc .or. z_tracers) call bgc_diags (dt) - if (tr_brine) call hbrine_diags(dt) + if (solve_zsal) call zsal_diags + if (skl_bgc .or. z_tracers) call bgc_diags + if (tr_brine) call hbrine_diags endif call ice_timer_stop(timer_diags) ! diagnostics @@ -325,20 +322,25 @@ subroutine coupling_prep (iblk) use ice_arrays_column, only: alvdfn, alidfn, alvdrn, alidrn, & albicen, albsnon, albpndn, apeffn, fzsal_g, fzsal, snowfracn - use ice_blocks, only: block, nx_block, ny_block + use ice_blocks, only: nx_block, ny_block, get_block, block + use ice_domain, only: blocks_ice use ice_calendar, only: dt, nstreams use ice_domain_size, only: ncat use ice_flux, only: alvdf, alidf, alvdr, alidr, albice, albsno, & - albpnd, albcnt, apeff_ai, coszen, fpond, fresh, l_mpond_fresh, & + albpnd, albcnt, apeff_ai, fpond, fresh, l_mpond_fresh, & alvdf_ai, alidf_ai, alvdr_ai, alidr_ai, fhocn_ai, & fresh_ai, fsalt_ai, fsalt, & fswthru_ai, fhocn, fswthru, scale_factor, snowfrac, & swvdr, swidr, swvdf, swidf, Tf, Tair, Qa, strairxT, strairyt, & fsens, flat, fswabs, flwout, evap, Tref, Qref, & - fsurfn_f, flatn_f, scale_fluxes, frzmlt_init, frzmlt + scale_fluxes, frzmlt_init, frzmlt use ice_flux_bgc, only: faero_ocn, fzsal_ai, fzsal_g_ai, flux_bio, flux_bio_ai use ice_grid, only: tmask - use ice_state, only: aicen, aice, aice_init + use ice_state, only: aicen, aice +#ifdef CICE_IN_NEMO + use ice_state, only: aice_init + use ice_flux, only: flatn_f, fsurfn_f +#endif use ice_step_mod, only: ocean_mixed_layer use ice_timers, only: timer_couple, ice_timer_start, ice_timer_stop @@ -348,11 +350,15 @@ subroutine coupling_prep (iblk) ! local variables integer (kind=int_kind) :: & + ilo,ihi,jlo,jhi, & ! beginning and end of physical domain n , & ! thickness category index i,j , & ! horizontal indices k , & ! tracer index nbtrcr ! + type (block) :: & + this_block ! block information for current block + logical (kind=log_kind) :: & calc_Tsfc ! @@ -413,7 +419,16 @@ subroutine coupling_prep (iblk) enddo enddo enddo + +! this_block = get_block(blocks_ice(iblk),iblk) +! ilo = this_block%ilo +! ihi = this_block%ihi +! jlo = this_block%jlo +! jhi = this_block%jhi + do n = 1, ncat +! do j = jlo, jhi +! do i = ilo, ihi do j = 1, ny_block do i = 1, nx_block if (aicen(i,j,n,iblk) > puny) then @@ -516,6 +531,7 @@ subroutine coupling_prep (iblk) fzsal (:,:,iblk), fzsal_g (:,:,iblk), & flux_bio(:,:,1:nbtrcr,iblk)) +#ifdef CICE_IN_NEMO !echmod - comment this out for efficiency, if .not. calc_Tsfc if (.not. calc_Tsfc) then @@ -531,11 +547,13 @@ subroutine coupling_prep (iblk) fresh (:,:,iblk), fhocn (:,:,iblk)) endif !echmod - +#endif call ice_timer_stop(timer_couple) ! atm/ocn coupling end subroutine coupling_prep +#ifdef CICE_IN_NEMO + !======================================================================= ! ! If surface heat fluxes are provided to CICE instead of CICE calculating @@ -575,7 +593,6 @@ subroutine sfcflux_to_ocn(nx_block, ny_block, & fresh , & ! fresh water flux to ocean (kg/m2/s) fhocn ! actual ocn/ice heat flx (W/m**2) -#ifdef CICE_IN_NEMO ! local variables integer (kind=int_kind) :: & @@ -606,10 +623,11 @@ subroutine sfcflux_to_ocn(nx_block, ny_block, & enddo ! j enddo ! n -#endif end subroutine sfcflux_to_ocn +#endif + !======================================================================= end module CICE_RunMod diff --git a/cicecore/drivers/cice/CICE_RunMod.F90_debug b/cicecore/drivers/cice/CICE_RunMod.F90_debug index 4ce48bcd9..72e8f86df 100644 --- a/cicecore/drivers/cice/CICE_RunMod.F90_debug +++ b/cicecore/drivers/cice/CICE_RunMod.F90_debug @@ -1,4 +1,3 @@ -! SVN:$Id: CICE_RunMod.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! ! Main driver for time stepping of CICE. diff --git a/cicecore/drivers/hadgem3/CICE.F90 b/cicecore/drivers/hadgem3/CICE.F90 index 00112c784..1cad5bcfa 100644 --- a/cicecore/drivers/hadgem3/CICE.F90 +++ b/cicecore/drivers/hadgem3/CICE.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: CICE.F90 1229 2017-05-24 02:22:58Z eclare $ !======================================================================= ! Copyright (c) 2017, Los Alamos National Security, LLC ! All rights reserved. diff --git a/cicecore/drivers/hadgem3/CICE_FinalMod.F90 b/cicecore/drivers/hadgem3/CICE_FinalMod.F90 index facec4498..6b5a53abe 100644 --- a/cicecore/drivers/hadgem3/CICE_FinalMod.F90 +++ b/cicecore/drivers/hadgem3/CICE_FinalMod.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: CICE_FinalMod.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! ! This module contains routines for the final exit of the CICE model, diff --git a/cicecore/drivers/hadgem3/CICE_InitMod.F90 b/cicecore/drivers/hadgem3/CICE_InitMod.F90 index e72a396d2..4a056110b 100644 --- a/cicecore/drivers/hadgem3/CICE_InitMod.F90 +++ b/cicecore/drivers/hadgem3/CICE_InitMod.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: CICE_InitMod.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! ! This module contains the CICE initialization routine that sets model diff --git a/cicecore/drivers/hadgem3/CICE_RunMod.F90 b/cicecore/drivers/hadgem3/CICE_RunMod.F90 index 789c0ba9d..6741521b9 100644 --- a/cicecore/drivers/hadgem3/CICE_RunMod.F90 +++ b/cicecore/drivers/hadgem3/CICE_RunMod.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: CICE_RunMod.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! ! Main driver for time stepping of CICE. diff --git a/cicecore/shared/ice_arrays_column.F90 b/cicecore/shared/ice_arrays_column.F90 index c5bc243f1..1d255fcd1 100644 --- a/cicecore/shared/ice_arrays_column.F90 +++ b/cicecore/shared/ice_arrays_column.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_arrays_column.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! Grid-dependent arrays needed for column package diff --git a/cicecore/shared/ice_calendar.F90 b/cicecore/shared/ice_calendar.F90 index d0e36d99f..c721281ba 100644 --- a/cicecore/shared/ice_calendar.F90 +++ b/cicecore/shared/ice_calendar.F90 @@ -1,4 +1,3 @@ -! $Id: ice_calendar.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! Calendar routines for managing time diff --git a/cicecore/shared/ice_constants.F90 b/cicecore/shared/ice_constants.F90 index 40d186783..7b59f3dee 100644 --- a/cicecore/shared/ice_constants.F90 +++ b/cicecore/shared/ice_constants.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_constants.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! ! This module defines a variety of physical and numerical constants diff --git a/cicecore/shared/ice_distribution.F90 b/cicecore/shared/ice_distribution.F90 index 5a7facdaf..fa49adbc9 100644 --- a/cicecore/shared/ice_distribution.F90 +++ b/cicecore/shared/ice_distribution.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_distribution.F90 732 2013-09-19 18:19:31Z eclare $ !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| module ice_distribution @@ -606,6 +605,12 @@ function create_distrb_cart(nprocs, workPerBlock) result(newDistrb) allocate (newDistrb%blockLocation(nblocks_tot), & newDistrb%blockLocalID (nblocks_tot), stat=istat) + if (istat > 0) then + call abort_ice( & + 'create_distrb_cart: error allocating blockLocation or blockLocalID') + return + endif + !---------------------------------------------------------------------- ! ! distribute blocks linearly across processors in each direction @@ -659,6 +664,11 @@ function create_distrb_cart(nprocs, workPerBlock) result(newDistrb) if (newDistrb%numLocalBlocks > 0) then allocate (newDistrb%blockGlobalID(newDistrb%numLocalBlocks), & stat=istat) + if (istat > 0) then + call abort_ice( & + 'create_distrb_cart: error allocating blockGlobalID') + return + endif do j=1,nprocsY do i=1,nprocsX @@ -760,6 +770,11 @@ function create_distrb_rake(nprocs, workPerBlock) result(newDistrb) if (numOcnBlocks <= 2*nprocs) then allocate(priority(nblocks_tot), stat=istat) + if (istat > 0) then + call abort_ice( & + 'create_distrb_rake: error allocating priority') + return + endif !*** initialize priority array @@ -775,6 +790,11 @@ function create_distrb_rake(nprocs, workPerBlock) result(newDistrb) end do allocate(workTmp(nblocks_tot), procTmp(nblocks_tot), stat=istat) + if (istat > 0) then + call abort_ice( & + 'create_distrb_rake: error allocating procTmp') + return + endif workTmp(:) = 0 do i=1,nprocs @@ -790,6 +810,11 @@ function create_distrb_rake(nprocs, workPerBlock) result(newDistrb) priority, dist) deallocate(workTmp, procTmp, stat=istat) + if (istat > 0) then + call abort_ice( & + 'create_distrb_rake: error deallocating procTmp') + return + endif !---------------------------------------------------------------------- ! @@ -808,6 +833,11 @@ function create_distrb_rake(nprocs, workPerBlock) result(newDistrb) !---------------------------------------------------------------------- allocate(priority(nblocks_tot), stat=istat) + if (istat > 0) then + call abort_ice( & + 'create_distrb_rake: error allocating priority') + return + endif !*** set highest priority such that eastern-most blocks !*** and blocks with the least amount of work are @@ -826,6 +856,11 @@ function create_distrb_rake(nprocs, workPerBlock) result(newDistrb) end do allocate(workTmp(nprocsX), procTmp(nprocsX), stat=istat) + if (istat > 0) then + call abort_ice( & + 'create_distrb_rake: error allocating procTmp') + return + endif do j=1,nprocsY @@ -845,6 +880,11 @@ function create_distrb_rake(nprocs, workPerBlock) result(newDistrb) end do deallocate(workTmp, procTmp, stat=istat) + if (istat > 0) then + call abort_ice( & + 'create_distrb_rake: error deallocating procTmp') + return + endif !---------------------------------------------------------------------- ! @@ -867,6 +907,11 @@ function create_distrb_rake(nprocs, workPerBlock) result(newDistrb) end do allocate(workTmp(nprocsY), procTmp(nprocsY), stat=istat) + if (istat > 0) then + call abort_ice( & + 'create_distrb_rake: error allocating procTmp') + return + endif do i=1,nprocsX @@ -887,6 +932,11 @@ function create_distrb_rake(nprocs, workPerBlock) result(newDistrb) end do deallocate(workTmp, procTmp, priority, stat=istat) + if (istat > 0) then + call abort_ice( & + 'create_distrb_rake: error deallocating procTmp') + return + endif endif ! 1d or 2d rake @@ -902,8 +952,18 @@ function create_distrb_rake(nprocs, workPerBlock) result(newDistrb) allocate(newDistrb%blockLocation(nblocks_tot), & newDistrb%blockLocalID(nblocks_tot), stat=istat) + if (istat > 0) then + call abort_ice( & + 'create_distrb_rake: error allocating blockLocation or blockLocalID') + return + endif allocate(procTmp(nprocs), stat=istat) + if (istat > 0) then + call abort_ice( & + 'create_distrb_rake: error allocating procTmp') + return + endif procTmp = 0 do n=1,nblocks_tot @@ -1016,6 +1076,11 @@ function create_distrb_roundrobin(nprocs, workPerBlock) result(newDistrb) allocate (newDistrb%blockLocation(nblocks_tot), & newDistrb%blockLocalID (nblocks_tot), stat=istat) + if (istat > 0) then + call abort_ice( & + 'create_distrb_roundrobin: error allocating blockLocation or blockLocalID') + return + endif allocate (newDistrb%blockCnt(nprocs)) @@ -1075,6 +1140,11 @@ function create_distrb_roundrobin(nprocs, workPerBlock) result(newDistrb) if (newDistrb%numLocalBlocks > 0) then allocate (newDistrb%blockGlobalID(newDistrb%numLocalBlocks), & stat=istat) + if (istat > 0) then + call abort_ice( & + 'create_distrb_roundrobin: error allocating numLocalBlocks') + return + endif processor = my_task + 1 do localID = 1,newDistrb%numLocalBlocks @@ -1546,6 +1616,11 @@ function create_distrb_sectrobin(nprocs, workPerBlock) result(newDistrb) allocate (newDistrb%blockLocation(nblocks_tot), & newDistrb%blockLocalID (nblocks_tot), stat=istat) + if (istat > 0) then + call abort_ice( & + 'create_distrb_sectrobin: error allocating blockLocation or blockLocalID') + return + endif allocate (newDistrb%blockCnt(nprocs)) @@ -1763,6 +1838,11 @@ function create_distrb_sectrobin(nprocs, workPerBlock) result(newDistrb) if (newDistrb%numLocalBlocks > 0) then allocate (newDistrb%blockGlobalID(newDistrb%numLocalBlocks), & stat=istat) + if (istat > 0) then + call abort_ice( & + 'create_distrb_sectrobin: error allocating numLocalBlocks') + return + endif processor = my_task + 1 do localID = 1,newDistrb%numLocalBlocks @@ -1839,6 +1919,11 @@ function create_distrb_sectcart(nprocs, workPerBlock) result(newDistrb) allocate (newDistrb%blockLocation(nblocks_tot), & newDistrb%blockLocalID (nblocks_tot), stat=istat) + if (istat > 0) then + call abort_ice( & + 'create_distrb_sectcart: error allocating blockLocation or blockLocalID') + return + endif allocate (newDistrb%blockCnt(nprocs)) !---------------------------------------------------------------------- @@ -1922,6 +2007,11 @@ function create_distrb_sectcart(nprocs, workPerBlock) result(newDistrb) if (newDistrb%numLocalBlocks > 0) then allocate (newDistrb%blockGlobalID(newDistrb%numLocalBlocks), & stat=istat) + if (istat > 0) then + call abort_ice( & + 'create_distrb_sectcart: error allocating numLocalBlocks') + return + endif processor = my_task + 1 do localID = 1,newDistrb%numLocalBlocks @@ -2263,7 +2353,7 @@ subroutine ice_distributionRake (procWork, procID, blockWork, & minPriority, &! minimum priority lastLoc, &! location for most recent block meanWork, maxWork, &! mean,max work per processor - diffWork, residual, &! work differences and residual work + diffWork, &! work differences numTransfers ! counter for number of block transfers character(len=*),parameter :: subname='(ice_distributionRake)' @@ -2281,7 +2371,7 @@ subroutine ice_distributionRake (procWork, procID, blockWork, & meanWork = sum(procWork)/nprocs + 1 maxWork = maxval(procWork) - residual = mod(meanWork,nprocs) +! residual = mod(meanWork,nprocs) minPriority = 1000000 do n=1,nprocs diff --git a/cicecore/shared/ice_domain_size.F90 b/cicecore/shared/ice_domain_size.F90 index 7d4ec0eac..a60e10c02 100644 --- a/cicecore/shared/ice_domain_size.F90 +++ b/cicecore/shared/ice_domain_size.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_domain_size.F90 1228 2017-05-23 21:33:34Z tcraig $ !======================================================================= ! Defines the global domain size and number of categories and layers. diff --git a/cicecore/shared/ice_fileunits.F90 b/cicecore/shared/ice_fileunits.F90 index aec762d33..45d3193c2 100644 --- a/cicecore/shared/ice_fileunits.F90 +++ b/cicecore/shared/ice_fileunits.F90 @@ -278,11 +278,10 @@ subroutine flush_fileunit(iunit) #ifdef CESMCOUPLED call shr_sys_flush(iunit) #else -#if (defined IRIX64 || defined CRAY || defined OSF1 || defined SUNOS || defined LINUX || defined NEC_SX | defined UNICOSMP) - call flush(iunit) -#endif -#if (defined AIX) - call flush_(iunit) +#ifndef NO_F2003 + flush(iunit) +#else +! Place holder for old call. #endif #endif diff --git a/cicecore/shared/ice_init_column.F90 b/cicecore/shared/ice_init_column.F90 index 5418661d9..17500c81b 100644 --- a/cicecore/shared/ice_init_column.F90 +++ b/cicecore/shared/ice_init_column.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_init_column.F90 1228 2017-05-23 21:33:34Z tcraig $ !========================================================================= ! ! Initialization routines for the column package. @@ -115,16 +114,16 @@ subroutine init_shortwave kaer_tab, waer_tab, gaer_tab, kaer_bc_tab, waer_bc_tab, gaer_bc_tab, bcenh, & swgrid, igrid use ice_blocks, only: block, get_block, nx_block, ny_block - use ice_calendar, only: nstreams, istep1, dt, calendar_type, & + use ice_calendar, only: dt, calendar_type, & days_per_year, nextsw_cday, yday, sec - use ice_communicate, only: my_task, master_task + use ice_communicate, only: my_task use ice_diagnostics, only: npnt, print_points, pmloc, piloc, pjloc, & diagnostic_abort use ice_domain, only: nblocks, blocks_ice use ice_flux, only: alvdf, alidf, alvdr, alidr, & alvdr_ai, alidr_ai, alvdf_ai, alidf_ai, & swvdr, swvdf, swidr, swidf, scale_factor, snowfrac, & - albice, albsno, albpnd, apeff_ai, albcnt, coszen, fsnow + albice, albsno, albpnd, apeff_ai, coszen, fsnow use ice_grid, only: tlat, tlon, tmask use ice_restart_shared, only: restart, runtype use ice_state, only: aicen, vicen, vsnon, trcrn @@ -136,7 +135,6 @@ subroutine init_shortwave n ! thickness category index real (kind=dbl_kind) :: & - cszn , & ! counter for history averaging netsw ! flag for shortwave radiation presence type (block) :: & @@ -148,8 +146,6 @@ subroutine init_shortwave dEdd_algae, & ! from icepack modal_aero ! from icepack - character (char_len) :: stop_label - character (char_len) :: shortwave integer (kind=int_kind) :: & @@ -187,7 +183,7 @@ subroutine init_shortwave file=__FILE__,line= __LINE__) !!$OMP PARALLEL DO PRIVATE(iblk,i,j,n,ilo,ihi,jlo,jhi,this_block, & - !!$OMP cszn,l_print_point,debug,ipoint) + !!$OMP l_print_point,debug,ipoint) do iblk=1,nblocks ! Initialize @@ -426,17 +422,22 @@ end subroutine init_FY ! Initialize ice lvl tracers (call prior to reading restart data) - subroutine init_lvl(alvl, vlvl) + subroutine init_lvl(iblk, alvl, vlvl) - use ice_constants, only: c1 + use ice_constants, only: c0, c1 + use ice_arrays_column, only: ffracn, dhsn - real(kind=dbl_kind), dimension(:,:,:), intent(out) :: & + integer (kind=int_kind), intent(in) :: iblk + + real (kind=dbl_kind), dimension(:,:,:), intent(out) :: & alvl , & ! level ice area fraction vlvl ! level ice volume character(len=*),parameter :: subname='(init_lvl)' alvl(:,:,:) = c1 ! level ice area fraction vlvl(:,:,:) = c1 ! level ice volume + ffracn(:,:,:,iblk) = c0 + dhsn(:,:,:,iblk) = c0 end subroutine init_lvl @@ -518,11 +519,7 @@ subroutine init_bgc() ocean_bio_all, ice_bio_net, snow_bio_net, & cgrid, igrid, bphi, iDi, bTiz, iki, & Rayleigh_criteria, Rayleigh_real - use ice_blocks, only: block, get_block, nx_block, ny_block - use ice_calendar, only: dt, istep1 - use ice_communicate, only: my_task - use ice_diagnostics, only: npnt, print_points, pmloc, piloc, pjloc, & - diagnostic_abort + use ice_blocks, only: block, get_block use ice_domain, only: nblocks, blocks_ice use ice_flux, only: sss use ice_flux_bgc, only: nit, amm, sil, dmsp, dms, algalN, & @@ -530,28 +527,23 @@ subroutine init_bgc() use ice_forcing_bgc, only: init_bgc_data, get_forcing_bgc use ice_restart_column, only: restart_zsal, & read_restart_bgc, restart_bgc - use ice_state, only: trcrn, aicen, vicen, vsnon + use ice_state, only: trcrn ! local variables integer (kind=int_kind) :: & i, j, iblk , & ! horizontal indices ilo,ihi,jlo,jhi , & ! beginning and end of physical domain - k,m , & ! vertical index - n , & ! category index - ipoint + k , & ! vertical index + n ! category index integer (kind=int_kind) :: & max_nbtrcr, max_algae, max_don, max_doc, max_dic, max_aero, max_fe logical (kind=log_kind) :: & - l_print_point, & ! flag to print designated grid point diagnostics - debug , & ! prints debugging output if true RayleighC , & solve_zsal - character (char_len) :: stop_label - type (block) :: & this_block ! block information for current block @@ -963,11 +955,11 @@ subroutine init_zbgc ! R_chl2N , & ! 3 algal chlorophyll to N (mg/mmol) F_abs_chl ! to scale absorption in Dedd - real (kind=dbl_kind), dimension(icepack_max_don) :: & ! increase compare to algal R_Fe2C - R_C2N_DON +! real (kind=dbl_kind), dimension(icepack_max_don) :: & ! increase compare to algal R_Fe2C +! R_C2N_DON real (kind=dbl_kind), dimension(icepack_max_algae) :: & - R_Si2N , & ! algal Sil to N (mole/mole) +! R_Si2N , & ! algal Sil to N (mole/mole) R_S2N , & ! algal S to N (mole/mole) ! Marchetti et al 2006, 3 umol Fe/mol C for iron limited Pseudo-nitzschia R_Fe2C , & ! algal Fe to carbon (umol/mmol) @@ -980,13 +972,13 @@ subroutine init_zbgc R_Fe2DOC ! Fe to C of DOC (nmol/umol) real (kind=dbl_kind), dimension(icepack_max_algae) :: & - chlabs , & ! chla absorption 1/m/(mg/m^3) - alpha2max_low , & ! light limitation (1/(W/m^2)) - beta2max , & ! light inhibition (1/(W/m^2)) - mu_max , & ! maximum growth rate (1/d) - grow_Tdep , & ! T dependence of growth (1/C) - fr_graze , & ! fraction of algae grazed - mort_pre , & ! mortality (1/day) +! chlabs , & ! chla absorption 1/m/(mg/m^3) +! alpha2max_low , & ! light limitation (1/(W/m^2)) +! beta2max , & ! light inhibition (1/(W/m^2)) +! mu_max , & ! maximum growth rate (1/d) +! grow_Tdep , & ! T dependence of growth (1/C) +! fr_graze , & ! fraction of algae grazed +! mort_pre , & ! mortality (1/day) mort_Tdep , & ! T dependence of mortality (1/C) k_exude , & ! algal carbon exudation rate (1/d) K_Nit , & ! nitrate half saturation (mmol/m^3) @@ -1000,7 +992,7 @@ subroutine init_zbgc f_don_Am ! fraction of remineralized DON to Am real (kind=dbl_kind), dimension(icepack_max_DOC) :: & - f_doc , & ! fraction of mort_N that goes to each doc pool +! f_doc , & ! fraction of mort_N that goes to each doc pool f_exude , & ! fraction of exuded carbon to each DOC pool k_bac ! Bacterial degredation of DOC (1/d) @@ -1732,9 +1724,9 @@ subroutine init_zbgc !----------------------------------------------------------------- ! Define array parameters !----------------------------------------------------------------- - R_Si2N(1) = ratio_Si2N_diatoms - R_Si2N(2) = ratio_Si2N_sp - R_Si2N(3) = ratio_Si2N_phaeo +! R_Si2N(1) = ratio_Si2N_diatoms +! R_Si2N(2) = ratio_Si2N_sp +! R_Si2N(3) = ratio_Si2N_phaeo R_S2N(1) = ratio_S2N_diatoms R_S2N(2) = ratio_S2N_sp @@ -1767,33 +1759,33 @@ subroutine init_zbgc R_Fe2DOC(2) = ratio_Fe2DOC_l R_Fe2DOC(3) = c0 - chlabs(1) = chlabs_diatoms - chlabs(2) = chlabs_sp - chlabs(3) = chlabs_phaeo +! chlabs(1) = chlabs_diatoms +! chlabs(2) = chlabs_sp +! chlabs(3) = chlabs_phaeo - alpha2max_low(1) = alpha2max_low_diatoms - alpha2max_low(2) = alpha2max_low_sp - alpha2max_low(3) = alpha2max_low_phaeo +! alpha2max_low(1) = alpha2max_low_diatoms +! alpha2max_low(2) = alpha2max_low_sp +! alpha2max_low(3) = alpha2max_low_phaeo - beta2max(1) = beta2max_diatoms - beta2max(2) = beta2max_sp - beta2max(3) = beta2max_phaeo +! beta2max(1) = beta2max_diatoms +! beta2max(2) = beta2max_sp +! beta2max(3) = beta2max_phaeo - mu_max(1) = mu_max_diatoms - mu_max(2) = mu_max_sp - mu_max(3) = mu_max_phaeo +! mu_max(1) = mu_max_diatoms +! mu_max(2) = mu_max_sp +! mu_max(3) = mu_max_phaeo - grow_Tdep(1) = grow_Tdep_diatoms - grow_Tdep(2) = grow_Tdep_sp - grow_Tdep(3) = grow_Tdep_phaeo +! grow_Tdep(1) = grow_Tdep_diatoms +! grow_Tdep(2) = grow_Tdep_sp +! grow_Tdep(3) = grow_Tdep_phaeo - fr_graze(1) = fr_graze_diatoms - fr_graze(2) = fr_graze_sp - fr_graze(3) = fr_graze_phaeo +! fr_graze(1) = fr_graze_diatoms +! fr_graze(2) = fr_graze_sp +! fr_graze(3) = fr_graze_phaeo - mort_pre(1) = mort_pre_diatoms - mort_pre(2) = mort_pre_sp - mort_pre(3) = mort_pre_phaeo +! mort_pre(1) = mort_pre_diatoms +! mort_pre(2) = mort_pre_sp +! mort_pre(3) = mort_pre_phaeo mort_Tdep(1) = mort_Tdep_diatoms mort_Tdep(2) = mort_Tdep_sp @@ -1856,7 +1848,7 @@ subroutine init_zbgc R_chl2N_in=R_chl2N, F_abs_chl_in=F_abs_chl, R_Fe2DON_in=R_Fe2DON, R_Fe2DOC_in=R_Fe2DOC, & mort_Tdep_in=mort_Tdep, k_exude_in=k_exude, & K_Nit_in=K_Nit, K_Am_in=K_Am, K_sil_in=K_Sil, K_Fe_in=K_Fe, & - f_don_in=f_don, kn_bac_in=kn_bac, f_don_Am_in=f_don, f_exude_in=f_exude, k_bac_in=k_bac, & + f_don_in=f_don, kn_bac_in=kn_bac, f_don_Am_in=f_don_Am, f_exude_in=f_exude, k_bac_in=k_bac, & fr_resp_in=fr_resp, algal_vel_in=algal_vel, R_dFe2dust_in=R_dFe2dust, & dustFe_sol_in=dustFe_sol, T_max_in=T_max, fr_mort2min_in=fr_mort2min, fr_dFe_in=fr_dFe, & op_dep_min_in=op_dep_min, fr_graze_s_in=fr_graze_s, fr_graze_e_in=fr_graze_e, & diff --git a/cicecore/shared/ice_kinds_mod.F90 b/cicecore/shared/ice_kinds_mod.F90 index ae416be70..4124f2594 100644 --- a/cicecore/shared/ice_kinds_mod.F90 +++ b/cicecore/shared/ice_kinds_mod.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_kinds_mod.F90 1226 2017-05-22 22:45:03Z tcraig $ !======================================================================= ! Defines variable precision for all common data types diff --git a/cicecore/shared/ice_restart_column.F90 b/cicecore/shared/ice_restart_column.F90 index 1e0ac2f16..63d095f11 100644 --- a/cicecore/shared/ice_restart_column.F90 +++ b/cicecore/shared/ice_restart_column.F90 @@ -1,4 +1,3 @@ -! SVN:$Id: ice_restart_column.F90 1228 2017-05-23 21:33:34Z tcraig $ !========================================================================= ! ! Restart routines for the column package. @@ -13,7 +12,7 @@ module ice_restart_column use ice_communicate, only: my_task, master_task use ice_constants, only: c0, c1, p5 use ice_constants, only: field_loc_center, field_type_scalar - use ice_domain_size, only: ncat, nilyr, nslyr, max_blocks, nblyr + use ice_domain_size, only: ncat, nblyr use ice_restart,only: read_restart_field, write_restart_field use ice_exit, only: abort_ice use ice_fileunits, only: nu_diag @@ -729,7 +728,7 @@ end subroutine write_restart_hbrine subroutine write_restart_bgc() use ice_arrays_column, only: Rayleigh_criteria, Rayleigh_real - use ice_blocks, only: block, get_block, nx_block, ny_block + use ice_blocks, only: block, get_block use ice_domain, only: nblocks, blocks_ice use ice_domain_size, only: ncat, n_algae, n_doc, n_dic, & n_don, n_zaero, n_fed, n_fep @@ -747,8 +746,6 @@ subroutine write_restart_bgc() mm , & ! n_algae ilo,ihi,jlo,jhi ! beginning and end of physical domain - real (kind=dbl_kind) :: cszn ! counter for history averaging - logical (kind=log_kind) :: diag character (len=3) :: nchar, ncharb diff --git a/cicecore/shared/ice_restart_shared.F90 b/cicecore/shared/ice_restart_shared.F90 index d0943a604..82b82c5ce 100644 --- a/cicecore/shared/ice_restart_shared.F90 +++ b/cicecore/shared/ice_restart_shared.F90 @@ -1,12 +1,8 @@ -! SVN:$Id: ice_restart_shared.F90 607 2013-03-29 15:49:42Z eclare $ !======================================================================= module ice_restart_shared use ice_kinds_mod - use ice_fileunits, only: nu_diag - use ice_exit, only: abort_ice - use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted implicit none private diff --git a/cicecore/shared/ice_spacecurve.F90 b/cicecore/shared/ice_spacecurve.F90 index 6b5662274..ed108e1c7 100644 --- a/cicecore/shared/ice_spacecurve.F90 +++ b/cicecore/shared/ice_spacecurve.F90 @@ -8,7 +8,6 @@ module ice_spacecurve ! create space-filling curves. ! ! !REVISION HISTORY: -! SVN:$Id: ice_spacecurve.F90 1228 2017-05-23 21:33:34Z tcraig $ ! ! author: John Dennis, NCAR @@ -124,6 +123,7 @@ recursive function Cinco(l,type,ma,md,ja,jd) result(ierr) character(len=*),parameter :: subname='(Cinco)' !----------------------------------------------------------------------- + ltype = type ll = l if(ll .gt. 1) ltype = fact%factors(ll-1) ! Set the next type of space curve @@ -638,6 +638,7 @@ recursive function PeanoM(l,type,ma,md,ja,jd) result(ierr) !----------------------------------------------------------------------- + ltype = type ll = l if(ll .gt. 1) ltype = fact%factors(ll-1) ! Set the next type of space curve !-------------------------------------------------------------- @@ -862,6 +863,7 @@ recursive function Hilbert(l,type,ma,md,ja,jd) result(ierr) character(len=*),parameter :: subname='(Hilbert)' !----------------------------------------------------------------------- + ltype = type ll = l if(ll .gt. 1) ltype = fact%factors(ll-1) ! Set the next type of space curve !-------------------------------------------------------------- diff --git a/configuration/scripts/machines/Macros.hobart_intel b/configuration/scripts/machines/Macros.hobart_intel index a01582f86..f4176eaf1 100755 --- a/configuration/scripts/machines/Macros.hobart_intel +++ b/configuration/scripts/machines/Macros.hobart_intel @@ -15,7 +15,7 @@ FC_AUTO_R8 := -r8 FFLAGS_NOOPT:= ifeq ($(ICE_BLDDEBUG), true) - FFLAGS := -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created + FFLAGS := -qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created endif ifeq ($(ICE_COMMDIR), mpi) @@ -29,9 +29,7 @@ MPICC:= mpicc MPIFC:= mpif90 LD:= $(MPIFC) -NETCDF_PATH := /usr/local/netcdf-intel-cluster - -INCLDIR := -I/usr/local/netcdf-intel-cluster/include -I/usr/mpi/intel/mvapich2-2.1-qlc/include +INCLDIR := -I$(NETCDF_PATH)/include -I$(MPI_PATH)/include LIB_NETCDF := $(NETCDF_PATH)/lib LIB_PNETCDF := $(PNETCDF_PATH)/lib diff --git a/configuration/scripts/machines/Macros.hobart_nag b/configuration/scripts/machines/Macros.hobart_nag index feb4b45f0..a7f973a69 100755 --- a/configuration/scripts/machines/Macros.hobart_nag +++ b/configuration/scripts/machines/Macros.hobart_nag @@ -29,9 +29,7 @@ MPICC:= mpicc MPIFC:= mpif90 LD:= $(MPIFC) -NETCDF_PATH := /usr/local/netcdf_c-4.3.2_f-4.4.1-nag-6.0 - -INCLDIR := -I/usr/local/netcdf_c-4.3.2_f-4.4.1-nag-6.0/include -I/cluster/mvapich2-2.2rc1-gcc-g++-4.8.5-nag-6.1/include +INCLDIR := -I$(NETCDF_PATH)/include -I$(MPI_PATH)/include LIB_NETCDF := $(NETCDF_PATH)/lib LIB_PNETCDF := $(PNETCDF_PATH)/lib diff --git a/configuration/scripts/machines/env.hobart_intel b/configuration/scripts/machines/env.hobart_intel index 9d2dd6cf0..fa06d9ec6 100755 --- a/configuration/scripts/machines/env.hobart_intel +++ b/configuration/scripts/machines/env.hobart_intel @@ -3,7 +3,7 @@ source /usr/share/Modules/init/csh module purge -module load compiler/intel/default +module load compiler/intel/18.0.3 setenv ICE_MACHINE_ENVNAME hobart setenv ICE_MACHINE_COMPILER ifort diff --git a/configuration/scripts/machines/env.hobart_nag b/configuration/scripts/machines/env.hobart_nag index a1bb008ba..62dc6c69c 100755 --- a/configuration/scripts/machines/env.hobart_nag +++ b/configuration/scripts/machines/env.hobart_nag @@ -3,7 +3,7 @@ source /usr/share/Modules/init/csh module purge -module load compiler/nag/6.1 +module load compiler/nag/6.2 setenv ICE_MACHINE_ENVNAME hobart setenv ICE_MACHINE_COMPILER nag diff --git a/doc/source/master_list.bib b/doc/source/master_list.bib index d3be30f54..0e2f96cb5 100644 --- a/doc/source/master_list.bib +++ b/doc/source/master_list.bib @@ -1,6 +1,4 @@ %======================================================================= -% SVN: $Id: master_list.bib 5 2005-12-12 17:41:05Z mvr $ -%======================================================================= % **************************************** % * File: SAMPLE.BIB * % **************************************** diff --git a/icepack b/icepack index 34224289a..49a1cc9b7 160000 --- a/icepack +++ b/icepack @@ -1 +1 @@ -Subproject commit 34224289affc597bd49cdbc03465dadf90f65659 +Subproject commit 49a1cc9b76b05034cd12b404f93447bfdf8c355b From 7668f09eceed6187748d84c6b0ff04d3e1f60bb9 Mon Sep 17 00:00:00 2001 From: Tony Craig Date: Tue, 25 Sep 2018 00:00:42 -0700 Subject: [PATCH 8/8] fix ice_abort error in ice_state.F90 (#5) --- cicecore/cicedynB/general/ice_state.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/cicecore/cicedynB/general/ice_state.F90 b/cicecore/cicedynB/general/ice_state.F90 index 27211f49e..44aa16d4c 100644 --- a/cicecore/cicedynB/general/ice_state.F90 +++ b/cicecore/cicedynB/general/ice_state.F90 @@ -38,6 +38,7 @@ module ice_state use ice_kinds_mod use ice_domain_size, only: max_blocks, ncat, max_ntrcr use ice_blocks, only: nx_block, ny_block + use ice_exit, only: abort_ice implicit none private