source: LMDZ4/branches/LMDZ4-dev-20091210/libf/bibio/nf95_put_var_m.F90 @ 1911

Last change on this file since 1911 was 1263, checked in by lguez, 15 years ago

1) Reactivated ability to read ozone (that was deactivated because of
dependency on version of IOIPSL). Added ability to read a pressure
coordinate in Pa in "regr_lat_time_climoz".

2) Added the ability to read a second ozone climatology, corresponding to
daylight ozone:

-- "read_climoz" is now an integer variable, instead of a logical
variable.

-- Added argument "read_climoz" to "phys_state_var_init",
"phys_output_open" and "regr_lat_time_climoz".

-- Created new variable "ozone_daylight" for "hist*.nc" output files.

-- Added a third dimension to variable "wo" in module
"phys_state_var_mod" and variable "POZON" in "radlwsw": index 1 for
average day-night ozone, index 2 for daylight ozone.

-- Added a fourth dimension to variables "o3_in", "o3_regr_lat" and
"o3_out" in "regr_lat_time_climoz": index 1 for average day-night
ozone, index 2 for daylight ozone.

-- In "physiq", moved call to "conf_phys" before call to
"phys_state_var_init". Thus, "conf_phys" is now inside the block "if
(first)" instead of "IF (debut)". There were definitions of "bl95_b0"
and "bl95_b1" that were useless because the variables were overwritten
by "conf_phys". Removed those definitions.

-- In "radlwsw", we pass the average day-night ozone to "LW_LMDAR4"
and the daylight ozone, if we have it, to "SW_LMDAR4" or
"SW_AEROAR4". If we do not have a specific field for daylight ozone
then "SW_LMDAR4" or "SW_AEROAR4" just get the average day-night ozone.

-- "regr_lat_time_climoz" now manages latitudes where the input ozone
field is missing at all levels (polar night).

-- Encapsulated "radlwsw" in a module.

3) Modifications to make sequential and parallel versions of
"create_etat0_limit" almost identical:

-- In "dyn3dpar/create_etat0_limit.F". No need to call
"phys_state_var_init", removed "use phys_state_var_mod" statement. No
need for "clesphys.h", removed "include" statement.

-- In "dyn3dpar/etat0_netcdf.F". Added argument "tau_ratqs" in call to
"conf_phys" (this bug was already corrected in "dyn3d"). Moved call to
"inifilr" after call to "infotrac_init" (as in "dyn3d").

4) Other peripheral modifications:

-- Added procedures "nf95_get_att" and "nf95_def_var_scalar" in
NetCDF95 interface. Overloaded "nf95_put_var" with three more
procedures: "nf95_put_var_FourByteReal", "nf95_put_var_FourByteInt",
"nf95_put_var_1D_FourByteInt".

-- Overloaded "regr1_step_av" with one more procedure:
"regr14_step_av". Overloaded "regr3_lint" with one more procedure:
"regr34_lint".

-- Corrected call to "Init_Phys_lmdz" in "dyn3d/create_etat0_limit.F":
the last argument should be an array, not a scalar.

-- Encapsulated "conf_phys" in a module.

-- Splitted module "regr_pr" into "regr_pr_av_m" and "regr_pr_int_m".

5) Tests:

This revision was compared to revision 1259, with optimization options
"debug" and "dev", parallelization options "none", "mpi", "omp" and
"mpi_omp", 1 and 2 MPI processes, 1 and 2 OpenMP threads, with the
compiler "FORTRAN90/SX Version 2.0 for SX-8". Both programs
"create_etat0_limit" and "gcm" were tested. In all cases,
parallelization does not change the results. With "read_climoz = 0" in
the ".def" files, the results of revision 1259 and of this revision
are the same.

File size: 8.1 KB
Line 
1! $Id$
2module nf95_put_var_m
3
4  implicit none
5
6  interface nf95_put_var
7     module procedure nf95_put_var_FourByteReal, nf95_put_var_FourByteInt, &
8          nf95_put_var_1D_FourByteReal, nf95_put_var_1D_FourByteInt, &
9          nf95_put_var_2D_FourByteReal, nf95_put_var_3D_FourByteReal, &
10          nf95_put_var_4D_FourByteReal
11!!$     module procedure nf95_put_var_1D_FourByteReal, &
12!!$          nf95_put_var_2D_FourByteReal, nf95_put_var_3D_FourByteReal, &
13!!$          nf95_put_var_4D_FourByteReal, nf90_put_var_1D_EightByteReal, &
14!!$          nf90_put_var_3D_EightByteReal
15  end interface
16
17  private
18  public nf95_put_var
19
20contains
21
22  subroutine nf95_put_var_FourByteReal(ncid, varid, values, start, ncerr)
23
24    use netcdf, only: nf90_put_var
25    use handle_err_m, only: handle_err
26
27    integer, intent( in) :: ncid, varid
28    real, intent( in) :: values
29    integer, dimension(:), optional, intent( in) :: start
30    integer, intent(out), optional:: ncerr
31
32    ! Variable local to the procedure:
33    integer ncerr_not_opt
34
35    !-------------------
36
37    ncerr_not_opt = nf90_put_var(ncid, varid, values, start)
38    if (present(ncerr)) then
39       ncerr = ncerr_not_opt
40    else
41       call handle_err("nf95_put_var_FourByteReal", ncerr_not_opt, ncid, &
42            varid)
43    end if
44
45  end subroutine nf95_put_var_FourByteReal
46
47  !***********************
48
49  subroutine nf95_put_var_FourByteInt(ncid, varid, values, start, ncerr)
50
51    use netcdf, only: nf90_put_var
52    use handle_err_m, only: handle_err
53
54    integer, intent( in) :: ncid, varid
55    integer, intent( in) :: values
56    integer, dimension(:), optional, intent( in) :: start
57    integer, intent(out), optional:: ncerr
58
59    ! Variable local to the procedure:
60    integer ncerr_not_opt
61
62    !-------------------
63
64    ncerr_not_opt = nf90_put_var(ncid, varid, values, start)
65    if (present(ncerr)) then
66       ncerr = ncerr_not_opt
67    else
68       call handle_err("nf95_put_var_FourByteInt", ncerr_not_opt, ncid, &
69            varid)
70    end if
71
72  end subroutine nf95_put_var_FourByteInt
73
74  !***********************
75
76  subroutine nf95_put_var_1D_FourByteReal(ncid, varid, values, start, count, &
77       stride, map, ncerr)
78
79    use netcdf, only: nf90_put_var
80    use handle_err_m, only: handle_err
81
82    integer,                         intent(in) :: ncid, varid
83    real, intent(in) :: values(:)
84    integer, dimension(:), optional, intent(in) :: start, count, stride, map
85    integer, intent(out), optional:: ncerr
86
87    ! Variable local to the procedure:
88    integer ncerr_not_opt
89
90    !-------------------
91
92    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count, stride, &
93         map)
94    if (present(ncerr)) then
95       ncerr = ncerr_not_opt
96    else
97       call handle_err("nf95_put_var_1D_FourByteReal", ncerr_not_opt, ncid, &
98            varid)
99    end if
100
101  end subroutine nf95_put_var_1D_FourByteReal
102
103  !***********************
104
105  subroutine nf95_put_var_1D_FourByteInt(ncid, varid, values, start, count, &
106       stride, map, ncerr)
107
108    use netcdf, only: nf90_put_var
109    use handle_err_m, only: handle_err
110
111    integer,                         intent(in) :: ncid, varid
112    integer, intent(in) :: values(:)
113    integer, dimension(:), optional, intent(in) :: start, count, stride, map
114    integer, intent(out), optional:: ncerr
115
116    ! Variable local to the procedure:
117    integer ncerr_not_opt
118
119    !-------------------
120
121    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count, stride, &
122         map)
123    if (present(ncerr)) then
124       ncerr = ncerr_not_opt
125    else
126       call handle_err("nf95_put_var_1D_FourByteInt", ncerr_not_opt, ncid, &
127            varid)
128    end if
129
130  end subroutine nf95_put_var_1D_FourByteInt
131
132  !***********************
133
134  subroutine nf95_put_var_2D_FourByteReal(ncid, varid, values, start, count, &
135       stride, map, ncerr)
136
137    use netcdf, only: nf90_put_var
138    use handle_err_m, only: handle_err
139
140    integer,                         intent( in) :: ncid, varid
141    real, intent( in) :: values(:, :)
142    integer, dimension(:), optional, intent( in) :: start, count, stride, map
143    integer, intent(out), optional:: ncerr
144
145    ! Variable local to the procedure:
146    integer ncerr_not_opt
147
148    !-------------------
149
150    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count, stride, &
151         map)
152    if (present(ncerr)) then
153       ncerr = ncerr_not_opt
154    else
155       call handle_err("nf95_put_var_2D_FourByteReal", ncerr_not_opt, ncid, &
156            varid)
157    end if
158
159  end subroutine nf95_put_var_2D_FourByteReal
160
161  !***********************
162
163  subroutine nf95_put_var_3D_FourByteReal(ncid, varid, values, start, count, &
164       stride, map, ncerr)
165
166    use netcdf, only: nf90_put_var
167    use handle_err_m, only: handle_err
168
169    integer,                         intent( in) :: ncid, varid
170    real, intent( in) :: values(:, :, :)
171    integer, dimension(:), optional, intent( in) :: start, count, stride, map
172    integer, intent(out), optional:: ncerr
173
174    ! Variable local to the procedure:
175    integer ncerr_not_opt
176
177    !-------------------
178
179    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count, stride, &
180         map)
181    if (present(ncerr)) then
182       ncerr = ncerr_not_opt
183    else
184       call handle_err("nf95_put_var_3D_FourByteReal", ncerr_not_opt, ncid, &
185            varid)
186    end if
187
188  end subroutine nf95_put_var_3D_FourByteReal
189
190  !***********************
191
192  subroutine nf95_put_var_4D_FourByteReal(ncid, varid, values, start, count, &
193       stride, map, ncerr)
194
195    use netcdf, only: nf90_put_var
196    use handle_err_m, only: handle_err
197
198    integer,                         intent( in) :: ncid, varid
199    real, intent( in) :: values(:, :, :, :)
200    integer, dimension(:), optional, intent( in) :: start, count, stride, map
201    integer, intent(out), optional:: ncerr
202
203    ! Variable local to the procedure:
204    integer ncerr_not_opt
205
206    !-------------------
207
208    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count, stride, &
209         map)
210    if (present(ncerr)) then
211       ncerr = ncerr_not_opt
212    else
213       call handle_err("nf95_put_var_4D_FourByteReal", ncerr_not_opt, ncid, &
214            varid)
215    end if
216
217  end subroutine nf95_put_var_4D_FourByteReal
218
219  !***********************
220
221!!$  subroutine nf90_put_var_1D_EightByteReal(ncid, varid, values, start, count, &
222!!$       stride, map, ncerr)
223!!$
224!!$    use typesizes, only: eightByteReal
225!!$    use netcdf, only: nf90_put_var
226!!$    use handle_err_m, only: handle_err
227!!$
228!!$    integer,                         intent( in) :: ncid, varid
229!!$    real (kind = EightByteReal),     intent( in) :: values(:)
230!!$    integer, dimension(:), optional, intent( in) :: start, count, stride, map
231!!$    integer, intent(out), optional:: ncerr
232!!$
233!!$    ! Variable local to the procedure:
234!!$    integer ncerr_not_opt
235!!$
236!!$    !-------------------
237!!$
238!!$    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count, stride, &
239!!$         map)
240!!$    if (present(ncerr)) then
241!!$       ncerr = ncerr_not_opt
242!!$    else
243!!$       call handle_err("nf95_put_var_1D_eightByteReal", ncerr_not_opt, ncid, &
244!!$            varid)
245!!$    end if
246!!$
247!!$  end subroutine nf90_put_var_1D_EightByteReal
248!!$
249!!$  !***********************
250!!$
251!!$  subroutine nf90_put_var_3D_EightByteReal(ncid, varid, values, start, count, &
252!!$       stride, map, ncerr)
253!!$
254!!$    use typesizes, only: eightByteReal
255!!$    use netcdf, only: nf90_put_var
256!!$    use handle_err_m, only: handle_err
257!!$
258!!$    integer,                         intent( in) :: ncid, varid
259!!$    real (kind = EightByteReal),     intent( in) :: values(:, :, :)
260!!$    integer, dimension(:), optional, intent( in) :: start, count, stride, map
261!!$    integer, intent(out), optional:: ncerr
262!!$
263!!$    ! Variable local to the procedure:
264!!$    integer ncerr_not_opt
265!!$
266!!$    !-------------------
267!!$
268!!$    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count, stride, &
269!!$         map)
270!!$    if (present(ncerr)) then
271!!$       ncerr = ncerr_not_opt
272!!$    else
273!!$       call handle_err("nf95_put_var_3D_eightByteReal", ncerr_not_opt, ncid, &
274!!$            varid)
275!!$    end if
276!!$
277!!$  end subroutine nf90_put_var_3D_EightByteReal
278
279end module nf95_put_var_m
Note: See TracBrowser for help on using the repository browser.