source: palm/trunk/SOURCE/lpm_init.f90 @ 1314

Last change on this file since 1314 was 1314, checked in by suehring, 10 years ago

Vertical logarithmic interpolation of horizontal particle speed for particles
between roughness height and first vertical grid level.

  • Property svn:keywords set to Id
File size: 23.6 KB
RevLine 
[849]1 SUBROUTINE lpm_init
[1]2
[1036]3!--------------------------------------------------------------------------------!
4! This file is part of PALM.
5!
6! PALM is free software: you can redistribute it and/or modify it under the terms
7! of the GNU General Public License as published by the Free Software Foundation,
8! either version 3 of the License, or (at your option) any later 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!
[1310]17! Copyright 1997-2014 Leibniz Universitaet Hannover
[1036]18!--------------------------------------------------------------------------------!
19!
[254]20! Current revisions:
[1]21! -----------------
[1314]22! Vertical logarithmic interpolation of horizontal particle speed for particles
23! between roughness height and first vertical grid level.
[850]24!
25! Former revisions:
26! -----------------
27! $Id: lpm_init.f90 1314 2014-03-14 18:25:17Z suehring $
28!
[1093]29! 1092 2013-02-02 11:24:22Z raasch
30! unused variables removed
31!
[1037]32! 1036 2012-10-22 13:43:42Z raasch
33! code put under GPL (PALM 3.9)
34!
[850]35! 849 2012-03-15 10:35:09Z raasch
[849]36! routine renamed: init_particles -> lpm_init
37! de_dx, de_dy, de_dz are allocated here (instead of automatic arrays in
38! advec_particles),
39! sort_particles renamed lpm_sort_arrays, user_init_particles renamed lpm_init
[392]40!
[829]41! 828 2012-02-21 12:00:36Z raasch
42! call of init_kernels, particle feature color renamed class
43!
[826]44! 824 2012-02-17 09:09:57Z raasch
45! particle attributes speed_x|y|z_sgs renamed rvar1|2|3,
46! array particles implemented as pointer
47!
[668]48! 667 2010-12-23 12:06:00Z suehring/gryschka
49! nxl-1, nxr+1, nys-1, nyn+1 replaced by nxlg, nxrg, nysg, nyng for allocation
50! of arrays.
51!
[623]52! 622 2010-12-10 08:08:13Z raasch
53! optional barriers included in order to speed up collective operations
54!
[392]55! 336 2009-06-10 11:19:35Z raasch
[276]56! Maximum number of tails is calculated from maximum number of particles and
57! skip_particles_for_tail,
58! output of messages replaced by message handling routine
[229]59! Bugfix: arrays for tails are allocated with a minimum size of 10 tails if
60! there is no tail initially
[1]61!
[198]62! 150 2008-02-29 08:19:58Z raasch
63! Setting offset_ocean_* needed for calculating vertical indices within ocean
64! runs
65!
[139]66! 117 2007-10-11 03:27:59Z raasch
67! Sorting of particles only in case of cloud droplets
68!
[110]69! 106 2007-08-16 14:30:26Z raasch
70! variable iran replaced by iran_part
71!
[83]72! 82 2007-04-16 15:40:52Z raasch
73! Preprocessor directives for old systems removed
74!
[77]75! 70 2007-03-18 23:46:30Z raasch
76! displacements for mpi_particle_type changed, age_m initialized,
77! particles-package is now part of the default code
78!
[39]79! 16 2007-02-15 13:16:47Z raasch
80! Bugfix: MPI_REAL in MPI_ALLREDUCE replaced by MPI_INTEGER
81!
82! r4 | raasch | 2007-02-13 12:33:16 +0100 (Tue, 13 Feb 2007)
[3]83! RCS Log replace by Id keyword, revision history cleaned up
84!
[1]85! Revision 1.24  2007/02/11 13:00:17  raasch
86! Bugfix: allocation of tail_mask and new_tail_id in case of restart-runs
87! Bugfix: __ was missing in a cpp-directive
88!
89! Revision 1.1  1999/11/25 16:22:38  raasch
90! Initial revision
91!
92!
93! Description:
94! ------------
95! This routine initializes a set of particles and their attributes (position,
[849]96! radius, ..) which are used by the Lagrangian particle model (see lpm).
[1]97!------------------------------------------------------------------------------!
98
99    USE arrays_3d
[824]100    USE cloud_parameters
[1]101    USE control_parameters
[336]102    USE dvrp_variables
[1]103    USE grid_variables
104    USE indices
[828]105    USE lpm_collision_kernels_mod
[1]106    USE particle_attributes
107    USE pegrid
108    USE random_function_mod
109
110
111    IMPLICIT NONE
112
[1314]113    INTEGER ::  i, j, k, n, nn
[1]114#if defined( __parallel )
115    INTEGER, DIMENSION(3) ::  blocklengths, displacements, types
116#endif
117    LOGICAL ::  uniform_particles_l
[1314]118    REAL    ::  height_int, height_p, pos_x, pos_y, pos_z, z_p,            &
119                z0_av_local = 0.0
[1]120
121
122#if defined( __parallel )
123!
124!-- Define MPI derived datatype for FORTRAN datatype particle_type (see module
[82]125!-- particle_attributes). Integer length is 4 byte, Real is 8 byte
126    blocklengths(1)  = 19;  blocklengths(2)  =   4;  blocklengths(3)  =   1
127    displacements(1) =  0;  displacements(2) = 152;  displacements(3) = 168
128
[1]129    types(1) = MPI_REAL
130    types(2) = MPI_INTEGER
131    types(3) = MPI_UB
132    CALL MPI_TYPE_STRUCT( 3, blocklengths, displacements, types, &
133                          mpi_particle_type, ierr )
134    CALL MPI_TYPE_COMMIT( mpi_particle_type, ierr )
135#endif
136
137!
[150]138!-- In case of oceans runs, the vertical index calculations need an offset,
139!-- because otherwise the k indices will become negative
140    IF ( ocean )  THEN
141       offset_ocean_nzt    = nzt
142       offset_ocean_nzt_m1 = nzt - 1
143    ENDIF
144
145
146!
[1]147!-- Check the number of particle groups.
148    IF ( number_of_particle_groups > max_number_of_particle_groups )  THEN
[274]149       WRITE( message_string, * ) 'max_number_of_particle_groups =',      &
150                                  max_number_of_particle_groups ,         &
[254]151                                  '&number_of_particle_groups reset to ', &
152                                  max_number_of_particle_groups
[849]153       CALL message( 'lpm_init', 'PA0213', 0, 1, 0, 6, 0 )
[1]154       number_of_particle_groups = max_number_of_particle_groups
155    ENDIF
156
157!
158!-- Set default start positions, if necessary
159    IF ( psl(1) == 9999999.9 )  psl(1) = -0.5 * dx
160    IF ( psr(1) == 9999999.9 )  psr(1) = ( nx + 0.5 ) * dx
161    IF ( pss(1) == 9999999.9 )  pss(1) = -0.5 * dy
162    IF ( psn(1) == 9999999.9 )  psn(1) = ( ny + 0.5 ) * dy
163    IF ( psb(1) == 9999999.9 )  psb(1) = zu(nz/2)
164    IF ( pst(1) == 9999999.9 )  pst(1) = psb(1)
165
166    IF ( pdx(1) == 9999999.9  .OR.  pdx(1) == 0.0 )  pdx(1) = dx
167    IF ( pdy(1) == 9999999.9  .OR.  pdy(1) == 0.0 )  pdy(1) = dy
168    IF ( pdz(1) == 9999999.9  .OR.  pdz(1) == 0.0 )  pdz(1) = zu(2) - zu(1)
169
170    DO  j = 2, number_of_particle_groups
171       IF ( psl(j) == 9999999.9 )  psl(j) = psl(j-1)
172       IF ( psr(j) == 9999999.9 )  psr(j) = psr(j-1)
173       IF ( pss(j) == 9999999.9 )  pss(j) = pss(j-1)
174       IF ( psn(j) == 9999999.9 )  psn(j) = psn(j-1)
175       IF ( psb(j) == 9999999.9 )  psb(j) = psb(j-1)
176       IF ( pst(j) == 9999999.9 )  pst(j) = pst(j-1)
177       IF ( pdx(j) == 9999999.9  .OR.  pdx(j) == 0.0 )  pdx(j) = pdx(j-1)
178       IF ( pdy(j) == 9999999.9  .OR.  pdy(j) == 0.0 )  pdy(j) = pdy(j-1)
179       IF ( pdz(j) == 9999999.9  .OR.  pdz(j) == 0.0 )  pdz(j) = pdz(j-1)
180    ENDDO
181
182!
[849]183!-- Allocate arrays required for calculating particle SGS velocities
184    IF ( use_sgs_for_particles )  THEN
185       ALLOCATE( de_dx(nzb:nzt+1,nysg:nyng,nxlg:nxrg), &
186                 de_dy(nzb:nzt+1,nysg:nyng,nxlg:nxrg), &
187                 de_dz(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
188    ENDIF
189
190!
[1314]191!-- Allocate array required for logarithmic vertical interpolation of
192!-- horizontal particle velocities between the surface and the first vertical
193!-- grid level. In order to avoid repeated CPU cost-intensive CALLS of
194!-- intrinsic FORTRAN procedure LOG(z/z0), LOG(z/z0) is precalculated for
195!-- several heights. Splitting into 20 sublayers turned out to be sufficient.
196!-- To obtain exact height levels of particles, linear interpolation is applied
197!-- (see lpm_advec.f90).
198    IF ( prandtl_layer )  THEN
199       
200       ALLOCATE ( log_z_z0(0:number_of_sublayers) ) 
201       z_p         = zu(nzb+1) - zw(nzb)
202
203!
204!--    Calculate horizontal mean value of z0 used for logartihmic
205!--    interpolation. Note: this is not exact for heterogeneous z0.
206!--    However, sensitivity studies showed that the effect is
207!--    negligible.
208       z0_av_local  = SUM( z0(nys:nyn,nxl:nxr) )
209       z0_av_global = 0.0
210
211       CALL MPI_ALLREDUCE(z0_av_local, z0_av_global, 1, MPI_REAL, MPI_SUM, &
212                          comm2d, ierr )
213
214       z0_av_global = z0_av_global  / ( ( ny + 1 ) * ( nx + 1 ) )
215!
216!--    Horizontal wind speed is zero below and at z0
217       log_z_z0(0) = 0.0   
218!
219!--    Calculate vertical depth of the sublayers
220       height_int  = ( z_p - z0_av_global ) / REAL( number_of_sublayers ) 
221!
222!--    Precalculate LOG(z/z0)
223       height_p    = 0.0
224       DO  k = 1, number_of_sublayers
225
226          height_p    = height_p + height_int
227          log_z_z0(k) = LOG( height_p / z0_av_global )
228
229       ENDDO
230
231
232    ENDIF
233
234!
[828]235!-- Initialize collision kernels
236    IF ( collision_kernel /= 'none' )  CALL init_kernels
237
238!
[1]239!-- For the first model run of a possible job chain initialize the
[849]240!-- particles, otherwise read the particle data from restart file.
[1]241    IF ( TRIM( initializing_actions ) == 'read_restart_data'  &
242         .AND.  read_particles_from_restartfile )  THEN
243
[849]244       CALL lpm_read_restart_file
[1]245
246    ELSE
247
248!
249!--    Allocate particle arrays and set attributes of the initial set of
250!--    particles, which can be also periodically released at later times.
251!--    Also allocate array for particle tail coordinates, if needed.
[667]252       ALLOCATE( prt_count(nzb:nzt+1,nysg:nyng,nxlg:nxrg),       &
253                 prt_start_index(nzb:nzt+1,nysg:nyng,nxlg:nxrg), &
[792]254                 particle_mask(maximum_number_of_particles),     &
255                 part_1(maximum_number_of_particles),            &
256                 part_2(maximum_number_of_particles)  )
[1]257
[792]258       particles => part_1
259
260       sort_count = 0
261
[1]262!
263!--    Initialize all particles with dummy values (otherwise errors may
264!--    occur within restart runs). The reason for this is still not clear
265!--    and may be presumably caused by errors in the respective user-interface.
266       particles = particle_type( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
267                                  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &
[57]268                                  0.0, 0, 0, 0, 0 )
[1]269       particle_groups = particle_groups_type( 0.0, 0.0, 0.0, 0.0 )
270
271!
272!--    Set the default particle size used for dvrp plots
273       IF ( dvrp_psize == 9999999.9 )  dvrp_psize = 0.2 * dx
274
275!
276!--    Set values for the density ratio and radius for all particle
277!--    groups, if necessary
278       IF ( density_ratio(1) == 9999999.9 )  density_ratio(1) = 0.0
279       IF ( radius(1)        == 9999999.9 )  radius(1) = 0.0
280       DO  i = 2, number_of_particle_groups
281          IF ( density_ratio(i) == 9999999.9 )  THEN
282             density_ratio(i) = density_ratio(i-1)
283          ENDIF
284          IF ( radius(i) == 9999999.9 )  radius(i) = radius(i-1)
285       ENDDO
286
287       DO  i = 1, number_of_particle_groups
288          IF ( density_ratio(i) /= 0.0  .AND.  radius(i) == 0 )  THEN
[254]289             WRITE( message_string, * ) 'particle group #', i, 'has a', &
290                                        'density ratio /= 0 but radius = 0'
[849]291             CALL message( 'lpm_init', 'PA0215', 1, 2, 0, 6, 0 )
[1]292          ENDIF
293          particle_groups(i)%density_ratio = density_ratio(i)
294          particle_groups(i)%radius        = radius(i)
295       ENDDO
296
297!
298!--    Calculate particle positions and store particle attributes, if
299!--    particle is situated on this PE
300       n = 0
301
302       DO  i = 1, number_of_particle_groups
303
304          pos_z = psb(i)
305
306          DO WHILE ( pos_z <= pst(i) )
307
308             pos_y = pss(i)
309
310             DO WHILE ( pos_y <= psn(i) )
311
312                IF ( pos_y >= ( nys - 0.5 ) * dy  .AND.  &
313                     pos_y <  ( nyn + 0.5 ) * dy )  THEN
314
315                   pos_x = psl(i)
316
317                   DO WHILE ( pos_x <= psr(i) )
318
319                      IF ( pos_x >= ( nxl - 0.5 ) * dx  .AND.  &
320                           pos_x <  ( nxr + 0.5 ) * dx )  THEN
321
322                         DO  j = 1, particles_per_point
323
324                            n = n + 1
325                            IF ( n > maximum_number_of_particles )  THEN
[254]326                               WRITE( message_string, * ) 'number of initial', &
[274]327                                      'particles (', n, ') exceeds',           &
328                                      '&maximum_number_of_particles (',        &
329                                      maximum_number_of_particles, ') on PE ', &
[254]330                                             myid
[849]331                               CALL message( 'lpm_init', 'PA0216', 2, 2, -1, 6,&
332                                             1 )
[1]333                            ENDIF
334                            particles(n)%x             = pos_x
335                            particles(n)%y             = pos_y
336                            particles(n)%z             = pos_z
337                            particles(n)%age           = 0.0
[57]338                            particles(n)%age_m         = 0.0
[1]339                            particles(n)%dt_sum        = 0.0
340                            particles(n)%dvrp_psize    = dvrp_psize
341                            particles(n)%e_m           = 0.0
[824]342                            IF ( curvature_solution_effects )  THEN
343!
344!--                            Initial values (internal timesteps, derivative)
345!--                            for Rosenbrock method
346                               particles(n)%rvar1      = 1.0E-12
347                               particles(n)%rvar2      = 1.0E-3
348                               particles(n)%rvar3      = -9999999.9
349                            ELSE
350!
351!--                            Initial values for SGS velocities
352                               particles(n)%rvar1      = 0.0
353                               particles(n)%rvar2      = 0.0
354                               particles(n)%rvar3      = 0.0
355                            ENDIF
[1]356                            particles(n)%speed_x       = 0.0
357                            particles(n)%speed_y       = 0.0
358                            particles(n)%speed_z       = 0.0
359                            particles(n)%origin_x      = pos_x
360                            particles(n)%origin_y      = pos_y
361                            particles(n)%origin_z      = pos_z
362                            particles(n)%radius      = particle_groups(i)%radius
363                            particles(n)%weight_factor =initial_weighting_factor
[828]364                            particles(n)%class         = 1
[1]365                            particles(n)%group         = i
366                            particles(n)%tailpoints    = 0
367                            IF ( use_particle_tails  .AND. &
368                                 MOD( n, skip_particles_for_tail ) == 0 )  THEN
369                               number_of_tails         = number_of_tails + 1
370!
371!--                            This is a temporary provisional setting (see
372!--                            further below!)
373                               particles(n)%tail_id    = number_of_tails
374                            ELSE
375                               particles(n)%tail_id    = 0
376                            ENDIF
377
378                         ENDDO
379
380                      ENDIF
381
382                      pos_x = pos_x + pdx(i)
383
384                   ENDDO
385
386                ENDIF
387
388                pos_y = pos_y + pdy(i)
389
390             ENDDO
391
392             pos_z = pos_z + pdz(i)
393
394          ENDDO
395
396       ENDDO
397
398       number_of_initial_particles = n
399       number_of_particles         = n
400
401!
402!--    Calculate the number of particles and tails of the total domain
403#if defined( __parallel )
[622]404       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
[1]405       CALL MPI_ALLREDUCE( number_of_particles, total_number_of_particles, 1, &
[16]406                           MPI_INTEGER, MPI_SUM, comm2d, ierr )
[622]407       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
[1]408       CALL MPI_ALLREDUCE( number_of_tails, total_number_of_tails, 1, &
[16]409                           MPI_INTEGER, MPI_SUM, comm2d, ierr )
[1]410#else
411       total_number_of_particles = number_of_particles
412       total_number_of_tails     = number_of_tails
413#endif
414
415!
416!--    Set a seed value for the random number generator to be exclusively
417!--    used for the particle code. The generated random numbers should be
418!--    different on the different PEs.
419       iran_part = iran_part + myid
420
421!
422!--    User modification of initial particles
[849]423       CALL user_lpm_init
[1]424
425!
426!--    Store the initial set of particles for release at later times
427       IF ( number_of_initial_particles /= 0 )  THEN
428          ALLOCATE( initial_particles(1:number_of_initial_particles) )
429          initial_particles(1:number_of_initial_particles) = &
430                                        particles(1:number_of_initial_particles)
431       ENDIF
432
433!
434!--    Add random fluctuation to particle positions
435       IF ( random_start_position )  THEN
436
437          DO  n = 1, number_of_initial_particles
438             IF ( psl(particles(n)%group) /= psr(particles(n)%group) )  THEN
439                particles(n)%x = particles(n)%x + &
[106]440                                 ( random_function( iran_part ) - 0.5 ) * &
[1]441                                 pdx(particles(n)%group)
442                IF ( particles(n)%x  <=  ( nxl - 0.5 ) * dx )  THEN
443                   particles(n)%x = ( nxl - 0.4999999999 ) * dx
444                ELSEIF ( particles(n)%x  >=  ( nxr + 0.5 ) * dx )  THEN
445                   particles(n)%x = ( nxr + 0.4999999999 ) * dx
446                ENDIF
447             ENDIF
448             IF ( pss(particles(n)%group) /= psn(particles(n)%group) )  THEN
449                particles(n)%y = particles(n)%y + &
[106]450                                 ( random_function( iran_part ) - 0.5 ) * &
[1]451                                 pdy(particles(n)%group)
452                IF ( particles(n)%y  <=  ( nys - 0.5 ) * dy )  THEN
453                   particles(n)%y = ( nys - 0.4999999999 ) * dy
454                ELSEIF ( particles(n)%y  >=  ( nyn + 0.5 ) * dy )  THEN
455                   particles(n)%y = ( nyn + 0.4999999999 ) * dy
456                ENDIF
457             ENDIF
458             IF ( psb(particles(n)%group) /= pst(particles(n)%group) )  THEN
459                particles(n)%z = particles(n)%z + &
[106]460                                 ( random_function( iran_part ) - 0.5 ) * &
[1]461                                 pdz(particles(n)%group)
462             ENDIF
463          ENDDO
464       ENDIF
465
466!
[117]467!--    Sort particles in the sequence the gridboxes are stored in the memory.
468!--    Only required if cloud droplets are used.
[849]469       IF ( cloud_droplets )  CALL lpm_sort_arrays
[1]470
471!
472!--    Open file for statistical informations about particle conditions
473       IF ( write_particle_statistics )  THEN
474          CALL check_open( 80 )
475          WRITE ( 80, 8000 )  current_timestep_number, simulated_time, &
476                              number_of_initial_particles,             &
477                              maximum_number_of_particles
478          CALL close_file( 80 )
479       ENDIF
480
481!
482!--    Check if particles are really uniform in color and radius (dvrp_size)
483!--    (uniform_particles is preset TRUE)
484       IF ( uniform_particles )  THEN
485          IF ( number_of_initial_particles == 0 )  THEN
486             uniform_particles_l = .TRUE.
487          ELSE
488             n = number_of_initial_particles
489             IF ( MINVAL( particles(1:n)%dvrp_psize  ) ==     &
490                  MAXVAL( particles(1:n)%dvrp_psize  )  .AND. &
[828]491                  MINVAL( particles(1:n)%class ) ==     &
492                  MAXVAL( particles(1:n)%class ) )  THEN
[1]493                uniform_particles_l = .TRUE.
494             ELSE
495                uniform_particles_l = .FALSE.
496             ENDIF
497          ENDIF
498
499#if defined( __parallel )
[622]500          IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
[1]501          CALL MPI_ALLREDUCE( uniform_particles_l, uniform_particles, 1, &
502                              MPI_LOGICAL, MPI_LAND, comm2d, ierr )
503#else
504          uniform_particles = uniform_particles_l
505#endif
506
507       ENDIF
508
509!
[336]510!--    Particles will probably become none-uniform, if their size and color
511!--    will be determined by flow variables
512       IF ( particle_color /= 'none'  .OR.  particle_dvrpsize /= 'none' )  THEN
513          uniform_particles = .FALSE.
514       ENDIF
515
516!
[1]517!--    Set the beginning of the particle tails and their age
518       IF ( use_particle_tails )  THEN
519!
[276]520!--       Choose the maximum number of tails with respect to the maximum number
521!--       of particles and skip_particles_for_tail
522          maximum_number_of_tails = maximum_number_of_particles / &
523                                    skip_particles_for_tail
524
[229]525!
526!--       Create a minimum number of tails in case that there is no tail
527!--       initially (otherwise, index errors will occur when adressing the
528!--       arrays below)
529          IF ( maximum_number_of_tails == 0 )  maximum_number_of_tails = 10
[1]530
531          ALLOCATE( particle_tail_coordinates(maximum_number_of_tailpoints,5, &
532                    maximum_number_of_tails),                                 &
533                    new_tail_id(maximum_number_of_tails),                     &
534                    tail_mask(maximum_number_of_tails) )
535
536          particle_tail_coordinates  = 0.0
537          minimum_tailpoint_distance = minimum_tailpoint_distance**2
538          number_of_initial_tails    = number_of_tails
539
540          nn = 0
541          DO  n = 1, number_of_particles
542!
543!--          Only for those particles marked above with a provisional tail_id
544!--          tails will be created. Particles now get their final tail_id.
545             IF ( particles(n)%tail_id /= 0 )  THEN
546
547                nn = nn + 1
548                particles(n)%tail_id = nn
549
550                particle_tail_coordinates(1,1,nn) = particles(n)%x
551                particle_tail_coordinates(1,2,nn) = particles(n)%y
552                particle_tail_coordinates(1,3,nn) = particles(n)%z
[828]553                particle_tail_coordinates(1,4,nn) = particles(n)%class
[1]554                particles(n)%tailpoints = 1
555                IF ( minimum_tailpoint_distance /= 0.0 )  THEN
556                   particle_tail_coordinates(2,1,nn) = particles(n)%x
557                   particle_tail_coordinates(2,2,nn) = particles(n)%y
558                   particle_tail_coordinates(2,3,nn) = particles(n)%z
[828]559                   particle_tail_coordinates(2,4,nn) = particles(n)%class
[1]560                   particle_tail_coordinates(1:2,5,nn) = 0.0
561                   particles(n)%tailpoints = 2
562                ENDIF
563
564             ENDIF
565          ENDDO
566       ENDIF
567
568!
569!--    Plot initial positions of particles (only if particle advection is
570!--    switched on from the beginning of the simulation (t=0))
571       IF ( particle_advection_start == 0.0 )  CALL data_output_dvrp
572
573    ENDIF
574
575!
576!-- Check boundary condition and set internal variables
577    SELECT CASE ( bc_par_b )
578   
579       CASE ( 'absorb' )
580          ibc_par_b = 1
581
582       CASE ( 'reflect' )
583          ibc_par_b = 2
584         
585       CASE DEFAULT
[254]586          WRITE( message_string, * )  'unknown boundary condition ',   &
587                                       'bc_par_b = "', TRIM( bc_par_b ), '"'
[849]588          CALL message( 'lpm_init', 'PA0217', 1, 2, 0, 6, 0 )
[1]589         
590    END SELECT
591    SELECT CASE ( bc_par_t )
592   
593       CASE ( 'absorb' )
594          ibc_par_t = 1
595
596       CASE ( 'reflect' )
597          ibc_par_t = 2
598         
599       CASE DEFAULT
[254]600          WRITE( message_string, * ) 'unknown boundary condition ',   &
601                                     'bc_par_t = "', TRIM( bc_par_t ), '"'
[849]602          CALL message( 'lpm_init', 'PA0218', 1, 2, 0, 6, 0 )
[1]603         
604    END SELECT
605    SELECT CASE ( bc_par_lr )
606
607       CASE ( 'cyclic' )
608          ibc_par_lr = 0
609
610       CASE ( 'absorb' )
611          ibc_par_lr = 1
612
613       CASE ( 'reflect' )
614          ibc_par_lr = 2
615         
616       CASE DEFAULT
[254]617          WRITE( message_string, * ) 'unknown boundary condition ',   &
618                                     'bc_par_lr = "', TRIM( bc_par_lr ), '"'
[849]619          CALL message( 'lpm_init', 'PA0219', 1, 2, 0, 6, 0 )
[1]620         
621    END SELECT
622    SELECT CASE ( bc_par_ns )
623
624       CASE ( 'cyclic' )
625          ibc_par_ns = 0
626
627       CASE ( 'absorb' )
628          ibc_par_ns = 1
629
630       CASE ( 'reflect' )
631          ibc_par_ns = 2
632         
633       CASE DEFAULT
[254]634          WRITE( message_string, * ) 'unknown boundary condition ',   &
635                                     'bc_par_ns = "', TRIM( bc_par_ns ), '"'
[849]636          CALL message( 'lpm_init', 'PA0220', 1, 2, 0, 6, 0 )
[1]637         
638    END SELECT
639!
640!-- Formats
6418000 FORMAT (I6,1X,F7.2,4X,I6,71X,I6)
642
[849]643 END SUBROUTINE lpm_init
Note: See TracBrowser for help on using the repository browser.