[1682] | 1 | !> @file user_data_output_3d.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[2696] | 3 | ! This file is part of the PALM model system. |
---|
[1036] | 4 | ! |
---|
[2000] | 5 | ! PALM is free software: you can redistribute it and/or modify it under the |
---|
| 6 | ! terms of the GNU General Public License as published by the Free Software |
---|
| 7 | ! Foundation, either version 3 of the License, or (at your option) any later |
---|
| 8 | ! version. |
---|
[1036] | 9 | ! |
---|
| 10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 13 | ! |
---|
| 14 | ! You should have received a copy of the GNU General Public License along with |
---|
| 15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 16 | ! |
---|
[2718] | 17 | ! Copyright 1997-2018 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1036] | 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[1106] | 21 | ! ------------------ |
---|
[1321] | 22 | ! |
---|
[2001] | 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: user_data_output_3d.f90 3004 2018-04-27 12:33:25Z banzhafs $ |
---|
[3004] | 27 | ! Further allocation checks implemented (averaged data will be assigned to fill |
---|
| 28 | ! values if no allocation happened so far) |
---|
| 29 | ! |
---|
| 30 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
[2716] | 31 | ! Corrected "Former revisions" section |
---|
| 32 | ! |
---|
| 33 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
| 34 | ! Change in file header (GPL part) |
---|
| 35 | ! |
---|
| 36 | ! 2512 2017-10-04 08:26:59Z raasch |
---|
[2512] | 37 | ! ghost layer points removed from output array local_pf |
---|
| 38 | ! |
---|
| 39 | ! 2101 2017-01-05 16:42:31Z suehring |
---|
[1321] | 40 | ! |
---|
[2001] | 41 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 42 | ! Forced header and separation lines into 80 columns |
---|
| 43 | ! |
---|
[1683] | 44 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 45 | ! Code annotations made doxygen readable |
---|
| 46 | ! |
---|
[1552] | 47 | ! 1551 2015-03-03 14:18:16Z maronga |
---|
| 48 | ! Replaced nzb and nzt+1 with the new array bounds nzb_do and nzt_do. |
---|
| 49 | ! |
---|
[1321] | 50 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 51 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 52 | ! kinds are defined in new module kinds, |
---|
| 53 | ! revision history before 2012 removed, |
---|
| 54 | ! comment fields (!:) to be used for variable explanations added to |
---|
[1321] | 55 | ! all variable declaration statements |
---|
[211] | 56 | ! |
---|
[1107] | 57 | ! 1106 2013-03-04 05:31:38Z raasch |
---|
| 58 | ! array_kind renamed precision_kind |
---|
| 59 | ! |
---|
[1037] | 60 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 61 | ! code put under GPL (PALM 3.9) |
---|
| 62 | ! |
---|
[226] | 63 | ! 211 2008-11-11 04:46:24Z raasch |
---|
| 64 | ! Former file user_interface.f90 split into one file per subroutine |
---|
| 65 | ! |
---|
[211] | 66 | ! Description: |
---|
| 67 | ! ------------ |
---|
[1682] | 68 | !> Resorts the user-defined output quantity with indices (k,j,i) to a |
---|
| 69 | !> temporary array with indices (i,j,k). |
---|
[211] | 70 | !------------------------------------------------------------------------------! |
---|
[1682] | 71 | SUBROUTINE user_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do ) |
---|
| 72 | |
---|
[211] | 73 | |
---|
| 74 | USE indices |
---|
[1320] | 75 | |
---|
| 76 | USE kinds |
---|
| 77 | |
---|
[211] | 78 | USE user |
---|
| 79 | |
---|
| 80 | IMPLICIT NONE |
---|
| 81 | |
---|
[1682] | 82 | CHARACTER (LEN=*) :: variable !< |
---|
[211] | 83 | |
---|
[1682] | 84 | INTEGER(iwp) :: av !< |
---|
| 85 | INTEGER(iwp) :: i !< |
---|
| 86 | INTEGER(iwp) :: j !< |
---|
| 87 | INTEGER(iwp) :: k !< |
---|
| 88 | INTEGER(iwp) :: nzb_do !< lower limit of the data output (usually 0) |
---|
| 89 | INTEGER(iwp) :: nzt_do !< vertical upper limit of the data output (usually nz_do3d) |
---|
[211] | 90 | |
---|
[1682] | 91 | LOGICAL :: found !< |
---|
[211] | 92 | |
---|
[3004] | 93 | REAL(wp) :: fill_value = -999.0_wp !< value for the _FillValue attribute |
---|
[211] | 94 | |
---|
[3004] | 95 | REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) :: local_pf !< |
---|
[211] | 96 | |
---|
[3004] | 97 | |
---|
[211] | 98 | found = .TRUE. |
---|
| 99 | |
---|
| 100 | SELECT CASE ( TRIM( variable ) ) |
---|
| 101 | |
---|
| 102 | ! |
---|
| 103 | !-- Uncomment and extend the following lines, if necessary. |
---|
| 104 | !-- The arrays for storing the user defined quantities (here u2 and u2_av) |
---|
| 105 | !-- have to be declared and defined by the user! |
---|
| 106 | !-- Sample for user-defined output: |
---|
| 107 | ! CASE ( 'u2' ) |
---|
| 108 | ! IF ( av == 0 ) THEN |
---|
[2512] | 109 | ! DO i = nxl, nxr |
---|
| 110 | ! DO j = nys, nyn |
---|
[1551] | 111 | ! DO k = nzb_do, nzt_do |
---|
[211] | 112 | ! local_pf(i,j,k) = u2(k,j,i) |
---|
| 113 | ! ENDDO |
---|
| 114 | ! ENDDO |
---|
| 115 | ! ENDDO |
---|
| 116 | ! ELSE |
---|
[3004] | 117 | ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN |
---|
| 118 | ! ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 119 | ! u2_av = REAL( fill_value, KIND = wp ) |
---|
| 120 | ! ENDIF |
---|
[2512] | 121 | ! DO i = nxl, nxr |
---|
| 122 | ! DO j = nys, nyn |
---|
[1551] | 123 | ! DO k = nzb_do, nzt_do |
---|
[211] | 124 | ! local_pf(i,j,k) = u2_av(k,j,i) |
---|
| 125 | ! ENDDO |
---|
| 126 | ! ENDDO |
---|
| 127 | ! ENDDO |
---|
| 128 | ! ENDIF |
---|
| 129 | ! |
---|
| 130 | |
---|
| 131 | CASE DEFAULT |
---|
| 132 | found = .FALSE. |
---|
| 133 | |
---|
| 134 | END SELECT |
---|
| 135 | |
---|
| 136 | |
---|
| 137 | END SUBROUTINE user_data_output_3d |
---|
| 138 | |
---|