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