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

Last change on this file since 2232 was 2232, checked in by suehring, 7 years ago

Adjustments according new topography and surface-modelling concept implemented

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