Ignore:
Timestamp:
Apr 11, 2014 5:15:14 PM (11 years ago)
Author:
hoffmann
Message:

new Lagrangian particle structure integrated

File:
1 edited

Legend:

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

    r1329 r1359  
    2020! Current revisions:
    2121! ------------------
    22 !
     22! New particle structure integrated.
     23! Kind definition added to all floating point numbers.
     24! lpm_init changed form a subroutine to a module.
    2325!
    2426! Former revisions:
     
    5355        ONLY:  iran, message_string, netcdf_data_format
    5456
     57    USE lpm_init_mod,                                                          &
     58        ONLY: lpm_create_particle, PHASE_RELEASE
     59
    5560    USE grid_variables,                                                        &
    5661        ONLY:  dx, dy
     
    6267
    6368    USE particle_attributes,                                                   &
    64         ONLY:  initial_particles, iran_part, maximum_number_of_particles,      &
    65                maximum_number_of_tails, minimum_tailpoint_distance,            &
    66                number_of_initial_particles, number_of_initial_tails,           &
    67                number_of_particles, number_of_tails, particles,                &
    68                particle_tail_coordinates, pdx, pdy, pdz, psb, psl, psn, psr,   &
    69                pss, pst, random_start_position, use_particle_tails
    70 
    71     USE random_function_mod,                                                   &
    72         ONLY:  random_function
     69        ONLY:  minimum_tailpoint_distance, number_of_tails, particles,         &
     70               particle_tail_coordinates, use_particle_tails
    7371
    7472    IMPLICIT NONE
     
    8078
    8179
     80    CALL lpm_create_particle(PHASE_RELEASE)
    8281!
    83 !-- Check, if particle storage must be extended
    84     IF ( number_of_particles + number_of_initial_particles > &
    85          maximum_number_of_particles  )  THEN
    86        IF ( netcdf_data_format < 3 )  THEN
    87           message_string = 'maximum_number_of_particles needs to be increa' // &
    88                            'sed &but this is not allowed with netcdf_data_' // &
    89                            'format < 3'
    90           CALL message( 'lpm_release_set', 'PA0146', 2, 2, -1, 6, 1 )
    91        ELSE
    92           CALL lpm_extend_particle_array( number_of_initial_particles )
    93        ENDIF
    94     ENDIF
     82!-- particle tails currently not available
     83! !
     84! !-- Set the beginning of the new particle tails and their age
     85!     IF ( use_particle_tails )  THEN
     86!
     87!        DO  n = is, ie
     88! !
     89! !--       New particles which should have a tail, already have got a
     90! !--       provisional tail id unequal zero (see lpm_init)
     91!           IF ( particles(n)%tail_id /= 0 )  THEN
     92!
     93!              number_of_tails = number_of_tails + 1
     94!              nn = number_of_tails
     95!              particles(n)%tail_id = nn   ! set the final tail id
     96!              particle_tail_coordinates(1,1,nn) = particles(n)%x
     97!              particle_tail_coordinates(1,2,nn) = particles(n)%y
     98!              particle_tail_coordinates(1,3,nn) = particles(n)%z
     99!              particle_tail_coordinates(1,4,nn) = particles(n)%class
     100!              particles(n)%tailpoints = 1
     101!
     102!              IF ( minimum_tailpoint_distance /= 0.0 )  THEN
     103!                 particle_tail_coordinates(2,1,nn) = particles(n)%x
     104!                 particle_tail_coordinates(2,2,nn) = particles(n)%y
     105!                 particle_tail_coordinates(2,3,nn) = particles(n)%z
     106!                 particle_tail_coordinates(2,4,nn) = particles(n)%class
     107!                 particle_tail_coordinates(1:2,5,nn) = 0.0_wp
     108!                 particles(n)%tailpoints = 2
     109!              ENDIF
     110!
     111!           ENDIF
     112!
     113!        ENDDO
     114!
     115!     ENDIF
    95116
    96 !
    97 !-- Check, if tail storage must be extended
    98     IF ( use_particle_tails )  THEN
    99        IF ( number_of_tails + number_of_initial_tails > &
    100             maximum_number_of_tails  )  THEN
    101           IF ( netcdf_data_format < 3 )  THEN
    102              message_string = 'maximum_number_of_tails needs to be increas' // &
    103                               'ed &but this is not allowed with netcdf_dat' // &
    104                               'a_format < 3'
    105              CALL message( 'lpm_release_set', 'PA0147', 2, 2, -1, 6, 1 )
    106           ELSE
    107              CALL lpm_extend_tail_array( number_of_initial_tails )
    108           ENDIF
    109        ENDIF
    110     ENDIF
    111 
    112     IF ( number_of_initial_particles /= 0 )  THEN
    113 
    114        is = number_of_particles + 1
    115        ie = number_of_particles + number_of_initial_particles
    116        particles(is:ie) = initial_particles(1:number_of_initial_particles)
    117 !
    118 !--    Add random fluctuation to particle positions. Particles should
    119 !--    remain in the subdomain.
    120        IF ( random_start_position )  THEN
    121 
    122           DO  n = is, ie
    123 
    124              IF ( psl(particles(n)%group) /= psr(particles(n)%group) )  THEN
    125                 particles(n)%x = particles(n)%x +                         &
    126                                  ( random_function( iran_part ) - 0.5 ) * &
    127                                  pdx(particles(n)%group)
    128                 IF ( particles(n)%x  <=  ( nxl - 0.5 ) * dx )  THEN
    129                    particles(n)%x = ( nxl - 0.4999999999 ) * dx
    130                 ELSEIF ( particles(n)%x  >=  ( nxr + 0.5 ) * dx )  THEN
    131                    particles(n)%x = ( nxr + 0.4999999999 ) * dx
    132                 ENDIF
    133              ENDIF
    134 
    135              IF ( pss(particles(n)%group) /= psn(particles(n)%group) )  THEN
    136                 particles(n)%y = particles(n)%y +                         &
    137                                  ( random_function( iran_part ) - 0.5 ) * &
    138                                  pdy(particles(n)%group)
    139                 IF ( particles(n)%y  <=  ( nys - 0.5 ) * dy )  THEN
    140                    particles(n)%y = ( nys - 0.4999999999 ) * dy
    141                 ELSEIF ( particles(n)%y  >=  ( nyn + 0.5 ) * dy )  THEN
    142                    particles(n)%y = ( nyn + 0.4999999999 ) * dy
    143                 ENDIF
    144              ENDIF
    145 
    146              IF ( psb(particles(n)%group) /= pst(particles(n)%group) )  THEN
    147                 particles(n)%z = particles(n)%z +                         &
    148                                  ( random_function( iran_part ) - 0.5 ) * &
    149                                  pdz(particles(n)%group)
    150              ENDIF
    151 
    152           ENDDO
    153 
    154        ENDIF
    155 
    156 !
    157 !--    Set the beginning of the new particle tails and their age
    158        IF ( use_particle_tails )  THEN
    159 
    160           DO  n = is, ie
    161 !
    162 !--          New particles which should have a tail, already have got a
    163 !--          provisional tail id unequal zero (see lpm_init)
    164              IF ( particles(n)%tail_id /= 0 )  THEN
    165 
    166                 number_of_tails = number_of_tails + 1
    167                 nn = number_of_tails
    168                 particles(n)%tail_id = nn   ! set the final tail id
    169                 particle_tail_coordinates(1,1,nn) = particles(n)%x
    170                 particle_tail_coordinates(1,2,nn) = particles(n)%y
    171                 particle_tail_coordinates(1,3,nn) = particles(n)%z
    172                 particle_tail_coordinates(1,4,nn) = particles(n)%class
    173                 particles(n)%tailpoints = 1
    174 
    175                 IF ( minimum_tailpoint_distance /= 0.0 )  THEN
    176                    particle_tail_coordinates(2,1,nn) = particles(n)%x
    177                    particle_tail_coordinates(2,2,nn) = particles(n)%y
    178                    particle_tail_coordinates(2,3,nn) = particles(n)%z
    179                    particle_tail_coordinates(2,4,nn) = particles(n)%class
    180                    particle_tail_coordinates(1:2,5,nn) = 0.0
    181                    particles(n)%tailpoints = 2
    182                 ENDIF
    183 
    184              ENDIF
    185 
    186           ENDDO
    187 
    188        ENDIF
    189 
    190        number_of_particles = number_of_particles + number_of_initial_particles
    191 
    192     ENDIF
    193117
    194118 END SUBROUTINE lpm_release_set
Note: See TracChangeset for help on using the changeset viewer.