source: palm/trunk/SOURCE/swap_timelevel.f90 @ 1320

Last change on this file since 1320 was 1320, checked in by raasch, 10 years ago

ONLY-attribute added to USE-statements,
kind-parameters added to all INTEGER and REAL declaration statements,
kinds are defined in new module kinds,
old module precision_kind is removed,
revision history before 2012 removed,
comment fields (!:) to be used for variable explanations added to all variable declaration statements

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