source: dynamico_lmdz/aquaplanet/LMDZ5/libf/phylmd/open_climoz_m.F90 @ 3983

Last change on this file since 3983 was 3895, checked in by ymipsl, 9 years ago

Make LMDZ5 be compliant to generate initiale state and compute in openMP mode suing unstructured grid.

YM

File size: 2.0 KB
Line 
1! $Id$
2module open_climoz_m
3
4  implicit none
5
6contains
7
8  subroutine open_climoz(ncid, press_in_edg)
9
10    ! This procedure should be called once per "gcm" run, by a single
11    ! thread of each MPI process.
12    ! The root MPI process opens "climoz_LMDZ.nc", reads the pressure
13    ! levels and broadcasts them to the other processes.
14
15    ! We assume that, in "climoz_LMDZ.nc", the pressure levels are in hPa
16    ! and in strictly ascending order.
17
18    use netcdf95, only: nf95_open, nf95_close, nf95_gw_var, nf95_inq_varid
19    use netcdf, only: nf90_nowrite
20    use mod_phys_lmdz_para, only : is_master, bcast
21
22    integer, intent(out):: ncid ! of "climoz_LMDZ.nc", OpenMP shared
23
24    real, pointer:: press_in_edg(:)
25    ! edges of pressure intervals for ozone climatology, in Pa, in strictly
26    ! ascending order, OpenMP shared
27
28    ! Variables local to the procedure:
29
30    real, pointer:: plev(:)
31    ! (pressure levels for ozone climatology, converted to Pa, in strictly
32    ! ascending order)
33
34    integer varid ! for NetCDF
35    integer n_plev ! number of pressure levels in the input data
36    integer k
37
38    !---------------------------------------
39
40    print *, "Call sequence information: open_climoz"
41    if (is_master) then
42       call nf95_open("climoz_LMDZ.nc", nf90_nowrite, ncid)
43
44       call nf95_inq_varid(ncid, "plev", varid)
45       call nf95_gw_var(ncid, varid, plev)
46       ! Convert from hPa to Pa because "paprs" and "pplay" are in Pa:
47       plev = plev * 100.
48       n_plev = size(plev)
49     endif
50     CALL bcast(n_plev)
51     ALLOCATE(press_in_edg(n_plev + 1))
52     if (is_master) THEN
53       press_in_edg(1) = 0.
54       ! We choose edges halfway in logarithm:
55       forall (k = 2:n_plev) press_in_edg(k) = sqrt(plev(k - 1) * plev(k))
56       press_in_edg(n_plev + 1) = huge(0.)
57       ! (infinity, but any value guaranteed to be greater than the
58       ! surface pressure would do)
59       deallocate(plev) ! pointer
60     endif
61     call bcast(press_in_edg)
62
63  end subroutine open_climoz
64
65end module open_climoz_m
Note: See TracBrowser for help on using the repository browser.