Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ice ridging from Icepack #147

Merged
merged 17 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 136 additions & 0 deletions config_src/external/Icepack_interfaces/icepack_itd.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
module icepack_itd

use icepack_kinds
! use icepack_parameters, only: c0, c1, c2, c3, c15, c25, c100, p1, p01, p001, p5, puny
! use icepack_parameters, only: Lfresh, rhos, ice_ref_salinity, hs_min, cp_ice, Tocnfrz, rhoi
! use icepack_parameters, only: rhosi, sk_l, hs_ssl, min_salin
! use icepack_tracers, only: nt_Tsfc, nt_qice, nt_qsno, nt_aero, nt_isosno, nt_isoice
! use icepack_tracers, only: nt_apnd, nt_hpnd, nt_fbri, tr_brine, nt_bgc_S, bio_index
! use icepack_tracers, only: n_iso
! use icepack_tracers, only: tr_iso
! use icepack_tracers, only: icepack_compute_tracers
! use icepack_parameters, only: solve_zsal, skl_bgc, z_tracers
! use icepack_parameters, only: kcatbound, kitd
! use icepack_therm_shared, only: Tmin, hi_min
! use icepack_warnings, only: warnstr, icepack_warnings_add
! use icepack_warnings, only: icepack_warnings_setabort, icepack_warnings_aborted
! use icepack_zbgc_shared,only: zap_small_bgc

implicit none

private
public :: cleanup_itd ,icepack_init_itd



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

contains

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

subroutine icepack_init_itd(ncat, hin_max)

integer (kind=int_kind), intent(in) :: &
ncat ! number of thickness categories

real (kind=dbl_kind), intent(out) :: &
hin_max(0:ncat) ! category limits (m)


end subroutine icepack_init_itd

subroutine cleanup_itd (dt, ntrcr, &
nilyr, nslyr, &
ncat, hin_max, &
aicen, trcrn, &
vicen, vsnon, &
aice0, aice, &
n_aero, &
nbtrcr, nblyr, &
tr_aero, &
tr_pond_topo, &
heat_capacity, &
first_ice, &
trcr_depend, trcr_base, &
n_trcr_strata,nt_strata, &
fpond, fresh, &
fsalt, fhocn, &
faero_ocn, fiso_ocn, &
fzsal, &
flux_bio, limit_aice_in)

integer (kind=int_kind), intent(in) :: &
ncat , & ! number of thickness categories
nilyr , & ! number of ice layers
nblyr , & ! number of bio layers
nslyr , & ! number of snow layers
ntrcr , & ! number of tracers in use
nbtrcr, & ! number of bio tracers in use
n_aero ! number of aerosol tracers

real (kind=dbl_kind), intent(in) :: &
dt ! time step

real (kind=dbl_kind), dimension(0:ncat), intent(in) :: &
hin_max ! category boundaries (m)

real (kind=dbl_kind), dimension (:), intent(inout) :: &
aicen , & ! concentration of ice
vicen , & ! volume per unit area of ice (m)
vsnon ! volume per unit area of snow (m)

real (kind=dbl_kind), dimension (:,:), intent(inout) :: &
trcrn ! ice tracers

real (kind=dbl_kind), intent(inout) :: &
aice , & ! total ice concentration
aice0 ! concentration of open water

integer (kind=int_kind), dimension (:), intent(in) :: &
trcr_depend, & ! = 0 for aicen tracers, 1 for vicen, 2 for vsnon
n_trcr_strata ! number of underlying tracer layers

real (kind=dbl_kind), dimension (:,:), intent(in) :: &
trcr_base ! = 0 or 1 depending on tracer dependency
! argument 2: (1) aice, (2) vice, (3) vsno

integer (kind=int_kind), dimension (:,:), intent(in) :: &
nt_strata ! indices of underlying tracer layers

logical (kind=log_kind), intent(in) :: &
tr_aero, & ! aerosol flag
tr_pond_topo, & ! topo pond flag
heat_capacity ! if false, ice and snow have zero heat capacity

logical (kind=log_kind), dimension(ncat), intent(inout) :: &
first_ice ! For bgc and S tracers. set to true if zapping ice.

! ice-ocean fluxes (required for strict conservation)

real (kind=dbl_kind), intent(inout), optional :: &
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)
fhocn , & ! net heat flux to ocean (W/m^2)
fzsal ! net salt flux to ocean from zsalinity (kg/m^2/s)

real (kind=dbl_kind), dimension (:), intent(inout), optional :: &
flux_bio ! net tracer flux to ocean from biology (mmol/m^2/s)

real (kind=dbl_kind), dimension (:), intent(inout), optional :: &
faero_ocn ! aerosol flux to ocean (kg/m^2/s)

real (kind=dbl_kind), dimension (:), intent(inout) :: &
fiso_ocn ! isotope flux to ocean (kg/m^2/s)

logical (kind=log_kind), intent(in), optional :: &
limit_aice_in ! if false, allow aice to be out of bounds
! may want to allow this for unit tests


end subroutine cleanup_itd

end module icepack_itd

!=======================================================================
38 changes: 38 additions & 0 deletions config_src/external/Icepack_interfaces/icepack_kinds.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
!=======================================================================

! Defines variable precision for all common data types
! Code originally based on kinds_mod.F in POP
!
! author: Elizabeth C. Hunke and William H. Lipscomb, LANL
! 2006: ECH converted to free source form (F90)
! 2020: TC added support for NO_I8 and NO_R16

module icepack_kinds

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

implicit none
public

integer, parameter :: char_len = 80, &
char_len_long = 256, &
log_kind = kind(.true.), &
int_kind = selected_int_kind(6), &
#if defined (NO_I8)
int8_kind = selected_int_kind(6), &
#else
int8_kind = selected_int_kind(13), &
#endif
real_kind = selected_real_kind(6), &
dbl_kind = selected_real_kind(13), &
#if defined (NO_R16)
r16_kind = selected_real_kind(13)
#else
r16_kind = selected_real_kind(33,4931)
#endif

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

end module icepack_kinds

!=======================================================================
194 changes: 194 additions & 0 deletions config_src/external/Icepack_interfaces/icepack_mechred.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
module icepack_mechred

use icepack_kinds
use icepack_tracers, only : n_iso, n_aero

implicit none

private
public :: ridge_ice
contains

subroutine ridge_ice (dt, ndtd, &
ncat, n_aero, &
nilyr, nslyr, &
ntrcr, hin_max, &
rdg_conv, rdg_shear, &
aicen, trcrn, &
vicen, vsnon, &
aice0, &
trcr_depend, trcr_base, &
n_trcr_strata, &
nt_strata, &
krdg_partic, krdg_redist,&
mu_rdg, tr_brine, &
dardg1dt, dardg2dt, &
dvirdgdt, opening, &
fpond, &
fresh, fhocn, &
faero_ocn, fiso_ocn, &
aparticn, krdgn, &
aredistn, vredistn, &
dardg1ndt, dardg2ndt, &
dvirdgndt, &
araftn, vraftn, &
closing_flag,closing )

integer (kind=int_kind), intent(in) :: &
ndtd , & ! number of dynamics subcycles
ncat , & ! number of thickness categories
nilyr , & ! number of ice layers
nslyr , & ! number of snow layers
n_aero, & ! number of aerosol tracers
ntrcr ! number of tracers in use

real (kind=dbl_kind), intent(in) :: &
mu_rdg , & ! gives e-folding scale of ridged ice (m^.5)
dt ! time step

real (kind=dbl_kind), dimension(0:ncat), intent(inout) :: &
hin_max ! category limits (m)

real (kind=dbl_kind), intent(in) :: &
rdg_conv , & ! normalized energy dissipation due to convergence (1/s)
rdg_shear ! normalized energy dissipation due to shear (1/s)

real (kind=dbl_kind), dimension (:), intent(inout) :: &
aicen , & ! concentration of ice
vicen , & ! volume per unit area of ice (m)
vsnon ! volume per unit area of snow (m)

real (kind=dbl_kind), dimension (:,:), intent(inout) :: &
trcrn ! ice tracers

real (kind=dbl_kind), intent(inout) :: &
aice0 ! concentration of open water

integer (kind=int_kind), dimension (:), intent(in) :: &
trcr_depend, & ! = 0 for aicen tracers, 1 for vicen, 2 for vsnon
n_trcr_strata ! number of underlying tracer layers

real (kind=dbl_kind), dimension (:,:), intent(in) :: &
trcr_base ! = 0 or 1 depending on tracer dependency
! argument 2: (1) aice, (2) vice, (3) vsno

integer (kind=int_kind), dimension (:,:), intent(in) :: &
nt_strata ! indices of underlying tracer layers

integer (kind=int_kind), intent(in) :: &
krdg_partic, & ! selects participation function
krdg_redist ! selects redistribution function

logical (kind=log_kind), intent(in) :: &
closing_flag, &! flag if closing is valid
tr_brine ! if .true., brine height differs from ice thickness

! optional history fields
real (kind=dbl_kind), intent(inout), optional :: &
dardg1dt , & ! rate of fractional area loss by ridging ice (1/s)
dardg2dt , & ! rate of fractional area gain by new ridges (1/s)
dvirdgdt , & ! rate of ice volume ridged (m/s)
opening , & ! rate of opening due to divergence/shear (1/s)
closing , & ! rate of closing due to divergence/shear (1/s)
fpond , & ! fresh water flux to ponds (kg/m^2/s)
fresh , & ! fresh water flux to ocean (kg/m^2/s)
fhocn ! net heat flux to ocean (W/m^2)

real (kind=dbl_kind), dimension(:), intent(inout), optional :: &
dardg1ndt , & ! rate of fractional area loss by ridging ice (1/s)
dardg2ndt , & ! rate of fractional area gain by new ridges (1/s)
dvirdgndt , & ! rate of ice volume ridged (m/s)
aparticn , & ! participation function
krdgn , & ! mean ridge thickness/thickness of ridging ice
araftn , & ! rafting ice area
vraftn , & ! rafting ice volume
aredistn , & ! redistribution function: fraction of new ridge area
vredistn ! redistribution function: fraction of new ridge volume

real (kind=dbl_kind), dimension(:), intent(inout), optional :: &
faero_ocn ! aerosol flux to ocean (kg/m^2/s)

real (kind=dbl_kind), dimension(:), intent(inout), optional :: &
fiso_ocn ! isotope flux to ocean (kg/m^2/s)

! local variables

real (kind=dbl_kind), dimension (ncat) :: &
eicen ! energy of melting for each ice layer (J/m^2)

real (kind=dbl_kind), dimension (ncat) :: &
esnon, & ! energy of melting for each snow layer (J/m^2)
vbrin, & ! ice volume with defined by brine height (m)
sicen ! Bulk salt in h ice (ppt*m)

real (kind=dbl_kind) :: &
asum , & ! sum of ice and open water area
aksum , & ! ratio of area removed to area ridged
msnow_mlt , & ! mass of snow added to ocean (kg m-2)
esnow_mlt , & ! energy needed to melt snow in ocean (J m-2)
mpond , & ! mass of pond added to ocean (kg m-2)
closing_net, & ! net rate at which area is removed (1/s)
! (ridging ice area - area of new ridges) / dt
divu_adv , & ! divu as implied by transport scheme (1/s)
opning , & ! rate of opening due to divergence/shear
! opning is a local variable;
! opening is the history diagnostic variable
ardg1 , & ! fractional area loss by ridging ice
ardg2 , & ! fractional area gain by new ridges
virdg , & ! ice volume ridged
aopen ! area opening due to divergence/shear

real (kind=dbl_kind), dimension (n_aero) :: &
maero ! aerosol mass added to ocean (kg m-2)

real (kind=dbl_kind), dimension (n_iso) :: &
miso ! isotope mass added to ocean (kg m-2)

real (kind=dbl_kind), dimension (0:ncat) :: &
apartic ! participation function; fraction of ridging
! and closing associated w/ category n

real (kind=dbl_kind), dimension (ncat) :: &
hrmin , & ! minimum ridge thickness
hrmax , & ! maximum ridge thickness (krdg_redist = 0)
hrexp , & ! ridge e-folding thickness (krdg_redist = 1)
krdg , & ! mean ridge thickness/thickness of ridging ice
ardg1n , & ! area of ice ridged
ardg2n , & ! area of new ridges
virdgn , & ! ridging ice volume
mraftn ! rafting ice mask

real (kind=dbl_kind) :: &
vice_init, vice_final, & ! ice volume summed over categories
vsno_init, vsno_final, & ! snow volume summed over categories
eice_init, eice_final, & ! ice energy summed over layers
vbri_init, vbri_final, & ! ice volume in fbri*vicen summed over categories
sice_init ,sice_final, & ! ice bulk salinity summed over categories
esno_init, esno_final ! snow energy summed over layers

integer (kind=int_kind), parameter :: &
nitermax = 20 ! max number of ridging iterations

integer (kind=int_kind) :: &
n , & ! thickness category index
niter , & ! iteration counter
k , & ! vertical index
it ! tracer index

real (kind=dbl_kind) :: &
dti ! 1 / dt

logical (kind=log_kind) :: &
iterate_ridging ! if true, repeat the ridging

character (len=char_len) :: &
fieldid ! field identifier



end subroutine ridge_ice


end module icepack_mechred

!=======================================================================
Loading