Ignore:
Timestamp:
Apr 2, 2016, 4:09:43 PM (9 years ago)
Author:
emillour
Message:

Mars GCM:

  • Got rid of references to "dimensions.h" from physics packages: use nbp_lon (=iim), nbp_lat (==jjp1) and nbp_lev from module mod_grid_phy_lmdz (in phy_common) instead.
  • Added "ioipsl_getin_p_mod.F90" (getin_p routine) in phy_common to correctly read in parameters from *.def files in a parallel environment.

EM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/libf/phymars/getslopes.F90

    r1266 r1528  
    33use comgeomfi_h, only: long, lati
    44use slope_mod, only: theta_sl, psi_sl
    5 USE comcstfi_h
     5use comcstfi_h, only: g, rad, pi
     6use mod_phys_lmdz_para, only: is_parallel
     7use mod_grid_phy_lmdz, only: nbp_lon, nbp_lat
    68implicit none
    79
    8 #include "dimensions.h"
    910
    1011! This routine computes slope inclination and orientation for the GCM (callslope=.true. in callphys.def)
     
    1617integer,intent(in) :: ngrid ! nnumber of atmospheric columns
    1718real,intent(in) :: geopot(ngrid)     ! geopotential on phy grid
    18 real topogrid(iim,jjm+1) ! topography on lat/lon grid with poles and only one -180/180 point
    19 real latigrid(iim,jjm+1),longgrid(iim,jjm+1) ! meshgrid of latitude and longitude values (radians)
     19real topogrid(nbp_lon,nbp_lat) ! topography on lat/lon grid with poles and only one -180/180 point
     20real latigrid(nbp_lon,nbp_lat),longgrid(nbp_lon,nbp_lat) ! meshgrid of latitude and longitude values (radians)
    2021real theta_val ! slope inclination
    2122real psi_val   ! slope orientation
    22 real gradx(iim,jjm+1) ! x: latitude-wise topography gradient,  increasing northward
    23 real grady(iim,jjm+1) ! y: longitude-wise topography gradient, increasing westward
     23real gradx(nbp_lon,nbp_lat) ! x: latitude-wise topography gradient,  increasing northward
     24real grady(nbp_lon,nbp_lat) ! y: longitude-wise topography gradient, increasing westward
    2425integer i,j,ig0
    2526integer id2,idm1 ! a trick to compile testphys1d with debug option
    2627
     28if (is_parallel) then
     29  ! This routine only works in serial mode so stop now.
     30  write(*,*) "getslopes Error: this routine is not designed to run in parallel"
     31  stop
     32endif
     33
    2734id2  = 2
    28 idm1 = iim-1
     35idm1 = nbp_lon-1
    2936
    3037! rearrange topography on a 2d array
    31 do j=2,jjm
    32    ig0= 1+(j-2)*iim
    33    do i=1,iim
     38do j=2,nbp_lat-1
     39   ig0= 1+(j-2)*nbp_lon
     40   do i=1,nbp_lon
    3441      topogrid(i,j)=geopot(ig0+i)/g
    3542      latigrid(i,j)=lati(ig0+i)
     
    4148latigrid(:,1) = lati(1)
    4249longgrid(:,1) = long(1)
    43 topogrid(:,jjm+1) = geopot(ngrid)/g
    44 latigrid(:,jjm+1) = lati(ngrid)
    45 longgrid(:,jjm+1) = long(ngrid)
     50topogrid(:,nbp_lat) = geopot(ngrid)/g
     51latigrid(:,nbp_lat) = lati(ngrid)
     52longgrid(:,nbp_lat) = long(ngrid)
    4653
    4754
     
    4956! compute topography gradient
    5057! topogrid and rad are both in meters
    51 do j=2,jjm
    52    do i=1,iim
     58do j=2,nbp_lat-1
     59   do i=1,nbp_lon
    5360     gradx(i,j) = (topogrid(i,j+1) - topogrid(i,j-1)) / (latigrid(i,j+1)-latigrid(i,j-1))
    5461     gradx(i,j) = gradx(i,j) / rad
    5562   enddo
    56    grady(1,j) = (topogrid(id2,j) - topogrid(iim,j)) / (2*pi+longgrid(id2,j)-longgrid(iim,j))
     63   grady(1,j) = (topogrid(id2,j) - topogrid(nbp_lon,j)) / (2*pi+longgrid(id2,j)-longgrid(nbp_lon,j))
    5764   grady(1,j) = grady(1,j) / rad
    58    grady(iim,j) = (topogrid(1,j) - topogrid(idm1,j)) / (2*pi+longgrid(1,j)-longgrid(idm1,j))
    59    grady(iim,j) = grady(iim,j) / rad
    60    do i=2,iim-1
     65   grady(nbp_lon,j) = (topogrid(1,j) - topogrid(idm1,j)) / (2*pi+longgrid(1,j)-longgrid(idm1,j))
     66   grady(nbp_lon,j) = grady(nbp_lon,j) / rad
     67   do i=2,nbp_lon-1
    6168     grady(i,j) = (topogrid(i+1,j) - topogrid(i-1,j)) / (longgrid(i+1,j)-longgrid(i-1,j))
    6269     grady(i,j) = grady(i,j) / rad
     
    6673gradx(:,1) = 0.
    6774grady(:,1) = 0.
    68 gradx(:,jjm+1) = 0.
    69 grady(:,jjm+1) = 0.
     75gradx(:,nbp_lat) = 0.
     76grady(:,nbp_lat) = 0.
    7077
    7178
     
    7481theta_sl(:) = 0.
    7582psi_sl(:)   = 0.
    76 do j=2,jjm
    77    do i=1,iim
     83do j=2,nbp_lat-1
     84   do i=1,nbp_lon
    7885   
    79      ig0= 1+(j-2)*iim
     86     ig0= 1+(j-2)*nbp_lon
    8087   
    8188     theta_val=atan(sqrt( (gradx(i,j))**2 + (grady(i,j))**2 ))
Note: See TracChangeset for help on using the changeset viewer.