Changeset 3051 for palm/trunk/SOURCE/init_grid.f90
- Timestamp:
- May 30, 2018 5:43:55 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/init_grid.f90
r3049 r3051 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Minor bugfix concerning mapping 3D buildings on top of terrain 28 ! 29 ! 3045 2018-05-28 07:55:41Z Giersch 27 30 ! Error messages revised 28 31 ! … … 926 929 topo_3d(nzb,:,:) = IBCLR( topo_3d(nzb,:,:), 0 ) 927 930 ! 931 !-- In order to map topography on PALM grid also in case of ocean simulations, 932 !-- pre-calculate an offset value. 933 ocean_offset = MERGE( zw(0), 0.0_wp, ocean ) 934 ! 928 935 !-- Reference buildings on top of orography. This is not necessary 929 936 !-- if topography is read from ASCII file as no distinction between buildings … … 1038 1045 1039 1046 ! 1040 !-- Finally, determine maximumum terrain height occupied by the1041 !-- respective building.1047 !-- Determine maximumum terrain height occupied by the respective 1048 !-- building and temporalily store on oro_max 1042 1049 ALLOCATE( oro_max_l(1:SIZE(build_ids_final)) ) 1043 1050 ALLOCATE( oro_max(1:SIZE(build_ids_final)) ) … … 1059 1066 oro_max = oro_max_l 1060 1067 #endif 1068 ! 1069 !-- Finally, determine discrete grid height of maximum orography occupied 1070 !-- by a building. Use all-or-nothing approach, i.e. a grid box is either 1071 oro_max_l = 0.0 1072 DO nr = 1, SIZE(build_ids_final) 1073 DO k = nzb, nzt 1074 IF ( zu(k) - ocean_offset <= oro_max(nr) ) & 1075 oro_max_l = zw(k) - ocean_offset 1076 ENDDO 1077 oro_max = oro_max_l 1078 ENDDO 1061 1079 ENDIF 1062 1080 ! 1063 1081 !-- Map orography as well as buildings onto grid. 1064 !-- In case of ocean simulations, add an offset.1065 ocean_offset = MERGE( zw(0), 0.0_wp, ocean )1066 1082 DO i = nxl, nxr 1067 1083 DO j = nys, nyn … … 1080 1096 topo_3d(k,j,i) = IBCLR( topo_3d(k,j,i), 0 ) 1081 1097 topo_3d(k,j,i) = IBSET( topo_3d(k,j,i), 1 ) 1082 topo_top_index = topo_top_index + 11098 topo_top_index = k ! topo_top_index + 1 1083 1099 ENDIF 1084 1100 ! … … 1116 1132 building_id_f%var(j,i) ), DIM = 1 ) 1117 1133 ! 1118 !-- Extend building down to the terrain surface. 1119 k2 = topo_top_index 1134 !-- Extend building down to the terrain surface, i.e. fill-up 1135 !-- surface irregularities below a building. Note, oro_max 1136 !-- is already a discrete height according to the all-or-nothing 1137 !-- approach, i.e. grid box is either topography or atmosphere, 1138 !-- terrain top is defined at upper bound of the grid box. 1139 !-- Hence, check for zw in this case. 1120 1140 DO k = topo_top_index + 1, nzt + 1 1121 IF ( z u(k) - ocean_offset <= oro_max(nr) ) THEN1141 IF ( zw(k) - ocean_offset <= oro_max(nr) ) THEN 1122 1142 topo_3d(k,j,i) = IBCLR( topo_3d(k,j,i), 0 ) 1123 1143 topo_3d(k,j,i) = IBSET( topo_3d(k,j,i), 2 ) 1124 k2 = k2 + 11125 1144 ENDIF 1126 ENDDO 1127 topo_top_index = k2 1128 ! 1129 !-- Now, map building on top. 1145 ENDDO 1146 ! 1147 !-- After surface irregularities are smoothen, determine lower 1148 !-- start index where building starts. 1149 DO k = nzb, nzt 1150 IF ( zw(k) - ocean_offset <= oro_max(nr) ) & 1151 topo_top_index = k 1152 ENDDO 1153 ! 1154 !-- Finally, map building on top. 1130 1155 k2 = 0 1131 1156 DO k = topo_top_index, nzt + 1
Note: See TracChangeset
for help on using the changeset viewer.