Changeset 861 for palm/trunk/SOURCE/init_grid.f90
 Timestamp:
 Mar 26, 2012 2:18:34 PM (12 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

palm/trunk/SOURCE/init_grid.f90
r844 r861 4 4 ! Current revisions: 5 5 !  6 ! Set wall_flags_0. The array is needed for degradation in wsscheme near walls, 7 ! inflow and outflow boundaries as well as near the bottom and the top of the 8 ! model domain. 9 ! 10 ! Initialization of nzb_s_inner and nzb_w_inner. 11 ! gls has to be at least nbgp to do not exceed the array bounds of nzb_local 12 ! while setting wall_flags_0 6 13 ! 7 14 ! Former revisions: … … 104 111 corner_sr, wall_l, wall_n, wall_r,& 105 112 wall_s, nzb_local, nzb_tmp 113 114 LOGICAL :: flag_set = .FALSE. 106 115 107 116 REAL :: dx_l, dy_l, dz_stretched … … 311 320 ! the flag arrays needed for the multigrid method 312 321 gls = 2**( maximum_grid_level ) 322 IF ( gls < nbgp ) gls = nbgp 313 323 314 324 ALLOCATE( corner_nl(nys:nyn,nxl:nxr), corner_nr(nys:nyn,nxl:nxr), & … … 589 599 590 600 END SELECT 591 601 ! 602 ! Determine the maximum level of topography. Furthermore it is used for 603 ! steering the degradation of order of the applied advection scheme. 604 nzb_max = MAXVAL( nzb_local ) 592 605 ! 593 606 ! Consistency checks and index array initialization are only required for … … 653 666 ! 654 667 ! Initialize index arrays nzb_s_inner and nzb_w_inner 655 nzb_s_inner = nzb_local(nys 1:nyn+1,nxl1:nxr+1)656 nzb_w_inner = nzb_local(nys 1:nyn+1,nxl1:nxr+1)668 nzb_s_inner = nzb_local(nysg:nyng,nxlg:nxrg) 669 nzb_w_inner = nzb_local(nysg:nyng,nxlg:nxrg) 657 670 658 671 ! … … 1018 1031 ENDDO 1019 1032 ENDDO 1020 ENDDO 1033 ENDDO 1021 1034 1022 1035 ! … … 1036 1049 1037 1050 ENDIF 1051 ! 1052 ! Allocate flags needed for masking walls. 1053 ALLOCATE( wall_flags_0(nzb:nzt,nys:nyn,nxl:nxr) ) 1054 wall_flags_0 = 0 1055 1056 IF ( scalar_advec == 'wsscheme' ) THEN 1057 ! 1058 ! Set flags to steer the degradation of the advection scheme in advec_ws 1059 ! near topography, inflow and outflow boundaries as well as bottom and 1060 ! top of model domain. wall_flags_0 remains zero for all nonprognostic 1061 ! grid points. 1062 DO i = nxl, nxr 1063 DO j = nys, nyn 1064 DO k = nzb_s_inner(j,i)+1, nzt 1065 ! 1066 ! scalar  xdirection 1067 ! WS1 (0), WS3 (1), WS5 (2) 1068 IF ( k <= nzb_s_inner(j,i+1) .OR. ( outflow_l .AND. i == nxl ) & 1069 .OR. ( outflow_r .AND. i == nxr ) ) THEN 1070 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 0 ) 1071 ELSEIF ( k <= nzb_s_inner(j,i+2) .OR. k <= nzb_s_inner(j,i1) & 1072 .OR. ( outflow_r .AND. i == nxr1 ) & 1073 .OR. ( outflow_l .AND. i == nxlu ) ) THEN 1074 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 1 ) 1075 ELSE 1076 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 2 ) 1077 ENDIF 1078 ! 1079 ! scalar  ydirection 1080 ! WS1 (3), WS3 (4), WS5 (5) 1081 IF ( k <= nzb_s_inner(j+1,i) .OR. ( outflow_s .AND. j == nys ) & 1082 .OR. ( outflow_n .AND. j == nyn ) ) THEN 1083 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 3 ) 1084 ! WS3 1085 ELSEIF ( k <= nzb_s_inner(j+2,i) .OR. k <= nzb_s_inner(j1,i) & 1086 .OR. ( outflow_s .AND. j == nysv ) & 1087 .OR. ( outflow_n .AND. j == nyn1 ) ) THEN 1088 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 4 ) 1089 ! WS5 1090 ELSE 1091 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 5 ) 1092 ENDIF 1093 ! 1094 ! scalar  zdirection 1095 ! WS1 (6), WS3 (7), WS5 (8) 1096 flag_set = .FALSE. 1097 IF ( k == nzb_s_inner(j,i) + 1 .OR. k == nzt ) THEN 1098 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 6 ) 1099 flag_set = .TRUE. 1100 ELSEIF ( k == nzb_s_inner(j,i) + 2 .OR. k == nzt  1 ) THEN 1101 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 7 ) 1102 flag_set = .TRUE. 1103 ELSEIF ( k > nzb_s_inner(j,i) .AND. .NOT. flag_set ) THEN 1104 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 8 ) 1105 ENDIF 1106 ENDDO 1107 ENDDO 1108 ENDDO 1109 ENDIF 1110 1111 IF ( momentum_advec == 'wsscheme' ) THEN 1112 ! 1113 ! Set wall_flags_0 to steer the degradation of the advection scheme in advec_ws 1114 ! near topography, inflow and outflow boundaries as well as bottom and 1115 ! top of model domain. wall_flags_0 remains zero for all nonprognostic 1116 ! grid points. 1117 DO i = nxl, nxr 1118 DO j = nys, nyn 1119 DO k = nzb_u_inner(j,i)+1, nzt 1120 ! 1121 ! u component  xdirection 1122 ! WS1 (9), WS3 (10), WS5 (11) 1123 IF ( k <= nzb_u_inner(j,i+1) & 1124 .OR. ( outflow_r .AND. i == nxr ) ) THEN 1125 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 9 ) 1126 ELSEIF ( k <= nzb_u_inner(j,i+2) .OR. k <= nzb_u_inner(j,i1) & 1127 .OR. ( outflow_r .AND. i == nxr1 ) & 1128 .OR. ( outflow_l .AND. i == nxlu ) ) THEN 1129 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 10 ) 1130 ELSE 1131 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 11 ) 1132 ENDIF 1133 ! 1134 ! u component  ydirection 1135 ! WS1 (12), WS3 (13), WS5 (14) 1136 IF ( k <= nzb_u_inner(j+1,i) .OR. ( outflow_s .AND. j == nys ) & 1137 .OR. ( outflow_n .AND. j == nyn ) ) THEN 1138 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 12 ) 1139 ELSEIF ( k <= nzb_u_inner(j+2,i) .OR. k <= nzb_u_inner(j1,i) & 1140 .OR. ( outflow_s .AND. j == nysv ) & 1141 .OR. ( outflow_n .AND. j == nyn1 ) ) THEN 1142 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 13 ) 1143 ELSE 1144 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 14 ) 1145 ENDIF 1146 ! 1147 ! u component  zdirection 1148 ! WS1 (15), WS3 (16), WS5 (17) 1149 flag_set = .FALSE. 1150 IF ( k == nzb_u_inner(j,i) + 1 .OR. k == nzt ) THEN 1151 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 15 ) 1152 flag_set = .TRUE. 1153 ELSEIF ( k == nzb_u_inner(j,i) + 2 .OR. k == nzt  1 ) THEN 1154 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 16 ) 1155 flag_set = .TRUE. 1156 ELSEIF ( k > nzb_u_inner(j,i) .AND. .NOT. flag_set ) THEN 1157 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 17 ) 1158 ENDIF 1159 1160 ENDDO 1161 ENDDO 1162 ENDDO 1163 1164 DO i = nxl, nxr 1165 DO j = nys, nyn 1166 DO k = nzb_v_inner(j,i)+1, nzt 1167 ! 1168 ! v component  xdirection 1169 ! WS1 (18), WS3 (19), WS5 (20) 1170 IF ( k <= nzb_v_inner(j,i+1) .OR. ( outflow_l .AND. i == nxl ) & 1171 .OR. ( outflow_r .AND. i == nxr ) ) THEN 1172 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 18 ) 1173 ! WS3 1174 ELSEIF ( k <= nzb_v_inner(j,i+2) .OR. k <= nzb_v_inner(j,i1) & 1175 .OR. ( outflow_r .AND. i == nxr1 ) & 1176 .OR. ( outflow_l .AND. i == nxlu ) ) THEN 1177 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 19 ) 1178 ELSE 1179 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 20 ) 1180 ENDIF 1181 ! 1182 ! v component  ydirection 1183 ! WS1 (21), WS3 (22), WS5 (23) 1184 IF ( k <= nzb_v_inner(j+1,i) & 1185 .OR. ( outflow_n .AND. j == nyn ) ) THEN 1186 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 21 ) 1187 ELSEIF ( k <= nzb_v_inner(j+2,i) .OR. k <= nzb_v_inner(j1,i) & 1188 .OR. ( outflow_s .AND. j == nysv ) & 1189 .OR. ( outflow_n .AND. j == nyn1 ) ) THEN 1190 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 22 ) 1191 ELSE 1192 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 23 ) 1193 ENDIF 1194 ! 1195 ! v component  zdirection 1196 ! WS1 (24), WS3 (25), WS5 (26) 1197 flag_set = .FALSE. 1198 IF ( k == nzb_v_inner(j,i) + 1 .OR. k == nzt ) THEN 1199 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 24 ) 1200 flag_set = .TRUE. 1201 ELSEIF ( k == nzb_v_inner(j,i) + 2 .OR. k == nzt  1 ) THEN 1202 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 25 ) 1203 flag_set = .TRUE. 1204 ELSEIF ( k > nzb_v_inner(j,i) .AND. .NOT. flag_set ) THEN 1205 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 26 ) 1206 ENDIF 1207 1208 ENDDO 1209 ENDDO 1210 ENDDO 1211 DO i = nxl, nxr 1212 DO j = nys, nyn 1213 DO k = nzb_w_inner(j,i)+1, nzt 1214 ! 1215 ! w component  xdirection 1216 ! WS1 (27), WS3 (28), WS5 (29) 1217 IF ( k <= nzb_w_inner(j,i+1) .OR. ( outflow_l .AND. i == nxl ) & 1218 .OR. ( outflow_r .AND. i == nxr ) ) THEN 1219 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 27 ) 1220 ELSEIF ( k <= nzb_w_inner(j,i+2) .OR. k <= nzb_w_inner(j,i1) & 1221 .OR. ( outflow_r .AND. i == nxr1 ) & 1222 .OR. ( outflow_l .AND. i == nxlu ) ) THEN 1223 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 28 ) 1224 ELSE 1225 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i),29 ) 1226 ENDIF 1227 ! 1228 ! w component  ydirection 1229 ! WS1 (30), WS3 (31), WS5 (32) 1230 IF ( k <= nzb_w_inner(j+1,i) .OR. ( outflow_s .AND. j == nys ) & 1231 .OR. ( outflow_n .AND. j == nyn ) ) THEN 1232 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 30 ) 1233 ELSEIF ( k <= nzb_w_inner(j+2,i) .OR. k <= nzb_w_inner(j1,i) & 1234 .OR. ( outflow_s .AND. j == nysv ) & 1235 .OR. ( outflow_n .AND. j == nyn1 ) ) THEN 1236 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 31 ) 1237 ELSE 1238 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 32 ) 1239 ENDIF 1240 ! 1241 ! w component  zdirection 1242 ! WS1 (33), WS3 (34), WS5 (35) 1243 flag_set = .FALSE. 1244 IF ( k == nzb_w_inner(j,i) .OR. k == nzb_w_inner(j,i) + 1 & 1245 .OR. k == nzt ) THEN 1246 ! 1247 ! Please note, at k == nzb_w_inner(j,i) a flag is explictely 1248 ! set, although this is not a prognostic level. However, 1249 ! contrary to the advection of u,v and s this is necessary 1250 ! because flux_t(nzb_w_inner(j,i)) is used for the tendency 1251 ! at k == nzb_w_inner(j,i)+1. 1252 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 33 ) 1253 flag_set = .TRUE. 1254 ELSEIF ( k == nzb_w_inner(j,i) + 2 .OR. k == nzt  1 ) THEN 1255 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 34 ) 1256 flag_set = .TRUE. 1257 ELSEIF ( k > nzb_w_inner(j,i) .AND. .NOT. flag_set ) THEN 1258 wall_flags_0(k,j,i) = IBSET( wall_flags_0(k,j,i), 35 ) 1259 ENDIF 1260 1261 ENDDO 1262 ENDDO 1263 ENDDO 1264 1265 ENDIF 1038 1266 1039 1267 !
Note: See TracChangeset
for help on using the changeset viewer.