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