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

Last change on this file since 2718 was 2718, checked in by maronga, 6 years ago

deleting of deprecated files; headers updated where needed

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