C     Last change:  LKS  21 Jan 2008    1:58 pm
      subroutine acdom(z,wavenm, abscdom)
c
c     EXAMPLE user routine on file acdom.f
c
c     called by abcase2 and sources
c
c     This user-supplied subroutine returns the absorption by CDOM for
c     the current geometric depth z and wavelength wavenm, for use
c     in computing the CDOM fluorescence in subroutine shatcdom.
c
c     This version of acdom parameterizes the wavelength dependence
c     of CDOM absorption by the simple model of Eq. (3.25), i.e.
c     acdom(wave) is specified via the value of acdom(440).
c     (For a more sophisticated model of acdom, see Carder, et al., 
c     1989, Limnol & Oceanogr 34(1), pp 68-81)
c
      real cdomexp, waveold, z, wavenm, abscdom

      data kall/0/, waveold/0.0/
c
      save
c
      if(kall.eq.0) then
c
c     set parameter values
c
      acdom0 = 0.1
      wave0 = 440.0
      gamma = 0.014
      write(10,100) acdom0,wave0,gamma
      kall = 1
      endif
c
      if(wavenm.ne.waveold) then
c
      cdomexp = exp(-gamma*(wavenm - wave0))
      waveold = wavenm
      endif
c
      abscdom = acdom0*cdomz(z)*cdomexp
c
      return
c
  100 format(//5x,'CDOM absorption is modeled as an exponential in',
     1' wavelength:  ',/
     110x,'aCDOM(lambda) = aCDOM(lambda0)*exp[-gamma*(lambda/lambda0)]' 
     1/5x,'where'/
     210x,'aCDOM(lambda0) =',f6.3,' 1/m'/
     310x,'lambda0        =',f6.1,' nm'/
     410x,'gamma          =',f6.3,' 1/nm')
      end
c---------------------------------------------------------------------
      function cdomz(z)
c
c     This function returns the absorption by CDOM at geometric depth z
c     relative to the value at z = 0.0.  (set cdomz = 1.0 for
c     depth-independent CDOM absorption)
c
      data kall/0/
      save kall
c
      If(kall.eq.0) write(10,100)
	kall = 1

      cdomz = exp(-z/10.0)

c
  100 format(/5x,'CDOM absorption is modeled as an exponential in ',
     1'depth:'/10x,'saCDOM(z) = aCDOM(z=0) * exp(-z/10)'/)
      return
      end

