From 7646f2afde7ecc80bfa12005e5469eed18bfb33d Mon Sep 17 00:00:00 2001 From: apcraig Date: Wed, 4 Oct 2017 11:57:24 -0600 Subject: [PATCH] Migrate icepack_constants out of the columnphysics/constants directory. Update icepack intfc methods and add init/query/write methods for icepack_intfc_tracers and icepack_constants. Change constants to no longer be parameters (so they can be set) and update icepack as needed. --- .../constants/cesm/icepack_constants.F90 | 162 ----- .../constants/cice/icepack_constants.F90 | 153 ---- .../constants/hadgem3/icepack_constants.F90 | 153 ---- columnphysics/icepack_atmo.F90 | 13 +- columnphysics/icepack_constants.F90 | 518 +++++++++++++ columnphysics/icepack_intfc.F90 | 462 +----------- .../icepack_intfc.F90.another_option | 72 -- columnphysics/icepack_intfc_tracers.F90 | 682 ++++++++++++++++++ columnphysics/icepack_itd.F90 | 8 +- columnphysics/icepack_meltpond_topo.F90 | 3 +- columnphysics/icepack_mushy_physics.F90 | 155 ++-- columnphysics/icepack_orbital.F90 | 21 +- columnphysics/icepack_therm_mushy.F90 | 5 +- columnphysics/icepack_therm_vertical.F90 | 5 +- .../driver/icepack_drv_constants.F90 | 7 +- configuration/driver/icepack_drv_init.F90 | 5 +- 16 files changed, 1349 insertions(+), 1075 deletions(-) delete mode 100644 columnphysics/constants/cesm/icepack_constants.F90 delete mode 100644 columnphysics/constants/cice/icepack_constants.F90 delete mode 100644 columnphysics/constants/hadgem3/icepack_constants.F90 create mode 100644 columnphysics/icepack_constants.F90 delete mode 100644 columnphysics/icepack_intfc.F90.another_option diff --git a/columnphysics/constants/cesm/icepack_constants.F90 b/columnphysics/constants/cesm/icepack_constants.F90 deleted file mode 100644 index 76fa0cf0e..000000000 --- a/columnphysics/constants/cesm/icepack_constants.F90 +++ /dev/null @@ -1,162 +0,0 @@ -! SVN:$Id: icepack_constants.F90 1326 2015-11-18 23:41:52Z afrobert@nps.edu $ -!======================================================================= -! -! This module defines a variety of physical and numerical constants -! used in the column package -! -! author Elizabeth C. Hunke, LANL - - module icepack_constants - - use icepack_kinds_mod - use shr_const_mod - - implicit none - save - public - - !----------------------------------------------------------------- - ! physical constants - !----------------------------------------------------------------- - - real (kind=dbl_kind), parameter :: & - secday = SHR_CONST_CDAY ,&! seconds in calendar day - rhos = 330.0_dbl_kind ,&! density of snow (kg/m^3) - rhoi = SHR_CONST_RHOICE ,&! density of ice (kg/m^3) - rhow = SHR_CONST_RHOSW ,&! density of seawater (kg/m^3) - cp_air = SHR_CONST_CPDAIR ,&! specific heat of air (J/kg/K) - ! (Briegleb JGR 97 11475-11485 July 1992) - emissivity= 0.95_dbl_kind ,&! emissivity of snow and ice - cp_ice = SHR_CONST_CPICE ,&! specific heat of fresh ice (J/kg/K) - cp_ocn = SHR_CONST_CPSW ,&! specific heat of ocn (J/kg/K) - ! freshwater value needed for enthalpy - depressT = 0.054_dbl_kind ,&! Tf:brine salinity ratio (C/ppt) - -#ifdef RASM_MODS - dragio = 0.00962_dbl_kind ,&! ice-ocn drag coefficient for RASM as temporary measure -#else - dragio = 0.00536_dbl_kind ,&! ice-ocn drag coefficient -#endif - - albocn = 0.06_dbl_kind ,&! ocean albedo - gravit = SHR_CONST_G ,&! gravitational acceleration (m/s^2) - viscosity_dyn = 1.79e-3_dbl_kind, & ! dynamic viscosity of brine (kg/m/s) - Tocnfrz= -34.0_dbl_kind*depressT,&! freezing temp of seawater (C), - ! used as Tsfcn for open water - rhofresh = SHR_CONST_RHOFW ,&! density of fresh water (kg/m^3) - zvir = SHR_CONST_ZVIR ,&! rh2o/rair - 1.0 - vonkar = SHR_CONST_KARMAN,&! von Karman constant - cp_wv = SHR_CONST_CPWV ,&! specific heat of water vapor (J/kg/K) - stefan_boltzmann = SHR_CONST_STEBOL,&! W/m^2/K^4 - Tffresh = SHR_CONST_TKFRZ ,&! freezing temp of fresh ice (K) - Lsub = SHR_CONST_LATSUB,&! latent heat, sublimation freshwater (J/kg) - Lvap = SHR_CONST_LATVAP,&! latent heat, vaporization freshwater (J/kg) - Lfresh = SHR_CONST_LATICE,&! latent heat of melting of fresh ice (J/kg) - Timelt = SHR_CONST_TKFRZ-SHR_CONST_TKFRZ,&! melting temp. ice top surface (C) - Tsmelt = SHR_CONST_TKFRZ-SHR_CONST_TKFRZ,&! melting temp. snow top surface (C) - ice_ref_salinity = SHR_CONST_ICE_REF_SAL ,&! (psu) -! ocn_ref_salinity = SHR_CONST_OCN_REF_SAL ,&! (psu) - - iceruf = 0.0005_dbl_kind ,&! ice surface roughness (m) - cprho = cp_ocn*rhow ,&! for ocean mixed layer (J kg / K m^3) - - ! for ice strength - Cf = 17._dbl_kind ,&! ratio of ridging work to PE change in ridging - Cp = 0.5_dbl_kind*gravit*(rhow-rhoi)*rhoi/rhow ,&! proport const for PE - Pstar = 2.75e4_dbl_kind ,&! constant in Hibler strength formula - ! (kstrength = 0) - Cstar = 20._dbl_kind ,&! constant in Hibler strength formula - ! (kstrength = 0) - - ! (Ebert, Schramm and Curry JGR 100 15965-15975 Aug 1995) - kappav = 1.4_dbl_kind ,&! vis extnctn coef in ice, wvlngth<700nm (1/m) - !kappan = 17.6_dbl_kind,&! vis extnctn coef in ice, wvlngth<700nm (1/m) - - ! kice is not used for mushy thermo - kice = 2.03_dbl_kind ,&! thermal conductivity of fresh ice(W/m/deg) - ! kseaice is used only for zero-layer thermo - kseaice= 2.00_dbl_kind ,&! thermal conductivity of sea ice (W/m/deg) - ! (used in zero layer thermodynamics option) - ksno = 0.30_dbl_kind ,&! thermal conductivity of snow (W/m/deg) - zref = 10._dbl_kind ,&! reference height for stability (m) - hs_min = 1.e-4_dbl_kind ,&! min snow thickness for computing zTsn (m) - snowpatch = 0.005_dbl_kind ! parameter for fractional snow area (m) -!tcx note cice snowpatch = 0.02 - - integer (kind=int_kind), parameter :: & - nspint = 3 ! number of solar spectral intervals - - ! weights for albedos - ! 4 Jan 2007 BPB Following are appropriate for complete cloud - ! in a summer polar atmosphere with 1.5m bare sea ice surface: - ! .636/.364 vis/nir with only 0.5% direct for each band. - real (kind=dbl_kind), parameter :: & ! currently used only - awtvdr = 0.00318_dbl_kind, &! visible, direct ! for history and - awtidr = 0.00182_dbl_kind, &! near IR, direct ! diagnostics - awtvdf = 0.63282_dbl_kind, &! visible, diffuse - awtidf = 0.36218_dbl_kind ! near IR, diffuse - - real (kind=dbl_kind), parameter :: & - qqqice = 11637800._dbl_kind ,&! for qsat over ice - TTTice = 5897.8_dbl_kind ,&! for qsat over ice - qqqocn = 627572.4_dbl_kind ,&! for qsat over ocn - TTTocn = 5107.4_dbl_kind ! for qsat over ocn - - ! orbital parameters - integer (kind=int_kind) :: iyear_AD ! Year to calculate orbit for - real(kind=dbl_kind),public :: eccen ! Earth's orbital eccentricity - real(kind=dbl_kind),public :: obliqr ! Earth's obliquity in radians - real(kind=dbl_kind),public :: lambm0 ! Mean longitude of perihelion at the - ! vernal equinox (radians) - real(kind=dbl_kind),public :: mvelpp ! Earth's moving vernal equinox longitude - ! of perihelion + pi (radians) - real(kind=dbl_kind),public :: obliq ! obliquity in degrees - real(kind=dbl_kind),public :: mvelp ! moving vernal equinox long - real(kind=dbl_kind),public :: decln ! solar declination angle in radians - real(kind=dbl_kind),public :: eccf ! earth orbit eccentricity factor - logical(kind=log_kind),public :: log_print ! Flags print of status/error - - !----------------------------------------------------------------- - ! numbers used in column package - !----------------------------------------------------------------- - - real (kind=dbl_kind), parameter :: & - c0 = 0.0_dbl_kind, & - c1 = 1.0_dbl_kind, & - c1p5 = 1.5_dbl_kind, & - c2 = 2.0_dbl_kind, & - c3 = 3.0_dbl_kind, & - c4 = 4.0_dbl_kind, & - c5 = 5.0_dbl_kind, & - c6 = 6.0_dbl_kind, & - c8 = 8.0_dbl_kind, & - c10 = 10.0_dbl_kind, & - c15 = 15.0_dbl_kind, & - c16 = 16.0_dbl_kind, & - c20 = 20.0_dbl_kind, & - c25 = 25.0_dbl_kind, & - c100 = 100.0_dbl_kind, & - c1000= 1000.0_dbl_kind, & - p001 = 0.001_dbl_kind, & - p01 = 0.01_dbl_kind, & - p1 = 0.1_dbl_kind, & - p2 = 0.2_dbl_kind, & - p4 = 0.4_dbl_kind, & - p5 = 0.5_dbl_kind, & - p6 = 0.6_dbl_kind, & - p05 = 0.05_dbl_kind, & - p15 = 0.15_dbl_kind, & - p25 = 0.25_dbl_kind, & - p75 = 0.75_dbl_kind, & - p333 = c1/c3, & - p666 = c2/c3, & - puny = 1.0e-11_dbl_kind, & - bignum = 1.0e+30_dbl_kind, & - pi = SHR_CONST_PI ,&! pi - pih = p5*pi - -!======================================================================= - - end module icepack_constants - -!======================================================================= diff --git a/columnphysics/constants/cice/icepack_constants.F90 b/columnphysics/constants/cice/icepack_constants.F90 deleted file mode 100644 index cd2893843..000000000 --- a/columnphysics/constants/cice/icepack_constants.F90 +++ /dev/null @@ -1,153 +0,0 @@ -! SVN:$Id: icepack_constants.F90 1226 2017-05-22 22:45:03Z tcraig $ -!======================================================================= -! -! This module defines a variety of physical and numerical constants -! used in the column package -! -! author Elizabeth C. Hunke, LANL - - module icepack_constants - - use icepack_kinds_mod - - implicit none - save - private - - !----------------------------------------------------------------- - ! physical constants - !----------------------------------------------------------------- - - real (kind=dbl_kind), parameter, public :: & - secday = 86400.0_dbl_kind ,&! seconds in calendar day - rhos = 330.0_dbl_kind ,&! density of snow (kg/m^3) - rhoi = 917.0_dbl_kind ,&! density of ice (kg/m^3) - rhow = 1026.0_dbl_kind ,&! density of seawater (kg/m^3) - cp_air = 1005.0_dbl_kind ,&! specific heat of air (J/kg/K) - ! (Briegleb JGR 97 11475-11485 July 1992) - emissivity= 0.95_dbl_kind ,&! emissivity of snow and ice - cp_ice = 2106._dbl_kind ,&! specific heat of fresh ice (J/kg/K) - cp_ocn = 4218._dbl_kind ,&! specific heat of ocn (J/kg/K) - ! freshwater value needed for enthalpy - depressT = 0.054_dbl_kind ,&! Tf:brine salinity ratio (C/ppt) - dragio = 0.00536_dbl_kind ,&! ice-ocn drag coefficient - albocn = 0.06_dbl_kind ,&! ocean albedo - gravit = 9.80616_dbl_kind ,&! gravitational acceleration (m/s^2) - viscosity_dyn = 1.79e-3_dbl_kind, & ! dynamic viscosity of brine (kg/m/s) - Tocnfrz = -1.8_dbl_kind ,&! freezing temp of seawater (C), - ! used as Tsfcn for open water - rhofresh = 1000.0_dbl_kind ,&! density of fresh water (kg/m^3) - zvir = 0.606_dbl_kind ,&! rh2o/rair - 1.0 - vonkar = 0.4_dbl_kind ,&! von Karman constant - cp_wv = 1.81e3_dbl_kind ,&! specific heat of water vapor (J/kg/K) - stefan_boltzmann = 567.0e-10_dbl_kind,&! W/m^2/K^4 - Tffresh = 273.15_dbl_kind ,&! freezing temp of fresh ice (K) - Lsub = 2.835e6_dbl_kind ,&! latent heat, sublimation freshwater (J/kg) - Lvap = 2.501e6_dbl_kind ,&! latent heat, vaporization freshwater (J/kg) - Lfresh = Lsub-Lvap ,&! latent heat of melting of fresh ice (J/kg) - Timelt = 0.0_dbl_kind ,&! melting temperature, ice top surface (C) - Tsmelt = 0.0_dbl_kind ,&! melting temperature, snow top surface (C) - ice_ref_salinity = 4._dbl_kind ,&! (ppt) - ! ocn_ref_salinity = 34.7_dbl_kind,&! (ppt) - iceruf = 0.0005_dbl_kind ,&! ice surface roughness (m) - cprho = cp_ocn*rhow ,&! for ocean mixed layer (J kg / K m^3) - - ! for ice strength - Cf = 17._dbl_kind ,&! ratio of ridging work to PE change in ridging - Cp = 0.5_dbl_kind*gravit*(rhow-rhoi)*rhoi/rhow ,&! proport const for PE - Pstar = 2.75e4_dbl_kind ,&! constant in Hibler strength formula - ! (kstrength = 0) - Cstar = 20._dbl_kind ,&! constant in Hibler strength formula - ! (kstrength = 0) - - ! (Ebert, Schramm and Curry JGR 100 15965-15975 Aug 1995) - kappav = 1.4_dbl_kind ,&! vis extnctn coef in ice, wvlngth<700nm (1/m) - !kappan = 17.6_dbl_kind,&! vis extnctn coef in ice, wvlngth<700nm (1/m) - - ! kice is not used for mushy thermo - kice = 2.03_dbl_kind ,&! thermal conductivity of fresh ice(W/m/deg) - ! kseaice is used only for zero-layer thermo - kseaice= 2.00_dbl_kind ,&! thermal conductivity of sea ice (W/m/deg) - ! (used in zero layer thermodynamics option) - ksno = 0.30_dbl_kind ,&! thermal conductivity of snow (W/m/deg) - zref = 10._dbl_kind ,&! reference height for stability (m) - hs_min = 1.e-4_dbl_kind ,&! min snow thickness for computing zTsn (m) - snowpatch = 0.02_dbl_kind ! parameter for fractional snow area (m) - - integer (kind=int_kind), parameter, public :: & - nspint = 3 ! number of solar spectral intervals - - ! weights for albedos - ! 4 Jan 2007 BPB Following are appropriate for complete cloud - ! in a summer polar atmosphere with 1.5m bare sea ice surface: - ! .636/.364 vis/nir with only 0.5% direct for each band. - real (kind=dbl_kind), parameter, public :: & ! currently used only - awtvdr = 0.00318_dbl_kind, &! visible, direct ! for history and - awtidr = 0.00182_dbl_kind, &! near IR, direct ! diagnostics - awtvdf = 0.63282_dbl_kind, &! visible, diffuse - awtidf = 0.36218_dbl_kind ! near IR, diffuse - - real (kind=dbl_kind), parameter, public :: & - qqqice = 11637800._dbl_kind ,&! for qsat over ice - TTTice = 5897.8_dbl_kind ,&! for qsat over ice - qqqocn = 627572.4_dbl_kind ,&! for qsat over ocn - TTTocn = 5107.4_dbl_kind ! for qsat over ocn - - ! orbital parameters - integer (kind=int_kind), public :: iyear_AD ! Year to calculate orbit for - real(kind=dbl_kind),public :: eccen ! Earth's orbital eccentricity - real(kind=dbl_kind),public :: obliqr ! Earth's obliquity in radians - real(kind=dbl_kind),public :: lambm0 ! Mean longitude of perihelion at the - ! vernal equinox (radians) - real(kind=dbl_kind),public :: mvelpp ! Earth's moving vernal equinox longitude - ! of perihelion + pi (radians) - real(kind=dbl_kind),public :: obliq ! obliquity in degrees - real(kind=dbl_kind),public :: mvelp ! moving vernal equinox long - real(kind=dbl_kind),public :: decln ! solar declination angle in radians - real(kind=dbl_kind),public :: eccf ! earth orbit eccentricity factor - logical(kind=log_kind),public :: log_print ! Flags print of status/error - - !----------------------------------------------------------------- - ! numbers used in column package - !----------------------------------------------------------------- - - real (kind=dbl_kind), parameter, public :: & - c0 = 0.0_dbl_kind, & - c1 = 1.0_dbl_kind, & - c1p5 = 1.5_dbl_kind, & - c2 = 2.0_dbl_kind, & - c3 = 3.0_dbl_kind, & - c4 = 4.0_dbl_kind, & - c5 = 5.0_dbl_kind, & - c6 = 6.0_dbl_kind, & - c8 = 8.0_dbl_kind, & - c10 = 10.0_dbl_kind, & - c15 = 15.0_dbl_kind, & - c16 = 16.0_dbl_kind, & - c20 = 20.0_dbl_kind, & - c25 = 25.0_dbl_kind, & - c100 = 100.0_dbl_kind, & - c1000= 1000.0_dbl_kind, & - p001 = 0.001_dbl_kind, & - p01 = 0.01_dbl_kind, & - p1 = 0.1_dbl_kind, & - p2 = 0.2_dbl_kind, & - p4 = 0.4_dbl_kind, & - p5 = 0.5_dbl_kind, & - p6 = 0.6_dbl_kind, & - p05 = 0.05_dbl_kind, & - p15 = 0.15_dbl_kind, & - p25 = 0.25_dbl_kind, & - p75 = 0.75_dbl_kind, & - p333 = c1/c3, & - p666 = c2/c3, & - puny = 1.0e-11_dbl_kind, & - bignum = 1.0e+30_dbl_kind, & - pi = 3.14159265358979323846_dbl_kind, & - pih = p5*pi - -!======================================================================= - - end module icepack_constants - -!======================================================================= diff --git a/columnphysics/constants/hadgem3/icepack_constants.F90 b/columnphysics/constants/hadgem3/icepack_constants.F90 deleted file mode 100644 index 11d36f5e3..000000000 --- a/columnphysics/constants/hadgem3/icepack_constants.F90 +++ /dev/null @@ -1,153 +0,0 @@ -! SVN:$Id: icepack_constants.F90 890 2014-11-20 23:35:37Z eclare $ -!======================================================================= -! -! This module defines a variety of physical and numerical constants -! used in the column package -! -! author Elizabeth C. Hunke, LANL - - module icepack_constants - - use icepack_kinds_mod - - implicit none - save - private - - !----------------------------------------------------------------- - ! physical constants - !----------------------------------------------------------------- - - real (kind=dbl_kind), parameter, public :: & - secday = 86400.0_dbl_kind ,&! seconds in calendar day - rhos = 330.0_dbl_kind ,&! density of snow (kg/m^3) - rhoi = 917.0_dbl_kind ,&! density of ice (kg/m^3) - rhow = 1026.0_dbl_kind ,&! density of seawater (kg/m^3) - cp_air = 1005.0_dbl_kind ,&! specific heat of air (J/kg/K) - ! (Briegleb JGR 97 11475-11485 July 1992) - emissivity= 0.95_dbl_kind ,&! emissivity of snow and ice - cp_ice = 2106._dbl_kind ,&! specific heat of fresh ice (J/kg/K) - cp_ocn = 4218._dbl_kind ,&! specific heat of ocn (J/kg/K) - ! freshwater value needed for enthalpy - depressT = 0.054_dbl_kind ,&! Tf:brine salinity ratio (C/ppt) - dragio = 0.00536_dbl_kind ,&! ice-ocn drag coefficient - albocn = 0.06_dbl_kind ,&! ocean albedo - gravit = 9.80665_dbl_kind ,&! gravitational acceleration (m/s^2) - viscosity_dyn = 1.79e-3_dbl_kind, & ! dynamic viscosity of brine (kg/m/s) - Tocnfrz = -1.8_dbl_kind ,&! freezing temp of seawater (C), - ! used as Tsfcn for open water - rhofresh = 1000.0_dbl_kind ,&! density of fresh water (kg/m^3) - zvir = 0.606_dbl_kind ,&! rh2o/rair - 1.0 - vonkar = 0.4_dbl_kind ,&! von Karman constant - cp_wv = 1.81e3_dbl_kind ,&! specific heat of water vapor (J/kg/K) - stefan_boltzmann = 567.0e-10_dbl_kind,&! W/m^2/K^4 - Tffresh = 273.15_dbl_kind ,&! freezing temp of fresh ice (K) - Lsub = 2.835e6_dbl_kind ,&! latent heat, sublimation freshwater (J/kg) - Lvap = 2.501e6_dbl_kind ,&! latent heat, vaporization freshwater (J/kg) - Lfresh = Lsub-Lvap ,&! latent heat of melting of fresh ice (J/kg) - Timelt = 0.0_dbl_kind ,&! melting temperature, ice top surface (C) - Tsmelt = 0.0_dbl_kind ,&! melting temperature, snow top surface (C) - ice_ref_salinity = 4._dbl_kind ,&! (ppt) - ! ocn_ref_salinity = 34.7_dbl_kind,&! (ppt) - iceruf = 0.0005_dbl_kind ,&! ice surface roughness (m) - cprho = cp_ocn*rhow ,&! for ocean mixed layer (J kg / K m^3) - - ! for ice strength - Cf = 17._dbl_kind ,&! ratio of ridging work to PE change in ridging - Cp = 0.5_dbl_kind*gravit*(rhow-rhoi)*rhoi/rhow ,&! proport const for PE - Pstar = 2.75e4_dbl_kind ,&! constant in Hibler strength formula - ! (kstrength = 0) - Cstar = 20._dbl_kind ,&! constant in Hibler strength formula - ! (kstrength = 0) - - ! (Ebert, Schramm and Curry JGR 100 15965-15975 Aug 1995) - kappav = 1.4_dbl_kind ,&! vis extnctn coef in ice, wvlngth<700nm (1/m) - !kappan = 17.6_dbl_kind,&! vis extnctn coef in ice, wvlngth<700nm (1/m) - - ! kice is not used for mushy thermo - kice = 2.03_dbl_kind ,&! thermal conductivity of fresh ice(W/m/deg) - ! kseaice is used only for zero-layer thermo - kseaice= 2.00_dbl_kind ,&! thermal conductivity of sea ice (W/m/deg) - ! (used in zero layer thermodynamics option) - ksno = 0.31_dbl_kind ,&! thermal conductivity of snow (W/m/deg) - zref = 10._dbl_kind ,&! reference height for stability (m) - hs_min = 1.e-4_dbl_kind ,&! min snow thickness for computing zTsn (m) - snowpatch = 0.02_dbl_kind ! parameter for fractional snow area (m) - - integer (kind=int_kind), parameter, public :: & - nspint = 3 ! number of solar spectral intervals - - ! weights for albedos - ! 4 Jan 2007 BPB Following are appropriate for complete cloud - ! in a summer polar atmosphere with 1.5m bare sea ice surface: - ! .636/.364 vis/nir with only 0.5% direct for each band. - real (kind=dbl_kind), parameter, public :: & ! currently used only - awtvdr = 0.00318_dbl_kind, &! visible, direct ! for history and - awtidr = 0.00182_dbl_kind, &! near IR, direct ! diagnostics - awtvdf = 0.63282_dbl_kind, &! visible, diffuse - awtidf = 0.36218_dbl_kind ! near IR, diffuse - - real (kind=dbl_kind), parameter, public :: & - qqqice = 11637800._dbl_kind ,&! for qsat over ice - TTTice = 5897.8_dbl_kind ,&! for qsat over ice - qqqocn = 627572.4_dbl_kind ,&! for qsat over ocn - TTTocn = 5107.4_dbl_kind ! for qsat over ocn - - ! orbital parameters - integer (kind=int_kind), public :: iyear_AD ! Year to calculate orbit for - real(kind=dbl_kind),public :: eccen ! Earth's orbital eccentricity - real(kind=dbl_kind),public :: obliqr ! Earth's obliquity in radians - real(kind=dbl_kind),public :: lambm0 ! Mean longitude of perihelion at the - ! vernal equinox (radians) - real(kind=dbl_kind),public :: mvelpp ! Earth's moving vernal equinox longitude - ! of perihelion + pi (radians) - real(kind=dbl_kind),public :: obliq ! obliquity in degrees - real(kind=dbl_kind),public :: mvelp ! moving vernal equinox long - real(kind=dbl_kind),public :: decln ! solar declination angle in radians - real(kind=dbl_kind),public :: eccf ! earth orbit eccentricity factor - logical(kind=log_kind),public :: log_print ! Flags print of status/error - - !----------------------------------------------------------------- - ! numbers used in column package - !----------------------------------------------------------------- - - real (kind=dbl_kind), parameter, public :: & - c0 = 0.0_dbl_kind, & - c1 = 1.0_dbl_kind, & - c1p5 = 1.5_dbl_kind, & - c2 = 2.0_dbl_kind, & - c3 = 3.0_dbl_kind, & - c4 = 4.0_dbl_kind, & - c5 = 5.0_dbl_kind, & - c6 = 6.0_dbl_kind, & - c8 = 8.0_dbl_kind, & - c10 = 10.0_dbl_kind, & - c15 = 15.0_dbl_kind, & - c16 = 16.0_dbl_kind, & - c20 = 20.0_dbl_kind, & - c25 = 25.0_dbl_kind, & - c100 = 100.0_dbl_kind, & - c1000= 1000.0_dbl_kind, & - p001 = 0.001_dbl_kind, & - p01 = 0.01_dbl_kind, & - p1 = 0.1_dbl_kind, & - p2 = 0.2_dbl_kind, & - p4 = 0.4_dbl_kind, & - p5 = 0.5_dbl_kind, & - p6 = 0.6_dbl_kind, & - p05 = 0.05_dbl_kind, & - p15 = 0.15_dbl_kind, & - p25 = 0.25_dbl_kind, & - p75 = 0.75_dbl_kind, & - p333 = c1/c3, & - p666 = c2/c3, & - puny = 1.0e-11_dbl_kind, & - bignum = 1.0e+30_dbl_kind, & - pi = 3.14159265358979323846_dbl_kind, & - pih = p5*pi - -!======================================================================= - - end module icepack_constants - -!======================================================================= diff --git a/columnphysics/icepack_atmo.F90 b/columnphysics/icepack_atmo.F90 index cf026ad67..fe4ad26c1 100644 --- a/columnphysics/icepack_atmo.F90 +++ b/columnphysics/icepack_atmo.F90 @@ -148,10 +148,10 @@ subroutine atmo_boundary_layer (sfctype, & cp , & ! specific heat of moist air hol , & ! H (at zlvl ) over L stable, & ! stability factor + cpvir , & ! defined as cp_wv/cp_air - 1. psixh ! stability function at zlvl (heat and water) real (kind=dbl_kind), parameter :: & - cpvir = cp_wv/cp_air-c1, & ! defined as cp_wv/cp_air - 1. zTrf = c2 ! reference height for air temp (m) ! local functions @@ -176,6 +176,8 @@ subroutine atmo_boundary_layer (sfctype, & ! Initialize !------------------------------------------------------------ + cpvir = cp_wv/cp_air-c1 ! defined as cp_wv/cp_air - 1. + if (highfreq) then umin = p5 ! minumum allowable wind-ice speed difference of 0.5 m/s else @@ -598,6 +600,8 @@ subroutine neutral_drag_coeffs (apnd, hpnd, & ctecar, & ctecwk, & ai, aii, & ! ice area and its inverse + ocnrufi, & ! inverse ocean roughness + icerufi, & ! inverse ice roughness tmp1 ! temporary real (kind=dbl_kind) :: & @@ -608,9 +612,7 @@ subroutine neutral_drag_coeffs (apnd, hpnd, & vrdg ! ridged ice mean thickness real (kind=dbl_kind), parameter :: & - ocnruf = 0.000327_dbl_kind, & ! ocean surface roughness (m) - ocnrufi = c1/ocnruf, & ! inverse ocean roughness - icerufi = c1/iceruf ! inverse ice roughness + ocnruf = 0.000327_dbl_kind ! ocean surface roughness (m) real (kind=dbl_kind), parameter :: & camax = 0.02_dbl_kind , & ! Maximum for atmospheric drag @@ -618,11 +620,12 @@ subroutine neutral_drag_coeffs (apnd, hpnd, & astar = c1/(c1-(Lmin/Lmax)**(c1/beta)) - !----------------------------------------------------------------- ! Initialize across entire grid !----------------------------------------------------------------- + ocnrufi = c1/ocnruf ! inverse ocean roughness + icerufi = c1/iceruf ! inverse ice roughness hfreebd=c0 hdraft =c0 hridge =c0 diff --git a/columnphysics/icepack_constants.F90 b/columnphysics/icepack_constants.F90 new file mode 100644 index 000000000..0b4e367aa --- /dev/null +++ b/columnphysics/icepack_constants.F90 @@ -0,0 +1,518 @@ +! SVN:$Id: icepack_constants.F90 1226 2017-05-22 22:45:03Z tcraig $ +!======================================================================= +! +! This module defines a variety of physical and numerical constants +! used in the column package +! +! author Elizabeth C. Hunke, LANL + + module icepack_constants + + use icepack_kinds_mod + + implicit none + save + private + + public :: icepack_init_constants + public :: icepack_query_constants + public :: icepack_write_constants + + !----------------------------------------------------------------- + ! parameter constants + !----------------------------------------------------------------- + + integer (kind=int_kind), parameter, public :: & + nspint = 3 ! number of solar spectral intervals + + real (kind=dbl_kind), parameter, public :: & + secday = 86400.0_dbl_kind ,&! seconds in calendar day + c0 = 0.0_dbl_kind, & + c1 = 1.0_dbl_kind, & + c1p5 = 1.5_dbl_kind, & + c2 = 2.0_dbl_kind, & + c3 = 3.0_dbl_kind, & + c4 = 4.0_dbl_kind, & + c5 = 5.0_dbl_kind, & + c6 = 6.0_dbl_kind, & + c8 = 8.0_dbl_kind, & + c10 = 10.0_dbl_kind, & + c15 = 15.0_dbl_kind, & + c16 = 16.0_dbl_kind, & + c20 = 20.0_dbl_kind, & + c25 = 25.0_dbl_kind, & + c100 = 100.0_dbl_kind, & + c1000= 1000.0_dbl_kind, & + p001 = 0.001_dbl_kind, & + p01 = 0.01_dbl_kind, & + p1 = 0.1_dbl_kind, & + p2 = 0.2_dbl_kind, & + p4 = 0.4_dbl_kind, & + p5 = 0.5_dbl_kind, & + p6 = 0.6_dbl_kind, & + p05 = 0.05_dbl_kind, & + p15 = 0.15_dbl_kind, & + p25 = 0.25_dbl_kind, & + p75 = 0.75_dbl_kind, & + p333 = c1/c3, & + p666 = c2/c3, & + spval_const= -1.0e36_dbl_kind + + !----------------------------------------------------------------- + ! derived physical constants + ! Lfresh = Lsub-Lvap ,&! latent heat of melting of fresh ice (J/kg) + ! cprho = cp_ocn*rhow ,&! for ocean mixed layer (J kg / K m^3) + ! Cp = 0.5_dbl_kind*gravit*(rhow-rhoi)*rhoi/rhow ,&! proport const for PE + !----------------------------------------------------------------- + + real (kind=dbl_kind), public :: & + pih = spval_const, & + piq = spval_const, & + pi2 = spval_const, & + Lfresh = spval_const, &! latent heat of melting of fresh ice (J/kg) + cprho = spval_const, &! for ocean mixed layer (J kg / K m^3) + Cp = spval_const ! proport const for PE + + !----------------------------------------------------------------- + ! settable physical constants + !----------------------------------------------------------------- + + real (kind=dbl_kind), public :: & + rhos = 330.0_dbl_kind ,&! density of snow (kg/m^3) + rhoi = 917.0_dbl_kind ,&! density of ice (kg/m^3) + rhow = 1026.0_dbl_kind ,&! density of seawater (kg/m^3) + cp_air = 1005.0_dbl_kind ,&! specific heat of air (J/kg/K) + ! (Briegleb JGR 97 11475-11485 July 1992) + emissivity= 0.95_dbl_kind ,&! emissivity of snow and ice + cp_ice = 2106._dbl_kind ,&! specific heat of fresh ice (J/kg/K) + cp_ocn = 4218._dbl_kind ,&! specific heat of ocn (J/kg/K) + ! freshwater value needed for enthalpy + depressT = 0.054_dbl_kind ,&! Tf:brine salinity ratio (C/ppt) + dragio = 0.00536_dbl_kind ,&! ice-ocn drag coefficient + albocn = 0.06_dbl_kind ,&! ocean albedo + gravit = 9.80616_dbl_kind ,&! gravitational acceleration (m/s^2) + viscosity_dyn = 1.79e-3_dbl_kind, & ! dynamic viscosity of brine (kg/m/s) + Tocnfrz = -1.8_dbl_kind ,&! freezing temp of seawater (C), + ! used as Tsfcn for open water + rhofresh = 1000.0_dbl_kind ,&! density of fresh water (kg/m^3) + zvir = 0.606_dbl_kind ,&! rh2o/rair - 1.0 + vonkar = 0.4_dbl_kind ,&! von Karman constant + cp_wv = 1.81e3_dbl_kind ,&! specific heat of water vapor (J/kg/K) + stefan_boltzmann = 567.0e-10_dbl_kind,&! W/m^2/K^4 + Tffresh = 273.15_dbl_kind ,&! freezing temp of fresh ice (K) + Lsub = 2.835e6_dbl_kind ,&! latent heat, sublimation freshwater (J/kg) + Lvap = 2.501e6_dbl_kind ,&! latent heat, vaporization freshwater (J/kg) + Timelt = 0.0_dbl_kind ,&! melting temperature, ice top surface (C) + Tsmelt = 0.0_dbl_kind ,&! melting temperature, snow top surface (C) + ice_ref_salinity = 4._dbl_kind ,&! (ppt) + ! ocn_ref_salinity = 34.7_dbl_kind,&! (ppt) + iceruf = 0.0005_dbl_kind ,&! ice surface roughness (m) + + ! for ice strength + Cf = 17._dbl_kind ,&! ratio of ridging work to PE change in ridging + Pstar = 2.75e4_dbl_kind ,&! constant in Hibler strength formula + ! (kstrength = 0) + Cstar = 20._dbl_kind ,&! constant in Hibler strength formula + ! (kstrength = 0) + + ! (Ebert, Schramm and Curry JGR 100 15965-15975 Aug 1995) + kappav = 1.4_dbl_kind ,&! vis extnctn coef in ice, wvlngth<700nm (1/m) + !kappan = 17.6_dbl_kind,&! vis extnctn coef in ice, wvlngth<700nm (1/m) + + ! kice is not used for mushy thermo + kice = 2.03_dbl_kind ,&! thermal conductivity of fresh ice(W/m/deg) + ! kseaice is used only for zero-layer thermo + kseaice= 2.00_dbl_kind ,&! thermal conductivity of sea ice (W/m/deg) + ! (used in zero layer thermodynamics option) + ksno = 0.30_dbl_kind ,&! thermal conductivity of snow (W/m/deg) + zref = 10._dbl_kind ,&! reference height for stability (m) + hs_min = 1.e-4_dbl_kind ,&! min snow thickness for computing zTsn (m) + snowpatch = 0.02_dbl_kind ! parameter for fractional snow area (m) + + ! weights for albedos + ! 4 Jan 2007 BPB Following are appropriate for complete cloud + ! in a summer polar atmosphere with 1.5m bare sea ice surface: + ! .636/.364 vis/nir with only 0.5% direct for each band. + real (kind=dbl_kind), public :: & ! currently used only + awtvdr = 0.00318_dbl_kind, &! visible, direct ! for history and + awtidr = 0.00182_dbl_kind, &! near IR, direct ! diagnostics + awtvdf = 0.63282_dbl_kind, &! visible, diffuse + awtidf = 0.36218_dbl_kind ! near IR, diffuse + + real (kind=dbl_kind), public :: & + qqqice = 11637800._dbl_kind ,&! for qsat over ice + TTTice = 5897.8_dbl_kind ,&! for qsat over ice + qqqocn = 627572.4_dbl_kind ,&! for qsat over ocn + TTTocn = 5107.4_dbl_kind ! for qsat over ocn + + real (kind=dbl_kind), public :: & + puny = 1.0e-11_dbl_kind, & + bignum = 1.0e+30_dbl_kind, & + pi = 3.14159265358979323846_dbl_kind + +!======================================================================= + contains +!======================================================================= + + subroutine icepack_init_constants( & + rhos_in, rhoi_in, rhow_in, cp_air_in, emissivity_in, & + cp_ice_in, cp_ocn_in, & + depressT_in, dragio_in, albocn_in, gravit_in, viscosity_dyn_in, & + Tocnfrz_in, rhofresh_in, zvir_in, vonkar_in, cp_wv_in, & + stefan_boltzmann_in, ice_ref_salinity_in, & + Tffresh_in, Lsub_in, Lvap_in, Timelt_in, Tsmelt_in, & + iceruf_in, Cf_in, Pstar_in, Cstar_in, kappav_in, & + kice_in, kseaice_in, ksno_in, & + zref_in, hs_min_in, snowpatch_in, & + awtvdr_in, awtidr_in, awtvdf_in, awtidf_in, & + qqqice_in, TTTice_in, qqqocn_in, TTTocn_in, & + puny_in, bignum_in, pi_in ) + + real (kind=dbl_kind), intent(in), optional :: & + rhos_in, & ! density of snow (kg/m^3) + rhoi_in, & ! density of ice (kg/m^3) + rhow_in, & ! density of seawater (kg/m^3) + cp_air_in, & ! specific heat of air (J/kg/K) + emissivity_in, & ! emissivity of snow and ice + cp_ice_in, & ! specific heat of fresh ice (J/kg/K) + cp_ocn_in, & ! specific heat of ocn (J/kg/K) + depressT_in, & ! Tf:brine salinity ratio (C/ppt) + dragio_in, & ! ice-ocn drag coefficient + albocn_in, & ! ocean albedo + gravit_in, & ! gravitational acceleration (m/s^2) + viscosity_dyn_in, & ! dynamic viscosity of brine (kg/m/s) + Tocnfrz_in, & ! freezing temp of seawater (C) + rhofresh_in, & ! density of fresh water (kg/m^3) + zvir_in, & ! rh2o/rair - 1.0 + vonkar_in, & ! von Karman constant + cp_wv_in, & ! specific heat of water vapor (J/kg/K) + stefan_boltzmann_in, & ! W/m^2/K^4 + Tffresh_in, & ! freezing temp of fresh ice (K) + Lsub_in, & ! latent heat, sublimation freshwater (J/kg) + Lvap_in, & ! latent heat, vaporization freshwater (J/kg) + Timelt_in, & ! melting temperature, ice top surface (C) + Tsmelt_in, & ! melting temperature, snow top surface (C) + ice_ref_salinity_in, & ! (ppt) + iceruf_in, & ! ice surface roughness (m) + Cf_in, & ! ratio of ridging work to PE change in ridging + Pstar_in, & ! constant in Hibler strength formula + Cstar_in, & ! constant in Hibler strength formula + kappav_in, & ! vis extnctn coef in ice, wvlngth<700nm (1/m) + kice_in, & ! thermal conductivity of fresh ice(W/m/deg) + kseaice_in, & ! thermal conductivity of sea ice (W/m/deg) + ksno_in, & ! thermal conductivity of snow (W/m/deg) + zref_in, & ! reference height for stability (m) + hs_min_in, & ! min snow thickness for computing zTsn (m) + snowpatch_in, & ! parameter for fractional snow area (m) + awtvdr_in, & ! visible, direct ! for history and + awtidr_in, & ! near IR, direct ! diagnostics + awtvdf_in, & ! visible, diffuse + awtidf_in, & ! near IR, diffuse + qqqice_in, & ! for qsat over ice + TTTice_in, & ! for qsat over ice + qqqocn_in, & ! for qsat over ocn + TTTocn_in, & ! for qsat over ocn + puny_in, & ! + bignum_in, & ! + pi_in ! + + if (present(rhos_in)) rhos = rhos_in + if (present(rhoi_in)) rhoi = rhoi_in + if (present(rhow_in)) rhow = rhow_in + if (present(cp_air_in)) cp_air = cp_air_in + if (present(emissivity_in)) emissivity = emissivity_in + if (present(cp_ice_in)) cp_ice = cp_ice_in + if (present(cp_ocn_in)) cp_ocn = cp_ocn_in + if (present(depressT_in)) depressT = depressT_in + if (present(dragio_in)) dragio = dragio_in + if (present(albocn_in)) albocn = albocn_in + if (present(gravit_in)) gravit = gravit_in + if (present(viscosity_dyn_in)) viscosity_dyn = viscosity_dyn_in + if (present(Tocnfrz_in)) Tocnfrz = Tocnfrz_in + if (present(rhofresh_in)) rhofresh = rhofresh_in + if (present(zvir_in)) zvir = zvir_in + if (present(vonkar_in)) vonkar = vonkar_in + if (present(cp_wv_in)) cp_wv = cp_wv_in + if (present(stefan_boltzmann_in)) stefan_boltzmann = stefan_boltzmann_in + if (present(Tffresh_in)) Tffresh = Tffresh_in + if (present(Lsub_in)) Lsub = Lsub_in + if (present(Lvap_in)) Lvap = Lvap_in + if (present(Timelt_in)) Timelt = Timelt_in + if (present(Tsmelt_in)) Tsmelt = Tsmelt_in + if (present(ice_ref_salinity_in)) ice_ref_salinity = ice_ref_salinity_in + if (present(iceruf_in)) iceruf = iceruf_in + if (present(Cf_in)) Cf = Cf_in + if (present(Pstar_in)) Pstar = Pstar_in + if (present(Cstar_in)) Cstar = Cstar_in + if (present(kappav_in)) kappav = kappav_in + if (present(kice_in)) kice = kice_in + if (present(kseaice_in)) kseaice = kseaice_in + if (present(ksno_in)) ksno = ksno_in + if (present(zref_in)) zref = zref_in + if (present(hs_min_in)) hs_min = hs_min_in + if (present(snowpatch_in)) snowpatch = snowpatch_in + if (present(awtvdr_in)) awtvdr = awtvdr_in + if (present(awtidr_in)) awtidr = awtidr_in + if (present(awtvdf_in)) awtvdf = awtvdf_in + if (present(awtidf_in)) awtidf = awtidf_in + if (present(qqqice_in)) qqqice = qqqice_in + if (present(TTTice_in)) TTTice = TTTice_in + if (present(qqqocn_in)) qqqocn = qqqocn_in + if (present(TTTocn_in)) TTTocn = TTTocn_in + if (present(puny_in)) puny = puny_in + if (present(bignum_in)) bignum = bignum_in + if (present(pi_in)) pi = pi_in + + call icepack_recompute_constants() + + end subroutine icepack_init_constants + +!======================================================================= + + subroutine icepack_query_constants( & + rhos_out, rhoi_out, rhow_out, cp_air_out, emissivity_out, & + cp_ice_out, cp_ocn_out, & + depressT_out, dragio_out, albocn_out, gravit_out, viscosity_dyn_out, & + Tocnfrz_out, rhofresh_out, zvir_out, vonkar_out, cp_wv_out, & + stefan_boltzmann_out, ice_ref_salinity_out, & + Tffresh_out, Lsub_out, Lvap_out, Timelt_out, Tsmelt_out, & + iceruf_out, Cf_out, Pstar_out, Cstar_out, kappav_out, & + kice_out, kseaice_out, ksno_out, & + zref_out, hs_min_out, snowpatch_out, & + awtvdr_out, awtidr_out, awtvdf_out, awtidf_out, & + qqqice_out, TTTice_out, qqqocn_out, TTTocn_out, & + Lfresh_out, cprho_out, Cp_out, & + puny_out, bignum_out, pi_out, & + secday_out, c0_out, c1_out, c1p5_out, c2_out, c3_out, c4_out, & + c5_out, c6_out, c8_out, c10_out, c15_out, c16_out, c20_out, & + c25_out, c100_out, c1000_out, p001_out, p01_out, p1_out, & + p2_out, p4_out, p5_out, p6_out, p05_out, p15_out, p25_out, p75_out, & + p333_out, p666_out, spval_const_out, pih_out, piq_out, pi2_out) + + + real (kind=dbl_kind), intent(out), optional :: & + rhos_out, & ! density of snow (kg/m^3) + rhoi_out, & ! density of ice (kg/m^3) + rhow_out, & ! density of seawater (kg/m^3) + cp_air_out, & ! specific heat of air (J/kg/K) + emissivity_out, & ! emissivity of snow and ice + cp_ice_out, & ! specific heat of fresh ice (J/kg/K) + cp_ocn_out, & ! specific heat of ocn (J/kg/K) + depressT_out, & ! Tf:brine salinity ratio (C/ppt) + dragio_out, & ! ice-ocn drag coefficient + albocn_out, & ! ocean albedo + gravit_out, & ! gravitational acceleration (m/s^2) + viscosity_dyn_out, & ! dynamic viscosity of brine (kg/m/s) + Tocnfrz_out, & ! freezing temp of seawater (C) + rhofresh_out, & ! density of fresh water (kg/m^3) + zvir_out, & ! rh2o/rair - 1.0 + vonkar_out, & ! von Karman constant + cp_wv_out, & ! specific heat of water vapor (J/kg/K) + stefan_boltzmann_out, & ! W/m^2/K^4 + Tffresh_out, & ! freezing temp of fresh ice (K) + Lsub_out, & ! latent heat, sublimation freshwater (J/kg) + Lvap_out, & ! latent heat, vaporization freshwater (J/kg) + Timelt_out, & ! melting temperature, ice top surface (C) + Tsmelt_out, & ! melting temperature, snow top surface (C) + ice_ref_salinity_out, & ! (ppt) + iceruf_out, & ! ice surface roughness (m) + Cf_out, & ! ratio of ridging work to PE change in ridging + Pstar_out, & ! constant in Hibler strength formula + Cstar_out, & ! constant in Hibler strength formula + kappav_out, & ! vis extnctn coef in ice, wvlngth<700nm (1/m) + kice_out, & ! thermal conductivity of fresh ice(W/m/deg) + kseaice_out, & ! thermal conductivity of sea ice (W/m/deg) + ksno_out, & ! thermal conductivity of snow (W/m/deg) + zref_out, & ! reference height for stability (m) + hs_min_out, & ! min snow thickness for computing zTsn (m) + snowpatch_out, & ! parameter for fractional snow area (m) + awtvdr_out, & ! visible, direct ! for history and + awtidr_out, & ! near IR, direct ! diagnostics + awtvdf_out, & ! visible, diffuse + awtidf_out, & ! near IR, diffuse + qqqice_out, & ! for qsat over ice + TTTice_out, & ! for qsat over ice + qqqocn_out, & ! for qsat over ocn + TTTocn_out, & ! for qsat over ocn + Lfresh_out, & ! latent heat of melting of fresh ice (J/kg) + cprho_out, & ! for ocean mixed layer (J kg / K m^3) + Cp_out, & ! proport const for PE + puny_out, & ! + bignum_out, & ! + pi_out, & ! + secday_out, c0_out, c1_out, c1p5_out, c2_out, c3_out, c4_out, & + c5_out, c6_out, c8_out, c10_out, c15_out, c16_out, c20_out, & + c25_out, c100_out, c1000_out, p001_out, p01_out, p1_out, & + p2_out, p4_out, p5_out, p6_out, p05_out, p15_out, p25_out, p75_out, & + p333_out, p666_out, spval_const_out, pih_out, piq_out, pi2_out + + if (present(rhos_out)) rhos_out = rhos + if (present(rhoi_out)) rhoi_out = rhoi + if (present(rhow_out)) rhow_out = rhow + if (present(cp_air_out)) cp_air_out = cp_air + if (present(emissivity_out)) emissivity_out = emissivity + if (present(cp_ice_out)) cp_ice_out = cp_ice + if (present(cp_ocn_out)) cp_ocn_out = cp_ocn + if (present(depressT_out)) depressT_out = depressT + if (present(dragio_out)) dragio_out = dragio + if (present(albocn_out)) albocn_out = albocn + if (present(gravit_out)) gravit_out = gravit + if (present(viscosity_dyn_out)) viscosity_dyn_out = viscosity_dyn + if (present(Tocnfrz_out)) Tocnfrz_out = Tocnfrz + if (present(rhofresh_out)) rhofresh_out = rhofresh + if (present(zvir_out)) zvir_out = zvir + if (present(vonkar_out)) vonkar_out = vonkar + if (present(cp_wv_out)) cp_wv_out = cp_wv + if (present(stefan_boltzmann_out)) stefan_boltzmann_out = stefan_boltzmann + if (present(Tffresh_out)) Tffresh_out = Tffresh + if (present(Lsub_out)) Lsub_out = Lsub + if (present(Lvap_out)) Lvap_out = Lvap + if (present(Timelt_out)) Timelt_out = Timelt + if (present(Tsmelt_out)) Tsmelt_out = Tsmelt + if (present(ice_ref_salinity_out)) ice_ref_salinity_out = ice_ref_salinity + if (present(iceruf_out)) iceruf_out = iceruf + if (present(Cf_out)) Cf_out = Cf + if (present(Pstar_out)) Pstar_out = Pstar + if (present(Cstar_out)) Cstar_out = Cstar + if (present(kappav_out)) kappav_out = kappav + if (present(kice_out)) kice_out = kice + if (present(kseaice_out)) kseaice_out = kseaice + if (present(ksno_out)) ksno_out = ksno + if (present(zref_out)) zref_out = zref + if (present(hs_min_out)) hs_min_out = hs_min + if (present(snowpatch_out)) snowpatch_out = snowpatch + if (present(awtvdr_out)) awtvdr_out = awtvdr + if (present(awtidr_out)) awtidr_out = awtidr + if (present(awtvdf_out)) awtvdf_out = awtvdf + if (present(awtidf_out)) awtidf_out = awtidf + if (present(qqqice_out)) qqqice_out = qqqice + if (present(TTTice_out)) TTTice_out = TTTice + if (present(qqqocn_out)) qqqocn_out = qqqocn + if (present(TTTocn_out)) TTTocn_out = TTTocn + if (present(Lfresh_out)) Lfresh_out = Lfresh + if (present(cprho_out)) cprho_out = cprho + if (present(Cp_out)) Cp_out = Cp + if (present(puny_out)) puny_out = puny + if (present(bignum_out)) bignum_out = bignum + if (present(pi_out)) pi_out = pi + + if (present(secday_out)) secday_out = secday + if (present(c0_out)) c0_out = c0 + if (present(c1_out)) c1_out = c1 + if (present(c1p5_out)) c1p5_out = c1p5 + if (present(c2_out)) c2_out = c2 + if (present(c3_out)) c3_out = c3 + if (present(c4_out)) c4_out = c4 + if (present(c5_out)) c5_out = c5 + if (present(c6_out)) c6_out = c6 + if (present(c8_out)) c8_out = c8 + if (present(c10_out)) c10_out = c10 + if (present(c15_out)) c15_out = c15 + if (present(c16_out)) c16_out = c16 + if (present(c20_out)) c20_out = c20 + if (present(c25_out)) c25_out = c25 + if (present(c100_out)) c100_out = c100 + if (present(c1000_out)) c1000_out = c1000 + if (present(p001_out)) p001_out = p001 + if (present(p01_out)) p01_out = p01 + if (present(p1_out)) p1_out = p1 + if (present(p2_out)) p2_out = p2 + if (present(p4_out)) p4_out = p4 + if (present(p5_out)) p5_out = p5 + if (present(p6_out)) p6_out = p6 + if (present(p05_out)) p05_out = p05 + if (present(p15_out)) p15_out = p15 + if (present(p25_out)) p25_out = p25 + if (present(p75_out)) p75_out = p75 + if (present(p333_out)) p333_out = p333 + if (present(p666_out)) p666_out = p666 + if (present(spval_const_out)) spval_const_out = spval_const + if (present(pih_out)) pih_out = pih + if (present(piq_out)) piq_out = piq + if (present(pi2_out)) pi2_out = pi2 + + call icepack_recompute_constants() + + end subroutine icepack_query_constants + +!======================================================================= + + subroutine icepack_write_constants(iounit) + + integer (kind=int_kind), intent(in) :: & + iounit ! file unit number + + write(iounit,*) "icepack_write_constants:" + write(iounit,*) " rhos = ",rhos + write(iounit,*) " rhoi = ",rhoi + write(iounit,*) " rhow = ",rhow + write(iounit,*) " cp_air = ",cp_air + write(iounit,*) " emissivity = ",emissivity + write(iounit,*) " cp_ice = ",cp_ice + write(iounit,*) " cp_ocn = ",cp_ocn + write(iounit,*) " depressT = ",depressT + write(iounit,*) " dragio = ",dragio + write(iounit,*) " albocn = ",albocn + write(iounit,*) " gravit = ",gravit + write(iounit,*) " viscosity_dyn = ",viscosity_dyn + write(iounit,*) " Tocnfrz = ",Tocnfrz + write(iounit,*) " rhofresh = ",rhofresh + write(iounit,*) " zvir = ",zvir + write(iounit,*) " vonkar = ",vonkar + write(iounit,*) " cp_wv = ",cp_wv + write(iounit,*) " stefan_boltzmann = ",stefan_boltzmann + write(iounit,*) " Tffresh = ",Tffresh + write(iounit,*) " Lsub = ",Lsub + write(iounit,*) " Lvap = ",Lvap + write(iounit,*) " Timelt = ",Timelt + write(iounit,*) " Tsmelt = ",Tsmelt + write(iounit,*) " ice_ref_salinity = ",ice_ref_salinity + write(iounit,*) " iceruf = ",iceruf + write(iounit,*) " Cf = ",Cf + write(iounit,*) " Pstar = ",Pstar + write(iounit,*) " Cstar = ",Cstar + write(iounit,*) " kappav = ",kappav + write(iounit,*) " kice = ",kice + write(iounit,*) " kseaice = ",kseaice + write(iounit,*) " ksno = ",ksno + write(iounit,*) " zref = ",zref + write(iounit,*) " hs_min = ",hs_min + write(iounit,*) " snowpatch = ",snowpatch + write(iounit,*) " awtvdr = ",awtvdr + write(iounit,*) " awtidr = ",awtidr + write(iounit,*) " awtvdf = ",awtvdf + write(iounit,*) " awtidf = ",awtidf + write(iounit,*) " qqqice = ",qqqice + write(iounit,*) " TTTice = ",TTTice + write(iounit,*) " qqqocn = ",qqqocn + write(iounit,*) " TTTocn = ",TTTocn + write(iounit,*) " puny = ",puny + write(iounit,*) " bignum = ",bignum + write(iounit,*) " pi = ",pi + write(iounit,*) " pih = ",pih + write(iounit,*) " piq = ",piq + write(iounit,*) " pi2 = ",pi2 + write(iounit,*) " Lfresh = ",Lfresh + write(iounit,*) " cprho = ",cprho + write(iounit,*) " Cp = ",Cp + + end subroutine icepack_write_constants + +!======================================================================= + + subroutine icepack_recompute_constants() + + cprho = cp_ocn*rhow + Lfresh = Lsub-Lvap + Cp = 0.5_dbl_kind*gravit*(rhow-rhoi)*rhoi/rhow + pih = p5*pi + piq = p5*p5*pi + pi2 = c2*pi + + end subroutine icepack_recompute_constants + +!======================================================================= + + end module icepack_constants + +!======================================================================= diff --git a/columnphysics/icepack_intfc.F90 b/columnphysics/icepack_intfc.F90 index bfda33207..ada3e464c 100644 --- a/columnphysics/icepack_intfc.F90 +++ b/columnphysics/icepack_intfc.F90 @@ -7,7 +7,26 @@ module icepack_intfc - use icepack_kinds_mod ! kinds + use icepack_kinds_mod, only: icepack_char_len => char_len + use icepack_kinds_mod, only: icepack_char_len_long => char_len_long + use icepack_kinds_mod, only: icepack_log_kind => log_kind + use icepack_kinds_mod, only: icepack_int_kind => int_kind + use icepack_kinds_mod, only: icepack_real_kind => real_kind + use icepack_kinds_mod, only: icepack_dbl_kind => dbl_kind + use icepack_kinds_mod, only: icepack_r16_kind => r16_kind + + use icepack_constants, only: icepack_init_constants + use icepack_constants, only: icepack_query_constants + use icepack_constants, only: icepack_write_constants + + use icepack_intfc_shared, only: icepack_init_parameters + use icepack_intfc_shared, only: icepack_query_parameters + use icepack_intfc_shared, only: icepack_write_parameters + + use icepack_intfc_tracers, only: icepack_compute_tracers + use icepack_intfc_tracers, only: icepack_init_tracer_flags + use icepack_intfc_tracers, only: icepack_init_tracer_indices + use icepack_intfc_tracers, only: icepack_init_tracer_numbers use icepack_itd, only: icepack_init_itd use icepack_itd, only: icepack_init_itd_hist @@ -48,451 +67,10 @@ module icepack_intfc use icepack_warnings, only: icepack_get_warnings use icepack_warnings, only: icepack_print_warnings - use icepack_intfc_shared, only: icepack_init_parameters - use icepack_intfc_shared, only: icepack_query_parameters - use icepack_intfc_shared, only: icepack_write_parameters - - use icepack_intfc_tracers, only: icepack_compute_tracers - implicit none public - ! initialization - public :: & - icepack_init_tracer_flags, & - icepack_init_tracer_indices, & - icepack_init_tracer_numbers - -!======================================================================= - - contains - -!======================================================================= -! Initialization routines -!======================================================================= -! set tracer active flags - - subroutine icepack_init_tracer_flags(& - tr_iage_in , & ! if .true., use age tracer - tr_FY_in , & ! if .true., use first-year area tracer - tr_lvl_in , & ! if .true., use level ice tracer - tr_pond_in , & ! if .true., use melt pond tracer - tr_pond_cesm_in , & ! if .true., use cesm pond tracer - tr_pond_lvl_in , & ! if .true., use level-ice pond tracer - tr_pond_topo_in , & ! if .true., use explicit topography-based ponds - tr_aero_in , & ! if .true., use aerosol tracers - tr_brine_in , & ! if .true., brine height differs from ice thickness - tr_bgc_S_in , & ! if .true., use zsalinity - tr_zaero_in , & ! if .true., black carbon is tracers (n_zaero) - tr_bgc_Nit_in , & ! if .true., Nitrate tracer in ice - tr_bgc_N_in , & ! if .true., algal nitrogen tracers (n_algae) - tr_bgc_DON_in , & ! if .true., DON pools are tracers (n_don) - tr_bgc_C_in , & ! if .true., algal carbon tracers + DOC and DIC - tr_bgc_chl_in , & ! if .true., algal chlorophyll tracers - tr_bgc_Am_in , & ! if .true., ammonia/um as nutrient tracer - tr_bgc_Sil_in , & ! if .true., silicon as nutrient tracer - tr_bgc_DMS_in , & ! if .true., DMS as product tracer - tr_bgc_Fe_in , & ! if .true., Fe as product tracer - tr_bgc_hum_in , & ! if .true., hum as tracer - tr_bgc_PON_in) ! if .true., PON as product tracer - - - use icepack_intfc_tracers, only: & - tr_iage , & ! if .true., use age tracer - tr_FY , & ! if .true., use first-year area tracer - tr_lvl , & ! if .true., use level ice tracer - tr_pond , & ! if .true., use melt pond tracer - tr_pond_cesm , & ! if .true., use cesm pond tracer - tr_pond_lvl , & ! if .true., use level-ice pond tracer - tr_pond_topo , & ! if .true., use explicit topography-based ponds - tr_aero , & ! if .true., use aerosol tracers - tr_brine , & ! if .true., brine height differs from ice thickness - tr_bgc_S , & ! if .true., use zsalinity - tr_zaero , & ! if .true., black carbon is tracers (n_zaero) - tr_bgc_Nit , & ! if .true., Nitrate tracer in ice - tr_bgc_N , & ! if .true., algal nitrogen tracers (n_algae) - tr_bgc_DON , & ! if .true., DON pools are tracers (n_don) - tr_bgc_C , & ! if .true., algal carbon tracers + DOC and DIC - tr_bgc_chl , & ! if .true., algal chlorophyll tracers - tr_bgc_Am , & ! if .true., ammonia/um as nutrient tracer - tr_bgc_Sil , & ! if .true., silicon as nutrient tracer - tr_bgc_DMS , & ! if .true., DMS as product tracer - tr_bgc_Fe , & ! if .true., Fe as product tracer - tr_bgc_hum , & ! if .true., hum as product tracer - tr_bgc_PON ! if .true., PON as product tracer - - - logical, intent(in) :: & - tr_iage_in , & ! if .true., use age tracer - tr_FY_in , & ! if .true., use first-year area tracer - tr_lvl_in , & ! if .true., use level ice tracer - tr_pond_in , & ! if .true., use melt pond tracer - tr_pond_cesm_in , & ! if .true., use cesm pond tracer - tr_pond_lvl_in , & ! if .true., use level-ice pond tracer - tr_pond_topo_in , & ! if .true., use explicit topography-based ponds - tr_aero_in , & ! if .true., use aerosol tracers - tr_brine_in , & ! if .true., brine height differs from ice thickness - tr_bgc_S_in , & ! if .true., use zsalinity - tr_zaero_in , & ! if .true., black carbon is tracers (n_zaero) - tr_bgc_Nit_in , & ! if .true., Nitrate tracer in ice - tr_bgc_N_in , & ! if .true., algal nitrogen tracers (n_algae) - tr_bgc_DON_in , & ! if .true., DON pools are tracers (n_don) - tr_bgc_C_in , & ! if .true., algal carbon tracers + DOC and DIC - tr_bgc_chl_in , & ! if .true., algal chlorophyll tracers - tr_bgc_Am_in , & ! if .true., ammonia/um as nutrient tracer - tr_bgc_Sil_in , & ! if .true., silicon as nutrient tracer - tr_bgc_DMS_in , & ! if .true., DMS as product tracer - tr_bgc_Fe_in , & ! if .true., Fe as product tracer - tr_bgc_hum_in , & ! if .true., hum as product tracer - tr_bgc_PON_in ! if .true., PON as product tracer - - tr_iage = tr_iage_in - tr_FY = tr_FY_in - tr_lvl = tr_lvl_in - tr_pond = tr_pond_in - tr_pond_cesm = tr_pond_cesm_in - tr_pond_lvl = tr_pond_lvl_in - tr_pond_topo = tr_pond_topo_in - tr_aero = tr_aero_in - tr_brine = tr_brine_in - tr_bgc_S = tr_bgc_S_in - tr_zaero = tr_zaero_in - tr_bgc_Nit = tr_bgc_Nit_in - tr_bgc_N = tr_bgc_N_in - tr_bgc_DON = tr_bgc_DON_in - tr_bgc_C = tr_bgc_C_in - tr_bgc_chl = tr_bgc_chl_in - tr_bgc_Am = tr_bgc_Am_in - tr_bgc_Sil = tr_bgc_Sil_in - tr_bgc_DMS = tr_bgc_DMS_in - tr_bgc_Fe = tr_bgc_Fe_in - tr_bgc_hum = tr_bgc_hum_in - tr_bgc_PON = tr_bgc_PON_in - - end subroutine icepack_init_tracer_flags - -!======================================================================= - - subroutine icepack_init_tracer_indices(& - nt_Tsfc_in, & ! ice/snow temperature - nt_qice_in, & ! volume-weighted ice enthalpy (in layers) - nt_qsno_in, & ! volume-weighted snow enthalpy (in layers) - nt_sice_in, & ! volume-weighted ice bulk salinity (CICE grid layers) - nt_fbri_in, & ! volume fraction of ice with dynamic salt (hinS/vicen*aicen) - nt_iage_in, & ! volume-weighted ice age - nt_FY_in, & ! area-weighted first-year ice area - nt_alvl_in, & ! level ice area fraction - nt_vlvl_in, & ! level ice volume fraction - nt_apnd_in, & ! melt pond area fraction - nt_hpnd_in, & ! melt pond depth - nt_ipnd_in, & ! melt pond refrozen lid thickness - nt_aero_in, & ! starting index for aerosols in ice - nt_zaero_in, & ! black carbon and other aerosols - nt_bgc_N_in , & ! diatoms, phaeocystis, pico/small - nt_bgc_C_in , & ! diatoms, phaeocystis, pico/small - nt_bgc_chl_in, & ! diatoms, phaeocystis, pico/small - nt_bgc_DOC_in, & ! dissolved organic carbon - nt_bgc_DON_in, & ! dissolved organic nitrogen - nt_bgc_DIC_in, & ! dissolved inorganic carbon - nt_bgc_Fed_in, & ! dissolved iron - nt_bgc_Fep_in, & ! particulate iron - nt_bgc_Nit_in, & ! nutrients - nt_bgc_Am_in, & ! - nt_bgc_Sil_in, & ! - nt_bgc_DMSPp_in,&! trace gases (skeletal layer) - nt_bgc_DMSPd_in,&! - nt_bgc_DMS_in, & ! - nt_bgc_hum_in, & ! - nt_bgc_PON_in, & ! zooplankton and detritus - nlt_zaero_in, & ! black carbon and other aerosols - nlt_bgc_N_in , & ! diatoms, phaeocystis, pico/small - nlt_bgc_C_in , & ! diatoms, phaeocystis, pico/small - nlt_bgc_chl_in,& ! diatoms, phaeocystis, pico/small - nlt_bgc_DOC_in,& ! dissolved organic carbon - nlt_bgc_DON_in,& ! dissolved organic nitrogen - nlt_bgc_DIC_in,& ! dissolved inorganic carbon - nlt_bgc_Fed_in,& ! dissolved iron - nlt_bgc_Fep_in,& ! particulate iron - nlt_bgc_Nit_in,& ! nutrients - nlt_bgc_Am_in, & ! - nlt_bgc_Sil_in,& ! - nlt_bgc_DMSPp_in,&! trace gases (skeletal layer) - nlt_bgc_DMSPd_in,&! - nlt_bgc_DMS_in,& ! - nlt_bgc_hum_in,& ! - nlt_bgc_PON_in,& ! zooplankton and detritus - nt_zbgc_frac_in,&! fraction of tracer in the mobile phase - nt_bgc_S_in, & ! Bulk salinity in fraction ice with dynamic salinity (Bio grid)) - nlt_chl_sw_in, & ! points to total chla in trcrn_sw - nlt_zaero_sw_in,&! black carbon and dust in trcrn_sw - ! Index Dimensions: - n_algae, n_algalC, & ! - n_algalchl, n_DOC, & ! - n_DON,n_DIC,n_dFe, & ! - n_pFe, n_aerosols, & ! - bio_index_o_in, & ! nlt index to fixed data array - bio_index_in, & ! nlt index to nt index - nbtrcr) - - use icepack_intfc_tracers, only: & - nt_Tsfc, & ! ice/snow temperature - nt_qice, & ! volume-weighted ice enthalpy (in layers) - nt_qsno, & ! volume-weighted snow enthalpy (in layers) - nt_sice, & ! volume-weighted ice bulk salinity (CICE grid layers) - nt_fbri, & ! volume fraction of ice with dynamic salt (hinS/vicen*aicen) - nt_iage, & ! volume-weighted ice age - nt_FY, & ! area-weighted first-year ice area - nt_alvl, & ! level ice area fraction - nt_vlvl, & ! level ice volume fraction - nt_apnd, & ! melt pond area fraction - nt_hpnd, & ! melt pond depth - nt_ipnd, & ! melt pond refrozen lid thickness - nt_aero, & ! starting index for aerosols in ice - nt_zaero, & ! black carbon and other aerosols - nt_bgc_N , & ! diatoms, phaeocystis, pico/small - nt_bgc_C , & ! diatoms, phaeocystis, pico/small - nt_bgc_chl, & ! diatoms, phaeocystis, pico/small - nt_bgc_DOC, & ! dissolved organic carbon - nt_bgc_DON, & ! dissolved organic nitrogen - nt_bgc_DIC, & ! dissolved inorganic carbon - nt_bgc_Fed, & ! dissolved iron - nt_bgc_Fep, & ! particulate iron - nt_bgc_Nit, & ! nutrients - nt_bgc_Am, & ! - nt_bgc_Sil, & ! - nt_bgc_DMSPp,&! trace gases (skeletal layer) - nt_bgc_DMSPd,&! - nt_bgc_DMS, & ! - nt_bgc_hum, & ! - nt_bgc_PON, & ! zooplankton and detritus - nlt_zaero, & ! black carbon and other aerosols - nlt_bgc_N , & ! diatoms, phaeocystis, pico/small - nlt_bgc_C , & ! diatoms, phaeocystis, pico/small - nlt_bgc_chl,& ! diatoms, phaeocystis, pico/small - nlt_bgc_DOC,& ! dissolved organic carbon - nlt_bgc_DON,& ! dissolved organic nitrogen - nlt_bgc_DIC,& ! dissolved inorganic carbon - nlt_bgc_Fed,& ! dissolved iron - nlt_bgc_Fep,& ! particulate iron - nlt_bgc_Nit,& ! nutrients - nlt_bgc_Am, & ! - nlt_bgc_Sil,& ! - nlt_bgc_DMSPp,&! trace gases (skeletal layer) - nlt_bgc_DMSPd,&! - nlt_bgc_DMS,& ! - nlt_bgc_hum,& ! - nlt_bgc_PON,& ! zooplankton and detritus - nt_zbgc_frac,&! fraction of tracer in the mobile phase - nt_bgc_S, & ! Bulk salinity in fraction ice with dynamic salinity (Bio grid)) - nlt_chl_sw, & ! points to total chla in trcrn_sw - nlt_zaero_sw,&! black carbon and dust in trcrn_sw - bio_index_o,& ! - bio_index - - integer, intent(in) :: & - nt_Tsfc_in, & ! ice/snow temperature - nt_qice_in, & ! volume-weighted ice enthalpy (in layers) - nt_qsno_in, & ! volume-weighted snow enthalpy (in layers) - nt_sice_in, & ! volume-weighted ice bulk salinity (CICE grid layers) - nt_fbri_in, & ! volume fraction of ice with dynamic salt (hinS/vicen*aicen) - nt_iage_in, & ! volume-weighted ice age - nt_FY_in, & ! area-weighted first-year ice area - nt_alvl_in, & ! level ice area fraction - nt_vlvl_in, & ! level ice volume fraction - nt_apnd_in, & ! melt pond area fraction - nt_hpnd_in, & ! melt pond depth - nt_ipnd_in, & ! melt pond refrozen lid thickness - nt_aero_in, & ! starting index for aerosols in ice - nt_bgc_Nit_in, & ! nutrients - nt_bgc_Am_in, & ! - nt_bgc_Sil_in, & ! - nt_bgc_DMSPp_in,&! trace gases (skeletal layer) - nt_bgc_DMSPd_in,&! - nt_bgc_DMS_in, & ! - nt_bgc_hum_in, & ! - nt_bgc_PON_in, & ! zooplankton and detritus - nlt_bgc_Nit_in,& ! nutrients - nlt_bgc_Am_in, & ! - nlt_bgc_Sil_in,& ! - nlt_bgc_DMSPp_in,&! trace gases (skeletal layer) - nlt_bgc_DMSPd_in,&! - nlt_bgc_DMS_in,& ! - nlt_bgc_hum_in,& ! - nlt_bgc_PON_in,& ! zooplankton and detritus - nt_zbgc_frac_in,&! fraction of tracer in the mobile phase - nt_bgc_S_in, & ! Bulk salinity in fraction ice with dynamic salinity (Bio grid)) - nlt_chl_sw_in ! points to total chla in trcrn_sw - - integer, intent(in) :: & - n_algae, & ! Dimensions - n_algalC, & ! - n_algalchl, & ! - n_DOC, & ! - n_DON, & ! - n_DIC, & ! - n_dFe, & ! - n_pFe, & ! - n_aerosols, & ! - nbtrcr - - integer (kind=int_kind), dimension(:), intent(in) :: & - bio_index_o_in, & - bio_index_in - - integer (kind=int_kind), dimension(:), intent(in) :: & - nt_bgc_N_in , & ! diatoms, phaeocystis, pico/small - nt_bgc_C_in , & ! diatoms, phaeocystis, pico/small - nt_bgc_chl_in, & ! diatoms, phaeocystis, pico/small - nlt_bgc_N_in , & ! diatoms, phaeocystis, pico/small - nlt_bgc_C_in , & ! diatoms, phaeocystis, pico/small - nlt_bgc_chl_in ! diatoms, phaeocystis, pico/small - - integer (kind=int_kind), dimension(:), intent(in) :: & - nt_bgc_DOC_in, & ! dissolved organic carbon - nlt_bgc_DOC_in ! dissolved organic carbon - - integer (kind=int_kind), dimension(:), intent(in) :: & - nt_bgc_DON_in, & ! dissolved organic nitrogen - nlt_bgc_DON_in ! dissolved organic nitrogen - - integer (kind=int_kind), dimension(:), intent(in) :: & - nt_bgc_DIC_in, & ! dissolved inorganic carbon - nlt_bgc_DIC_in ! dissolved inorganic carbon - - integer (kind=int_kind), dimension(:), intent(in) :: & - nt_bgc_Fed_in, & ! dissolved iron - nt_bgc_Fep_in, & ! particulate iron - nlt_bgc_Fed_in,& ! dissolved iron - nlt_bgc_Fep_in ! particulate iron - - integer (kind=int_kind), dimension(:), intent(in) :: & - nt_zaero_in, & ! black carbon and other aerosols - nlt_zaero_in, & ! black carbon and other aerosols - nlt_zaero_sw_in ! black carbon and dust in trcrn_sw - - ! local - integer (kind=int_kind) :: k - - nt_Tsfc = nt_Tsfc_in - nt_qice = nt_qice_in - nt_qsno = nt_qsno_in - nt_sice = nt_sice_in - nt_fbri = nt_fbri_in - nt_iage = nt_iage_in - nt_FY = nt_FY_in - nt_alvl = nt_alvl_in - nt_vlvl = nt_vlvl_in - nt_apnd = nt_apnd_in - nt_hpnd = nt_hpnd_in - nt_ipnd = nt_ipnd_in - nt_aero = nt_aero_in - nt_bgc_Nit = nt_bgc_Nit_in - nt_bgc_Am = nt_bgc_Am_in - nt_bgc_Sil = nt_bgc_Sil_in - nt_bgc_DMSPp=nt_bgc_DMSPp_in - nt_bgc_DMSPd=nt_bgc_DMSPd_in - nt_bgc_DMS = nt_bgc_DMS_in - nt_bgc_hum = nt_bgc_hum_in - nt_bgc_PON = nt_bgc_PON_in - nlt_bgc_Nit = nlt_bgc_Nit_in - nlt_bgc_Am = nlt_bgc_Am_in - nlt_bgc_Sil = nlt_bgc_Sil_in - nlt_bgc_DMSPp=nlt_bgc_DMSPp_in - nlt_bgc_DMSPd=nlt_bgc_DMSPd_in - nlt_bgc_DMS = nlt_bgc_DMS_in - nlt_bgc_hum = nlt_bgc_hum_in - nlt_bgc_PON = nlt_bgc_PON_in - nlt_chl_sw = nlt_chl_sw_in - nt_zbgc_frac=nt_zbgc_frac_in - nt_bgc_S = nt_bgc_S_in - - nt_bgc_N(:) = 0 - nt_bgc_C(:) = 0 - nt_bgc_chl(:) = 0 - nlt_bgc_N(:) = 0 - nlt_bgc_C(:) = 0 - nlt_bgc_chl(:) = 0 - nt_bgc_DOC(:) = 0 - nlt_bgc_DOC(:) = 0 - nt_bgc_DIC(:) = 0 - nlt_bgc_DIC(:) = 0 - nt_bgc_DON(:) = 0 - nlt_bgc_DON(:) = 0 - nt_bgc_Fed(:) = 0 - nt_bgc_Fep(:) = 0 - nlt_bgc_Fed(:) = 0 - nlt_bgc_Fep(:) = 0 - nt_zaero(:) = 0 - nlt_zaero(:) = 0 - nlt_zaero_sw(:)= 0 - bio_index(:) = 0 - bio_index_o(:) = 0 - - do k = 1, nbtrcr - bio_index_o(k)= bio_index_o_in(k) - bio_index(k) = bio_index_in(k) - enddo - do k = 1, n_algae - nt_bgc_N(k) = nt_bgc_N_in(k) - nlt_bgc_N(k)= nlt_bgc_N_in(k) - enddo - do k = 1, n_algalC - nt_bgc_C(k) = nt_bgc_C_in(k) - nlt_bgc_C(k)= nlt_bgc_C_in(k) - enddo - do k = 1, n_algalchl - nt_bgc_chl(k) = nt_bgc_chl_in(k) - nlt_bgc_chl(k)= nlt_bgc_chl_in(k) - enddo - do k = 1, n_DOC - nt_bgc_DOC(k) = nt_bgc_DOC_in(k) - nlt_bgc_DOC(k)= nlt_bgc_DOC_in(k) - enddo - do k = 1, n_DON - nt_bgc_DON(k) = nt_bgc_DON_in(k) - nlt_bgc_DON(k)= nlt_bgc_DON_in(k) - enddo - do k = 1, n_DIC - nt_bgc_DIC(k) = nt_bgc_DIC_in(k) - nlt_bgc_DIC(k)= nlt_bgc_DIC_in(k) - enddo - do k = 1, n_dFe - nt_bgc_Fed(k) = nt_bgc_Fed_in(k) - nlt_bgc_Fed(k)= nlt_bgc_Fed_in(k) - enddo - do k = 1, n_pFe - nt_bgc_Fep(k) = nt_bgc_Fep_in(k) - nlt_bgc_Fep(k)= nlt_bgc_Fep_in(k) - enddo - do k = 1, n_aerosols - nt_zaero(k) = nt_zaero_in(k) - nlt_zaero(k) = nlt_zaero_in(k) - nlt_zaero_sw(k)= nlt_zaero_sw_in(k) - enddo - - end subroutine icepack_init_tracer_indices - -!======================================================================= -! set the number of column tracers - - subroutine icepack_init_tracer_numbers(& - ntrcr_in, nbtrcr_in, nbtrcr_sw_in) - - use icepack_intfc_tracers, only: & - ntrcr, nbtrcr, nbtrcr_sw - - integer (kind=int_kind), intent(in) :: & - ntrcr_in , &! number of tracers in use - nbtrcr_in , &! number of bio tracers in use - nbtrcr_sw_in ! number of shortwave bio tracers in use - - ntrcr = ntrcr_in - nbtrcr = nbtrcr_in - nbtrcr_sw = nbtrcr_sw_in - - end subroutine icepack_init_tracer_numbers - !======================================================================= end module icepack_intfc diff --git a/columnphysics/icepack_intfc.F90.another_option b/columnphysics/icepack_intfc.F90.another_option deleted file mode 100644 index 7fad55af1..000000000 --- a/columnphysics/icepack_intfc.F90.another_option +++ /dev/null @@ -1,72 +0,0 @@ -! SVN:$Id: icepack_intfc.F90 1227 2017-05-22 22:49:10Z tcraig $ -!========================================================================= -! -! flags and interface routines for the column package -! -! authors: Elizabeth C. Hunke, LANL - - module icepack_intfc - - use icepack_itd, only: icepack_intfc_init_itd => icepack_init_itd - use icepack_itd, only: icepack_intfc_init_itd_hist => icepack_init_itd_hist - use icepack_itd, only: icepack_intfc_aggregate => icepack_aggregate - - use icepack_mechred, only: icepack_intfc_step_ridge => icepack_step_ridge - use icepack_mechred, only: icepack_intfc_ice_strength => icepack_ice_strength - - use icepack_shortwave, only: icepack_intfc_prep_radiation => icepack_prep_radiation - use icepack_shortwave, only: icepack_intfc_step_radiation => icepack_step_radiation - - use icepack_brine, only: icepack_intfc_init_hbrine => icepack_init_hbrine - use icepack_brine, only: icepack_intfc_init_zsalinity => icepack_init_zsalinity - - use icepack_zbgc , only: icepack_intfc_init_bgc => icepack_init_bgc - use icepack_zbgc , only: icepack_intfc_init_zbgc => icepack_init_zbgc - use icepack_zbgc , only: icepack_intfc_init_bgc_trcr => icepack_init_bgc_trcr - use icepack_zbgc , only: icepack_intfc_biogeochemistry => icepack_biogeochemistry - use icepack_zbgc , only: icepack_intfc_init_OceanConcArray => icepack_init_OceanConcArray - use icepack_zbgc , only: icepack_intfc_init_ocean_conc => icepack_init_ocean_conc - - use icepack_atmo , only: icepack_intfc_atm_boundary => icepack_atm_boundary - use icepack_ocean, only: icepack_intfc_ocn_mixed_layer => icepack_ocn_mixed_layer - - use icepack_therm_vertical, only: icepack_intfc_step_therm1 => icepack_step_therm1 - use icepack_therm_itd , only: icepack_intfc_step_therm2 => icepack_step_therm2 - use icepack_therm_shared , only: icepack_intfc_ice_temperature => icepack_ice_temperature - use icepack_therm_shared , only: icepack_intfc_snow_temperature => icepack_snow_temperature - use icepack_therm_shared , only: icepack_intfc_liquidus_temperature => icepack_liquidus_temperature - use icepack_therm_shared , only: icepack_intfc_sea_freezing_temperature => icepack_sea_freezing_temperature - use icepack_therm_shared , only: icepack_intfc_enthalpy_snow => icepack_enthalpy_snow - use icepack_therm_shared , only: icepack_intfc_init_thermo => icepack_init_thermo - use icepack_therm_shared , only: icepack_intfc_init_trcr => icepack_init_trcr - - use icepack_orbital , only: icepack_intfc_init_orbit => icepack_init_orbit - - use icepack_warnings, only: icepack_intfc_clear_warnings => icepack_clear_warnings - use icepack_warnings, only: icepack_intfc_get_warnings => icepack_get_warnings - use icepack_warnings, only: icepack_intfc_print_warnings => icepack_print_warnings - - use icepack_parameters, only: icepack_intfc_init_parameters => icepack_init_parameters - use icepack_parameters, only: icepack_intfc_query_parameters => icepack_query_parameters - use icepack_parameters, only: icepack_intfc_write_parameters => icepack_write_parameters - - use icepack_param_tracers, only: icepack_intfc_init_tracer_flags => icepack_init_tracer_flags - use icepack_param_tracers, only: icepack_intfc_query_tracer_flags => icepack_query_tracer_flags - use icepack_param_tracers, only: icepack_intfc_write_tracer_flags => icepack_write_tracer_flags - use icepack_param_tracers, only: icepack_intfc_init_tracer_indices => icepack_init_tracer_indices - use icepack_param_tracers, only: icepack_intfc_query_tracer_indices => icepack_query_tracer_indices - use icepack_param_tracers, only: icepack_intfc_write_tracer_indices => icepack_write_tracer_indices - use icepack_param_tracers, only: icepack_intfc_init_tracer_numbers => icepack_init_tracer_numbers - use icepack_param_tracers, only: icepack_intfc_query_tracer_numbers => icepack_query_tracer_numbers - use icepack_param_tracers, only: icepack_intfc_write_tracer_numbers => icepack_write_tracer_numbers - use icepack_param_tracers, only: icepack_intfc_compute_tracers => icepack_compute_tracers - - implicit none - - public - -!======================================================================= - - end module icepack_intfc - -!======================================================================= diff --git a/columnphysics/icepack_intfc_tracers.F90 b/columnphysics/icepack_intfc_tracers.F90 index 3fa1cf891..b42190b33 100644 --- a/columnphysics/icepack_intfc_tracers.F90 +++ b/columnphysics/icepack_intfc_tracers.F90 @@ -16,6 +16,14 @@ module icepack_intfc_tracers private public :: icepack_compute_tracers + public :: icepack_init_tracer_flags + public :: icepack_query_tracer_flags + public :: icepack_write_tracer_indices + public :: icepack_init_tracer_indices + public :: icepack_query_tracer_indices + public :: icepack_init_tracer_numbers + public :: icepack_query_tracer_numbers + public :: icepack_write_tracer_numbers integer (kind=int_kind), public :: & ntrcr , & ! number of tracers in use @@ -147,6 +155,680 @@ module icepack_intfc_tracers contains +!======================================================================= +! set tracer active flags + + subroutine icepack_init_tracer_flags(& + tr_iage_in, tr_FY_in, tr_lvl_in, & + tr_pond_in, tr_pond_cesm_in, tr_pond_lvl_in, tr_pond_topo_in, & + tr_aero_in, tr_brine_in, tr_bgc_S_in, tr_zaero_in, & + tr_bgc_Nit_in, tr_bgc_N_in, tr_bgc_DON_in, tr_bgc_C_in, tr_bgc_chl_in, & + tr_bgc_Am_in, tr_bgc_Sil_in, tr_bgc_DMS_in, tr_bgc_Fe_in, tr_bgc_hum_in, & + tr_bgc_PON_in) + + logical, intent(in), optional :: & + tr_iage_in , & ! if .true., use age tracer + tr_FY_in , & ! if .true., use first-year area tracer + tr_lvl_in , & ! if .true., use level ice tracer + tr_pond_in , & ! if .true., use melt pond tracer + tr_pond_cesm_in , & ! if .true., use cesm pond tracer + tr_pond_lvl_in , & ! if .true., use level-ice pond tracer + tr_pond_topo_in , & ! if .true., use explicit topography-based ponds + tr_aero_in , & ! if .true., use aerosol tracers + tr_brine_in , & ! if .true., brine height differs from ice thickness + tr_bgc_S_in , & ! if .true., use zsalinity + tr_zaero_in , & ! if .true., black carbon is tracers (n_zaero) + tr_bgc_Nit_in , & ! if .true., Nitrate tracer in ice + tr_bgc_N_in , & ! if .true., algal nitrogen tracers (n_algae) + tr_bgc_DON_in , & ! if .true., DON pools are tracers (n_don) + tr_bgc_C_in , & ! if .true., algal carbon tracers + DOC and DIC + tr_bgc_chl_in , & ! if .true., algal chlorophyll tracers + tr_bgc_Am_in , & ! if .true., ammonia/um as nutrient tracer + tr_bgc_Sil_in , & ! if .true., silicon as nutrient tracer + tr_bgc_DMS_in , & ! if .true., DMS as product tracer + tr_bgc_Fe_in , & ! if .true., Fe as product tracer + tr_bgc_hum_in , & ! if .true., hum as product tracer + tr_bgc_PON_in ! if .true., PON as product tracer + + if (present(tr_iage_in)) tr_iage = tr_iage_in + if (present(tr_FY_in) ) tr_FY = tr_FY_in + if (present(tr_lvl_in) ) tr_lvl = tr_lvl_in + if (present(tr_pond_in)) tr_pond = tr_pond_in + if (present(tr_pond_cesm_in)) tr_pond_cesm = tr_pond_cesm_in + if (present(tr_pond_lvl_in) ) tr_pond_lvl = tr_pond_lvl_in + if (present(tr_pond_topo_in)) tr_pond_topo = tr_pond_topo_in + if (present(tr_aero_in) ) tr_aero = tr_aero_in + if (present(tr_brine_in) ) tr_brine = tr_brine_in + if (present(tr_bgc_S_in) ) tr_bgc_S = tr_bgc_S_in + if (present(tr_zaero_in) ) tr_zaero = tr_zaero_in + if (present(tr_bgc_Nit_in)) tr_bgc_Nit = tr_bgc_Nit_in + if (present(tr_bgc_N_in) ) tr_bgc_N = tr_bgc_N_in + if (present(tr_bgc_DON_in)) tr_bgc_DON = tr_bgc_DON_in + if (present(tr_bgc_C_in) ) tr_bgc_C = tr_bgc_C_in + if (present(tr_bgc_chl_in)) tr_bgc_chl = tr_bgc_chl_in + if (present(tr_bgc_Am_in) ) tr_bgc_Am = tr_bgc_Am_in + if (present(tr_bgc_Sil_in)) tr_bgc_Sil = tr_bgc_Sil_in + if (present(tr_bgc_DMS_in)) tr_bgc_DMS = tr_bgc_DMS_in + if (present(tr_bgc_Fe_in )) tr_bgc_Fe = tr_bgc_Fe_in + if (present(tr_bgc_hum_in)) tr_bgc_hum = tr_bgc_hum_in + if (present(tr_bgc_PON_in)) tr_bgc_PON = tr_bgc_PON_in + + end subroutine icepack_init_tracer_flags + +!======================================================================= +! query tracer active flags + + subroutine icepack_query_tracer_flags(& + tr_iage_out, tr_FY_out, tr_lvl_out, & + tr_pond_out, tr_pond_cesm_out, tr_pond_lvl_out, tr_pond_topo_out, & + tr_aero_out, tr_brine_out, tr_bgc_S_out, tr_zaero_out, & + tr_bgc_Nit_out, tr_bgc_N_out, tr_bgc_DON_out, tr_bgc_C_out, tr_bgc_chl_out, & + tr_bgc_Am_out, tr_bgc_Sil_out, tr_bgc_DMS_out, tr_bgc_Fe_out, tr_bgc_hum_out, & + tr_bgc_PON_out) + + logical, intent(out), optional :: & + tr_iage_out , & ! if .true., use age tracer + tr_FY_out , & ! if .true., use first-year area tracer + tr_lvl_out , & ! if .true., use level ice tracer + tr_pond_out , & ! if .true., use melt pond tracer + tr_pond_cesm_out , & ! if .true., use cesm pond tracer + tr_pond_lvl_out , & ! if .true., use level-ice pond tracer + tr_pond_topo_out , & ! if .true., use explicit topography-based ponds + tr_aero_out , & ! if .true., use aerosol tracers + tr_brine_out , & ! if .true., brine height differs from ice thickness + tr_bgc_S_out , & ! if .true., use zsalinity + tr_zaero_out , & ! if .true., black carbon is tracers (n_zaero) + tr_bgc_Nit_out , & ! if .true., Nitrate tracer in ice + tr_bgc_N_out , & ! if .true., algal nitrogen tracers (n_algae) + tr_bgc_DON_out , & ! if .true., DON pools are tracers (n_don) + tr_bgc_C_out , & ! if .true., algal carbon tracers + DOC and DIC + tr_bgc_chl_out , & ! if .true., algal chlorophyll tracers + tr_bgc_Am_out , & ! if .true., ammonia/um as nutrient tracer + tr_bgc_Sil_out , & ! if .true., silicon as nutrient tracer + tr_bgc_DMS_out , & ! if .true., DMS as product tracer + tr_bgc_Fe_out , & ! if .true., Fe as product tracer + tr_bgc_hum_out , & ! if .true., hum as product tracer + tr_bgc_PON_out ! if .true., PON as product tracer + + if (present(tr_iage_out)) tr_iage_out = tr_iage + if (present(tr_FY_out) ) tr_FY_out = tr_FY + if (present(tr_lvl_out) ) tr_lvl_out = tr_lvl + if (present(tr_pond_out)) tr_pond_out = tr_pond + if (present(tr_pond_cesm_out)) tr_pond_cesm_out = tr_pond_cesm + if (present(tr_pond_lvl_out) ) tr_pond_lvl_out = tr_pond_lvl + if (present(tr_pond_topo_out)) tr_pond_topo_out = tr_pond_topo + if (present(tr_aero_out) ) tr_aero_out = tr_aero + if (present(tr_brine_out) ) tr_brine_out = tr_brine + if (present(tr_bgc_S_out) ) tr_bgc_S_out = tr_bgc_S + if (present(tr_zaero_out) ) tr_zaero_out = tr_zaero + if (present(tr_bgc_Nit_out)) tr_bgc_Nit_out = tr_bgc_Nit + if (present(tr_bgc_N_out) ) tr_bgc_N_out = tr_bgc_N + if (present(tr_bgc_DON_out)) tr_bgc_DON_out = tr_bgc_DON + if (present(tr_bgc_C_out) ) tr_bgc_C_out = tr_bgc_C + if (present(tr_bgc_chl_out)) tr_bgc_chl_out = tr_bgc_chl + if (present(tr_bgc_Am_out) ) tr_bgc_Am_out = tr_bgc_Am + if (present(tr_bgc_Sil_out)) tr_bgc_Sil_out = tr_bgc_Sil + if (present(tr_bgc_DMS_out)) tr_bgc_DMS_out = tr_bgc_DMS + if (present(tr_bgc_Fe_out )) tr_bgc_Fe_out = tr_bgc_Fe + if (present(tr_bgc_hum_out)) tr_bgc_hum_out = tr_bgc_hum + if (present(tr_bgc_PON_out)) tr_bgc_PON_out = tr_bgc_PON + + end subroutine icepack_query_tracer_flags + +!======================================================================= +! write tracer active flags + + subroutine icepack_write_tracer_flags(iounit) + + logical, intent(in) :: iounit + + write(iounit,*) "icepack_write_tracer_flags:" + write(iounit,*) " tr_iage = ",tr_iage + write(iounit,*) " tr_FY = ",tr_FY + write(iounit,*) " tr_lvl = ",tr_lvl + write(iounit,*) " tr_pond = ",tr_pond + write(iounit,*) " tr_pond_cesm = ",tr_pond_cesm + write(iounit,*) " tr_pond_lvl = ",tr_pond_lvl + write(iounit,*) " tr_pond_topo = ",tr_pond_topo + write(iounit,*) " tr_aero = ",tr_aero + write(iounit,*) " tr_brine = ",tr_brine + write(iounit,*) " tr_bgc_S = ",tr_bgc_S + write(iounit,*) " tr_zaero = ",tr_zaero + write(iounit,*) " tr_bgc_Nit = ",tr_bgc_Nit + write(iounit,*) " tr_bgc_N = ",tr_bgc_N + write(iounit,*) " tr_bgc_DON = ",tr_bgc_DON + write(iounit,*) " tr_bgc_C = ",tr_bgc_C + write(iounit,*) " tr_bgc_chl = ",tr_bgc_chl + write(iounit,*) " tr_bgc_Am = ",tr_bgc_Am + write(iounit,*) " tr_bgc_Sil = ",tr_bgc_Sil + write(iounit,*) " tr_bgc_DMS = ",tr_bgc_DMS + write(iounit,*) " tr_bgc_Fe = ",tr_bgc_Fe + write(iounit,*) " tr_bgc_hum = ",tr_bgc_hum + write(iounit,*) " tr_bgc_PON = ",tr_bgc_PON + + end subroutine icepack_write_tracer_flags + +!======================================================================= +! set the number of column tracer indices + + subroutine icepack_init_tracer_indices(& + nt_Tsfc_in, nt_qice_in, nt_qsno_in, nt_sice_in, & + nt_fbri_in, nt_iage_in, nt_FY_in, & + nt_alvl_in, nt_vlvl_in, nt_apnd_in, nt_hpnd_in, nt_ipnd_in, & + nt_aero_in, nt_zaero_in, & + nt_bgc_N_in, nt_bgc_C_in, nt_bgc_chl_in, nt_bgc_DOC_in, nt_bgc_DON_in, & + nt_bgc_DIC_in, nt_bgc_Fed_in, nt_bgc_Fep_in, nt_bgc_Nit_in, nt_bgc_Am_in, & + nt_bgc_Sil_in, nt_bgc_DMSPp_in, nt_bgc_DMSPd_in, nt_bgc_DMS_in, nt_bgc_hum_in, & + nt_bgc_PON_in, nlt_zaero_in, nlt_bgc_N_in, nlt_bgc_C_in, nlt_bgc_chl_in, & + nlt_bgc_DOC_in, nlt_bgc_DON_in, nlt_bgc_DIC_in, nlt_bgc_Fed_in, & + nlt_bgc_Fep_in, nlt_bgc_Nit_in, nlt_bgc_Am_in, nlt_bgc_Sil_in, & + nlt_bgc_DMSPp_in, nlt_bgc_DMSPd_in, nlt_bgc_DMS_in, nlt_bgc_hum_in, & + nlt_bgc_PON_in, nt_zbgc_frac_in, nt_bgc_S_in, nlt_chl_sw_in, & + nlt_zaero_sw_in, & + n_algae_in, n_algalC_in, n_algalchl_in, n_DOC_in, & + n_DON_in, n_DIC_in, n_dFe_in, n_pFe_in, n_aerosols_in, & + bio_index_o_in, bio_index_in, nbtrcr_in) + + integer, intent(in), optional :: & + nt_Tsfc_in, & ! ice/snow temperature + nt_qice_in, & ! volume-weighted ice enthalpy (in layers) + nt_qsno_in, & ! volume-weighted snow enthalpy (in layers) + nt_sice_in, & ! volume-weighted ice bulk salinity (CICE grid layers) + nt_fbri_in, & ! volume fraction of ice with dynamic salt (hinS/vicen*aicen) + nt_iage_in, & ! volume-weighted ice age + nt_FY_in, & ! area-weighted first-year ice area + nt_alvl_in, & ! level ice area fraction + nt_vlvl_in, & ! level ice volume fraction + nt_apnd_in, & ! melt pond area fraction + nt_hpnd_in, & ! melt pond depth + nt_ipnd_in, & ! melt pond refrozen lid thickness + nt_aero_in, & ! starting index for aerosols in ice + nt_bgc_Nit_in, & ! nutrients + nt_bgc_Am_in, & ! + nt_bgc_Sil_in, & ! + nt_bgc_DMSPp_in,&! trace gases (skeletal layer) + nt_bgc_DMSPd_in,&! + nt_bgc_DMS_in, & ! + nt_bgc_hum_in, & ! + nt_bgc_PON_in, & ! zooplankton and detritus + nlt_bgc_Nit_in,& ! nutrients + nlt_bgc_Am_in, & ! + nlt_bgc_Sil_in,& ! + nlt_bgc_DMSPp_in,&! trace gases (skeletal layer) + nlt_bgc_DMSPd_in,&! + nlt_bgc_DMS_in,& ! + nlt_bgc_hum_in,& ! + nlt_bgc_PON_in,& ! zooplankton and detritus + nt_zbgc_frac_in,&! fraction of tracer in the mobile phase + nt_bgc_S_in, & ! Bulk salinity in fraction ice with dynamic salinity (Bio grid)) + nlt_chl_sw_in ! points to total chla in trcrn_sw + + integer, intent(in), optional :: & + n_algae_in, & ! Dimensions + n_algalC_in, & ! + n_algalchl_in, & ! + n_DOC_in, & ! + n_DON_in, & ! + n_DIC_in, & ! + n_dFe_in, & ! + n_pFe_in, & ! + n_aerosols_in, & ! + nbtrcr_in + + integer (kind=int_kind), dimension(:), intent(in), optional :: & + bio_index_o_in, & + bio_index_in + + integer (kind=int_kind), dimension(:), intent(in), optional :: & + nt_bgc_N_in , & ! diatoms, phaeocystis, pico/small + nt_bgc_C_in , & ! diatoms, phaeocystis, pico/small + nt_bgc_chl_in, & ! diatoms, phaeocystis, pico/small + nlt_bgc_N_in , & ! diatoms, phaeocystis, pico/small + nlt_bgc_C_in , & ! diatoms, phaeocystis, pico/small + nlt_bgc_chl_in ! diatoms, phaeocystis, pico/small + + integer (kind=int_kind), dimension(:), intent(in), optional :: & + nt_bgc_DOC_in, & ! dissolved organic carbon + nlt_bgc_DOC_in ! dissolved organic carbon + + integer (kind=int_kind), dimension(:), intent(in), optional :: & + nt_bgc_DON_in, & ! dissolved organic nitrogen + nlt_bgc_DON_in ! dissolved organic nitrogen + + integer (kind=int_kind), dimension(:), intent(in), optional :: & + nt_bgc_DIC_in, & ! dissolved inorganic carbon + nlt_bgc_DIC_in ! dissolved inorganic carbon + + integer (kind=int_kind), dimension(:), intent(in), optional :: & + nt_bgc_Fed_in, & ! dissolved iron + nt_bgc_Fep_in, & ! particulate iron + nlt_bgc_Fed_in,& ! dissolved iron + nlt_bgc_Fep_in ! particulate iron + + integer (kind=int_kind), dimension(:), intent(in), optional :: & + nt_zaero_in, & ! black carbon and other aerosols + nlt_zaero_in, & ! black carbon and other aerosols + nlt_zaero_sw_in ! black carbon and dust in trcrn_sw + + ! local + integer (kind=int_kind) :: k + + if (present(nt_Tsfc_in)) nt_Tsfc = nt_Tsfc_in + if (present(nt_qice_in)) nt_qice = nt_qice_in + if (present(nt_qsno_in)) nt_qsno = nt_qsno_in + if (present(nt_sice_in)) nt_sice = nt_sice_in + if (present(nt_fbri_in)) nt_fbri = nt_fbri_in + if (present(nt_iage_in)) nt_iage = nt_iage_in + if (present(nt_FY_in) ) nt_FY = nt_FY_in + if (present(nt_alvl_in)) nt_alvl = nt_alvl_in + if (present(nt_vlvl_in)) nt_vlvl = nt_vlvl_in + if (present(nt_apnd_in)) nt_apnd = nt_apnd_in + if (present(nt_hpnd_in)) nt_hpnd = nt_hpnd_in + if (present(nt_ipnd_in)) nt_ipnd = nt_ipnd_in + if (present(nt_aero_in)) nt_aero = nt_aero_in + if (present(nt_bgc_Nit_in) ) nt_bgc_Nit = nt_bgc_Nit_in + if (present(nt_bgc_Am_in) ) nt_bgc_Am = nt_bgc_Am_in + if (present(nt_bgc_Sil_in) ) nt_bgc_Sil = nt_bgc_Sil_in + if (present(nt_bgc_DMSPp_in) ) nt_bgc_DMSPp = nt_bgc_DMSPp_in + if (present(nt_bgc_DMSPd_in) ) nt_bgc_DMSPd = nt_bgc_DMSPd_in + if (present(nt_bgc_DMS_in) ) nt_bgc_DMS = nt_bgc_DMS_in + if (present(nt_bgc_hum_in) ) nt_bgc_hum = nt_bgc_hum_in + if (present(nt_bgc_PON_in) ) nt_bgc_PON = nt_bgc_PON_in + if (present(nlt_bgc_Nit_in) ) nlt_bgc_Nit = nlt_bgc_Nit_in + if (present(nlt_bgc_Am_in) ) nlt_bgc_Am = nlt_bgc_Am_in + if (present(nlt_bgc_Sil_in) ) nlt_bgc_Sil = nlt_bgc_Sil_in + if (present(nlt_bgc_DMSPp_in)) nlt_bgc_DMSPp = nlt_bgc_DMSPp_in + if (present(nlt_bgc_DMSPd_in)) nlt_bgc_DMSPd = nlt_bgc_DMSPd_in + if (present(nlt_bgc_DMS_in) ) nlt_bgc_DMS = nlt_bgc_DMS_in + if (present(nlt_bgc_hum_in) ) nlt_bgc_hum = nlt_bgc_hum_in + if (present(nlt_bgc_PON_in) ) nlt_bgc_PON = nlt_bgc_PON_in + if (present(nlt_chl_sw_in) ) nlt_chl_sw = nlt_chl_sw_in + if (present(nt_zbgc_frac_in) ) nt_zbgc_frac = nt_zbgc_frac_in + if (present(nt_bgc_S_in) ) nt_bgc_S = nt_bgc_S_in + + nt_bgc_N(:) = 0 + nt_bgc_C(:) = 0 + nt_bgc_chl(:) = 0 + nlt_bgc_N(:) = 0 + nlt_bgc_C(:) = 0 + nlt_bgc_chl(:) = 0 + nt_bgc_DOC(:) = 0 + nlt_bgc_DOC(:) = 0 + nt_bgc_DIC(:) = 0 + nlt_bgc_DIC(:) = 0 + nt_bgc_DON(:) = 0 + nlt_bgc_DON(:) = 0 + nt_bgc_Fed(:) = 0 + nt_bgc_Fep(:) = 0 + nlt_bgc_Fed(:) = 0 + nlt_bgc_Fep(:) = 0 + nt_zaero(:) = 0 + nlt_zaero(:) = 0 + nlt_zaero_sw(:)= 0 + bio_index(:) = 0 + bio_index_o(:) = 0 + + if (present(nbtrcr_in)) then + do k = 1, nbtrcr_in + if (present(bio_index_o_in)) bio_index_o(k)= bio_index_o_in(k) + if (present(bio_index_in) ) bio_index(k) = bio_index_in(k) + enddo + endif + + if (present(n_algae_in)) then + do k = 1, n_algae_in + if (present(nt_bgc_N_in) ) nt_bgc_N(k) = nt_bgc_N_in(k) + if (present(nlt_bgc_N_in)) nlt_bgc_N(k)= nlt_bgc_N_in(k) + enddo + endif + + if (present(n_algalC_in)) then + do k = 1, n_algalC_in + if (present(nt_bgc_C_in) ) nt_bgc_C(k) = nt_bgc_C_in(k) + if (present(nlt_bgc_C_in)) nlt_bgc_C(k)= nlt_bgc_C_in(k) + enddo + endif + + if (present(n_algalchl_in)) then + do k = 1, n_algalchl_in + if (present(nt_bgc_chl_in) ) nt_bgc_chl(k) = nt_bgc_chl_in(k) + if (present(nlt_bgc_chl_in)) nlt_bgc_chl(k)= nlt_bgc_chl_in(k) + enddo + endif + + if (present(n_DOC_in)) then + do k = 1, n_DOC_in + if (present(nt_bgc_DOC_in) ) nt_bgc_DOC(k) = nt_bgc_DOC_in(k) + if (present(nlt_bgc_DOC_in)) nlt_bgc_DOC(k)= nlt_bgc_DOC_in(k) + enddo + endif + + if (present(n_DON_in)) then + do k = 1, n_DON_in + if (present(nt_bgc_DON_in) ) nt_bgc_DON(k) = nt_bgc_DON_in(k) + if (present(nlt_bgc_DON_in)) nlt_bgc_DON(k)= nlt_bgc_DON_in(k) + enddo + endif + + if (present(n_DIC_in)) then + do k = 1, n_DIC_in + if (present(nt_bgc_DIC_in) ) nt_bgc_DIC(k) = nt_bgc_DIC_in(k) + if (present(nlt_bgc_DIC_in)) nlt_bgc_DIC(k)= nlt_bgc_DIC_in(k) + enddo + endif + + if (present(n_dFe_in)) then + do k = 1, n_dFe_in + if (present(nt_bgc_Fed_in) ) nt_bgc_Fed(k) = nt_bgc_Fed_in(k) + if (present(nlt_bgc_Fed_in)) nlt_bgc_Fed(k)= nlt_bgc_Fed_in(k) + enddo + endif + + if (present(n_pFe_in)) then + do k = 1, n_pFe_in + if (present(nt_bgc_Fep_in) ) nt_bgc_Fep(k) = nt_bgc_Fep_in(k) + if (present(nlt_bgc_Fep_in)) nlt_bgc_Fep(k)= nlt_bgc_Fep_in(k) + enddo + endif + + if (present(n_aerosols_in)) then + do k = 1, n_aerosols_in + if (present(nt_zaero_in) ) nt_zaero(k) = nt_zaero_in(k) + if (present(nlt_zaero_in) ) nlt_zaero(k) = nlt_zaero_in(k) + if (present(nlt_zaero_sw_in)) nlt_zaero_sw(k)= nlt_zaero_sw_in(k) + enddo + endif + + end subroutine icepack_init_tracer_indices + +!======================================================================= +! query the number of column tracer indices + + subroutine icepack_query_tracer_indices(& + nt_Tsfc_out, nt_qice_out, nt_qsno_out, nt_sice_out, & + nt_fbri_out, nt_iage_out, nt_FY_out, & + nt_alvl_out, nt_vlvl_out, nt_apnd_out, nt_hpnd_out, nt_ipnd_out, & + nt_aero_out, nt_zaero_out, & + nt_bgc_N_out, nt_bgc_C_out, nt_bgc_chl_out, nt_bgc_DOC_out, nt_bgc_DON_out, & + nt_bgc_DIC_out, nt_bgc_Fed_out, nt_bgc_Fep_out, nt_bgc_Nit_out, nt_bgc_Am_out, & + nt_bgc_Sil_out, nt_bgc_DMSPp_out, nt_bgc_DMSPd_out, nt_bgc_DMS_out, nt_bgc_hum_out, & + nt_bgc_PON_out, nlt_zaero_out, nlt_bgc_N_out, nlt_bgc_C_out, nlt_bgc_chl_out, & + nlt_bgc_DOC_out, nlt_bgc_DON_out, nlt_bgc_DIC_out, nlt_bgc_Fed_out, & + nlt_bgc_Fep_out, nlt_bgc_Nit_out, nlt_bgc_Am_out, nlt_bgc_Sil_out, & + nlt_bgc_DMSPp_out, nlt_bgc_DMSPd_out, nlt_bgc_DMS_out, nlt_bgc_hum_out, & + nlt_bgc_PON_out, nt_zbgc_frac_out, nt_bgc_S_out, nlt_chl_sw_out, & + nlt_zaero_sw_out, & + bio_index_o_out, bio_index_out) + + integer, intent(out), optional :: & + nt_Tsfc_out, & ! ice/snow temperature + nt_qice_out, & ! volume-weighted ice enthalpy (in layers) + nt_qsno_out, & ! volume-weighted snow enthalpy (in layers) + nt_sice_out, & ! volume-weighted ice bulk salinity (CICE grid layers) + nt_fbri_out, & ! volume fraction of ice with dynamic salt (hinS/vicen*aicen) + nt_iage_out, & ! volume-weighted ice age + nt_FY_out, & ! area-weighted first-year ice area + nt_alvl_out, & ! level ice area fraction + nt_vlvl_out, & ! level ice volume fraction + nt_apnd_out, & ! melt pond area fraction + nt_hpnd_out, & ! melt pond depth + nt_ipnd_out, & ! melt pond refrozen lid thickness + nt_aero_out, & ! starting index for aerosols in ice + nt_bgc_Nit_out, & ! nutrients + nt_bgc_Am_out, & ! + nt_bgc_Sil_out, & ! + nt_bgc_DMSPp_out,&! trace gases (skeletal layer) + nt_bgc_DMSPd_out,&! + nt_bgc_DMS_out, & ! + nt_bgc_hum_out, & ! + nt_bgc_PON_out, & ! zooplankton and detritus + nlt_bgc_Nit_out,& ! nutrients + nlt_bgc_Am_out, & ! + nlt_bgc_Sil_out,& ! + nlt_bgc_DMSPp_out,&! trace gases (skeletal layer) + nlt_bgc_DMSPd_out,&! + nlt_bgc_DMS_out,& ! + nlt_bgc_hum_out,& ! + nlt_bgc_PON_out,& ! zooplankton and detritus + nt_zbgc_frac_out,&! fraction of tracer in the mobile phase + nt_bgc_S_out, & ! Bulk salinity in fraction ice with dynamic salinity (Bio grid)) + nlt_chl_sw_out ! points to total chla in trcrn_sw + + integer (kind=int_kind), dimension(:), intent(out), optional :: & + bio_index_o_out, & + bio_index_out + + integer (kind=int_kind), dimension(:), intent(out), optional :: & + nt_bgc_N_out , & ! diatoms, phaeocystis, pico/small + nt_bgc_C_out , & ! diatoms, phaeocystis, pico/small + nt_bgc_chl_out, & ! diatoms, phaeocystis, pico/small + nlt_bgc_N_out , & ! diatoms, phaeocystis, pico/small + nlt_bgc_C_out , & ! diatoms, phaeocystis, pico/small + nlt_bgc_chl_out ! diatoms, phaeocystis, pico/small + + integer (kind=int_kind), dimension(:), intent(out), optional :: & + nt_bgc_DOC_out, & ! dissolved organic carbon + nlt_bgc_DOC_out ! dissolved organic carbon + + integer (kind=int_kind), dimension(:), intent(out), optional :: & + nt_bgc_DON_out, & ! dissolved organic nitrogen + nlt_bgc_DON_out ! dissolved organic nitrogen + + integer (kind=int_kind), dimension(:), intent(out), optional :: & + nt_bgc_DIC_out, & ! dissolved inorganic carbon + nlt_bgc_DIC_out ! dissolved inorganic carbon + + integer (kind=int_kind), dimension(:), intent(out), optional :: & + nt_bgc_Fed_out, & ! dissolved iron + nt_bgc_Fep_out, & ! particulate iron + nlt_bgc_Fed_out,& ! dissolved iron + nlt_bgc_Fep_out ! particulate iron + + integer (kind=int_kind), dimension(:), intent(out), optional :: & + nt_zaero_out, & ! black carbon and other aerosols + nlt_zaero_out, & ! black carbon and other aerosols + nlt_zaero_sw_out ! black carbon and dust in trcrn_sw + + if (present(nt_Tsfc_out)) nt_Tsfc_out = nt_Tsfc + if (present(nt_qice_out)) nt_qice_out = nt_qice + if (present(nt_qsno_out)) nt_qsno_out = nt_qsno + if (present(nt_sice_out)) nt_sice_out = nt_sice + if (present(nt_fbri_out)) nt_fbri_out = nt_fbri + if (present(nt_iage_out)) nt_iage_out = nt_iage + if (present(nt_FY_out) ) nt_FY_out = nt_FY + if (present(nt_alvl_out)) nt_alvl_out = nt_alvl + if (present(nt_vlvl_out)) nt_vlvl_out = nt_vlvl + if (present(nt_apnd_out)) nt_apnd_out = nt_apnd + if (present(nt_hpnd_out)) nt_hpnd_out = nt_hpnd + if (present(nt_ipnd_out)) nt_ipnd_out = nt_ipnd + if (present(nt_aero_out)) nt_aero_out = nt_aero + if (present(nt_bgc_Nit_out) ) nt_bgc_Nit_out = nt_bgc_Nit + if (present(nt_bgc_Am_out) ) nt_bgc_Am_out = nt_bgc_Am + if (present(nt_bgc_Sil_out) ) nt_bgc_Sil_out = nt_bgc_Sil + if (present(nt_bgc_DMSPp_out) ) nt_bgc_DMSPp_out = nt_bgc_DMSPp + if (present(nt_bgc_DMSPd_out) ) nt_bgc_DMSPd_out = nt_bgc_DMSPd + if (present(nt_bgc_DMS_out) ) nt_bgc_DMS_out = nt_bgc_DMS + if (present(nt_bgc_hum_out) ) nt_bgc_hum_out = nt_bgc_hum + if (present(nt_bgc_PON_out) ) nt_bgc_PON_out = nt_bgc_PON + if (present(nlt_bgc_Nit_out) ) nlt_bgc_Nit_out = nlt_bgc_Nit + if (present(nlt_bgc_Am_out) ) nlt_bgc_Am_out = nlt_bgc_Am + if (present(nlt_bgc_Sil_out) ) nlt_bgc_Sil_out = nlt_bgc_Sil + if (present(nlt_bgc_DMSPp_out)) nlt_bgc_DMSPp_out = nlt_bgc_DMSPp + if (present(nlt_bgc_DMSPd_out)) nlt_bgc_DMSPd_out = nlt_bgc_DMSPd + if (present(nlt_bgc_DMS_out) ) nlt_bgc_DMS_out = nlt_bgc_DMS + if (present(nlt_bgc_hum_out) ) nlt_bgc_hum_out = nlt_bgc_hum + if (present(nlt_bgc_PON_out) ) nlt_bgc_PON_out = nlt_bgc_PON + if (present(nlt_chl_sw_out) ) nlt_chl_sw_out = nlt_chl_sw + if (present(nt_zbgc_frac_out) ) nt_zbgc_frac_out = nt_zbgc_frac + if (present(nt_bgc_S_out) ) nt_bgc_S_out = nt_bgc_S + + if (present(bio_index_o_out) ) bio_index_o_out = bio_index_o + if (present(bio_index_out) ) bio_index_out = bio_index + if (present(nt_bgc_N_out) ) nt_bgc_N_out = nt_bgc_N + if (present(nlt_bgc_N_out) ) nlt_bgc_N_out = nlt_bgc_N + if (present(nt_bgc_C_out) ) nt_bgc_C_out = nt_bgc_C + if (present(nlt_bgc_C_out) ) nlt_bgc_C_out = nlt_bgc_C + if (present(nt_bgc_chl_out) ) nt_bgc_chl_out = nt_bgc_chl + if (present(nlt_bgc_chl_out) ) nlt_bgc_chl_out = nlt_bgc_chl + if (present(nt_bgc_DOC_out) ) nt_bgc_DOC_out = nt_bgc_DOC + if (present(nlt_bgc_DOC_out) ) nlt_bgc_DOC_out = nlt_bgc_DOC + if (present(nt_bgc_DON_out) ) nt_bgc_DON_out = nt_bgc_DON + if (present(nlt_bgc_DON_out) ) nlt_bgc_DON_out = nlt_bgc_DON + if (present(nt_bgc_DIC_out) ) nt_bgc_DIC_out = nt_bgc_DIC + if (present(nlt_bgc_DIC_out) ) nlt_bgc_DIC_out = nlt_bgc_DIC + if (present(nt_bgc_Fed_out) ) nt_bgc_Fed_out = nt_bgc_Fed + if (present(nlt_bgc_Fed_out) ) nlt_bgc_Fed_out = nlt_bgc_Fed + if (present(nt_bgc_Fep_out) ) nt_bgc_Fep_out = nt_bgc_Fep + if (present(nlt_bgc_Fep_out) ) nlt_bgc_Fep_out = nlt_bgc_Fep + if (present(nt_zaero_out) ) nt_zaero_out = nt_zaero + if (present(nlt_zaero_out) ) nlt_zaero_out = nlt_zaero + if (present(nlt_zaero_sw_out)) nlt_zaero_sw_out = nlt_zaero_sw + + end subroutine icepack_query_tracer_indices + +!======================================================================= +! write the number of column tracer indices + + subroutine icepack_write_tracer_indices(iounit) + + integer, intent(in), optional :: iounit + + ! local + integer (kind=int_kind) :: k + + write(iounit,*) "icepack_write_tracer_indices:" + write(iounit,*) " nt_Tsfc = ",nt_Tsfc + write(iounit,*) " nt_qice = ",nt_qice + write(iounit,*) " nt_qsno = ",nt_qsno + write(iounit,*) " nt_sice = ",nt_sice + write(iounit,*) " nt_fbri = ",nt_fbri + write(iounit,*) " nt_iage = ",nt_iage + write(iounit,*) " nt_FY = ",nt_FY + write(iounit,*) " nt_alvl = ",nt_alvl + write(iounit,*) " nt_vlvl = ",nt_vlvl + write(iounit,*) " nt_apnd = ",nt_apnd + write(iounit,*) " nt_hpnd = ",nt_hpnd + write(iounit,*) " nt_ipnd = ",nt_ipnd + write(iounit,*) " nt_aero = ",nt_aero + write(iounit,*) " nt_bgc_Nit = ",nt_bgc_Nit + write(iounit,*) " nt_bgc_Am = ",nt_bgc_Am + write(iounit,*) " nt_bgc_Sil = ",nt_bgc_Sil + write(iounit,*) " nt_bgc_DMSPp = ",nt_bgc_DMSPp + write(iounit,*) " nt_bgc_DMSPd = ",nt_bgc_DMSPd + write(iounit,*) " nt_bgc_DMS = ",nt_bgc_DMS + write(iounit,*) " nt_bgc_hum = ",nt_bgc_hum + write(iounit,*) " nt_bgc_PON = ",nt_bgc_PON + write(iounit,*) " nlt_bgc_Nit = ",nlt_bgc_Nit + write(iounit,*) " nlt_bgc_Am = ",nlt_bgc_Am + write(iounit,*) " nlt_bgc_Sil = ",nlt_bgc_Sil + write(iounit,*) " nlt_bgc_DMSPp = ",nlt_bgc_DMSPp + write(iounit,*) " nlt_bgc_DMSPd = ",nlt_bgc_DMSPd + write(iounit,*) " nlt_bgc_DMS = ",nlt_bgc_DMS + write(iounit,*) " nlt_bgc_hum = ",nlt_bgc_hum + write(iounit,*) " nlt_bgc_PON = ",nlt_bgc_PON + write(iounit,*) " nlt_chl_sw = ",nlt_chl_sw + write(iounit,*) " nt_zbgc_frac = ",nt_zbgc_frac + write(iounit,*) " nt_bgc_S = ",nt_bgc_S + + write(iounit,*) " max_nbtrcr = ",max_nbtrcr + do k = 1, max_nbtrcr + write(iounit,*) " bio_index_o(k) = ",k,bio_index_o(k) + write(iounit,*) " bio_index(k) = ",k,bio_index(k) + enddo + + write(iounit,*) " max_algae = ",max_algae + do k = 1, max_algae + write(iounit,*) " nt_bgc_N(k) = ",k,nt_bgc_N(k) + write(iounit,*) " nlt_bgc_N(k) = ",k,nlt_bgc_N(k) + write(iounit,*) " nt_bgc_C(k) = ",k,nt_bgc_C(k) + write(iounit,*) " nlt_bgc_C(k) = ",k,nlt_bgc_C(k) + write(iounit,*) " nt_bgc_chl(k) = ",k,nt_bgc_chl(k) + write(iounit,*) " nlt_bgc_chl(k) = ",k,nlt_bgc_chl(k) + enddo + + write(iounit,*) " max_DOC = ",max_DOC + do k = 1, max_DOC + write(iounit,*) " nt_bgc_DOC(k) = ",k,nt_bgc_DOC(k) + write(iounit,*) " nlt_bgc_DOC(k) = ",k,nlt_bgc_DOC(k) + enddo + + write(iounit,*) " max_DON = ",max_DON + do k = 1, max_DON + write(iounit,*) " nt_bgc_DON(k) = ",k,nt_bgc_DON(k) + write(iounit,*) " nlt_bgc_DON(k) = ",k,nlt_bgc_DON(k) + enddo + + write(iounit,*) " max_DIC = ",max_DIC + do k = 1, max_DIC + write(iounit,*) " nt_bgc_DIC(k) = ",k,nt_bgc_DIC(k) + write(iounit,*) " nlt_bgc_DIC(k) = ",k,nlt_bgc_DIC(k) + enddo + + write(iounit,*) " max_fe = ",max_fe + do k = 1, max_fe + write(iounit,*) " nt_bgc_Fed(k) = ",k,nt_bgc_Fed(k) + write(iounit,*) " nlt_bgc_Fed(k) = ",k,nlt_bgc_Fed(k) + write(iounit,*) " nt_bgc_Fep(k) = ",k,nt_bgc_Fep(k) + write(iounit,*) " nlt_bgc_Fep(k) = ",k,nlt_bgc_Fep(k) + enddo + + write(iounit,*) " max_aero = ",max_aero + do k = 1, max_aero + write(iounit,*) " nt_zaero(k) = ",k,nt_zaero(k) + write(iounit,*) " nlt_zaero(k) = ",k,nlt_zaero(k) + write(iounit,*) " nlt_zaero_sw(k) = ",k,nlt_zaero_sw(k) + enddo + + end subroutine icepack_write_tracer_indices + +!======================================================================= +! set the number of column tracers + + subroutine icepack_init_tracer_numbers(& + ntrcr_in, nbtrcr_in, nbtrcr_sw_in) + + integer (kind=int_kind), intent(in), optional :: & + ntrcr_in , &! number of tracers in use + nbtrcr_in , &! number of bio tracers in use + nbtrcr_sw_in ! number of shortwave bio tracers in use + + if (present(ntrcr_in) ) ntrcr = ntrcr_in + if (present(nbtrcr_in) ) nbtrcr = nbtrcr_in + if (present(nbtrcr_sw_in)) nbtrcr_sw = nbtrcr_sw_in + + end subroutine icepack_init_tracer_numbers + +!======================================================================= +! query the number of column tracers + + subroutine icepack_query_tracer_numbers(& + ntrcr_out, nbtrcr_out, nbtrcr_sw_out) + + integer (kind=int_kind), intent(out), optional :: & + ntrcr_out , &! number of tracers in use + nbtrcr_out , &! number of bio tracers in use + nbtrcr_sw_out ! number of shortwave bio tracers in use + + if (present(ntrcr_out) ) ntrcr_out = ntrcr + if (present(nbtrcr_out) ) nbtrcr_out = nbtrcr + if (present(nbtrcr_sw_out)) nbtrcr_sw_out = nbtrcr_sw + + end subroutine icepack_query_tracer_numbers + +!======================================================================= +! write the number of column tracers + + subroutine icepack_write_tracer_numbers(iounit) + + integer (kind=int_kind), intent(in) :: iounit + + write(iounit,*) "icepack_write_tracer_numbers:" + write(iounit,*) " ntrcr = ",ntrcr + write(iounit,*) " nbtrcr = ",nbtrcr + write(iounit,*) " nbtrcr_sw = ",nbtrcr_sw + + end subroutine icepack_write_tracer_numbers + !======================================================================= ! Compute tracer fields. diff --git a/columnphysics/icepack_itd.F90 b/columnphysics/icepack_itd.F90 index 6a6fda63b..32256e106 100644 --- a/columnphysics/icepack_itd.F90 +++ b/columnphysics/icepack_itd.F90 @@ -1586,9 +1586,9 @@ subroutine zerolayer_check (ncat, nilyr, & k , & ! vertical index n ! category index - real (kind=dbl_kind), parameter :: & - max_error = puny*Lfresh*rhos ! max error in zero layer energy check - ! (so max volume error = puny) + real (kind=dbl_kind) :: & + max_error ! max error in zero layer energy check + ! (so max volume error = puny) real (kind=dbl_kind), dimension (ncat) :: & eicen ! energy of melting for each ice layer (J/m^2) @@ -1611,6 +1611,8 @@ subroutine zerolayer_check (ncat, nilyr, & !----------------------------------------------------------------- l_stop = .false. + max_error = puny*Lfresh*rhos ! max error in zero layer energy check + ! (so max volume error = puny) !---------------------------------------------------------------- ! Calculate difference between ice and snow energies and the diff --git a/columnphysics/icepack_meltpond_topo.F90 b/columnphysics/icepack_meltpond_topo.F90 index dbaec5dcd..e79ddad8c 100644 --- a/columnphysics/icepack_meltpond_topo.F90 +++ b/columnphysics/icepack_meltpond_topo.F90 @@ -120,6 +120,7 @@ subroutine compute_ponds_topo(dt, ncat, nilyr, & dvice, & ! change in ice volume (m) Tavg, & ! mean surface temperature across categories (C) Tp, & ! pond freezing temperature (C) + rhoi_L,& ! (J/m^3) dvn ! change in melt pond volume for fresh water budget integer (kind=int_kind) :: n ! loop indices @@ -127,7 +128,6 @@ subroutine compute_ponds_topo(dt, ncat, nilyr, & real (kind=dbl_kind), parameter :: & hicemin = p1 , & ! minimum ice thickness with ponds (m) Td = p15 , & ! temperature difference for freeze-up (C) - rhoi_L = Lfresh * rhoi, & ! (J/m^3) min_volp = 1.e-4_dbl_kind ! minimum pond volume (m) !--------------------------------------------------------------- @@ -135,6 +135,7 @@ subroutine compute_ponds_topo(dt, ncat, nilyr, & !--------------------------------------------------------------- volp = c0 + rhoi_L = Lfresh * rhoi ! (J/m^3) do n = 1, ncat ! load tracers diff --git a/columnphysics/icepack_mushy_physics.F90 b/columnphysics/icepack_mushy_physics.F90 index 473612367..98da9424c 100644 --- a/columnphysics/icepack_mushy_physics.F90 +++ b/columnphysics/icepack_mushy_physics.F90 @@ -51,68 +51,6 @@ module icepack_mushy_physics az2p_liq = az2_liq / c1000, & bz2p_liq = bz2_liq / c1000 - ! quadratic constants - higher temperature region - real(kind=dbl_kind), parameter :: & - AS1_liq = az1p_liq * (rhow * cp_ocn - rhoi * cp_ice) , & - AC1_liq = rhoi * cp_ice * az1_liq , & - BS1_liq = (c1 + bz1p_liq) * (rhow * cp_ocn - rhoi * cp_ice) & - + rhoi * Lfresh * az1p_liq , & - BQ1_liq = -az1_liq , & - BC1_liq = rhoi * cp_ice * bz1_liq - rhoi * Lfresh * az1_liq, & - CS1_liq = rhoi * Lfresh * (c1 + bz1p_liq) , & - CQ1_liq = -bz1_liq , & - CC1_liq = -rhoi * Lfresh * bz1_liq - - ! quadratic constants - lower temperature region - real(kind=dbl_kind), parameter :: & - AS2_liq = az2p_liq * (rhow * cp_ocn - rhoi * cp_ice) , & - AC2_liq = rhoi * cp_ice * az2_liq , & - BS2_liq = (c1 + bz2p_liq) * (rhow * cp_ocn - rhoi * cp_ice) & - + rhoi * Lfresh * az2p_liq , & - BQ2_liq = -az2_liq , & - BC2_liq = rhoi * cp_ice * bz2_liq - rhoi * Lfresh * az2_liq, & - CS2_liq = rhoi * Lfresh * (c1 + bz2p_liq) , & - CQ2_liq = -bz2_liq , & - CC2_liq = -rhoi * Lfresh * bz2_liq - - ! break enthalpy constants - real(kind=dbl_kind), parameter :: & - D_liq = ((c1 + az1p_liq*Tb_liq + bz1p_liq) & - / ( az1_liq*Tb_liq + bz1_liq)) & - * ((cp_ocn*rhow - cp_ice*rhoi)*Tb_liq + Lfresh*rhoi), & - E_liq = cp_ice*rhoi*Tb_liq - Lfresh*rhoi - - ! just fully melted enthapy constants - real(kind=dbl_kind), parameter :: & - F1_liq = ( -c1000 * cp_ocn * rhow) / az1_liq , & - G1_liq = -c1000 , & - H1_liq = (-bz1_liq * cp_ocn * rhow) / az1_liq , & - F2_liq = ( -c1000 * cp_ocn * rhow) / az2_liq , & - G2_liq = -c1000 , & - H2_liq = (-bz2_liq * cp_ocn * rhow) / az2_liq - - ! warmer than fully melted constants - real(kind=dbl_kind), parameter :: & - I_liq = c1 / (cp_ocn * rhow) - - ! temperature to brine salinity - real(kind=dbl_kind), parameter :: & - J1_liq = bz1_liq / az1_liq , & - K1_liq = c1 / c1000 , & - L1_liq = (c1 + bz1p_liq) / az1_liq , & - J2_liq = bz2_liq / az2_liq , & - K2_liq = c1 / c1000 , & - L2_liq = (c1 + bz2p_liq) / az2_liq - - ! brine salinity to temperature - real(kind=dbl_kind), parameter :: & - M1_liq = az1_liq , & - N1_liq = -az1p_liq , & - O1_liq = -bz1_liq / az1_liq , & - M2_liq = az2_liq , & - N2_liq = -az2p_liq , & - O2_liq = -bz2_liq / az2_liq - !----------------------------------------------------------------- ! Other parameters !----------------------------------------------------------------- @@ -220,12 +158,11 @@ function temperature_snow(zqsn) result(zTsn) zqsn ! snow layer enthalpy (J m-3) real(kind=dbl_kind) :: & - zTsn ! snow layer temperature (C) - - real(kind=dbl_kind), parameter :: & - A = c1 / (rhos * cp_ice) , & - B = Lfresh / cp_ice - + zTsn, & ! snow layer temperature (C) + A, B + + A = c1 / (rhos * cp_ice) + B = Lfresh / cp_ice zTsn = A * zqsn + B end function temperature_snow @@ -249,6 +186,18 @@ function liquidus_brine_salinity_mush(zTin) result(Sbr) t_high , & ! mask for high temperature liquidus region lsubzero ! mask for sub-zero temperatures + real(kind=dbl_kind) :: & + J1_liq, K1_liq, L1_liq, & ! temperature to brine salinity + J2_liq, K2_liq, L2_liq + + ! temperature to brine salinity + J1_liq = bz1_liq / az1_liq + K1_liq = c1 / c1000 + L1_liq = (c1 + bz1p_liq) / az1_liq + J2_liq = bz2_liq / az2_liq + K2_liq = c1 / c1000 + L2_liq = (c1 + bz2p_liq) / az2_liq + t_high = merge(c1, c0, (zTin > Tb_liq)) lsubzero = merge(c1, c0, (zTin <= c0)) @@ -275,6 +224,22 @@ function liquidus_temperature_mush(Sbr) result(zTin) real(kind=dbl_kind) :: & t_high ! mask for high temperature liquidus region + real(kind=dbl_kind) :: & + M1_liq, &! brine salinity to temperature + N1_liq, & + O1_liq, & + M2_liq, & + N2_liq, & + O2_liq + + ! brine salinity to temperature + M1_liq = az1_liq + N1_liq = -az1p_liq + O1_liq = -bz1_liq / az1_liq + M2_liq = az2_liq + N2_liq = -az2p_liq + O2_liq = -bz2_liq / az2_liq + t_high = merge(c1, c0, (Sbr <= Sb_liq)) zTin = ((Sbr / (M1_liq + N1_liq * Sbr)) + O1_liq) * t_high + & @@ -380,6 +345,60 @@ function temperature_mush(zqin, zSin) result(zTin) t_low , & ! mask for low temperature liquidus region q_melt ! mask for all mush melted + ! quadratic constants - higher temperature region + real(kind=dbl_kind) :: & + AS1_liq, AC1_liq, & ! quadratic constants - higher temperature region + BS1_liq, BC1_liq, BQ1_liq, & ! " + CS1_liq, CC1_liq, CQ1_liq, & ! " + AS2_liq, AC2_liq, & ! quadratic constants - lower temperature region + BS2_liq, BC2_liq, BQ2_liq, & ! " + CS2_liq, CC2_liq, CQ2_liq, & ! " + D_liq, E_liq, & ! break enthalpy constants + F1_liq, G1_liq, H1_liq, & ! just fully melted enthapy constants + F2_liq, G2_liq, H2_liq, & ! " + I_liq ! warmer than fully melted constants + + !-------------------------------------------------------- + + ! quadratic constants - higher temperature region + AS1_liq = az1p_liq * (rhow * cp_ocn - rhoi * cp_ice) + AC1_liq = rhoi * cp_ice * az1_liq + BS1_liq = (c1 + bz1p_liq) * (rhow * cp_ocn - rhoi * cp_ice) & + + rhoi * Lfresh * az1p_liq + BQ1_liq = -az1_liq + BC1_liq = rhoi * cp_ice * bz1_liq - rhoi * Lfresh * az1_liq + CS1_liq = rhoi * Lfresh * (c1 + bz1p_liq) + CQ1_liq = -bz1_liq + CC1_liq = -rhoi * Lfresh * bz1_liq + + ! quadratic constants - lower temperature region + AS2_liq = az2p_liq * (rhow * cp_ocn - rhoi * cp_ice) + AC2_liq = rhoi * cp_ice * az2_liq + BS2_liq = (c1 + bz2p_liq) * (rhow * cp_ocn - rhoi * cp_ice) & + + rhoi * Lfresh * az2p_liq + BQ2_liq = -az2_liq + BC2_liq = rhoi * cp_ice * bz2_liq - rhoi * Lfresh * az2_liq + CS2_liq = rhoi * Lfresh * (c1 + bz2p_liq) + CQ2_liq = -bz2_liq + CC2_liq = -rhoi * Lfresh * bz2_liq + + ! break enthalpy constants + D_liq = ((c1 + az1p_liq*Tb_liq + bz1p_liq) & + / ( az1_liq*Tb_liq + bz1_liq)) & + * ((cp_ocn*rhow - cp_ice*rhoi)*Tb_liq + Lfresh*rhoi) + E_liq = cp_ice*rhoi*Tb_liq - Lfresh*rhoi + + ! just fully melted enthapy constants + F1_liq = ( -c1000 * cp_ocn * rhow) / az1_liq + G1_liq = -c1000 + H1_liq = (-bz1_liq * cp_ocn * rhow) / az1_liq + F2_liq = ( -c1000 * cp_ocn * rhow) / az2_liq + G2_liq = -c1000 + H2_liq = (-bz2_liq * cp_ocn * rhow) / az2_liq + + ! warmer than fully melted constants + I_liq = c1 / (cp_ocn * rhow) + ! just melted enthalpy S_low = merge(c1, c0, (zSin < Sb_liq)) q0 = ((F1_liq * zSin) / (G1_liq + zSin) + H1_liq) * S_low + & diff --git a/columnphysics/icepack_orbital.F90 b/columnphysics/icepack_orbital.F90 index 9e3882144..33137fdb6 100644 --- a/columnphysics/icepack_orbital.F90 +++ b/columnphysics/icepack_orbital.F90 @@ -18,6 +18,20 @@ module icepack_orbital public :: compute_coszen, & icepack_init_orbit + ! orbital parameters + integer (kind=int_kind) :: iyear_AD ! Year to calculate orbit for + real(kind=dbl_kind) :: eccen ! Earth's orbital eccentricity + real(kind=dbl_kind) :: obliqr ! Earth's obliquity in radians + real(kind=dbl_kind) :: lambm0 ! Mean longitude of perihelion at the + ! vernal equinox (radians) + real(kind=dbl_kind) :: mvelpp ! Earth's moving vernal equinox longitude + ! of perihelion + pi (radians) + real(kind=dbl_kind) :: obliq ! obliquity in degrees + real(kind=dbl_kind) :: mvelp ! moving vernal equinox long + real(kind=dbl_kind) :: decln ! solar declination angle in radians + real(kind=dbl_kind) :: eccf ! earth orbit eccentricity factor + logical(kind=log_kind) :: log_print ! Flags print of status/error + !======================================================================= contains @@ -30,9 +44,6 @@ module icepack_orbital subroutine icepack_init_orbit(l_stop, stop_label) - use icepack_constants, only: iyear_AD, eccen, obliqr, lambm0, & - mvelpp, obliq, mvelp, decln, eccf, log_print - logical (kind=log_kind), intent(out) :: & l_stop ! if true, abort the model @@ -63,7 +74,6 @@ subroutine compute_coszen (tlat, tlon, & nextsw_cday, yday, sec, & coszen, dt) - use icepack_constants, only: eccen, mvelpp, lambm0, obliqr, decln, eccf #ifdef CCSMCOUPLED use shr_orb_mod, only: shr_orb_decl #endif @@ -165,7 +175,6 @@ SUBROUTINE shr_orb_params( iyear_AD , eccen , obliq , mvelp , & integer(int_kind),parameter :: pmvelen=78 ! # of elements in series wrt vernal equinox real (dbl_kind),parameter :: psecdeg = 1.0_dbl_kind/3600.0_dbl_kind ! arc sec to deg conversion - real (dbl_kind) :: degrad = pi/180._dbl_kind ! degree to radian conversion factor real (dbl_kind) :: yb4_1950AD ! number of years before 1950 AD real (dbl_kind),parameter :: SHR_ORB_ECCEN_MIN = 0.0_dbl_kind ! min value for eccen @@ -363,6 +372,7 @@ SUBROUTINE shr_orb_params( iyear_AD , eccen , obliq , mvelp , & real (dbl_kind) :: years ! Years to time of interest ( pos <=> future) real (dbl_kind) :: eccen2 ! eccentricity squared real (dbl_kind) :: eccen3 ! eccentricity cubed + real (dbl_kind) :: degrad ! degrees to rad conversion integer (int_kind), parameter :: s_loglev = 0 character(len=char_len_long) :: warning ! warning message @@ -382,6 +392,7 @@ SUBROUTINE shr_orb_params( iyear_AD , eccen , obliq , mvelp , & l_stop = .false. stop_label = ' ' + degrad = pi/180._dbl_kind ! degree to radian conversion factor if ( log_print .and. s_loglev > 0 ) then write(warning,F00) 'Calculate characteristics of the orbit:' diff --git a/columnphysics/icepack_therm_mushy.F90 b/columnphysics/icepack_therm_mushy.F90 index 71a88eeaf..b46f4e0de 100644 --- a/columnphysics/icepack_therm_mushy.F90 +++ b/columnphysics/icepack_therm_mushy.F90 @@ -2882,7 +2882,6 @@ subroutine explicit_flow_velocities(nilyr, zSin, & real(kind=dbl_kind), parameter :: & kappal = 8.824e-8_dbl_kind, & ! heat diffusivity of liquid - ra_constants = gravit / (viscosity_dyn * kappal), & ! for Rayleigh number fracmax = p2 , & ! limiting advective layer fraction zSin_min = p1 , & ! minimum bulk salinity (ppt) safety_factor = c10 ! to prevent negative salinities @@ -2913,7 +2912,8 @@ subroutine explicit_flow_velocities(nilyr, zSin, & Bp , & ! B parameter for channel qlimit , & ! limit to vertical Darcy flow for numerical stability dS_guess , & ! expected bulk salinity without limits - alpha ! desalination limiting factor + alpha , & ! desalination limiting factor + ra_constants ! for Rayleigh number integer(kind=int_kind) :: & k ! ice layer index @@ -2946,6 +2946,7 @@ subroutine explicit_flow_velocities(nilyr, zSin, & ! no flow through ice top surface q(0) = c0 + ra_constants = gravit / (viscosity_dyn * kappal) ! first iterate over layers going up do k = nilyr, 1, -1 diff --git a/columnphysics/icepack_therm_vertical.F90 b/columnphysics/icepack_therm_vertical.F90 index 6b5505748..8741aaf88 100644 --- a/columnphysics/icepack_therm_vertical.F90 +++ b/columnphysics/icepack_therm_vertical.F90 @@ -1092,9 +1092,6 @@ subroutine thickness_changes (nilyr, nslyr, & ! local variables - real (kind=dbl_kind), parameter :: & - qbotmax = -p5*rhoi*Lfresh ! max enthalpy of ice growing at bottom - integer (kind=int_kind) :: & k ! vertical index @@ -1108,6 +1105,7 @@ subroutine thickness_changes (nilyr, nslyr, & emlt_ocn ! total energy of brine, to ocean (J m-2) real (kind=dbl_kind) :: & + qbotmax , & ! max enthalpy of ice growing at bottom dhi , & ! change in ice thickness dhs , & ! change in snow thickness Ti , & ! ice temperature @@ -1256,6 +1254,7 @@ subroutine thickness_changes (nilyr, nslyr, & ! enthalpy of new ice growing at bottom surface if (heat_capacity) then if (l_brine) then + qbotmax = -p5*rhoi*Lfresh ! max enthalpy of ice growing at bottom qbot = -rhoi * (cp_ice * (Tmlts-Tbot) & + Lfresh * (c1-Tmlts/Tbot) & - cp_ocn * Tmlts) diff --git a/configuration/driver/icepack_drv_constants.F90 b/configuration/driver/icepack_drv_constants.F90 index 7712a9eaa..ecbf5d993 100644 --- a/configuration/driver/icepack_drv_constants.F90 +++ b/configuration/driver/icepack_drv_constants.F90 @@ -67,9 +67,7 @@ module icepack_drv_constants p027 = p055*p5, & p222 = c2/c9, & eps13 = 1.0e-13_dbl_kind, & - eps16 = 1.0e-16_dbl_kind, & - piq = p5*pih, & - pi2 = c2*pi + eps16 = 1.0e-16_dbl_kind !----------------------------------------------------------------- ! conversion factors @@ -80,8 +78,7 @@ module icepack_drv_constants m_to_cm = 100._dbl_kind ,&! meters to cm m2_to_km2 = 1.e-6_dbl_kind ,&! m^2 to km^2 kg_to_g = 1000._dbl_kind ,&! kilograms to grams - mps_to_cmpdy = 8.64e6_dbl_kind ,&! m per s to cm per day - rad_to_deg = 180._dbl_kind/pi ! degree-radian conversion + mps_to_cmpdy = 8.64e6_dbl_kind ! m per s to cm per day !======================================================================= diff --git a/configuration/driver/icepack_drv_init.F90 b/configuration/driver/icepack_drv_init.F90 index 32cd11e95..517d861a7 100644 --- a/configuration/driver/icepack_drv_init.F90 +++ b/configuration/driver/icepack_drv_init.F90 @@ -66,6 +66,7 @@ subroutine input_data atm_data_format, ocn_data_format, bgc_data_format, & data_dir, dbug + use icepack_intfc, only: icepack_init_constants use icepack_intfc_tracers, only: tr_iage, tr_FY, tr_lvl, tr_pond, & tr_pond_cesm, tr_pond_lvl, tr_pond_topo, & tr_aero, nt_Tsfc, nt_qice, nt_qsno, nt_sice, & @@ -687,6 +688,8 @@ subroutine input_data endif endif + call icepack_init_constants() + end subroutine input_data !======================================================================= @@ -939,7 +942,7 @@ subroutine set_state_var (nx, ice_ic, & use icepack_drv_arrays_column, only: hin_max use icepack_intfc, only: icepack_init_trcr use icepack_drv_constants, only: c0, c1, c2, c3, p2, p5, rhoi, rhos, Lfresh, & - cp_ice, cp_ocn, Tsmelt, Tffresh, rad_to_deg, puny + cp_ice, cp_ocn, Tsmelt, Tffresh, puny use icepack_drv_domain_size, only: nilyr, nslyr, max_ntrcr, ncat use icepack_intfc_tracers, only: nt_Tsfc, nt_qice, nt_qsno, nt_sice, & nt_fbri, tr_brine, tr_lvl, nt_alvl, nt_vlvl