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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 139 - (show annotations)
Tue May 26 17:46:03 2015 UTC (8 years, 11 months ago) by guez
File size: 3248 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 startdyn
2
3 ! From startvar.F, version 1.4
4 ! January 27th, 2006 15:14:22
5
6 INTEGER iml_dyn, jml_dyn, llm_dyn
7
8 REAL, pointer:: lon_ini(:), lat_ini(:)
9 ! longitude and latitude from the input file, converted to rad
10
11 real, pointer:: levdyn_ini(:)
12
13 CONTAINS
14
15 SUBROUTINE start_init_dyn(tsol_2d, phis, ps)
16
17 use comgeom, only: aire_2d, apoln, apols
18 use conf_dat2d_m, only: conf_dat2d
19 use dimens_m, only: iim, jjm
20 use dynetat0_m, only: rlonu, rlatv
21 use gr_int_dyn_m, only: gr_int_dyn
22 use inter_barxy_m, only: inter_barxy
23 use netcdf, only: nf90_nowrite
24 use netcdf95, only: nf95_open, nf95_close, nf95_get_var, nf95_inq_varid, &
25 nf95_gw_var, find_coord
26 use nr_util, only: assert, pi
27
28 REAL, intent(in):: tsol_2d(:, :) ! (iim + 1, jjm + 1)
29
30 REAL, intent(in):: phis(:, :) ! (iim + 1, jjm + 1)
31 ! surface geopotential, in m2 s-2
32
33 REAL, intent(out):: ps(:, :) ! (iim + 1, jjm + 1) surface pressure, in Pa
34
35 ! Local:
36
37 INTEGER ncid, varid
38 REAL, ALLOCATABLE:: lon_rad(:), lat_rad(:)
39 REAL, ALLOCATABLE:: var_ana(:, :)
40 real z(iim + 1, jjm + 1)
41 real tmp_var(iim, jjm + 1)
42
43 !--------------------------
44
45 print *, "Call sequence information: start_init_dyn"
46 call assert((/size(tsol_2d, 1), size(phis, 1), size(ps, 1)/) == iim + 1, &
47 "start_init_dyn size 1")
48 call assert((/size(tsol_2d, 2), size(phis, 2), size(ps, 2)/) == jjm + 1, &
49 "start_init_dyn size 2")
50
51 call nf95_open('ECDYN.nc', nf90_nowrite, ncid)
52
53 call find_coord(ncid, varid=varid, std_name="longitude")
54 call nf95_gw_var(ncid, varid, lon_ini)
55 lon_ini = lon_ini * pi / 180. ! convert to rad
56 iml_dyn = size(lon_ini)
57 print *, "iml_dyn = ", iml_dyn
58
59 call find_coord(ncid, varid=varid, std_name="latitude")
60 call nf95_gw_var(ncid, varid, lat_ini)
61 lat_ini = lat_ini * pi / 180. ! convert to rad
62 jml_dyn = size(lat_ini)
63 print *, "jml_dyn = ", jml_dyn
64
65 call nf95_inq_varid(ncid, "level", varid)
66 call nf95_gw_var(ncid, varid, levdyn_ini)
67 llm_dyn = size(levdyn_ini)
68 print *, "llm_dyn = ", llm_dyn
69
70 ALLOCATE(var_ana(iml_dyn, jml_dyn), lon_rad(iml_dyn), lat_rad(jml_dyn))
71
72 ! 'Z': Surface geopotential
73 call nf95_inq_varid(ncid, 'Z', varid)
74 call nf95_get_var(ncid, varid, var_ana)
75 CALL conf_dat2d(lon_ini, lat_ini, lon_rad, lat_rad, var_ana)
76 CALL inter_barxy(lon_rad, lat_rad(:jml_dyn -1), var_ana, rlonu(:iim), &
77 rlatv, tmp_var)
78 z = gr_int_dyn(tmp_var)
79
80 ! 'SP': Surface pressure
81 call nf95_inq_varid(ncid, 'SP', varid)
82 call nf95_get_var(ncid, varid, var_ana)
83 CALL conf_dat2d(lon_ini, lat_ini, lon_rad, lat_rad, var_ana)
84 CALL inter_barxy(lon_rad, lat_rad(:jml_dyn -1), var_ana, rlonu(:iim), &
85 rlatv, tmp_var)
86 ps = gr_int_dyn(tmp_var)
87
88 call nf95_close(ncid)
89
90 ! Adapt the surface pressure to "phis", with the hypsometric equation:
91 ps(:iim, :) = ps(:iim, :) &
92 * (1. + (z(:iim, :) - phis(:iim, :)) / 287. / tsol_2d(:iim, :))
93
94 ps(iim + 1, :) = ps(1, :)
95 ps(:, 1) = SUM(aire_2d(:iim, 1) * ps(:iim, 1)) / apoln
96 ps(:, jjm + 1) = SUM(aire_2d(:iim, jjm + 1) * ps(:iim, jjm + 1)) / apols
97
98 END SUBROUTINE start_init_dyn
99
100 END MODULE startdyn

  ViewVC Help
Powered by ViewVC 1.1.21