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

Generated by: LCOV version 1.14-6-g40580cd