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

Last change on this file since 1053 was 1053, checked in by hoffmann, 11 years ago

two-moment cloud physics implemented

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