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/writediagsoil.F90

    r1525 r1528  
    1212! Modifs: Aug.2010 Ehouarn: enforce outputs to be real*4
    1313
    14 use comsoil_h, only: nsoilmx
     14use comsoil_h, only: nsoilmx, inertiedat
     15use comgeomphy, only: airephy
    1516use time_phylmdz_mod, only: ecritphy, day_step, iphysiq
    1617use mod_phys_lmdz_para, only : is_mpi_root, is_master, gather
    17 use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo
     18use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo, &
     19                              nbp_lon, nbp_lat
    1820
    1921implicit none
    2022
    21 #include"dimensions.h"
    22 #include"paramet.h"
    23 !#include"control.h"
    24 !#include"comsoil.h"
    25 #include"netcdf.inc"
     23include"netcdf.inc"
    2624
    2725! Arguments:
     
    3331integer,intent(in) :: dimpx ! dimension of the variable (3,2 or 0)
    3432real,dimension(ngrid,nsoilmx),intent(in) :: px ! variable
    35 ! Note: nsoilmx is a parameter set in 'comsoil_h'
    3633
    3734! Local variables:
    38 real*4,dimension(iip1,jjp1,nsoilmx) :: data3 ! to store 3D data
    39 ! Note iip1,jjp1 known from paramet.h; nsoilmx known from comsoil_h
    40 real*4,dimension(iip1,jjp1) :: data2 ! to store 2D data
     35real*4,dimension(nbp_lon+1,nbp_lat,nsoilmx) :: data3 ! to store 3D data
     36real*4,dimension(nbp_lon+1,nbp_lat) :: data2 ! to store 2D data
    4137real*4 :: data0 ! to store 0D data
    4238integer :: i,j,l ! for loops
     
    4440
    4541real*4,save :: date ! time counter (in elapsed days)
     42
     43real :: inertia((nbp_lon+1),nbp_lat,nsoilmx)
     44real :: area((nbp_lon+1),nbp_lat)
     45
     46real :: inertiafi_glo(klon_glo,nsoilmx)
     47real :: areafi_glo(klon_glo)
     48
    4649integer,save :: isample ! sample rate at which data is to be written to output
    4750integer,save :: ntime=0 ! counter to internally store time steps
     
    6164! Added to work in parallel mode
    6265real dx3_glop(klon_glo,nsoilmx)
    63 real dx3_glo(iim,jjp1,nsoilmx) ! to store a global 3D data set
     66real dx3_glo(nbp_lon,nbp_lat,nsoilmx) ! to store a global 3D data set
    6467real dx2_glop(klon_glo)
    65 real dx2_glo(iim,jjp1)     ! to store a global 2D (surface) data set
     68real dx2_glo(nbp_lon,nbp_lat)     ! to store a global 2D (surface) data set
    6669real px2(ngrid)
    6770#endif
     
    9295    stop
    9396   endif
     97
     98#ifdef CPP_PARA
     99   ! Gather inertiedat() soil thermal inertia on physics grid
     100   call Gather(inertiedat,inertiafi_glo)
     101   ! Gather airephy() mesh area on physics grid
     102   call Gather(airephy,areafi_glo)
     103#else
     104         inertiafi_glo(:,:)=inertiedat(:,:)
     105         areafi_glo(:)=airephy(:)
     106#endif
     107
     108   ! build inertia() and area()
     109   do i=1,nbp_lon+1 ! poles
     110     inertia(i,1,1:nsoilmx)=inertiafi_glo(1,1:nsoilmx)
     111     inertia(i,nbp_lat,1:nsoilmx)=inertiafi_glo(klon_glo,1:nsoilmx)
     112     ! for area, divide at the poles by nbp_lon
     113     area(i,1)=areafi_glo(1)/nbp_lon
     114     area(i,nbp_lat)=areafi_glo(klon_glo)/nbp_lon
     115   enddo
     116   do j=2,nbp_lat-1
     117     ig0= 1+(j-2)*nbp_lon
     118     do i=1,nbp_lon
     119        inertia(i,j,1:nsoilmx)=inertiafi_glo(ig0+i,1:nsoilmx)
     120        area(i,j)=areafi_glo(ig0+i)
     121     enddo
     122     ! handle redundant point in longitude
     123     inertia(nbp_lon+1,j,1:nsoilmx)=inertia(1,j,1:nsoilmx)
     124     area(nbp_lon+1,j)=area(1,j)
     125   enddo
     126   
     127   ! write "header" of file (longitudes, latitudes, geopotential, ...)
     128   call iniwritesoil(nid,ngrid,inertia,area)
     129
    94130  endif ! of if (is_master)
    95 
    96   ! Define dimensions and axis attributes
    97   call iniwritesoil(nid,ngrid)
    98131 
    99132  ! set zitau to -1 to be compatible with zitau incrementation step below
     
    149182    call Grid1Dto2D_glo(dx3_glop,dx3_glo)
    150183    ! copy dx3_glo() to dx3(:) and add redundant longitude
    151     data3(1:iim,:,:)=dx3_glo(1:iim,:,:)
    152     data3(iip1,:,:)=data3(1,:,:)
     184    data3(1:nbp_lon,:,:)=dx3_glo(1:nbp_lon,:,:)
     185    data3(nbp_lon+1,:,:)=data3(1,:,:)
    153186  endif
    154187!$OMP END MASTER
     
    157190  do l=1,nsoilmx
    158191    ! handle the poles
    159     do i=1,iip1
     192    do i=1,nbp_lon+1
    160193      data3(i,1,l)=px(1,l)
    161       data3(i,jjp1,l)=px(ngrid,l)
     194      data3(i,nbp_lat,l)=px(ngrid,l)
    162195    enddo
    163196    ! rest of the grid
    164     do j=2,jjm
    165       ig0=1+(j-2)*iim
    166       do i=1,iim
     197    do j=2,nbp_lat-1
     198      ig0=1+(j-2)*nbp_lon
     199      do i=1,nbp_lon
    167200        data3(i,j,l)=px(ig0+i,l)
    168201      enddo
    169       data3(iip1,j,l)=data3(1,j,l) ! extra (modulo) longitude
     202      data3(nbp_lon+1,j,l)=data3(1,j,l) ! extra (modulo) longitude
    170203    enddo
    171204  enddo
     
    196229  corners(4)=ntime
    197230 
    198   edges(1)=iip1
    199   edges(2)=jjp1
     231  edges(1)=nbp_lon+1
     232  edges(2)=nbp_lat
    200233  edges(3)=nsoilmx
    201234  edges(4)=1
     
    224257    call Grid1Dto2D_glo(dx2_glop,dx2_glo)
    225258    ! copy dx3_glo() to dx3(:) and add redundant longitude
    226     data2(1:iim,:)=dx2_glo(1:iim,:)
    227     data2(iip1,:)=data2(1,:)
     259    data2(1:nbp_lon,:)=dx2_glo(1:nbp_lon,:)
     260    data2(nbp_lon+1,:)=data2(1,:)
    228261  endif
    229262!$OMP END MASTER
     
    231264#else
    232265  ! handle the poles
    233   do i=1,iip1
     266  do i=1,nbp_lon+1
    234267    data2(i,1)=px(1,1)
    235     data2(i,jjp1)=px(ngrid,1)
     268    data2(i,nbp_lat)=px(ngrid,1)
    236269  enddo
    237270  ! rest of the grid
    238   do j=2,jjm
    239     ig0=1+(j-2)*iim
    240     do i=1,iim
     271  do j=2,nbp_lat-1
     272    ig0=1+(j-2)*nbp_lon
     273    do i=1,nbp_lon
    241274      data2(i,j)=px(ig0+i,1)
    242275    enddo
    243     data2(iip1,j)=data2(1,j) ! extra (modulo) longitude
     276    data2(nbp_lon+1,j)=data2(1,j) ! extra (modulo) longitude
    244277  enddo
    245278#endif
     
    267300  corners(3)=ntime
    268301 
    269   edges(1)=iip1
    270   edges(2)=jjp1
     302  edges(1)=nbp_lon+1
     303  edges(2)=nbp_lat
    271304  edges(3)=1
    272305 
Note: See TracChangeset for help on using the changeset viewer.