!#################################################################
!
! Purpose:
! --------
!
! This module  contains all subroutines needed for dry deposition calculations.
! The mean purpose is to perform on a high resolution of  1x1 degree:
!  
! 0. allocate the vd on the model resolution
!
! 1. read fields needed for further calculations in subroutines:
!    
! 2. calculate the tracer independent friction velocity, aerodynamic 
!    and sub-laminar resistance 
!
! 3. calculate fields needed for resistance calculations 
!
! 4. the tracer dependent vd
!
! 5. coarsen the vd
!
! 6. apply the coarsened deposition velocities to concentration field rm
!
! 7. deallocate vd
!
! Reference:
! ---------
! general documentationon ECMWF fields can be found on:
! http://www.ecmwf.int/research/ifsdocs/PHYSICS/
! ---------
! Authors:
! -------
! original code by Laurens Ganzeveld and Ad Jeuken (1997)
! revised and adapted for use in TM5 and use of ECMWF data 
! by F. Dentener and M. Krol (2003)
! 
!   24 Jan 2012 - P. Le Sager - modified for mpi lat-lon domain decomposition
!
!### macro's #####################################################
!
#define TRACEBACK write (gol,'("in ",a," (",a,", line",i5,")")') rname, __FILE__, __LINE__; call goErr
#define IF_NOTOK_RETURN(action) if (status/=0) then; TRACEBACK; action; return; end if
#define IF_ERROR_RETURN(action) if (status> 0) then; TRACEBACK; action; return; end if
!
#include "tm5.inc"
!
!#################################################################

module dry_deposition

  use GO          , only : gol, goPr, goErr

  implicit none


  ! --- in/out ----------------------

  private

  public :: Dry_Deposition_Init, Dry_Deposition_Done
  public :: dd_surface_fields

  ! --- const -----------------------
  
  character(len=*), parameter  ::  mname = 'dry_deposition'

contains 

  subroutine Dry_Deposition_Init( status )

    ! --- in/out ------------------------------------
    
    integer, intent(out)    ::  status
    
    ! --- const -------------------------------------
    
    character(len=*), parameter  ::  rname = mname//'/Dry_Deposition_Init'
    
    ! --- local -------------------------------------

    ! ok
    status = 0

  end subroutine Dry_Deposition_Init
  
  subroutine Dry_Deposition_Done( status )

    ! --- in/out ------------------------------------
    
    integer, intent(out)    ::  status
    
    ! --- const -------------------------------------
    
    character(len=*), parameter  ::  rname = mname//'/Dry_Deposition_Done'
    
    ! ok
    status = 0

  end subroutine Dry_Deposition_Done

  subroutine dd_surface_fields( status )
    ! --- in/out -----------------------------
    
    integer, intent(out)    ::  status

    ! --- const -------------------------------
    
    character(len=*), parameter  ::  rname = 'dd_surface_fields'

    ! --- local ------------------------------

    ! ok
    status = 0

  end subroutine dd_surface_fields
   
end module dry_deposition
