SURFEX v7.3
General documentation of Surfex
|
00001 ! ################################################################ 00002 SUBROUTINE GRID_MODIF_CONF_PROJ(KLUOUT,KLUNAM,KGRID_PAR,KL,PGRID_PAR, & 00003 KGRID_PAR2,KL2,OMODIF,PGRID_PAR2 ) 00004 ! ################################################################ 00005 ! 00006 !!**** *GRID_MODIF_CONF_PROJ* - routine to read in namelist the horizontal grid 00007 !! 00008 !! PURPOSE 00009 !! ------- 00010 !! 00011 !!** METHOD 00012 !! ------ 00013 !! 00014 !! EXTERNAL 00015 !! -------- 00016 !! 00017 !! 00018 !! IMPLICIT ARGUMENTS 00019 !! ------------------ 00020 !! 00021 !! REFERENCE 00022 !! --------- 00023 !! 00024 !! 00025 !! AUTHOR 00026 !! ------ 00027 !! V. Masson *Meteo France* 00028 !! 00029 !! MODIFICATIONS 00030 !! ------------- 00031 !! Original 01/2004 00032 !------------------------------------------------------------------------------- 00033 ! 00034 !* 0. DECLARATIONS 00035 ! ------------ 00036 ! 00037 USE MODD_SURF_PAR, ONLY : NUNDEF 00038 00039 USE MODE_POS_SURF 00040 USE MODE_GRIDTYPE_CONF_PROJ 00041 ! 00042 ! 00043 USE YOMHOOK ,ONLY : LHOOK, DR_HOOK 00044 USE PARKIND1 ,ONLY : JPRB 00045 ! 00046 USE MODI_REGULAR_GRID_SPAWN 00047 ! 00048 IMPLICIT NONE 00049 ! 00050 !* 0.1 Declarations of arguments 00051 ! ------------------------- 00052 ! 00053 INTEGER, INTENT(IN) :: KLUOUT ! output listing logical unit 00054 INTEGER, INTENT(IN) :: KLUNAM ! namelist file logical unit 00055 INTEGER, INTENT(IN) :: KL ! number of points 00056 INTEGER, INTENT(IN) :: KGRID_PAR ! size of PGRID_PAR 00057 REAL, DIMENSION(KGRID_PAR), INTENT(IN) :: PGRID_PAR ! parameters defining the grid 00058 INTEGER, INTENT(INOUT) :: KL2 ! number of points in modified grid 00059 INTEGER, INTENT(INOUT) :: KGRID_PAR2 ! size of PGRID_PAR2 00060 LOGICAL, INTENT(IN) :: OMODIF ! flag to modify the grid 00061 REAL, DIMENSION(KGRID_PAR2), INTENT(OUT) :: PGRID_PAR2 ! parameters defining the modified grid 00062 ! 00063 !* 0.2 Declarations of local variables 00064 ! ------------------------------- 00065 ! 00066 !* initial grid 00067 REAL :: ZLAT0 ! reference latitude 00068 REAL :: ZLON0 ! reference longitude 00069 REAL :: ZRPK ! projection parameter 00070 ! ! K=1 : stereographic north pole 00071 ! ! 0<K<1 : Lambert, north hemisphere 00072 ! ! K=0 : Mercator 00073 ! !-1<K<0 : Lambert, south hemisphere 00074 ! ! K=-1: stereographic south pole 00075 REAL :: ZBETA ! angle between grid and reference longitude 00076 REAL :: ZLATOR ! latitude of point of coordinates X=0, Y=0 00077 REAL :: ZLONOR ! longitude of point of coordinates X=0, Y=0 00078 INTEGER :: IIMAX1 ! number of points in I direction 00079 INTEGER :: IJMAX1 ! number of points in J direction 00080 REAL, DIMENSION(:), ALLOCATABLE :: ZX1 ! X conformal coordinate of grid mesh 00081 REAL, DIMENSION(:), ALLOCATABLE :: ZY1 ! Y conformal coordinate of grid mesh 00082 REAL, DIMENSION(:), ALLOCATABLE :: ZDX1 ! X grid mesh size 00083 REAL, DIMENSION(:), ALLOCATABLE :: ZDY1 ! Y grid mesh size 00084 ! 00085 !* new grid 00086 INTEGER :: IIMAX2 ! number of points in I direction 00087 INTEGER :: IJMAX2 ! number of points in J direction 00088 REAL, DIMENSION(:), ALLOCATABLE :: ZX2 ! X conformal coordinate of grid mesh 00089 REAL, DIMENSION(:), ALLOCATABLE :: ZY2 ! Y conformal coordinate of grid mesh 00090 REAL, DIMENSION(:), ALLOCATABLE :: ZDX2 ! X grid mesh size 00091 REAL, DIMENSION(:), ALLOCATABLE :: ZDY2 ! Y grid mesh size 00092 ! 00093 !* other variables 00094 LOGICAL :: GFOUND 00095 REAL, DIMENSION(:), POINTER :: ZGRID_PAR 00096 ! 00097 ! 00098 !* 0.3 Declarations of namelist 00099 ! ------------------------ 00100 ! 00101 INTEGER :: IXOR = 1 ! position of modified bottom left point 00102 INTEGER :: IYOR = 1 ! according to initial grid 00103 INTEGER :: IXSIZE = -999 ! number of grid meshes in initial grid to be 00104 INTEGER :: IYSIZE = -999 ! covered by the modified grid 00105 INTEGER :: IDXRATIO = 1 ! resolution ratio between modified grid 00106 INTEGER :: IDYRATIO = 1 ! and initial grid 00107 REAL(KIND=JPRB) :: ZHOOK_HANDLE 00108 ! 00109 ! 00110 NAMELIST/NAM_INIFILE_CONF_PROJ/IXOR,IYOR,IXSIZE,IYSIZE,IDXRATIO,IDYRATIO 00111 ! 00112 !------------------------------------------------------------------------------ 00113 ! 00114 !* 1. Reading of projection parameters 00115 ! -------------------------------- 00116 ! 00117 IF (LHOOK) CALL DR_HOOK('GRID_MODIF_CONF_PROJ',0,ZHOOK_HANDLE) 00118 CALL POSNAM(KLUNAM,'NAM_INIFILE_CONF_PROJ',GFOUND,KLUOUT) 00119 IF (GFOUND) READ(UNIT=KLUNAM,NML=NAM_INIFILE_CONF_PROJ) 00120 ! 00121 !--------------------------------------------------------------------------- 00122 ! 00123 !* 2. All this information stored into pointer PGRID_PAR 00124 ! -------------------------------------------------- 00125 ! 00126 ALLOCATE(ZX1 (KL)) 00127 ALLOCATE(ZY1 (KL)) 00128 ALLOCATE(ZDX1(KL)) 00129 ALLOCATE(ZDY1(KL)) 00130 ! 00131 CALL GET_GRIDTYPE_CONF_PROJ(PGRID_PAR,ZLAT0,ZLON0,ZRPK,ZBETA, & 00132 ZLATOR,ZLONOR, & 00133 IIMAX1,IJMAX1, & 00134 ZX1,ZY1,ZDX1,ZDY1 ) 00135 ! 00136 !--------------------------------------------------------------------------- 00137 ! 00138 !* 3. Default : no modification 00139 ! ------------------------- 00140 ! 00141 IF (IXSIZE==-999) IXSIZE=IIMAX1 00142 IF (IYSIZE==-999) IYSIZE=IJMAX1 00143 ! 00144 !--------------------------------------------------------------------------- 00145 ! 00146 !* 4. Modification of the grid 00147 ! ------------------------ 00148 ! 00149 !* number of points 00150 ! 00151 IIMAX2=IXSIZE*IDXRATIO 00152 IJMAX2=IYSIZE*IDYRATIO 00153 ! 00154 KL2 = IIMAX2 * IJMAX2 00155 ! 00156 ALLOCATE(ZX2 (IIMAX2*IJMAX2)) 00157 ALLOCATE(ZY2 (IIMAX2*IJMAX2)) 00158 ALLOCATE(ZDX2(IIMAX2*IJMAX2)) 00159 ALLOCATE(ZDY2(IIMAX2*IJMAX2)) 00160 ! 00161 CALL REGULAR_GRID_SPAWN(KLUOUT, & 00162 KL, IIMAX1,IJMAX1,ZX1,ZY1,ZDX1,ZDY1, & 00163 IXOR, IYOR, IDXRATIO, IDYRATIO, & 00164 IXSIZE, IYSIZE, & 00165 KL2, IIMAX2,IJMAX2,ZX2,ZY2,ZDX2,ZDY2 ) 00166 DEALLOCATE(ZX1) 00167 DEALLOCATE(ZY1) 00168 DEALLOCATE(ZDX1) 00169 DEALLOCATE(ZDY1) 00170 ! 00171 !--------------------------------------------------------------------------- 00172 ! 00173 !* 5. All this information stored into pointer PGRID_PAR 00174 ! -------------------------------------------------- 00175 ! 00176 CALL PUT_GRIDTYPE_CONF_PROJ(ZGRID_PAR,ZLAT0,ZLON0,ZRPK,ZBETA, & 00177 ZLATOR,ZLONOR, & 00178 IIMAX2,IJMAX2, & 00179 ZX2,ZY2,ZDX2,ZDY2 ) 00180 ! 00181 !--------------------------------------------------------------------------- 00182 DEALLOCATE(ZX2) 00183 DEALLOCATE(ZY2) 00184 DEALLOCATE(ZDX2) 00185 DEALLOCATE(ZDY2) 00186 !--------------------------------------------------------------------------- 00187 ! 00188 !* 1st call : initializes dimension 00189 ! 00190 IF (KGRID_PAR2==0) THEN 00191 KGRID_PAR2 = SIZE(ZGRID_PAR) 00192 ! 00193 ELSE 00194 ! 00195 !* 2nd call : initializes grid array 00196 ! 00197 PGRID_PAR2(:) = 0. 00198 PGRID_PAR2(:) = ZGRID_PAR 00199 END IF 00200 ! 00201 DEALLOCATE(ZGRID_PAR) 00202 IF (LHOOK) CALL DR_HOOK('GRID_MODIF_CONF_PROJ',1,ZHOOK_HANDLE) 00203 ! 00204 !--------------------------------------------------------------------------- 00205 ! 00206 END SUBROUTINE GRID_MODIF_CONF_PROJ