PartMC  2.6.1
exact_soln.F90
Go to the documentation of this file.
1 ! Copyright (C) 2005-2016 Nicole Riemer and Matthew West
2 ! Licensed under the GNU General Public License version 2 or (at your
3 ! option) any later version. See the file COPYING for details.
4 
5 !> \file
6 !> The pmc_exact_soln module.
7 
8 !> Exact solutions for various simulations.
10 
11  use pmc_bin_grid
12  use pmc_util
13  use pmc_constants
14  use pmc_aero_data
15  use pmc_aero_dist
16  use pmc_coag_kernel
20  use pmc_env_state
21  use pmc_scenario
22  use pmc_aero_binned
23 
24 contains
25 
26 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
27 
28  subroutine exact_soln(bin_grid, aero_data, do_coagulation, &
29  coag_kernel_type, aero_dist_init, scenario, env_state, time, &
30  aero_binned)
31 
32  !> Bin grid.
33  type(bin_grid_t), intent(in) :: bin_grid
34  !> Aerosol data.
35  type(aero_data_t), intent(in) :: aero_data
36  !> Whether to do coagulation.
37  logical, intent(in) :: do_coagulation
38  !> Coagulation kernel type.
39  integer, intent(in) :: coag_kernel_type
40  !> Initial distribution.
41  type(aero_dist_t), intent(in) :: aero_dist_init
42  !> Environment data.
43  type(scenario_t), intent(in) :: scenario
44  !> Environment state.
45  type(env_state_t), intent(in) :: env_state
46  !> Current time (s).
47  real(kind=dp), intent(in) :: time
48  !> Output state.
49  type(aero_binned_t), intent(inout) :: aero_binned
50 
51  if (.not. do_coagulation) then
52  call die_msg(287486666, 'Exact solutions require coagulation ' &
53  // '(can set coag_kernel to "zero").')
54  end if
55 
56  if (coag_kernel_type /= coag_kernel_type_zero &
57  .and. scenario%loss_function_type /= scenario_loss_function_none) then
58  call die_msg(189372109, 'Exact solution with particle loss ' &
59  // 'requires using the "none" coag_kernel.')
60  end if
61 
62  if (coag_kernel_type == coag_kernel_type_additive) then
63  ! FIXME: check scenario has no emissions or dilution
64  if (aero_dist_n_mode(aero_dist_init) /= 1) then
65  call die_msg(285407619, "Exact solution with additive kernel " &
66  // "requires exactly 1 initial distribution mode, not: " &
67  // trim(integer_to_string(aero_dist_n_mode(aero_dist_init))))
68  end if
69  if (aero_dist_init%mode(1)%type /= aero_mode_type_exp) then
70  call die_msg(373749499, "Exact solution with additive kernel " &
71  // "requires exactly 1 initial distribution mode of " &
72  // "exponential type, not: " &
73  // aero_mode_type_to_string(aero_dist_init%mode(1)%type))
74  end if
75  call soln_additive_exp(bin_grid, aero_data, time, &
76  aero_dist_init%mode(1)%num_conc, &
77  aero_dist_init%mode(1)%char_radius, env_state, aero_binned)
78  elseif (coag_kernel_type == coag_kernel_type_constant) then
79  ! FIXME: check scenario has no emissions or dilution
80  if (aero_dist_n_mode(aero_dist_init) /= 1) then
81  call die_msg(827813758, "Exact solution with constant kernel " &
82  // "requires exactly 1 initial distribution mode, not: " &
83  // trim(integer_to_string(aero_dist_n_mode(aero_dist_init))))
84  end if
85  if (aero_dist_init%mode(1)%type /= aero_mode_type_exp) then
86  call die_msg(574495367, "Exact solution with constant kernel " &
87  // "requires exactly 1 initial distribution mode of " &
88  // "exponential type, not: " &
89  // aero_mode_type_to_string(aero_dist_init%mode(1)%type))
90  end if
91  call soln_constant_exp(bin_grid, aero_data, time, &
92  aero_dist_init%mode(1)%num_conc, &
93  aero_dist_init%mode(1)%char_radius, env_state, aero_binned)
94  elseif (coag_kernel_type == coag_kernel_type_zero) then
95  ! FIXME: check scenario has constant emissions and constant dilution
96  call soln_zero(bin_grid, aero_data, time, aero_dist_init, &
97  scenario, env_state, aero_binned)
98  else
99  call die_msg(932981721, "No exact solutions with " &
100  // "coagulation kernel type " &
101  // trim(integer_to_string(coag_kernel_type)) &
102  // " (" // coag_kernel_type_to_string(coag_kernel_type) // ")")
103  end if
104 
105  end subroutine exact_soln
106 
107 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
108 
109 end module pmc_exact_soln
pmc_exact_soln::exact_soln
subroutine exact_soln(bin_grid, aero_data, do_coagulation, coag_kernel_type, aero_dist_init, scenario, env_state, time, aero_binned)
Definition: exact_soln.F90:31
pmc_aero_dist::aero_dist_n_mode
elemental integer function aero_dist_n_mode(aero_dist)
Return the number of modes.
Definition: aero_dist.F90:44
pmc_exact_soln
Exact solutions for various simulations.
Definition: exact_soln.F90:9
pmc_coag_kernel_additive
Additive coagulation kernel.
Definition: coag_kernel_additive.F90:9
pmc_scenario
The scenario_t structure and associated subroutines.
Definition: scenario.F90:9
pmc_scenario::scenario_t
Scenario data.
Definition: scenario.F90:54
pmc_coag_kernel_additive::soln_additive_exp
subroutine soln_additive_exp(bin_grid, aero_data, time, num_conc, radius_at_mean_vol, env_state, aero_binned)
Exact solution with the additive coagulation kernel and exponential initial condition.
Definition: coag_kernel_additive.F90:103
pmc_coag_kernel_constant
Constant coagulation kernel.
Definition: coag_kernel_constant.F90:9
pmc_util::die_msg
subroutine die_msg(code, error_msg)
Error immediately.
Definition: util.F90:134
pmc_scenario::scenario_loss_function_none
integer, parameter scenario_loss_function_none
Type code for a zero loss function.
Definition: scenario.F90:28
pmc_constants::dp
integer, parameter dp
Kind of a double precision real number.
Definition: constants.F90:12
pmc_coag_kernel
Generic coagulation kernel.
Definition: coag_kernel.F90:9
pmc_coag_kernel_zero::soln_zero
subroutine soln_zero(bin_grid, aero_data, time, aero_dist_init, scenario, env_state, aero_binned)
Exact solution with the zero coagulation kernel. Only useful for testing emissions,...
Definition: coag_kernel_zero.F90:107
pmc_env_state::env_state_t
Current environment state.
Definition: env_state.F90:29
pmc_coag_kernel::coag_kernel_type_additive
integer, parameter coag_kernel_type_additive
Type code for an additive kernel.
Definition: coag_kernel.F90:33
pmc_util::integer_to_string
character(len=pmc_util_convert_string_len) function integer_to_string(val)
Convert an integer to a string format.
Definition: util.F90:766
pmc_aero_dist
The aero_dist_t structure and associated subroutines.
Definition: aero_dist.F90:18
pmc_coag_kernel::coag_kernel_type_constant
integer, parameter coag_kernel_type_constant
Type code for a constant kernel.
Definition: coag_kernel.F90:35
pmc_coag_kernel_zero
Constant kernel equal to zero.
Definition: coag_kernel_zero.F90:13
pmc_env_state
The env_state_t structure and associated subroutines.
Definition: env_state.F90:9
pmc_aero_data::aero_data_t
Aerosol material properties and associated data.
Definition: aero_data.F90:49
pmc_constants
Physical constants.
Definition: constants.F90:9
pmc_aero_dist::aero_dist_t
A complete aerosol distribution, consisting of several modes.
Definition: aero_dist.F90:33
pmc_util
Common utility subroutines.
Definition: util.F90:9
pmc_aero_binned
The aero_binned_t structure and associated subroutines.
Definition: aero_binned.F90:9
pmc_coag_kernel::coag_kernel_type_to_string
character(len=coag_kernel_type_len) function coag_kernel_type_to_string(coag_kernel_type)
Return a string representation of a kernel type.
Definition: coag_kernel.F90:54
pmc_aero_binned::aero_binned_t
Aerosol number and volume distributions stored per bin.
Definition: aero_binned.F90:37
pmc_bin_grid
The bin_grid_t structure and associated subroutines.
Definition: bin_grid.F90:9
pmc_aero_data
The aero_data_t structure and associated subroutines.
Definition: aero_data.F90:9
pmc_coag_kernel::coag_kernel_type_zero
integer, parameter coag_kernel_type_zero
Type code for a zero kernel.
Definition: coag_kernel.F90:39
pmc_bin_grid::bin_grid_t
1D grid, either logarithmic or linear.
Definition: bin_grid.F90:33
pmc_coag_kernel_constant::soln_constant_exp
subroutine soln_constant_exp(bin_grid, aero_data, time, num_conc, radius_at_mean_vol, env_state, aero_binned)
Exact solution with a constant coagulation kernel and an exponential initial condition.
Definition: coag_kernel_constant.F90:94