Ignore:
Timestamp:
Apr 7, 2016, 3:53:15 PM (9 years ago)
Author:
emillour
Message:

Mars GCM:

  • Some fixes for buggy outputs in 1D introduced by previous code modifications.
  • made statto.h a module.
  • ecritphy in dyn3d/control_mod.F90 should be an integer, not a real.

EM

File:
1 edited

Legend:

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

    r1528 r1532  
    3636real*4,dimension(nbp_lon+1,nbp_lat) :: data2 ! to store 2D data
    3737real*4 :: data0 ! to store 0D data
     38real*4 :: data3_1d(1,nsoilmx) ! to store a profile in 1D model
     39real*4 :: data2_1d ! to store surface value with 1D model
    3840integer :: i,j,l ! for loops
    3941integer :: ig0
     
    5153character(len=20),save :: firstname="1234567890"
    5254integer,save :: zitau=0
     55!$OMP THREADPRIVATE(date,isample,ntime,firstname,zitau)
    5356
    5457character(len=30) :: filename="diagsoil.nc"
     
    107110
    108111   ! build inertia() and area()
    109    do i=1,nbp_lon+1 ! poles
     112   if (klon_glo>1) then
     113    do i=1,nbp_lon+1 ! poles
    110114     inertia(i,1,1:nsoilmx)=inertiafi_glo(1,1:nsoilmx)
    111115     inertia(i,nbp_lat,1:nsoilmx)=inertiafi_glo(klon_glo,1:nsoilmx)
     
    113117     area(i,1)=areafi_glo(1)/nbp_lon
    114118     area(i,nbp_lat)=areafi_glo(klon_glo)/nbp_lon
    115    enddo
    116    do j=2,nbp_lat-1
     119    enddo
     120    do j=2,nbp_lat-1
    117121     ig0= 1+(j-2)*nbp_lon
    118122     do i=1,nbp_lon
     
    123127     inertia(nbp_lon+1,j,1:nsoilmx)=inertia(1,j,1:nsoilmx)
    124128     area(nbp_lon+1,j)=area(1,j)
    125    enddo
     129    enddo
     130   endif
    126131   
    127132   ! write "header" of file (longitudes, latitudes, geopotential, ...)
    128    call iniwritesoil(nid,ngrid,inertia,area)
     133   if (klon_glo>1) then ! general 3D case
     134     call iniwritesoil(nid,ngrid,inertia,area,nbp_lon+1,nbp_lat)
     135   else ! 1D model
     136     call iniwritesoil(nid,ngrid,inertiafi_glo(1,:),areafi_glo(1),1,1)
     137   endif
    129138
    130139  endif ! of if (is_master)
     
    188197!$OMP BARRIER
    189198#else
    190   do l=1,nsoilmx
     199  if (klon_glo>1) then ! General case
     200   do l=1,nsoilmx
    191201    ! handle the poles
    192202    do i=1,nbp_lon+1
     
    202212      data3(nbp_lon+1,j,l)=data3(1,j,l) ! extra (modulo) longitude
    203213    enddo
    204   enddo
     214   enddo
     215  else ! 1D model case
     216   data3_1d(1,1:nsoilmx)=px(1,1:nsoilmx)
     217  endif
    205218#endif
    206219 
     
    229242  corners(4)=ntime
    230243 
    231   edges(1)=nbp_lon+1
     244  if (klon_glo==1) then
     245    edges(1)=1
     246  else
     247    edges(1)=nbp_lon+1
     248  endif
    232249  edges(2)=nbp_lat
    233250  edges(3)=nsoilmx
     
    238255!  ierr=NF_PUT_VARA_DOUBLE(nid,varid,corners,edges,data3)
    239256!#else
    240   ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,data3)
     257  if (klon_glo>1) then
     258    ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,data3)
     259  else
     260    ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,data3_1d)
     261  endif
    241262!#endif
    242263  if (ierr.ne.NF_NOERR) then
     
    263284!$OMP BARRIER
    264285#else
    265   ! handle the poles
    266   do i=1,nbp_lon+1
    267     data2(i,1)=px(1,1)
    268     data2(i,nbp_lat)=px(ngrid,1)
    269   enddo
    270   ! rest of the grid
    271   do j=2,nbp_lat-1
    272     ig0=1+(j-2)*nbp_lon
    273     do i=1,nbp_lon
    274       data2(i,j)=px(ig0+i,1)
    275     enddo
    276     data2(nbp_lon+1,j)=data2(1,j) ! extra (modulo) longitude
    277   enddo
     286  if (klon_glo>1) then ! general case
     287    ! handle the poles
     288    do i=1,nbp_lon+1
     289      data2(i,1)=px(1,1)
     290      data2(i,nbp_lat)=px(ngrid,1)
     291    enddo
     292    ! rest of the grid
     293    do j=2,nbp_lat-1
     294      ig0=1+(j-2)*nbp_lon
     295      do i=1,nbp_lon
     296        data2(i,j)=px(ig0+i,1)
     297      enddo
     298      data2(nbp_lon+1,j)=data2(1,j) ! extra (modulo) longitude
     299    enddo
     300  else ! 1D model case
     301    data2_1d=px(1,1)
     302  endif
    278303#endif
    279304
     
    300325  corners(3)=ntime
    301326 
    302   edges(1)=nbp_lon+1
     327  if (klon_glo==1) then
     328    edges(1)=1
     329  else
     330    edges(1)=nbp_lon+1
     331  endif
    303332  edges(2)=nbp_lat
    304333  edges(3)=1
     
    308337!  ierr=NF_PUT_VARA_DOUBLE(nid,varid,corners,edges,data2)
    309338!#else
    310   ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,data2)
     339  if (klon_glo>1) then ! General case
     340    ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,data2)
     341  else
     342    ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,data2_1d)
     343  endif
    311344!#endif
    312345  if (ierr.ne.NF_NOERR) then
Note: See TracChangeset for help on using the changeset viewer.