/[lmdze]/trunk/Sources/phylmd/getso4fromfile.f
ViewVC logotype

Contents of /trunk/Sources/phylmd/getso4fromfile.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 191 - (show annotations)
Mon May 9 19:56:28 2016 UTC (8 years ago) by guez
File size: 1171 byte(s)
Extracted the call to read_comdissnew out of conf_gcm.

Made ok_instan a variable of module clesphys, itau_phy a variable of
module phyetat0_m, nid_ins a variable of module ini_histins_m, itap a
variable of new module time_phylmdz, so that histwrite_phy can be
called from any procedure without the need to cascade those variables
into that procedure. Made itau_w a variable of module time_phylmdz so
that it is computed only once per time step of physics.

Extracted variables of module clesphys which were in namelist
conf_phys_nml into their own namelist, clesphys_nml, and created
procedure read_clesphys reading clesphys_nml, to avoid side effect.

No need for double precision in procedure getso4fromfile. Assume there
is a single variable for the whole year in the NetCDF file instead of
one variable per month.

Created generic procedure histwrite_phy and removed procedure
write_histins, following LMDZ. histwrite_phy has only two arguments,
can be called from anywhere, and should manage the logic of writing or
not writing into various history files with various operations. So the
test on ok_instan goes inside histwrite_phy.

Test for raz_date in phyetat0 instead of physiq to avoid side effect.

Created procedure increment_itap to avoid side effect.

Removed unnecessary differences between procedures readsulfate and
readsulfate_pi.

1 module getso4fromfile_m
2
3 implicit none
4
5 contains
6
7 SUBROUTINE getso4fromfile(cyr, so4)
8
9 ! Routine for reading SO4 data from files
10
11 USE netcdf, ONLY: nf90_nowrite
12 USE netcdf95, ONLY: nf95_close, nf95_get_var, nf95_inq_varid, &
13 nf95_inquire_dimension, nf95_inquire_variable, nf95_open
14 use nr_util, only: assert
15
16 CHARACTER(len=*), intent(in):: cyr
17 real, intent(out):: so4(:, :, :, :) ! (iim, jjm + 1, klev, 12)
18
19 ! Local:
20 CHARACTER(len=15) fname
21 INTEGER NCID, VARID, nclen(4), i
22 integer, pointer:: dimids(:) ! (4)
23
24 !---------------------------------------------------------------------
25
26 fname = 'aerosols' // cyr // '.nc'
27 print *, 'Reading ', fname
28 call NF95_OPEN(fname, NF90_NOWRITE, NCID)
29 call NF95_INQ_VARID(NCID, "SO4", VARID)
30 call nf95_inquire_variable(ncid, varid, dimids=dimids)
31
32 do i = 1, 4
33 call nf95_inquire_dimension(ncid, dimids(i), nclen=nclen(i))
34 end do
35
36 deallocate(dimids) ! pointer
37 call assert(nclen == shape(so4), "getso4fromfile")
38 call NF95_GET_VAR(NCID, VARID, so4)
39 call NF95_CLOSE(NCID)
40
41 END SUBROUTINE getso4fromfile
42
43 end module getso4fromfile_m

  ViewVC Help
Powered by ViewVC 1.1.21