source: palm/trunk/SOURCE/buoyancy.f90 @ 431

Last change on this file since 431 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: 9.9 KB
Line 
1 MODULE buoyancy_mod
2
3!------------------------------------------------------------------------------!
4! Currrent revisions:
5! -----------------
6!
7!
8! Former revisions:
9! -----------------
10! $Id: buoyancy.f90 392 2009-09-24 10:39:14Z raasch $
11!
12! 247 2009-02-27 14:01:30Z heinze
13! Output of messages replaced by message handling routine
14!
15! 132 2007-11-20 09:46:11Z letzel
16! Vertical scalar profiles now based on nzb_s_inner and ngp_2dh_s_inner.
17!
18! 106 2007-08-16 14:30:26Z raasch
19! i loop for u-component (sloping surface) is starting from nxlu (needed for
20! non-cyclic boundary conditions)
21!
22! 97 2007-06-21 08:23:15Z raasch
23! Routine reneralized to be used with temperature AND density:
24! argument theta renamed var, new argument var_reference,
25! use_pt_reference renamed use_reference,
26! calc_mean_pt_profile renamed calc_mean_profile
27!
28! 57 2007-03-09 12:05:41Z raasch
29! Reference temperature pt_reference can be used.
30!
31! RCS Log replace by Id keyword, revision history cleaned up
32!
33! Revision 1.19  2006/04/26 12:09:56  raasch
34! OpenMP optimization (one dimension added to sums_l)
35!
36! Revision 1.1  1997/08/29 08:56:48  raasch
37! Initial revision
38!
39!
40! Description:
41! ------------
42! Buoyancy term of the third component of the equation of motion.
43! WARNING: humidity is not regarded when using a sloping surface!
44!------------------------------------------------------------------------------!
45
46    PRIVATE
47    PUBLIC buoyancy, calc_mean_profile
48
49    INTERFACE buoyancy
50       MODULE PROCEDURE buoyancy
51       MODULE PROCEDURE buoyancy_ij
52    END INTERFACE buoyancy
53
54    INTERFACE calc_mean_profile
55       MODULE PROCEDURE calc_mean_profile
56    END INTERFACE calc_mean_profile
57
58 CONTAINS
59
60
61!------------------------------------------------------------------------------!
62! Call for all grid points
63!------------------------------------------------------------------------------!
64    SUBROUTINE buoyancy( var, var_reference, wind_component, pr )
65
66       USE arrays_3d
67       USE control_parameters
68       USE indices
69       USE pegrid
70       USE statistics
71
72       IMPLICIT NONE
73
74       INTEGER ::  i, j, k, pr, wind_component
75       REAL    ::  var_reference
76       REAL, DIMENSION(:,:,:), POINTER  ::  var
77
78
79       IF ( .NOT. sloping_surface )  THEN
80!
81!--       Normal case: horizontal surface
82          IF ( use_reference )  THEN
83             DO  i = nxl, nxr
84                DO  j = nys, nyn
85                   DO  k = nzb_s_inner(j,i)+1, nzt-1
86                      tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5 * &
87                                                            (                  &
88                          ( var(k,j,i)   - hom(k,1,pr,0)   ) / var_reference + &
89                          ( var(k+1,j,i) - hom(k+1,1,pr,0) ) / var_reference   &
90                                                            )
91                   ENDDO
92                ENDDO
93             ENDDO
94          ELSE
95             DO  i = nxl, nxr
96                DO  j = nys, nyn
97                   DO  k = nzb_s_inner(j,i)+1, nzt-1
98                      tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5 * &
99                                                            (                  &
100                          ( var(k,j,i)   - hom(k,1,pr,0)   ) / hom(k,1,pr,0) + &
101                          ( var(k+1,j,i) - hom(k+1,1,pr,0) ) / hom(k+1,1,pr,0) &
102                                                            )
103                   ENDDO
104                ENDDO
105             ENDDO
106          ENDIF
107
108       ELSE
109!
110!--       Buoyancy term for a surface with a slope in x-direction. The equations
111!--       for both the u and w velocity-component contain proportionate terms.
112!--       Temperature field at time t=0 serves as environmental temperature.
113!--       Reference temperature (pt_surface) is the one at the lower left corner
114!--       of the total domain.
115          IF ( wind_component == 1 )  THEN
116
117             DO  i = nxlu, nxr
118                DO  j = nys, nyn
119                   DO  k = nzb_s_inner(j,i)+1, nzt-1
120                      tend(k,j,i) = tend(k,j,i) + g * sin_alpha_surface *      &
121                           0.5 * ( ( pt(k,j,i-1)         + pt(k,j,i)         ) &
122                                 - ( pt_slope_ref(k,i-1) + pt_slope_ref(k,i) ) &
123                                 ) / pt_surface
124                   ENDDO
125                ENDDO
126             ENDDO
127
128          ELSEIF ( wind_component == 3 )  THEN
129
130             DO  i = nxl, nxr
131                DO  j = nys, nyn
132                   DO  k = nzb_s_inner(j,i)+1, nzt-1
133                      tend(k,j,i) = tend(k,j,i) + g * cos_alpha_surface *      &
134                           0.5 * ( ( pt(k,j,i)         + pt(k+1,j,i)         ) &
135                                 - ( pt_slope_ref(k,i) + pt_slope_ref(k+1,i) ) &
136                                 ) / pt_surface
137                   ENDDO
138                ENDDO
139            ENDDO
140
141          ELSE
142             
143             WRITE( message_string, * ) 'no term for component "',&
144                                       wind_component,'"'
145             CALL message( 'buoyancy', 'PA0159', 1, 2, 0, 6, 0 )
146
147          ENDIF
148
149       ENDIF
150
151    END SUBROUTINE buoyancy
152
153
154!------------------------------------------------------------------------------!
155! Call for grid point i,j
156!------------------------------------------------------------------------------!
157    SUBROUTINE buoyancy_ij( i, j, var, var_reference, wind_component, pr )
158
159       USE arrays_3d
160       USE control_parameters
161       USE indices
162       USE pegrid
163       USE statistics
164
165       IMPLICIT NONE
166
167       INTEGER ::  i, j, k, pr, wind_component
168       REAL    ::  var_reference
169       REAL, DIMENSION(:,:,:), POINTER  ::  var
170
171
172       IF ( .NOT. sloping_surface )  THEN
173!
174!--       Normal case: horizontal surface
175          IF ( use_reference )  THEN
176             DO  k = nzb_s_inner(j,i)+1, nzt-1
177                 tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5 * (   &
178                         ( var(k,j,i)   - hom(k,1,pr,0)   ) / var_reference + &
179                         ( var(k+1,j,i) - hom(k+1,1,pr,0) ) / var_reference   &
180                                                                          )
181             ENDDO
182          ELSE
183             DO  k = nzb_s_inner(j,i)+1, nzt-1
184                 tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5 * (    &
185                          ( var(k,j,i)   - hom(k,1,pr,0)   ) / hom(k,1,pr,0) + &
186                          ( var(k+1,j,i) - hom(k+1,1,pr,0) ) / hom(k+1,1,pr,0) &
187                                                                          )
188             ENDDO
189          ENDIF
190
191       ELSE
192!
193!--       Buoyancy term for a surface with a slope in x-direction. The equations
194!--       for both the u and w velocity-component contain proportionate terms.
195!--       Temperature field at time t=0 serves as environmental temperature.
196!--       Reference temperature (pt_surface) is the one at the lower left corner
197!--       of the total domain.
198          IF ( wind_component == 1 )  THEN
199
200             DO  k = nzb_s_inner(j,i)+1, nzt-1
201                tend(k,j,i) = tend(k,j,i) + g * sin_alpha_surface *            &
202                           0.5 * ( ( pt(k,j,i-1)         + pt(k,j,i)         ) &
203                                 - ( pt_slope_ref(k,i-1) + pt_slope_ref(k,i) ) &
204                                 ) / pt_surface
205             ENDDO
206
207          ELSEIF ( wind_component == 3 )  THEN
208
209             DO  k = nzb_s_inner(j,i)+1, nzt-1
210                tend(k,j,i) = tend(k,j,i) + g * cos_alpha_surface *            &
211                           0.5 * ( ( pt(k,j,i)         + pt(k+1,j,i)         ) &
212                                 - ( pt_slope_ref(k,i) + pt_slope_ref(k+1,i) ) &
213                                 ) / pt_surface
214             ENDDO
215
216          ELSE
217
218             WRITE( message_string, * ) 'no term for component "',&
219                                       wind_component,'"'
220             CALL message( 'buoyancy', 'PA0159', 1, 2, 0, 6, 0 )
221
222          ENDIF
223
224       ENDIF
225
226    END SUBROUTINE buoyancy_ij
227
228
229    SUBROUTINE calc_mean_profile( var, pr )
230
231!------------------------------------------------------------------------------!
232! Description:
233! ------------
234! Calculate the horizontally averaged vertical temperature profile (pr=4 in case
235! of potential temperature and 44 in case of virtual potential temperature).
236!------------------------------------------------------------------------------!
237
238       USE control_parameters
239       USE indices
240       USE pegrid
241       USE statistics
242
243       IMPLICIT NONE
244
245       INTEGER ::  i, j, k, omp_get_thread_num, pr, tn
246       REAL, DIMENSION(:,:,:), POINTER  ::  var
247
248!
249!--    Computation of the horizontally averaged profile of variable var, unless
250!--    already done by the relevant call from flow_statistics. The calculation
251!--    is done only for the first respective intermediate timestep in order to
252!--    spare communication time and to produce identical model results with jobs
253!--    which are calling flow_statistics at different time intervals.
254       IF ( .NOT. flow_statistics_called  .AND. &
255            intermediate_timestep_count == 1 )  THEN
256
257!
258!--       Horizontal average of variable var
259          tn           =   0  ! Default thread number in case of one thread
260          !$OMP PARALLEL PRIVATE( i, j, k, tn )
261!$        tn = omp_get_thread_num()
262          sums_l(:,pr,tn) = 0.0
263          !$OMP DO
264          DO  i = nxl, nxr
265             DO  j =  nys, nyn
266                DO  k = nzb_s_inner(j,i), nzt+1
267                   sums_l(k,pr,tn) = sums_l(k,pr,tn) + var(k,j,i)
268                ENDDO
269             ENDDO
270          ENDDO
271          !$OMP END PARALLEL
272
273          DO  i = 1, threads_per_task-1
274             sums_l(:,pr,0) = sums_l(:,pr,0) + sums_l(:,pr,i)
275          ENDDO
276
277#if defined( __parallel )
278
279          CALL MPI_ALLREDUCE( sums_l(nzb,pr,0), sums(nzb,pr), nzt+2-nzb, &
280                              MPI_REAL, MPI_SUM, comm2d, ierr )
281
282#else
283
284          sums(:,pr) = sums_l(:,pr,0)
285
286#endif
287
288          hom(:,1,pr,0) = sums(:,pr) / ngp_2dh_s_inner(:,0)
289
290       ENDIF
291
292    END SUBROUTINE calc_mean_profile
293
294 END MODULE buoyancy_mod
Note: See TracBrowser for help on using the repository browser.