SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
grid_from_file.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 ! #########
6  SUBROUTINE grid_from_file (&
7  hprogram,hfile,hfiletype,ogrid,hgrid,kgrid_par,pgrid_par,kl)
8 ! ##########################################################
9 !!
10 !! PURPOSE
11 !! -------
12 !! Reads in namelist the grid type and parameters.
13 !!
14 !! METHOD
15 !! ------
16 !!
17 !! EXTERNAL
18 !! --------
19 !!
20 !!
21 !! IMPLICIT ARGUMENTS
22 !! ------------------
23 !!
24 !!
25 !! REFERENCE
26 !! ---------
27 !!
28 !! AUTHOR
29 !! ------
30 !!
31 !! V. Masson Meteo-France
32 !!
33 !! MODIFICATION
34 !! ------------
35 !!
36 !! Original 01/2004
37 !----------------------------------------------------------------------------
38 !
39 !* 0. DECLARATION
40 ! -----------
41 !
42 !
43 !
44 !
45 USE modi_open_aux_io_surf
46 USE modi_read_gridtype
47 USE modi_close_aux_io_surf
49 USE modi_open_namelist
50 USE modi_close_namelist
51 USE modi_grid_modif
52 !
53 USE yomhook ,ONLY : lhook, dr_hook
54 USE parkind1 ,ONLY : jprb
55 !
56 USE modi_get_luout
57 IMPLICIT NONE
58 !
59 !* 0.1 Declaration of dummy arguments
60 ! ------------------------------
61 !
62 !
63 !
64  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! program calling the surface
65  CHARACTER(LEN=28), INTENT(IN) :: hfile ! file name
66  CHARACTER(LEN=6), INTENT(IN) :: hfiletype ! file type
67 LOGICAL, INTENT(IN) :: ogrid ! .true. if grid is imposed by atm. model
68  CHARACTER(LEN=10), INTENT(OUT) :: hgrid ! type of horizontal grid
69 INTEGER, INTENT(OUT) :: kgrid_par ! size of PGRID_PAR
70 REAL, DIMENSION(:), POINTER :: pgrid_par ! parameters defining this grid
71 INTEGER, INTENT(OUT) :: kl ! number of points on processor
72 !
73 !
74 !* 0.2 Declaration of local variables
75 ! ------------------------------
76 !
77 INTEGER :: iluout ! listing file logical unit
78 INTEGER :: ilunam ! namelist file logical unit
79 INTEGER :: iresp ! return code
80 REAL(KIND=JPRB) :: zhook_handle
81 !
82 !* 0.3 Declaration of namelists
83 ! ------------------------
84 !
85 !------------------------------------------------------------------------------
86 !
87 !* 1. Defaults
88 ! --------
89 !
90 IF (lhook) CALL dr_hook('GRID_FROM_FILE',0,zhook_handle)
91  CALL get_luout(hprogram,iluout)
92 !
93 !---------------------------------------------------------------------------
94 !
95 !* 2. Opening of the file
96 ! -------------------
97 !
98  CALL open_aux_io_surf(&
99  hfile,hfiletype,'FULL ')
100 !
101 !---------------------------------------------------------------------------
102 !
103 !* 3. Number of points in this file
104 ! -----------------------------
105 !
106  CALL read_surf(&
107  hfiletype,'DIM_FULL ',kl,iresp)
108 !
109 !---------------------------------------------------------------------------
110 !
111 !* 4. Grid type
112 ! ---------
113 !
114  CALL read_surf(&
115  hfiletype,'GRID_TYPE',hgrid,iresp)
116 !
117 !---------------------------------------------------------------------------
118 !
119 !* 5. Reading parameters of the grid
120 ! ------------------------------
121 !
122  CALL read_gridtype(&
123  hfiletype,hgrid,kgrid_par,kl,.false.,hdir='A')
124 !
125 ALLOCATE(pgrid_par(kgrid_par))
126  CALL read_gridtype(&
127  hfiletype,hgrid,kgrid_par,kl,.true.,pgrid_par,iresp,hdir='A')
128 !
129 !---------------------------------------------------------------------------
130 !
131 !* 6. Closes the file
132 ! ---------------
133 !
134  CALL close_aux_io_surf(hfile,hfiletype)
135 !
136 !------------------------------------------------------------------------------
137 !
138 !* 7. Open namelist
139 ! -------------
140 !
141  CALL open_namelist(hprogram,ilunam)
142 !
143 !------------------------------------------------------------------------------
144 !
145 !* 8. Grid modification
146 ! -----------------
147 !
148 IF (.NOT. ogrid) CALL grid_modif(iluout,ilunam,hgrid,kgrid_par,pgrid_par,kl)
149 !
150 !------------------------------------------------------------------------------
151 !
152 !* 9. Close namelist
153 ! --------------
154 !
155  CALL close_namelist(hprogram,ilunam)
156 IF (lhook) CALL dr_hook('GRID_FROM_FILE',1,zhook_handle)
157 !
158 !-------------------------------------------------------------------------------
159 !
160 END SUBROUTINE grid_from_file
subroutine read_gridtype(HPROGRAM, HGRID, KGRID_PAR, KLU, OREAD, PGRID_PAR, KRESP, HDIR)
subroutine grid_from_file(HPROGRAM, HFILE, HFILETYPE, OGRID, HGRID, KGRID_PAR, PGRID_PAR, KL)
subroutine close_aux_io_surf(HFILE, HFILETYPE)
subroutine open_aux_io_surf(HFILE, HFILETYPE, HMASK)
subroutine grid_modif(KLUOUT, KLUNAM, HGRID, KGRID_PAR, PGRID_PAR, KL)
Definition: grid_modif.F90:6
subroutine close_namelist(HPROGRAM, KLUNAM)
subroutine get_luout(HPROGRAM, KLUOUT)
Definition: get_luout.F90:6
subroutine open_namelist(HPROGRAM, KLUNAM, HFILE)