Changeset 1395 for trunk/LMDZ.MARS/libf/phymars/iniphysiq.F90
- Timestamp:
- Mar 12, 2015, 12:45:17 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/iniphysiq.F90
r1257 r1395 1 subroutine iniphysiq( ngrid,nlayer, punjours, pdayref,ptimestep,&2 plat,plon,parea,pcu,pcv,&1 subroutine iniphysiq(ii,jj,nlayer,punjours, pdayref,ptimestep, & 2 rlatu,rlonv,aire,cu,cv, & 3 3 prad,pg,pr,pcpp,iflag_phys) 4 4 … … 10 10 klon_omp_end, & ! end index of local omp subgrid 11 11 klon_mpi_begin ! start indes of columns (on local mpi grid) 12 use comgeomphy, only : airephy, & ! physics grid area (m2) 12 13 use comgeomphy, only : initcomgeomphy, & 14 airephy, & ! physics grid area (m2) 13 15 cuphy, & ! cu coeff. (u_covariant = cu * u) 14 16 cvphy, & ! cv coeff. (v_covariant = cv * v) … … 20 22 implicit none 21 23 24 include "iniprint.h" 25 22 26 real,intent(in) :: prad ! radius of the planet (m) 23 27 real,intent(in) :: pg ! gravitational acceleration (m/s2) … … 25 29 real,intent(in) :: pcpp ! specific heat Cp 26 30 real,intent(in) :: punjours ! length (in s) of a standard day 27 integer,intent(in) :: ngrid ! number of horizontal grid points in the physics (full grid)31 !integer,intent(in) :: ngrid ! number of horizontal grid points in the physics (full grid) 28 32 integer,intent(in) :: nlayer ! number of atmospheric layers 29 real,intent(in) :: plat(ngrid) ! latitudes of the physics grid 30 real,intent(in) :: plon(ngrid) ! longitudes of the physics grid 31 real,intent(in) :: parea(klon_glo) ! area (m2) 32 real,intent(in) :: pcu(klon_glo) ! cu coeff. (u_covariant = cu * u) 33 real,intent(in) :: pcv(klon_glo) ! cv coeff. (v_covariant = cv * v) 33 integer,intent(in) :: ii ! number of atmospheric coulumns along longitudes 34 integer,intent(in) :: jj ! number of atompsheric columns along latitudes 35 real,intent(in) :: rlatu(jj+1) ! latitudes of the dynamics U grid 36 real,intent(in) :: rlonv(ii+1) ! longitudes of the dynamics V grid 37 real,intent(in) :: aire(ii+1,jj+1) ! area of the dynamics grid (m2) 38 real,intent(in) :: cu((ii+1)*(jj+1)) ! cu coeff. (u_covariant = cu * u) 39 real,intent(in) :: cv((ii+1)*jj) ! cv coeff. (v_covariant = cv * v) 34 40 integer,intent(in) :: pdayref ! reference day of for the simulation 35 41 real,intent(in) :: ptimestep !physics time step (s) … … 37 43 38 44 integer :: ibegin,iend,offset 45 integer :: i,j 39 46 character(len=20) :: modname='iniphysiq' 40 47 character(len=80) :: abort_message 48 real :: total_area_phy, total_area_dyn 49 50 51 ! global array, on full physics grid: 52 real,allocatable :: latfi(:) 53 real,allocatable :: lonfi(:) 54 real,allocatable :: cufi(:) 55 real,allocatable :: cvfi(:) 56 real,allocatable :: airefi(:) 41 57 42 58 IF (nlayer.NE.klev) THEN … … 49 65 ENDIF 50 66 51 IF (ngrid.NE.klon_glo) THEN 52 write(*,*) 'STOP in ',trim(modname) 53 write(*,*) 'Problem with dimensions :' 54 write(*,*) 'ngrid = ',ngrid 55 write(*,*) 'klon = ',klon_glo 56 abort_message = '' 57 CALL abort_gcm (modname,abort_message,1) 67 !IF (ngrid.NE.klon_glo) THEN 68 ! write(*,*) 'STOP in ',trim(modname) 69 ! write(*,*) 'Problem with dimensions :' 70 ! write(*,*) 'ngrid = ',ngrid 71 ! write(*,*) 'klon = ',klon_glo 72 ! abort_message = '' 73 ! CALL abort_gcm (modname,abort_message,1) 74 !ENDIF 75 76 ! Generate global arrays on full physics grid 77 allocate(latfi(klon_glo),lonfi(klon_glo),cufi(klon_glo),cvfi(klon_glo)) 78 latfi(1)=rlatu(1) 79 lonfi(1)=0. 80 cufi(1) = cu(1) 81 cvfi(1) = cv(1) 82 DO j=2,jj 83 DO i=1,ii 84 latfi((j-2)*ii+1+i)= rlatu(j) 85 lonfi((j-2)*ii+1+i)= rlonv(i) 86 cufi((j-2)*ii+1+i) = cu((j-1)*ii+1+i) 87 cvfi((j-2)*ii+1+i) = cv((j-1)*ii+1+i) 88 ENDDO 89 ENDDO 90 latfi(klon_glo)= rlatu(jj+1) 91 lonfi(klon_glo)= 0. 92 cufi(klon_glo) = cu((ii+1)*jj+1) 93 cvfi(klon_glo) = cv((ii+1)*jj-ii) 94 95 ! build airefi(), mesh area on physics grid 96 allocate(airefi(klon_glo)) 97 CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,aire,airefi) 98 ! Poles are single points on physics grid 99 airefi(1)=sum(aire(1:ii,1)) 100 airefi(klon_glo)=sum(aire(1:ii,jj+1)) 101 102 ! Sanity check: do total planet area match between physics and dynamics? 103 total_area_dyn=sum(aire(1:ii,1:jj+1)) 104 total_area_phy=sum(airefi(1:klon_glo)) 105 IF (total_area_dyn/=total_area_phy) THEN 106 WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!' 107 WRITE (lunout, *) ' in the dynamics total_area_dyn=', total_area_dyn 108 WRITE (lunout, *) ' but in the physics total_area_phy=', total_area_phy 109 IF (abs(total_area_dyn-total_area_phy)>0.00001*total_area_dyn) THEN 110 ! stop here if the relative difference is more than 0.001% 111 abort_message = 'planet total surface discrepancy' 112 CALL abort_gcm(modname, abort_message, 1) 113 ENDIF 58 114 ENDIF 59 115 60 !$OMP PARALLEL PRIVATE(ibegin,iend) 61 !$OMP+ SHARED(parea,pcu,pcv,plon,plat) 116 117 118 !$OMP PARALLEL 119 ! Now generate local lon/lat/cu/cv/area arrays 120 call initcomgeomphy 121 122 !!!!$OMP PARALLEL PRIVATE(ibegin,iend) 123 !!!$OMP+ SHARED(parea,pcu,pcv,plon,plat) 62 124 63 125 offset=klon_mpi_begin-1 64 airephy(1:klon_omp)= parea(offset+klon_omp_begin:offset+klon_omp_end)65 cuphy(1:klon_omp)= pcu(offset+klon_omp_begin:offset+klon_omp_end)66 cvphy(1:klon_omp)= pcv(offset+klon_omp_begin:offset+klon_omp_end)67 rlond(1:klon_omp)= plon(offset+klon_omp_begin:offset+klon_omp_end)68 rlatd(1:klon_omp)= plat(offset+klon_omp_begin:offset+klon_omp_end)126 airephy(1:klon_omp)=airefi(offset+klon_omp_begin:offset+klon_omp_end) 127 cuphy(1:klon_omp)=cufi(offset+klon_omp_begin:offset+klon_omp_end) 128 cvphy(1:klon_omp)=cvfi(offset+klon_omp_begin:offset+klon_omp_end) 129 rlond(1:klon_omp)=lonfi(offset+klon_omp_begin:offset+klon_omp_end) 130 rlatd(1:klon_omp)=latfi(offset+klon_omp_begin:offset+klon_omp_end) 69 131 70 132 ! copy some fundamental parameters to physics
Note: See TracChangeset
for help on using the changeset viewer.