PartMC 2.1.4
coag_kernel_zero.F90
Go to the documentation of this file.
00001 ! Copyright (C) 2007-2010 Matthew West
00002 ! Licensed under the GNU General Public License version 2 or (at your
00003 ! option) any later version. See the file COPYING for details.
00004 
00005 !> \file
00006 !> The pmc_coag_kernel_zero module.
00007 
00008 !> Constant kernel equal to zero.
00009 !!
00010 !! This is only of interest for the exact solution to the
00011 !! no-coagulation, no-condensation case that can be used to test
00012 !! emissions and background dilution.
00013 module pmc_coag_kernel_zero
00014 
00015   use pmc_bin_grid
00016   use pmc_env_state
00017   use pmc_util
00018   use pmc_aero_binned
00019   use pmc_aero_dist
00020   use pmc_aero_data
00021   use pmc_aero_data
00022   use pmc_aero_particle
00023   
00024 contains
00025   
00026 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00027 
00028   !> Zero coagulation kernel.
00029   subroutine kernel_zero(aero_particle_1, aero_particle_2, &
00030        aero_data, env_state, k)
00031 
00032     !> First particle.
00033     type(aero_particle_t), intent(in) :: aero_particle_1
00034     !> Second particle.
00035     type(aero_particle_t), intent(in) :: aero_particle_2
00036     !> Aerosol data.
00037     type(aero_data_t), intent(in) :: aero_data
00038     !> Environment state.
00039     type(env_state_t), intent(in) :: env_state
00040     !> Coagulation kernel.
00041     real(kind=dp), intent(out) :: k
00042     
00043     k = 0d0
00044     
00045   end subroutine kernel_zero
00046   
00047 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00048 
00049   !> Zero coagulation kernel.
00050   subroutine kernel_zero_max(v1, v2, aero_data, env_state, k_max)
00051 
00052     !> Volume of first particle.
00053     real(kind=dp), intent(in) :: v1
00054     !> Volume of second particle.
00055     real(kind=dp), intent(in) :: v2
00056     !> Aerosol data.
00057     type(aero_data_t), intent(in) :: aero_data
00058     !> Environment state.
00059     type(env_state_t), intent(in) :: env_state
00060     !> Coagulation kernel maximum value.
00061     real(kind=dp), intent(out) :: k_max
00062     
00063     k_max = 0d0
00064     
00065   end subroutine kernel_zero_max
00066   
00067 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00068 
00069   !> Exact solution with the zero coagulation kernel. Only useful for
00070   !> testing emissions and background dilution.
00071   !!
00072   !! With only constant-rate emissions and dilution the number
00073   !! distribution \f$n(D,t)\f$ at diameter \f$D\f$ and time \f$t\f$
00074   !! satisfies:
00075   !! \f[
00076   !!     \frac{d n(D,t)}{dt} = k_{\rm emit} n_{\rm emit}(D)
00077   !!                           + k_{\rm dilute} (n_{\rm back}(D) - n(D,t))
00078   !! \f]
00079   !! together with the initial condition \f$ n(D,0) = n_0(D) \f$. Here
00080   !! \f$n_{\rm emit}(D)\f$ and \f$n_{\rm back}(D)\f$ are emission and
00081   !! background size distributions, with corresponding rates \f$k_{\rm
00082   !! emit}\f$ and \f$k_{\rm dilute}\f$. All values are taken at time
00083   !! \f$t = 0\f$ and held constant, so there is no support for
00084   !! time-varying emissions or background dilution.
00085   !!
00086   !! This is a family of ODEs parameterized by \f$D\f$ with
00087   !! solution:
00088   !! \f[
00089   !!     n(D,t) = n_{\infty}(D)
00090   !!              + (n_0(D) - n_{\infty}(D)) \exp(-k_{\rm dilute} t)
00091   !! \f]
00092   !! where the steady state limit is:
00093   !! \f[
00094   !!     n_{\infty}(D) = n(D,\infty)
00095   !!                   = n_{\rm back}(D)
00096   !!                     + \frac{k_{\rm emit}}{k_{\rm dilute}} n_{\rm emit}(D)
00097   !! \f]
00098   subroutine soln_zero(bin_grid, aero_data, time, aero_dist_init, &
00099        env_state, aero_binned)
00100 
00101     !> Bin grid.
00102     type(bin_grid_t), intent(in) :: bin_grid
00103     !> Aerosol data.
00104     type(aero_data_t), intent(in) :: aero_data
00105     !> Current time (s).
00106     real(kind=dp), intent(in) :: time
00107     !> Initial distribution.
00108     type(aero_dist_t), intent(in) :: aero_dist_init
00109     !> Environment state.
00110     type(env_state_t), intent(in) :: env_state
00111     !> Output state.
00112     type(aero_binned_t), intent(inout) :: aero_binned
00113 
00114     type(aero_binned_t) :: aero_binned_limit
00115 
00116     if (env_state%aero_dilution_rate == 0d0) then
00117        call aero_binned_zero(aero_binned)
00118        call aero_binned_add_aero_dist(aero_binned, bin_grid, aero_data, &
00119             env_state%aero_emissions)
00120        call aero_binned_scale(aero_binned, &
00121             env_state%aero_emission_rate * time / env_state%height)
00122     else
00123        ! calculate the limit steady state distribution
00124        call aero_binned_allocate_size(aero_binned_limit, bin_grid%n_bin, &
00125             aero_data%n_spec)
00126        call aero_binned_add_aero_dist(aero_binned_limit, bin_grid, &
00127             aero_data, env_state%aero_emissions)
00128        call aero_binned_scale(aero_binned_limit, &
00129             env_state%aero_emission_rate / env_state%height &
00130             / env_state%aero_dilution_rate)
00131        call aero_binned_add_aero_dist(aero_binned_limit, bin_grid, &
00132             aero_data, env_state%aero_background)
00133 
00134        ! calculate the current state
00135        call aero_binned_zero(aero_binned)
00136        call aero_binned_add_aero_dist(aero_binned, bin_grid, aero_data, &
00137             aero_dist_init)
00138        call aero_binned_sub(aero_binned, aero_binned_limit)
00139        call aero_binned_scale(aero_binned, &
00140             exp(-env_state%aero_dilution_rate * time))
00141        call aero_binned_add(aero_binned, aero_binned_limit)
00142 
00143        call aero_binned_deallocate(aero_binned_limit)
00144     end if
00145 
00146   end subroutine soln_zero
00147 
00148 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00149   
00150 end module pmc_coag_kernel_zero