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

Last change on this file since 1613 was 1551, checked in by maronga, 9 years ago

land surface model released

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