[1] | 1 | SUBROUTINE swap_timelevel |
---|
| 2 | |
---|
[1036] | 3 | !--------------------------------------------------------------------------------! |
---|
| 4 | ! This file is part of PALM. |
---|
| 5 | ! |
---|
| 6 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 7 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 8 | ! either version 3 of the License, or (at your option) any later 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 | ! |
---|
[1310] | 17 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
[1036] | 18 | !--------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[1] | 21 | ! ----------------- |
---|
[1321] | 22 | ! |
---|
[1375] | 23 | ! |
---|
[1] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
[3] | 26 | ! $Id: swap_timelevel.f90 1375 2014-04-25 13:07:08Z keck $ |
---|
[39] | 27 | ! |
---|
[1375] | 28 | ! 1374 2014-04-25 12:55:07Z raasch |
---|
| 29 | ! bugfix: use-statement for nopointer-case added |
---|
| 30 | ! |
---|
[1321] | 31 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
| 32 | ! ONLY-attribute added to USE-statements, |
---|
| 33 | ! revision history before 2012 removed, |
---|
[1319] | 34 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
| 35 | ! module interfaces removed |
---|
| 36 | ! |
---|
[1116] | 37 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
| 38 | ! calculation of qr and nr is restricted to precipitation |
---|
| 39 | ! |
---|
[1112] | 40 | ! 1111 2013-03-08 23:54:10Z raasch |
---|
| 41 | ! openACC directives added |
---|
| 42 | ! |
---|
[1054] | 43 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
| 44 | ! swap of timelevels for nr, qr added |
---|
| 45 | ! |
---|
[1037] | 46 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 47 | ! code put under GPL (PALM 3.9) |
---|
| 48 | ! |
---|
[1033] | 49 | ! 1032 2012-10-21 13:03:21Z letzel |
---|
| 50 | ! save memory by not allocating pt_2 in case of neutral = .T. |
---|
| 51 | ! |
---|
[1011] | 52 | ! 1010 2012-09-20 07:59:54Z raasch |
---|
| 53 | ! cpp switch __nopointer added for pointer free version |
---|
| 54 | ! |
---|
[1002] | 55 | ! 1001 2012-09-13 14:08:46Z raasch |
---|
| 56 | ! all actions concerning leapfrog scheme removed |
---|
| 57 | ! |
---|
[1] | 58 | ! Revision 1.1 2000/01/10 10:08:58 10:08:58 raasch (Siegfried Raasch) |
---|
| 59 | ! Initial revision |
---|
| 60 | ! |
---|
| 61 | ! |
---|
| 62 | ! Description: |
---|
| 63 | ! ------------ |
---|
| 64 | ! Swap of timelevels of variables after each timestep |
---|
[3] | 65 | !------------------------------------------------------------------------------! |
---|
[1] | 66 | |
---|
[1374] | 67 | #if defined( __nopointer ) |
---|
[1320] | 68 | USE arrays_3d, & |
---|
[1374] | 69 | ONLY: e, e_p, nr, nr_p, pt, pt_p, q, q_p, qr, qr_p, sa, sa_p, u, u_p, & |
---|
| 70 | v, v_p, w, w_p |
---|
| 71 | #else |
---|
| 72 | USE arrays_3d, & |
---|
[1320] | 73 | ONLY: e, e_1, e_2, e_p, nr, nr_1, nr_2, nr_p, pt, pt_1, pt_2, pt_p, q,& |
---|
| 74 | q_1, q_2, q_p, qr, qr_1, qr_2, qr_p, sa, sa_1, sa_2, sa_p, u, & |
---|
| 75 | u_1, u_2, u_p, v, v_1, v_2, v_p, w, w_1, w_2, w_p |
---|
[1374] | 76 | #endif |
---|
[1] | 77 | |
---|
[1320] | 78 | USE cpulog, & |
---|
| 79 | ONLY: cpu_log, log_point |
---|
| 80 | |
---|
| 81 | USE control_parameters, & |
---|
| 82 | ONLY: cloud_physics, constant_diffusion, humidity, icloud_scheme, & |
---|
| 83 | neutral, ocean, passive_scalar, precipitation, timestep_count |
---|
| 84 | |
---|
[1] | 85 | IMPLICIT NONE |
---|
| 86 | |
---|
| 87 | ! |
---|
| 88 | !-- Incrementing timestep counter |
---|
| 89 | timestep_count = timestep_count + 1 |
---|
| 90 | |
---|
| 91 | ! |
---|
[1001] | 92 | !-- Swap of variables |
---|
[1010] | 93 | #if defined( __nopointer ) |
---|
| 94 | CALL cpu_log( log_point(28), 'swap_timelevel (nop)', 'start' ) |
---|
| 95 | |
---|
[1111] | 96 | !$acc kernels present( pt, pt_p, u, u_p, v, v_p, w, w_p ) |
---|
[1010] | 97 | u = u_p |
---|
| 98 | v = v_p |
---|
| 99 | w = w_p |
---|
| 100 | pt = pt_p |
---|
[1111] | 101 | !$acc end kernels |
---|
[1010] | 102 | IF ( .NOT. constant_diffusion ) THEN |
---|
[1111] | 103 | !$acc kernels present( e, e_p ) |
---|
[1010] | 104 | e = e_p |
---|
[1111] | 105 | !$acc end kernels |
---|
[1010] | 106 | ENDIF |
---|
| 107 | IF ( ocean ) THEN |
---|
| 108 | sa = sa_p |
---|
| 109 | ENDIF |
---|
| 110 | IF ( humidity .OR. passive_scalar ) THEN |
---|
[1053] | 111 | q = q_p |
---|
| 112 | IF ( cloud_physics .AND. icloud_scheme == 0 ) THEN |
---|
| 113 | qr = qr_p |
---|
| 114 | nr = nr_p |
---|
| 115 | ENDIF |
---|
[1010] | 116 | ENDIF |
---|
| 117 | |
---|
| 118 | CALL cpu_log( log_point(28), 'swap_timelevel (nop)', 'stop' ) |
---|
| 119 | #else |
---|
| 120 | CALL cpu_log( log_point(28), 'swap_timelevel', 'start' ) |
---|
| 121 | |
---|
[1] | 122 | SELECT CASE ( MOD( timestep_count, 2 ) ) |
---|
| 123 | |
---|
| 124 | CASE ( 0 ) |
---|
| 125 | |
---|
[1001] | 126 | u => u_1; u_p => u_2 |
---|
| 127 | v => v_1; v_p => v_2 |
---|
| 128 | w => w_1; w_p => w_2 |
---|
[1032] | 129 | IF ( .NOT. neutral ) THEN |
---|
| 130 | pt => pt_1; pt_p => pt_2 |
---|
| 131 | ENDIF |
---|
[1001] | 132 | IF ( .NOT. constant_diffusion ) THEN |
---|
| 133 | e => e_1; e_p => e_2 |
---|
| 134 | ENDIF |
---|
| 135 | IF ( ocean ) THEN |
---|
| 136 | sa => sa_1; sa_p => sa_2 |
---|
| 137 | ENDIF |
---|
| 138 | IF ( humidity .OR. passive_scalar ) THEN |
---|
| 139 | q => q_1; q_p => q_2 |
---|
[1115] | 140 | IF ( cloud_physics .AND. icloud_scheme == 0 .AND. & |
---|
| 141 | precipitation ) THEN |
---|
[1053] | 142 | qr => qr_1; qr_p => qr_2 |
---|
| 143 | nr => nr_1; nr_p => nr_2 |
---|
| 144 | ENDIF |
---|
[1001] | 145 | ENDIF |
---|
[1] | 146 | |
---|
| 147 | |
---|
[1001] | 148 | CASE ( 1 ) |
---|
[1] | 149 | |
---|
[1001] | 150 | u => u_2; u_p => u_1 |
---|
| 151 | v => v_2; v_p => v_1 |
---|
| 152 | w => w_2; w_p => w_1 |
---|
[1032] | 153 | IF ( .NOT. neutral ) THEN |
---|
| 154 | pt => pt_2; pt_p => pt_1 |
---|
| 155 | ENDIF |
---|
[1001] | 156 | IF ( .NOT. constant_diffusion ) THEN |
---|
| 157 | e => e_2; e_p => e_1 |
---|
[1] | 158 | ENDIF |
---|
[1001] | 159 | IF ( ocean ) THEN |
---|
| 160 | sa => sa_2; sa_p => sa_1 |
---|
| 161 | ENDIF |
---|
| 162 | IF ( humidity .OR. passive_scalar ) THEN |
---|
| 163 | q => q_2; q_p => q_1 |
---|
[1115] | 164 | IF ( cloud_physics .AND. icloud_scheme == 0 .AND. & |
---|
| 165 | precipitation) THEN |
---|
[1053] | 166 | qr => qr_2; qr_p => qr_1 |
---|
| 167 | nr => nr_2; nr_p => nr_1 |
---|
| 168 | ENDIF |
---|
[1001] | 169 | ENDIF |
---|
[1] | 170 | |
---|
| 171 | |
---|
| 172 | END SELECT |
---|
| 173 | |
---|
| 174 | CALL cpu_log( log_point(28), 'swap_timelevel', 'stop' ) |
---|
[1010] | 175 | #endif |
---|
[1] | 176 | |
---|
| 177 | END SUBROUTINE swap_timelevel |
---|
| 178 | |
---|
| 179 | |
---|