Changeset 2894 for palm/trunk/SOURCE/surface_mod.f90
- Timestamp:
- Mar 15, 2018 9:17:58 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/surface_mod.f90
r2813 r2894 26 26 ! ----------------- 27 27 ! $Id$ 28 ! Calculations of the index range of the subdomain on file which overlaps with 29 ! the current subdomain are already done in read_restart_data_mod, 30 ! surface_read/write_restart_data was renamed to surface_r/wrd_local, variable 31 ! named found has been introduced for checking if restart data was found, 32 ! reading of restart strings has been moved completely to 33 ! read_restart_data_mod, surface_rrd_local is already inside the overlap loop 34 ! programmed in read_restart_data_mod, SAVE attribute added where necessary, 35 ! deallocation and allocation of some arrays have been changed to take care of 36 ! different restart files that can be opened (index i), the marker *** end 37 ! surf *** is not necessary anymore, strings and their respective lengths are 38 ! written out and read now in case of restart runs to get rid of prescribed 39 ! character lengths (Giersch) 40 ! 41 ! 2813 2018-02-16 16:28:14Z suehring 28 42 ! Some more bugfixes concerning restart runs 29 43 ! … … 432 446 END INTERFACE init_surface_arrays 433 447 434 INTERFACE surface_r ead_restart_data435 MODULE PROCEDURE surface_r ead_restart_data436 END INTERFACE surface_r ead_restart_data437 438 INTERFACE surface_wr ite_restart_data439 MODULE PROCEDURE surface_wr ite_restart_data440 END INTERFACE surface_wr ite_restart_data448 INTERFACE surface_rrd_local 449 MODULE PROCEDURE surface_rrd_local 450 END INTERFACE surface_rrd_local 451 452 INTERFACE surface_wrd_local 453 MODULE PROCEDURE surface_wrd_local 454 END INTERFACE surface_wrd_local 441 455 442 456 INTERFACE surface_last_actions … … 457 471 PUBLIC get_topography_top_index, get_topography_top_index_ji, init_bc, & 458 472 init_surfaces, & 459 init_surface_arrays, surface_r ead_restart_data, &460 surface_restore_elements, surface_wr ite_restart_data, &473 init_surface_arrays, surface_rrd_local, & 474 surface_restore_elements, surface_wrd_local, & 461 475 surface_last_actions 462 476 … … 888 902 END SUBROUTINE init_surface_arrays 889 903 904 905 !------------------------------------------------------------------------------! 906 ! Description: 907 ! ------------ 908 !> Deallocating memory for upward and downward-facing horizontal surface types, 909 !> except for top fluxes. 910 !------------------------------------------------------------------------------! 911 SUBROUTINE deallocate_surface_attributes_h( surfaces ) 912 913 IMPLICIT NONE 914 915 916 TYPE(surf_type) :: surfaces !< respective surface type 917 918 919 DEALLOCATE ( surfaces%start_index ) 920 DEALLOCATE ( surfaces%end_index ) 921 ! 922 !-- Indices to locate surface element 923 DEALLOCATE ( surfaces%i ) 924 DEALLOCATE ( surfaces%j ) 925 DEALLOCATE ( surfaces%k ) 926 ! 927 !-- Surface-layer height 928 DEALLOCATE ( surfaces%z_mo ) 929 ! 930 !-- Surface orientation 931 DEALLOCATE ( surfaces%facing ) 932 ! 933 !-- Surface-parallel wind velocity 934 DEALLOCATE ( surfaces%uvw_abs ) 935 ! 936 !-- Roughness 937 DEALLOCATE ( surfaces%z0 ) 938 DEALLOCATE ( surfaces%z0h ) 939 DEALLOCATE ( surfaces%z0q ) 940 ! 941 !-- Friction velocity 942 DEALLOCATE ( surfaces%us ) 943 ! 944 !-- Stability parameter 945 DEALLOCATE ( surfaces%ol ) 946 ! 947 !-- Bulk Richardson number 948 DEALLOCATE ( surfaces%rib ) 949 ! 950 !-- Vertical momentum fluxes of u and v 951 DEALLOCATE ( surfaces%usws ) 952 DEALLOCATE ( surfaces%vsws ) 953 ! 954 !-- Required in production_e 955 IF ( .NOT. constant_diffusion ) THEN 956 DEALLOCATE ( surfaces%u_0 ) 957 DEALLOCATE ( surfaces%v_0 ) 958 ENDIF 959 ! 960 !-- Characteristic temperature and surface flux of sensible heat 961 DEALLOCATE ( surfaces%ts ) 962 DEALLOCATE ( surfaces%shf ) 963 ! 964 !-- surface temperature 965 DEALLOCATE ( surfaces%pt_surface ) 966 ! 967 !-- Characteristic humidity and surface flux of latent heat 968 IF ( humidity ) THEN 969 DEALLOCATE ( surfaces%qs ) 970 DEALLOCATE ( surfaces%qsws ) 971 ENDIF 972 ! 973 !-- Characteristic scalar and surface flux of scalar 974 IF ( passive_scalar ) THEN 975 DEALLOCATE ( surfaces%ss ) 976 DEALLOCATE ( surfaces%ssws ) 977 ENDIF 978 ! 979 !-- Scaling parameter (cs*) and surface flux of chemical species 980 IF ( air_chemistry ) THEN 981 DEALLOCATE ( surfaces%css ) 982 DEALLOCATE ( surfaces%cssws ) 983 ENDIF 984 ! 985 !-- Arrays for storing potential temperature and 986 !-- specific humidity at first grid level 987 DEALLOCATE ( surfaces%pt1 ) 988 DEALLOCATE ( surfaces%qv1 ) 989 ! 990 !-- 991 IF ( cloud_physics .AND. microphysics_morrison) THEN 992 DEALLOCATE ( surfaces%qcs ) 993 DEALLOCATE ( surfaces%ncs ) 994 DEALLOCATE ( surfaces%qcsws ) 995 DEALLOCATE ( surfaces%ncsws ) 996 ENDIF 997 ! 998 !-- 999 IF ( cloud_physics .AND. microphysics_seifert) THEN 1000 DEALLOCATE ( surfaces%qrs ) 1001 DEALLOCATE ( surfaces%nrs ) 1002 DEALLOCATE ( surfaces%qrsws ) 1003 DEALLOCATE ( surfaces%nrsws ) 1004 ENDIF 1005 ! 1006 !-- Salinity surface flux 1007 IF ( ocean ) DEALLOCATE ( surfaces%sasws ) 1008 1009 END SUBROUTINE deallocate_surface_attributes_h 1010 1011 890 1012 !------------------------------------------------------------------------------! 891 1013 ! Description: … … 916 1038 !-- might exist for given (j,i). 917 1039 !-- If no surface of respective type exist at current (j,i), set indicies 918 !-- such that loop in diffusion routines will not be entered. 1040 !-- such that loop in diffusion routines will not be entered. 919 1041 ALLOCATE ( surfaces%start_index(nys_l:nyn_l,nxl_l:nxr_l) ) 920 1042 ALLOCATE ( surfaces%end_index(nys_l:nyn_l,nxl_l:nxr_l) ) … … 1015 1137 ! Description: 1016 1138 ! ------------ 1139 !> Deallocating memory for model-top fluxes 1140 !------------------------------------------------------------------------------! 1141 SUBROUTINE deallocate_surface_attributes_h_top( surfaces ) 1142 1143 IMPLICIT NONE 1144 1145 1146 TYPE(surf_type) :: surfaces !< respective surface type 1147 1148 DEALLOCATE ( surfaces%start_index ) 1149 DEALLOCATE ( surfaces%end_index ) 1150 ! 1151 !-- Indices to locate surface (model-top) element 1152 DEALLOCATE ( surfaces%i ) 1153 DEALLOCATE ( surfaces%j ) 1154 DEALLOCATE ( surfaces%k ) 1155 1156 IF ( .NOT. constant_diffusion ) THEN 1157 DEALLOCATE ( surfaces%u_0 ) 1158 DEALLOCATE ( surfaces%v_0 ) 1159 ENDIF 1160 ! 1161 !-- Vertical momentum fluxes of u and v 1162 DEALLOCATE ( surfaces%usws ) 1163 DEALLOCATE ( surfaces%vsws ) 1164 ! 1165 !-- Sensible heat flux 1166 DEALLOCATE ( surfaces%shf ) 1167 ! 1168 !-- Latent heat flux 1169 IF ( humidity .OR. coupling_mode == 'ocean_to_atmosphere') THEN 1170 DEALLOCATE ( surfaces%qsws ) 1171 ENDIF 1172 ! 1173 !-- Scalar flux 1174 IF ( passive_scalar ) THEN 1175 DEALLOCATE ( surfaces%ssws ) 1176 ENDIF 1177 ! 1178 !-- Chemical species flux 1179 IF ( air_chemistry ) THEN 1180 DEALLOCATE ( surfaces%cssws ) 1181 ENDIF 1182 ! 1183 !-- 1184 IF ( cloud_physics .AND. microphysics_morrison) THEN 1185 DEALLOCATE ( surfaces%qcsws ) 1186 DEALLOCATE ( surfaces%ncsws ) 1187 ENDIF 1188 ! 1189 !-- 1190 IF ( cloud_physics .AND. microphysics_seifert) THEN 1191 DEALLOCATE ( surfaces%qrsws ) 1192 DEALLOCATE ( surfaces%nrsws ) 1193 ENDIF 1194 ! 1195 !-- Salinity flux 1196 IF ( ocean ) DEALLOCATE ( surfaces%sasws ) 1197 1198 END SUBROUTINE deallocate_surface_attributes_h_top 1199 1200 1201 !------------------------------------------------------------------------------! 1202 ! Description: 1203 ! ------------ 1017 1204 !> Allocating memory for model-top fluxes 1018 1205 !------------------------------------------------------------------------------! … … 1082 1269 1083 1270 END SUBROUTINE allocate_surface_attributes_h_top 1271 1272 1273 !------------------------------------------------------------------------------! 1274 ! Description: 1275 ! ------------ 1276 !> Deallocating memory for vertical surface types. 1277 !------------------------------------------------------------------------------! 1278 SUBROUTINE deallocate_surface_attributes_v( surfaces ) 1279 1280 IMPLICIT NONE 1281 1282 1283 TYPE(surf_type) :: surfaces !< respective surface type 1284 1285 ! 1286 !-- Allocate arrays for start and end index of vertical surface type 1287 !-- for each (j,i)-grid point. This is required in diffion_x, which is 1288 !-- called for each (j,i). In order to find the location where the 1289 !-- respective flux is store within the surface-type, start- and end- 1290 !-- index are stored for each (j,i). For example, each (j,i) can have 1291 !-- several entries where fluxes for vertical surfaces might be stored. 1292 !-- In the flat case, where no vertical walls exit, set indicies such 1293 !-- that loop in diffusion routines will not be entered. 1294 DEALLOCATE ( surfaces%start_index ) 1295 DEALLOCATE ( surfaces%end_index ) 1296 ! 1297 !-- Indices to locate surface element. 1298 DEALLOCATE ( surfaces%i ) 1299 DEALLOCATE ( surfaces%j ) 1300 DEALLOCATE ( surfaces%k ) 1301 ! 1302 !-- Surface-layer height 1303 DEALLOCATE ( surfaces%z_mo ) 1304 ! 1305 !-- Surface orientation 1306 DEALLOCATE ( surfaces%facing ) 1307 ! 1308 !-- Surface parallel wind velocity 1309 DEALLOCATE ( surfaces%uvw_abs ) 1310 ! 1311 !-- Roughness 1312 DEALLOCATE ( surfaces%z0 ) 1313 DEALLOCATE ( surfaces%z0h ) 1314 DEALLOCATE ( surfaces%z0q ) 1315 1316 ! 1317 !-- Friction velocity 1318 DEALLOCATE ( surfaces%us ) 1319 ! 1320 !-- Allocate Obukhov length and bulk Richardson number. Actually, at 1321 !-- vertical surfaces these are only required for natural surfaces. 1322 !-- for natural land surfaces 1323 DEALLOCATE( surfaces%ol ) 1324 DEALLOCATE( surfaces%rib ) 1325 ! 1326 !-- Allocate arrays for surface momentum fluxes for u and v. For u at north- 1327 !-- and south-facing surfaces, for v at east- and west-facing surfaces. 1328 DEALLOCATE ( surfaces%mom_flux_uv ) 1329 ! 1330 !-- Allocate array for surface momentum flux for w - wsus and wsvs 1331 DEALLOCATE ( surfaces%mom_flux_w ) 1332 ! 1333 !-- Allocate array for surface momentum flux for subgrid-scale tke wsus and 1334 !-- wsvs; first index usvs or vsws, second index for wsus or wsvs, depending 1335 !-- on surface. 1336 DEALLOCATE ( surfaces%mom_flux_tke ) 1337 ! 1338 !-- Characteristic temperature and surface flux of sensible heat 1339 DEALLOCATE ( surfaces%ts ) 1340 DEALLOCATE ( surfaces%shf ) 1341 ! 1342 !-- surface temperature 1343 DEALLOCATE ( surfaces%pt_surface ) 1344 ! 1345 !-- Characteristic humidity and surface flux of latent heat 1346 IF ( humidity ) THEN 1347 DEALLOCATE ( surfaces%qs ) 1348 DEALLOCATE ( surfaces%qsws ) 1349 ENDIF 1350 ! 1351 !-- Characteristic scalar and surface flux of scalar 1352 IF ( passive_scalar ) THEN 1353 DEALLOCATE ( surfaces%ss ) 1354 DEALLOCATE ( surfaces%ssws ) 1355 ENDIF 1356 ! 1357 !-- Scaling parameter (cs*) and surface flux of chemical species 1358 IF ( air_chemistry ) THEN 1359 DEALLOCATE ( surfaces%css ) 1360 DEALLOCATE ( surfaces%cssws ) 1361 ENDIF 1362 ! 1363 !-- Arrays for storing potential temperature and 1364 !-- specific humidity at first grid level 1365 DEALLOCATE ( surfaces%pt1 ) 1366 DEALLOCATE ( surfaces%qv1 ) 1367 1368 IF ( cloud_physics .AND. microphysics_seifert) THEN 1369 DEALLOCATE ( surfaces%qcs ) 1370 DEALLOCATE ( surfaces%ncs ) 1371 DEALLOCATE ( surfaces%qcsws ) 1372 DEALLOCATE ( surfaces%ncsws ) 1373 ENDIF 1374 1375 IF ( cloud_physics .AND. microphysics_seifert) THEN 1376 DEALLOCATE ( surfaces%qrs ) 1377 DEALLOCATE ( surfaces%nrs ) 1378 DEALLOCATE ( surfaces%qrsws ) 1379 DEALLOCATE ( surfaces%nrsws ) 1380 ENDIF 1381 ! 1382 !-- Salinity surface flux 1383 IF ( ocean ) DEALLOCATE ( surfaces%sasws ) 1384 1385 END SUBROUTINE deallocate_surface_attributes_v 1386 1084 1387 1085 1388 !------------------------------------------------------------------------------! … … 1203 1506 1204 1507 END SUBROUTINE allocate_surface_attributes_v 1508 1205 1509 1206 1510 !------------------------------------------------------------------------------! … … 2175 2479 !> type) onto a surface type, and writes binary data into restart files. 2176 2480 !------------------------------------------------------------------------------! 2177 SUBROUTINE surface_write_restart_data 2481 SUBROUTINE surface_wrd_local 2482 2178 2483 2179 2484 IMPLICIT NONE … … 2637 2942 2638 2943 2639 WRITE ( 14 ) 'ns_h_on_file ' 2640 WRITE ( 14 ) ns_h_on_file 2641 WRITE ( 14 ) 'ns_v_on_file ' 2642 WRITE ( 14 ) ns_v_on_file 2944 CALL wrd_write_string( 'ns_h_on_file' ) 2945 WRITE ( 14 ) ns_h_on_file 2946 2947 CALL wrd_write_string( 'ns_v_on_file' ) 2948 WRITE ( 14 ) ns_v_on_file 2949 2643 2950 ! 2644 2951 !-- Write required restart data. … … 2646 2953 DO l = 0, 2 2647 2954 WRITE( dum, '(I1)') l 2648 2649 WRITE ( 14 ) 'surf_h(' // dum // ')%start_index ' 2650 WRITE ( 14 ) surf_h(l)%start_index 2651 WRITE ( 14 ) 'surf_h(' // dum // ')%end_index ' 2652 WRITE ( 14 ) surf_h(l)%end_index 2955 2956 CALL wrd_write_string( 'surf_h(' // dum // ')%start_index' ) 2957 WRITE ( 14 ) surf_h(l)%start_index 2958 2959 CALL wrd_write_string( 'surf_h(' // dum // ')%end_index' ) 2960 WRITE ( 14 ) surf_h(l)%end_index 2653 2961 2654 2962 IF ( ALLOCATED ( surf_h(l)%us ) ) THEN 2655 WRITE ( 14 ) 'surf_h(' // dum // ')%us '2963 CALL wrd_write_string( 'surf_h(' // dum // ')%us' ) 2656 2964 WRITE ( 14 ) surf_h(l)%us 2657 ENDIF 2965 ENDIF 2966 2658 2967 IF ( ALLOCATED ( surf_h(l)%ts ) ) THEN 2659 WRITE ( 14 ) 'surf_h(' // dum // ')%ts '2968 CALL wrd_write_string( 'surf_h(' // dum // ')%ts' ) 2660 2969 WRITE ( 14 ) surf_h(l)%ts 2661 2970 ENDIF 2971 2662 2972 IF ( ALLOCATED ( surf_h(l)%qs ) ) THEN 2663 WRITE ( 14 ) 'surf_h(' // dum // ')%qs '2973 CALL wrd_write_string( 'surf_h(' // dum // ')%qs' ) 2664 2974 WRITE ( 14 ) surf_h(l)%qs 2665 2975 ENDIF 2976 2666 2977 IF ( ALLOCATED ( surf_h(l)%ss ) ) THEN 2667 WRITE ( 14 ) 'surf_h(' // dum // ')%ss '2978 CALL wrd_write_string( 'surf_h(' // dum // ')%ss' ) 2668 2979 WRITE ( 14 ) surf_h(l)%ss 2669 2980 ENDIF 2981 2670 2982 IF ( ALLOCATED ( surf_h(l)%qcs ) ) THEN 2671 WRITE ( 14 ) 'surf_h(' // dum // ')%qcs '2983 CALL wrd_write_string( 'surf_h(' // dum // ')%qcs' ) 2672 2984 WRITE ( 14 ) surf_h(l)%qcs 2673 2985 ENDIF 2986 2674 2987 IF ( ALLOCATED ( surf_h(l)%ncs ) ) THEN 2675 WRITE ( 14 ) 'surf_h(' // dum // ')%ncs '2988 CALL wrd_write_string( 'surf_h(' // dum // ')%ncs' ) 2676 2989 WRITE ( 14 ) surf_h(l)%ncs 2677 2990 ENDIF 2991 2678 2992 IF ( ALLOCATED ( surf_h(l)%qrs ) ) THEN 2679 WRITE ( 14 ) 'surf_h(' // dum // ')%qrs '2993 CALL wrd_write_string( 'surf_h(' // dum // ')%qrs' ) 2680 2994 WRITE ( 14 ) surf_h(l)%qrs 2681 2995 ENDIF 2996 2682 2997 IF ( ALLOCATED ( surf_h(l)%nrs ) ) THEN 2683 WRITE ( 14 ) 'surf_h(' // dum // ')%nrs '2998 CALL wrd_write_string( 'surf_h(' // dum // ')%nrs' ) 2684 2999 WRITE ( 14 ) surf_h(l)%nrs 2685 3000 ENDIF 3001 2686 3002 IF ( ALLOCATED ( surf_h(l)%ol ) ) THEN 2687 WRITE ( 14 ) 'surf_h(' // dum // ')%ol '3003 CALL wrd_write_string( 'surf_h(' // dum // ')%ol' ) 2688 3004 WRITE ( 14 ) surf_h(l)%ol 2689 ENDIF 3005 ENDIF 3006 2690 3007 IF ( ALLOCATED ( surf_h(l)%rib ) ) THEN 2691 WRITE ( 14 ) 'surf_h(' // dum // ')%rib '3008 CALL wrd_write_string( 'surf_h(' // dum // ')%rib' ) 2692 3009 WRITE ( 14 ) surf_h(l)%rib 2693 ENDIF 3010 ENDIF 3011 2694 3012 IF ( ALLOCATED ( surf_h(l)%pt_surface ) ) THEN 2695 WRITE ( 14 ) 'surf_h(' // dum // ')%pt_surface '3013 CALL wrd_write_string( 'surf_h(' // dum // ')%pt_surface' ) 2696 3014 WRITE ( 14 ) surf_h(l)%pt_surface 2697 ENDIF 3015 ENDIF 3016 2698 3017 IF ( ALLOCATED ( surf_h(l)%usws ) ) THEN 2699 WRITE ( 14 ) 'surf_h(' // dum // ')%usws '3018 CALL wrd_write_string( 'surf_h(' // dum // ')%usws' ) 2700 3019 WRITE ( 14 ) surf_h(l)%usws 2701 3020 ENDIF 3021 2702 3022 IF ( ALLOCATED ( surf_h(l)%vsws ) ) THEN 2703 WRITE ( 14 ) 'surf_h(' // dum // ')%vsws '3023 CALL wrd_write_string( 'surf_h(' // dum // ')%vsws' ) 2704 3024 WRITE ( 14 ) surf_h(l)%vsws 2705 3025 ENDIF 3026 2706 3027 IF ( ALLOCATED ( surf_h(l)%shf ) ) THEN 2707 WRITE ( 14 ) 'surf_h(' // dum // ')%shf '3028 CALL wrd_write_string( 'surf_h(' // dum // ')%shf' ) 2708 3029 WRITE ( 14 ) surf_h(l)%shf 2709 3030 ENDIF 3031 2710 3032 IF ( ALLOCATED ( surf_h(l)%qsws ) ) THEN 2711 WRITE ( 14 ) 'surf_h(' // dum // ')%qsws '3033 CALL wrd_write_string( 'surf_h(' // dum // ')%qsws' ) 2712 3034 WRITE ( 14 ) surf_h(l)%qsws 2713 3035 ENDIF 3036 2714 3037 IF ( ALLOCATED ( surf_h(l)%ssws ) ) THEN 2715 WRITE ( 14 ) 'surf_h(' // dum // ')%ssws '3038 CALL wrd_write_string( 'surf_h(' // dum // ')%ssws' ) 2716 3039 WRITE ( 14 ) surf_h(l)%ssws 2717 3040 ENDIF 3041 2718 3042 IF ( ALLOCATED ( surf_h(l)%css ) ) THEN 2719 WRITE ( 14 ) 'surf_h(' // dum // ')%css '3043 CALL wrd_write_string( 'surf_h(' // dum // ')%css' ) 2720 3044 WRITE ( 14 ) surf_h(l)%css 2721 3045 ENDIF 3046 2722 3047 IF ( ALLOCATED ( surf_h(l)%cssws ) ) THEN 2723 WRITE ( 14 ) 'surf_h(' // dum // ')%cssws '3048 CALL wrd_write_string( 'surf_h(' // dum // ')%cssws' ) 2724 3049 WRITE ( 14 ) surf_h(l)%cssws 2725 3050 ENDIF 3051 2726 3052 IF ( ALLOCATED ( surf_h(l)%qcsws ) ) THEN 2727 WRITE ( 14 ) 'surf_h(' // dum // ')%qcsws '3053 CALL wrd_write_string( 'surf_h(' // dum // ')%qcsws' ) 2728 3054 WRITE ( 14 ) surf_h(l)%qcsws 2729 3055 ENDIF 3056 2730 3057 IF ( ALLOCATED ( surf_h(l)%ncsws ) ) THEN 2731 WRITE ( 14 ) 'surf_h(' // dum // ')%ncsws '3058 CALL wrd_write_string( 'surf_h(' // dum // ')%ncsws' ) 2732 3059 WRITE ( 14 ) surf_h(l)%ncsws 2733 3060 ENDIF 3061 2734 3062 IF ( ALLOCATED ( surf_h(l)%qrsws ) ) THEN 2735 WRITE ( 14 ) 'surf_h(' // dum // ')%qrsws '3063 CALL wrd_write_string( 'surf_h(' // dum // ')%qrsws' ) 2736 3064 WRITE ( 14 ) surf_h(l)%qrsws 2737 3065 ENDIF 3066 2738 3067 IF ( ALLOCATED ( surf_h(l)%nrsws ) ) THEN 2739 WRITE ( 14 ) 'surf_h(' // dum // ')%nrsws '3068 CALL wrd_write_string( 'surf_h(' // dum // ')%nrsws' ) 2740 3069 WRITE ( 14 ) surf_h(l)%nrsws 2741 3070 ENDIF 3071 2742 3072 IF ( ALLOCATED ( surf_h(l)%sasws ) ) THEN 2743 WRITE ( 14 ) 'surf_h(' // dum // ')%sasws '3073 CALL wrd_write_string( 'surf_h(' // dum // ')%sasws' ) 2744 3074 WRITE ( 14 ) surf_h(l)%sasws 2745 ENDIF 3075 ENDIF 3076 2746 3077 ENDDO 2747 3078 ! … … 2750 3081 WRITE( dum, '(I1)') l 2751 3082 2752 WRITE ( 14 ) 'surf_v(' // dum // ')%start_index ' 2753 WRITE ( 14 ) surf_v(l)%start_index 2754 WRITE ( 14 ) 'surf_v(' // dum // ')%end_index ' 3083 CALL wrd_write_string( 'surf_v(' // dum // ')%start_index' ) 3084 WRITE ( 14 ) surf_v(l)%start_index 3085 3086 CALL wrd_write_string( 'surf_v(' // dum // ')%end_index' ) 2755 3087 WRITE ( 14 ) surf_v(l)%end_index 2756 3088 2757 3089 IF ( ALLOCATED ( surf_v(l)%us ) ) THEN 2758 WRITE ( 14 ) 'surf_v(' // dum // ')%us '3090 CALL wrd_write_string( 'surf_v(' // dum // ')%us' ) 2759 3091 WRITE ( 14 ) surf_v(l)%us 2760 ENDIF 3092 ENDIF 3093 2761 3094 IF ( ALLOCATED ( surf_v(l)%ts ) ) THEN 2762 WRITE ( 14 ) 'surf_v(' // dum // ')%ts '3095 CALL wrd_write_string( 'surf_v(' // dum // ')%ts' ) 2763 3096 WRITE ( 14 ) surf_v(l)%ts 2764 3097 ENDIF 3098 2765 3099 IF ( ALLOCATED ( surf_v(l)%qs ) ) THEN 2766 WRITE ( 14 ) 'surf_v(' // dum // ')%qs '3100 CALL wrd_write_string( 'surf_v(' // dum // ')%qs' ) 2767 3101 WRITE ( 14 ) surf_v(l)%qs 2768 ENDIF 3102 ENDIF 3103 2769 3104 IF ( ALLOCATED ( surf_v(l)%ss ) ) THEN 2770 WRITE ( 14 ) 'surf_v(' // dum // ')%ss '3105 CALL wrd_write_string( 'surf_v(' // dum // ')%ss' ) 2771 3106 WRITE ( 14 ) surf_v(l)%ss 2772 ENDIF 3107 ENDIF 3108 2773 3109 IF ( ALLOCATED ( surf_v(l)%qcs ) ) THEN 2774 WRITE ( 14 ) 'surf_v(' // dum // ')%qcs '3110 CALL wrd_write_string( 'surf_v(' // dum // ')%qcs' ) 2775 3111 WRITE ( 14 ) surf_v(l)%qcs 2776 3112 ENDIF 3113 2777 3114 IF ( ALLOCATED ( surf_v(l)%ncs ) ) THEN 2778 WRITE ( 14 ) 'surf_v(' // dum // ')%ncs '3115 CALL wrd_write_string( 'surf_v(' // dum // ')%ncs' ) 2779 3116 WRITE ( 14 ) surf_v(l)%ncs 2780 3117 ENDIF 3118 2781 3119 IF ( ALLOCATED ( surf_v(l)%qrs ) ) THEN 2782 WRITE ( 14 ) 'surf_v(' // dum // ')%qrs '3120 CALL wrd_write_string( 'surf_v(' // dum // ')%qrs' ) 2783 3121 WRITE ( 14 ) surf_v(l)%qrs 2784 3122 ENDIF 3123 2785 3124 IF ( ALLOCATED ( surf_v(l)%nrs ) ) THEN 2786 WRITE ( 14 ) 'surf_v(' // dum // ')%nrs '3125 CALL wrd_write_string( 'surf_v(' // dum // ')%nrs' ) 2787 3126 WRITE ( 14 ) surf_v(l)%nrs 2788 ENDIF 3127 ENDIF 3128 2789 3129 IF ( ALLOCATED ( surf_v(l)%ol ) ) THEN 2790 WRITE ( 14 ) 'surf_v(' // dum // ')%ol '3130 CALL wrd_write_string( 'surf_v(' // dum // ')%ol' ) 2791 3131 WRITE ( 14 ) surf_v(l)%ol 2792 3132 ENDIF 3133 2793 3134 IF ( ALLOCATED ( surf_v(l)%rib ) ) THEN 2794 WRITE ( 14 ) 'surf_v(' // dum // ')%rib '3135 CALL wrd_write_string( 'surf_v(' // dum // ')%rib' ) 2795 3136 WRITE ( 14 ) surf_v(l)%rib 2796 3137 ENDIF 3138 2797 3139 IF ( ALLOCATED ( surf_v(l)%pt_surface ) ) THEN 2798 WRITE ( 14 ) 'surf_v(' // dum // ')%pt_surface '3140 CALL wrd_write_string( 'surf_v(' // dum // ')%pt_surface' ) 2799 3141 WRITE ( 14 ) surf_v(l)%pt_surface 2800 ENDIF 3142 ENDIF 3143 2801 3144 IF ( ALLOCATED ( surf_v(l)%shf ) ) THEN 2802 WRITE ( 14 ) 'surf_v(' // dum // ')%shf '3145 CALL wrd_write_string( 'surf_v(' // dum // ')%shf' ) 2803 3146 WRITE ( 14 ) surf_v(l)%shf 2804 3147 ENDIF 3148 2805 3149 IF ( ALLOCATED ( surf_v(l)%qsws ) ) THEN 2806 WRITE ( 14 ) 'surf_v(' // dum // ')%qsws '3150 CALL wrd_write_string( 'surf_v(' // dum // ')%qsws' ) 2807 3151 WRITE ( 14 ) surf_v(l)%qsws 2808 3152 ENDIF 3153 2809 3154 IF ( ALLOCATED ( surf_v(l)%ssws ) ) THEN 2810 WRITE ( 14 ) 'surf_v(' // dum // ')%ssws '3155 CALL wrd_write_string( 'surf_v(' // dum // ')%ssws' ) 2811 3156 WRITE ( 14 ) surf_v(l)%ssws 2812 3157 ENDIF 3158 2813 3159 IF ( ALLOCATED ( surf_v(l)%css ) ) THEN 2814 WRITE ( 14 ) 'surf_v(' // dum // ')%css '3160 CALL wrd_write_string( 'surf_v(' // dum // ')%css' ) 2815 3161 WRITE ( 14 ) surf_v(l)%css 2816 ENDIF 3162 ENDIF 3163 2817 3164 IF ( ALLOCATED ( surf_v(l)%cssws ) ) THEN 2818 WRITE ( 14 ) 'surf_v(' // dum // ')%cssws '3165 CALL wrd_write_string( 'surf_v(' // dum // ')%cssws' ) 2819 3166 WRITE ( 14 ) surf_v(l)%cssws 2820 ENDIF 3167 ENDIF 3168 2821 3169 IF ( ALLOCATED ( surf_v(l)%qcsws ) ) THEN 2822 WRITE ( 14 ) 'surf_v(' // dum // ')%qcsws '3170 CALL wrd_write_string( 'surf_v(' // dum // ')%qcsws' ) 2823 3171 WRITE ( 14 ) surf_v(l)%qcsws 2824 ENDIF 3172 ENDIF 3173 2825 3174 IF ( ALLOCATED ( surf_v(l)%ncsws ) ) THEN 2826 WRITE ( 14 ) 'surf_v(' // dum // ')%ncsws '3175 CALL wrd_write_string( 'surf_v(' // dum // ')%ncsws' ) 2827 3176 WRITE ( 14 ) surf_v(l)%ncsws 2828 3177 ENDIF 3178 2829 3179 IF ( ALLOCATED ( surf_v(l)%qrsws ) ) THEN 2830 WRITE ( 14 ) 'surf_v(' // dum // ')%qrsws '3180 CALL wrd_write_string( 'surf_v(' // dum // ')%qrsws' ) 2831 3181 WRITE ( 14 ) surf_v(l)%qrsws 2832 ENDIF 3182 ENDIF 3183 2833 3184 IF ( ALLOCATED ( surf_v(l)%nrsws ) ) THEN 2834 WRITE ( 14 ) 'surf_v(' // dum // ')%nrsws '3185 CALL wrd_write_string( 'surf_v(' // dum // ')%nrsws' ) 2835 3186 WRITE ( 14 ) surf_v(l)%nrsws 2836 3187 ENDIF 3188 2837 3189 IF ( ALLOCATED ( surf_v(l)%sasws ) ) THEN 2838 WRITE ( 14 ) 'surf_v(' // dum // ')%sasws '3190 CALL wrd_write_string( 'surf_v(' // dum // ')%sasws' ) 2839 3191 WRITE ( 14 ) surf_v(l)%sasws 2840 3192 ENDIF 3193 2841 3194 IF ( ALLOCATED ( surf_v(l)%mom_flux_uv ) ) THEN 2842 WRITE ( 14 ) 'surf_v(' // dum // ')%mom_uv '3195 CALL wrd_write_string( 'surf_v(' // dum // ')%mom_uv' ) 2843 3196 WRITE ( 14 ) surf_v(l)%mom_flux_uv 2844 3197 ENDIF 3198 2845 3199 IF ( ALLOCATED ( surf_v(l)%mom_flux_w ) ) THEN 2846 WRITE ( 14 ) 'surf_v(' // dum // ')%mom_w '3200 CALL wrd_write_string( 'surf_v(' // dum // ')%mom_w' ) 2847 3201 WRITE ( 14 ) surf_v(l)%mom_flux_w 2848 3202 ENDIF 3203 2849 3204 IF ( ALLOCATED ( surf_v(l)%mom_flux_tke ) ) THEN 2850 WRITE ( 14 ) 'surf_v(' // dum // ')%mom_tke '3205 CALL wrd_write_string( 'surf_v(' // dum // ')%mom_tke' ) 2851 3206 WRITE ( 14 ) surf_v(l)%mom_flux_tke 2852 ENDIF 3207 ENDIF 2853 3208 2854 3209 ENDDO 2855 3210 2856 WRITE ( 14 ) '*** end surf *** ' 2857 2858 END SUBROUTINE surface_write_restart_data 3211 3212 END SUBROUTINE surface_wrd_local 2859 3213 2860 3214 … … 2870 3224 !> of cyclic_fill mode. 2871 3225 !------------------------------------------------------------------------------! 2872 SUBROUTINE surface_read_restart_data( ii, & 2873 nxlfa, nxl_on_file, nxrfa, nxr_on_file, & 2874 nynfa, nyn_on_file, nysfa, nys_on_file, & 2875 offset_xa, offset_ya, overlap_count ) 3226 SUBROUTINE surface_rrd_local( ii, kk, nxlf, nxlc, nxl_on_file, nxrf, nxrc, & 3227 nxr_on_file, nynf, nync, nyn_on_file, nysf, & 3228 nysc, nys_on_file, found ) 2876 3229 2877 3230 USE pegrid, & 2878 ONLY: numprocs_previous_run 3231 ONLY: myid, numprocs_previous_run 3232 3233 IMPLICIT NONE 2879 3234 2880 3235 CHARACTER (LEN=1) :: dum !< dummy to create correct string for reading input variable 2881 CHARACTER (LEN=30) :: field_chr !< input variable2882 3236 2883 3237 INTEGER(iwp) :: i !< running index along x-direction, refers to former domain size … … 2886 3240 INTEGER(iwp) :: jc !< running index along y-direction, refers to former domain size 2887 3241 INTEGER(iwp) :: k !< running index along z-direction 2888 INTEGER(iwp) :: l !< index variable for surface type2889 3242 INTEGER(iwp) :: m !< running index for surface elements, refers to gathered array encompassing all surface types 2890 3243 INTEGER(iwp) :: mm !< running index for surface elements, refers to individual surface types 2891 2892 3244 INTEGER(iwp) :: ii !< running index over input files 2893 3245 INTEGER(iwp) :: kk !< running index over previous input files covering current local domain … … 2904 3256 INTEGER(iwp) :: nysf !< index of south boundary on former subdomain 2905 3257 INTEGER(iwp) :: nys_on_file !< index of south boundary on former local domain 2906 INTEGER(iwp) :: overlap_count !< number of overlaps 2907 2908 INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nxlfa !< 2909 INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nxrfa !< 2910 INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nynfa !< 2911 INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nysfa !< 2912 INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: offset_xa !< 2913 INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: offset_ya !< 2914 2915 2916 LOGICAL :: horizontal_surface !< flag indicating horizontal surfaces 3258 3259 INTEGER(iwp), SAVE :: l !< index variable for surface type 3260 2917 3261 LOGICAL :: surf_match_def !< flag indicating that surface element is of default type 2918 3262 LOGICAL :: surf_match_lsm !< flag indicating that surface element is of natural type 2919 3263 LOGICAL :: surf_match_usm !< flag indicating that surface element is of urban type 2920 LOGICAL :: vertical_surface !< flag indicating vertical surfaces 2921 2922 TYPE(surf_type), DIMENSION(0:2) :: surf_h !< horizontal surface type on file 2923 TYPE(surf_type), DIMENSION(0:3) :: surf_v !< vertical surface type on file 2924 2925 ! 2926 !-- Read number of respective surface elements on file 2927 READ ( 13 ) field_chr 2928 IF ( TRIM( field_chr ) /= 'ns_h_on_file' ) THEN 2929 ! 2930 !-- Add a proper error message 2931 ENDIF 2932 READ ( 13 ) ns_h_on_file 2933 2934 READ ( 13 ) field_chr 2935 IF ( TRIM( field_chr ) /= 'ns_v_on_file' ) THEN 2936 ! 2937 !-- Add a proper error message 2938 ENDIF 2939 READ ( 13 ) ns_v_on_file 2940 ! 2941 !-- Allocate memory for number of surface elements on file. Please note, 2942 !-- these number is not necessarily the same as the final number of surface 2943 !-- elements on local domain, which is the case if processor topology changes 2944 !-- during restart runs. 2945 !-- Horizontal upward facing 2946 surf_h(0)%ns = ns_h_on_file(0) 2947 CALL allocate_surface_attributes_h( surf_h(0), & 3264 3265 LOGICAL, INTENT(OUT) :: found 3266 3267 LOGICAL, SAVE :: horizontal_surface !< flag indicating horizontal surfaces 3268 LOGICAL, SAVE :: vertical_surface !< flag indicating vertical surfaces 3269 3270 TYPE(surf_type), DIMENSION(0:2), SAVE :: surf_h !< horizontal surface type on file 3271 TYPE(surf_type), DIMENSION(0:3), SAVE :: surf_v !< vertical surface type on file 3272 3273 3274 found = .TRUE. 3275 3276 3277 SELECT CASE ( restart_string(1:length) ) 3278 3279 CASE ( 'ns_h_on_file' ) 3280 IF ( kk == 1 ) THEN 3281 READ ( 13 ) ns_h_on_file 3282 3283 IF ( ALLOCATED( surf_h(0)%start_index ) ) & 3284 CALL deallocate_surface_attributes_h( surf_h(0) ) 3285 IF ( ALLOCATED( surf_h(1)%start_index ) ) & 3286 CALL deallocate_surface_attributes_h( surf_h(1) ) 3287 IF ( ALLOCATED( surf_h(2)%start_index ) ) & 3288 CALL deallocate_surface_attributes_h_top( surf_h(2) ) 3289 3290 !-- Allocate memory for number of surface elements on file. 3291 !-- Please note, these number is not necessarily the same as 3292 !-- the final number of surface elements on local domain, 3293 !-- which is the case if processor topology changes during 3294 !-- restart runs. 3295 !-- Horizontal upward facing 3296 surf_h(0)%ns = ns_h_on_file(0) 3297 CALL allocate_surface_attributes_h( surf_h(0), & 3298 nys_on_file, nyn_on_file, & 3299 nxl_on_file, nxr_on_file ) 3300 3301 !-- Horizontal downward facing 3302 surf_h(1)%ns = ns_h_on_file(1) 3303 CALL allocate_surface_attributes_h( surf_h(1), & 3304 nys_on_file, nyn_on_file, & 3305 nxl_on_file, nxr_on_file ) 3306 3307 !-- Model top 3308 surf_h(2)%ns = ns_h_on_file(2) 3309 CALL allocate_surface_attributes_h_top( surf_h(2), & 3310 nys_on_file, nyn_on_file, & 3311 nxl_on_file, nxr_on_file ) 3312 3313 ! 3314 !-- Initial setting of flags for horizontal and vertical surfaces, 3315 !-- will be set after start- and end-indices are read. 3316 horizontal_surface = .FALSE. 3317 vertical_surface = .FALSE. 3318 3319 ENDIF 3320 3321 CASE ( 'ns_v_on_file' ) 3322 IF ( kk == 1 ) THEN 3323 READ ( 13 ) ns_v_on_file 3324 3325 DO l = 0, 3 3326 IF ( ALLOCATED( surf_v(l)%start_index ) ) & 3327 CALL deallocate_surface_attributes_v( surf_v(l) ) 3328 ENDDO 3329 3330 !-- Vertical surfaces 3331 DO l = 0, 3 3332 surf_v(l)%ns = ns_v_on_file(l) 3333 CALL allocate_surface_attributes_v( surf_v(l), & 2948 3334 nys_on_file, nyn_on_file, & 2949 3335 nxl_on_file, nxr_on_file ) 2950 ! 2951 !-- Horizontal downward facing 2952 surf_h(1)%ns = ns_h_on_file(1) 2953 CALL allocate_surface_attributes_h( surf_h(1), & 2954 nys_on_file, nyn_on_file, & 2955 nxl_on_file, nxr_on_file ) 2956 ! 2957 !-- Model top 2958 surf_h(2)%ns = ns_h_on_file(2) 2959 CALL allocate_surface_attributes_h_top( surf_h(2), & 2960 nys_on_file, nyn_on_file, & 2961 nxl_on_file, nxr_on_file ) 2962 ! 2963 !-- Vertical surfaces 2964 DO l = 0, 3 2965 surf_v(l)%ns = ns_v_on_file(l) 2966 CALL allocate_surface_attributes_v( surf_v(l), & 2967 nys_on_file, nyn_on_file, & 2968 nxl_on_file, nxr_on_file ) 2969 ENDDO 2970 2971 IF ( initializing_actions == 'read_restart_data' .OR. & 2972 initializing_actions == 'cyclic_fill' ) THEN 2973 ! 2974 !-- Initial setting of flags for horizontal and vertical surfaces, will 2975 !-- be set after start- and end-indices are read. 2976 horizontal_surface = .FALSE. 2977 vertical_surface = .FALSE. 2978 2979 READ ( 13 ) field_chr 2980 2981 DO WHILE ( TRIM( field_chr ) /= '*** end surf ***' ) 2982 ! 2983 !-- Map data on file as often as needed (data are read only for k=1) 2984 DO kk = 1, overlap_count 2985 ! 2986 !-- Get the index range of the subdomain on file which overlap with the 2987 !-- current subdomain 2988 nxlf = nxlfa(ii,kk) 2989 nxlc = nxlfa(ii,kk) + offset_xa(ii,kk) 2990 nxrf = nxrfa(ii,kk) 2991 nxrc = nxrfa(ii,kk) + offset_xa(ii,kk) 2992 nysf = nysfa(ii,kk) 2993 nysc = nysfa(ii,kk) + offset_ya(ii,kk) 2994 nynf = nynfa(ii,kk) 2995 nync = nynfa(ii,kk) + offset_ya(ii,kk) 2996 2997 SELECT CASE ( TRIM( field_chr ) ) 2998 2999 CASE ( 'surf_h(0)%start_index' ) 3000 IF ( kk == 1 ) & 3001 READ ( 13 ) surf_h(0)%start_index 3002 l = 0 3003 CASE ( 'surf_h(0)%end_index' ) 3004 IF ( kk == 1 ) & 3005 READ ( 13 ) surf_h(0)%end_index 3006 horizontal_surface = .TRUE. 3007 vertical_surface = .FALSE. 3008 CASE ( 'surf_h(0)%us' ) 3009 IF ( ALLOCATED( surf_h(0)%us ) .AND. kk == 1 ) & 3010 READ ( 13 ) surf_h(0)%us 3011 CASE ( 'surf_h(0)%ts' ) 3012 IF ( ALLOCATED( surf_h(0)%ts ) .AND. kk == 1 ) & 3013 READ ( 13 ) surf_h(0)%ts 3014 CASE ( 'surf_h(0)%qs' ) 3015 IF ( ALLOCATED( surf_h(0)%qs ) .AND. kk == 1 ) & 3016 READ ( 13 ) surf_h(0)%qs 3017 CASE ( 'surf_h(0)%ss' ) 3018 IF ( ALLOCATED( surf_h(0)%ss ) .AND. kk == 1 ) & 3019 READ ( 13 ) surf_h(0)%ss 3020 CASE ( 'surf_h(0)%qcs' ) 3021 IF ( ALLOCATED( surf_h(0)%qcs ) .AND. kk == 1 ) & 3022 READ ( 13 ) surf_h(0)%qcs 3023 CASE ( 'surf_h(0)%ncs' ) 3024 IF ( ALLOCATED( surf_h(0)%ncs ) .AND. kk == 1 ) & 3025 READ ( 13 ) surf_h(0)%ncs 3026 CASE ( 'surf_h(0)%qrs' ) 3027 IF ( ALLOCATED( surf_h(0)%qrs ) .AND. kk == 1 ) & 3028 READ ( 13 ) surf_h(0)%qrs 3029 CASE ( 'surf_h(0)%nrs' ) 3030 IF ( ALLOCATED( surf_h(0)%nrs ) .AND. kk == 1 ) & 3031 READ ( 13 ) surf_h(0)%nrs 3032 CASE ( 'surf_h(0)%ol' ) 3033 IF ( ALLOCATED( surf_h(0)%ol ) .AND. kk == 1 ) & 3034 READ ( 13 ) surf_h(0)%ol 3035 CASE ( 'surf_h(0)%rib' ) 3036 IF ( ALLOCATED( surf_h(0)%rib ) .AND. kk == 1 ) & 3037 READ ( 13 ) surf_h(0)%rib 3038 CASE ( 'surf_h(0)%pt_surface' ) 3039 IF ( ALLOCATED( surf_h(0)%pt_surface ) .AND. kk == 1 ) & 3040 READ ( 13 ) surf_h(0)%pt_surface 3041 CASE ( 'surf_h(0)%usws' ) 3042 IF ( ALLOCATED( surf_h(0)%usws ) .AND. kk == 1 ) & 3043 READ ( 13 ) surf_h(0)%usws 3044 CASE ( 'surf_h(0)%vsws' ) 3045 IF ( ALLOCATED( surf_h(0)%vsws ) .AND. kk == 1 ) & 3046 READ ( 13 ) surf_h(0)%vsws 3047 CASE ( 'surf_h(0)%shf' ) 3048 IF ( ALLOCATED( surf_h(0)%shf ) .AND. kk == 1 ) & 3049 READ ( 13 ) surf_h(0)%shf 3050 CASE ( 'surf_h(0)%qsws' ) 3051 IF ( ALLOCATED( surf_h(0)%qsws ) .AND. kk == 1 ) & 3052 READ ( 13 ) surf_h(0)%qsws 3053 CASE ( 'surf_h(0)%ssws' ) 3054 IF ( ALLOCATED( surf_h(0)%ssws ) .AND. kk == 1 ) & 3055 READ ( 13 ) surf_h(0)%ssws 3056 CASE ( 'surf_h(0)%css' ) 3057 IF ( ALLOCATED( surf_h(0)%css ) .AND. kk == 1 ) & 3058 READ ( 13 ) surf_h(0)%css 3059 CASE ( 'surf_h(0)%cssws' ) 3060 IF ( ALLOCATED( surf_h(0)%cssws ) .AND. kk == 1 ) & 3061 READ ( 13 ) surf_h(0)%cssws 3062 CASE ( 'surf_h(0)%qcsws' ) 3063 IF ( ALLOCATED( surf_h(0)%qcsws ) .AND. kk == 1 ) & 3064 READ ( 13 ) surf_h(0)%qcsws 3065 CASE ( 'surf_h(0)%ncsws' ) 3066 IF ( ALLOCATED( surf_h(0)%ncsws ) .AND. kk == 1 ) & 3067 READ ( 13 ) surf_h(0)%ncsws 3068 CASE ( 'surf_h(0)%qrsws' ) 3069 IF ( ALLOCATED( surf_h(0)%qrsws ) .AND. kk == 1 ) & 3070 READ ( 13 ) surf_h(0)%qrsws 3071 CASE ( 'surf_h(0)%nrsws' ) 3072 IF ( ALLOCATED( surf_h(0)%nrsws ) .AND. kk == 1 ) & 3073 READ ( 13 ) surf_h(0)%nrsws 3074 CASE ( 'surf_h(0)%sasws' ) 3075 IF ( ALLOCATED( surf_h(0)%sasws ) .AND. kk == 1 ) & 3076 READ ( 13 ) surf_h(0)%sasws 3077 3078 CASE ( 'surf_h(1)%start_index' ) 3079 IF ( kk == 1 ) & 3080 READ ( 13 ) surf_h(1)%start_index 3081 l = 1 3082 CASE ( 'surf_h(1)%end_index' ) 3083 IF ( kk == 1 ) & 3084 READ ( 13 ) surf_h(1)%end_index 3085 CASE ( 'surf_h(1)%us' ) 3086 IF ( ALLOCATED( surf_h(1)%us ) .AND. kk == 1 ) & 3087 READ ( 13 ) surf_h(1)%us 3088 CASE ( 'surf_h(1)%ts' ) 3089 IF ( ALLOCATED( surf_h(1)%ts ) .AND. kk == 1 ) & 3090 READ ( 13 ) surf_h(1)%ts 3091 CASE ( 'surf_h(1)%qs' ) 3092 IF ( ALLOCATED( surf_h(1)%qs ) .AND. kk == 1 ) & 3093 READ ( 13 ) surf_h(1)%qs 3094 CASE ( 'surf_h(1)%ss' ) 3095 IF ( ALLOCATED( surf_h(1)%ss ) .AND. kk == 1 ) & 3096 READ ( 13 ) surf_h(1)%ss 3097 CASE ( 'surf_h(1)%qcs' ) 3098 IF ( ALLOCATED( surf_h(1)%qcs ) .AND. kk == 1 ) & 3099 READ ( 13 ) surf_h(1)%qcs 3100 CASE ( 'surf_h(1)%ncs' ) 3101 IF ( ALLOCATED( surf_h(1)%ncs ) .AND. kk == 1 ) & 3102 READ ( 13 ) surf_h(1)%ncs 3103 CASE ( 'surf_h(1)%qrs' ) 3104 IF ( ALLOCATED( surf_h(1)%qrs ) .AND. kk == 1 ) & 3105 READ ( 13 ) surf_h(1)%qrs 3106 CASE ( 'surf_h(1)%nrs' ) 3107 IF ( ALLOCATED( surf_h(1)%nrs ) .AND. kk == 1 ) & 3108 READ ( 13 ) surf_h(1)%nrs 3109 CASE ( 'surf_h(1)%ol' ) 3110 IF ( ALLOCATED( surf_h(1)%ol ) .AND. kk == 1 ) & 3111 READ ( 13 ) surf_h(1)%ol 3112 CASE ( 'surf_h(1)%rib' ) 3113 IF ( ALLOCATED( surf_h(1)%rib ) .AND. kk == 1 ) & 3114 READ ( 13 ) surf_h(1)%rib 3115 CASE ( 'surf_h(1)%pt_surface' ) 3116 IF ( ALLOCATED( surf_h(1)%pt_surface ) .AND. kk == 1 ) & 3117 READ ( 13 ) surf_h(1)%pt_surface 3118 CASE ( 'surf_h(1)%usws' ) 3119 IF ( ALLOCATED( surf_h(1)%usws ) .AND. kk == 1 ) & 3120 READ ( 13 ) surf_h(1)%usws 3121 CASE ( 'surf_h(1)%vsws' ) 3122 IF ( ALLOCATED( surf_h(1)%vsws ) .AND. kk == 1 ) & 3123 READ ( 13 ) surf_h(1)%vsws 3124 CASE ( 'surf_h(1)%shf' ) 3125 IF ( ALLOCATED( surf_h(1)%shf ) .AND. kk == 1 ) & 3126 READ ( 13 ) surf_h(1)%shf 3127 CASE ( 'surf_h(1)%qsws' ) 3128 IF ( ALLOCATED( surf_h(1)%qsws ) .AND. kk == 1 ) & 3129 READ ( 13 ) surf_h(1)%qsws 3130 CASE ( 'surf_h(1)%ssws' ) 3131 IF ( ALLOCATED( surf_h(1)%ssws ) .AND. kk == 1 ) & 3132 READ ( 13 ) surf_h(1)%ssws 3133 CASE ( 'surf_h(1)%css' ) 3134 IF ( ALLOCATED( surf_h(1)%css ) .AND. kk == 1 ) & 3135 READ ( 13 ) surf_h(1)%css 3136 CASE ( 'surf_h(1)%cssws' ) 3137 IF ( ALLOCATED( surf_h(1)%cssws ) .AND. kk == 1 ) & 3138 READ ( 13 ) surf_h(1)%cssws 3139 CASE ( 'surf_h(1)%qcsws' ) 3140 IF ( ALLOCATED( surf_h(1)%qcsws ) .AND. kk == 1 ) & 3141 READ ( 13 ) surf_h(1)%qcsws 3142 CASE ( 'surf_h(1)%ncsws' ) 3143 IF ( ALLOCATED( surf_h(1)%ncsws ) .AND. kk == 1 ) & 3144 READ ( 13 ) surf_h(1)%ncsws 3145 CASE ( 'surf_h(1)%qrsws' ) 3146 IF ( ALLOCATED( surf_h(1)%qrsws ) .AND. kk == 1 ) & 3147 READ ( 13 ) surf_h(1)%qrsws 3148 CASE ( 'surf_h(1)%nrsws' ) 3149 IF ( ALLOCATED( surf_h(1)%nrsws ) .AND. kk == 1 ) & 3150 READ ( 13 ) surf_h(1)%nrsws 3151 CASE ( 'surf_h(1)%sasws' ) 3152 IF ( ALLOCATED( surf_h(1)%sasws ) .AND. kk == 1 ) & 3153 READ ( 13 ) surf_h(1)%sasws 3154 3155 CASE ( 'surf_h(2)%start_index' ) 3156 IF ( kk == 1 ) & 3157 READ ( 13 ) surf_h(2)%start_index 3158 l = 2 3159 CASE ( 'surf_h(2)%end_index' ) 3160 IF ( kk == 1 ) & 3161 READ ( 13 ) surf_h(2)%end_index 3162 CASE ( 'surf_h(2)%us' ) 3163 IF ( ALLOCATED( surf_h(2)%us ) .AND. kk == 1 ) & 3164 READ ( 13 ) surf_h(2)%us 3165 CASE ( 'surf_h(2)%ts' ) 3166 IF ( ALLOCATED( surf_h(2)%ts ) .AND. kk == 1 ) & 3167 READ ( 13 ) surf_h(2)%ts 3168 CASE ( 'surf_h(2)%qs' ) 3169 IF ( ALLOCATED( surf_h(2)%qs ) .AND. kk == 1 ) & 3170 READ ( 13 ) surf_h(2)%qs 3171 CASE ( 'surf_h(2)%ss' ) 3172 IF ( ALLOCATED( surf_h(2)%ss ) .AND. kk == 1 ) & 3173 READ ( 13 ) surf_h(2)%ss 3174 CASE ( 'surf_h(2)%qcs' ) 3175 IF ( ALLOCATED( surf_h(2)%qcs ) .AND. kk == 1 ) & 3176 READ ( 13 ) surf_h(2)%qcs 3177 CASE ( 'surf_h(2)%ncs' ) 3178 IF ( ALLOCATED( surf_h(2)%ncs ) .AND. kk == 1 ) & 3179 READ ( 13 ) surf_h(2)%ncs 3180 CASE ( 'surf_h(2)%qrs' ) 3181 IF ( ALLOCATED( surf_h(2)%qrs ) .AND. kk == 1 ) & 3182 READ ( 13 ) surf_h(2)%qrs 3183 CASE ( 'surf_h(2)%nrs' ) 3184 IF ( ALLOCATED( surf_h(2)%nrs ) .AND. kk == 1 ) & 3185 READ ( 13 ) surf_h(2)%nrs 3186 CASE ( 'surf_h(2)%ol' ) 3187 IF ( ALLOCATED( surf_h(2)%ol ) .AND. kk == 1 ) & 3188 READ ( 13 ) surf_h(2)%ol 3189 CASE ( 'surf_h(2)%rib' ) 3190 IF ( ALLOCATED( surf_h(2)%rib ) .AND. kk == 1 ) & 3191 READ ( 13 ) surf_h(2)%rib 3192 CASE ( 'surf_h(2)%usws' ) 3193 IF ( ALLOCATED( surf_h(2)%usws ) .AND. kk == 1 ) & 3194 READ ( 13 ) surf_h(2)%usws 3195 CASE ( 'surf_h(2)%vsws' ) 3196 IF ( ALLOCATED( surf_h(2)%vsws ) .AND. kk == 1 ) & 3197 READ ( 13 ) surf_h(2)%vsws 3198 CASE ( 'surf_h(2)%shf' ) 3199 IF ( ALLOCATED( surf_h(2)%shf ) .AND. kk == 1 ) & 3200 READ ( 13 ) surf_h(2)%shf 3201 CASE ( 'surf_h(2)%qsws' ) 3202 IF ( ALLOCATED( surf_h(2)%qsws ) .AND. kk == 1 ) & 3203 READ ( 13 ) surf_h(2)%qsws 3204 CASE ( 'surf_h(2)%ssws' ) 3205 IF ( ALLOCATED( surf_h(2)%ssws ) .AND. kk == 1 ) & 3206 READ ( 13 ) surf_h(2)%ssws 3207 CASE ( 'surf_h(2)%css' ) 3208 IF ( ALLOCATED( surf_h(2)%css ) .AND. kk == 1 ) & 3209 READ ( 13 ) surf_h(2)%css 3210 CASE ( 'surf_h(2)%cssws' ) 3211 IF ( ALLOCATED( surf_h(2)%cssws ) .AND. kk == 1 ) & 3212 READ ( 13 ) surf_h(2)%cssws 3213 CASE ( 'surf_h(2)%qcsws' ) 3214 IF ( ALLOCATED( surf_h(2)%qcsws ) .AND. kk == 1 ) & 3215 READ ( 13 ) surf_h(2)%qcsws 3216 CASE ( 'surf_h(2)%ncsws' ) 3217 IF ( ALLOCATED( surf_h(2)%ncsws ) .AND. kk == 1 ) & 3218 READ ( 13 ) surf_h(2)%ncsws 3219 CASE ( 'surf_h(2)%qrsws' ) 3220 IF ( ALLOCATED( surf_h(2)%qrsws ) .AND. kk == 1 ) & 3221 READ ( 13 ) surf_h(2)%qrsws 3222 CASE ( 'surf_h(2)%nrsws' ) 3223 IF ( ALLOCATED( surf_h(2)%nrsws ) .AND. kk == 1 ) & 3224 READ ( 13 ) surf_h(2)%nrsws 3225 CASE ( 'surf_h(2)%sasws' ) 3226 IF ( ALLOCATED( surf_h(2)%sasws ) .AND. kk == 1 ) & 3227 READ ( 13 ) surf_h(2)%sasws 3228 3229 CASE ( 'surf_v(0)%start_index' ) 3230 IF ( kk == 1 ) & 3231 READ ( 13 ) surf_v(0)%start_index 3232 l = 0 3233 horizontal_surface = .FALSE. 3234 vertical_surface = .TRUE. 3235 CASE ( 'surf_v(0)%end_index' ) 3236 IF ( kk == 1 ) & 3237 READ ( 13 ) surf_v(0)%end_index 3238 CASE ( 'surf_v(0)%us' ) 3239 IF ( ALLOCATED( surf_v(0)%us ) .AND. kk == 1 ) & 3240 READ ( 13 ) surf_v(0)%us 3241 CASE ( 'surf_v(0)%ts' ) 3242 IF ( ALLOCATED( surf_v(0)%ts ) .AND. kk == 1 ) & 3243 READ ( 13 ) surf_v(0)%ts 3244 CASE ( 'surf_v(0)%qs' ) 3245 IF ( ALLOCATED( surf_v(0)%qs ) .AND. kk == 1 ) & 3246 READ ( 13 ) surf_v(0)%qs 3247 CASE ( 'surf_v(0)%ss' ) 3248 IF ( ALLOCATED( surf_v(0)%ss ) .AND. kk == 1 ) & 3249 READ ( 13 ) surf_v(0)%ss 3250 CASE ( 'surf_v(0)%qcs' ) 3251 IF ( ALLOCATED( surf_v(0)%qcs ) .AND. kk == 1 ) & 3252 READ ( 13 ) surf_v(0)%qcs 3253 CASE ( 'surf_v(0)%ncs' ) 3254 IF ( ALLOCATED( surf_v(0)%ncs ) .AND. kk == 1 ) & 3255 READ ( 13 ) surf_v(0)%ncs 3256 CASE ( 'surf_v(0)%qrs' ) 3257 IF ( ALLOCATED( surf_v(0)%qrs ) .AND. kk == 1 ) & 3258 READ ( 13 ) surf_v(0)%qrs 3259 CASE ( 'surf_v(0)%nrs' ) 3260 IF ( ALLOCATED( surf_v(0)%nrs ) .AND. kk == 1 ) & 3261 READ ( 13 ) surf_v(0)%nrs 3262 CASE ( 'surf_v(0)%ol' ) 3263 IF ( ALLOCATED( surf_v(0)%ol ) .AND. kk == 1 ) & 3264 READ ( 13 ) surf_v(0)%ol 3265 CASE ( 'surf_v(0)%rib' ) 3266 IF ( ALLOCATED( surf_v(0)%rib ) .AND. kk == 1 ) & 3267 READ ( 13 ) surf_v(0)%rib 3268 CASE ( 'surf_v(0)%pt_surface' ) 3269 IF ( ALLOCATED( surf_v(0)%pt_surface ) .AND. kk == 1 ) & 3270 READ ( 13 ) surf_v(0)%pt_surface 3271 CASE ( 'surf_v(0)%shf' ) 3272 IF ( ALLOCATED( surf_v(0)%shf ) .AND. kk == 1 ) & 3273 READ ( 13 ) surf_v(0)%shf 3274 CASE ( 'surf_v(0)%qsws' ) 3275 IF ( ALLOCATED( surf_v(0)%qsws ) .AND. kk == 1 ) & 3276 READ ( 13 ) surf_v(0)%qsws 3277 CASE ( 'surf_v(0)%ssws' ) 3278 IF ( ALLOCATED( surf_v(0)%ssws ) .AND. kk == 1 ) & 3279 READ ( 13 ) surf_v(0)%ssws 3280 CASE ( 'surf_v(0)%css' ) 3281 IF ( ALLOCATED( surf_v(0)%css ) .AND. kk == 1 ) & 3282 READ ( 13 ) surf_v(0)%css 3283 CASE ( 'surf_v(0)%cssws' ) 3284 IF ( ALLOCATED( surf_v(0)%cssws ) .AND. kk == 1 ) & 3285 READ ( 13 ) surf_v(0)%cssws 3286 CASE ( 'surf_v(0)%qcsws' ) 3287 IF ( ALLOCATED( surf_v(0)%qcsws ) .AND. kk == 1 ) & 3288 READ ( 13 ) surf_v(0)%qcsws 3289 CASE ( 'surf_v(0)%ncsws' ) 3290 IF ( ALLOCATED( surf_v(0)%ncsws ) .AND. kk == 1 ) & 3291 READ ( 13 ) surf_v(0)%ncsws 3292 CASE ( 'surf_v(0)%qrsws' ) 3293 IF ( ALLOCATED( surf_v(0)%qrsws ) .AND. kk == 1 ) & 3294 READ ( 13 ) surf_v(0)%qrsws 3295 CASE ( 'surf_v(0)%nrsws' ) 3296 IF ( ALLOCATED( surf_v(0)%nrsws ) .AND. kk == 1 ) & 3297 READ ( 13 ) surf_v(0)%nrsws 3298 CASE ( 'surf_v(0)%sasws' ) 3299 IF ( ALLOCATED( surf_v(0)%sasws ) .AND. kk == 1 ) & 3300 READ ( 13 ) surf_v(0)%sasws 3301 CASE ( 'surf_v(0)%mom_uv' ) 3302 IF ( ALLOCATED( surf_v(0)%mom_flux_uv ) .AND. kk == 1 )& 3303 READ ( 13 ) surf_v(0)%mom_flux_uv 3304 CASE ( 'surf_v(0)%mom_w' ) 3305 IF ( ALLOCATED( surf_v(0)%mom_flux_w ) .AND. kk == 1 ) & 3306 READ ( 13 ) surf_v(0)%mom_flux_w 3307 CASE ( 'surf_v(0)%mom_tke' ) 3308 IF ( ALLOCATED( surf_v(0)%mom_flux_tke ) .AND. kk == 1 )& 3309 READ ( 13 ) surf_v(0)%mom_flux_tke 3310 3311 CASE ( 'surf_v(1)%start_index' ) 3312 IF ( kk == 1 ) & 3313 READ ( 13 ) surf_v(1)%start_index 3314 l = 1 3315 CASE ( 'surf_v(1)%end_index' ) 3316 IF ( kk == 1 ) & 3317 READ ( 13 ) surf_v(1)%end_index 3318 CASE ( 'surf_v(1)%us' ) 3319 IF ( ALLOCATED( surf_v(1)%us ) .AND. kk == 1 ) & 3320 READ ( 13 ) surf_v(1)%us 3321 CASE ( 'surf_v(1)%ts' ) 3322 IF ( ALLOCATED( surf_v(1)%ts ) .AND. kk == 1 ) & 3323 READ ( 13 ) surf_v(1)%ts 3324 CASE ( 'surf_v(1)%qs' ) 3325 IF ( ALLOCATED( surf_v(1)%qs ) .AND. kk == 1 ) & 3326 READ ( 13 ) surf_v(1)%qs 3327 CASE ( 'surf_v(1)%ss' ) 3328 IF ( ALLOCATED( surf_v(1)%ss ) .AND. kk == 1 ) & 3329 READ ( 13 ) surf_v(1)%ss 3330 CASE ( 'surf_v(1)%qcs' ) 3331 IF ( ALLOCATED( surf_v(1)%qcs ) .AND. kk == 1 ) & 3332 READ ( 13 ) surf_v(1)%qcs 3333 CASE ( 'surf_v(1)%ncs' ) 3334 IF ( ALLOCATED( surf_v(1)%ncs ) .AND. kk == 1 ) & 3335 READ ( 13 ) surf_v(1)%ncs 3336 CASE ( 'surf_v(1)%qrs' ) 3337 IF ( ALLOCATED( surf_v(1)%qrs ) .AND. kk == 1 ) & 3338 READ ( 13 ) surf_v(1)%qrs 3339 CASE ( 'surf_v(1)%nrs' ) 3340 IF ( ALLOCATED( surf_v(1)%nrs ) .AND. kk == 1 ) & 3341 READ ( 13 ) surf_v(1)%nrs 3342 CASE ( 'surf_v(1)%ol' ) 3343 IF ( ALLOCATED( surf_v(1)%ol ) .AND. kk == 1 ) & 3344 READ ( 13 ) surf_v(1)%ol 3345 CASE ( 'surf_v(1)%rib' ) 3346 IF ( ALLOCATED( surf_v(1)%rib ) .AND. kk == 1 ) & 3347 READ ( 13 ) surf_v(1)%rib 3348 CASE ( 'surf_v(1)%pt_surface' ) 3349 IF ( ALLOCATED( surf_v(1)%pt_surface ) .AND. kk == 1 ) & 3350 READ ( 13 ) surf_v(1)%pt_surface 3351 CASE ( 'surf_v(1)%shf' ) 3352 IF ( ALLOCATED( surf_v(1)%shf ) .AND. kk == 1 ) & 3353 READ ( 13 ) surf_v(1)%shf 3354 CASE ( 'surf_v(1)%qsws' ) 3355 IF ( ALLOCATED( surf_v(1)%qsws ) .AND. kk == 1 ) & 3356 READ ( 13 ) surf_v(1)%qsws 3357 CASE ( 'surf_v(1)%ssws' ) 3358 IF ( ALLOCATED( surf_v(1)%ssws ) .AND. kk == 1 ) & 3359 READ ( 13 ) surf_v(1)%ssws 3360 CASE ( 'surf_v(1)%css' ) 3361 IF ( ALLOCATED( surf_v(1)%css ) .AND. kk == 1 ) & 3362 READ ( 13 ) surf_v(1)%css 3363 CASE ( 'surf_v(1)%cssws' ) 3364 IF ( ALLOCATED( surf_v(1)%cssws ) .AND. kk == 1 ) & 3365 READ ( 13 ) surf_v(1)%cssws 3366 CASE ( 'surf_v(1)%qcsws' ) 3367 IF ( ALLOCATED( surf_v(1)%qcsws ) .AND. kk == 1 ) & 3368 READ ( 13 ) surf_v(1)%qcsws 3369 CASE ( 'surf_v(1)%ncsws' ) 3370 IF ( ALLOCATED( surf_v(1)%ncsws ) .AND. kk == 1 ) & 3371 READ ( 13 ) surf_v(1)%ncsws 3372 CASE ( 'surf_v(1)%qrsws' ) 3373 IF ( ALLOCATED( surf_v(1)%qrsws ) .AND. kk == 1 ) & 3374 READ ( 13 ) surf_v(1)%qrsws 3375 CASE ( 'surf_v(1)%nrsws' ) 3376 IF ( ALLOCATED( surf_v(1)%nrsws ) .AND. kk == 1 ) & 3377 READ ( 13 ) surf_v(1)%nrsws 3378 CASE ( 'surf_v(1)%sasws' ) 3379 IF ( ALLOCATED( surf_v(1)%sasws ) .AND. kk == 1 ) & 3380 READ ( 13 ) surf_v(1)%sasws 3381 CASE ( 'surf_v(1)%mom_uv' ) 3382 IF ( ALLOCATED( surf_v(1)%mom_flux_uv ) .AND. kk == 1 )& 3383 READ ( 13 ) surf_v(1)%mom_flux_uv 3384 CASE ( 'surf_v(1)%mom_w' ) 3385 IF ( ALLOCATED( surf_v(1)%mom_flux_w ) .AND. kk == 1 ) & 3386 READ ( 13 ) surf_v(1)%mom_flux_w 3387 CASE ( 'surf_v(1)%mom_tke' ) 3388 IF ( ALLOCATED( surf_v(1)%mom_flux_tke ) .AND. kk == 1 )& 3389 READ ( 13 ) surf_v(1)%mom_flux_tke 3390 3391 CASE ( 'surf_v(2)%start_index' ) 3392 IF ( kk == 1 ) & 3393 READ ( 13 ) surf_v(2)%start_index 3394 l = 2 3395 CASE ( 'surf_v(2)%end_index' ) 3396 IF ( kk == 1 ) & 3397 READ ( 13 ) surf_v(2)%end_index 3398 CASE ( 'surf_v(2)%us' ) 3399 IF ( ALLOCATED( surf_v(2)%us ) .AND. kk == 1 ) & 3400 READ ( 13 ) surf_v(2)%us 3401 CASE ( 'surf_v(2)%ts' ) 3402 IF ( ALLOCATED( surf_v(2)%ts ) .AND. kk == 1 ) & 3403 READ ( 13 ) surf_v(2)%ts 3404 CASE ( 'surf_v(2)%qs' ) 3405 IF ( ALLOCATED( surf_v(2)%qs ) .AND. kk == 1 ) & 3406 READ ( 13 ) surf_v(2)%qs 3407 CASE ( 'surf_v(2)%ss' ) 3408 IF ( ALLOCATED( surf_v(2)%ss ) .AND. kk == 1 ) & 3409 READ ( 13 ) surf_v(2)%ss 3410 CASE ( 'surf_v(2)%qcs' ) 3411 IF ( ALLOCATED( surf_v(2)%qcs ) .AND. kk == 1 ) & 3412 READ ( 13 ) surf_v(2)%qcs 3413 CASE ( 'surf_v(2)%ncs' ) 3414 IF ( ALLOCATED( surf_v(2)%ncs ) .AND. kk == 1 ) & 3415 READ ( 13 ) surf_v(2)%ncs 3416 CASE ( 'surf_v(2)%qrs' ) 3417 IF ( ALLOCATED( surf_v(2)%qrs ) .AND. kk == 1 ) & 3418 READ ( 13 ) surf_v(2)%qrs 3419 CASE ( 'surf_v(2)%nrs' ) 3420 IF ( ALLOCATED( surf_v(2)%nrs ) .AND. kk == 1 ) & 3421 READ ( 13 ) surf_v(2)%nrs 3422 CASE ( 'surf_v(2)%ol' ) 3423 IF ( ALLOCATED( surf_v(2)%ol ) .AND. kk == 1 ) & 3424 READ ( 13 ) surf_v(2)%ol 3425 CASE ( 'surf_v(2)%rib' ) 3426 IF ( ALLOCATED( surf_v(2)%rib ) .AND. kk == 1 ) & 3427 READ ( 13 ) surf_v(2)%rib 3428 CASE ( 'surf_v(2)%pt_surface' ) 3429 IF ( ALLOCATED( surf_v(2)%pt_surface ) .AND. kk == 1 ) & 3430 READ ( 13 ) surf_v(2)%pt_surface 3431 CASE ( 'surf_v(2)%shf' ) 3432 IF ( ALLOCATED( surf_v(2)%shf ) .AND. kk == 1 ) & 3433 READ ( 13 ) surf_v(2)%shf 3434 CASE ( 'surf_v(2)%qsws' ) 3435 IF ( ALLOCATED( surf_v(2)%qsws ) .AND. kk == 1 ) & 3436 READ ( 13 ) surf_v(2)%qsws 3437 CASE ( 'surf_v(2)%ssws' ) 3438 IF ( ALLOCATED( surf_v(2)%ssws ) .AND. kk == 1 ) & 3439 READ ( 13 ) surf_v(2)%ssws 3440 CASE ( 'surf_v(2)%css' ) 3441 IF ( ALLOCATED( surf_v(2)%css ) .AND. kk == 1 ) & 3442 READ ( 13 ) surf_v(2)%css 3443 CASE ( 'surf_v(2)%cssws' ) 3444 IF ( ALLOCATED( surf_v(2)%cssws ) .AND. kk == 1 ) & 3445 READ ( 13 ) surf_v(2)%cssws 3446 CASE ( 'surf_v(2)%qcsws' ) 3447 IF ( ALLOCATED( surf_v(2)%qcsws ) .AND. kk == 1 ) & 3448 READ ( 13 ) surf_v(2)%qcsws 3449 CASE ( 'surf_v(2)%ncsws' ) 3450 IF ( ALLOCATED( surf_v(2)%ncsws ) .AND. kk == 1 ) & 3451 READ ( 13 ) surf_v(2)%ncsws 3452 CASE ( 'surf_v(2)%qrsws' ) 3453 IF ( ALLOCATED( surf_v(2)%qrsws ) .AND. kk == 1 ) & 3454 READ ( 13 ) surf_v(2)%qrsws 3455 CASE ( 'surf_v(2)%nrsws' ) 3456 IF ( ALLOCATED( surf_v(2)%nrsws ) .AND. kk == 1 ) & 3457 READ ( 13 ) surf_v(2)%nrsws 3458 CASE ( 'surf_v(2)%sasws' ) 3459 IF ( ALLOCATED( surf_v(2)%sasws ) .AND. kk == 1 ) & 3460 READ ( 13 ) surf_v(2)%sasws 3461 CASE ( 'surf_v(2)%mom_uv' ) 3462 IF ( ALLOCATED( surf_v(2)%mom_flux_uv ) .AND. kk == 1 )& 3463 READ ( 13 ) surf_v(2)%mom_flux_uv 3464 CASE ( 'surf_v(2)%mom_w' ) 3465 IF ( ALLOCATED( surf_v(2)%mom_flux_w ) .AND. kk == 1 ) & 3466 READ ( 13 ) surf_v(2)%mom_flux_w 3467 CASE ( 'surf_v(2)%mom_tke' ) 3468 IF ( ALLOCATED( surf_v(2)%mom_flux_tke ) .AND. kk == 1 )& 3469 READ ( 13 ) surf_v(2)%mom_flux_tke 3470 3471 CASE ( 'surf_v(3)%start_index' ) 3472 IF ( kk == 1 ) & 3473 READ ( 13 ) surf_v(3)%start_index 3474 l = 3 3475 CASE ( 'surf_v(3)%end_index' ) 3476 IF ( kk == 1 ) & 3477 READ ( 13 ) surf_v(3)%end_index 3478 CASE ( 'surf_v(3)%us' ) 3479 IF ( ALLOCATED( surf_v(3)%us ) .AND. kk == 1 ) & 3480 READ ( 13 ) surf_v(3)%us 3481 CASE ( 'surf_v(3)%ts' ) 3482 IF ( ALLOCATED( surf_v(3)%ts ) .AND. kk == 1 ) & 3483 READ ( 13 ) surf_v(3)%ts 3484 CASE ( 'surf_v(3)%qs' ) 3485 IF ( ALLOCATED( surf_v(3)%qs ) .AND. kk == 1 ) & 3486 READ ( 13 ) surf_v(3)%qs 3487 CASE ( 'surf_v(3)%ss' ) 3488 IF ( ALLOCATED( surf_v(3)%ss ) .AND. kk == 1 ) & 3489 READ ( 13 ) surf_v(3)%ss 3490 CASE ( 'surf_v(3)%qcs' ) 3491 IF ( ALLOCATED( surf_v(3)%qcs ) .AND. kk == 1 ) & 3492 READ ( 13 ) surf_v(3)%qcs 3493 CASE ( 'surf_v(3)%ncs' ) 3494 IF ( ALLOCATED( surf_v(3)%ncs ) .AND. kk == 1 ) & 3495 READ ( 13 ) surf_v(3)%ncs 3496 CASE ( 'surf_v(3)%qrs' ) 3497 IF ( ALLOCATED( surf_v(3)%qrs ) .AND. kk == 1 ) & 3498 READ ( 13 ) surf_v(3)%qrs 3499 CASE ( 'surf_v(3)%nrs' ) 3500 IF ( ALLOCATED( surf_v(3)%nrs ) .AND. kk == 1 ) & 3501 READ ( 13 ) surf_v(3)%nrs 3502 CASE ( 'surf_v(3)%ol' ) 3503 IF ( ALLOCATED( surf_v(3)%ol ) .AND. kk == 1 ) & 3504 READ ( 13 ) surf_v(3)%ol 3505 CASE ( 'surf_v(3)%rib' ) 3506 IF ( ALLOCATED( surf_v(3)%rib ) .AND. kk == 1 ) & 3507 READ ( 13 ) surf_v(3)%rib 3508 CASE ( 'surf_v(3)%pt_surface' ) 3509 IF ( ALLOCATED( surf_v(3)%pt_surface ) .AND. kk == 1 ) & 3510 READ ( 13 ) surf_v(3)%pt_surface 3511 CASE ( 'surf_v(3)%shf' ) 3512 IF ( ALLOCATED( surf_v(3)%shf ) .AND. kk == 1 ) & 3513 READ ( 13 ) surf_v(3)%shf 3514 CASE ( 'surf_v(3)%qsws' ) 3515 IF ( ALLOCATED( surf_v(3)%qsws ) .AND. kk == 1 ) & 3516 READ ( 13 ) surf_v(3)%qsws 3517 CASE ( 'surf_v(3)%ssws' ) 3518 IF ( ALLOCATED( surf_v(3)%ssws ) .AND. kk == 1 ) & 3519 READ ( 13 ) surf_v(3)%ssws 3520 CASE ( 'surf_v(3)%css' ) 3521 IF ( ALLOCATED( surf_v(3)%css ) .AND. kk == 1 ) & 3522 READ ( 13 ) surf_v(3)%css 3523 CASE ( 'surf_v(3)%cssws' ) 3524 IF ( ALLOCATED( surf_v(3)%cssws ) .AND. kk == 1 ) & 3525 READ ( 13 ) surf_v(3)%cssws 3526 CASE ( 'surf_v(3)%qcsws' ) 3527 IF ( ALLOCATED( surf_v(3)%qcsws ) .AND. kk == 1 ) & 3528 READ ( 13 ) surf_v(3)%qcsws 3529 CASE ( 'surf_v(3)%ncsws' ) 3530 IF ( ALLOCATED( surf_v(3)%ncsws ) .AND. kk == 1 ) & 3531 READ ( 13 ) surf_v(3)%ncsws 3532 CASE ( 'surf_v(3)%qrsws' ) 3533 IF ( ALLOCATED( surf_v(3)%qrsws ) .AND. kk == 1 ) & 3534 READ ( 13 ) surf_v(3)%qrsws 3535 CASE ( 'surf_v(3)%nrsws' ) 3536 IF ( ALLOCATED( surf_v(3)%nrsws ) .AND. kk == 1 ) & 3537 READ ( 13 ) surf_v(3)%nrsws 3538 CASE ( 'surf_v(3)%sasws' ) 3539 IF ( ALLOCATED( surf_v(3)%sasws ) .AND. kk == 1 ) & 3540 READ ( 13 ) surf_v(3)%sasws 3541 CASE ( 'surf_v(3)%mom_uv' ) 3542 IF ( ALLOCATED( surf_v(3)%mom_flux_uv ) .AND. kk == 1 )& 3543 READ ( 13 ) surf_v(3)%mom_flux_uv 3544 CASE ( 'surf_v(3)%mom_w' ) 3545 IF ( ALLOCATED( surf_v(3)%mom_flux_w ) .AND. kk == 1 ) & 3546 READ ( 13 ) surf_v(3)%mom_flux_w 3547 CASE ( 'surf_v(3)%mom_tke' ) 3548 IF ( ALLOCATED( surf_v(3)%mom_flux_tke ) .AND. kk == 1 )& 3549 READ ( 13 ) surf_v(3)%mom_flux_tke 3550 3551 END SELECT 3552 ! 3553 !-- Redistribute surface elements on its respective type. 3554 IF ( horizontal_surface ) THEN 3555 ic = nxlc 3556 DO i = nxlf, nxrf 3557 jc = nysc 3558 DO j = nysf, nynf 3559 3560 surf_match_def = surf_def_h(l)%end_index(jc,ic) >= & 3561 surf_def_h(l)%start_index(jc,ic) 3562 surf_match_lsm = ( surf_lsm_h%end_index(jc,ic) >= & 3563 surf_lsm_h%start_index(jc,ic) ) & 3564 .AND. l == 0 3565 surf_match_usm = ( surf_usm_h%end_index(jc,ic) >= & 3566 surf_usm_h%start_index(jc,ic) ) & 3567 .AND. l == 0 3568 3569 IF ( surf_match_def ) THEN 3570 mm = surf_def_h(l)%start_index(jc,ic) 3571 DO m = surf_h(l)%start_index(j,i), & 3572 surf_h(l)%end_index(j,i) 3573 CALL restore_surface_elements( surf_def_h(l), & 3574 mm, surf_h(l), m ) 3575 mm = mm + 1 3576 ENDDO 3577 ENDIF 3578 3579 IF ( surf_match_lsm ) THEN 3580 mm = surf_lsm_h%start_index(jc,ic) 3581 DO m = surf_h(l)%start_index(j,i), & 3582 surf_h(l)%end_index(j,i) 3583 CALL restore_surface_elements( surf_lsm_h, & 3584 mm, surf_h(l), m ) 3585 mm = mm + 1 3586 ENDDO 3587 ENDIF 3588 3589 IF ( surf_match_usm ) THEN 3590 mm = surf_usm_h%start_index(jc,ic) 3591 DO m = surf_h(l)%start_index(j,i), & 3592 surf_h(l)%end_index(j,i) 3593 CALL restore_surface_elements( surf_usm_h, & 3594 mm, surf_h(l), m ) 3595 mm = mm + 1 3596 ENDDO 3597 ENDIF 3598 3599 jc = jc + 1 3600 ENDDO 3601 ic = ic + 1 3602 ENDDO 3603 ELSEIF ( vertical_surface ) THEN 3604 ic = nxlc 3605 DO i = nxlf, nxrf 3606 jc = nysc 3607 DO j = nysf, nynf 3608 3609 surf_match_def = surf_def_v(l)%end_index(jc,ic) >= & 3610 surf_def_v(l)%start_index(jc,ic) 3611 surf_match_lsm = surf_lsm_v(l)%end_index(jc,ic) >= & 3612 surf_lsm_v(l)%start_index(jc,ic) 3613 surf_match_usm = surf_usm_v(l)%end_index(jc,ic) >= & 3614 surf_usm_v(l)%start_index(jc,ic) 3615 3616 IF ( surf_match_def ) THEN 3617 mm = surf_def_v(l)%start_index(jc,ic) 3618 DO m = surf_v(l)%start_index(j,i), & 3619 surf_v(l)%end_index(j,i) 3620 CALL restore_surface_elements( surf_def_v(l), & 3621 mm, surf_v(l), m ) 3622 mm = mm + 1 3623 ENDDO 3624 ENDIF 3625 3626 IF ( surf_match_lsm ) THEN 3627 mm = surf_lsm_v(l)%start_index(jc,ic) 3628 DO m = surf_v(l)%start_index(j,i), & 3629 surf_v(l)%end_index(j,i) 3630 CALL restore_surface_elements( surf_lsm_v(l), & 3631 mm, surf_v(l), m ) 3632 mm = mm + 1 3633 ENDDO 3634 ENDIF 3635 3636 IF ( surf_match_usm ) THEN 3637 mm = surf_usm_v(l)%start_index(jc,ic) 3638 DO m = surf_v(l)%start_index(j,i), & 3639 surf_v(l)%end_index(j,i) 3640 CALL restore_surface_elements( surf_usm_v(l), & 3641 mm, surf_v(l), m ) 3642 mm = mm + 1 3643 ENDDO 3644 ENDIF 3645 3646 jc = jc + 1 3647 ENDDO 3648 ic = ic + 1 3336 ENDDO 3337 3338 ENDIF 3339 3340 CASE ( 'surf_h(0)%start_index' ) 3341 IF ( kk == 1 ) & 3342 READ ( 13 ) surf_h(0)%start_index 3343 l = 0 3344 CASE ( 'surf_h(0)%end_index' ) 3345 IF ( kk == 1 ) & 3346 READ ( 13 ) surf_h(0)%end_index 3347 horizontal_surface = .TRUE. 3348 vertical_surface = .FALSE. 3349 CASE ( 'surf_h(0)%us' ) 3350 IF ( ALLOCATED( surf_h(0)%us ) .AND. kk == 1 ) & 3351 READ ( 13 ) surf_h(0)%us 3352 CASE ( 'surf_h(0)%ts' ) 3353 IF ( ALLOCATED( surf_h(0)%ts ) .AND. kk == 1 ) & 3354 READ ( 13 ) surf_h(0)%ts 3355 CASE ( 'surf_h(0)%qs' ) 3356 IF ( ALLOCATED( surf_h(0)%qs ) .AND. kk == 1 ) & 3357 READ ( 13 ) surf_h(0)%qs 3358 CASE ( 'surf_h(0)%ss' ) 3359 IF ( ALLOCATED( surf_h(0)%ss ) .AND. kk == 1 ) & 3360 READ ( 13 ) surf_h(0)%ss 3361 CASE ( 'surf_h(0)%qcs' ) 3362 IF ( ALLOCATED( surf_h(0)%qcs ) .AND. kk == 1 ) & 3363 READ ( 13 ) surf_h(0)%qcs 3364 CASE ( 'surf_h(0)%ncs' ) 3365 IF ( ALLOCATED( surf_h(0)%ncs ) .AND. kk == 1 ) & 3366 READ ( 13 ) surf_h(0)%ncs 3367 CASE ( 'surf_h(0)%qrs' ) 3368 IF ( ALLOCATED( surf_h(0)%qrs ) .AND. kk == 1 ) & 3369 READ ( 13 ) surf_h(0)%qrs 3370 CASE ( 'surf_h(0)%nrs' ) 3371 IF ( ALLOCATED( surf_h(0)%nrs ) .AND. kk == 1 ) & 3372 READ ( 13 ) surf_h(0)%nrs 3373 CASE ( 'surf_h(0)%ol' ) 3374 IF ( ALLOCATED( surf_h(0)%ol ) .AND. kk == 1 ) & 3375 READ ( 13 ) surf_h(0)%ol 3376 CASE ( 'surf_h(0)%rib' ) 3377 IF ( ALLOCATED( surf_h(0)%rib ) .AND. kk == 1 ) & 3378 READ ( 13 ) surf_h(0)%rib 3379 CASE ( 'surf_h(0)%pt_surface' ) 3380 IF ( ALLOCATED( surf_h(0)%pt_surface ) .AND. kk == 1 ) & 3381 READ ( 13 ) surf_h(0)%pt_surface 3382 CASE ( 'surf_h(0)%usws' ) 3383 IF ( ALLOCATED( surf_h(0)%usws ) .AND. kk == 1 ) & 3384 READ ( 13 ) surf_h(0)%usws 3385 CASE ( 'surf_h(0)%vsws' ) 3386 IF ( ALLOCATED( surf_h(0)%vsws ) .AND. kk == 1 ) & 3387 READ ( 13 ) surf_h(0)%vsws 3388 CASE ( 'surf_h(0)%shf' ) 3389 IF ( ALLOCATED( surf_h(0)%shf ) .AND. kk == 1 ) & 3390 READ ( 13 ) surf_h(0)%shf 3391 CASE ( 'surf_h(0)%qsws' ) 3392 IF ( ALLOCATED( surf_h(0)%qsws ) .AND. kk == 1 ) & 3393 READ ( 13 ) surf_h(0)%qsws 3394 CASE ( 'surf_h(0)%ssws' ) 3395 IF ( ALLOCATED( surf_h(0)%ssws ) .AND. kk == 1 ) & 3396 READ ( 13 ) surf_h(0)%ssws 3397 CASE ( 'surf_h(0)%css' ) 3398 IF ( ALLOCATED( surf_h(0)%css ) .AND. kk == 1 ) & 3399 READ ( 13 ) surf_h(0)%css 3400 CASE ( 'surf_h(0)%cssws' ) 3401 IF ( ALLOCATED( surf_h(0)%cssws ) .AND. kk == 1 ) & 3402 READ ( 13 ) surf_h(0)%cssws 3403 CASE ( 'surf_h(0)%qcsws' ) 3404 IF ( ALLOCATED( surf_h(0)%qcsws ) .AND. kk == 1 ) & 3405 READ ( 13 ) surf_h(0)%qcsws 3406 CASE ( 'surf_h(0)%ncsws' ) 3407 IF ( ALLOCATED( surf_h(0)%ncsws ) .AND. kk == 1 ) & 3408 READ ( 13 ) surf_h(0)%ncsws 3409 CASE ( 'surf_h(0)%qrsws' ) 3410 IF ( ALLOCATED( surf_h(0)%qrsws ) .AND. kk == 1 ) & 3411 READ ( 13 ) surf_h(0)%qrsws 3412 CASE ( 'surf_h(0)%nrsws' ) 3413 IF ( ALLOCATED( surf_h(0)%nrsws ) .AND. kk == 1 ) & 3414 READ ( 13 ) surf_h(0)%nrsws 3415 CASE ( 'surf_h(0)%sasws' ) 3416 IF ( ALLOCATED( surf_h(0)%sasws ) .AND. kk == 1 ) & 3417 READ ( 13 ) surf_h(0)%sasws 3418 3419 CASE ( 'surf_h(1)%start_index' ) 3420 IF ( kk == 1 ) & 3421 READ ( 13 ) surf_h(1)%start_index 3422 l = 1 3423 CASE ( 'surf_h(1)%end_index' ) 3424 IF ( kk == 1 ) & 3425 READ ( 13 ) surf_h(1)%end_index 3426 CASE ( 'surf_h(1)%us' ) 3427 IF ( ALLOCATED( surf_h(1)%us ) .AND. kk == 1 ) & 3428 READ ( 13 ) surf_h(1)%us 3429 CASE ( 'surf_h(1)%ts' ) 3430 IF ( ALLOCATED( surf_h(1)%ts ) .AND. kk == 1 ) & 3431 READ ( 13 ) surf_h(1)%ts 3432 CASE ( 'surf_h(1)%qs' ) 3433 IF ( ALLOCATED( surf_h(1)%qs ) .AND. kk == 1 ) & 3434 READ ( 13 ) surf_h(1)%qs 3435 CASE ( 'surf_h(1)%ss' ) 3436 IF ( ALLOCATED( surf_h(1)%ss ) .AND. kk == 1 ) & 3437 READ ( 13 ) surf_h(1)%ss 3438 CASE ( 'surf_h(1)%qcs' ) 3439 IF ( ALLOCATED( surf_h(1)%qcs ) .AND. kk == 1 ) & 3440 READ ( 13 ) surf_h(1)%qcs 3441 CASE ( 'surf_h(1)%ncs' ) 3442 IF ( ALLOCATED( surf_h(1)%ncs ) .AND. kk == 1 ) & 3443 READ ( 13 ) surf_h(1)%ncs 3444 CASE ( 'surf_h(1)%qrs' ) 3445 IF ( ALLOCATED( surf_h(1)%qrs ) .AND. kk == 1 ) & 3446 READ ( 13 ) surf_h(1)%qrs 3447 CASE ( 'surf_h(1)%nrs' ) 3448 IF ( ALLOCATED( surf_h(1)%nrs ) .AND. kk == 1 ) & 3449 READ ( 13 ) surf_h(1)%nrs 3450 CASE ( 'surf_h(1)%ol' ) 3451 IF ( ALLOCATED( surf_h(1)%ol ) .AND. kk == 1 ) & 3452 READ ( 13 ) surf_h(1)%ol 3453 CASE ( 'surf_h(1)%rib' ) 3454 IF ( ALLOCATED( surf_h(1)%rib ) .AND. kk == 1 ) & 3455 READ ( 13 ) surf_h(1)%rib 3456 CASE ( 'surf_h(1)%pt_surface' ) 3457 IF ( ALLOCATED( surf_h(1)%pt_surface ) .AND. kk == 1 ) & 3458 READ ( 13 ) surf_h(1)%pt_surface 3459 CASE ( 'surf_h(1)%usws' ) 3460 IF ( ALLOCATED( surf_h(1)%usws ) .AND. kk == 1 ) & 3461 READ ( 13 ) surf_h(1)%usws 3462 CASE ( 'surf_h(1)%vsws' ) 3463 IF ( ALLOCATED( surf_h(1)%vsws ) .AND. kk == 1 ) & 3464 READ ( 13 ) surf_h(1)%vsws 3465 CASE ( 'surf_h(1)%shf' ) 3466 IF ( ALLOCATED( surf_h(1)%shf ) .AND. kk == 1 ) & 3467 READ ( 13 ) surf_h(1)%shf 3468 CASE ( 'surf_h(1)%qsws' ) 3469 IF ( ALLOCATED( surf_h(1)%qsws ) .AND. kk == 1 ) & 3470 READ ( 13 ) surf_h(1)%qsws 3471 CASE ( 'surf_h(1)%ssws' ) 3472 IF ( ALLOCATED( surf_h(1)%ssws ) .AND. kk == 1 ) & 3473 READ ( 13 ) surf_h(1)%ssws 3474 CASE ( 'surf_h(1)%css' ) 3475 IF ( ALLOCATED( surf_h(1)%css ) .AND. kk == 1 ) & 3476 READ ( 13 ) surf_h(1)%css 3477 CASE ( 'surf_h(1)%cssws' ) 3478 IF ( ALLOCATED( surf_h(1)%cssws ) .AND. kk == 1 ) & 3479 READ ( 13 ) surf_h(1)%cssws 3480 CASE ( 'surf_h(1)%qcsws' ) 3481 IF ( ALLOCATED( surf_h(1)%qcsws ) .AND. kk == 1 ) & 3482 READ ( 13 ) surf_h(1)%qcsws 3483 CASE ( 'surf_h(1)%ncsws' ) 3484 IF ( ALLOCATED( surf_h(1)%ncsws ) .AND. kk == 1 ) & 3485 READ ( 13 ) surf_h(1)%ncsws 3486 CASE ( 'surf_h(1)%qrsws' ) 3487 IF ( ALLOCATED( surf_h(1)%qrsws ) .AND. kk == 1 ) & 3488 READ ( 13 ) surf_h(1)%qrsws 3489 CASE ( 'surf_h(1)%nrsws' ) 3490 IF ( ALLOCATED( surf_h(1)%nrsws ) .AND. kk == 1 ) & 3491 READ ( 13 ) surf_h(1)%nrsws 3492 CASE ( 'surf_h(1)%sasws' ) 3493 IF ( ALLOCATED( surf_h(1)%sasws ) .AND. kk == 1 ) & 3494 READ ( 13 ) surf_h(1)%sasws 3495 3496 CASE ( 'surf_h(2)%start_index' ) 3497 IF ( kk == 1 ) & 3498 READ ( 13 ) surf_h(2)%start_index 3499 l = 2 3500 CASE ( 'surf_h(2)%end_index' ) 3501 IF ( kk == 1 ) & 3502 READ ( 13 ) surf_h(2)%end_index 3503 CASE ( 'surf_h(2)%us' ) 3504 IF ( ALLOCATED( surf_h(2)%us ) .AND. kk == 1 ) & 3505 READ ( 13 ) surf_h(2)%us 3506 CASE ( 'surf_h(2)%ts' ) 3507 IF ( ALLOCATED( surf_h(2)%ts ) .AND. kk == 1 ) & 3508 READ ( 13 ) surf_h(2)%ts 3509 CASE ( 'surf_h(2)%qs' ) 3510 IF ( ALLOCATED( surf_h(2)%qs ) .AND. kk == 1 ) & 3511 READ ( 13 ) surf_h(2)%qs 3512 CASE ( 'surf_h(2)%ss' ) 3513 IF ( ALLOCATED( surf_h(2)%ss ) .AND. kk == 1 ) & 3514 READ ( 13 ) surf_h(2)%ss 3515 CASE ( 'surf_h(2)%qcs' ) 3516 IF ( ALLOCATED( surf_h(2)%qcs ) .AND. kk == 1 ) & 3517 READ ( 13 ) surf_h(2)%qcs 3518 CASE ( 'surf_h(2)%ncs' ) 3519 IF ( ALLOCATED( surf_h(2)%ncs ) .AND. kk == 1 ) & 3520 READ ( 13 ) surf_h(2)%ncs 3521 CASE ( 'surf_h(2)%qrs' ) 3522 IF ( ALLOCATED( surf_h(2)%qrs ) .AND. kk == 1 ) & 3523 READ ( 13 ) surf_h(2)%qrs 3524 CASE ( 'surf_h(2)%nrs' ) 3525 IF ( ALLOCATED( surf_h(2)%nrs ) .AND. kk == 1 ) & 3526 READ ( 13 ) surf_h(2)%nrs 3527 CASE ( 'surf_h(2)%ol' ) 3528 IF ( ALLOCATED( surf_h(2)%ol ) .AND. kk == 1 ) & 3529 READ ( 13 ) surf_h(2)%ol 3530 CASE ( 'surf_h(2)%rib' ) 3531 IF ( ALLOCATED( surf_h(2)%rib ) .AND. kk == 1 ) & 3532 READ ( 13 ) surf_h(2)%rib 3533 CASE ( 'surf_h(2)%pt_surface' ) 3534 IF ( ALLOCATED( surf_h(2)%pt_surface ) .AND. kk == 1 ) & 3535 READ ( 13 ) surf_h(2)%pt_surface 3536 CASE ( 'surf_h(2)%usws' ) 3537 IF ( ALLOCATED( surf_h(2)%usws ) .AND. kk == 1 ) & 3538 READ ( 13 ) surf_h(2)%usws 3539 CASE ( 'surf_h(2)%vsws' ) 3540 IF ( ALLOCATED( surf_h(2)%vsws ) .AND. kk == 1 ) & 3541 READ ( 13 ) surf_h(2)%vsws 3542 CASE ( 'surf_h(2)%shf' ) 3543 IF ( ALLOCATED( surf_h(2)%shf ) .AND. kk == 1 ) & 3544 READ ( 13 ) surf_h(2)%shf 3545 CASE ( 'surf_h(2)%qsws' ) 3546 IF ( ALLOCATED( surf_h(2)%qsws ) .AND. kk == 1 ) & 3547 READ ( 13 ) surf_h(2)%qsws 3548 CASE ( 'surf_h(2)%ssws' ) 3549 IF ( ALLOCATED( surf_h(2)%ssws ) .AND. kk == 1 ) & 3550 READ ( 13 ) surf_h(2)%ssws 3551 CASE ( 'surf_h(2)%css' ) 3552 IF ( ALLOCATED( surf_h(2)%css ) .AND. kk == 1 ) & 3553 READ ( 13 ) surf_h(2)%css 3554 CASE ( 'surf_h(2)%cssws' ) 3555 IF ( ALLOCATED( surf_h(2)%cssws ) .AND. kk == 1 ) & 3556 READ ( 13 ) surf_h(2)%cssws 3557 CASE ( 'surf_h(2)%qcsws' ) 3558 IF ( ALLOCATED( surf_h(2)%qcsws ) .AND. kk == 1 ) & 3559 READ ( 13 ) surf_h(2)%qcsws 3560 CASE ( 'surf_h(2)%ncsws' ) 3561 IF ( ALLOCATED( surf_h(2)%ncsws ) .AND. kk == 1 ) & 3562 READ ( 13 ) surf_h(2)%ncsws 3563 CASE ( 'surf_h(2)%qrsws' ) 3564 IF ( ALLOCATED( surf_h(2)%qrsws ) .AND. kk == 1 ) & 3565 READ ( 13 ) surf_h(2)%qrsws 3566 CASE ( 'surf_h(2)%nrsws' ) 3567 IF ( ALLOCATED( surf_h(2)%nrsws ) .AND. kk == 1 ) & 3568 READ ( 13 ) surf_h(2)%nrsws 3569 CASE ( 'surf_h(2)%sasws' ) 3570 IF ( ALLOCATED( surf_h(2)%sasws ) .AND. kk == 1 ) & 3571 READ ( 13 ) surf_h(2)%sasws 3572 3573 CASE ( 'surf_v(0)%start_index' ) 3574 IF ( kk == 1 ) & 3575 READ ( 13 ) surf_v(0)%start_index 3576 l = 0 3577 horizontal_surface = .FALSE. 3578 vertical_surface = .TRUE. 3579 CASE ( 'surf_v(0)%end_index' ) 3580 IF ( kk == 1 ) & 3581 READ ( 13 ) surf_v(0)%end_index 3582 CASE ( 'surf_v(0)%us' ) 3583 IF ( ALLOCATED( surf_v(0)%us ) .AND. kk == 1 ) & 3584 READ ( 13 ) surf_v(0)%us 3585 CASE ( 'surf_v(0)%ts' ) 3586 IF ( ALLOCATED( surf_v(0)%ts ) .AND. kk == 1 ) & 3587 READ ( 13 ) surf_v(0)%ts 3588 CASE ( 'surf_v(0)%qs' ) 3589 IF ( ALLOCATED( surf_v(0)%qs ) .AND. kk == 1 ) & 3590 READ ( 13 ) surf_v(0)%qs 3591 CASE ( 'surf_v(0)%ss' ) 3592 IF ( ALLOCATED( surf_v(0)%ss ) .AND. kk == 1 ) & 3593 READ ( 13 ) surf_v(0)%ss 3594 CASE ( 'surf_v(0)%qcs' ) 3595 IF ( ALLOCATED( surf_v(0)%qcs ) .AND. kk == 1 ) & 3596 READ ( 13 ) surf_v(0)%qcs 3597 CASE ( 'surf_v(0)%ncs' ) 3598 IF ( ALLOCATED( surf_v(0)%ncs ) .AND. kk == 1 ) & 3599 READ ( 13 ) surf_v(0)%ncs 3600 CASE ( 'surf_v(0)%qrs' ) 3601 IF ( ALLOCATED( surf_v(0)%qrs ) .AND. kk == 1 ) & 3602 READ ( 13 ) surf_v(0)%qrs 3603 CASE ( 'surf_v(0)%nrs' ) 3604 IF ( ALLOCATED( surf_v(0)%nrs ) .AND. kk == 1 ) & 3605 READ ( 13 ) surf_v(0)%nrs 3606 CASE ( 'surf_v(0)%ol' ) 3607 IF ( ALLOCATED( surf_v(0)%ol ) .AND. kk == 1 ) & 3608 READ ( 13 ) surf_v(0)%ol 3609 CASE ( 'surf_v(0)%rib' ) 3610 IF ( ALLOCATED( surf_v(0)%rib ) .AND. kk == 1 ) & 3611 READ ( 13 ) surf_v(0)%rib 3612 CASE ( 'surf_v(0)%pt_surface' ) 3613 IF ( ALLOCATED( surf_v(0)%pt_surface ) .AND. kk == 1 ) & 3614 READ ( 13 ) surf_v(0)%pt_surface 3615 CASE ( 'surf_v(0)%shf' ) 3616 IF ( ALLOCATED( surf_v(0)%shf ) .AND. kk == 1 ) & 3617 READ ( 13 ) surf_v(0)%shf 3618 CASE ( 'surf_v(0)%qsws' ) 3619 IF ( ALLOCATED( surf_v(0)%qsws ) .AND. kk == 1 ) & 3620 READ ( 13 ) surf_v(0)%qsws 3621 CASE ( 'surf_v(0)%ssws' ) 3622 IF ( ALLOCATED( surf_v(0)%ssws ) .AND. kk == 1 ) & 3623 READ ( 13 ) surf_v(0)%ssws 3624 CASE ( 'surf_v(0)%css' ) 3625 IF ( ALLOCATED( surf_v(0)%css ) .AND. kk == 1 ) & 3626 READ ( 13 ) surf_v(0)%css 3627 CASE ( 'surf_v(0)%cssws' ) 3628 IF ( ALLOCATED( surf_v(0)%cssws ) .AND. kk == 1 ) & 3629 READ ( 13 ) surf_v(0)%cssws 3630 CASE ( 'surf_v(0)%qcsws' ) 3631 IF ( ALLOCATED( surf_v(0)%qcsws ) .AND. kk == 1 ) & 3632 READ ( 13 ) surf_v(0)%qcsws 3633 CASE ( 'surf_v(0)%ncsws' ) 3634 IF ( ALLOCATED( surf_v(0)%ncsws ) .AND. kk == 1 ) & 3635 READ ( 13 ) surf_v(0)%ncsws 3636 CASE ( 'surf_v(0)%qrsws' ) 3637 IF ( ALLOCATED( surf_v(0)%qrsws ) .AND. kk == 1 ) & 3638 READ ( 13 ) surf_v(0)%qrsws 3639 CASE ( 'surf_v(0)%nrsws' ) 3640 IF ( ALLOCATED( surf_v(0)%nrsws ) .AND. kk == 1 ) & 3641 READ ( 13 ) surf_v(0)%nrsws 3642 CASE ( 'surf_v(0)%sasws' ) 3643 IF ( ALLOCATED( surf_v(0)%sasws ) .AND. kk == 1 ) & 3644 READ ( 13 ) surf_v(0)%sasws 3645 CASE ( 'surf_v(0)%mom_uv' ) 3646 IF ( ALLOCATED( surf_v(0)%mom_flux_uv ) .AND. kk == 1 ) & 3647 READ ( 13 ) surf_v(0)%mom_flux_uv 3648 CASE ( 'surf_v(0)%mom_w' ) 3649 IF ( ALLOCATED( surf_v(0)%mom_flux_w ) .AND. kk == 1 ) & 3650 READ ( 13 ) surf_v(0)%mom_flux_w 3651 CASE ( 'surf_v(0)%mom_tke' ) 3652 IF ( ALLOCATED( surf_v(0)%mom_flux_tke ) .AND. kk == 1 ) & 3653 READ ( 13 ) surf_v(0)%mom_flux_tke 3654 3655 CASE ( 'surf_v(1)%start_index' ) 3656 IF ( kk == 1 ) & 3657 READ ( 13 ) surf_v(1)%start_index 3658 l = 1 3659 CASE ( 'surf_v(1)%end_index' ) 3660 IF ( kk == 1 ) & 3661 READ ( 13 ) surf_v(1)%end_index 3662 CASE ( 'surf_v(1)%us' ) 3663 IF ( ALLOCATED( surf_v(1)%us ) .AND. kk == 1 ) & 3664 READ ( 13 ) surf_v(1)%us 3665 CASE ( 'surf_v(1)%ts' ) 3666 IF ( ALLOCATED( surf_v(1)%ts ) .AND. kk == 1 ) & 3667 READ ( 13 ) surf_v(1)%ts 3668 CASE ( 'surf_v(1)%qs' ) 3669 IF ( ALLOCATED( surf_v(1)%qs ) .AND. kk == 1 ) & 3670 READ ( 13 ) surf_v(1)%qs 3671 CASE ( 'surf_v(1)%ss' ) 3672 IF ( ALLOCATED( surf_v(1)%ss ) .AND. kk == 1 ) & 3673 READ ( 13 ) surf_v(1)%ss 3674 CASE ( 'surf_v(1)%qcs' ) 3675 IF ( ALLOCATED( surf_v(1)%qcs ) .AND. kk == 1 ) & 3676 READ ( 13 ) surf_v(1)%qcs 3677 CASE ( 'surf_v(1)%ncs' ) 3678 IF ( ALLOCATED( surf_v(1)%ncs ) .AND. kk == 1 ) & 3679 READ ( 13 ) surf_v(1)%ncs 3680 CASE ( 'surf_v(1)%qrs' ) 3681 IF ( ALLOCATED( surf_v(1)%qrs ) .AND. kk == 1 ) & 3682 READ ( 13 ) surf_v(1)%qrs 3683 CASE ( 'surf_v(1)%nrs' ) 3684 IF ( ALLOCATED( surf_v(1)%nrs ) .AND. kk == 1 ) & 3685 READ ( 13 ) surf_v(1)%nrs 3686 CASE ( 'surf_v(1)%ol' ) 3687 IF ( ALLOCATED( surf_v(1)%ol ) .AND. kk == 1 ) & 3688 READ ( 13 ) surf_v(1)%ol 3689 CASE ( 'surf_v(1)%rib' ) 3690 IF ( ALLOCATED( surf_v(1)%rib ) .AND. kk == 1 ) & 3691 READ ( 13 ) surf_v(1)%rib 3692 CASE ( 'surf_v(1)%pt_surface' ) 3693 IF ( ALLOCATED( surf_v(1)%pt_surface ) .AND. kk == 1 ) & 3694 READ ( 13 ) surf_v(1)%pt_surface 3695 CASE ( 'surf_v(1)%shf' ) 3696 IF ( ALLOCATED( surf_v(1)%shf ) .AND. kk == 1 ) & 3697 READ ( 13 ) surf_v(1)%shf 3698 CASE ( 'surf_v(1)%qsws' ) 3699 IF ( ALLOCATED( surf_v(1)%qsws ) .AND. kk == 1 ) & 3700 READ ( 13 ) surf_v(1)%qsws 3701 CASE ( 'surf_v(1)%ssws' ) 3702 IF ( ALLOCATED( surf_v(1)%ssws ) .AND. kk == 1 ) & 3703 READ ( 13 ) surf_v(1)%ssws 3704 CASE ( 'surf_v(1)%css' ) 3705 IF ( ALLOCATED( surf_v(1)%css ) .AND. kk == 1 ) & 3706 READ ( 13 ) surf_v(1)%css 3707 CASE ( 'surf_v(1)%cssws' ) 3708 IF ( ALLOCATED( surf_v(1)%cssws ) .AND. kk == 1 ) & 3709 READ ( 13 ) surf_v(1)%cssws 3710 CASE ( 'surf_v(1)%qcsws' ) 3711 IF ( ALLOCATED( surf_v(1)%qcsws ) .AND. kk == 1 ) & 3712 READ ( 13 ) surf_v(1)%qcsws 3713 CASE ( 'surf_v(1)%ncsws' ) 3714 IF ( ALLOCATED( surf_v(1)%ncsws ) .AND. kk == 1 ) & 3715 READ ( 13 ) surf_v(1)%ncsws 3716 CASE ( 'surf_v(1)%qrsws' ) 3717 IF ( ALLOCATED( surf_v(1)%qrsws ) .AND. kk == 1 ) & 3718 READ ( 13 ) surf_v(1)%qrsws 3719 CASE ( 'surf_v(1)%nrsws' ) 3720 IF ( ALLOCATED( surf_v(1)%nrsws ) .AND. kk == 1 ) & 3721 READ ( 13 ) surf_v(1)%nrsws 3722 CASE ( 'surf_v(1)%sasws' ) 3723 IF ( ALLOCATED( surf_v(1)%sasws ) .AND. kk == 1 ) & 3724 READ ( 13 ) surf_v(1)%sasws 3725 CASE ( 'surf_v(1)%mom_uv' ) 3726 IF ( ALLOCATED( surf_v(1)%mom_flux_uv ) .AND. kk == 1 ) & 3727 READ ( 13 ) surf_v(1)%mom_flux_uv 3728 CASE ( 'surf_v(1)%mom_w' ) 3729 IF ( ALLOCATED( surf_v(1)%mom_flux_w ) .AND. kk == 1 ) & 3730 READ ( 13 ) surf_v(1)%mom_flux_w 3731 CASE ( 'surf_v(1)%mom_tke' ) 3732 IF ( ALLOCATED( surf_v(1)%mom_flux_tke ) .AND. kk == 1 ) & 3733 READ ( 13 ) surf_v(1)%mom_flux_tke 3734 3735 CASE ( 'surf_v(2)%start_index' ) 3736 IF ( kk == 1 ) & 3737 READ ( 13 ) surf_v(2)%start_index 3738 l = 2 3739 CASE ( 'surf_v(2)%end_index' ) 3740 IF ( kk == 1 ) & 3741 READ ( 13 ) surf_v(2)%end_index 3742 CASE ( 'surf_v(2)%us' ) 3743 IF ( ALLOCATED( surf_v(2)%us ) .AND. kk == 1 ) & 3744 READ ( 13 ) surf_v(2)%us 3745 CASE ( 'surf_v(2)%ts' ) 3746 IF ( ALLOCATED( surf_v(2)%ts ) .AND. kk == 1 ) & 3747 READ ( 13 ) surf_v(2)%ts 3748 CASE ( 'surf_v(2)%qs' ) 3749 IF ( ALLOCATED( surf_v(2)%qs ) .AND. kk == 1 ) & 3750 READ ( 13 ) surf_v(2)%qs 3751 CASE ( 'surf_v(2)%ss' ) 3752 IF ( ALLOCATED( surf_v(2)%ss ) .AND. kk == 1 ) & 3753 READ ( 13 ) surf_v(2)%ss 3754 CASE ( 'surf_v(2)%qcs' ) 3755 IF ( ALLOCATED( surf_v(2)%qcs ) .AND. kk == 1 ) & 3756 READ ( 13 ) surf_v(2)%qcs 3757 CASE ( 'surf_v(2)%ncs' ) 3758 IF ( ALLOCATED( surf_v(2)%ncs ) .AND. kk == 1 ) & 3759 READ ( 13 ) surf_v(2)%ncs 3760 CASE ( 'surf_v(2)%qrs' ) 3761 IF ( ALLOCATED( surf_v(2)%qrs ) .AND. kk == 1 ) & 3762 READ ( 13 ) surf_v(2)%qrs 3763 CASE ( 'surf_v(2)%nrs' ) 3764 IF ( ALLOCATED( surf_v(2)%nrs ) .AND. kk == 1 ) & 3765 READ ( 13 ) surf_v(2)%nrs 3766 CASE ( 'surf_v(2)%ol' ) 3767 IF ( ALLOCATED( surf_v(2)%ol ) .AND. kk == 1 ) & 3768 READ ( 13 ) surf_v(2)%ol 3769 CASE ( 'surf_v(2)%rib' ) 3770 IF ( ALLOCATED( surf_v(2)%rib ) .AND. kk == 1 ) & 3771 READ ( 13 ) surf_v(2)%rib 3772 CASE ( 'surf_v(2)%pt_surface' ) 3773 IF ( ALLOCATED( surf_v(2)%pt_surface ) .AND. kk == 1 ) & 3774 READ ( 13 ) surf_v(2)%pt_surface 3775 CASE ( 'surf_v(2)%shf' ) 3776 IF ( ALLOCATED( surf_v(2)%shf ) .AND. kk == 1 ) & 3777 READ ( 13 ) surf_v(2)%shf 3778 CASE ( 'surf_v(2)%qsws' ) 3779 IF ( ALLOCATED( surf_v(2)%qsws ) .AND. kk == 1 ) & 3780 READ ( 13 ) surf_v(2)%qsws 3781 CASE ( 'surf_v(2)%ssws' ) 3782 IF ( ALLOCATED( surf_v(2)%ssws ) .AND. kk == 1 ) & 3783 READ ( 13 ) surf_v(2)%ssws 3784 CASE ( 'surf_v(2)%css' ) 3785 IF ( ALLOCATED( surf_v(2)%css ) .AND. kk == 1 ) & 3786 READ ( 13 ) surf_v(2)%css 3787 CASE ( 'surf_v(2)%cssws' ) 3788 IF ( ALLOCATED( surf_v(2)%cssws ) .AND. kk == 1 ) & 3789 READ ( 13 ) surf_v(2)%cssws 3790 CASE ( 'surf_v(2)%qcsws' ) 3791 IF ( ALLOCATED( surf_v(2)%qcsws ) .AND. kk == 1 ) & 3792 READ ( 13 ) surf_v(2)%qcsws 3793 CASE ( 'surf_v(2)%ncsws' ) 3794 IF ( ALLOCATED( surf_v(2)%ncsws ) .AND. kk == 1 ) & 3795 READ ( 13 ) surf_v(2)%ncsws 3796 CASE ( 'surf_v(2)%qrsws' ) 3797 IF ( ALLOCATED( surf_v(2)%qrsws ) .AND. kk == 1 ) & 3798 READ ( 13 ) surf_v(2)%qrsws 3799 CASE ( 'surf_v(2)%nrsws' ) 3800 IF ( ALLOCATED( surf_v(2)%nrsws ) .AND. kk == 1 ) & 3801 READ ( 13 ) surf_v(2)%nrsws 3802 CASE ( 'surf_v(2)%sasws' ) 3803 IF ( ALLOCATED( surf_v(2)%sasws ) .AND. kk == 1 ) & 3804 READ ( 13 ) surf_v(2)%sasws 3805 CASE ( 'surf_v(2)%mom_uv' ) 3806 IF ( ALLOCATED( surf_v(2)%mom_flux_uv ) .AND. kk == 1 ) & 3807 READ ( 13 ) surf_v(2)%mom_flux_uv 3808 CASE ( 'surf_v(2)%mom_w' ) 3809 IF ( ALLOCATED( surf_v(2)%mom_flux_w ) .AND. kk == 1 ) & 3810 READ ( 13 ) surf_v(2)%mom_flux_w 3811 CASE ( 'surf_v(2)%mom_tke' ) 3812 IF ( ALLOCATED( surf_v(2)%mom_flux_tke ) .AND. kk == 1 ) & 3813 READ ( 13 ) surf_v(2)%mom_flux_tke 3814 3815 CASE ( 'surf_v(3)%start_index' ) 3816 IF ( kk == 1 ) & 3817 READ ( 13 ) surf_v(3)%start_index 3818 l = 3 3819 CASE ( 'surf_v(3)%end_index' ) 3820 IF ( kk == 1 ) & 3821 READ ( 13 ) surf_v(3)%end_index 3822 CASE ( 'surf_v(3)%us' ) 3823 IF ( ALLOCATED( surf_v(3)%us ) .AND. kk == 1 ) & 3824 READ ( 13 ) surf_v(3)%us 3825 CASE ( 'surf_v(3)%ts' ) 3826 IF ( ALLOCATED( surf_v(3)%ts ) .AND. kk == 1 ) & 3827 READ ( 13 ) surf_v(3)%ts 3828 CASE ( 'surf_v(3)%qs' ) 3829 IF ( ALLOCATED( surf_v(3)%qs ) .AND. kk == 1 ) & 3830 READ ( 13 ) surf_v(3)%qs 3831 CASE ( 'surf_v(3)%ss' ) 3832 IF ( ALLOCATED( surf_v(3)%ss ) .AND. kk == 1 ) & 3833 READ ( 13 ) surf_v(3)%ss 3834 CASE ( 'surf_v(3)%qcs' ) 3835 IF ( ALLOCATED( surf_v(3)%qcs ) .AND. kk == 1 ) & 3836 READ ( 13 ) surf_v(3)%qcs 3837 CASE ( 'surf_v(3)%ncs' ) 3838 IF ( ALLOCATED( surf_v(3)%ncs ) .AND. kk == 1 ) & 3839 READ ( 13 ) surf_v(3)%ncs 3840 CASE ( 'surf_v(3)%qrs' ) 3841 IF ( ALLOCATED( surf_v(3)%qrs ) .AND. kk == 1 ) & 3842 READ ( 13 ) surf_v(3)%qrs 3843 CASE ( 'surf_v(3)%nrs' ) 3844 IF ( ALLOCATED( surf_v(3)%nrs ) .AND. kk == 1 ) & 3845 READ ( 13 ) surf_v(3)%nrs 3846 CASE ( 'surf_v(3)%ol' ) 3847 IF ( ALLOCATED( surf_v(3)%ol ) .AND. kk == 1 ) & 3848 READ ( 13 ) surf_v(3)%ol 3849 CASE ( 'surf_v(3)%rib' ) 3850 IF ( ALLOCATED( surf_v(3)%rib ) .AND. kk == 1 ) & 3851 READ ( 13 ) surf_v(3)%rib 3852 CASE ( 'surf_v(3)%pt_surface' ) 3853 IF ( ALLOCATED( surf_v(3)%pt_surface ) .AND. kk == 1 ) & 3854 READ ( 13 ) surf_v(3)%pt_surface 3855 CASE ( 'surf_v(3)%shf' ) 3856 IF ( ALLOCATED( surf_v(3)%shf ) .AND. kk == 1 ) & 3857 READ ( 13 ) surf_v(3)%shf 3858 CASE ( 'surf_v(3)%qsws' ) 3859 IF ( ALLOCATED( surf_v(3)%qsws ) .AND. kk == 1 ) & 3860 READ ( 13 ) surf_v(3)%qsws 3861 CASE ( 'surf_v(3)%ssws' ) 3862 IF ( ALLOCATED( surf_v(3)%ssws ) .AND. kk == 1 ) & 3863 READ ( 13 ) surf_v(3)%ssws 3864 CASE ( 'surf_v(3)%css' ) 3865 IF ( ALLOCATED( surf_v(3)%css ) .AND. kk == 1 ) & 3866 READ ( 13 ) surf_v(3)%css 3867 CASE ( 'surf_v(3)%cssws' ) 3868 IF ( ALLOCATED( surf_v(3)%cssws ) .AND. kk == 1 ) & 3869 READ ( 13 ) surf_v(3)%cssws 3870 CASE ( 'surf_v(3)%qcsws' ) 3871 IF ( ALLOCATED( surf_v(3)%qcsws ) .AND. kk == 1 ) & 3872 READ ( 13 ) surf_v(3)%qcsws 3873 CASE ( 'surf_v(3)%ncsws' ) 3874 IF ( ALLOCATED( surf_v(3)%ncsws ) .AND. kk == 1 ) & 3875 READ ( 13 ) surf_v(3)%ncsws 3876 CASE ( 'surf_v(3)%qrsws' ) 3877 IF ( ALLOCATED( surf_v(3)%qrsws ) .AND. kk == 1 ) & 3878 READ ( 13 ) surf_v(3)%qrsws 3879 CASE ( 'surf_v(3)%nrsws' ) 3880 IF ( ALLOCATED( surf_v(3)%nrsws ) .AND. kk == 1 ) & 3881 READ ( 13 ) surf_v(3)%nrsws 3882 CASE ( 'surf_v(3)%sasws' ) 3883 IF ( ALLOCATED( surf_v(3)%sasws ) .AND. kk == 1 ) & 3884 READ ( 13 ) surf_v(3)%sasws 3885 CASE ( 'surf_v(3)%mom_uv' ) 3886 IF ( ALLOCATED( surf_v(3)%mom_flux_uv ) .AND. kk == 1 ) & 3887 READ ( 13 ) surf_v(3)%mom_flux_uv 3888 CASE ( 'surf_v(3)%mom_w' ) 3889 IF ( ALLOCATED( surf_v(3)%mom_flux_w ) .AND. kk == 1 ) & 3890 READ ( 13 ) surf_v(3)%mom_flux_w 3891 CASE ( 'surf_v(3)%mom_tke' ) 3892 IF ( ALLOCATED( surf_v(3)%mom_flux_tke ) .AND. kk == 1 ) & 3893 READ ( 13 ) surf_v(3)%mom_flux_tke 3894 3895 CASE DEFAULT 3896 3897 found = .FALSE. 3898 3899 END SELECT 3900 3901 ! 3902 !-- Redistribute surface elements on its respective type. 3903 IF ( horizontal_surface ) THEN 3904 ic = nxlc 3905 DO i = nxlf, nxrf 3906 jc = nysc 3907 DO j = nysf, nynf 3908 3909 surf_match_def = surf_def_h(l)%end_index(jc,ic) >= & 3910 surf_def_h(l)%start_index(jc,ic) 3911 surf_match_lsm = ( surf_lsm_h%end_index(jc,ic) >= & 3912 surf_lsm_h%start_index(jc,ic) ) & 3913 .AND. l == 0 3914 surf_match_usm = ( surf_usm_h%end_index(jc,ic) >= & 3915 surf_usm_h%start_index(jc,ic) ) & 3916 .AND. l == 0 3917 3918 IF ( surf_match_def ) THEN 3919 mm = surf_def_h(l)%start_index(jc,ic) 3920 DO m = surf_h(l)%start_index(j,i), & 3921 surf_h(l)%end_index(j,i) 3922 CALL restore_surface_elements( surf_def_h(l), & 3923 mm, surf_h(l), m ) 3924 mm = mm + 1 3649 3925 ENDDO 3650 3926 ENDIF 3651 3927 3928 IF ( surf_match_lsm ) THEN 3929 mm = surf_lsm_h%start_index(jc,ic) 3930 DO m = surf_h(l)%start_index(j,i), & 3931 surf_h(l)%end_index(j,i) 3932 CALL restore_surface_elements( surf_lsm_h, & 3933 mm, surf_h(l), m ) 3934 mm = mm + 1 3935 ENDDO 3936 ENDIF 3937 3938 IF ( surf_match_usm ) THEN 3939 mm = surf_usm_h%start_index(jc,ic) 3940 DO m = surf_h(l)%start_index(j,i), & 3941 surf_h(l)%end_index(j,i) 3942 CALL restore_surface_elements( surf_usm_h, & 3943 mm, surf_h(l), m ) 3944 mm = mm + 1 3945 ENDDO 3946 ENDIF 3947 3948 jc = jc + 1 3652 3949 ENDDO 3653 3654 READ ( 13 ) field_chr 3655 3950 ic = ic + 1 3656 3951 ENDDO 3657 3952 ELSEIF ( vertical_surface ) THEN 3953 ic = nxlc 3954 DO i = nxlf, nxrf 3955 jc = nysc 3956 DO j = nysf, nynf 3957 3958 surf_match_def = surf_def_v(l)%end_index(jc,ic) >= & 3959 surf_def_v(l)%start_index(jc,ic) 3960 surf_match_lsm = surf_lsm_v(l)%end_index(jc,ic) >= & 3961 surf_lsm_v(l)%start_index(jc,ic) 3962 surf_match_usm = surf_usm_v(l)%end_index(jc,ic) >= & 3963 surf_usm_v(l)%start_index(jc,ic) 3964 3965 IF ( surf_match_def ) THEN 3966 mm = surf_def_v(l)%start_index(jc,ic) 3967 DO m = surf_v(l)%start_index(j,i), & 3968 surf_v(l)%end_index(j,i) 3969 CALL restore_surface_elements( surf_def_v(l), & 3970 mm, surf_v(l), m ) 3971 mm = mm + 1 3972 ENDDO 3973 ENDIF 3974 3975 IF ( surf_match_lsm ) THEN 3976 mm = surf_lsm_v(l)%start_index(jc,ic) 3977 DO m = surf_v(l)%start_index(j,i), & 3978 surf_v(l)%end_index(j,i) 3979 CALL restore_surface_elements( surf_lsm_v(l), & 3980 mm, surf_v(l), m ) 3981 mm = mm + 1 3982 ENDDO 3983 ENDIF 3984 3985 IF ( surf_match_usm ) THEN 3986 mm = surf_usm_v(l)%start_index(jc,ic) 3987 DO m = surf_v(l)%start_index(j,i), & 3988 surf_v(l)%end_index(j,i) 3989 CALL restore_surface_elements( surf_usm_v(l), & 3990 mm, surf_v(l), m ) 3991 mm = mm + 1 3992 ENDDO 3993 ENDIF 3994 3995 jc = jc + 1 3996 ENDDO 3997 ic = ic + 1 3998 ENDDO 3658 3999 ENDIF 3659 4000 3660 CONTAINS 4001 4002 CONTAINS 3661 4003 !------------------------------------------------------------------------------! 3662 4004 ! Description: … … 3676 4018 TYPE( surf_type ) :: surf_file !< surface type on file 3677 4019 3678 IF ( INDEX( TRIM( field_chr), '%us' ) /= 0 ) THEN4020 IF ( INDEX( restart_string(1:length), '%us' ) /= 0 ) THEN 3679 4021 IF ( ALLOCATED( surf_target%us ) .AND. & 3680 4022 ALLOCATED( surf_file%us ) ) & … … 3682 4024 ENDIF 3683 4025 3684 IF ( INDEX( TRIM( field_chr), '%ol' ) /= 0 ) THEN4026 IF ( INDEX( restart_string(1:length), '%ol' ) /= 0 ) THEN 3685 4027 IF ( ALLOCATED( surf_target%ol ) .AND. & 3686 4028 ALLOCATED( surf_file%ol ) ) & … … 3688 4030 ENDIF 3689 4031 3690 IF ( INDEX( TRIM( field_chr), '%pt_surface' ) /= 0 ) THEN4032 IF ( INDEX( restart_string(1:length), '%pt_surface' ) /= 0 ) THEN 3691 4033 IF ( ALLOCATED( surf_target%pt_surface ) .AND. & 3692 4034 ALLOCATED( surf_file%pt_surface ) ) & … … 3694 4036 ENDIF 3695 4037 3696 IF ( INDEX( TRIM( field_chr), '%usws' ) /= 0 ) THEN4038 IF ( INDEX( restart_string(1:length), '%usws' ) /= 0 ) THEN 3697 4039 IF ( ALLOCATED( surf_target%usws ) .AND. & 3698 4040 ALLOCATED( surf_file%usws ) ) & … … 3700 4042 ENDIF 3701 4043 3702 IF ( INDEX( TRIM( field_chr), '%vsws' ) /= 0 ) THEN4044 IF ( INDEX( restart_string(1:length), '%vsws' ) /= 0 ) THEN 3703 4045 IF ( ALLOCATED( surf_target%vsws ) .AND. & 3704 4046 ALLOCATED( surf_file%vsws ) ) & … … 3706 4048 ENDIF 3707 4049 3708 IF ( INDEX( TRIM( field_chr), '%ts' ) /= 0 ) THEN4050 IF ( INDEX( restart_string(1:length), '%ts' ) /= 0 ) THEN 3709 4051 IF ( ALLOCATED( surf_target%ts ) .AND. & 3710 4052 ALLOCATED( surf_file%ts ) ) & … … 3712 4054 ENDIF 3713 4055 3714 IF ( INDEX( TRIM( field_chr), '%shf' ) /= 0 ) THEN4056 IF ( INDEX( restart_string(1:length), '%shf' ) /= 0 ) THEN 3715 4057 IF ( ALLOCATED( surf_target%shf ) .AND. & 3716 4058 ALLOCATED( surf_file%shf ) ) & … … 3718 4060 ENDIF 3719 4061 3720 IF ( INDEX( TRIM( field_chr), '%qs' ) /= 0 ) THEN4062 IF ( INDEX( restart_string(1:length), '%qs' ) /= 0 ) THEN 3721 4063 IF ( ALLOCATED( surf_target%qs ) .AND. & 3722 4064 ALLOCATED( surf_file%qs ) ) & … … 3724 4066 ENDIF 3725 4067 3726 IF ( INDEX( TRIM( field_chr), '%qsws' ) /= 0 ) THEN4068 IF ( INDEX( restart_string(1:length), '%qsws' ) /= 0 ) THEN 3727 4069 IF ( ALLOCATED( surf_target%qsws ) .AND. & 3728 4070 ALLOCATED( surf_file%qsws ) ) & … … 3730 4072 ENDIF 3731 4073 3732 IF ( INDEX( TRIM( field_chr), '%ss' ) /= 0 ) THEN4074 IF ( INDEX( restart_string(1:length), '%ss' ) /= 0 ) THEN 3733 4075 IF ( ALLOCATED( surf_target%ss ) .AND. & 3734 4076 ALLOCATED( surf_file%ss ) ) & … … 3736 4078 ENDIF 3737 4079 3738 IF ( INDEX( TRIM( field_chr), '%ssws' ) /= 0 ) THEN4080 IF ( INDEX( restart_string(1:length), '%ssws' ) /= 0 ) THEN 3739 4081 IF ( ALLOCATED( surf_target%ssws ) .AND. & 3740 4082 ALLOCATED( surf_file%ssws ) ) & … … 3742 4084 ENDIF 3743 4085 3744 IF ( INDEX( TRIM( field_chr), '%css' ) /= 0 ) THEN4086 IF ( INDEX( restart_string(1:length), '%css' ) /= 0 ) THEN 3745 4087 IF ( ALLOCATED( surf_target%css ) .AND. & 3746 4088 ALLOCATED( surf_file%css ) ) THEN … … 3750 4092 ENDIF 3751 4093 ENDIF 3752 IF ( INDEX( TRIM( field_chr), '%cssws' ) /= 0 ) THEN4094 IF ( INDEX( restart_string(1:length), '%cssws' ) /= 0 ) THEN 3753 4095 IF ( ALLOCATED( surf_target%cssws ) .AND. & 3754 4096 ALLOCATED( surf_file%cssws ) ) THEN … … 3759 4101 ENDIF 3760 4102 3761 IF ( INDEX( TRIM( field_chr), '%qcs' ) /= 0 ) THEN4103 IF ( INDEX( restart_string(1:length), '%qcs' ) /= 0 ) THEN 3762 4104 IF ( ALLOCATED( surf_target%qcs ) .AND. & 3763 4105 ALLOCATED( surf_file%qcs ) ) & … … 3765 4107 ENDIF 3766 4108 3767 IF ( INDEX( TRIM( field_chr), '%qcsws' ) /= 0 ) THEN4109 IF ( INDEX( restart_string(1:length), '%qcsws' ) /= 0 ) THEN 3768 4110 IF ( ALLOCATED( surf_target%qcsws ) .AND. & 3769 4111 ALLOCATED( surf_file%qcsws ) ) & … … 3771 4113 ENDIF 3772 4114 3773 IF ( INDEX( TRIM( field_chr), '%ncs' ) /= 0 ) THEN4115 IF ( INDEX( restart_string(1:length), '%ncs' ) /= 0 ) THEN 3774 4116 IF ( ALLOCATED( surf_target%ncs ) .AND. & 3775 4117 ALLOCATED( surf_file%ncs ) ) & … … 3777 4119 ENDIF 3778 4120 3779 IF ( INDEX( TRIM( field_chr), '%ncsws' ) /= 0 ) THEN4121 IF ( INDEX( restart_string(1:length), '%ncsws' ) /= 0 ) THEN 3780 4122 IF ( ALLOCATED( surf_target%ncsws ) .AND. & 3781 4123 ALLOCATED( surf_file%ncsws ) ) & … … 3783 4125 ENDIF 3784 4126 3785 IF ( INDEX( TRIM( field_chr), '%qrs' ) /= 0 ) THEN4127 IF ( INDEX( restart_string(1:length), '%qrs' ) /= 0 ) THEN 3786 4128 IF ( ALLOCATED( surf_target%qrs ) .AND. & 3787 4129 ALLOCATED( surf_file%qrs ) ) & … … 3789 4131 ENDIF 3790 4132 3791 IF ( INDEX( TRIM( field_chr), '%qrsws' ) /= 0 ) THEN4133 IF ( INDEX( restart_string(1:length), '%qrsws' ) /= 0 ) THEN 3792 4134 IF ( ALLOCATED( surf_target%qrsws ) .AND. & 3793 4135 ALLOCATED( surf_file%qrsws ) ) & … … 3795 4137 ENDIF 3796 4138 3797 IF ( INDEX( TRIM( field_chr), '%nrs' ) /= 0 ) THEN4139 IF ( INDEX( restart_string(1:length), '%nrs' ) /= 0 ) THEN 3798 4140 IF ( ALLOCATED( surf_target%nrs ) .AND. & 3799 4141 ALLOCATED( surf_file%nrs ) ) & … … 3801 4143 ENDIF 3802 4144 3803 IF ( INDEX( TRIM( field_chr), '%nrsws' ) /= 0 ) THEN4145 IF ( INDEX( restart_string(1:length), '%nrsws' ) /= 0 ) THEN 3804 4146 IF ( ALLOCATED( surf_target%nrsws ) .AND. & 3805 4147 ALLOCATED( surf_file%nrsws ) ) & … … 3807 4149 ENDIF 3808 4150 3809 IF ( INDEX( TRIM( field_chr), '%sasws' ) /= 0 ) THEN4151 IF ( INDEX( restart_string(1:length), '%sasws' ) /= 0 ) THEN 3810 4152 IF ( ALLOCATED( surf_target%sasws ) .AND. & 3811 4153 ALLOCATED( surf_file%sasws ) ) & … … 3813 4155 ENDIF 3814 4156 3815 IF ( INDEX( TRIM( field_chr), '%mom_uv' ) /= 0 ) THEN4157 IF ( INDEX( restart_string(1:length), '%mom_uv' ) /= 0 ) THEN 3816 4158 IF ( ALLOCATED( surf_target%mom_flux_uv ) .AND. & 3817 4159 ALLOCATED( surf_file%mom_flux_uv ) ) & … … 3820 4162 ENDIF 3821 4163 3822 IF ( INDEX( TRIM( field_chr), '%mom_w' ) /= 0 ) THEN4164 IF ( INDEX( restart_string(1:length), '%mom_w' ) /= 0 ) THEN 3823 4165 IF ( ALLOCATED( surf_target%mom_flux_w ) .AND. & 3824 4166 ALLOCATED( surf_file%mom_flux_w ) ) & … … 3827 4169 ENDIF 3828 4170 3829 IF ( INDEX( TRIM( field_chr), '%mom_tke' ) /= 0 ) THEN4171 IF ( INDEX( restart_string(1:length), '%mom_tke' ) /= 0 ) THEN 3830 4172 IF ( ALLOCATED( surf_target%mom_flux_tke ) .AND. & 3831 4173 ALLOCATED( surf_file%mom_flux_tke ) ) & … … 3834 4176 ENDIF 3835 4177 4178 3836 4179 END SUBROUTINE restore_surface_elements 3837 4180 3838 END SUBROUTINE surface_read_restart_data 4181 4182 END SUBROUTINE surface_rrd_local 3839 4183 3840 4184 … … 3903 4247 REAL(wp), DIMENSION(:) :: surf_target !< target surface type 3904 4248 REAL(wp), DIMENSION(:) :: surf_file !< surface type on file 3905 4249 3906 4250 ic = nxlc 3907 4251 DO i = nxlf, nxrf
Note: See TracChangeset
for help on using the changeset viewer.