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

Contents of /trunk/dyn3d/grilles_gcm_netcdf_sub.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 139 - (show annotations)
Tue May 26 17:46:03 2015 UTC (9 years ago) by guez
Original Path: trunk/Sources/dyn3d/grilles_gcm_netcdf_sub.f
File size: 3922 byte(s)
dynetat0 read rlonu, rlatu, rlonv, rlatv, cu_2d, cv_2d, aire_2d from
"start.nc" and then these variables were overwritten by
inigeom. Corrected this. Now, inigeom does not compute rlonu, rlatu,
rlonv and rlatv. Moreover, cu_2d, cv_2d, aire_2d are not written to
"restart.nc". Since xprimu, xprimv, xprimm025, xprimp025, rlatu1,
rlatu2, yprimu1, yprimu2 are computed at the same time as rlonu,
rlatu, rlonv, rlatv, and since it would not be convenient to separate
those computations, we decide to write xprimu, xprimv, xprimm025,
xprimp025, rlatu1, rlatu2, yprimu1, yprimu2 into "restart.nc", read
them from "start.nc" and not compute them in inigeom. So, in summary,
"start.nc" contains all the coordinates and their derivatives, and
inigeom only computes the 2D-variables.

Technical details:

Moved variables rlatu, rlonv, rlonu, rlatv, xprimu, xprimv from module
comgeom to module dynetat0_m. Upgraded local variables rlatu1,
yprimu1, rlatu2, yprimu2, xprimm025, xprimp025 of procedure inigeom to
variables of module dynetat0_m.

Removed unused local variable yprimu of procedure inigeom and
corresponding argument yyprimu of fyhyp.

Moved variables clat, clon, grossismx, grossismy, dzoomx, dzoomy,
taux, tauy from module serre to module dynetat0_m (since they are read
from "start.nc"). The default values are now defined in read_serre
instead of in the declarations. Changed name of module serre to
read_serre_m, no more module variable here.

The calls to fxhyp and fyhyp are moved from inigeom to etat0.

Side effects in programs other than gcm: etat0 and read_serre write
variables of module dynetat0; the programs test_fxyp and
test_inter_barxy need more source files.

Removed unused arguments len and nd of cv3_tracer. Removed unused
argument PPSOL of LWU.

Bug fix in test_inter_barxy: forgotten call to read_serre.

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