1 | SUBROUTINE swap_timelevel |
---|
2 | |
---|
3 | !------------------------------------------------------------------------------! |
---|
4 | ! Current revisions: |
---|
5 | ! ----------------- |
---|
6 | ! |
---|
7 | ! |
---|
8 | ! Former revisions: |
---|
9 | ! ----------------- |
---|
10 | ! $Id: swap_timelevel.f90 1033 2012-10-21 13:25:48Z raasch $ |
---|
11 | ! |
---|
12 | ! 1032 2012-10-21 13:03:21Z letzel |
---|
13 | ! save memory by not allocating pt_2 in case of neutral = .T. |
---|
14 | ! |
---|
15 | ! 1010 2012-09-20 07:59:54Z raasch |
---|
16 | ! cpp switch __nopointer added for pointer free version |
---|
17 | ! |
---|
18 | ! 1001 2012-09-13 14:08:46Z raasch |
---|
19 | ! all actions concerning leapfrog scheme removed |
---|
20 | ! |
---|
21 | ! 102 2007-07-27 09:09:17Z raasch |
---|
22 | ! swaping of uswst, vswst included |
---|
23 | ! |
---|
24 | ! 95 2007-06-02 16:48:38Z raasch |
---|
25 | ! Swaping of salinity |
---|
26 | ! |
---|
27 | ! 75 2007-03-22 09:54:05Z raasch |
---|
28 | ! moisture renamed humidity |
---|
29 | ! |
---|
30 | ! 19 2007-02-23 04:53:48Z raasch |
---|
31 | ! Swaping of top fluxes |
---|
32 | ! |
---|
33 | ! RCS Log replace by Id keyword, revision history cleaned up |
---|
34 | ! |
---|
35 | ! Revision 1.8 2004/01/28 15:28:18 raasch |
---|
36 | ! Swaping for Runge-Kutta schemes implemented |
---|
37 | ! |
---|
38 | ! Revision 1.1 2000/01/10 10:08:58 10:08:58 raasch (Siegfried Raasch) |
---|
39 | ! Initial revision |
---|
40 | ! |
---|
41 | ! |
---|
42 | ! Description: |
---|
43 | ! ------------ |
---|
44 | ! Swap of timelevels of variables after each timestep |
---|
45 | !------------------------------------------------------------------------------! |
---|
46 | |
---|
47 | USE arrays_3d |
---|
48 | USE cpulog |
---|
49 | USE interfaces |
---|
50 | USE control_parameters |
---|
51 | |
---|
52 | IMPLICIT NONE |
---|
53 | |
---|
54 | ! |
---|
55 | !-- Incrementing timestep counter |
---|
56 | timestep_count = timestep_count + 1 |
---|
57 | |
---|
58 | ! |
---|
59 | !-- Swap of variables |
---|
60 | #if defined( __nopointer ) |
---|
61 | CALL cpu_log( log_point(28), 'swap_timelevel (nop)', 'start' ) |
---|
62 | |
---|
63 | u = u_p |
---|
64 | v = v_p |
---|
65 | w = w_p |
---|
66 | pt = pt_p |
---|
67 | IF ( .NOT. constant_diffusion ) THEN |
---|
68 | e = e_p |
---|
69 | ENDIF |
---|
70 | IF ( ocean ) THEN |
---|
71 | sa = sa_p |
---|
72 | ENDIF |
---|
73 | IF ( humidity .OR. passive_scalar ) THEN |
---|
74 | q = q_p |
---|
75 | ENDIF |
---|
76 | |
---|
77 | CALL cpu_log( log_point(28), 'swap_timelevel (nop)', 'stop' ) |
---|
78 | #else |
---|
79 | CALL cpu_log( log_point(28), 'swap_timelevel', 'start' ) |
---|
80 | |
---|
81 | SELECT CASE ( MOD( timestep_count, 2 ) ) |
---|
82 | |
---|
83 | CASE ( 0 ) |
---|
84 | |
---|
85 | u => u_1; u_p => u_2 |
---|
86 | v => v_1; v_p => v_2 |
---|
87 | w => w_1; w_p => w_2 |
---|
88 | IF ( .NOT. neutral ) THEN |
---|
89 | pt => pt_1; pt_p => pt_2 |
---|
90 | ENDIF |
---|
91 | IF ( .NOT. constant_diffusion ) THEN |
---|
92 | e => e_1; e_p => e_2 |
---|
93 | ENDIF |
---|
94 | IF ( ocean ) THEN |
---|
95 | sa => sa_1; sa_p => sa_2 |
---|
96 | ENDIF |
---|
97 | IF ( humidity .OR. passive_scalar ) THEN |
---|
98 | q => q_1; q_p => q_2 |
---|
99 | ENDIF |
---|
100 | |
---|
101 | |
---|
102 | CASE ( 1 ) |
---|
103 | |
---|
104 | u => u_2; u_p => u_1 |
---|
105 | v => v_2; v_p => v_1 |
---|
106 | w => w_2; w_p => w_1 |
---|
107 | IF ( .NOT. neutral ) THEN |
---|
108 | pt => pt_2; pt_p => pt_1 |
---|
109 | ENDIF |
---|
110 | IF ( .NOT. constant_diffusion ) THEN |
---|
111 | e => e_2; e_p => e_1 |
---|
112 | ENDIF |
---|
113 | IF ( ocean ) THEN |
---|
114 | sa => sa_2; sa_p => sa_1 |
---|
115 | ENDIF |
---|
116 | IF ( humidity .OR. passive_scalar ) THEN |
---|
117 | q => q_2; q_p => q_1 |
---|
118 | ENDIF |
---|
119 | |
---|
120 | |
---|
121 | END SELECT |
---|
122 | |
---|
123 | CALL cpu_log( log_point(28), 'swap_timelevel', 'stop' ) |
---|
124 | #endif |
---|
125 | |
---|
126 | END SUBROUTINE swap_timelevel |
---|
127 | |
---|
128 | |
---|