Ignore:
Timestamp:
Jul 19, 2024, 10:05:57 AM (7 months ago)
Author:
abarral
Message:

[continued & end] replace netcdf by lmdz_netcdf.F90 wrapper
"use netcdf" is now only used in lmdz_netcdf.F90 (except ecrad and obsolete/)
<include "netcdf.inc"> is now likewise only used in lmdz_netcdf.F90.

systematically specify explicitely <USE lmdz_netcdf, ONLY:> (probably left some missing, to correct later on)

Further replacement of nf_put_* by nf90_put_* (same for _get_)

[minor] replace deprecated boolean operators along the way

Location:
LMDZ6/trunk/libf/phylmd/dyn1d
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/phylmd/dyn1d/1DUTILS.h

    r4650 r5075  
    673673      USE logic_mod, ONLY: fxyhypb, ysinus
    674674      USE temps_mod, ONLY: annee_ref, day_ini, day_ref, itau_dyn
     675      USE lmdz_netcdf, ONLY:nf_open,nf_write,nf_noerr
    675676
    676677      IMPLICIT NONE
     
    682683      include "dimensions.h"
    683684!!#include "control.h"
    684       include "netcdf.inc"
    685685
    686686!   Arguments:
     
    820820      USE logic_mod, ONLY: fxyhypb, ysinus
    821821      USE temps_mod, ONLY: annee_ref,day_end,day_ref,itau_dyn,itaufin
     822      USE lmdz_netcdf, ONLY:nf_open,nf_write,nf_noerr
    822823
    823824      IMPLICIT NONE
     
    829830      include "dimensions.h"
    830831!!#include "control.h"
    831       include "netcdf.inc"
    832832
    833833!   Arguments:
  • LMDZ6/trunk/libf/phylmd/dyn1d/1D_decl_cases.h

    r4593 r5075  
    1         INCLUDE "netcdf.inc"
    21
    32! Declarations specifiques au cas Toga
  • LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_amma_read.F90

    r5073 r5075  
    11MODULE mod_1D_amma_read
    2 
     2        USE lmdz_netcdf, ONLY: nf90_get_var,nf_open,nf_noerr,nf_open,nf_nowrite,&
     3                nf_inq_dimid,nf_inq_dimlen,nf_strerror,nf_inq_varid
    34!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    45!Declarations specifiques au cas AMMA
     
    67! Option du cas AMMA ou on impose la discretisation verticale (Ap,Bp)
    78        integer nlev_amma, nt_amma
    8 
    99
    1010        integer year_ini_amma, day_ini_amma, mth_ini_amma
     
    5858SUBROUTINE read_1D_cases
    5959      implicit none
    60 
    61       INCLUDE "netcdf.inc"
    6260
    6361      INTEGER nid,rid,ierr
     
    172170
    173171
    174 END MODULE mod_1D_amma_read
    175172!=====================================================================
    176173      subroutine read_amma(nid,nlevel,ntime                          &
     
    180177!program reading forcings of the AMMA case study
    181178      implicit none
    182       INCLUDE "netcdf.inc"
    183179
    184180      integer ntime,nlevel
     
    459455        END
    460456
     457END MODULE mod_1D_amma_read
  • LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_cases_read.F90

    r5073 r5075  
    1 !
    2 ! $Id$
    3 !
    41MODULE mod_1D_cases_read
     2  USE lmdz_netcdf, ONLY: nf_noerr,nf_strerror,nf_inq_varid,nf_inq_dimlen,nf_inq_dimid,&
     3          nf_nowrite,nf_open,nf90_get_var
    54
    65!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    76!Declarations specifiques au cas standard
    87        character*80 :: fich_cas
    9 ! Discr?tisation 
     8! Discr?tisation
    109        integer nlev_cas, nt_cas
    1110
     
    5756        real, allocatable::  q_prof_cas(:)
    5857        real, allocatable::  u_prof_cas(:)
    59         real, allocatable::  v_prof_cas(:)       
     58        real, allocatable::  v_prof_cas(:)
    6059
    6160        real, allocatable::  vitw_prof_cas(:)
     
    8281
    8382        real lat_prof_cas,sens_prof_cas,ts_prof_cas,ustar_prof_cas
    84      
     83
    8584
    8685
     
    8887
    8988SUBROUTINE read_1D_cas
    90       implicit none
    91 
    92       INCLUDE "netcdf.inc"
    9389
    9490      INTEGER nid,rid,ierr
     
    137133!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    138134!profils moyens:
    139         allocate(plev_cas(nlev_cas,nt_cas))       
     135        allocate(plev_cas(nlev_cas,nt_cas))
    140136        allocate(z_cas(nlev_cas,nt_cas))
    141137        allocate(t_cas(nlev_cas,nt_cas),q_cas(nlev_cas,nt_cas),rh_cas(nlev_cas,nt_cas))
     
    204200!profils environnementaux:
    205201        deallocate(plev_cas)
    206        
     202
    207203        deallocate(z_cas)
    208204        deallocate(t_cas,q_cas,rh_cas)
     
    210206        deallocate(u_cas)
    211207        deallocate(v_cas)
    212        
     208
    213209!forcing
    214210        deallocate(ht_cas,vt_cas,dt_cas,dtrad_cas)
     
    257253END SUBROUTINE deallocate_1D_cases
    258254
    259 
    260 END MODULE mod_1D_cases_read
    261 !=====================================================================
     255  !=====================================================================
    262256      subroutine read_cas(nid,nlevel,ntime                          &
    263257     &     ,zz,pp,temp,qv,rh,theta,rv,u,v,ug,vg,w,                   &
     
    266260
    267261!program reading forcing of the case study
    268       implicit none
    269       INCLUDE "netcdf.inc"
    270262
    271263      integer ntime,nlevel
     
    296288      integer var3didin(nbvar3d)
    297289
    298        ierr=NF_INQ_VARID(nid,"zz",var3didin(1)) 
     290       ierr=NF_INQ_VARID(nid,"zz",var3didin(1))
    299291         if(ierr/=NF_NOERR) then
    300292           write(*,*) NF_STRERROR(ierr)
    301293           stop 'lev'
    302294         endif
    303      
    304       ierr=NF_INQ_VARID(nid,"pp",var3didin(2)) 
     295
     296      ierr=NF_INQ_VARID(nid,"pp",var3didin(2))
    305297         if(ierr/=NF_NOERR) then
    306298           write(*,*) NF_STRERROR(ierr)
     
    429421           stop 'advq'
    430422         endif
    431      
     423
    432424      ierr=NF_INQ_VARID(nid,"hq",var3didin(23))
    433425         if(ierr/=NF_NOERR) then
     
    465457           stop 'advr'
    466458         endif
    467      
     459
    468460      ierr=NF_INQ_VARID(nid,"hr",var3didin(29))
    469461         if(ierr/=NF_NOERR) then
     
    531523           stop 'q2'
    532524         endif
    533  
     525
    534526         ierr = nf90_get_var(nid,var3didin(1),zz)
    535527         if(ierr/=NF_NOERR) then
     
    560552         endif
    561553!          write(*,*)'lecture qv ok',qv
    562  
     554
    563555         ierr = nf90_get_var(nid,var3didin(5),rh)
    564556         if(ierr/=NF_NOERR) then
     
    807799
    808800
    809          return 
     801         return
    810802         end subroutine read_cas
    811803!======================================================================
     
    825817     &         ,hq_prof_cas,vq_prof_cas,lat_prof_cas,sens_prof_cas    &
    826818     &         ,ustar_prof_cas,uw_prof_cas,vw_prof_cas,q1_prof_cas,q2_prof_cas)
    827          
     819
    828820
    829821        implicit none
     
    834826! day: current julian day (e.g. 717538.2)
    835827! day1: first day of the simulation
    836 ! nt_cas: total nb of data in the forcing 
     828! nt_cas: total nb of data in the forcing
    837829! pdt_cas: total time interval (in sec) between 2 forcing data
    838830!---------------------------------------------------------------------------------------
     
    926918       it_cas1=INT(timeit/pdt_cas)+1
    927919       IF (it_cas1 == nt_cas) THEN
    928        it_cas2=it_cas1 
     920       it_cas2=it_cas1
    929921       ELSE
    930922       it_cas2=it_cas1 + 1
     
    952944
    953945       lat_prof_cas = lat_cas(it_cas2)                                       &
    954      &          -frac*(lat_cas(it_cas2)-lat_cas(it_cas1)) 
     946     &          -frac*(lat_cas(it_cas2)-lat_cas(it_cas1))
    955947       sens_prof_cas = sens_cas(it_cas2)                                     &
    956948     &          -frac*(sens_cas(it_cas2)-sens_cas(it_cas1))
     
    10171009
    10181010!**********************************************************************************************
     1011END MODULE mod_1D_cases_read
  • LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_cases_read2.F90

    r4706 r5075  
    33!
    44MODULE mod_1D_cases_read2
    5 
     5  USE lmdz_netcdf, ONLY: nf90_get_var,nf_noerr,nf_inq_varid,nf_inq_dimlen,nf_strerror,nf_open,&
     6          nf_nowrite,nf_inq_dimid
    67!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    78  !Declarations specifiques au cas standard
     
    8182    implicit none
    8283
    83     INCLUDE "netcdf.inc"
    84 
    8584    INTEGER nid,rid,ierr
    8685    INTEGER ii,jj
     
    9089    ierr = NF_OPEN(fich_cas,NF_NOWRITE,nid)
    9190    print*,'fich_cas,NF_NOWRITE,nid ',fich_cas,NF_NOWRITE,nid
    92     if (ierr.NE.NF_NOERR) then
     91    if (ierr/=NF_NOERR) then
    9392       write(*,*) 'ERROR: GROS Pb opening forcings nc file '
    9493       write(*,*) NF_STRERROR(ierr)
     
    9796    !.......................................................................
    9897    ierr=NF_INQ_DIMID(nid,'lat',rid)
    99     IF (ierr.NE.NF_NOERR) THEN
     98    IF (ierr/=NF_NOERR) THEN
    10099       print*, 'Oh probleme lecture dimension lat'
    101100    ENDIF
     
    104103    !.......................................................................
    105104    ierr=NF_INQ_DIMID(nid,'lon',rid)
    106     IF (ierr.NE.NF_NOERR) THEN
     105    IF (ierr/=NF_NOERR) THEN
    107106       print*, 'Oh probleme lecture dimension lon'
    108107    ENDIF
     
    111110    !.......................................................................
    112111    ierr=NF_INQ_DIMID(nid,'lev',rid)
    113     IF (ierr.NE.NF_NOERR) THEN
     112    IF (ierr/=NF_NOERR) THEN
    114113       print*, 'Oh probleme lecture dimension zz'
    115114    ENDIF
     
    120119    print*,'nid,rid',nid,rid
    121120    nt_cas=0
    122     IF (ierr.NE.NF_NOERR) THEN
     121    IF (ierr/=NF_NOERR) THEN
    123122       stop 'probleme lecture dimension sens'
    124123    ENDIF
     
    192191    implicit none
    193192
    194     INCLUDE "netcdf.inc"
    195 
    196193    INTEGER nid,rid,ierr
    197194    INTEGER ii,jj
     
    201198    ierr = NF_OPEN(fich_cas,NF_NOWRITE,nid)
    202199    print*,'fich_cas,NF_NOWRITE,nid ',fich_cas,NF_NOWRITE,nid
    203     if (ierr.NE.NF_NOERR) then
     200    if (ierr/=NF_NOERR) then
    204201       write(*,*) 'ERROR: GROS Pb opening forcings nc file '
    205202       write(*,*) NF_STRERROR(ierr)
     
    208205    !.......................................................................
    209206    ierr=NF_INQ_DIMID(nid,'lat',rid)
    210     IF (ierr.NE.NF_NOERR) THEN
     207    IF (ierr/=NF_NOERR) THEN
    211208       print*, 'Oh probleme lecture dimension lat'
    212209    ENDIF
     
    215212    !.......................................................................
    216213    ierr=NF_INQ_DIMID(nid,'lon',rid)
    217     IF (ierr.NE.NF_NOERR) THEN
     214    IF (ierr/=NF_NOERR) THEN
    218215       print*, 'Oh probleme lecture dimension lon'
    219216    ENDIF
     
    222219    !.......................................................................
    223220    ierr=NF_INQ_DIMID(nid,'nlev',rid)
    224     IF (ierr.NE.NF_NOERR) THEN
     221    IF (ierr/=NF_NOERR) THEN
    225222       print*, 'Oh probleme lecture dimension nlev'
    226223    ENDIF
     
    230227    ierr=NF_INQ_DIMID(nid,'time',rid)
    231228    nt_cas=0
    232     IF (ierr.NE.NF_NOERR) THEN
     229    IF (ierr/=NF_NOERR) THEN
    233230       stop 'Oh probleme lecture dimension time'
    234231    ENDIF
     
    317314  !**********************************************************************************************
    318315  SUBROUTINE old_read_SCM_cas
    319     use netcdf, only: nf90_get_var
    320316    implicit none
    321317
    322     INCLUDE "netcdf.inc"
    323318    INCLUDE "date_cas.h"
    324319
     
    331326    ierr = NF_OPEN(fich_cas,NF_NOWRITE,nid)
    332327    print*,'fich_cas,NF_NOWRITE,nid ',fich_cas,NF_NOWRITE,nid
    333     if (ierr.NE.NF_NOERR) then
     328    if (ierr/=NF_NOERR) then
    334329       write(*,*) 'ERROR: GROS Pb opening forcings nc file '
    335330       write(*,*) NF_STRERROR(ierr)
     
    338333    !.......................................................................
    339334    ierr=NF_INQ_DIMID(nid,'lat',rid)
    340     IF (ierr.NE.NF_NOERR) THEN
     335    IF (ierr/=NF_NOERR) THEN
    341336       print*, 'Oh probleme lecture dimension lat'
    342337    ENDIF
     
    345340    !.......................................................................
    346341    ierr=NF_INQ_DIMID(nid,'lon',rid)
    347     IF (ierr.NE.NF_NOERR) THEN
     342    IF (ierr/=NF_NOERR) THEN
    348343       print*, 'Oh probleme lecture dimension lon'
    349344    ENDIF
     
    352347    !.......................................................................
    353348    ierr=NF_INQ_DIMID(nid,'lev',rid)
    354     IF (ierr.NE.NF_NOERR) THEN
     349    IF (ierr/=NF_NOERR) THEN
    355350       print*, 'Oh probleme lecture dimension nlev'
    356351    ENDIF
     
    364359    ierr=NF_INQ_DIMID(nid,'time',rid)
    365360    nt_cas=0
    366     IF (ierr.NE.NF_NOERR) THEN
     361    IF (ierr/=NF_NOERR) THEN
    367362       stop 'Oh probleme lecture dimension time'
    368363    ENDIF
     
    533528
    534529
    535 END MODULE mod_1D_cases_read2
    536530!=====================================================================
    537531subroutine read_cas2(nid,nlevel,ntime                          &
     
    541535
    542536  !program reading forcing of the case study
    543   use netcdf, only: nf90_get_var
    544537  implicit none
    545   INCLUDE "netcdf.inc"
    546538
    547539  integer ntime,nlevel
     
    589581  do i=1,nbvar3d
    590582     print *,'Dans read_cas2, on va lire ',var3didin(i),name_var(i)
    591      if(i.LE.35) then
     583     if(i<=35) then
    592584        ierr = NF90_GET_VAR(nid,var3didin(i),resul, count = [1, 1, nlevel, ntime])
    593585        print *,'Dans read_cas2, on a lu ',ierr,var3didin(i),name_var(i)
     
    658650
    659651  !program reading forcing of the case study
    660   use netcdf, only: nf90_get_var
    661652  implicit none
    662   INCLUDE "netcdf.inc"
    663653
    664654  integer ntime,nlevel
     
    711701     else
    712702        !-----------------------------------------------------------------------
    713         if(i.LE.4) then     ! Lecture des coord pression en (nlevelp1,lat,lon)
     703        if(i<=4) then     ! Lecture des coord pression en (nlevelp1,lat,lon)
    714704           ierr = NF90_GET_VAR(nid,var3didin(i),apbp, count = [1, 1, nlevel + 1])
    715705           print *,'read2_cas(apbp), on a lu ',i,name_var(i)
     
    719709           endif
    720710           !-----------------------------------------------------------------------
    721         else if(i.gt.4.and.i.LE.45) then   ! Lecture des variables en (time,nlevel,lat,lon)
     711        else if(i>4.and.i<=45) then   ! Lecture des variables en (time,nlevel,lat,lon)
    722712           ierr = NF90_GET_VAR(nid,var3didin(i),resul, count = [1, 1, nlevel, ntime])
    723713           print *,'read2_cas(resul), on a lu ',i,name_var(i)
     
    727717           endif
    728718           !-----------------------------------------------------------------------
    729         else if (i.gt.45.and.i.LE.51) then   ! Lecture des variables en (time,lat,lon)
     719        else if (i>45.and.i<=51) then   ! Lecture des variables en (time,lat,lon)
    730720           ierr = NF90_GET_VAR(nid,var3didin(i),resul2, count = [1, 1, ntime])
    731721           print *,'read2_cas(resul2), on a lu ',i,name_var(i)
     
    829819
    830820  !program reading forcing of the case study
    831   use netcdf, only: nf90_get_var
    832821  implicit none
    833   INCLUDE "netcdf.inc"
    834822
    835823  integer ntime,nlevel,k,t
     
    888876     else
    889877        !-----------------------------------------------------------------------
    890         if(i.LE.4) then     ! Lecture des coord pression en (nlevelp1,lat,lon)
     878        if(i<=4) then     ! Lecture des coord pression en (nlevelp1,lat,lon)
    891879           ierr = NF90_GET_VAR(nid,var3didin(i),apbp)
    892880           print *,'read2_cas(apbp), on a lu ',i,name_var(i)
     
    896884           endif
    897885           !-----------------------------------------------------------------------
    898         else if(i.gt.4.and.i.LE.12) then   ! Lecture des variables en (time,nlevel,lat,lon)
     886        else if(i>4.and.i<=12) then   ! Lecture des variables en (time,nlevel,lat,lon)
    899887           ierr = NF90_GET_VAR(nid,var3didin(i),resul1)
    900888           print *,'read2_cas(resul1), on a lu ',i,name_var(i)
     
    905893           print*,'Lecture de la variable #i ',i,name_var(i),minval(resul1),maxval(resul1)
    906894           !-----------------------------------------------------------------------
    907         else if(i.gt.12.and.i.LE.54) then   ! Lecture des variables en (time,nlevel,lat,lon)
     895        else if(i>12.and.i<=54) then   ! Lecture des variables en (time,nlevel,lat,lon)
    908896           ierr = NF90_GET_VAR(nid,var3didin(i),resul)
    909897           print *,'read2_cas(resul), on a lu ',i,name_var(i)
     
    914902           print*,'Lecture de la variable #i ',i,name_var(i),minval(resul),maxval(resul)
    915903           !-----------------------------------------------------------------------
    916         else if (i.gt.54.and.i.LE.65) then   ! Lecture des variables en (time,lat,lon)
     904        else if (i>54.and.i<=65) then   ! Lecture des variables en (time,lat,lon)
    917905           ierr = NF90_GET_VAR(nid,var3didin(i),resul2)
    918906           print *,'read2_cas(resul2), on a lu ',i,name_var(i)
     
    11481136
    11491137  it_cas1=INT(timeit/pdt_cas)+1
    1150   IF (it_cas1 .EQ. nt_cas) THEN
     1138  IF (it_cas1 == nt_cas) THEN
    11511139     it_cas2=it_cas1
    11521140  ELSE
     
    11571145  !print *,'it_cas1,it_cas2,time_cas1,time_cas2=',it_cas1,it_cas2,time_cas1,time_cas2
    11581146
    1159   if (it_cas1 .gt. nt_cas) then
     1147  if (it_cas1 > nt_cas) then
    11601148     write(*,*) 'PB-stop: day, day_ju_ini_cas,it_cas1, it_cas2, timeit: '            &
    11611149          ,day,day_ju_ini_cas,it_cas1,it_cas2,timeit
     
    11641152
    11651153  ! time interpolation:
    1166   IF (it_cas1 .EQ. it_cas2) THEN
     1154  IF (it_cas1 == it_cas2) THEN
    11671155     frac=0.
    11681156  ELSE
     
    13631351
    13641352  it_cas1=INT(timeit/pdt_cas)+1
    1365   IF (it_cas1 .EQ. nt_cas) THEN
     1353  IF (it_cas1 == nt_cas) THEN
    13661354     it_cas2=it_cas1
    13671355  ELSE
     
    13731361  !print *,'it_cas1,it_cas2,time_cas1,time_cas2=',it_cas1,it_cas2,time_cas1,time_cas2
    13741362
    1375   if (it_cas1 .gt. nt_cas) then
     1363  if (it_cas1 > nt_cas) then
    13761364     write(*,*) 'PB-stop: day, day_ju_ini_cas,it_cas1, it_cas2, timeit: '            &
    13771365          ,day,day_ju_ini_cas,it_cas1,it_cas2,timeit
     
    13801368
    13811369  ! time interpolation:
    1382   IF (it_cas1 .EQ. it_cas2) THEN
     1370  IF (it_cas1 == it_cas2) THEN
    13831371     frac=0.
    13841372  ELSE
     
    14751463!**********************************************************************************************
    14761464
     1465END MODULE mod_1D_cases_read2
  • LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_cases_read_std.F90

    r4706 r5075  
    33!
    44MODULE mod_1D_cases_read_std
     5  USE lmdz_netcdf, ONLY:nf_noerr,nf_inq_varid,nf_inq_dimid,nf_inq_dimlen,nf_open,nf_nowrite,&
     6          nf_strerror,nf90_get_var
    57
    68!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    8789  !**********************************************************************************************
    8890  SUBROUTINE read_SCM_cas
    89     use netcdf, only: nf90_get_var
    9091    implicit none
    9192
    92     INCLUDE "netcdf.inc"
    9393    INCLUDE "date_cas.h"
    9494
     
    101101    ierr = NF_OPEN(fich_cas,NF_NOWRITE,nid)
    102102    print*,'fich_cas,NF_NOWRITE,nid ',fich_cas,NF_NOWRITE,nid
    103     if (ierr.NE.NF_NOERR) then
     103    if (ierr/=NF_NOERR) then
    104104       write(*,*) 'ERROR: GROS Pb opening forcings nc file '
    105105       write(*,*) NF_STRERROR(ierr)
     
    108108    !.......................................................................
    109109    ierr=NF_INQ_DIMID(nid,'lat',rid)
    110     IF (ierr.NE.NF_NOERR) THEN
     110    IF (ierr/=NF_NOERR) THEN
    111111       print*, 'Oh probleme lecture dimension lat'
    112112    ENDIF
     
    115115    !.......................................................................
    116116    ierr=NF_INQ_DIMID(nid,'lon',rid)
    117     IF (ierr.NE.NF_NOERR) THEN
     117    IF (ierr/=NF_NOERR) THEN
    118118       print*, 'Oh probleme lecture dimension lon'
    119119    ENDIF
     
    122122    !.......................................................................
    123123    ierr=NF_INQ_DIMID(nid,'lev',rid)
    124     IF (ierr.NE.NF_NOERR) THEN
     124    IF (ierr/=NF_NOERR) THEN
    125125       print*, 'Oh probleme lecture dimension nlev'
    126126    ENDIF
     
    134134    ierr=NF_INQ_DIMID(nid,'time',rid)
    135135    nt_cas=0
    136     IF (ierr.NE.NF_NOERR) THEN
     136    IF (ierr/=NF_NOERR) THEN
    137137       stop 'Oh probleme lecture dimension time'
    138138    ENDIF
     
    329329
    330330    !program reading forcing of the case study
    331     use netcdf, only: nf90_get_var
    332331    implicit none
    333     INCLUDE "netcdf.inc"
    334332    INCLUDE "compar1d.h"
    335333
     
    455453          ! Reading variables 1D (N+1) vertical variables (nlevelp1,lat,lon)
    456454          !-----------------------------------------------------------------------
    457           if(i.LE.4) then
     455          if(i<=4) then
    458456             ierr = NF90_GET_VAR(nid,var3didin(i),apbp)
    459457             print *,'read_SCM(apbp), on a lu ',i,name_var(i)
     
    466464             !  Reading 1D (N) vertical varialbes    (nlevel,lat,lon)   
    467465             !-----------------------------------------------------------------------
    468           else if(i.gt.4.and.i.LE.12) then 
     466          else if(i>4.and.i<=12) then
    469467             ierr = NF90_GET_VAR(nid,var3didin(i),resul1)
    470468             print *,'read_SCM(resul1), on a lu ',i,name_var(i)
     
    479477             !  TBD : seems to be the same as above.
    480478             !-----------------------------------------------------------------------
    481           else if(i.gt.12.and.i.LE.61) then
     479          else if(i>12.and.i<=61) then
    482480             ierr = NF90_GET_VAR(nid,var3didin(i),resul)
    483481             print *,'read_SCM(resul), on a lu ',i,name_var(i)
     
    491489             !  Reading 1D time variables (time,lat,lon)
    492490             !-----------------------------------------------------------------------
    493           else if (i.gt.62.and.i.LE.75) then
     491          else if (i>62.and.i<=75) then
    494492             ierr = NF90_GET_VAR(nid,var3didin(i),resul2)
    495493             print *,'read_SCM(resul2), on a lu ',i,name_var(i)
     
    777775
    778776    it_cas1=INT(timeit/pdt_cas)+1
    779     IF (it_cas1 .EQ. nt_cas) THEN
     777    IF (it_cas1 == nt_cas) THEN
    780778       it_cas2=it_cas1
    781779    ELSE
     
    787785    !     print *,'it_cas1,it_cas2,time_cas1,time_cas2=',it_cas1,it_cas2,time_cas1,time_cas2
    788786
    789     if (it_cas1 .gt. nt_cas) then
     787    if (it_cas1 > nt_cas) then
    790788       write(*,*) 'PB-stop: day, day_ju_ini_cas,it_cas1, it_cas2, timeit: '            &
    791789            ,day,day_ju_ini_cas,it_cas1,it_cas2,timeit
     
    794792
    795793    ! time interpolation:
    796     IF (it_cas1 .EQ. it_cas2) THEN
     794    IF (it_cas1 == it_cas2) THEN
    797795       frac=0.
    798796    ELSE
     
    989987    do l = 1, llm
    990988
    991        if (play(l).ge.plev_prof_cas(nlev_cas)) then
     989       if (play(l)>=plev_prof_cas(nlev_cas)) then
    992990
    993991          mxcalc=l
     
    996994          k2=0
    997995
    998           if (play(l).le.plev_prof_cas(1)) then
     996          if (play(l)<=plev_prof_cas(1)) then
    999997
    1000998             do k = 1, nlev_cas-1
    1001                 if (play(l).le.plev_prof_cas(k).and. play(l).gt.plev_prof_cas(k+1)) then
     999                if (play(l)<=plev_prof_cas(k).and. play(l)>plev_prof_cas(k+1)) then
    10021000                   k1=k
    10031001                   k2=k+1
     
    10051003             enddo
    10061004
    1007              if (k1.eq.0 .or. k2.eq.0) then
     1005             if (k1==0 .or. k2==0) then
    10081006                write(*,*) 'PB! k1, k2 = ',k1,k2
    10091007                write(*,*) 'l,play(l) = ',l,play(l)/100
     
    10191017             t_mod_cas(l)= t_prof_cas(k2) - frac*(t_prof_cas(k2)-t_prof_cas(k1))
    10201018             theta_mod_cas(l)= th_prof_cas(k2) - frac*(th_prof_cas(k2)-th_prof_cas(k1))
    1021              if(theta_mod_cas(l).NE.0) t_mod_cas(l)= theta_mod_cas(l)*(play(l)/100000.)**(RD/RCPD)
     1019             if(theta_mod_cas(l)/=0) t_mod_cas(l)= theta_mod_cas(l)*(play(l)/100000.)**(RD/RCPD)
    10221020             thv_mod_cas(l)= thv_prof_cas(k2) - frac*(thv_prof_cas(k2)-thv_prof_cas(k1))
    10231021             thl_mod_cas(l)= thl_prof_cas(k2) - frac*(thl_prof_cas(k2)-thl_prof_cas(k1))
     
    10681066             t_mod_cas(l)= frac1*t_prof_cas(k1) - frac2*t_prof_cas(k2)
    10691067             theta_mod_cas(l)= frac1*th_prof_cas(k1) - frac2*th_prof_cas(k2)
    1070              if(theta_mod_cas(l).NE.0) t_mod_cas(l)= theta_mod_cas(l)*(play(l)/100000.)**(RD/RCPD)
     1068             if(theta_mod_cas(l)/=0) t_mod_cas(l)= theta_mod_cas(l)*(play(l)/100000.)**(RD/RCPD)
    10711069             thv_mod_cas(l)= frac1*thv_prof_cas(k1) - frac2*thv_prof_cas(k2)
    10721070             thl_mod_cas(l)= frac1*thl_prof_cas(k1) - frac2*thl_prof_cas(k2)
     
    11651163    do l = 1, llm+1
    11661164
    1167        if (plev(l).ge.plev_prof_cas(nlev_cas)) then
     1165       if (plev(l)>=plev_prof_cas(nlev_cas)) then
    11681166
    11691167          mxcalc=l
     
    11711169          k2=0
    11721170
    1173           if (plev(l).le.plev_prof_cas(1)) then
     1171          if (plev(l)<=plev_prof_cas(1)) then
    11741172
    11751173             do k = 1, nlev_cas-1
    1176                 if (plev(l).le.plev_prof_cas(k).and. plev(l).gt.plev_prof_cas(k+1)) then
     1174                if (plev(l)<=plev_prof_cas(k).and. plev(l)>plev_prof_cas(k+1)) then
    11771175                   k1=k
    11781176                   k2=k+1
     
    11801178             enddo
    11811179
    1182              if (k1.eq.0 .or. k2.eq.0) then
     1180             if (k1==0 .or. k2==0) then
    11831181                write(*,*) 'PB! k1, k2 = ',k1,k2
    11841182                write(*,*) 'l,plev(l) = ',l,plev(l)/100
  • LMDZ6/trunk/libf/phylmd/dyn1d/old_1DUTILS_read_interp.h

    r4593 r5075  
    146146!program reading forcings of the TWP-ICE experiment
    147147
    148         use netcdf, only: nf90_get_var
     148        use lmdz_netcdf, ONLY: nf_open,nf_nowrite,nf_noerr,nf_strerror,nf_inq_varid,nf90_get_var,&
     149            nf_inq_dimid,nf_inq_dimlen
     150
    149151
    150152      implicit none
    151 
    152       INCLUDE "netcdf.inc"
    153153
    154154      integer ntime,nlevel
     
    492492         subroutine catchaxis(nid,ttm,llm,time,lev,ierr)
    493493
    494          use netcdf, only: nf90_get_var
     494         use lmdz_netcdf, ONLY: nf_open,nf_nowrite,nf_noerr,nf_strerror,nf_inq_varid,nf90_get_var,&
     495            nf_inq_dimid,nf_inq_dimlen
    495496
    496497         implicit none
    497          INCLUDE "netcdf.inc"
    498498         integer nid,ttm,llm
    499499         real*8 time(ttm)
     
    21702170
    21712171
    2172       use netcdf, only: nf90_get_var
     2172      use lmdz_netcdf, ONLY: nf_open,nf_nowrite,nf_noerr,nf_strerror,nf_inq_varid,nf90_get_var,&
     2173            nf_inq_dimid,nf_inq_dimlen
    21732174      implicit none
    2174 
    2175       INCLUDE "netcdf.inc"
    21762175
    21772176      integer ntime,nlevel
     
    23812380!program reading initial profils and forcings of the Dice case study
    23822381
    2383       use netcdf, only: nf90_get_var
     2382      use lmdz_netcdf, ONLY: nf_open,nf_nowrite,nf_noerr,nf_strerror,nf_inq_varid,nf90_get_var,&
     2383            nf_inq_dimid,nf_inq_dimlen
    23842384
    23852385      implicit none
    23862386
    2387       INCLUDE "netcdf.inc"
    23882387      INCLUDE "YOMCST.h"
    23892388
     
    27152714!program reading initial profils and forcings of the Gabls4 case study
    27162715
    2717       use netcdf, only: nf90_get_var
     2716      use lmdz_netcdf, ONLY: nf_open,nf_nowrite,nf_noerr,nf_strerror,nf_inq_varid,nf90_get_var,&
     2717            nf_inq_dimid,nf_inq_dimlen
    27182718
    27192719      implicit none
    2720 
    2721       INCLUDE "netcdf.inc"
    27222720
    27232721      integer ntime,nlevel,nsol
  • LMDZ6/trunk/libf/phylmd/dyn1d/old_1D_decl_cases.h

    r4593 r5075  
    1          INCLUDE "netcdf.inc"
    21
    32! Declarations specifiques au cas Toga
  • LMDZ6/trunk/libf/phylmd/dyn1d/old_lmdz1d.F90

    r4744 r5075  
    4444   USE temps_mod, ONLY: annee_ref, calend, day_end, day_ini, day_ref, &
    4545                        itau_dyn, itau_phy, start_time, year_len
    46    USE phys_cal_mod, ONLY : year_len_phys_cal_mod => year_len
     46   USE phys_cal_mod, ONLY : year_len_phys_cal_mod => year_len
     47   USE mod_1D_cases_read, ONLY: interp_case_time ! used in included old_1D_read_forc_cases.h
     48
    4749
    4850      implicit none
     
    366368      if (forcing_type <=0) THEN
    367369       forcing_les = .true.
    368       elseif (forcing_type .eq.1) THEN
     370      elseif (forcing_type ==1) THEN
    369371       forcing_radconv = .true.
    370       elseif (forcing_type .eq.2) THEN
     372      elseif (forcing_type ==2) THEN
    371373       forcing_toga    = .true.
    372       elseif (forcing_type .eq.3) THEN
     374      elseif (forcing_type ==3) THEN
    373375       forcing_GCM2SCM = .true.
    374       elseif (forcing_type .eq.4) THEN
     376      elseif (forcing_type ==4) THEN
    375377       forcing_twpice = .true.
    376       elseif (forcing_type .eq.5) THEN
     378      elseif (forcing_type ==5) THEN
    377379       forcing_rico = .true.
    378       elseif (forcing_type .eq.6) THEN
     380      elseif (forcing_type ==6) THEN
    379381       forcing_amma = .true.
    380       elseif (forcing_type .eq.7) THEN
     382      elseif (forcing_type ==7) THEN
    381383       forcing_dice = .true.
    382       elseif (forcing_type .eq.8) THEN
     384      elseif (forcing_type ==8) THEN
    383385       forcing_gabls4 = .true.
    384       elseif (forcing_type .eq.101) THEN ! Cindynamo starts 1-10-2011 0h
     386      elseif (forcing_type ==101) THEN ! Cindynamo starts 1-10-2011 0h
    385387       forcing_case = .true.
    386388       year_ini_cas=2011
     
    389391       heure_ini_cas=0.
    390392       pdt_cas=3*3600.         ! forcing frequency
    391       elseif (forcing_type .eq.102) THEN ! Bomex starts 24-6-1969 0h
     393      elseif (forcing_type ==102) THEN ! Bomex starts 24-6-1969 0h
    392394       forcing_case = .true.
    393395       year_ini_cas=1969
     
    396398       heure_ini_cas=0.
    397399       pdt_cas=1800.         ! forcing frequency
    398       elseif (forcing_type .eq.103) THEN ! Arm_cu starts 21-6-1997 11h30
     400      elseif (forcing_type ==103) THEN ! Arm_cu starts 21-6-1997 11h30
    399401       forcing_case2 = .true.
    400402       year_ini_cas=1997
     
    403405       heure_ini_cas=11.5
    404406       pdt_cas=1800.         ! forcing frequency
    405       elseif (forcing_type .eq.104) THEN ! rico starts 16-12-2004 0h
     407      elseif (forcing_type ==104) THEN ! rico starts 16-12-2004 0h
    406408       forcing_case2 = .true.
    407409       year_ini_cas=2004
     
    410412       heure_ini_cas=0.
    411413       pdt_cas=1800.         ! forcing frequency
    412       elseif (forcing_type .eq.105) THEN ! bomex starts 16-12-2004 0h
     414      elseif (forcing_type ==105) THEN ! bomex starts 16-12-2004 0h
    413415       forcing_case2 = .true.
    414416       year_ini_cas=1969
     
    417419       heure_ini_cas=0.
    418420       pdt_cas=1800.         ! forcing frequency
    419       elseif (forcing_type .eq.106) THEN ! ayotte_24SC starts 6-11-1992 0h
     421      elseif (forcing_type ==106) THEN ! ayotte_24SC starts 6-11-1992 0h
    420422       forcing_case2 = .true.
    421423       year_ini_cas=1992
     
    424426       heure_ini_cas=10.
    425427       pdt_cas=86400.        ! forcing frequency
    426       elseif (forcing_type .eq.113) THEN ! Arm_cu starts 21-6-1997 11h30
     428      elseif (forcing_type ==113) THEN ! Arm_cu starts 21-6-1997 11h30
    427429       forcing_SCM = .true.
    428430       year_ini_cas=1997
     
    432434       mth_ini_cas=1 ! pour le moment on compte depuis le debut de l'annee
    433435       call getin('time_ini',heure_ini_cas)
    434       elseif (forcing_type .eq.40) THEN
     436      elseif (forcing_type ==40) THEN
    435437       forcing_GCSSold = .true.
    436       elseif (forcing_type .eq.50) THEN
     438      elseif (forcing_type ==50) THEN
    437439       forcing_fire = .true.
    438       elseif (forcing_type .eq.59) THEN
     440      elseif (forcing_type ==59) THEN
    439441       forcing_sandu   = .true.
    440       elseif (forcing_type .eq.60) THEN
     442      elseif (forcing_type ==60) THEN
    441443       forcing_astex   = .true.
    442       elseif (forcing_type .eq.61) THEN
     444      elseif (forcing_type ==61) THEN
    443445       forcing_armcu = .true.
    444        IF(llm.NE.19.AND.llm.NE.40) stop 'Erreur nombre de niveaux !!'
     446       IF(llm/=19.AND.llm/=40) stop 'Erreur nombre de niveaux !!'
    445447      else
    446448       write (*,*) 'ERROR : unknown forcing_type ', forcing_type
     
    461463     jcode = iflag_nudge
    462464     do i = 1,nudge_max
    463        nudge(i) = mod(jcode,10) .ge. 1
     465       nudge(i) = mod(jcode,10) >= 1
    464466       jcode = jcode/10
    465467     enddo
     
    528530
    529531! Special case for arm_cu which lasts less than one day : 53100s !! (MPL 20111026)
    530       IF(forcing_type .EQ. 61) fnday=53100./86400.
    531       IF(forcing_type .EQ. 103) fnday=53100./86400.
     532      IF(forcing_type == 61) fnday=53100./86400.
     533      IF(forcing_type == 103) fnday=53100./86400.
    532534! Special case for amma which lasts less than one day : 64800s !! (MPL 20120216)
    533       IF(forcing_type .EQ. 6) fnday=64800./86400.
     535      IF(forcing_type == 6) fnday=64800./86400.
    534536!     IF(forcing_type .EQ. 6) fnday=50400./86400.
    535  IF(forcing_type .EQ. 8 ) fnday=129600./86400.
     537 IF(forcing_type == 8 ) fnday=129600./86400.
    536538      annee_ref = anneeref
    537539      mois = 1
     
    544546      day_end = day_ini + int(fnday)
    545547
    546       IF (forcing_type .eq.2) THEN
     548      IF (forcing_type ==2) THEN
    547549! Convert the initial date of Toga-Coare to Julian day
    548550      call ymds2ju                                                          &
    549551     & (year_ini_toga,mth_ini_toga,day_ini_toga,heure,day_ju_ini_toga)
    550552
    551       ELSEIF (forcing_type .eq.4) THEN
     553      ELSEIF (forcing_type ==4) THEN
    552554! Convert the initial date of TWPICE to Julian day
    553555      call ymds2ju                                                          &
    554556     & (year_ini_twpi,mth_ini_twpi,day_ini_twpi,heure_ini_twpi              &
    555557     & ,day_ju_ini_twpi)
    556       ELSEIF (forcing_type .eq.6) THEN
     558      ELSEIF (forcing_type ==6) THEN
    557559! Convert the initial date of AMMA to Julian day
    558560      call ymds2ju                                                          &
    559561     & (year_ini_amma,mth_ini_amma,day_ini_amma,heure_ini_amma              &
    560562     & ,day_ju_ini_amma)
    561       ELSEIF (forcing_type .eq.7) THEN
     563      ELSEIF (forcing_type ==7) THEN
    562564! Convert the initial date of DICE to Julian day
    563565      call ymds2ju                                                         &
    564566     & (year_ini_dice,mth_ini_dice,day_ini_dice,heure_ini_dice             &
    565567     & ,day_ju_ini_dice)
    566  ELSEIF (forcing_type .eq.8 ) THEN
     568 ELSEIF (forcing_type ==8 ) THEN
    567569! Convert the initial date of GABLS4 to Julian day
    568570      call ymds2ju                                                         &
    569571     & (year_ini_gabls4,mth_ini_gabls4,day_ini_gabls4,heure_ini_gabls4     &
    570572     & ,day_ju_ini_gabls4)
    571       ELSEIF (forcing_type .gt.100) THEN
     573      ELSEIF (forcing_type >100) THEN
    572574! Convert the initial date to Julian day
    573575      day_ini_cas=day_deb
     
    577579     & ,day_ju_ini_cas)
    578580      print*,'time case 2',day_ini_cas,day_ju_ini_cas
    579       ELSEIF (forcing_type .eq.59) THEN
     581      ELSEIF (forcing_type ==59) THEN
    580582! Convert the initial date of Sandu case to Julian day
    581583      call ymds2ju                                                          &
     
    583585     &    time_ini*3600.,day_ju_ini_sandu)
    584586
    585       ELSEIF (forcing_type .eq.60) THEN
     587      ELSEIF (forcing_type ==60) THEN
    586588! Convert the initial date of Astex case to Julian day
    587589      call ymds2ju                                                          &
     
    589591     &    time_ini*3600.,day_ju_ini_astex)
    590592
    591       ELSEIF (forcing_type .eq.61) THEN
     593      ELSEIF (forcing_type ==61) THEN
    592594! Convert the initial date of Arm_cu case to Julian day
    593595      call ymds2ju                                                          &
     
    596598      ENDIF
    597599
    598       IF (forcing_type .gt.100) THEN
     600      IF (forcing_type >100) THEN
    599601      daytime = day + heure_ini_cas/24. ! 1st day and initial time of the simulation
    600602      ELSE
     
    638640      call phys_state_var_init(read_climoz)
    639641
    640       if (ngrid.ne.klon) then
     642      if (ngrid/=klon) then
    641643         print*,'stop in inifis'
    642644         print*,'Probleme de dimensions :'
     
    702704      zlay=-rd*300.*log(play/psurf)/rg ! moved after reading profiles
    703705
    704       IF (forcing_type .eq. 59) THEN
     706      IF (forcing_type == 59) THEN
    705707! pour forcing_sandu, on cherche l'indice le plus proche de 700hpa#3000m
    706708      write(*,*) '***********************'
    707709      do l = 1, llm
    708710       write(*,*) 'l,play(l),presnivs(l): ',l,play(l),presnivs(l)
    709        if (trouve_700 .and. play(l).le.70000) then
     711       if (trouve_700 .and. play(l)<=70000) then
    710712         llm700=l
    711713         print *,'llm700,play=',llm700,play(l)/100.
     
    826828        print*,'avant phyredem'
    827829        pctsrf(1,:)=0.
    828           if (nat_surf.eq.0.) then
     830          if (nat_surf==0.) then
    829831          pctsrf(1,is_oce)=1.
    830832          pctsrf(1,is_ter)=0.
    831833          pctsrf(1,is_lic)=0.
    832834          pctsrf(1,is_sic)=0.
    833         else if (nat_surf .eq. 1) then
     835        else if (nat_surf == 1) then
    834836          pctsrf(1,is_oce)=0.
    835837          pctsrf(1,is_ter)=1.
    836838          pctsrf(1,is_lic)=0.
    837839          pctsrf(1,is_sic)=0.
    838         else if (nat_surf .eq. 2) then
     840        else if (nat_surf == 2) then
    839841          pctsrf(1,is_oce)=0.
    840842          pctsrf(1,is_ter)=0.
    841843          pctsrf(1,is_lic)=1.
    842844          pctsrf(1,is_sic)=0.
    843         else if (nat_surf .eq. 3) then
     845        else if (nat_surf == 3) then
    844846          pctsrf(1,is_oce)=0.
    845847          pctsrf(1,is_ter)=0.
     
    870872        pbl_tke(:,2,:)=1.e-2
    871873        PRINT *, ' pbl_tke dans lmdz1d '
    872         if (prt_level .ge. 5) then
     874        if (prt_level >= 5) then
    873875         DO nsrf = 1,4
    874876           PRINT *,'pbl_tke(1,:,',nsrf,') ',pbl_tke(1,:,nsrf)
     
    10211023      endif
    10221024!Al1 ================  end restart =================================
    1023       IF (ecrit_slab_oc.eq.1) then
     1025      IF (ecrit_slab_oc==1) then
    10241026         open(97,file='div_slab.dat',STATUS='UNKNOWN')
    1025        elseif (ecrit_slab_oc.eq.0) then
     1027       elseif (ecrit_slab_oc==0) then
    10261028         open(97,file='div_slab.dat',STATUS='OLD')
    10271029       endif
     
    10461048      it_end = nint(fnday*day_step)
    10471049!test JLD     it_end = 10
    1048       do while(it.le.it_end)
    1049 
    1050        if (prt_level.ge.1) then
     1050      do while(it<=it_end)
     1051
     1052       if (prt_level>=1) then
    10511053         print*,'XXXXXXXXXXXXXXXXXXX ITAP,day,time=',                       &
    10521054     &             it,day,time,it_end,day_step
     
    10541056       endif
    10551057!Al1 demande de restartphy.nc
    1056        if (it.eq.it_end) lastcall=.True.
     1058       if (it==it_end) lastcall=.True.
    10571059
    10581060!---------------------------------------------------------------------
     
    11491151
    11501152       if (forcing_toga .or. forcing_GCSSold .or. forcing_twpice            &
    1151      &    .or.forcing_amma .or. forcing_type.eq.101) then
     1153     &    .or.forcing_amma .or. forcing_type==101) then
    11521154         fcoriolis=0.0 ; ug=0. ; vg=0.
    11531155       endif
     
    11641166!on calcule dt_cooling
    11651167        do l=1,llm
    1166         if (play(l).ge.20000.) then
     1168        if (play(l)>=20000.) then
    11671169            dt_cooling(l)=-1.5/86400.
    1168         elseif ((play(l).ge.10000.).and.((play(l).lt.20000.))) then
     1170        elseif ((play(l)>=10000.).and.((play(l)<20000.))) then
    11691171            dt_cooling(l)=-1.5/86400.*(play(l)-10000.)/(10000.)-1./86400.*(20000.-play(l))/10000.*(temp(l)-200.)
    11701172        else
     
    12731275     &               +d_q_nudge(1:mxcalc,:) )
    12741276
    1275         if (prt_level.ge.3) then
     1277        if (prt_level>=3) then
    12761278          print *,                                                          &
    12771279     &    'physiq-> temp(1),dt_phys(1),d_t_adv(1),dt_cooling(1) ',         &
     
    13511353
    13521354!Al1
    1353       if (ecrit_slab_oc.ne.-1) close(97)
     1355      if (ecrit_slab_oc/=-1) close(97)
    13541356
    13551357!Al1 Call to 1D equivalent of dynredem (an,mois,jour,heure ?)
Note: See TracChangeset for help on using the changeset viewer.