Changeset 2332 in lmdz_wrf
- Timestamp:
- Feb 12, 2019, 2:41:13 PM (6 years ago)
- Location:
- trunk/tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/diag_tools.py
r2277 r2332 1480 1480 """ 1481 1481 fname = 'Forcompute_range_faces' 1482 1483 print fname + 'Lluis:', dsfilt, dsnewrng, hvalleyrng1484 1482 1485 1483 vardims = dimns[:] -
trunk/tools/module_ForDiagnostics.f90
r2330 r2332 9 9 USE module_definitions 10 10 USE module_generic 11 USE module_scientific 11 12 USE module_ForDiagnosticsVars 12 13 … … 978 979 INTEGER, DIMENSION(2,d2) :: ranges2 979 980 INTEGER, DIMENSION(d1,d2) :: iranges 981 LOGICAL, DIMENSION(d1,d2) :: Lranges 980 982 981 983 !!!!!!! Variables … … 1053 1055 1054 1056 ! Homogenizing indices of the ranges 1055 IF (TRIM(face) == 'WE') THEN 1056 CALL xzones_homogenization(d1, d2, iranges, ranges) 1057 ELSE IF (TRIM(face) == 'SN') THEN 1058 CALL yzones_homogenization(d1, d2, iranges, ranges) 1059 END IF 1057 Lranges = iranges /= 0 1058 CALL polygons(.FALSE., d1, d2, Lranges, ranges, Nranges) 1059 1060 ! IF (TRIM(face) == 'WE') THEN 1061 ! CALL xzones_homogenization(d1, d2, iranges, ranges) 1062 ! ELSE IF (TRIM(face) == 'SN') THEN 1063 ! CALL yzones_homogenization(d1, d2, iranges, ranges) 1064 ! END IF 1060 1065 1061 1066 RETURN -
trunk/tools/module_scientific.f90
r2328 r2332 2576 2576 INTEGER :: ierr 2577 2577 INTEGER, DIMENSION(:,:), ALLOCATABLE :: borders 2578 LOGICAL, DIMENSION(dx,dy) :: isborder, isbordery 2578 LOGICAL, DIMENSION(dx,dy) :: isborder, isbordery, borderp 2579 2579 INTEGER, DIMENSION(:,:,:), ALLOCATABLE :: paths 2580 2580 INTEGER :: Npath … … 2584 2584 INTEGER, DIMENSION(:,:), ALLOCATABLE :: vertxs, points 2585 2585 LOGICAL, DIMENSION(:), ALLOCATABLE :: isin 2586 CHARACTER(len=1000) :: boundsS 2586 2587 2587 2588 !!!!!!! Variables … … 2596 2597 2597 2598 ! The mathematical maximum woiuld be dx*dy/4, but let's be optimistic... (sorry Jero) 2598 Nppt = dx*dy/10 2599 Nppt = dx*dy/100 2599 2600 2600 2601 IF (ALLOCATED(borders)) DEALLOCATE(borders) … … 2605 2606 IF (ALLOCATED(paths)) DEALLOCATE(paths) 2606 2607 ALLOCATE(paths(Nppt,Nppt,2), STAT=ierr) 2607 msg = "Problems allocating matrix 'paths'" 2608 boundsS = vectorI_S(3, (/Nppt, Nppt, 2/)) 2609 msg = "Problems allocating matrix 'paths' shape: " // TRIM(boundsS) // " try to reduce Nppt " // & 2610 "and recompile" 2608 2611 CALL ErrMsg(msg, fname, ierr) 2609 2612 … … 2633 2636 END DO 2634 2637 2635 CALL borders_matrixL(d x, dy, Nppt, boolmat, borders, isborder, isbordery)2638 CALL borders_matrixL(dbg, dx, dy, Nppt, boolmat, borders, isborder, isbordery) 2636 2639 CALL paths_border(dbg, dx, dy, isborder, Nppt, borders, paths, Npath, Nptpaths) 2637 2640 … … 2651 2654 isin = .FALSE. 2652 2655 2653 IF (dbg) PRINT *, ' path:', ip, ' N pts:', Nptpaths(ip) 2656 IF (dbg) THEN 2657 PRINT *, ' path:', ip, ' N pts:', Nptpaths(ip) 2658 DO j=1, Nptpaths(ip) 2659 PRINT *, ' ',j,':',paths(ip,j,:) 2660 END DO 2661 END IF 2662 2663 borderp = .FALSE. 2664 DO j=1,Nptpaths(ip) 2665 borderp(paths(ip,j,1),paths(ip,j,2)) = .TRUE. 2666 END DO 2654 2667 2655 2668 CALL path_properties(dx, dy, boolmat, Nptpaths(ip), paths(ip,1:Nptpaths(ip),:), xtrx, xtry, & … … 2667 2680 END IF 2668 2681 2669 CALL gridpoints_InsidePolygon(d x, dy, isbordery, Nptpaths(ip), paths(ip,1:Nptpaths(ip),:), Nvertx,&2670 xtrx, xtry, vertxs, Npts, points, isin)2682 CALL gridpoints_InsidePolygon(dbg, dx, dy, isbordery, Nptpaths(ip), paths(ip,1:Nptpaths(ip),:), & 2683 Nvertx, xtrx, xtry, vertxs, Npts, points, isin) 2671 2684 2672 2685 ! Filling polygons … … 2689 2702 CALL clean_polygons(dx, dy, boolmat, polys, Npoly, dbg) 2690 2703 2691 DEALLOCATE (borders)2692 DEALLOCATE (Nptpaths)2693 DEALLOCATE (paths)2694 DEALLOCATE (vertxs)2695 DEALLOCATE (points)2696 DEALLOCATE (isin)2704 IF (ALLOCATED(borders)) DEALLOCATE (borders) 2705 IF (ALLOCATED(Nptpaths)) DEALLOCATE (Nptpaths) 2706 IF (ALLOCATED(paths)) DEALLOCATE (paths) 2707 IF (ALLOCATED(vertxs)) DEALLOCATE (vertxs) 2708 IF (ALLOCATED(points)) DEALLOCATE (points) 2709 IF (ALLOCATED(isin)) DEALLOCATE (isin) 2697 2710 2698 2711 RETURN … … 2904 2917 END SUBROUTINE path_properties 2905 2918 2906 SUBROUTINE gridpoints_InsidePolygon(d x, dy, isbrdr, Npath, path, Nvrtx, xpathxtrm, ypathxtrm,&2919 SUBROUTINE gridpoints_InsidePolygon(dbg, dx, dy, isbrdr, Npath, path, Nvrtx, xpathxtrm, ypathxtrm, & 2907 2920 vrtxs, Npts, pts, inside) 2908 2921 ! Subroutine to determine if a series of grid points are inside a polygon following ray casting algorithm … … 2912 2925 2913 2926 INTEGER, INTENT(in) :: dx,dy,Npath,Nvrtx,Npts 2927 LOGICAL, INTENT(in) :: dbg 2914 2928 LOGICAL, DIMENSION(dx,dy), INTENT(in) :: isbrdr 2915 2929 INTEGER, DIMENSION(Npath,2), INTENT(in) :: path … … 2947 2961 halo_brdr = .FALSE. 2948 2962 2963 IF (dbg) PRINT *,'Border _______' 2949 2964 DO i=1,dx 2950 2965 halo_brdr(i+1,2:dy+1) = isbrdr(i,:) 2966 IF (dbg) PRINT *,isbrdr(i,:) 2951 2967 END DO 2952 2968 … … 2979 2995 IF (halo_brdr(ix+1,j+1) .AND. (ispath /= -1) .AND. (halo_brdr(ix+1,j+1) .EQV. halo_brdr(ix+1,j+2))) THEN 2980 2996 Nbrbrdr = Nbrbrdr + 1 2997 IF (dbg) PRINT *,' ',Nbrbrdr,' Consec brdrs:', halo_brdr(ix+1,j+1), halo_brdr(ix+1,j+2), & 2998 '(', ix,j,';', ix,j+1,')', isbrdr(ix,j), isbrdr(ix,j+1) 2981 2999 ELSE 2982 3000 ! Will remove that consecutive borders above 2 2983 3001 IF (Nbrbrdr /= 0) THEN 3002 IF (dbg) PRINT *, ix,',',iy,';', Nintersecs, ' amount of consecutive borders:', Nbrbrdr, & 3003 ' removing:', MAX(Nbrbrdr-1, 0) 2984 3004 Nintersecs = Nintersecs - MAX(Nbrbrdr-1, 0) 2985 3005 Nbrbrdr = 0 … … 2988 3008 END DO 2989 3009 IF (MOD(Nintersecs,2) /= 0) inside(ip) = .TRUE. 3010 IF (dbg) PRINT *,ip,' point:', ix, iy, 'isbrdr:', isbrdr(ix,1:iy-1), 'y-ray:', halo_brdr(ix+1,1:iy), 'inside:', inside(ip) 2990 3011 END IF 2991 3012 … … 3065 3086 END SUBROUTINE look_clockwise_borders 3066 3087 3067 SUBROUTINE borders_matrixL(d x,dy,dxy,Lmat,brdrs,isbrdr,isbrdry)3088 SUBROUTINE borders_matrixL(dbg,dx,dy,dxy,Lmat,brdrs,isbrdr,isbrdry) 3068 3089 ! Subroutine to provide the borders of a logical array (interested in .TRUE.) 3069 3090 … … 3071 3092 3072 3093 INTEGER, INTENT(in) :: dx,dy,dxy 3094 LOGICAL, INTENT(in) :: dbg 3073 3095 LOGICAL, DIMENSION(dx,dy), INTENT(in) :: Lmat 3074 3096 INTEGER, DIMENSION(dxy,2), INTENT(out) :: brdrs … … 3185 3207 END DO 3186 3208 3209 IF (dbg) THEN 3210 PRINT *,' BORDERS _______ x y' 3211 DO i=1,dx 3212 PRINT *,isbrdr(i,:), ' ', isbrdry(i,:) 3213 END DO 3214 END IF 3215 3187 3216 RETURN 3188 3217 … … 3222 3251 fname = 'paths_border' 3223 3252 3253 IF (dbg) PRINT *, TRIM(fname) // ' ...' 3254 3224 3255 ! Sarting matrix 3225 3256 paths = -1 … … 3238 3269 3239 3270 IF (dbg) THEN 3271 PRINT *,' isborder ______' 3272 DO i=1,dx 3273 PRINT *,isborder(i,:) 3274 END DO 3275 3240 3276 PRINT *,' borders _______' 3241 3277 DO i=1,Nbrdr … … 3278 3314 IF (dbg) PRINT *,ipath,'iip jip:', iip, ijp 3279 3315 found = .FALSE. 3280 CALL look_clockwise_borders(dx,dy,Nppt,borders,gotbrdr,isborder,iip,ijp, .FALSE.,iif,jjf,iff)3316 CALL look_clockwise_borders(dx,dy,Nppt,borders,gotbrdr,isborder,iip,ijp,dbg,iif,jjf,iff) 3281 3317 IF (iif /= -1) THEN 3282 3318 ip=ip+1 … … 3310 3346 iip = paths(ipath,i,1) 3311 3347 ijp = paths(ipath,i,2) 3312 CALL look_clockwise_borders(dx,dy,Nppt,borders, gotbrdr,isborder,iip,ijp,.FALSE., iif, &3348 CALL look_clockwise_borders(dx,dy,Nppt,borders, gotbrdr, isborder,iip, ijp, dbg, iif, & 3313 3349 jjf,iff) 3314 3350 IF (iif /= -1 .AND. iff /= -1) THEN
Note: See TracChangeset
for help on using the changeset viewer.