source: palm/trunk/SOURCE/prandtl_fluxes.f90 @ 418

Last change on this file since 418 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: 12.4 KB
RevLine 
[1]1 SUBROUTINE prandtl_fluxes
2
3!------------------------------------------------------------------------------!
4! Actual revisions:
5! -----------------
[392]6!
[1]7!
8! Former revisions:
9! -----------------
[3]10! $Id: prandtl_fluxes.f90 392 2009-09-24 10:39:14Z heinze $
[77]11!
[392]12! 315 2009-05-13 10:57:59Z raasch
13! Saturation condition at (sea) surface is not used in precursor runs (only
14! in the following coupled runs)
15! Bugfix: qsws was calculated in case of constant heatflux = .FALSE.
16!
[198]17! 187 2008-08-06 16:25:09Z letzel
18! Bugfix: modification of the calculation of the vertical turbulent momentum
19! fluxes u'w' and v'w'
20! Bugfix: change definition of us_wall from 1D to 2D
21! Change: modification of the integrated version of the profile function for
22! momentum for unstable stratification (does not effect results)
23!
[110]24! 108 2007-08-24 15:10:38Z letzel
25! assume saturation at k=nzb_s_inner(j,i) for atmosphere coupled to ocean
26!
[77]27! 75 2007-03-22 09:54:05Z raasch
28! moisture renamed humidity
29!
[3]30! RCS Log replace by Id keyword, revision history cleaned up
31!
[1]32! Revision 1.19  2006/04/26 12:24:35  raasch
33! +OpenMP directives and optimization (array assignments replaced by DO loops)
34!
35! Revision 1.1  1998/01/23 10:06:06  raasch
36! Initial revision
37!
38!
39! Description:
40! ------------
41! Diagnostic computation of vertical fluxes in the Prandtl layer from the
42! values of the variables at grid point k=1
43!------------------------------------------------------------------------------!
44
45    USE arrays_3d
46    USE control_parameters
47    USE grid_variables
48    USE indices
49
50    IMPLICIT NONE
51
52    INTEGER ::  i, j, k
[108]53    REAL    ::  a, b, e_q, rifm, uv_total, z_p
[1]54
55!
56!-- Compute theta*
57    IF ( constant_heatflux )  THEN
58!
59!--    For a given heat flux in the Prandtl layer:
60!--    for u* use the value from the previous time step
61       !$OMP PARALLEL DO
62       DO  i = nxl-1, nxr+1
63          DO  j = nys-1, nyn+1
64             ts(j,i) = -shf(j,i) / ( us(j,i) + 1E-30 )
65!
66!--          ts must be limited, because otherwise overflow may occur in case of
67!--          us=0 when computing rif further below
68             IF ( ts(j,i) < -1.05E5 )  ts = -1.0E5
69             IF ( ts(j,i) >   1.0E5 )  ts =  1.0E5
70          ENDDO
71       ENDDO
72
73    ELSE
74!
75!--    For a given surface temperature:
76!--    (the Richardson number is still the one from the previous time step)
77       !$OMP PARALLEL DO PRIVATE( a, b, k, z_p )
78       DO  i = nxl-1, nxr+1
79          DO  j = nys-1, nyn+1
80
81             k   = nzb_s_inner(j,i)
82             z_p = zu(k+1) - zw(k)
83
84             IF ( rif(j,i) >= 0.0 )  THEN
85!
86!--             Stable stratification
87                ts(j,i) = kappa * ( pt(k+1,j,i) - pt(k,j,i) ) / (          &
88                                  LOG( z_p / z0(j,i) ) +                   &
89                                  5.0 * rif(j,i) * ( z_p - z0(j,i) ) / z_p &
90                                                                )
91             ELSE
92!
93!--             Unstable stratification
94                a = SQRT( 1.0 - 16.0 * rif(j,i) )
[187]95                b = SQRT( 1.0 - 16.0 * rif(j,i) * z0(j,i) / z_p )
96
97                ts(j,i) = kappa * ( pt(k+1,j,i) - pt(k,j,i) ) /  (         &
98                          LOG( z_p / z0(j,i) ) -                           &
99                          2.0 * LOG( ( 1.0 + a ) / ( 1.0 + b ) ) )
[1]100             ENDIF
101
102          ENDDO
103       ENDDO
104    ENDIF
105
106!
107!-- Compute z_p/L (corresponds to the Richardson-flux number)
[75]108    IF ( .NOT. humidity )  THEN
[1]109       !$OMP PARALLEL DO PRIVATE( k, z_p )
110       DO  i = nxl-1, nxr+1
111          DO  j = nys-1, nyn+1
112             k   = nzb_s_inner(j,i)
113             z_p = zu(k+1) - zw(k)
114             rif(j,i) = z_p * kappa * g * ts(j,i) / &
115                        ( pt(k+1,j,i) * ( us(j,i)**2 + 1E-30 ) )
116!
117!--          Limit the value range of the Richardson numbers.
118!--          This is necessary for very small velocities (u,v --> 0), because
119!--          the absolute value of rif can then become very large, which in
120!--          consequence would result in very large shear stresses and very
121!--          small momentum fluxes (both are generally unrealistic).
122             IF ( rif(j,i) < rif_min )  rif(j,i) = rif_min
123             IF ( rif(j,i) > rif_max )  rif(j,i) = rif_max
124          ENDDO
125       ENDDO
126    ELSE
127       !$OMP PARALLEL DO PRIVATE( k, z_p )
128       DO  i = nxl-1, nxr+1
129          DO  j = nys-1, nyn+1
130             k   = nzb_s_inner(j,i)
131             z_p = zu(k+1) - zw(k)
132             rif(j,i) = z_p * kappa * g *                            &
133                        ( ts(j,i) + 0.61 * pt(k+1,j,i) * qs(j,i) ) / &
134                        ( vpt(k+1,j,i) * ( us(j,i)**2 + 1E-30 ) )
135!
136!--          Limit the value range of the Richardson numbers.
137!--          This is necessary for very small velocities (u,v --> 0), because
138!--          the absolute value of rif can then become very large, which in
139!--          consequence would result in very large shear stresses and very
140!--          small momentum fluxes (both are generally unrealistic).
141             IF ( rif(j,i) < rif_min )  rif(j,i) = rif_min
142             IF ( rif(j,i) > rif_max )  rif(j,i) = rif_max
143          ENDDO
144       ENDDO       
145    ENDIF
146
147!
148!-- Compute u* at the scalars' grid points
149    !$OMP PARALLEL DO PRIVATE( a, b, k, uv_total, z_p )
150    DO  i = nxl, nxr
151       DO  j = nys, nyn
152
153          k   = nzb_s_inner(j,i)
154          z_p = zu(k+1) - zw(k)
155
156!
157!--       Compute the absolute value of the horizontal velocity
158          uv_total = SQRT( ( 0.5 * ( u(k+1,j,i) + u(k+1,j,i+1) ) )**2 + &
159                           ( 0.5 * ( v(k+1,j,i) + v(k+1,j+1,i) ) )**2   &
160                         )
161
162          IF ( rif(j,i) >= 0.0 )  THEN
163!
164!--          Stable stratification
165             us(j,i) = kappa * uv_total / (                                &
166                                  LOG( z_p / z0(j,i) ) +                   &
167                                  5.0 * rif(j,i) * ( z_p - z0(j,i) ) / z_p &
168                                          )
169          ELSE
170!
171!--          Unstable stratification
[187]172             a = SQRT( SQRT( 1.0 - 16.0 * rif(j,i) ) )
173             b = SQRT( SQRT( 1.0 - 16.0 * rif(j,i) / z_p * z0(j,i) ) )
174
175             us(j,i) = kappa * uv_total / (                                  &
176                       LOG( z_p / z0(j,i) ) -                                &
177                       LOG( ( 1.0 + a )**2 * ( 1.0 + a**2 ) / (              &
178                            ( 1.0 + b )**2 * ( 1.0 + b**2 )   ) ) +          &
179                            2.0 * ( ATAN( a ) - ATAN( b ) )                  &
180                                           )
[1]181          ENDIF
182       ENDDO
183    ENDDO
184
185!
[187]186!-- Values of us at ghost point locations are needed for the evaluation of usws
187!-- and vsws.
188    CALL exchange_horiz_2d( us )
189!
[1]190!-- Compute u'w' for the total model domain.
191!-- First compute the corresponding component of u* and square it.
192    !$OMP PARALLEL DO PRIVATE( a, b, k, rifm, z_p )
193    DO  i = nxl, nxr
194       DO  j = nys, nyn
195
196          k   = nzb_u_inner(j,i)
197          z_p = zu(k+1) - zw(k)
198
199!
200!--       Compute Richardson-flux number for this point
201          rifm = 0.5 * ( rif(j,i-1) + rif(j,i) )
202          IF ( rifm >= 0.0 )  THEN
203!
204!--          Stable stratification
205             usws(j,i) = kappa * u(k+1,j,i) / (                           &
206                                     LOG( z_p / z0(j,i) ) +               &
207                                     5.0 * rifm * ( z_p - z0(j,i) ) / z_p &
208                                              )
209          ELSE
210!
211!--          Unstable stratification
[187]212             a = SQRT( SQRT( 1.0 - 16.0 * rifm ) )
213             b = SQRT( SQRT( 1.0 - 16.0 * rifm / z_p * z0(j,i) ) )
214
215             usws(j,i) = kappa * u(k+1,j,i) / (                           &
216                         LOG( z_p / z0(j,i) ) -                           &
217                         LOG( (1.0 + a )**2 * ( 1.0 + a**2 ) / (          &
218                              (1.0 + b )**2 * ( 1.0 + b**2 )   ) ) +      &
219                              2.0 * ( ATAN( a ) - ATAN( b ) )             &
[1]220                                                 )
221          ENDIF
[187]222          usws(j,i) = -usws(j,i) * 0.5 * ( us(j,i-1) + us(j,i) )
[1]223       ENDDO
224    ENDDO
225
226!
227!-- Compute v'w' for the total model domain.
228!-- First compute the corresponding component of u* and square it.
229    !$OMP PARALLEL DO PRIVATE( a, b, k, rifm, z_p )
230    DO  i = nxl, nxr
231       DO  j = nys, nyn
232
233          k   = nzb_v_inner(j,i)
234          z_p = zu(k+1) - zw(k)
235
236!
237!--       Compute Richardson-flux number for this point
238          rifm = 0.5 * ( rif(j-1,i) + rif(j,i) )
239          IF ( rifm >= 0.0 )  THEN
240!
241!--          Stable stratification
242             vsws(j,i) = kappa * v(k+1,j,i) / (                           &
243                                     LOG( z_p / z0(j,i) ) +               &
244                                     5.0 * rifm * ( z_p - z0(j,i) ) / z_p &
245                                              )
246          ELSE
247!
248!--          Unstable stratification
[187]249             a = SQRT( SQRT( 1.0 - 16.0 * rifm ) )
250             b = SQRT( SQRT( 1.0 - 16.0 * rifm / z_p * z0(j,i) ) )
251
252             vsws(j,i) = kappa * v(k+1,j,i) / (                           &
253                         LOG( z_p / z0(j,i) ) -                           &
254                         LOG( (1.0 + a )**2 * ( 1.0 + a**2 ) / (          &
255                              (1.0 + b )**2 * ( 1.0 + b**2 )   ) ) +      &
256                              2.0 * ( ATAN( a ) - ATAN( b ) )             &
[1]257                                                 )
258          ENDIF
[187]259          vsws(j,i) = -vsws(j,i) * 0.5 * ( us(j-1,i) + us(j,i) )
[1]260       ENDDO
261    ENDDO
262
263!
264!-- If required compute q*
[75]265    IF ( humidity  .OR.  passive_scalar )  THEN
[1]266       IF ( constant_waterflux )  THEN
267!
268!--       For a given water flux in the Prandtl layer:
269          !$OMP PARALLEL DO
270          DO  i = nxl-1, nxr+1
271             DO  j = nys-1, nyn+1
272                qs(j,i) = -qsws(j,i) / ( us(j,i) + 1E-30 )
273             ENDDO
274          ENDDO
275         
276       ELSE         
277          !$OMP PARALLEL DO PRIVATE( a, b, k, z_p )
278          DO  i = nxl-1, nxr+1
279             DO  j = nys-1, nyn+1
280
281                k   = nzb_s_inner(j,i)
282                z_p = zu(k+1) - zw(k)
283
[108]284!
[291]285!--             Assume saturation for atmosphere coupled to ocean (but not
286!--             in case of precursor runs)
287                IF ( coupling_mode == 'atmosphere_to_ocean' .AND. run_coupled )&
288                THEN
[108]289                   e_q = 6.1 * &
290                        EXP( 0.07 * ( MIN(pt(0,j,i),pt(1,j,i)) - 273.15 ) )
291                   q(k,j,i) = 0.622 * e_q / ( surface_pressure - e_q )
292                ENDIF
[1]293                IF ( rif(j,i) >= 0.0 )  THEN
294!
295!--                Stable stratification
296                   qs(j,i) = kappa * ( q(k+1,j,i) - q(k,j,i) ) / (         &
297                                  LOG( z_p / z0(j,i) ) +                   &
298                                  5.0 * rif(j,i) * ( z_p - z0(j,i) ) / z_p &
299                                                                 )
300                ELSE
301!
302!--                Unstable stratification
[187]303                   a = SQRT( 1.0 - 16.0 * rif(j,i) ) 
304                   b = SQRT( 1.0 - 16.0 * rif(j,i) * z0(j,i) / z_p ) 
305 
306                   qs(j,i) = kappa * ( q(k+1,j,i) - q(k,j,i) ) /   (   &
307                             LOG( z_p / z0(j,i) ) -                    &
308                              2.0 * LOG( (1.0 + a ) / ( 1.0 + b ) ) )
[1]309                ENDIF
310
311             ENDDO
312          ENDDO
313       ENDIF
314    ENDIF
315
316!
[187]317!-- Exchange the boundaries for the momentum fluxes (only for sake of
318!-- completeness)
[1]319    CALL exchange_horiz_2d( usws )
320    CALL exchange_horiz_2d( vsws )
[75]321    IF ( humidity  .OR.  passive_scalar )  CALL exchange_horiz_2d( qsws )
[1]322
323!
324!-- Compute the vertical kinematic heat flux
325    IF ( .NOT. constant_heatflux )  THEN
326       !$OMP PARALLEL DO
327       DO  i = nxl-1, nxr+1
328          DO  j = nys-1, nyn+1
329             shf(j,i) = -ts(j,i) * us(j,i)
330          ENDDO
331       ENDDO
332    ENDIF
333
334!
335!-- Compute the vertical water/scalar flux
[315]336    IF ( .NOT. constant_waterflux .AND. ( humidity .OR. passive_scalar ) ) THEN
[1]337       !$OMP PARALLEL DO
338       DO  i = nxl-1, nxr+1
339          DO  j = nys-1, nyn+1
340             qsws(j,i) = -qs(j,i) * us(j,i)
341          ENDDO
342       ENDDO
343    ENDIF
344
345!
346!-- Bottom boundary condition for the TKE
347    IF ( ibc_e_b == 2 )  THEN
348       !$OMP PARALLEL DO
349       DO  i = nxl-1, nxr+1
350          DO  j = nys-1, nyn+1
351             e(nzb_s_inner(j,i)+1,j,i) = ( us(j,i) / 0.1 )**2
352!
353!--          As a test: cm = 0.4
354!            e(nzb_s_inner(j,i)+1,j,i) = ( us(j,i) / 0.4 )**2
355             e(nzb_s_inner(j,i),j,i)   = e(nzb_s_inner(j,i)+1,j,i)
356          ENDDO
357       ENDDO
358    ENDIF
359
360
361 END SUBROUTINE prandtl_fluxes
Note: See TracBrowser for help on using the repository browser.