[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 | ! |
---|
[1961] | 22 | ! |
---|
[1321] | 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: user_spectra.f90 1961 2016-07-12 16:37:58Z maronga $ |
---|
| 26 | ! |
---|
[1961] | 27 | ! 1960 2016-07-12 16:34:24Z suehring |
---|
| 28 | ! Consider additional spectra for passive scalar |
---|
| 29 | ! |
---|
[1834] | 30 | ! 1833 2016-04-07 14:23:03Z raasch |
---|
| 31 | ! spectrum renamed spectra_mod |
---|
| 32 | ! |
---|
[1683] | 33 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 34 | ! Code annotations made doxygen readable |
---|
| 35 | ! |
---|
[1321] | 36 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 37 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 38 | ! kinds are defined in new module kinds, |
---|
| 39 | ! old module precision_kind is removed, |
---|
| 40 | ! revision history before 2012 removed, |
---|
| 41 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 42 | ! all variable declaration statements |
---|
[211] | 43 | ! |
---|
[1037] | 44 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 45 | ! code put under GPL (PALM 3.9) |
---|
| 46 | ! |
---|
[226] | 47 | ! 211 2008-11-11 04:46:24Z raasch |
---|
| 48 | ! Former file user_interface.f90 split into one file per subroutine |
---|
| 49 | ! |
---|
[211] | 50 | ! Description: |
---|
| 51 | ! ------------ |
---|
[1682] | 52 | !> Calculation of user-defined spectra. |
---|
| 53 | !> See section 3.5.4 on how to define, calculate, and output user defined |
---|
| 54 | !> quantities. |
---|
[211] | 55 | !------------------------------------------------------------------------------! |
---|
[1682] | 56 | SUBROUTINE user_spectra( mode, m, pr ) |
---|
| 57 | |
---|
[211] | 58 | |
---|
| 59 | USE arrays_3d |
---|
[1320] | 60 | |
---|
[258] | 61 | USE control_parameters |
---|
[1320] | 62 | |
---|
[211] | 63 | USE indices |
---|
[1320] | 64 | |
---|
| 65 | USE kinds |
---|
| 66 | |
---|
[1833] | 67 | USE spectra_mod |
---|
[1320] | 68 | |
---|
[211] | 69 | USE statistics |
---|
[1320] | 70 | |
---|
[211] | 71 | USE user |
---|
| 72 | |
---|
| 73 | IMPLICIT NONE |
---|
| 74 | |
---|
| 75 | CHARACTER (LEN=*) :: mode |
---|
| 76 | |
---|
[1682] | 77 | INTEGER(iwp) :: i !< |
---|
| 78 | INTEGER(iwp) :: j !< |
---|
| 79 | INTEGER(iwp) :: k !< |
---|
| 80 | INTEGER(iwp) :: m !< |
---|
| 81 | INTEGER(iwp) :: pr !< |
---|
[211] | 82 | |
---|
| 83 | |
---|
| 84 | ! |
---|
| 85 | !-- Sample on how to calculate spectra of user-defined quantities. |
---|
| 86 | !-- Each quantity is identified by the corresponding user profile index |
---|
| 87 | !-- "pr_palm+#" where "#" is an integer starting from 1. These |
---|
| 88 | !-- user-profile-numbers must also be assigned to the respective strings |
---|
| 89 | !-- given by data_output_pr_user in routine user_check_data_output_pr. |
---|
| 90 | IF ( mode == 'preprocess' ) THEN |
---|
| 91 | |
---|
| 92 | SELECT CASE ( TRIM( data_output_sp(m) ) ) |
---|
| 93 | |
---|
[1960] | 94 | CASE ( 'u', 'v', 'w', 'pt', 'q', 's' ) |
---|
[211] | 95 | !-- Not allowed here since these are the standard quantities used in |
---|
| 96 | !-- preprocess_spectra. |
---|
| 97 | |
---|
| 98 | ! CASE ( 'u*v*' ) |
---|
| 99 | ! pr = pr_palm+1 |
---|
| 100 | ! d(nzb+1:nzt,nys:nyn,nxl:nxr) = ustvst(nzb+1:nzt,nys:nyn,nxl:nxr) |
---|
| 101 | |
---|
| 102 | CASE DEFAULT |
---|
[1320] | 103 | message_string = 'Spectra of ' // & |
---|
[274] | 104 | TRIM( data_output_sp(m) ) // ' can not be calculated' |
---|
[258] | 105 | CALL message( 'user_spectra', 'UI0010', 0, 0, 0, 6, 0 ) |
---|
| 106 | |
---|
[211] | 107 | END SELECT |
---|
| 108 | |
---|
| 109 | ELSEIF ( mode == 'data_output' ) THEN |
---|
| 110 | |
---|
| 111 | SELECT CASE ( TRIM( data_output_sp(m) ) ) |
---|
| 112 | |
---|
[1960] | 113 | CASE ( 'u', 'v', 'w', 'pt', 'q', 's' ) |
---|
[211] | 114 | !-- Not allowed here since these are the standard quantities used in |
---|
| 115 | !-- data_output_spectra. |
---|
| 116 | |
---|
| 117 | ! CASE ( 'u*v*' ) |
---|
| 118 | ! pr = 6 |
---|
| 119 | |
---|
| 120 | CASE DEFAULT |
---|
[1320] | 121 | message_string = 'Spectra of ' // & |
---|
[258] | 122 | TRIM( data_output_sp(m) ) // ' are not defined' |
---|
| 123 | CALL message( 'user_spectra', 'UI0011', 0, 0, 0, 6, 0 ) |
---|
| 124 | |
---|
[211] | 125 | END SELECT |
---|
| 126 | |
---|
| 127 | ENDIF |
---|
| 128 | |
---|
| 129 | END SUBROUTINE user_spectra |
---|
| 130 | |
---|