3 | | The topography implementation described in Sect. [wiki:/doc/tec/bc#Topography boundary conditions] allows the use of 2-D topography height data in PALM. Currently, the topography data has to be provided within a rastered ASCII file. After reading and mapping of these data to the |
4 | | horizontal grid in PALM, they can be directly incorporated into the standard loop structure of the Fortran code as lower vertical index |
| 3 | Under construction |
| 4 | |
| 5 | With revision -r2232, the topography implementation is completely revised. |
| 6 | Starting from this revision, overhanging structures (e.g. bridges, ceilings or tunnels) are allowed, i.e. topography does not necessarily be surface-mounted. |
| 7 | |
| 8 | The topography implementation described in Sect. [wiki:/doc/tec/bc#Topography boundary conditions] allows the use of 2-D topography height data (if no overhanging structures should be considered), or 3-D topography information. The topography input data has to be provided within a rastered ASCII or NetCDF file. Rastered 3-D topography consists of values either 1 (within topography) or 0 (outside topography), and has to be provided up to the level of the highest present topography structures. |
| 9 | After reading and mapping of topography data to the 3-D grid in PALM, flag arrays are set in order to mask grid boxes within the integration loops accordingly. |
| 10 | |
| 11 | The prognostic terms are executed overall, i.e. also within topography. |
| 12 | Masking of topography is done via Fortran integer bit flags, where a certain bit position indicates whether the respective grid point belongs to an obstacle (bit is 0) or to the atmosphere (bit is 1). |
| 13 | Different bit positions indicate different masking on the staggered grid, e.g. on the u, v, w grid, equivalent to the former nzb_u/v/w_inner arrays. Further, regions where special wall-bounded code is executed, is also masked via special bit flags. |
| 14 | A list of the respective bit flags and their meaning concerning the deprecated implementation via the nzb_u/v/w_inner arrays can be found in Table 1. |
| 15 | |
| 16 | ||='''Bit position''' =||='''Meaning''' =|| |
| 17 | |---------------- |
| 18 | {{{#!td style="vertical-align:top" |
| 19 | 0 |
| 20 | }}} |
| 21 | {{{#!td style="vertical-align:top" |
| 22 | mask topography on scalar-grid ( former nzb_s_inner ) |
| 23 | }}} |
| 24 | |---------------- |
| 25 | {{{#!td style="vertical-align:top" |
| 26 | 1 |
| 27 | }}} |
| 28 | {{{#!td style="vertical-align:top" |
| 29 | mask topography on u-grid ( former nzb_u_inner ) |
| 30 | }}} |
| 31 | |---------------- |
| 32 | {{{#!td style="vertical-align:top" |
| 33 | 2 |
| 34 | }}} |
| 35 | {{{#!td style="vertical-align:top" |
| 36 | mask topography on v-grid ( former nzb_v_inner ) |
| 37 | }}} |
| 38 | |---------------- |
| 39 | {{{#!td style="vertical-align:top" |
| 40 | 3 |
| 41 | }}} |
| 42 | {{{#!td style="vertical-align:top" |
| 43 | mask topography on w-grid ( former nzb_w_inner ) |
| 44 | }}} |
| 45 | |---------------- |
| 46 | {{{#!td style="vertical-align:top" |
| 47 | 8 |
| 48 | }}} |
| 49 | {{{#!td style="vertical-align:top" |
| 50 | mask regions where surface-bounded code for u, v, w, and scalars is executed ( combines information of former nzb_s_outer, nzb_u_outer, nzb_v_outer and nzb_w_outer arrays ) |
| 51 | }}} |
| 52 | |---------------- |
| 53 | {{{#!td style="vertical-align:top" |
| 54 | 9 |
| 55 | }}} |
| 56 | {{{#!td style="vertical-align:top" |
| 57 | mask regions where model-top fluxes are applied ( former nzt_diff ) |
| 58 | }}} |
| 59 | |---------------- |
| 60 | {{{#!td style="vertical-align:top" |
| 61 | 12 |
| 62 | }}} |
| 63 | {{{#!td style="vertical-align:top" |
| 64 | flags upward-facing surfaces on scalar-grid |
| 65 | }}} |
| 66 | |---------------- |
| 67 | {{{#!td style="vertical-align:top" |
| 68 | 13 |
| 69 | }}} |
| 70 | {{{#!td style="vertical-align:top" |
| 71 | flags downward-facing surfaces on scalar-grid |
| 72 | }}} |
| 73 | |---------------- |
| 74 | {{{#!td style="vertical-align:top" |
| 75 | 14 |
| 76 | }}} |
| 77 | {{{#!td style="vertical-align:top" |
| 78 | flags upward-facing surfaces on u-grid |
| 79 | }}} |
| 80 | |---------------- |
| 81 | {{{#!td style="vertical-align:top" |
| 82 | 15 |
| 83 | }}} |
| 84 | {{{#!td style="vertical-align:top" |
| 85 | flags downward-facing surfaces on u-grid |
| 86 | }}} |
| 87 | |---------------- |
| 88 | {{{#!td style="vertical-align:top" |
| 89 | 17 |
| 90 | }}} |
| 91 | {{{#!td style="vertical-align:top" |
| 92 | flags upward-facing surfaces on v-grid |
| 93 | }}} |
| 94 | |---------------- |
| 95 | {{{#!td style="vertical-align:top" |
| 96 | 17 |
| 97 | }}} |
| 98 | {{{#!td style="vertical-align:top" |
| 99 | flags downward-facing surfaces on v-grid |
| 100 | }}} |
| 101 | |---------------- |
| 102 | {{{#!td style="vertical-align:top" |
| 103 | 18 |
| 104 | }}} |
| 105 | {{{#!td style="vertical-align:top" |
| 106 | flags upward-facing surfaces on w-grid |
| 107 | }}} |
| 108 | |---------------- |
| 109 | {{{#!td style="vertical-align:top" |
| 110 | 19 |
| 111 | }}} |
| 112 | {{{#!td style="vertical-align:top" |
| 113 | flags downward-facing surfaces on w-grid |
| 114 | }}} |
| 115 | |---------------- |
| 116 | {{{#!td style="vertical-align:top" |
| 117 | 20 |
| 118 | }}} |
| 119 | {{{#!td style="vertical-align:top" |
| 120 | mask topography on u-grid and one grid point above, used only for adding random perturbations ( former nzb_u_inner+1 ) |
| 121 | }}} |
| 122 | |---------------- |
| 123 | {{{#!td style="vertical-align:top" |
| 124 | 21 |
| 125 | }}} |
| 126 | {{{#!td style="vertical-align:top" |
| 127 | mask topography on v-grid and one grid point above, used only for adding random perturbations ( former nzb_v_inner+1 ) |
| 128 | }}} |
| 129 | |---------------- |
| 130 | {{{#!td style="vertical-align:top" |
| 131 | 24 |
| 132 | }}} |
| 133 | {{{#!td style="vertical-align:top" |
| 134 | mask regions where surface-bounded code is executed on scalar-grid ( former nzb_s_outer ) |
| 135 | }}} |
| 136 | |---------------- |
| 137 | {{{#!td style="vertical-align:top" |
| 138 | 25 |
| 139 | }}} |
| 140 | {{{#!td style="vertical-align:top" |
| 141 | mask regions where surface-bounded code is executed on scalar-grid ( former nzb_s_outer+1 ) |
| 142 | }}} |
| 143 | |---------------- |
| 144 | {{{#!td style="vertical-align:top" |
| 145 | 26 |
| 146 | }}} |
| 147 | {{{#!td style="vertical-align:top" |
| 148 | mask regions where surface-bounded code is executed on u-grid ( former nzb_u_outer ) |
| 149 | }}} |
| 150 | |---------------- |
| 151 | {{{#!td style="vertical-align:top" |
| 152 | 27 |
| 153 | }}} |
| 154 | {{{#!td style="vertical-align:top" |
| 155 | mask regions where surface-bounded code is executed on v-grid ( former nzb_v_outer ) |
| 156 | }}} |
| 157 | |---------------- |
| 158 | {{{#!td style="vertical-align:top" |
| 159 | 28 |
| 160 | }}} |
| 161 | {{{#!td style="vertical-align:top" |
| 162 | mask regions where surface-bounded code is executed on w-grid ( former nzb_w_outer ) |
| 163 | }}} |
| 164 | |---------------- |
| 165 | {{{#!td style="vertical-align:top" |
| 166 | 29 |
| 167 | }}} |
| 168 | {{{#!td style="vertical-align:top" |
| 169 | mask regions where surface-bounded code is executed on s-grid ( former nzb_diff_s_outer - 1 ) |
| 170 | }}} |
| 171 | |---------------- |
| 172 | {{{#!td style="vertical-align:top" |
| 173 | 30 |
| 174 | }}} |
| 175 | {{{#!td style="vertical-align:top" |
| 176 | mask regions where surface-bounded code is executed on s-grid ( former nzb_diff_s_outer ) |
| 177 | }}} |
| 178 | |---------------- |
| 179 | |
| 180 | |
| 181 | The following example illustrates the general realization of topography masking in the code using Bit flags: |
| 182 | {{{ |
| 183 | #!Latex |
| 184 | \begin{verbatim} |
| 185 | DO k = nzb+1, nzt |
| 186 | tend(k,j,i) = tend(k,j,i) + … & |
| 187 | * MERGE( 1.0_wp, 0.0_wp, BTEST(wall_flags_0(k,j,i),0) ) |
| 188 | ENDDO |
| 189 | \end{verbatim} |
| 190 | }}} |
| 191 | Here, the intrinsic Fortran function `MERGE` returns 1 if `wall_flags_0(k,j,i)` at bit position zero is 1 (`BTEST` returns `.TRUE.`), else, `MERGE` would return 0 and no term is effectively added to the tend array. |
| 192 | A similar approach is also realized for the 5th-order advection-scheme to degrade the order near surfaces. |
| 193 | |
| 194 | |
| 195 | |
| 196 | they can be directly incorporated into the standard loop structure of the Fortran code as lower vertical index |