1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
---|
2 | <html><head> |
---|
3 | |
---|
4 | <meta http-equiv="CONTENT-TYPE" content="text/html; charset=windows-1252"><title>PALM chapter 3.5.4</title> <meta name="GENERATOR" content="StarOffice 7 (Win32)"> <meta name="AUTHOR" content="Siegfried Raasch"> <meta name="CREATED" content="20040802;14050943"> <meta name="CHANGED" content="20041117;12180008"> <meta name="KEYWORDS" content="parallel LES model"> <style> |
---|
5 | <!-- |
---|
6 | @page { size: 21cm 29.7cm } |
---|
7 | --> |
---|
8 | </style></head><body style="direction: ltr;" lang="en-US"><h3 style="line-height: 100%;"><font size="4">3.5.4 |
---|
9 | User-defined output quantities<br> |
---|
10 | </font></h3>A very typical request of users is the |
---|
11 | calculation and |
---|
12 | output of |
---|
13 | quantities which are not part of PALM's standard output. The basic user |
---|
14 | interface includes a number of subroutines which allow the calculation |
---|
15 | of user-defined quantities and output of these quantities as 1. |
---|
16 | (horizontally averaged) <a href="#vertical_profiles">vertical |
---|
17 | profiles</a>, 2. <a href="#time_series">time |
---|
18 | series</a>, 3. <a href="#2D_and_3D">2d cross |
---|
19 | section</a> or <a href="#2D_and_3D">3d volume data</a>, |
---|
20 | 4. <a href="#dvrp">dvrp</a> objects, and 5. <a href="#spectra">spectra</a>. The respective |
---|
21 | subroutines |
---|
22 | contain sample code lines (written as comment lines) for defining, |
---|
23 | calculating and |
---|
24 | output of such quantities.<br><br>Output times, averaging |
---|
25 | intervals, etc. are steered by the same variables as used for the |
---|
26 | standard PALM output quantities, e.g. <a href="chapter_4.2.html#dt_data_output">dt_data_output</a>.<br><br>The |
---|
27 | following five parts of this chapter explains step-by-step how |
---|
28 | to modify/extend the |
---|
29 | respective default user interface subroutines in order to generate the respective |
---|
30 | output:<br><ol><li>(horizontally averaged) <a href="chapter_3.5.4.html#vertical_profiles">vertical profiles</a>, </li><li><a href="chapter_3.5.4.html#time_series">time series</a>, </li><li><a href="chapter_3.5.4.html#2D_and_3D">2d cross |
---|
31 | section</a> or <a href="chapter_3.5.4.html#2D_and_3D">3d |
---|
32 | volume data</a>, </li><li><a href="chapter_3.5.4.html#dvrp">dvrp</a> objects, |
---|
33 | and </li><li><a href="chapter_3.5.4.html#spectra">spectra</a>.</li></ol><br><h4><a name="vertical_profiles"></a>1. Output of user-defined |
---|
34 | vertical profiles</h4>This example shows the output of the |
---|
35 | quantity "turbulent resolved-scale horizontal momentum flux" (u*v*). If |
---|
36 | more than one user-defined |
---|
37 | quantity shall be output, the following steps have to be carried out in |
---|
38 | the |
---|
39 | same way for each of the quantities.<br><br><ol><li>The |
---|
40 | quantity has to be given a unique string identifier, e.g. <span style="font-style: italic;">'u*v*'</span>. |
---|
41 | This identifier must be different from the identifiers used for the |
---|
42 | PALM standard output (see list in description of parameter <a href="chapter_4.2.html#data_output_pr">data_output_pr</a>). |
---|
43 | To switch on output of this quantity, the user has to assign the string |
---|
44 | identifier to the parameter <a href="chapter_4.3.html#data_output_pr_user">data_output_pr_user</a>, |
---|
45 | eg.:<br><br><span style="font-family: monospace;"> |
---|
46 | data_output_pr_user</span> = <span style="font-style: italic;">'u*v*'</span>,<span style="font-style: italic;"></span><span style="font-style: italic;"></span><span style="font-style: italic;"></span><span style="font-style: italic;"></span><span style="font-style: italic;"></span><span style="font-style: italic;"></span><br><br></li><li>For |
---|
47 | the |
---|
48 | quantity, an identification number, a physical unit, and the vertical |
---|
49 | grid on which it is defined (u- or w-grid), has to be assigned |
---|
50 | (subroutine <a href="chapter_3.5.1.html#user_check_data_output_pr"><span style="font-family: monospace;">user_check_data_output_pr</span></a>):<span style="font-family: monospace;"><br><br> |
---|
51 | CASE ( |
---|
52 | 'u*v*' )<br></span><span style="font-family: monospace;"> |
---|
53 | index = pr_palm + <span style="color: rgb(255, 0, 0);">1<span style="color: rgb(0, 0, 0);"> |
---|
54 | |
---|
55 | |
---|
56 | |
---|
57 | |
---|
58 | ! identification number</span></span><br> |
---|
59 | dopr_index(var_count) = index<br> |
---|
60 | dopr_unit(var_count) = '<span style="color: rgb(255, 0, 0);">m2/s2</span>' |
---|
61 | |
---|
62 | |
---|
63 | ! |
---|
64 | physical unit<br> |
---|
65 | hom(:,2,index,:) = SPREAD( <span style="color: rgb(255, 0, 0);">zu</span>, 2, |
---|
66 | statistic_regions+1 ) ! vertical grid<br></span><br>Here |
---|
67 | only the those parts in <span style="color: rgb(255, 0, 0);">red</span> |
---|
68 | color have to be given by the user appropriately.<br>The |
---|
69 | identification number (<span style="font-family: Courier New,Courier,monospace;">index</span>) |
---|
70 | must be within the range [<span style="font-family: Courier New,Courier,monospace;"> |
---|
71 | pr_palm+1 , pr_palm+max_pr_user</span> ], where <span style="font-family: Courier New,Courier,monospace;">max_pr_user</span> |
---|
72 | is the number of user-defined profiles as given by parameter <a href="chapter_4.3.html#data_output_pr_user">data_output_pr_user</a> |
---|
73 | in the respective PALM run. The physical unit has to be given |
---|
74 | with respect to the NetCDF conventions. If no unit is given, |
---|
75 | PALM will abort. The vertical grid has to be either <span style="font-family: Courier New,Courier,monospace;">zu</span> |
---|
76 | (u-grid) or <span style="font-family: Courier New,Courier,monospace;">zw</span> |
---|
77 | (w-grid).<br><br></li><li>The quantity has to |
---|
78 | be calculated for all gridpoints (subroutine <a href="chapter_3.5.1.html#user_statistics">user_statistics</a>):<br><br><span style="font-family: monospace;"> !$OMP |
---|
79 | DO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
80 | DO i = nxl, nxr</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
81 | DO j = nys, nyn</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
82 | DO k = nzb_s_inner(j,i)+1, nzt</span><br style="font-family: monospace;"><span style="font-family: monospace;"></span><span style="font-family: monospace;"></span><span style="font-family: monospace;"></span><span style="font-family: monospace;"> |
---|
83 | sums_l(k,pr_palm+<span style="color: rgb(255, 0, 0);">1</span>,tn) |
---|
84 | = sums_l(k,pr_palm+<span style="color: rgb(255, 0, 0);">1</span>,tn) |
---|
85 | + |
---|
86 | &</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
87 | <span style="color: rgb(255, 0, 0);">( 0.5 * ( u(k,j,i) + |
---|
88 | u(k,j,i+1) ) - hom(k,1,1,sr) ) * &</span></span><br style="font-family: monospace; color: rgb(255, 0, 0);"><span style="font-family: monospace; color: rgb(255, 0, 0);"> |
---|
89 | ( 0.5 * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,sr) ) &</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
90 | * rmask(j,i,sr)<br> |
---|
91 | ENDDO<br> |
---|
92 | ENDDO<br> ENDDO<br></span><br style="font-family: monospace;">Once again, only those parts |
---|
93 | in <span style="color: rgb(255, 0, 0);">red</span> |
---|
94 | have to be adjusted by the user.<br>The |
---|
95 | turbulent resolved-scale momentum flux u*v* is defined as the product |
---|
96 | of the deviations of the horizontal velocities from their respective |
---|
97 | horizontally averaged mean values. These mean values are stored in |
---|
98 | array <span style="font-family: Courier New,Courier,monospace;">hom(..,1,1,sr)</span> |
---|
99 | and <span style="font-family: Courier New,Courier,monospace;">hom(..,1,2,sr)</span> |
---|
100 | for the u- and v-component, respectively. Since due to the staggered |
---|
101 | grid, <span style="font-family: Courier New,Courier,monospace;">u</span> |
---|
102 | and <span style="font-family: Courier New,Courier,monospace;">v</span> |
---|
103 | are not defined at the same gridpoints, they have to be interpolated |
---|
104 | appropriately (here to the center of the gridbox). The result of the |
---|
105 | calculation is stored in array <span style="font-family: Courier New,Courier,monospace;">sums_l</span>. |
---|
106 | The second index of this array is the identification number of the |
---|
107 | profile which must match the one given in the previous step 2.</li></ol><br><h4><a name="time_series"></a>2. Output of user-defined |
---|
108 | timeseries</h4>This example shows the output of two time series |
---|
109 | for the absolut extremal values of the horizontal velocities <span style="font-style: italic;">u</span> and <span style="font-style: italic;">v</span>. If more than one |
---|
110 | user-defined |
---|
111 | quantity shall be output, the following steps have to be carried out in |
---|
112 | the |
---|
113 | same way for each of the quantities.<br><br><ol><li>For |
---|
114 | each time series quantity you have to give a label and a unit |
---|
115 | (subroutine <a href="chapter_3.5.1.html#user_init">user_init</a>), |
---|
116 | which will be used for the NetCDF file. They must not contain more than |
---|
117 | seven characters. The value of <code>dots_num</code> has |
---|
118 | to be increased by the number of new time series quantities. Its old |
---|
119 | value has to be stored in <code>dots_num_palm</code>.<br><br><code> |
---|
120 | dots_label(dots_num<span style="color: rgb(255, 0, 0);">+1</span>) |
---|
121 | = '<span style="color: rgb(255, 0, 0);">abs_umx</span>'<br> |
---|
122 | dots_unit(dots_num<span style="color: rgb(255, 0, 0);">+1</span>) |
---|
123 | = '<span style="color: rgb(255, 0, 0);">m/s</span>'<br> |
---|
124 | dots_label(dots_num<span style="color: rgb(255, 0, 0);">+2</span>) |
---|
125 | = '<span style="color: rgb(255, 0, 0);">abs_vmx</span>'<br> |
---|
126 | dots_unit(dots_num<span style="color: rgb(255, 0, 0);">+2</span>) |
---|
127 | = '<span style="color: rgb(255, 0, 0);">m/s</span>'<br><br> |
---|
128 | dots_num_palm = dots_num<br> |
---|
129 | dots_num = dots_num <span style="color: rgb(255, 0, 0);">+ |
---|
130 | 2</span><br><br></code>Only those parts in <span style="color: rgb(255, 0, 0);">red</span> have to be |
---|
131 | adjusted by the user.<br><br></li><li>These |
---|
132 | quantities are calculated and output in subroutine <a href="chapter_3.5.1.html#user_statistics">user_statistics</a> |
---|
133 | for every statistic region <code>sr</code> defined by the |
---|
134 | user, but at least for the region <span style="font-style: italic;">"total domain"</span>:<br> <br><code> |
---|
135 | ts_value(dots_num_palm+1,sr) = ABS( u_max )<br> |
---|
136 | ts_value(dots_num_palm+2,sr) = ABS( v_max )<br></code></li></ol> <br><h4><span style="font-weight: bold;"><a name="2D_and_3D"></a>3. |
---|
137 | Output of user-defined 2d cross sections or 3d volume data</span></h4><br>This |
---|
138 | example shows the output of the |
---|
139 | quantity "square of the u-component" (<span style="font-weight: bold;">Note:</span> this quantity |
---|
140 | could of course easily be calculated from the u-component by |
---|
141 | postprocessing the PALM output so that calculation within PALM is not |
---|
142 | necessarily required). If more than one user-defined |
---|
143 | quantity shall be output, the following steps have to be carried out in |
---|
144 | the |
---|
145 | same way for each of the quantities.<br><br><ol><li>The |
---|
146 | quantity has to be given a unique string identifier, e.g. <span style="font-style: italic;">'u2'</span>. |
---|
147 | This identifier must be different from the identifiers used for the |
---|
148 | PALM standard output (see list in description of parameter <a href="chapter_4.2.html#data_output">data_output</a>). |
---|
149 | To switch on output of this quantity, the user has to assign the string |
---|
150 | identifier to the parameter <a href="chapter_4.3.html#data_output_user">data_output_user</a>, |
---|
151 | eg.:<br><br><span style="font-family: monospace;"> |
---|
152 | data_output_user</span> = <span style="font-style: italic;">'u2'</span>, <span style="font-style: italic;"> 'u2_xy_av'</span><br><br>The |
---|
153 | pure string <span style="font-style: italic;">'u2'</span> |
---|
154 | switches on the output of instantaneous 3d volume data. Output of cross |
---|
155 | section data and time averaged data is switched on by additionally |
---|
156 | appending the strings <span style="font-style: italic;">'_xy'</span>, |
---|
157 | <span style="font-style: italic;">'_xz'</span>, <span style="font-style: italic;">'_yz'</span>, and/or <span style="font-style: italic;">'_av'</span> (for a |
---|
158 | detailed explanation see parameter <a href="chapter_4.2.html#data_output">data_output</a>).<br><br></li><li>In |
---|
159 | order to store the quantities' grid point data within PALM, a 3d data |
---|
160 | array has to be declared in module <a href="chapter_3.5.1.html#user"><span style="font-family: monospace;">user</span></a>:<br><br><span style="font-family: monospace;"> REAL, |
---|
161 | DIMENSION(:,:,:), ALLOCATABLE :: u2, u2_av</span><br><br>The |
---|
162 | second array <span style="font-family: monospace;">u2_av</span> |
---|
163 | is needed in case that output of time averaged data is requested. It is |
---|
164 | used to store the sum of the data of the respective time levels over |
---|
165 | which the average has to be carried out.<br><br><br></li><li>The |
---|
166 | data array has to be allocated in subroutine <a href="chapter_3.5.1.html#user_init"><span style="font-family: monospace;">user_init</span></a>:<br><br><span style="font-family: monospace;"> |
---|
167 | ALLOCATE( u2(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )</span><br><br>In |
---|
168 | case that output of time averaged data is requested, the array |
---|
169 | containing the sum has possibly to be read from the restart file (local |
---|
170 | filename <a href="chapter_3.4.html#BININ">BININ</a>) |
---|
171 | by executing the following code in <span style="font-family: monospace;">user_init</span>:<br><br><span style="font-family: monospace;"> |
---|
172 | IF ( initializing_actions == 'read_restart_data' ) |
---|
173 | THEN</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
174 | READ ( 13 ) field_char</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
175 | DO WHILE ( TRIM( field_char ) /= '*** end |
---|
176 | user ***' )</span><br style="font-family: monospace;"><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
177 | SELECT CASE ( TRIM( field_char ) )</span><br style="font-family: monospace;"><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
178 | CASE ( 'u2_av' )</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
179 | ALLOCATE( |
---|
180 | u2_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
181 | READ ( 13 ) u2_av</span><br style="font-family: monospace;"><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
182 | CASE DEFAULT</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
183 | PRINT*, |
---|
184 | '+++ user_init: unknown |
---|
185 | variable named "', &</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
186 | |
---|
187 | |
---|
188 | TRIM( field_char ), '" found in'</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
189 | PRINT*, |
---|
190 | ' |
---|
191 | data from prior run on PE ', myid</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
192 | |
---|
193 | CALL local_stop</span><br style="font-family: monospace;"><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
194 | END SELECT<br> |
---|
195 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
196 | ENDIF</span><br style="font-family: monospace;"><br><br></li><li>The |
---|
197 | quantity has to be given a unit (subroutine <a href="chapter_3.5.1.html#user_check_data_output"><span style="font-family: monospace;">user_check_data_output</span></a>):<br><br><span style="font-family: monospace;"> CASE ( |
---|
198 | 'u2' )</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
199 | unit = 'm2/s2'</span><br> <br>Otherwise, |
---|
200 | PALM will abort.<br><br><br></li><li>The |
---|
201 | vertical grid on which the quantity is defined (given by the levels |
---|
202 | 'zu' or 'zw', on which the u- or w-component of the velocity are |
---|
203 | defined) has to be specified for the NetCDF output files in subroutine <a href="chapter_3.5.1.html#user_define_netcdf_grid"><span style="font-family: monospace;">user_define_netcdf_grid</span></a>:<br><br><span style="font-family: monospace;"> |
---|
204 | CASE ( 'u2', 'u2_xy', 'u2_xz', 'u2_yz' )</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
205 | grid = 'zu'</span><br> <br>As |
---|
206 | the example shows, this grid has to be defined for the 3d volume data |
---|
207 | as well as for all of the three cross sections.<br><span style="font-family: monospace;"><br><br></span></li><li>After |
---|
208 | each timestep, the quantity has to be calculated at all gridpoints and |
---|
209 | to be stored. This has to be done in subroutine <a href="chapter_3.5.1#user_actions"><span style="font-family: monospace;">user_actions</span></a> |
---|
210 | at location 'after_integration':<br><br><span style="font-family: monospace;"> CASE |
---|
211 | ( 'after_integration' )</span><br style="font-family: monospace;"><span style="font-family: monospace;">!</span><br style="font-family: monospace;"><span style="font-family: monospace;">!-- |
---|
212 | Enter actions to be done after every time integration (before</span><br style="font-family: monospace;"><span style="font-family: monospace;">!-- |
---|
213 | data output)</span><br style="font-family: monospace;"><span style="font-family: monospace;">!-- |
---|
214 | Sample for user-defined output:</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
215 | DO i = nxl-1, nxr+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
216 | DO j = nys-1, nyn+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
217 | DO k = nzb, nzt+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
218 | u2(k,j,i) = u(k,j,i)**2</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
219 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
220 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
221 | ENDDO</span><br><br> <br></li><li>In |
---|
222 | case that output of time-averaged data is requested, the sum- and |
---|
223 | average-operations as well as the allocation of the sum-array have to |
---|
224 | be carried out in subroutine <a href="chapter_3.5.1.html#user_3d_data_averaging"><span style="font-family: monospace;">user_3d_data_averaging</span></a>:<br><br><span style="font-family: monospace;"> |
---|
225 | IF ( mode == 'allocate' ) THEN<br> |
---|
226 | ...</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
227 | CASE ( 'u2' )</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
228 | IF ( .NOT. ALLOCATED( u2_av ) ) THEN</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
229 | ALLOCATE( u2_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
230 | ENDIF</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
231 | u2_av = 0.0<br> ...</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
232 | ELSEIF ( mode == 'sum' ) THEN<br> |
---|
233 | ...</span><br style="font-family: monospace;"><span style="font-family: monospace;"> CASE |
---|
234 | ( 'u2' )</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
235 | DO i = nxl-1, nxr+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
236 | DO j = nys-1, nyn+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
237 | DO k = nzb, nzt+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
238 | u2_av(k,j,i) = u2_av(k,j,i) + u2(k,j,i)</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
239 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
240 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
241 | ENDDO<br> ...</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
242 | ELSEIF ( mode == 'average' ) THEN<br> |
---|
243 | ...</span><br style="font-family: monospace;"><span style="font-family: monospace;"> CASE |
---|
244 | ( 'u2' )</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
245 | DO i = nxl-1, nxr+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
246 | DO j = nys-1, nyn+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
247 | DO k = nzb, nzt+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
248 | u2_av(k,j,i) = u2_av(k,j,i) / REAL( average_count_3d )</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
249 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
250 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
251 | ENDDO</span><br><br> </li><li>For |
---|
252 | output of 2d cross sections, the gridpoint data of the quantity has to |
---|
253 | be resorted to array <span style="font-family: monospace;">local_pf</span> |
---|
254 | in subroutine <a href="chapter_3.5.1.html#user_data_output_2d"><span style="font-family: monospace;">user_data_output_2d</span></a>. |
---|
255 | Also the vertical grid, on which the quantity is defined, has to be set |
---|
256 | again:<br><br><span style="font-family: monospace;"> CASE |
---|
257 | ( 'u2_xy', 'u2_xz', 'u2_yz' )</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
258 | IF ( av == 0 ) THEN</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
259 | DO i = nxl-1, nxr+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
260 | DO j = nys-1, nyn+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
261 | DO k = nzb, nzt+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
262 | local_pf(i,j,k) = u2(k,j,i)</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
263 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
264 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
265 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
266 | ELSE</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
267 | DO i = nxl-1, nxr+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
268 | DO j = nys-1, nyn+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
269 | DO k = nzb, nzt+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
270 | local_pf(i,j,k) = u2_av(k,j,i)</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
271 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
272 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
273 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
274 | ENDIF</span><br style="font-family: monospace;"><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
275 | grid = 'zu'</span><br> <br>The <span style="font-family: monospace;">ELSE</span> case is |
---|
276 | only needed in case that output of time-averaged data is requested.<br><br> |
---|
277 | As a special case, xy cross section output can also be defined at one single level at height <span style="font-family: monospace;">k=nzb+1</span> |
---|
278 | on the u-grid. This features is useful for output of surface data (e.g. |
---|
279 | heat fluxes). In this case, the corresponding 2d data has to be |
---|
280 | resorted to the array <span style="font-family: monospace;">local_pf(i,j,nzb+1).</span> In addition to this, the grid in <a href="chapter_3.5.1.html#user_define_netcdf_grid"><span style="font-family: monospace;">user_define_netcdf_grid</span></a> as well as in <a href="chapter_3.5.1.html#user_data_output_2d"><span style="font-family: monospace;">user_data_output_2d</span></a> must be set to <span style="font-family: monospace;">grid = 'zu1'</span>.<br><br> |
---|
281 | <span style="font-family: monospace;"> CASE |
---|
282 | ( 'u2_xy' )</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
283 | IF ( av == 0 ) THEN</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
284 | DO i = nxl-1, nxr+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
285 | DO j = nys-1, nyn+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
286 | local_pf(i,j,nzb+1) = u2(j,i)</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
287 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
288 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
289 | ELSE</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
290 | DO i = nxl-1, nxr+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
291 | DO j = nys-1, nyn+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
292 | local_pf(i,j,nzb+1) = u2_av(j,i)</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
293 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
294 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
295 | ENDIF</span><br style="font-family: monospace;"><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
296 | grid = 'zu1'</span><br><span style="font-family: monospace;"> |
---|
297 | two_d = .TRUE.</span><br><br> |
---|
298 | Note that <span style="font-family: monospace;">two_d = .TRUE.</span> is necessary for output of a 2d data slice.<br><br> |
---|
299 | <br></li><li>For |
---|
300 | output of 3d volume data, the gridpoint data of the quantity has to be |
---|
301 | resorted to array <span style="font-family: monospace;">local_pf</span> |
---|
302 | in subroutine <a href="chapter_3.5.1.html#user_data_output_3d"><span style="font-family: monospace;">user_data_output_3d</span></a>.:<br><br><span style="font-family: monospace;"> CASE |
---|
303 | ( 'u2' )</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
304 | IF ( av == 0 ) THEN</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
305 | DO i = nxl-1, nxr+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
306 | DO j = nys-1, nyn+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
307 | DO k = nzb, nz_do</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
308 | local_pf(i,j,k) = u2(k,j,i)</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
309 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
310 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
311 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
312 | ELSE</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
313 | DO i = nxl-1, nxr+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
314 | DO j = nys-1, nyn+1</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
315 | DO k = nzb, nz_do</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
316 | local_pf(i,j,k) = u2_av(k,j,i)</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
317 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
318 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
319 | ENDDO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
320 | ENDIF</span><br><br>The <span style="font-family: monospace;">ELSE</span> case is |
---|
321 | only needed in case that output of time-averaged data is requested.<br><br><br></li><li>In |
---|
322 | case of job chains, the sum array has to be written to the (binary) |
---|
323 | restart file (local filename <a href="chapter_3.4.html#BINOUT">BINOUT</a>) |
---|
324 | in subroutine <a href="chapter_3.5.1.html#user_last_actions"><span style="font-family: monospace;">user_last_actions</span></a>:<br><br><span style="font-family: monospace;"> |
---|
325 | IF ( ALLOCATED( u2_av ) ) THEN</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
326 | WRITE ( 14 ) |
---|
327 | 'u2_av |
---|
328 | '; WRITE ( 14 ) u2_av</span><br style="font-family: monospace;"><span style="font-family: monospace;"> |
---|
329 | ENDIF</span><br><br>Otherwise, |
---|
330 | the calculated |
---|
331 | time-average may be wrong. In the restart run, this quantity has to be |
---|
332 | read from the restart file by including the following code in |
---|
333 | subroutine <a href="chapter_3.5.1.html#user_read_restart_data"><span style="font-family: monospace;">user_read_restart_data</span></a>:<br><br><span style="font-family: monospace;"> IF ( initializing_actions == 'read_restart_data' ) THEN<br> READ ( 13 ) field_char<br> DO WHILE ( TRIM( field_char ) /= '*** end user ***' )<br><br> SELECT CASE ( TRIM( field_char ) )<br><br> CASE ( 'u2_av' )<br> IF ( .NOT. ALLOCATED( u2_av ) ) THEN<br> |
---|
334 | ALLOCATE( u2_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )<br> ENDIF<br> READ ( 13 ) tmp_3d<br> |
---|
335 | u2_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &<br> |
---|
336 | tmp_3d(:,nysf-1:nynf+1,nxlf-1:nxrf+1)<br><br> CASE DEFAULT<br> |
---|
337 | PRINT*, '+++ user_init: unknown variable named "', &<br> |
---|
338 | TRIM( field_char ), '" found in'<br> |
---|
339 | PRINT*, |
---|
340 | ' |
---|
341 | data from prior run on PE ', myid<br> CALL local_stop<br><br> END SELECT<br><br> READ ( 13 ) field_char<br><br> ENDDO<br> ENDIF<br></span></li></ol><h4><a name="dvrp"></a>4. Output of user-defined DVRP objects</h4>This |
---|
342 | example shows the output of the |
---|
343 | quantity "square of the u-component", <span style="font-style: italic;">u<sup>2</sup></span>. |
---|
344 | If more than one user-defined |
---|
345 | quantity shall be output, the following steps have to be carried out in |
---|
346 | the |
---|
347 | same way for each of the quantities. First, steps 1 - 6 |
---|
348 | of <a href="chapter_3.5.4.html#2D_and_3D"><span style="font-weight: bold;">part 3.</span> </a> <a href="chapter_3.5.4.html#2D_and_3D">(2d cross |
---|
349 | section or </a><a href="chapter_3.5.4.html#2D_and_3D">3d |
---|
350 | volume data)</a> are required. Second, the gridpoint |
---|
351 | data |
---|
352 | of the quantity has to |
---|
353 | be resorted to array <span style="font-family: monospace;">local_pf</span> |
---|
354 | in subroutine <a href="chapter_3.5.1.html#user_data_output_dvrp"><span style="font-family: monospace;">user_data_output_dvrp</span></a> |
---|
355 | as follows:<br><br><code> |
---|
356 | CASE ( '<span style="color: rgb(255, 0, 0);">u2</span>', |
---|
357 | '<span style="color: rgb(255, 0, 0);">u2</span>_xy', |
---|
358 | '<span style="color: rgb(255, 0, 0);">u2</span>_xz', |
---|
359 | '<span style="color: rgb(255, 0, 0);">u2</span>_yz' |
---|
360 | )<br> |
---|
361 | DO i = nxl, nxr+1<br> |
---|
362 | DO j = nys, nyn+1<br> |
---|
363 | DO k = nzb, nz_do3d<br> |
---|
364 | local_pf(i,j,k) = <span style="color: rgb(255, 0, 0);">u2</span>(k,j,i)<br> |
---|
365 | ENDDO<br> |
---|
366 | ENDDO<br> |
---|
367 | ENDDO</code><br><br>Only those parts in <span style="color: rgb(255, 0, 0);">red</span> have to be |
---|
368 | adjusted by the user.<br><br>After performing these steps, |
---|
369 | the user-defined quantity <code>'u2'</code> can be |
---|
370 | selected like standard model quantities by the <a href="chapter_4.2.html#dvrp_graphics">dvrp_graphics</a> |
---|
371 | package parameter <a href="chapter_4.2.html#mode_dvrp">mode_dvrp</a>.<br><br><h4><a name="spectra"></a>5. Output of user-defined spectra</h4>This |
---|
372 | example shows the output of the |
---|
373 | quantity "turbulent resolved-scale horizontal momentum flux" (u*v*). If |
---|
374 | more than one user-defined |
---|
375 | quantity shall be output, the following steps have to be carried out in |
---|
376 | the |
---|
377 | same way for each of the quantities.<br><br><ol><li>The |
---|
378 | calculation of user-defined spectra is closely linked with the |
---|
379 | calculation of <a href="chapter_3.5.4.html#vertical_profiles"><span style="font-weight: bold;">part 1.</span> |
---|
380 | (user-defined |
---|
381 | </a><a href="chapter_3.5.4.html#vertical_profiles">vertical |
---|
382 | profiles</a><a href="chapter_3.5.4.html#vertical_profiles">)</a><span style="font-weight: bold;"></span> and <a href="chapter_3.5.4.html#2D_and_3D"><span style="font-weight: bold;">part 3.</span> (user-defined</a><a href="chapter_3.5.4.html#2D_and_3D"> </a><a href="chapter_3.5.4.html#2D_and_3D">3d volume data</a><a href="chapter_3.5.4.html#2D_and_3D">)</a><span style="font-weight: bold;"></span>. Therefore, the |
---|
383 | following prerequisites apply |
---|
384 | for each user-defined |
---|
385 | spectra quantity:</li></ol><ol style="list-style-type: upper-alpha;"><ol style="list-style-type: upper-alpha;"><li>From <a href="chapter_3.5.4.html#vertical_profiles"><span style="font-weight: bold;">part 1.</span> |
---|
386 | (user-defined |
---|
387 | </a><a href="chapter_3.5.4.html#vertical_profiles">vertical |
---|
388 | profiles</a><a href="chapter_3.5.4.html#vertical_profiles">)</a> |
---|
389 | steps 2 and 3. <br>See the sample code (as comment lines) for <span style="font-style: italic;">'u*v*'</span> and <code>ustvst</code>, |
---|
390 | respectively. (Actual output of vertical profiles - step 1 - is not |
---|
391 | required.)</li><li>From <a href="chapter_3.5.4.html#2D_and_3D"><span style="font-weight: bold;">part 3.</span> (user-defined</a><a href="chapter_3.5.4.html#2D_and_3D"> </a><a href="chapter_3.5.4.html#2D_and_3D">3d volume data</a><a href="chapter_3.5.4.html#2D_and_3D">)</a> steps 2, 3, |
---|
392 | 4, 5, and 6. <br>See the sample code (as comment lines) for <span style="font-style: italic;">'u*v*'</span> and <code>ustvst</code>, |
---|
393 | respectively. (Actual output of 3d volume data - step 1 - is not |
---|
394 | required.)</li><li>The quantity has to be given a unique |
---|
395 | string identifier, e.g. <span style="font-style: italic;">'u*v*'</span>. |
---|
396 | This identifier must be different from the identifiers used for the |
---|
397 | PALM standard output (see list in description of package parameter <a href="chapter_4.2.html#data_output_sp">data_output_sp</a>). |
---|
398 | To switch on output of this quantity, the user has to assign the string |
---|
399 | identifier to the package parameter <a href="chapter_4.2.html#data_output_sp">data_output_sp</a>, |
---|
400 | eg.:<br><br><span style="font-family: monospace;"> |
---|
401 | data_output_sp</span> = <span style="font-style: italic;">'u*v*'</span><br><br></li></ol>A. |
---|
402 | and B. as prerequisites for C. require a naming convention of identical |
---|
403 | identifiers, e.g. data_output_pr_user = 'u*v*', data_output_user = |
---|
404 | 'u*v*' and data_output_sp = 'u*v*'. This naming convention applies only |
---|
405 | in case of user-defined spectra.</ol><ol start="2"><li>Edit |
---|
406 | the subroutine <a href="chapter_3.5.1.html#user_spectra">user_spectra</a> |
---|
407 | (only those parts in <span style="color: rgb(255, 0, 0);">red</span>) |
---|
408 | as follows:<br><br><code> |
---|
409 | IF ( mode == 'preprocess' ) THEN<br><br> |
---|
410 | SELECT CASE ( TRIM( data_output_sp(m) ) )<br> |
---|
411 | <br> |
---|
412 | CASE ( 'u', 'v', 'w', 'pt', 'q' )<br>!-- |
---|
413 | Not allowed here since these are the standard quantities used in <br>!-- |
---|
414 | preprocess_spectra.<br> |
---|
415 | <br><span style="color: rgb(255, 0, 0); background-color: rgb(255, 255, 255);"> |
---|
416 | CASE ( 'u*v*' )</span><br style="color: rgb(255, 0, 0); background-color: rgb(255, 255, 255);"><span style="color: rgb(255, 0, 0); background-color: rgb(255, 255, 255);"> |
---|
417 | pr = pr_palm+1</span><br style="color: rgb(255, 0, 0); background-color: rgb(255, 255, 255);"><span style="color: rgb(255, 0, 0); background-color: rgb(255, 255, 255);"> |
---|
418 | d(nzb+1:nzt,nys:nyn,nxl:nxr) = ustvst(nzb+1:nzt,nys:nyn,nxl:nxr)</span><br style="color: rgb(255, 0, 0); background-color: rgb(255, 255, 255);"> |
---|
419 | <br> |
---|
420 | CASE DEFAULT<br> |
---|
421 | PRINT*, '+++ user_spectra/preprocess: Spectra of ', &<br> |
---|
422 | TRIM( data_output_sp(m) ), ' can not be calculated'<br> |
---|
423 | <br> |
---|
424 | END SELECT<br><br> ELSEIF ( |
---|
425 | mode == 'data_output' ) THEN<br><br> |
---|
426 | SELECT CASE ( TRIM( data_output_sp(m) ) )<br><br> |
---|
427 | CASE ( 'u', 'v', 'w', 'pt', 'q' )<br>!-- |
---|
428 | Not allowed here since these are the standard quantities used in <br>!-- |
---|
429 | data_output_spectra.<br><br><span style="color: rgb(255, 0, 0);"> |
---|
430 | CASE ( 'u*v*' )</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);"> |
---|
431 | pr = 6</span><br style="color: rgb(255, 0, 0);"><br> |
---|
432 | CASE DEFAULT<br> |
---|
433 | PRINT*, '+++ user_spectra/data_output: Spectra of ', &<br> |
---|
434 | TRIM( data_output_sp(m) ), ' are not defined'<br><br> |
---|
435 | END SELECT<br><br> ENDIF</code><br></li></ol>Note |
---|
436 | that spectra output is an <a href="chapter_3.7.html">optional |
---|
437 | software package</a> (see <a href="chapter_3.7.html">chapter |
---|
438 | 3.7</a>). Therefore user-defined spectra also require the package |
---|
439 | activation via <code>mrun -p spectra</code>.<hr> |
---|
440 | <p style="line-height: 100%;"><br><font color="#000080"><font color="#000080"><a href="chapter_3.5.3.html"><font color="#000080"><img src="left.gif" name="Grafik1" align="bottom" border="2" height="32" width="32"></font></a><a href="index.html"><font color="#000080"><img src="up.gif" name="Grafik2" align="bottom" border="2" height="32" width="32"></font></a><a href="chapter_3.5.5.html"><font color="#000080"><img style="border: 2px solid ; width: 32px; height: 32px;" alt="" src="right.gif" name="Grafik3"></font></a></font></font></p><p style="line-height: 100%;"><i>Last |
---|
441 | change: </i> $Id: chapter_3.5.4.html 136 2007-11-26 |
---|
442 | 02:47:32Z letzel $</p> |
---|
443 | </body></html> |
---|