1 | SUBROUTINE swap_timelevel |
---|
2 | |
---|
3 | !------------------------------------------------------------------------------! |
---|
4 | ! Actual revisions: |
---|
5 | ! ----------------- |
---|
6 | ! Swaping of salinity |
---|
7 | ! |
---|
8 | ! Former revisions: |
---|
9 | ! ----------------- |
---|
10 | ! $Id: swap_timelevel.f90 95 2007-06-02 16:48:38Z raasch $ |
---|
11 | ! |
---|
12 | ! 75 2007-03-22 09:54:05Z raasch |
---|
13 | ! moisture renamed humidity |
---|
14 | ! |
---|
15 | ! 19 2007-02-23 04:53:48Z raasch |
---|
16 | ! Swaping of top fluxes |
---|
17 | ! |
---|
18 | ! RCS Log replace by Id keyword, revision history cleaned up |
---|
19 | ! |
---|
20 | ! Revision 1.8 2004/01/28 15:28:18 raasch |
---|
21 | ! Swaping for Runge-Kutta schemes implemented |
---|
22 | ! |
---|
23 | ! Revision 1.1 2000/01/10 10:08:58 10:08:58 raasch (Siegfried Raasch) |
---|
24 | ! Initial revision |
---|
25 | ! |
---|
26 | ! |
---|
27 | ! Description: |
---|
28 | ! ------------ |
---|
29 | ! Swap of timelevels of variables after each timestep |
---|
30 | !------------------------------------------------------------------------------! |
---|
31 | |
---|
32 | USE arrays_3d |
---|
33 | USE cpulog |
---|
34 | USE interfaces |
---|
35 | USE control_parameters |
---|
36 | |
---|
37 | IMPLICIT NONE |
---|
38 | |
---|
39 | |
---|
40 | CALL cpu_log( log_point(28), 'swap_timelevel', 'start' ) |
---|
41 | |
---|
42 | ! |
---|
43 | !-- Incrementing timestep counter |
---|
44 | timestep_count = timestep_count + 1 |
---|
45 | |
---|
46 | ! |
---|
47 | !-- Swap of 3-level variables |
---|
48 | IF ( timestep_scheme(1:5) /= 'runge' ) THEN |
---|
49 | |
---|
50 | SELECT CASE ( MOD( timestep_count, 3 ) ) |
---|
51 | |
---|
52 | CASE ( 0 ) |
---|
53 | |
---|
54 | u_m => u_1; u => u_2; u_p => u_3 |
---|
55 | v_m => v_1; v => v_2; v_p => v_3 |
---|
56 | w_m => w_1; w => w_2; w_p => w_3 |
---|
57 | pt_m => pt_1; pt => pt_2; pt_p => pt_3 |
---|
58 | IF ( .NOT. constant_diffusion ) THEN |
---|
59 | e_m => e_1; e => e_2; e_p => e_3 |
---|
60 | ENDIF |
---|
61 | IF ( humidity .OR. passive_scalar ) THEN |
---|
62 | q_m => q_1; q => q_2; q_p => q_3 |
---|
63 | ENDIF |
---|
64 | |
---|
65 | CASE ( 1 ) |
---|
66 | |
---|
67 | u_m => u_2; u => u_3; u_p => u_1 |
---|
68 | v_m => v_2; v => v_3; v_p => v_1 |
---|
69 | w_m => w_2; w => w_3; w_p => w_1 |
---|
70 | pt_m => pt_2; pt => pt_3; pt_p => pt_1 |
---|
71 | IF ( .NOT. constant_diffusion ) THEN |
---|
72 | e_m => e_2; e => e_3; e_p => e_1 |
---|
73 | ENDIF |
---|
74 | IF ( humidity .OR. passive_scalar ) THEN |
---|
75 | q_m => q_2; q => q_3; q_p => q_1 |
---|
76 | ENDIF |
---|
77 | |
---|
78 | CASE ( 2 ) |
---|
79 | |
---|
80 | u_m => u_3; u => u_1; u_p => u_2 |
---|
81 | v_m => v_3; v => v_1; v_p => v_2 |
---|
82 | w_m => w_3; w => w_1; w_p => w_2 |
---|
83 | pt_m => pt_3; pt => pt_1; pt_p => pt_2 |
---|
84 | IF ( .NOT. constant_diffusion ) THEN |
---|
85 | e_m => e_3; e => e_1; e_p => e_2 |
---|
86 | ENDIF |
---|
87 | IF ( humidity .OR. passive_scalar ) THEN |
---|
88 | q_m => q_3; q => q_1; q_p => q_2 |
---|
89 | ENDIF |
---|
90 | |
---|
91 | END SELECT |
---|
92 | |
---|
93 | ENDIF |
---|
94 | |
---|
95 | ! |
---|
96 | !-- Swap of 2-level variables |
---|
97 | SELECT CASE ( MOD( timestep_count, 2 ) ) |
---|
98 | |
---|
99 | CASE ( 0 ) |
---|
100 | |
---|
101 | IF ( timestep_scheme(1:5) == 'runge' ) THEN |
---|
102 | |
---|
103 | u => u_1; u_p => u_2 |
---|
104 | v => v_1; v_p => v_2 |
---|
105 | w => w_1; w_p => w_2 |
---|
106 | pt => pt_1; pt_p => pt_2 |
---|
107 | IF ( .NOT. constant_diffusion ) THEN |
---|
108 | e => e_1; e_p => e_2 |
---|
109 | ENDIF |
---|
110 | IF ( ocean ) THEN |
---|
111 | sa => sa_1; sa_p => sa_2 |
---|
112 | ENDIF |
---|
113 | IF ( humidity .OR. passive_scalar ) THEN |
---|
114 | q => q_1; q_p => q_2 |
---|
115 | ENDIF |
---|
116 | |
---|
117 | ELSE |
---|
118 | ! |
---|
119 | !-- Old timelevels are needed for explicit diffusion within leapfrog |
---|
120 | IF ( .NOT. constant_diffusion ) THEN |
---|
121 | kh_m => kh_1; kh => kh_2 |
---|
122 | km_m => km_1; km => km_2 |
---|
123 | IF ( use_surface_fluxes ) THEN |
---|
124 | usws_m => usws_1; usws => usws_2 |
---|
125 | vsws_m => vsws_1; vsws => vsws_2 |
---|
126 | shf_m => shf_1; shf => shf_2 |
---|
127 | IF ( humidity .OR. passive_scalar ) THEN |
---|
128 | qsws_m => qsws_1; qsws => qsws_2 |
---|
129 | ENDIF |
---|
130 | ENDIF |
---|
131 | IF ( prandtl_layer ) THEN |
---|
132 | rif_m => rif_1; rif => rif_2 |
---|
133 | ENDIF |
---|
134 | IF ( use_top_fluxes ) THEN |
---|
135 | tswst_m => tswst_1; tswst => tswst_2 |
---|
136 | IF ( humidity .OR. passive_scalar ) THEN |
---|
137 | qswst_m => qswst_1; qswst => qswst_2 |
---|
138 | ENDIF |
---|
139 | ENDIF |
---|
140 | ENDIF |
---|
141 | |
---|
142 | IF ( humidity ) THEN |
---|
143 | vpt_m => vpt_1; vpt => vpt_2 |
---|
144 | ENDIF |
---|
145 | |
---|
146 | ENDIF |
---|
147 | |
---|
148 | CASE ( 1 ) |
---|
149 | |
---|
150 | IF ( timestep_scheme(1:5) == 'runge' ) THEN |
---|
151 | |
---|
152 | u => u_2; u_p => u_1 |
---|
153 | v => v_2; v_p => v_1 |
---|
154 | w => w_2; w_p => w_1 |
---|
155 | pt => pt_2; pt_p => pt_1 |
---|
156 | IF ( .NOT. constant_diffusion ) THEN |
---|
157 | e => e_2; e_p => e_1 |
---|
158 | ENDIF |
---|
159 | IF ( ocean ) THEN |
---|
160 | sa => sa_2; sa_p => sa_1 |
---|
161 | ENDIF |
---|
162 | IF ( humidity .OR. passive_scalar ) THEN |
---|
163 | q => q_2; q_p => q_1 |
---|
164 | ENDIF |
---|
165 | |
---|
166 | ELSE |
---|
167 | |
---|
168 | IF ( .NOT. constant_diffusion ) THEN |
---|
169 | kh_m => kh_2; kh => kh_1 |
---|
170 | km_m => km_2; km => km_1 |
---|
171 | IF ( use_surface_fluxes ) THEN |
---|
172 | usws_m => usws_2; usws => usws_1 |
---|
173 | vsws_m => vsws_2; vsws => vsws_1 |
---|
174 | shf_m => shf_2; shf => shf_1 |
---|
175 | IF ( humidity .OR. passive_scalar ) THEN |
---|
176 | qsws_m => qsws_2; qsws => qsws_1 |
---|
177 | ENDIF |
---|
178 | ENDIF |
---|
179 | IF ( prandtl_layer ) THEN |
---|
180 | rif_m => rif_2; rif => rif_1 |
---|
181 | ENDIF |
---|
182 | IF ( use_top_fluxes ) THEN |
---|
183 | tswst_m => tswst_2; tswst => tswst_1 |
---|
184 | IF ( humidity .OR. passive_scalar ) THEN |
---|
185 | qswst_m => qswst_2; qswst => qswst_1 |
---|
186 | ENDIF |
---|
187 | ENDIF |
---|
188 | ENDIF |
---|
189 | |
---|
190 | IF ( humidity ) THEN |
---|
191 | vpt_m => vpt_2; vpt => vpt_1 |
---|
192 | ENDIF |
---|
193 | |
---|
194 | ENDIF |
---|
195 | |
---|
196 | END SELECT |
---|
197 | |
---|
198 | CALL cpu_log( log_point(28), 'swap_timelevel', 'stop' ) |
---|
199 | |
---|
200 | END SUBROUTINE swap_timelevel |
---|
201 | |
---|
202 | |
---|