1 | !> @file user_data_output_3d.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | ! This file is part of the PALM model system. |
---|
4 | ! |
---|
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. |
---|
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 | ! |
---|
17 | ! Copyright 1997-2018 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ------------------ |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: user_data_output_3d.f90 3004 2018-04-27 12:33:25Z Giersch $ |
---|
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 |
---|
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 |
---|
37 | ! ghost layer points removed from output array local_pf |
---|
38 | ! |
---|
39 | ! 2101 2017-01-05 16:42:31Z suehring |
---|
40 | ! |
---|
41 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
42 | ! Forced header and separation lines into 80 columns |
---|
43 | ! |
---|
44 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
45 | ! Code annotations made doxygen readable |
---|
46 | ! |
---|
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 | ! |
---|
50 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
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 |
---|
55 | ! all variable declaration statements |
---|
56 | ! |
---|
57 | ! 1106 2013-03-04 05:31:38Z raasch |
---|
58 | ! array_kind renamed precision_kind |
---|
59 | ! |
---|
60 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
61 | ! code put under GPL (PALM 3.9) |
---|
62 | ! |
---|
63 | ! 211 2008-11-11 04:46:24Z raasch |
---|
64 | ! Former file user_interface.f90 split into one file per subroutine |
---|
65 | ! |
---|
66 | ! Description: |
---|
67 | ! ------------ |
---|
68 | !> Resorts the user-defined output quantity with indices (k,j,i) to a |
---|
69 | !> temporary array with indices (i,j,k). |
---|
70 | !------------------------------------------------------------------------------! |
---|
71 | SUBROUTINE user_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do ) |
---|
72 | |
---|
73 | |
---|
74 | USE indices |
---|
75 | |
---|
76 | USE kinds |
---|
77 | |
---|
78 | USE user |
---|
79 | |
---|
80 | IMPLICIT NONE |
---|
81 | |
---|
82 | CHARACTER (LEN=*) :: variable !< |
---|
83 | |
---|
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) |
---|
90 | |
---|
91 | LOGICAL :: found !< |
---|
92 | |
---|
93 | REAL(wp) :: fill_value = -999.0_wp !< value for the _FillValue attribute |
---|
94 | |
---|
95 | REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) :: local_pf !< |
---|
96 | |
---|
97 | |
---|
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 |
---|
109 | ! DO i = nxl, nxr |
---|
110 | ! DO j = nys, nyn |
---|
111 | ! DO k = nzb_do, nzt_do |
---|
112 | ! local_pf(i,j,k) = u2(k,j,i) |
---|
113 | ! ENDDO |
---|
114 | ! ENDDO |
---|
115 | ! ENDDO |
---|
116 | ! ELSE |
---|
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 |
---|
121 | ! DO i = nxl, nxr |
---|
122 | ! DO j = nys, nyn |
---|
123 | ! DO k = nzb_do, nzt_do |
---|
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 | |
---|