LCOV - code coverage report
Current view: top level - configuration/driver - icedrv_flux.F90 (source / functions) Hit Total Coverage
Test: 200904-015006:19b4ed4c2c:3:base,travis,quick Lines: 261 265 98.49 %
Date: 2020-09-03 20:12:34 Functions: 5 5 100.00 %

          Line data    Source code
       1             : !=======================================================================
       2             : 
       3             : ! Flux variable declarations; these include fields sent from the coupler
       4             : ! ("in"), sent to the coupler ("out"), written to diagnostic history files
       5             : ! ("diagnostic"), and used internally ("internal").
       6             : !
       7             : ! author Elizabeth C. Hunke, LANL
       8             : !
       9             :       module icedrv_flux
      10             : 
      11             :       use icedrv_kinds
      12             :       use icedrv_domain_size, only: ncat, nilyr, nx
      13             :       use icedrv_constants, only: c0, c1, c5, c10, c20, c180
      14             :       use icedrv_constants, only: nu_diag
      15             :       use icepack_intfc, only: icepack_max_iso, icepack_max_aero
      16             :       use icepack_intfc, only: icepack_max_nbtrcr, icepack_max_fe
      17             :       use icepack_intfc, only: icepack_max_algae, icepack_max_doc, icepack_max_don
      18             :       use icepack_intfc, only: icepack_max_dic
      19             :       use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted
      20             :       use icepack_intfc, only: icepack_query_parameters
      21             :       use icepack_intfc, only: icepack_query_tracer_flags, icepack_query_tracer_indices
      22             :       use icepack_intfc, only: icepack_query_parameters
      23             :       use icedrv_system, only: icedrv_system_abort
      24             : 
      25             :       implicit none
      26             :       private
      27             :       public :: init_coupler_flux, init_history_therm, init_history_dyn, &
      28             :                 init_flux_atm_ocn, init_history_bgc
      29             : 
      30             :       character (char_len), public :: &
      31             :          default_season ! seasonal default values for forcing
      32             : 
      33             :       !-----------------------------------------------------------------
      34             :       ! Dynamics component
      35             :       !-----------------------------------------------------------------
      36             : 
      37             :       real (kind=dbl_kind), dimension (nx), public :: &
      38             : 
      39             :        ! in from atmos (if .not.calc_strair)  
      40             :          strax   , & ! wind stress components (N/m^2)
      41             :          stray   , & ! 
      42             : 
      43             :        ! in from ocean
      44             :          uocn    , & ! ocean current, x-direction (m/s)
      45             :          vocn    , & ! ocean current, y-direction (m/s)
      46             : 
      47             :        ! out to atmosphere
      48             :          strairxT, & ! stress on ice by air, x-direction
      49             :          strairyT, & ! stress on ice by air, y-direction
      50             : 
      51             :        ! out to ocean          T-cell (kg/m s^2)
      52             :          strocnxT, & ! ice-ocean stress, x-direction
      53             :          strocnyT    ! ice-ocean stress, y-direction
      54             : 
      55             :        ! diagnostic
      56             : 
      57             :       real (kind=dbl_kind), dimension (nx), public :: &
      58             :          strairx , & ! stress on ice by air, x-direction
      59             :          strairy , & ! stress on ice by air, y-direction
      60             :          daidtd  , & ! ice area tendency due to transport   (1/s)
      61             :          dvidtd  , & ! ice volume tendency due to transport (m/s)
      62             :          dagedtd , & ! ice age tendency due to transport (s/s)
      63             :          dardg1dt, & ! rate of area loss by ridging ice (1/s)
      64             :          dardg2dt, & ! rate of area gain by new ridges (1/s)
      65             :          dvirdgdt, & ! rate of ice volume ridged (m/s)
      66             :          closing,  & ! rate of closing due to divergence/shear (1/s)
      67             :          opening     ! rate of opening due to divergence/shear (1/s)
      68             : 
      69             :       real (kind=dbl_kind), & 
      70             :          dimension (nx,ncat), public :: &
      71             :        ! ridging diagnostics in categories
      72             :          dardg1ndt, & ! rate of area loss by ridging ice (1/s)
      73             :          dardg2ndt, & ! rate of area gain by new ridges (1/s)
      74             :          dvirdgndt, & ! rate of ice volume ridged (m/s)
      75             :          aparticn,  & ! participation function
      76             :          krdgn,     & ! mean ridge thickness/thickness of ridging ice
      77             :          ardgn,     & ! fractional area of ridged ice
      78             :          vrdgn,     & ! volume of ridged ice
      79             :          araftn,    & ! rafting ice area
      80             :          vraftn,    & ! rafting ice volume 
      81             :          aredistn,  & ! redistribution function: fraction of new ridge area
      82             :          vredistn     ! redistribution function: fraction of new ridge volume
      83             : 
      84             :       !-----------------------------------------------------------------
      85             :       ! Thermodynamic component
      86             :       !-----------------------------------------------------------------
      87             : 
      88             :        ! in from atmosphere (if calc_Tsfc)
      89             : 
      90             :       real (kind=dbl_kind), dimension (nx), public :: &
      91             :          zlvl    , & ! atm level height (m)
      92             :          uatm    , & ! wind velocity components (m/s)
      93             :          vatm    , &
      94             :          wind    , & ! wind speed (m/s)
      95             :          potT    , & ! air potential temperature  (K)
      96             :          Tair    , & ! air temperature  (K)
      97             :          Qa      , & ! specific humidity (kg/kg)
      98             :          rhoa    , & ! air density (kg/m^3)
      99             :          swvdr   , & ! sw down, visible, direct  (W/m^2)
     100             :          swvdf   , & ! sw down, visible, diffuse (W/m^2)
     101             :          swidr   , & ! sw down, near IR, direct  (W/m^2)
     102             :          swidf   , & ! sw down, near IR, diffuse (W/m^2)
     103             :          flw         ! incoming longwave radiation (W/m^2)
     104             : 
     105             :        ! in from atmosphere (if .not. calc_Tsfc)
     106             :        ! These are per ice area
     107             : 
     108             :       real (kind=dbl_kind), & 
     109             :          dimension (nx,ncat), public :: &
     110             :          fsurfn_f   , & ! net flux to top surface, excluding fcondtop
     111             :          fcondtopn_f, & ! downward cond flux at top surface (W m-2)
     112             :          fsensn_f   , & ! sensible heat flux (W m-2)
     113             :          flatn_f        ! latent heat flux (W m-2)
     114             : 
     115             :        ! in from atmosphere
     116             : 
     117             :       real (kind=dbl_kind), dimension (nx), public :: &
     118             :          frain   , & ! rainfall rate (kg/m^2 s)
     119             :          fsnow       ! snowfall rate (kg/m^2 s)
     120             : 
     121             :        ! in from ocean
     122             : 
     123             :       real (kind=dbl_kind), dimension (nx), public :: &
     124             :          sss     , & ! sea surface salinity (ppt)
     125             :          sst     , & ! sea surface temperature (C)
     126             :          sstdat  , & ! sea surface temperature (C) saved for restoring
     127             :          frzmlt  , & ! freezing/melting potential (W/m^2)
     128             :          frzmlt_init, & ! frzmlt used in current time step (W/m^2)
     129             :          Tf      , & ! freezing temperature (C)
     130             :          qdp     , & ! deep ocean heat flux (W/m^2), negative upward
     131             :          hmix        ! mixed layer depth (m)
     132             : 
     133             :       ! water isotopes
     134             :       real (kind=dbl_kind), dimension (nx), public :: &
     135             :          HDO_ocn    , & ! seawater concentration of HDO (kg/kg)
     136             :          H2_16O_ocn , & ! seawater concentration of H2_16O (kg/kg)
     137             :          H2_18O_ocn     ! seawater concentration of H2_18O (kg/kg)
     138             : 
     139             :       real (kind=dbl_kind), dimension (nx), public :: &
     140             :          fsens   , & ! sensible heat flux (W/m^2)
     141             :          flat    , & ! latent heat flux   (W/m^2)
     142             :          fswabs  , & ! shortwave flux absorbed in ice and ocean (W/m^2)
     143             :          fswint_ai,& ! SW absorbed in ice interior below surface (W/m^2)
     144             :          flwout  , & ! outgoing longwave radiation (W/m^2)
     145             :          Tref    , & ! 2m atm reference temperature (K)
     146             :          Qref    , & ! 2m atm reference spec humidity (kg/kg)
     147             :          Uref    , & ! 10m atm reference wind speed (m/s)
     148             :          evap    , & ! evaporative water flux (kg/m^2/s)
     149             :          evaps   , & ! evaporative water flux over snow (kg/m^2/s)
     150             :          evapi       ! evaporative water flux over ice (kg/m^2/s)
     151             : 
     152             :        ! albedos aggregated over categories (if calc_Tsfc)
     153             :       real (kind=dbl_kind), dimension(nx), public :: &
     154             :          alvdr   , & ! visible, direct   (fraction)
     155             :          alidr   , & ! near-ir, direct   (fraction)
     156             :          alvdf   , & ! visible, diffuse  (fraction)
     157             :          alidf   , & ! near-ir, diffuse  (fraction)
     158             :          ! grid-box-mean versions
     159             :          alvdr_ai, & ! visible, direct   (fraction)
     160             :          alidr_ai, & ! near-ir, direct   (fraction)
     161             :          alvdf_ai, & ! visible, diffuse  (fraction)
     162             :          alidf_ai, & ! near-ir, diffuse  (fraction)
     163             :          ! components for history
     164             :          albice    , & ! bare ice albedo
     165             :          albsno    , & ! snow albedo
     166             :          albpnd    , & ! melt pond albedo
     167             :          apeff_ai  , & ! effective pond area used for radiation calculation
     168             :          snowfrac  , & ! snow fraction used in radiation
     169             :          ! components for diagnostic
     170             :          alvdr_init, & ! visible, direct   (fraction)
     171             :          alidr_init, & ! near-ir, direct   (fraction)
     172             :          alvdf_init, & ! visible, diffuse  (fraction)
     173             :          alidf_init    ! near-ir, diffuse  (fraction)
     174             : 
     175             :        ! out to ocean
     176             :       real (kind=dbl_kind), dimension (nx), public :: &
     177             :          fpond   , & ! fresh water flux to ponds (kg/m^2/s)
     178             :          fresh   , & ! fresh water flux to ocean (kg/m^2/s)
     179             :          fsalt   , & ! salt flux to ocean (kg/m^2/s)
     180             :          fhocn   , & ! net heat flux to ocean (W/m^2)
     181             :          fswthru , & ! shortwave penetrating to ocean (W/m^2)
     182             :          fswthru_vdr , & ! vis dir shortwave penetrating to ocean (W/m^2)
     183             :          fswthru_vdf , & ! vis dif shortwave penetrating to ocean (W/m^2)
     184             :          fswthru_idr , & ! nir dir shortwave penetrating to ocean (W/m^2)
     185             :          fswthru_idf     ! nir dif shortwave penetrating to ocean (W/m^2)
     186             : 
     187             :        ! internal
     188             : 
     189             :       real (kind=dbl_kind), &
     190             :          dimension (nx), public :: &
     191             :          fswfac  , & ! for history
     192             :          scale_factor! scaling factor for shortwave components
     193             : 
     194             :       logical (kind=log_kind), public :: &
     195             :          update_ocn_f, & ! if true, update fresh water and salt fluxes
     196             :          l_mpond_fresh   ! if true, include freshwater feedback from meltponds
     197             :                          ! when running in ice-ocean or coupled configuration
     198             : 
     199             :       real (kind=dbl_kind), dimension (nx,ncat), public :: &
     200             :          meltsn      , & ! snow melt in category n (m)
     201             :          melttn      , & ! top melt in category n (m)
     202             :          meltbn      , & ! bottom melt in category n (m)
     203             :          congeln     , & ! congelation ice formation in category n (m)
     204             :          snoicen         ! snow-ice formation in category n (m)
     205             : 
     206             :       real (kind=dbl_kind), dimension (nx,ncat), public :: &
     207             :          keffn_top       ! effective thermal conductivity of the top ice layer 
     208             :                          ! on categories (W/m^2/K)
     209             : 
     210             :       ! quantities passed from ocean mixed layer to atmosphere
     211             : 
     212             :       real (kind=dbl_kind), dimension (nx), public :: &
     213             :          strairx_ocn , & ! stress on ocean by air, x-direction
     214             :          strairy_ocn , & ! stress on ocean by air, y-direction
     215             :          fsens_ocn   , & ! sensible heat flux (W/m^2)
     216             :          flat_ocn    , & ! latent heat flux   (W/m^2)
     217             :          flwout_ocn  , & ! outgoing longwave radiation (W/m^2)
     218             :          evap_ocn    , & ! evaporative water flux (kg/m^2/s)
     219             :          alvdr_ocn   , & ! visible, direct   (fraction)
     220             :          alidr_ocn   , & ! near-ir, direct   (fraction)
     221             :          alvdf_ocn   , & ! visible, diffuse  (fraction)
     222             :          alidf_ocn   , & ! near-ir, diffuse  (fraction)
     223             :          Tref_ocn    , & ! 2m atm reference temperature (K)
     224             :          Qref_ocn        ! 2m atm reference spec humidity (kg/kg)
     225             : 
     226             :       ! diagnostic
     227             : 
     228             :       real (kind=dbl_kind), dimension (nx), public :: &
     229             :          fsurf , & ! net surface heat flux (excluding fcondtop)(W/m^2)
     230             :          fcondtop,&! top surface conductive flux        (W/m^2)
     231             :          fcondbot,&! bottom surface conductive flux        (W/m^2)
     232             :          fbot,   & ! heat flux at bottom surface of ice (excluding excess) (W/m^2)
     233             :          Tbot,   & ! Temperature at bottom surface of ice (deg C)
     234             :          Tsnice,  & ! Temperature at snow ice interface (deg C)
     235             :          congel, & ! basal ice growth         (m/step-->cm/day)
     236             :          frazil, & ! frazil ice growth        (m/step-->cm/day)
     237             :          snoice, & ! snow-ice formation       (m/step-->cm/day)
     238             :          meltt , & ! top ice melt             (m/step-->cm/day)
     239             :          melts , & ! snow melt                (m/step-->cm/day)
     240             :          meltb , & ! basal ice melt           (m/step-->cm/day)
     241             :          meltl , & ! lateral ice melt         (m/step-->cm/day)
     242             :          dsnow,  & ! change in snow thickness (m/step-->cm/day)
     243             :          daidtt, & ! ice area tendency thermo.   (s^-1)
     244             :          dvidtt, & ! ice volume tendency thermo. (m/s)
     245             :          dagedtt,& ! ice age tendency thermo.    (s/s)
     246             :          mlt_onset, &! day of year that sfc melting begins
     247             :          frz_onset, &! day of year that freezing begins (congel or frazil)
     248             :          frazil_diag ! frazil ice growth diagnostic (m/step-->cm/day)
     249             :          
     250             :       real (kind=dbl_kind), & 
     251             :          dimension (nx,ncat), public :: &
     252             :          fsurfn,   & ! category fsurf
     253             :          fcondtopn,& ! category fcondtop
     254             :          fcondbotn,& ! category fcondbot
     255             :          fsensn,   & ! category sensible heat flux
     256             :          flatn       ! category latent heat flux
     257             : 
     258             :       ! As above but these remain grid box mean values i.e. they are not
     259             :       ! divided by aice at end of ice_dynamics.
     260             :       ! These are used for generating
     261             :       ! ice diagnostics as these are more accurate. 
     262             :       ! (The others suffer from problem of incorrect values at grid boxes
     263             :       !  that change from an ice free state to an icy state.)
     264             :     
     265             :       real (kind=dbl_kind), dimension (nx), public :: &
     266             :          fresh_ai, & ! fresh water flux to ocean (kg/m^2/s)
     267             :          fsalt_ai, & ! salt flux to ocean (kg/m^2/s)
     268             :          fhocn_ai, & ! net heat flux to ocean (W/m^2)
     269             :          fswthru_ai  ! shortwave penetrating to ocean (W/m^2)
     270             : 
     271             :       !-----------------------------------------------------------------
     272             :       ! internal
     273             :       !-----------------------------------------------------------------
     274             : 
     275             :       real (kind=dbl_kind), dimension (nx), public :: &
     276             :          rside   , & ! fraction of ice that melts laterally
     277             :          fside   , & ! lateral heat flux (W/m^2)
     278             :          fsw     , & ! incoming shortwave radiation (W/m^2)
     279             :          coszen  , & ! cosine solar zenith angle, < 0 for sun below horizon 
     280             :          rdg_conv, & ! convergence term for ridging (1/s)
     281             :          rdg_shear   ! shear term for ridging (1/s)
     282             :  
     283             :       real (kind=dbl_kind), dimension(nx,nilyr+1), public :: &
     284             :          salinz  , & ! initial salinity  profile (ppt)   
     285             :          Tmltz       ! initial melting temperature (C)
     286             : 
     287             :       !-----------------------------------------------------------------
     288             :       ! biogeochemistry
     289             :       !-----------------------------------------------------------------
     290             : 
     291             :       ! in from atmosphere
     292             : 
     293             :       real (kind=dbl_kind), &   ! coupling variable for both tr_aero and tr_zaero
     294             :          dimension (nx,icepack_max_aero), public :: &
     295             :          faero_atm   ! aerosol deposition rate (kg/m^2 s)   
     296             : 
     297             :       real (kind=dbl_kind), &   ! coupling variable for tr_iso
     298             :          dimension (nx,icepack_max_iso), public :: &
     299             :          fiso_atm  , & ! isotope deposition rate (kg/m^2 s)   
     300             :          fiso_evap     ! isotope evaporation rate (kg/m^2 s)   
     301             : 
     302             :       real (kind=dbl_kind), &
     303             :          dimension (nx,icepack_max_nbtrcr), public :: &
     304             :          flux_bio_atm  ! all bio fluxes to ice from atmosphere
     305             : 
     306             :       real (kind=dbl_kind), dimension (nx,icepack_max_iso), public :: &
     307             :          Qa_iso      , & ! isotope specific humidity (kg/kg)
     308             :          Qref_iso        ! 2m atm reference isotope spec humidity (kg/kg)
     309             : 
     310             :       ! out to ocean
     311             : 
     312             :       real (kind=dbl_kind), &
     313             :          dimension (nx,icepack_max_aero), public :: &
     314             :          faero_ocn   ! aerosol flux to ocean  (kg/m^2/s)
     315             : 
     316             :       real (kind=dbl_kind), &
     317             :          dimension (nx,icepack_max_iso), public :: &
     318             :          fiso_ocn    ! isotope flux to ocean  (kg/m^2/s)
     319             : 
     320             :       real (kind=dbl_kind), &
     321             :          dimension (nx,icepack_max_nbtrcr), public :: &
     322             :          flux_bio   , & ! all bio fluxes to ocean
     323             :          flux_bio_ai    ! all bio fluxes to ocean, averaged over grid cell
     324             : 
     325             :       real (kind=dbl_kind), dimension (nx), public :: &
     326             :          fzsal_ai, & ! salt flux to ocean from zsalinity (kg/m^2/s) 
     327             :          fzsal_g_ai  ! gravity drainage salt flux to ocean (kg/m^2/s) 
     328             : 
     329             :       ! internal
     330             : 
     331             :       logical (kind=log_kind), public :: &
     332             :          cpl_bgc         ! switch to couple BGC via drivers
     333             : 
     334             :       real (kind=dbl_kind), dimension (nx,ncat), public :: &
     335             :          hin_old     , & ! old ice thickness
     336             :          dsnown          ! change in snow thickness in category n (m)
     337             : 
     338             :       real (kind=dbl_kind), dimension (nx), public :: &
     339             :          nit        , & ! ocean nitrate (mmol/m^3)          
     340             :          amm        , & ! ammonia/um (mmol/m^3)
     341             :          sil        , & ! silicate (mmol/m^3)
     342             :          dmsp       , & ! dmsp (mmol/m^3)
     343             :          dms        , & ! dms (mmol/m^3)
     344             :          hum        , & ! humic material carbon (mmol/m^3)
     345             :          fnit       , & ! ice-ocean nitrate flux (mmol/m^2/s), positive to ocean
     346             :          famm       , & ! ice-ocean ammonia/um flux (mmol/m^2/s), positive to ocean
     347             :          fsil       , & ! ice-ocean silicate flux (mmol/m^2/s), positive to ocean
     348             :          fdmsp      , & ! ice-ocean dmsp (mmol/m^2/s), positive to ocean
     349             :          fdms       , & ! ice-ocean dms (mmol/m^2/s), positive to ocean
     350             :          fhum       , & ! ice-ocean humic material carbon (mmol/m^2/s), positive to ocean
     351             :          fdust          ! ice-ocean dust flux (kg/m^2/s), positive to ocean
     352             : 
     353             :       real (kind=dbl_kind), dimension (nx,icepack_max_algae), public :: &
     354             :          algalN     , & ! ocean algal nitrogen (mmol/m^3) (diatoms, pico, phaeo)
     355             :          falgalN        ! ice-ocean algal nitrogen flux (mmol/m^2/s) (diatoms, pico, phaeo)
     356             : 
     357             :       real (kind=dbl_kind), dimension (nx,icepack_max_doc), public :: &
     358             :          doc         , & ! ocean doc (mmol/m^3)  (saccharids, lipids, tbd )
     359             :          fdoc            ! ice-ocean doc flux (mmol/m^2/s)  (saccharids, lipids, tbd)
     360             : 
     361             :       real (kind=dbl_kind), dimension (nx,icepack_max_don), public :: &
     362             :          don         , & ! ocean don (mmol/m^3) (proteins and amino acids)
     363             :          fdon            ! ice-ocean don flux (mmol/m^2/s) (proteins and amino acids)
     364             : 
     365             :       real (kind=dbl_kind), dimension (nx,icepack_max_dic), public :: &
     366             :          dic         , & ! ocean dic (mmol/m^3) 
     367             :          fdic            ! ice-ocean dic flux (mmol/m^2/s) 
     368             : 
     369             :       real (kind=dbl_kind), dimension (nx,icepack_max_fe), public :: &
     370             :          fed, fep    , & ! ocean dissolved and particulate fe (nM) 
     371             :          ffed, ffep      ! ice-ocean dissolved and particulate fe flux (umol/m^2/s) 
     372             : 
     373             :       real (kind=dbl_kind), dimension (nx,icepack_max_aero), public :: &
     374             :          zaeros          ! ocean aerosols (mmol/m^3) 
     375             : 
     376             : !=======================================================================
     377             : 
     378             :       contains
     379             : 
     380             : !=======================================================================
     381             : 
     382             : ! Initialize all fluxes exchanged with flux coupler
     383             : ! and some data-derived fields
     384             : !
     385             : ! author Elizabeth C. Hunke, LANL
     386             : 
     387          46 :       subroutine init_coupler_flux
     388             : 
     389             :       use icedrv_arrays_column, only: Cdn_atm
     390             :       use icepack_intfc, only: icepack_liquidus_temperature
     391             : 
     392             :       integer (kind=int_kind) :: n
     393             : 
     394             :       real (kind=dbl_kind) :: fcondtopn_d(6), fsurfn_d(6)
     395          17 :       real (kind=dbl_kind) :: stefan_boltzmann, Tffresh
     396          34 :       real (kind=dbl_kind) :: vonkar, zref, iceruf
     397             : 
     398             :       integer :: i
     399             : 
     400             :       data fcondtopn_d / -50.0_dbl_kind,-17.0_dbl_kind,-12.0_dbl_kind, &
     401             :                           -9.0_dbl_kind, -7.0_dbl_kind, -3.0_dbl_kind /
     402             :       data fsurfn_d    /  0.20_dbl_kind, 0.15_dbl_kind, 0.10_dbl_kind, &
     403             :                           0.05_dbl_kind, 0.01_dbl_kind, 0.01_dbl_kind /
     404             : 
     405             :       character(len=*), parameter :: subname='(init_coupler_flux)'
     406             : 
     407             :       !-----------------------------------------------------------------
     408             :       ! query Icepack values
     409             :       !-----------------------------------------------------------------
     410             : 
     411             :       call icepack_query_parameters(stefan_boltzmann_out=stefan_boltzmann, &
     412          46 :         Tffresh_out=Tffresh, vonkar_out=vonkar, zref_out=zref, iceruf_out=iceruf)
     413          46 :       call icepack_warnings_flush(nu_diag)
     414          46 :       if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, &
     415           0 :           file=__FILE__,line= __LINE__)
     416             : 
     417             :       !-----------------------------------------------------------------
     418             :       ! fluxes received from atmosphere
     419             :       !-----------------------------------------------------------------
     420         230 :       zlvl  (:) = c10                ! atm level height (m)
     421         230 :       rhoa  (:) = 1.3_dbl_kind       ! air density (kg/m^3)
     422         230 :       uatm  (:) = c5                 ! wind velocity    (m/s)
     423         230 :       vatm  (:) = c5
     424         230 :       strax (:) = 0.05_dbl_kind
     425         230 :       stray (:) = 0.05_dbl_kind
     426          46 :       fsnow (:) = c0                 ! snowfall rate (kg/m2/s)
     427             :                                      ! fsnow must be 0 for exact restarts
     428          46 :       if (trim(default_season) == 'winter') then
     429             :          ! typical winter values
     430          15 :          potT  (:) = 253.0_dbl_kind  ! air potential temp (K)
     431          15 :          Tair  (:) = 253.0_dbl_kind  ! air temperature  (K)
     432          15 :          Qa    (:) = 0.0006_dbl_kind ! specific humidity (kg/kg)
     433           3 :          swvdr (:) = c0              ! shortwave radiation (W/m^2)
     434           3 :          swvdf (:) = c0              ! shortwave radiation (W/m^2)
     435           3 :          swidr (:) = c0              ! shortwave radiation (W/m^2)
     436           3 :          swidf (:) = c0              ! shortwave radiation (W/m^2)
     437          15 :          flw   (:) = c180            ! incoming longwave rad (W/m^2)
     438           3 :          frain (:) = c0              ! rainfall rate (kg/m2/s)
     439           6 :          do n = 1, ncat              ! conductive heat flux (W/m^2)
     440          18 :             fcondtopn_f(:,n) = fcondtopn_d(n)
     441             :          enddo
     442           3 :          fsurfn_f = fcondtopn_f      ! surface heat flux (W/m^2)
     443           3 :          flatn_f (:,:) = c0          ! latent heat flux (kg/m2/s)
     444           3 :          fsensn_f(:,:) = c0          ! sensible heat flux (W/m^2)
     445          43 :       elseif (trim(default_season) == 'summer') then
     446             :          ! typical summer values
     447          15 :          potT  (:) = 273.0_dbl_kind  ! air potential temp (K)
     448          15 :          Tair  (:) = 273.0_dbl_kind  ! air temperature  (K)
     449          15 :          Qa    (:) = 0.0035_dbl_kind ! specific humidity (kg/kg)
     450          15 :          swvdr (:) = 50._dbl_kind    ! shortwave radiation (W/m^2)
     451          15 :          swvdf (:) = 50._dbl_kind    ! shortwave radiation (W/m^2)
     452          15 :          swidr (:) = 50._dbl_kind    ! shortwave radiation (W/m^2)
     453          15 :          swidf (:) = 50._dbl_kind    ! shortwave radiation (W/m^2)
     454          15 :          flw   (:) = 280.0_dbl_kind  ! incoming longwave rad (W/m^2)
     455           3 :          frain (:) = c0              ! rainfall rate (kg/m2/s)
     456          18 :          do n = 1, ncat                   ! surface heat flux (W/m^2)
     457          78 :             fsurfn_f(:,n) = fsurfn_d(n)
     458             :          enddo
     459           3 :          fcondtopn_f(:,:) =  0.0_dbl_kind ! conductive heat flux (W/m^2)
     460          78 :          flatn_f    (:,:) = -2.0_dbl_kind ! latent heat flux (W/m^2)
     461           3 :          fsensn_f   (:,:) =  c0           ! sensible heat flux (W/m^2)
     462             :       else
     463             :          ! typical spring values
     464         200 :          potT  (:) = 263.15_dbl_kind ! air potential temp (K)
     465         200 :          Tair  (:) = 263.15_dbl_kind ! air temperature  (K)
     466         200 :          Qa    (:) = 0.001_dbl_kind  ! specific humidity (kg/kg)
     467         200 :          swvdr (:) = 25._dbl_kind    ! shortwave radiation (W/m^2)
     468         200 :          swvdf (:) = 25._dbl_kind    ! shortwave radiation (W/m^2)
     469         200 :          swidr (:) = 25._dbl_kind    ! shortwave radiation (W/m^2)
     470         200 :          swidf (:) = 25._dbl_kind    ! shortwave radiation (W/m^2)
     471         200 :          flw   (:) = 230.0_dbl_kind  ! incoming longwave rad (W/m^2)
     472          40 :          frain (:) = c0              ! rainfall rate (kg/m2/s)
     473         240 :          do n = 1, ncat                   ! surface heat flux (W/m^2)
     474        1040 :             fsurfn_f(:,n) = fsurfn_d(n)
     475             :          enddo
     476          40 :          fcondtopn_f(:,:) =  c0           ! conductive heat flux (W/m^2)
     477        1040 :          flatn_f    (:,:) = -1.0_dbl_kind ! latent heat flux (W/m^2)
     478          40 :          fsensn_f   (:,:) =  c0           ! sensible heat flux (W/m^2)
     479             :       endif !     l_winter
     480             : 
     481          46 :       fiso_atm     (:,:) = c0        ! isotope deposition rate (kg/m2/s)
     482          46 :       fiso_evap    (:,:) = c0        ! isotope evaporation rate (kg/m2/s)
     483          46 :       faero_atm    (:,:) = c0        ! aerosol deposition rate (kg/m2/s)
     484          46 :       flux_bio_atm (:,:) = c0        ! zaero and bio deposition rate (kg/m2/s)
     485             : 
     486             :       !-----------------------------------------------------------------
     487             :       ! fluxes received from ocean
     488             :       !-----------------------------------------------------------------
     489             : 
     490          46 :       uocn   (:) = c0              ! surface ocean currents (m/s)
     491          46 :       vocn   (:) = c0
     492          46 :       frzmlt (:) = c0              ! freezing/melting potential (W/m^2)
     493         230 :       sss    (:) = 34.0_dbl_kind   ! sea surface salinity (ppt)
     494         230 :       sst    (:) = -1.8_dbl_kind   ! sea surface temperature (C)
     495          46 :       sstdat (:) = sst(:)          ! sea surface temperature (C)
     496             : 
     497             :       ! water isotopes from ocean
     498          46 :       HDO_ocn   (:) = c0
     499          46 :       H2_16O_ocn(:) = c0
     500          46 :       H2_18O_ocn(:) = c0
     501             : 
     502         230 :       do i = 1, nx
     503         230 :          Tf (i) = icepack_liquidus_temperature(sss(i)) ! freezing temp (C)
     504             :       enddo
     505          46 :       call icepack_warnings_flush(nu_diag)
     506          46 :       if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, &
     507           0 :           file=__FILE__,line= __LINE__)
     508             : 
     509          46 :       qdp     (:) = c0             ! deep ocean heat flux (W/m^2)
     510         230 :       hmix    (:) = c20            ! ocean mixed layer depth
     511             : 
     512             :       !-----------------------------------------------------------------
     513             :       ! fluxes sent to atmosphere
     514             :       !-----------------------------------------------------------------
     515             : 
     516          46 :       strairxT(:) = c0            ! wind stress, T grid
     517          46 :       strairyT(:) = c0
     518             : 
     519          46 :       fsens   (:) = c0
     520          46 :       flat    (:) = c0
     521          46 :       fswabs  (:) = c0
     522         230 :       flwout  (:) = -stefan_boltzmann*Tffresh**4   
     523             :                      ! in case atm model diagnoses Tsfc from flwout
     524          46 :       evap    (:) = c0
     525          46 :       evaps   (:) = c0
     526          46 :       evapi   (:) = c0
     527          46 :       Tref    (:) = c0
     528          46 :       Qref    (:) = c0
     529          46 :       Uref    (:) = c0
     530          46 :       alvdr   (:) = c0
     531          46 :       alidr   (:) = c0
     532          46 :       alvdf   (:) = c0
     533          46 :       alidf   (:) = c0
     534             : 
     535             :       !-----------------------------------------------------------------
     536             :       ! fluxes sent to ocean
     537             :       !-----------------------------------------------------------------
     538             : 
     539          46 :       strocnxT(:) = c0    ! ice-ocean stress, x-direction (T-cell)
     540          46 :       strocnyT(:) = c0    ! ice-ocean stress, y-direction (T-cell)
     541          46 :       fresh   (:) = c0
     542          46 :       fsalt   (:) = c0
     543          46 :       fhocn   (:) = c0
     544          46 :       fswthru (:) = c0
     545          46 :       fswthru_vdr (:) = c0
     546          46 :       fswthru_vdf (:) = c0
     547          46 :       fswthru_idr (:) = c0
     548          46 :       fswthru_idf (:) = c0
     549          46 :       flux_bio(:,:) = c0 ! bgc
     550          46 :       fnit    (:) = c0
     551          46 :       fsil    (:) = c0
     552          46 :       famm    (:) = c0
     553          46 :       fdmsp   (:) = c0
     554          46 :       fdms    (:) = c0
     555          46 :       fhum    (:) = c0
     556          46 :       fdust   (:) = c0
     557          46 :       falgalN(:,:)= c0
     558          46 :       fdoc   (:,:)= c0
     559          46 :       fdic   (:,:)= c0
     560          46 :       fdon   (:,:)= c0
     561          46 :       ffep   (:,:)= c0
     562          46 :       ffed   (:,:)= c0
     563             :       
     564             :       !-----------------------------------------------------------------
     565             :       ! derived or computed fields
     566             :       !-----------------------------------------------------------------
     567             : 
     568          46 :       coszen  (:) = c0            ! Cosine of the zenith angle
     569             : !      fsw     (:) = c0            ! shortwave radiation (W/m^2)
     570         230 :       fsw     (:) = swvdr(:) + swvdf(:) + swidr(:) + swidf(:)
     571         230 :       scale_factor(:) = c1        ! shortwave scaling factor 
     572         230 :       wind    (:) = sqrt(uatm(:)**2 + vatm(:)**2)  ! wind speed, (m/s)
     573             :       Cdn_atm(:) = (vonkar/log(zref/iceruf)) &
     574         230 :                  * (vonkar/log(zref/iceruf)) ! atmo drag for RASM
     575             : 
     576          46 :       end subroutine init_coupler_flux
     577             : 
     578             : !=======================================================================
     579             : 
     580             : ! Initialize some fluxes sent to coupler for use by the atm and ocean models
     581             : !
     582             : ! author: Elizabeth C. Hunke, LANL
     583             : 
     584      351300 :       subroutine init_flux_atm_ocn
     585             :       character(len=*), parameter :: subname='(init_flux_atm_ocn)'
     586             : 
     587             :       !-----------------------------------------------------------------
     588             :       ! initialize albedo and atmosphere fluxes
     589             :       !-----------------------------------------------------------------
     590             : 
     591      351300 :       strairxT(:) = c0      ! wind stress, T grid
     592      351300 :       strairyT(:) = c0
     593      351300 :       fsens   (:) = c0
     594      351300 :       flat    (:) = c0
     595      351300 :       fswabs  (:) = c0
     596      351300 :       flwout  (:) = c0
     597      351300 :       evap    (:) = c0
     598      351300 :       evaps   (:) = c0
     599      351300 :       evapi   (:) = c0
     600      351300 :       Tref    (:) = c0
     601      351300 :       Qref    (:) = c0
     602      351300 :       Uref    (:) = c0
     603      351300 :       fiso_evap(:,:) = c0   ! isotope evaporation rate (kg/m2/s)
     604             : 
     605             :       !-----------------------------------------------------------------
     606             :       ! fluxes sent to ocean
     607             :       !-----------------------------------------------------------------
     608             : 
     609      351300 :       fresh    (:)   = c0
     610      351300 :       fsalt    (:)   = c0
     611      351300 :       fhocn    (:)   = c0
     612      351300 :       fswthru  (:)   = c0
     613      351300 :       fswthru_vdr  (:)   = c0
     614      351300 :       fswthru_vdf  (:)   = c0
     615      351300 :       fswthru_idr  (:)   = c0
     616      351300 :       fswthru_idf  (:)   = c0
     617      351300 :       fiso_ocn (:,:) = c0
     618      351300 :       faero_ocn(:,:) = c0
     619             : 
     620      351300 :       end subroutine init_flux_atm_ocn
     621             : 
     622             : !=======================================================================
     623             : 
     624             : ! Initialize thermodynamic fields written to history files.
     625             : !
     626             : ! authors: William H. Lipscomb, LANL
     627             : !          Elizabeth C. Hunke, LANL
     628             : 
     629      351346 :       subroutine init_history_therm
     630             : 
     631             :       use icedrv_state, only: aice, vice, trcr
     632             :       use icedrv_arrays_column, only: hfreebd, hdraft, hridge, distrdg
     633             :       use icedrv_arrays_column, only: hkeel, dkeel, lfloe, dfloe
     634             :       use icedrv_arrays_column, only: Cdn_atm_skin, Cdn_atm_floe
     635             :       use icedrv_arrays_column, only: Cdn_atm_pond, Cdn_atm_rdg
     636             :       use icedrv_arrays_column, only: Cdn_ocn_skin, Cdn_ocn_floe
     637             :       use icedrv_arrays_column, only: Cdn_ocn_keel, Cdn_atm_ratio
     638             :       use icedrv_arrays_column, only: Cdn_atm, Cdn_ocn
     639             : 
     640             :       logical (kind=log_kind) :: formdrag, tr_iage
     641             :       integer (kind=int_kind) :: nt_iage
     642      127349 :       real (kind=dbl_kind) :: vonkar, zref, iceruf
     643      127349 :       real (kind=dbl_kind) :: dragio
     644             :       character(len=*), parameter :: subname='(init_history_therm)'
     645             : 
     646             :       !-----------------------------------------------------------------
     647             :       ! query Icepack values
     648             :       !-----------------------------------------------------------------
     649             : 
     650      351346 :       call icepack_query_parameters(formdrag_out=formdrag)
     651      351346 :       call icepack_query_tracer_flags(tr_iage_out=tr_iage)
     652      351346 :       call icepack_query_tracer_indices(nt_iage_out=nt_iage)
     653             :       call icepack_query_parameters(dragio_out=dragio, &
     654      351346 :            vonkar_out=vonkar, zref_out=zref, iceruf_out=iceruf)
     655             : 
     656      351346 :       call icepack_warnings_flush(nu_diag)
     657      351346 :       if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, &
     658           0 :           file=__FILE__,line= __LINE__)
     659             : 
     660             :       !-----------------------------------------------------------------
     661             : 
     662      351346 :       fsurf  (:) = c0
     663      351346 :       fcondtop(:)= c0
     664      351346 :       fcondbot(:)= c0
     665      351346 :       congel (:) = c0
     666      351346 :       frazil (:) = c0
     667      351346 :       snoice (:) = c0
     668      351346 :       dsnow  (:) = c0
     669      351346 :       meltt  (:) = c0
     670      351346 :       melts  (:) = c0
     671      351346 :       meltb  (:) = c0
     672      351346 :       meltl  (:) = c0
     673      351346 :       daidtt (:) = aice(:) ! temporary initial area
     674      351346 :       dvidtt (:) = vice(:) ! temporary initial volume
     675      351346 :       if (tr_iage) then
     676       76870 :          dagedtt(:) = trcr(:,nt_iage) ! temporary initial age
     677             :       else
     678      335972 :          dagedtt(:) = c0
     679             :       endif
     680      351346 :       fsurfn    (:,:) = c0
     681      351346 :       fcondtopn (:,:) = c0
     682      351346 :       fcondbotn (:,:) = c0
     683      351346 :       flatn     (:,:) = c0
     684      351346 :       fsensn    (:,:) = c0
     685      351346 :       fpond     (:) = c0
     686      351346 :       fresh_ai  (:) = c0
     687      351346 :       fsalt_ai  (:) = c0
     688      351346 :       fhocn_ai  (:) = c0
     689      351346 :       fswthru_ai(:) = c0
     690      351346 :       albice (:) = c0
     691      351346 :       albsno (:) = c0
     692      351346 :       albpnd (:) = c0
     693      351346 :       apeff_ai (:) = c0
     694      351346 :       snowfrac (:) = c0
     695      351346 :       frazil_diag (:) = c0
     696             : 
     697             :       ! drag coefficients are computed prior to the atmo_boundary call, 
     698             :       ! during the thermodynamics section 
     699     1756730 :       Cdn_ocn(:) = dragio
     700             :       Cdn_atm(:) = (vonkar/log(zref/iceruf)) &
     701     1756730 :                  * (vonkar/log(zref/iceruf)) ! atmo drag for RASM
     702             : 
     703      351346 :       if (formdrag) then
     704       24135 :         Cdn_atm_rdg (:) = c0
     705       24135 :         Cdn_atm_ratio(:)= c0
     706       24135 :         Cdn_atm_floe(:) = c0
     707       24135 :         Cdn_atm_pond(:) = c0
     708       24135 :         Cdn_atm_skin(:) = c0
     709       24135 :         Cdn_ocn_skin(:) = c0
     710       24135 :         Cdn_ocn_keel(:) = c0
     711       24135 :         Cdn_ocn_floe(:) = c0
     712       24135 :         hfreebd     (:) = c0
     713       24135 :         hdraft      (:) = c0
     714       24135 :         hridge      (:) = c0
     715       24135 :         distrdg     (:) = c0
     716       24135 :         hkeel       (:) = c0
     717       24135 :         dkeel       (:) = c0
     718       24135 :         lfloe       (:) = c0
     719       24135 :         dfloe       (:) = c0
     720             :       endif
     721             : 
     722      351346 :       end subroutine init_history_therm
     723             : 
     724             : !=======================================================================
     725             : 
     726             : ! Initialize dynamic fields written to history files.
     727             : !
     728             : ! authors: William H. Lipscomb, LANL
     729             : !          Elizabeth C. Hunke, LANL
     730             : 
     731      351300 :       subroutine init_history_dyn
     732             : 
     733             :       use icedrv_state, only: aice, vice, trcr
     734             :       logical (kind=log_kind) :: tr_iage
     735             :       integer (kind=int_kind) :: nt_iage
     736             :       character(len=*), parameter :: subname='(init_history_dyn)'
     737             : 
     738             :       !-----------------------------------------------------------------
     739             :       ! query Icepack values
     740             :       !-----------------------------------------------------------------
     741             : 
     742      351300 :       call icepack_query_tracer_flags(tr_iage_out=tr_iage)
     743      351300 :       call icepack_query_tracer_indices(nt_iage_out=nt_iage)
     744      351300 :       call icepack_warnings_flush(nu_diag)
     745      351300 :       if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, &
     746           0 :           file=__FILE__,line= __LINE__)
     747             : 
     748             :       !-----------------------------------------------------------------
     749             : 
     750      351300 :       dardg1dt(:) = c0
     751      351300 :       dardg2dt(:) = c0
     752      351300 :       dvirdgdt(:) = c0
     753      351300 :       daidtd  (:) = aice(:) ! temporary initial area
     754      351300 :       dvidtd  (:) = vice(:) ! temporary initial volume
     755      351300 :       if (tr_iage) &
     756       76860 :          dagedtd (:) = trcr(:,nt_iage) ! temporary initial age
     757      351300 :       ardgn   (:,:) = c0
     758      351300 :       vrdgn   (:,:) = c0
     759     8651160 :       krdgn   (:,:) = c1
     760      351300 :       aparticn(:,:) = c0
     761      351300 :       aredistn(:,:) = c0
     762      351300 :       vredistn(:,:) = c0
     763      351300 :       dardg1ndt(:,:) = c0
     764      351300 :       dardg2ndt(:,:) = c0
     765      351300 :       dvirdgndt(:,:) = c0
     766      351300 :       araftn   (:,:) = c0
     767      351300 :       vraftn   (:,:) = c0
     768      351300 :       aredistn (:,:) = c0
     769      351300 :       vredistn (:,:) = c0
     770             : 
     771      351300 :       end subroutine init_history_dyn
     772             : 
     773             : !=======================================================================
     774             : 
     775             : ! Initialize bgc fields written to history files
     776             : !
     777             : ! authors: Nicole Jeffery, LANL
     778             : 
     779      351300 :       subroutine init_history_bgc
     780             : 
     781             :       use icedrv_arrays_column, only: PP_net, grow_net, hbri
     782             :       use icedrv_arrays_column, only: ice_bio_net, snow_bio_net, fbio_snoice, fbio_atmice
     783             :       use icedrv_arrays_column, only: fzsal, fzsal_g, zfswin 
     784             :       character(len=*), parameter :: subname='(init_history_bgc)'
     785             : 
     786      351300 :       PP_net        (:) = c0
     787      351300 :       grow_net      (:) = c0
     788      351300 :       hbri          (:) = c0
     789      351300 :       flux_bio    (:,:) = c0
     790      351300 :       flux_bio_ai (:,:) = c0
     791      351300 :       ice_bio_net (:,:) = c0
     792      351300 :       snow_bio_net(:,:) = c0
     793      351300 :       fbio_snoice (:,:) = c0
     794      351300 :       fbio_atmice (:,:) = c0
     795      351300 :       fzsal         (:) = c0
     796      351300 :       fzsal_g       (:) = c0
     797      351300 :       zfswin    (:,:,:) = c0
     798      351300 :       fnit          (:) = c0
     799      351300 :       fsil          (:) = c0
     800      351300 :       famm          (:) = c0
     801      351300 :       fdmsp         (:) = c0
     802      351300 :       fdms          (:) = c0
     803      351300 :       fhum          (:) = c0
     804      351300 :       fdust         (:) = c0
     805      351300 :       falgalN     (:,:) = c0
     806      351300 :       fdoc        (:,:) = c0
     807      351300 :       fdic        (:,:) = c0
     808      351300 :       fdon        (:,:) = c0
     809      351300 :       ffep        (:,:) = c0
     810      351300 :       ffed        (:,:) = c0
     811             : 
     812      351300 :       end subroutine init_history_bgc
     813             : 
     814             : !=======================================================================
     815             : 
     816             :       end module icedrv_flux
     817             : 
     818             : !=======================================================================

Generated by: LCOV version 1.14-6-g40580cd