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

Refactor icepack interfaces #285

Merged
merged 10 commits into from
Dec 8, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 6 additions & 6 deletions columnphysics/icepack_brine.F90
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module icepack_brine
use icepack_warnings, only: warnstr, icepack_warnings_add
use icepack_warnings, only: icepack_warnings_setabort, icepack_warnings_aborted

use icepack_mushy_physics, only: temperature_mush, liquid_fraction
use icepack_mushy_physics, only: icepack_mushy_temperature_mush, icepack_mushy_liquid_fraction
use icepack_therm_shared, only: calculate_Tin_from_qin

implicit none
Expand Down Expand Up @@ -260,8 +260,8 @@ subroutine compute_microS_mushy (nilyr, nblyr, &
do k = 1, nblyr
bqin (k+1) = min(c0, trtmp_q(nt_qice+k-1))
bSin (k+1) = max(Smin, trtmp_s(nt_sice+k-1))
bTin (k+1) = temperature_mush(bqin(k+1), bSin(k+1))
bphin(k+1) = liquid_fraction (bTin(k+1), bSin(k+1))
bTin (k+1) = icepack_mushy_temperature_mush(bqin(k+1), bSin(k+1))
bphin(k+1) = icepack_mushy_liquid_fraction (bTin(k+1), bSin(k+1))
enddo ! k

bSin (1) = bSin(2)
Expand Down Expand Up @@ -1010,7 +1010,7 @@ end subroutine icepack_init_hbrine
! Initialize zSalinity

subroutine icepack_init_zsalinity(nblyr,ntrcr_o, Rayleigh_criteria, &
Rayleigh_real, trcrn, nt_bgc_S, ncat, sss)
Rayleigh_real, trcrn_bgc, nt_bgc_S, ncat, sss)

integer (kind=int_kind), intent(in) :: &
nblyr, & ! number of biolayers
Expand All @@ -1028,7 +1028,7 @@ subroutine icepack_init_zsalinity(nblyr,ntrcr_o, Rayleigh_criteria, &
sss

real (kind=dbl_kind), dimension(:,:), intent(inout):: &
trcrn ! bgc subset of trcrn
trcrn_bgc ! bgc subset of trcrn

!autodocument_end

Expand All @@ -1049,7 +1049,7 @@ subroutine icepack_init_zsalinity(nblyr,ntrcr_o, Rayleigh_criteria, &
Rayleigh_real = c0
do n = 1,ncat
do k = 1,nblyr
trcrn(nt_bgc_S+k-1-ntrcr_o,n) = sss*salt_loss
trcrn_bgc(nt_bgc_S+k-1-ntrcr_o,n) = sss*salt_loss
enddo ! k
enddo ! n

Expand Down
36 changes: 22 additions & 14 deletions columnphysics/icepack_intfc.F90
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
!=========================================================================
!
! flags and interface routines for the column package
!
! authors: Elizabeth C. Hunke, LANL
!

!autodocument_start icepack_intfc.F90
! public parameters and interface routines for the icepack columnpackage code

module icepack_intfc

Expand All @@ -15,16 +17,16 @@ module icepack_intfc
use icepack_kinds, only: icepack_dbl_kind => dbl_kind
use icepack_kinds, only: icepack_r16_kind => r16_kind

use icepack_tracers, only: icepack_max_nbtrcr => max_nbtrcr
use icepack_tracers, only: icepack_max_algae => max_algae
use icepack_tracers, only: icepack_max_dic => max_dic
use icepack_tracers, only: icepack_max_doc => max_doc
use icepack_tracers, only: icepack_max_don => max_don
use icepack_tracers, only: icepack_max_fe => max_fe
use icepack_tracers, only: icepack_max_aero => max_aero
use icepack_tracers, only: icepack_nmodal1 => nmodal1
use icepack_tracers, only: icepack_nmodal2 => nmodal2
use icepack_parameters, only: icepack_nspint => nspint
use icepack_tracers, only: icepack_max_nbtrcr => max_nbtrcr
use icepack_tracers, only: icepack_max_algae => max_algae
use icepack_tracers, only: icepack_max_dic => max_dic
use icepack_tracers, only: icepack_max_doc => max_doc
use icepack_tracers, only: icepack_max_don => max_don
use icepack_tracers, only: icepack_max_fe => max_fe
use icepack_tracers, only: icepack_max_aero => max_aero
use icepack_tracers, only: icepack_nmodal1 => nmodal1
use icepack_tracers, only: icepack_nmodal2 => nmodal2
use icepack_parameters, only: icepack_nspint => nspint

use icepack_parameters, only: icepack_init_parameters
use icepack_parameters, only: icepack_query_parameters
Expand Down Expand Up @@ -72,8 +74,8 @@ module icepack_intfc
use icepack_zbgc , only: icepack_init_bgc
use icepack_zbgc , only: icepack_init_zbgc
use icepack_zbgc , only: icepack_biogeochemistry
use icepack_zbgc , only: icepack_init_OceanConcArray
use icepack_zbgc , only: icepack_init_ocean_conc
use icepack_zbgc , only: icepack_init_ocean_bio
use icepack_zbgc , only: icepack_load_ocean_bio_array

use icepack_atmo , only: icepack_atm_boundary
use icepack_ocean, only: icepack_ocn_mixed_layer
Expand All @@ -91,11 +93,17 @@ module icepack_intfc
use icepack_therm_shared , only: icepack_init_thermo
use icepack_therm_shared , only: icepack_init_trcr

use icepack_mushy_physics , only: icepack_mushy_density_brine
use icepack_mushy_physics , only: icepack_mushy_liquid_fraction
use icepack_mushy_physics , only: icepack_mushy_temperature_mush

use icepack_warnings, only: icepack_warnings_clear
use icepack_warnings, only: icepack_warnings_print
use icepack_warnings, only: icepack_warnings_flush
use icepack_warnings, only: icepack_warnings_aborted

!autodocument_end icepack_intfc.F90

implicit none

public
Expand Down
30 changes: 15 additions & 15 deletions columnphysics/icepack_mushy_physics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ module icepack_mushy_physics
enthalpy_mush_liquid_fraction, &
enthalpy_of_melting, &
temperature_snow, &
temperature_mush, &
icepack_mushy_temperature_mush, &
temperature_mush_liquid_fraction, &
liquidus_brine_salinity_mush, &
liquidus_temperature_mush, &
liquid_fraction, &
density_brine
icepack_mushy_liquid_fraction, &
icepack_mushy_density_brine

!-----------------------------------------------------------------
! Constants for Liquidus relation from Assur (1958)
Expand Down Expand Up @@ -92,7 +92,7 @@ subroutine conductivity_mush_array(nilyr, zqin, zSin, km)

do k = 1, nilyr

Tmush = temperature_mush(zqin(k), zSin(k))
Tmush = icepack_mushy_temperature_mush(zqin(k), zSin(k))

km(k) = heat_conductivity(Tmush, zSin(k))

Expand All @@ -102,7 +102,7 @@ end subroutine conductivity_mush_array

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

function density_brine(Sbr) result(rho)
function icepack_mushy_density_brine(Sbr) result(rho)

! density of brine from brine salinity

Expand All @@ -117,11 +117,11 @@ function density_brine(Sbr) result(rho)
b = 0.78237_dbl_kind , & ! linear empirical coefficient
c = 2.8008e-4_dbl_kind ! quadratic empirical coefficient

character(len=*),parameter :: subname='(density_brine)'
character(len=*),parameter :: subname='(icepack_mushy_density_brine)'

rho = a + b * Sbr + c * Sbr**2

end function density_brine
end function icepack_mushy_density_brine

!=======================================================================
! Snow
Expand Down Expand Up @@ -281,7 +281,7 @@ function enthalpy_mush(zTin, zSin) result(zqin)

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

phi = liquid_fraction(zTin, zSin)
phi = icepack_mushy_liquid_fraction(zTin, zSin)

zqin = phi * (cp_ocn * rhow - cp_ice * rhoi) * zTin + &
rhoi * cp_ice * zTin - (c1 - phi) * rhoi * Lfresh
Expand Down Expand Up @@ -347,7 +347,7 @@ end function enthalpy_brine

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

function temperature_mush(zqin, zSin) result(zTin)
function icepack_mushy_temperature_mush(zqin, zSin) result(zTin)

! temperature of mush from mush enthalpy

Expand Down Expand Up @@ -382,7 +382,7 @@ function temperature_mush(zqin, zSin) result(zTin)
F2_liq, G2_liq, H2_liq, & ! "
I_liq ! warmer than fully melted constants

character(len=*),parameter :: subname='(temperature_mush)'
character(len=*),parameter :: subname='(icepack_mushy_temperature_mush)'

!--------------------------------------------------------

Expand Down Expand Up @@ -451,7 +451,7 @@ function temperature_mush(zqin, zSin) result(zTin)
! change T if all melted
zTin = q_melt * zqin * I_liq + (c1 - q_melt) * zTin

end function temperature_mush
end function icepack_mushy_temperature_mush

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

Expand Down Expand Up @@ -491,15 +491,15 @@ function heat_conductivity(zTin, zSin) result(km)

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

phi = liquid_fraction(zTin, zSin)
phi = icepack_mushy_liquid_fraction(zTin, zSin)

km = phi * (kb - ki) + ki

end function heat_conductivity

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

function liquid_fraction(zTin, zSin) result(phi)
function icepack_mushy_liquid_fraction(zTin, zSin) result(phi)

! liquid fraction of mush from mush temperature and bulk salinity

Expand All @@ -511,12 +511,12 @@ function liquid_fraction(zTin, zSin) result(phi)
phi , & ! liquid fraction
Sbr ! brine salinity (ppt)

character(len=*),parameter :: subname='(liquid_fraction)'
character(len=*),parameter :: subname='(icepack_mushy_liquid_fraction)'

Sbr = max(liquidus_brine_salinity_mush(zTin),puny)
phi = zSin / max(Sbr, zSin)

end function liquid_fraction
end function icepack_mushy_liquid_fraction

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

Expand Down
Loading