New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 7025 for branches/2016/dev_r6999_CONFIGMAN_1/NEMOGCM/TOOLS/SIREN/src/create_coord.f90 – NEMO

Ignore:
Timestamp:
2016-10-13T11:08:38+02:00 (8 years ago)
Author:
jpaul
Message:

see ticket #1781

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2016/dev_r6999_CONFIGMAN_1/NEMOGCM/TOOLS/SIREN/src/create_coord.f90

    r6393 r7025  
    7676!> 
    7777!>    * _nesting namelist (namnst)_:<br/> 
     78!>       you could define sub domain with coarse grid indices or with coordinates. 
    7879!>       - in_imin0 : i-direction lower left  point indice  
    7980!> of coarse grid subdomain to be used 
     
    8485!>       - in_jmax0 : j-direction upper right point indice 
    8586!> of coarse grid subdomain to be used 
     87!>       - rn_lonmin0 : lower left  longitude of coarse grid subdomain to be used 
     88!>       - rn_lonmax0 : upper right longitude of coarse grid subdomain to be used 
     89!>       - rn_latmin0 : lower left  latitude  of coarse grid subdomain to be used 
     90!>       - rn_latmax0 : upper right latitude  of coarse grid subdomain to be used 
    8691!>       - in_rhoi  : refinement factor in i-direction 
    8792!>       - in_rhoj  : refinement factor in j-direction<br/> 
    8893!> 
    8994!>       \image html  grid_zoom_40.png  
    90 !>       \image latex grid_zoom_40.png 
     95!>       <center> \image latex grid_zoom_40.png  
     96!>       </center> 
    9197!> 
    9298!>    * _output namelist (namout)_: 
     
    102108!> @date September, 2015 
    103109!> - manage useless (dummy) variable, attributes, and dimension 
     110!> @date September, 2016 
     111!> - allow to use coordinate to define subdomain 
    104112!> 
    105113!> @note Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     
    139147   INTEGER(i4)                                          :: il_nvar 
    140148   INTEGER(i4)                                          :: il_ew 
     149   INTEGER(i4)                                          :: il_imin0 
     150   INTEGER(i4)                                          :: il_imax0 
     151   INTEGER(i4)                                          :: il_jmin0 
     152   INTEGER(i4)                                          :: il_jmax0 
     153 
    141154   INTEGER(i4)      , DIMENSION(ip_maxdim)              :: il_rho 
     155   INTEGER(i4)      , DIMENSION(2)                      :: il_index 
    142156   INTEGER(i4)      , DIMENSION(2,2,ip_npoint)          :: il_offset 
    143157 
     
    177191 
    178192   !namnst 
     193   REAL(sp)          :: rn_lonmin0 = -360. 
     194   REAL(sp)          :: rn_lonmax0 = -360. 
     195   REAL(sp)          :: rn_latmin0 = -360. 
     196   REAL(sp)          :: rn_latmax0 = -360. 
    179197   INTEGER(i4)       :: in_imin0 = 0 
    180198   INTEGER(i4)       :: in_imax0 = 0 
     
    207225    
    208226   NAMELIST /namnst/ &  !  nesting namelist 
     227   &  rn_lonmin0, &     !< lower left  coarse grid longitude 
     228   &  rn_lonmax0, &     !< upper right coarse grid longitude 
     229   &  rn_latmin0, &     !< lower left  coarse grid latitude 
     230   &  rn_latmax0, &     !< upper right coarse grid latitude 
    209231   &  in_imin0,   &     !< i-direction lower left  point indice  
    210232   &  in_imax0,   &     !< i-direction upper right point indice 
     
    301323 
    302324   ! check nesting parameters 
    303    IF( in_imin0 < 0 .OR. in_imax0 < 0 .OR. in_jmin0 < 0 .OR. in_jmax0 < 0)THEN 
     325   il_index(:)=0 
     326   IF( rn_lonmin0 >= -180. .AND. rn_lonmin0 <= 360 .AND. & 
     327     & rn_latmin0 >= -90.  .AND. rn_latmin0 <= 90. )THEN 
     328 
     329      il_index(:)=grid_get_closest(tl_coord0, & 
     330         &                         REAL(rn_lonmin0,dp), REAL(rn_latmin0,dp), & 
     331         &                         cd_pos='ll')  
     332      il_imin0=il_index(1) 
     333      il_jmin0=il_index(2) 
     334   ELSE 
     335      il_imin0=in_imin0 
     336      il_jmin0=in_jmin0 
     337   ENDIF 
     338 
     339   il_index(:)=0 
     340   IF( rn_lonmax0 >= -180. .AND. rn_lonmax0 <= 360 .AND. & 
     341     & rn_latmax0 >= -90.  .AND. rn_latmax0 <= 90. )THEN 
     342      il_index(:)=grid_get_closest(tl_coord0, & 
     343         &                         REAL(rn_lonmax0,dp), REAL(rn_latmax0,dp), & 
     344         &                         cd_pos='ur')  
     345      il_imax0=il_index(1) 
     346      il_jmax0=il_index(2) 
     347   ELSE 
     348      il_imax0=in_imax0 
     349      il_jmax0=in_jmax0 
     350   ENDIF 
     351 
     352   ! forced indices for east west cyclic domain 
     353   IF( rn_lonmin0 == rn_lonmax0 .AND. & 
     354     & rn_lonmin0 /= -360. )THEN 
     355      il_imin0=0 
     356      il_imax0=0 
     357   ENDIF 
     358 
     359   IF( il_imin0 < 0 .OR. il_imax0 < 0 .OR. il_jmin0 < 0 .OR. il_jmax0 < 0)THEN 
    304360      CALL logger_fatal("CREATE COORD: invalid points indices."//& 
    305361      &  " check namelist "//TRIM(cl_namelist)) 
     
    318374 
    319375   ! check domain validity 
    320    CALL grid_check_dom(tl_coord0, in_imin0, in_imax0, in_jmin0, in_jmax0 ) 
     376   CALL grid_check_dom(tl_coord0, il_imin0, il_imax0, il_jmin0, il_jmax0 ) 
    321377 
    322378   ! compute domain 
    323379   tl_dom=dom_init( tl_coord0,         & 
    324    &                in_imin0, in_imax0,& 
    325    &                in_jmin0, in_jmax0 ) 
     380   &                il_imin0, il_imax0,& 
     381   &                il_jmin0, il_jmax0 ) 
    326382 
    327383   ! add extra band (if need be) to compute interpolation 
Note: See TracChangeset for help on using the changeset viewer.