Changeset 5159 for LMDZ6/branches/Amaury_dev/libf/dyn3d_common/extrapol.f90
- Timestamp:
- Aug 2, 2024, 9:58:25 PM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/branches/Amaury_dev/libf/dyn3d_common/extrapol.f90
r5134 r5159 2 2 ! $Id$ 3 3 4 ! 5 ! 4 5 6 6 SUBROUTINE extrapol(pfild, kxlon, kylat, pmask, & 7 7 norsud, ldper, knbor, pwork) 8 8 IMPLICIT NONE 9 ! 9 10 10 ! OASIS routine (Adaptation: Laurent Li, le 14 mars 1997) 11 11 ! Fill up missed values by using the neighbor points 12 ! 12 13 13 INTEGER :: kxlon, kylat ! longitude and latitude dimensions (Input) 14 14 INTEGER :: knbor ! minimum neighbor number (Input) … … 18 18 REAL :: pfild(kxlon,kylat) ! field to be extrapolated (Input/Output) 19 19 REAL :: pwork(kxlon,kylat) ! working space 20 ! 20 21 21 REAL :: zwmsk 22 22 INTEGER :: incre, idoit, i, j, k, inbor, ideb, ifin, ilon, jlat 23 23 INTEGER :: ix(9), jy(9) ! index arrays for the neighbors coordinates 24 24 REAL :: zmask(9) 25 ! 25 26 26 ! We search over the eight closest neighbors 27 ! 27 28 28 ! j+1 7 8 9 29 29 ! j 4 5 6 Current point 5 --> (i,j) 30 30 ! j-1 1 2 3 31 31 ! i-1 i i+1 32 ! 33 ! 32 33 34 34 IF (norsud) THEN 35 35 DO j = 1, kylat … … 44 44 ENDDO 45 45 ENDIF 46 ! 46 47 47 incre = 0 48 ! 48 49 49 DO j = 1, kylat 50 50 DO i = 1, kxlon … … 52 52 ENDDO 53 53 ENDDO 54 ! 54 55 55 !* To avoid problems in floating point tests 56 56 zwmsk = pmask - 1.0 57 ! 57 58 58 200 CONTINUE 59 59 incre = incre + 1 … … 65 65 ideb = 1 66 66 ifin = 9 67 ! 67 68 68 !* Fill up ix array 69 69 ix(1) = MAX (1,i-1) … … 76 76 ix(8) = i 77 77 ix(9) = MIN (kxlon,i+1) 78 ! 78 79 79 !* Fill up iy array 80 80 jy(1) = MAX (1,j-1) … … 87 87 jy(8) = MIN (kylat,j+1) 88 88 jy(9) = MIN (kylat,j+1) 89 ! 89 90 90 !* Correct latitude bounds if southernmost or northernmost points 91 91 IF (j == 1) ideb = 4 92 92 IF (j == kylat) ifin = 6 93 ! 93 94 94 !* Account for periodicity in longitude 95 ! 95 96 96 IF (ldper) THEN 97 97 IF (i == kxlon) THEN … … 121 121 ix(6) = i 122 122 ENDIF 123 ! 123 124 124 IF (i == 1 .OR. i == kxlon) THEN 125 125 jy(1) = MAX (1,j-1) … … 129 129 jy(5) = MIN (kylat,j+1) 130 130 jy(6) = MIN (kylat,j+1) 131 ! 131 132 132 ideb = 1 133 133 ifin = 6 … … 136 136 ENDIF 137 137 ENDIF ! end for ldper test 138 ! 138 139 139 !* Find unmasked neighbors 140 ! 140 141 141 DO k = ideb, ifin 142 142 zmask(k) = 0. … … 148 148 ENDIF 149 149 END DO 150 ! 150 151 151 !* Not enough points around point P are unmasked; interpolation on P 152 152 ! will be done in a future CALL to extrap. 153 ! 153 154 154 IF (inbor >= knbor) THEN 155 155 pwork(i,j) = 0. … … 161 161 ENDDO 162 162 ENDIF 163 ! 163 164 164 ENDIF 165 165 END DO 166 166 END DO 167 ! 167 168 168 !* 3. Writing back unmasked field in pfild 169 169 ! ------------------------------------ 170 ! 170 171 171 !* pfild then contains: 172 172 ! - Values which were not masked 173 173 ! - Interpolated values from the inbor neighbors 174 174 ! - Values which are not yet interpolated 175 ! 175 176 176 idoit = 0 177 177 DO j = 1, kylat … … 181 181 ENDDO 182 182 ENDDO 183 ! 183 184 184 IF (idoit /= 0) GOTO 200 185 185 !cc PRINT*, "Number of extrapolation steps incre =", incre 186 ! 186 187 187 IF (norsud) THEN 188 188 DO j = 1, kylat … … 197 197 ENDDO 198 198 ENDIF 199 ! 199 200 200 RETURN 201 201 END SUBROUTINE extrapol
Note: See TracChangeset
for help on using the changeset viewer.