-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmod_particle_attributes.f90
283 lines (260 loc) · 16.8 KB
/
mod_particle_attributes.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
!> @file mod_particle_attributes.f90
!------------------------------------------------------------------------------!
! This file is part of the PALM model system.
!
! PALM is free software: you can redistribute it and/or modify it under the
! terms of the GNU General Public License as published by the Free Software
! Foundation, either version 3 of the License, or (at your option) any later
! version.
!
! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
! A PARTICULAR PURPOSE. See the GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License along with
! PALM. If not, see <http://www.gnu.org/licenses/>.
!
! Copyright 1997-2019 Leibniz Universitaet Hannover
!------------------------------------------------------------------------------!
!
! Current revisions:
! ------------------
!
!
! Former revisions:
! -----------------
! $Id: mod_particle_attributes.f90 3655 2019-01-07 16:51:22Z knoop $
! time_prel replaced by last_particle_release_time
!
! 3405 2018-10-23 15:34:41Z raasch
! bugfix: BIND attribute added to derived type particle_type
!
! 2718 2018-01-02 08:49:38Z maronga
! Corrected "Former revisions" section
!
! 2696 2017-12-14 17:12:51Z kanani
! Change in file header (GPL part)
!
! 2375 2017-08-29 14:10:28Z schwenkel
! molecular_weight_of_solute, molecular_weight_of_water, vanthoff removed and
! added in modules. Parameters are also used in bulk-microphysics.
!
! 2312 2017-07-14 20:26:51Z hoffmann
! Aerosol initialization improved.
!
! 2305 2017-07-06 11:18:47Z hoffmann
! Improved calculation of particle IDs.
!
! 2278 2017-06-12 13:08:18Z schwenkel
! Added comments
!
! 2265 2017-06-08 16:58:28Z schwenkel
! Unused variables removed.
!
! 2263 2017-06-08 14:59:01Z schwenkel
! Implemented splitting and merging algorithm
!
! 2183 2017-03-17 14:29:15Z schwenkel
!
! 2182 2017-03-17 14:27:40Z schwenkel
! Added parameters for simplified particle initialization.
!
! 2122 2017-01-18 12:22:54Z hoffmann
! Calculation of particle ID
! Particle attribute dvrp_psize renamed to user: this attribute can be used by
! by the user to store any variable
!
! 2000 2016-08-20 18:09:15Z knoop
! Forced header and separation lines into 80 columns
!
! 1936 2016-06-13 13:37:44Z suehring
! +deallocate_memory, step_dealloc
!
! 1929 2016-06-09 16:25:25Z suehring
! -sgs_wfu_par, sgs_wfv_par, sgs_wfw_par
! + sgs_wf_par
!
! 1871 2016-04-15 11:46:09Z hoffmann
! Initialization of aerosols added.
!
! 1849 2016-04-08 11:33:18Z hoffmann
! bfactor, mass_of_solute, molecular_weight_of_solute, molecular_weight_of_water,
! vanthoff added from modules
!
! 1831 2016-04-07 13:15:51Z hoffmann
! palm_kernel removed, curvature_solution_effects added
!
! 1822 2016-04-07 07:49:42Z hoffmann
! +collision_algorithm, all_or_nothing, average_impact
! Tails removed.
!
! 1727 2015-11-20 07:22:02Z knoop
! Bugfix: Cause of syntax warning gfortran preprocessor removed
!
! 1682 2015-10-07 23:56:08Z knoop
! Code annotations made doxygen readable
!
! 1575 2015-03-27 09:56:27Z raasch
! +seed_follows_topography
!
! 1359 2014-04-11 17:15:14Z hoffmann
! new module containing all particle related variables
! -dt_sort_particles
!
! Description:
! ------------
!> Definition of variables used to compute particle transport
!------------------------------------------------------------------------------!
MODULE particle_attributes
USE, INTRINSIC :: ISO_C_BINDING
USE kinds
CHARACTER(LEN=15) :: aero_species = 'nacl' !< aerosol species
CHARACTER(LEN=15) :: aero_type = 'maritime' !< aerosol type
CHARACTER(LEN=15) :: bc_par_lr = 'cyclic' !< left/right boundary condition
CHARACTER(LEN=15) :: bc_par_ns = 'cyclic' !< north/south boundary condition
CHARACTER(LEN=15) :: bc_par_b = 'reflect' !< bottom boundary condition
CHARACTER(LEN=15) :: bc_par_t = 'absorb' !< top boundary condition
CHARACTER(LEN=15) :: collision_kernel = 'none' !< collision kernel
CHARACTER(LEN=5) :: splitting_function = 'gamma' !< function for calculation critical weighting factor
CHARACTER(LEN=5) :: splitting_mode = 'const' !< splitting mode
INTEGER(iwp) :: deleted_particles = 0 !< number of deleted particles per time step
INTEGER(iwp) :: dissipation_classes = 10 !< namelist parameter (see documentation)
INTEGER(iwp) :: ibc_par_b !< particle bottom boundary condition dummy
INTEGER(iwp) :: ibc_par_lr !< particle left/right boundary condition dummy
INTEGER(iwp) :: ibc_par_ns !< particle north/south boundary condition dummy
INTEGER(iwp) :: ibc_par_t !< particle top boundary condition dummy
INTEGER(iwp) :: iran_part = -1234567 !< number for random generator
INTEGER(iwp) :: isf !< dummy for splitting function
INTEGER(iwp) :: i_splitting_mode !< dummy for splitting mode
INTEGER(iwp) :: max_number_particles_per_gridbox = 100 !< namelist parameter (see documentation)
INTEGER(iwp) :: merge_drp = 0 !< number of merged droplets
INTEGER(iwp) :: min_nr_particle = 50 !< namelist parameter (see documentation)
INTEGER(iwp) :: new_particles = 0 !< number of new particles
INTEGER(iwp) :: n_max = 100 !< number of radii bin for splitting functions
INTEGER(iwp) :: number_of_particles = 0 !< number of particles for each grid box (3d array is saved on prt_count)
INTEGER(iwp) :: number_of_particle_groups = 1 !< namelist parameter (see documentation)
INTEGER(iwp) :: number_of_sublayers = 20 !< number of sublayers for particle velocities betwenn surface and first grid level
INTEGER(iwp) :: number_particles_per_gridbox = -1 !< namelist parameter (see documentation)
INTEGER(iwp) :: offset_ocean_nzt = 0 !< in case of oceans runs, the vertical index calculations need an offset
INTEGER(iwp) :: offset_ocean_nzt_m1 = 0 !< in case of oceans runs, the vertical index calculations need an offset
INTEGER(iwp) :: particles_per_point = 1 !< namelist parameter (see documentation)
INTEGER(iwp) :: radius_classes = 20 !< namelist parameter (see documentation)
INTEGER(iwp) :: sort_count = 0 !< counter for sorting particles
INTEGER(iwp) :: splitting_factor = 2 !< namelist parameter (see documentation)
INTEGER(iwp) :: splitting_factor_max = 5 !< namelist parameter (see documentation)
INTEGER(iwp) :: step_dealloc = 100 !< namelist parameter (see documentation)
INTEGER(iwp) :: sum_merge_drp = 0 !< sum of merged super droplets
INTEGER(iwp) :: sum_new_particles = 0 !< sum of created particles (in splitting algorithm)
INTEGER(iwp) :: total_number_of_particles !< total number of particles in the whole model domain
INTEGER(iwp) :: trlp_count_sum !< parameter for particle exchange of PEs
INTEGER(iwp) :: trlp_count_recv_sum !< parameter for particle exchange of PEs
INTEGER(iwp) :: trrp_count_sum !< parameter for particle exchange of PEs
INTEGER(iwp) :: trrp_count_recv_sum !< parameter for particle exchange of PEs
INTEGER(iwp) :: trsp_count_sum !< parameter for particle exchange of PEs
INTEGER(iwp) :: trsp_count_recv_sum !< parameter for particle exchange of PEs
INTEGER(iwp) :: trnp_count_sum !< parameter for particle exchange of PEs
INTEGER(iwp) :: trnp_count_recv_sum !< parameter for particle exchange of PEs
INTEGER(iwp), PARAMETER :: max_number_of_particle_groups = 10 !< maximum allowed number of particle groups
INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE :: prt_count !< 3d array of number of particles of every grid box
LOGICAL :: curvature_solution_effects = .FALSE. !< namelist parameter (see documentation)
LOGICAL :: deallocate_memory = .TRUE. !< namelist parameter (see documentation)
LOGICAL :: hall_kernel = .FALSE. !< flag for collision kernel
LOGICAL :: merging = .FALSE. !< namelist parameter (see documentation)
LOGICAL :: particle_advection = .FALSE. !< parameter to steer the advection of particles
LOGICAL :: random_start_position = .FALSE. !< namelist parameter (see documentation)
LOGICAL :: read_particles_from_restartfile = .TRUE. !< namelist parameter (see documentation)
LOGICAL :: seed_follows_topography = .FALSE. !< namelist parameter (see documentation)
LOGICAL :: splitting = .FALSE. !< namelist parameter (see documentation)
LOGICAL :: use_kernel_tables = .FALSE. !< parameter, which turns on the use of precalculated collision kernels
LOGICAL :: use_sgs_for_particles = .FALSE. !< namelist parameter (see documentation)
LOGICAL :: wang_kernel = .FALSE. !< flag for collision kernel
LOGICAL :: write_particle_statistics = .FALSE. !< namelist parameter (see documentation)
LOGICAL, DIMENSION(max_number_of_particle_groups) :: &
vertical_particle_advection = .TRUE. !< Switch on/off vertical particle transport
REAL(wp) :: aero_weight = 1.0_wp !< namelist parameter (see documentation)
REAL(wp) :: alloc_factor = 20.0_wp !< namelist parameter (see documentation)
REAL(wp) :: c_0 = 3.0_wp !< parameter for lagrangian timescale
REAL(wp) :: dt_min_part = 0.0002_wp !< minimum particle time step when SGS velocities are used (s)
REAL(wp) :: dt_prel = 9999999.9_wp !< namelist parameter (see documentation)
REAL(wp) :: dt_write_particle_data = 9999999.9_wp !< namelist parameter (see documentation)
REAL(wp) :: end_time_prel = 9999999.9_wp !< namelist parameter (see documentation)
REAL(wp) :: initial_weighting_factor = 1.0_wp !< namelist parameter (see documentation)
REAL(wp) :: last_particle_release_time = 0.0_wp !< last time of particle release
REAL(wp) :: log_sigma(3) = 1.0_wp !< namelist parameter (see documentation)
REAL(wp) :: na(3) = 0.0_wp !< namelist parameter (see documentation)
REAL(wp) :: number_concentration = -1.0_wp !< namelist parameter (see documentation)
REAL(wp) :: particle_advection_start = 0.0_wp !< namelist parameter (see documentation)
REAL(wp) :: radius_merge = 1.0E-7_wp !< namelist parameter (see documentation)
REAL(wp) :: radius_split = 40.0E-6_wp !< namelist parameter (see documentation)
REAL(wp) :: rm(3) = 1.0E-6_wp !< namelist parameter (see documentation)
REAL(wp) :: sgs_wf_part !< parameter for sgs
REAL(wp) :: time_write_particle_data = 0.0_wp !< write particle data at current time on file
REAL(wp) :: weight_factor_merge = -1.0_wp !< namelist parameter (see documentation)
REAL(wp) :: weight_factor_split = -1.0_wp !< namelist parameter (see documentation)
REAL(wp) :: z0_av_global !< horizontal mean value of z0
REAL(wp), DIMENSION(max_number_of_particle_groups) :: density_ratio = 9999999.9_wp !< namelist parameter (see documentation)
REAL(wp), DIMENSION(max_number_of_particle_groups) :: pdx = 9999999.9_wp !< namelist parameter (see documentation)
REAL(wp), DIMENSION(max_number_of_particle_groups) :: pdy = 9999999.9_wp !< namelist parameter (see documentation)
REAL(wp), DIMENSION(max_number_of_particle_groups) :: pdz = 9999999.9_wp !< namelist parameter (see documentation)
REAL(wp), DIMENSION(max_number_of_particle_groups) :: psb = 9999999.9_wp !< namelist parameter (see documentation)
REAL(wp), DIMENSION(max_number_of_particle_groups) :: psl = 9999999.9_wp !< namelist parameter (see documentation)
REAL(wp), DIMENSION(max_number_of_particle_groups) :: psn = 9999999.9_wp !< namelist parameter (see documentation)
REAL(wp), DIMENSION(max_number_of_particle_groups) :: psr = 9999999.9_wp !< namelist parameter (see documentation)
REAL(wp), DIMENSION(max_number_of_particle_groups) :: pss = 9999999.9_wp !< namelist parameter (see documentation)
REAL(wp), DIMENSION(max_number_of_particle_groups) :: pst = 9999999.9_wp !< namelist parameter (see documentation).
REAL(wp), DIMENSION(max_number_of_particle_groups) :: radius = 9999999.9_wp !< namelist parameter (see documentation)
REAL(wp), DIMENSION(:), ALLOCATABLE :: log_z_z0 !< Precalculate LOG(z/z0)
TYPE, BIND(C) :: particle_type
REAL(wp) :: aux1 !< auxiliary multi-purpose feature
REAL(wp) :: aux2 !< auxiliary multi-purpose feature
REAL(wp) :: radius !< radius of particle
REAL(wp) :: age !< age of particle
REAL(wp) :: age_m !<
REAL(wp) :: dt_sum !<
REAL(wp) :: e_m !< interpolated sgs tke
REAL(wp) :: origin_x !< origin x-position of particle (changed cyclic bc)
REAL(wp) :: origin_y !< origin y-position of particle (changed cyclic bc)
REAL(wp) :: origin_z !< origin z-position of particle (changed cyclic bc)
REAL(wp) :: rvar1 !<
REAL(wp) :: rvar2 !<
REAL(wp) :: rvar3 !<
REAL(wp) :: speed_x !< speed of particle in x
REAL(wp) :: speed_y !< speed of particle in y
REAL(wp) :: speed_z !< speed of particle in z
REAL(wp) :: weight_factor !< weighting factor
REAL(wp) :: x !< x-position
REAL(wp) :: y !< y-position
REAL(wp) :: z !< z-position
INTEGER(iwp) :: class !< radius class needed for collision
INTEGER(iwp) :: group !< number of particle group
INTEGER(idp) :: id !< particle ID (64 bit integer)
LOGICAL :: particle_mask !< if this parameter is set to false the particle will be deleted
INTEGER(iwp) :: block_nr !< number for sorting (removable?)
END TYPE particle_type
TYPE(particle_type), DIMENSION(:), POINTER :: particles !< Particle array for this grid cell
TYPE(particle_type) :: zero_particle !< zero particle to avoid weird thinge
TYPE particle_groups_type
SEQUENCE
REAL(wp) :: density_ratio !< density ratio of the fluid and the particles
REAL(wp) :: radius !< radius of particle
REAL(wp) :: exp_arg !< exponential term of particle inertia
REAL(wp) :: exp_term !< exponential term of particle inertia
END TYPE particle_groups_type
TYPE(particle_groups_type), DIMENSION(max_number_of_particle_groups) :: &
particle_groups
TYPE grid_particle_def
INTEGER(iwp), DIMENSION(0:7) :: start_index !< start particle index for current block
INTEGER(iwp), DIMENSION(0:7) :: end_index !< end particle index for current block
INTEGER(iwp) :: id_counter !< particle id counter
LOGICAL :: time_loop_done !< timestep loop for particle advection
TYPE(particle_type), POINTER, DIMENSION(:) :: particles !< Particle array for this grid cell
END TYPE grid_particle_def
TYPE(grid_particle_def), DIMENSION(:,:,:), ALLOCATABLE, TARGET :: grid_particles
TYPE block_offset_def !<
INTEGER(iwp) :: i_off !<
INTEGER(iwp) :: j_off !<
INTEGER(iwp) :: k_off !<
END TYPE block_offset_def
TYPE(block_offset_def), DIMENSION(0:7) :: block_offset
SAVE
END MODULE particle_attributes