Skip to content

Commit

Permalink
Refactor tracer initialization (CICE-Consortium#235)
Browse files Browse the repository at this point in the history
* separated namelist and tracer count from init_zbgc into input_zbgc

* rearranged zbgc initialization, and namelist tracers iage, FY, lvl, pnd

* input_data and init_zbgc split into 6 routines and rearranged

* recombined input_zbgc2 with init_zbgc

* minor cleanup

* minor cleanup

* update icepack

* create count_tracers subroutine

* eliminate max_ntrcr

* remove max_nsw, n_bgc, nltrcr, n_trbgcz, n_trzs, n_trzaero, n_trbri, n_trbgcs

* standardize subroutine argument definitions on single line, remove dead code, add input init aborts for bgc

* update alt01 test, update some input checks

* minor cleanup

* minor updates

* update alt01 and alt04 tests, add new debug tests, minor fixes
  • Loading branch information
eclare108213 authored and apcraig committed Nov 16, 2018
1 parent 8586cd1 commit 8b0ae03
Show file tree
Hide file tree
Showing 40 changed files with 3,456 additions and 1,352 deletions.
6 changes: 2 additions & 4 deletions cicecore/cicedynB/analysis/ice_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1131,8 +1131,7 @@ subroutine total_energy (work)
use ice_grid, only: tmask
use ice_state, only: vicen, vsnon, trcrn

real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), &
intent(out) :: &
real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), intent(out) :: &
work ! total energy

! local variables
Expand Down Expand Up @@ -1219,8 +1218,7 @@ subroutine total_salt (work)
use ice_grid, only: tmask
use ice_state, only: vicen, trcrn

real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), &
intent(out) :: &
real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks), intent(out) :: &
work ! total salt

! local variables
Expand Down
12 changes: 4 additions & 8 deletions cicecore/cicedynB/analysis/ice_history_shared.F90
Original file line number Diff line number Diff line change
Expand Up @@ -725,9 +725,8 @@ subroutine define_hist_field(id, vname, vunit, vcoord, vcellmeas, &
ns, vhistfreq)

use ice_calendar, only: histfreq, histfreq_n
use ice_domain_size, only: max_nstrm

integer (int_kind), dimension(max_nstrm), intent(out) :: &
integer (int_kind), dimension(:), intent(out) :: & ! max_nstrm
id ! location in avail_fields array for use in
! later routines

Expand Down Expand Up @@ -833,10 +832,9 @@ subroutine accum_hist_field_2D(id, iblk, field_accum, field)
use ice_blocks, only: block, get_block
use ice_calendar, only: nstreams
use ice_domain, only: blocks_ice
use ice_domain_size, only: max_nstrm
use ice_grid, only: tmask

integer (int_kind), dimension(max_nstrm), intent(in) :: &
integer (int_kind), dimension(:), intent(in) :: & ! max_nstrm
id ! location in avail_fields array for use in
! later routines

Expand Down Expand Up @@ -894,10 +892,9 @@ subroutine accum_hist_field_3D(id, iblk, ndim, field_accum, field)
use ice_blocks, only: block, get_block
use ice_calendar, only: nstreams
use ice_domain, only: blocks_ice
use ice_domain_size, only: max_nstrm
use ice_grid, only: tmask

integer (int_kind), dimension(max_nstrm), intent(in) :: &
integer (int_kind), dimension(:), intent(in) :: & ! max_nstrm
id ! location in avail_fields array for use in
! later routines

Expand Down Expand Up @@ -960,10 +957,9 @@ subroutine accum_hist_field_4D(id, iblk, ndim3, ndim4, field_accum, field)
use ice_blocks, only: block, get_block
use ice_calendar, only: nstreams
use ice_domain, only: blocks_ice
use ice_domain_size, only: max_nstrm
use ice_grid, only: tmask

integer (int_kind), dimension(max_nstrm), intent(in) :: &
integer (int_kind), dimension(:), intent(in) :: & ! max_nstrm
id ! location in avail_fields array for use in
! later routines

Expand Down
24 changes: 8 additions & 16 deletions cicecore/cicedynB/dynamics/ice_dyn_eap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1204,8 +1204,7 @@ subroutine stress_eap (nx_block, ny_block, &
ndte , & ! number of subcycles
icellt ! no. of cells where icetmask = 1

integer (kind=int_kind), dimension (nx_block*ny_block), &
intent(in) :: &
integer (kind=int_kind), dimension (nx_block*ny_block), intent(in) :: &
indxti , & ! compressed index in i-direction
indxtj ! compressed index in j-direction

Expand All @@ -1227,19 +1226,16 @@ subroutine stress_eap (nx_block, ny_block, &
cxm , & ! 0.5*HTN - 1.5*HTN
tarear ! 1/tarea

real (kind=dbl_kind), dimension (nx_block,ny_block), &
intent(inout) :: &
real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: &
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

real (kind=dbl_kind), dimension (nx_block,ny_block), &
intent(inout) :: &
real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: &
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), &
intent(inout) :: &
real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: &
shear , & ! strain rate II component (1/s)
divu , & ! strain rate I component, velocity divergence (1/s)
e11 , & ! components of strain rate tensor (1/s)
Expand All @@ -1254,8 +1250,7 @@ subroutine stress_eap (nx_block, ny_block, &
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) :: &
real (kind=dbl_kind), dimension(nx_block,ny_block,8), intent(out) :: &
strtmp ! stress combinations

! local variables
Expand Down Expand Up @@ -1809,20 +1804,17 @@ subroutine stepa (nx_block, ny_block, &
real (kind=dbl_kind), intent(in) :: &
dtei ! 1/dte, where dte is subcycling timestep (1/s)

integer (kind=int_kind), dimension (nx_block*ny_block), &
intent(in) :: &
integer (kind=int_kind), dimension (nx_block*ny_block), intent(in) :: &
indxti , & ! compressed index in i-direction
indxtj ! compressed index in j-direction

real (kind=dbl_kind), dimension (nx_block,ny_block), &
intent(in) :: &
real (kind=dbl_kind), dimension (nx_block,ny_block), intent(in) :: &
! ice stress tensor (kg/s^2) in each corner of T cell
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

real (kind=dbl_kind), dimension (nx_block,ny_block), &
intent(inout) :: &
real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: &
! structure tensor () in each corner of T cell
a11, a12, a11_1, a11_2, a11_3, a11_4, & ! components of
a12_1, a12_2, a12_3, a12_4 ! structure tensor ()
Expand Down
12 changes: 4 additions & 8 deletions cicecore/cicedynB/dynamics/ice_dyn_evp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,7 @@ subroutine stress (nx_block, ny_block, &
ksub , & ! subcycling step
icellt ! no. of cells where icetmask = 1

integer (kind=int_kind), dimension (nx_block*ny_block), &
intent(in) :: &
integer (kind=int_kind), dimension (nx_block*ny_block), intent(in) :: &
indxti , & ! compressed index in i-direction
indxtj ! compressed index in j-direction

Expand All @@ -575,21 +574,18 @@ subroutine stress (nx_block, ny_block, &
tarear , & ! 1/tarea
tinyarea ! puny*tarea

real (kind=dbl_kind), dimension (nx_block,ny_block), &
intent(inout) :: &
real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: &
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

real (kind=dbl_kind), dimension (nx_block,ny_block), &
intent(inout) :: &
real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: &
shear , & ! strain rate II component (1/s)
divu , & ! strain rate I component, velocity divergence (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) :: &
real (kind=dbl_kind), dimension(nx_block,ny_block,8), intent(out) :: &
str ! stress combinations

! local variables
Expand Down
57 changes: 19 additions & 38 deletions cicecore/cicedynB/dynamics/ice_dyn_shared.F90
Original file line number Diff line number Diff line change
Expand Up @@ -297,26 +297,22 @@ subroutine dyn_prep1 (nx_block, ny_block, &
nx_block, ny_block, & ! block dimensions
ilo,ihi,jlo,jhi ! beginning and end of physical domain

real (kind=dbl_kind), dimension (nx_block,ny_block), &
intent(in) :: &
real (kind=dbl_kind), dimension (nx_block,ny_block), intent(in) :: &
aice , & ! concentration of ice
vice , & ! volume per unit area of ice (m)
vsno , & ! volume per unit area of snow (m)
strairxT, & ! stress on ice by air, x-direction
strairyT ! stress on ice by air, y-direction

logical (kind=log_kind), dimension (nx_block,ny_block), &
intent(in) :: &
logical (kind=log_kind), dimension (nx_block,ny_block), intent(in) :: &
tmask ! land/boundary mask, thickness (T-cell)

real (kind=dbl_kind), dimension (nx_block,ny_block), &
intent(out) :: &
real (kind=dbl_kind), dimension (nx_block,ny_block), intent(out) :: &
strairx , & ! stress on ice by air, x-direction
strairy , & ! stress on ice by air, y-direction
tmass ! total mass of ice and snow (kg/m^2)

integer (kind=int_kind), dimension (nx_block,ny_block), &
intent(out) :: &
integer (kind=int_kind), dimension (nx_block,ny_block), intent(out) :: &
icetmask ! ice extent mask (T-cell)

! local variables
Expand Down Expand Up @@ -439,23 +435,19 @@ subroutine dyn_prep2 (nx_block, ny_block, &
icellt , & ! no. of cells where icetmask = 1
icellu ! no. of cells where iceumask = 1

integer (kind=int_kind), dimension (nx_block*ny_block), &
intent(out) :: &
integer (kind=int_kind), dimension (nx_block*ny_block), intent(out) :: &
indxti , & ! compressed index in i-direction
indxtj , & ! compressed index in j-direction
indxui , & ! compressed index in i-direction
indxuj ! compressed index in j-direction

logical (kind=log_kind), dimension (nx_block,ny_block), &
intent(in) :: &
logical (kind=log_kind), dimension (nx_block,ny_block), intent(in) :: &
umask ! land/boundary mask, thickness (U-cell)

integer (kind=int_kind), dimension (nx_block,ny_block), &
intent(in) :: &
integer (kind=int_kind), dimension (nx_block,ny_block), intent(in) :: &
icetmask ! ice extent mask (T-cell)

logical (kind=log_kind), dimension (nx_block,ny_block), &
intent(inout) :: &
logical (kind=log_kind), dimension (nx_block,ny_block), intent(inout) :: &
iceumask ! ice extent mask (U-cell)

real (kind=dbl_kind), dimension (nx_block,ny_block), intent(in) :: &
Expand All @@ -472,8 +464,7 @@ subroutine dyn_prep2 (nx_block, ny_block, &
real (kind=dbl_kind), intent(in) :: &
dt ! time step

real (kind=dbl_kind), dimension (nx_block,ny_block), &
intent(out) :: &
real (kind=dbl_kind), dimension (nx_block,ny_block), intent(out) :: &
Tbu, & ! coefficient for basal stress (N/m^2)
uvel_init,& ! x-component of velocity (m/s), beginning of time step
vvel_init,& ! y-component of velocity (m/s), beginning of time step
Expand All @@ -483,8 +474,7 @@ subroutine dyn_prep2 (nx_block, ny_block, &
forcex , & ! work array: combined atm stress and ocn tilt, x
forcey ! work array: combined atm stress and ocn tilt, y

real (kind=dbl_kind), dimension (nx_block,ny_block), &
intent(inout) :: &
real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: &
fm , & ! Coriolis param. * mass in U-cell (kg/s)
stressp_1, stressp_2, stressp_3, stressp_4 , & ! sigma11+sigma22
stressm_1, stressm_2, stressm_3, stressm_4 , & ! sigma11-sigma22
Expand Down Expand Up @@ -683,8 +673,7 @@ subroutine stepu (nx_block, ny_block, &
icellu, & ! total count when iceumask is true
ksub ! subcycling iteration

integer (kind=int_kind), dimension (nx_block*ny_block), &
intent(in) :: &
integer (kind=int_kind), dimension (nx_block*ny_block), intent(in) :: &
indxui , & ! compressed index in i-direction
indxuj ! compressed index in j-direction

Expand All @@ -703,26 +692,22 @@ subroutine stepu (nx_block, ny_block, &
fm , & ! Coriolis param. * mass in U-cell (kg/s)
uarear ! 1/uarea

real (kind=dbl_kind), dimension(nx_block,ny_block,8), &
intent(in) :: &
real (kind=dbl_kind), dimension(nx_block,ny_block,8), intent(in) :: &
str

real (kind=dbl_kind), dimension (nx_block,ny_block), &
intent(inout) :: &
real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: &
uvel , & ! x-component of velocity (m/s)
vvel ! y-component of velocity (m/s)

real (kind=dbl_kind), dimension (nx_block,ny_block), &
intent(inout) :: &
real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: &
strocnx , & ! ice-ocean stress, x-direction
strocny , & ! ice-ocean stress, y-direction
strintx , & ! divergence of internal ice stress, x (N/m^2)
strinty , & ! divergence of internal ice stress, y (N/m^2)
taubx , & ! basal stress, x-direction (N/m^2)
tauby ! basal stress, y-direction (N/m^2)

real (kind=dbl_kind), dimension (nx_block,ny_block), &
intent(inout) :: &
real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: &
Cw ! ocean-ice neutral drag coefficient

! local variables
Expand Down Expand Up @@ -830,8 +815,7 @@ subroutine dyn_finish (nx_block, ny_block, &
nx_block, ny_block, & ! block dimensions
icellu ! total count when iceumask is true

integer (kind=int_kind), dimension (nx_block*ny_block), &
intent(in) :: &
integer (kind=int_kind), dimension (nx_block*ny_block), intent(in) :: &
indxui , & ! compressed index in i-direction
indxuj ! compressed index in j-direction

Expand All @@ -847,8 +831,7 @@ subroutine dyn_finish (nx_block, ny_block, &
strairx , & ! stress on ice by air, x-direction
strairy ! stress on ice by air, y-direction

real (kind=dbl_kind), dimension (nx_block,ny_block), &
intent(inout) :: &
real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: &
strocnx , & ! ice-ocean stress, x-direction
strocny , & ! ice-ocean stress, y-direction
strocnxT, & ! ice-ocean stress, x-direction
Expand All @@ -860,8 +843,7 @@ subroutine dyn_finish (nx_block, ny_block, &
i, j, ij

real (kind=dbl_kind) :: vrel, rhow
real (kind=dbl_kind), dimension (nx_block,ny_block), &
intent(inout) :: &
real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: &
Cw ! ocean-ice neutral drag coefficient

character(len=*), parameter :: subname = '(dyn_finish)'
Expand Down Expand Up @@ -938,8 +920,7 @@ subroutine basal_stress_coeff (nx_block, ny_block, &
nx_block, ny_block, & ! block dimensions
icellu ! no. of cells where icetmask = 1

integer (kind=int_kind), dimension (nx_block*ny_block), &
intent(in) :: &
integer (kind=int_kind), dimension (nx_block*ny_block), intent(in) :: &
indxui , & ! compressed index in i-direction
indxuj ! compressed index in j-direction

Expand Down
Loading

0 comments on commit 8b0ae03

Please sign in to comment.