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