Ignore:
Timestamp:
Apr 7, 2016 7:49:42 AM (8 years ago)
Author:
hoffmann
Message:

changes in LPM and bulk cloud microphysics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/lpm_init.f90

    r1818 r1822  
    1919! Current revisions:
    2020! -----------------
    21 !
     21! Unused variables removed.
    2222!
    2323! Former revisions:
     
    113113               dz, initializing_actions, message_string, ocean, simulated_time
    114114
    115     USE dvrp_variables,                                                        &
    116         ONLY:  particle_color, particle_dvrpsize
    117 
    118115    USE grid_variables,                                                        &
    119116        ONLY:  ddx, dx, ddy, dy
     
    134131        ONLY:   alloc_factor, bc_par_b, bc_par_lr, bc_par_ns, bc_par_t,        &
    135132                block_offset, block_offset_def, collision_kernel,              &
    136                 density_ratio, dvrp_psize, grid_particles,                     &
     133                density_ratio, grid_particles,                                 &
    137134                initial_weighting_factor, ibc_par_b, ibc_par_lr, ibc_par_ns,   &
    138135                ibc_par_t, iran_part, log_z_z0,                                &
    139136                max_number_of_particle_groups, maximum_number_of_particles,    &
    140                 maximum_number_of_tailpoints, maximum_number_of_tails,         &
    141                 minimum_tailpoint_distance, min_nr_particle,                   &
    142                 mpi_particle_type, new_tail_id,                                &
    143                 number_of_initial_tails, number_of_particles,                  &
     137                min_nr_particle, mpi_particle_type,                            &
     138                number_of_particles,                                           &
    144139                number_of_particle_groups, number_of_sublayers,                &
    145                 number_of_tails, offset_ocean_nzt, offset_ocean_nzt_m1,        &
     140                offset_ocean_nzt, offset_ocean_nzt_m1,                         &
    146141                particles, particle_advection_start, particle_groups,          &
    147142                particle_groups_type, particles_per_point,                     &
    148                 particle_tail_coordinates,  particle_type, pdx, pdy, pdz,      &
     143                particle_type, pdx, pdy, pdz,                                  &
    149144                prt_count, psb, psl, psn, psr, pss, pst,                       &
    150145                radius, random_start_position, read_particles_from_restartfile,&
    151                 seed_follows_topography, skip_particles_for_tail, sort_count,  &
    152                 tail_mask, total_number_of_particles, total_number_of_tails,   &
    153                 use_particle_tails, use_sgs_for_particles,                     &
     146                seed_follows_topography, sort_count,                           &
     147                total_number_of_particles,                                     &
     148                use_sgs_for_particles,                                         &
    154149                write_particle_statistics, uniform_particles, zero_particle,   &
    155150                z0_av_global
     
    192187
    193188    INTEGER(iwp) ::  i                           !<
    194     INTEGER(iwp) ::  ip                          !<
    195189    INTEGER(iwp) ::  j                           !<
    196     INTEGER(iwp) ::  jp                          !<
    197190    INTEGER(iwp) ::  k                           !<
    198     INTEGER(iwp) ::  kp                          !<
    199     INTEGER(iwp) ::  n                           !<
    200     INTEGER(iwp) ::  nn                          !<
    201191
    202192#if defined( __parallel )
     
    205195    INTEGER(iwp), DIMENSION(3) ::  types         !<
    206196#endif
    207     LOGICAL ::  uniform_particles_l              !<
    208197
    209198    REAL(wp) ::  height_int                      !<
     
    216205!-- Define MPI derived datatype for FORTRAN datatype particle_type (see module
    217206!-- particle_attributes). Integer length is 4 byte, Real is 8 byte
    218 #if defined( __twocachelines )
    219     blocklengths(1)  =  7;  blocklengths(2)  =  18;  blocklengths(3)  =   1
    220     displacements(1) =  0;  displacements(2) =  64;  displacements(3) = 128
    221 
    222     types(1) = MPI_REAL                               ! 64 bit words
    223     types(2) = MPI_INTEGER                            ! 32 Bit words
    224     types(3) = MPI_UB
    225 #else
    226207    blocklengths(1)  = 19;  blocklengths(2)  =   6;  blocklengths(3)  =   1
    227208    displacements(1) =  0;  displacements(2) = 152;  displacements(3) = 176
     
    230211    types(2) = MPI_INTEGER
    231212    types(3) = MPI_UB
    232 #endif
    233213    CALL MPI_TYPE_STRUCT( 3, blocklengths, displacements, types, &
    234214                          mpi_particle_type, ierr )
     
    293273!
    294274!-- Allocate arrays required for calculating particle SGS velocities
    295     IF ( use_sgs_for_particles )  THEN
     275    IF ( use_sgs_for_particles  .AND.  .NOT. cloud_droplets )  THEN
    296276       ALLOCATE( de_dx(nzb:nzt+1,nysg:nyng,nxlg:nxrg), &
    297277                 de_dy(nzb:nzt+1,nysg:nyng,nxlg:nxrg), &
     
    429409!--    Allocate particle arrays and set attributes of the initial set of
    430410!--    particles, which can be also periodically released at later times.
    431 !--    Also allocate array for particle tail coordinates, if needed.
    432411       ALLOCATE( prt_count(nzb:nzt+1,nysg:nyng,nxlg:nxrg), &
    433412                 grid_particles(nzb+1:nzt,nys:nyn,nxl:nxr) )
     
    443422!--    occur within restart runs). The reason for this is still not clear
    444423!--    and may be presumably caused by errors in the respective user-interface.
    445 #if defined( __twocachelines )
    446        zero_particle = particle_type( 0.0_wp, 0.0_sp, 0.0_sp, 0.0_sp, 0.0_sp,  &
    447                                       0.0_sp, 0.0_sp, 0.0_wp, 0.0_wp, 0.0_wp,  &
    448                                       0, .FALSE., 0.0_wp, 0.0_wp, 0.0_wp,      &
    449                                       0.0_sp, 0.0_sp, 0.0_sp, 0.0_sp, 0.0_sp,  &
    450                                       0.0_sp, 0, 0, 0, -1)
    451 #else
    452424       zero_particle = particle_type( 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp,  &
    453425                                      0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp,  &
     
    455427                                      0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0, 0, 0, &
    456428                                      0, .FALSE., -1)
    457 #endif
     429
    458430       particle_groups = particle_groups_type( 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp )
    459 
    460 !
    461 !--    Set the default particle size used for dvrp plots
    462        IF ( dvrp_psize == 9999999.9_wp )  dvrp_psize = 0.2_wp * dx
    463431
    464432!
     
    506474       ENDIF
    507475
    508 !
    509 !--    Check if particles are really uniform in color and radius (dvrp_size)
    510 !--    (uniform_particles is preset TRUE)
    511        IF ( uniform_particles )  THEN
    512           DO  ip = nxl, nxr
    513              DO  jp = nys, nyn
    514                 DO  kp = nzb+1, nzt
    515 
    516                    n = prt_count(kp,jp,ip)
    517                    IF ( MINVAL( grid_particles(kp,jp,ip)%particles(1:n)%dvrp_psize  ) ==     &
    518                         MAXVAL( grid_particles(kp,jp,ip)%particles(1:n)%dvrp_psize  )  .AND. &
    519                         MINVAL( grid_particles(kp,jp,ip)%particles(1:n)%class ) ==           &
    520                         MAXVAL( grid_particles(kp,jp,ip)%particles(1:n)%class ) )  THEN
    521                       uniform_particles_l = .TRUE.
    522                    ELSE
    523                       uniform_particles_l = .FALSE.
    524                    ENDIF
    525 
    526                 ENDDO
    527              ENDDO
    528           ENDDO
    529 
    530 #if defined( __parallel )
    531           IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
    532           CALL MPI_ALLREDUCE( uniform_particles_l, uniform_particles, 1,       &
    533                               MPI_LOGICAL, MPI_LAND, comm2d, ierr )
    534 #else
    535           uniform_particles = uniform_particles_l
    536 #endif
    537 
    538        ENDIF
    539 
    540 !
    541 !--    Particles will probably become none-uniform, if their size and color
    542 !--    will be determined by flow variables
    543        IF ( particle_color /= 'none'  .OR.  particle_dvrpsize /= 'none' )  THEN
    544           uniform_particles = .FALSE.
    545        ENDIF
    546 
    547 ! !kk    Not implemented aft individual particle array fort every gridcell
    548 ! !
    549 ! !--    Set the beginning of the particle tails and their age
    550 !        IF ( use_particle_tails )  THEN
    551 ! !
    552 ! !--       Choose the maximum number of tails with respect to the maximum number
    553 ! !--       of particles and skip_particles_for_tail
    554 !           maximum_number_of_tails = maximum_number_of_particles / &
    555 !                                     skip_particles_for_tail
    556 !
    557 ! !
    558 ! !--       Create a minimum number of tails in case that there is no tail
    559 ! !--       initially (otherwise, index errors will occur when adressing the
    560 ! !--       arrays below)
    561 !           IF ( maximum_number_of_tails == 0 )  maximum_number_of_tails = 10
    562 !
    563 !           ALLOCATE( particle_tail_coordinates(maximum_number_of_tailpoints,5, &
    564 !                     maximum_number_of_tails),                                 &
    565 !                     new_tail_id(maximum_number_of_tails),                     &
    566 !                     tail_mask(maximum_number_of_tails) )
    567 !
    568 !           particle_tail_coordinates  = 0.0_wp
    569 !           minimum_tailpoint_distance = minimum_tailpoint_distance**2
    570 !           number_of_initial_tails    = number_of_tails
    571 !
    572 !           nn = 0
    573 !           DO  n = 1, number_of_particles
    574 ! !
    575 ! !--          Only for those particles marked above with a provisional tail_id
    576 ! !--          tails will be created. Particles now get their final tail_id.
    577 !              IF ( particles(n)%tail_id /= 0 )  THEN
    578 !
    579 !                 nn = nn + 1
    580 !                 particles(n)%tail_id = nn
    581 !
    582 !                 particle_tail_coordinates(1,1,nn) = particles(n)%x
    583 !                 particle_tail_coordinates(1,2,nn) = particles(n)%y
    584 !                 particle_tail_coordinates(1,3,nn) = particles(n)%z
    585 !                 particle_tail_coordinates(1,4,nn) = particles(n)%class
    586 !                 particles(n)%tailpoints = 1
    587 !                 IF ( minimum_tailpoint_distance /= 0.0_wp )  THEN
    588 !                    particle_tail_coordinates(2,1,nn) = particles(n)%x
    589 !                    particle_tail_coordinates(2,2,nn) = particles(n)%y
    590 !                    particle_tail_coordinates(2,3,nn) = particles(n)%z
    591 !                    particle_tail_coordinates(2,4,nn) = particles(n)%class
    592 !                    particle_tail_coordinates(1:2,5,nn) = 0.0_wp
    593 !                    particles(n)%tailpoints = 2
    594 !                 ENDIF
    595 !
    596 !              ENDIF
    597 !           ENDDO
    598 !        ENDIF
    599 !
    600 ! !
    601 ! !--    Plot initial positions of particles (only if particle advection is
    602 ! !--    switched on from the beginning of the simulation (t=0))
    603 !        IF ( particle_advection_start == 0.0_wp )  CALL data_output_dvrp
    604 
    605476    ENDIF
    606477
     
    641512    INTEGER(iwp)               ::  n           !<
    642513    INTEGER(iwp)               ::  new_size    !<
    643     INTEGER(iwp)               ::  nn          !<
    644514
    645515    INTEGER(iwp), INTENT(IN)   ::  phase       !<
     
    691561
    692562                            n = n + 1
    693 #if defined( __twocachelines )
    694                             tmp_particle%x             = pos_x
    695                             tmp_particle%y             = pos_y
    696                             tmp_particle%z             = pos_z
    697                             tmp_particle%age           = 0.0_sp
    698                             tmp_particle%age_m         = 0.0_sp
    699                             tmp_particle%dt_sum        = 0.0_wp
    700                             tmp_particle%dvrp_psize    = dvrp_psize
    701                             tmp_particle%e_m           = 0.0_sp
    702                             IF ( curvature_solution_effects )  THEN
    703 !
    704 !--                            Initial values (internal timesteps, derivative)
    705 !--                            for Rosenbrock method
    706                                tmp_particle%rvar1      = 1.0E-12_wp
    707                                tmp_particle%rvar2      = 1.0E-3_wp
    708                                tmp_particle%rvar3      = -9999999.9_wp
    709                             ELSE
    710 !
    711 !--                            Initial values for SGS velocities
    712                                tmp_particle%rvar1      = 0.0_wp
    713                                tmp_particle%rvar2      = 0.0_wp
    714                                tmp_particle%rvar3      = 0.0_wp
    715                             ENDIF
    716                             tmp_particle%speed_x       = 0.0_sp
    717                             tmp_particle%speed_y       = 0.0_sp
    718                             tmp_particle%speed_z       = 0.0_sp
    719                             tmp_particle%origin_x      = pos_x
    720                             tmp_particle%origin_y      = pos_y
    721                             tmp_particle%origin_z      = pos_z
    722                             tmp_particle%radius        = particle_groups(i)%radius
    723                             tmp_particle%weight_factor = initial_weighting_factor
    724                             tmp_particle%class         = 1
    725                             tmp_particle%group         = i
    726                             tmp_particle%tailpoints    = 0
    727                             tmp_particle%particle_mask = .TRUE.
    728 #else
    729563                            tmp_particle%x             = pos_x
    730564                            tmp_particle%y             = pos_y
     
    733567                            tmp_particle%age_m         = 0.0_wp
    734568                            tmp_particle%dt_sum        = 0.0_wp
    735                             tmp_particle%dvrp_psize    = dvrp_psize
     569                            tmp_particle%dvrp_psize    = 0.0_wp !unused
    736570                            tmp_particle%e_m           = 0.0_wp
    737571                            IF ( curvature_solution_effects )  THEN
     
    759593                            tmp_particle%class         = 1
    760594                            tmp_particle%group         = i
    761                             tmp_particle%tailpoints    = 0
     595                            tmp_particle%tailpoints    = 0     !unused
    762596                            tmp_particle%particle_mask = .TRUE.
    763 #endif
    764                             IF ( use_particle_tails  .AND. &
    765                                  MOD( n, skip_particles_for_tail ) == 0 )  THEN
    766                                number_of_tails         = number_of_tails + 1
    767 !
    768 !--                            This is a temporary provisional setting (see
    769 !--                            further below!)
    770                                tmp_particle%tail_id    = number_of_tails
    771                             ELSE
    772                                tmp_particle%tail_id    = 0
    773                             ENDIF
     597                            tmp_particle%tail_id       = 0     !unused
     598
    774599!
    775600!--                         Determine the grid indices of the particle position
     
    913738    ENDDO
    914739!
    915 !-- Calculate the number of particles and tails of the total domain
     740!-- Calculate the number of particles of the total domain
    916741#if defined( __parallel )
    917742    IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
    918743    CALL MPI_ALLREDUCE( number_of_particles, total_number_of_particles, 1, &
    919744    MPI_INTEGER, MPI_SUM, comm2d, ierr )
    920     IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
    921     CALL MPI_ALLREDUCE( number_of_tails, total_number_of_tails, 1, &
    922     MPI_INTEGER, MPI_SUM, comm2d, ierr )
    923745#else
    924746    total_number_of_particles = number_of_particles
    925     total_number_of_tails     = number_of_tails
    926747#endif
    927748
Note: See TracChangeset for help on using the changeset viewer.