Changeset 5463


Ignore:
Timestamp:
Dec 31, 2024, 5:53:47 PM (3 days ago)
Author:
fhourdin
Message:

Bug fix for nf90_open in Dust routines

Location:
LMDZ6/trunk/libf/phylmd/Dust
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/phylmd/Dust/read_dust.f90

    r5337 r5463  
    2121  save ncid1, varid1, ncid2, varid2
    2222!$OMP THREADPRIVATE(ncid1, varid1, ncid2, varid2)
    23   integer :: start(4),count(4), status
     23  integer :: start_(4),count_(4)
    2424  integer :: i, j, ig
    2525  !
     
    2828  if (debutphy) then
    2929  !
    30      ncid1=nf90_open('dust.nc',nf90_nowrite,rcode)
    31      varid1=nf90_inq_varid(ncid1,'EMISSION',rcode)
     30     rcode=nf90_open('dust.nc',nf90_nowrite,ncid1)
     31     if ( rcode /= 0 ) then ; call abort_physic('LMDZ','open dust.nc dans read_vent',1) ; endif
     32
     33     rcode=nf90_inq_varid(ncid1,'EMISSION',varid1)
     34     if ( rcode /= 0 ) then ; call abort_physic('LMDZ','inq varid EMISSION dans read_vent',1) ; endif
    3235  !
    3336  endif
    3437  !
    35   start(1)=1
    36   start(2)=1
    37   start(4)=0
     38  start_(1)=1
     39  start_(2)=1
     40  start_(3)=step
     41  start_(4)=0
    3842
    39    ! count(1)=iip1
    40   count(1)=nbp_lon+1
    41    ! count(2)=jjp1
    42   count(2)=nbp_lat
    43   count(3)=1
    44   count(4)=0
     43   ! count_(1)=iip1
     44  count_(1)=nbp_lon+1
     45   ! count_(2)=jjp1
     46  count_(2)=nbp_lat
     47  count_(3)=1
     48  count_(4)=0
    4549  !
    46   start(3)=step
    4750  !
    48   status = nf90_get_var(ncid1, varid1, dust_nc_glo, start, count)
     51  rcode = nf90_get_var(ncid1, varid1, dust_nc_glo, start_, count_)
     52  if ( rcode /= 0 ) then ; call abort_physic('LMDZ','get EMISSION dans read_vent',1) ; endif
    4953
    5054  !
  • LMDZ6/trunk/libf/phylmd/Dust/read_surface.f90

    r5337 r5463  
    3131       real surfa_glo(klon_glo,5)
    3232!
    33        integer ncid, varid, rcode
    34        integer start(2),count(2),status
     33       integer ncid, varid, rcode, varlatid,tmpid
     34       integer start_(2),count_(2)
    3535       integer i,j,l,ig
    3636       character*1 str1
     
    4141      real, dimension(nbp_lat) :: lats
    4242      real, dimension(nbp_lat) :: lats_glo
    43       integer, dimension(1) :: startj,endj
     43      integer, dimension(1) :: start_j,endj
    4444!JE20140526>>
    4545!$OMP MASTER
     
    4747
    4848       print*,'Lecture du fichier donnees_lisa.nc'
    49        ncid=nf90_open('donnees_lisa.nc',nf90_nowrite,rcode)
     49       rcode=nf90_open('donnees_lisa.nc',nf90_nowrite,ncid)
     50       if ( rcode /= 0 ) then ; call abort_physic('LMDZ','open donnees_lisa.nc dans read_vent',1) ; endif
     51
    5052
    5153!JE20140526<<: check if are inversed or not the latitude grid in donnes_lisa
     
    5456      isinversed=.false.
    5557      do i=1,5
    56        if (i==1) aux4s='latu'
    57        if (i==2) aux4s='LATU'
    58        if (i==3) aux4s='LatU'
    59        if (i==4) aux4s='Latu'
    60        if (i==5) aux4s='latU'
    61        status = nf90_inq_varid(ncid, aux4s, rcode)
    62 !       print *,'stat,i',status,i,outcycle,aux4s
    63 !       print *,'ifclause',status.NE. nf90_noerr ,outcycle == .false.
    64        IF ((.not.(status.NE. nf90_noerr) ).and.( .not. outcycle )) THEN
    65          outcycle=.true.
    66          latstr=aux4s
    67        ENDIF
     58          if (i==1) aux4s='latu'
     59          if (i==2) aux4s='LATU'
     60          if (i==3) aux4s='LatU'
     61          if (i==4) aux4s='Latu'
     62          if (i==5) aux4s='latU'
     63          rcode = nf90_inq_varid(ncid, aux4s, tmpid)
     64          IF ((rcode==0).and.( .not. outcycle )) THEN
     65            outcycle=.true.
     66            varlatid=tmpid
     67          ENDIF
    6868      enddo ! check if it inversed lat
    69       startj(1)=1
    70 !      endj(1)=jjp1
     69      start_j(1)=1
    7170      endj(1)=nbp_lat
    72       varid=nf90_inq_varid(ncid,latstr,rcode)
     71      rcode = nf90_get_var(ncid, varlatid, lats_glo, start_j, endj)
     72      if ( .not. outcycle ) then ; call abort_physic('LMDZ','get lat dans read_surface',1) ; endif
    7373
    74           status = nf90_get_var(ncid, varid, lats_glo, startj, endj)
    75 !      print *,latstr,varid,status,jjp1,rcode
    76 !      IF (status .NE. nf90_noerr) print*,'NOOOOOOO'
    77 !      print *,lats
    78 !stop
     74
    7975
    8076! check if netcdf is latitude inversed or not.
     
    8682          write(str1,'(i1)') i
    8783          varname=trim(name)//str1
    88        print*,'lecture variable:',varname
    89           varid=nf90_inq_varid(ncid,trim(varname),rcode)
     84          rcode=nf90_inq_varid(ncid,trim(varname),varid)
     85          if ( rcode /= 0 ) then ; call abort_physic('LMDZ','get'//varname//'  dans read_vent',1) ; endif
    9086!          varid=nf90_inq_varid(ncid,varname,rcode)
    9187
     
    9389!  -----------------------------------------------------
    9490
    95           start(1)=1
    96           start(2)=1     
    97           count(1)=nbp_lon+1
    98 !          count(1)=iip1
    99           count(2)=nbp_lat
    100 !          count(2)=jjp1
     91          start_(1)=1
     92          start_(2)=1     
     93          count_(1)=nbp_lon+1
     94!          count_(1)=iip1
     95          count_(2)=nbp_lat
     96!          count_(2)=jjp1
    10197
    10298! mise a zero des tableaux
     
    106102! Lecture
    107103! -----------------------
    108           status = nf90_get_var(ncid, varid, tmp_dyn_glo, start, count)
     104          rcode = nf90_get_var(ncid, varid, tmp_dyn_glo, start_, count_)
     105          if ( rcode /= 0 ) then ; call abort_physic('LMDZ','get'//varname//'  dans read_vent',1) ; endif
    109106
    110107!      call dump2d(iip1,jjp1,tmp_dyn,'tmp_dyn   ')
  • LMDZ6/trunk/libf/phylmd/Dust/read_vent.f90

    r5337 r5463  
    2323  save ncidu1, varidu1, ncidv1, varidv1
    2424!$OMP THREADPRIVATE(ncidu1, varidu1, ncidv1, varidv1)
    25   integer :: start(4),count(4), status
     25  integer :: start(4),count_(4)
    2626  integer :: i, j, ig
    2727
     
    3232  if (debutphy) then
    3333  !
    34      ncidu1=nf90_open('u10m.nc',nf90_nowrite,rcode)
    35      varidu1=nf90_inq_varid(ncidu1,'U10M',rcode)
    36      ncidv1=nf90_open('v10m.nc',nf90_nowrite,rcode)
    37      varidv1=nf90_inq_varid(ncidv1,'V10M',rcode)
     34     rcode=nf90_open('u10m.nc',nf90_nowrite,ncidu1)
     35     if ( rcode /= 0 ) then ; call abort_physic('LMDZ','open u10m.nc dans read_vent',1) ; endif
     36     rcode=nf90_inq_varid(ncidu1,'U10M',varidu1)
     37     if ( rcode /= 0 ) then ; call abort_physic('LMDZ','get id u10m dans read_vent',1) ; endif
     38     rcode=nf90_open('v10m.nc',nf90_nowrite,ncidv1)
     39     if ( rcode /= 0 ) then ; call abort_physic('LMDZ','open v10m.nc dans read_vent',1) ; endif
     40     rcode=nf90_inq_varid(ncidv1,'V10M',varidv1)
     41     if ( rcode /= 0 ) then ; call abort_physic('LMDZ','get id v10m dans read_vent',1) ; endif
    3842  !
    3943  endif
     
    4145  start(1)=1
    4246  start(2)=1
     47  start(3)=step
    4348  start(4)=0
    4449
    45    ! count(1)=iip1
    46   count(1)=nbp_lon+1
    47    ! count(2)=jjp1
    48   count(2)=nbp_lat
    49   count(3)=1
    50   count(4)=0
     50   ! count_(1)=iip1
     51  count_(1)=nbp_lon+1
     52   ! count_(2)=jjp1
     53  count_(2)=nbp_lat
     54  count_(3)=1
     55  count_(4)=0
    5156  !
    52   start(3)=step
    5357  !
    54   status = nf90_get_var(ncidu1, varidu1, u10m_nc_glo, start, count)
     58  rcode = nf90_get_var(ncidu1, varidu1, u10m_nc_glo, start, count_)
     59  if ( rcode /= 0 ) then ; call abort_physic('LMDZ','lecture u10m dans read_vent',1) ; endif
     60  rcode = nf90_get_var(ncidv1, varidv1, v10m_nc_glo, start, count_)
     61  if ( rcode /= 0 ) then ; call abort_physic('LMDZ','lecture v10m dans read_vent',1) ; endif
    5562
    56     ! print *,status
    57   !
    58   status = nf90_get_var(ncidv1, varidv1, v10m_nc_glo, start, count)
     63
     64! ------- Tests 2024/12/31-FH----------------------------------------
     65! print*,'nbp_lon,npb_lat ',nbp_lon,nbp_lat
     66! print*,'start ',start
     67! print*,'count_ ',count_
     68! print*,'satus lecture u10m ',rcode
     69! call dump2d(nbp_lon+1,nbp_lat,u10m_nc_glo,'U10M global read_vent')
     70! call dump2d(nbp_lon+1,nbp_lat,v10m_nc_glo,'V10M global read_vent')
     71! stop
     72! ------- Tests -----------------------------------------------------
    5973
    6074  !
     
    6377  !  print *,'beforebidcor v10m_nc', v10m_nc(1,jjp1)
    6478
    65   !   print *,status
     79  !   print *,rcode
    6680  !  call correctbid(iim,jjp1,u10m_nc)
    6781  !  call correctbid(iim,jjp1,v10m_nc)
Note: See TracChangeset for help on using the changeset viewer.