!-----------------------------------------------------------------------
!
! Modules for each field class, and subs to initialize field structures:
!
!-----------------------------------------------------------------------
      module flds_airglow
      use fields
      use params
      implicit none
!
      integer,parameter :: nf_airglow=6
      type (field) :: f_airglow(nf_airglow) 
      real,target,dimension(nlev) ::
     |  e5577, eo200, e6300, eco215, eno53, sr63
      contains
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      subroutine init_airglow
      integer :: n
      n = 0
!
      n = n+1 
      write(f_airglow(n)%long_name,"('Greenline Emission')")
      f_airglow(n)%short_name = "E5577"
      f_airglow(n)%units = "PHOTONS CM-3 S-1"
      f_airglow(n)%var_name = "E5577"
      f_airglow(n)%data     => e5577
!
      n = n+1 
      write(f_airglow(n)%long_name,"('O2 Atmospheric Band Emission')")
      f_airglow(n)%short_name = "EO200"
      f_airglow(n)%units = "PHOTONS CM-3 S-1"
      f_airglow(n)%var_name = "EO200"
      f_airglow(n)%data     => eo200
!
      n = n+1 
      write(f_airglow(n)%long_name,"('Redline Emission')")
      f_airglow(n)%short_name = "E6300"
      f_airglow(n)%units = "PHOTONS CM-3 S-1"
      f_airglow(n)%var_name = "E6300"
      f_airglow(n)%data     => e6300
!
      n = n+1 
      write(f_airglow(n)%long_name,"('15 micron CO2')")
      f_airglow(n)%short_name = "ECO215"
      f_airglow(n)%units = "PHOTONS CM-3 S-1"
      f_airglow(n)%var_name = "ECO215"
      f_airglow(n)%data     => eco215
!
      n = n+1 
      write(f_airglow(n)%long_name,"('5.3 micron NO Emission')")
      f_airglow(n)%units = "PHOTONS CM-3 S-1"
      f_airglow(n)%short_name = "ENO53"
      f_airglow(n)%var_name = "ENO53"
      f_airglow(n)%data     => eno53
!
      n = n+1 
      write(f_airglow(n)%long_name,"('Shumann-Runge 63')")
      f_airglow(n)%short_name = "SR63"
      f_airglow(n)%units = "PHOTONS CM-3 S-1"
      f_airglow(n)%var_name = "SR63"
      f_airglow(n)%data     => sr63
!
! Initial value:
      do n=1,nf_airglow
        f_airglow(n)%data = 0.
        f_airglow(n)%class = "airglow"
        f_airglow(n)%timedep = "time-independent"
        f_airglow(n)%logplt = 1
      enddo
!     write(6,"(/,'Initialized ',i3,' airglow fields:')") nf_airglow
!     write(6,"(7a10)") (trim(f_airglow(n)%short_name),n=1,nf_airglow)
!     do n=1,nf_airglow
!       write(6,"('  Field ',i3,': ',a)")
!    |    n,trim(f_airglow(n)%short_name)
!     enddo
      end subroutine init_airglow
      end module flds_airglow
!
!-----------------------------------------------------------------------
!
      module flds_atmos
      use fields
      use params
      implicit none
!
      integer,parameter :: nf_atmos=49
      type (field) :: f_atmos(nf_atmos) 
      real,target,dimension(nlev) ::
     |  xno     ,xno2    ,xnn2    ,xnno    ,xn2d    ,xn4s    ,
     |  xnno2   ,xnox    ,xno3    ,xno1d   ,xnhox   ,xnh     ,   
     |  xnoh    ,xnho2   ,xnh2o2  ,xnhtot  ,xnh2    ,xnh2o   ,
     |  xnco2   ,xnco    ,xnch4   ,xnhe    ,xnarg   ,xnnoz   ,
     |  xnof    ,tn      ,rho     ,sht     ,amas    ,xnou    ,
     |  xno21d  ,xno21s  ,tvib    ,xnn2o   ,xnch4l  ,xnnoy   ,
     |  xnhno3  ,xnn2o5  ,xnh2o2l ,xnno3   ,xn4sl   ,xncl    ,
     |  xnclo   ,ch3     ,ch3o2   ,ch3ooh  ,ch3o    ,ch2o    ,
     |  hco
      contains
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      subroutine init_atmos
      integer :: n
      n = 0
!
! XNO:
      n = n+1 
      write(f_atmos(n)%long_name,"('ATOMIC OXYGEN')")
      f_atmos(n)%short_name = "O"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNO"
      f_atmos(n)%data     => xno
!
! XNO2:
      n = n+1 
      write(f_atmos(n)%long_name,"('MOLECULAR OXYGEN')")
      f_atmos(n)%short_name = "O2"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNO2"
      f_atmos(n)%data => xno2
!
! XNN2:
      n = n+1 
      write(f_atmos(n)%long_name,"('MOLECULAR NITROGEN')")
      f_atmos(n)%short_name = "N2"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNN2"
      f_atmos(n)%data => xnn2
!
! XNNO:
      n = n+1 
      write(f_atmos(n)%long_name,"('NITRIC OXIDE')")
      f_atmos(n)%short_name = "NO"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNNO"
      f_atmos(n)%data => xnno
!
! XN2D:
      n = n+1 
      write(f_atmos(n)%long_name,"('N(2D)')")
      f_atmos(n)%short_name = "N2D"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XN2D"
      f_atmos(n)%data => xn2d
!
! XN4S:
      n = n+1 
      write(f_atmos(n)%long_name,"('N(4S)')")
      f_atmos(n)%short_name = "N4S"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XN4S"
      f_atmos(n)%data => xn4s
!
! XNNO2:
      n = n+1 
      write(f_atmos(n)%long_name,"('NO2')")
      f_atmos(n)%short_name = "NO2"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNNO2"
      f_atmos(n)%data => xnno2
!
! XNOX:
      n = n+1 
      write(f_atmos(n)%long_name,"('OX (O+O3)')")
      f_atmos(n)%short_name = "OX"
      f_atmos(n)%units = "CM"
      f_atmos(n)%var_name = "XNOX"
      f_atmos(n)%data => xnox
!
! XNO3:
      n = n+1 
      write(f_atmos(n)%long_name,"('OZONE')")
      f_atmos(n)%short_name = "O3"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNO3"
      f_atmos(n)%data => xno3
!
! XNO1D:
      n = n+1 
      write(f_atmos(n)%long_name,"('O(1D)')")
      f_atmos(n)%short_name = "NO1D"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNO1D"
      f_atmos(n)%data => xno1d
!
! HOX:
      n = n+1 
      write(f_atmos(n)%long_name,"('HOX (OH_HO2+H)')")
      f_atmos(n)%short_name = "HOX"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNHOX"
      f_atmos(n)%data => xnhox
!
! XNH:
      n = n+1 
      write(f_atmos(n)%long_name,"('HYDROGEN')")
      f_atmos(n)%short_name = "H"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNH"
      f_atmos(n)%data => xnh
!
! XNOH:
      n = n+1 
      write(f_atmos(n)%long_name,"('HYDROXYL')")
      f_atmos(n)%short_name = "OH"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNOH"
      f_atmos(n)%data => xnoh
!
! HO2:
      n = n+1 
      write(f_atmos(n)%long_name,"('HYDROGEN DIOXIDE')")
      f_atmos(n)%short_name = "HO2"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNHO2"
      f_atmos(n)%data => xnho2
!
! XNH2O2:
      n = n+1 
      write(f_atmos(n)%long_name,"('HYDROGEN PEROXIDE')")
      f_atmos(n)%short_name = "H2O2"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNH2O2"
      f_atmos(n)%data => xnh2o2
!
! XNHTOT:
      n = n+1 
      write(f_atmos(n)%long_name,"('TOTAL HYDROGEN')")
      f_atmos(n)%short_name = "HTOT"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNHTOT"
      f_atmos(n)%data => xnhtot
!
! XNH2:
      n = n+1 
      write(f_atmos(n)%long_name,"('MOLECULAR HYDROGEN')")
      f_atmos(n)%short_name = "H2"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNH2"
      f_atmos(n)%data => xnh2
!
! XNH2O:
      n = n+1 
      write(f_atmos(n)%long_name,"('WATER VAPOR')")
      f_atmos(n)%short_name = "H2O"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNH2O"
      f_atmos(n)%data => xnh2o
!
! XNCO2:
      n = n+1 
      write(f_atmos(n)%long_name,"('CARBON DIOXIDE')")
      f_atmos(n)%short_name = "CO2"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNCO2"
      f_atmos(n)%data => xnco2
!
! XNCO:
      n = n+1 
      write(f_atmos(n)%long_name,"('CARBON MONOXIDE')")
      f_atmos(n)%short_name = "CO"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNCO"
      f_atmos(n)%data => xnco
!
! XNCH4:
      n = n+1 
      write(f_atmos(n)%long_name,"('METHANE')")
      f_atmos(n)%short_name = "CH4"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNCH4"
      f_atmos(n)%data => xnch4
!
! XNHE:
      n = n+1 
      write(f_atmos(n)%long_name,"('HELIUM')")
      f_atmos(n)%short_name = "HE"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNHE"
      f_atmos(n)%data => xnhe
!
! XNARG:
      n = n+1 
      write(f_atmos(n)%long_name,"('ARGON')")
      f_atmos(n)%short_name = "ARG"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNARG"
      f_atmos(n)%data => xnarg
!
! XNNOZ:
      n = n+1 
      write(f_atmos(n)%long_name,"('NOZ (NO+NO2)')")
      f_atmos(n)%short_name = "NOZ"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNNOZ"
      f_atmos(n)%data => xnnoz
!
! XNOF:
      n = n+1 
      write(f_atmos(n)%long_name,"('XNOF')")
      f_atmos(n)%short_name = "XNOF"
      f_atmos(n)%units = " "
      f_atmos(n)%var_name = "XNOF"
      f_atmos(n)%data => xnof
!
! TN:
      n = n+1 
      write(f_atmos(n)%long_name,"('NEUTRAL TEMPERATURE')")
      f_atmos(n)%short_name = "TN"
      f_atmos(n)%units = "DEG K"
      f_atmos(n)%var_name = "TN"
      f_atmos(n)%data => tn
!
! RHO:
      n = n+1 
      write(f_atmos(n)%long_name,"('TOTAL DENSITY')")
      f_atmos(n)%short_name = "RHO"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "RHO"
      f_atmos(n)%data => rho
!
      n = n+1 
      write(f_atmos(n)%long_name,"('SCALE HEIGHT')")
      f_atmos(n)%short_name = "SHT"
      f_atmos(n)%units = "CM"
      f_atmos(n)%var_name = "SHT"
      f_atmos(n)%data => sht
!
      n = n+1 
      write(f_atmos(n)%long_name,"('AMAS')")
      f_atmos(n)%short_name = "AMAS"
      f_atmos(n)%units = " "
      f_atmos(n)%var_name = "AMAS"
      f_atmos(n)%data => amas
!
      n = n+1 
      write(f_atmos(n)%long_name,"('XNOU')")
      f_atmos(n)%short_name = "XNOU"
      f_atmos(n)%units = " "
      f_atmos(n)%var_name = "XNOU"
      f_atmos(n)%data => xnou
!
! XNO21D:
      n = n+1 
      write(f_atmos(n)%long_name,"('O2(1D)')")
      f_atmos(n)%short_name = "O21D"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNO21D"
      f_atmos(n)%data => xno21d
!
      n = n+1 
      write(f_atmos(n)%long_name,"('O2(1S)')")
      f_atmos(n)%short_name = "O21S"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNO21S"
      f_atmos(n)%data => xno21s
!
      n = n+1 
      write(f_atmos(n)%long_name,"('TVIB')")
      f_atmos(n)%short_name = "TVIB"
      f_atmos(n)%units = " "
      f_atmos(n)%var_name = "TVIB"
      f_atmos(n)%data => tvib
!
! XNN2O:
      n = n+1 
      write(f_atmos(n)%long_name,"('NITROUS OXIDE')")
      f_atmos(n)%short_name = "N2O"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNN2O"
      f_atmos(n)%data => xnn2o
!
      n = n+1 
      write(f_atmos(n)%long_name,"('CH4L')")
      f_atmos(n)%short_name = "CH4L"
      f_atmos(n)%units = " "
      f_atmos(n)%var_name = "XNCH4L"
      f_atmos(n)%data => xnch4l
!
      n = n+1 
      write(f_atmos(n)%long_name,"('NOY')")
      f_atmos(n)%short_name = "NOY"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNNOY"
      f_atmos(n)%data => xnnoy
!
      n = n+1 
      write(f_atmos(n)%long_name,"('HNO3')")
      f_atmos(n)%short_name = "HNO3"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNHNO3"
      f_atmos(n)%data => xnhno3
!
      n = n+1 
      write(f_atmos(n)%long_name,"('N2O5')")
      f_atmos(n)%short_name = "N2O5"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNN2O5"
      f_atmos(n)%data => xnn2o5
!
      n = n+1 
      write(f_atmos(n)%long_name,"('H2O2L')")
      f_atmos(n)%short_name = "H2O2L"
      f_atmos(n)%units = " "
      f_atmos(n)%var_name = "XNH2O2L"
      f_atmos(n)%data => xnh2o2l
!
      n = n+1 
      write(f_atmos(n)%long_name,"('NO3')")
      f_atmos(n)%short_name = "NO3"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNNO3"
      f_atmos(n)%data => xnno3
!
      n = n+1 
      write(f_atmos(n)%long_name,"('N4SL')")
      f_atmos(n)%short_name = "N4SL"
      f_atmos(n)%units = " "
      f_atmos(n)%var_name = "XN4SL"
      f_atmos(n)%data => xn4sl
!
! XNCL:
      n = n+1 
      write(f_atmos(n)%long_name,"('Chlorine')")
      f_atmos(n)%short_name = "CL"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNCL"
      f_atmos(n)%data => xncl
!
! XNCLO:
      n = n+1 
      write(f_atmos(n)%long_name,"('CLO')")
      f_atmos(n)%short_name = "CLO"
      f_atmos(n)%units = "CM-3"
      f_atmos(n)%var_name = "XNCLO"
      f_atmos(n)%data => xnclo
!
! CH3:
      n = n+1 
      write(f_atmos(n)%long_name,"('Methane')")
      f_atmos(n)%short_name = "CH3"
      f_atmos(n)%units = " "
      f_atmos(n)%var_name = "CH3"
      f_atmos(n)%data => ch3
!
! CH3O2:
      n = n+1 
      write(f_atmos(n)%long_name,"('CH3O2')")
      f_atmos(n)%short_name = "CH3O2"
      f_atmos(n)%units = " "
      f_atmos(n)%var_name = "CH3O2"
      f_atmos(n)%data => ch3o2
!
      n = n+1 
      write(f_atmos(n)%long_name,"('CH3OOH')")
      f_atmos(n)%short_name = "CH3OOH"
      f_atmos(n)%units = " "
      f_atmos(n)%var_name = "CH3OOH"
      f_atmos(n)%data => ch3ooh
!
      n = n+1 
      write(f_atmos(n)%long_name,"('CH3O')")
      f_atmos(n)%short_name = "CH3O"
      f_atmos(n)%units = " "
      f_atmos(n)%var_name = "CH3O"
      f_atmos(n)%data => ch3o
!
      n = n+1 
      write(f_atmos(n)%long_name,"('CH2O')")
      f_atmos(n)%short_name = "CH2O"
      f_atmos(n)%units = " "
      f_atmos(n)%var_name = "CH2O"
      f_atmos(n)%data => ch2o
!
      n = n+1 
      write(f_atmos(n)%long_name,"('HCO')")
      f_atmos(n)%short_name = "HCO"
      f_atmos(n)%units = " "
      f_atmos(n)%var_name = "HCO"
      f_atmos(n)%data => hco
!
! Initial value:
      do n=1,nf_atmos
        f_atmos(n)%data = 0.
        f_atmos(n)%class = "atmosp"
        f_atmos(n)%timedep = "time-dependent"
        f_atmos(n)%logplt = 1
        if (trim(f_atmos(n)%short_name)=='TN'  ) f_atmos(n)%logplt = 0
        if (trim(f_atmos(n)%short_name)=='SHT' ) f_atmos(n)%logplt = 0
        if (trim(f_atmos(n)%short_name)=='AMAS') f_atmos(n)%logplt = 0
        if (trim(f_atmos(n)%short_name)=='TVIB') f_atmos(n)%logplt = 0
      enddo
!
!     write(6,"(/,'Initialized ',i3,' atmosp fields:')") nf_atmos
!     write(6,"(7a10)") (trim(f_atmos(n)%short_name),n=1,nf_atmos)
!     do n=1,nf_atmos
!       write(6,"('  Field ',i3,': ',a)")
!    |    n,trim(f_atmos(n)%short_name)
!     enddo
      end subroutine init_atmos
      end module flds_atmos
!
!-----------------------------------------------------------------------
!
      module flds_col
      use fields
      use params
      implicit none
!
      integer,parameter :: nf_col=11
      type (field) :: f_col(nf_col) 
      real,target,dimension(nlev) ::
     |  clno3   ,cno     ,cno2    ,cnn2    ,txno    ,txno2   ,
     |  txnn2   ,txno3   ,schap   ,yeesrcj ,yeesrch
!
      contains
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      subroutine init_col
      integer :: n
      n = 0
!
      n = n+1 
      write(f_col(n)%long_name,"('CLNO3')")
      f_col(n)%short_name = "CLNO3"
      f_col(n)%units = " "
      f_col(n)%var_name = "CLNO3"
      f_col(n)%data => clno3
!
      n = n+1 
      write(f_col(n)%long_name,"('CNO')")
      f_col(n)%short_name = "CNO"
      f_col(n)%units = " "
      f_col(n)%var_name = "CNO"
      f_col(n)%data => cno
!
      n = n+1 
      write(f_col(n)%long_name,"('CNO2')")
      f_col(n)%short_name = "CNO2"
      f_col(n)%units = " "
      f_col(n)%var_name = "CNO2"
      f_col(n)%data => cno2
!
      n = n+1 
      write(f_col(n)%long_name,"('CNN2')")
      f_col(n)%short_name = "CNN2"
      f_col(n)%units = " "
      f_col(n)%var_name = "CNN2"
      f_col(n)%data => cnn2
!
      n = n+1 
      write(f_col(n)%long_name,"('TXNO')")
      f_col(n)%short_name = "TXNO"
      f_col(n)%units = " "
      f_col(n)%var_name = "TXNO"
      f_col(n)%data => txno
!
      n = n+1 
      write(f_col(n)%long_name,"('TXNO2')")
      f_col(n)%short_name = "TXNO2"
      f_col(n)%units = " "
      f_col(n)%var_name = "TXNO2"
      f_col(n)%data => txno2
!
      n = n+1 
      write(f_col(n)%long_name,"('TXNN2')")
      f_col(n)%short_name = "TXNN2"
      f_col(n)%units = " "
      f_col(n)%var_name = "TXNN2"
      f_col(n)%data => txnn2
!
      n = n+1 
      write(f_col(n)%long_name,"('TXNO3')")
      f_col(n)%short_name = "TXNO3"
      f_col(n)%units = " "
      f_col(n)%var_name = "TXNO3"
      f_col(n)%data => txno3
!
      n = n+1 
      write(f_col(n)%long_name,"('SCHAP')")
      f_col(n)%short_name = "SCHAP"
      f_col(n)%units = " "
      f_col(n)%var_name = "SCHAP"
      f_col(n)%data => schap
!
      n = n+1 
      write(f_col(n)%long_name,"('YEESRCJ')")
      f_col(n)%short_name = "YEESRCJ"
      f_col(n)%units = " "
      f_col(n)%var_name = "YEESRCJ"
      f_col(n)%data => yeesrcj
!
      n = n+1 
      write(f_col(n)%long_name,"('YEESRCH')")
      f_col(n)%short_name = "YEESRCH"
      f_col(n)%units = " "
      f_col(n)%var_name = "YEESRCH"
      f_col(n)%data => yeesrch
!
! Initial value:
      do n=1,nf_col
        f_col(n)%data = 0.
        f_col(n)%class = "collll"
        f_col(n)%timedep = "time-dependent"
        f_col(n)%logplt = 1
      enddo
!     write(6,"(/,'Initialized ',i3,' col fields:')") nf_col
!     write(6,"(7a10)") (trim(f_col(n)%short_name),n=1,nf_col)
!     do n=1,nf_col
!       write(6,"('  Field ',i3,': ',a)")
!    |    n,trim(f_col(n)%short_name)
!     enddo
      end subroutine init_col
      end module flds_col
!
!-----------------------------------------------------------------------
!
      module flds_dissoc
      use fields
      use params
      implicit none
!
      integer,parameter :: nf_dissoc=60
      type (field) :: f_dissoc(nf_dissoc) 
      real,target,dimension(nlev) ::
     |  do2euv  ,do2lya  ,do2src  ,do2srb  ,do2hz   ,do2t    ,
     |  dh2oeuv ,dh2olya ,dh2osrc ,dh2osrb ,dh2ot   ,dco2euv ,
     |  dco2lya ,dco2src ,dco2srb ,dco2t   ,dch4euv ,dch4lya ,
     |  dch4b   ,dch4t   ,dcoeuv  ,do3euv  ,do3lya  ,do3src  ,
     |  do3srb  ,do3hz   ,do3har  ,do3hug  ,do3chap ,do3t    ,
     |  pnoeuv  ,dnosrb  ,dno2t   ,dh2o2t  ,dnchm   ,dichm   ,
     |  dho2b   ,dnoeuv  ,po3chap ,po3hug  ,po3har  ,pdo2hz  ,
     |  pdo3hz  ,pdo2srb ,pdo2src ,pdh2o2t ,pdno2t  ,diop    ,
     |  dio2p   ,din2p   ,dinp    ,diop2p  ,diop2d  ,diop4s  ,
     |  xjo2srb ,xjh2osb ,dh2osrn ,sjmlya  ,sjo2lya ,sjnmlya
      real :: xjdis(nlev,44) ! see sub uars_solaruv in solheat.F
!
      contains
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      subroutine init_dissoc
      integer :: n
      n = 0
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DO2EUV')")
      f_dissoc(n)%short_name = "DO2EUV"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DO2EUV"
      f_dissoc(n)%data => do2euv
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DISSOCIATION O2 LYMAN-ALPHA')")
      f_dissoc(n)%short_name = "DO2LYA"
      f_dissoc(n)%units = "S-1"
      f_dissoc(n)%var_name = "DO2LYA"
      f_dissoc(n)%data => do2lya
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DISSOCIATION O2 S-R CONTINUUM')")
      f_dissoc(n)%short_name = "DO2SRC"
      f_dissoc(n)%units = "S-1"
      f_dissoc(n)%var_name = "DO2SRC"
      f_dissoc(n)%data => do2src
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DISSOCIATION O2 S-R BANDS')")
      f_dissoc(n)%short_name = "DO2SRB"
      f_dissoc(n)%units = "S-1"
      f_dissoc(n)%var_name = "DO2SRB"
      f_dissoc(n)%data => do2srb
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DO2HZ')")
      f_dissoc(n)%short_name = "DO2HZ"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DO2HZ"
      f_dissoc(n)%data => do2hz
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('TOTAL O2 DISSOCIATION')")
      f_dissoc(n)%short_name = "DO2T"
      f_dissoc(n)%units = "S-1"
      f_dissoc(n)%var_name = "DO2T"
      f_dissoc(n)%data => do2t
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DH2OEUV')")
      f_dissoc(n)%short_name = "DH2OEUV"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DH2OEUV"
      f_dissoc(n)%data => dh2oeuv
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DH2OLYA')")
      f_dissoc(n)%short_name = "DH2OLYA"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DH2OLYA"
      f_dissoc(n)%data => dh2olya
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DH2OSRC')")
      f_dissoc(n)%short_name = "DH2OSRC"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DH2OSRC"
      f_dissoc(n)%data => dh2osrc
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DH2OSRB')")
      f_dissoc(n)%short_name = "DH2OSRB"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DH2OSRB"
      f_dissoc(n)%data => dh2osrb
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DH2OT')")
      f_dissoc(n)%short_name = "DH2OT"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DH2OT"
      f_dissoc(n)%data => dh2ot
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DCO2EUV')")
      f_dissoc(n)%short_name = "DCO2EUV"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DCO2EUV"
      f_dissoc(n)%data => dco2euv
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DCO2LYA')")
      f_dissoc(n)%short_name = "DCO2LYA"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DCO2LYA"
      f_dissoc(n)%data => dco2lya
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DCO2SRC')")
      f_dissoc(n)%short_name = "DCO2SRC"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DCO2SRC"
      f_dissoc(n)%data => dco2src
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DCO2SRB')")
      f_dissoc(n)%short_name = "DCO2SRB"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DCO2SRB"
      f_dissoc(n)%data => dco2srb
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DCO2T')")
      f_dissoc(n)%short_name = "DCO2T"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DCO2T"
      f_dissoc(n)%data => dco2t
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DCH4EUV')")
      f_dissoc(n)%short_name = "DCH4EUV"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DCH4EUV"
      f_dissoc(n)%data => dch4euv
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DCH4LYA')")
      f_dissoc(n)%short_name = "DCH4LYA"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DCH4LYA"
      f_dissoc(n)%data => dch4lya
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DCH4B')")
      f_dissoc(n)%short_name = "DCH4B"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DCH4B"
      f_dissoc(n)%data => dch4b
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DCH4T')")
      f_dissoc(n)%short_name = "DCH4T"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DCH4T"
      f_dissoc(n)%data => dch4t
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DCOEUV')")
      f_dissoc(n)%short_name = "DCOEUV"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DCOEUV"
      f_dissoc(n)%data => dcoeuv
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DO3EUV')")
      f_dissoc(n)%short_name = "DO3EUV"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DO3EUV"
      f_dissoc(n)%data => do3euv
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DO3LYA')")
      f_dissoc(n)%short_name = "DO3LYA"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DO3LYA"
      f_dissoc(n)%data => do3lya
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DO3SRC')")
      f_dissoc(n)%short_name = "DO3SRC"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DO3SRC"
      f_dissoc(n)%data => do3src
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DO3SRB')")
      f_dissoc(n)%short_name = "DO3SRB"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DO3SRB"
      f_dissoc(n)%data => do3srb
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DO3HZ')")
      f_dissoc(n)%short_name = "DO3HZ"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DO3HZ"
      f_dissoc(n)%data => do3hz
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DO3HAR')")
      f_dissoc(n)%short_name = "DO3HAR"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DO3HAR"
      f_dissoc(n)%data => do3har
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DO3HUG')")
      f_dissoc(n)%short_name = "DO3HUG"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DO3HUG"
      f_dissoc(n)%data => do3hug
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DO3CHAP')")
      f_dissoc(n)%short_name = "DO3CHAP"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DO3CHAP"
      f_dissoc(n)%data => do3chap
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('TOTAL O3 DISSOCIATION')")
      f_dissoc(n)%short_name = "DO3T"
      f_dissoc(n)%units = "S-1"
      f_dissoc(n)%var_name = "DO3T"
      f_dissoc(n)%data => do3t
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('PNOEUV')")
      f_dissoc(n)%short_name = "PNOEUV"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "PNOEUV"
      f_dissoc(n)%data => pnoeuv
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DNOSRB')")
      f_dissoc(n)%short_name = "DNOSRB"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DNOSRB"
      f_dissoc(n)%data => dnosrb
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DNO2T')")
      f_dissoc(n)%short_name = "DNO2T"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DNO2T"
      f_dissoc(n)%data => dno2t
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DH2O2T')")
      f_dissoc(n)%short_name = "DH2O2T"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DH2O2T"
      f_dissoc(n)%data => dh2o2t
!
      n = n+1 
      write(f_dissoc(n)%long_name,
     |  "('DISSOCIATION O2 NEUTRAL CHEMISTRY')")
      f_dissoc(n)%short_name = "DNCHM"
      f_dissoc(n)%units = "S-1"
      f_dissoc(n)%var_name = "DNCHM"
      f_dissoc(n)%data => dnchm
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DISSOCIATION O2 ION CHEMISTRY')")
      f_dissoc(n)%short_name = "DICHM"
      f_dissoc(n)%units = "S-1"
      f_dissoc(n)%var_name = "DICHM"
      f_dissoc(n)%data => dichm
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DHO2B')")
      f_dissoc(n)%short_name = "DHO2B"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DHO2B"
      f_dissoc(n)%data => dho2b
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DNOEUV')")
      f_dissoc(n)%short_name = "DNOEUV"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DNOEUV"
      f_dissoc(n)%data => dnoeuv
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('PO3CHAP')")
      f_dissoc(n)%short_name = "PO3CHAP"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "PO3CHAP"
      f_dissoc(n)%data => po3chap
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('PO3HUG')")
      f_dissoc(n)%short_name = "PO3HUG"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "PO3HUG"
      f_dissoc(n)%data => po3hug
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('PO3HAR')")
      f_dissoc(n)%short_name = "PO3HAR"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "PO3HAR"
      f_dissoc(n)%data => po3har
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('PDO2HZ')")
      f_dissoc(n)%short_name = "PDO2HZ"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "PDO2HZ"
      f_dissoc(n)%data => pdo2hz
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('PDO3HZ')")
      f_dissoc(n)%short_name = "PDO3HZ"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "PDO3HZ"
      f_dissoc(n)%data => pdo3hz
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('PDO2SRB')")
      f_dissoc(n)%short_name = "PDO2SRB"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "PDO2SRB"
      f_dissoc(n)%data => pdo2srb
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('PDO2SRC')")
      f_dissoc(n)%short_name = "PDO2SRC"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "PDO2SRC"
      f_dissoc(n)%data => pdo2src
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('PDH2O2T')")
      f_dissoc(n)%short_name = "PDH2O2T"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "PDH2O2T"
      f_dissoc(n)%data => pdh2o2t
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('PDNO2T')")
      f_dissoc(n)%short_name = "PDNO2T"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "PDNO2T"
      f_dissoc(n)%data => pdno2t
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DIOP')")
      f_dissoc(n)%short_name = "DIOP"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DIOP"
      f_dissoc(n)%data => diop
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DIO2P')")
      f_dissoc(n)%short_name = "DIO2P"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DIO2P"
      f_dissoc(n)%data => dio2p
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DIN2P')")
      f_dissoc(n)%short_name = "DIN2P"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DIN2P"
      f_dissoc(n)%data => din2p
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DINP')")
      f_dissoc(n)%short_name = "DINP"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DINP"
      f_dissoc(n)%data => dinp
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DIOP2P')")
      f_dissoc(n)%short_name = "DIOP2P"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DIOP2P"
      f_dissoc(n)%data => diop2p
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DIOP2D')")
      f_dissoc(n)%short_name = "DIOP2D"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DIOP2D"
      f_dissoc(n)%data => diop2d
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DIOP4S')")
      f_dissoc(n)%short_name = "DIOP4S"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DIOP4S"
      f_dissoc(n)%data => diop4s
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('XJO2SRB')")
      f_dissoc(n)%short_name = "XJO2SRB"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "XJO2SRB"
      f_dissoc(n)%data => xjo2srb
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('XJH2OSB')")
      f_dissoc(n)%short_name = "XJH2OSB"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "XJH2OSB"
      f_dissoc(n)%data => xjh2osb
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('DH2OSRN')")
      f_dissoc(n)%short_name = "DH2OSRN"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "DH2OSRN"
      f_dissoc(n)%data => dh2osrn
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('SJMLYA')")
      f_dissoc(n)%short_name = "SJMLYA"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "SJMLYA"
      f_dissoc(n)%data => sjmlya
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('SJO2LYA')")
      f_dissoc(n)%short_name = "SJO2LYA"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "SJO2LYA"
      f_dissoc(n)%data => sjo2lya
!
      n = n+1 
      write(f_dissoc(n)%long_name,"('SJNMLYA')")
      f_dissoc(n)%short_name = "SJNMLYA"
      f_dissoc(n)%units = " "
      f_dissoc(n)%var_name = "SJNMLYA"
      f_dissoc(n)%data => sjnmlya
!
! Initial value:
      do n=1,nf_dissoc
        f_dissoc(n)%data = 0.
        f_dissoc(n)%class = "dissoc"
        f_dissoc(n)%timedep = "time-dependent"
        f_dissoc(n)%logplt = 1
!       if (trim(f_dissoc(n)%short_name)=='DO2LYA' ) 
!    |    f_dissoc(n)%logplt = 0
!       if (trim(f_dissoc(n)%short_name)=='DO2SRC' ) 
!    |    f_dissoc(n)%logplt = 0
      enddo
!     write(6,"(/,'Initialized ',i3,' dissoc fields:')") nf_dissoc
!     write(6,"(7a10)") (trim(f_dissoc(n)%short_name),n=1,nf_dissoc)
!     do n=1,nf_dissoc
!       write(6,"('  Field ',i3,': ',a)")
!    |    n,trim(f_dissoc(n)%short_name)
!     enddo
      end subroutine init_dissoc
      end module flds_dissoc
!
!-----------------------------------------------------------------------
      module flds_fields
      use fields
      use params
      implicit none
!
      integer,parameter :: nf_fields=38
      type (field) :: f_fields(nf_fields) 
      real,target,dimension(nlev) ::
     |  ft      ,fno2    ,fno     ,fnn2    ,fnar    ,fnhe    ,
     |  fnno    ,fnn2d   ,fnn4s   ,fw      ,fnat    ,fnhox   ,
     |  fne     ,fte     ,fdifk   ,fnh2o   ,fnh2o2  ,fno1d   ,
     |  fnh2    ,fnoh    ,fnho2   ,fno3    ,fnh     ,fnch4   ,
     |  fnco    ,fnco2   ,fnno2   ,frj     ,fnnoz   ,rno2no  ,
     |  rnonoz  ,ho2hr   ,ohhr    ,hhoxr   ,fnox    ,o3or    ,
     |  ooxr    , edy
      contains
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      subroutine init_fields
      integer :: n
      n = 0
!
      n = n+1 
      write(f_fields(n)%long_name,"('FT')")
      f_fields(n)%short_name = "FT"
      f_fields(n)%var_name = "FT"
      f_fields(n)%units = " "
      f_fields(n)%data => ft
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNO2')")
      f_fields(n)%short_name = "FNO2"
      f_fields(n)%var_name = "FNO2"
      f_fields(n)%units = " "
      f_fields(n)%data => fno2
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNO')")
      f_fields(n)%short_name = "FNO"
      f_fields(n)%var_name = "FNO"
      f_fields(n)%units = " "
      f_fields(n)%data => fno
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNN2')")
      f_fields(n)%short_name = "FNN2"
      f_fields(n)%var_name = "FNN2"
      f_fields(n)%units = " "
      f_fields(n)%data => fnn2
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNAR')")
      f_fields(n)%short_name = "FNAR"
      f_fields(n)%var_name = "FNAR"
      f_fields(n)%units = " "
      f_fields(n)%data => fnar
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNHE')")
      f_fields(n)%short_name = "FNHE"
      f_fields(n)%var_name = "FNHE"
      f_fields(n)%units = " "
      f_fields(n)%data => fnhe
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNNO')")
      f_fields(n)%short_name = "FNNO"
      f_fields(n)%var_name = "FNNO"
      f_fields(n)%units = " "
      f_fields(n)%data => fnno
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNN2D')")
      f_fields(n)%short_name = "FNN2D"
      f_fields(n)%var_name = "FNN2D"
      f_fields(n)%units = " "
      f_fields(n)%data => fnn2d
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNN4S')")
      f_fields(n)%short_name = "FNN4S"
      f_fields(n)%var_name = "FNN4S"
      f_fields(n)%units = " "
      f_fields(n)%data => fnn4s
!
      n = n+1 
      write(f_fields(n)%long_name,"('FW')")
      f_fields(n)%short_name = "FW"
      f_fields(n)%var_name = "FW"
      f_fields(n)%units = " "
      f_fields(n)%data => fw
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNAT')")
      f_fields(n)%short_name = "FNAT"
      f_fields(n)%var_name = "FNAT"
      f_fields(n)%units = " "
      f_fields(n)%data => fnat
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNHOX')")
      f_fields(n)%short_name = "FNHOX"
      f_fields(n)%var_name = "FNHOX"
      f_fields(n)%units = " "
      f_fields(n)%data => fnhox
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNE')")
      f_fields(n)%short_name = "FNE"
      f_fields(n)%var_name = "FNE"
      f_fields(n)%units = " "
      f_fields(n)%data => fne
!
      n = n+1 
      write(f_fields(n)%long_name,"('FTE')")
      f_fields(n)%short_name = "FTE"
      f_fields(n)%var_name = "FTE"
      f_fields(n)%units = " "
      f_fields(n)%data => fte
!
      n = n+1 
      write(f_fields(n)%long_name,"('FDIFK')")
      f_fields(n)%short_name = "FDIFK"
      f_fields(n)%var_name = "FDIFK"
      f_fields(n)%units = " "
      f_fields(n)%data => fdifk
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNH2O')")
      f_fields(n)%short_name = "FNH2O"
      f_fields(n)%var_name = "FNH2O"
      f_fields(n)%units = " "
      f_fields(n)%data => fnh2o
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNH2O2')")
      f_fields(n)%short_name = "FNH2O2"
      f_fields(n)%var_name = "FNH2O2"
      f_fields(n)%units = " "
      f_fields(n)%data => fnh2o2
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNO1D')")
      f_fields(n)%short_name = "FNO1D"
      f_fields(n)%var_name = "FNO1D"
      f_fields(n)%units = " "
      f_fields(n)%data => fno1d
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNH2')")
      f_fields(n)%short_name = "FNH2"
      f_fields(n)%var_name = "FNH2"
      f_fields(n)%units = " "
      f_fields(n)%data => fnh2
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNOH')")
      f_fields(n)%short_name = "FNOH"
      f_fields(n)%var_name = "FNOH"
      f_fields(n)%units = " "
      f_fields(n)%data => fnoh
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNHO2')")
      f_fields(n)%short_name = "FNHO2"
      f_fields(n)%var_name = "FNHO2"
      f_fields(n)%units = " "
      f_fields(n)%data => fnho2
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNO3')")
      f_fields(n)%short_name = "FNO3"
      f_fields(n)%var_name = "FNO3"
      f_fields(n)%units = " "
      f_fields(n)%data => fno3
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNH')")
      f_fields(n)%short_name = "FNH"
      f_fields(n)%var_name = "FNH"
      f_fields(n)%units = " "
      f_fields(n)%data => fnh
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNCH4')")
      f_fields(n)%short_name = "FNCH4"
      f_fields(n)%var_name = "FNCH4"
      f_fields(n)%units = " "
      f_fields(n)%data => fnch4
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNCO')")
      f_fields(n)%short_name = "FNCO"
      f_fields(n)%var_name = "FNCO"
      f_fields(n)%units = " "
      f_fields(n)%data => fnco
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNCO2')")
      f_fields(n)%short_name = "FNCO2"
      f_fields(n)%var_name = "FNCO2"
      f_fields(n)%units = " "
      f_fields(n)%data => fnco2
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNNO2')")
      f_fields(n)%short_name = "FNNO2"
      f_fields(n)%var_name = "FNNO2"
      f_fields(n)%units = " "
      f_fields(n)%data => fnno2
!
      n = n+1 
      write(f_fields(n)%long_name,"('FRJ')")
      f_fields(n)%short_name = "FRJ"
      f_fields(n)%var_name = "FRJ"
      f_fields(n)%units = " "
      f_fields(n)%data => frj
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNNOZ')")
      f_fields(n)%short_name = "FNNOZ"
      f_fields(n)%var_name = "FNNOZ"
      f_fields(n)%units = " "
      f_fields(n)%data => fnnoz
!
      n = n+1 
      write(f_fields(n)%long_name,"('RNO2NO')")
      f_fields(n)%short_name = "RNO2NO"
      f_fields(n)%var_name = "RNO2NO"
      f_fields(n)%units = " "
      f_fields(n)%data => rno2no
!
      n = n+1 
      write(f_fields(n)%long_name,"('RNONOZ')")
      f_fields(n)%short_name = "RNONOZ"
      f_fields(n)%var_name = "RNONOZ"
      f_fields(n)%units = " "
      f_fields(n)%data => rnonoz
!
      n = n+1 
      write(f_fields(n)%long_name,"('HO2HR')")
      f_fields(n)%short_name = "HO2HR"
      f_fields(n)%var_name = "HO2HR"
      f_fields(n)%units = " "
      f_fields(n)%data => ho2hr
!
      n = n+1 
      write(f_fields(n)%long_name,"('OHHR')")
      f_fields(n)%short_name = "OHHR"
      f_fields(n)%var_name = "OHHR"
      f_fields(n)%units = " "
      f_fields(n)%data => ohhr
!
      n = n+1 
      write(f_fields(n)%long_name,"('HHOXR')")
      f_fields(n)%short_name = "HHOXR"
      f_fields(n)%var_name = "HHOXR"
      f_fields(n)%units = " "
      f_fields(n)%data => hhoxr
!
      n = n+1 
      write(f_fields(n)%long_name,"('FNOX')")
      f_fields(n)%short_name = "FNOX"
      f_fields(n)%var_name = "FNOX"
      f_fields(n)%units = " "
      f_fields(n)%data => fnox
!
      n = n+1 
      write(f_fields(n)%long_name,"('O3OR')")
      f_fields(n)%short_name = "O3OR"
      f_fields(n)%var_name = "O3OR"
      f_fields(n)%units = " "
      f_fields(n)%data => o3or
!
      n = n+1 
      write(f_fields(n)%long_name,"('OOXR')")
      f_fields(n)%short_name = "OOXR"
      f_fields(n)%var_name = "OOXR"
      f_fields(n)%units = " "
      f_fields(n)%data => ooxr
!
      n = n+1 
      write(f_fields(n)%long_name,"('EDDY DIFFUSION')")
      f_fields(n)%short_name = "EDY"
      f_fields(n)%var_name = "EDY"
      f_fields(n)%units = "S-1"
      f_fields(n)%data => edy
!
! Initial value:
      do n=1,nf_fields
        f_fields(n)%data = 0.
        f_fields(n)%class = "fields"
        f_fields(n)%timedep = "time-dependent"
        f_fields(n)%logplt = 1
        if (trim(f_fields(n)%short_name)=='FT' ) f_fields(n)%logplt = 0
        if (trim(f_fields(n)%short_name)=='FW' ) f_fields(n)%logplt = 0
        if (trim(f_fields(n)%short_name)=='FTE') f_fields(n)%logplt = 0
      enddo
!     write(6,"(/,'Initialized ',i3,' fields fields:')") nf_fields
!     write(6,"(7a10)") (trim(f_fields(n)%short_name),n=1,nf_fields)
!     do n=1,nf_fields
!       write(6,"('  Field ',i3,': ',a)")
!    |    n,trim(f_fields(n)%short_name)
!     enddo
      end subroutine init_fields
      end module flds_fields
!
!-----------------------------------------------------------------------
      module flds_heat
      use fields
      use params
      implicit none
!
      integer,parameter :: nf_totheat=20
      type (field) :: f_totheat(nf_totheat) 
      real,target,dimension(nlev) ::
     |  qanosrb ,xnoc    ,xco2c   ,xo3pc   ,xircool ,ck      ,   
     |  cmu     ,cp      ,gwheat  ,hce     ,hcm     ,qntot   ,
     |  xlen    ,qno3    ,coolt   ,xno21sc ,xno21dc ,xmetac  ,
     |  xcool   ,xmetah
!
      integer,parameter :: nf_heat=38
      type (field) :: f_heat(nf_heat) 
      real,target,dimension(nlev) ::
     |  qsrc    ,qsrb    ,qaurh   ,qproh   ,qnight  ,qn      ,   
     |  qchap   ,qhar    ,qhug    ,qherz   ,qnlya   ,qjoul   ,
     |  qnn     ,qnmn    ,qnc     ,qn1d    ,qo3pr   ,qpchap  ,
     |  qphug   ,qphar   ,qpsrb   ,qpsrc   ,qpherz  ,qpherz2 ,
     |  qpherz3 ,qherzo2 ,qherzo3 ,qnnox   ,qno1d   ,qno21d  ,
     |  qno21s  ,qnhox   ,qncl    ,qnox    ,qnic    ,qnmth   ,
     |  qnnc    ,qnpe
      contains
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      subroutine init_totheat
      integer :: n
      n = 0
!
      n = n+1 
      write(f_totheat(n)%long_name,"('QANOSRB')")
      f_totheat(n)%short_name = "QANOSRB"
      f_totheat(n)%var_name = "QANOSRB"
      f_totheat(n)%units = " "
      f_totheat(n)%data => qanosrb
!
      n = n+1 
      write(f_totheat(n)%long_name,"('NO 5.3U COOLING')")
      f_totheat(n)%short_name = "XNOC"
      f_totheat(n)%var_name = "XNOC"
      f_totheat(n)%units = "ERGS GM-1 S-1"
      f_totheat(n)%data => xnoc
!
      n = n+1 
      write(f_totheat(n)%long_name,"('CO2 15U COOLING')")
      f_totheat(n)%short_name = "XCO2C"
      f_totheat(n)%var_name = "XCO2C"
      f_totheat(n)%units = "ERGS GM-1 S-1"
      f_totheat(n)%data => xco2c
!
      n = n+1 
      write(f_totheat(n)%long_name,"('O FINE STRUCTURE COOLING')")
      f_totheat(n)%short_name = "XO3PC"
      f_totheat(n)%var_name = "XO3PC"
      f_totheat(n)%units = "ERGS GM-1 S-1"
      f_totheat(n)%data => xo3pc
!
      n = n+1 
      write(f_totheat(n)%long_name,"('TOTAL INFRA-RED COOLING')")
      f_totheat(n)%short_name = "XIRCOOL"
      f_totheat(n)%var_name = "XIRCOOL"
      f_totheat(n)%units = "ERGS GM-1 S-1"
      f_totheat(n)%data => xircool
!
      n = n+1 
      write(f_totheat(n)%long_name,"('CK')")
      f_totheat(n)%short_name = "CK"
      f_totheat(n)%var_name = "CK"
      f_totheat(n)%units = " "
      f_totheat(n)%data => ck
!
      n = n+1 
      write(f_totheat(n)%long_name,"('CMU')")
      f_totheat(n)%short_name = "CMU"
      f_totheat(n)%var_name = "CMU"
      f_totheat(n)%units = " "
      f_totheat(n)%data => cmu
!
      n = n+1 
      write(f_totheat(n)%long_name,"('SPECIFIC HEAT')")
      f_totheat(n)%short_name = "CP"
      f_totheat(n)%var_name = "CP"
      f_totheat(n)%units = " "
      f_totheat(n)%data => cp
!
      n = n+1 
      write(f_totheat(n)%long_name,"('GRAVITY WAVE HEATING')")
      f_totheat(n)%short_name = "GWHEAT"
      f_totheat(n)%var_name = "GWHEAT"
      f_totheat(n)%units = "ERGS GM-1 S-1"
      f_totheat(n)%data => gwheat
!
      n = n+1 
      write(f_totheat(n)%long_name,"('EDDY DIFFUSION COOLING')")
      f_totheat(n)%short_name = "HCE"
      f_totheat(n)%var_name = "HCE"
      f_totheat(n)%units = "ERGS GM-1 S-1"
      f_totheat(n)%data => hce
!
      n = n+1 
      write(f_totheat(n)%long_name,"('MOLECULAR DIFFUSION COOLING')")
      f_totheat(n)%short_name = "HCM"
      f_totheat(n)%var_name = "HCM"
      f_totheat(n)%units = "ERGS GM-1 S-1"
      f_totheat(n)%data => hcm
!
      n = n+1 
      write(f_totheat(n)%long_name,"('TOTAL NEUTRAL HEATING')")
      f_totheat(n)%short_name = "QNTOT"
      f_totheat(n)%var_name = "QNTOT"
      f_totheat(n)%units = "ERGS GM-1 S-1"
      f_totheat(n)%data => qntot
!
      n = n+1 
      write(f_totheat(n)%long_name,
     |  "('ELECTRON-NEUTRAL COLLISIONAL HEATING')")
      f_totheat(n)%short_name = "XLEN"
      f_totheat(n)%var_name = "XLEN"
      f_totheat(n)%units = "ERGS GM-1 S-1"
      f_totheat(n)%data => xlen
!
      n = n+1 
      write(f_totheat(n)%long_name,"('TOTAL OZONE HEATING')")
      f_totheat(n)%short_name = "QNO3"
      f_totheat(n)%var_name = "QNO3"
      f_totheat(n)%units = "ERGS GM-1 S-1"
      f_totheat(n)%data => qno3
!
      n = n+1 
      write(f_totheat(n)%long_name,"('COOLT')")
      f_totheat(n)%short_name = "COOLT"
      f_totheat(n)%var_name = "COOLT"
      f_totheat(n)%units = " "
      f_totheat(n)%data => coolt
!
      n = n+1 
      write(f_totheat(n)%long_name,"('XNO21SC')")
      f_totheat(n)%short_name = "XNO21SC"
      f_totheat(n)%var_name = "XNO21SC"
      f_totheat(n)%units = " "
      f_totheat(n)%data => xno21sc
!
      n = n+1 
      write(f_totheat(n)%long_name,"('XNO21DC')")
      f_totheat(n)%short_name = "XNO21DC"
      f_totheat(n)%var_name = "XNO21DC"
      f_totheat(n)%units = " "
      f_totheat(n)%data => xno21dc
!
      n = n+1 
      write(f_totheat(n)%long_name,"('XMETAC')")
      f_totheat(n)%short_name = "XMETAC"
      f_totheat(n)%var_name = "XMETAC"
      f_totheat(n)%units = " "
      f_totheat(n)%data => xmetac
!
      n = n+1 
      write(f_totheat(n)%long_name,"('XCOOL')")
      f_totheat(n)%short_name = "XCOOL"
      f_totheat(n)%var_name = "XCOOL"
      f_totheat(n)%units = " "
      f_totheat(n)%data => xcool
!
      n = n+1 
      write(f_totheat(n)%long_name,"('XMETAH')")
      f_totheat(n)%short_name = "XMETAH"
      f_totheat(n)%var_name = "XMETAH"
      f_totheat(n)%units = " "
      f_totheat(n)%data => xmetah

!
! Initial value:
      do n=1,nf_totheat
        f_totheat(n)%data = 0.
        f_totheat(n)%class = "totheat"
        f_totheat(n)%timedep = "time-dependent"
        f_totheat(n)%logplt = 1
!       if (trim(f_totheat(n)%short_name)=='XIRCOOL') 
!    |    f_totheat(n)%logplt=0
!       if (trim(f_totheat(n)%short_name)=='XCO2C') 
!    |    f_totheat(n)%logplt=0
!       if (trim(f_totheat(n)%short_name)=='HCM') 
!    |    f_totheat(n)%logplt=0
!       if (trim(f_totheat(n)%short_name)=='HCE') 
!    |    f_totheat(n)%logplt=0
      enddo
!     write(6,"(/,'Initialized ',i3,' totheat fields:')") nf_totheat
!     write(6,"(7a10)") (trim(f_totheat(n)%short_name),n=1,nf_totheat)
!     do n=1,nf_totheat
!       write(6,"('  Field ',i3,': ',a)")
!    |    n,trim(f_totheat(n)%short_name)
!     enddo
      end subroutine init_totheat
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      subroutine init_heat
      integer :: n
      n = 0
!
      n = n+1 
      write(f_heat(n)%long_name,"('S-R CONTINUUM HEATING')")
      f_heat(n)%short_name = "QSRC"
      f_heat(n)%var_name = "QSRC"
      f_heat(n)%units = "ERGS GM-1 S-1"
      f_heat(n)%data => qsrc
!
      n = n+1 
      write(f_heat(n)%long_name,"('S-R BAND HEATING')")
      f_heat(n)%short_name = "QSRB"
      f_heat(n)%var_name = "QSRB"
      f_heat(n)%units = "ERGS GM-1 S-1"
      f_heat(n)%data => qsrb
!
      n = n+1 
      write(f_heat(n)%long_name,"('QAURH')")
      f_heat(n)%short_name = "QAURH"
      f_heat(n)%var_name = "QAURH"
      f_heat(n)%units = " "
      f_heat(n)%data => qaurh
!
      n = n+1 
      write(f_heat(n)%long_name,"('QPROH')")
      f_heat(n)%short_name = "QPROH"
      f_heat(n)%var_name = "QPROH"
      f_heat(n)%units = "CM-3 S-1"
      f_heat(n)%data => qproh
!
      n = n+1 
      write(f_heat(n)%long_name,"('NIGHTIME HEATING')")
      f_heat(n)%short_name = "QNIGHT"
      f_heat(n)%var_name = "QNIGHT"
      f_heat(n)%units = "ERGS GM-1 S-1"
      f_heat(n)%data => qnight
!
      n = n+1 
      write(f_heat(n)%long_name,"('QN')")
      f_heat(n)%short_name = "QN"
      f_heat(n)%var_name = "QN"
      f_heat(n)%units = " "
      f_heat(n)%data => qn
!
      n = n+1 
      write(f_heat(n)%long_name,"('QCHAP')")
      f_heat(n)%short_name = "QCHAP"
      f_heat(n)%var_name = "QCHAP"
      f_heat(n)%units = " "
      f_heat(n)%data => qchap
!
      n = n+1 
      write(f_heat(n)%long_name,"('QHAR')")
      f_heat(n)%short_name = "QHAR"
      f_heat(n)%var_name = "QHAR"
      f_heat(n)%units = " "
      f_heat(n)%data => qhar
!
      n = n+1 
      write(f_heat(n)%long_name,"('QHUG')")
      f_heat(n)%short_name = "QHUG"
      f_heat(n)%var_name = "QHUG"
      f_heat(n)%units = " "
      f_heat(n)%data => qhug
!
      n = n+1 
      write(f_heat(n)%long_name,"('QHERZ')")
      f_heat(n)%short_name = "QHERZ"
      f_heat(n)%var_name = "QHERZ"
      f_heat(n)%units = " "
      f_heat(n)%data => qherz
!
      n = n+1 
      write(f_heat(n)%long_name,"('LYMAN-ALPHA HEATING')")
      f_heat(n)%short_name = "QNLYA"
      f_heat(n)%var_name = "QNLYA"
      f_heat(n)%units = "ERGS GM-1 S-1"
      f_heat(n)%data => qnlya
!
      n = n+1 
      write(f_heat(n)%long_name,"('JOULE HEATING')")
      f_heat(n)%short_name = "QJOUL"
      f_heat(n)%var_name = "QJOUL"
      f_heat(n)%units = "ERGS GM-1 S-1"
      f_heat(n)%data => qjoul
!
      n = n+1 
      write(f_heat(n)%long_name,"('TOTAL NEUTRAL HEATING')")
      f_heat(n)%short_name = "QNN"
      f_heat(n)%var_name = "QNN"
      f_heat(n)%units = "ERGS GM-1 S-1"
      f_heat(n)%data => qnn
!
      n = n+1 
      write(f_heat(n)%long_name,"('QNMN')")
      f_heat(n)%short_name = "QNMN"
      f_heat(n)%var_name = "QNMN"
      f_heat(n)%units = " "
      f_heat(n)%data => qnmn
!
      n = n+1 
      write(f_heat(n)%long_name,"('NEUTRAL CHEMICAL HEATING')")
      f_heat(n)%short_name = "QNC"
      f_heat(n)%var_name = "QNC"
      f_heat(n)%units = "ERGS GM-1 S-1"
      f_heat(n)%data => qnc
!
      n = n+1 
      write(f_heat(n)%long_name,"('O(1D) QUENCHING HEATING')")
      f_heat(n)%short_name = "QN1D"
      f_heat(n)%var_name = "QN1D"
      f_heat(n)%units = "ERGS GM-1 S-1"
      f_heat(n)%data => qn1d
!
      n = n+1 
      write(f_heat(n)%long_name,"('O 3-BODY HEATING')")
      f_heat(n)%short_name = "QO3PR"
      f_heat(n)%var_name = "QO3PR"
      f_heat(n)%units = "ERGS GM-1 S-1"
      f_heat(n)%data => qo3pr
!
      n = n+1 
      write(f_heat(n)%long_name,"('QPCHAP')")
      f_heat(n)%short_name = "QPCHAP"
      f_heat(n)%var_name = "QPCHAP"
      f_heat(n)%units = " "
      f_heat(n)%data => qpchap
!
      n = n+1 
      write(f_heat(n)%long_name,"('QPHUG')")
      f_heat(n)%short_name = "QPHUG"
      f_heat(n)%var_name = "QPHUG"
      f_heat(n)%units = " "
      f_heat(n)%data => qphug
!
      n = n+1 
      write(f_heat(n)%long_name,"('QPHAR')")
      f_heat(n)%short_name = "QPHAR"
      f_heat(n)%var_name = "QPHAR"
      f_heat(n)%units = " "
      f_heat(n)%data => qphar
!
      n = n+1 
      write(f_heat(n)%long_name,"('QPSRB')")
      f_heat(n)%short_name = "QPSRB"
      f_heat(n)%var_name = "QPSRB"
      f_heat(n)%units = " "
      f_heat(n)%data => qpsrb
!
      n = n+1 
      write(f_heat(n)%long_name,"('QPSRC')")
      f_heat(n)%short_name = "QPSRC"
      f_heat(n)%var_name = "QPSRC"
      f_heat(n)%units = " "
      f_heat(n)%data => qpsrc
!
      n = n+1 
      write(f_heat(n)%long_name,"('QPHERZ')")
      f_heat(n)%short_name = "QPHERZ"
      f_heat(n)%var_name = "QPHERZ"
      f_heat(n)%units = " "
      f_heat(n)%data => qpherz
!
      n = n+1 
      write(f_heat(n)%long_name,"('QPHERZ2')")
      f_heat(n)%short_name = "QPHERZ2"
      f_heat(n)%var_name = "QPHERZ2"
      f_heat(n)%units = " "
      f_heat(n)%data => qpherz2
!
      n = n+1 
      write(f_heat(n)%long_name,"('QPHERZ3')")
      f_heat(n)%short_name = "QPHERZ3"
      f_heat(n)%var_name = "QPHERZ3"
      f_heat(n)%units = " "
      f_heat(n)%data => qpherz3
!
      n = n+1 
      write(f_heat(n)%long_name,"('QHERZO2')")
      f_heat(n)%short_name = "QHERZO2"
      f_heat(n)%var_name = "QHERZO2"
      f_heat(n)%units = " "
      f_heat(n)%data => qherzo2
!
      n = n+1 
      write(f_heat(n)%long_name,"('QHERZO3')")
      f_heat(n)%short_name = "QHERZO3"
      f_heat(n)%var_name = "QHERZO3"
      f_heat(n)%units = " "
      f_heat(n)%data => qherzo3
!
      n = n+1 
      write(f_heat(n)%long_name,"('QNNOX')")
      f_heat(n)%short_name = "QNNOX"
      f_heat(n)%var_name = "QNNOX"
      f_heat(n)%units = " "
      f_heat(n)%data => qnnox
!
      n = n+1 
      write(f_heat(n)%long_name,"('QNO1D')")
      f_heat(n)%short_name = "QNO1D"
      f_heat(n)%var_name = "QNO1D"
      f_heat(n)%units = " "
      f_heat(n)%data => qno1d
!
      n = n+1 
      write(f_heat(n)%long_name,"('QNO21D')")
      f_heat(n)%short_name = "QNO21D"
      f_heat(n)%var_name = "QNO21D"
      f_heat(n)%units = "CM-3"
      f_heat(n)%data => qno21d
!
      n = n+1 
      write(f_heat(n)%long_name,"('QNO21S')")
      f_heat(n)%short_name = "QNO21S"
      f_heat(n)%var_name = "QNO21S"
      f_heat(n)%units = "CM-3"
      f_heat(n)%data => qno21s
!
      n = n+1 
      write(f_heat(n)%long_name,"('QNHOX')")
      f_heat(n)%short_name = "QNHOX"
      f_heat(n)%var_name = "QNHOX"
      f_heat(n)%units = " "
      f_heat(n)%data => qnhox
!
      n = n+1 
      write(f_heat(n)%long_name,"('QNCL')")
      f_heat(n)%short_name = "QNCL"
      f_heat(n)%var_name = "QNCL"
      f_heat(n)%units = " "
      f_heat(n)%data => qncl
!
      n = n+1 
      write(f_heat(n)%long_name,"('QNOX')")
      f_heat(n)%short_name = "QNOX"
      f_heat(n)%var_name = "QNOX"
      f_heat(n)%units = " "
      f_heat(n)%data => qnox
!
      n = n+1 
      write(f_heat(n)%long_name,"('QNIC')")
      f_heat(n)%short_name = "QNIC"
      f_heat(n)%var_name = "QNIC"
      f_heat(n)%units = " "
      f_heat(n)%data => qnic
!
      n = n+1 
      write(f_heat(n)%long_name,"('QNMTH')")
      f_heat(n)%short_name = "QNMTH"
      f_heat(n)%var_name = "QNMTH"
      f_heat(n)%units = " "
      f_heat(n)%data => qnmth
!
      n = n+1 
      write(f_heat(n)%long_name,"('QNNC')")
      f_heat(n)%short_name = "QNNC"
      f_heat(n)%var_name = "QNNC"
      f_heat(n)%units = " "
      f_heat(n)%data => qnnc
!
      n = n+1 
      write(f_heat(n)%long_name,"('QNPE')")
      f_heat(n)%short_name = "QNPE"
      f_heat(n)%var_name = "QNPE"
      f_heat(n)%units = " "
      f_heat(n)%data => qnpe
!
! Initial value:
      do n=1,nf_heat
        f_heat(n)%data = 0.
        f_heat(n)%class = "heat"
        f_heat(n)%timedep = "time-dependent"
        f_heat(n)%logplt = 1
      enddo
!     write(6,"(/,'Initialized ',i3,' heat fields:')") nf_heat
!     write(6,"(7a10)") (trim(f_heat(n)%short_name),n=1,nf_heat)
!     do n=1,nf_heat
!       write(6,"('  Field ',i3,': ',a)")
!    |    n,trim(f_heat(n)%short_name)
!     enddo
      end subroutine init_heat
      end module flds_heat
!
!-----------------------------------------------------------------------
      module flds_ionatm
      use fields
      use params
      implicit none
!
      integer,parameter :: nf_ionatm=40
      type (field) :: f_ionatm(nf_ionatm) 
      real,target,dimension(nlev) ::
     |  xne     ,xiop    ,xio2p   ,xinop   ,xin2p   ,xinp    ,
     |  te      ,ti      ,xihp    ,xchue   ,xnpi    ,xnni    ,
     |  xneee   ,sped    ,shal    ,parcd   ,alamxx  ,alamxy  ,
     |  xmup    ,xmun    ,sigp    ,sign    ,xmolpi  ,xmolni  ,
     |  qse     ,qsi     ,zop2p   ,zop2d   ,zop4s   ,zo2p4p  ,
     |  znp     ,zo2p    ,zhep    ,zhp     ,zne     ,zn2p    ,
     |  znop    ,xiop2p  ,xiop2d  ,xiop4s
      real :: xar(60,nlev) ! see denmod.F (formerly in /ionatm/)
      contains
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      subroutine init_ionatm
      integer :: n
      n = 0
!
! XNE:
      n = n+1 
      write(f_ionatm(n)%long_name,"('ELECTRON DENSITY')")
      f_ionatm(n)%short_name = "NE"
      f_ionatm(n)%var_name = "XNE"
      f_ionatm(n)%units = "CM-3"
      f_ionatm(n)%data => xne
!
! XIOP:
      n = n+1 
      write(f_ionatm(n)%long_name,"('O+ ION')")
      f_ionatm(n)%short_name = "O+"
      f_ionatm(n)%var_name = "XIOP"
      f_ionatm(n)%units = "CM-3"
      f_ionatm(n)%data => xiop
!
! XIO2P:
      n = n+1 
      write(f_ionatm(n)%long_name,"('O2+ ION')")
      f_ionatm(n)%short_name = "O2+"
      f_ionatm(n)%var_name = "XIO2P"
      f_ionatm(n)%units = "CM-3"
      f_ionatm(n)%data => xio2p
!
! XINOP:
      n = n+1 
      write(f_ionatm(n)%long_name,"('NO+ ION')")
      f_ionatm(n)%short_name = "NO+"
      f_ionatm(n)%var_name = "XINOP"
      f_ionatm(n)%units = "CM-3"
      f_ionatm(n)%data => xinop
!
! XIN2P:
      n = n+1 
      write(f_ionatm(n)%long_name,"('N2+ ION')")
      f_ionatm(n)%short_name = "N2+"
      f_ionatm(n)%var_name = "XIN2P"
      f_ionatm(n)%units = "CM-3"
      f_ionatm(n)%data => xin2p
!
! XINP:
      n = n+1 
      write(f_ionatm(n)%long_name,"('N+ ION')")
      f_ionatm(n)%short_name = "N+"
      f_ionatm(n)%var_name = "XINP"
      f_ionatm(n)%units = "CM-3"
      f_ionatm(n)%data => xinp
!
! TE:
      n = n+1 
      write(f_ionatm(n)%long_name,"('ELECTRON TEMPERATURE')")
      f_ionatm(n)%short_name = "TE"
      f_ionatm(n)%var_name = "TE"
      f_ionatm(n)%units = "DEG K"
      f_ionatm(n)%data => te
!
! TI
      n = n+1 
      write(f_ionatm(n)%long_name,"('ION TEMPERATURE')")
      f_ionatm(n)%short_name = "TI"
      f_ionatm(n)%var_name = "TI"
      f_ionatm(n)%units = "DEG K"
      f_ionatm(n)%data => ti
!
! XIHP:
      n = n+1 
      write(f_ionatm(n)%long_name,"('H+ ION')")
      f_ionatm(n)%short_name = "H+"
      f_ionatm(n)%var_name = "XIHP"
      f_ionatm(n)%units = "CM-3"
      f_ionatm(n)%data => xihp
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('XCHUE')")
      f_ionatm(n)%short_name = "XCHUE"
      f_ionatm(n)%var_name = "XCHUE"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => xchue
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('POSITIVE ION DENSITY')")
      f_ionatm(n)%short_name = "XNPI"
      f_ionatm(n)%var_name = "XNPI"
      f_ionatm(n)%units = "CM-3"
      f_ionatm(n)%data => xnpi
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('NEGATIVE ION DENSITY')")
      f_ionatm(n)%short_name = "XNNI"
      f_ionatm(n)%var_name = "XNNI"
      f_ionatm(n)%units = "CM-3"
      f_ionatm(n)%data => xnni
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('D-REGION ELECTRON DENSITY')")
      f_ionatm(n)%short_name = "XNEEE"
      f_ionatm(n)%var_name = "XNEEE"
      f_ionatm(n)%units = "CM-3"
      f_ionatm(n)%data => xneee
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('PEDERSEN CONDUCTIVITY')")
      f_ionatm(n)%short_name = "SPED"
      f_ionatm(n)%var_name = "SPED"
      f_ionatm(n)%units = "MHO M-1"
      f_ionatm(n)%data => sped
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('HALL CONDUCTIVITY')")
      f_ionatm(n)%short_name = "SHAL"
      f_ionatm(n)%var_name = "SHAL"
      f_ionatm(n)%units = "MHO M-1"
      f_ionatm(n)%data => shal
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('PARALLEL CONDUCTIVITY')")
      f_ionatm(n)%short_name = "PARCD"
      f_ionatm(n)%var_name = "PARCD"
      f_ionatm(n)%units = "MHO M-1"
      f_ionatm(n)%data => parcd
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('LAMBDA XX')")
      f_ionatm(n)%short_name = "ALAMXX"
      f_ionatm(n)%var_name = "ALAMXX"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => alamxx
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('LAMBDA XY')")
      f_ionatm(n)%short_name = "ALAMXY"
      f_ionatm(n)%var_name = "ALAMXY"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => alamxy
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('XMUP')")
      f_ionatm(n)%short_name = "XMUP"
      f_ionatm(n)%var_name = "XMUP"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => xmup
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('XMUN')")
      f_ionatm(n)%short_name = "XMUN"
      f_ionatm(n)%var_name = "XMUN"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => xmun
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('SIGP')")
      f_ionatm(n)%short_name = "SIGP"
      f_ionatm(n)%var_name = "SIGP"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => sigp
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('SIGN')")
      f_ionatm(n)%short_name = "SIGN"
      f_ionatm(n)%var_name = "SIGN"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => sign
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('XMOLPI')")
      f_ionatm(n)%short_name = "XMOLPI"
      f_ionatm(n)%var_name = "XMOLPI"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => xmolpi
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('XMOLNI')")
      f_ionatm(n)%short_name = "XMOLNI"
      f_ionatm(n)%var_name = "XMOLNI"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => xmolni
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('QSE')")
      f_ionatm(n)%short_name = "QSE"
      f_ionatm(n)%var_name = "QSE"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => qse
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('QSI')")
      f_ionatm(n)%short_name = "QSI"
      f_ionatm(n)%var_name = "QSI"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => qsi
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('ZOP2P')")
      f_ionatm(n)%short_name = "ZOP2P"
      f_ionatm(n)%var_name = "ZOP2P"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => zop2p
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('ZOP2D')")
      f_ionatm(n)%short_name = "ZOP2D"
      f_ionatm(n)%var_name = "ZOP2D"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => zop2d
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('ZOP4S')")
      f_ionatm(n)%short_name = "ZOP4S"
      f_ionatm(n)%var_name = "ZOP4S"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => zop4s
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('ZO2P4P')")
      f_ionatm(n)%short_name = "ZO2P4P"
      f_ionatm(n)%var_name = "ZO2P4P"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => zo2p4p
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('ZNP')")
      f_ionatm(n)%short_name = "ZNP"
      f_ionatm(n)%var_name = "ZNP"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => znp
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('ZO2P')")
      f_ionatm(n)%short_name = "ZO2P"
      f_ionatm(n)%var_name = "ZO2P"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => zo2p
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('ZHEP')")
      f_ionatm(n)%short_name = "ZHEP"
      f_ionatm(n)%var_name = "ZHEP"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => zhep
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('ZHP')")
      f_ionatm(n)%short_name = "ZHP"
      f_ionatm(n)%var_name = "ZHP"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => zhp
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('ZNE')")
      f_ionatm(n)%short_name = "ZNE"
      f_ionatm(n)%var_name = "ZNE"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => zne
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('ZN2P')")
      f_ionatm(n)%short_name = "ZN2P"
      f_ionatm(n)%var_name = "ZN2P"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => zn2p
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('ZNOP')")
      f_ionatm(n)%short_name = "ZNOP"
      f_ionatm(n)%var_name = "ZNOP"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => znop
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('XIOP2P')")
      f_ionatm(n)%short_name = "XIOP2P"
      f_ionatm(n)%var_name = "XIOP2P"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => xiop2p
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('XIOP2D')")
      f_ionatm(n)%short_name = "XIOP2D"
      f_ionatm(n)%var_name = "XIOP2D"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => xiop2d
!
      n = n+1 
      write(f_ionatm(n)%long_name,"('XIOP4S')")
      f_ionatm(n)%short_name = "XIOP4S"
      f_ionatm(n)%var_name = "XIOP4S"
      f_ionatm(n)%units = " "
      f_ionatm(n)%data => xiop4s
!
! Initial value:
      do n=1,nf_ionatm
        f_ionatm(n)%data = 0.
        f_ionatm(n)%class = "ionatm"
        f_ionatm(n)%timedep = "time-dependent"
        f_ionatm(n)%logplt = 1
        if (trim(f_ionatm(n)%short_name)=='TI') f_ionatm(n)%logplt = 0
        if (trim(f_ionatm(n)%short_name)=='TE') f_ionatm(n)%logplt = 0
      enddo
!     write(6,"(/,'Initialized ',i3,' ionatm fields:')") nf_ionatm
!     write(6,"(7a10)") (trim(f_ionatm(n)%short_name),n=1,nf_ionatm)
!     do n=1,nf_ionatm
!       write(6,"('  Field ',i3,': ',a)")
!    |    n,trim(f_ionatm(n)%short_name)
!     enddo
      end subroutine init_ionatm
      end module flds_ionatm
!
!-----------------------------------------------------------------------
      module flds_ionzrt
      use fields
      use params
      implicit none
!
      integer,parameter :: nf_ionzrt=63
      type (field) :: f_ionzrt(nf_ionzrt) 
      real,target,dimension(nlev) ::
     |  qop     ,qo2p    ,qnop    ,qn2p    ,qnp     ,qtin    ,
     |  qian    ,qiaur   ,qpro    ,qixray  ,qnspe   ,qcr     ,   
     |  qti     ,dinolya ,qop2p   ,qop2d   ,qop4s   ,qo2p4p  ,
     |  aqops   ,aqn2p   ,aqo2p   ,aqinp   ,aqop2p  ,aqop2d  ,
     |  aqop4s  ,apnoeuv ,adnoeuv ,ado2euv ,ah2oeuv ,aco2euv ,
     |  acoeuv  ,ao3euv  ,ach4euv ,pinp    ,piop2p  ,piop2d  ,
     |  piop4s  ,ppnoeuv ,pdnoeuv ,pdo2euv ,ph2oeuv ,pco2euv ,
     |  pcoeuv  ,po3euv  ,pch4euv ,xjch4   ,xjch3oo ,xjch2oa ,
     |  xjch2ob ,xjh2o2  ,xjch4t  ,xjco2t  ,xjh2ot  ,xjno    ,
     |  xjno2   ,xjnop   ,xjo3t   ,xjo2t   ,xjio2p  ,xjiop   ,
     |  qn2ps   ,qops    ,qlyb
      real :: qia(5,nlev)
      contains
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      subroutine init_ionzrt
      integer :: n
      n = 0
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('O+ IONIZATION RATE')")
      f_ionzrt(n)%short_name = "QOP"
      f_ionzrt(n)%var_name = "QOP"
      f_ionzrt(n)%units = "CM-3 S-1"
      f_ionzrt(n)%data => qop
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('O2+ IONIZATION RATE')")
      f_ionzrt(n)%short_name = "QO2P"
      f_ionzrt(n)%var_name = "QO2P"
      f_ionzrt(n)%units = "CM-3 S-1"
      f_ionzrt(n)%data => qo2p
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('NO+ IONIZATION RATE')")
      f_ionzrt(n)%short_name = "QNOP"
      f_ionzrt(n)%var_name = "QNOP"
      f_ionzrt(n)%units = "CM-3 S-1"
      f_ionzrt(n)%data => qnop
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('N2+ IONIZATION RATE')")
      f_ionzrt(n)%short_name = "QN2P"
      f_ionzrt(n)%var_name = "QN2P"
      f_ionzrt(n)%units = "CM-3 S-1"
      f_ionzrt(n)%data => qn2p
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('N+ IONIZATION RATE')")
      f_ionzrt(n)%short_name = "QNP"
      f_ionzrt(n)%var_name = "QNP"
      f_ionzrt(n)%units = "CM-3 S-1"
      f_ionzrt(n)%data => qnp
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('TOTAL IONIZATION RATE')")
      f_ionzrt(n)%short_name = "QTIN"
      f_ionzrt(n)%var_name = "QTIN"
      f_ionzrt(n)%units = "CM-3 S-1"
      f_ionzrt(n)%data => qtin
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('AURORAL PARTICLE HEATING')")
      f_ionzrt(n)%short_name = "QIAN"
      f_ionzrt(n)%var_name = "QIAN"
      f_ionzrt(n)%units = "ERGS GM-1 S-1"
      f_ionzrt(n)%data => qian
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('QIAUR')")
      f_ionzrt(n)%short_name = "QIAUR"
      f_ionzrt(n)%var_name = "QIAUR"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => qiaur
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('SOLAR PROTON HEATING')")
      f_ionzrt(n)%short_name = "QPRO"
      f_ionzrt(n)%var_name = "QPRO"
      f_ionzrt(n)%units = "CM-3 S-1"
      f_ionzrt(n)%data => qpro
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('X-RAY ION PRODUCTION')")
      f_ionzrt(n)%short_name = "QIXRAY"
      f_ionzrt(n)%var_name = "QIXRAY"
      f_ionzrt(n)%units = "CM-3 S-1"
      f_ionzrt(n)%data => qixray
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('SECONDARY PHOTOELECTRON HEATING')")
      f_ionzrt(n)%short_name = "QNSPE"
      f_ionzrt(n)%var_name = "QNSPE"
      f_ionzrt(n)%units = "CM-3 S-1"
      f_ionzrt(n)%data => qnspe
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('COSMIC RAY ION PRODUCTION')")
      f_ionzrt(n)%short_name = "QCR"
      f_ionzrt(n)%var_name = "QCR"
      f_ionzrt(n)%units = "CM-3 S-1"
      f_ionzrt(n)%data => qcr
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('QTI')")
      f_ionzrt(n)%short_name = "QTI"
      f_ionzrt(n)%var_name = "QTI"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => qti
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('DINOLYA')")
      f_ionzrt(n)%short_name = "DINOLYA"
      f_ionzrt(n)%var_name = "DINOLYA"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => dinolya
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('QOP2P')")
      f_ionzrt(n)%short_name = "QOP2P"
      f_ionzrt(n)%var_name = "QOP2P"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => qop2p
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('QOP2D')")
      f_ionzrt(n)%short_name = "QOP2D"
      f_ionzrt(n)%var_name = "QOP2D"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => qop2d
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('QOP4S')")
      f_ionzrt(n)%short_name = "QOP4S"
      f_ionzrt(n)%var_name = "QOP4S"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => qop4s
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('QO2P4P')")
      f_ionzrt(n)%short_name = "QO2P4P"
      f_ionzrt(n)%var_name = "QO2P4P"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => qo2p4p
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('AQOPS')")
      f_ionzrt(n)%short_name = "AQOPS"
      f_ionzrt(n)%var_name = "AQOPS"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => aqops
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('AQN2P')")
      f_ionzrt(n)%short_name = "AQN2P"
      f_ionzrt(n)%var_name = "AQN2P"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => aqn2p
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('AQO2P')")
      f_ionzrt(n)%short_name = "AQO2P"
      f_ionzrt(n)%var_name = "AQO2P"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => aqo2p
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('AQINP')")
      f_ionzrt(n)%short_name = "AQINP"
      f_ionzrt(n)%var_name = "AQINP"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => aqinp
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('AQOP2P')")
      f_ionzrt(n)%short_name = "AQOP2P"
      f_ionzrt(n)%var_name = "AQOP2P"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => aqop2p
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('AQOP2D')")
      f_ionzrt(n)%short_name = "AQOP2D"
      f_ionzrt(n)%var_name = "AQOP2D"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => aqop2d
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('AQOP4S')")
      f_ionzrt(n)%short_name = "AQOP4S"
      f_ionzrt(n)%var_name = "AQOP4S"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => aqop4s
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('APNOEUV')")
      f_ionzrt(n)%short_name = "APNOEUV"
      f_ionzrt(n)%var_name = "APNOEUV"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => apnoeuv
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('ADNOEUV')")
      f_ionzrt(n)%short_name = "ADNOEUV"
      f_ionzrt(n)%var_name = "ADNOEUV"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => adnoeuv
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('ADO2EUV')")
      f_ionzrt(n)%short_name = "ADO2EUV"
      f_ionzrt(n)%var_name = "ADO2EUV"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => ado2euv
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('AH2OEUV')")
      f_ionzrt(n)%short_name = "AH2OEUV"
      f_ionzrt(n)%var_name = "AH2OEUV"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => ah2oeuv
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('ACO2EUV')")
      f_ionzrt(n)%short_name = "ACO2EUV"
      f_ionzrt(n)%var_name = "ACO2EUV"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => aco2euv
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('ACOEUV')")
      f_ionzrt(n)%short_name = "ACOEUV"
      f_ionzrt(n)%var_name = "ACOEUV"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => acoeuv
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('AO3EUV')")
      f_ionzrt(n)%short_name = "AO3EUV"
      f_ionzrt(n)%var_name = "AO3EUV"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => ao3euv
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('ACH4EUV')")
      f_ionzrt(n)%short_name = "ACH4EUV"
      f_ionzrt(n)%var_name = "ACH4EUV"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => ach4euv
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('PINP')")
      f_ionzrt(n)%short_name = "PINP"
      f_ionzrt(n)%var_name = "PINP"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => pinp
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('PIOP2P')")
      f_ionzrt(n)%short_name = "PIOP2P"
      f_ionzrt(n)%var_name = "PIOP2P"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => piop2p
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('PIOP2D')")
      f_ionzrt(n)%short_name = "PIOP2D"
      f_ionzrt(n)%var_name = "PIOP2D"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => piop2d
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('PIOP4S')")
      f_ionzrt(n)%short_name = "PIOP4S"
      f_ionzrt(n)%var_name = "PIOP4S"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => piop4s
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('PPNOEUV')")
      f_ionzrt(n)%short_name = "PPNOEUV"
      f_ionzrt(n)%var_name = "PPNOEUV"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => ppnoeuv
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('PDNOEUV')")
      f_ionzrt(n)%short_name = "PDNOEUV"
      f_ionzrt(n)%var_name = "PDNOEUV"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => pdnoeuv
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('PDO2EUV')")
      f_ionzrt(n)%short_name = "PDO2EUV"
      f_ionzrt(n)%var_name = "PDO2EUV"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => pdo2euv
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('PH2OEUV')")
      f_ionzrt(n)%short_name = "PH2OEUV"
      f_ionzrt(n)%var_name = "PH2OEUV"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => ph2oeuv
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('PCO2EUV')")
      f_ionzrt(n)%short_name = "PCO2EUV"
      f_ionzrt(n)%var_name = "PCO2EUV"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => pco2euv
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('PCOEUV')")
      f_ionzrt(n)%short_name = "PCOEUV"
      f_ionzrt(n)%var_name = "PCOEUV"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => pcoeuv
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('PO3EUV')")
      f_ionzrt(n)%short_name = "PO3EUV"
      f_ionzrt(n)%var_name = "PO3EUV"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => po3euv
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('PCH4EUV')")
      f_ionzrt(n)%short_name = "PCH4EUV"
      f_ionzrt(n)%var_name = "PCH4EUV"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => pch4euv
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('XJCH4')")
      f_ionzrt(n)%short_name = "XJCH4"
      f_ionzrt(n)%var_name = "XJCH4"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => xjch4
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('XJCH3OO')")
      f_ionzrt(n)%short_name = "XJCH3OO"
      f_ionzrt(n)%var_name = "XJCH3OO"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => xjch3oo
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('XJCH2OA')")
      f_ionzrt(n)%short_name = "XJCH2OA"
      f_ionzrt(n)%var_name = "XJCH2OA"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => xjch2oa
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('XJCH2OB')")
      f_ionzrt(n)%short_name = "XJCH2OB"
      f_ionzrt(n)%var_name = "XJCH2OB"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => xjch2ob
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('XJH2O2')")
      f_ionzrt(n)%short_name = "XJH2O2"
      f_ionzrt(n)%var_name = "XJH2O2"
      f_ionzrt(n)%units = "CM-3"
      f_ionzrt(n)%data => xjh2o2
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('XJCH4T')")
      f_ionzrt(n)%short_name = "XJCH4T"
      f_ionzrt(n)%var_name = "XJCH4T"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => xjch4t
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('XJCO2T')")
      f_ionzrt(n)%short_name = "XJCO2T"
      f_ionzrt(n)%var_name = "XJCO2T"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => xjco2t
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('XJH2OT')")
      f_ionzrt(n)%short_name = "XJH2OT"
      f_ionzrt(n)%var_name = "XJH2OT"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => xjh2ot
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('XJNO')")
      f_ionzrt(n)%short_name = "XJNO"
      f_ionzrt(n)%var_name = "XJNO"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => xjno
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('XJNO2')")
      f_ionzrt(n)%short_name = "XJNO2"
      f_ionzrt(n)%var_name = "XJNO2"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => xjno2
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('XJNOP')")
      f_ionzrt(n)%short_name = "XJNOP"
      f_ionzrt(n)%var_name = "XJNOP"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => xjnop
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('XJO3T')")
      f_ionzrt(n)%short_name = "XJO3T"
      f_ionzrt(n)%var_name = "XJO3T"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => xjo3t
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('XJO2T')")
      f_ionzrt(n)%short_name = "XJO2T"
      f_ionzrt(n)%var_name = "XJO2T"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => xjo2t
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('XJIO2P')")
      f_ionzrt(n)%short_name = "XJIO2P"
      f_ionzrt(n)%var_name = "XJIO2P"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => xjio2p
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('XJIOP')")
      f_ionzrt(n)%short_name = "XJIOP"
      f_ionzrt(n)%var_name = "XJIOP"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => xjiop
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('QN2PS')")
      f_ionzrt(n)%short_name = "QN2PS"
      f_ionzrt(n)%var_name = "QN2PS"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => qn2ps
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('QOPS')")
      f_ionzrt(n)%short_name = "QOPS"
      f_ionzrt(n)%var_name = "QOPS"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => qops
!
      n = n+1 
      write(f_ionzrt(n)%long_name,"('QLYB')")
      f_ionzrt(n)%short_name = "QLYB"
      f_ionzrt(n)%var_name = "QLYB"
      f_ionzrt(n)%units = " "
      f_ionzrt(n)%data => qlyb
!
! Initial value:
      do n=1,nf_ionzrt
        f_ionzrt(n)%data = 0.
        f_ionzrt(n)%class = "ionzrt"
        f_ionzrt(n)%timedep = "time-dependent"
        f_ionzrt(n)%logplt = 1
        if (trim(f_ionzrt(n)%short_name)=='QIAN' )f_ionzrt(n)%logplt=0
      enddo
!     write(6,"(/,'Initialized ',i3,' ionzrt fields:')") nf_ionzrt
!     write(6,"(7a10)") (trim(f_ionzrt(n)%short_name),n=1,nf_ionzrt)
!     do n=1,nf_ionzrt
!       write(6,"('  Field ',i3,': ',a)")
!    |    n,trim(f_ionzrt(n)%short_name)
!     enddo
      end subroutine init_ionzrt
      end module flds_ionzrt
!-----------------------------------------------------------------------
      module flds_prodloss
      use fields
      use params
      implicit none
!
      integer,parameter :: nf_prodloss=72
      type (field) :: f_prodloss(nf_prodloss) 
      real,target,dimension(nlev) ::
     |  po21sg  ,xlo21sg ,po21dl  ,xlo21dl ,pch3    ,xlch3   ,
     |  pch3o2  ,xlch3o2 ,pch3oo  ,xlch3oo ,pch3o   ,xlch3o  ,
     |  pch2o   ,xlch2o  ,phco    ,xlhco   ,ph2o2   ,xlh2o2  ,
     |  pch4    ,xlch4   ,pco2    ,xlco2   ,pco     ,xlco    ,
     |  ph2o    ,xlh2o   ,ph2     ,xlh2    ,pho2    ,xlho2   ,
     |  poh     ,xloh    ,ph      ,xlh     ,phox    ,xlhox   ,
     |  xlhoxt  ,pn4s    ,xln4s   ,pno     ,xlno    ,pno2    ,
     |  xlno2   ,pnox    ,xlnox   ,xlnoxt  ,po3     ,xlo3    ,
     |  po      ,xlo     ,ratio1  ,ratio2  ,ratio3  ,ratio4  ,
     |  ratio5  ,ratio6  ,ratio7  ,a4      ,a5      ,b1      ,   
     |  b2      ,b3      ,c1      ,c2      ,c3      ,d1      ,   
     |  pn2d    ,xln2d   ,po1d    ,xlo1d   ,pna     ,xlna
      contains
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      subroutine init_prodloss
      integer :: n
      n = 0
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PO21SG')")
      f_prodloss(n)%short_name = "PO21SG"
      f_prodloss(n)%var_name = "PO21SG"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => po21sg
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLO21SG')")
      f_prodloss(n)%short_name = "XLO21SG"
      f_prodloss(n)%var_name = "XLO21SG"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlo21sg
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PO21DL')")
      f_prodloss(n)%short_name = "PO21DL"
      f_prodloss(n)%var_name = "PO21DL"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => po21dl
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLO21DL')")
      f_prodloss(n)%short_name = "XLO21DL"
      f_prodloss(n)%var_name = "XLO21DL"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlo21dl
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PCH3')")
      f_prodloss(n)%short_name = "PCH3"
      f_prodloss(n)%var_name = "PCH3"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => pch3
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLCH3')")
      f_prodloss(n)%short_name = "XLCH3"
      f_prodloss(n)%var_name = "XLCH3"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlch3
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PCH3O2')")
      f_prodloss(n)%short_name = "PCH3O2"
      f_prodloss(n)%var_name = "PCH3O2"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => pch3o2
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLCH3O2')")
      f_prodloss(n)%short_name = "XLCH3O2"
      f_prodloss(n)%var_name = "XLCH3O2"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlch3o2
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PCH3oo')")
      f_prodloss(n)%short_name = "PCH3oo"
      f_prodloss(n)%var_name = "PCH3oo"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => pch3oo
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLCH3OO')")
      f_prodloss(n)%short_name = "XLCH3OO"
      f_prodloss(n)%var_name = "XLCH3OO"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlch3oo
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PCH3O')")
      f_prodloss(n)%short_name = "PCH3O"
      f_prodloss(n)%var_name = "PCH3O"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => pch3o
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLCH3O')")
      f_prodloss(n)%short_name = "XLCH3O"
      f_prodloss(n)%var_name = "XLCH3O"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlch3o
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PCH2O')")
      f_prodloss(n)%short_name = "PCH2O"
      f_prodloss(n)%var_name = "PCH2O"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => pch2o
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLCH2O')")
      f_prodloss(n)%short_name = "XLCH2O"
      f_prodloss(n)%var_name = "XLCH2O"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlch2o
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PHCO')")
      f_prodloss(n)%short_name = "PHCO"
      f_prodloss(n)%var_name = "PHCO"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => phco
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLHCO')")
      f_prodloss(n)%short_name = "XLHCO"
      f_prodloss(n)%var_name = "XLHCO"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlhco
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PH2O2')")
      f_prodloss(n)%short_name = "PH2O2"
      f_prodloss(n)%var_name = "PH2O2"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => ph2o2
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLH2O2')")
      f_prodloss(n)%short_name = "XLH2O2"
      f_prodloss(n)%var_name = "XLH2O2"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlh2o2
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PCH4')")
      f_prodloss(n)%short_name = "PCH4"
      f_prodloss(n)%var_name = "PCH4"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => pch4
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLCH4')")
      f_prodloss(n)%short_name = "XLCH4"
      f_prodloss(n)%var_name = "XLCH4"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlch4
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PCO2')")
      f_prodloss(n)%short_name = "PCO2"
      f_prodloss(n)%var_name = "PCO2"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => pco2
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLCO2')")
      f_prodloss(n)%short_name = "XLCO2"
      f_prodloss(n)%var_name = "XLCO2"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlco2
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PCO')")
      f_prodloss(n)%short_name = "PCO"
      f_prodloss(n)%var_name = "PCO"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => pco
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLCO')")
      f_prodloss(n)%short_name = "XLCO"
      f_prodloss(n)%var_name = "XLCO"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlco
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PH2O')")
      f_prodloss(n)%short_name = "PH2O"
      f_prodloss(n)%var_name = "PH2O"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => ph2o
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLH2O')")
      f_prodloss(n)%short_name = "XLH2O"
      f_prodloss(n)%var_name = "XLH2O"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlh2o
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PH2')")
      f_prodloss(n)%short_name = "PH2"
      f_prodloss(n)%var_name = "PH2"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => ph2
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLH2')")
      f_prodloss(n)%short_name = "XLH2"
      f_prodloss(n)%var_name = "XLH2"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlh2
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PHO2')")
      f_prodloss(n)%short_name = "PHO2"
      f_prodloss(n)%var_name = "PHO2"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => pho2
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLHO2')")
      f_prodloss(n)%short_name = "XLHO2"
      f_prodloss(n)%var_name = "XLHO2"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlho2
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('POH')")
      f_prodloss(n)%short_name = "POH"
      f_prodloss(n)%var_name = "POH"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => poh
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLOH')")
      f_prodloss(n)%short_name = "XLOH"
      f_prodloss(n)%var_name = "XLOH"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xloh
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PH')")
      f_prodloss(n)%short_name = "PH"
      f_prodloss(n)%var_name = "PH"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => ph
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLH')")
      f_prodloss(n)%short_name = "XLH"
      f_prodloss(n)%var_name = "XLH"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlh
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PHOX')")
      f_prodloss(n)%short_name = "PHOX"
      f_prodloss(n)%var_name = "PHOX"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => phox
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLHOX')")
      f_prodloss(n)%short_name = "XLHOX"
      f_prodloss(n)%var_name = "XLHOX"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlhox
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLHOXT')")
      f_prodloss(n)%short_name = "XLHOXT"
      f_prodloss(n)%var_name = "XLHOXT"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlhoxt
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PN4S')")
      f_prodloss(n)%short_name = "PN4S"
      f_prodloss(n)%var_name = "PN4S"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => pn4s
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLN4S')")
      f_prodloss(n)%short_name = "XLN4S"
      f_prodloss(n)%var_name = "XLN4S"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xln4s
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PNO')")
      f_prodloss(n)%short_name = "PNO"
      f_prodloss(n)%var_name = "PNO"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => pno
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLNO')")
      f_prodloss(n)%short_name = "XLNO"
      f_prodloss(n)%var_name = "XLNO"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlno
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PNO2')")
      f_prodloss(n)%short_name = "PNO2"
      f_prodloss(n)%var_name = "PNO2"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => pno2
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLNO2')")
      f_prodloss(n)%short_name = "XLNO2"
      f_prodloss(n)%var_name = "XLNO2"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlno2
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PNOX')")
      f_prodloss(n)%short_name = "PNOX"
      f_prodloss(n)%var_name = "PNOX"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => pnox
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLNOX')")
      f_prodloss(n)%short_name = "XLNOX"
      f_prodloss(n)%var_name = "XLNOX"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlnox
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLNOXT')")
      f_prodloss(n)%short_name = "XLNOXT"
      f_prodloss(n)%var_name = "XLNOXT"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlnoxt
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PO3')")
      f_prodloss(n)%short_name = "PO3"
      f_prodloss(n)%var_name = "PO3"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => po3
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLO3')")
      f_prodloss(n)%short_name = "XLO3"
      f_prodloss(n)%var_name = "XLO3"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlo3
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PO')")
      f_prodloss(n)%short_name = "PO"
      f_prodloss(n)%var_name = "PO"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => po
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLO')")
      f_prodloss(n)%short_name = "XLO"
      f_prodloss(n)%var_name = "XLO"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlo
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('RATIO1')")
      f_prodloss(n)%short_name = "RATIO1"
      f_prodloss(n)%var_name = "RATIO1"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => ratio1
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('RATIO2')")
      f_prodloss(n)%short_name = "RATIO2"
      f_prodloss(n)%var_name = "RATIO2"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => ratio2
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('RATIO3')")
      f_prodloss(n)%short_name = "RATIO3"
      f_prodloss(n)%var_name = "RATIO3"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => ratio3
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('RATIO4')")
      f_prodloss(n)%short_name = "RATIO4"
      f_prodloss(n)%var_name = "RATIO4"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => ratio4
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('RATIO5')")
      f_prodloss(n)%short_name = "RATIO5"
      f_prodloss(n)%var_name = "RATIO5"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => ratio5
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('RATIO6')")
      f_prodloss(n)%short_name = "RATIO6"
      f_prodloss(n)%var_name = "RATIO6"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => ratio6
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('RATIO7')")
      f_prodloss(n)%short_name = "RATIO7"
      f_prodloss(n)%var_name = "RATIO7"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => ratio7
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('A4')")
      f_prodloss(n)%short_name = "A4"
      f_prodloss(n)%var_name = "A4"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => a4
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('A5')")
      f_prodloss(n)%short_name = "A5"
      f_prodloss(n)%var_name = "A5"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => a5
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('B1')")
      f_prodloss(n)%short_name = "B1"
      f_prodloss(n)%var_name = "B1"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => b1
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('B2')")
      f_prodloss(n)%short_name = "B2"
      f_prodloss(n)%var_name = "B2"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => b2
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('B3')")
      f_prodloss(n)%short_name = "B3"
      f_prodloss(n)%var_name = "B3"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => b3
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('C1')")
      f_prodloss(n)%short_name = "C1"
      f_prodloss(n)%var_name = "C1"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => c1
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('C2')")
      f_prodloss(n)%short_name = "C2"
      f_prodloss(n)%var_name = "C2"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => c2
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('C3')")
      f_prodloss(n)%short_name = "C3"
      f_prodloss(n)%var_name = "C3"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => c3
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('D1')")
      f_prodloss(n)%short_name = "D1"
      f_prodloss(n)%var_name = "D1"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => d1
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PN2D')")
      f_prodloss(n)%short_name = "PN2D"
      f_prodloss(n)%var_name = "PN2D"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => pn2d
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLN2D')")
      f_prodloss(n)%short_name = "XLN2D"
      f_prodloss(n)%var_name = "XLN2D"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xln2d
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PO1D')")
      f_prodloss(n)%short_name = "PO1D"
      f_prodloss(n)%var_name = "PO1D"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => po1d
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLO1D')")
      f_prodloss(n)%short_name = "XLO1D"
      f_prodloss(n)%var_name = "XLO1D"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlo1d
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('PNA')")
      f_prodloss(n)%short_name = "PNA"
      f_prodloss(n)%var_name = "PNA"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => pna
!
      n = n+1 
      write(f_prodloss(n)%long_name,"('XLNA')")
      f_prodloss(n)%short_name = "XLNA"
      f_prodloss(n)%var_name = "XLNA"
      f_prodloss(n)%units = " "
      f_prodloss(n)%data => xlna
!
! Initial value:
      do n=1,nf_prodloss
        f_prodloss(n)%data = 0.
        f_prodloss(n)%class = "prodloss"
        f_prodloss(n)%timedep = "time-dependent"
        f_prodloss(n)%logplt = 1
      enddo
!     write(6,"(/,'Initialized ',i3,' prodloss fields:')") nf_prodloss
!     write(6,"(7a10)") (trim(f_prodloss(n)%short_name),n=1,nf_prodloss)
!     do n=1,nf_prodloss
!       write(6,"('  Field ',i3,': ',a)")
!    |    n,trim(f_prodloss(n)%short_name)
!     enddo
      end subroutine init_prodloss
      end module flds_prodloss
!-----------------------------------------------------------------------
      module flds_ratecoef
      use fields
      use params
      implicit none
!
      integer,parameter :: nf_ratecoef=148
      type (field) :: f_ratecoef(nf_ratecoef) 
      real,target,dimension(nlev) ::
     |  rk1     ,rk2     ,rk3     ,rk4     ,rk5     ,rk6     ,   
     |  rk7     ,rk8     ,rk9     ,rk10    ,rk11    ,rk12    ,
     |  rk13    ,rk14    ,rk15    ,rk16    ,rk17    ,rk18    ,
     |  rk19    ,rk20    ,rk21    ,rk22    ,rk23    ,rk24    ,
     |  rk25    ,rk26    ,rk27    ,rk28    ,alp1    ,alp2    ,
     |  alp3    ,rb1     ,rb2     ,rb3     ,rb4     ,rb5     ,   
     |  rb6     ,rb7     ,rb8     ,rb9     ,rb10    ,rb11    ,
     |  rb12    ,rb13    ,rkm1    ,rkm2a   ,rkm2b   ,rkm3    ,
     |  rkm4    ,rkm5a   ,rkm5b   ,rkm6    ,rkm7a   ,rkm7b   ,
     |  rkm8    ,rkm9    ,rkm10   ,rkm11   ,rkm12   ,rkm13   ,
     |  rkm14   ,rkm15   ,rkm16   ,rkm17   ,rkm18   ,rkm19   ,
     |  rkm20   ,rkm21   ,rkm22   ,rkm23   ,rkm24   ,rkm25   ,
     |  rkm26   ,rkm27   ,rkm28   ,rkm29   ,rkm30   ,rkm31   ,
     |  rkm32   ,rkm33   ,rkm34   ,rkm35   ,rkm36   ,rkm37   ,
     |  rkm38   ,rkm39   ,rkm40   ,rkm41   ,rkm42   ,rkm43   ,
     |  rkm44   ,rkm45   ,gam1    ,gam2a   ,gam2b   ,gam3    ,
     |  gam4    ,gam5    ,gam6    ,gam7    ,gam8    ,gam9    ,
     |  gam10   ,gam11   ,gam12   ,gam13   ,gam14   ,gam15   ,
     |  del1    ,del2    ,del3    ,rkm8a   ,rb14    ,rkn1    ,
     |  rkn2    ,rkn3a   ,rkn3b   ,rkn4    ,rkn5    ,rkn6    ,
     |  rkn7    ,rkn8    ,rkn9    ,xjn10   ,rkn11   ,xjn12   ,
     |  rkn13   ,xjn14   ,rkn15   ,rkn16   ,rkn17   ,rkn18   ,
     |  rkn19   ,rkn20   ,rkn21   ,rkn22   ,xjn23   ,rkn24a  ,
     |  rkn24b  ,rkn25   ,xjn26   ,rkn27a  ,rkn27b  ,rkn28   ,
     |  rkn29   ,rkn30   ,rk1nv   ,rk2nv
      real :: a1d,adl,asg
      contains
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      subroutine init_ratecoef
      integer :: n
      n = 0
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK1')")
      f_ratecoef(n)%short_name = "RK1"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk1
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK2')")
      f_ratecoef(n)%short_name = "RK2"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk2
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK3')")
      f_ratecoef(n)%short_name = "RK3"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk3
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK4')")
      f_ratecoef(n)%short_name = "RK4"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk4
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK5')")
      f_ratecoef(n)%short_name = "RK5"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk5
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK6')")
      f_ratecoef(n)%short_name = "RK6"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk6
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK7')")
      f_ratecoef(n)%short_name = "RK7"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk7
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK8')")
      f_ratecoef(n)%short_name = "RK8"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk8
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK9')")
      f_ratecoef(n)%short_name = "RK9"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk9
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK10')")
      f_ratecoef(n)%short_name = "RK10"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk10
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK11')")
      f_ratecoef(n)%short_name = "RK11"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk11
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK12')")
      f_ratecoef(n)%short_name = "RK12"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk12
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK13')")
      f_ratecoef(n)%short_name = "RK13"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk13
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK14')")
      f_ratecoef(n)%short_name = "RK14"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk14
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK15')")
      f_ratecoef(n)%short_name = "RK15"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk15
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK16')")
      f_ratecoef(n)%short_name = "RK16"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk16
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK17')")
      f_ratecoef(n)%short_name = "RK17"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk17
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK18')")
      f_ratecoef(n)%short_name = "RK18"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk18
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK19')")
      f_ratecoef(n)%short_name = "RK19"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk19
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK20')")
      f_ratecoef(n)%short_name = "RK20"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk20
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK21')")
      f_ratecoef(n)%short_name = "RK21"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk21
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK22')")
      f_ratecoef(n)%short_name = "RK22"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk22
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK23')")
      f_ratecoef(n)%short_name = "RK23"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk23
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK24')")
      f_ratecoef(n)%short_name = "RK14"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk14
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK25')")
      f_ratecoef(n)%short_name = "RK25"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk25
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK26')")
      f_ratecoef(n)%short_name = "RK26"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk26
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK27')")
      f_ratecoef(n)%short_name = "RK27"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk27
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK28')")
      f_ratecoef(n)%short_name = "RK28"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk28
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('ALP1')")
      f_ratecoef(n)%short_name = "ALP1"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => alp1
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('ALP2')")
      f_ratecoef(n)%short_name = "ALP2"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => alp2
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('ALP3')")
      f_ratecoef(n)%short_name = "ALP3"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => alp3
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RB1')")
      f_ratecoef(n)%short_name = "RB1"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RB1
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RB2')")
      f_ratecoef(n)%short_name = "RB2"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RB2
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RB3')")
      f_ratecoef(n)%short_name = "RB3"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RB3
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RB4')")
      f_ratecoef(n)%short_name = "RB4"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RB4
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RB5')")
      f_ratecoef(n)%short_name = "RB5"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RB5
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RB6')")
      f_ratecoef(n)%short_name = "RB6"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RB6
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RB7')")
      f_ratecoef(n)%short_name = "RB7"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RB7
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RB8')")
      f_ratecoef(n)%short_name = "RB8"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RB8
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RB9')")
      f_ratecoef(n)%short_name = "RB9"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RB9
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RB10')")
      f_ratecoef(n)%short_name = "RB10"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RB10
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RB11')")
      f_ratecoef(n)%short_name = "RB11"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RB11
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RB12')")
      f_ratecoef(n)%short_name = "RB12"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RB12
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RB13')")
      f_ratecoef(n)%short_name = "RB13"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RB13
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM1')")
      f_ratecoef(n)%short_name = "RKM1"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkm1
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM2A')")
      f_ratecoef(n)%short_name = "RKM2A"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM2A
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM2B')")
      f_ratecoef(n)%short_name = "RKM2B"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM2B
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM3')")
      f_ratecoef(n)%short_name = "RKM3"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM3
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM4')")
      f_ratecoef(n)%short_name = "RKM4"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM4
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM5A')")
      f_ratecoef(n)%short_name = "RKM5A"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM5A
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM5B')")
      f_ratecoef(n)%short_name = "RKM5B"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM5B
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM6')")
      f_ratecoef(n)%short_name = "RKM6"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM6
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM7A')")
      f_ratecoef(n)%short_name = "RKM7A"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM7A
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM7B')")
      f_ratecoef(n)%short_name = "RKM7B"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM7B
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM8')")
      f_ratecoef(n)%short_name = "RKM8"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM8
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM9')")
      f_ratecoef(n)%short_name = "RKM9"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM9
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM10')")
      f_ratecoef(n)%short_name = "RKM10"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM10
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM11')")
      f_ratecoef(n)%short_name = "RKM11"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM11
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM12')")
      f_ratecoef(n)%short_name = "RKM12"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM12
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM13')")
      f_ratecoef(n)%short_name = "RKM13"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM13
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM14')")
      f_ratecoef(n)%short_name = "RKM14"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM14
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM15')")
      f_ratecoef(n)%short_name = "RKM15"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM15
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM16')")
      f_ratecoef(n)%short_name = "RKM16"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM16
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM17')")
      f_ratecoef(n)%short_name = "RKM17"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM17
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM18')")
      f_ratecoef(n)%short_name = "RKM18"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM18
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM19')")
      f_ratecoef(n)%short_name = "RKM19"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM19
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM20')")
      f_ratecoef(n)%short_name = "RKM20"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM20
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM21')")
      f_ratecoef(n)%short_name = "RKM21"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM21
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM22')")
      f_ratecoef(n)%short_name = "RKM22"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM22
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM23')")
      f_ratecoef(n)%short_name = "RKM23"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM23
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM24')")
      f_ratecoef(n)%short_name = "RKM24"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM24
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM25')")
      f_ratecoef(n)%short_name = "RKM25"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM25
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM26')")
      f_ratecoef(n)%short_name = "RKM26"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM26
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM27')")
      f_ratecoef(n)%short_name = "RKM27"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM27
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM28')")
      f_ratecoef(n)%short_name = "RKM28"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM28
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM29')")
      f_ratecoef(n)%short_name = "RKM29"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM29
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM30')")
      f_ratecoef(n)%short_name = "RKM30"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM30
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM31')")
      f_ratecoef(n)%short_name = "RKM31"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM31
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM32')")
      f_ratecoef(n)%short_name = "RKM32"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM32
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM33')")
      f_ratecoef(n)%short_name = "RKM33"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM33
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM34')")
      f_ratecoef(n)%short_name = "RKM34"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM34
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM35')")
      f_ratecoef(n)%short_name = "RKM35"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM35
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM36')")
      f_ratecoef(n)%short_name = "RKM36"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM36
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM37')")
      f_ratecoef(n)%short_name = "RKM37"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM37
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM38')")
      f_ratecoef(n)%short_name = "RKM38"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM38
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM39')")
      f_ratecoef(n)%short_name = "RKM39"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM39
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM40')")
      f_ratecoef(n)%short_name = "RKM40"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM40
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM41')")
      f_ratecoef(n)%short_name = "RKM41"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM41
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM42')")
      f_ratecoef(n)%short_name = "RKM42"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM42
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM43')")
      f_ratecoef(n)%short_name = "RKM43"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM43
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM44')")
      f_ratecoef(n)%short_name = "RKM44"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM44
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM45')")
      f_ratecoef(n)%short_name = "RKM45"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => RKM45
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('GAM1')")
      f_ratecoef(n)%short_name = "GAM1"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => GAM1
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('GAM2A')")
      f_ratecoef(n)%short_name = "GAM2A"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => gam2a
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('GAM2B')")
      f_ratecoef(n)%short_name = "GAM2B"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => gam2b
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('GAM3')")
      f_ratecoef(n)%short_name = "GAM3"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => gam3
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('GAM4')")
      f_ratecoef(n)%short_name = "GAM4"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => gam4
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('GAM5')")
      f_ratecoef(n)%short_name = "GAM5"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => gam5
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('GAM6')")
      f_ratecoef(n)%short_name = "GAM6"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => gam6
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('GAM7')")
      f_ratecoef(n)%short_name = "GAM7"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => gam7
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('GAM8')")
      f_ratecoef(n)%short_name = "GAM8"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => gam8
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('GAM9')")
      f_ratecoef(n)%short_name = "GAM9"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => gam9
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('GAM10')")
      f_ratecoef(n)%short_name = "GAM10"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => gam10
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('GAM11')")
      f_ratecoef(n)%short_name = "GAM11"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => gam11
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('GAM12')")
      f_ratecoef(n)%short_name = "GAM12"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => gam12
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('GAM13')")
      f_ratecoef(n)%short_name = "GAM13"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => gam13
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('GAM14')")
      f_ratecoef(n)%short_name = "GAM14"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => gam14
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('GAM15')")
      f_ratecoef(n)%short_name = "GAM15"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => gam15
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('DEL1')")
      f_ratecoef(n)%short_name = "DEL1"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => del1
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('DEL2')")
      f_ratecoef(n)%short_name = "DEL2"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => del2
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('DEL3')")
      f_ratecoef(n)%short_name = "DEL3"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => del3
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKM8A')")
      f_ratecoef(n)%short_name = "RKM8A"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkm8a
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RB14')")
      f_ratecoef(n)%short_name = "RB14"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rb14
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN1')")
      f_ratecoef(n)%short_name = "RKN1"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn1
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN2')")
      f_ratecoef(n)%short_name = "RKN2"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn2
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN3A')")
      f_ratecoef(n)%short_name = "RKN3A"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn3a
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN3B')")
      f_ratecoef(n)%short_name = "RKN3B"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn3b
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN4')")
      f_ratecoef(n)%short_name = "RKN4"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn4
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN5')")
      f_ratecoef(n)%short_name = "RKN5"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn5
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN6')")
      f_ratecoef(n)%short_name = "RKN6"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn6
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN7')")
      f_ratecoef(n)%short_name = "RKN7"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn7
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN8')")
      f_ratecoef(n)%short_name = "RKN8"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn8
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN9')")
      f_ratecoef(n)%short_name = "RKN9"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn9
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('XJN10')")
      f_ratecoef(n)%short_name = "XJN10"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => xjn10
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN11')")
      f_ratecoef(n)%short_name = "RKN11"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn11
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('XJN12')")
      f_ratecoef(n)%short_name = "XJN12"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => xjn12
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN13')")
      f_ratecoef(n)%short_name = "RKN13"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn13
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('XJN14')")
      f_ratecoef(n)%short_name = "XJN14"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => xjn14
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN15')")
      f_ratecoef(n)%short_name = "RKN15"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn15
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN16')")
      f_ratecoef(n)%short_name = "RKN16"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn16
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN17')")
      f_ratecoef(n)%short_name = "RKN17"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn17
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN18')")
      f_ratecoef(n)%short_name = "RKN18"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn18
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN19')")
      f_ratecoef(n)%short_name = "RKN19"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn19
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN20')")
      f_ratecoef(n)%short_name = "RKN20"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn20
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN21')")
      f_ratecoef(n)%short_name = "RKN21"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn21
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN22')")
      f_ratecoef(n)%short_name = "RKN22"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn22
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('XJN23')")
      f_ratecoef(n)%short_name = "XJN23"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => xjn23
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN24A')")
      f_ratecoef(n)%short_name = "RKN24A"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn24a
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN24B')")
      f_ratecoef(n)%short_name = "RKN24B"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn24b
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN25')")
      f_ratecoef(n)%short_name = "RKN25"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn25
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('XJN26')")
      f_ratecoef(n)%short_name = "XJN26"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => xjn26
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN27A')")
      f_ratecoef(n)%short_name = "RKN27A"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn27a
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN27B')")
      f_ratecoef(n)%short_name = "RKN27B"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn27b
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN28')")
      f_ratecoef(n)%short_name = "RKN28"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn28
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN29')")
      f_ratecoef(n)%short_name = "RKN29"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn29
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RKN30')")
      f_ratecoef(n)%short_name = "RKN30"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rkn30
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK1NV')")
      f_ratecoef(n)%short_name = "RK1NV"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk1nv
!
      n = n+1 
      write(f_ratecoef(n)%long_name,"('RK2NV')")
      f_ratecoef(n)%short_name = "RK2NV"
      f_ratecoef(n)%units = " "
      f_ratecoef(n)%data => rk2nv
!
! Initial value:
      do n=1,nf_ratecoef
        f_ratecoef(n)%data = 0.
        f_ratecoef(n)%class = "ratecoef"
        f_ratecoef(n)%var_name = f_ratecoef(n)%short_name
        f_ratecoef(n)%timedep = "time-dependent"
        f_ratecoef(n)%logplt = 1
      enddo
!     write(6,"(/,'Initialized ',i3,' ratecoef fields:')") nf_ratecoef
!     write(6,"(7a10)") (trim(f_ratecoef(n)%short_name),n=1,nf_ratecoef)
!     do n=1,nf_ratecoef
!       write(6,"('  Field ',i3,': ',a)")
!    |    n,trim(f_ratecoef(n)%short_name)
!     enddo
      end subroutine init_ratecoef
      end module flds_ratecoef
!-----------------------------------------------------------------------
      module flds_sodium
      use fields
      use params
      implicit none
!
      integer,parameter :: nf_sodium=28
      type (field) :: f_sodium(nf_sodium) 
      real,target,dimension(nlev) ::
     |  pnam    ,pnas    ,xlnas   ,xnas    ,xlbnas  ,xnapco2 ,
     |  xnaph2o ,xnaop   ,xnao    ,pnasp   ,xlnasp  ,xnasp   ,
     |  xnan2p  ,xnaoh   ,xnao2   ,pnaoh   ,xlnaoh  ,pnao2   ,
     |  xlnao2  ,pnao    ,xlnao   ,xnaspe  ,xnao3   ,xnaco3  ,
     |  xnahco3 ,xnat    ,xnaco2p ,xnah2op
      contains
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      subroutine init_sodium
      integer :: n
      n = 0
!
      n = n+1 
      write(f_sodium(n)%long_name,"('PNAM')")
      f_sodium(n)%short_name = "PNAM"
      f_sodium(n)%var_name = "PNAM"
      f_sodium(n)%units = " "
      f_sodium(n)%data => pnam
!
      n = n+1 
      write(f_sodium(n)%long_name,"('PNAS')")
      f_sodium(n)%short_name = "PNAS"
      f_sodium(n)%var_name = "PNAS"
      f_sodium(n)%units = " "
      f_sodium(n)%data => pnas
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XLNAS')")
      f_sodium(n)%short_name = "XLNAS"
      f_sodium(n)%var_name = "XLNAS"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xlnas
!
      n = n+1 
      write(f_sodium(n)%long_name,"('NEUTRAL SODIUM')")
      f_sodium(n)%short_name = "XNAS"
      f_sodium(n)%var_name = "XNAS"
      f_sodium(n)%units = "CM-3"
      f_sodium(n)%data => xnas
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XLBNAS')")
      f_sodium(n)%short_name = "XLBNAS"
      f_sodium(n)%var_name = "XLBNAS"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xlbnas
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XNAPCO2')")
      f_sodium(n)%short_name = "XNAPCO2"
      f_sodium(n)%var_name = "XNAPCO2"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xnapco2
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XNAPH2O')")
      f_sodium(n)%short_name = "XNAPH2O"
      f_sodium(n)%var_name = "XNAPH2O"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xnaph2o
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XNAOP')")
      f_sodium(n)%short_name = "XNAOP"
      f_sodium(n)%var_name = "XNAOP"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xnaop
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XNAO')")
      f_sodium(n)%short_name = "XNAO"
      f_sodium(n)%var_name = "XNAO"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xnao
!
      n = n+1 
      write(f_sodium(n)%long_name,"('PNASP')")
      f_sodium(n)%short_name = "PNASP"
      f_sodium(n)%var_name = "PNASP"
      f_sodium(n)%units = " "
      f_sodium(n)%data => pnasp
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XLNASP')")
      f_sodium(n)%short_name = "XLNASP"
      f_sodium(n)%var_name = "XLNASP"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xlnasp
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XNASP')")
      f_sodium(n)%short_name = "XNASP"
      f_sodium(n)%var_name = "XNASP"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xnasp
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XNAN2P')")
      f_sodium(n)%short_name = "XNAN2P"
      f_sodium(n)%var_name = "XNAN2P"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xnan2p
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XNAOH')")
      f_sodium(n)%short_name = "XNAOH"
      f_sodium(n)%var_name = "XNAOH"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xnaoh
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XNAO2')")
      f_sodium(n)%short_name = "XNAO2"
      f_sodium(n)%var_name = "XNAO2"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xnao2
!
      n = n+1 
      write(f_sodium(n)%long_name,"('PNAOH')")
      f_sodium(n)%short_name = "PNAOH"
      f_sodium(n)%var_name = "PNAOH"
      f_sodium(n)%units = " "
      f_sodium(n)%data => pnaoh
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XLNAOH')")
      f_sodium(n)%short_name = "XLNAOH"
      f_sodium(n)%var_name = "XLNAOH"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xlnaoh
!
      n = n+1 
      write(f_sodium(n)%long_name,"('PNAO2')")
      f_sodium(n)%short_name = "PNAO2"
      f_sodium(n)%var_name = "PNAO2"
      f_sodium(n)%units = " "
      f_sodium(n)%data => pnao2
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XLNAO2')")
      f_sodium(n)%short_name = "XLNAO2"
      f_sodium(n)%var_name = "XLNAO2"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xlnao2
!
      n = n+1 
      write(f_sodium(n)%long_name,"('PNAO')")
      f_sodium(n)%short_name = "PNAO"
      f_sodium(n)%var_name = "PNAO"
      f_sodium(n)%units = " "
      f_sodium(n)%data => pnao
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XLNAO')")
      f_sodium(n)%short_name = "XLNAO"
      f_sodium(n)%var_name = "XLNAO"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xlnao
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XNASPE')")
      f_sodium(n)%short_name = "XNASPE"
      f_sodium(n)%var_name = "XNASPE"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xnaspe
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XNAO3')")
      f_sodium(n)%short_name = "XNAO3"
      f_sodium(n)%var_name = "XNAO3"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xnao3
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XNACO3')")
      f_sodium(n)%short_name = "XNACO3"
      f_sodium(n)%var_name = "XNACO3"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xnaco3
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XNAHCO3')")
      f_sodium(n)%short_name = "XNAHCO3"
      f_sodium(n)%var_name = "XNAHCO3"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xnahco3
!
      n = n+1 
      write(f_sodium(n)%long_name,"('TOTAL SODIUM')")
      f_sodium(n)%short_name = "XNAT"
      f_sodium(n)%var_name = "XNAT"
      f_sodium(n)%units = "CM-3"
      f_sodium(n)%data => xnat
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XNACO2P')")
      f_sodium(n)%short_name = "XNACO2P"
      f_sodium(n)%var_name = "XNACO2P"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xnaco2p
!
      n = n+1 
      write(f_sodium(n)%long_name,"('XNAH2OP')")
      f_sodium(n)%short_name = "XNAH2OP"
      f_sodium(n)%var_name = "XNAH2OP"
      f_sodium(n)%units = " "
      f_sodium(n)%data => xnah2op
!
! Initial value:
      do n=1,nf_sodium
        f_sodium(n)%data = 0.
        f_sodium(n)%class = "sodium"
        f_sodium(n)%timedep = "time-dependent"
        f_sodium(n)%logplt = 1
      enddo
!
! Init as in old glbmean.F:
      xnapco2 = 1.e-20
      xnaph2o = 1.e-20
      xnaop = 1.e-20
!
!     write(6,"(/,'Initialized ',i3,' sodium fields:')") nf_sodium
!     write(6,"(7a10)") (trim(f_sodium(n)%short_name),n=1,nf_sodium)
!     do n=1,nf_sodium
!       write(6,"('  Field ',i3,': ',a)")
!    |    n,trim(f_sodium(n)%short_name)
!     enddo
      end subroutine init_sodium
      end module flds_sodium
!-----------------------------------------------------------------------
      module flds_msisatm
      use fields
      use params
      implicit none
!
      integer,parameter :: nf_msisatm=13
      type (field) :: f_msisatm(nf_msisatm) 
      real,target,dimension(nlev) ::
     |  xom     ,xo2m    ,xn2m    ,xn4sm   ,xnhem   ,xnargm  ,
     |  xnhm    ,tnms    ,zpms    ,zpmht   ,shtms   ,amass   ,
     |  rhoms
      contains
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      subroutine init_msisatm
      integer :: n
      n = 0
!
      n = n+1 
      write(f_msisatm(n)%long_name,"('MSIS O')")
      f_msisatm(n)%short_name = "XOM"
      f_msisatm(n)%var_name = "XOM"
      f_msisatm(n)%units = "CM-3"
      f_msisatm(n)%data => xom
!
      n = n+1 
      write(f_msisatm(n)%long_name,"('MSIS O2')")
      f_msisatm(n)%short_name = "XO2M"
      f_msisatm(n)%var_name = "XO2M"
      f_msisatm(n)%units = "CM-3"
      f_msisatm(n)%data => xo2m
!
      n = n+1 
      write(f_msisatm(n)%long_name,"('MSIS N2')")
      f_msisatm(n)%short_name = "XN2M"
      f_msisatm(n)%var_name = "XN2M"
      f_msisatm(n)%units = "CM-3"
      f_msisatm(n)%data => xn2m
!
      n = n+1 
      write(f_msisatm(n)%long_name,"('MSIS N4S')")
      f_msisatm(n)%short_name = "XN4SM"
      f_msisatm(n)%var_name = "XN4SM"
      f_msisatm(n)%units = "CM-3"
      f_msisatm(n)%data => xn4sm
!
      n = n+1 
      write(f_msisatm(n)%long_name,"('MSIS HE')")
      f_msisatm(n)%short_name = "XNHEM"
      f_msisatm(n)%var_name = "XNHEM"
      f_msisatm(n)%units = "CM-3"
      f_msisatm(n)%data => xnhem
!
      n = n+1 
      write(f_msisatm(n)%long_name,"('MSIS ARGON')")
      f_msisatm(n)%short_name = "XNARGM"
      f_msisatm(n)%var_name = "XNARGM"
      f_msisatm(n)%units = "CM-3"
      f_msisatm(n)%data => xnargm
!
      n = n+1 
      write(f_msisatm(n)%long_name,"('MSIS H')")
      f_msisatm(n)%short_name = "XNHM"
      f_msisatm(n)%var_name = "XNHM"
      f_msisatm(n)%units = "CM-3"
      f_msisatm(n)%data => xnhm
!
      n = n+1 
      write(f_msisatm(n)%long_name,"('MSIS NEUTRAL TEMPERATURE')")
      f_msisatm(n)%short_name = "TNMS"
      f_msisatm(n)%var_name = "TNMS"
      f_msisatm(n)%units = "DEG K"
      f_msisatm(n)%data => tnms
!
      n = n+1 
      write(f_msisatm(n)%long_name,"('MSIS LOG PRESSURE')")
      f_msisatm(n)%short_name = "ZPMS"
      f_msisatm(n)%var_name = "ZPMS"
      f_msisatm(n)%units = "LN(P0/P)"
      f_msisatm(n)%data => zpms
!
      n = n+1 
      write(f_msisatm(n)%long_name,"('MSIS HEIGHT')")
      f_msisatm(n)%short_name = "ZPMHT"
      f_msisatm(n)%var_name = "ZPMHT"
      f_msisatm(n)%units = "CM"
      f_msisatm(n)%data => zpmht
!
      n = n+1 
      write(f_msisatm(n)%long_name,"('MSIS SCALE HEIGHT')")
      f_msisatm(n)%short_name = "SHTMS"
      f_msisatm(n)%var_name = "SHTMS"
      f_msisatm(n)%units = "CM"
      f_msisatm(n)%data => shtms
!
      n = n+1 
      write(f_msisatm(n)%long_name,"('AMASS')")
      f_msisatm(n)%short_name = "AMASS"
      f_msisatm(n)%var_name = "AMASS"
      f_msisatm(n)%units = " "
      f_msisatm(n)%data => amass
!
      n = n+1 
      write(f_msisatm(n)%long_name,"('MSIS TOTAL DENSITY')")
      f_msisatm(n)%short_name = "RHOMS"
      f_msisatm(n)%var_name = "RHOMS"
      f_msisatm(n)%units = "CM-3"
      f_msisatm(n)%data => rhoms
!
! Initial value:
      do n=1,nf_msisatm
        f_msisatm(n)%data = 0.
        f_msisatm(n)%class = "msisatm"
        f_msisatm(n)%timedep = "time-independent"
        f_msisatm(n)%logplt = 1
        if (trim(f_msisatm(n)%short_name)=='TNMS' )f_msisatm(n)%logplt=0
        if (trim(f_msisatm(n)%short_name)=='ZPMS' )f_msisatm(n)%logplt=0
        if (trim(f_msisatm(n)%short_name)=='ZPMHT')f_msisatm(n)%logplt=0
        if (trim(f_msisatm(n)%short_name)=='SHTMS')f_msisatm(n)%logplt=0
      enddo
!     write(6,"(/,'Initialized ',i3,' msisatm fields:')") nf_msisatm
!     write(6,"(7a10)") (trim(f_msisatm(n)%short_name),n=1,nf_msisatm)
!     do n=1,nf_msisatm
!       write(6,"('  Field ',i3,': ',a)")
!    |    n,trim(f_msisatm(n)%short_name)
!     enddo
      end subroutine init_msisatm
      end module flds_msisatm
!-----------------------------------------------------------------------
      module flds_modelz
      use fields
      use params
      implicit none
!
      integer,parameter :: nf_modelz=4
      type (field) :: f_modelz(nf_modelz) 
      real,target,dimension(nlev) ::
     |  zp, zpht, zqht, gz
      contains
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      subroutine init_modelz
      integer :: n
      n = 0
!
      n = n+1 
      write(f_modelz(n)%long_name,"('LOG PRESSURE')")
      f_modelz(n)%short_name = "ZP"
      f_modelz(n)%var_name = "ZP"
      f_modelz(n)%units = "LN(P0/P)"
      f_modelz(n)%data => zp
!
      n = n+1 
      write(f_modelz(n)%long_name,"('HEIGHT')")
      f_modelz(n)%short_name = "ZPHT"
      f_modelz(n)%var_name = "ZPHT"
      f_modelz(n)%units = "CM"
      f_modelz(n)%data => zpht
!
      n = n+1 
      write(f_modelz(n)%long_name,"('ZQHT')")
      f_modelz(n)%short_name = "ZQHT"
      f_modelz(n)%var_name = "ZQHT"
      f_modelz(n)%units = " "
      f_modelz(n)%data => zqht
!
      n = n+1 
      write(f_modelz(n)%long_name,"('GZ')")
      f_modelz(n)%short_name = "GZ"
      f_modelz(n)%var_name = "GZ"
      f_modelz(n)%units = " "
      f_modelz(n)%data => gz
!
! Initial value:
      do n=1,nf_modelz
        f_modelz(n)%data = 0.
        f_modelz(n)%class = "modelz"
        f_modelz(n)%timedep = "time-dependent"
        if (trim(f_modelz(n)%short_name)=='ZP')
     |    f_modelz(n)%timedep = "time-independent"
        f_modelz(n)%logplt = 0
      enddo
!     write(6,"(/,'Initialized ',i3,' modelz fields:')") nf_modelz
!     write(6,"(7a10)") (trim(f_modelz(n)%short_name),n=1,nf_modelz)
!     do n=1,nf_modelz
!       write(6,"('  Field ',i3,': ',a)")
!    |    n,trim(f_modelz(n)%short_name)
!     enddo
      end subroutine init_modelz
      end module flds_modelz
!-----------------------------------------------------------------------
