Changeset 2359 in lmdz_wrf
- Timestamp:
- Feb 21, 2019, 8:10:14 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/module_generic.f90
r2357 r2359 991 991 END SUBROUTINE get_xyconlimits 992 992 993 SUBROUTINE from_ptlist_2DRKmatrix(Npts, pts, vals, dx, dy, NOval, matrix)993 SUBROUTINE from_ptlist_2DRKmatrix(Npts, pts, Flike, vals, dx, dy, NOval, matrix) 994 994 ! Subroutine to construct a 2D RK matrix from a list of values accompaigned by a list of grid-point 995 995 ! coordinates … … 998 998 999 999 INTEGER, INTENT(in) :: Npts, dx, dy 1000 LOGICAL, INTENT(in) :: Flike 1000 1001 REAL(r_k), INTENT(in) :: NOval 1001 1002 INTEGER, DIMENSION(Npts,2), INTENT(in) :: pts … … 1009 1010 ! Npts: Number of values of the list 1010 1011 ! pts: 2D matrix coordinates of the values 1012 ! Flike: whether input is Fortran-like (1: x, 2: y) or not (0-based; 1: y, 2: x) 1011 1013 ! vals: list of values correspondant to the coordinates 1012 1014 ! dx, dy: shape of the 2D matrix … … 1018 1020 matrix = NOval 1019 1021 1020 DO iv=1, Npts 1021 i = pts(iv,1) 1022 j = pts(iv,2) 1023 matrix(i,j) = vals(iv) 1024 END DO 1022 IF (Flike) THEN 1023 DO iv=1, Npts 1024 i = pts(iv,1) 1025 j = pts(iv,2) 1026 matrix(i,j) = vals(iv) 1027 END DO 1028 ELSE 1029 DO iv=1, Npts 1030 i = pts(iv,2)+1 1031 j = pts(iv,1)+1 1032 matrix(i,j) = vals(iv) 1033 END DO 1034 END IF 1025 1035 1026 1036 RETURN … … 1028 1038 END SUBROUTINE from_ptlist_2DRKmatrix 1029 1039 1030 SUBROUTINE from_ptlist_2DRKNmatrix(Npts, pts, Nvals, vals, dx, dy, NOval, Nmatrix)1040 SUBROUTINE from_ptlist_2DRKNmatrix(Npts, pts, Flike, Nvals, vals, dx, dy, NOval, Nmatrix) 1031 1041 ! Subroutine to construct N 2D RK matrix from a list of values accompaigned by a list of grid-point 1032 1042 ! coordinates … … 1035 1045 1036 1046 INTEGER, INTENT(in) :: Npts, dx, dy, Nvals 1047 LOGICAL, INTENT(in) :: Flike 1037 1048 REAL(r_k), INTENT(in) :: NOval 1038 1049 INTEGER, DIMENSION(Npts,2), INTENT(in) :: pts … … 1046 1057 ! Npts: Number of values of the list 1047 1058 ! pts: 2D matrix coordinates of the values 1059 ! Flike: whether input is Fortran-like (1: x, 2: y) or not (0-based; 1: y, 2: x) 1048 1060 ! Nvals: number of different values 1049 1061 ! vals: list of N-values correspondant to the coordinates … … 1056 1068 Nmatrix = NOval 1057 1069 1058 DO iv=1, Npts 1059 i = pts(iv,1) 1060 j = pts(iv,2) 1061 Nmatrix(i,j,:) = vals(iv,:) 1062 END DO 1070 IF (Flike) THEN 1071 DO iv=1, Npts 1072 i = pts(iv,1) 1073 j = pts(iv,2) 1074 Nmatrix(i,j,:) = vals(iv,:) 1075 END DO 1076 ELSE 1077 DO iv=1, Npts 1078 i = pts(iv,2)+1 1079 j = pts(iv,1)+1 1080 Nmatrix(i,j,:) = vals(iv,:) 1081 END DO 1082 END IF 1063 1083 1064 1084 RETURN … … 1066 1086 END SUBROUTINE from_ptlist_2DRKNmatrix 1067 1087 1068 SUBROUTINE from_coordlist_2DRKmatrix(Npts, coords, xcoord, ycoord, vals, dx, dy, NOval, matrix) 1088 SUBROUTINE from_coordlist_2DRKmatrix(Npts, coords, Flike, xcoord, ycoord, vals, dx, dy, NOval, & 1089 matrix) 1069 1090 ! Subroutine to construct a 2D RK matrix from a list of values accompaigned by a list of coordinates 1070 1091 ! to find i,j grid-point coordinates by minimum distance … … 1073 1094 1074 1095 INTEGER, INTENT(in) :: Npts, dx, dy 1096 LOGICAL, INTENT(in) :: Flike 1075 1097 REAL(r_k), INTENT(in) :: NOval 1076 1098 REAL(r_k), DIMENSION(Npts,2), INTENT(in) :: coords … … 1088 1110 ! Npts: Number of values of the list 1089 1111 ! coords: 2D coordinates of the values 1112 ! Flike: whether input is Fortran-like (1: x, 2: y) or not (0-based; 1: y, 2: x) 1090 1113 ! vals: list of values correspondant to the coordinates 1091 1114 ! xcoord, ycoord: matrix of values correspondant to the each coordinate … … 1098 1121 matrix = NOval 1099 1122 1100 DO iv=1, Npts 1101 xi = coords(iv,1) 1102 yi = coords(iv,2) 1103 diff = SQRT((xcoord-xi)**2+(ycoord-yi)**2) 1104 minpt = MINLOC(diff) 1105 matrix(minpt(1),minpt(2)) = vals(iv) 1106 END DO 1123 IF (Flike) THEN 1124 DO iv=1, Npts 1125 xi = coords(iv,1) 1126 yi = coords(iv,2) 1127 diff = SQRT((xcoord-xi)**2+(ycoord-yi)**2) 1128 minpt = MINLOC(diff) 1129 matrix(minpt(1),minpt(2)) = vals(iv) 1130 END DO 1131 ELSE 1132 DO iv=1, Npts 1133 xi = coords(iv,2) 1134 yi = coords(iv,1) 1135 diff = SQRT((xcoord-xi)**2+(ycoord-yi)**2) 1136 minpt = MINLOC(diff) 1137 matrix(minpt(1),minpt(2)) = vals(iv) 1138 END DO 1139 END IF 1107 1140 1108 1141 RETURN
Note: See TracChangeset
for help on using the changeset viewer.