Changeset 1528 for trunk/LMDZ.MARS/libf/phymars/getslopes.F90
- Timestamp:
- Apr 2, 2016, 4:09:43 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/getslopes.F90
r1266 r1528 3 3 use comgeomfi_h, only: long, lati 4 4 use slope_mod, only: theta_sl, psi_sl 5 USE comcstfi_h 5 use comcstfi_h, only: g, rad, pi 6 use mod_phys_lmdz_para, only: is_parallel 7 use mod_grid_phy_lmdz, only: nbp_lon, nbp_lat 6 8 implicit none 7 9 8 #include "dimensions.h"9 10 10 11 ! This routine computes slope inclination and orientation for the GCM (callslope=.true. in callphys.def) … … 16 17 integer,intent(in) :: ngrid ! nnumber of atmospheric columns 17 18 real,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 point19 real latigrid( iim,jjm+1),longgrid(iim,jjm+1) ! meshgrid of latitude and longitude values (radians)19 real topogrid(nbp_lon,nbp_lat) ! topography on lat/lon grid with poles and only one -180/180 point 20 real latigrid(nbp_lon,nbp_lat),longgrid(nbp_lon,nbp_lat) ! meshgrid of latitude and longitude values (radians) 20 21 real theta_val ! slope inclination 21 22 real psi_val ! slope orientation 22 real gradx( iim,jjm+1) ! x: latitude-wise topography gradient, increasing northward23 real grady( iim,jjm+1) ! y: longitude-wise topography gradient, increasing westward23 real gradx(nbp_lon,nbp_lat) ! x: latitude-wise topography gradient, increasing northward 24 real grady(nbp_lon,nbp_lat) ! y: longitude-wise topography gradient, increasing westward 24 25 integer i,j,ig0 25 26 integer id2,idm1 ! a trick to compile testphys1d with debug option 26 27 28 if (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 32 endif 33 27 34 id2 = 2 28 idm1 = iim-135 idm1 = nbp_lon-1 29 36 30 37 ! rearrange topography on a 2d array 31 do j=2, jjm32 ig0= 1+(j-2)* iim33 do i=1, iim38 do j=2,nbp_lat-1 39 ig0= 1+(j-2)*nbp_lon 40 do i=1,nbp_lon 34 41 topogrid(i,j)=geopot(ig0+i)/g 35 42 latigrid(i,j)=lati(ig0+i) … … 41 48 latigrid(:,1) = lati(1) 42 49 longgrid(:,1) = long(1) 43 topogrid(:, jjm+1) = geopot(ngrid)/g44 latigrid(:, jjm+1) = lati(ngrid)45 longgrid(:, jjm+1) = long(ngrid)50 topogrid(:,nbp_lat) = geopot(ngrid)/g 51 latigrid(:,nbp_lat) = lati(ngrid) 52 longgrid(:,nbp_lat) = long(ngrid) 46 53 47 54 … … 49 56 ! compute topography gradient 50 57 ! topogrid and rad are both in meters 51 do j=2, jjm52 do i=1, iim58 do j=2,nbp_lat-1 59 do i=1,nbp_lon 53 60 gradx(i,j) = (topogrid(i,j+1) - topogrid(i,j-1)) / (latigrid(i,j+1)-latigrid(i,j-1)) 54 61 gradx(i,j) = gradx(i,j) / rad 55 62 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)) 57 64 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) / rad60 do i=2, iim-165 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 61 68 grady(i,j) = (topogrid(i+1,j) - topogrid(i-1,j)) / (longgrid(i+1,j)-longgrid(i-1,j)) 62 69 grady(i,j) = grady(i,j) / rad … … 66 73 gradx(:,1) = 0. 67 74 grady(:,1) = 0. 68 gradx(:, jjm+1) = 0.69 grady(:, jjm+1) = 0.75 gradx(:,nbp_lat) = 0. 76 grady(:,nbp_lat) = 0. 70 77 71 78 … … 74 81 theta_sl(:) = 0. 75 82 psi_sl(:) = 0. 76 do j=2, jjm77 do i=1, iim83 do j=2,nbp_lat-1 84 do i=1,nbp_lon 78 85 79 ig0= 1+(j-2)* iim86 ig0= 1+(j-2)*nbp_lon 80 87 81 88 theta_val=atan(sqrt( (gradx(i,j))**2 + (grady(i,j))**2 ))
Note: See TracChangeset
for help on using the changeset viewer.