PartMC  2.6.1
run_exact.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_run_exact module.
7 
8 !> Exact solution simulation.
10 
11  use pmc_aero_dist
12  use pmc_bin_grid
13  use pmc_aero_state
14  use pmc_scenario
15  use pmc_env_state
16  use pmc_aero_data
17  use pmc_output
18  use pmc_aero_binned
19  use pmc_gas_data
20  use pmc_gas_state
21  use pmc_exact_soln
22 
23  !> Options controlling the execution of run_exact().
25  !> Total simulation time.
26  real(kind=dp) :: t_max
27  !> Interval to output info (s).
28  real(kind=dp) :: t_output
29  !> Output prefix.
30  character(len=300) :: prefix
31  !> Whether to do coagulation.
32  logical :: do_coagulation
33  !> Type of coagulation kernel.
34  integer :: coag_kernel_type
35  !> UUID of the simulation.
36  character(len=PMC_UUID_LEN) :: uuid
37  end type run_exact_opt_t
38 
39 contains
40 
41 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
42 
43  !> Run an exact simulation.
44  subroutine run_exact(bin_grid, scenario, env_state, aero_data, &
45  aero_dist_init, gas_data, run_exact_opt)
46 
47  !> Bin grid.
48  type(bin_grid_t), intent(in) :: bin_grid
49  !> Environment data.
50  type(scenario_t), intent(in) :: scenario
51  !> Environment state.
52  type(env_state_t), intent(inout) :: env_state
53  !> Aerosol data.
54  type(aero_data_t), intent(in) :: aero_data
55  !> Initial aerosol distribution.
56  type(aero_dist_t), intent(in) :: aero_dist_init
57  !> Gas data.
58  type(gas_data_t), intent(in) :: gas_data
59  !> Options.
60  type(run_exact_opt_t), intent(in) :: run_exact_opt
61 
62  integer :: i_time, n_time, ncid
63  type(aero_binned_t) :: aero_binned
64  real(kind=dp) :: time
65  type(gas_state_t) :: gas_state
66 
67  call check_time_multiple("t_max", run_exact_opt%t_max, &
68  "t_output", run_exact_opt%t_output)
69 
70  call gas_state_set_size(gas_state, gas_data_n_spec(gas_data))
71 
72  n_time = nint(run_exact_opt%t_max / run_exact_opt%t_output)
73  do i_time = 0,n_time
74  time = real(i_time, kind=dp) / real(n_time, kind=dp) &
75  * run_exact_opt%t_max
76  call scenario_update_env_state(scenario, env_state, time)
77  call exact_soln(bin_grid, aero_data, run_exact_opt%do_coagulation, &
78  run_exact_opt%coag_kernel_type, aero_dist_init, scenario, &
79  env_state, time, aero_binned)
80  call output_sectional(run_exact_opt%prefix, bin_grid, aero_data, &
81  aero_binned, gas_data, gas_state, env_state, i_time + 1, &
82  time, run_exact_opt%t_output, run_exact_opt%uuid)
83  end do
84 
85  end subroutine run_exact
86 
87 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
88 
89 end module pmc_run_exact
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_gas_data::gas_data_t
Constant gas data.
Definition: gas_data.F90:35
pmc_exact_soln
Exact solutions for various simulations.
Definition: exact_soln.F90:9
pmc_gas_state::gas_state_set_size
subroutine gas_state_set_size(gas_state, n_spec)
Sets the sizes of the gas state.
Definition: gas_state.F90:56
pmc_scenario
The scenario_t structure and associated subroutines.
Definition: scenario.F90:9
pmc_scenario::scenario_t
Scenario data.
Definition: scenario.F90:54
pmc_gas_data
The gas_data_t structure and associated subroutines.
Definition: gas_data.F90:9
pmc_output::output_sectional
subroutine output_sectional(prefix, bin_grid, aero_data, aero_binned, gas_data, gas_state, env_state, index, time, del_t, uuid)
Write the current sectional data.
Definition: output.F90:665
pmc_constants::dp
integer, parameter dp
Kind of a double precision real number.
Definition: constants.F90:12
pmc_env_state::env_state_t
Current environment state.
Definition: env_state.F90:29
pmc_aero_state
The aero_state_t structure and assocated subroutines.
Definition: aero_state.F90:9
pmc_scenario::scenario_update_env_state
subroutine scenario_update_env_state(scenario, env_state, time)
Update time-dependent contents of the environment. scenario_init_env_state() should have been called ...
Definition: scenario.F90:134
pmc_gas_state
The gas_state_t structure and associated subroutines.
Definition: gas_state.F90:9
pmc_util::check_time_multiple
subroutine check_time_multiple(first_name, first_time, second_name, second_time)
Check that the first time interval is close to an integer multiple of the second, and warn if it is n...
Definition: util.F90:376
pmc_aero_dist
The aero_dist_t structure and associated subroutines.
Definition: aero_dist.F90:18
pmc_env_state
The env_state_t structure and associated subroutines.
Definition: env_state.F90:9
pmc_run_exact::run_exact
subroutine run_exact(bin_grid, scenario, env_state, aero_data, aero_dist_init, gas_data, run_exact_opt)
Run an exact simulation.
Definition: run_exact.F90:46
pmc_gas_state::gas_state_t
Current state of the gas mixing ratios in the system.
Definition: gas_state.F90:33
pmc_aero_data::aero_data_t
Aerosol material properties and associated data.
Definition: aero_data.F90:49
pmc_output
Write data in NetCDF format.
Definition: output.F90:68
pmc_run_exact::run_exact_opt_t
Options controlling the execution of run_exact().
Definition: run_exact.F90:24
pmc_aero_dist::aero_dist_t
A complete aerosol distribution, consisting of several modes.
Definition: aero_dist.F90:33
pmc_gas_data::gas_data_n_spec
elemental integer function gas_data_n_spec(gas_data)
Return the number of gas species.
Definition: gas_data.F90:109
pmc_aero_binned
The aero_binned_t structure and associated subroutines.
Definition: aero_binned.F90:9
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_bin_grid::bin_grid_t
1D grid, either logarithmic or linear.
Definition: bin_grid.F90:33
pmc_run_exact
Exact solution simulation.
Definition: run_exact.F90:9