Changeset 144 for palm


Ignore:
Timestamp:
Jan 4, 2008 4:29:45 AM (17 years ago)
Author:
letzel
Message:

User-defined spectra.

Bugfix: extra '*' removed in user_statistics sample code (user_interface).

Location:
palm/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/DOC/app/chapter_3.5.1.html

    r138 r144  
    206206in the CASE
    207207structure 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
     209quantities</a> can be computed here.</p>The
     210routine contains some simple examples (as comment lines) in order to
     211demonstrate 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>
    209212before the summation of array <span style="font-family: monospace;">hom</span>
    210213(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  
    1313quantities which are not part of PALM's standard output. The basic user
    1414interface 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.&nbsp;<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
     15of user-defined quantities and output of these quantities as 1.
     16(horizontally averaged) <a href="#vertical_profiles">vertical
     17profiles</a>, 2.&nbsp;<a href="#time_series">time
     18series</a>, 3. <a href="#2D_and_3D">2d cross
     19section</a> or <a href="#2D_and_3D">3d volume data</a>,
     204. <a href="#dvrp">dvrp</a> objects, and 5. <a href="#spectra">spectra</a>. The respective
     21subroutines
     22contain sample code lines (written as comment lines) for defining,
     23calculating and
     24output of such quantities.<br><br>Output times, averaging
     25intervals, etc. are steered by the same variables as used for the
     26standard PALM output quantities, e.g. <a href="chapter_4.2.html#dt_data_output">dt_data_output</a>.<br><br>The
     27following five parts of&nbsp;this chapter explains step-by-step how
     28to modify/extend the
     29default file user_interface.f90 in order to generate the respective
     30output:<br><ol><li>(horizontally averaged) <a href="chapter_3.5.4.html#vertical_profiles">vertical profiles</a>,&nbsp;</li><li><a href="chapter_3.5.4.html#time_series">time series</a>,&nbsp;</li><li><a href="chapter_3.5.4.html#2D_and_3D">2d cross
     31section</a> or <a href="chapter_3.5.4.html#2D_and_3D">3d
     32volume data</a>,&nbsp;</li><li><a href="chapter_3.5.4.html#dvrp">dvrp</a> objects,
     33and&nbsp;</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
     34vertical profiles</h4>This example shows the output of the
     35quantity "turbulent resolved-scale horizontal momentum flux" (u*v*). If
     36more than one user-defined
     37quantity shall be output, the following steps have to be carried out in
     38the
    2339same way for each of the quantities.<br><br><ol><li>The
    2440quantity has to be given a unique string identifier, e.g. <span style="font-style: italic;">'u*v*'</span>.
     
    3147the
    3248quantity, 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>&nbsp; &nbsp; CASE (
    34 'u*v*' )<br></span><span style="font-family: monospace;">&nbsp; &nbsp; &nbsp; &nbsp;index = pr_palm + <span style="color: rgb(255, 0, 0);">1<span style="color: rgb(0, 0, 0);">
    35 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    36 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    37 &nbsp; &nbsp; ! identification number</span></span><br>&nbsp; &nbsp; &nbsp; &nbsp;dopr_index(var_count) = index<br>&nbsp; &nbsp; &nbsp;&nbsp; dopr_unit(var_count) &nbsp;= '<span style="color: rgb(255, 0, 0);">m2/s2</span>'
    38 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    39 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ! physical unit<br>&nbsp; &nbsp; &nbsp; &nbsp;hom(:,2,index,:) &nbsp; &nbsp; &nbsp;= SPREAD( <span style="color: rgb(255, 0, 0);">zu</span>, 2, statistic_regions+1 ) &nbsp; &nbsp;! 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&nbsp;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.&nbsp;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;">&nbsp; &nbsp; !$OMP DO</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp; DO&nbsp; i = nxl, nxr</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DO&nbsp; j = nys, nyn</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DO&nbsp; 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;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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) +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 0, 0);">( 0.5 * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,sr) ) * &amp;</span></span><br style="font-family: monospace; color: rgb(255, 0, 0);"><span style="font-family: monospace; color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    41 ( 0.5 * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,sr) ) * &amp;</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    42 * rmask(j,i,sr)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ENDDO<br>&nbsp; &nbsp; &nbsp; &nbsp;ENDDO<br>&nbsp; &nbsp; 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
     49grid 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>&nbsp;
     51&nbsp; CASE (
     52'u*v*' )<br></span><span style="font-family: monospace;">&nbsp;
     53&nbsp; &nbsp; &nbsp;index = pr_palm + <span style="color: rgb(255, 0, 0);">1<span style="color: rgb(0, 0, 0);">
     54&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     55&nbsp; &nbsp; &nbsp; &nbsp;
     56&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     57&nbsp; &nbsp; &nbsp; &nbsp;
     58&nbsp; &nbsp; ! identification number</span></span><br>&nbsp;
     59&nbsp; &nbsp; &nbsp;dopr_index(var_count) = index<br>&nbsp;
     60&nbsp; &nbsp;&nbsp; dopr_unit(var_count) &nbsp;= '<span style="color: rgb(255, 0, 0);">m2/s2</span>'
     61&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
     62&nbsp; &nbsp; &nbsp; &nbsp;
     63&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; !
     64physical unit<br>&nbsp; &nbsp; &nbsp;
     65&nbsp;hom(:,2,index,:) &nbsp; &nbsp; &nbsp;= SPREAD( <span style="color: rgb(255, 0, 0);">zu</span>, 2,
     66statistic_regions+1 ) &nbsp; &nbsp;! vertical grid<br></span><br>Here
     67only the those parts in <span style="color: rgb(255, 0, 0);">red</span>
     68color have to be given by the user appropriately.<br>The
     69identification number (<span style="font-family: Courier New,Courier,monospace;">index</span>)
     70must be within the range [<span style="font-family: Courier New,Courier,monospace;">
     71pr_palm+1 , pr_palm+max_pr_user</span> ], where <span style="font-family: Courier New,Courier,monospace;">max_pr_user</span>
     72is the number of&nbsp;user-defined profiles as given by parameter <a href="chapter_4.3.html#data_output_pr_user">data_output_pr_user</a>
     73in the respective PALM run.&nbsp;The physical unit has to be given
     74with respect to the NetCDF conventions. If no unit is given,
     75PALM 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
     78be calculated for all gridpoints (subroutine <a href="chapter_3.5.1.html#user_statistics">user_statistics</a>):<br><br><span style="font-family: monospace;">&nbsp; &nbsp; !$OMP
     79DO</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;
     80DO&nbsp; i = nxl, nxr</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     81DO&nbsp; j = nys, nyn</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     82DO&nbsp; 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;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     83sums_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+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     86&amp;</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     87<span style="color: rgb(255, 0, 0);">( 0.5 * ( u(k,j,i) +
     88u(k,j,i+1) ) - hom(k,1,1,sr) ) * &amp;</span></span><br style="font-family: monospace; color: rgb(255, 0, 0);"><span style="font-family: monospace; color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     89( 0.5 * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,sr) ) &nbsp; &amp;</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     90* rmask(j,i,sr)<br>&nbsp; &nbsp; &nbsp; &nbsp;
     91&nbsp; ENDDO<br>&nbsp; &nbsp; &nbsp;
     92&nbsp;ENDDO<br>&nbsp; &nbsp; ENDDO<br></span><br style="font-family: monospace;">Once again, only those parts
     93in <span style="color: rgb(255, 0, 0);">red</span>
     94have to be adjusted by the user.<br>The
    4395turbulent resolved-scale momentum flux u*v* is defined as the product
    4496of the deviations of the horizontal velocities from their respective
    4597horizontally 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>
     98array <span style="font-family: Courier New,Courier,monospace;">hom(..,1,1,sr)</span>
     99and <span style="font-family: Courier New,Courier,monospace;">hom(..,1,2,sr)</span>
     100for the u- and v-component, respectively. Since due to the staggered
     101grid, <span style="font-family: Courier New,Courier,monospace;">u</span>
     102and <span style="font-family: Courier New,Courier,monospace;">v</span>
    47103are not defined at the same gridpoints, they have to be interpolated
    48104appropriately (here to the center of the gridbox). The result of the
    49105calculation is stored in array <span style="font-family: Courier New,Courier,monospace;">sums_l</span>.
    50106The 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>&nbsp;&nbsp;&nbsp; dots_label(dots_num<span style="color: rgb(255, 0, 0);">+1</span>) = '<span style="color: rgb(255, 0, 0);">abs_umx</span>'<br>&nbsp;&nbsp;&nbsp; dots_unit(dots_num<span style="color: rgb(255, 0, 0);">+1</span>)&nbsp; = '<span style="color: rgb(255, 0, 0);">m/s</span>'<br>&nbsp;&nbsp;&nbsp; dots_label(dots_num<span style="color: rgb(255, 0, 0);">+2</span>) = '<span style="color: rgb(255, 0, 0);">abs_vmx</span>'<br>&nbsp;&nbsp;&nbsp; dots_unit(dots_num<span style="color: rgb(255, 0, 0);">+2</span>)&nbsp; = '<span style="color: rgb(255, 0, 0);">m/s</span>'<br><br>&nbsp;&nbsp;&nbsp; dots_num_palm = dots_num<br>&nbsp;&nbsp;&nbsp; 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&nbsp;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,&nbsp;but at least for the region <span style="font-style: italic;">"total domain"</span>:<br>&nbsp;<br><code>&nbsp;&nbsp;&nbsp; ts_value(dots_num_palm+1,sr) = ABS( u_max )<br>&nbsp;&nbsp;&nbsp; ts_value(dots_num_palm+2,sr) = ABS( v_max )<br></code></li></ol>&nbsp;<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
     107profile 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
     108timeseries</h4>This example shows the output of two time series
     109for 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
     110user-defined
     111quantity shall be output, the following steps have to be carried out in
     112the
     113same way for each of the quantities.<br><br><ol><li>For
     114each 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>),
     116which will be used for the NetCDF file. They must not contain more than
     117seven characters. The value of <code>dots_num</code> has
     118to be increased by the number of new time series quantities. Its old
     119value has to be stored in <code>dots_num_palm</code>.<br><br><code>&nbsp;&nbsp;&nbsp;
     120dots_label(dots_num<span style="color: rgb(255, 0, 0);">+1</span>)
     121= '<span style="color: rgb(255, 0, 0);">abs_umx</span>'<br>&nbsp;&nbsp;&nbsp;
     122dots_unit(dots_num<span style="color: rgb(255, 0, 0);">+1</span>)&nbsp;
     123= '<span style="color: rgb(255, 0, 0);">m/s</span>'<br>&nbsp;&nbsp;&nbsp;
     124dots_label(dots_num<span style="color: rgb(255, 0, 0);">+2</span>)
     125= '<span style="color: rgb(255, 0, 0);">abs_vmx</span>'<br>&nbsp;&nbsp;&nbsp;
     126dots_unit(dots_num<span style="color: rgb(255, 0, 0);">+2</span>)&nbsp;
     127= '<span style="color: rgb(255, 0, 0);">m/s</span>'<br><br>&nbsp;&nbsp;&nbsp;
     128dots_num_palm = dots_num<br>&nbsp;&nbsp;&nbsp;
     129dots_num = dots_num <span style="color: rgb(255, 0, 0);">+
     1302</span><br><br></code>Only those parts in <span style="color: rgb(255, 0, 0);">red</span> have to be
     131adjusted by the user.<br><br></li><li>These
     132quantities are&nbsp;calculated and output in subroutine <a href="chapter_3.5.1.html#user_statistics">user_statistics</a>
     133for every statistic region <code>sr</code> defined by the
     134user,&nbsp;but at least for the region <span style="font-style: italic;">"total domain"</span>:<br>&nbsp;<br><code>&nbsp;&nbsp;&nbsp;
     135ts_value(dots_num_palm+1,sr) = ABS( u_max )<br>&nbsp;&nbsp;&nbsp;
     136ts_value(dots_num_palm+2,sr) = ABS( v_max )<br></code></li></ol>&nbsp;<br><h4><span style="font-weight: bold;"><a name="2D_and_3D"></a>3.
     137Output of user-defined 2d cross sections or 3d volume data</span></h4><br>This
     138example shows the output of the
    54139quantity "square of the u-component" (<span style="font-weight: bold;">Note:</span> this quantity
    55140could of course easily be calculated from the u-component by
    56141postprocessing the PALM output so that calculation within PALM is not
    57142necessarily required). If more than one user-defined
    58 quantity shall be output, the following steps have to be carried out in the
     143quantity shall be output, the following steps have to be carried out in
     144the
    59145same way for each of the quantities.<br><br><ol><li>The
    60146quantity has to be given a unique string identifier, e.g. <span style="font-style: italic;">'u2'</span>.
     
    220306';&nbsp; WRITE ( 14 )&nbsp; u2_av</span><br style="font-family: monospace;"><span style="font-family: monospace;">&nbsp;&nbsp;&nbsp;
    221307ENDIF</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,&nbsp;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,&nbsp;the gridpoint data of the quantity has to
     308time-average may be wrong.</li></ol><br><h4><a name="dvrp"></a>4. Output of user-defined DVRP objects</h4>This
     309example shows the output of the
     310quantity "square of the u-component", <span style="font-style: italic;">u<sup>2</sup></span>.
     311If more than one user-defined
     312quantity shall be output, the following steps have to be carried out in
     313the
     314same way for each of the quantities. First,&nbsp;steps 1 - 6
     315of&nbsp;<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
     316section or </a><a href="chapter_3.5.4.html#2D_and_3D">3d
     317volume data)</a> are required. Second,&nbsp;the gridpoint
     318data
     319of the quantity has to
    227320be 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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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'&nbsp; )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DO&nbsp; i = nxl, nxr+1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DO&nbsp; j = nys, nyn+1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DO&nbsp; k = nzb, nz_do3d<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; local_pf(i,j,k) = <span style="color: rgb(255, 0, 0);">u2</span>(k,j,i)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDDO<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ENDDO<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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:&nbsp;</i> $Id$</p>
     321in subroutine <a href="chapter_3.5.1.html#user_data_output_dvrp"><span style="font-family: monospace;">user_data_output_dvrp</span></a>
     322as follows:<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     323CASE ( '<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'&nbsp;
     327)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     328DO&nbsp; i = nxl, nxr+1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     329DO&nbsp; j = nys, nyn+1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     330DO&nbsp; k = nzb, nz_do3d<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     331local_pf(i,j,k) = <span style="color: rgb(255, 0, 0);">u2</span>(k,j,i)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     332ENDDO<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     333ENDDO<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     334ENDDO</code><br><br>Only those parts in <span style="color: rgb(255, 0, 0);">red</span> have to be
     335adjusted by the user.<br><br>After performing these steps,
     336the user-defined quantity <code>'u2'</code> can be
     337selected like standard model quantities by the <a href="chapter_4.2.html#dvrp_graphics">dvrp_graphics</a>
     338package 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
     339example shows the output of the
     340quantity "turbulent resolved-scale horizontal momentum flux" (u*v*). If
     341more than one user-defined
     342quantity shall be output, the following steps have to be carried out in
     343the
     344same way for each of the quantities.<br><br><ol><li>The
     345calculation of user-defined spectra is closely linked with the
     346calculation 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
     349profiles</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
     350following prerequisites apply
     351for each user-defined
     352spectra 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
     355profiles</a><a href="chapter_3.5.4.html#vertical_profiles">)</a>
     356steps 2 and 3. <br>See the sample code (as comment lines) for <span style="font-style: italic;">'u*v*'</span> and <code>ustvst</code>,
     357respectively. (Actual output of vertical profiles - step 1 - is not
     358required.)</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,
     3594, 5, and 6. <br>See the sample code (as comment lines) for <span style="font-style: italic;">'u*v*'</span> and <code>ustvst</code>,
     360respectively. (Actual output of 3d volume data - step 1 - is not
     361required.)</li><li>The quantity has to be given a unique
     362string identifier, e.g. <span style="font-style: italic;">'u*v*'</span>.
     363This identifier must be different from the identifiers used for the
     364PALM standard output (see list in description of package parameter <a href="chapter_4.2.html#data_output_sp">data_output_sp</a>).
     365To switch on output of this quantity, the user has to assign the string
     366identifier to the package parameter <a href="chapter_4.2.html#data_output_sp">data_output_sp</a>,
     367eg.:<br><br><span style="font-family: monospace;">&nbsp;
     368&nbsp; data_output_sp</span> =&nbsp; <span style="font-style: italic;">'u*v*'</span><br><br></li></ol>A.
     369and B. as prerequisites for C. require a naming convention of identical
     370identifiers, 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
     372in case of user-defined spectra.</ol><ol start="2"><li>Edit
     373the 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>)
     375as follows:<br><br><code>&nbsp;&nbsp;&nbsp;
     376IF ( mode == 'preprocess' )&nbsp; THEN<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     377SELECT CASE ( TRIM( data_output_sp(m) ) )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     378<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     379CASE ( 'u', 'v', 'w', 'pt', 'q' )<br>!--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     380Not allowed here since these are the standard quantities used in <br>!--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     381preprocess_spectra.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     382<br><span style="color: rgb(255, 0, 0); background-color: rgb(255, 255, 255);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     383CASE ( '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);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     384pr = 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);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     385d(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);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     386<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     387CASE DEFAULT<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     388PRINT*, '+++ user_spectra/preprocess: Spectra of ', &amp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     389TRIM( data_output_sp(m) ), ' can not be calculated'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     390<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     391END SELECT<br><br>&nbsp;&nbsp;&nbsp; ELSEIF (
     392mode == 'data_output' )&nbsp; THEN<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     393SELECT CASE ( TRIM( data_output_sp(m) ) )<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     394CASE ( 'u', 'v', 'w', 'pt', 'q' )<br>!--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     395Not allowed here since these are the standard quantities used in <br>!--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     396data_output_spectra.<br><br><span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     397CASE ( 'u*v*' )</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     398pr = 6</span><br style="color: rgb(255, 0, 0);"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     399CASE DEFAULT<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     400PRINT*, '+++ user_spectra/data_output: Spectra of ', &amp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     401TRIM( data_output_sp(m) ), ' are not defined'<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     402END SELECT<br><br>&nbsp;&nbsp;&nbsp; ENDIF</code><br></li></ol>Note
     403that spectra output is an <a href="chapter_3.7.html">optional
     404software package</a> (see <a href="chapter_3.7.html">chapter
     4053.7</a>). Therefore user-defined spectra also require the package
     406activation 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
     408change:&nbsp;</i> $Id: chapter_3.5.4.html 136 2007-11-26
     40902:47:32Z letzel $</p>
    232410</body></html>
  • palm/trunk/DOC/app/chapter_4.2.html

    r130 r144  
    1123811238     
    1123911239     
    11240       <p>Allowed values are:&nbsp; <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:&nbsp; <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>
    1124211242
    1124311243
  • palm/trunk/SOURCE/CURRENT_MODIFICATIONS

    r143 r144  
    1515necessary for the current subdomain.
    1616
    17 check_open, read_var_list, read_3d_binary, write_3d_binary
     17User-defined spectra.
     18
     19calc_spectra, check_open, data_output_spectra, netcdf, read_var_list, read_3d_binary, user_interface, write_3d_binary
    1820
    1921
     
    3840NetCDF files newly created by restart files (no append of existing files!)
    3941contained uneccessary time levels. (read_3d_binary, write_3d_binary)
     42Bugfix: extra '*' removed in user_statistics sample code (user_interface)
    4043
    41 flow_statistics, plant_canopy_model, read_3d_binary, write_3d_binary
     44flow_statistics, plant_canopy_model, read_3d_binary, user_interface, write_3d_binary
    4245
  • palm/trunk/SOURCE/calc_spectra.f90

    r4 r144  
    44! Actual revisions:
    55! -----------------
    6 !
     6! user-defined spectra
    77!
    88! Former revisions:
     
    180180       
    181181    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 )
    184188         
    185189    END SELECT
  • palm/trunk/SOURCE/data_output_spectra.f90

    r4 r144  
    44! Actual revisions:
    55! -----------------
    6 !
     6! user-defined spectra
    77!
    88! Former revisions:
     
    117117
    118118             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 )
    121126
    122127          END SELECT
  • palm/trunk/SOURCE/netcdf.f90

    r98 r144  
    77! Current revisions:
    88! ------------------
    9 !
     9! user-defined spectra
    1010!
    1111! Former revisions:
     
    28672867          i = 1
    28682868          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
    28692893
    28702894             IF ( INDEX( spectra_direction(i), 'x' ) /= 0 )  THEN
     
    28732897!--             Define the variable
    28742898                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
    28762901                   nc_stat = NF90_DEF_VAR( id_set_sp, netcdf_var_name,      &
    28772902                                           nc_precision(7), (/ id_dim_x_sp, &
     
    29032928!--             Define the variable
    29042929                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
    29062932                   nc_stat = NF90_DEF_VAR( id_set_sp, netcdf_var_name,      &
    29072933                                           nc_precision(7), (/ id_dim_y_sp, &
  • palm/trunk/SOURCE/user_interface.f90

    r139 r144  
    44! Actual revisions:
    55! -----------------
    6 !
     6! new subroutine user_spectra
    77!
    88! Former revisions:
     
    5656!-- Sample for user-defined output
    5757!    REAL, DIMENSION(:,:,:), ALLOCATABLE ::  u2, u2_av
     58!    REAL, DIMENSION(:,:,:), ALLOCATABLE ::  ustvst
    5859
    5960    SAVE
     
    198199!-- Sample for user-defined output
    199200!    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) )
    200202!
    201203!    IF ( initializing_actions == 'read_restart_data' )  THEN
     
    456458!                ENDDO
    457459!             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
    458469
    459470
     
    561572 END MODULE user_actions_mod
    562573
     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
    563644
    564645
     
    600681!       DO  i = nxl, nxr
    601682!          DO  j = nys, nyn
    602 !             DO  k = nzb_s_outer(j,i)+1, nzt
     683!             DO  k = nzb_s_inner(j,i)+1, nzt
    603684!!
    604685!!--             Sample on how to calculate the profile of the resolved-scale
     
    606687!                sums_l(k,pr_palm+1,tn) = sums_l(k,pr_palm+1,tn) +           &
    607688!                      ( 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) )   &
    609690!                                                 * rmask(j,i,sr)
    610691!!
     
    796877!--    Uncomment and extend the following lines, if necessary
    797878!       CASE ( 'u2' )
     879!          unit = 'm2/s2'
     880!
     881!       CASE ( 'u*v*' )
    798882!          unit = 'm2/s2'
    799883!
     
    890974!       CASE ( 'u2', 'u2_xy', 'u2_xz', 'u2_yz' )
    891975!          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'
    892981!          grid_y = 'y'
    893982!          grid_z = 'zu'
Note: See TracChangeset for help on using the changeset viewer.