| 259 | |
| 260 | '''Outline of technical realization''' |
| 261 | |
| 262 | At first, the number of surface elements of its respective type and orientation is counted and stored within the data-structure: |
| 263 | |
| 264 | {{{ |
| 265 | #!Latex |
| 266 | \begin{verbatim} |
| 267 | surf_def_h(0)%ns = 120 !< number of horizontal upward-facing surface elements on local processor |
| 268 | surf_def_h(1)%ns = 12 !< number of horizontal downward-facing surface elements on local processor |
| 269 | |
| 270 | surf_def_v(0)%ns = 50 !< number of vertical northward-facing surfaces on local processor |
| 271 | surf_def_v(1)%ns = 31 !< number of vertical southward-facing surfaces on local processor |
| 272 | surf_def_v(2)%ns = 19 !< number of vertical eastward-facing surfaces on local processor |
| 273 | surf_def_v(3)%ns = 39 !< number of vertical westward-facing surfaces on local processor |
| 274 | \end{verbatim} |
| 275 | }}} |
| 276 | |
| 277 | In the following, surface attributes are allocated for the exact number of surface elements of the respective type: |
| 278 | {{{ |
| 279 | #!Latex |
| 280 | \begin{verbatim} |
| 281 | ALLOCATE ( surf_def_h(0)%i(1:surf_def_h(0)%ns) ) !< allocate i index |
| 282 | ALLOCATE ( surf_def_h(0)%j(1:surf_def_h(0)%ns) ) !< allocate j index |
| 283 | ALLOCATE ( surf_def_h(0)%k(1:surf_def_h(0)%ns) ) !< allocate k index |
| 284 | ALLOCATE ( surf_def_h(0)%shf(1:surf_def_h(0)%ns) ) !< allocate heat flux |
| 285 | \end{verbatim} |
| 286 | }}} |
| 287 | |
| 288 | Here, ''i, j, k'' are the corresponding indices linking the surface element to the 3D grid, and ''shf'' is the surface heat flux. |
| 289 | Please note, there are many other attributes allocated. |
| 290 | |
| 291 | A certain variable within the data-structure can be accessed: |
| 292 | {{{ |
| 293 | #!Latex |
| 294 | \begin{verbatim} |
| 295 | DO m = 1, surf_def_h(0)%ns |
| 296 | surf_def_h(0)%shf(m) = ... |
| 297 | ENDDO |
| 298 | \end{verbatim} |
| 299 | }}} |
| 300 | |
| 301 | Finally, the resulting fluxes are added to the prognostic terms in following way: |
| 302 | |
| 303 | {{{ |
| 304 | #!Latex |
| 305 | \begin{verbatim} |
| 306 | DO m = 1, surf_def_h(0)%ns |
| 307 | i = surf_def_h(0)%i(m) |
| 308 | j = surf_def_h(0)%j(m) |
| 309 | k = surf_def_h(0)%k(m) |
| 310 | tend(k,j,i) = tend(k,j,i) + surf_def_h(0)%shf(m) * ddz(k) |
| 311 | ENDDO |
| 312 | \end{verbatim} |
| 313 | }}} |
| 314 | Summarized, the surface data-structure {{{surf_type}}} is used to store and access all surface related quantities in an optimized memory demand. Several adjoining surfaces at a grid cell (e.g. at corners) are treated separately. The new data-structure is also applied in the flat case without any topography. |
| 315 | |
| 316 | '''Some notes''': So far, downward-facing walls are only realized for default surface type. |
| 317 | |