PartMC 2.1.3
|
00001 ! Copyright (C) 2005-2010 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_run_exact module. 00007 00008 !> Exact solution simulation. 00009 module pmc_run_exact 00010 00011 use pmc_aero_dist 00012 use pmc_bin_grid 00013 use pmc_aero_state 00014 use pmc_env_data 00015 use pmc_env_state 00016 use pmc_aero_data 00017 use pmc_output 00018 use pmc_aero_binned 00019 use pmc_gas_data 00020 use pmc_gas_state 00021 use pmc_exact_soln 00022 00023 !> Options controlling the execution of run_exact(). 00024 type run_exact_opt_t 00025 !> Total simulation time. 00026 real(kind=dp) :: t_max 00027 !> Interval to output info (s). 00028 real(kind=dp) :: t_output 00029 !> Output prefix. 00030 character(len=300) :: prefix 00031 !> Whether to do coagulation. 00032 logical :: do_coagulation 00033 !> Type of coagulation kernel. 00034 integer :: coag_kernel_type 00035 !> UUID of the simulation. 00036 character(len=PMC_UUID_LEN) :: uuid 00037 end type run_exact_opt_t 00038 00039 contains 00040 00041 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 00042 00043 !> Run an exact simulation. 00044 subroutine run_exact(bin_grid, env_data, env_state, aero_data, & 00045 aero_dist_init, run_exact_opt) 00046 00047 !> Bin grid. 00048 type(bin_grid_t), intent(in) :: bin_grid 00049 !> Environment data. 00050 type(env_data_t), intent(in) :: env_data 00051 !> Environment state. 00052 type(env_state_t), intent(inout) :: env_state 00053 !> Aerosol data. 00054 type(aero_data_t), intent(in) :: aero_data 00055 !> Initial aerosol distribution. 00056 type(aero_dist_t), intent(in) :: aero_dist_init 00057 !> Options. 00058 type(run_exact_opt_t), intent(in) :: run_exact_opt 00059 00060 integer :: i_time, n_time, ncid 00061 type(aero_binned_t) :: aero_binned 00062 real(kind=dp) :: time 00063 type(gas_data_t) :: gas_data 00064 type(gas_state_t) :: gas_state 00065 00066 call aero_binned_allocate_size(aero_binned, bin_grid%n_bin, & 00067 aero_data%n_spec) 00068 call gas_data_allocate(gas_data) 00069 call gas_state_allocate(gas_state) 00070 00071 n_time = nint(run_exact_opt%t_max / run_exact_opt%t_output) 00072 do i_time = 0,n_time 00073 time = real(i_time, kind=dp) / real(n_time, kind=dp) 00074 * run_exact_opt%t_max 00075 call env_data_update_state(env_data, env_state, time, & 00076 update_rel_humid = .true.) 00077 call exact_soln(bin_grid, aero_data, run_exact_opt%do_coagulation, & 00078 run_exact_opt%coag_kernel_type, aero_dist_init, env_data, & 00079 env_state, time, aero_binned) 00080 call output_sectional(run_exact_opt%prefix, bin_grid, aero_data, & 00081 aero_binned, gas_data, gas_state, env_state, i_time + 1, & 00082 time, run_exact_opt%t_output, run_exact_opt%uuid) 00083 end do 00084 00085 call gas_data_deallocate(gas_data) 00086 call gas_state_deallocate(gas_state) 00087 call aero_binned_deallocate(aero_binned) 00088 00089 end subroutine run_exact 00090 00091 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 00092 00093 end module pmc_run_exact