! $Id$ module press_coefoz_m IMPLICIT NONE REAL, ALLOCATABLE, save:: plev(:) ! (pressure level of Mobidic input data, converted to Pa, in strictly ! ascending order) REAL, ALLOCATABLE, save:: press_in_edg(:) ! (edges of pressure intervals for Mobidic input data, in Pa, in strictly ! ascending order) CONTAINS SUBROUTINE press_coefoz ! This procedure is called once per "gcm" run. ! A single thread of the root process reads the pressure levels ! from "coefoz_LMDZ.nc" and broadcasts them to the other processes. ! We assume that, in "coefoz_LMDZ.nc", the pressure levels are in hPa ! and in strictly ascending order. USE netcdf95, ONLY: nf95_open, nf95_close, nf95_gw_var, nf95_inq_varid USE netcdf, ONLY: nf90_nowrite USE lmdz_phys_mpi_data, ONLY: is_mpi_root USE lmdz_phys_mpi_transfert, ONLY: bcast_mpi ! broadcast ! Variables local to the procedure: INTEGER ncid, varid ! for NetCDF INTEGER n_plev ! number of pressure levels in the input data INTEGER k !--------------------------------------- !$omp single PRINT *, "Call sequence information: press_coefoz" IF (is_mpi_root) THEN CALL nf95_open("coefoz_LMDZ.nc", nf90_nowrite, ncid) CALL nf95_inq_varid(ncid, "plev", varid) CALL nf95_gw_var(ncid, varid, plev) ! Convert from hPa to Pa because "paprs" and "pplay" are in Pa: plev = plev * 100. n_plev = size(plev) CALL nf95_close(ncid) end if CALL bcast_mpi(n_plev) IF (.NOT. is_mpi_root) allocate(plev(n_plev)) CALL bcast_mpi(plev) ! Compute edges of pressure intervals: allocate(press_in_edg(n_plev + 1)) IF (is_mpi_root) THEN press_in_edg(1) = 0. ! We choose edges halfway in logarithm: DO k = 2,n_plev press_in_edg(k) = SQRT(plev(k - 1) * plev(k)) ENDDO press_in_edg(n_plev + 1) = huge(0.) ! (infinity, but any value guaranteed to be greater than the ! surface pressure would do) end if CALL bcast_mpi(press_in_edg) !$omp end single END SUBROUTINE press_coefoz END MODULE press_coefoz_m