Ignore:
Timestamp:
Mar 12, 2015, 12:45:17 PM (10 years ago)
Author:
emillour
Message:

All GCMS:
Some cleanup and tidying on the dynamics/physics interface.
Essentially affects the "iniphysiq" routine in all physics packages.
EM

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,                            &
     1subroutine iniphysiq(ii,jj,nlayer,punjours, pdayref,ptimestep,           &
     2                     rlatu,rlonv,aire,cu,cv,                             &
    33                     prad,pg,pr,pcpp,iflag_phys)
    44
     
    1010                               klon_omp_end, & ! end index of local omp subgrid
    1111                               klon_mpi_begin ! start indes of columns (on local mpi grid)
    12 use comgeomphy, only : airephy, & ! physics grid area (m2)
     12
     13use comgeomphy, only : initcomgeomphy, &
     14                       airephy, & ! physics grid area (m2)
    1315                       cuphy, & ! cu coeff. (u_covariant = cu * u)
    1416                       cvphy, & ! cv coeff. (v_covariant = cv * v)
     
    2022implicit none
    2123
     24include "iniprint.h"
     25
    2226real,intent(in) :: prad ! radius of the planet (m)
    2327real,intent(in) :: pg ! gravitational acceleration (m/s2)
     
    2529real,intent(in) :: pcpp ! specific heat Cp
    2630real,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)
    2832integer,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)
     33integer,intent(in) :: ii ! number of atmospheric coulumns along longitudes
     34integer,intent(in) :: jj  ! number of atompsheric columns along latitudes
     35real,intent(in) :: rlatu(jj+1) ! latitudes of the dynamics U grid
     36real,intent(in) :: rlonv(ii+1) ! longitudes of the dynamics V grid
     37real,intent(in) :: aire(ii+1,jj+1) ! area of the dynamics grid (m2)
     38real,intent(in) :: cu((ii+1)*(jj+1)) ! cu coeff. (u_covariant = cu * u)
     39real,intent(in) :: cv((ii+1)*jj) ! cv coeff. (v_covariant = cv * v)
    3440integer,intent(in) :: pdayref ! reference day of for the simulation
    3541real,intent(in) :: ptimestep !physics time step (s)
     
    3743
    3844integer :: ibegin,iend,offset
     45integer :: i,j
    3946character(len=20) :: modname='iniphysiq'
    4047character(len=80) :: abort_message
     48real :: total_area_phy, total_area_dyn
     49
     50
     51! global array, on full physics grid:
     52real,allocatable :: latfi(:)
     53real,allocatable :: lonfi(:)
     54real,allocatable :: cufi(:)
     55real,allocatable :: cvfi(:)
     56real,allocatable :: airefi(:)
    4157
    4258IF (nlayer.NE.klev) THEN
     
    4965ENDIF
    5066
    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
     77allocate(latfi(klon_glo),lonfi(klon_glo),cufi(klon_glo),cvfi(klon_glo))
     78latfi(1)=rlatu(1)
     79lonfi(1)=0.
     80cufi(1) = cu(1)
     81cvfi(1) = cv(1)
     82DO 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
     89ENDDO
     90latfi(klon_glo)= rlatu(jj+1)
     91lonfi(klon_glo)= 0.
     92cufi(klon_glo) = cu((ii+1)*jj+1)
     93cvfi(klon_glo) = cv((ii+1)*jj-ii)
     94
     95! build airefi(), mesh area on physics grid
     96allocate(airefi(klon_glo))
     97CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,aire,airefi)
     98! Poles are single points on physics grid
     99airefi(1)=sum(aire(1:ii,1))
     100airefi(klon_glo)=sum(aire(1:ii,jj+1))
     101
     102! Sanity check: do total planet area match between physics and dynamics?
     103total_area_dyn=sum(aire(1:ii,1:jj+1))
     104total_area_phy=sum(airefi(1:klon_glo))
     105IF (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
    58114ENDIF
    59115
    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
     120call initcomgeomphy
     121
     122!!!!$OMP PARALLEL PRIVATE(ibegin,iend)
     123!!!$OMP+         SHARED(parea,pcu,pcv,plon,plat)
    62124     
    63125offset=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)
     126airephy(1:klon_omp)=airefi(offset+klon_omp_begin:offset+klon_omp_end)
     127cuphy(1:klon_omp)=cufi(offset+klon_omp_begin:offset+klon_omp_end)
     128cvphy(1:klon_omp)=cvfi(offset+klon_omp_begin:offset+klon_omp_end)
     129rlond(1:klon_omp)=lonfi(offset+klon_omp_begin:offset+klon_omp_end)
     130rlatd(1:klon_omp)=latfi(offset+klon_omp_begin:offset+klon_omp_end)
    69131
    70132! copy some fundamental parameters to physics
Note: See TracChangeset for help on using the changeset viewer.