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