--- trunk/libf/phylmd/Orography/start_init_orog_m.f90 2011/01/25 15:11:05 39 +++ trunk/libf/phylmd/Orography/start_init_orog_m.f90 2012/11/14 16:59:30 68 @@ -16,41 +16,41 @@ use conf_dat2d_m, only: conf_dat2d use comgeom, only: rlatu, rlonv use dimens_m, only: iim, jjm - USE flincom, only: flininfo, flinopen_nozoom, flinclo - use flinget_m, only: flinget 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 - REAL, intent(out):: relief(:, :) ! orographie moyenne + REAL, intent(out):: relief(:, :) ! (iim + 1, jjm + 1) orographie moyenne - REAL, intent(out):: zstd_2d(:, :) + REAL, intent(out):: zstd_2d(:, :) ! (iim + 1, jjm + 1) ! (deviation standard de l'orographie sous-maille) - REAL, intent(out):: zsig_2d(:, :) + REAL, intent(out):: zsig_2d(:, :) ! (iim + 1, jjm + 1) ! (pente de l'orographie sous-maille) - REAL, intent(out):: zgam_2d(:, :) + REAL, intent(out):: zgam_2d(:, :) ! (iim + 1, jjm + 1) ! (anisotropie de l'orographie sous maille) - REAL, intent(out):: zthe_2d(:, :) + REAL, intent(out):: zthe_2d(:, :) ! (iim + 1, jjm + 1) ! (orientation de l'axe oriente dans la direction de plus grande ! pente de l'orographie sous maille) - REAL, intent(out):: zpic_2d(:, :) ! hauteur pics de la SSO - REAL, intent(out):: zval_2d(:, :) ! hauteur vallees de la SSO + REAL, intent(out):: zpic_2d(:, :) ! (iim + 1, jjm + 1) + ! hauteur pics de la SSO + + REAL, intent(out):: zval_2d(:, :) ! (iim + 1, jjm + 1) + ! hauteur vallees de la SSO ! Local: - INTEGER, SAVE:: iml_rel - INTEGER, SAVE:: jml_rel - REAL lev(1), date, dt - INTEGER itau(1), fid - INTEGER llm_tmp, ttm_tmp - REAL, ALLOCATABLE:: relief_hi(:, :) + INTEGER iml_rel + INTEGER jml_rel + INTEGER ncid, varid + REAL, pointer:: relief_hi(:, :) REAL, ALLOCATABLE:: lon_rad(:), lat_rad(:) - REAL, ALLOCATABLE:: lon_ini(:), lat_ini(:) - REAL, ALLOCATABLE:: lon_rel(:, :), lat_rel(:, :) + REAL, pointer:: lon_ini(:), lat_ini(:) !----------------------------------- @@ -63,51 +63,41 @@ size(zgam_2d, 2), size(zthe_2d, 2), size(zpic_2d, 2), & size(zval_2d, 2)/) /= jjm + 1)) stop "start_init_orog size 2" - print *, 'Reading the high resolution orography' - CALL flininfo('Relief.nc', iml_rel, jml_rel, llm_tmp, ttm_tmp, fid) + print *, 'Reading the high resolution orography...' - ALLOCATE(lat_rel(iml_rel, jml_rel)) - ALLOCATE(lon_rel(iml_rel, jml_rel)) - ALLOCATE(relief_hi(iml_rel, jml_rel)) - - CALL flinopen_nozoom(iml_rel, jml_rel, llm_tmp, & - lon_rel, lat_rel, lev, ttm_tmp, itau, date, dt, fid) - ! 'RELIEF': high resolution orography - CALL flinget(fid, 'RELIEF', iml_rel, jml_rel, llm_tmp, ttm_tmp, 1, 1, & - relief_hi) - CALL flinclo(fid) + call nf95_open('Relief.nc', nf90_nowrite, ncid) - ! In case we have a file which is in degrees we do the transformation: + call nf95_inq_varid(ncid, "longitude", varid) + call nf95_gw_var(ncid, varid, lon_ini) + lon_ini = lon_ini * pi / 180. ! convert to rad + iml_rel = size(lon_ini) - ALLOCATE(lon_rad(iml_rel)) - ALLOCATE(lon_ini(iml_rel)) + call nf95_inq_varid(ncid, "latitude", varid) + call nf95_gw_var(ncid, varid, lat_ini) + lat_ini = lat_ini * pi / 180. ! convert to rad + jml_rel = size(lat_ini) - IF (MAXVAL(lon_rel(:, :)) > pi) THEN - lon_ini(:) = lon_rel(:, 1) * pi / 180. - ELSE - lon_ini(:) = lon_rel(:, 1) - ENDIF + call nf95_inq_varid(ncid, "RELIEF", varid) + call nf95_gw_var(ncid, varid, relief_hi) - ALLOCATE(lat_rad(jml_rel)) - ALLOCATE(lat_ini(jml_rel)) + call nf95_close(ncid) - IF (MAXVAL(lat_rel(:, :)) > pi) THEN - lat_ini(:) = lat_rel(1, :) * pi / 180. - ELSE - lat_ini(:) = lat_rel(1, :) - ENDIF + ALLOCATE(lon_rad(iml_rel)) + ALLOCATE(lat_rad(jml_rel)) CALL conf_dat2d(lon_ini, lat_ini, lon_rad, lat_rad, relief_hi , & interbar=.FALSE.) + deallocate(lon_ini, lat_ini) ! pointers print *, 'Compute all the parameters needed for the gravity wave drag code' - ! Allocate the data we need to put in the interpolated fields: + ! 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, & zstd_2d, zsig_2d, zgam_2d, zthe_2d, zpic_2d, zval_2d, mask) + deallocate(relief_hi) ! pointer phis(iim + 1, :) = phis(1, :) phis(:, :) = phis(:, :) * 9.81