[1682] | 1 | !> @file user_spectra.f90 |
---|
[1036] | 2 | !--------------------------------------------------------------------------------! |
---|
| 3 | ! This file is part of PALM. |
---|
| 4 | ! |
---|
| 5 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 6 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 7 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 8 | ! |
---|
| 9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 10 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 11 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 12 | ! |
---|
| 13 | ! You should have received a copy of the GNU General Public License along with |
---|
| 14 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 15 | ! |
---|
[1818] | 16 | ! Copyright 1997-2016 Leibniz Universitaet Hannover |
---|
[1036] | 17 | !--------------------------------------------------------------------------------! |
---|
| 18 | ! |
---|
[258] | 19 | ! Current revisions: |
---|
[211] | 20 | ! ----------------- |
---|
[1683] | 21 | ! |
---|
[1834] | 22 | ! |
---|
[1321] | 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: user_spectra.f90 1834 2016-04-07 14:34:20Z hellstea $ |
---|
| 26 | ! |
---|
[1834] | 27 | ! 1833 2016-04-07 14:23:03Z raasch |
---|
| 28 | ! spectrum renamed spectra_mod |
---|
| 29 | ! |
---|
[1683] | 30 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 31 | ! Code annotations made doxygen readable |
---|
| 32 | ! |
---|
[1321] | 33 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 34 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 35 | ! kinds are defined in new module kinds, |
---|
| 36 | ! old module precision_kind is removed, |
---|
| 37 | ! revision history before 2012 removed, |
---|
| 38 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 39 | ! all variable declaration statements |
---|
[211] | 40 | ! |
---|
[1037] | 41 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 42 | ! code put under GPL (PALM 3.9) |
---|
| 43 | ! |
---|
[226] | 44 | ! 211 2008-11-11 04:46:24Z raasch |
---|
| 45 | ! Former file user_interface.f90 split into one file per subroutine |
---|
| 46 | ! |
---|
[211] | 47 | ! Description: |
---|
| 48 | ! ------------ |
---|
[1682] | 49 | !> Calculation of user-defined spectra. |
---|
| 50 | !> See section 3.5.4 on how to define, calculate, and output user defined |
---|
| 51 | !> quantities. |
---|
[211] | 52 | !------------------------------------------------------------------------------! |
---|
[1682] | 53 | SUBROUTINE user_spectra( mode, m, pr ) |
---|
| 54 | |
---|
[211] | 55 | |
---|
| 56 | USE arrays_3d |
---|
[1320] | 57 | |
---|
[258] | 58 | USE control_parameters |
---|
[1320] | 59 | |
---|
[211] | 60 | USE indices |
---|
[1320] | 61 | |
---|
| 62 | USE kinds |
---|
| 63 | |
---|
[1833] | 64 | USE spectra_mod |
---|
[1320] | 65 | |
---|
[211] | 66 | USE statistics |
---|
[1320] | 67 | |
---|
[211] | 68 | USE user |
---|
| 69 | |
---|
| 70 | IMPLICIT NONE |
---|
| 71 | |
---|
| 72 | CHARACTER (LEN=*) :: mode |
---|
| 73 | |
---|
[1682] | 74 | INTEGER(iwp) :: i !< |
---|
| 75 | INTEGER(iwp) :: j !< |
---|
| 76 | INTEGER(iwp) :: k !< |
---|
| 77 | INTEGER(iwp) :: m !< |
---|
| 78 | INTEGER(iwp) :: pr !< |
---|
[211] | 79 | |
---|
| 80 | |
---|
| 81 | ! |
---|
| 82 | !-- Sample on how to calculate spectra of user-defined quantities. |
---|
| 83 | !-- Each quantity is identified by the corresponding user profile index |
---|
| 84 | !-- "pr_palm+#" where "#" is an integer starting from 1. These |
---|
| 85 | !-- user-profile-numbers must also be assigned to the respective strings |
---|
| 86 | !-- given by data_output_pr_user in routine user_check_data_output_pr. |
---|
| 87 | IF ( mode == 'preprocess' ) THEN |
---|
| 88 | |
---|
| 89 | SELECT CASE ( TRIM( data_output_sp(m) ) ) |
---|
| 90 | |
---|
| 91 | CASE ( 'u', 'v', 'w', 'pt', 'q' ) |
---|
| 92 | !-- Not allowed here since these are the standard quantities used in |
---|
| 93 | !-- preprocess_spectra. |
---|
| 94 | |
---|
| 95 | ! CASE ( 'u*v*' ) |
---|
| 96 | ! pr = pr_palm+1 |
---|
| 97 | ! d(nzb+1:nzt,nys:nyn,nxl:nxr) = ustvst(nzb+1:nzt,nys:nyn,nxl:nxr) |
---|
| 98 | |
---|
| 99 | CASE DEFAULT |
---|
[1320] | 100 | message_string = 'Spectra of ' // & |
---|
[274] | 101 | TRIM( data_output_sp(m) ) // ' can not be calculated' |
---|
[258] | 102 | CALL message( 'user_spectra', 'UI0010', 0, 0, 0, 6, 0 ) |
---|
| 103 | |
---|
[211] | 104 | END SELECT |
---|
| 105 | |
---|
| 106 | ELSEIF ( mode == 'data_output' ) THEN |
---|
| 107 | |
---|
| 108 | SELECT CASE ( TRIM( data_output_sp(m) ) ) |
---|
| 109 | |
---|
| 110 | CASE ( 'u', 'v', 'w', 'pt', 'q' ) |
---|
| 111 | !-- Not allowed here since these are the standard quantities used in |
---|
| 112 | !-- data_output_spectra. |
---|
| 113 | |
---|
| 114 | ! CASE ( 'u*v*' ) |
---|
| 115 | ! pr = 6 |
---|
| 116 | |
---|
| 117 | CASE DEFAULT |
---|
[1320] | 118 | message_string = 'Spectra of ' // & |
---|
[258] | 119 | TRIM( data_output_sp(m) ) // ' are not defined' |
---|
| 120 | CALL message( 'user_spectra', 'UI0011', 0, 0, 0, 6, 0 ) |
---|
| 121 | |
---|
[211] | 122 | END SELECT |
---|
| 123 | |
---|
| 124 | ENDIF |
---|
| 125 | |
---|
| 126 | END SUBROUTINE user_spectra |
---|
| 127 | |
---|