--- trunk/phylmd/Orography/start_init_orog_m.f90 2013/11/15 18:45:49 76 +++ trunk/phylmd/Orography/start_init_orog_m.f 2014/03/05 14:57:53 82 @@ -3,26 +3,31 @@ ! From startvar.F, version 1.4 ! 2006/01/27 15:14:22 Fairhead + use dimens_m, only: iim, jjm + IMPLICIT NONE - REAL, ALLOCATABLE, SAVE:: mask(:, :) ! fraction of land (iim + 1, jjm + 1) - REAL, ALLOCATABLE, SAVE:: phis(:, :) ! surface geopotential, in m2 s-2 + REAL, SAVE:: mask(iim + 1, jjm + 1) ! interpolated fraction of land + + private iim, jjm CONTAINS - SUBROUTINE start_init_orog(relief, zstd_2d, zsig_2d, zgam_2d, zthe_2d, & - zpic_2d, zval_2d) + SUBROUTINE start_init_orog(phis, zmea_2d, zstd_2d, zsig_2d, zgam_2d, & + zthe_2d, zpic_2d, zval_2d) use conf_dat2d_m, only: conf_dat2d use comgeom, only: rlatu, rlonv - use dimens_m, only: iim, jjm use grid_noro_m, only: grid_noro use indicesol, only: epsfra use netcdf, only: nf90_nowrite use netcdf95, only: nf95_open, nf95_gw_var, nf95_inq_varid, nf95_close - use nr_util, only: pi + use nr_util, only: pi, assert + + REAL, intent(out):: phis(:, :) ! (iim + 1, jjm + 1) + ! surface geopotential, in m2 s-2 - REAL, intent(out):: relief(:, :) ! (iim + 1, jjm + 1) orographie moyenne + REAL, intent(out):: zmea_2d(:, :) ! (iim + 1, jjm + 1) orographie moyenne REAL, intent(out):: zstd_2d(:, :) ! (iim + 1, jjm + 1) ! (deviation standard de l'orographie sous-maille) @@ -48,7 +53,7 @@ INTEGER iml_rel INTEGER jml_rel INTEGER ncid, varid - REAL, pointer:: relief_hi(:, :) + REAL, pointer:: relief(:, :) REAL, ALLOCATABLE:: lon_rad(:), lat_rad(:) REAL, pointer:: lon_ini(:), lat_ini(:) @@ -56,12 +61,12 @@ print *, "Call sequence information: start_init_orog" - if (any((/size(relief, 1), size(zstd_2d, 1), size(zsig_2d, 1), & - size(zgam_2d, 1), size(zthe_2d, 1), size(zpic_2d, 1), & - size(zval_2d, 1)/) /= iim + 1)) stop "start_init_orog size 1" - if (any((/size(relief, 2), size(zstd_2d, 2), size(zsig_2d, 2), & - size(zgam_2d, 2), size(zthe_2d, 2), size(zpic_2d, 2), & - size(zval_2d, 2)/) /= jjm + 1)) stop "start_init_orog size 2" + call assert((/size(phis, 1), size(zmea_2d, 1), size(zstd_2d, 1), & + size(zsig_2d, 1), size(zgam_2d, 1), size(zthe_2d, 1), & + size(zpic_2d, 1), size(zval_2d, 1)/) == iim + 1, "start_init_orog iim") + call assert((/size(phis, 2), size(zmea_2d, 2), size(zstd_2d, 2), & + size(zsig_2d, 2), size(zgam_2d, 2), size(zthe_2d, 2), & + size(zpic_2d, 2), size(zval_2d, 2)/) == jjm + 1, "start_init_orog jjm") print *, 'Reading the high resolution orography...' @@ -78,28 +83,22 @@ jml_rel = size(lat_ini) call nf95_inq_varid(ncid, "RELIEF", varid) - call nf95_gw_var(ncid, varid, relief_hi) + call nf95_gw_var(ncid, varid, relief) call nf95_close(ncid) ALLOCATE(lon_rad(iml_rel)) ALLOCATE(lat_rad(jml_rel)) - CALL conf_dat2d(lon_ini, lat_ini, lon_rad, lat_rad, relief_hi , & + CALL conf_dat2d(lon_ini, lat_ini, lon_rad, lat_rad, relief , & interbar=.FALSE.) deallocate(lon_ini, lat_ini) ! pointers print *, 'Compute all the parameters needed for the gravity wave drag code' - ! Interpolated fields: - ALLOCATE(phis(iim + 1, jjm + 1)) - ALLOCATE(mask(iim + 1, jjm + 1)) - - CALL grid_noro(lon_rad, lat_rad, relief_hi, rlonv, rlatu, phis, relief, & + CALL grid_noro(lon_rad, lat_rad, relief, rlonv, rlatu, phis, zmea_2d, & zstd_2d, zsig_2d, zgam_2d, zthe_2d, zpic_2d, zval_2d, mask) - deallocate(relief_hi) ! pointer - - phis(iim + 1, :) = phis(1, :) + deallocate(relief) ! pointer phis(:, :) = phis(:, :) * 9.81 mask(2:, 1) = mask(1, 1) ! north pole