PartMC  2.3.0
exact_soln.F90
Go to the documentation of this file.
1 ! Copyright (C) 2005-2012 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, do_loss, loss_function_type, aero_dist_init, &
30  scenario, env_state, time, 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  !> Whether to do particle loss.
41  logical, intent(in) :: do_loss
42  !> Particle loss function type.
43  integer, intent(in) :: loss_function_type
44  !> Initial distribution.
45  type(aero_dist_t), intent(in) :: aero_dist_init
46  !> Environment data.
47  type(scenario_t), intent(in) :: scenario
48  !> Environment state.
49  type(env_state_t), intent(in) :: env_state
50  !> Current time (s).
51  real(kind=dp), intent(in) :: time
52  !> Output state.
53  type(aero_binned_t), intent(inout) :: aero_binned
54 
55  if (.not. do_coagulation) then
56  call die_msg(287486666, 'Exact solutions require coagulation ' &
57  // '(can set coag_kernel to "zero").')
58  end if
59 
60  if (coag_kernel_type /= coag_kernel_type_zero .and. do_loss) then
61  call die_msg(189372109, 'Exact solution with particle loss ' &
62  // 'requires using the "zero" coag_kernel.')
63  end if
64 
65  if (coag_kernel_type == coag_kernel_type_additive) then
66  ! FIXME: check scenario has no emissions or dilution
67  if (aero_dist_init%n_mode /= 1) then
68  call die_msg(285407619, "Exact solution with additive kernel " &
69  // "requires exactly 1 initial distribution mode, not: " &
70  // trim(integer_to_string(aero_dist_init%n_mode)))
71  end if
72  if (aero_dist_init%mode(1)%type /= aero_mode_type_exp) then
73  call die_msg(373749499, "Exact solution with additive kernel " &
74  // "requires exactly 1 initial distribution mode of " &
75  // "exponential type, not: " &
76  // aero_mode_type_to_string(aero_dist_init%mode(1)%type))
77  end if
78  call soln_additive_exp(bin_grid, aero_data, time, &
79  aero_dist_init%mode(1)%num_conc, &
80  aero_dist_init%mode(1)%char_radius, env_state, aero_binned)
81  elseif (coag_kernel_type == coag_kernel_type_constant) then
82  ! FIXME: check scenario has no emissions or dilution
83  if (aero_dist_init%n_mode /= 1) then
84  call die_msg(827813758, "Exact solution with constant kernel " &
85  // "requires exactly 1 initial distribution mode, not: " &
86  // trim(integer_to_string(aero_dist_init%n_mode)))
87  end if
88  if (aero_dist_init%mode(1)%type /= aero_mode_type_exp) then
89  call die_msg(574495367, "Exact solution with constant kernel " &
90  // "requires exactly 1 initial distribution mode of " &
91  // "exponential type, not: " &
92  // aero_mode_type_to_string(aero_dist_init%mode(1)%type))
93  end if
94  call soln_constant_exp(bin_grid, aero_data, time, &
95  aero_dist_init%mode(1)%num_conc, &
96  aero_dist_init%mode(1)%char_radius, env_state, aero_binned)
97  elseif (coag_kernel_type == coag_kernel_type_zero) then
98  ! FIXME: check scenario has constant emissions and constant dilution
99  if (do_loss) then
100  call soln_zero(bin_grid, aero_data, time, aero_dist_init, &
101  scenario, env_state, loss_function_type, aero_binned)
102  else
103  call soln_zero(bin_grid, aero_data, time, aero_dist_init, &
104  scenario, env_state, scenario_loss_function_invalid, aero_binned)
105  end if
106  else
107  call die_msg(932981721, "No exact solutions with " &
108  // "coagulation kernel type " &
109  // trim(integer_to_string(coag_kernel_type)) &
110  // " (" // coag_kernel_type_to_string(coag_kernel_type) // ")")
111  end if
112 
113  end subroutine exact_soln
114 
115 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
116 
117 end module pmc_exact_soln
The scenario_t structure and associated subroutines.
Definition: scenario.F90:9
The aero_data_t structure and associated subroutines.
Definition: aero_data.F90:9
subroutine die_msg(code, error_msg)
Error immediately.
Definition: util.F90:133
Additive coagulation kernel.
Exact solutions for various simulations.
Definition: exact_soln.F90:9
The aero_dist_t structure and associated subroutines.
Definition: aero_dist.F90:18
Physical constants.
Definition: constants.F90:9
The env_state_t structure and associated subroutines.
Definition: env_state.F90:9
subroutine soln_zero(bin_grid, aero_data, time, aero_dist_init, scenario, env_state, loss_function_type, aero_binned)
Exact solution with the zero coagulation kernel. Only useful for testing emissions and background dil...
subroutine exact_soln(bin_grid, aero_data, do_coagulation, coag_kernel_type, do_loss, loss_function_type, aero_dist_init, scenario, env_state, time, aero_binned)
Definition: exact_soln.F90:28
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.
A complete aerosol distribution, consisting of several modes.
Definition: aero_dist.F90:33
Common utility subroutines.
Definition: util.F90:9
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:44
character(len=aero_mode_type_len) function aero_mode_type_to_string(type)
Return a string representation of a kernel type.
Definition: aero_mode.F90:75
Current environment state.
Definition: env_state.F90:26
Constant coagulation kernel.
character(len=pmc_util_convert_string_len) function integer_to_string(val)
Convert an integer to a string format.
Definition: util.F90:743
Scenario data.
Definition: scenario.F90:51
1D grid, either logarithmic or linear.
Definition: bin_grid.F90:33
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.
The bin_grid_t structure and associated subroutines.
Definition: bin_grid.F90:9
The aero_binned_t structure and associated subroutines.
Definition: aero_binned.F90:9
Constant kernel equal to zero.
Aerosol material properties and associated data.
Definition: aero_data.F90:40
Generic coagulation kernel.
Definition: coag_kernel.F90:9
Aerosol number and volume distributions stored per bin.
Definition: aero_binned.F90:33