Oasis3 4.0.2
coasts.f
Go to the documentation of this file.
00001       SUBROUTINE coasts (plon, plat, kmsk, kmskval, klon, klat, kmesh)
00002 C
00003 C               *****************************
00004 C               * OASIS ROUTINE  -  LEVEL 3 *
00005 C               * -------------     ------- *
00006 C               *****************************
00007 C
00008 C**** *coasts* - locate coastal points where SST must be extrapolated
00009 C                when using surfmesh interpolation.
00010 C
00011 C     Purpose:
00012 C     -------
00013 C     This routine is designed to detect coastal points where there is
00014 C     mismatch between the atmosphere and ocean land sea masks and
00015 C     where this mismatch could result in the atmosphere (undesirably)
00016 C     'seeing' climatological SST's directly adjacent to ocean model SST's.
00017 C     Where this situation arises, suitable neighbours from where
00018 C     ocean model SST's may be extrapolated are located.
00019 C     
00020 C     NB: This is only for use with 'SURFMESH' interpolation of SST's.
00021 C
00022 C**   Interface:
00023 C     ---------
00024 C       *CALL*  *coasts*(plon, plat, kmsk, kmskval, klon, klat, kmesh)*
00025 C
00026 C     Input:
00027 C     -----
00028 C                plon    : target grid longitude array (real 2D) 
00029 C                plat    : target grid latitude array (real 2D) 
00030 C                klon    : number of longitude for target grid (integer)
00031 C                klat    : number of latitude for target grid (integer)
00032 C                kmsk    : target grid sea-land mask (integer 2D)
00033 C                kmskval : sea-land mask value (integer)
00034 C                kmesh   : overlap array (integer 2D)
00035 C
00036 C     Output:
00037 C     ------
00038 C     None
00039 C
00040 C     Workspace:
00041 C     ---------
00042 C         indx(4) - stores indices for neighbours
00043 C
00044 C     Externals:
00045 C     ---------
00046 C     None
00047 C
00048 C     History:
00049 C     -------
00050 C       Version   Programmer     Date      Description
00051 C       -------   ----------     ----      -----------  
00052 C       1.1       R. Sutton      24/11/95  Original
00053 C       2.0       L. Terray      26/12/95  Modified: to suit OASIS 2.0
00054 C       2.3       S. Valcke      99/04/30  added: printing levels
00055 C
00056 C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00057 C
00058 C* --------------- Include files and USE of modules ---------------------------
00059 C
00060       USE mod_unit
00061       USE mod_parameter
00062       USE mod_coast
00063       USE mod_smooth
00064       USE mod_printing
00065 C
00066 C* ---------------------------- Argument declarations -------------------
00067 C
00068       REAL (kind=ip_realwp_p) plon(klon,klat), plat(klon,klat)
00069       INTEGER (kind=ip_intwp_p) kmsk(klon,klat), kmesh(klon,klat)
00070 C
00071 C* ---------------------------- Local declarations ----------------------
00072 C
00073       INTEGER (kind=ip_intwp_p) indx(4)
00074 C
00075 C* ---------------------------- Poema verses ----------------------------
00076 C
00077 C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00078 C
00079 C
00080 C*    1. Initialization
00081 C        --------------
00082 C
00083       IF (nlogprt .GE. 2) THEN
00084           WRITE (UNIT = nulou,FMT = *) ' '
00085           WRITE (UNIT = nulou,FMT = *) ' '
00086           WRITE (UNIT = nulou,FMT = *) 
00087      $    '           ROUTINE coasts  -  Level 3'
00088           WRITE (UNIT = nulou,FMT = *) 
00089      $    '           **************     *******'
00090           WRITE (UNIT = nulou,FMT = *) ' '
00091           WRITE (UNIT = nulou,FMT = *)
00092      $     ' locate any coastal points where SST must be extrapolated'
00093           WRITE (UNIT = nulou,FMT = *) ' '
00094           CALL FLUSH(nulou)
00095       ENDIF
00096       ncoast = 0
00097       indx(:)=0
00098 C
00099 C
00100 C*    2. Locate coastal points and neighbours from where to do extrapolation 
00101 C        -------------------------------------------------------------------
00102 C
00103 C* Loop between southern and northern boundaries   
00104 C (Range of latitude is set by parameters defined in blkdata.)
00105 C
00106       DO 210 jj = nsltb+1, nnltb-1
00107         DO 220 ji = 1, klon 
00108 C
00109 C* Find all grid squares which are ocean on the atmosphere grid but
00110 C  have no ocean underlying them on the ocean grid
00111 C
00112           IF (kmsk(ji,jj) .NE.  kmskval .AND. 
00113      $        kmesh(ji,jj) .EQ. 0) THEN
00114               is = jj-1
00115               in = jj+1
00116               iw = ji-1
00117               ie = ji+1
00118 C
00119 C* For an atmospheric domain that is periodic in longitude
00120 C
00121               IF (iw .EQ. 0) iw = klon
00122               IF (ie .GT. klon) ie = ie - klon
00123 C
00124 C* For a domain that is not periodic in longitude
00125 C          if (iw .eq. 0) iw=1
00126 C          if (ie .gt. klon) ie=klon
00127 C
00128 C* Search for neighbours from which ocean model SST may be extrapolated.
00129 C     
00130               inbor = 0
00131               IF (kmsk(iw,jj) .EQ. 0 .AND. kmesh(iw,jj) .NE. 0) THEN
00132                   inbor = inbor + 1
00133                   indx(inbor) = iw + (jj-1) * klon
00134               ENDIF
00135               IF (kmsk(ie,jj) .EQ. 0 .AND. kmesh(ie,jj) .NE. 0) THEN
00136                   inbor = inbor + 1
00137                   indx(inbor)= ie + (jj-1) * klon
00138               ENDIF
00139               IF (kmsk(ji,is) .EQ. 0 .AND. kmesh(ji,is) .NE. 0) THEN
00140                   inbor = inbor + 1
00141                   indx(inbor) = ji + (is-1) * klon
00142               ENDIF
00143               IF (kmsk(ji,in) .EQ. 0 .AND. kmesh(ji,in) .NE. 0) THEN
00144                   inbor = inbor + 1
00145                   indx(inbor) = ji + (in-1) * klon
00146               ENDIF
00147 C
00148 C* Store location of coastal point, number of suitable
00149 C  neighbours and their locations.
00150 C  Note that if there are no neighbours the point must
00151 C  be an inland sea on the atmosphere grid for which 
00152 C  we do not want to extrapolate the ocean SST's 
00153 C
00154               IF (inbor .GT. 0) THEN
00155                   ncoast = ncoast + 1
00156                   npcoast(ncoast,1) = ji + (jj-1) * klon
00157                   npcoast(ncoast,2) = inbor
00158                   DO 230 jkbor = 1, inbor
00159                     npcoast(ncoast,2+jkbor) = indx(jkbor)
00160  230              CONTINUE
00161               ENDIF
00162           ENDIF
00163  220    CONTINUE
00164  210  CONTINUE
00165 C
00166 C
00167 C*    3. Writing results
00168 C        ---------------
00169 C
00170       IF (nlogprt .GE. 2) THEN
00171           WRITE (UNIT = nulou,FMT = *) 
00172      $    'Number of coastal ocean squares on the atmosphere grid '//
00173      $    'for which there'
00174           WRITE (UNIT = nulou,FMT = *) 
00175      $    'are no underlying ocean squares on the ocean grid = ',ncoast
00176           WRITE (UNIT = nulou,FMT = *) ' ' 
00177           WRITE (UNIT = nulou,FMT = *) ' '
00178           WRITE (UNIT = nulou,FMT = *) 
00179      $    'Coordinates  nbor  Coordinates of neighbours '
00180           do 310 jn = 1, ncoast
00181             ii = icoor(npcoast(jn,1),klon)
00182             ij = jcoor(npcoast(jn,1),klon)
00183             WRITE (UNIT = nulou,FMT = 3100) 
00184      $       plon(ii,ij),plat(ii,ij),npcoast(jn,2),
00185      $       (plon(icoor(npcoast(jn,jkbor),klon),
00186      $            jcoor(npcoast(jn,jkbor),klon)),
00187      $        plat(icoor(npcoast(jn,jkbor),klon),   
00188      $            jcoor(npcoast(jn,jkbor),klon)), 
00189      $       jkbor=3,2+npcoast(jn,2))
00190  310      CONTINUE
00191       ENDIF
00192 C
00193 C* Formats
00194 C
00195  3100 FORMAT (1X,'(',F5.1,',',F5.1,')  ',I1,
00196      $       4X,4('(',F5.1,',',F5.1,') '))
00197 C
00198 C
00199 C*    4. End of routine
00200 C        --------------
00201 C
00202       IF (nlogprt .GE. 2) THEN
00203           WRITE (UNIT = nulou,FMT = *) ' '
00204           WRITE (UNIT = nulou,FMT = *) 
00205      $    '           --------- End of ROUTINE coasts ---------'
00206           CALL FLUSH (nulou)
00207       ENDIF
00208       RETURN
00209       END
00210 
00211 
 All Data Structures Namespaces Files Functions Variables Defines