Ignore:
Timestamp:
Apr 13, 2001, 12:44:53 PM (23 years ago)
Author:
lmdz
Message:

Debogage du guidage et de la version debranchee et abandon de la version
debranchee non-netcdf FH/MAF
LF

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ.3.3/trunk/libf/dyn3d/grilles_gcm_netcdf.F

    r198 r204  
     1c
    12c $Header
     3c
     4
    25      PROGRAM create_fausse_var
    36C
     
    912#include "comconst.h"
    1013#include "comgeom.h"
     14#include "comvert.h"
     15
     16      real temp(iim+1,jjm+1)
    1117#include "netcdf.inc"
    1218
     
    1925        integer*4 out_latudim,out_latvdim,out_dim(3)
    2026
    21 c   champs a faire disparaitre
    22         real ucov(ijp1llm),vcov(ijmllm),teta(ijp1llm)
    23         real masse(ijp1llm),ps(ip1jmp1),phis(ip1jmp1)
    24         real q(ijp1llm*nqmx)
    25         real time_0
    26 
    27         real clesphy0(20),pa,preff
     27      INTEGER         longcles
     28      PARAMETER     ( longcles = 20 )
     29      REAL  clesphy0( longcles )
     30
     31      integer start(4),count(4)
    2832
    2933        integer status,i,j
     
    3135        real rlonudeg(iip1),rlonvdeg(iip1)
    3236
     37      real dlon1(iip1),dlon2(iip1),dlat1(jjp1),dlat2(jjp1)
     38      real acoslat,dxkm,dykm,resol(iip1,jjp1)
     39
     40#include "serre.h"
     41#include "fxyprim.h"
     42
     43      print*,'OK0'
    3344
    3445      rad = 6400000
     
    4253      pa= 50000.
    4354
    44 c     CALL dynetat0("start.nc",nqmx,vcov,ucov,
    45 c    .              teta,q,masse,ps,phis, time_0)
    46 
    47 
    4855      open(99,file='run.def',status='old',form='formatted')
    49       CALL defrun_new( 99, .TRUE. ,clesphy0)
     56      CALL defrun_new( 99, .TRUE.,clesphy0 )
    5057      close(99)
    5158      CALL iniconst
    52       print*,'inigeom pas OK'
    5359      CALL inigeom
    54       print*,'inigeom OK'
    55 
     60
     61
     62      print*,'OK1'
    5663      do j=1,jjp1
    5764         rlatudeg(j)=rlatu(j)*180./pi
     
    6673      enddo
    6774
    68       print*,'  2 ----- OUVERTURE DE LA SORTIE NETCDF'
     75
     76      print*,'OK2'
     77c  2 ----- OUVERTURE DE LA SORTIE NETCDF
    6978c ---------------------------------------------------
    7079c CREATION OUTPUT
     
    7887        status=NF_DEF_DIM(ncid_out,'latv',jjm,out_latvdim)
    7988
     89
     90      print*,'OK3'
    8091c   Longitudes en u
    8192        print *,'OUTID: ',ncid_out
     
    138149     %  16,'Grille aux point v')
    139150
    140 
     151c   ecriture de la grille u
     152        out_dim(1)=out_lonvdim
     153        out_dim(2)=out_latudim
     154        status=NF_DEF_VAR(ncid_out,'grille_s',NF_FLOAT,2,out_dim,
     155     %  out_varid)
     156        call handle_err(status)
     157        status=NF_PUT_ATT_TEXT(ncid_out,out_varid,'units',
     158     %  6,'Kelvin')
     159        status=NF_PUT_ATT_TEXT(ncid_out,out_varid,'long_name',
     160     %  16,'Grille aux point u')
     161
     162
     163      print*,'OK4'
    141164        status=NF_ENDDEF(ncid_out)
    142         print*,' 5) ----- FERMETURE DES FICHIERS NETCDF-'
     165c 5) ----- FERMETURE DES FICHIERS NETCDF------------------
    143166c --------------------------------------------------------
    144167c 3-b- Ecriture de la grille pour la sortie
     
    150173        status=NF_PUT_VARA_REAL(ncid_out,out_latvid,1,jjm,rlatvdeg)
    151174
     175        start(1)=1
     176        start(2)=1
     177        start(3)=1
     178        start(4)=1
     179
     180        count(1)=iim+1
     181        count(2)=jjm+1
     182        count(3)=1
     183        count(4)=1
     184
     185        do j=1,jjm+1
     186           do i=1,iim+1
     187              temp(i,j)=mod(i,2)+mod(j,2)
     188           enddo
     189        enddo
     190
     191        status=NF_PUT_VARA_REAL(ncid_out,out_varid,start,
     192     s  count,temp)
    152193
    153194c fermeture du fichier netcdf
     
    155196        write(*,*) 'Fermeture: ',fich_out
    156197
     198
     199      print*,'OK5'
     200c   Ecriture grads
     201      open (20,file='grille.dat',form='unformatted',access='direct'
     202     s      ,recl=4*ip1jmp1)
     203      write(20,rec=1) ((float(mod(i,2)+mod(j,2)),i=1,iip1),j=1,jjp1)
     204      write(20,rec=2) ((float(mod(i,2)*mod(j,2)),i=1,iip1),j=1,jjp1)
     205      do j=2,jjm
     206         dlat1(j)=180.*(rlatv(j)-rlatv(j-1))/pi
     207c        dlat2(j)=180.*fyprim(float(j))/pi
     208      enddo
     209      do i=2,iip1
     210         dlon1(i)=180.*(rlonu(i)-rlonu(i-1))/pi
     211c        dlon2(i)=180.*fxprim(float(i))/pi
     212      enddo
     213      do j=2,jjm
     214         dykm=(rlatv(j)-rlatv(j-1))*6400.
     215         acoslat=6400.*cos(rlatu(j))
     216         do i=2,iip1
     217            dxkm=acoslat*(rlonu(i)-rlonu(i-1))
     218            resol(i,j)=sqrt(dykm*dykm+dxkm*dxkm)
     219         enddo
     220         resol(1,j)=resol(iip1,j)
     221      enddo
     222      write(20,rec=3) resol
     223      dlon1(1)=dlon1(iip1)
     224      dlon2(1)=dlon2(iip1)
     225      write(20,rec=4) ((dlon1(i),i=1,iip1),j=1,jjp1)
     226      write(20,rec=5) ((dlon2(i),i=1,iip1),j=1,jjp1)
     227      write(20,rec=6) ((dlat1(j),i=1,iip1),j=1,jjp1)
     228      write(20,rec=7) ((dlat2(j),i=1,iip1),j=1,jjp1)
     229       
     230      open (21,file='grille.ctl',form='formatted')
     231
     232c   WARNING! on reecrase le fichier .ctl a chaque ecriture
     233      write(21,'(a5,1x,a40)')
     234     &       'DSET ','^grille.dat'
     235
     236      write(21,'(a12)') 'UNDEF 1.0E30'
     237      write(21,'(a5,1x,a40)') 'TITLE ','grille'
     238      call formcoord(21,iip1,rlonv,180./pi,.false.,'XDEF')
     239      call formcoord(21,jjp1,rlatu,180./pi,.true.,'YDEF')
     240      call formcoord(21,1,0.,1.,.false.,'ZDEF')
     241      write(21,'(a4,i10,a30)')
     242     &       'TDEF ',1,' LINEAR 23OCT1994 3hr '
     243      write(21,'(a4,2x,i5)') 'VARS',7
     244      write(21,'(a18)') 'grille 0 99 grille'
     245      write(21,'(a18)') 'gril   0 99 gril  '
     246      write(21,'(a29)') 'resol   0 99 resolution (km)  '
     247      write(21,'(a18)') 'dlon1  0 99 dlon1 '
     248      write(21,'(a18)') 'dlon2  0 99 dlon2 '
     249      write(21,'(a18)') 'dlat1  0 99 dlat1 '
     250      write(21,'(a18)') 'dlat2  0 99 dlat2 '
     251      write(21,'(a7)') 'ENDVARS'
     252
     253
     254
     255
     256
     257      print*,'OK6'
    157258        end
    158259
     
    161262        subroutine handle_err(status)
    162263#include "netcdf.inc"
     264
     265
    163266        integer status
    164267        print *,'handle code err: ',NF_NOERR
Note: See TracChangeset for help on using the changeset viewer.