/[lmdze]/trunk/Sources/dyn3d/grilles_gcm_netcdf_sub.f
ViewVC logotype

Contents of /trunk/Sources/dyn3d/grilles_gcm_netcdf_sub.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 140 - (show annotations)
Fri Jun 5 18:58:06 2015 UTC (8 years, 11 months ago) by guez
File size: 3926 byte(s)
Changed unit of variables lat_min_guide and lat_max_guide from module
conf_guide_m from degrees to rad. Then we do not have to convert the
whole array rlat from rad to degrees in SUBROUTINE tau2alpha.

Removed some useless computations in inigeom.

Removed module coefils. Moved variables sddv, unsddv, sddu, unsddu,
eignfnu, eignfnv of module coefils to module inifgn_m. Downgraded
variables coefilu, coefilu2, coefilv, coefilv2, modfrstu, modfrstv of
module coefils to local variables of SUBROUTINE inifilr.

Write and read a 3-dimensional variable Tsoil in restartphy.nc and
startphy.nc instead of multiple variables for the different
subs-urfaces and soil layers. This does not allow any longer to
provide only the surface value in startphy.nc and spread it to other
layers. Instead, if necessary, pre-process the file startphy.nc to
spread the surface value.

1 module grilles_gcm_netcdf_sub_m
2
3 IMPLICIT NONE
4
5 contains
6
7 SUBROUTINE grilles_gcm_netcdf_sub(phis)
8
9 ! This subroutine creates the file "grilles_gcm.nc" containg
10 ! longitudes and latitudes in degrees for grids u and v.
11
12 USE comconst, ONLY: g
13 USE comgeom, ONLY: aire_2d
14 USE dimens_m, ONLY: iim, jjm
15 use dynetat0_m, only: rlatu, rlatv, rlonu, rlonv
16 USE netcdf, ONLY: nf90_clobber, nf90_float, nf90_int
17 USE netcdf95, ONLY: nf95_close, nf95_create, nf95_def_dim, nf95_def_var, &
18 nf95_enddef, nf95_put_att, nf95_put_var, nf95_redef
19 USE nr_util, ONLY: pi
20 USE start_init_orog_m, ONLY: mask
21
22 REAL, INTENT(IN):: phis(:, :) ! (iim + 1, jjm + 1)
23 ! surface geopotential, in m2 s-2
24
25 ! Local:
26
27 REAL grille_s(iim + 1, jjm + 1)
28 INTEGER i, j
29
30 ! For Netcdf:
31 INTEGER ncid
32 INTEGER dimid_lonu, dimid_lonv, dimid_latu, dimid_latv
33 INTEGER varid_lonu, varid_lonv, varid_latu, varid_latv
34 INTEGER varid
35 INTEGER varid_orog, varid_area, varid_mask
36
37 !-----------------------------------------------------------------
38
39 print *, "Call sequence information: grilles_gcm_netcdf_sub"
40
41 call NF95_CREATE('grilles_gcm.nc', NF90_CLOBBER, ncid)
42
43 call NF95_DEF_DIM(ncid, 'lonu', iim + 1, dimid_lonu)
44 call NF95_DEF_DIM(ncid, 'lonv', iim + 1, dimid_lonv)
45 call NF95_DEF_DIM(ncid, 'latu', jjm + 1, dimid_latu)
46 call NF95_DEF_DIM(ncid, 'latv', jjm, dimid_latv)
47
48 call NF95_DEF_VAR(ncid, 'lonu', NF90_FLOAT, dimid_lonu, varid_lonu)
49 call NF95_PUT_ATT(ncid, varid_lonu, 'units', 'degrees_east')
50 call NF95_PUT_ATT(ncid, varid_lonu, 'long_name', 'Longitude en u')
51
52 call NF95_DEF_VAR(ncid, 'lonv', NF90_FLOAT, dimid_lonv, varid_lonv)
53 call NF95_PUT_ATT(ncid, varid_lonv, 'units', 'degrees_east')
54 call NF95_PUT_ATT(ncid, varid_lonv, 'long_name', 'Longitude en v')
55
56 call NF95_DEF_VAR(ncid, 'latu', NF90_FLOAT, dimid_latu, varid_latu)
57 call NF95_PUT_ATT(ncid, varid_latu, 'units', 'degrees_north')
58 call NF95_PUT_ATT(ncid, varid_latu, 'long_name', 'Latitude en u')
59
60 call NF95_DEF_VAR(ncid, 'latv', NF90_FLOAT, dimid_latv, varid_latv)
61 call NF95_PUT_ATT(ncid, varid_latv, 'units', 'degrees_north')
62 call NF95_PUT_ATT(ncid, varid_latv, 'long_name', 'Latitude en v')
63
64 call NF95_DEF_VAR(ncid, 'grille_u', NF90_FLOAT, (/dimid_lonu, &
65 dimid_latu/), varid)
66 call NF95_PUT_ATT(ncid, varid, 'long_name', 'Grille aux points u')
67
68 call NF95_DEF_VAR(ncid, 'grille_v', NF90_FLOAT, (/dimid_lonv, &
69 dimid_latv/), varid)
70 call NF95_PUT_ATT(ncid, varid, 'long_name', 'Grille aux points v')
71
72 call NF95_DEF_VAR(ncid, 'grille_s', NF90_FLOAT, (/dimid_lonv, &
73 dimid_latu/), varid)
74 call NF95_PUT_ATT(ncid, varid, 'long_name', 'Grille aux points scalaires')
75
76 call NF95_DEF_VAR(ncid, 'orog', NF90_FLOAT, (/dimid_lonv, dimid_latu/), &
77 varid_orog)
78 call NF95_PUT_ATT(ncid, varid_orog, 'units', 'm')
79 call NF95_PUT_ATT(ncid, varid_orog, 'standard_name', 'surface_altitude')
80
81 call NF95_DEF_VAR(ncid, 'aire', NF90_FLOAT, (/dimid_lonv, dimid_latu/), &
82 varid_area)
83 call NF95_PUT_ATT(ncid, varid_area, 'units', 'm2')
84
85 call NF95_DEF_VAR(ncid, 'mask', NF90_INT, (/dimid_lonv, dimid_latu/), &
86 varid_mask)
87
88 call NF95_ENDDEF(ncid)
89
90 call NF95_PUT_VAR(ncid, varid_lonu, rlonu * 180. / pi)
91 call NF95_PUT_VAR(ncid, varid_lonv, rlonv * 180. / pi)
92 call NF95_PUT_VAR(ncid, varid_latu, rlatu * 180. / pi)
93 call NF95_PUT_VAR(ncid, varid_latv, rlatv * 180. / pi)
94
95 forall (i = 1:iim + 1, j = 1:jjm + 1) grille_s(i, j) = MOD(i, 2) + MOD(j, 2)
96 call NF95_PUT_VAR(ncid, varid, grille_s)
97
98 call NF95_PUT_VAR(ncid, varid_orog, phis / g)
99 call NF95_PUT_VAR(ncid, varid_area, aire_2d)
100 call NF95_PUT_VAR(ncid, varid_mask, nINT(mask))
101
102 CALL nf95_close(ncid)
103
104 END SUBROUTINE grilles_gcm_netcdf_sub
105
106 end module grilles_gcm_netcdf_sub_m

  ViewVC Help
Powered by ViewVC 1.1.21