PartMC  2.2.0
exact_soln.F90
Go to the documentation of this file.
00001 ! Copyright (C) 2005-2011 Nicole Riemer and 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_exact_soln module.
00007 
00008 !> Exact solutions for various simulations.
00009 module pmc_exact_soln
00010 
00011   use pmc_bin_grid
00012   use pmc_util
00013   use pmc_constants
00014   use pmc_aero_data
00015   use pmc_aero_dist
00016   use pmc_coag_kernel
00017   use pmc_coag_kernel_zero
00018   use pmc_coag_kernel_additive
00019   use pmc_coag_kernel_constant
00020   use pmc_env_state
00021   use pmc_env_data
00022   use pmc_aero_binned
00023 
00024 contains
00025 
00026 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00027   
00028   subroutine exact_soln(bin_grid, aero_data, do_coagulation, &
00029        coag_kernel_type, aero_dist_init, env_data, env_state, time, &
00030        aero_binned)
00031 
00032     !> Bin grid.
00033     type(bin_grid_t), intent(in) :: bin_grid
00034     !> Aerosol data.
00035     type(aero_data_t), intent(in) :: aero_data
00036     !> Whether to do coagulation.
00037     logical, intent(in) :: do_coagulation
00038     !> Coagulation kernel type.
00039     integer, intent(in) :: coag_kernel_type
00040     !> Initial distribution.
00041     type(aero_dist_t), intent(in) :: aero_dist_init
00042     !> Environment data.
00043     type(env_data_t), intent(in) :: env_data
00044     !> Environment state.
00045     type(env_state_t), intent(in) :: env_state
00046     !> Current time (s).
00047     real(kind=dp), intent(in) :: time
00048     !> Output state.
00049     type(aero_binned_t), intent(inout) :: aero_binned
00050 
00051     if (.not. do_coagulation) then
00052        call die_msg(287486666, 'Exact solutions require coagulation ' &
00053             // '(can set coag_kernel to "zero").')
00054     end if
00055 
00056     if (coag_kernel_type == COAG_KERNEL_TYPE_ADDITIVE) then
00057        ! FIXME: check env_data has no emissions or dilution
00058        if (aero_dist_init%n_mode /= 1) then
00059           call die_msg(285407619, "Exact solution with additive kernel " &
00060                // "requires exactly 1 initial distribution mode, not: " &
00061                // trim(integer_to_string(aero_dist_init%n_mode)))
00062        end if
00063        if (aero_dist_init%mode(1)%type /= AERO_MODE_TYPE_EXP) then
00064           call die_msg(373749499, "Exact solution with additive kernel " &
00065                // "requires exactly 1 initial distribution mode of " &
00066                // "exponential type, not: " &
00067                // aero_mode_type_to_string(aero_dist_init%mode(1)%type))
00068        end if
00069        call soln_additive_exp(bin_grid, aero_data, time, &
00070             aero_dist_init%mode(1)%num_conc, &
00071             aero_dist_init%mode(1)%char_radius, env_state, aero_binned)
00072     elseif (coag_kernel_type == COAG_KERNEL_TYPE_CONSTANT) then
00073        ! FIXME: check env_data has no emissions or dilution
00074        if (aero_dist_init%n_mode /= 1) then
00075           call die_msg(827813758, "Exact solution with constant kernel " &
00076                // "requires exactly 1 initial distribution mode, not: " &
00077                // trim(integer_to_string(aero_dist_init%n_mode)))
00078        end if
00079        if (aero_dist_init%mode(1)%type /= AERO_MODE_TYPE_EXP) then
00080           call die_msg(574495367, "Exact solution with constant kernel " &
00081                // "requires exactly 1 initial distribution mode of " &
00082                // "exponential type, not: " &
00083                // aero_mode_type_to_string(aero_dist_init%mode(1)%type))
00084        end if
00085        call soln_constant_exp(bin_grid, aero_data, time, &
00086             aero_dist_init%mode(1)%num_conc, &
00087             aero_dist_init%mode(1)%char_radius, env_state, aero_binned)
00088     elseif (coag_kernel_type == COAG_KERNEL_TYPE_ZERO) then
00089        ! FIXME: check env_data has constant emissions and constant dilution
00090        call soln_zero(bin_grid, aero_data, time, aero_dist_init, &
00091             env_state, aero_binned)
00092     else
00093        call die_msg(932981721, "No exact solutions with " &
00094             // "coagulation kernel type " &
00095             // trim(integer_to_string(coag_kernel_type)) &
00096             // " (" // coag_kernel_type_to_string(coag_kernel_type) // ")")
00097     end if
00098 
00099   end subroutine exact_soln
00100 
00101 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00102 
00103 end module pmc_exact_soln