source: palm/trunk/SOURCE/set_particle_attributes.f90 @ 448

Last change on this file since 448 was 392, checked in by raasch, 15 years ago

New:
---

Adapted for machine lck
(mrun, mbuild, subjob)

bc_lr/bc_ns in most subroutines replaced by LOGICAL variables bc_lr_cyc,
bc_ns_cyc for speed optimization
(check_parameters, diffusion_u, diffusion_v, diffusion_w, modules)

Additional timestep criterion in case of simulations with plant canopy (timestep)

Check for illegal entries in section_xy|xz|yz that exceed nz+1|ny+1|nx+1
(check_parameters)

Clipping of dvrp output implemented. Default colourtable for particles
implemented, particle attributes (color, dvrp_size) can be set with new
parameters particle_color, particle_dvrpsize, color_interval,
dvrpsize_interval (init_dvrp, data_output_dvrp, modules, user_data_output_dvrp).
Slicer attributes (dvrp) are set with new routine set_slicer_attributes_dvrp
and are controlled with existing parameters slicer_range_limits.
(set_slicer_attributes_dvrp)

Ocean atmosphere coupling allows to use independent precursor runs in order
to account for different spin-up times. The time when coupling has to be
started is given by new inipar parameter coupling_start_time. The precursor
ocean run has to be started using new mrun option "-y" in order to add
appendix "_O" to all output files.
(check_for_restart, check_parameters, data_output_2d, data_output_3d,
data_output_profiles, data_output_ptseries, data_output_spectra,
data_output_tseries, header, init_coupling, modules, mrun,
parin, read_var_list, surface_coupler, time_integration, write_var_list)

Polygon reduction for topography and ground plate isosurface. Reduction level
for buildings can be chosen with parameter cluster_size. (init_dvrp)

External pressure gradient (check_parameters, header, init_3d_model, modules,
parin, prognostic_equations, read_var_list, write_var_list)

New topography case 'single_street_canyon' (header, init_grid, modules, parin,
read_var_list, user_check_parameters, user_header, user_init_grid, write_var_list)

Option to predefine a target bulk velocity for conserve_volume_flow
(check_parameters, header, init_3d_model, modules, parin, read_var_list,
write_var_list)

Option for user defined 2D data output in xy cross sections at z=nzb+1
(data_output_2d, user_data_output_2d)

xy cross section output of surface heatfluxes (latent, sensible)
(average_3d_data, check_parameters, data_output_2d, modules, read_3d_binary,
sum_up_3d_data, write_3d_binary)

average_3d_data, check_for_restart, check_parameters, data_output_2d, data_output_3d, data_output_dvrp, data_output_profiles, data_output_ptseries, data_output_spectra, data_output_tseries, init_coupling, init_dvrp, init_grid, init_3d_model, header, mbuild, modules, mrun, package_parin, parin, prognostic_equations, read_3d_binary, read_var_list, subjob, surface_coupler, timestep, time_integration, user_check_parameters, user_data_output_2d, user_data_output_dvrp, user_header, user_init_grid, write_3d_binary, write_var_list

New: set_particle_attributes, set_slicer_attributes_dvrp

Changed:


lcmuk changed to lc to avoid problems with Intel compiler on sgi-ice
(poisfft)

For extended NetCDF files, the updated title attribute includes an update of
time_average_text where appropriate. (netcdf)

In case of restart runs without extension, initial profiles are not written
to NetCDF-file anymore. (data_output_profiles, modules, read_var_list, write_var_list)

Small change in formatting of the message handling routine concering the output in the
job protocoll. (message)

initializing_actions='read_data_for_recycling' renamed to 'cyclic_fill', now
independent of turbulent_inflow (check_parameters, header, init_3d_model)

2 NetCDF error numbers changed. (data_output_3d)

A Link to the website appendix_a.html is printed for further information
about the possible errors. (message)

Temperature gradient criterion for estimating the boundary layer height
replaced by the gradient criterion of Sullivan et al. (1998). (flow_statistics)

NetCDF unit attribute in timeseries output in case of statistic regions added
(netcdf)

Output of NetCDF messages with aid of message handling routine.
(check_open, close_file, data_output_2d, data_output_3d,
data_output_profiles, data_output_ptseries, data_output_spectra,
data_output_tseries, netcdf, output_particles_netcdf)

Output of messages replaced by message handling routine.
(advec_particles, advec_s_bc, buoyancy, calc_spectra, check_for_restart,
check_open, coriolis, cpu_log, data_output_2d, data_output_3d, data_output_dvrp,
data_output_profiles, data_output_spectra, fft_xy, flow_statistics, header,
init_1d_model, init_3d_model, init_dvrp, init_grid, init_particles, init_pegrid,
netcdf, parin, plant_canopy_model, poisfft_hybrid, poismg, read_3d_binary,
read_var_list, surface_coupler, temperton_fft, timestep, user_actions,
user_data_output_dvrp, user_dvrp_coltab, user_init_grid, user_init_plant_canopy,
user_parin, user_read_restart_data, user_spectra )

Maximum number of tails is calculated from maximum number of particles and
skip_particles_for_tail (init_particles)

Value of vertical_particle_advection may differ for each particle group
(advec_particles, header, modules)

First constant in array den also defined as type double. (eqn_state_seawater)

Parameter dvrp_psize moved from particles_par to dvrp_graphics_par. (package_parin)

topography_grid_convention moved from userpar to inipar (check_parameters,
header, parin, read_var_list, user_check_parameters, user_header,
user_init_grid, user_parin, write_var_list)

Default value of grid_matching changed to strict.

Adjustments for runs on lcxt4 (necessary due to an software update on CRAY) and
for coupled runs on ibmy (mrun, subjob)

advec_particles, advec_s_bc, buoyancy, calc_spectra, check_for_restart, check_open, check_parameters, close_file, coriolis, cpu_log, data_output_2d, data_output_3d, data_output_dvrp, data_output_profiles, data_output_ptseries, data_output_spectra, data_output_tseries, eqn_state_seawater, fft_xy, flow_statistics, header, init_1d_model, init_3d_model, init_dvrp, init_grid, init_particles, init_pegrid, message, mrun, netcdf, output_particles_netcdf, package_parin, parin, plant_canopy_model, poisfft, poisfft_hybrid, poismg, read_3d_binary, read_var_list, sort_particles, subjob, user_check_parameters, user_header, user_init_grid, user_parin, surface_coupler, temperton_fft, timestep, user_actions, user_data_output_dvrp, user_dvrp_coltab, user_init_grid, user_init_plant_canopy, user_parin, user_read_restart_data, user_spectra, write_var_list

Errors:


Bugfix: Initial hydrostatic pressure profile in case of ocean runs is now
calculated in 5 iteration steps. (init_ocean)

Bugfix: wrong sign in buoyancy production of ocean part in case of not using
the reference density (only in 3D routine production_e) (production_e)

Bugfix: output of averaged 2d/3d quantities requires that an avaraging
interval has been set, respective error message is included (check_parameters)

Bugfix: Output on unit 14 only if requested by write_binary.
(user_last_actions)

Bugfix to avoid zero division by km_neutral (production_e)

Bugfix for extended NetCDF files: In order to avoid 'data mode' errors if
updated attributes are larger than their original size, NF90_PUT_ATT is called
in 'define mode' enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a
possible performance loss; an alternative strategy would be to ensure equal
attribute size in a job chain. (netcdf)

Bugfix: correction of initial volume flow for non-flat topography (init_3d_model)
Bugfix: zero initialization of arrays within buildings for 'cyclic_fill' (init_3d_model)

Bugfix: to_be_resorted => s_av for time-averaged scalars (data_output_2d, data_output_3d)

Bugfix: error in formatting the output (message)

Bugfix: avoid that ngp_2dh_s_inner becomes zero (init_3_model)

Typographical error: unit of wpt in dots_unit (modules)

Bugfix: error in check, if particles moved further than one subdomain length.
This check must not be applied for newly released particles. (advec_particles)

Bugfix: several tail counters are initialized, particle_tail_coordinates is
only written to file if its third index is > 0, arrays for tails are allocated
with a minimum size of 10 tails if there is no tail initially (init_particles,
advec_particles)

Bugfix: pressure included for profile output (check_parameters)

Bugfix: Type of count and count_rate changed to default INTEGER on NEC machines
(cpu_log)

Bugfix: output if particle time series only if particle advection is switched
on. (time_integration)

Bugfix: qsws was calculated in case of constant heatflux = .FALSE. (prandtl_fluxes)

Bugfix: averaging along z is not allowed for 2d quantities (e.g. u* and z0) (data_output_2d)

Typographical errors (netcdf)

If the inversion height calculated by the prerun is zero, inflow_damping_height
must be explicitly specified (init_3d_model)

Small bugfix concerning 3d 64bit netcdf output format (header)

Bugfix: dt_fixed removed from the restart file, because otherwise, no change
from a fixed to a variable timestep would be possible in restart runs.
(read_var_list, write_var_list)

Bugfix: initial setting of time_coupling in coupled restart runs (time_integration)

advec_particles, check_parameters, cpu_log, data_output_2d, data_output_3d, header, init_3d_model, init_particles, init_ocean, modules, netcdf, prandtl_fluxes, production_e, read_var_list, time_integration, user_last_actions, write_var_list

  • Property svn:keywords set to Id
File size: 8.8 KB
RevLine 
[264]1 SUBROUTINE set_particle_attributes
2
3!------------------------------------------------------------------------------!
4! Actual revisions:
5! -----------------
6!
7!
8! Former revisions:
9! -----------------
10! $Id: set_particle_attributes.f90 392 2009-09-24 10:39:14Z raasch $
11!
[392]12! 271 2009-03-26 00:47:14Z raasch
13! Initial version
[264]14!
15! Description:
16! ------------
17! This routine sets certain particle attributes depending on the values that
18! other PALM variables have at the current particle position.
19!------------------------------------------------------------------------------!
20
21    USE arrays_3d
22    USE control_parameters
23    USE cpulog
24    USE dvrp_variables
25    USE grid_variables
26    USE indices
27    USE interfaces
28    USE particle_attributes
29    USE pegrid
30    USE statistics
31
32    IMPLICIT NONE
33
34    INTEGER ::  i, j, k, n
[268]35    REAL    ::  aa, absuv, bb, cc, dd, gg, height, pt_int, pt_int_l, pt_int_u, &
36                u_int, u_int_l, u_int_u, v_int, v_int_l, v_int_u, w_int,       &
37                w_int_l, w_int_u, x, y
[264]38
39
[271]40    CALL cpu_log( log_point_s(49), 'set_particle_attrib', 'start' )
[264]41
42!
43!-- Set particle color
44    IF ( particle_color == 'absuv' )  THEN
45
[266]46!
47!--    Set particle color depending on the absolute value of the horizontal
48!--    velocity
49       DO  n = 1, number_of_particles
50!
51!--       Interpolate u velocity-component, determine left, front, bottom
52!--       index of u-array
53          i = ( particles(n)%x + 0.5 * dx ) * ddx
54          j =   particles(n)%y * ddy
55          k = ( particles(n)%z + 0.5 * dz * atmos_ocean_sign ) / dz  &
56              + offset_ocean_nzt                     ! only exact if equidistant
57
58!
59!--       Interpolation of the velocity components in the xy-plane
60          x  = particles(n)%x + ( 0.5 - i ) * dx
61          y  = particles(n)%y - j * dy
62          aa = x**2          + y**2
63          bb = ( dx - x )**2 + y**2
64          cc = x**2          + ( dy - y )**2
65          dd = ( dx - x )**2 + ( dy - y )**2
66          gg = aa + bb + cc + dd
67
68          u_int_l = ( ( gg - aa ) * u(k,j,i)   + ( gg - bb ) * u(k,j,i+1)   &
69                    + ( gg - cc ) * u(k,j+1,i) + ( gg - dd ) * u(k,j+1,i+1) &
70                    ) / ( 3.0 * gg ) - u_gtrans
71          IF ( k+1 == nzt+1 )  THEN
72             u_int = u_int_l
73          ELSE
74             u_int_u = ( ( gg-aa ) * u(k+1,j,i)   + ( gg-bb ) * u(k+1,j,i+1)   &
75                       + ( gg-cc ) * u(k+1,j+1,i) + ( gg-dd ) * u(k+1,j+1,i+1) &
76                       ) / ( 3.0 * gg ) - u_gtrans
77             u_int = u_int_l + ( particles(n)%z - zu(k) ) / dz * &
78                               ( u_int_u - u_int_l )
79          ENDIF
80
81!
82!--       Same procedure for interpolation of the v velocity-component (adopt
83!--       index k from u velocity-component)
84          i =   particles(n)%x * ddx
85          j = ( particles(n)%y + 0.5 * dy ) * ddy
86
87          x  = particles(n)%x - i * dx
88          y  = particles(n)%y + ( 0.5 - j ) * dy
89          aa = x**2          + y**2
90          bb = ( dx - x )**2 + y**2
91          cc = x**2          + ( dy - y )**2
92          dd = ( dx - x )**2 + ( dy - y )**2
93          gg = aa + bb + cc + dd
94
95          v_int_l = ( ( gg - aa ) * v(k,j,i)   + ( gg - bb ) * v(k,j,i+1)   &
96                 + ( gg - cc ) * v(k,j+1,i) + ( gg - dd ) * v(k,j+1,i+1) &
97                 ) / ( 3.0 * gg ) - v_gtrans
98          IF ( k+1 == nzt+1 )  THEN
99             v_int = v_int_l
100          ELSE
101             v_int_u = ( ( gg-aa ) * v(k+1,j,i)   + ( gg-bb ) * v(k+1,j,i+1)   &
102                       + ( gg-cc ) * v(k+1,j+1,i) + ( gg-dd ) * v(k+1,j+1,i+1) &
103                       ) / ( 3.0 * gg ) - v_gtrans
104             v_int = v_int_l + ( particles(n)%z - zu(k) ) / dz * &
105                               ( v_int_u - v_int_l )
106          ENDIF
107
108          absuv = SQRT( u_int**2 + v_int**2 )
109
110!
111!--       Limit values by the given interval and normalize to interval [0,1]
112          absuv = MIN( absuv, color_interval(2) )
113          absuv = MAX( absuv, color_interval(1) )
114
115          absuv = ( absuv - color_interval(1) ) / &
116                  ( color_interval(2) - color_interval(1) )
117
118!
119!--       Number of available colors is defined in init_dvrp
120          particles(n)%color = 1 + absuv * ( dvrp_colortable_entries_prt - 1 )
121
122       ENDDO
123
[264]124    ELSEIF ( particle_color == 'pt*' )  THEN
125!
126!--    Set particle color depending on the resolved scale temperature
127!--    fluctuation.
128!--    First, calculate the horizontal average of the potential temperature
129!--    (This is also done in flow_statistics, but flow_statistics is called
130!--    after this routine.)
131       sums_l(:,4,0) = 0.0
132       DO  i = nxl, nxr
133          DO  j =  nys, nyn
134             DO  k = nzb, nzt+1
135                sums_l(k,4,0) = sums_l(k,4,0) + pt(k,j,i)
136             ENDDO
137          ENDDO
138       ENDDO
139
140#if defined( __parallel )
141
142       CALL MPI_ALLREDUCE( sums_l(nzb,4,0), sums(nzb,4), nzt+2-nzb, &
143                           MPI_REAL, MPI_SUM, comm2d, ierr )
144
145#else
146
147       sums(:,4) = sums_l(:,4,0)
148
149#endif
150
151       sums(:,4) = sums(:,4) / ngp_2dh(0)
152
153       DO  n = 1, number_of_particles
154!
155!--       Interpolate temperature to the current particle position
156          i = particles(n)%x * ddx
157          j = particles(n)%y * ddy
158          k = ( particles(n)%z + 0.5 * dz * atmos_ocean_sign ) / dz  &
159              + offset_ocean_nzt                     ! only exact if equidistant
160
161          x  = particles(n)%x - i * dx
162          y  = particles(n)%y - j * dy
163          aa = x**2          + y**2
164          bb = ( dx - x )**2 + y**2
165          cc = x**2          + ( dy - y )**2
166          dd = ( dx - x )**2 + ( dy - y )**2
167          gg = aa + bb + cc + dd
168
169          pt_int_l = ( ( gg - aa ) * pt(k,j,i)   + ( gg - bb ) * pt(k,j,i+1)   &
170                     + ( gg - cc ) * pt(k,j+1,i) + ( gg - dd ) * pt(k,j+1,i+1) &
171                     ) / ( 3.0 * gg ) - sums(k,4)
172
173          pt_int_u = ( ( gg-aa ) * pt(k+1,j,i)   + ( gg-bb ) * pt(k+1,j,i+1)   &
174                     + ( gg-cc ) * pt(k+1,j+1,i) + ( gg-dd ) * pt(k+1,j+1,i+1) &
175                     ) / ( 3.0 * gg ) - sums(k,4)
176
177          pt_int = pt_int_l + ( particles(n)%z - zu(k) ) / dz * &
178                              ( pt_int_u - pt_int_l )
179
180!
181!--       Limit values by the given interval and normalize to interval [0,1]
182          pt_int = MIN( pt_int, color_interval(2) )
183          pt_int = MAX( pt_int, color_interval(1) )
184
185          pt_int = ( pt_int - color_interval(1) ) / &
186                   ( color_interval(2) - color_interval(1) )
187
188!
189!--       Number of available colors is defined in init_dvrp
190          particles(n)%color = 1 + pt_int * ( dvrp_colortable_entries_prt - 1 )
191
[266]192       ENDDO
[264]193
194    ELSEIF ( particle_color == 'z' )  THEN
[266]195!
196!--    Set particle color depending on the height above the bottom
197!--    boundary (z=0)
198       DO  n = 1, number_of_particles
[264]199
[266]200          height = particles(n)%z
201!
202!--       Limit values by the given interval and normalize to interval [0,1]
203          height = MIN( height, color_interval(2) )
204          height = MAX( height, color_interval(1) )
205
206          height = ( height - color_interval(1) ) / &
207                   ( color_interval(2) - color_interval(1) )
208
209!
210!--       Number of available colors is defined in init_dvrp
211          particles(n)%color = 1 + height * ( dvrp_colortable_entries_prt - 1 )
212
213       ENDDO
214
[264]215    ENDIF
216
217!
218!-- Set particle size for dvrp graphics
219    IF ( particle_dvrpsize == 'absw' )  THEN
220
221       DO  n = 1, number_of_particles
222!
223!--       Interpolate w-component to the current particle position
224          i = particles(n)%x * ddx
225          j = particles(n)%y * ddy
226          k = particles(n)%z / dz
227
228          x  = particles(n)%x - i * dx
229          y  = particles(n)%y - j * dy
230          aa = x**2          + y**2
231          bb = ( dx - x )**2 + y**2
232          cc = x**2          + ( dy - y )**2
233          dd = ( dx - x )**2 + ( dy - y )**2
234          gg = aa + bb + cc + dd
235
236          w_int_l = ( ( gg - aa ) * w(k,j,i)   + ( gg - bb ) * w(k,j,i+1)   &
237                    + ( gg - cc ) * w(k,j+1,i) + ( gg - dd ) * w(k,j+1,i+1) &
238                    ) / ( 3.0 * gg )
239
240          IF ( k+1 == nzt+1 )  THEN
241             w_int = w_int_l
242          ELSE
243             w_int_u = ( ( gg-aa ) * w(k+1,j,i)   + ( gg-bb ) * w(k+1,j,i+1)   &
244                       + ( gg-cc ) * w(k+1,j+1,i) + ( gg-dd ) * w(k+1,j+1,i+1) &
245                       ) / ( 3.0 * gg )
246             w_int = w_int_l + ( particles(n)%z - zw(k) ) / dz * &
247                               ( w_int_u - w_int_l )
248          ENDIF
249
[266]250!
251!--       Limit values by the given interval and normalize to interval [0,1]
252          w_int = ABS( w_int )
253          w_int = MIN( w_int, dvrpsize_interval(2) )
254          w_int = MAX( w_int, dvrpsize_interval(1) )
[264]255
[266]256          w_int = ( w_int - dvrpsize_interval(1) ) / &
257                  ( dvrpsize_interval(2) - dvrpsize_interval(1) )
258
259          particles(n)%dvrp_psize = ( 0.25 + w_int * 0.6 ) * dx
260
[264]261       ENDDO
262
263    ENDIF
264
[271]265    CALL cpu_log( log_point_s(49), 'set_particle_attrib', 'stop' )
[264]266
267
268 END SUBROUTINE set_particle_attributes
Note: See TracBrowser for help on using the repository browser.