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

Last change on this file since 2008 was 2008, checked in by kanani, 8 years ago

last commit documented

  • Property svn:keywords set to Id
File size: 8.0 KB
RevLine 
[1682]1!> @file swap_timelevel.f90
[2000]2!------------------------------------------------------------------------------!
[1036]3! This file is part of PALM.
4!
[2000]5! PALM is free software: you can redistribute it and/or modify it under the
6! terms of the GNU General Public License as published by the Free Software
7! Foundation, either version 3 of the License, or (at your option) any later
8! version.
[1036]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!
[1818]17! Copyright 1997-2016 Leibniz Universitaet Hannover
[2000]18!------------------------------------------------------------------------------!
[1036]19!
[484]20! Current revisions:
[1]21! -----------------
[1961]22!
[2008]23!
[1]24! Former revisions:
25! -----------------
[3]26! $Id: swap_timelevel.f90 2008 2016-08-24 15:53:00Z kanani $
[39]27!
[2008]28! 2007 2016-08-24 15:47:17Z kanani
29! Added swapping of urban surface model quantities,
30! removed redundance for land surface model
31!
[2001]32! 2000 2016-08-20 18:09:15Z knoop
33! Forced header and separation lines into 80 columns
34!
[1961]35! 1960 2016-07-12 16:34:24Z suehring
36! Separate humidity and passive scalar
37!
[1823]38! 1822 2016-04-07 07:49:42Z hoffmann
39! icloud_scheme replaced by microphysics_*
40!
[1767]41! swap_timelevel.f90 1766 2016-02-29 08:37:15Z raasch
42! setting the swap level for pmc data transfer
43!
[1748]44! 1747 2016-02-08 12:25:53Z raasch
45! explicit loops in nopointer case to omit craypointer option of pgi compiler
46!
[1683]47! 1682 2015-10-07 23:56:08Z knoop
48! Code annotations made doxygen readable
49!
[1497]50! 1496 2014-12-02 17:25:50Z maronga
51! Added swapping of land surface model quantities
52!
[1375]53! 1374 2014-04-25 12:55:07Z raasch
54! bugfix: use-statement for nopointer-case added
55!
[1321]56! 1320 2014-03-20 08:40:49Z raasch
57! ONLY-attribute added to USE-statements,
58! revision history before 2012 removed,
[1319]59! 1318 2014-03-17 13:35:16Z raasch
60! module interfaces removed
61!
[1116]62! 1115 2013-03-26 18:16:16Z hoffmann
63! calculation of qr and nr is restricted to precipitation
64!
[1112]65! 1111 2013-03-08 23:54:10Z raasch
66! openACC directives added
67!
[1054]68! 1053 2012-11-13 17:11:03Z hoffmann
69! swap of timelevels for nr, qr added
70!
[1037]71! 1036 2012-10-22 13:43:42Z raasch
72! code put under GPL (PALM 3.9)
73!
[1033]74! 1032 2012-10-21 13:03:21Z letzel
75! save memory by not allocating pt_2 in case of neutral = .T.
76!
[1011]77! 1010 2012-09-20 07:59:54Z raasch
78! cpp switch __nopointer added for pointer free version
79!
[1002]80! 1001 2012-09-13 14:08:46Z raasch
81! all actions concerning leapfrog scheme removed
82!
[1]83! Revision 1.1  2000/01/10  10:08:58  10:08:58  raasch (Siegfried Raasch)
84! Initial revision
85!
86!
87! Description:
88! ------------
[1682]89!> Swap of timelevels of variables after each timestep
[3]90!------------------------------------------------------------------------------!
[1682]91 SUBROUTINE swap_timelevel
92 
[1]93
[1374]94#if defined( __nopointer )
[1320]95    USE arrays_3d,                                                             &
[1960]96        ONLY:  e, e_p, nr, nr_p, pt, pt_p, q, q_p, qr, qr_p, s, s_p, sa, sa_p, &
97               u, u_p, v, v_p, w, w_p
[1374]98#else
99    USE arrays_3d,                                                             &
[1320]100        ONLY:  e, e_1, e_2, e_p, nr, nr_1, nr_2, nr_p, pt, pt_1, pt_2, pt_p, q,&
[1960]101               q_1, q_2, q_p, qr, qr_1, qr_2, qr_p, s, s_1, s_2, s_p, sa, sa_1,&
102               sa_2, sa_p, u, u_1, u_2, u_p, v, v_1, v_2, v_p, w, w_1, w_2, w_p
[1496]103
[1374]104#endif
[1]105
[1551]106    USE land_surface_model_mod,                                                &
107        ONLY: land_surface, lsm_swap_timelevel
108
[1320]109    USE cpulog,                                                                &
110        ONLY: cpu_log, log_point
111
112    USE control_parameters,                                                    &
[1822]113        ONLY:  cloud_physics, constant_diffusion, humidity,                    &
114               microphysics_seifert, neutral, ocean, passive_scalar,           &
115               timestep_count
[1320]116
[1747]117    USE indices,                                                               &
118        ONLY:  nxlg, nxrg, nyng, nysg, nzb, nzt
[1766]119
120    USE pmc_interface,                                                         &
121        ONLY: nested_run, pmci_set_swaplevel
122
[2007]123    USE urban_surface_mod,                                                     &
124        ONLY:  urban_surface, usm_swap_timelevel
[1766]125
[2007]126
[1]127    IMPLICIT NONE
128
[1766]129    INTEGER ::  i, j, k     !> loop indices
130    INTEGER ::  swap_level  !> swap_level for steering the pmc data transfer
[1747]131
[1]132!
133!-- Incrementing timestep counter
134    timestep_count = timestep_count + 1
135
136!
[1001]137!-- Swap of variables
[1010]138#if defined( __nopointer )
139    CALL cpu_log( log_point(28), 'swap_timelevel (nop)', 'start' )
140
[1111]141    !$acc kernels present( pt, pt_p, u, u_p, v, v_p, w, w_p )
[1747]142    !$acc loop independent
143    DO  i = nxlg, nxrg
144       !$acc loop independent
145       DO  j = nysg, nyng
146          !$acc loop independent
147          DO  k = nzb, nzt+1
148             u(k,j,i)  = u_p(k,j,i)
149             v(k,j,i)  = v_p(k,j,i)
150             w(k,j,i)  = w_p(k,j,i)
151             pt(k,j,i) = pt_p(k,j,i)
152          ENDDO
153       ENDDO
154    ENDDO
155!    u  = u_p
156!    v  = v_p
157!    w  = w_p
158!    pt = pt_p
[1111]159    !$acc end kernels
[1010]160    IF ( .NOT. constant_diffusion )  THEN
[1111]161       !$acc kernels present( e, e_p )
[1747]162       !$acc loop independent
163       DO  i = nxlg, nxrg
164          !$acc loop independent
165          DO  j = nysg, nyng
166             !$acc loop independent
167             DO  k = nzb, nzt+1
168                e(k,j,i) = e_p(k,j,i)
169             ENDDO
170          ENDDO
171       ENDDO
172!       e = e_p
[1111]173       !$acc end kernels
[1010]174    ENDIF
175    IF ( ocean )  THEN
176       sa = sa_p
177    ENDIF
[1960]178    IF ( humidity )  THEN
[1053]179       q = q_p             
[1822]180       IF ( cloud_physics  .AND.  microphysics_seifert )  THEN
[1053]181          qr = qr_p
182          nr = nr_p
183       ENDIF
[1010]184    ENDIF
[1960]185    IF ( passive_scalar )  s = s_p             
[1010]186
[1496]187    IF ( land_surface )  THEN
[1551]188       CALL lsm_swap_timelevel ( 0 )
[1496]189    ENDIF
190
[2007]191    IF ( urban_surface )  THEN
192       CALL usm_swap_timelevel ( 0 )
193    ENDIF
[1496]194
[2007]195
[1010]196    CALL cpu_log( log_point(28), 'swap_timelevel (nop)', 'stop' )
197#else
198    CALL cpu_log( log_point(28), 'swap_timelevel', 'start' )
199
[1]200    SELECT CASE ( MOD( timestep_count, 2 ) )
201
202       CASE ( 0 )
203
[1001]204          u  => u_1;   u_p  => u_2
205          v  => v_1;   v_p  => v_2
206          w  => w_1;   w_p  => w_2
[1032]207          IF ( .NOT. neutral )  THEN
208             pt => pt_1;  pt_p => pt_2
209          ENDIF
[1001]210          IF ( .NOT. constant_diffusion )  THEN
211             e => e_1;    e_p => e_2
212          ENDIF
213          IF ( ocean )  THEN
214             sa => sa_1;  sa_p => sa_2
215          ENDIF
[1960]216          IF ( humidity )  THEN
[1001]217             q => q_1;    q_p => q_2
[1822]218             IF ( cloud_physics  .AND.  microphysics_seifert )  THEN
[1053]219                qr => qr_1;    qr_p => qr_2
220                nr => nr_1;    nr_p => nr_2
221             ENDIF
[1001]222          ENDIF
[1960]223          IF ( passive_scalar )  THEN
224             s => s_1;    s_p => s_2
225          ENDIF
[1]226
[1766]227          swap_level = 1
[1496]228
[1001]229       CASE ( 1 )
[1]230
[1001]231          u  => u_2;   u_p  => u_1
232          v  => v_2;   v_p  => v_1
233          w  => w_2;   w_p  => w_1
[1032]234          IF ( .NOT. neutral )  THEN
235             pt => pt_2;  pt_p => pt_1
236          ENDIF
[1001]237          IF ( .NOT. constant_diffusion )  THEN
238             e => e_2;    e_p => e_1
[1]239          ENDIF
[1001]240          IF ( ocean )  THEN
241             sa => sa_2;  sa_p => sa_1
242          ENDIF
[1960]243          IF ( humidity )  THEN
[1001]244             q => q_2;    q_p => q_1
[1822]245             IF ( cloud_physics  .AND.  microphysics_seifert )  THEN
[1053]246                qr => qr_2;    qr_p => qr_1
247                nr => nr_2;    nr_p => nr_1
248             ENDIF
[1001]249          ENDIF
[1960]250          IF ( passive_scalar )  THEN
251             s => s_2;    s_p => s_1
252          ENDIF
[1]253
[1766]254          swap_level = 2
[1496]255
[1]256    END SELECT
257
[2007]258    IF ( land_surface )  THEN
259       CALL lsm_swap_timelevel ( MOD( timestep_count, 2) )
260    ENDIF
261
262    IF ( urban_surface )  THEN
263       CALL usm_swap_timelevel ( MOD( timestep_count, 2) )
264    ENDIF
265
[1766]266!
267!-- Set the swap level for steering the pmc data transfer
268    IF ( nested_run )  CALL pmci_set_swaplevel( swap_level )
269
[1]270    CALL cpu_log( log_point(28), 'swap_timelevel', 'stop' )
[1010]271#endif
[1]272
273 END SUBROUTINE swap_timelevel
274
275
Note: See TracBrowser for help on using the repository browser.