Version 9 (modified by suehring, 14 years ago) (diff) |
---|
User-defined output quantities
A very typical request of users is the calculation and output of quantities which are not part of PALM's standard output. The basic user interface includes a number of subroutines which allow the calculation of user-defined quantities and output of these quantities as 1. (horizontally averaged) vertical profiles, 2. time series, 3. 2d cross section or 3d volume data, 4. dvrp objects, and 5. spectra. The respective subroutines contain sample code lines (written as comment lines) for defining, calculating and output of such quantities.
Output times, averaging intervals, etc. are steered by the same variables as used for the standard PALM output quantities, e.g. dt_data_output.
The following five parts of this chapter explains step-by-step how to modify/extend the respective default user interface subroutines in order to generate the respective output:
- (horizontally averaged) vertical profiles,
- time series,
- 2d cross section or 3d volume data,
- dvrp objects, and
- spectra.
1. Output of user-defined vertical profiles
This example shows the output of the quantity "turbulent resolved-scale horizontal momentum flux" (u*v*). If more than one user-defined quantity shall be output, the following steps have to be carried out in the same way for each of the quantities.
- The quantity has to be given a unique string identifier, e.g. 'u*v*'. This identifier must be different from the identifiers used for the PALM standard output (see list in description of parameter data_output_pr). To switch on output of this quantity, the user has to assign the string identifier to the parameter data_output_pr_user, eg.:
\
data_output_pr_user = 'u*v*',
- For the quantity, an identification number, a physical unit, and the vertical grid on which it is defined (u- or w-grid), has to be assigned (subroutine user_check
_data_output_pr):
CASE ( 'u*v*' )
index = pr_palm + 1 ! identification number
dopr_index(var_count) = index
dopr_unit(var_count) = 'm2s2' ! physical unit
hom(:,2,index,:) = SPREAD( zu, 2, statistic_regions+1 ) ! vertical grid
Here only the those parts in red color have to be given by the user appropriately.
The identification number (index) must be within the range [ pr_palm+1 , pr_palm+max_pr_user ], where max_pr_user is the number of user-defined profiles as given by parameter data_output_pr_user in the respective PALM run. The physical unit has to be given with respect to the netCDF conventions. If no unit is given, PALM will abort. The vertical grid has to be either zu (u-grid) or zw (w-grid).
- The quantity has to be calculated for all gridpoints (subroutine user_statistics):
!$OMP DO DO i = nxl, nxr
DO j = nys, nyn
DO k = nzb_s_inner(j,i)+1, nzt
sums_l(k,pr_palm+1,tn) = sums_l(k,pr_palm+1,tn) + &
(0.5*(u(k, j, i)+u(k, j, i+1))-hom(k, 1, 1, sr))*&
(0.5*(v(k, j, i)+v(k, j+1, i))-hom(k, 1, 2, sr)) &
* rmask(j,i,sr)ENDDO
ENDDO
ENDDO
Once again, only those parts in red have to be adjusted by the user.
The turbulent resolved-scale momentum flux u*v* is defined as the product of the deviations of the horizontal velocities from their respective horizontally averaged mean values. These mean values are stored in array hom(..,1,1,sr) and hom(..,1,2,sr) for the u- and v-component, respectively. Since due to the staggered grid, u and v are not defined at the same gridpoints, they have to be interpolated appropriately (here to the center of the gridbox). The result of the calculation is stored in array sums_l. The second index of this array is the identification number of the profile which must match the one given in the previous step 2.