Ignore:
Timestamp:
Aug 2, 2024, 9:58:25 PM (3 months ago)
Author:
abarral
Message:

Put dimensions.h and paramet.h into modules

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/Amaury_dev/libf/dyn3d_common/extrapol.f90

    r5134 r5159  
    22! $Id$
    33
    4 !
    5 !
     4
     5
    66SUBROUTINE extrapol(pfild, kxlon, kylat, pmask, &
    77        norsud, ldper, knbor, pwork)
    88  IMPLICIT NONE
    9   !
     9
    1010  ! OASIS routine (Adaptation: Laurent Li, le 14 mars 1997)
    1111  ! Fill up missed values by using the neighbor points
    12   !
     12
    1313  INTEGER :: kxlon, kylat ! longitude and latitude dimensions (Input)
    1414  INTEGER :: knbor ! minimum neighbor number (Input)
     
    1818  REAL :: pfild(kxlon,kylat) ! field to be extrapolated (Input/Output)
    1919  REAL :: pwork(kxlon,kylat) ! working space
    20   !
     20
    2121  REAL :: zwmsk
    2222  INTEGER :: incre, idoit, i, j, k, inbor, ideb, ifin, ilon, jlat
    2323  INTEGER :: ix(9), jy(9) ! index arrays for the neighbors coordinates
    2424  REAL :: zmask(9)
    25   !
     25
    2626  !  We search over the eight closest neighbors
    27   !
     27
    2828  !        j+1  7  8  9
    2929  !          j  4  5  6    Current point 5 --> (i,j)
    3030  !        j-1  1  2  3
    3131  !            i-1 i i+1
    32   !
    33   !
     32
     33
    3434  IF (norsud) THEN
    3535     DO j = 1, kylat
     
    4444     ENDDO
    4545  ENDIF
    46   !
     46
    4747  incre = 0
    48   !
     48
    4949  DO j = 1, kylat
    5050  DO i = 1, kxlon
     
    5252  ENDDO
    5353  ENDDO
    54   !
     54
    5555  !* To avoid problems in floating point tests
    5656  zwmsk = pmask - 1.0
    57   !
     57
    5858200   CONTINUE
    5959  incre = incre + 1
     
    6565     ideb = 1
    6666     ifin = 9
    67   !
     67
    6868  !* Fill up ix array
    6969     ix(1) = MAX (1,i-1)
     
    7676     ix(8) = i
    7777     ix(9) = MIN (kxlon,i+1)
    78   !
     78
    7979  !* Fill up iy array
    8080     jy(1) = MAX (1,j-1)
     
    8787     jy(8) = MIN (kylat,j+1)
    8888     jy(9) = MIN (kylat,j+1)
    89   !
     89
    9090  !* Correct latitude bounds if southernmost or northernmost points
    9191     IF (j == 1) ideb = 4
    9292     IF (j == kylat) ifin = 6
    93   !
     93
    9494  !* Account for periodicity in longitude
    95   !
     95
    9696     IF (ldper) THEN
    9797        IF (i == kxlon) THEN
     
    121121           ix(6) = i
    122122        ENDIF
    123   !
     123
    124124        IF (i == 1 .OR. i == kxlon) THEN
    125125           jy(1) = MAX (1,j-1)
     
    129129           jy(5) = MIN (kylat,j+1)
    130130           jy(6) = MIN (kylat,j+1)
    131   !
     131
    132132           ideb = 1
    133133           ifin = 6
     
    136136        ENDIF
    137137     ENDIF ! end for ldper test
    138   !
     138
    139139  !* Find unmasked neighbors
    140   !
     140
    141141     DO k = ideb, ifin
    142142        zmask(k) = 0.
     
    148148        ENDIF
    149149  END DO
    150   !
     150
    151151  !* Not enough points around point P are unmasked; interpolation on P
    152152  !  will be done in a future CALL to extrap.
    153   !
     153
    154154     IF (inbor >= knbor) THEN
    155155        pwork(i,j) = 0.
     
    161161        ENDDO
    162162     ENDIF
    163   !
     163
    164164  ENDIF
    165165  END DO
    166166  END DO
    167   !
     167
    168168  !*    3. Writing back unmasked field in pfild
    169169  !    ------------------------------------
    170   !
     170
    171171  !* pfild then contains:
    172172  ! - Values which were not masked
    173173  ! - Interpolated values from the inbor neighbors
    174174  ! - Values which are not yet interpolated
    175   !
     175
    176176  idoit = 0
    177177  DO j = 1, kylat
     
    181181  ENDDO
    182182  ENDDO
    183   !
     183
    184184  IF (idoit /= 0) GOTO 200
    185185  !cc      PRINT*, "Number of extrapolation steps incre =", incre
    186   !
     186
    187187  IF (norsud) THEN
    188188     DO j = 1, kylat
     
    197197     ENDDO
    198198  ENDIF
    199   !
     199
    200200  RETURN
    201201END SUBROUTINE extrapol
Note: See TracChangeset for help on using the changeset viewer.