source: palm/trunk/SOURCE/mod_particle_attributes.f90 @ 3806

Last change on this file since 3806 was 3786, checked in by raasch, 6 years ago

unused variables removed, interoperable C datatypes introduced in particle type to avoid compiler warnings

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