- Timestamp:
- Jan 4, 2008 4:29:45 AM (17 years ago)
- Location:
- palm/trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/DOC/app/chapter_3.5.1.html
r138 r144 206 206 in the CASE 207 207 structure of <tt><font style="font-size: 10pt;" size="2">user_actions_ij</font></tt>!</p> </td> 208 </tr> <tr valign="top"> <td width="211"><p><tt><font style="font-size: 10pt;" size="2">flow_statistics.f90</font></tt> 208 </tr> <tr><td style="vertical-align: top;"><code>SUBROUTINE preprocess_spectra</code> in <code>calc_spectra.f90</code>, and <code>data_output_spectra.f90</code></td><td style="vertical-align: top;"><tt><font style="font-size: 10pt;" size="2"><font face="Cumberland, monospace"><a name="user_spectra"></a>user_spectra</font></font></tt></td><td style="vertical-align: top;"><p><a href="chapter_3.5.4.html#spectra">Spectra of user-defined 209 quantities</a> can be computed here.</p>The 210 routine contains some simple examples (as comment lines) in order to 211 demonstrate how to use it.</td></tr><tr valign="top"> <td width="211"><p><tt><font style="font-size: 10pt;" size="2">flow_statistics.f90</font></tt> 209 212 before the summation of array <span style="font-family: monospace;">hom</span> 210 213 (horizontal averages)<br> </p> </td> <td width="117"> <p><tt><font style="font-size: 10pt;" size="2"><font face="Cumberland, monospace"><a name="user_statistics"></a>user_statistics<br>( -
palm/trunk/DOC/app/chapter_3.5.4.html
r136 r144 13 13 quantities which are not part of PALM's standard output. The basic user 14 14 interface includes a number of subroutines which allow the calculation 15 of user-defined quantities and output of these quantities as 1. (horizontally averaged) <a href="#vertical_profiles">vertical profiles</a>, 2. <a href="#time_series">time series</a>, 3. <a href="#2D_and_3D">2d cross 16 section</a> or <a href="#2D_and_3D">3d volume data</a> and 4. <a href="#dvrp">dvrp</a> objects. The respective subroutines 17 contain sample code lines (written as comment lines) for defining, calculating and 18 output of such quantities.<br><br>Output times, averaging intervals, etc. are steered by the same variables as used for the standard PALM output quantities, e.g. <a href="chapter_4.2.html#dt_data_output">dt_data_output</a>.<br><br>The 19 rest of this chapter explains step-by-step how to modify/extend the 20 default file user_interface.f90 in order to generate the respective output.<br><br><br><h4><a name="vertical_profiles"></a>1. Output of vertical profiles</h4>This example shows the output of the 21 quantity "turbulent resolved-scale horizontal momentum flux" (u*v*). If more than one user-defined 22 quantity shall be output, the following steps have to be carried out in the 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 default file user_interface.f90 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 23 39 same way for each of the quantities.<br><br><ol><li>The 24 40 quantity has to be given a unique string identifier, e.g. <span style="font-style: italic;">'u*v*'</span>. … … 31 47 the 32 48 quantity, an identification number, a physical unit, and the vertical 33 grid on which it is defined (u- or w-grid), has to be assigned (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> CASE ( 34 'u*v*' )<br></span><span style="font-family: monospace;"> index = pr_palm + <span style="color: rgb(255, 0, 0);">1<span style="color: rgb(0, 0, 0);"> 35 36 37 ! identification number</span></span><br> dopr_index(var_count) = index<br> dopr_unit(var_count) = '<span style="color: rgb(255, 0, 0);">m2/s2</span>' 38 39 ! physical unit<br> hom(:,2,index,:) = SPREAD( <span style="color: rgb(255, 0, 0);">zu</span>, 2, statistic_regions+1 ) ! vertical grid<br></span><br>Here only the those parts in <span style="color: rgb(255, 0, 0);">red</span> color have to be given by the user appropriately.<br>The identification number (<span style="font-family: Courier New,Courier,monospace;">index</span>) must be within the range [<span style="font-family: Courier New,Courier,monospace;"> pr_palm+1 , pr_palm+max_pr_user</span> ], where <span style="font-family: Courier New,Courier,monospace;">max_pr_user</span> 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> in the respective PALM run. The physical unit has to be given with respect to the NetCDF conventions. If no unit is given, 40 PALM will abort. The vertical grid has to be either <span style="font-family: Courier New,Courier,monospace;">zu</span> (u-grid) or <span style="font-family: Courier New,Courier,monospace;">zw</span> (w-grid).<br><br></li><li>The quantity has to 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 DO</span><br style="font-family: monospace;"><span style="font-family: monospace;"> DO i = nxl, nxr</span><br style="font-family: monospace;"><span style="font-family: monospace;"> DO j = nys, nyn</span><br style="font-family: monospace;"><span style="font-family: monospace;"> DO k = nzb_s_outer(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;"> sums_l(k,pr_palm+<span style="color: rgb(255, 0, 0);">1</span>,tn) = sums_l(k,pr_palm+<span style="color: rgb(255, 0, 0);">1</span>,tn) + &</span><br style="font-family: monospace;"><span style="font-family: monospace;"> <span style="color: rgb(255, 0, 0);">( 0.5 * ( u(k,j,i) + 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);"> 41 ( 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;"> 42 * rmask(j,i,sr)<br> ENDDO<br> ENDDO<br> ENDDO<br></span><br style="font-family: monospace;">Once again, only those parts in <span style="color: rgb(255, 0, 0);">red</span> have to be adjusted by the user.<br>The 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 43 95 turbulent resolved-scale momentum flux u*v* is defined as the product 44 96 of the deviations of the horizontal velocities from their respective 45 97 horizontally averaged mean values. These mean values are stored in 46 array <span style="font-family: Courier New,Courier,monospace;">hom(..,1,1,sr)</span> and <span style="font-family: Courier New,Courier,monospace;">hom(..,1,2,sr)</span> for the u- and v-component, respectively. Since due to the staggered grid, <span style="font-family: Courier New,Courier,monospace;">u</span> and <span style="font-family: Courier New,Courier,monospace;">v</span> 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> 47 103 are not defined at the same gridpoints, they have to be interpolated 48 104 appropriately (here to the center of the gridbox). The result of the 49 105 calculation is stored in array <span style="font-family: Courier New,Courier,monospace;">sums_l</span>. 50 106 The second index of this array is the identification number of the 51 profile which must match the one given in the previous step 2.</li></ol><br><h4><a name="time_series"></a>2. Output of timeseries</h4>This example shows the output of two time series 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 user-defined 52 quantity shall be output, the following steps have to be carried out in the 53 same way for each of the quantities.<br><br><ol><li>For each time series quantity you have to give a label and a unit (subroutine <a href="chapter_3.5.1.html#user_init">user_init</a>), which will be used for the NetCDF file. They must not contain more than seven characters. The value of <code>dots_num</code> has to be increased by the number of new time series quantities. Its old value has to be stored in <code>dots_num_palm</code>.<br><br><code> dots_label(dots_num<span style="color: rgb(255, 0, 0);">+1</span>) = '<span style="color: rgb(255, 0, 0);">abs_umx</span>'<br> dots_unit(dots_num<span style="color: rgb(255, 0, 0);">+1</span>) = '<span style="color: rgb(255, 0, 0);">m/s</span>'<br> dots_label(dots_num<span style="color: rgb(255, 0, 0);">+2</span>) = '<span style="color: rgb(255, 0, 0);">abs_vmx</span>'<br> dots_unit(dots_num<span style="color: rgb(255, 0, 0);">+2</span>) = '<span style="color: rgb(255, 0, 0);">m/s</span>'<br><br> dots_num_palm = dots_num<br> dots_num = dots_num <span style="color: rgb(255, 0, 0);">+ 2</span><br><br></code>Only those parts in <span style="color: rgb(255, 0, 0);">red</span> have to be adjusted by the user.<br><br></li><li>These quantities are calculated and output in subroutine <a href="chapter_3.5.1.html#user_statistics">user_statistics</a> for every statistic region <code>sr</code> defined by the user, but at least for the region <span style="font-style: italic;">"total domain"</span>:<br> <br><code> ts_value(dots_num_palm+1,sr) = ABS( u_max )<br> 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. Output of 2d cross sections or 3d volume data</span></h4><br>This example shows the output 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 54 139 quantity "square of the u-component" (<span style="font-weight: bold;">Note:</span> this quantity 55 140 could of course easily be calculated from the u-component by 56 141 postprocessing the PALM output so that calculation within PALM is not 57 142 necessarily required). If more than one user-defined 58 quantity shall be output, the following steps have to be carried out in the 143 quantity shall be output, the following steps have to be carried out in 144 the 59 145 same way for each of the quantities.<br><br><ol><li>The 60 146 quantity has to be given a unique string identifier, e.g. <span style="font-style: italic;">'u2'</span>. … … 220 306 '; WRITE ( 14 ) u2_av</span><br style="font-family: monospace;"><span style="font-family: monospace;"> 221 307 ENDIF</span><br><br>Otherwise, the calculated 222 time-average may be wrong.</li></ol><br><h4><a name="dvrp"></a>4. Output of DVRP objects</h4>This example shows the output of the 223 quantity "square of the u-component", <span style="font-style: italic;">u<sup>2</sup></span>. If more than one user-defined 224 quantity shall be output, the following steps have to be carried out in the 225 same way for each of the quantities. First, steps 1 - 6 of <a href="chapter_3.5.4.html#2D_and_3D">2d cross 226 section</a> or <a href="chapter_3.5.4.html#2D_and_3D">3d volume data</a> are required. Second, the gridpoint data of the quantity has to 308 time-average may be wrong.</li></ol><br><h4><a name="dvrp"></a>4. Output of user-defined DVRP objects</h4>This 309 example shows the output of the 310 quantity "square of the u-component", <span style="font-style: italic;">u<sup>2</sup></span>. 311 If more than one user-defined 312 quantity shall be output, the following steps have to be carried out in 313 the 314 same way for each of the quantities. First, steps 1 - 6 315 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 316 section or </a><a href="chapter_3.5.4.html#2D_and_3D">3d 317 volume data)</a> are required. Second, the gridpoint 318 data 319 of the quantity has to 227 320 be resorted to array <span style="font-family: monospace;">local_pf</span> 228 in subroutine <a href="chapter_3.5.1.html#user_data_output_dvrp"><span style="font-family: monospace;">user_data_output_dvrp</span></a> as follows:<br><br><code> CASE ( '<span style="color: rgb(255, 0, 0);">u2</span>', '<span style="color: rgb(255, 0, 0);">u2</span>_xy', '<span style="color: rgb(255, 0, 0);">u2</span>_xz', '<span style="color: rgb(255, 0, 0);">u2</span>_yz' )<br> DO i = nxl, nxr+1<br> DO j = nys, nyn+1<br> DO k = nzb, nz_do3d<br> local_pf(i,j,k) = <span style="color: rgb(255, 0, 0);">u2</span>(k,j,i)<br> ENDDO<br> ENDDO<br> ENDDO</code><br><br>Only those parts in <span style="color: rgb(255, 0, 0);">red</span> have to be adjusted by the user.<br><br>After performing these steps, the user-defined quantity <code>'u2'</code> can be selected like standard model quantities by the <a href="chapter_4.2.html#dvrp_graphics">dvrp_graphics</a> package parameter <a href="chapter_4.2.html#mode_dvrp">mode_dvrp</a>.<hr> 229 <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> 230 <p style="line-height: 100%;"><i>Last 231 change: </i> $Id$</p> 321 in subroutine <a href="chapter_3.5.1.html#user_data_output_dvrp"><span style="font-family: monospace;">user_data_output_dvrp</span></a> 322 as follows:<br><br><code> 323 CASE ( '<span style="color: rgb(255, 0, 0);">u2</span>', 324 '<span style="color: rgb(255, 0, 0);">u2</span>_xy', 325 '<span style="color: rgb(255, 0, 0);">u2</span>_xz', 326 '<span style="color: rgb(255, 0, 0);">u2</span>_yz' 327 )<br> 328 DO i = nxl, nxr+1<br> 329 DO j = nys, nyn+1<br> 330 DO k = nzb, nz_do3d<br> 331 local_pf(i,j,k) = <span style="color: rgb(255, 0, 0);">u2</span>(k,j,i)<br> 332 ENDDO<br> 333 ENDDO<br> 334 ENDDO</code><br><br>Only those parts in <span style="color: rgb(255, 0, 0);">red</span> have to be 335 adjusted by the user.<br><br>After performing these steps, 336 the user-defined quantity <code>'u2'</code> can be 337 selected like standard model quantities by the <a href="chapter_4.2.html#dvrp_graphics">dvrp_graphics</a> 338 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 339 example shows the output of the 340 quantity "turbulent resolved-scale horizontal momentum flux" (u*v*). If 341 more than one user-defined 342 quantity shall be output, the following steps have to be carried out in 343 the 344 same way for each of the quantities.<br><br><ol><li>The 345 calculation of user-defined spectra is closely linked with the 346 calculation of <a href="chapter_3.5.4.html#vertical_profiles"><span style="font-weight: bold;">part 1.</span> 347 (user-defined 348 </a><a href="chapter_3.5.4.html#vertical_profiles">vertical 349 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 350 following prerequisites apply 351 for each user-defined 352 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> 353 (user-defined 354 </a><a href="chapter_3.5.4.html#vertical_profiles">vertical 355 profiles</a><a href="chapter_3.5.4.html#vertical_profiles">)</a> 356 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>, 357 respectively. (Actual output of vertical profiles - step 1 - is not 358 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, 359 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>, 360 respectively. (Actual output of 3d volume data - step 1 - is not 361 required.)</li><li>The quantity has to be given a unique 362 string identifier, e.g. <span style="font-style: italic;">'u*v*'</span>. 363 This identifier must be different from the identifiers used for the 364 PALM standard output (see list in description of package parameter <a href="chapter_4.2.html#data_output_sp">data_output_sp</a>). 365 To switch on output of this quantity, the user has to assign the string 366 identifier to the package parameter <a href="chapter_4.2.html#data_output_sp">data_output_sp</a>, 367 eg.:<br><br><span style="font-family: monospace;"> 368 data_output_sp</span> = <span style="font-style: italic;">'u*v*'</span><br><br></li></ol>A. 369 and B. as prerequisites for C. require a naming convention of identical 370 identifiers, e.g. data_output_pr_user = 'u*v*', data_output_user = 371 'u*v*' and data_output_sp = 'u*v*'. This naming convention applies only 372 in case of user-defined spectra.</ol><ol start="2"><li>Edit 373 the subroutine <a href="chapter_3.5.1.html#user_spectra">user_spectra</a> 374 (only those parts in <span style="color: rgb(255, 0, 0);">red</span>) 375 as follows:<br><br><code> 376 IF ( mode == 'preprocess' ) THEN<br><br> 377 SELECT CASE ( TRIM( data_output_sp(m) ) )<br> 378 <br> 379 CASE ( 'u', 'v', 'w', 'pt', 'q' )<br>!-- 380 Not allowed here since these are the standard quantities used in <br>!-- 381 preprocess_spectra.<br> 382 <br><span style="color: rgb(255, 0, 0); background-color: rgb(255, 255, 255);"> 383 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);"> 384 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);"> 385 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);"> 386 <br> 387 CASE DEFAULT<br> 388 PRINT*, '+++ user_spectra/preprocess: Spectra of ', &<br> 389 TRIM( data_output_sp(m) ), ' can not be calculated'<br> 390 <br> 391 END SELECT<br><br> ELSEIF ( 392 mode == 'data_output' ) THEN<br><br> 393 SELECT CASE ( TRIM( data_output_sp(m) ) )<br><br> 394 CASE ( 'u', 'v', 'w', 'pt', 'q' )<br>!-- 395 Not allowed here since these are the standard quantities used in <br>!-- 396 data_output_spectra.<br><br><span style="color: rgb(255, 0, 0);"> 397 CASE ( 'u*v*' )</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);"> 398 pr = 6</span><br style="color: rgb(255, 0, 0);"><br> 399 CASE DEFAULT<br> 400 PRINT*, '+++ user_spectra/data_output: Spectra of ', &<br> 401 TRIM( data_output_sp(m) ), ' are not defined'<br><br> 402 END SELECT<br><br> ENDIF</code><br></li></ol>Note 403 that spectra output is an <a href="chapter_3.7.html">optional 404 software package</a> (see <a href="chapter_3.7.html">chapter 405 3.7</a>). Therefore user-defined spectra also require the package 406 activation via <code>mrun - p spectra</code>.<hr> 407 <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 408 change: </i> $Id: chapter_3.5.4.html 136 2007-11-26 409 02:47:32Z letzel $</p> 232 410 </body></html> -
palm/trunk/DOC/app/chapter_4.2.html
r130 r144 11238 11238 11239 11239 11240 <p>Allowed values are: <b>data_output_sp</b>11241 = <span style="font-style: italic;">'u'</span>, <span style="font-style: italic;">'v'</span>, <span style="font-style: italic;">'w'</span>, <span style="font-style: italic;">'pt'</span>, <span style="font-style: italic;">'q'</span>. <br>11240 <p>Allowed standard values are: <b>data_output_sp</b> 11241 = <span style="font-style: italic;">'u'</span>, <span style="font-style: italic;">'v'</span>, <span style="font-style: italic;">'w'</span>, <span style="font-style: italic;">'pt'</span>, <span style="font-style: italic;">'q'</span>. The user may define further quantities (see <a href="chapter_3.5.4#spectra">chapter 3.5.4 part 5</a>).<br> 11242 11242 11243 11243 -
palm/trunk/SOURCE/CURRENT_MODIFICATIONS
r143 r144 15 15 necessary for the current subdomain. 16 16 17 check_open, read_var_list, read_3d_binary, write_3d_binary 17 User-defined spectra. 18 19 calc_spectra, check_open, data_output_spectra, netcdf, read_var_list, read_3d_binary, user_interface, write_3d_binary 18 20 19 21 … … 38 40 NetCDF files newly created by restart files (no append of existing files!) 39 41 contained uneccessary time levels. (read_3d_binary, write_3d_binary) 42 Bugfix: extra '*' removed in user_statistics sample code (user_interface) 40 43 41 flow_statistics, plant_canopy_model, read_3d_binary, write_3d_binary44 flow_statistics, plant_canopy_model, read_3d_binary, user_interface, write_3d_binary 42 45 -
palm/trunk/SOURCE/calc_spectra.f90
r4 r144 4 4 ! Actual revisions: 5 5 ! ----------------- 6 ! 6 ! user-defined spectra 7 7 ! 8 8 ! Former revisions: … … 180 180 181 181 CASE DEFAULT 182 PRINT*, '+++ preprocess_spectra: Spectra of ', & 183 TRIM( data_output_sp(m) ), ' can not be calculated' 182 ! 183 !-- The DEFAULT case is reached either if the parameter data_output_sp(m) 184 !-- contains a wrong character string or if the user has coded a special 185 !-- case in the user interface. There, the subroutine user_spectra 186 !-- checks which of these two conditions applies. 187 CALL user_spectra( 'preprocess', m, pr ) 184 188 185 189 END SELECT -
palm/trunk/SOURCE/data_output_spectra.f90
r4 r144 4 4 ! Actual revisions: 5 5 ! ----------------- 6 ! 6 ! user-defined spectra 7 7 ! 8 8 ! Former revisions: … … 117 117 118 118 CASE DEFAULT 119 PRINT*, '+++ data_output_spectra: Spectra of ', & 120 TRIM( data_output_sp(m) ), ' are not defined' 119 ! 120 !-- The DEFAULT case is reached either if the parameter 121 !-- data_output_sp(m) contains a wrong character string or if the 122 !-- user has coded a special case in the user interface. There, the 123 !-- subroutine user_spectra checks which of these two conditions 124 !-- applies. 125 CALL user_spectra( 'data_output', m, pr ) 121 126 122 127 END SELECT -
palm/trunk/SOURCE/netcdf.f90
r98 r144 7 7 ! Current revisions: 8 8 ! ------------------ 9 ! 9 ! user-defined spectra 10 10 ! 11 11 ! Former revisions: … … 2867 2867 i = 1 2868 2868 DO WHILE ( data_output_sp(i) /= ' ' .AND. i <= 10 ) 2869 ! 2870 !-- First check for the vertical grid 2871 found = .TRUE. 2872 SELECT CASE ( data_output_sp(i) ) 2873 ! 2874 !-- Most variables are defined on the zu levels 2875 CASE ( 'e', 'p', 'pc', 'pr', 'pt', 'q', 'ql', 'ql_c', 'ql_v', & 2876 'ql_vp', 'qv', 'rho', 's', 'sa', 'u', 'v', 'vpt' ) 2877 2878 grid_z = 'zu' 2879 ! 2880 !-- zw levels 2881 CASE ( 'w' ) 2882 2883 grid_z = 'zw' 2884 2885 CASE DEFAULT 2886 ! 2887 !-- Check for user-defined quantities (found, grid_x and grid_y 2888 !-- are dummies) 2889 CALL user_define_netcdf_grid( data_output_sp(i), found, & 2890 grid_x, grid_y, grid_z ) 2891 2892 END SELECT 2869 2893 2870 2894 IF ( INDEX( spectra_direction(i), 'x' ) /= 0 ) THEN … … 2873 2897 !-- Define the variable 2874 2898 netcdf_var_name = TRIM( data_output_sp(i) ) // '_x' 2875 IF ( data_output_sp(i) == 'w' ) THEN 2899 CALL clean_netcdf_varname( netcdf_var_name ) 2900 IF ( TRIM( grid_z ) == 'zw' ) THEN 2876 2901 nc_stat = NF90_DEF_VAR( id_set_sp, netcdf_var_name, & 2877 2902 nc_precision(7), (/ id_dim_x_sp, & … … 2903 2928 !-- Define the variable 2904 2929 netcdf_var_name = TRIM( data_output_sp(i) ) // '_y' 2905 IF ( data_output_sp(i) == 'w' ) THEN 2930 CALL clean_netcdf_varname( netcdf_var_name ) 2931 IF ( TRIM( grid_z ) == 'zw' ) THEN 2906 2932 nc_stat = NF90_DEF_VAR( id_set_sp, netcdf_var_name, & 2907 2933 nc_precision(7), (/ id_dim_y_sp, & -
palm/trunk/SOURCE/user_interface.f90
r139 r144 4 4 ! Actual revisions: 5 5 ! ----------------- 6 ! 6 ! new subroutine user_spectra 7 7 ! 8 8 ! Former revisions: … … 56 56 !-- Sample for user-defined output 57 57 ! REAL, DIMENSION(:,:,:), ALLOCATABLE :: u2, u2_av 58 ! REAL, DIMENSION(:,:,:), ALLOCATABLE :: ustvst 58 59 59 60 SAVE … … 198 199 !-- Sample for user-defined output 199 200 ! ALLOCATE( u2(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ) 201 ! ALLOCATE( ustvst(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) ) 200 202 ! 201 203 ! IF ( initializing_actions == 'read_restart_data' ) THEN … … 456 458 ! ENDDO 457 459 ! ENDDO 460 ! DO i = nxl-1, nxr+1 461 ! DO j = nys-1, nyn+1 462 ! DO k = nzb, nzt+1 463 ! ustvst(k,j,i) = & 464 ! ( 0.5 * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,0) ) * & 465 ! ( 0.5 * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,0) ) 466 ! ENDDO 467 ! ENDDO 468 ! ENDDO 458 469 459 470 … … 561 572 END MODULE user_actions_mod 562 573 574 575 576 SUBROUTINE user_spectra( mode, m, pr ) 577 578 !------------------------------------------------------------------------------! 579 ! 580 ! Description: 581 ! ------------ 582 ! Calculation of user-defined spectra. 583 ! See section 3.5.4 on how to define, calculate, and output user defined 584 ! quantities. 585 !------------------------------------------------------------------------------! 586 587 USE arrays_3d 588 USE indices 589 USE spectrum 590 USE statistics 591 USE user 592 593 IMPLICIT NONE 594 595 CHARACTER (LEN=*) :: mode 596 597 INTEGER :: i, j, k, m, pr 598 599 600 ! 601 !-- Sample on how to calculate spectra of user-defined quantities. 602 !-- Each quantity is identified by the corresponding user profile index 603 !-- "pr_palm+#" where "#" is an integer starting from 1. These 604 !-- user-profile-numbers must also be assigned to the respective strings 605 !-- given by data_output_pr_user in routine user_check_data_output_pr. 606 IF ( mode == 'preprocess' ) THEN 607 608 SELECT CASE ( TRIM( data_output_sp(m) ) ) 609 610 CASE ( 'u', 'v', 'w', 'pt', 'q' ) 611 !-- Not allowed here since these are the standard quantities used in 612 !-- preprocess_spectra. 613 614 ! CASE ( 'u*v*' ) 615 ! pr = pr_palm+1 616 ! d(nzb+1:nzt,nys:nyn,nxl:nxr) = ustvst(nzb+1:nzt,nys:nyn,nxl:nxr) 617 618 CASE DEFAULT 619 PRINT*, '+++ user_spectra/preprocess: Spectra of ', & 620 TRIM( data_output_sp(m) ), ' can not be calculated' 621 622 END SELECT 623 624 ELSEIF ( mode == 'data_output' ) THEN 625 626 SELECT CASE ( TRIM( data_output_sp(m) ) ) 627 628 CASE ( 'u', 'v', 'w', 'pt', 'q' ) 629 !-- Not allowed here since these are the standard quantities used in 630 !-- data_output_spectra. 631 632 ! CASE ( 'u*v*' ) 633 ! pr = 6 634 635 CASE DEFAULT 636 PRINT*, '+++ user_spectra/data_output: Spectra of ', & 637 TRIM( data_output_sp(m) ), ' are not defined' 638 639 END SELECT 640 641 ENDIF 642 643 END SUBROUTINE user_spectra 563 644 564 645 … … 600 681 ! DO i = nxl, nxr 601 682 ! DO j = nys, nyn 602 ! DO k = nzb_s_ outer(j,i)+1, nzt683 ! DO k = nzb_s_inner(j,i)+1, nzt 603 684 !! 604 685 !!-- Sample on how to calculate the profile of the resolved-scale … … 606 687 ! sums_l(k,pr_palm+1,tn) = sums_l(k,pr_palm+1,tn) + & 607 688 ! ( 0.5 * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,sr) ) * & 608 ! ( 0.5 * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,sr) ) *&689 ! ( 0.5 * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,sr) ) & 609 690 ! * rmask(j,i,sr) 610 691 !! … … 796 877 !-- Uncomment and extend the following lines, if necessary 797 878 ! CASE ( 'u2' ) 879 ! unit = 'm2/s2' 880 ! 881 ! CASE ( 'u*v*' ) 798 882 ! unit = 'm2/s2' 799 883 ! … … 890 974 ! CASE ( 'u2', 'u2_xy', 'u2_xz', 'u2_yz' ) 891 975 ! grid_x = 'xu' 976 ! grid_y = 'y' 977 ! grid_z = 'zu' 978 979 ! CASE ( 'u*v*', 'u*v*_xy', 'u*v*_xz', 'u*v*_yz' ) 980 ! grid_x = 'x' 892 981 ! grid_y = 'y' 893 982 ! grid_z = 'zu'
Note: See TracChangeset
for help on using the changeset viewer.