Ignore:
Timestamp:
Mar 1, 2023, 6:22:39 PM (16 months ago)
Author:
Laurent Fairhead
Message:

Merged trunk revisions from 4127 to 4443 (HEAD) into branch

Location:
LMDZ6/branches/Portage_acc/libf/phylmdiso
Files:
1 added
1 deleted
38 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/add_phys_tend_mod.F90

    r4004 r4446  
    3939  USE mod_grid_phy_lmdz, ONLY: nbp_lev
    4040#ifdef ISO
    41   USE infotrac_phy, ONLY: ntraciso
     41  USE infotrac_phy, ONLY: ntraciso=>ntiso
    4242  USE isotopes_mod, ONLY: iso_eau
    4343#endif
     
    154154
    155155#ifdef ISO
    156     USE infotrac_phy, ONLY: ntraciso 
     156    USE infotrac_phy, ONLY: ntraciso=>ntiso
    157157#ifdef ISOVERIF
    158158    USE isotopes_mod, ONLY: iso_eau
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/add_wake_tend.F90

    r4004 r4446  
    1818USE print_control_mod, ONLY: prt_level
    1919#ifdef ISO
    20     USE infotrac_phy, ONLY: ntraciso   
     20    USE infotrac_phy, ONLY: ntiso   
    2121    USE phys_state_var_mod, ONLY:  wake_deltaxt   
    2222#endif
     
    3131  INTEGER,                       INTENT (IN)         :: abortphy
    3232#ifdef ISO
    33   REAL, DIMENSION(ntraciso,klon, klev),   INTENT (IN)         :: zddeltaxt
     33  REAL, DIMENSION(ntiso, klon, klev), INTENT (IN)    :: zddeltaxt
    3434#endif
    3535
     
    6161               wake_deltaq(i, l) = wake_deltaq(i, l) + zddeltaq(i,l)
    6262#ifdef ISO
    63                do ixt=1,ntraciso
     63               do ixt=1,ntiso
    6464                 wake_deltaxt(ixt,i, l) = wake_deltaxt(ixt,i, l) + zddeltaxt(ixt,i,l)
    6565               enddo
     
    6969               wake_deltaq(i, l) = 0.
    7070#ifdef ISO
    71                do ixt=1,ntraciso
     71               do ixt=1,ntiso
    7272                 wake_deltaxt(ixt,i, l) = 0.0
    7373               enddo
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/ajsec.F90

    r4004 r4446  
    99  USE dimphy
    1010#ifdef ISO
    11     USE infotrac_phy, ONLY: ntraciso    
     11    USE infotrac_phy, ONLY: ntraciso =>ntiso   
    1212#ifdef ISOVERIF
    1313  USE isotopes_mod, ONLY : iso_eau,iso_HDO
     
    303303  USE dimphy
    304304#ifdef ISO
    305     USE infotrac_phy, ONLY: ntraciso      
     305    USE infotrac_phy, ONLY: ntraciso=>ntiso   
    306306#ifdef ISOVERIF
    307307  USE isotopes_mod, ONLY : iso_eau,iso_HDO
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/calwake.F90

    r4033 r4446  
    3535  USE print_control_mod, ONLY: mydebug=>debug , lunout, prt_level
    3636#ifdef ISO
    37   USE infotrac_phy, ONLY : ntraciso
     37  USE infotrac_phy, ONLY : ntraciso=>ntiso
    3838#ifdef ISOVERIF
    3939  USE isotopes_mod, ONLY: iso_eau
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/change_srf_frac_mod.F90

    r4004 r4446  
    3939    USE print_control_mod, ONLY: lunout
    4040#ifdef ISO
    41   USE infotrac_phy, ONLY: ntraciso   
     41  USE infotrac_phy, ONLY: ntiso   
    4242#endif
    4343   
     
    6666!albedo SB <<<
    6767#ifdef ISO
    68     REAL, DIMENSION(ntraciso,klon,nbsrf), INTENT(INOUT)        :: xtevap
     68    REAL, DIMENSION(ntiso,klon,nbsrf), INTENT(INOUT)        :: xtevap
    6969#endif
    7070
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/climb_hq_mod.F90

    r4124 r4446  
    66  USE dimphy
    77#ifdef ISO
    8   USE infotrac_phy, ONLY: ntraciso ! ajout C Risi pour isos     
     8  USE infotrac_phy, ONLY: ntraciso=>ntiso ! ajout C Risi pour isos     
    99#endif
    1010
     
    5959            )
    6060#ifdef ISOVERIF
    61 !USE infotrac_phy, ONLY: use_iso
    6261USE isotopes_mod, ONLY: iso_eau,iso_HDO
    6362!USE isotopes_verif_mod, ONLY: errmax, errmaxrel
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/concvl.F90

    r4004 r4446  
    4444  USE infotrac_phy, ONLY: nbtr
    4545#ifdef ISO
    46   USE infotrac_phy, ONLY: ntraciso
     46  USE infotrac_phy, ONLY: ntraciso=>ntiso
    4747  USE isotopes_mod, ONLY: iso_eau, bidouille_anti_divergence, ridicule, &
    4848        iso_eau,iso_HDO
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/cv30_routines.F90

    r4050 r4446  
    165165    )
    166166#ifdef ISO
    167     USE infotrac_phy, ONLY: ntraciso   
     167    USE infotrac_phy, ONLY: ntraciso=>ntiso
    168168#endif
    169169  IMPLICIT NONE
     
    370370
    371371#ifdef ISO
    372 USE infotrac_phy, ONLY: ntraciso
     372USE infotrac_phy, ONLY: ntraciso=>ntiso
    373373USE isotopes_mod, ONLY: pxtmelt,pxtice,pxtmin,pxtmax,cond_temp_env, &
    374374        iso_eau,iso_HDO, ridicule
     
    947947  USE print_control_mod, ONLY: lunout
    948948#ifdef ISO
    949     use infotrac_phy, ONLY: ntraciso
     949    use infotrac_phy, ONLY: ntraciso=>ntiso
    950950    use isotopes_mod, ONLY: essai_convergence, iso_eau,iso_HDO
    951951#ifdef ISOVERIF
     
    11331133    ! epmax_cape: ajout arguments
    11341134#ifdef ISO
    1135 use infotrac_phy, ONLY: ntraciso
     1135use infotrac_phy, ONLY: ntraciso=>ntiso
    11361136USE isotopes_mod, ONLY: pxtmelt,pxtice,pxtmin,pxtmax,cond_temp_env, iso_eau,iso_HDO
    11371137USE isotopes_routines_mod, ONLY: condiso_liq_ice_vectall
     
    18281828
    18291829#ifdef ISO
    1830 use infotrac_phy, ONLY: ntraciso,niso,index_trac
     1830use infotrac_phy, ONLY: ntraciso=>ntiso,niso,itZonIso
    18311831USE isotopes_mod, ONLY: pxtmelt,pxtice,pxtmin,pxtmax, iso_eau,iso_HDO, &
    18321832        ridicule
     
    26162616        call iso_verif_traceur(xtclw(1,il,im), &
    26172617     &          'condiso_liq_ice_vectiso_trac 358')
    2618         if (iso_verif_positif_nostop(xtclw(index_trac( &
     2618        if (iso_verif_positif_nostop(xtclw(itZonIso( &
    26192619     &           izone_cond,iso_eau),i,k)-xtclw(iso_eau,i,k) &
    26202620     &           ,'cv30_routines 909').eq.1) then
     
    26242624     &             niso,ntraciso,index_zone,izone_cond       
    26252625               stop
    2626          endif !if (iso_verif_positif_nostop(xtclw(index_trac(
     2626         endif !if (iso_verif_positif_nostop(xtclw(itZonIso(
    26272627#endif             
    26282628         enddo !do il = 1, ncum   
     
    26472647     &          )
    26482648#ifdef ISO
    2649     use infotrac_phy, ONLY: ntraciso
     2649    use infotrac_phy, ONLY: ntraciso=>ntiso
    26502650    use isotopes_mod, ONLY: essai_convergence, iso_eau,iso_HDO,ridicule
    26512651    use isotopes_routines_mod, ONLY: appel_stewart_vectall
     
    26592659#ifdef ISOTRAC
    26602660    use isotrac_mod, only: option_cond,izone_cond
    2661     use infotrac_phy, ONLY: index_trac
     2661    use infotrac_phy, ONLY: itZonIso
    26622662#ifdef ISOVERIF
    26632663    use isotopes_verif_mod, ONLY: iso_verif_traceur_justmass, &
     
    29382938           ! on verifie que tout le detrainement est tagge condensat
    29392939           if (iso_verif_positif_nostop( &
    2940      &          xtwdtrain(index_trac(izone_cond,iso_eau),il) &
     2940     &          xtwdtrain(itZonIso(izone_cond,iso_eau),il) &
    29412941     &          -xtwdtrain(iso_eau,il), &
    29422942     &          'cv30_routines 2795').eq.1) then
     
    32003200!        if (option_tmin.ge.1) then
    32013201!           call iso_verif_positif(xtwater(
    3202 !     :           index_trac(izone_cond,iso_eau),il,i+1)
     3202!     :           itZonIso(izone_cond,iso_eau),il,i+1)
    32033203!     :           -xtwater(iso_eau,il,i+1),
    32043204!     :          'cv30_routines 3083')
     
    32593259!        if (option_tmin.ge.1) then
    32603260!         call iso_verif_positif(xtwater(
    3261 !     :           index_trac(izone_cond,iso_eau),il,i)
     3261!     :           itZonIso(izone_cond,iso_eau),il,i)
    32623262!     :           -xtwater(iso_eau,il,i),
    32633263!     :          'cv30_routines 3143')
     
    33693369     &                    )
    33703370#ifdef ISO
    3371     use infotrac_phy, ONLY: ntraciso,niso, &
    3372 &       ntraceurs_zone,index_trac
     3371    use infotrac_phy, ONLY: ntraciso=>ntiso, niso, nzone, itZonIso
    33733372    use isotopes_mod, ONLY: essai_convergence,ridicule,iso_eau,iso_HDO,iso_O18
    33743373#ifdef ISOVERIF
     
    50035002          do iiso = 1, niso
    50045003             
    5005              ixt_ddft=index_trac(izone_ddft,iiso) 
     5004             ixt_ddft=itZonIso(izone_ddft,iiso) 
    50065005             if (mp(il,i).gt.mp(il,i+1)) then
    50075006                fxtYe(iiso)=0.01*grav*dpinv*mp(il,i) &
     
    50165015     &              -mp(il,i)*(xtp(iiso,il,i)-xt(iiso,il,i-1)))
    50175016       
    5018              ixt_poubelle=index_trac(izone_poubelle,iiso)
     5017             ixt_poubelle=itZonIso(izone_poubelle,iiso)
    50195018             fxt(ixt_ddft,il,i)=fxt(ixt_ddft,il,i)+fxtYe(iiso)
    50205019             fxt(ixt_poubelle,il,i)=fxt(ixt_poubelle,il,i) &
     
    50335032     &              -mp(il,i)*(xtp(iiso,il,i)-xt(iiso,il,i-1)))
    50345033
    5035                 ixt_ddft=index_trac(izone_ddft,iiso)
     5034                ixt_ddft=itZonIso(izone_ddft,iiso)
    50365035                fxtYe(iiso)=0.01*grav*dpinv*mp(il,i) &
    50375036     &           *(xt(ixt_ddft,il,i-1)-xt(ixt_ddft,il,i))
    50385037                fxt(ixt_ddft,il,i)=fxt(ixt_ddft,il,i)+fxtYe(iiso) 
    50395038
    5040                ixt_revap=index_trac(izone_revap,iiso) 
     5039               ixt_revap=itZonIso(izone_revap,iiso) 
    50415040               fxt_revap(iiso)=0.01*grav*dpinv*(mp(il,i+1)* &
    50425041     &                  (xtp(ixt_revap,il,i+1)-xt(ixt_revap,il,i)) &
     
    50495048     &                   -xt(ixt_ddft,il,i)-xt(ixt_revap,il,i)
    50505049                if (Xe(iiso).gt.ridicule) then
    5051                   do izone=1,ntraceurs_zone
     5050                  do izone=1,nzone
    50525051                   if ((izone.ne.izone_revap).and. &
    50535052     &                   (izone.ne.izone_ddft)) then
    5054                     ixt=index_trac(izone,iiso)
     5053                    ixt=itZonIso(izone,iiso)
    50555054                    fxt(ixt,il,i)=fxt(ixt,il,i) &
    50565055     &                   +xt(ixt,il,i)/Xe(iiso)*fxtXe(iiso)
    50575056                   endif !if ((izone.ne.izone_revap).and.
    5058                   enddo !do izone=1,ntraceurs_zone   
     5057                  enddo !do izone=1,nzone   
    50595058#ifdef ISOVERIF
    50605059!                write(*,*) 'iiso=',iiso
     
    50785077                endif
    50795078#endif                   
    5080                 do izone=1,ntraceurs_zone
     5079                do izone=1,nzone
    50815080                   if ((izone.ne.izone_revap).and. &
    50825081     &                   (izone.ne.izone_ddft)) then                   
    5083                     ixt=index_trac(izone,iiso)
     5082                    ixt=itZonIso(izone,iiso)
    50845083                    if (izone.eq.izone_poubelle) then
    50855084                      fxt(ixt,il,i)=fxt(ixt,il,i)+fxtXe(iiso)
     
    50885087                    endif !if (izone.eq.izone_poubelle) then
    50895088                   endif !if ((izone.ne.izone_revap).and.
    5090                 enddo !do izone=1,ntraceurs_zone
     5089                enddo !do izone=1,nzone
    50915090#ifdef ISOVERIF
    50925091                  call iso_verif_traceur_justmass(fxt(1,il,i), &
     
    52375236        enddo !do ixt = 1+niso,ntraciso
    52385237!        write(*,*) 'tmp cv3_yield 4165: i,il=',i,il
    5239 !        ixt_poubelle=index_trac(izone_poubelle,iso_eau)
    5240 !        ixt_ddft=index_trac(izone_ddft,iso_eau)
     5238!        ixt_poubelle=itZonIso(izone_poubelle,iso_eau)
     5239!        ixt_ddft=itZonIso(izone_ddft,iso_eau)
    52415240!        write(*,*) 'delt*fxt(ixt_poubelle,il,i)=',
    52425241!     :           delt*fxt(ixt_poubelle,il,i)
     
    52445243!        write(*,*) 'xt(iso_eau,il,i)=',xt(iso_eau,il,i)
    52455244          do iiso = 1, niso
    5246              ixt_poubelle=index_trac(izone_poubelle,iiso)
    5247              ixt_ddft=index_trac(izone_ddft,iiso) 
     5245             ixt_poubelle=itZonIso(izone_poubelle,iiso)
     5246             ixt_ddft=itZonIso(izone_ddft,iiso) 
    52485247             if (mp(il,i).gt.mp(il,i+1)) then
    52495248                fxtYe(iiso)=0.01*grav*dpinv*mp(il,i) &
     
    61116110
    61126111#ifdef ISO
    6113     use infotrac_phy, ONLY: ntraciso
     6112    use infotrac_phy, ONLY: ntraciso=>ntiso
    61146113#ifdef ISOVERIF
    61156114    use isotopes_verif_mod, ONLY: Tmin_verif,iso_verif_aberrant, &
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/cv3_enthalpmix.F90

    r4004 r4446  
    77                       )
    88#ifdef ISO
    9     use infotrac_phy, ONLY: ntraciso
     9    use infotrac_phy, ONLY: ntiso
    1010#endif
    1111  ! **************************************************************
     
    4343  REAL, DIMENSION (len,nd+1), INTENT (IN)   :: ph
    4444#ifdef ISO
    45   REAL, DIMENSION (ntraciso,len,nd), INTENT (IN)     :: xt
     45  REAL, DIMENSION (ntiso,len,nd), INTENT (IN)     :: xt
    4646#endif
    4747!input/output:
     
    5454  REAL, DIMENSION (len,nd), INTENT (OUT)    :: wi
    5555#ifdef ISO
    56   REAL, DIMENSION (ntraciso,len), INTENT (OUT)     :: xtmix
     56  REAL, DIMENSION (ntiso,len), INTENT (OUT)     :: xtmix
    5757#endif
    5858!internal variables :
     
    153153        vmix(i) = vmix(i) + v(i, j)*wi(i, j)
    154154#ifdef ISO
    155         do ixt=1,ntraciso
     155        do ixt=1,ntiso
    156156          xtmix(ixt,i) = xtmix(ixt,i) +  xt(ixt,i, j)*wi(i, j)
    157157        enddo
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/cv3_estatmix.F90

    r4004 r4446  
    77                       )
    88#ifdef ISO
    9     use infotrac_phy, ONLY: ntraciso
     9    use infotrac_phy, ONLY: ntiso
    1010#endif
    1111  ! **************************************************************
     
    4646  REAL, DIMENSION (len,nd+1), INTENT (IN)   :: ph
    4747#ifdef ISO
    48   REAL, DIMENSION (ntraciso,len,nd), INTENT (IN)     :: xt
     48  REAL, DIMENSION (ntiso,len,nd), INTENT (IN)     :: xt
    4949#endif
    5050!input/output:
     
    5757  REAL, DIMENSION (len,nd), INTENT (OUT)    :: wi
    5858#ifdef ISO
    59   REAL, DIMENSION (ntraciso,len), INTENT (OUT)     :: xtmix
     59  REAL, DIMENSION (ntiso,len), INTENT (OUT)     :: xtmix
    6060#endif
    6161!internal variables :
     
    153153        vmix(i) = vmix(i) +  v(i, j)*wi(i, j)
    154154#ifdef ISO
    155         do ixt=1,ntraciso
     155        do ixt=1,ntiso
    156156          xtmix(ixt,i) = xtmix(ixt,i) +  xt(ixt,i, j)*wi(i, j)
    157157        enddo
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/cv3_routines.F90

    r4123 r4446  
    314314     &   )
    315315#ifdef ISO
    316     use infotrac_phy, ONLY: ntraciso
     316    use infotrac_phy, ONLY: ntraciso=>ntiso
    317317#ifdef ISOVERIF
    318318    use isotopes_verif_mod, ONLY: iso_verif_positif,iso_verif_noNaN,iso_verif_egalite
     
    685685     &                   )
    686686#ifdef ISO
    687 USE infotrac_phy, ONLY: ntraciso
     687USE infotrac_phy, ONLY: ntraciso=>ntiso
    688688USE isotopes_mod, ONLY: pxtmelt,pxtice,pxtmin,pxtmax,cond_temp_env, &
    689689        iso_eau,iso_HDO,ridicule
     
    12741274  USE print_control_mod, ONLY: lunout
    12751275#ifdef ISO
    1276     use infotrac_phy, ONLY: ntraciso
     1276    use infotrac_phy, ONLY: ntraciso=>ntiso
    12771277    use isotopes_mod, ONLY: essai_convergence, iso_eau,iso_HDO
    12781278#ifdef ISOVERIF
     
    14741474  USE print_control_mod, ONLY: prt_level
    14751475#ifdef ISO
    1476 use infotrac_phy, ONLY: ntraciso
     1476use infotrac_phy, ONLY: ntraciso=>ntiso
    14771477USE isotopes_mod, ONLY: pxtmelt,pxtice,pxtmin,pxtmax,cond_temp_env, &
    14781478        iso_eau,iso_HDO
     
    27772777
    27782778#ifdef ISO
    2779 use infotrac_phy, ONLY: ntraciso,niso,index_trac
     2779use infotrac_phy, ONLY: ntraciso=>ntiso,niso,itZonIso
    27802780USE isotopes_mod, ONLY: pxtmelt,pxtice,pxtmin,pxtmax, iso_eau,iso_HDO, &
    27812781        ridicule
     
    35803580        call iso_verif_traceur(xtclw(1,il,im), &
    35813581     &          'condiso_liq_ice_vectiso_trac 358')
    3582         if (iso_verif_positif_nostop(xtclw(index_trac( &
     3582        if (iso_verif_positif_nostop(xtclw(itZonIso( &
    35833583     &           izone_cond,iso_eau),i,k)-xtclw(iso_eau,i,k) &
    35843584     &           ,'cv3_routines 909').eq.1) then
     
    35883588     &             niso,ntraciso,index_zone,izone_cond     
    35893589               stop
    3590          endif !if (iso_verif_positif_nostop(xtclw(index_trac(
     3590         endif !if (iso_verif_positif_nostop(xtclw(itZonIso(
    35913591#endif             
    35923592         enddo !do il = 1, ncum   
     
    36153615  USE print_control_mod, ONLY: prt_level, lunout
    36163616#ifdef ISO
    3617     use infotrac_phy, ONLY: ntraciso
     3617    use infotrac_phy, ONLY: ntraciso=>ntiso
    36183618    use isotopes_mod, ONLY: essai_convergence, iso_eau,iso_HDO, &
    36193619        ridicule
     
    36283628#ifdef ISOTRAC
    36293629    use isotrac_mod, only: option_cond,izone_cond
    3630     use infotrac_phy, ONLY: index_trac
     3630    use infotrac_phy, ONLY: itZonIso
    36313631#ifdef ISOVERIF
    36323632    use isotopes_verif_mod, ONLY: iso_verif_traceur_justmass, &
     
    39933993          ! on verifie que tout le detrainement est tagge condensat
    39943994          if (iso_verif_positif_nostop( &
    3995      &          xtwdtrain(index_trac(izone_cond,iso_eau),il) &
     3995     &          xtwdtrain(itZonIso(izone_cond,iso_eau),il) &
    39963996     &          -xtwdtrain(iso_eau,il), &
    39973997     &          'cv3_routines 2795').eq.1) then
     
    45354535!        if (option_tmin.ge.1) then
    45364536!           call iso_verif_positif(xtwater(
    4537 !     :           index_trac(izone_cond,iso_eau),il,i+1)
     4537!     :           itZonIso(izone_cond,iso_eau),il,i+1)
    45384538!     :           -xtwater(iso_eau,il,i+1),
    45394539!     :          'cv3_routines 3083')
     
    46024602!        if (option_tmin.ge.1) then
    46034603!         call iso_verif_positif(xtwater(
    4604 !     :           index_trac(izone_cond,iso_eau),il,i)
     4604!     :           itZonIso(izone_cond,iso_eau),il,i)
    46054605!     :           -xtwater(iso_eau,il,i),
    46064606!     :          'cv3_routines 3143')
     
    47414741
    47424742#ifdef ISO
    4743     use infotrac_phy, ONLY: ntraciso,niso, &
    4744 &       ntraceurs_zone,index_trac
     4743    use infotrac_phy, ONLY: ntraciso=>ntiso, niso, nzone, itZonIso
    47454744    use isotopes_mod, ONLY: essai_convergence,ridicule,iso_eau,iso_HDO,iso_O18
    47464745#ifdef ISOVERIF
     
    58895888          do iiso = 1, niso
    58905889             
    5891              ixt_ddft=index_trac(izone_ddft,iiso) 
     5890             ixt_ddft=itZonIso(izone_ddft,iiso) 
    58925891             if (mp(il,i).gt.mp(il,i+1)) then
    58935892                fxtYe(iiso)=0.01*grav*dpinv*mp(il,i) &
     
    59025901     &              -mp(il,i)*(xtp(iiso,il,i)-xt(iiso,il,i-1)))
    59035902       
    5904              ixt_poubelle=index_trac(izone_poubelle,iiso)
     5903             ixt_poubelle=itZonIso(izone_poubelle,iiso)
    59055904             fxt(ixt_ddft,il,i)=fxt(ixt_ddft,il,i)+fxtYe(iiso)
    59065905             fxt(ixt_poubelle,il,i)=fxt(ixt_poubelle,il,i) &
     
    59195918     &              -mp(il,i)*(xtp(iiso,il,i)-xt(iiso,il,i-1)))
    59205919
    5921                 ixt_ddft=index_trac(izone_ddft,iiso)
     5920                ixt_ddft=itZonIso(izone_ddft,iiso)
    59225921                fxtYe(iiso)=0.01*grav*dpinv*mp(il,i) &
    59235922     &           *(xt(ixt_ddft,il,i-1)-xt(ixt_ddft,il,i))
    59245923                fxt(ixt_ddft,il,i)=fxt(ixt_ddft,il,i)+fxtYe(iiso) 
    59255924
    5926                ixt_revap=index_trac(izone_revap,iiso) 
     5925               ixt_revap=itZonIso(izone_revap,iiso) 
    59275926               fxt_revap(iiso)=0.01*grav*dpinv*(mp(il,i+1)* &
    59285927     &                  (xtp(ixt_revap,il,i+1)-xt(ixt_revap,il,i)) &
     
    59355934     &                   -xt(ixt_ddft,il,i)-xt(ixt_revap,il,i)
    59365935                if (Xe(iiso).gt.ridicule) then
    5937                   do izone=1,ntraceurs_zone
     5936                  do izone=1,nzone
    59385937                   if ((izone.ne.izone_revap).and. &
    59395938     &                   (izone.ne.izone_ddft)) then
    5940                     ixt=index_trac(izone,iiso)
     5939                    ixt=itZonIso(izone,iiso)
    59415940                    fxt(ixt,il,i)=fxt(ixt,il,i) &
    59425941     &                   +xt(ixt,il,i)/Xe(iiso)*fxtXe(iiso)
    59435942                   endif !if ((izone.ne.izone_revap).and.
    5944                   enddo !do izone=1,ntraceurs_zone   
     5943                  enddo !do izone=1,nzone   
    59455944#ifdef ISOVERIF
    59465945!                write(*,*) 'iiso=',iiso
     
    59645963                endif
    59655964#endif                   
    5966                 do izone=1,ntraceurs_zone
     5965                do izone=1,nzone
    59675966                   if ((izone.ne.izone_revap).and. &
    59685967     &                   (izone.ne.izone_ddft)) then                   
    5969                     ixt=index_trac(izone,iiso)
     5968                    ixt=itZonIso(izone,iiso)
    59705969                    if (izone.eq.izone_poubelle) then
    59715970                      fxt(ixt,il,i)=fxt(ixt,il,i)+fxtXe(iiso)
     
    59745973                    endif !if (izone.eq.izone_poubelle) then
    59755974                   endif !if ((izone.ne.izone_revap).and.
    5976                 enddo !do izone=1,ntraceurs_zone
     5975                enddo !do izone=1,nzone
    59775976#ifdef ISOVERIF
    59785977                  call iso_verif_traceur_justmass(fxt(1,il,i), &
     
    74597458     &     )   
    74607459#ifdef ISO
    7461     use infotrac_phy, ONLY: ntraciso
     7460    use infotrac_phy, ONLY: ntraciso=>ntiso
    74627461#ifdef ISOVERIF
    74637462    use isotopes_verif_mod, ONLY: Tmin_verif,iso_verif_aberrant, &
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/cv3a_compress.F90

    r4004 r4446  
    3434  ! **************************************************************
    3535#ifdef ISO
    36     use infotrac_phy, ONLY: ntraciso
     36    use infotrac_phy, ONLY: ntraciso=>ntiso
    3737    use isotopes_mod, ONLY: essai_convergence, iso_eau,iso_HDO
    3838#ifdef ISOVERIF
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/cv3a_uncompress.F90

    r4004 r4446  
    5454
    5555#ifdef ISO
    56   USE infotrac_phy, ONLY : ntraciso
     56  USE infotrac_phy, ONLY : ntraciso=>ntiso
    5757#endif
    5858  IMPLICIT NONE
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/cv3p_mixing.F90

    r4033 r4446  
    2121  USE add_phys_tend_mod, ONLY: fl_cor_ebil
    2222#ifdef ISO
    23   USE infotrac_phy, ONLY: ntraciso
     23  USE infotrac_phy, ONLY: ntraciso=>ntiso
    2424  USE isotopes_mod, ONLY: pxtmelt,pxtice
    2525  USE isotopes_routines_mod, ONLY: condiso_liq_ice_vectall
     
    13011301            call iso_verif_egalite_choix(xtent(iso_eau,il,im,jm), &
    13021302              qent(il,im,jm),'cv3p_mixing 2112',errmax,errmaxrel)
    1303           endif !if (use_iso_eau) then
     1303          endif !if (iso_eau>0) then
    13041304#ifdef ISOTRAC
    13051305        call iso_verif_traceur_justmass(xtelij(1,il,im,jm), &   
     
    13531353!        call iso_verif_traceur(xtclw(1,il,im), &
    13541354!               'cv3p_mixing 358')
    1355 !        if (iso_verif_positif_nostop(xtclw(index_trac( &
     1355!        if (iso_verif_positif_nostop(xtclw(itZonIso( &
    13561356!                izone_cond,iso_eau),i,k)-xtclw(iso_eau,i,k) &
    13571357!                ,'cv3p_mixing 909').eq.1) then
     
    13611361!                  niso,ntraciso,index_zone,izone_cond     
    13621362!               stop
    1363 !         endif !if (iso_verif_positif_nostop(xtclw(index_trac(
     1363!         endif !if (iso_verif_positif_nostop(xtclw(itZonIso(
    13641364!#endif             
    13651365!         enddo !do il = 1, ncum   
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/cv_driver.F90

    r4004 r4446  
    2525  USE dimphy
    2626#ifdef ISO
    27   USE infotrac_phy, ONLY: ntraciso,niso,index_trac,ntraceurs_zone
     27  USE infotrac_phy, ONLY: ntraciso=>ntiso,niso,itZonIso,nzone
    2828  USE isotopes_mod, ONLY: iso_eau,iso_HDO,ridicule,bidouille_anti_divergence
    2929#ifdef ISOVERIF
     
    511511    CALL cv_param(nd)
    512512#ifdef ISO
    513        write(*,*) 'cv_driver 454: isos pas prévus ici'
     513       write(*,*) 'cv_driver 454: isos pas prevus ici'
    514514       stop
    515515#endif
     
    687687!c--debug
    688688#ifdef ISOVERIF
    689        write(*,*) 'cv_driver 621: après cv3_undilute1'
     689       write(*,*) 'cv_driver 621: apres cv3_undilute1'
    690690       do k = 1, klev
    691691        do i = 1, klon
     
    752752        !write(*,*) 'xt1(iso_eau,1,1),q1(1,1)=',xt1(iso_eau,1,1),q1(1,1)
    753753        !write(*,*) 'xt1(iso_eau,14,1),q1(14,1)=',xt1(iso_eau,14,1),q1(14,1)
    754         !write(*,*) 'iso_eau,use_iso=',iso_eau,use_iso
    755754       do k = 1, klev
    756755        do i = 1, nloc
     
    783782#ifdef ISO
    784783#ifdef ISOVERIF
    785        write(*,*) 'cv_driver 720: après cv3_compress'           
     784       write(*,*) 'cv_driver 720: apres cv3_compress'           
    786785       do k = 1, klev
    787786        do i = 1, ncum
     
    883882                ,cape,ep,hp,icb,inb,clw,nk,t,h,lv &
    884883                ,epmax_diag)
    885         ! on écrase ep et recalcule hp
     884        ! on écrase ep et recalcule hp
    886885    END IF
    887886
     
    910909#ifdef ISO
    911910#ifdef ISOVERIF
    912        write(*,*) 'cv_driver 837: après cv3_mixing'
     911       write(*,*) 'cv_driver 837: apres cv3_mixing'
    913912       do k = 1, klev
    914913       do j = 1, klev
     
    925924           call iso_verif_traceur_justmass(xtelij(1,i,j,k), &
    926925     &           'cv_driver 847')
    927            ! on ne vérfier pas le deltaD ici car peut dépasser le seuil
    928            ! raisonable pour températures très froides.
     926           ! on ne verifie pas le deltaD ici car peut depasser le seuil
     927           ! raisonable pour temperatures tres froides.
    929928#endif               
    930929        enddo
     
    940939           call iso_verif_traceur(xt(1,i,k),'cv_driver 856')
    941940           if (option_tmin.eq.1) then
    942              if (iso_verif_positif_nostop(xtclw(index_trac( &
     941             if (iso_verif_positif_nostop(xtclw(itZonIso( &
    943942     &           izone_cond,iso_eau),i,k)-xtclw(iso_eau,i,k) &
    944943     &           ,'cv_driver 909').eq.1) then
     
    946945               write(*,*) 'xtclw=',xtclw(:,i,k)
    947946               stop
    948              endif !if (iso_verif_positif_nostop(xtclw(index_trac(
     947             endif !if (iso_verif_positif_nostop(xtclw(itZonIso(
    949948           endif !if ((option_traceurs.eq.17).or.
    950949#endif 
     
    1000999       write(*,*) 'klev=',klev
    10011000#ifdef ISOVERIF
    1002        write(*,*) 'cv_driver 930: après cv3_unsat'
     1001       write(*,*) 'cv_driver 930: apres cv3_unsat'
    10031002       do k = 1, klev
    10041003        do i = 1, ncum
     
    10481047            do i = 1, ncum
    10491048               do iiso=1,niso
    1050                   ixt_ddft=index_trac(izone_ddft,iiso)
    1051                   ixt_poubelle=index_trac(izone_poubelle,iiso)
     1049                  ixt_ddft=itZonIso(izone_ddft,iiso)
     1050                  ixt_poubelle=itZonIso(izone_poubelle,iiso)
    10521051                  xtp(ixt_ddft,i,k)=xtp(ixt_ddft,i,k) &
    10531052     &                    +xtp(ixt_poubelle,i,k)
     
    10631062          do k = 1, klev
    10641063            do i = 1, ncum
    1065                do izone=1,ntraceurs_zone
     1064               do izone=1,nzone
    10661065                 if (izone.eq.izone_ddft) then
    10671066                   do iiso=1,niso
    1068                      ixt_ddft=index_trac(izone,iiso)
    1069                      ixt_revap=index_trac(izone_revap,iiso)
     1067                     ixt_ddft=itZonIso(izone,iiso)
     1068                     ixt_revap=itZonIso(izone_revap,iiso)
    10701069                     xtp(ixt_ddft,i,k)=xtp(iiso,i,k)-xtp(ixt_revap,i,k)
    10711070                   enddo !do iiso=1,niso
    10721071                 elseif (izone.eq.izone_ddft) then
    1073                     ! rien à faire
     1072                    ! rien a faire
    10741073                 else !if (izone.eq.izone_ddft) then
    10751074                   do iiso=1,niso
    1076                      ixt=index_trac(izone,iiso)
     1075                     ixt=itZonIso(izone,iiso)
    10771076                     xtp(ixt,i,k)=0.0
    10781077                   enddo !do iiso=1,niso
    10791078                 endif !if (izone.eq.izone_ddft) then
    1080                enddo !do izone=1,ntraceurs_zone
     1079               enddo !do izone=1,nzone
    10811080#ifdef ISOVERIF
    10821081               call iso_verif_traceur(xtp(1,i,k),'cv_driver 1059')
     
    12471246! si icvflag_Tpa=0, alors la fraction de glace dans l'ascendance adiabatique est
    12481247  ! fonction de la temperature de l'environnement et la temperature de l'ascendance est
    1249   ! calculee en deux itérations, une en supposant qu'il n'y a pas de glace et l'autre
    1250   ! en ajoutant la glace (ancien schéma d'Arnaud Jam).
     1248  ! calculee en deux iterations, une en supposant qu'il n'y a pas de glace et l'autre
     1249  ! en ajoutant la glace (ancien schema d'Arnaud Jam).
    12511250! si icvflag_Tpa=1, alors la fraction de glace dans l'ascendance adiabatique est
    12521251  ! fonction de la temperature de l'environnement et la temperature de l'ascendance est
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/cva_driver.F90

    r4033 r4446  
    5454  USE add_phys_tend_mod, ONLY: fl_cor_ebil
    5555#ifdef ISO
    56   USE infotrac_phy, ONLY: ntraciso,niso,niso,index_trac,ntraceurs_zone
     56  USE infotrac_phy, ONLY: ntraciso=>ntiso,niso,niso,itZonIso,nzone
    5757  USE isotopes_mod, ONLY: iso_eau,iso_HDO,iso_O18,ridicule,bidouille_anti_divergence
    5858#ifdef ISOVERIF
     
    13881388           call iso_verif_traceur(xt(1,i,k),'cva_driver 856')
    13891389           if (option_tmin.eq.1) then
    1390              if (iso_verif_positif_nostop(xtclw(index_trac( &
     1390             if (iso_verif_positif_nostop(xtclw(itZonIso( &
    13911391     &           izone_cond,iso_eau),i,k)-xtclw(iso_eau,i,k) &
    13921392     &           ,'cva_driver 909').eq.1) then
     
    13941394               write(*,*) 'xtclw=',xtclw(:,i,k)
    13951395               stop
    1396              endif !if (iso_verif_positif_nostop(xtclw(index_trac(
     1396             endif !if (iso_verif_positif_nostop(xtclw(itZonIso(
    13971397           endif !if ((option_traceurs.eq.17).or.
    13981398#endif 
     
    15091509            do i = 1, ncum
    15101510               do iiso=1,niso
    1511                   ixt_ddft=index_trac(izone_ddft,iiso)
    1512                   ixt_poubelle=index_trac(izone_poubelle,iiso)
     1511                  ixt_ddft=itZonIso(izone_ddft,iiso)
     1512                  ixt_poubelle=itZonIso(izone_poubelle,iiso)
    15131513                  xtp(ixt_ddft,i,k)=xtp(ixt_ddft,i,k) &
    15141514     &                    +xtp(ixt_poubelle,i,k)
     
    15241524          do k=1,nd
    15251525            do i = 1, ncum
    1526                do izone=1,ntraceurs_zone
     1526               do izone=1,nzone
    15271527                 if (izone.eq.izone_ddft) then
    15281528                   do iiso=1,niso
    1529                      ixt_ddft=index_trac(izone,iiso)
    1530                      ixt_revap=index_trac(izone_revap,iiso)
     1529                     ixt_ddft=itZonIso(izone,iiso)
     1530                     ixt_revap=itZonIso(izone_revap,iiso)
    15311531                     xtp(ixt_ddft,i,k)=xtp(iiso,i,k)-xtp(ixt_revap,i,k)
    15321532                   enddo !do iiso=1,niso
     
    15351535                 else !if (izone.eq.izone_ddft) then
    15361536                   do iiso=1,niso
    1537                      ixt=index_trac(izone,iiso)
     1537                     ixt=itZonIso(izone,iiso)
    15381538                     xtp(ixt,i,k)=0.0
    15391539                   enddo !do iiso=1,niso
    15401540                 endif !if (izone.eq.izone_ddft) then
    1541                enddo !do izone=1,ntraceurs_zone
     1541               enddo !do izone=1,nzone
    15421542#ifdef ISOVERIF
    15431543               call iso_verif_traceur(xtp(1,i,k),'cva_driver 1059')
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/fisrtilp.F90

    r3927 r4446  
    2727  USE add_phys_tend_mod, only : fl_cor_ebil
    2828#ifdef ISO
    29   USE infotrac_phy, ONLY: ntraciso,niso,index_trac,ntraceurs_zone
     29  USE infotrac_phy, ONLY: ntraciso=>ntiso,niso,itZonIso
    3030  USE isotopes_mod
    3131!, ONLY: essai_convergence,bidouille_anti_divergence, &
     
    143143  ! Coeffients de fraction lessivee : pour OFF-LINE
    144144  !
    145   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: pfrac_nucl
    146   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: pfrac_1nucl
    147   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: pfrac_impa
     145  REAL, DIMENSION(klon,klev),      INTENT(INOUT)  :: pfrac_nucl
     146  REAL, DIMENSION(klon,klev),      INTENT(INOUT)  :: pfrac_1nucl
     147  REAL, DIMENSION(klon,klev),      INTENT(INOUT)  :: pfrac_impa
    148148  !
    149149  ! Fraction d'aerosols lessivee par impaction et par nucleation
     
    15101510                   zxtn(iso_eau,i)=zqn(i)
    15111511#ifdef ISOTRAC
    1512                    zxtn(index_trac(izone_poubelle,iso_eau),i)=zqn(i) 
     1512                   zxtn(itZonIso(izone_poubelle,iso_eau),i)=zqn(i) 
    15131513                   if (option_tmin.eq.1) then                   
    15141514                     zxtcs(iso_eau,i)=zqcs(i)
     
    18481848           ! part le tag résuel et le condensat
    18491849           if (iso_verif_positif_choix_nostop( &
    1850      &           zxt_ancien(index_trac(izone,iso_eau),i) &
    1851      &          -zxt(index_trac(izone,iso_eau),i),1e-8,'ilp 1270') &
     1850     &           zxt_ancien(itZonIso(izone,iso_eau),i) &
     1851     &          -zxt(itZonIso(izone,iso_eau),i),1e-8,'ilp 1270') &
    18521852     &          .eq.1) then
    18531853            write(*,*) 'i,izone,rneb=',i,izone,rneb(i,k)
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/fonte_neige_mod.F90

    r4033 r4446  
    629629        ! de dépendance circulaire.
    630630
    631     USE infotrac_phy, ONLY: ntraciso,niso
     631    USE infotrac_phy, ONLY: ntiso,niso
    632632    USE isotopes_mod, ONLY: iso_eau   
    633633  USE indice_sol_mod   
     
    639639         ! inputs
    640640        integer klon,knon
    641         real xtprecip_snow(ntraciso,klon),xtprecip_rain(ntraciso,klon)
     641        real xtprecip_snow(ntiso,klon),xtprecip_rain(ntiso,klon)
    642642    INTEGER, INTENT(IN)                  :: nisurf
    643643    INTEGER, DIMENSION(klon), INTENT(IN) :: knindex
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/isotopes_mod.F90

    r4124 r4446  
    33
    44MODULE isotopes_mod
    5 USE infotrac_phy, ONLY: ntraciso,niso,indnum_fn_num,use_iso, &
    6 &       niso_possibles
    7 IMPLICIT NONE
    8 SAVE
    9 
    10 ! contient toutes les variables isotopiques et leur initialisation
    11 ! les routines specifiquement isotopiques sont dans
    12 ! isotopes_routines_mod pour éviter dépendance circulaire avec
    13 ! isotopes_verif_mod.
    14 
    15 
    16 ! indices des isotopes
    17 integer, save :: iso_eau,iso_HDO,iso_O18,iso_O17,iso_HTO ! indices de 1 à niso: les isos n'existant pas sont mis à 0
    18 !$OMP THREADPRIVATE(iso_eau,iso_HDO,iso_O18,iso_O17,iso_HTO)
    19 
    20 integer :: iso_eau_possible,iso_HDO_possible,iso_O18_possible,iso_O17_possible,iso_HTO_possible ! indices de 1 à niso_possibles: ils correspondent aux tableaux définis dans infotrac:
    21 ! tnom_iso=(/'eau','HDO','O18','O17','HTO'/)
    22 ! ce sont ces indices qui doivent être utilisés avec use_iso, puisque use_iso est défini comme DIMENSION(niso_possibles)
    23 parameter (iso_eau_possible=1)
    24 parameter (iso_HDO_possible=2)
    25 parameter (iso_O18_possible=3)
    26 parameter (iso_O17_possible=4)
    27 parameter (iso_HTO_possible=5)
    28 
    29 integer, save :: ntracisoOR
     5   USE strings_mod,  ONLY: msg, real2str, int2str, bool2str, maxlen, strIdx, strStack
     6   USE infotrac_phy, ONLY: isoName
     7   IMPLICIT NONE
     8   INTERFACE get_in; MODULE PROCEDURE getinp_s, getinp_i, getinp_r, getinp_l;  END INTERFACE get_in
     9   SAVE
     10
     11  !--- Contains all isotopic variables + their initialization
     12  !--- Isotopes-specific routines are in isotopes_routines_mod to avoid circular dependencies with isotopes_verif_mod.
     13
     14   !--- Isotopes indices (in [1,niso] ; non-existing => 0 index)
     15   INTEGER, SAVE :: iso_eau, iso_HDO, iso_O18, iso_O17, iso_HTO
     16!$OMP THREADPRIVATE(iso_eau, iso_HDO, iso_O18, iso_O17, iso_HTO)
     17
     18   INTEGER, SAVE :: ntracisoOR
    3019!$OMP THREADPRIVATE(ntracisoOR)
    3120
    32 ! variables indépendantes des isotopes
    33 
    34 real, save :: pxtmelt,pxtice,pxtmin,pxtmax
    35 !$OMP THREADPRIVATE(pxtmelt,pxtice,pxtmin,pxtmax)
    36 real, save ::  tdifexp, tv0cin, thumxt1
     21   !--- Variables not depending on isotopes
     22   REAL,    SAVE :: pxtmelt, pxtice, pxtmin, pxtmax
     23!$OMP THREADPRIVATE(pxtmelt, pxtice, pxtmin, pxtmax)
     24   REAL,    SAVE :: tdifexp, tv0cin, thumxt1
    3725!$OMP THREADPRIVATE(tdifexp, tv0cin, thumxt1)
    38 integer, save :: ntot
     26   INTEGER, SAVE :: ntot
    3927!$OMP THREADPRIVATE(ntot)
    40 real, save :: h_land_ice
     28   REAL,    SAVE :: h_land_ice
    4129!$OMP THREADPRIVATE(h_land_ice)
    42 real, save :: P_veg
     30   REAL,    SAVE :: P_veg
    4331!$OMP THREADPRIVATE(P_veg)
    44 real, save ::  musi,lambda_sursat
    45 !$OMP THREADPRIVATE(lambda_sursat)
    46 real, save :: Kd
     32   REAL,    SAVE :: musi, lambda_sursat
     33!$OMP THREADPRIVATE(musi, lambda_sursat)
     34   REAL,    SAVE :: Kd
    4735!$OMP THREADPRIVATE(Kd)
    48 real, save ::  rh_cste_surf_cond,T_cste_surf_cond
    49 !$OMP THREADPRIVATE(rh_cste_surf_cond,T_cste_surf_cond)
    50 
    51 logical, save ::   bidouille_anti_divergence
    52                 ! si true, rappel régulier de xteau vers q, pour éviter dérives lentes
     36   REAL,    SAVE :: rh_cste_surf_cond, T_cste_surf_cond
     37!$OMP THREADPRIVATE(rh_cste_surf_cond, T_cste_surf_cond)
     38   LOGICAL, SAVE :: bidouille_anti_divergence    ! T: regularly, xteau <- q to avoid slow drifts
    5339!$OMP THREADPRIVATE(bidouille_anti_divergence)
    54 logical, save ::   essai_convergence
    55                 ! si false, on fait rigoureusement comme dans LMDZ sans isotopes,
    56                 ! meme si c'est génant pour les isotopes
     40   LOGICAL, SAVE :: essai_convergence            ! F: as in LMDZ without isotopes (bad for isotopes)
    5741!$OMP THREADPRIVATE(essai_convergence)
    58 integer, save ::   initialisation_iso
    59                 ! 0: dans fichier
    60                 ! 1: R=0
    61                 ! 2: R selon distill rayleigh
    62                 ! 3: R=Rsmow
     42   INTEGER, SAVE :: initialisation_iso           ! 0: file ; 1: R=0 ; 2: R=distill. Rayleigh ; 3: R=Rsmow
    6343!$OMP THREADPRIVATE(initialisation_iso)
    64 integer, save ::  modif_SST ! 0 par defaut, 1 si on veut modifier la sst
    65                 ! 2 et 3: profils de SST
     44   INTEGER, SAVE :: modif_SST                    ! 0: default ; 1: modified SST ; 2, 3: SST profiles
    6645!$OMP THREADPRIVATE(modif_SST)
    67 real, save ::  deltaTtest ! modif de la SST, uniforme.
     46   REAL,    SAVE :: deltaTtest                   ! Uniform modification of the SST
    6847!$OMP THREADPRIVATE(deltaTtest)
    69 integer, save ::  modif_sic ! on met des trous dans glace de mer
     48   INTEGER, SAVE :: modif_sic                    ! Holes in the Sea Ice
    7049!$OMP THREADPRIVATE(modif_sic)
    71 real, save ::  deltasic ! fraction de trous minimale
     50   REAL,    SAVE :: deltasic                     ! Minimal holes fraction
    7251!$OMP THREADPRIVATE(deltasic)
    73 real, save :: deltaTtestpoles
     52   REAL,    SAVE :: deltaTtestpoles
    7453!$OMP THREADPRIVATE(deltaTtestpoles)
    75 real, save ::  sstlatcrit
    76 !$OMP THREADPRIVATE(sstlatcrit)
    77 real, save ::  dsstlatcrit
    78 !$OMP THREADPRIVATE(dsstlatcrit)
    79 real, save ::  deltaO18_oce
     54   REAL,    SAVE :: sstlatcrit, dsstlatcrit
     55!$OMP THREADPRIVATE(sstlatcrit, dsstlatcrit)
     56   REAL,    SAVE :: deltaO18_oce
    8057!$OMP THREADPRIVATE(deltaO18_oce)
    81 integer, save ::  albedo_prescrit ! 0 par defaut
    82                         ! 1 si on veut garder albedo constant
     58   INTEGER, SAVE :: albedo_prescrit              ! 0: default ; 1: constant albedo
    8359!$OMP THREADPRIVATE(albedo_prescrit)
    84 real, save ::  lon_min_albedo,lon_max_albedo
    85 !$OMP THREADPRIVATE(lon_min_albedo,lon_max_albedo)
    86 real, save :: lat_min_albedo,lat_max_albedo
    87 !$OMP THREADPRIVATE(lat_min_albedo,lat_max_albedo)
    88 real, save ::  deltaP_BL,tdifexp_sol
     60   REAL,    SAVE :: lon_min_albedo, lon_max_albedo, lat_min_albedo, lat_max_albedo
     61!$OMP THREADPRIVATE(lon_min_albedo, lon_max_albedo, lat_min_albedo, lat_max_albedo)
     62   REAL,    SAVE :: deltaP_BL,tdifexp_sol
    8963!$OMP THREADPRIVATE(deltaP_BL,tdifexp_sol)
    90 integer, save ::  ruissellement_pluie,alphak_stewart
    91 !$OMP THREADPRIVATE(ruissellement_pluie,alphak_stewart)
    92 integer, save :: calendrier_guide
     64   INTEGER, SAVE :: ruissellement_pluie, alphak_stewart
     65!$OMP THREADPRIVATE(ruissellement_pluie, alphak_stewart)
     66   INTEGER, SAVE :: calendrier_guide
    9367!$OMP THREADPRIVATE(calendrier_guide)
    94 integer, save :: cste_surf_cond
     68   INTEGER, SAVE :: cste_surf_cond
    9569!$OMP THREADPRIVATE(cste_surf_cond)
    96 real, save :: mixlen
     70   REAL,    SAVE :: mixlen
    9771!$OMP THREADPRIVATE(mixlen)
    98 integer, save :: evap_cont_cste
     72   INTEGER, SAVE :: evap_cont_cste
    9973!$OMP THREADPRIVATE(evap_cont_cste)
    100 real, save ::  deltaO18_evap_cont,d_evap_cont
    101 !$OMP THREADPRIVATE(deltaO18_evap_cont,d_evap_cont)
    102 integer, save ::  nudge_qsol,region_nudge_qsol
    103 !$OMP THREADPRIVATE(nudge_qsol,region_nudge_qsol)
    104 integer, save :: nlevmaxO17
     74   REAL,    SAVE :: deltaO18_evap_cont, d_evap_cont
     75!$OMP THREADPRIVATE(deltaO18_evap_cont, d_evap_cont)
     76   INTEGER, SAVE :: nudge_qsol, region_nudge_qsol
     77!$OMP THREADPRIVATE(nudge_qsol, region_nudge_qsol)
     78   INTEGER, SAVE :: nlevmaxO17
    10579!$OMP THREADPRIVATE(nlevmaxO17)
    106 integer, save ::  no_pce
    107 !       real, save :: slope_limiterxy,slope_limiterz
     80   INTEGER, SAVE :: no_pce
    10881!$OMP THREADPRIVATE(no_pce)
    109 real, save :: A_satlim
     82   REAL,    SAVE :: A_satlim
    11083!$OMP THREADPRIVATE(A_satlim)
    111 integer, save ::  ok_restrict_A_satlim,modif_ratqs
    112 !$OMP THREADPRIVATE(ok_restrict_A_satlim,modif_ratqs)
    113 real, save ::  Pcrit_ratqs,ratqsbasnew
    114 !$OMP THREADPRIVATE(Pcrit_ratqs,ratqsbasnew)
    115 real, save :: fac_modif_evaoce
     84   INTEGER, SAVE :: ok_restrict_A_satlim, modif_ratqs
     85!$OMP THREADPRIVATE(ok_restrict_A_satlim, modif_ratqs)
     86   REAL,    SAVE :: Pcrit_ratqs, ratqsbasnew
     87!$OMP THREADPRIVATE(Pcrit_ratqs, ratqsbasnew)
     88   REAL,    SAVE :: fac_modif_evaoce
    11689!$OMP THREADPRIVATE(fac_modif_evaoce)
    117 integer, save :: ok_bidouille_wake
     90   INTEGER, SAVE :: ok_bidouille_wake
    11891!$OMP THREADPRIVATE(ok_bidouille_wake)
    119 logical :: cond_temp_env
     92   LOGICAL, SAVE :: cond_temp_env
    12093!$OMP THREADPRIVATE(cond_temp_env)
    12194
    122 
    123 ! variables tableaux fn de niso
    124 real, ALLOCATABLE, DIMENSION(:), save :: tnat, toce, tcorr
    125 !$OMP THREADPRIVATE(tnat, toce, tcorr)
    126 real, ALLOCATABLE, DIMENSION(:), save :: tdifrel
    127 !$OMP THREADPRIVATE(tdifrel)
    128 real, ALLOCATABLE, DIMENSION(:), save :: talph1, talph2, talph3
    129 !$OMP THREADPRIVATE(talph1, talph2, talph3)
    130 real, ALLOCATABLE, DIMENSION(:), save :: talps1, talps2
    131 !$OMP THREADPRIVATE(talps1, talps2)
    132 real, ALLOCATABLE, DIMENSION(:), save :: tkcin0, tkcin1, tkcin2
     95   !--- Vectors of length "niso"
     96   REAL, ALLOCATABLE, DIMENSION(:), SAVE :: &
     97                    tnat, toce, tcorr, tdifrel
     98!$OMP THREADPRIVATE(tnat, toce, tcorr, tdifrel)
     99   REAL, ALLOCATABLE, DIMENSION(:), SAVE :: &
     100                    talph1, talph2, talph3, talps1, talps2
     101!$OMP THREADPRIVATE(talph1, talph2, talph3, talps1, talps2)
     102   REAL, ALLOCATABLE, DIMENSION(:), SAVE :: &
     103                    tkcin0, tkcin1, tkcin2
    133104!$OMP THREADPRIVATE(tkcin0, tkcin1, tkcin2)
    134 real, ALLOCATABLE, DIMENSION(:), save :: alpha_liq_sol
    135 !$OMP THREADPRIVATE(alpha_liq_sol)
    136 real, ALLOCATABLE, DIMENSION(:), save :: Rdefault, Rmethox
    137 !$OMP THREADPRIVATE(Rdefault, Rmethox)
    138 character*3, ALLOCATABLE, DIMENSION(:), save :: striso
    139 !$OMP THREADPRIVATE(striso)
    140 real, save :: fac_coeff_eq17_liq, fac_coeff_eq17_ice
     105   REAL, ALLOCATABLE, DIMENSION(:), SAVE :: &
     106                    alpha_liq_sol, Rdefault, Rmethox
     107!$OMP THREADPRIVATE(alpha_liq_sol, Rdefault, Rmethox)
     108   REAL, SAVE ::    fac_coeff_eq17_liq, fac_coeff_eq17_ice
    141109!$OMP THREADPRIVATE(fac_coeff_eq17_liq, fac_coeff_eq17_ice)
    142110
    143       real ridicule ! valeur maximale pour qu'une variable de type
    144                     ! rapoport de mélange puisse être considérée comme négligeable. Si
    145                     ! négligeable, alors on ne verifie pas si sa compo iso esta bérrante.
    146       parameter (ridicule=1e-12)     
    147 !      parameter (ridicule=1)
    148 !
    149       real ridicule_rain ! valeur limite de ridicule pour les flux de pluies (rain, zrfl...)
    150       parameter (ridicule_rain=1e-8) ! en kg/s <-> 1e-3mm/day
    151 
    152       real ridicule_evap ! valeur limite de ridicule pour les evap
    153       parameter (ridicule_evap=ridicule_rain*1e-2) ! en kg/s <-> 1e-3mm/day
    154 
    155       real ridicule_qsol ! valeur limite de ridicule pour les qsol
    156       parameter (ridicule_qsol=ridicule_rain) ! en kg <-> 1e-8kg
    157 
    158       real ridicule_snow ! valeur limite de ridicule pour les snow
    159       parameter (ridicule_snow=ridicule_qsol) ! en kg/s <-> 1e-8kg
    160      
    161         real expb_max
    162         parameter (expb_max=30.0)
    163 
    164         ! spécifique au tritium:
    165        
    166 
    167 logical, save :: ok_prod_nucl_tritium ! si oui, production de tritium par essais nucleaires
     111   !--- Negligible lower thresholds: no need to check for absurd values under these lower limits
     112   REAL, PARAMETER :: &
     113      ridicule      = 1e-12,              & ! For mixing ratios
     114      ridicule_rain = 1e-8,               & ! For rain fluxes (rain, zrfl...) in kg/s <-> 1e-3 mm/day
     115      ridicule_evap = ridicule_rain*1e-2, & ! For evaporations                in kg/s <-> 1e-3 mm/day
     116      ridicule_qsol = ridicule_rain,      & ! For qsol                        in kg <-> 1e-8 kg
     117      ridicule_snow = ridicule_qsol         ! For snow                        in kg <-> 1e-8 kg
     118   REAL, PARAMETER :: expb_max = 30.0
     119
     120   !--- Specific to HTO:
     121   LOGICAL, SAVE :: ok_prod_nucl_tritium    !--- TRUE => HTO production by nuclear tests
    168122!$OMP THREADPRIVATE(ok_prod_nucl_tritium)
    169         integer nessai
    170         parameter (nessai=486)
    171         integer, save :: day_nucl(nessai)
    172 !$OMP THREADPRIVATE(day_nucl)
    173         integer, save :: month_nucl(nessai)
    174 !$OMP THREADPRIVATE(month_nucl)
    175         integer, save :: year_nucl(nessai)
    176 !$OMP THREADPRIVATE(year_nucl)
    177         real, save :: lat_nucl(nessai)
    178 !$OMP THREADPRIVATE(lat_nucl)
    179         real, save :: lon_nucl(nessai)
    180 !$OMP THREADPRIVATE(lon_nucl)
    181         real, save :: zmin_nucl(nessai)
    182 !$OMP THREADPRIVATE(zmin_nucl)
    183         real, save :: zmax_nucl(nessai)
    184 !$OMP THREADPRIVATE(zmax_nucl)
    185         real, save :: HTO_nucl(nessai)
    186 !$OMP THREADPRIVATE(HTO_nucl)
    187 
     123   INTEGER, PARAMETER :: nessai = 486
     124   INTEGER, DIMENSION(nessai), SAVE :: &
     125                    day_nucl, month_nucl, year_nucl
     126!$OMP THREADPRIVATE(day_nucl, month_nucl, year_nucl)
     127   REAL,    DIMENSION(nessai), SAVE :: &
     128                    lat_nucl, lon_nucl, zmin_nucl, zmax_nucl, HTO_nucl
     129!$OMP THREADPRIVATE(lat_nucl, lon_nucl, zmin_nucl, zmax_nucl, HTO_nucl)
     130 
    188131 
    189132CONTAINS
    190133
    191   SUBROUTINE iso_init()
    192       use ioipsl_getin_p_mod, ONLY : getin_p
    193       implicit none
    194 
    195 ! -- local variables:
    196 
    197       integer ixt
    198       ! référence O18
    199       real fac_enrichoce18
    200       real alpha_liq_sol_O18, &
    201      &     talph1_O18,talph2_O18,talph3_O18, &
    202      &     talps1_O18,talps2_O18, &
    203      &     tkcin0_O18,tkcin1_O18,tkcin2_O18, &
    204      &     tdifrel_O18 
     134SUBROUTINE iso_init()
     135   USE infotrac_phy,       ONLY: ntiso, niso, getKey
     136    USE strings_mod,       ONLY: maxlen
     137   IMPLICIT NONE
     138
     139   !=== Local variables:
     140   INTEGER :: ixt
     141
     142   !--- H2[18]O reference
     143   REAL :: fac_enrichoce18, alpha_liq_sol_O18, &
     144           talph1_O18, talph2_O18, talph3_O18, talps1_O18, talps2_O18, &
     145           tkcin0_O18, tkcin1_O18, tkcin2_O18, tdifrel_O18 
     146
     147   !--- For H2[17]O
     148   REAL    :: fac_kcin, pente_MWL
    205149     
    206       ! cas de l'O17
    207       real fac_kcin
    208       real pente_MWL
    209       integer ierr
    210      
    211       logical ok_nocinsat, ok_nocinsfc !sensi test
    212       parameter (ok_nocinsfc=.FALSE.)  ! if T: no kinetic effect in sfc evap
    213       parameter (ok_nocinsat=.FALSE.)  ! if T: no sursaturation effect for ice
    214       logical Rdefault_smow
    215       parameter (Rdefault_smow=.FALSE.) ! si T: Rdefault=smow; si F: nul
    216       ! pour le tritium
    217       integer iessai
    218 
    219     write(*,*) 'iso_init 219: entree'
    220 
    221 ! allocations mémoire
    222 allocate (tnat(niso))
    223 allocate (toce(niso))
    224 allocate (tcorr(niso))
    225 allocate (tdifrel(niso))
    226 allocate (talph1(niso))
    227 allocate (talph2(niso))
    228 allocate (talph3(niso))
    229 allocate (talps1(niso))
    230 allocate (talps2(niso))
    231 allocate (tkcin0(niso))
    232 allocate (tkcin1(niso))
    233 allocate (tkcin2(niso))
    234 allocate (alpha_liq_sol(niso))
    235 allocate (Rdefault(niso))
    236 allocate (Rmethox(niso))
    237 allocate (striso(niso))
    238 
    239 
    240 !--------------------------------------------------------------
    241 ! General:
    242 !--------------------------------------------------------------
    243 
    244 ! -- verif du nombre d'isotopes:
    245       write(*,*) 'iso_init 64: niso=',niso
    246 
    247 ! init de ntracisoOR: on écrasera en cas de nzone>0 si complications avec
    248 ! ORCHIDEE
    249       ntracisoOR=ntraciso 
    250              
    251 ! -- Type of water isotopes:
    252 
    253         iso_eau=indnum_fn_num(1)
    254         iso_HDO=indnum_fn_num(2)
    255         iso_O18=indnum_fn_num(3)
    256         iso_O17=indnum_fn_num(4)
    257         iso_HTO=indnum_fn_num(5)
    258         write(*,*) 'iso_init 59: iso_eau=',iso_eau
    259         write(*,*) 'iso_HDO=',iso_HDO
    260         write(*,*) 'iso_O18=',iso_O18
    261         write(*,*) 'iso_O17=',iso_O17
    262         write(*,*) 'iso_HTO=',iso_HTO
    263         write(*,*) 'iso_init 251: use_iso=',use_iso
    264 
    265       ! initialisation
    266         lambda_sursat=0.004
    267         thumxt1=0.75*1.2
    268         ntot=20
    269         h_land_ice=20. ! à comparer aux 3000mm de snow_max
    270         P_veg=1.0
    271         bidouille_anti_divergence=.false.
    272         essai_convergence=.false.
    273         initialisation_iso=0
    274         modif_sst=0
    275         modif_sic=0
    276         deltaTtest=0.0
    277         deltasic=0.1
    278         deltaTtestpoles=0.0
    279         sstlatcrit=30.0
    280         deltaO18_oce=0.0
    281         albedo_prescrit=0
    282         lon_min_albedo=-200
    283         lon_max_albedo=200
    284         lat_min_albedo=-100
    285         lat_max_albedo=100
    286         deltaP_BL=10.0
    287         ruissellement_pluie=0
    288         alphak_stewart=1
    289         tdifexp_sol=0.67
    290         calendrier_guide=0
    291         cste_surf_cond=0
    292 mixlen=35.0       
    293 evap_cont_cste=0.0
    294 deltaO18_evap_cont=0.0
    295 d_evap_cont=0.0
    296 nudge_qsol=0
    297 region_nudge_qsol=1
    298 nlevmaxO17=50
    299 no_pce=0
    300 A_satlim=1.0
    301 ok_restrict_A_satlim=0
    302 !        slope_limiterxy=2.0
    303 !        slope_limiterz=2.0
    304 modif_ratqs=0
    305 Pcrit_ratqs=500.0
    306 ratqsbasnew=0.05
    307 
    308 fac_modif_evaoce=1.0
    309 ok_bidouille_wake=0
    310 cond_temp_env=.false.
    311 ! si oui, la temperature de cond est celle de l'environnement,
    312 ! pour eviter bugs quand temperature dans ascendances convs est
    313 ! mal calculee
    314 ok_prod_nucl_tritium=.false.
    315 
    316 ! lecture des paramètres isotopiques:
    317 ! pour que ça marche en openMP, il faut utiliser getin_p. Car le getin ne peut
    318 ! être appelé que par un thread à la fois, et ça pose tout un tas de problème,
    319 ! d'où tout un tas de magouilles comme dans conf_phys_m. A terme, tout le monde
    320 ! lira par getin_p.
    321 call getin_p('lambda',lambda_sursat)
    322 call getin_p('thumxt1',thumxt1)
    323 call getin_p('ntot',ntot)
    324 call getin_p('h_land_ice',h_land_ice)
    325 call getin_p('P_veg',P_veg)
    326 call getin_p('bidouille_anti_divergence',bidouille_anti_divergence)
    327 call getin_p('essai_convergence',essai_convergence)
    328 call getin_p('initialisation_iso',initialisation_iso)
    329 !if (nzone>0) then     
    330 !if (initialisation_iso.eq.0) then
    331 !  call getin_p('initialisation_isotrac',initialisation_isotrac)
    332 !endif !if (initialisation_iso.eq.0) then
    333 !endif !if (nzone>0)
    334 call getin_p('modif_sst',modif_sst)
    335 if (modif_sst.ge.1) then
    336 call getin_p('deltaTtest',deltaTtest)
    337 if (modif_sst.ge.2) then
    338   call getin_p('deltaTtestpoles',deltaTtestpoles)
    339   call getin_p('sstlatcrit',sstlatcrit)
     150   !--- Sensitivity tests
     151   LOGICAL, PARAMETER ::   ok_nocinsfc = .FALSE. ! if T: no kinetic effect in sfc evap
     152   LOGICAL, PARAMETER ::   ok_nocinsat = .FALSE. ! if T: no sursaturation effect for ice
     153   LOGICAL, PARAMETER :: Rdefault_smow = .FALSE. ! if T: Rdefault=smow; if F: nul
     154
     155   !--- For [3]H
     156   INTEGER :: iessai
     157
     158   CHARACTER(LEN=maxlen) :: modname, sxt
     159   REAL, ALLOCATABLE :: tmp(:)
     160
     161   modname = 'iso_init'
     162   CALL msg('219: entree', modname)
     163
     164   !--------------------------------------------------------------
     165   ! General:
     166   !--------------------------------------------------------------
     167
     168   !--- Check number of isotopes
     169   CALL msg('64: niso = '//TRIM(int2str(niso)), modname)
     170
     171   !--- Init de ntracisoOR: on ecrasera en cas de traceurs de tagging isotopiques
     172   !                     (nzone>0) si complications avec ORCHIDEE
     173   ntracisoOR = ntiso 
     174
     175   !--- Type of water isotopes:
     176   iso_eau = strIdx(isoName, 'H216O'); CALL msg('iso_eau='//int2str(iso_eau), modname)
     177   iso_HDO = strIdx(isoName, 'HDO');   CALL msg('iso_HDO='//int2str(iso_HDO), modname)
     178   iso_O18 = strIdx(isoName, 'H218O'); CALL msg('iso_O18='//int2str(iso_O18), modname)
     179   iso_O17 = strIdx(isoName, 'H217O'); CALL msg('iso_O17='//int2str(iso_O17), modname)
     180   iso_HTO = strIdx(isoName, 'HTO');   CALL msg('iso_HTO='//int2str(iso_HTO), modname)
     181
     182   !--- Initialiaation: reading the isotopic parameters.
     183   CALL get_in('lambda',     lambda_sursat, 0.004)
     184   CALL get_in('thumxt1',    thumxt1,       0.75*1.2)
     185   CALL get_in('ntot',       ntot,          20,  .FALSE.)
     186   CALL get_in('h_land_ice', h_land_ice,    20., .FALSE.)
     187   CALL get_in('P_veg',      P_veg,         1.0, .FALSE.)
     188   CALL get_in('bidouille_anti_divergence', bidouille_anti_divergence, .FALSE.)
     189   CALL get_in('essai_convergence',         essai_convergence,         .FALSE.)
     190   CALL get_in('initialisation_iso',        initialisation_iso,        0)
     191
     192!  IF(nzone>0 .AND. initialisation_iso==0) &
     193!      CALL get_in('initialisation_isotrac',initialisation_isotrac)
     194   CALL get_in('modif_sst',      modif_sst,         0)
     195   CALL get_in('deltaTtest',     deltaTtest,      0.0)     !--- For modif_sst>=1
     196   CALL get_in('deltaTtestpoles',deltaTtestpoles, 0.0)     !--- For modif_sst>=2
     197   CALL get_in( 'sstlatcrit',    sstlatcrit,     30.0)     !--- For modif_sst>=3
     198   CALL get_in('dsstlatcrit',   dsstlatcrit,      0.0)     !--- For modif_sst>=3
    340199#ifdef ISOVERIF
    341       !call iso_verif_positif(sstlatcrit,'iso_init 107')
    342       if (sstlatcrit.lt.0.0) then
    343         write(*,*) 'iso_init 270: sstlatcrit=',sstlatcrit
    344         stop
    345       endif
     200   CALL msg('iso_init 270:  sstlatcrit='//real2str( sstlatcrit), modname, sstlatcrit < 0.0) !--- For modif_sst>=2
     201   CALL msg('iso_init 279: dsstlatcrit='//real2str(dsstlatcrit), modname, sstlatcrit < 0.0) !--- For modif_sst>=3
     202   IF(modif_sst >= 2 .AND. sstlatcrit < 0.0) STOP
    346203#endif             
    347   if (modif_sst.ge.3) then 
    348       call getin_p('dsstlatcrit',dsstlatcrit)
     204
     205   CALL get_in('modif_sic', modif_sic,  0)
     206   IF(modif_sic >= 1) &
     207   CALL get_in('deltasic',  deltasic, 0.1)
     208
     209   CALL get_in('albedo_prescrit', albedo_prescrit, 0)
     210   IF(albedo_prescrit == 1) THEN
     211      CALL get_in('lon_min_albedo', lon_min_albedo, -200.)
     212      CALL get_in('lon_max_albedo', lon_max_albedo,  200.)
     213      CALL get_in('lat_min_albedo', lat_min_albedo, -100.)
     214      CALL get_in('lat_max_albedo', lat_max_albedo,  100.)
     215   END IF
     216   deltaO18_oce=0.0
     217   CALL get_in('deltaP_BL',           deltaP_BL,     10.0)
     218   CALL get_in('ruissellement_pluie', ruissellement_pluie, 0)
     219   CALL get_in('alphak_stewart',      alphak_stewart,      1)
     220   CALL get_in('tdifexp_sol',         tdifexp_sol,      0.67)
     221   CALL get_in('calendrier_guide',    calendrier_guide,    0)
     222   CALL get_in('cste_surf_cond',      cste_surf_cond,      0)
     223   CALL get_in('mixlen',              mixlen,           35.0)
     224   CALL get_in('evap_cont_cste',      evap_cont_cste,      0)
     225   CALL get_in('deltaO18_evap_cont',  deltaO18_evap_cont,0.0)
     226   CALL get_in('d_evap_cont',         d_evap_cont,       0.0)
     227   CALL get_in('nudge_qsol',          nudge_qsol,          0)
     228   CALL get_in('region_nudge_qsol',   region_nudge_qsol,   1)
     229   nlevmaxO17 = 50
     230   CALL msg('nlevmaxO17='//TRIM(int2str(nlevmaxO17)))
     231   CALL get_in('no_pce',   no_pce,     0)
     232   CALL get_in('A_satlim', A_satlim, 1.0)
     233   CALL get_in('ok_restrict_A_satlim', ok_restrict_A_satlim, 0)
    349234#ifdef ISOVERIF
    350       !call iso_verif_positif(dsstlatcrit,'iso_init 110')
    351       if (sstlatcrit.lt.0.0) then
    352         write(*,*) 'iso_init 279: dsstlatcrit=',dsstlatcrit
    353         stop
    354       endif
    355 #endif             
    356   endif !if (modif_sst.ge.3) then
    357 endif !if (modif_sst.ge.2) then
    358 endif !  if (modif_sst.ge.1) then   
    359 call getin_p('modif_sic',modif_sic)
    360 if (modif_sic.ge.1) then
    361 call getin_p('deltasic',deltasic)
    362 endif !if (modif_sic.ge.1) then
    363 
    364 call getin_p('albedo_prescrit',albedo_prescrit)
    365 call getin_p('lon_min_albedo',lon_min_albedo)
    366 call getin_p('lon_max_albedo',lon_max_albedo)
    367 call getin_p('lat_min_albedo',lat_min_albedo)
    368 call getin_p('lat_max_albedo',lat_max_albedo)
    369 call getin_p('deltaO18_oce',deltaO18_oce)
    370 call getin_p('deltaP_BL',deltaP_BL)
    371 call getin_p('ruissellement_pluie',ruissellement_pluie)
    372 call getin_p('alphak_stewart',alphak_stewart)
    373 call getin_p('tdifexp_sol',tdifexp_sol)
    374 call getin_p('calendrier_guide',calendrier_guide)
    375 call getin_p('cste_surf_cond',cste_surf_cond)
    376 call getin_p('mixlen',mixlen)
    377 call getin_p('evap_cont_cste',evap_cont_cste)
    378 call getin_p('deltaO18_evap_cont',deltaO18_evap_cont)
    379 call getin_p('d_evap_cont',d_evap_cont) 
    380 call getin_p('nudge_qsol',nudge_qsol)
    381 call getin_p('region_nudge_qsol',region_nudge_qsol)
    382 call getin_p('no_pce',no_pce)
    383 call getin_p('A_satlim',A_satlim)
    384 call getin_p('ok_restrict_A_satlim',ok_restrict_A_satlim)
    385 #ifdef ISOVERIF     
    386 !call iso_verif_positif(1.0-A_satlim,'iso_init 158')
    387       if (A_satlim.gt.1.0) then
    388         write(*,*) 'iso_init 315: A_satlim=',A_satlim
    389         stop
    390       endif
    391 #endif         
    392 !      call getin_p('slope_limiterxy',slope_limiterxy)
    393 !      call getin_p('slope_limiterz',slope_limiterz)
    394 call getin_p('modif_ratqs',modif_ratqs)
    395 call getin_p('Pcrit_ratqs',Pcrit_ratqs)
    396 call getin_p('ratqsbasnew',ratqsbasnew)
    397 call getin_p('fac_modif_evaoce',fac_modif_evaoce)
    398 call getin_p('ok_bidouille_wake',ok_bidouille_wake)
    399 call getin_p('cond_temp_env',cond_temp_env)
    400 if (use_iso(iso_HTO_possible)) then
    401   ok_prod_nucl_tritium=.true.
    402   call getin_p('ok_prod_nucl_tritium',ok_prod_nucl_tritium)
    403 endif
    404 
    405 write(*,*) 'lambda,thumxt1=',lambda_sursat,thumxt1
    406 write(*,*) 'bidouille_anti_divergence=',bidouille_anti_divergence
    407 write(*,*) 'essai_convergence=',essai_convergence
    408 write(*,*) 'initialisation_iso=',initialisation_iso
    409 write(*,*) 'modif_sst=',modif_sst
    410 if (modif_sst.ge.1) then
    411 write(*,*) 'deltaTtest=',deltaTtest
    412 if (modif_sst.ge.2) then 
    413 write(*,*) 'deltaTtestpoles,sstlatcrit=', &
    414 &           deltaTtestpoles,sstlatcrit
    415 if (modif_sst.ge.3) then   
    416  write(*,*) 'dsstlatcrit=',dsstlatcrit
    417 endif !if (modif_sst.ge.3) then
    418 endif !if (modif_sst.ge.2) then
    419 endif !if (modif_sst.ge.1) then
    420 write(*,*) 'modif_sic=',modif_sic
    421 if (modif_sic.ge.1) then 
    422 write(*,*) 'deltasic=',deltasic
    423 endif !if (modif_sic.ge.1) then
    424 write(*,*) 'deltaO18_oce=',deltaO18_oce
    425 write(*,*) 'albedo_prescrit=',albedo_prescrit
    426 if (albedo_prescrit.eq.1) then
    427  write(*,*) 'lon_min_albedo,lon_max_albedo=', &
    428 &           lon_min_albedo,lon_max_albedo
    429  write(*,*) 'lat_min_albedo,lat_max_albedo=', &
    430 &           lat_min_albedo,lat_max_albedo
    431 endif !if (albedo_prescrit.eq.1) then
    432 write(*,*) 'deltaP_BL,ruissellement_pluie,alphak_stewart=', &
    433 &       deltaP_BL,ruissellement_pluie,alphak_stewart
    434 write(*,*) 'cste_surf_cond=',cste_surf_cond
    435 write(*,*) 'mixlen=',mixlen
    436 write(*,*) 'tdifexp_sol=',tdifexp_sol
    437 write(*,*) 'calendrier_guide=',calendrier_guide
    438 write(*,*) 'evap_cont_cste=',evap_cont_cste
    439 write(*,*) 'deltaO18_evap_cont,d_evap_cont=', &
    440 &           deltaO18_evap_cont,d_evap_cont
    441 write(*,*) 'nudge_qsol,region_nudge_qsol=', &
    442 &  nudge_qsol,region_nudge_qsol 
    443 write(*,*) 'nlevmaxO17=',nlevmaxO17
    444 write(*,*) 'no_pce=',no_pce
    445 write(*,*) 'A_satlim=',A_satlim
    446 write(*,*) 'ok_restrict_A_satlim=',ok_restrict_A_satlim
    447 !      write(*,*) 'slope_limiterxy=',slope_limiterxy
    448 !      write(*,*) 'slope_limiterz=',slope_limiterz
    449 write(*,*) 'modif_ratqs=',modif_ratqs
    450 write(*,*) 'Pcrit_ratqs=',Pcrit_ratqs
    451 write(*,*) 'ratqsbasnew=',ratqsbasnew
    452 write(*,*) 'fac_modif_evaoce=',fac_modif_evaoce
    453 write(*,*) 'ok_bidouille_wake=',ok_bidouille_wake
    454 write(*,*) 'cond_temp_env=',cond_temp_env
    455 write(*,*) 'ok_prod_nucl_tritium=',ok_prod_nucl_tritium
    456          
    457 
    458 !--------------------------------------------------------------
    459 ! Parameters that do not depend on the nature of water isotopes:
    460 !--------------------------------------------------------------
    461 
    462 ! -- temperature at which ice condensate starts to form (valeur ECHAM?):
    463 pxtmelt=273.15
    464 !      pxtmelt=273.15-10.0 ! test PHASE
    465 
    466 ! -- temperature at which all condensate is ice:
    467 pxtice=273.15-10.0
    468 !      pxtice=273.15-30.0 ! test PHASE
    469 
    470 ! -- minimum temperature to calculate fractionation coeff
    471 pxtmin=273.15-120.0 ! On ne calcule qu'au dessus de -120°C
    472 pxtmax=273.15+60.0 ! On ne calcule qu'au dessus de +60°C
    473 ! remarque: les coeffs ont été mesurés seulement jusq'à -40!
    474 
    475 ! -- a constant for alpha_eff for equilibrium below cloud base:
    476 tdifexp=0.58
    477 tv0cin=7.0
    478 
    479 ! facteurs lambda et mu dans Si=musi-lambda*T
    480 musi=1.0
    481 if (ok_nocinsat) then
    482 lambda_sursat = 0.0 ! no sursaturation effect
    483 endif           
    484 
    485 
    486 ! diffusion dans le sol
    487 Kd=2.5e-9 ! m2/s   
    488 
    489 ! cas où cste_surf_cond: on met rhs ou/et Ts cste pour voir
    490 rh_cste_surf_cond=0.6
    491 T_cste_surf_cond=288.0
    492 
    493 !--------------------------------------------------------------
    494 ! Parameters that depend on the nature of water isotopes:
    495 !--------------------------------------------------------------
    496 ! ** constantes locales
    497 fac_enrichoce18=0.0005
    498 ! on a alors tcor018=1+fac_enrichoce18
    499 ! tcorD=1+fac_enrichoce18*8
    500 ! tcorO17=1+fac_enrichoce18*0.528
    501 alpha_liq_sol_O18=1.00291 ! valeur de Lehmann & Siegenthaler, 1991,
    502   ! Journal of Glaciology, vol 37, p 23
    503 talph1_O18=1137.
    504 talph2_O18=-0.4156
    505 talph3_O18=-2.0667E-3
    506 talps1_O18=11.839
    507 talps2_O18=-0.028244
    508 tkcin0_O18 = 0.006
    509 tkcin1_O18 = 0.000285
    510 tkcin2_O18 = 0.00082
    511 tdifrel_O18= 1./0.9723
    512 
    513 ! rapport des ln(alphaeq) entre O18 et O17
    514 fac_coeff_eq17_liq=0.529 ! donné par Amaelle
    515 !      fac_coeff_eq17_ice=0.528 ! slope MWL
    516 fac_coeff_eq17_ice=0.529
    517 
    518 
    519 write(*,*) 'iso_O18,iso_HDO,iso_eau=',iso_O18,iso_HDO,iso_eau
    520 do 999 ixt = 1, niso
    521 write(*,*) 'iso_init 80: ixt=',ixt
    522 
    523 
    524 ! -- kinetic factor for surface evaporation:
    525 ! (cf: kcin = tkcin0                  if |V|<tv0cin
    526 !      kcin = tkcin1*|Vsurf| + tkcin2 if |V|>tv0cin )
    527 ! (Rq: formula discontinuous for |V|=tv0cin... )       
    528 
    529 ! -- main:
    530 if (ixt.eq.iso_HTO) then ! Tritium
    531   tkcin0(ixt) = 0.01056
    532   tkcin1(ixt) = 0.0005016
    533   tkcin2(ixt) = 0.0014432
    534   tnat(ixt)=0.
    535   !toce(ixt)=2.2222E-8 ! corrigé par Alex Cauquoin
    536   !toce(ixt)=1.0E-18 ! rapport 3H/1H ocean
    537   toce(ixt)=4.0E-19 ! rapport T/H = 0.2 TU Dreisigacker and Roether 1978
    538   tcorr(ixt)=1.
    539   tdifrel(ixt)=1./0.968
    540   talph1(ixt)=46480.
    541   talph2(ixt)=-103.87
    542   talph3(ixt)=0.
    543   talps1(ixt)=46480.
    544   talps2(ixt)=-103.87
    545   alpha_liq_sol(ixt)=1.
    546   Rdefault(ixt)=0.0
    547   Rmethox(ixt)=0.0
    548   striso(ixt)='HTO'
    549 endif     
    550 if (ixt.eq.iso_O17) then ! Deuterium
    551   pente_MWL=0.528
    552 !          tdifrel(ixt)=1./0.985452 ! donné par Amaelle
    553   tdifrel(ixt)=1./0.98555 ! valeur utilisée en 1D et dans modèle de LdG
    554 !          fac_kcin=0.5145 ! donné par Amaelle
    555   fac_kcin= (tdifrel(ixt)-1.0)/(tdifrel_O18-1.0)
    556   tkcin0(ixt) = tkcin0_O18*fac_kcin
    557   tkcin1(ixt) = tkcin1_O18*fac_kcin
    558   tkcin2(ixt) = tkcin2_O18*fac_kcin
    559   tnat(ixt)=0.004/100. ! O17 représente 0.004% de l'oxygène
    560   toce(ixt)=tnat(ixt)*(1.0+deltaO18_oce/1000.0)**pente_MWL
    561   tcorr(ixt)=1.0+fac_enrichoce18*pente_MWL ! donné par Amaelle           
    562   talph1(ixt)=talph1_O18
    563   talph2(ixt)=talph2_O18
    564   talph3(ixt)=talph3_O18
    565   talps1(ixt)=talps1_O18
    566   talps2(ixt)=talps2_O18     
    567   alpha_liq_sol(ixt)=(alpha_liq_sol_O18)**fac_coeff_eq17_liq
    568   if (Rdefault_smow) then   
    569         Rdefault(ixt)=tnat(ixt)*(-3.15/1000.0+1.0)
    570   else
    571         Rdefault(ixt)=0.0
    572   endif
    573   Rmethox(ixt)=(230./1000.+1.)*tnat(ixt) !Zahn et al 2006
    574   striso(ixt)='O17'
    575 endif
    576 
    577 if (ixt.eq.iso_O18) then ! Oxygene18
    578   tkcin0(ixt) = tkcin0_O18
    579   tkcin1(ixt) = tkcin1_O18
    580   tkcin2(ixt) = tkcin2_O18
    581   tnat(ixt)=2005.2E-6
    582   toce(ixt)=tnat(ixt)*(1.0+deltaO18_oce/1000.0)
    583   tcorr(ixt)=1.0+fac_enrichoce18
    584   tdifrel(ixt)=tdifrel_O18
    585   talph1(ixt)=talph1_O18
    586   talph2(ixt)=talph2_O18
    587   talph3(ixt)=talph3_O18
    588   talps1(ixt)=talps1_O18
    589   talps2(ixt)=talps2_O18
    590   alpha_liq_sol(ixt)=alpha_liq_sol_O18   
    591   if (Rdefault_smow) then   
    592         Rdefault(ixt)=tnat(ixt)*(-6.0/1000.0+1.0)
    593   else
    594         Rdefault(ixt)=0.0
    595   endif
    596   Rmethox(ixt)=(130./1000.+1.)*tnat(ixt) !Zahn et al 2006   
    597 !       write(*,*) 'iso_init 163: ZXalpha_liq_sol=',ZXalpha_liq_sol
    598   striso(ixt)='O18'
    599   write(*,*) 'isotopes_mod 519: ixt,striso(ixt)=',ixt,striso(ixt)
    600 endif
    601 
    602 if (ixt.eq.iso_HDO) then ! Deuterium
    603   pente_MWL=8.0
    604 !          fac_kcin=0.88
    605   tdifrel(ixt)=1./0.9755
    606   fac_kcin= (tdifrel(ixt)-1)/(tdifrel_O18-1)
    607   tkcin0(ixt) = tkcin0_O18*fac_kcin
    608   tkcin1(ixt) = tkcin1_O18*fac_kcin
    609   tkcin2(ixt) = tkcin2_O18*fac_kcin
    610   tnat(ixt)=155.76E-6
    611   toce(ixt)=tnat(ixt)*(1.0+pente_MWL*deltaO18_oce/1000.0)
    612   tcorr(ixt)=1.0+fac_enrichoce18*pente_MWL         
    613   talph1(ixt)=24844.
    614   talph2(ixt)=-76.248
    615   talph3(ixt)=52.612E-3
    616   talps1(ixt)=16288.
    617   talps2(ixt)=-0.0934
    618   !ZXalpha_liq_sol=1.0192 ! Weston, Ralph, 1955
    619   alpha_liq_sol(ixt)=1.0212
    620   ! valeur de Lehmann & Siegenthaler, 1991, Journal of
    621   ! Glaciology, vol 37, p 23
    622   if (Rdefault_smow) then   
    623     Rdefault(ixt)=tnat(ixt)*((-6.0*pente_MWL+10.0)/1000.0+1.0)
    624   else
    625     Rdefault(ixt)=0.0
    626   endif
    627   Rmethox(ixt)=tnat(ixt)*(-25.0/1000.+1.) ! Zahn et al 2006
    628   striso(ixt)='HDO'
    629   write(*,*) 'isotopes_mod 548: ixt,striso(ixt)=',ixt,striso(ixt)
    630 endif
    631 
    632 !       write(*,*) 'iso_init 163: ZXalpha_liq_sol=',ZXalpha_liq_sol
    633 if (ixt.eq.iso_eau) then ! Oxygene16
    634   tkcin0(ixt) = 0.0
    635   tkcin1(ixt) = 0.0
    636   tkcin2(ixt) = 0.0
    637   tnat(ixt)=1.
    638   toce(ixt)=tnat(ixt)
    639   tcorr(ixt)=1.0
    640   tdifrel(ixt)=1.
    641   talph1(ixt)=0.
    642   talph2(ixt)=0.
    643   talph3(ixt)=0.
    644   talps1(ixt)=0.
    645   talph3(ixt)=0.
    646   alpha_liq_sol(ixt)=1.
    647   if (Rdefault_smow) then
    648         Rdefault(ixt)=tnat(ixt)*1.0
    649   else
    650         Rdefault(ixt)=1.0
    651   endif
    652   Rmethox(ixt)=1.0
    653   striso(ixt)='eau'
    654 endif
    655 
    656 999   continue
    657 
    658 ! test de sensibilité:
    659 if (ok_nocinsfc) then ! no kinetic effect in sfc evaporation
    660  do ixt=1,niso
    661   tkcin0(ixt) = 0.0
    662   tkcin1(ixt) = 0.0
    663   tkcin2(ixt) = 0.0
    664  enddo
    665 endif
    666 
    667 ! nom des isotopes
    668 
    669 ! verif
    670 write(*,*) 'iso_init 285: verif initialisation:'
    671 
    672 do ixt=1,niso
    673   write(*,*) '* striso(',ixt,')=<'//striso(ixt)//'>'
    674   write(*,*) 'tnat(',ixt,')=',tnat(ixt)
    675 !          write(*,*) 'alpha_liq_sol(',ixt,')=',alpha_liq_sol(ixt)
    676 !          write(*,*) 'tkcin0(',ixt,')=',tkcin0(ixt)
    677 !          write(*,*) 'tdifrel(',ixt,')=',tdifrel(ixt)
    678 enddo
    679 write(*,*) 'iso_init 69: lambda=',lambda_sursat
    680 write(*,*) 'iso_init 69: thumxt1=',thumxt1
    681 write(*,*) 'iso_init 69: h_land_ice=',h_land_ice
    682 write(*,*) 'iso_init 69: P_veg=',P_veg   
    683 
    684     return
     235   CALL msg(' 315: A_satlim='//real2str(A_satlim), modname, A_satlim > 1.0)
     236   IF(A_satlim > 1.0) STOP
     237#endif
     238!  CALL get_in('slope_limiterxy',   slope_limiterxy,  2.0)
     239!  CALL get_in('slope_limiterz',    slope_limiterz,   2.0)
     240   CALL get_in('modif_ratqs',       modif_ratqs,        0)
     241   CALL get_in('Pcrit_ratqs',       Pcrit_ratqs,    500.0)
     242   CALL get_in('ratqsbasnew',       ratqsbasnew,     0.05)
     243   CALL get_in('fac_modif_evaoce',  fac_modif_evaoce, 1.0)
     244   CALL get_in('ok_bidouille_wake', ok_bidouille_wake,  0)
     245   ! si oui, la temperature de cond est celle de l'environnement, pour eviter
     246   ! bugs quand temperature dans ascendances convs est mal calculee
     247   CALL get_in('cond_temp_env',        cond_temp_env,        .FALSE.)
     248   IF(ANY(isoName == 'HTO')) &
     249   CALL get_in('ok_prod_nucl_tritium', ok_prod_nucl_tritium, .FALSE., .FALSE.)
     250
     251   !--------------------------------------------------------------
     252   ! Parameters that do not depend on the nature of water isotopes:
     253   !--------------------------------------------------------------
     254   ! -- temperature at which ice condensate starts to form (valeur ECHAM?):
     255   pxtmelt = 273.15
     256
     257   ! -- temperature at which all condensate is ice:
     258   pxtice  = 273.15-10.0
     259
     260   !- -- test PHASE
     261!   pxtmelt = 273.15 - 10.0
     262!   pxtice  = 273.15 - 30.0
     263
     264   ! -- minimum temperature to calculate fractionation coeff
     265   pxtmin = 273.15 - 120.0   ! On ne calcule qu'au dessus de -120°C
     266   pxtmax = 273.15 +  60.0   ! On ne calcule qu'au dessus de +60°C
     267   !    Remarque: les coeffs ont ete mesures seulement jusq'à -40!
     268
     269   ! -- a constant for alpha_eff for equilibrium below cloud base:
     270   tdifexp = 0.58
     271   tv0cin  = 7.0
     272
     273   ! facteurs lambda et mu dans Si=musi-lambda*T
     274   musi=1.0
     275   if (ok_nocinsat) lambda_sursat = 0.0          ! no sursaturation effect
     276
     277   ! diffusion dans le sol
     278   Kd=2.5e-9 ! m2/s   
     279
     280   ! cas où cste_surf_cond: on met rhs ou/et Ts cste pour voir
     281   rh_cste_surf_cond = 0.6
     282    T_cste_surf_cond = 288.0
     283   
     284   CALL msg('iso_O18, iso_HDO, iso_eau = '//TRIM(strStack(int2str([iso_O18, iso_HDO, iso_eau]))), modname)
     285
     286   !--------------------------------------------------------------
     287   ! Parameters that depend on the nature of water isotopes:
     288   !--------------------------------------------------------------
     289   IF(getKey('tnat',    tnat,    isoName)) CALL abort_physic(modname, 'can''t get tnat',    1)
     290   IF(getKey('toce',    toce,    isoName)) CALL abort_physic(modname, 'can''t get toce',    1)
     291   IF(getKey('tcorr',   tcorr,   isoName)) CALL abort_physic(modname, 'can''t get tcorr',   1)
     292   IF(getKey('talph1',  talph1,  isoName)) CALL abort_physic(modname, 'can''t get talph1',  1)
     293   IF(getKey('talph2',  talph2,  isoName)) CALL abort_physic(modname, 'can''t get talph2',  1)
     294   IF(getKey('talph3',  talph3,  isoName)) CALL abort_physic(modname, 'can''t get talph3',  1)
     295   IF(getKey('talps1',  talps1,  isoName)) CALL abort_physic(modname, 'can''t get talps1',  1)
     296   IF(getKey('talps2',  talps2,  isoName)) CALL abort_physic(modname, 'can''t get talps2',  1)
     297   IF(getKey('tkcin0',  tkcin0,  isoName)) CALL abort_physic(modname, 'can''t get tkcin0',  1)
     298   IF(getKey('tkcin1',  tkcin1,  isoName)) CALL abort_physic(modname, 'can''t get tkcin1',  1)
     299   IF(getKey('tkcin2',  tkcin2,  isoName)) CALL abort_physic(modname, 'can''t get tkcin2',  1)
     300   IF(getKey('tdifrel', tdifrel, isoName)) CALL abort_physic(modname, 'can''t get tdifrel', 1)
     301   IF(getKey('alpha_liq_sol', alpha_liq_sol, isoName)) CALL abort_physic(modname, 'can''t get alpha_liq_sol',  1)
     302   IF(getKey('Rdefault',Rdefault,isoName)) CALL abort_physic(modname, 'can''t get Rdefault',1)
     303   IF(getKey('Rmethox', Rmethox, isoName)) CALL abort_physic(modname, 'can''t get Rmethox', 1)
     304   IF(.NOT.Rdefault_smow) Rdefault(:) = 0.0
     305
     306   !--- Sensitivity test: no kinetic effect in sfc evaporation
     307   IF(ok_nocinsfc) THEN
     308      tkcin0(1:niso) = 0.0
     309      tkcin1(1:niso) = 0.0
     310      tkcin2(1:niso) = 0.0
     311   END IF
     312
     313   CALL msg('285: verif initialisation:', modname)
     314   DO ixt=1,niso
     315      sxt=int2str(ixt)
     316      CALL msg(' * isoName('//TRIM(sxt)//') = <'//TRIM(isoName(ixt))//'>',  modname)
     317      CALL msg(  '    tnat('//TRIM(sxt)//') = '//TRIM(real2str(tnat(ixt))), modname)
     318!     CALL msg('    alpha_liq_sol('//TRIM(sxt)//') = '//TRIM(real2str(alpha_liq_sol(ixt))), modname)
     319!     CALL msg(        '   tkcin0('//TRIM(sxt)//') = '//TRIM(real2str(tkcin0(ixt))),        modname)
     320!     CALL msg(       '   tdifrel('//TRIM(sxt)//') = '//TRIM(real2str(tdifrel(ixt))),       modname)
     321   END DO
     322   CALL msg('69:     lambda = '//TRIM(real2str(lambda_sursat)), modname)
     323   CALL msg('69:    thumxt1 = '//TRIM(real2str(thumxt1)),       modname)
     324   CALL msg('69: h_land_ice = '//TRIM(real2str(h_land_ice)),    modname)
     325   CALL msg('69:      P_veg = '//TRIM(real2str(P_veg)),         modname)
     326
    685327END SUBROUTINE iso_init
    686328
     329
     330SUBROUTINE getinp_s(nam, val, def, lDisp)
     331   USE ioipsl_getincom, ONLY: getin
     332   USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
     333   USE mod_phys_lmdz_omp_data, ONLY :  is_omp_root
     334   USE mod_phys_lmdz_transfert_para, ONLY : bcast
     335   CHARACTER(LEN=*),           INTENT(IN)    :: nam
     336   CHARACTER(LEN=*),           INTENT(INOUT) :: val
     337   CHARACTER(LEN=*), OPTIONAL, INTENT(IN)    :: def
     338   LOGICAL,          OPTIONAL, INTENT(IN)    :: lDisp
     339   LOGICAL :: lD
     340!$OMP BARRIER
     341   IF(is_mpi_root.AND.is_omp_root) THEN
     342      IF(PRESENT(def)) val=def; CALL getin(nam,val)
     343      lD=.TRUE.; IF(PRESENT(lDisp)) lD=lDisp
     344      IF(lD) CALL msg(TRIM(nam)//' = '//TRIM(val))
     345  END IF
     346  CALL bcast(val)
     347END SUBROUTINE getinp_s
     348
     349SUBROUTINE getinp_i(nam, val, def, lDisp)
     350   USE ioipsl_getincom, ONLY: getin
     351   USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
     352   USE mod_phys_lmdz_omp_data, ONLY :  is_omp_root
     353   USE mod_phys_lmdz_transfert_para, ONLY : bcast
     354   CHARACTER(LEN=*),  INTENT(IN)    :: nam
     355   INTEGER,           INTENT(INOUT) :: val
     356   INTEGER, OPTIONAL, INTENT(IN)    :: def
     357   LOGICAL, OPTIONAL, INTENT(IN)    :: lDisp
     358   LOGICAL :: lD
     359!$OMP BARRIER
     360   IF(is_mpi_root.AND.is_omp_root) THEN
     361      IF(PRESENT(def)) val=def; CALL getin(nam,val)
     362      lD=.TRUE.; IF(PRESENT(lDisp)) lD=lDisp
     363      IF(lD) CALL msg(TRIM(nam)//' = '//TRIM(int2str(val)))
     364  END IF
     365  CALL bcast(val)
     366END SUBROUTINE getinp_i
     367
     368SUBROUTINE getinp_r(nam, val, def, lDisp)
     369   USE ioipsl_getincom, ONLY: getin
     370   USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
     371   USE mod_phys_lmdz_omp_data, ONLY :  is_omp_root
     372   USE mod_phys_lmdz_transfert_para, ONLY : bcast
     373   CHARACTER(LEN=*),  INTENT(IN)    :: nam
     374   REAL,              INTENT(INOUT) :: val
     375   REAL,    OPTIONAL, INTENT(IN)    :: def
     376   LOGICAL, OPTIONAL, INTENT(IN)    :: lDisp
     377   LOGICAL :: lD
     378!$OMP BARRIER
     379   IF(is_mpi_root.AND.is_omp_root) THEN
     380      IF(PRESENT(def)) val=def; CALL getin(nam,val)
     381      lD=.TRUE.; IF(PRESENT(lDisp)) lD=lDisp
     382      IF(lD) CALL msg(TRIM(nam)//' = '//TRIM(real2str(val)))
     383  END IF
     384  CALL bcast(val)
     385END SUBROUTINE getinp_r
     386
     387SUBROUTINE getinp_l(nam, val, def, lDisp)
     388   USE ioipsl_getincom, ONLY: getin
     389   USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
     390   USE mod_phys_lmdz_omp_data, ONLY :  is_omp_root
     391   USE mod_phys_lmdz_transfert_para, ONLY : bcast
     392   CHARACTER(LEN=*),  INTENT(IN)    :: nam
     393   LOGICAL,           INTENT(INOUT) :: val
     394   LOGICAL, OPTIONAL, INTENT(IN)    :: def
     395   LOGICAL, OPTIONAL, INTENT(IN)    :: lDisp
     396   LOGICAL :: lD
     397!$OMP BARRIER
     398   IF(is_mpi_root.AND.is_omp_root) THEN
     399      IF(PRESENT(def)) val=def; CALL getin(nam,val)
     400      lD=.TRUE.; IF(PRESENT(lDisp)) lD=lDisp
     401      IF(lD) CALL msg(TRIM(nam)//' = '//TRIM(bool2str(val)))
     402  END IF
     403  CALL bcast(val)
     404END SUBROUTINE getinp_l
    687405
    688406END MODULE isotopes_mod
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/isotopes_routines_mod.F90

    r4089 r4446  
    33
    44MODULE isotopes_routines_mod
     5  USE infotrac_phy, ONLY: niso, ntraciso=>ntiso, index_trac=>itZonIso, ntraceurs_zone=>nzone
    56IMPLICIT NONE
    67
     
    1314&            zqs,zq_ancien,zqev_diag,zq)
    1415
    15 USE infotrac_phy, ONLY: ntraciso,niso, &
    16         ntraceurs_zone,index_trac
    1716USE isotopes_mod, ONLY: ridicule, ridicule_rain, thumxt1, no_pce,  &
    1817&       bidouille_anti_divergence, &
     
    846845&    L, xtnu,Pveg)
    847846
    848 USE infotrac_phy, ONLY: niso
    849847USE isotopes_mod, ONLY: ridicule_qsol, ridicule, &
    850848&       ridicule_evap,P_veg,iso_HDO,iso_eau,iso_O17,iso_O18
     
    13011299
    13021300subroutine calcul_kcin(Vsurf,KCIN)
    1303 USE infotrac_phy, ONLY: niso
    13041301USE isotopes_mod, ONLY: tv0cin,tkcin0,tkcin1,tkcin2
    13051302implicit none
     
    13281325
    13291326     subroutine fractcalk(kt, ptin, pxtfra, pfraice)
    1330 !USE infotrac_phy, ONLY: use_iso
    13311327USE isotopes_mod, ONLY: talph1,talph2,talph3,pxtmin,iso_O17, &
    13321328&       fac_coeff_eq17_liq, pxtmelt, &
     
    14571453      subroutine fractcalk_liq(kt, ptin, pxtfra)
    14581454
    1459 !      USE infotrac_phy, ONLY: use_iso
    14601455      USE isotopes_mod, ONLY: pxtmin,talph1,talph2,talph3, &
    14611456&       fac_coeff_eq17_liq, pxtice, &
     
    15221517      subroutine fractcalk_glace(kt, ptin, pfraice)
    15231518
    1524 !      use infotrac_phy, ONLY: use_iso
    15251519      use isotopes_mod, ONLY: talps1,talps2, iso_O17,fac_coeff_eq17_ice, &
    15261520        & pxtmelt,musi, lambda_sursat, tdifrel, &
     
    16311625      subroutine fractcalk_vectall(ptin, pxtfra, pfraice,n)
    16321626
    1633         USE infotrac_phy, ONLY: niso
    16341627        USE isotopes_mod, ONLY: talph1,talph2,talph3,tdifrel,pxtmin, &
    16351628&      iso_O17, iso_HTO, iso_eau, iso_O18, iso_HDO, musi, lambda_sursat, &
     
    18031796      subroutine fractcalk_vectall_liq(ptin, pxtfra, n)
    18041797
    1805       USE infotrac_phy, ONLY: niso
    18061798      USE isotopes_mod, ONLY: pxtmin,talph1,talph2,talph3, &
    18071799&       iso_eau,iso_HDO, iso_O18, iso_O17,iso_HTO,fac_coeff_eq17_liq, &
     
    18821874      subroutine fractcalk_vectall_ice(ptin, pfraice,n)
    18831875
    1884       use infotrac_phy, ONLY: niso
    18851876      use isotopes_mod, ONLY: talps1,talps2, fac_coeff_eq17_ice, &
    18861877        & pxtmelt,musi, lambda_sursat, tdifrel, &
     
    20232014&            i,Rsol,klon)
    20242015
    2025   USE infotrac_phy, ONLY: niso,ntraciso
    20262016  USE isotopes_mod, ONLY: iso_eau, iso_HDO,ridicule, &
    20272017&        ridicule_qsol,iso_O17,iso_O18
     
    22332223&          i,xtevap,klon) 
    22342224
    2235   USE infotrac_phy, ONLY: ntraciso,niso
    22362225  USE isotopes_mod, ONLY: iso_eau, iso_HDO,ridicule,ridicule_rain, &
    22372226        iso_O18,iso_O17
     
    24442433&   )
    24452434
    2446   USE infotrac_phy, ONLY: ntraciso,niso
    24472435  USE isotopes_mod, ONLY: iso_eau, iso_HDO,expb_max,tdifrel,tdifexp, &
    24482436&       ridicule,thumxt1,ridicule_rain,bidouille_anti_divergence, &
     
    45004488&           Tevap)
    45014489
    4502   USE infotrac_phy, ONLY: niso,ntraciso
    45034490  USE isotopes_mod, ONLY: iso_eau, iso_HDO,bidouille_anti_divergence, &
    45044491&       ridicule,ridicule_rain
     
    46584645&           ,fac_ftmr)
    46594646
    4660   USE infotrac_phy, ONLY: niso,ntraciso
    46614647  USE isotopes_mod, ONLY: iso_eau, iso_HDO,bidouille_anti_divergence, &
    46624648&       Rdefault,ridicule,ridicule_rain
     
    49044890     &           Pqiinf_cas,Pqiinf)
    49054891
    4906   USE infotrac_phy, ONLY: niso,ntraciso
    49074892  USE isotopes_mod, ONLY: iso_eau, iso_HDO
    49084893
     
    50665051     &           xtnew_cas,xtnew,Pxtiinf_cas,Pxtiinf)
    50675052
    5068   USE infotrac_phy, ONLY: niso
    50695053  USE isotopes_mod, ONLY: iso_eau, iso_HDO
    50705054#ifdef ISOVERIF
     
    51115095     &           ncum)
    51125096
    5113   USE infotrac_phy, ONLY: niso,ntraciso
    51145097  USE isotopes_mod, ONLY: iso_eau, iso_HDO
    51155098
     
    51765159     &    nloc,ncum,nd,i)
    51775160
    5178   USE infotrac_phy, ONLY: niso, ntraciso
    51795161  USE isotopes_mod, ONLY: iso_eau, iso_HDO
    51805162
     
    52525234     &    nloc,ncum,nd,i)
    52535235
    5254   USE infotrac_phy, ONLY: niso,ntraciso
    52555236  USE isotopes_mod, ONLY: iso_eau, iso_HDO
    52565237
     
    53265307     &    nloc,ncum,nd,i)
    53275308
    5328   USE infotrac_phy, ONLY: niso,ntraciso
    53295309  USE isotopes_mod, ONLY: iso_eau, iso_HDO
    53305310
     
    53965376     &    nloc,ncum,nd,i)
    53975377
    5398   USE infotrac_phy, ONLY: niso,ntraciso
    53995378  USE isotopes_mod, ONLY: iso_eau, iso_HDO,ridicule
    54005379
     
    55665545     &    nloc,ncum,nd,i,frac_sublim)
    55675546
    5568   USE infotrac_phy, ONLY: niso,ntraciso
    55695547  USE isotopes_mod, ONLY: iso_eau, iso_HDO,ridicule
    55705548
     
    57035681     &       zxtrfln_cas,zxt_cas,zxtrfl,zxtrfln,zxt,klon)
    57045682
    5705   USE infotrac_phy, ONLY: niso,ntraciso
    57065683  USE isotopes_mod, ONLY: iso_eau, iso_HDO
    57075684
     
    57395716     &       delP,paprs,k,klon,klev)
    57405717
    5741   USE infotrac_phy, ONLY: niso
    57425718  USE isotopes_mod, ONLY: iso_eau, iso_HDO
    57435719         implicit none
     
    57775753     &       delP,paprs,k,klon,klev)
    57785754
    5779   USE infotrac_phy, ONLY: niso,ntraciso
    57805755  USE isotopes_mod, ONLY: iso_eau, iso_HDO
    57815756         implicit none
     
    58285803     &       delP,paprs,k,klon,klev,frac_sublim)
    58295804
    5830   USE infotrac_phy, ONLY: niso,ntraciso
    58315805  USE isotopes_mod, ONLY: iso_eau, iso_HDO
    58325806#ifdef ISOVERIF
     
    59055879     &          qp0,A,m0,beta,gama,g0) 
    59065880
    5907   USE infotrac_phy, ONLY: niso
    59085881  USE isotopes_mod, ONLY: iso_eau, iso_HDO,ntot
    59095882#ifdef ISOVERIF
     
    61006073 
    61016074
    6102   USE infotrac_phy, ONLY: ntraciso,niso,ntraceurs_zone, &
    6103 &       index_trac
    61046075  USE isotopes_mod, ONLY: iso_eau, iso_HDO,thumxt1, &
    61056076&       bidouille_anti_divergence,ridicule
     
    76807651     &          )   
    76817652
    7682   USE infotrac_phy, ONLY: niso,ntraciso
    76837653  USE isotopes_mod, ONLY: iso_eau, iso_HDO, Rdefault, ridicule
    76847654#ifdef ISOVERIF
     
    80488018     &  )
    80498019
    8050   USE infotrac_phy, ONLY: niso,ntraciso
    80518020  USE isotopes_mod, ONLY: iso_eau, iso_HDO, Rdefault,ridicule
    80528021#ifdef ISOVERIF
     
    82538222     &          )
    82548223
    8255   USE infotrac_phy, ONLY: niso,ntraciso
    82568224  USE isotopes_mod, ONLY: iso_eau, iso_HDO, Rdefault,ridicule
    82578225#ifdef ISOVERIF
     
    83908358     &          ,xtp_cas,xtwater_cas,xtevap_cas)
    83918359
    8392   USE infotrac_phy, ONLY: niso,ntraciso
    83938360  USE isotopes_mod, ONLY: iso_eau, iso_HDO,no_pce, Rdefault,ridicule       
    83948361#ifdef ISOVERIF
     
    89278894     &          ,xtp_cas,xtwater_cas,xtevap_cas)
    89288895
    8929   USE infotrac_phy, ONLY: niso,ntraciso
    89308896  USE isotopes_mod, ONLY: iso_eau, iso_HDO, Rdefault, ridicule
    89318897#ifdef ISOVERIF
     
    93179283 
    93189284
    9319   USE infotrac_phy, ONLY: niso,ntraciso, &
    9320 &       ntraceurs_zone,index_trac
    93219285  USE isotopes_mod, ONLY: iso_eau, iso_HDO,bidouille_anti_divergence, &
    93229286&       thumxt1, ridicule
     
    1102210986     &          )
    1102310987
    11024   USE infotrac_phy, ONLY: niso,ntraciso
    1102510988  USE isotopes_mod, ONLY: iso_eau, iso_HDO,Rdefault,ridicule
    1102610989#ifdef ISOVERIF
     
    1117211135     &          ,xtp_cas,xtwater_cas,xtevap_cas)
    1117311136
    11174   USE infotrac_phy, ONLY: niso,ntraciso
    1117511137  USE isotopes_mod, ONLY: iso_eau, iso_HDO,Rdefault,no_pce,ridicule
    1117611138#ifdef ISOVERIF
     
    1177011732     &          ,xtp_cas,xtwater_cas,xtevap_cas)
    1177111733
    11772   USE infotrac_phy, ONLY: niso,ntraciso
    1177311734  USE isotopes_mod, ONLY: iso_eau, iso_HDO, Rdefault, ridicule
    1177411735#ifdef ISOVERIF
     
    1219812159     &          tcond,zfice,zxtice,zxtliq)
    1219912160
    12200     USE infotrac_phy, ONLY: ntraciso,niso
    1220112161    USE isotopes_mod, ONLY: iso_eau,iso_HDO,essai_convergence, &
    1220212162&       bidouille_anti_divergence,ridicule
     
    1243212392     &          tcond,zfice,zxtice,zxtliq,n)
    1243312393
    12434     USE infotrac_phy, ONLY: ntraciso,niso
    1243512394    USE isotopes_mod, ONLY: iso_eau,iso_HDO,iso_O18,bidouille_anti_divergence, &
    1243612395&       ridicule
     
    1289012849     &          tcond,zfice,zxtice,zxtliq)
    1289112850
    12892     USE infotrac_phy, ONLY: ntraciso
    1289312851    USE isotopes_mod, ONLY: iso_eau,iso_HDO,bidouille_anti_divergence, &
    1289412852&       ridicule,iso_O18
     
    1308813046     &           xt1lay,q1lay,tsurf,t_coup,nisurf,Rland_ice)
    1308913047
    13090     USE infotrac_phy, ONLY: ntraciso,niso
    1309113048    USE isotopes_mod, ONLY: Rdefault,iso_eau,iso_HDO, &
    1309213049&       bidouille_anti_divergence, ridicule,ridicule_snow, &
     
    1365813615     &   )
    1365913616
    13660     USE infotrac_phy, ONLY: ntraciso,niso
    1366113617    USE isotopes_mod, ONLY: iso_eau,iso_HDO,cste_surf_cond, &
    1366213618&       rh_cste_surf_cond,Rdefault,T_cste_surf_cond,iso_O17,iso_O18, &
     
    1398213938     &   )
    1398313939
    13984     USE infotrac_phy, ONLY: ntraciso,niso
    1398513940    USE isotopes_mod, ONLY: tcorr, toce, alpha_liq_sol,ridicule_evap, &
    1398613941        iso_eau,iso_HDO
     
    1423814193     &   )
    1423914194
    14240     USE infotrac_phy, ONLY: ntraciso,niso
    1424114195    USE isotopes_mod, ONLY: h_land_ice, ridicule,ridicule_snow,ridicule_evap, &
    1424214196        iso_eau,iso_HDO,iso_O18
     
    1457314527     &   )
    1457414528
    14575 USE infotrac_phy, ONLY: niso,ntraciso
    1457614529USE isotopes_mod, ONLY: tdifrel,tdifexp_sol, iso_eau, iso_HDO, &
    1457714530&       bidouille_anti_divergence,ruissellement_pluie, Rdefault,Kd, &
     
    1600115954      !USE write_field_phy
    1600215955      USE indice_sol_mod, only: nbsrf 
    16003   USE infotrac_phy, ONLY: ntraciso,niso
    1600415956  USE isotopes_mod, ONLY: initialisation_iso, iso_eau,iso_HDO, &
    1600515957        ridicule_qsol,tnat, P_veg,iso_O18,ridicule, ridicule_snow,iso_O17, &
     
    1618716139      !USE write_field_phy
    1618816140      USE indice_sol_mod, only: nbsrf
    16189   USE infotrac_phy, ONLY: ntraciso,niso
    1619016141  USE isotopes_mod, ONLY: tnat,iso_HDO,iso_O18,iso_HTO, iso_eau,toce, &
    1619116142&       Rdefault,iso_O17,ridicule,ridicule_qsol
     
    1655716508      end subroutine phyiso_etat0_dur
    1655816509
    16559       subroutine phyiso_etat0_fichier( &
    16560      &           snow,run_off_lic_0, &
    16561      &           xtsnow,xtrun_off_lic_0, &
    16562      &           Rland_ice)
    16563       USE dimphy, only: klon,klev
    16564       !USE mod_grid_phy_lmdz
    16565       !USE mod_phys_lmdz_para
    16566       USE iophy
    16567       USE phys_state_var_mod, ONLY: q_ancien,xt_ancien,wake_deltaq,wake_deltaxt, &
    16568 #ifdef ISOVERIF
    16569         rain_fall,snow_fall,fevap,qsol, &
    16570 #endif
    16571         xtrain_fall,xtsnow_fall,ql_ancien,xtl_ancien,qs_ancien,xts_ancien, &
    16572         fxtevap,xtsol
    16573       !USE iostart
    16574       !USE write_field_phy
    16575       USE indice_sol_mod, only: nbsrf 
    16576   USE infotrac_phy, ONLY: ntraciso,niso
    16577   USE isotopes_mod, ONLY: striso,iso_HDO,iso_eau
    16578 #ifdef ISOVERIF
    16579   USE isotopes_verif_mod
     16510SUBROUTINE phyiso_etat0_fichier(snow, run_off_lic_0, xtsnow, xtrun_off_lic_0, Rland_ice)
     16511   USE dimphy,             ONLY: klon,klev
     16512   USE iophy
     16513   USE phys_state_var_mod, ONLY: q_ancien, xt_ancien, wake_deltaq, wake_deltaxt, &
     16514#ifdef ISOVERIF
     16515     rain_fall, snow_fall, fevap,qsol, &
     16516#endif
     16517     xtrain_fall, xtsnow_fall, ql_ancien, xtl_ancien, qs_ancien, xts_ancien, fxtevap, xtsol
     16518   USE indice_sol_mod,    ONLY: nbsrf
     16519   USE isotopes_mod,      ONLY: isoName,iso_HDO,iso_eau
     16520   USE phyetat0_get_mod,  ONLY: phyetat0_get, phyetat0_srf
     16521   USE readTracFiles_mod, ONLY: new2oldH2O
     16522   USE strings_mod,       ONLY: strIdx, strTail, maxlen, msg, int2str
     16523#ifdef ISOVERIF
     16524   USE isotopes_verif_mod
    1658016525#endif
    1658116526#ifdef ISOTRAC
    16582  USE isotrac_mod, ONLY: strtrac,initialisation_isotrac,index_iso, &
    16583 &       index_zone,izone_init
    16584 #endif
    16585         implicit none
     16527   USE isotrac_mod, ONLY: strtrac, initialisation_isotrac, index_iso, index_zone, izone_init
     16528#endif
     16529   IMPLICIT NONE
    1658616530
    1658716531#include "netcdf.inc"
    1658816532#include "dimsoil.h"
    1658916533#include "clesphys.h"
    16590 ! #include "thermcell.h"
    1659116534#include "compbl.h"   
    1659216535
    16593         ! inputs
    16594         !REAL qsol(klon)
    16595         REAL snow(klon,nbsrf)
    16596         !REAL evap(klon,nbsrf)
    16597         REAL run_off_lic_0(klon)
    16598         ! outputs   
    16599         !REAL xtsol(niso,klon)
    16600         REAL xtsnow(niso,klon,nbsrf)
    16601         !REAL xtevap(ntraciso,klon,nbsrf)     
    16602         REAL xtrun_off_lic_0(niso,klon)
    16603         REAL Rland_ice(niso,klon)
    16604 
    16605         ! locals
    16606         real iso_tmp(klon)
    16607         real iso_tmp_lonlev(klon,klev)
    16608         real iso_tmp_lonsrf(klon,nbsrf)
    16609         INTEGER ierr
    16610         integer i,ixt,k,nsrf
    16611         INTEGER nid, nvarid
    16612         CHARACTER*2 str2
    16613         CHARACTER*5 str5
    16614         real xmin,xmax   
    16615         CHARACTER*50 striso_sortie 
    16616         integer lnblnk
    16617         LOGICAL :: found,phyetat0_get,phyetat0_srf
    16618 
    16619 !#ifdef ISOVERIF
    16620 !      integer iso_verif_egalite_nostop
    16621 !#endif
    16622 !#ifdef ISOVERIF
    16623 !        real deltaD
    16624 !        integer iso_verif_noNaN_nostop
    16625 !#endif
     16536   REAL, INTENT(IN) ::             snow     (klon,nbsrf)
     16537   REAL, INTENT(IN) ::    run_off_lic_0     (klon)
     16538   REAL, INTENT(OUT) ::          xtsnow(niso,klon,nbsrf)
     16539   REAL, INTENT(OUT) :: xtrun_off_lic_0(niso,klon)
     16540   REAL, INTENT(OUT) ::       Rland_ice(niso,klon)
     16541
     16542   INTEGER :: ierr, i, ixt, k, nsrf, nid, nvarid, lnblnk
     16543   CHARACTER(LEN=2) :: str2
     16544   CHARACTER(LEN=5) :: str5
     16545   CHARACTER(LEN=maxlen) :: outiso, oldIso, modname, nam(2)
     16546   REAL :: xmin, xmax
     16547   LOGICAL :: found
    1662616548#ifdef ISOTRAC
    16627         integer iiso,izone
    16628 #endif
    16629 
    16630 
    16631    write(*,*) 'phyiso_etat0_fichier 3'
    16632    write(*,*) 'niso=',niso
    16633    write(*,*) 'striso(1)=',striso(1)
    16634 
    16635    do ixt=1,ntraciso
    16636 
    16637      if (ixt.le.niso) then
    16638         striso_sortie=striso(ixt)
    16639      else
     16549   INTEGER :: iiso, izone
     16550#endif
     16551
     16552   modname = 'phyiso_etat0_fichier'
     16553   CALL msg('3', modname)
     16554   CALL msg('niso = '//TRIM(int2str(niso)), modname)
     16555   CALL msg('isoName(1) = '//TRIM(isoName(1)), modname)
     16556
     16557   DO ixt = 1, ntraciso
     16558
     16559      outiso = isoName(ixt)
     16560      oldIso = strTail(new2oldH2O(outiso), '_')            !--- Remove "H2O_" from "H2O_<iso>[_<tag>]"
     16561      ! on lit seulement si ixt<=niso ou si on initialise les traceurs d'après fichier:
    1664016562#ifdef ISOTRAC
    16641         iiso=index_iso(ixt)
    16642         izone=index_zone(ixt)       
    16643         striso_sortie=striso(iiso)//strtrac(izone)
    16644 #else
    16645         write(*,*) 'phyredem 546: ixt,ntraciso=', ixt,ntraciso
    16646         stop
    16647 #endif
    16648      endif !if (ixt.le.niso) then
    16649      write(*,*) 'phyiso_etat0_fichier 16621: ixt,striso_sortie=',ixt,striso_sortie(1:lnblnk(striso_sortie))
    16650 
    16651            
    16652       ! on lit seulement si ixt<=niso ou si on initialise les traceurs d'après
    16653       ! fichier:
     16563      IF(ixt <= niso .OR. initialisation_isotrac == 0) THEN
     16564#endif
     16565      found = phyetat0iso_srf3(xtsnow,      "XTSNOW", "Surface snow", 0.)
     16566      if (.NOT.found) CALL abort_physic('isotopes_routines_mod', 'phyiso_etat0_fichier 16581: unfound isotopic variable',1)
     16567      found = phyetat0iso_srf3(fxtevap,     "XTEVAP", "evaporation",  0.)
     16568      found = phyetat0iso_get2(xtrain_fall, "xtrain_f", "xrain fall", 0.)
     16569      found = phyetat0iso_get2(xtsnow_fall, "xtsnow_f", "xsnow fall", 0.)
     16570      found = phyetat0iso_get3(xt_ancien,   "XTANCIEN",  "QANCIEN",   0.)
     16571      found = phyetat0iso_get3(xtl_ancien,  "XTLANCIEN", "QLANCIEN",  0.)
     16572      found = phyetat0iso_get3(xts_ancien,  "XTSANCIEN", "QSANCIEN",  0.)
     16573      found = phyetat0iso_get2(xtrun_off_lic_0, "XTRUNOFFLIC0", "RUNOFFLIC0", 0.)
     16574      found = phyetat0iso_get3(wake_deltaxt,  "WAKE_DELTAXT", "Delta hum. wake/env",  0.)
     16575#ifdef ISOVERIF
     16576      IF(ixt == iso_eau .AND. iso_eau > 0) THEN
     16577         DO i=1,klon
     16578            CALL iso_verif_egalite(xtrain_fall(iso_eau,i),rain_fall(i),TRIM(modname)//' 231a')
     16579            CALL iso_verif_egalite(xtsnow_fall(iso_eau,i),snow_fall(i),TRIM(modname)//' 231b')
     16580            DO nsrf = 1, nbsrf
     16581               CALL iso_verif_egalite(fxtevap(iso_eau,i,nsrf),fevap(i,nsrf),TRIM(modname)//' 231c')
     16582               CALL iso_verif_egalite( xtsnow(iso_eau,i,nsrf), snow(i,nsrf),TRIM(modname)//' 231d')
     16583            END DO
     16584         END DO
     16585      END IF
     16586      IF(ixt == iso_HDO .AND. iso_HDO > 0) THEN
     16587         DO k=1,klev
     16588            DO i=1,klon
     16589               IF(q_ancien(i,k) > 2e-3) &
     16590                  CALL iso_verif_aberrant(xt_ancien(iso_hdo,i,k)/q_ancien(i,k),TRIM(modname)//' 312')
     16591            END DO
     16592         END DO
     16593      END IF
     16594      IF(iso_eau > 0 .AND. ixt == iso_eau) THEN
     16595         DO i=1,klon
     16596            IF(iso_verif_egalite_nostop(run_off_lic_0(i),xtrun_off_lic_0(iso_eau,i),TRIM(modname)//' 326') == 1) THEN
     16597               WRITE(*,*) 'i=',i
     16598               STOP
     16599            END IF
     16600         END DO
     16601      END IF
     16602#endif
     16603      ! ces variables n'ont pas de traceurs:
     16604      IF(ixt <= niso) THEN
     16605         found = phyetat0iso_get2(xtsol, "XTSOL", "Surface humidity / bucket", 0.)
     16606         found = phyetat0iso_get2(Rland_ice, "Rland_ice", "SR land ice", 0.)
     16607#ifdef ISOVERIF
     16608
     16609         DO i=1,klon
     16610            IF(iso_verif_noNaN_nostop(xtsol(ixt,i),TRIM(modname)//' 95') == 1) THEN
     16611               WRITE(*,*) 'ixt,i=',ixt,i
     16612               STOP
     16613            END IF
     16614         END DO
     16615#endif
     16616      END IF
    1665416617#ifdef ISOTRAC
    16655       if ((ixt.le.niso).or.(initialisation_isotrac.eq.0)) then
    16656 #endif
    16657 
    16658       found=phyetat0_srf(1,iso_tmp_lonsrf,"XTSNOW"//striso_sortie(1:lnblnk(striso_sortie)), &
    16659      &     "Surface snow",0.)
    16660       if (.NOT.found) then
    16661         CALL abort_physic('isotopes_routines_mod', &
    16662                 'phyiso_etat0_fichier 16581: variable isotopique not found',1)
    16663       endif
    16664       xtsnow(ixt,:,:)=iso_tmp_lonsrf(:,:)
    16665      
    16666       found=phyetat0_srf(1,iso_tmp_lonsrf,"XTEVAP"//striso_sortie &
    16667      &   (1:lnblnk(striso_sortie)),"evaporation",0.)
    16668       fxtevap(ixt,:,:)=iso_tmp_lonsrf(:,:)
    16669 
    16670       found=phyetat0_get(1,iso_tmp,"xtrain_f"//striso_sortie &
    16671      &   (1:lnblnk(striso_sortie)),"xrain fall",0.)
    16672       xtrain_fall(ixt,:)=iso_tmp(:)
    16673 
    16674       found=phyetat0_get(1,iso_tmp,"xtsnow_f"//striso_sortie &
    16675      &   (1:lnblnk(striso_sortie)),"snow fall",0.)
    16676       xtsnow_fall(ixt,:)=iso_tmp(:)
    16677 
    16678       found=phyetat0_get(klev,iso_tmp_lonlev,"XTANCIEN"//striso_sortie &
    16679      &       (1:lnblnk(striso_sortie)),"QANCIEN",0.)
    16680       xt_ancien(ixt,:,:)=iso_tmp_lonlev(:,:)
    16681 
    16682       found=phyetat0_get(klev,iso_tmp_lonlev,"XTLANCIEN"//striso_sortie &
    16683      &       (1:lnblnk(striso_sortie)),"QLANCIEN",0.)
    16684       xtl_ancien(ixt,:,:)=iso_tmp_lonlev(:,:)
    16685 
    16686       found=phyetat0_get(klev,iso_tmp_lonlev,"XTSANCIEN"//striso_sortie &
    16687      &       (1:lnblnk(striso_sortie)),"QSANCIEN",0.)
    16688       xts_ancien(ixt,:,:)=iso_tmp_lonlev(:,:)
    16689 
    16690 
    16691       found=phyetat0_get(1,iso_tmp,"XTRUNOFFLIC0"//striso_sortie(1:lnblnk(striso_sortie)), &
    16692      &          "RUNOFFLIC0",0.) 
    16693       xtrun_off_lic_0(ixt,:)=iso_tmp(:)
    16694 
    16695 
    16696       found=phyetat0_get(klev,iso_tmp_lonlev,"WAKE_DELTAXT"//striso_sortie &
    16697      &   (1:lnblnk(striso_sortie)),"Delta hum. wake/env",0.) 
    16698       wake_deltaxt(ixt,:,:)=iso_tmp_lonlev(:,:)
    16699 
    16700 #ifdef ISOVERIF           
    16701       if ((ixt.eq.iso_eau).and.(iso_eau.gt.0)) then
    16702         do i=1,klon
    16703          call iso_verif_egalite(xtrain_fall(iso_eau,i),rain_fall(i), &
    16704      &           'phyisoetat0_fichier 231a')
    16705          call iso_verif_egalite(xtsnow_fall(iso_eau,i),snow_fall(i), &
    16706      &           'phyisoetat0_fichier 231b')
    16707          DO nsrf = 1, nbsrf
    16708          call iso_verif_egalite(fxtevap(iso_eau,i,nsrf),fevap(i,nsrf), &
    16709      &           'phyisoetat0_fichier 231c')
    16710          call iso_verif_egalite(xtsnow(iso_eau,i,nsrf),snow(i,nsrf), &
    16711      &           'phyisoetat0_fichier 231d')
    16712          enddo !DO nsrf = 1, nbsrf
    16713         enddo !do i=1,klon       
    16714       endif !if (iso_eau.gt.0) then 
    16715         if ((iso_HDO.gt.0).and.(ixt.eq.iso_HDO)) then
    16716               do k=1,klev
    16717                do i=1,klon
    16718                 if (q_ancien(i,k).gt.2e-3) then
    16719                 call iso_verif_aberrant(xt_ancien(iso_hdo,i,k) &
    16720      &           /q_ancien(i,k),'phyisoetat0_fichier 312')
    16721                 endif !if (q_ancien(i,k).gt.2e-3) then
    16722                enddo !do i=1,klon
    16723               enddo !do k=1,klev
    16724       endif !if ((iso_HDO.gt.0).and.(ixt.eq.iso_HDO)) then
    16725       if (iso_eau.gt.0) then   
    16726         do i=1,klon
    16727           if (iso_verif_egalite_nostop(run_off_lic_0(i), &
    16728      &           xtrun_off_lic_0(iso_eau,i), &
    16729      &          'phyiso_etat0_fichier 326').eq.1) then
    16730             write(*,*) 'i=',i
    16731             stop
    16732           endif !if (iso_verif_egalite_nostop(run_off_lic_0(i),
    16733         enddo !do i=1,klon
    16734       endif !if (iso_eau.gt.0) then
    16735 #endif
    16736 
    16737        ! ces variables n'ont pas de traceurs:
    16738        if (ixt.le.niso) then
    16739         found=phyetat0_get(1,iso_tmp,"XTSOL"//striso_sortie(1:lnblnk(striso_sortie)), &
    16740      &     "Surface hmidity / bucket",0.) 
    16741         xtsol(ixt,:)=iso_tmp(:)
    16742 
    16743         found=phyetat0_get(1,iso_tmp,"Rland_ice"//striso_sortie &
    16744      &     (1:lnblnk(striso_sortie)),"R land ice",0.)
    16745         Rland_ice(ixt,:)=iso_tmp(:)
    16746 
    16747 #ifdef ISOVERIF
    16748       do i=1,klon
    16749           if (iso_verif_noNaN_nostop(xtsol(ixt,i), &
    16750      &          'phyiso_etat0_fichier 95').eq.1) then
    16751             write(*,*) 'ixt,i=',ixt,i
    16752             stop
    16753           endif       
    16754       enddo !do i=1,klon
    16755 #endif
    16756 
    16757        endif
     16618      END IF ! IF(ixt > niso .OR. initialisation_isotrac == 0))
     16619#endif
     16620
     16621   END DO
    1675816622
    1675916623#ifdef ISOTRAC
    16760      endif !if ((ixt.le.niso).or.(initialisation_isotrac.eq.0)) then
    16761 #endif
    16762 
    16763   enddo !do ixt=1,ntraciso
    16764 
    16765 #ifdef ISOTRAC
    16766         if (initialisation_isotrac.ne.0) then
    16767         ! on n'initialise pas d'après le fichier
    16768         ! l'eau normale est mise dans la zone izone_init
    16769 
    16770         do ixt=niso+1,ntraciso
    16771 
    16772              iiso=index_iso(ixt)
    16773 
    16774              if (index_zone(ixt).eq.izone_init) then
    16775                 do i=1,klon
    16776                  do nsrf = 1, nbsrf
    16777                   fxtevap(ixt,i,nsrf)=fxtevap(iiso,i,nsrf)
    16778                  enddo !do nsrf = 1, nbsrf
    16779                  xtsnow_fall(ixt,i)=xtsnow_fall(iiso,i)
    16780                  xtrain_fall(ixt,i)=xtrain_fall(iiso,i)
    16781                  do k=1,klev
    16782                    xt_ancien(ixt,i,k)=xt_ancien(iiso,i,k)
    16783                    xtl_ancien(ixt,i,k)=xtl_ancien(iiso,i,k)
    16784                    xts_ancien(ixt,i,k)=xts_ancien(iiso,i,k)
    16785                    wake_deltaxt(ixt,i,k)= wake_deltaxt(iiso,i,k)   
    16786                  enddo
    16787                 enddo !do i=1,klon
    16788              else !if (index_zone(ixt).eq.izone_init) then
    16789                 do i=1,klon
    16790                  do nsrf = 1, nbsrf
    16791                   fxtevap(ixt,i,nsrf)=0.0
    16792                  enddo !do nsrf = 1, nbsrf
    16793                  xtsnow_fall(ixt,i)=0.0
    16794                  xtrain_fall(ixt,i)=0.0
    16795                  do k=1,klev
    16796                    xt_ancien(ixt,i,k)=0.0
    16797                    xtl_ancien(ixt,i,k)=0.0
    16798                    xts_ancien(ixt,i,k)=0.0
    16799                  enddo
    16800                 enddo !do i=1,klon
    16801              endif !if (index_zone(ixt).eq.izone_init) then
    16802 
    16803          enddo  !do ixt=1,niso
    16804       endif !if (initialisation_isotrac.eq.0) then
    16805 
    16806 
    16807 #ifdef ISOVERIF
    16808         DO nsrf = 1, nbsrf
    16809          do i=1,klon
    16810                call iso_verif_traceur(fxtevap(1,i,nsrf), &
    16811      &                   'phyiso_etat0_fichier 426')
    16812          enddo !do i=1,klon
    16813         enddo !DO nsrf = 1, nbsrf
    16814         do i=1,klon
    16815            call iso_verif_traceur(xtrain_fall(1,i), &
    16816      &                   'phyiso_etat0_fichier 466')
    16817            call iso_verif_traceur(xtsnow_fall(1,i), &
    16818      &                   'phyiso_etat0_fichier 468')
    16819         enddo !do i=1,klon
    16820         do k=1,klev
    16821           do i=1,klon
    16822                call iso_verif_traceur(xt_ancien(1,i,k), &
    16823      &                   'phyiso_etat0_fichier 591')
    16824           enddo !do i=1,klon
    16825         enddo !do k=1,klev             
     16624   IF(initialisation_isotrac /= 0) THEN
     16625      ! On n'initialise pas d'apres le fichier. L'eau normale est mise dans la zone izone_init
     16626      DO ixt=niso+1,ntraciso
     16627         iiso=index_iso(ixt)
     16628         IF(index_zone(ixt) == izone_init) THEN
     16629            DO i = 1, klon
     16630               fxtevap(ixt,i,1:nbsrf) = fxtevap(iiso,i,1:nbsrf)
     16631               xtsnow_fall(ixt,i) = xtsnow_fall(iiso,i)
     16632               xtrain_fall(ixt,i) = xtrain_fall(iiso,i)
     16633               DO k = 1, klev
     16634                  xt_ancien   (ixt,i,k) = xt_ancien   (iiso,i,k)
     16635                  xtl_ancien  (ixt,i,k) = xtl_ancien  (iiso,i,k)
     16636                  xts_ancien  (ixt,i,k) = xts_ancien  (iiso,i,k)
     16637                  wake_deltaxt(ixt,i,k) = wake_deltaxt(iiso,i,k)   
     16638               END DO
     16639            END DO
     16640         ELSE
     16641            DO i = 1, klon
     16642               fxtevap(ixt,i,1:nbsrf)=0.0
     16643               xtsnow_fall(ixt,i)=0.0
     16644               xtrain_fall(ixt,i)=0.0
     16645               xt_ancien (ixt,i,1:klev) = 0.0
     16646               xtl_ancien(ixt,i,1:klev) = 0.0
     16647               xts_ancien(ixt,i,1:klev) = 0.0
     16648            END DO
     16649         END IF
     16650      END DO
     16651   END IF
     16652
     16653#ifdef ISOVERIF
     16654   DO nsrf = 1, nbsrf
     16655      DO i = 1, klon
     16656         CALL iso_verif_traceur(fxtevap(1,i,nsrf), 'phyiso_etat0_fichier 426')
     16657      END DO
     16658   END DO
     16659   DO i=1,klon
     16660      CALL iso_verif_traceur(xtrain_fall(1,i), 'phyiso_etat0_fichier 466')
     16661      CALL iso_verif_traceur(xtsnow_fall(1,i), 'phyiso_etat0_fichier 468')
     16662   END DO
     16663   DO k = 1, klev
     16664      DO i = 1, klon
     16665         CALL iso_verif_traceur(xt_ancien(1,i,k), 'phyiso_etat0_fichier 591')
     16666      END DO
     16667   END DO
    1682616668#endif
    1682716669        ! endif ISOVERIF       
     
    1682916671        ! endif ISOTRAC     
    1683016672
    16831 ! on ferme le fichier
    16832 !      CALL close_startphy
    16833 ! déjà fermé dans phyetat0
     16673CONTAINS
     16674
     16675LOGICAL FUNCTION phyetat0iso_get2(field, pref, descr, default) RESULT(lFound)
     16676  REAL,             INTENT(INOUT) :: field(:,:)
     16677  CHARACTER(LEN=*), INTENT(IN)    :: pref, descr
     16678  REAL,             INTENT(IN)    :: default
     16679  REAL :: iso_tmp(klon)
     16680  nam(1) = TRIM(pref)//TRIM(outiso)
     16681  nam(2) = TRIM(pref)//TRIM(oldIso)
     16682  lFound = phyetat0_get(iso_tmp, nam, descr, default)
     16683  field(ixt,:) = iso_tmp
     16684END FUNCTION phyetat0iso_get2
     16685
     16686
     16687LOGICAL FUNCTION phyetat0iso_get3(field, pref, descr, default) RESULT(lFound)
     16688  REAL,             INTENT(INOUT) :: field(:,:,:)
     16689  CHARACTER(LEN=*), INTENT(IN)    :: pref, descr
     16690  REAL,             INTENT(IN)    :: default
     16691  REAL :: iso_tmp_lonlev(klon,klev)
     16692  nam(1) = TRIM(pref)//TRIM(outiso)
     16693  nam(2) = TRIM(pref)//TRIM(oldIso)
     16694  lFound = phyetat0_get(iso_tmp_lonlev, nam, descr, default)
     16695  field(ixt,:,:) = iso_tmp_lonlev(:,:)
     16696END FUNCTION phyetat0iso_get3
     16697
     16698LOGICAL FUNCTION phyetat0iso_srf3(field, pref, descr, default) RESULT(lFound)
     16699  REAL,             INTENT(INOUT) :: field(:,:,:)
     16700  CHARACTER(LEN=*), INTENT(IN)    :: pref, descr
     16701  REAL,             INTENT(IN)    :: default
     16702  REAL :: iso_tmp_lonsrf(klon,nbsrf)
     16703  nam(1) = TRIM(pref)//TRIM(outiso)
     16704  nam(2) = TRIM(pref)//TRIM(oldIso)
     16705  lFound = phyetat0_srf(iso_tmp_lonsrf, nam, descr, default)
     16706  field(ixt,:,:) = iso_tmp_lonsrf
     16707END FUNCTION phyetat0iso_srf3
    1683416708
    1683516709        end subroutine phyiso_etat0_fichier
     16710
     16711
    1683616712
    1683716713
     
    1684916725     &           d_xt_decroiss, &
    1685016726     &           xt_seri)
    16851         USE infotrac_phy, only: ntraciso
    1685216727        USE isotopes_mod, only: iso_HTO,ok_prod_nucl_tritium
    1685316728        USE dimphy, only: klon,klev
     
    1837118246!     &                         prod_nucl_HTO)
    1837218247
    18373         USE infotrac_phy, only: ntraciso
    1837418248        use isotopes_mod, only: nessai, lat_nucl, lon_nucl, &
    1837518249&               zmin_nucl, zmax_nucl, HTO_nucl
     
    1859318467     &                                paprs, &
    1859418468     &                                prod_nucl)
    18595         USE infotrac_phy, only: ntraciso
    1859618469        USE isotopes_mod, ONLY: iso_HTO
    1859718470        use geometry_mod, only: cell_area
     
    1873918612     &           tcond,zfice,zxtice,zxtliq)
    1874018613
    18741     USE infotrac_phy, ONLY: ntraciso,niso,index_trac,ntraceurs_zone
    1874218614    USE isotopes_mod, ONLY: iso_eau,iso_HDO,essai_convergence, &
    1874318615&       bidouille_anti_divergence,ridicule
     
    1886918741     &           tcond,zfice,zxtice,zxtliq,n)
    1887018742
    18871     USE infotrac_phy, ONLY: ntraciso,niso,index_trac,ntraceurs_zone
    1887218743    USE isotopes_mod, ONLY: iso_eau,iso_HDO,iso_O18,bidouille_anti_divergence, &
    1887318744&       ridicule
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/isotopes_verif_mod.F90

    r4050 r4446  
    66!use isotopes_mod, ONLY:
    77!#ifdef ISOTRAC
    8 !use isotrac_mod, ONLY:
     8!   USE isotrac_mod, ONLY: nzone
    99!#endif
     10USE infotrac_phy, ONLY: ntraciso=>ntiso, niso, itZonIso, nzone
    1011implicit none
    1112save
     
    9394        SUBROUTINE iso_verif_init()
    9495        use ioipsl_getin_p_mod, ONLY : getin_p
    95         !USE infotrac_phy, ONLY: use_iso
    9696        use isotopes_mod, ONLY: iso_O17, iso_O18, iso_HDO
    9797        implicit none
     
    196196
    197197        subroutine iso_verif_aberrant(R,err_msg)
    198         !USE infotrac_phy, ONLY: use_iso
    199198        use isotopes_mod, ONLY: ridicule, iso_HDO
    200199        implicit none
     
    227226
    228227        subroutine iso_verif_aberrant_encadre(R,err_msg)
    229         !use infotrac_phy, ONLY: use_iso
    230228        use isotopes_mod, ONLY: ridicule, iso_HDO
    231229        implicit none
     
    263261
    264262        subroutine iso_verif_aberrant_choix(xt,q,qmin,deltaDmax,err_msg)
    265         !use infotrac_phy, ONLY: use_iso
    266263        use isotopes_mod, ONLY: iso_HDO
    267264        implicit none
     
    298295
    299296        function iso_verif_aberrant_nostop(R,err_msg)
    300         !use infotrac_phy, ONLY: use_iso
    301297        use isotopes_mod, ONLY: ridicule,iso_HDO
    302298        implicit none
     
    330326
    331327        function iso_verif_aberrant_enc_nostop(R,err_msg)
    332         !use infotrac_phy, ONLY: use_iso
    333328        use isotopes_mod, ONLY: ridicule,iso_HDO
    334329        implicit none
     
    366361     &            qmin,deltaDmax,err_msg)
    367362
    368         !use infotrac_phy, ONLY: use_iso
    369363        use isotopes_mod, ONLY: iso_HDO
    370364        implicit none
     
    428422        function iso_verif_aberrant_enc_choix_nostop(xt,q,   &
    429423     &            qmin,deltaDmax,err_msg)
    430         !use infotrac_phy, ONLY: use_iso
    431424        use isotopes_mod, ONLY: iso_HDO
    432425        implicit none
     
    10651058        ! **********
    10661059        function deltaD(R)
    1067         !use infotrac_phy, ONLY: use_iso
    10681060        USE isotopes_mod, ONLY: tnat,iso_HDO
    10691061        implicit none
     
    10821074        ! **********
    10831075        function deltaO(R)
    1084         !use infotrac_phy, ONLY: use_iso
    10851076        USE isotopes_mod, ONLY: tnat,iso_O18
    10861077        implicit none
     
    10981089        ! **********
    10991090        function dexcess(RD,RO)
    1100         !use infotrac_phy, ONLY: use_iso
    11011091        USE isotopes_mod, ONLY: tnat,iso_O18,iso_HDO
    11021092        implicit none
     
    11381128         ! **********
    11391129        function o17excess(R17,R18)
    1140         !use infotrac_phy, ONLY: use_iso
    11411130        USE isotopes_mod, ONLY: tnat,iso_O18,iso_O17
    11421131        implicit none
     
    11601149     &           xt,q,err_msg,ni,n,m)
    11611150       
    1162         !use infotrac_phy, ONLY: use_iso
    11631151        USE isotopes_mod, ONLY: iso_eau
    11641152          implicit none
     
    12121200     &           xt,q,err_msg,ni,n)
    12131201
    1214         !use infotrac_phy, ONLY: use_iso
    12151202        USE isotopes_mod, ONLY: iso_eau
    12161203        implicit none
     
    12961283        subroutine iso_verif_aberrant_vect2D( &
    12971284     &           xt,q,err_msg,ni,n,m)
    1298         !use infotrac_phy, ONLY: use_iso
    12991285        use isotopes_mod, ONLY: ridicule,tnat,iso_HDO
    13001286          implicit none
     
    13451331     &           xt,q,err_msg,ni,n,m)
    13461332
    1347         !use infotrac_phy, ONLY: use_iso
    13481333        use isotopes_mod, ONLY: ridicule,tnat,iso_HDO
    13491334          implicit none
     
    13991384     &           xt,q,err_msg,ni,n,m)
    14001385
    1401         !use infotrac_phy, ONLY: use_iso
    14021386        use isotopes_mod, ONLY: ridicule,tnat,iso_HDO
    14031387          implicit none
     
    14501434     &           xt,q,err_msg,ni,n,m,deltaDmax)
    14511435
    1452         !use infotrac_phy, ONLY: use_iso
    14531436        use isotopes_mod, ONLY: ridicule,tnat,iso_HDO
    14541437          implicit none
     
    15011484     &           xt,q,err_msg,ni,n,m)
    15021485
    1503         !use infotrac_phy, ONLY: use_iso
    15041486        use isotopes_mod, ONLY: ridicule,tnat,iso_HDO,iso_O18
    15051487          implicit none
     
    17661748     &           xt,q,err_msg,ni,n,m,ib,ie)
    17671749
    1768         !use infotrac_phy, ONLY: use_iso
    17691750        use isotopes_mod, ONLY: ridicule,tnat,iso_HDO
    17701751          implicit none
     
    18171798     &           xt,q,err_msg,ni,n,m,ib,ie)
    18181799       
    1819         !use infotrac_phy, ONLY: use_iso
    18201800        USE isotopes_mod, ONLY: iso_eau
    18211801          implicit none
     
    18631843      function iso_verif_traceur_choix_nostop(x,err_msg, &
    18641844     &       errmax,errmaxrel,ridicule_trac,deltalimtrac)
    1865         USE infotrac_phy, ONLY: ntraciso
    18661845        use isotopes_mod, ONLY: iso_HDO
    18671846        implicit none
     
    19151894        function iso_verif_tracnps_choix_nostop(x,err_msg, &
    19161895     &       errmax,errmaxrel,ridicule_trac,deltalimtrac)
    1917         USE infotrac_phy, ONLY: ntraciso
    19181896        USE isotopes_mod, ONLY: iso_HDO
    19191897        implicit none
     
    19611939
    19621940        function iso_verif_tracpos_choix_nostop(x,err_msg,seuil)
    1963         use infotrac_phy, ONLY: ntraciso,niso
    1964         use isotrac_mod, only: index_iso,strtrac,index_zone
    1965         use isotopes_mod, only: striso
     1941        use isotopes_mod, only: isoName
    19661942        implicit none
    19671943
     
    19821958
    19831959       do ixt=niso+1,ntraciso
    1984           iiso=index_iso(ixt)
    19851960          if (iso_verif_positif_choix_nostop(x(ixt),seuil,err_msg// &
    1986      &           ', verif positif, iso'//striso(iiso) &
    1987      &           //strtrac(index_zone(ixt))).eq.1) then
     1961     &           ', verif positif, iso'//TRIM(isoName(ixt))).eq.1) then
    19881962            iso_verif_tracpos_choix_nostop=1
    19891963          endif
     
    19941968
    19951969        function iso_verif_traceur_noNaN_nostop(x,err_msg)
    1996         use infotrac_phy, ONLY: ntraciso,niso
    1997         use isotrac_mod, only: index_iso
    1998         use isotopes_mod, only: striso
     1970        use isotopes_mod, only: isoName
    19991971        implicit none
    20001972
     
    20151987
    20161988        do ixt=niso+1,ntraciso
    2017           iiso=index_iso(ixt)
    20181989!          write(*,*) 'iso_verif_traceurs 154: iiso,ixt=',iiso,ixt
    20191990          if (iso_verif_noNaN_nostop(x(ixt),err_msg// &
    2020      &           ', verif trac no NaN, iso'//striso(iiso)) &
     1991     &           ', verif trac no NaN, iso'//TRIM(isoName(ixt))) &
    20211992     &           .eq.1) then
    20221993            iso_verif_traceur_noNaN_nostop=1
     
    20292000     &           errmaxin,errmaxrelin)
    20302001
    2031         use infotrac_phy, ONLY: index_trac,ntraciso,niso
    2032         use isotopes_mod, ONLY: ridicule,striso
    2033         use isotrac_mod, only: ntraceurs_zone
     2002        use isotopes_mod, ONLY: ridicule,isoName
    20342003        ! on vérifie juste bilan de masse
    20352004        implicit none
     
    20532022
    20542023          xtractot=0.0
    2055           do izone=1,ntraceurs_zone 
    2056             ixt=index_trac(izone,iiso)
     2024          do izone=1,nzone 
     2025            ixt=itZonIso(izone,iiso)
    20572026            xtractot=xtractot+x(ixt)
    2058           enddo !do izone=1,ntraceurs_zone
     2027          enddo
    20592028
    20602029          if (iso_verif_egalite_choix_nostop(xtractot,x(iiso), &
    2061      &        err_msg//', verif trac egalite, iso '//striso(iiso), &
     2030     &        err_msg//', verif trac egalite, iso '// &
     2031     &        TRIM(isoName(iiso)), &
    20622032     &        errmaxin,errmaxrelin).eq.1) then
    20632033            write(*,*) 'iso_verif_traceur 202: x=',x
     
    20702040     &           (abs(x(iiso)).gt.ridicule)) then
    20712041            write(*,*) err_msg,', verif masse traceurs, iso ', &
    2072      &          striso(iiso)
     2042     &          TRIM(isoName(iiso))
    20732043            write(*,*) 'iso_verif_traceur 209: x=',x
    20742044!            iso_verif_tracm_choix_nostop=1
     
    20822052     &           ridicule_trac,deltalimtrac)
    20832053
    2084         use infotrac_phy, ONLY: index_trac,ntraciso
    20852054        USE isotopes_mod, ONLY: iso_eau, iso_HDO
    2086         use isotrac_mod, only: strtrac,ntraceurs_zone
     2055        use isotrac_mod, only: strtrac
    20872056        ! on vérifie juste deltaD
    20882057        implicit none
     
    21032072
    21042073        if ((iso_eau.gt.0).and.(iso_HDO.gt.0)) then
    2105         do izone=1,ntraceurs_zone
    2106              ieau=index_trac(izone,iso_eau)
    2107              ixt=index_trac(izone,iso_HDO)
     2074        do izone=1,nzone
     2075             ieau=itZonIso(izone,iso_eau)
     2076             ixt=itZonIso(izone,iso_HDO)
    21082077
    21092078             if (iso_verif_aberrant_choix_nostop(x(ixt),x(ieau), &
     
    21182087!     :           //strtrac(izone))
    21192088!             endif
    2120         enddo !do izone=1,ntraceurs_zone
     2089        enddo !do izone=1,nzone
    21212090       endif ! if ((iso_eau.gt.0).and.(iso_HDO.gt.0)) then
    21222091
     
    21242093
    21252094INTEGER FUNCTION iso_verif_tag17_q_deltaD_chns(x,err_msg) RESULT(res)
    2126   USE infotrac_phy, ONLY: index_trac, ntraciso
    21272095  USE isotopes_mod, ONLY: iso_HDO, iso_eau, ridicule
    21282096  USE isotrac_mod,  ONLY: nzone_temp, option_traceurs
     
    21352103  !--- Check whether * deltaD(highest tagging layer) < 200 permil
    21362104  !                  * q <
    2137   ieau=index_trac(nzone_temp,iso_eau)
    2138   ixt=index_trac(nzone_temp,iso_HDO)
     2105  ieau=itZonIso(nzone_temp,iso_eau)
     2106  ixt=itZonIso(nzone_temp,iso_HDO)
    21392107  IF(x(ieau)>ridicule) THEN
    21402108    IF(iso_verif_positif_nostop(-200.0-deltaD(x(ixt)/x(ieau)), err_msg//': deltaDt05 trop fort')==1) THEN
     
    21472115  !--- Check whether q is small ; then, qt01 < 10%
    21482116  IF(x(iso_eau)<2.0e-3) THEN
    2149     ieau1= index_trac(1,iso_eau)
     2117    ieau1= itZonIso(1,iso_eau)
    21502118    IF(iso_verif_positif_nostop(0.1-(x(ieau1)/x(iso_eau)),err_msg//': qt01 trop abondant')==1) THEN
    21512119      res=1; write(*,*) 'x=',x
     
    21562124SUBROUTINE iso_verif_trac17_q_deltaD(x,err_msg)
    21572125  USE isotrac_mod,  ONLY: nzone_temp, option_traceurs
    2158   USE infotrac_phy, ONLY: ntraciso
    21592126  IMPLICIT NONE
    21602127  REAL,             INTENT(IN) :: x(ntraciso)
     
    21672134
    21682135      subroutine iso_verif_traceur(x,err_msg)
    2169         USE infotrac_phy, ONLY: ntraciso
    21702136        use isotrac_mod, only: ridicule_trac
    21712137        implicit none
     
    21952161      subroutine iso_verif_traceur_retourne3D(x,n1,n2,n3, &
    21962162     &           i1,i2,i3,err_msg)
    2197         USE infotrac_phy, ONLY: ntraciso
    21982163        use isotrac_mod, only: ridicule_trac
    21992164
     
    22282193        subroutine iso_verif_traceur_retourne4D(x,n1,n2,n3,n4, &
    22292194     &           i1,i2,i3,i4,err_msg)
    2230         USE infotrac_phy, ONLY: ntraciso
    22312195        use isotrac_mod, only: ridicule_trac
    22322196
     
    22622226      subroutine iso_verif_traceur_retourne2D(x,n1,n2, &
    22632227     &           i1,i2,err_msg)
    2264         USE infotrac_phy, ONLY: ntraciso
    22652228        use isotrac_mod, only: ridicule_trac
    22662229        implicit none
     
    22932256
    22942257        subroutine iso_verif_traceur_vect(x,n,m,err_msg)
    2295         USE infotrac_phy, ONLY: ntraciso
    22962258        USE isotopes_mod, ONLY: iso_HDO
    22972259        implicit none
     
    23292291
    23302292        subroutine iso_verif_tracnps_vect(x,n,m,err_msg)
    2331         USE infotrac_phy, ONLY: ntraciso
    23322293        USE isotopes_mod, ONLY: iso_HDO
    23332294        implicit none
     
    23632324
    23642325        subroutine iso_verif_traceur_noNaN_vect(x,n,m,err_msg)
    2365         USE infotrac_phy, ONLY: ntraciso,niso
    23662326        implicit none
    23672327       
     
    24072367        subroutine iso_verif_trac_masse_vect(x,n,m,err_msg, &
    24082368     &            errmax,errmaxrel)
    2409         USE infotrac_phy, ONLY: index_trac,ntraciso,niso
    2410         use isotopes_mod, only: striso
    2411         use isotrac_mod, only: ntraceurs_zone
     2369        use isotopes_mod, only: isoName
    24122370        implicit none
    24132371       
     
    24302388          xtractot(i,j)=0.0
    24312389          xiiso(i,j)=x(iiso,i,j)
    2432           do izone=1,ntraceurs_zone 
    2433             ixt=index_trac(izone,iiso)
     2390          do izone=1,nzone
     2391            ixt=itZonIso(izone,iiso)
    24342392            xtractot(i,j)=xtractot(i,j)+x(ixt,i,j)           
    2435           enddo !do izone=1,ntraceurs_zone
     2393          enddo !do izone=1,nzone
    24362394         enddo !do i=1,n
    24372395        enddo !do j=1,m
     
    24402398        call iso_verif_egalite_std_vect( &
    24412399     &           xtractot,xiiso, &
    2442      &           err_msg//', verif trac egalite, iso '//striso(iiso), &
     2400     &           err_msg//', verif trac egalite, iso ' &
     2401     &           //TRIM(isoName(iiso)), &
    24432402     &           n,m,errmax,errmaxrel)
    24442403        enddo !do iiso=1,niso
     
    24472406
    24482407        subroutine iso_verif_tracdd_vect(x,n,m,err_msg)
    2449         use infotrac_phy, only: index_trac,ntraciso,niso
    24502408        use isotopes_mod, only: iso_HDO,iso_eau
    2451         use isotrac_mod, only: strtrac,ntraceurs_zone
     2409        use isotrac_mod, only: strtrac
    24522410        implicit none
    24532411       
     
    24642422
    24652423       if (iso_HDO.gt.0) then
    2466         do izone=1,ntraceurs_zone
    2467           ieau=index_trac(izone,iso_eau)
     2424        do izone=1,nzone
     2425          ieau=itZonIso(izone,iso_eau)
    24682426          do iiso=1,niso
    2469            ixt=index_trac(izone,iiso)
     2427           ixt=itZonIso(izone,iiso)
    24702428           do j=1,m
    24712429            do i=1,n
     
    24842442     &           xiiso,xeau,err_msg//strtrac(izone),niso,n,m, &
    24852443     &           deltalimtrac)
    2486          enddo !do izone=1,ntraceurs_zone
     2444         enddo !do izone=1,nzone
    24872445        endif !if (iso_HDO.gt.0) then
    24882446
     
    24902448
    24912449        subroutine iso_verif_tracpos_vect(x,n,m,err_msg,seuil)
    2492         USE infotrac_phy, ONLY: ntraciso,niso
    24932450        implicit none
    24942451
     
    25322489
    25332490        subroutine iso_verif_tracnps(x,err_msg)
    2534         USE infotrac_phy, ONLY: ntraciso
    25352491        use isotrac_mod, only: ridicule_trac
    25362492
     
    25592515
    25602516        subroutine iso_verif_tracpos_choix(x,err_msg,seuil)
    2561         USE infotrac_phy, ONLY: ntraciso
    25622517        implicit none
    25632518        ! vérifier des choses sur les traceurs
     
    25852540        subroutine iso_verif_traceur_choix(x,err_msg, &
    25862541     &       errmax,errmaxrel,ridicule_trac_loc,deltalimtrac)
    2587         USE infotrac_phy, ONLY: ntraciso
    25882542        implicit none
    25892543        ! vérifier des choses sur les traceurs
     
    26082562
    26092563        function iso_verif_traceur_nostop(x,err_msg)
    2610         USE infotrac_phy, ONLY: ntraciso
    26112564        use isotrac_mod, only: ridicule_trac
    26122565        !use isotopes_verif, only: errmax,errmaxrel,deltalimtrac
     
    26372590
    26382591      subroutine iso_verif_traceur_justmass(x,err_msg)
    2639         USE infotrac_phy, ONLY: ntraciso
    26402592        implicit none
    26412593        ! on vérifie que noNaN et masse
     
    26662618
    26672619        function iso_verif_traceur_jm_nostop(x,err_msg)
    2668         USE infotrac_phy, ONLY: ntraciso
    26692620        implicit none
    26702621        ! on vérifie que noNaN et masse
     
    26992650
    27002651        subroutine iso_verif_tag17_q_deltaD_vect(x,n,m,err_msg)
    2701         USE infotrac_phy, ONLY: index_trac,ntraciso
    27022652        USE isotopes_mod, ONLY: tnat,iso_eau, ridicule,iso_HDO
    27032653        use isotrac_mod, only: option_traceurs,nzone_temp
     
    27192669        ! verifier que deltaD du tag de la couche la plus haute <
    27202670        ! 200 permil, et vérifier que son q est inférieur à
    2721         ieau=index_trac(nzone_temp,iso_eau)
    2722         ixt=index_trac(nzone_temp,iso_HDO)
    2723         ieau1=index_trac(1,iso_eau)
     2671        ieau=itZonIso(nzone_temp,iso_eau)
     2672        ixt=itZonIso(nzone_temp,iso_HDO)
     2673        ieau1=itZonIso(1,iso_eau)
    27242674        do i=1,n
    27252675         do k=1,m
     
    27592709
    27602710        subroutine iso_verif_tag17_q_deltaD_vect_ret3D(x,n,m,nq,err_msg)
    2761         USE infotrac_phy, ONLY: index_trac,ntraciso
    27622711        USE isotopes_mod, ONLY: tnat,iso_eau,iso_HDO,ridicule
    27632712        use isotrac_mod, only: option_traceurs,nzone_temp
     
    27792728        ! verifier que deltaD du tag de la couche la plus haute <
    27802729        ! 200 permil, et vérifier que son q est inférieur à
    2781         ieau=index_trac(nzone_temp,iso_eau)
    2782         ixt=index_trac(nzone_temp,iso_HDO)
    2783         ieau1=index_trac(1,iso_eau)
     2730        ieau=itZonIso(nzone_temp,iso_eau)
     2731        ixt=itZonIso(nzone_temp,iso_HDO)
     2732        ieau1=itZonIso(1,iso_eau)
    27842733        do iq=1,nq
    27852734        do i=1,n
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/isotrac_mod.F90

    r3927 r4446  
    11#ifdef ISO
    22#ifdef ISOTRAC
    3 ! $Id: $
    43
    54MODULE isotrac_mod
    6 use infotrac_phy, ONLY: niso,ntraciso,ntraceurs_zone
    7 use isotopes_mod, only: ridicule
    8 
    9 IMPLICIT NONE
    10 SAVE
    11 
    12 ! contient toutes les variables traceurs isotopiques + les routines specifiquement
    13 ! traceurs isotopiques
    14 
    15       real ridicule_trac
    16       parameter (ridicule_trac=ridicule*1e4)
    17 
    18 integer, save ::  option_traceurs
    19 integer, save ::  ntraceurs_zone_opt ! ntraceurs_zone propre à l'option
    20 ! on vérifie que ça correspond bien à ntraceurs_zone d'infotrac
    21 integer, save ::  ntraceurs_zoneOR
    22 !$OMP THREADPRIVATE(option_traceurs,ntraceurs_zone_opt,ntraceurs_zoneOR)
    23 integer, save ::  initialisation_isotrac
    24                 ! 1 pour idéalisé
    25                 ! 0 pour lecture dans fichier
    26 !$OMP THREADPRIVATE(initialisation_isotrac)
    27 
    28 ! variables spécifiques aux différentes options, mais necessaires au
    29 ! calcul du nombre de zones de traceurs
    30 ! si option=3
    31 integer, save :: use_bassin_atlantic
    32 !$OMP THREADPRIVATE(use_bassin_atlantic)
    33 integer, save :: use_bassin_medit
    34 !$OMP THREADPRIVATE(use_bassin_medit)
    35 integer, save :: use_bassin_indian
    36 !$OMP THREADPRIVATE(use_bassin_indian)
    37 integer, save :: use_bassin_austral
    38 !$OMP THREADPRIVATE(use_bassin_austral)
    39 integer, save :: use_bassin_pacific
    40 !$OMP THREADPRIVATE(use_bassin_pacific)
    41 integer, save :: use_bassin_merarabie
    42 !$OMP THREADPRIVATE(use_bassin_merarabie)
    43 integer, save :: use_bassin_golfebengale
    44 !$OMP THREADPRIVATE(use_bassin_golfebengale)
    45 integer, save :: use_bassin_indiansud
    46 !$OMP THREADPRIVATE(use_bassin_indiansud)
    47 integer, save :: use_bassin_tropics
    48 !$OMP THREADPRIVATE(use_bassin_tropics)
    49 integer, save :: use_bassin_midlats
    50 !$OMP THREADPRIVATE(use_bassin_midlats)
    51 integer, save :: use_bassin_hauteslats
    52 !$OMP THREADPRIVATE(use_bassin_hauteslats)
    53 integer, save :: bassin_atlantic
    54 !$OMP THREADPRIVATE(bassin_atlantic)
    55 integer, save :: bassin_medit
    56 !$OMP THREADPRIVATE(bassin_medit)
    57 integer, save :: bassin_indian
    58 !$OMP THREADPRIVATE(bassin_indian)
    59 integer, save :: bassin_austral
    60 !$OMP THREADPRIVATE(bassin_austral)
    61 integer, save :: bassin_pacific
    62 !$OMP THREADPRIVATE(bassin_pacific)
    63 integer, save :: bassin_merarabie
    64 !$OMP THREADPRIVATE(bassin_merarabie)
    65 integer, save :: bassin_golfebengale
    66 !$OMP THREADPRIVATE(bassin_golfebengale)
    67 integer, save :: bassin_indiansud
    68 !$OMP THREADPRIVATE(bassin_indiansud)
    69 integer, save :: bassin_tropics
    70 !$OMP THREADPRIVATE(bassin_tropics)
    71 integer, save :: bassin_midlats
    72 !$OMP THREADPRIVATE(bassin_midlats)
    73 integer, save :: bassin_hauteslats
    74 !$OMP THREADPRIVATE(bassin_hauteslats)
    75 ! si option=4
    76 integer nzone_temp
    77 parameter (nzone_temp=1)
    78 real, save :: zone_temp1,zone_tempf,zone_tempa 
    79 !$OMP THREADPRIVATE(zone_temp1,zone_tempf,zone_tempa)
    80 ! si option 14
    81 integer nzone_lat
    82 parameter (nzone_lat=4)
    83 integer nzone_pres
    84 parameter (nzone_pres=3)
    85 real, save :: zone_pres1,zone_presf,zone_presa
    86 !$OMP THREADPRIVATE(zone_pres1,zone_presf,zone_presa)
    87 real, save :: dlattag,lattag_min
    88 !$OMP THREADPRIVATE(dlattag,lattag_min)
    89 
    90 
    91 ! option 1: on trace evap ocean et continent séparement 
     5  USE infotrac_phy,      ONLY: niso, ntiso, nzone
     6  USE readTracFiles_mod, ONLY: delPhase
     7  USE isotopes_mod,      ONLY: ridicule, get_in
     8
     9  IMPLICIT NONE
     10  SAVE
     11
     12!=== CONTENT: ALL THE ISOTOPIC TRACERS RELATED VARIABLES ===
     13!
     14! option 1: on trace evap ocean et continent separement 
    9215! option 2: on trace evap ocean, continent et evap precip
    93 ! option 3: on trace evap différents bassins océaniques
    94 !       + continents + résidu
    95 !       attention, choisir dans ce cas les bassins océaniques
     16! option 3: on trace evap differents bassins oceaniques
     17!       + continents + residu
     18!       attention, choisir dans ce cas les bassins oceaniques
    9619!       dans iso_traceurs_opt3F90.h
    97 ! option 4: tracage par température minimale
    98 !       dans ce cas, on définit des bins dans iso_traceurs_opt4.h
    99 ! option 5: pour AMMA: on taggue résidu/AEJ/flux mousson/Harmattan
     20! option 4: tracage par temperature minimale
     21!       dans ce cas, on definit des bins dans iso_traceurs_opt4.h
     22! option 5: pour AMMA: on taggue residu/AEJ/flux mousson/Harmattan
    10023! option 6: taggage des ddfts
    101 ! option 7: pour Sandrine: taggage de la vapeur à 700hPa pour omega500<-20 TODO
    102 ! option 8: pour Sandrine: taggage de la vapeur entre 950 et 800hPa, omega de 0 à 25 hPa et de l'évaoration en omega<-20. TODO
     24! option 7: pour Sandrine: taggage de la vapeur a 700hPa pour omega500<-20 TODO
     25! option 8: pour Sandrine: taggage de la vapeur entre 950 et 800hPa, omega de 0 a 25 hPa et de l'evaoration en omega<-20. TODO
    10326! option 9: taggage du condensat et de la revap precip
    10427! option 10: taggage evap oce, transpiration et evaporation
     
    10730! option 12: taggage evap oce, sol nu, canop et reste evap cont.
    10831! A utiliser quand on couple avec ORCHIDEE
    109 ! option 13: taggage température minimale + revap precip
    110 ! option 14: taggage lat et altitude de dernière saturation (niveaux de pression) + evap surf
     32! option 13: taggage temperature minimale + revap precip
     33! option 14: taggage lat et altitude de derniere saturation (niveaux de pression) + evap surf
    11134! otion 15: taggage irrigation
    11235! option 16: taggage precip selon saisons et fonte neige: seulement pour ORCHIDEE
    113 ! option 17: taggage température minimum de condensation directement dans la convection et la cond LS, + evap sfc, condensat et precipitation
     36! option 17: taggage temperature minimum de condensation directement dans la convection et la cond LS, + evap sfc, condensat et precipitation
    11437! option 18: idem 17 mais on tague qsmin au lieu de Tmin
    11538! option 19: on tag vap residuelle, vap residuelle dans ddfts, sfc, cond, rev
    11639! option 20: on taggue vapeur tropicale vs vapeur extratropicale
    11740! option 21: taggage de 2 boites 3D: extratropiques (>35°) et UT tropicale (15-15°, > 500hPa)
    118 ! option 22: tagage de la vapeur proccessée dans les zones très convectives
     41! option 22: tagage de la vapeur proccessee dans les zones tres convectives
    11942               
    120         ! ces variables sont initialisées dans traceurs_init
     43   !--- nzone_opt (value of nzone for the selected option) must be equal to nzone as defined in onfotrac
     44   REAL, PARAMETER :: ridicule_trac = ridicule * 1e4
     45   INTEGER, SAVE :: option_traceurs, nzone_opt, nzoneOR
     46!$OMP THREADPRIVATE(option_traceurs,nzone_opt,nzoneOR)
     47   INTEGER, SAVE :: initialisation_isotrac
     48!$OMP THREADPRIVATE(initialisation_isotrac)     
     49                ! 1 pour idealise
     50                ! 0 pour lecture dans fichier
     51
     52   !=== VARIABLES SPECIFIC TO THE SELECTED OPTION, BUT NEEDED FOR THE COMPUTATION OF THE NUMBER OF ZONES ; TO BE INITIALIZED IN traceurs_init
     53
     54   !--- option 3
     55   LOGICAL, SAVE :: use_bassin_Austral, use_bassin_Atlantic, use_bassin_MidLats, use_bassin_SouthIndian, use_bassin_MerArabie
     56!$OMP THREADPRIVATE(use_bassin_Austral, use_bassin_Atlantic, use_bassin_MidLats, use_bassin_SouthIndian, use_bassin_MerArabie)
     57   INTEGER, SAVE ::     bassin_Austral,     bassin_Atlantic,     bassin_MidLats,     bassin_SouthIndian,     bassin_MerArabie
     58!$OMP THREADPRIVATE(    bassin_Austral,     bassin_Atlantic,     bassin_MidLats,     bassin_SouthIndian,     bassin_MerArabie)
     59   LOGICAL, SAVE :: use_bassin_Pacific, use_bassin_Indian,   use_bassin_Tropics, use_bassin_BengalGolf,  use_bassin_HighLats, use_bassin_Medit
     60!$OMP THREADPRIVATE(use_bassin_Pacific, use_bassin_Indian,   use_bassin_Tropics, use_bassin_BengalGolf,  use_bassin_HighLats, use_bassin_Medit)
     61   INTEGER, SAVE ::     bassin_Pacific,     bassin_Indian,       bassin_Tropics,     bassin_BengalGolf,      bassin_HighLats,     bassin_Medit
     62!$OMP THREADPRIVATE(    bassin_Pacific,     bassin_Indian,       bassin_Tropics,     bassin_BengalGolf,      bassin_HighLats,     bassin_Medit)
     63
     64   !--- option 4
     65   INTEGER, PARAMETER :: nzone_temp = 1
     66   REAL,   SAVE ::  zone_temp1, zone_tempf, zone_tempa 
     67!$OMP THREADPRIVATE(zone_temp1, zone_tempf, zone_tempa)
     68   REAL,   SAVE ::  zone_temp(nzone_temp-1)
     69!$OMP THREADPRIVATE(zone_temp)
     70
     71   !--- option 5
     72   INTEGER, SAVE :: izone_aej, izone_harmattan, izone_mousson
     73!$OMP THREADPRIVATE(izone_aej, izone_harmattan, izone_mousson)
     74
     75   !--- option 6
     76   INTEGER, SAVE :: izone_ddft
     77!$OMP THREADPRIVATE(izone_ddft)
     78
     79   !--- option 10
     80   INTEGER, SAVE :: izone_contfrac
     81!$OMP THREADPRIVATE(izone_contfrac)
     82
     83   !--- option 12       
     84   INTEGER, SAVE :: izone_contcanop
     85!$OMP THREADPRIVATE(izone_contcanop)
     86
     87   !--- option 13
     88   INTEGER, PARAMETER :: nzone_pres = 3
     89   REAL, SAVE ::  zone_pres(nzone_pres-1)
     90!$OMP THREADPRIVATE(zone_pres)
     91
     92   !--- option 14
     93   INTEGER, PARAMETER :: nzone_lat = 4
     94   REAL,    SAVE :: zone_pres1, zone_presf, zone_presa
     95!$OMP THREADPRIVATE(zone_pres1, zone_presf, zone_presa)
     96   REAL,    SAVE :: dlattag, lattag_min, zone_lat(nzone_lat-1)
     97!$OMP THREADPRIVATE(dlattag, lattag_min, zone_lat)
     98
     99   !--- option 15
     100   INTEGER, SAVE :: izone_irrig
     101!$OMP THREADPRIVATE(izone_irrig)
     102
     103   !--- option 17
     104   REAL,    SAVE :: seuil_tag_tmin, seuil_tag_tmin_ls
     105!$OMP THREADPRIVATE(seuil_tag_tmin, seuil_tag_tmin_ls)
     106  INTEGER,  SAVE :: option_seuil_tag_tmin
     107!$OMP THREADPRIVATE(option_seuil_tag_tmin)
     108
     109   !--- option 20
     110   INTEGER, SAVE :: izone_trop, izone_extra
     111!$OMP THREADPRIVATE(izone_trop, izone_extra)
     112   REAL,    SAVE :: lim_tag20
     113!$OMP THREADPRIVATE(lim_tag20)
     114
     115   !--- option 21: on garde izone_trop, izone_extra 
     116
     117   !--- option 22
     118   INTEGER, SAVE :: izone_conv_BT, izone_conv_UT
     119!$OMP THREADPRIVATE(izone_conv_BT, izone_conv_UT)
     120   REAL,    SAVE :: lim_precip_tag22
     121!$OMP THREADPRIVATE(lim_precip_tag22)
     122
    121123       
    122 !integer ntraciso
    123 !parameter (ntraciso=(ntraceurs_zone+1)*niso)
    124 !integer ntracisoOR ! défini dans traceurs_init
    125 integer, ALLOCATABLE, DIMENSION(:), save :: index_iso
    126 !$OMP THREADPRIVATE(index_iso)
    127 integer, ALLOCATABLE, DIMENSION(:), save ::  index_zone
    128 !$OMP THREADPRIVATE(index_zone)
    129 integer, ALLOCATABLE, DIMENSION(:,:), save ::  index_trac_loc ! il y a déjà un index_trac dans infotrac: vérifier que c'est le même
    130 !$OMP THREADPRIVATE(index_trac_loc)
    131 character*3, ALLOCATABLE, DIMENSION(:), save :: strtrac
    132 !$OMP THREADPRIVATE(strtrac)
    133 ! -> tout ça passe maintenant par infotrac
    134 
    135 integer, ALLOCATABLE, DIMENSION(:), save :: bassin_map
    136 integer, ALLOCATABLE, DIMENSION(:,:), save :: boite_map
    137 !$OMP THREADPRIVATE(bassin_map,boite_map)
    138 
    139 
    140         ! traitement recyclage et evap
    141 integer, save :: izone_cont ! pour le recyclage continental
    142 !$OMP THREADPRIVATE(izone_cont)
    143 integer, save :: izone_oce ! pour l'océan
    144 !$OMP THREADPRIVATE(izone_oce)
    145 integer, save :: izone_poubelle ! pour les petits résidus numériques
     124  INTEGER, ALLOCATABLE, SAVE :: index_iso(:), index_zone(:), itZonIso_loc(:,:)
     125!$OMP THREADPRIVATE(            index_iso,    index_zone,    itZonIso_loc)
     126  CHARACTER(LEN=3), ALLOCATABLE :: strtrac(:)
     127!$OMP THREADPRIVATE(               strtrac)
     128  INTEGER, ALLOCATABLE, SAVE :: bassin_map(:), boite_map(:,:)
     129!$OMP THREADPRIVATE(            bassin_map,    boite_map)
     130
     131   !=== RECYCLING AND EVAPORATION TREATMENT
     132   INTEGER, SAVE :: izone_cont, izone_oce        !--- For land and ocean recycling
     133!$OMP THREADPRIVATE(izone_cont, izone_oce)
     134   INTEGER, SAVE :: izone_poubelle               !--- For small numerical residues
    146135!$OMP THREADPRIVATE(izone_poubelle)
    147 integer, save :: izone_init ! pour l'initialisation par défaut
     136   INTEGER, SAVE :: izone_init                   !--- For default initialization
    148137!$OMP THREADPRIVATE(izone_init)
    149 integer, save :: izone_revap ! pour l'évap des gouttes
     138   INTEGER, SAVE :: izone_revap                  !--- For droplets evaporation
    150139!$OMP THREADPRIVATE(izone_revap)
    151 integer, save :: option_revap
    152 !$OMP THREADPRIVATE(option_revap)
    153 integer, save :: option_tmin
    154 !$OMP THREADPRIVATE(option_tmin)
    155 integer, save :: option_cond
    156 !$OMP THREADPRIVATE(option_cond)
    157 integer, save :: izone_cond
    158 !$OMP THREADPRIVATE(izone_cond)
    159 real evap_franche
    160 parameter (evap_franche=1e-6) ! en kg/m2/s
    161 
    162 ! specifique à option 4:
    163 real, save ::  zone_temp(nzone_temp-1)
    164 !$OMP THREADPRIVATE(zone_temp)
    165 ! si option 5
    166 integer, save :: izone_aej
    167 !$OMP THREADPRIVATE(izone_aej)
    168 integer, save :: izone_harmattan
    169 !$OMP THREADPRIVATE(izone_harmattan)
    170 integer, save :: izone_mousson
    171 !$OMP THREADPRIVATE(izone_mousson)
    172 ! si option 6
    173 integer, save :: izone_ddft
    174 !$OMP THREADPRIVATE(izone_ddft)
    175 ! si option 10
    176 integer, save :: izone_contfrac
    177 !$OMP THREADPRIVATE(izone_contfrac)
    178 ! si option 12 
    179 integer, save :: izone_contcanop
    180 !$OMP THREADPRIVATE(izone_contcanop)
    181 ! specifique à option 13:
    182 real, save ::  zone_pres(nzone_pres-1)
    183 !$OMP THREADPRIVATE(zone_pres)
    184 ! si option 14
    185 real, save ::  zone_lat(nzone_lat-1)
    186 !$OMP THREADPRIVATE(zone_lat)
    187 ! si option 15
    188 integer, save :: izone_irrig
    189 !$OMP THREADPRIVATE(izone_irrig)
    190 ! si option 17
    191 real, save ::  seuil_tag_tmin
    192 !$OMP THREADPRIVATE(seuil_tag_tmin)
    193 real, save ::  seuil_tag_tmin_ls
    194 !$OMP THREADPRIVATE(seuil_tag_tmin_ls)
    195 integer, save :: option_seuil_tag_tmin
    196 !$OMP THREADPRIVATE(option_seuil_tag_tmin)
    197 ! si option 20
    198 integer, save :: izone_trop,izone_extra
    199 real, save ::  lim_tag20
    200 !$OMP THREADPRIVATE(izone_trop,izone_extra,lim_tag20)
    201 ! si option 21: on garde izone_trop,izone_extra 
    202 ! si opt 22
    203 integer, save :: izone_conv_BT,izone_conv_UT
    204 real, save ::  lim_precip_tag22
    205 !$OMP THREADPRIVATE(izone_conv_BT,izone_conv_UT,lim_precip_tag22)
    206 
     140   INTEGER, SAVE :: option_revap, option_tmin, option_cond, izone_cond
     141!$OMP THREADPRIVATE(option_revap, option_tmin, option_cond, izone_cond)
     142   REAL, PARAMETER :: evap_franche = 1e-6        !--- In kg/m2/s
    207143
    208144CONTAINS
    209145
    210       subroutine iso_traceurs_init()
    211 
    212       use IOIPSL ! getin
    213       USE infotrac_phy, ONLY: ntraciso,niso,ntraceurs_zone,index_trac
    214       USE isotopes_mod, ONLY: iso_eau,ntracisoOR,initialisation_iso, &
    215 &               iso_eau_possible
    216       USE dimphy, only: klon,klev
    217 
    218         implicit none
    219 
    220 
    221         ! définition de quelles zones et quelles isotopes représentent
    222         ! les traceurs
    223 
    224         ! inputs, outputs
    225         ! ! c'est les variables dans traceurs.h qui sont modifiées
    226 
    227         ! locals
    228         integer itrac,izone,ixt,k
    229         integer izone_pres,izone_lat
    230         character*2 strz,strz_preslat
    231         character*1 strz_pres,strz_lat
    232         integer ntraceurs_zone_opt
    233 
    234         ! vérifier que on a bien l'eau comme traceurs
    235         if (iso_eau.eq.0) then
    236             write(*,*) 'traceurs_init 18: isotrac ne marche que si ', &
    237      &            'on met l''eau comme isotope'
    238             stop
    239         endif
    240 
    241         ! initialiser
    242         option_traceurs=0
    243         initialisation_isotrac=0
    244 
    245         ! allouer
    246         allocate (index_iso(ntraciso))
    247         allocate (index_zone(ntraciso))
    248         allocate (index_trac_loc(ntraceurs_zone,niso))
    249         allocate (strtrac(ntraceurs_zone))
    250         allocate (bassin_map(klon))
    251         allocate (boite_map(klon,klev))
    252 
    253         if (initialisation_iso.eq.0) then
    254           call getin('initialisation_isotrac',initialisation_isotrac)
    255           write(*,*) 'initialisation_isotrac=',initialisation_isotrac
    256         endif !if (initialisation_iso.eq.0) then
    257 
    258         ! lire l'option de traçage
    259         call getin('option_traceurs',option_traceurs)
    260         write(*,*) 'option_traceurs=',option_traceurs
    261 
    262         ! cas général: pas de traceurs dans ORCHIDEE
    263         ntracisoOR=niso
    264 
    265         ! partie à éditer ! pour définir les différentes zones
    266         if (option_traceurs.eq.1) then
    267           ! on trace continents/ocean 
    268 
    269           ntraceurs_zone_opt=2
    270           izone_cont=1
    271           izone_oce=2         
    272           izone_poubelle=2 ! zone où on met les flux non physiques, de
    273                 ! réajustement
    274           izone_init=2 ! zone d'initialisation par défaut         
    275           option_revap=0
    276           option_tmin=0
    277           izone_revap=0
    278           option_cond=0
    279 
    280           strtrac(izone_cont)='con'
    281           strtrac(izone_oce)='oce'
    282 
    283         elseif (option_traceurs.eq.2) then
    284           ! on trace continent/ ocean/reevap des gouttes
    285 
    286           ntraceurs_zone_opt=3
    287           izone_cont=1
    288           izone_oce=2
    289           izone_poubelle=2 ! zone où on met les flux non physiques, de
    290                 ! réajustement
    291           izone_init=2 ! zone d'initialisation par défaut
    292           option_revap=1
    293           option_tmin=0
    294           izone_revap=3
    295           option_cond=0
    296 
    297           strtrac(izone_cont)='con'
    298           strtrac(izone_oce)='oce'
    299           strtrac(izone_revap)='rev'
    300          
    301 
    302         else if (option_traceurs.eq.3) then
    303             ! on trace des bassins océaniques + un résidu. On ne trace
    304             ! pas l'évap des gouttes à part
    305             ! le résidu est la dernère dimension
    306            
    307           ! lire les use_bassin
    308           call getin('use_bassin_atlantic',use_bassin_atlantic)     
    309           call getin('use_bassin_medit',use_bassin_medit)     
    310           call getin('use_bassin_indian',use_bassin_indian)     
    311           call getin('use_bassin_austral',use_bassin_austral)     
    312           call getin('use_bassin_pacific',use_bassin_pacific)     
    313           call getin('use_bassin_merarabie',use_bassin_merarabie)     
    314           call getin('use_bassin_golfebengale',use_bassin_golfebengale)     
    315           call getin('use_bassin_indiansud',use_bassin_indiansud)     
    316           call getin('use_bassin_tropics',use_bassin_tropics)     
    317           call getin('use_bassin_midlats',use_bassin_midlats)     
    318           call getin('use_bassin_hauteslats',use_bassin_hauteslats)
    319 
    320           write(*,*) 'use_bassin_atlantic=' ,use_bassin_atlantic 
    321           write(*,*) 'use_bassin_medit=' ,use_bassin_medit
    322           write(*,*) 'use_bassin_indian=' ,use_bassin_indian
    323           write(*,*) 'use_bassin_austral=' ,use_bassin_austral
    324           write(*,*) 'use_bassin_merarabie=' ,use_bassin_merarabie
    325           write(*,*) 'use_bassin_golfebengale=' ,use_bassin_golfebengale
    326           write(*,*) 'use_bassin_indiansud=' ,use_bassin_indiansud
    327           write(*,*) 'use_bassin_tropics=' ,use_bassin_tropics
    328           write(*,*) 'use_bassin_midlats=' ,use_bassin_midlats
    329           write(*,*) 'use_bassin_hauteslats=' ,use_bassin_hauteslats
    330 
    331        
    332           ntraceurs_zone_opt=2 &
    333      &                   +use_bassin_atlantic &
    334      &                   +use_bassin_medit &
    335      &                   +use_bassin_indian &
    336      &                   +use_bassin_austral &
    337      &                   +use_bassin_pacific &
    338      &                   +use_bassin_merarabie &
    339      &                   +use_bassin_golfebengale &
    340      &                   +use_bassin_indiansud &
    341      &                   +use_bassin_tropics &
    342      &                   +use_bassin_midlats &
    343      &                   +use_bassin_hauteslats
    344 
    345           izone_cont=ntraceurs_zone
    346           izone_oce=0 ! pas de sens car séparée en bassins         
    347           izone_poubelle=ntraceurs_zone-1 ! zone où on met les flux non physiques, de
    348                 ! réajustement
    349           izone_init=ntraceurs_zone-1 ! zone d'initialisation par défaut
    350           option_revap=0 ! on ne trace pas les gouttes
    351           option_tmin=0
    352           izone_revap=0 ! pas de sens car on taggue pas les gouttes séparemment 
    353           option_cond=0
    354 
    355           ! si on a use_bassin_indian, on n'a pas le découpage détaillé
    356           ! de l'indian:
     146   SUBROUTINE iso_traceurs_init()
     147
     148   USE infotrac_phy, ONLY: itZonIso, isoName, isoZone
     149   USE isotopes_mod, ONLY: iso_eau, ntracisoOR, initialisation_iso
     150   USE dimphy,       ONLY: klon, klev
     151   USE  strings_mod, ONLY: int2str, strStack, strTail, strHead, strIdx, fmsg
     152
     153   IMPLICIT NONE
     154   ! Define which zones and isotopes correspond to isotopic tagging tracers
     155   ! Modify traceurs.h variables
     156   INTEGER :: izone, ixt, k
     157   INTEGER :: izone_pres, izone_lat
     158   INTEGER :: nzone_opt
     159
     160   IF(fmsg("traceurs_init 18: isotrac ne marche que si on met l'eau comme isotope", 'iso_traceurs_init', iso_eau==0)) STOP
     161
     162   !--- Initialize
     163   option_traceurs = 0
     164   initialisation_isotrac = 0
     165
     166   !--- Allocate
     167   ALLOCATE(index_iso (ntiso))
     168   ALLOCATE(index_zone(ntiso))
     169   ALLOCATE(itZonIso_loc(nzone,niso))
     170   ALLOCATE(strtrac(nzone))
     171   ALLOCATE(bassin_map(klon))
     172   ALLOCATE( boite_map(klon,klev))
     173
     174   IF(initialisation_iso == 0) CALL get_in('initialisation_isotrac', initialisation_isotrac)
     175
     176   !--- Read tracing option
     177   CALL get_in('option_traceurs', option_traceurs)
     178
     179   !--- Genral case: no traceurs in ORCHIDEE
     180   ntracisoOR=niso
     181
     182   ! partie a editer ! pour definir les differentes zones
     183   SELECT CASE(option_traceurs)
     184      !========================================================================================================================
     185      CASE(1)      !=== TRACING LAND/OCEAN
     186      !========================================================================================================================
     187         nzone_opt=2
     188         izone_cont=1
     189         izone_oce=2
     190         izone_poubelle=2    ! zone ou on met les flux non physiques, de reajustement
     191         izone_init=2        ! zone d'initialisation par defaut         
     192         option_revap=0
     193         option_tmin=0
     194         izone_revap=0
     195         option_cond=0
     196         strtrac(izone_cont) = 'con'
     197         strtrac(izone_oce)  = 'oce'
     198      !========================================================================================================================
     199      CASE(2)      !=== TRACING LAND/OCEAN/DROPLETS REEVAPORATION
     200      !========================================================================================================================
     201         nzone_opt=3
     202         izone_cont=1
     203         izone_oce=2
     204         izone_poubelle=2    ! zone ou on met les flux non physiques, de reajustement
     205         izone_init=2        ! zone d'initialisation par defaut         
     206         option_revap=1
     207         option_tmin=0
     208         izone_revap=3
     209         option_cond=0
     210         strtrac(izone_cont) = 'con'
     211         strtrac(izone_oce)  = 'oce'
     212         strtrac(izone_revap)= 'rev'
     213      !========================================================================================================================
     214      CASE(3)      !=== TRACING OCEANS BASINS + RESIDUE (LAST DIMENSION). NO DROPLETS EVAPORATION TRACING.
     215      !========================================================================================================================
     216         ! lire les use_bassin
     217         CALL get_in('use_bassin_Atlantic',   use_bassin_Atlantic)
     218         CALL get_in('use_bassin_Medit',      use_bassin_Medit)
     219         CALL get_in('use_bassin_Indian',     use_bassin_Indian)
     220         CALL get_in('use_bassin_Austral',    use_bassin_Austral)
     221         CALL get_in('use_bassin_Pacific',    use_bassin_Pacific)
     222         CALL get_in('use_bassin_MerArabie',  use_bassin_MerArabie)
     223         CALL get_in('use_bassin_BengalGolf', use_bassin_BengalGolf)
     224         CALL get_in('use_bassin_SouthIndian',use_bassin_SouthIndian)
     225         CALL get_in('use_bassin_Tropics',    use_bassin_Tropics)
     226         CALL get_in('use_bassin_Midlats',    use_bassin_Midlats)
     227         CALL get_in('use_bassin_HighLats',   use_bassin_HighLats)
     228         nzone_opt  =  2  +  COUNT([use_bassin_Atlantic, use_bassin_Medit,     use_bassin_Indian,     &
     229            use_bassin_Austral,     use_bassin_Pacific,  use_bassin_MerArabie, use_bassin_BengalGolf, &
     230            use_bassin_SouthIndian, use_bassin_Tropics,  use_bassin_Midlats,   use_bassin_HighLats])
     231         izone_cont=nzone
     232         izone_oce=0             ! pas de sens car separee en bassins         
     233         izone_poubelle=nzone-1  ! zone ou on met les flux non physiques, de reajustement
     234         izone_init=nzone-1      ! zone d'initialisation par defaut
     235         option_revap=0          ! on ne trace pas les gouttes
     236         option_tmin=0
     237         izone_revap=0           ! pas de sens car on taggue pas les gouttes separemment 
     238         option_cond=0
    357239#ifdef ISOVERIF
    358           if (use_bassin_indian.eq.1) then
    359 !              call iso_verif_egalite(float(use_bassin_merarabie), &
    360 !     &            0.0,'iso_traceurs_init 73: revoir def des bassins')
    361                if ((use_bassin_merarabie.ne.0).or. &
    362       &            (use_bassin_indiansud.ne.0).or. &
    363       &            (use_bassin_golfebengale.ne.0)) then
    364                 write(*,*) 'traceurs_init 73'
    365                 stop
    366                endif
    367 !              call iso_verif_egalite(float(use_bassin_golfebengale), &
    368 !     &            0.0,'iso_traceurs_init 73: revoir def des bassins')
    369 !              call iso_verif_egalite(float(use_bassin_indiansud), &
    370 !     &            0.0,'iso_traceurs_init 73: revoir def des bassins')
    371           endif
     240         IF(use_bassin_Indian) THEN   !=== NON COMPATIBLE WITH A DETAILED INDIAN CUTTING
     241            IF(use_bassin_MerArabie .OR. use_bassin_SouthIndian .OR. use_bassin_BengalGolf) THEN
     242               WRITE(*,*) 'traceurs_init 73'; STOP
     243            END IF
     244!           CALL iso_verif_egalite(float(use_bassin_MerArabie),   0.0, 'iso_traceurs_init 73: revoir def des bassins')
     245!           CALL iso_verif_egalite(float(use_bassin_BengalGolf),  0.0, 'iso_traceurs_init 73: revoir def des bassins')
     246!           CALL iso_verif_egalite(float(use_bassin_SouthIndian), 0.0, 'iso_traceurs_init 73: revoir def des bassins')
     247         END IF
    372248#endif   
    373          
    374           bassin_atlantic= max(use_bassin_atlantic,1)
    375           bassin_medit=max(use_bassin_atlantic &
    376      &           +use_bassin_medit,1)
    377           bassin_indian=max(use_bassin_atlantic &
    378      &           +use_bassin_medit &
    379      &           +use_bassin_indian,1)
    380           bassin_austral=max(use_bassin_atlantic &
    381      &           +use_bassin_medit &
    382      &           +use_bassin_indian &
    383      &           +use_bassin_austral,1)
    384           bassin_pacific=max(use_bassin_atlantic &
    385      &           +use_bassin_medit &
    386      &           +use_bassin_indian &
    387      &           +use_bassin_austral &
    388      &           +use_bassin_pacific,1)
    389           bassin_merarabie=max(use_bassin_atlantic &
    390      &           +use_bassin_medit &
    391      &           +use_bassin_indian &
    392      &           +use_bassin_austral &
    393      &           +use_bassin_pacific &
    394      &           +use_bassin_merarabie,1)
    395           bassin_golfebengale=max(use_bassin_atlantic&
    396      &           +use_bassin_medit &
    397      &           +use_bassin_indian &
    398      &           +use_bassin_austral &
    399      &           +use_bassin_pacific &
    400      &           +use_bassin_merarabie &
    401      &           +use_bassin_golfebengale,1)
    402           bassin_indiansud=max(use_bassin_atlantic &
    403      &           +use_bassin_medit &
    404      &           +use_bassin_indian &
    405      &           +use_bassin_austral &
    406      &           +use_bassin_pacific &
    407      &           +use_bassin_merarabie &
    408      &           +use_bassin_golfebengale &
    409      &           +use_bassin_indiansud,1)
    410           bassin_tropics=max(use_bassin_atlantic &
    411      &                       +use_bassin_medit &
    412      &                       +use_bassin_indian &
    413      &                       +use_bassin_austral &
    414      &                       +use_bassin_pacific &
    415      &                       +use_bassin_merarabie &
    416      &                       +use_bassin_golfebengale &
    417      &                       +use_bassin_indiansud, &
    418      &                       +use_bassin_tropics,1)
    419           bassin_midlats=max(use_bassin_atlantic &
    420      &                       +use_bassin_medit &
    421      &                       +use_bassin_indian &
    422      &                       +use_bassin_austral &
    423      &                       +use_bassin_pacific &
    424      &                       +use_bassin_merarabie &
    425      &                       +use_bassin_golfebengale &
    426      &                       +use_bassin_indiansud &
    427      &                       +use_bassin_tropics &
    428      &                       +use_bassin_midlats,1)
    429           bassin_hauteslats=max(use_bassin_atlantic &
    430      &                       +use_bassin_medit &
    431      &                       +use_bassin_indian &
    432      &                       +use_bassin_austral &
    433      &                       +use_bassin_pacific &
    434      &                       +use_bassin_merarabie &
    435      &                       +use_bassin_golfebengale &
    436      &                       +use_bassin_indiansud &
    437      &                       +use_bassin_tropics &
    438      &                       +use_bassin_midlats &
    439      &                       +use_bassin_hauteslats,1)
    440 
    441           write(*,*) 'bassin_atlantic=' ,bassin_atlantic 
    442           write(*,*) 'bassin_medit=' ,bassin_medit
    443           write(*,*) 'bassin_indian=' ,bassin_indian
    444           write(*,*) 'bassin_austral=' ,bassin_austral
    445           write(*,*) 'bassin_merarabie=' ,bassin_merarabie
    446           write(*,*) 'bassin_golfebengale=' ,bassin_golfebengale
    447           write(*,*) 'bassin_indiansud=' ,bassin_indiansud
    448           write(*,*) 'bassin_tropics=' ,bassin_tropics
    449           write(*,*) 'bassin_midlats=' ,bassin_midlats
    450           write(*,*) 'bassin_hauteslats=' ,bassin_hauteslats
    451 
    452           if (use_bassin_atlantic.eq.1) then
    453             strtrac(bassin_atlantic)='atl'
    454           endif
    455           if (use_bassin_medit.eq.1) then
    456             strtrac(bassin_medit)='med'
    457           endif
    458           if (use_bassin_indian.eq.1) then
    459             strtrac(bassin_indian)='ind'
    460           endif
    461           if (use_bassin_austral.eq.1) then
    462             strtrac(bassin_austral)='aus'
    463           endif
    464           if (use_bassin_pacific.eq.1) then
    465             strtrac(bassin_pacific)='pac'
    466           endif
    467           if (use_bassin_merarabie.eq.1) then
    468             strtrac(bassin_merarabie)='ara'
    469           endif
    470           if (use_bassin_golfebengale.eq.1) then
    471             strtrac(bassin_golfebengale)='ben'
    472           endif
    473           if (use_bassin_indiansud.eq.1) then
    474             strtrac(bassin_indiansud)='ins'
    475           endif
    476           if (use_bassin_tropics.eq.1) then
    477             strtrac(bassin_tropics)='tro'
    478           endif
    479           if (use_bassin_midlats.eq.1) then
    480             strtrac(bassin_midlats)='mid'
    481           endif
    482           if (use_bassin_hauteslats.eq.1) then
    483             strtrac(bassin_hauteslats)='hau'
    484           endif
    485           strtrac(ntraceurs_zone-1)='res'
    486           strtrac(ntraceurs_zone)='con'
    487 
    488         else if (option_traceurs.eq.4) then
    489           ! on trace les température minimales vécues
    490           ! comme dans article sur LdG sauf pas de revap
    491            
    492           zone_temp1=293.0 ! en K
    493 !          zone_tempf=223.0 ! en K
    494           zone_tempf=243.0 ! en K
    495  ! courbure de la relation entre l'indice et la température: 0 pour linéaire, <0 pour plus de détal en bas
    496 
     249         bassin_Atlantic   = 1
     250         bassin_Medit      = bassin_Atlantic    + COUNT([use_bassin_Medit]);       WRITE(*,*) 'bassin_Atlantic    =' ,bassin_Atlantic
     251         bassin_Indian     = bassin_Medit       + COUNT([use_bassin_Indian]);      WRITE(*,*) 'bassin_Medit       =' ,bassin_Medit
     252         bassin_Austral    = bassin_Indian      + COUNT([use_bassin_Austral]);     WRITE(*,*) 'bassin_Indian      =' ,bassin_Indian
     253         bassin_Pacific    = bassin_Austral     + COUNT([use_bassin_Pacific]);     WRITE(*,*) 'bassin_Austral     =' ,bassin_Austral
     254         bassin_MerArabie  = bassin_Pacific     + COUNT([use_bassin_MerArabie]);   WRITE(*,*) 'bassin_MerArabie   =' ,bassin_MerArabie
     255         bassin_BengalGolf = bassin_MerArabie   + COUNT([use_bassin_BengalGolf]);  WRITE(*,*) 'bassin_BengalGolf  =' ,bassin_BengalGolf
     256         bassin_SouthIndian= bassin_BengalGolf  + COUNT([use_bassin_SouthIndian]); WRITE(*,*) 'bassin_SouthIndian =' ,bassin_SouthIndian
     257         bassin_Tropics    = bassin_SouthIndian + COUNT([use_bassin_Tropics]);     WRITE(*,*) 'bassin_Tropics     =' ,bassin_Tropics
     258         bassin_MidLats    = bassin_Tropics     + COUNT([use_bassin_MidLats]);     WRITE(*,*) 'bassin_MidLats     =' ,bassin_MidLats
     259         bassin_HighLats   = bassin_MidLats     + COUNT([use_bassin_HighLats]);    WRITE(*,*) 'bassin_HighLats    =' ,bassin_HighLats
     260         IF(use_bassin_atlantic   ) strtrac(bassin_atlantic)   = 'atl'
     261         IF(use_bassin_medit      ) strtrac(bassin_medit)      = 'med'
     262         IF(use_bassin_indian     ) strtrac(bassin_indian)     = 'ind'
     263         IF(use_bassin_austral    ) strtrac(bassin_austral)    = 'aus'
     264         IF(use_bassin_pacific    ) strtrac(bassin_pacific)    = 'pac'
     265         IF(use_bassin_merarabie  ) strtrac(bassin_merarabie)  = 'ara'
     266         IF(use_bassin_BengalGolf ) strtrac(bassin_BengalGolf) = 'ben'
     267         IF(use_bassin_SouthIndian) strtrac(bassin_SouthIndian)= 'ins'
     268         IF(use_bassin_tropics    ) strtrac(bassin_tropics)    = 'tro'
     269         IF(use_bassin_midlats    ) strtrac(bassin_midlats)    = 'mid'
     270         IF(use_bassin_HighLats   ) strtrac(bassin_HighLats)   = 'hau'
     271         strtrac(nzone-1)='res'
     272         strtrac(nzone)='con'
     273      !========================================================================================================================
     274      CASE(4)      !=== TRACING MINIMAL EXPERIENCED TEMPERATURE AS IN THE ARTICLE ON LfG, EXCEPT NO REVAPORATION
     275      !========================================================================================================================
     276         zone_temp1 = 293.0  ! en K
     277!        zone_tempf = 223.0  ! en K
     278         zone_tempf = 243.0  ! en K
     279        ! courbure de la relation entre l'indice et la temperature: 0 pour lineaire, <0 pour plus de detal en bas
    497280        ! zone 1: >= zone_temp1
    498         ! zone 2 à 4: intermédiaire,
     281        ! zone 2 a 4: intermediaire,
    499282        ! zone 5: <zone_tempf
    500        
    501           ntraceurs_zone_opt=nzone_temp+1
    502 
    503           zone_tempa=-4.0 ! en K
    504           izone_cont=ntraceurs_zone
    505           izone_oce=ntraceurs_zone 
    506           izone_poubelle=ntraceurs_zone
    507           izone_init=ntraceurs_zone ! zone d'initialisation par défaut
    508           option_revap=0
    509           option_tmin=0 
    510           izone_revap=0
    511           option_cond=0
    512           do izone=1,nzone_temp
    513             write(strz,'(i2.2)') izone
    514             strtrac(izone)='t'//strz
    515             write(*,*) 'izone,strz,strtrac=',izone,strz,strtrac(izone)
    516           enddo
    517           strtrac(izone_poubelle)='pou'
    518 
    519           ! initialisation des zones de tempéarture
    520           do izone=1,nzone_temp-1
    521             zone_temp(izone)=zone_temp1+float(izone-1) &
    522      &                      *(zone_tempa*float(izone-nzone_temp+1) &
    523      &                      +(zone_tempf-zone_temp1)/float(nzone_temp-2))
    524           enddo
    525           write(*,*) 'iso_trac_init 183: zone_temp=',zone_temp         
    526 
    527         elseif (option_traceurs.eq.5) then
    528           ! on trace AEJ/flux de mousson/Harmattan
    529 !          write(*,*) 'iso_traceurs_init 129'
    530 
    531           ntraceurs_zone_opt=4
    532           izone_cont=1
    533           izone_oce=1
    534           izone_poubelle=1 ! zone où on met les flux non physiques, de
    535                 ! réajustement
    536           izone_init=1 ! zone d'initialisation par défaut
    537           option_revap=0
    538           option_tmin=0
    539           izone_revap=0
    540           izone_aej=2
    541           izone_mousson=3
    542           izone_harmattan=4
    543           option_cond=0
    544 
    545           strtrac(izone_poubelle)='res'
    546           strtrac(izone_aej)='aej'
    547           strtrac(izone_mousson)='mou'
    548           strtrac(izone_harmattan)='sah'
    549 
    550         elseif (option_traceurs.eq.6) then
    551           ! on trace les ddfts
    552 
    553           ntraceurs_zone_opt=2
    554           izone_cont=1
    555           izone_oce=1
    556           izone_poubelle=1 ! zone où on met les flux non physiques, de
    557                 ! réajustement
    558           izone_init=1 ! zone d'initialisation par défaut
    559           option_revap=0
    560           option_tmin=0
    561           izone_revap=0
    562           izone_ddft=2
    563           option_cond=0
    564 
    565           strtrac(izone_poubelle)='res'
    566           strtrac(izone_ddft)='dft'
    567 
    568         elseif (option_traceurs.eq.9) then
    569           ! on trace le condensat
    570 
    571           ntraceurs_zone_opt=3
    572           izone_cont=1
    573           izone_oce=1
    574           izone_poubelle=1 ! zone où on met les flux non physiques, de
    575                 ! réajustement
    576           izone_init=1 ! zone d'initialisation par défaut
    577           option_revap=1
    578           option_tmin=0
    579           izone_revap=2
    580           izone_cond=3
    581           option_cond=1
    582 
    583           ! 1 par défaut pour colorier à la fois condensat LS et
    584           ! condensat convectif. Mais on peut mettre 2 si on ne veut que
    585           ! collorier que le condensat convectif.
    586           call getin('option_cond',option_cond)
    587           write(*,*) 'option_cond=',option_cond
    588 
    589           strtrac(izone_poubelle)='res'
    590           strtrac(izone_cond)='con'
    591           strtrac(izone_revap)='rev'
    592 
    593         elseif (option_traceurs.eq.10) then
    594           ! on trace l'évap venant de ocean/continent no frac/continent frac
    595           !  utilse seulement si couplé avec ORCHIDEE
    596 #ifdef CPP_VEGET
    597 #else
    598           write(*,*) 'iso_traceurs_init 219: option_traceurs=10 ', &
    599      &                      'inutile si on ne couple pas avec ORCHIDEE'
    600           stop
     283         nzone_opt=nzone_temp+1
     284         zone_tempa=-4.0     ! en K
     285         izone_cont=nzone
     286         izone_oce=nzone 
     287         izone_poubelle=nzone
     288         izone_init=nzone    ! zone d'initialisation par defaut
     289         option_revap=0
     290         option_tmin=0 
     291         izone_revap=0
     292         option_cond=0
     293         DO izone=1,nzone_temp
     294            strtrac(izone) = 't'//TRIM(int2str(izone))
     295            WRITE(*,*) 'izone, strtrac=', izone, strtrac(izone)
     296         END DO
     297         strtrac(izone_poubelle)='pou'
     298         ! Initialization of temperatures zones
     299         DO izone=1,nzone_temp-1
     300            zone_temp(izone) = zone_temp1+float(izone-1)            &
     301                            * (zone_tempa*float(izone-nzone_temp+1) &
     302                            + (zone_tempf-zone_temp1)/float(nzone_temp-2))
     303         END DO
     304         WRITE(*,*) 'iso_trac_init 183: zone_temp=', zone_temp
     305      !========================================================================================================================
     306      CASE(5)      !=== TRACING AEJ/MOONSOON FLUX/Harmattan
     307      !========================================================================================================================
     308!        WRITE*,*) 'iso_traceurs_init 129'
     309         nzone_opt=4
     310         izone_cont=1
     311         izone_oce=1
     312         izone_poubelle=1    ! zone ou on met les flux non physiques, de reajustement
     313         izone_init=1        ! zone d'initialisation par defaut         
     314         option_revap=0
     315         option_tmin=0
     316         izone_revap=0
     317         izone_aej=2
     318         izone_mousson=3
     319         izone_harmattan=4
     320         option_cond=0
     321         strtrac(izone_poubelle) = 'res'
     322         strtrac(izone_aej)      = 'aej'
     323         strtrac(izone_mousson)  = 'mou'
     324         strtrac(izone_harmattan)= 'sah'
     325      !========================================================================================================================
     326      CASE(6)      !=== TRACING DDFTS
     327      !========================================================================================================================
     328         nzone_opt=2
     329         izone_cont=1
     330         izone_oce=1
     331         izone_poubelle=1    ! zone ou on met les flux non physiques, de reajustement
     332         izone_init=1        ! zone d'initialisation par defaut         
     333         option_revap=0
     334         option_tmin=0
     335         izone_revap=0
     336         izone_ddft=2
     337         option_cond=0
     338         strtrac(izone_poubelle)='res'
     339         strtrac(izone_ddft)='dft'
     340      !========================================================================================================================
     341      CASE(9)      !=== TRACING CONDENSATION
     342      !========================================================================================================================
     343         nzone_opt=3
     344         izone_cont=1
     345         izone_oce=1
     346         izone_poubelle=1    ! zone ou on met les flux non physiques, de reajustement
     347         izone_init=1        ! zone d'initialisation par defaut         
     348         option_revap=1
     349         option_tmin=0
     350         izone_revap=2
     351         izone_cond=3
     352         option_cond=1
     353         ! 1 par defaut pour colorier a la fois condensat LS et condensat convectif.
     354         ! Mais on peut mettre 2 si on ne veut que colorier que le condensat convectif.
     355         CALL get_in('option_cond',option_cond)
     356         strtrac(izone_poubelle)='res'
     357         strtrac(izone_cond)='con'
     358         strtrac(izone_revap)='rev'
     359      !========================================================================================================================
     360      CASE(10)     !=== TRACING EVAPORATION FROM OCEAN/LAND, NON FRAC/LAND FRAC ; ONLY WHEN COUPLED WITH ORCHIDEE
     361      !========================================================================================================================
     362#ifndef CPP_VEGET
     363         WRITE(*,*) 'iso_traceurs_init 219: option_traceurs=10 inutile si on ne couple pas avec ORCHIDEE'; STOP
    601364#endif         
    602 
    603           ntraceurs_zone_opt=3
    604           izone_cont=1 ! sous-entendu non fractionnant
    605           izone_oce=2
    606           izone_poubelle=2 ! zone où on met les flux non physiques, de
    607                 ! réajustement
    608           izone_init=2 ! zone d'initialisation par défaut
    609           option_revap=0
    610           option_tmin=0
    611           izone_revap=0
    612           izone_contfrac=3
    613           izone_contcanop=3
    614           izone_irrig=0
    615           option_cond=0
    616 
    617           strtrac(izone_oce)='oce'
    618           strtrac(izone_cont)='con' 
    619           strtrac(izone_contfrac)='enu'  ! evap sol nu
    620 
    621         elseif (option_traceurs.eq.11) then
    622           ! on trace reevap des gouttes et le reste
    623 
    624           ntraceurs_zone_opt=2
    625           izone_cont=1
    626           izone_oce=1
    627           izone_poubelle=1 ! zone où on met les flux non physiques, de
    628                 ! réajustement
    629           izone_init=1 ! zone d'initialisation par défaut
    630           option_revap=1
    631           option_tmin=0
    632           izone_revap=2
    633           izone_irrig=0
    634           option_cond=0
    635 
    636           strtrac(izone_poubelle)='res'
    637           strtrac(izone_revap)='rev'
    638 
    639         elseif (option_traceurs.eq.12) then
    640           ! on trace evap du sol nu, evap de la canopée, reste de l'evap cont et
    641           ! evap oce
    642 #ifdef CPP_VEGET
    643 #else
    644           write(*,*) 'iso_traceurs_init 257: option_traceurs=10 ', &
    645      &                      'inutile si on ne couple pas avec ORCHIDEE'
    646           stop
     365         nzone_opt=3
     366         izone_cont=1        ! sous-entendu non fractionnant
     367         izone_oce=2
     368         izone_poubelle=2    ! zone ou on met les flux non physiques, de reajustement
     369         izone_init=2        ! zone d'initialisation par defaut
     370         option_revap=0
     371         option_tmin=0
     372         izone_revap=0
     373         izone_contfrac=3
     374         izone_contcanop=3
     375         izone_irrig=0
     376         option_cond=0
     377         strtrac(izone_oce)='oce'
     378         strtrac(izone_cont)='con' 
     379         strtrac(izone_contfrac)='enu'  ! evap sol nu
     380      !========================================================================================================================
     381      CASE(11)     !=== TRACING DROPLETS REEVAPORATION + REST
     382      !========================================================================================================================
     383         nzone_opt=2
     384         izone_cont=1
     385         izone_oce=1
     386         izone_poubelle=1    ! zone ou on met les flux non physiques, de reajustement
     387         izone_init=1        ! zone d'initialisation par defaut
     388         option_revap=1
     389         option_tmin=0
     390         izone_revap=2
     391         izone_irrig=0
     392         option_cond=0
     393         strtrac(izone_poubelle)='res'
     394         strtrac(izone_revap)='rev'
     395      !========================================================================================================================
     396      CASE(12)     !=== TRACING NAKED GROUND EVAPORATION, CANOPY EVAPORATION, REST OF LAND EVAPORATION AND OCEAN EVAPORATION
     397      !========================================================================================================================
     398#ifndef CPP_VEGET
     399         WRITE(*,*) 'iso_traceurs_init 257: option_traceurs=10 inutile si on ne couple pas avec ORCHIDEE'; STOP
    647400#endif           
    648 
    649           ntraceurs_zone_opt=2
    650           izone_cont=1
    651           izone_oce=2
    652           izone_poubelle=2 ! zone où on met les flux non physiques, de
    653                 ! réajustement
    654           izone_init=2 ! zone d'initialisation par défaut
    655           option_revap=0
    656           option_tmin=0
    657           izone_revap=0
    658           izone_contfrac=3
    659           izone_contcanop=4
    660           izone_irrig=0   
    661           option_cond=0
    662 
    663           strtrac(izone_oce)='oce'
    664           strtrac(izone_cont)='con'
    665           strtrac(izone_contfrac)='enu'  ! evap sol nu
    666           strtrac(izone_contcanop)='eca'  ! evap canop
    667 
    668        else if (option_traceurs.eq.13) then
    669           ! on trace les température minimales vécues + la revap
    670           ! comme dans article sur LdG
    671            
    672         zone_temp1=293.0         ! en K       
    673 !        parameter (zone_tempf=223.0) ! en K
    674         zone_tempf=243.0 ! en K
    675         zone_tempa=-4.0 ! courbure de la relation entre l'indice et la température: 0 pour linéaire, <0 pour plus de détal en bas
    676 
    677         ! zone 1: >= zone_temp1
    678         ! zone 2 à 4: intermédiaire,
    679         ! zone 5: <zone_tempf
    680        
    681           ntraceurs_zone_opt=nzone_temp+1
    682          
    683           izone_cont=1
    684           izone_oce=1 
    685           izone_poubelle=1
    686           izone_init=1 ! zone d'initialisation par défaut
    687           option_revap=1   
    688           option_tmin=0
    689           izone_revap=ntraceurs_zone
    690           izone_irrig=0
    691           option_cond=0
    692           do izone=1,nzone_temp
    693             write(strz,'(i2.2)') izone
    694             strtrac(izone)='t'//strz
    695             write(*,*) 'izone,strz,strtrac=',izone,strz,strtrac(izone)
    696           enddo
    697           strtrac(izone_revap)='rev'
    698 
    699           ! initialisation des zones de tempéarture
    700           do izone=1,nzone_temp-1
    701             zone_temp(izone)=zone_temp1+float(izone-1) &
    702      &                      *(zone_tempa*float(izone-nzone_temp+1) &
    703      &                      +(zone_tempf-zone_temp1)/float(nzone_temp-2))
    704           enddo
    705           write(*,*) 'zone_temp=',zone_temp
    706 
    707        else if (option_traceurs.eq.14) then
    708           ! on trace les pres et lat de dernière saturation définies
    709           ! comme rh>90%
    710            
    711         zone_pres1=600.0*100.0 ! en Pa       
    712         zone_presf=300.0*100.0 ! en Pa
    713         zone_presa=0.0 ! courbure de la relation entre l'indice et la température: 0 pour linéaire, <0 pour plus de détal en bas
    714 
    715         lattag_min=10.0 ! en degrès
    716         dlattag=15.0
    717 
    718         ! zone 1: >= zone_pres1
    719         ! zone 2 à 4: intermédiaire,
    720         ! zone 5: <zone_presf
    721        
    722          ntraceurs_zone_opt=nzone_pres*nzone_lat+1         
    723           izone_cont=ntraceurs_zone
    724           izone_oce=ntraceurs_zone
    725           izone_poubelle=ntraceurs_zone
    726           izone_init=ntraceurs_zone ! zone d'initialisation par défaut
    727           option_revap=0 
    728           option_tmin=0
    729           izone_revap=0
    730           izone_irrig=0
    731           option_cond=0
    732           do izone_pres=1,nzone_pres
    733            do izone_lat=1,nzone_lat
    734             write(strz_pres,'(i1.1)') izone_pres
    735             write(strz_lat,'(i1.1)') izone_lat
    736             strz_preslat=strz_pres//strz_lat
    737             izone=izone_lat+(izone_pres-1)*nzone_lat
    738             strtrac(izone)='t'//strz_preslat
    739             write(*,*) 'izone_pres,izone_lat,strtrac=', &
    740      &                        izone_pres,izone_lat,izone,strtrac(izone)
    741            enddo !do izone_lat=1,nzone_lat
    742           enddo !do izone_pres=1,nzone_pres
    743           strtrac(ntraceurs_zone)='sfc'
    744 
    745           ! initialisation des zones de tempéarture
    746           do izone=1,nzone_pres-1
    747             zone_pres(izone)=zone_pres1+float(izone-1) &
    748      &                      *(zone_presa*float(izone-nzone_pres+1) &
    749      &                      +(zone_presf-zone_pres1)/float(nzone_pres-2))
    750           enddo !do izone=1,nzone_pres-1
    751           write(*,*) 'traceurs_init 332: zone_pres=',zone_pres
    752 !          stop
    753 !
    754        elseif (option_traceurs.eq.15) then
    755           ! on trace l'irrigation dans ORCHIDEE
    756 #ifdef CPP_VEGET
    757 #else
    758           write(*,*) 'iso_traceurs_init 257: option_traceurs=15 ', &
    759      &                      'inutile si on ne couple pas avec ORCHIDEE'
    760           stop
     401         nzone_opt=2
     402         izone_cont=1
     403         izone_oce=2
     404         izone_poubelle=2    ! zone ou on met les flux non physiques, de reajustement
     405         izone_init=2        ! zone d'initialisation par defaut
     406         option_revap=0
     407         option_tmin=0
     408         izone_revap=0
     409         izone_contfrac=3
     410         izone_contcanop=4
     411         izone_irrig=0   
     412         option_cond=0
     413         strtrac(izone_oce)='oce'
     414         strtrac(izone_cont)='con'
     415         strtrac(izone_contfrac)='enu' ! evap sol nu
     416         strtrac(izone_contcanop)='eca'! evap canop
     417      !========================================================================================================================
     418      CASE(13)     !=== TRACING MINIMUM EXPERIENCED TEMPERATIRES + REEVAPORATION AS IN THE ARTICLE ON LdG
     419      !========================================================================================================================
     420         zone_temp1=293.0    ! en K       
     421!        zone_tempf=223.0    ! en K
     422         zone_tempf=243.0    ! en K
     423         zone_tempa=-4.0     ! courbure de la relation entre l'indice et la temperature: 0 pour lineaire, <0 pour plus de detal en bas
     424         ! zone 1: >= zone_temp1
     425         ! zone 2 a 4: intermediaire,
     426         ! zone 5: <zone_tempf
     427         nzone_opt=nzone_temp+1
     428         izone_cont=1
     429         izone_oce=1 
     430         izone_poubelle=1
     431         izone_init=1        ! zone d'initialisation par defaut
     432         option_revap=1   
     433         option_tmin=0
     434         izone_revap=nzone
     435         izone_irrig=0
     436         option_cond=0
     437         DO izone=1,nzone_temp
     438            strtrac(izone) = 't'//TRIM(int2str(izone))
     439            WRITE(*,*) 'izone, strtrac = ', izone, strtrac(izone)
     440         END DO
     441         strtrac(izone_revap)='rev'
     442         ! initialisation des zones de tempearture
     443         DO izone=1,nzone_temp-1
     444            zone_temp(izone) = zone_temp1+float(izone-1) &
     445                             *(zone_tempa*float(izone-nzone_temp+1) &
     446                             +(zone_tempf-zone_temp1)/float(nzone_temp-2))
     447         END DO
     448         WRITE(*,*) 'zone_temp=',zone_temp
     449      !========================================================================================================================
     450      CASE(14)     !=== TRACING PRES AND LAT OF LAST SATURATION DEFINED AS rh>90%
     451      !========================================================================================================================
     452         zone_pres1=600.0*100.0   ! en Pa       
     453         zone_presf=300.0*100.0   ! en Pa
     454         zone_presa=0.0           ! courbure de la relation entre l'indice et la temperature: 0 pour lineaire
     455         lattag_min=10.0          ! en degres
     456         dlattag=15.0
     457         ! zone 1: >= zone_pres1
     458         ! zone 2 a 4: intermediaire,
     459         ! zone 5: <zone_presf
     460         nzone_opt=nzone_pres*nzone_lat+1         
     461         izone_cont=nzone
     462         izone_oce=nzone
     463         izone_poubelle=nzone
     464         izone_init=nzone         ! zone d'initialisation par defaut
     465         option_revap=0 
     466         option_tmin=0
     467         izone_revap=0
     468         izone_irrig=0
     469         option_cond=0
     470         DO izone_pres=1,nzone_pres
     471            DO izone_lat=1,nzone_lat
     472               izone=izone_lat+(izone_pres-1)*nzone_lat
     473               strtrac(izone) = 't'//TRIM(int2str(izone_pres))//TRIM(int2str(izone_lat))
     474               write(*,*) 'izone_pres, izone_lat, izone, strtrac = ',izone_pres, izone_lat, izone, strtrac(izone)
     475            END DO
     476         END DO
     477         strtrac(nzone)='sfc'
     478         ! initialisation des zones de temperature
     479         DO izone=1,nzone_pres-1
     480            zone_pres(izone) = zone_pres1+float(izone-1) &
     481                             *(zone_presa*float(izone-nzone_pres+1) &
     482                             +(zone_presf-zone_pres1)/float(nzone_pres-2))
     483         END DO
     484         WRITE(*,*) 'traceurs_init 332: zone_pres=',zone_pres
     485      !========================================================================================================================
     486      CASE(15)     !=== TRACING IRRIGATION IN ORCHIDEE
     487      !========================================================================================================================
     488#ifndef CPP_VEGET
     489         WRITE(*,*) 'iso_traceurs_init 257: option_traceurs=15 inutile si on ne couple pas avec ORCHIDEE'; STOP
    761490#endif
    762 
    763           ntraceurs_zone_opt=1
    764           izone_cont=1
    765           izone_oce=1
    766           izone_poubelle=1 ! zone où on met les flux non physiques, de
    767                 ! réajustement
    768           izone_init=1 ! zone d'initialisation par défaut
    769           option_revap=0
    770           option_tmin=0
    771           izone_revap=0
    772           izone_contfrac=0
    773           izone_contcanop=0
    774           izone_irrig=2
    775           option_cond=0
    776          
    777           strtrac(izone_poubelle)='res'
    778           strtrac(izone_irrig)='irrig'
    779 
    780           ! dans ce cas particulier, il y a des traceurs dans ORCHIDEE
    781           ntracisoOR=ntraciso
    782 
    783         else if ((option_traceurs.eq.17).or. &
    784      &           (option_traceurs.eq.18)) then
    785           ! on trace les température minimales vécues
    786           ! comme dans article sur LdG sauf pas de revap
    787            
    788         zone_temp1=12.0e-3 ! en kg/kg       
    789         zone_tempf=0.2e-3 ! en kg/kg
    790         zone_tempa=1.2e-3 ! courbure de la relation entre l'indice et la température: 0 pour linéaire, <0 pour plus de détail en bas
    791 
    792 !       parameter (zone_temp1=14.0e-3) ! en kg/kg       
    793 !       parameter (zone_tempf=0.2e-3) ! en kg/kg
    794 !       parameter (zone_tempa=0.5e-3)       
    795 
    796 !        parameter (zone_temp1=10.0e-3) ! en kg/kg
    797 !       parameter (zone_tempf=0.5e-3) ! en kg/kg
    798 !       parameter (zone_tempa=0.5e-3)
    799 
    800         ! zone 1: >= zone_temp1
    801         ! zone 2 à 4: intermédiaire,
    802         ! zone 5: <zone_tempf
    803        
    804         ntraceurs_zone_opt=nzone_temp+3
    805        
    806           izone_cont=nzone_temp+1
    807           izone_oce=nzone_temp+1
    808           izone_poubelle=nzone_temp+1
    809           izone_init=nzone_temp+1 ! zone d'initialisation par défaut
    810           option_revap=1 
    811           option_tmin=1
    812           option_cond=1
    813 
    814           izone_revap=nzone_temp+3
    815           izone_cond=nzone_temp+2
    816           do izone=1,nzone_temp
    817             write(strz,'(i2.2)') izone
    818             strtrac(izone)='t'//strz
    819             write(*,*) 'izone,strz,strtrac=',izone,strz,strtrac(izone)
    820           enddo !do izone=1,nzone_temp
    821           strtrac(izone_poubelle)='sfc'
    822           strtrac(izone_cond)='con'
    823           strtrac(izone_revap)='rev'
    824 
    825           ! initialisation des zones de tempéarture
    826           do izone=1,nzone_temp-1
    827             zone_temp(izone)=zone_temp1+float(izone-1) &
    828      &                      *(zone_tempa*float(izone-nzone_temp+1) &
    829      &             +(zone_tempf-zone_temp1)/float(nzone_temp-2))
    830           enddo
    831          write(*,*) 'zone_temp1,zone_tempf,zone_tempa=', &
    832      &              zone_temp1,zone_tempf,zone_tempa
    833           write(*,*) 'zone_temp=',zone_temp
    834 !          stop         
    835 
    836         else if (option_traceurs.eq.19) then
    837 
    838         zone_temp1=12.0e-3 ! en kg/kg       
    839         zone_tempf=0.2e-3 ! en kg/kg
    840         zone_tempa=1.2e-3 ! courbure de la relation entre l'indice et la température: 0 pour linéaire, <0 pour plus de détail en bas
    841 
    842 !       parameter (zone_temp1=14.0e-3) ! en kg/kg       
    843 !       parameter (zone_tempf=0.2e-3) ! en kg/kg
    844 !       parameter (zone_tempa=0.5e-3)       
    845 
    846 !        parameter (zone_temp1=10.0e-3) ! en kg/kg
    847 !       parameter (zone_tempf=0.5e-3) ! en kg/kg
    848 !       parameter (zone_tempa=0.5e-3)
    849 
    850         ! zone 1: >= zone_temp1
    851         ! zone 2 à 4: intermédiaire,
    852         ! zone 5: <zone_tempf
    853        
    854         ntraceurs_zone_opt=nzone_temp+4
    855        
    856           izone_cont=nzone_temp+1
    857           izone_oce=nzone_temp+1
    858           izone_poubelle=nzone_temp+1
    859           if (option_seuil_tag_tmin.eq.1) then
    860             izone_init=nzone_temp+1 ! zone d'initialisation par défaut
    861           else
     491         nzone_opt=1
     492         izone_cont=1
     493         izone_oce=1
     494         izone_poubelle=1    ! zone ou on met les flux non physiques, de reajustement
     495         izone_init=1        ! zone d'initialisation par defaut
     496         option_revap=0
     497         option_tmin=0
     498         izone_revap=0
     499         izone_contfrac=0
     500         izone_contcanop=0
     501         izone_irrig=2
     502         option_cond=0
     503         strtrac(izone_poubelle)='res'
     504         strtrac(izone_irrig)='irrig'
     505         ! dans ce cas particulier, il y a des traceurs dans ORCHIDEE
     506         ntracisoOR=ntiso
     507      !========================================================================================================================
     508      CASE(17,18)  !=== TRACING MINIMAL EXPERIENCES TEMPERATURES AS IN THE ARTICLE ABOUT LdG, BUT NO EVAPORATION
     509      !========================================================================================================================
     510         zone_temp1=12.0e-3  ! en kg/kg       
     511         zone_tempf=0.2e-3   ! en kg/kg
     512         zone_tempa=1.2e-3   ! courbure de la relation entre l'indice et la temperature: 0 pour lineaire
     513!        zone_temp1=14.0e-3  ! en kg/kg       
     514!        zone_tempf=0.2e-3   ! en kg/kg
     515!        zone_tempa=0.5e-3       
     516!        zone_temp1=10.0e-3  ! en kg/kg
     517!        zone_tempf=0.5e-3   ! en kg/kg
     518!        zone_tempa=0.5e-3
     519         ! zone 1: >= zone_temp1
     520         ! zone 2 a 4: intermediaire,
     521         ! zone 5: <zone_tempf
     522         nzone_opt=nzone_temp+3
     523         izone_cont=nzone_temp+1
     524         izone_oce=nzone_temp+1
     525         izone_poubelle=nzone_temp+1
     526         izone_init=nzone_temp+1 ! zone d'initialisation par defaut
     527         option_revap=1 
     528         option_tmin=1
     529         option_cond=1
     530         izone_revap=nzone_temp+3
     531         izone_cond=nzone_temp+2
     532         DO izone=1,nzone_temp
     533            strtrac(izone) = 't'//TRIM(int2str(izone))
     534            WRITE(*,*) 'izone, strtrac = ', izone, strtrac(izone)
     535         END DO !do izone=1,nzone_temp
     536         strtrac(izone_poubelle)='sfc'
     537         strtrac(izone_cond)='con'
     538         strtrac(izone_revap)='rev'
     539         ! initialisation des zones de tempearture
     540         DO izone=1,nzone_temp-1
     541            zone_temp(izone) = zone_temp1+float(izone-1) &
     542                             *(zone_tempa*float(izone-nzone_temp+1) &
     543                             +(zone_tempf-zone_temp1)/float(nzone_temp-2))
     544         END DO
     545         WRITE(*,*) 'zone_temp1,zone_tempf,zone_tempa=',zone_temp1,zone_tempf,zone_tempa
     546         WRITE(*,*) 'zone_temp=',zone_temp
     547!        STOP         
     548      !========================================================================================================================
     549      CASE(19)     !=== TRACING TROPICAL AND EXTRATROPICAL VAPOUR
     550      !========================================================================================================================
     551         zone_temp1=12.0e-3  ! en kg/kg       
     552         zone_tempf=0.2e-3   ! en kg/kg
     553         zone_tempa=1.2e-3   ! courbure de la relation entre l'indice et la temperature: 0 pour lineaire, <0 pour plus de detail en bas
     554!        zone_temp1=14.0e-3  ! en kg/kg       
     555!        zone_tempf=0.2e-3   ! en kg/kg
     556!        zone_tempa=0.5e-3
     557!        zone_temp1=10.0e-3  ! en kg/kg       
     558!        zone_tempf=0.5e-3   ! en kg/kg
     559!        zone_tempa=0.5e-3
     560         ! zone 1: >= zone_temp1
     561         ! zone 2 a 4: intermediaire,
     562         ! zone 5: <zone_tempf
     563         nzone_opt=nzone_temp+4
     564         izone_cont=nzone_temp+1
     565         izone_oce=nzone_temp+1
     566         izone_poubelle=nzone_temp+1
     567         IF(option_seuil_tag_tmin == 1) THEN
     568            izone_init=nzone_temp+1 ! zone d'initialisation par defaut
     569         ELSE
    862570            izone_init=nzone_temp
    863           endif
    864           option_revap=1   
    865           izone_revap=nzone_temp+3
    866           izone_cond=nzone_temp+2
    867           izone_ddft=nzone_temp+4
    868           option_tmin=1         
    869           option_cond=1
    870           do izone=1,nzone_temp
    871             write(strz,'(i2.2)') izone
    872             strtrac(izone)='t'//strz
    873             write(*,*) 'izone,strz,strtrac=',izone,strz,strtrac(izone)
    874           enddo !do izone=1,nzone_temp
    875           strtrac(izone_poubelle)='sfc'
    876           strtrac(izone_cond)='con'
    877           strtrac(izone_revap)='rev'
    878           strtrac(izone_ddft)='dft'
    879 
    880         elseif (option_traceurs.eq.20) then
    881           ! on vapeur tropical/extractropicale/recyclage extractropical
    882           ! pour comprendre controles humidité et isotopes subtropicaux.       
    883          
    884           lim_tag20=35.0
    885           call getin('lim_tag20',lim_tag20)
    886           write(*,*) 'lim_tag20=',lim_tag20
    887 
    888           ntraceurs_zone_opt=3
    889           izone_cont=1
    890           izone_oce=1
    891           izone_poubelle=2 ! zone où on met les flux non physiques, de
    892                 ! réajustement
    893           izone_init=2 ! zone d'initialisation par défaut
    894           option_revap=0
    895           option_tmin=0
    896           izone_revap=0
    897           izone_trop=2
    898           izone_extra=3
    899 
    900           strtrac(izone_trop)='tro' ! vapeur tropicale
    901           strtrac(izone_extra)='ext' ! vapeur extractropicale evaporée
    902                 ! dans les tropiques
    903           strtrac(izone_cont)='rec' ! recyclage
    904 
    905         elseif (option_traceurs.eq.21) then
    906           ! on trace 2 boites 3D: UT tropicale et extratropiques
    907           ! fonctionnement similaire à option 5 pour taggage des zones
    908           ! AMMA
    909 !          write(*,*) 'iso_traceurs_init 129'
    910 
    911           ntraceurs_zone_opt=3
    912           izone_cont=1
    913           izone_oce=1
    914           izone_poubelle=1 ! zone où on met les flux non physiques, de
    915                 ! réajustement
    916           izone_init=1 ! zone d'initialisation par défaut
    917           option_revap=0
    918           option_tmin=0
    919           izone_revap=0
    920           izone_trop=2
    921           izone_extra=3
    922           option_cond=0
    923 
    924           strtrac(izone_poubelle)='res'
    925           strtrac(izone_trop)='tro'
    926           strtrac(izone_extra)='ext'
    927 
    928         elseif (option_traceurs.eq.22) then
    929           ! on trace la vapeur qui a été processée dans zones de
    930           ! convections à 3 niveaux: BT, MT et UT
    931 
    932           lim_precip_tag22=20.0
    933           call getin('lim_precip_tag22',lim_precip_tag22)
    934           write(*,*) 'lim_precip_tag22=',lim_precip_tag22
    935 
    936           ntraceurs_zone_opt=3
    937           izone_cont=1
    938           izone_oce=1
    939           izone_poubelle=1 ! zone où on met les flux non physiques, de
    940                 ! réajustement
    941           izone_init=1 ! zone d'initialisation par défaut
    942           option_revap=0
    943           option_tmin=0
    944           izone_revap=0
    945           izone_conv_BT=2
    946           izone_conv_UT=3
    947           option_cond=0
    948 
    949           strtrac(izone_poubelle)='res'
    950           strtrac(izone_conv_BT)='cbt'
    951           strtrac(izone_conv_UT)='cut'
    952 
    953         else
    954             write(*,*) 'traceurs_init 36: option pas encore prévue'
    955             stop
    956         endif
    957 
    958        
    959           if (ntraceurs_zone_opt.ne.ntraceurs_zone) then
    960                 write(*,*) 'ntraceurs_zone_opt,ntraceurs_zone=', &
    961                         & ntraceurs_zone_opt,ntraceurs_zone
    962                 call abort_physic ('isotrac_mod','ntraceurs_zone incoherent',1)
    963           endif
    964 
    965        
    966         ! seuil sur le taux de condensation
    967         if (option_tmin.eq.1) then
    968           seuil_tag_tmin=0.01
    969           call getin('seuil_tag_tmin',seuil_tag_tmin)
    970           write(*,*) 'seuil_tag_tmin=',seuil_tag_tmin
    971 
    972           seuil_tag_tmin_ls=seuil_tag_tmin
    973           call getin('seuil_tag_tmin_ls',seuil_tag_tmin_ls)
    974           write(*,*) 'seuil_tag_tmin_ls=',seuil_tag_tmin_ls
    975 
    976           option_seuil_tag_tmin=1
    977           call getin('option_seuil_tag_tmin',option_seuil_tag_tmin)
    978           write(*,*) 'option_seuil_tag_tmin=',option_seuil_tag_tmin
    979         endif
    980 
    981 
    982         do ixt=1,niso
    983            index_zone(ixt)=0
    984            index_iso(ixt)=ixt
    985         enddo
    986         itrac=niso       
    987         do izone=1,ntraceurs_zone
    988           do ixt=1,niso
    989             itrac=itrac+1
    990             index_zone(itrac)=izone
    991             index_iso(itrac)=ixt
    992             index_trac_loc(izone,ixt)=itrac
    993             if (index_trac(izone,ixt).ne.index_trac_loc(izone,ixt)) then
    994                 write(*,*) 'isotrac 989: izone,ixt,itrac=',izone,ixt,itrac
    995                 CALL abort_physic ('isotrac','isotrac 989',1)
    996             endif
    997           enddo
    998         enddo
     571         END IF
     572         option_revap=1   
     573         izone_revap=nzone_temp+3
     574         izone_cond=nzone_temp+2
     575         izone_ddft=nzone_temp+4
     576         option_tmin=1         
     577         option_cond=1
     578         DO izone=1,nzone_temp
     579            strtrac(izone) = 't'//TRIM(int2str(izone))
     580            WRITE(*,*) 'izone, strtrac = ', izone, strtrac(izone)
     581         END DO
     582         strtrac(izone_poubelle)='sfc'
     583         strtrac(izone_cond)='con'
     584         strtrac(izone_revap)='rev'
     585         strtrac(izone_ddft)='dft'
     586      !========================================================================================================================
     587      CASE(20)     !=== TRACING TROPICAL/EXTRATROPICAL/EXTRATROPICAL RECYCLING TO STUDY HUMIDITY AND SUBTROPICAL ISOTOPES CONTROL
     588      !========================================================================================================================
     589         CALL get_in('lim_tag20', lim_tag20, 35.0)
     590         nzone_opt=3
     591         izone_cont=1
     592         izone_oce=1
     593         izone_poubelle=2    ! zone ou on met les flux non physiques, de reajustement
     594         izone_init=2        ! zone d'initialisation par defaut
     595         option_revap=0
     596         option_tmin=0
     597         izone_revap=0
     598         izone_trop=2
     599         izone_extra=3
     600         strtrac(izone_trop)='tro'     ! tropical vapour
     601         strtrac(izone_extra)='ext'    ! extratropical vapour evaporated in the tropics
     602         strtrac(izone_cont)='rec'     ! recycling
     603      !========================================================================================================================
     604      CASE(21)     !=== TRACING TWO 3D BOXES: TROPICAL UT AND EXTRATROPICS ; SIMILAR TO 5 FOR AMMA ZONES TAGGING
     605      !========================================================================================================================
     606!        WRITE(*,*) 'iso_traceurs_init 129'
     607         nzone_opt=3
     608         izone_cont=1
     609         izone_oce=1
     610         izone_poubelle=1    ! zone ou on met les flux non physiques, de reajustement
     611         izone_init=1        ! zone d'initialisation par defaut
     612         option_revap=0
     613         option_tmin=0
     614         izone_revap=0
     615         izone_trop=2
     616         izone_extra=3
     617         option_cond=0
     618         strtrac(izone_poubelle)='res'
     619         strtrac(izone_trop)='tro'
     620         strtrac(izone_extra)='ext'
     621      !========================================================================================================================
     622      CASE(22)     !=== TRACING WATER VAPOUR PROCESSED IN THE 3-LEVELS SCONVECTION ZONES BT, MT AND UT
     623      !========================================================================================================================
     624         CALL get_in('lim_precip_tag22', lim_precip_tag22, 20.0)
     625         nzone_opt=3
     626         izone_cont=1
     627         izone_oce=1
     628         izone_poubelle=1    ! zone ou on met les flux non physiques, de reajustement
     629         izone_init=1        ! zone d'initialisation par defaut
     630         option_revap=0
     631         option_tmin=0
     632         izone_revap=0
     633         izone_conv_BT=2
     634         izone_conv_UT=3
     635         option_cond=0
     636         strtrac(izone_poubelle)='res'
     637         strtrac(izone_conv_BT)='cbt'
     638         strtrac(izone_conv_UT)='cut'
     639      CASE DEFAULT
     640         WRITE(*,*) 'traceurs_init 36: option pas encore prevue' ; STOP
     641   END SELECT
     642
     643   IF(nzone_opt /= nzone) THEN
     644      WRITE(*,*) 'nzone_opt, nzone=', nzone_opt, nzone
     645      CALL abort_physic ('isotrac_mod','nzone incoherent',1)
     646   END IF
     647
     648   !--- Condensation rate threshold
     649   IF(option_tmin == 1) THEN
     650      seuil_tag_tmin = 0.01
     651      CALL get_in('seuil_tag_tmin',        seuil_tag_tmin,        0.01)
     652      CALL get_in('seuil_tag_tmin_ls',     seuil_tag_tmin_ls,     seuil_tag_tmin)
     653      CALL get_in('option_seuil_tag_tmin', option_seuil_tag_tmin, 1)
     654   END IF
     655
     656   index_zone = [(strIdx(isoZone, strTail(isoName(ixt) ,'_',.TRUE.)), ixt=1, ntiso)]
     657   index_iso  = [(strIdx(isoName, strHead(isoName(ixt) ,'_',.TRUE.)), ixt=1, ntiso)]
     658   itZonIso_loc = itZonIso(:,:)
    999659#ifdef ISOVERIF
    1000 !        call iso_verif_egalite(float(itrac),float(ntraciso), &
    1001 !     &           'traceurs_init 50')
    1002         if (itrac.ne.ntraciso) then
    1003           write(*,*) 'traceurs_init 50'
    1004           stop
    1005         endif
    1006      
    1007         write(*,*) 'traceurs_init 65: bilan de l''init:'
    1008         write(*,*) 'index_zone=',index_zone(1:ntraciso)
    1009         write(*,*) 'index_iso=',index_iso(1:ntraciso)
    1010         write(*,*) 'index_trac=',index_trac(1:ntraceurs_zone,1:niso)
    1011         do izone=1,ntraceurs_zone
    1012           write(*,*) 'strtrac(',izone,')=',strtrac(izone)
    1013         enddo !do izone=1,ntraceurs_zone
    1014         write(*,*) 'ntracisoOR=',ntracisoOR
     660   WRITE(*,*) 'traceurs_init 65: bilan de l''init:'
     661   WRITE(*,*) 'index_zone = '//TRIM(strStack(int2str(index_zone(1:ntiso))))
     662   WRITE(*,*) 'index_iso  = '//TRIM(strStack(int2str(index_iso (1:ntiso))))
     663   DO izone=1,nzone
     664      WRITE(*,*)'itZonIso('//TRIM(int2str(izone))//',:) = '//strStack(int2str(itZonIso(izone,:)))
     665   END DO
     666   DO izone=1,nzone
     667      WRITE(*,*)'strtrac('//TRIM(int2str(izone))//',:) = '//TRIM(strtrac(izone))
     668   END DO
     669   WRITE(*,*) 'ntracisoOR=',ntracisoOR
    1015670#endif 
    1016671
    1017         end subroutine iso_traceurs_init
    1018 
     672END SUBROUTINE iso_traceurs_init
    1019673
    1020674END MODULE isotrac_mod
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/isotrac_routines_mod.F90

    r3927 r4446  
    88! isotopes_verif a besoin de isotopes et isotrac
    99! isotrac n'a besoin que de isotopes
     10    USE infotrac_phy, ONLY: ntraciso=>ntiso, niso, index_trac=>itZonIso, ntraceurs_zone=>nzone
    1011IMPLICIT NONE
    1112
     
    1718     &           ncum,izone)
    1819
    19     USE infotrac_phy, ONLY: ntraciso,niso,index_trac
    2020    USE isotopes_mod, ONLY: ridicule,iso_eau
    2121
     
    6363     &          xtp_avantevap_cas,liq,hdiag)
    6464
    65     USE infotrac_phy, ONLY: ntraciso,niso,index_trac
    6665    USE isotopes_mod, ONLY: ridicule,iso_eau,iso_HDO,ridicule_evap
    6766    USE isotrac_mod, only: option_revap,evap_franche,izone_revap, &
     
    231230     &    nloc,ncum,nd,i,izone)
    232231
    233     USE infotrac_phy, ONLY: ntraciso,niso,index_trac
    234232    USE isotopes_mod, ONLY: iso_eau
    235233#ifdef ISOVERIF       
     
    320318     &    nloc,ncum,nd,i,izone)
    321319
    322     USE infotrac_phy, ONLY: ntraciso,niso,index_trac
    323320    USE isotopes_mod, ONLY: iso_eau
    324321#ifdef ISOVERIF
     
    408405     &    nloc,ncum,nd,i,izone)
    409406
    410     USE infotrac_phy, ONLY: ntraciso,niso,index_trac
    411407    USE isotopes_mod, ONLY: ridicule,iso_eau
    412408#ifdef ISOVERIF
     
    476472     &    nloc,ncum,nd,izone)
    477473
    478     USE infotrac_phy, ONLY: ntraciso,niso,index_trac
    479474    USE isotopes_mod, ONLY: ridicule,iso_eau
    480475#ifdef ISOVERIF
     
    643638     &    nloc,ncum,nd,i,frac_sublim,izone)
    644639
    645     USE infotrac_phy, ONLY: ntraciso,niso,index_trac
    646640    USE isotopes_mod, ONLY: ridicule,iso_eau
    647641#ifdef ISOVERIF
     
    802796     &       xtrevap_tag,liq,hdiag)
    803797
    804     USE infotrac_phy, ONLY: ntraciso,niso,index_trac
    805798    USE isotopes_mod, ONLY: ridicule,iso_eau
    806799    USE isotrac_mod, only: option_revap,evap_franche
     
    899892     &       klon,izone,ptrac)
    900893
    901     USE infotrac_phy, ONLY: ntraciso,niso,index_trac
    902894    USE isotopes_mod, ONLY: ridicule,iso_eau
    903895#ifdef ISOVERIF
     
    986978     &       klon,izone)
    987979
    988     USE infotrac_phy, ONLY: ntraciso,niso,index_trac
    989980    USE isotopes_mod, ONLY: ridicule,iso_eau
    990981#ifdef ISOVERIF
     
    10521043     &    klon,izone,zxt,xtrevap_tag)
    10531044
    1054 USE infotrac_phy, ONLY: ntraciso,niso, &
    1055         ntraceurs_zone,index_trac
    10561045#ifdef ISOVERIF
    10571046USE isotopes_verif_mod
     
    11241113      USE isotrac_mod, only: use_bassin_atlantic,use_bassin_medit, &
    11251114&       use_bassin_indian,use_bassin_austral,use_bassin_pacific, &
    1126 &       use_bassin_merarabie,use_bassin_golfebengale,use_bassin_indiansud, &
    1127 &       use_bassin_tropics,use_bassin_midlats,use_bassin_hauteslats, &
     1115&       use_bassin_MerArabie,use_bassin_BengalGolf,use_bassin_SouthIndian, &
     1116&       use_bassin_tropics,use_bassin_midlats,use_bassin_HighLats, &
    11281117&       bassin_atlantic,bassin_medit, &
    11291118&       bassin_indian,bassin_austral,bassin_pacific, &
    1130 &       bassin_merarabie,bassin_golfebengale,bassin_indiansud, &
    1131 &       bassin_tropics,bassin_midlats,bassin_hauteslats
     1119&       bassin_MerArabie,bassin_BengalGolf,bassin_SouthIndian, &
     1120&       bassin_tropics,bassin_midlats,bassin_HighLats
    11321121      implicit none
    11331122      ! répond true si lat,lon se trouve dans le bassin numéroté bassin
     
    11481137      write(*,*) 'is_in_basin 84: entree,bassin=',bassin
    11491138#endif
    1150       if ((use_bassin_atlantic.eq.1).and. &
    1151      &           (bassin.eq.bassin_atlantic)) then
     1139      if (use_bassin_atlantic .and. bassin==bassin_atlantic) then
    11521140#ifdef ISOVERIF           
    11531141          write(*,*) 'bassin Atlantique?'
     
    11801168          endif
    11811169
    1182       else if ((use_bassin_medit.eq.1).and. &
    1183      &           (bassin.eq.bassin_medit)) then
     1170      else if (use_bassin_medit .and. bassin==bassin_medit) then
    11841171#ifdef ISOVERIF           
    11851172          write(*,*) 'bassin Medit?'
     
    11941181          endif
    11951182
    1196       else if ((use_bassin_indian.eq.1).and. &
    1197      &           (bassin.eq.bassin_indian)) then
     1183      else if (use_bassin_indian .and. bassin==bassin_indian) then
    11981184#ifdef ISOVERIF           
    11991185          write(*,*) 'bassin indian?'
     
    12101196          endif   
    12111197
    1212       else if ((use_bassin_indiansud.eq.1).and. &
    1213      &           (bassin.eq.bassin_indiansud)) then
     1198      else if (use_bassin_SouthIndian .and. bassin==bassin_SouthIndian) then
    12141199#ifdef ISOVERIF           
    12151200          write(*,*) 'bassin indian hemisphere Sud?'
     
    12201205          endif
    12211206         
    1222       else if ((use_bassin_merarabie.eq.1).and. &
    1223      &           (bassin.eq.bassin_merarabie)) then
     1207      else if (use_bassin_MerArabie .and. bassin==bassin_MerArabie) then
    12241208#ifdef ISOVERIF           
    12251209          write(*,*) 'bassin Mer d''Arabie?'
     
    12301214          endif
    12311215
    1232       else if ((use_bassin_golfebengale.eq.1).and. &
    1233      &           (bassin.eq.bassin_golfebengale)) then
     1216      else if (use_bassin_BengalGolf .and. bassin==bassin_BengalGolf) then
    12341217#ifdef ISOVERIF           
    12351218          write(*,*) 'bassin Golfe du Bengale?'
     
    12401223          endif         
    12411224
    1242       else if ((use_bassin_pacific.eq.1).and. &
    1243      &           (bassin.eq.bassin_pacific)) then
     1225      else if (use_bassin_pacific .and. bassin==bassin_pacific) then
    12441226#ifdef ISOVERIF           
    12451227          write(*,*) 'bassin Pacific?'
     
    12781260          endif
    12791261
    1280       else if ((use_bassin_austral.eq.1).and. &
    1281      &           (bassin.eq.bassin_austral)) then 
     1262      else if (use_bassin_austral .and. bassin==bassin_austral) then 
    12821263#ifdef ISOVERIF           
    12831264          write(*,*) 'bassin austral?'
     
    12881269          endif 
    12891270
    1290       else if ((use_bassin_hauteslats.eq.1).and. &
    1291      &           (bassin.eq.bassin_hauteslats)) then 
     1271      else if (use_bassin_HighLats .and. bassin==bassin_HighLats) then 
    12921272#ifdef ISOVERIF           
    12931273          write(*,*) 'bassin hautes lats?'
     
    12981278          endif
    12991279
    1300       else if ((use_bassin_tropics.eq.1).and. &
    1301      &           (bassin.eq.bassin_tropics)) then 
     1280      else if (use_bassin_tropics .and. bassin==bassin_tropics) then 
    13021281#ifdef ISOVERIF           
    13031282          write(*,*) 'bassin tropics?'
     
    13081287          endif
    13091288
    1310        else if ((use_bassin_midlats.eq.1).and. &
    1311      &           (bassin.eq.bassin_midlats)) then 
     1289       else if (use_bassin_midlats .and. bassin==bassin_midlats) then 
    13121290#ifdef ISOVERIF           
    13131291          write(*,*) 'bassin mid lats?'
     
    13251303          write(*,*) 'bassin_indian=' ,bassin_indian
    13261304          write(*,*) 'bassin_austral=' ,bassin_austral
    1327           write(*,*) 'bassin_merarabie=' ,bassin_merarabie
    1328           write(*,*) 'bassin_golfebengale=' ,bassin_golfebengale
    1329           write(*,*) 'bassin_indiansud=' ,bassin_indiansud
     1305          write(*,*) 'bassin_MerArabie=' ,bassin_MerArabie
     1306          write(*,*) 'bassin_BengalGolf=' ,bassin_BengalGolf
     1307          write(*,*) 'bassin_SouthIndian=' ,bassin_SouthIndian
    13301308          write(*,*) 'use_bassin_atlantic=' ,use_bassin_atlantic 
    13311309          write(*,*) 'use_bassin_medit=' ,use_bassin_medit
    13321310          write(*,*) 'use_bassin_indian=' ,use_bassin_indian
    13331311          write(*,*) 'use_bassin_austral=' ,use_bassin_austral
    1334           write(*,*) 'use_bassin_merarabie=' ,use_bassin_merarabie
    1335           write(*,*) 'use_bassin_golfebengale=' ,use_bassin_golfebengale
    1336           write(*,*) 'use_bassin_indiansud=' ,use_bassin_indiansud
     1312          write(*,*) 'use_bassin_MerArabie=' ,use_bassin_MerArabie
     1313          write(*,*) 'use_bassin_BengalGolf=' ,use_bassin_BengalGolf
     1314          write(*,*) 'use_bassin_SouthIndian=' ,use_bassin_SouthIndian
    13371315          stop
    13381316      endif
     
    13421320
    13431321      subroutine find_bassin(lat,lon,bassin)
    1344       use isotrac_mod, only: izone_poubelle,ntraceurs_zone,option_traceurs, &
     1322      use isotrac_mod, only: izone_poubelle,ntraceurs_zone=>ntiso,option_traceurs, &
    13451323&        bassin_map
    13461324#ifdef ISOVERIF
     
    15171495        subroutine isotrac_recolorise_tmin(xt,t)
    15181496        USE dimphy, only: klon, klev
    1519         USE infotrac_phy, ONLY: ntraciso,niso, &
    1520         ntraceurs_zone,index_trac
    15211497        USE isotrac_mod, only: zone_temp,nzone_temp
    15221498#ifdef ISOVERIF
     
    16031579        subroutine isotrac_recolorise_tmin_sfrev(xt,t)
    16041580        USE dimphy, only: klon,klev
    1605         USE infotrac_phy, ONLY: ntraciso,niso, &
    1606         ntraceurs_zone,index_trac
    16071581        USE isotrac_mod, only: nzone_temp,zone_temp
    16081582#ifdef ISOVERIF
     
    16611635        subroutine isotrac_recolorise_saturation(xt,rh,lat,pres)
    16621636        USE dimphy, only: klon,klev
    1663         USE infotrac_phy, ONLY: ntraciso,niso, &
    1664         ntraceurs_zone,index_trac
    16651637#ifdef ISOVERIF
    16661638        USE isotopes_verif_mod
     
    17271699        subroutine isotrac_recolorise_boite(xt,boite_map)
    17281700        USE dimphy, only: klon,klev
    1729         USE infotrac_phy, ONLY: ntraciso,niso, &
    1730         ntraceurs_zone,index_trac
    17311701#ifdef ISOVERIF
    17321702        USE isotopes_verif_mod
     
    17811751        subroutine isotrac_recolorise_extra(xt,rlat)
    17821752        USE dimphy, only: klon,klev
    1783         USE infotrac_phy, ONLY: ntraciso,niso, &
    1784         ntraceurs_zone,index_trac
    17851753        usE isotrac_mod, only: lim_tag20,izone_trop,izone_extra
    17861754#ifdef ISOVERIF
     
    18301798        subroutine isotrac_recolorise_conv(xt,rlat,presnivs,rain_con)
    18311799        USE dimphy, only: klon,klev
    1832         USE infotrac_phy, ONLY: ntraciso,niso, &
    1833         ntraceurs_zone,index_trac
    18341800        use isotrac_mod, only: lim_precip_tag22, &
    18351801&       izone_conv_BT,izone_conv_UT
     
    19021868        subroutine boite_AMMA_init(lat,lon,presnivs,boite_map)
    19031869        USE dimphy, only: klon,klev
    1904         USE infotrac_phy, ONLY: ntraciso,niso, &
    1905         ntraceurs_zone,index_trac
    19061870#ifdef ISOVERIF
    19071871        USE isotopes_verif_mod
     
    19571921        subroutine boite_UT_extra_init(lat,lon,presnivs,boite_map)
    19581922        USE dimphy, only: klon,klev
    1959         USE infotrac_phy, ONLY: ntraciso,niso, &
    1960         ntraceurs_zone,index_trac
    19611923        use isotrac_mod, only: izone_extra,izone_trop
    19621924#ifdef ISOVERIF
     
    20952057     &           seuil_in)
    20962058        USE dimphy, only: klon,klev
    2097         USE infotrac_phy, ONLY: ntraciso,niso, &
    2098         ntraceurs_zone,index_trac
    20992059        USE isotopes_mod, only: bidouille_anti_divergence,iso_eau
    21002060        use isotrac_mod, only: option_seuil_tag_tmin,izone_cond, &
     
    23042264        subroutine bassin_map_init_opt20(lat,bassin_map)
    23052265        USE dimphy, only: klon
    2306         USE infotrac_phy, ONLY: ntraciso,niso, &
    2307         ntraceurs_zone,index_trac
    23082266        use isotrac_mod, only: izone_cont,izone_trop,lim_tag20
    23092267#ifdef ISOVERIF
     
    23342292        USE geometry_mod, ONLY : latitude_deg
    23352293        USE dimphy, only: klon,klev
    2336         use infotrac_phy, only: ntraciso
    23372294        use isotrac_mod, only: option_traceurs,boite_map
    23382295        implicit none
     
    23652322        subroutine iso_verif_traceur_jbid_vect(x,n,m)
    23662323        USE isotopes_mod, ONLY: bidouille_anti_divergence,iso_eau,ridicule
    2367         USE infotrac_phy, ONLY: index_trac,niso,ntraciso
    2368         use isotrac_mod, only: ntraceurs_zone
     2324        !use isotrac_mod, only: ntraceurs_zone=>nzone
     2325        USE infotrac_phy, ONLY: ntraceurs_zone=>nzone
    23692326        implicit none
    23702327       
     
    24302387        subroutine iso_verif_traceur_jbidouille(x)
    24312388        USE isotopes_mod, ONLY: bidouille_anti_divergence,iso_eau,ridicule
    2432         USE infotrac_phy, ONLY: index_trac,niso,ntraciso,ntraceurs_zone
    24332389        implicit none
    24342390       
     
    24702426        subroutine iso_verif_traceur_jbid_pos(x)
    24712427        USE isotopes_mod, ONLY: bidouille_anti_divergence,iso_eau,ridicule
    2472         USE infotrac_phy, ONLY: index_trac,niso,ntraciso,ntraceurs_zone
    24732428!#ifdef ISOVERIF
    24742429!        use isotopes_verif_mod, only: iso_verif_traceur_pbidouille
     
    25442499        subroutine iso_verif_traceur_jbid_pos_vect(n,m,x)
    25452500        USE isotopes_mod, ONLY: bidouille_anti_divergence,iso_eau,ridicule
    2546         USE infotrac_phy, ONLY: index_trac,niso,ntraciso,ntraceurs_zone
    25472501#ifdef ISOVERIF
    25482502        USE isotopes_verif_mod
     
    26252579        subroutine iso_verif_traceur_jbid_pos2(x,q)
    26262580        USE isotopes_mod, ONLY: bidouille_anti_divergence,iso_eau,ridicule
    2627         USE infotrac_phy, ONLY: index_trac,niso,ntraciso,ntraceurs_zone
    26282581#ifdef ISOVERIF
    26292582        use isotopes_verif_mod
     
    26962649        subroutine iso_verif_traceur_jbid_vect1D(x,n)
    26972650        USE isotopes_mod, ONLY: bidouille_anti_divergence,iso_eau,ridicule
    2698         USE infotrac_phy, ONLY: index_trac,niso,ntraciso,ntraceurs_zone
    26992651        implicit none
    27002652       
     
    27392691
    27402692        subroutine iso_verif_traceur_pbidouille(x,err_msg)
    2741         USE infotrac_phy, ONLY: ntraciso
    27422693        use isotopes_verif_mod
    27432694        implicit none
     
    27652716
    27662717        function iso_verif_traceur_pbid_ns(x,err_msg)
    2767         USE infotrac_phy, ONLY: ntraciso
    27682718        use isotopes_mod, ONLY: iso_HDO,bidouille_anti_divergence
    27692719        use isotrac_mod, only: ridicule_trac
     
    28282778
    28292779        subroutine iso_verif_traceur_pbid_vect(x,n,m,err_msg)
    2830         USE infotrac_phy, ONLY: ntraciso
    28312780        use isotopes_mod, ONLY: iso_HDO,bidouille_anti_divergence
    28322781        use isotopes_verif_mod
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/limit_read_mod.F90

    r3927 r4446  
    281281    USE indice_sol_mod
    282282#ifdef ISO
    283     !USE infotrac_phy, ONLY: use_iso
    284283    USE isotopes_mod, ONLY : iso_HTO,ok_prod_nucl_tritium
    285284#ifdef ISOVERIF
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/ocean_forced_mod.F90

    r4033 r4446  
    4242    use config_ocean_skin_m, only: activate_ocean_skin
    4343#ifdef ISO
    44   USE infotrac_phy, ONLY: ntraciso,niso
     44  USE infotrac_phy, ONLY: ntiso,niso
    4545    USE isotopes_routines_mod, ONLY: calcul_iso_surf_oce_vectall, &
    4646&       calcul_iso_surf_sic_vectall   
     
    7373
    7474#ifdef ISO
    75     REAL, DIMENSION(ntraciso,klon), INTENT(IN)    :: xtprecip_rain, xtprecip_snow
    76     REAL, DIMENSION(ntraciso,klon), INTENT(IN)    :: xtspechum
     75    REAL, DIMENSION(ntiso,klon), INTENT(IN)  :: xtprecip_rain, xtprecip_snow
     76    REAL, DIMENSION(ntiso,klon), INTENT(IN)  :: xtspechum
    7777    real, dimension(klon), intent(IN) :: rlat
    7878#endif
     
    9898
    9999#ifdef ISO     
    100     REAL, DIMENSION(ntraciso,klon), INTENT(OUT)    :: xtevap ! isotopes in evaporation flux
     100    REAL, DIMENSION(ntiso,klon), INTENT(OUT) :: xtevap ! isotopes in evaporation flux
    101101    REAL, DIMENSION(klon), INTENT(out)    :: h1 ! just a diagnostic, not useful for the simulation
    102102#endif
     
    271271    USE phys_output_var_mod, ONLY : sens_prec_liq_o, sens_prec_sol_o, lat_prec_liq_o, lat_prec_sol_o
    272272#ifdef ISO
    273   USE infotrac_phy, ONLY: niso,ntraciso
     273  USE infotrac_phy, ONLY: niso, ntiso
    274274    USE isotopes_routines_mod, ONLY: calcul_iso_surf_oce_vectall, &
    275275&       calcul_iso_surf_sic_vectall
     
    303303    real, intent(in):: rhoa(:) ! (knon) density of moist air  (kg / m3)
    304304#ifdef ISO
    305     REAL, DIMENSION(ntraciso,klon), INTENT(IN)    :: xtprecip_rain, xtprecip_snow
    306     REAL, DIMENSION(ntraciso,klon), INTENT(IN)    :: xtspechum
    307     REAL, DIMENSION(niso,klon), INTENT(IN)    :: Roce
    308     REAL, DIMENSION(niso,klon), INTENT(IN)        :: Rland_ice
     305    REAL, DIMENSION(ntiso,klon), INTENT(IN)    :: xtprecip_rain, xtprecip_snow
     306    REAL, DIMENSION(ntiso,klon), INTENT(IN)    :: xtspechum
     307    REAL, DIMENSION(niso,klon),  INTENT(IN)    :: Roce
     308    REAL, DIMENSION(niso,klon),  INTENT(IN)    :: Rland_ice
    309309#endif
    310310
     
    330330    REAL, DIMENSION(klon), INTENT(OUT)            :: dflux_s, dflux_l     
    331331#ifdef ISO     
    332     REAL, DIMENSION(ntraciso,klon), INTENT(OUT)    :: xtevap
     332    REAL, DIMENSION(ntiso,klon), INTENT(OUT)    :: xtevap
    333333#endif     
    334334
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/pbl_surface_mod.F90

    r4036 r4446  
    1414  USE mod_grid_phy_lmdz,   ONLY : klon_glo
    1515  USE ioipsl
    16   USE surface_data,        ONLY : type_ocean, ok_veget
     16  USE surface_data,        ONLY : type_ocean, ok_veget, landice_opt
    1717  USE surf_land_mod,       ONLY : surf_land
    1818  USE surf_landice_mod,    ONLY : surf_landice
     
    3131                                  wx_pbl_check, wx_pbl_dts_check, wx_evappot
    3232  use config_ocean_skin_m, only: activate_ocean_skin
     33#ifdef ISO
     34  USE infotrac_phy, ONLY: niso,ntraciso=>ntiso   
     35#endif
    3336
    3437  IMPLICIT NONE
     
    193196    USE indice_sol_mod
    194197    USE print_control_mod, ONLY: lunout
    195   USE infotrac_phy, ONLY: niso,ntraciso ! ajout C Risi pour isos 
    196198#ifdef ISOVERIF
    197199    USE isotopes_mod, ONLY: iso_eau,ridicule
     
    395397    USE print_control_mod,  ONLY : prt_level,lunout
    396398#ifdef ISO
    397   USE infotrac_phy, ONLY: ntraciso,niso ! ajout C Risi pour isos   
    398399  USE isotopes_mod, ONLY: Rdefault,iso_eau
    399400#ifdef ISOVERIF
     
    405406#endif
    406407    USE ioipsl_getin_p_mod, ONLY : getin_p
    407     use phys_state_var_mod, only: ds_ns, dt_ns, delta_sst, delta_sal, zsig, zmea
    408     use phys_output_var_mod, only: dter, dser, tkt, tks, taur, sss
     408    use phys_state_var_mod, only: ds_ns, dt_ns, delta_sst, delta_sal, dter, &
     409         dser, dt_ds, zsig, zmea
     410    use phys_output_var_mod, only: tkt, tks, taur, sss
    409411#ifdef CPP_XIOS
    410412    USE wxios, ONLY: missing_val
     
    10281030    ! Martin
    10291031
    1030     REAL, DIMENSION(klon):: ydelta_sst, ydelta_sal, yds_ns, ydt_ns, ydter, ydser, &
    1031          ytkt, ytks, ytaur, ysss
    1032     ! compression of delta_sst, delta_sal, ds_ns, dt_ns, dter, dser, tkt, tks,
    1033     ! taur, sss on ocean points
     1032    REAL, DIMENSION(klon):: ydelta_sst, ydelta_sal, yds_ns, ydt_ns, ydter, &
     1033         ydser, ydt_ds, ytkt, ytks, ytaur, ysss
     1034    ! compression of delta_sst, delta_sal, ds_ns, dt_ns, dter, dser,
     1035    ! dt_ds, tkt, tks, taur, sss on ocean points
    10341036
    10351037#ifdef ISO
     
    18121814             ydelta_sal(:knon) = delta_sal(ni(:knon))
    18131815             ydelta_sst(:knon) = delta_sst(ni(:knon))
     1816             ydter(:knon) = dter(ni(:knon))
     1817             ydser(:knon) = dser(ni(:knon))
     1818             ydt_ds(:knon) = dt_ds(ni(:knon))
    18141819          end if
    18151820         
     
    23812386       CASE(is_lic)
    23822387          ! Martin
    2383           CALL surf_landice(itap, dtime, knon, ni, &
    2384                rlon, rlat, debut, lafin, &
    2385                yrmu0, ylwdown, yalb, zgeo1, &
    2386                ysolsw, ysollw, yts, ypplay(:,1), &
    2387 !!jyg               ycdragh, ycdragm, yrain_f, ysnow_f, yt(:,1), yq(:,1),&
    2388                ycdragh, ycdragm, yrain_f, ysnow_f, yt1, yq1,&
    2389                AcoefH, AcoefQ, BcoefH, BcoefQ, &
    2390                AcoefU, AcoefV, BcoefU, BcoefV, &
    2391                ypsref, yu1, yv1, ygustiness, yrugoro, pctsrf, &
    2392                ysnow, yqsurf, yqsol, yagesno, &
    2393                ytsoil, yz0m, yz0h, SFRWL, yalb_dir_new, yalb_dif_new, yevap,yfluxsens,yfluxlat, &
    2394                ytsurf_new, y_dflux_t, y_dflux_q, &
    2395                yzmea, yzsig, ycldt, &
    2396                ysnowhgt, yqsnow, ytoice, ysissnow, &
    2397                yalb3_new, yrunoff, &
    2398                y_flux_u1, y_flux_v1 &
    2399 #ifdef ISO
    2400            &    ,yxtrain_f, yxtsnow_f,yxt1,yRland_ice &
    2401            &    ,yxtsnow,yxtsol,yxtevap &
     2388          IF (landice_opt .LT. 2) THEN
     2389             ! Land ice is treated by LMDZ and not by ORCHIDEE
     2390             
     2391             CALL surf_landice(itap, dtime, knon, ni, &
     2392                  rlon, rlat, debut, lafin, &
     2393                  yrmu0, ylwdown, yalb, zgeo1, &
     2394                  ysolsw, ysollw, yts, ypplay(:,1), &
     2395                  !!jyg               ycdragh, ycdragm, yrain_f, ysnow_f, yt(:,1), yq(:,1),&
     2396                  ycdragh, ycdragm, yrain_f, ysnow_f, yt1, yq1,&
     2397                  AcoefH, AcoefQ, BcoefH, BcoefQ, &
     2398                  AcoefU, AcoefV, BcoefU, BcoefV, &
     2399                  ypsref, yu1, yv1, ygustiness, yrugoro, pctsrf, &
     2400                  ysnow, yqsurf, yqsol, yagesno, &
     2401                  ytsoil, yz0m, yz0h, SFRWL, yalb_dir_new, yalb_dif_new, yevap,yfluxsens,yfluxlat, &
     2402                  ytsurf_new, y_dflux_t, y_dflux_q, &
     2403                  yzmea, yzsig, ycldt, &
     2404                  ysnowhgt, yqsnow, ytoice, ysissnow, &
     2405                  yalb3_new, yrunoff, &
     2406                  y_flux_u1, y_flux_v1 &
     2407#ifdef ISO
     2408                  &    ,yxtrain_f, yxtsnow_f,yxt1,yRland_ice &
     2409                  &    ,yxtsnow,yxtsol,yxtevap &
    24022410#endif             
    2403            &    )
    2404 
    2405 !jyg<
    2406 !!          alb3_lic(:)=0.
    2407 !>jyg
    2408           DO j = 1, knon
    2409              i = ni(j)
    2410              alb3_lic(i) = yalb3_new(j)
    2411              snowhgt(i)   = ysnowhgt(j)
    2412              qsnow(i)     = yqsnow(j)
    2413              to_ice(i)    = ytoice(j)
    2414              sissnow(i)   = ysissnow(j)
    2415              runoff(i)    = yrunoff(j)
    2416           ENDDO
    2417           ! Martin
    2418 ! Special DICE MPL 05082013 puis BOMEX MPL 20150410
    2419        IF (ok_prescr_ust) THEN
    2420           DO j=1,knon
    2421           y_flux_u1(j)=ycdragm(j)*(1.+sqrt(yu(j,1)*yu(j,1)+yv(j,1)*yv(j,1)))*yu(j,1)*ypplay(j,1)/RD/yt(j,1)
    2422           y_flux_v1(j)=ycdragm(j)*(1.+sqrt(yu(j,1)*yu(j,1)+yv(j,1)*yv(j,1)))*yv(j,1)*ypplay(j,1)/RD/yt(j,1)
    2423           ENDDO
    2424       ENDIF
    2425 
     2411                  &    )
     2412             
     2413             !jyg<
     2414             !!          alb3_lic(:)=0.
     2415             !>jyg
     2416             DO j = 1, knon
     2417                i = ni(j)
     2418                alb3_lic(i) = yalb3_new(j)
     2419                snowhgt(i)   = ysnowhgt(j)
     2420                qsnow(i)     = yqsnow(j)
     2421                to_ice(i)    = ytoice(j)
     2422                sissnow(i)   = ysissnow(j)
     2423                runoff(i)    = yrunoff(j)
     2424             ENDDO
     2425             ! Martin
     2426             ! Special DICE MPL 05082013 puis BOMEX MPL 20150410
     2427             IF (ok_prescr_ust) THEN
     2428                DO j=1,knon
     2429                   y_flux_u1(j)=ycdragm(j)*(1.+sqrt(yu(j,1)*yu(j,1)+yv(j,1)*yv(j,1)))*yu(j,1)*ypplay(j,1)/RD/yt(j,1)
     2430                   y_flux_v1(j)=ycdragm(j)*(1.+sqrt(yu(j,1)*yu(j,1)+yv(j,1)*yv(j,1)))*yv(j,1)*ypplay(j,1)/RD/yt(j,1)
     2431                ENDDO
     2432             ENDIF
     2433             
    24262434#ifdef ISOVERIF
    2427         do j=1,knon
    2428           do ixt=1,ntraciso
    2429             call iso_verif_noNaN(yxtevap(ixt,j), &
    2430          &      'pbl_surface 1095a: apres surf_landice')
    2431             call iso_verif_noNaN(yxtsol(ixt,j), &
    2432          &      'pbl_surface 1095b: apres surf_landice')
    2433           enddo
    2434         enddo
     2435             do j=1,knon
     2436                do ixt=1,ntraciso
     2437                   call iso_verif_noNaN(yxtevap(ixt,j), &
     2438                        &      'pbl_surface 1095a: apres surf_landice')
     2439                   call iso_verif_noNaN(yxtsol(ixt,j), &
     2440                        &      'pbl_surface 1095b: apres surf_landice')
     2441                enddo
     2442             enddo
    24352443#endif
    24362444#ifdef ISOVERIF
    2437         !write(*,*) 'pbl_surface_mod 1060: sortie surf_landice'
    2438         do j=1,knon
    2439           if (iso_eau.gt.0) then     
    2440                  call iso_verif_egalite(yxtsnow(iso_eau,j), &
    2441      &                  ysnow(j),'pbl_surf_mod 1064')
    2442            endif !if (iso_eau.gt.0) then
    2443         enddo !do i=1,klon
    2444 #endif
    2445          
     2445             !write(*,*) 'pbl_surface_mod 1060: sortie surf_landice'
     2446             do j=1,knon
     2447                if (iso_eau.gt.0) then     
     2448                   call iso_verif_egalite(yxtsnow(iso_eau,j), &
     2449                        &                  ysnow(j),'pbl_surf_mod 1064')
     2450                endif !if (iso_eau.gt.0) then
     2451             enddo !do i=1,klon
     2452#endif
     2453          END IF
    24462454       CASE(is_oce)
    24472455           CALL surf_ocean(rlon, rlat, ysolsw, ysollw, yalb_vis, &
     
    24582466               y_flux_u1, y_flux_v1, ydelta_sst(:knon), ydelta_sal(:knon), &
    24592467               yds_ns(:knon), ydt_ns(:knon), ydter(:knon), ydser(:knon), &
    2460                ytkt(:knon), ytks(:knon), ytaur(:knon), ysss &
     2468               ydt_ds(:knon), ytkt(:knon), ytks(:knon), ytaur(:knon), ysss &
    24612469#ifdef ISO
    24622470         &      ,yxtrain_f, yxtsnow_f,yxt1,Roce, &
     
    33903398          taur(ni(:knon)) = ytaur(:knon)
    33913399          sss(ni(:knon)) = ysss(:knon)
     3400
     3401          if (activate_ocean_skin == 2 .and. type_ocean == "couple") then
     3402             dt_ds = missing_val
     3403             dt_ds(ni(:knon)) = ydt_ds(:knon)
     3404          end if
    33923405       end if
    33933406
     
    40514064    USE indice_sol_mod
    40524065#ifdef ISO
    4053   USE infotrac_phy, ONLY: ntraciso,niso ! ajout C Risi pour isos 
    40544066#ifdef ISOVERIF
    40554067    USE isotopes_mod, ONLY: iso_eau,ridicule
     
    41284140
    41294141    USE indice_sol_mod
    4130     use phys_state_var_mod, only: delta_sal, ds_ns, dt_ns, delta_sst
     4142    use phys_state_var_mod, only: delta_sal, ds_ns, dt_ns, delta_sst, dter, &
     4143         dser, dt_ds
    41314144    use config_ocean_skin_m, only: activate_ocean_skin
    4132 #ifdef ISO
    4133   USE infotrac_phy, ONLY: ntraciso   
    4134 #endif
    41354145
    41364146
     
    42374247                         delta_sal(i) = 0.
    42384248                         delta_sst(i) = 0.
     4249                         dter(i) = 0.
     4250                         dser(i) = 0.
     4251                         dt_ds(i) = 0.
    42394252                      end if
    42404253                     
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/phyredem.F90

    r4089 r4446  
    3030                                du_gwd_rando, du_gwd_front, u10m, v10m, &
    3131                                treedrg, solswfdiff, delta_sal, ds_ns, dt_ns, &
    32                                 delta_sst, ratqs_inter
     32                                delta_sst, ratqs_inter, dter, dser, dt_ds
    3333#ifdef ISO
    3434  USE phys_state_var_mod, ONLY: xtsol, fxtevap,xtrain_fall, xtsnow_fall,     &
     
    3939  USE iostart, ONLY: open_restartphy, close_restartphy, enddef_restartphy, put_field, put_var
    4040  USE traclmdz_mod, ONLY : traclmdz_to_restart
    41   USE infotrac_phy, ONLY: type_trac, nqtot, tracers, nbtr, niso, ntraciso
     41  USE infotrac_phy, ONLY: type_trac, nqtot, tracers, nbtr, niso
    4242#ifdef ISO
    4343#ifdef ISOVERIF
     
    4545#endif
    4646#endif
    47   USE carbon_cycle_mod, ONLY : carbon_cycle_cpl, co2_send
     47  USE carbon_cycle_mod, ONLY : carbon_cycle_cpl, co2_send, carbon_cycle_rad, RCO2_glo
    4848  USE indice_sol_mod, ONLY: nbsrf, is_oce, is_sic, is_ter, is_lic, epsfra
    4949  USE surface_data, ONLY: type_ocean, version_ocean
     
    130130
    131131  ! co2_ppm0 : initial value of atmospheric CO2
    132   tab_cntrl(16) = co2_ppm0
     132  ! tab_cntrl(16) = co2_ppm0
     133
     134  !  PC -- initial value of RCO2 for the radiation scheme
     135  !  tab_cntrl(17) = co2_ppm * 1.0e-06 * RMCO2 / RMD
     136  IF (carbon_cycle_rad) tab_cntrl(17) = RCO2_glo
     137  !PRINT*, "PC : phyredem RCO2_glo =",RCO2_glo
    133138
    134139  DO pass=1,2   ! pass=1 netcdf definition ; pass=2 netcdf write
     
    171176    CALL put_field(pass,"FSIC", "fraction glace mer", pctsrf(:, is_sic))
    172177
    173     IF(nbsrf>99) THEN
    174       PRINT*, "Trop de sous-mailles";  CALL abort_physic("phyredem", "", 1)
    175     END IF
    176     IF(nsoilmx>99) THEN
    177       PRINT*, "Trop de sous-surfaces"; CALL abort_physic("phyredem", "", 1)
    178     END IF
    179     IF(nsw>99) THEN
    180       PRINT*, "Trop de bandes"; CALL abort_physic("phyredem", "", 1)
    181     END IF
     178    IF(nbsrf  >99) CALL abort_physic("phyredem", "Trop de sous-mailles", 1)
     179    IF(nsoilmx>99) CALL abort_physic("phyredem", "Trop de sous-mailles", 1)
     180    IF(nsw    >99) CALL abort_physic("phyredem", "Trop de bandes", 1)
    182181
    183182!    Surface variables
     
    345344
    346345
    347     ! trs from traclmdz_mod
    348     IF (type_trac == 'lmdz') THEN
    349        CALL traclmdz_to_restart(trs)
    350        it = 0
    351        DO iq = 1, nqtot
    352           IF(.NOT.(tracers(iq)%isAdvected .AND. tracers(iq)%isInPhysics)) CYCLE
    353           it = it+1
    354           CALL put_field(pass,"trs_"//tracers(iq)%name, "", trs(:, it))
    355        END DO
    356     END IF
    357 
    358     IF (type_trac == 'co2i' .OR. type_trac == 'inco') THEN
     346    IF (ANY(type_trac == ['co2i','inco'])) THEN
    359347       IF (carbon_cycle_cpl) THEN
    360348          IF (.NOT. ALLOCATED(co2_send)) THEN
     
    365353          CALL put_field(pass,"co2_send", "co2_ppm for coupling", co2_send)
    366354       END IF
     355
     356    ! trs from traclmdz_mod
     357    ELSE IF (type_trac == 'lmdz') THEN
     358       CALL traclmdz_to_restart(trs)
     359       it = 0
     360       DO iq = 1, nqtot
     361          IF(.NOT.(tracers(iq)%isAdvected .AND. tracers(iq)%isInPhysics)) CYCLE
     362          it = it+1
     363          CALL put_field(pass,"trs_"//tracers(iq)%name, "", trs(:, it))
     364       END DO
    367365    END IF
    368366
     
    395393          CALL put_field(pass, "delta_SST", &
    396394               "ocean-air interface temperature minus bulk SST", delta_sst)
     395          CALL put_field(pass, "dter", &
     396               "ocean-air interface temperature minus subskin temperature", &
     397               dter)
     398          CALL put_field(pass, "dser", &
     399               "ocean-air interface salinity minus subskin salinity", dser)
     400          CALL put_field(pass, "dt_ds", &
     401               "(tks / tkt) * dTer", dt_ds)
    397402       end if
    398403       
     
    485490        xtrain_fall,xtsnow_fall, ql_ancien,xtl_ancien,qs_ancien,xts_ancien, &
    486491        xtsol,fxtevap
    487       USE infotrac_phy,ONLY: niso, ntraciso
     492      USE infotrac_phy,ONLY: niso, ntiso
    488493      !USE control_mod
    489494      USE indice_sol_mod, ONLY: nbsrf
    490495      USE iostart, ONLY: put_field
    491       USE isotopes_mod, ONLY: striso,iso_eau
     496      USE isotopes_mod, ONLY: isoName,iso_eau
    492497#ifdef ISOVERIF
    493498      USE isotopes_verif_mod
     
    509514      !REAL xtsol(niso,klon)
    510515      REAL xtsnow(niso,klon,nbsrf)
    511       !REAL xtevap(ntraciso,klon,nbsrf)     
     516      !REAL xtevap(ntiso,klon,nbsrf)     
    512517      REAL xtrun_off_lic_0(niso,klon)
    513518      REAL Rland_ice(niso,klon)
     
    566571#endif
    567572
    568    do ixt=1,ntraciso
    569 
    570      if (ixt.le.niso) then
    571         outiso=striso(ixt)
    572      else
    573 #ifdef ISOTRAC
    574         iiso=index_iso(ixt)
    575         izone=index_zone(ixt)       
    576         outiso=striso(iiso)//strtrac(izone)
    577 #else
    578         write(*,*) 'phyredem 546: ixt,ntraciso=', ixt,ntraciso
    579         stop
    580 #endif
    581      endif !if (ixt.le.niso) then
     573   do ixt=1,ntiso
     574
     575      outiso = TRIM(isoName(ixt))
     576      i = INDEX(outiso, '_', .TRUE.)
     577      outiso = outiso(1:i-1)//outiso(i+1:LEN_TRIM(outiso))
    582578      write(*,*) 'phyredem 550: ixt,outiso=',ixt,TRIM(outiso)
    583579     
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/phys_local_var_mod.F90

    r4118 r4446  
    726726USE infotrac_phy, ONLY : nbtr
    727727#ifdef ISO
    728 USE infotrac_phy, ONLY : ntraciso,niso
     728USE infotrac_phy, ONLY : ntraciso=>ntiso,niso
    729729#endif
    730730USE aero_mod
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/phys_output_mod.F90

    r4120 r4446  
    3535    USE iophy
    3636    USE dimphy
    37     USE infotrac_phy, ONLY: nqtot, tracers, type_trac, niso, ntraciso
     37    USE infotrac_phy, ONLY: nqtot, tracers, niso, ntraciso=>ntiso
    3838    USE strings_mod,  ONLY: maxlen
    3939    USE ioipsl
     
    5252#endif
    5353#ifdef ISO
    54     USE isotopes_mod, ONLY: striso,iso_HTO
     54    USE isotopes_mod, ONLY: isoName,iso_HTO
    5555#ifdef ISOTRAC
    5656    use isotrac_mod, only: index_zone,index_iso,strtrac
     
    122122
    123123#ifdef ISO
    124     CHARACTER(LEN=LEN(striso)) :: outiso
     124    CHARACTER(LEN=maxlen) :: outiso
    125125    CHARACTER(LEN=20) :: unit
    126126#endif
     
    546546    write(*,*) 'phys_output_mid 589'
    547547    do ixt=1,ntraciso
    548       if (ixt <= niso) then
    549         outiso=striso(ixt)
    550       else
    551 #ifdef ISOTRAC
    552         iiso=index_iso(ixt)
    553         izone=index_zone(ixt)       
    554         outiso=striso(iiso)//strtrac(izone)
    555 #else
    556         write(*,*) 'phys_output_mod 546: ixt,ntraciso=', ixt,ntraciso
    557         stop
    558 #endif
    559       endif
     548      outiso = TRIM(isoName(ixt))
     549      i = INDEX(outiso, '_', .TRUE.)
     550      outiso = outiso(1:i-1)//outiso(i+1:LEN_TRIM(outiso))
    560551
    561552      flag = [1,  1,  1, 10,  5, 10, 11, 11, 11, 11]; unit = 'kg/(s*m2)'
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/phys_output_var_mod.F90

    r3940 r4446  
    135135  ! Ocean-atmosphere interface, subskin ocean and near-surface ocean:
    136136 
    137   REAL, ALLOCATABLE, SAVE:: dter(:)
    138   ! Temperature variation in the diffusive microlayer, that is
    139   ! ocean-air interface temperature minus subskin temperature. In K.
    140      
    141   REAL, SAVE, ALLOCATABLE:: dser(:)
    142   ! Temperature variation in the diffusive microlayer, that is
    143   ! subskin temperature minus ocean-air interface temperature. In K.
    144 
    145   REAL, SAVE, ALLOCATABLE:: tkt(:)
     137  REAL, SAVE, ALLOCATABLE:: tkt(:) ! (klon)
    146138  ! épaisseur (m) de la couche de diffusion thermique (microlayer)
    147139  ! cool skin thickness
    148140
    149   REAL, SAVE, ALLOCATABLE:: tks(:)
     141  REAL, SAVE, ALLOCATABLE:: tks(:) ! (klon)
    150142  ! épaisseur (m) de la couche de diffusion de masse (microlayer)
    151143 
    152   REAL, SAVE, ALLOCATABLE:: taur(:) ! momentum flux due to rain, in Pa
    153 
    154   REAL, SAVE, ALLOCATABLE:: sss(:)
     144  REAL, SAVE, ALLOCATABLE:: taur(:) ! (klon) momentum flux due to rain, in Pa
     145
     146  REAL, SAVE, ALLOCATABLE:: sss(:) ! (klon)
    155147  ! bulk salinity of the surface layer of the ocean, in ppt
    156148 
    157   !$OMP THREADPRIVATE(dter, dser, tkt, tks, taur, sss)
     149  !$OMP THREADPRIVATE(tkt, tks, taur, sss)
    158150
    159151CONTAINS
     
    216208    IF (ok_gwd_rando) allocate(zustr_gwd_rando(klon), zvstr_gwd_rando(klon))
    217209
    218     if (activate_ocean_skin >= 1) allocate(dter(klon), dser(klon), tkt(klon), &
    219          tks(klon), taur(klon), sss(klon))
     210    if (activate_ocean_skin >= 1) allocate(tkt(klon), tks(klon), taur(klon), &
     211         sss(klon))
    220212
    221213  END SUBROUTINE phys_output_var_init
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/physiq_mod.F90

    r4124 r4446  
    3939    USE ioipsl_getin_p_mod, ONLY : getin_p
    4040    USE indice_sol_mod
    41     USE infotrac, ONLY: iso_num, iso_indnum
    42     USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, type_trac, nqCO2, indnum_fn_num
     41    USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, type_trac
    4342    USE readTracFiles_mod, ONLY: addPhase
    44     USE strings_mod,  ONLY: strIdx, strStack, int2str
     43    USE strings_mod,  ONLY: strIdx
    4544    USE iophy
    4645    USE limit_read_mod, ONLY : init_limit_read
     
    5453    USE pbl_surface_mod, ONLY : pbl_surface
    5554    USE phyaqua_mod, only: zenang_an
     55    USE phyetat0_mod, only: phyetat0
    5656    USE phystokenc_mod, ONLY: offline, phystokenc
    5757    USE phys_cal_mod, only: year_len, mth_len, days_elapsed, jh_1jan, &
    58          year_cur, mth_cur,jD_cur, jH_cur, jD_ref, day_cur, hour
     58         year_cur, mth_cur,jD_cur, jH_cur, jD_ref, day_cur, hour, calend
    5959!!  USE phys_local_var_mod, ONLY : a long list of variables
    6060!!              ==> see below, after "CPP Keys" section
     
    6969    USE regr_horiz_time_climoz_m, ONLY: regr_horiz_time_climoz
    7070    USE regr_pr_time_av_m, only: regr_pr_time_av
    71     USE surface_data,     ONLY : type_ocean, ok_veget, landice_opt
    72     USE time_phylmdz_mod, only: annee_ref, current_time, day_ini, day_ref, &
    73           day_step_phy, itau_phy, pdtphys, raz_date, start_time, update_time
     71    USE surface_data,     ONLY : type_ocean, ok_veget
     72    USE time_phylmdz_mod, only: current_time, itau_phy, pdtphys, raz_date, update_time
    7473    USE tracinca_mod, ONLY: config_inca
    7574    USE tropopause_m,     ONLY: dyn_tropopause
    7675    USE ice_sursat_mod,  ONLY: flight_init, airplane
    7776    USE vampir
    78     USE VERTICAL_LAYERS_MOD, ONLY: aps,bps, ap, bp
    7977    USE write_field_phy
     78#ifdef CPP_XIOS
     79    USE wxios, ONLY: g_ctx, wxios_set_context
     80#endif
     81    USE lscp_ini_mod, ONLY : lscp_ini
    8082    USE lscp_mod, ONLY : lscp
     83    USE wake_ini_mod, ONLY : wake_ini
    8184    USE thermcell_ini_mod, ONLY : thermcell_ini
    8285
     
    97100
    98101
     102#ifdef INCA
     103    USE geometry_mod,      ONLY: longitude, latitude, boundslon, boundslat, ind_cell_glo
     104    USE time_phylmdz_mod,  ONLY: ndays
     105    USE infotrac_phy,      ONLY: nqCO2
     106#endif
    99107#ifdef REPROBUS
    100     USE CHEM_REP, ONLY : Init_chem_rep_xjour, &
    101          d_q_rep,d_ql_rep,d_qi_rep,ptrop,ttrop, &
    102          ztrop, gravit,itroprep, Z1,Z2,fac,B
     108    USE chem_rep, ONLY: Init_chem_rep_xjour, d_q_rep, d_ql_rep, d_qi_rep, &
     109                        ptrop, ttrop, ztrop, gravit, itroprep, Z1, Z2, fac, B
     110#endif
     111#if defined INCA || defined REPROBUS
     112    USE time_phylmdz_mod,    ONLY: annee_ref, day_ini, day_ref, start_time
     113    USE vertical_layers_mod, ONLY: aps, bps, ap, bp
    103114#endif
    104115
     
    106117#ifdef CPP_RRTM
    107118    USE YOERAD, ONLY : NRADLP
    108     USE YOESW, ONLY : RSUN
     119!    USE YOESW, ONLY : RSUN
    109120#endif
    110121
     
    116127
    117128#ifdef CPP_XIOS
    118     USE xios, ONLY: xios_update_calendar, xios_context_finalize, &
    119             xios_get_field_attr, xios_field_is_active
     129    USE xios, ONLY: xios_update_calendar, xios_context_finalize
     130    USE xios, ONLY: xios_get_field_attr, xios_field_is_active, xios_context
     131    USE xios, ONLY: xios_set_current_context
    120132    USE wxios, ONLY: missing_val, missing_val_omp
    121133#endif
     
    126138
    127139#ifdef ISO
    128     USE infotrac_phy, ONLY: iqiso,niso, ntraciso, nzone
     140    USE infotrac_phy, ONLY: iqIsoPha,niso, ntraciso=>ntiso, nzone
    129141    USE isotopes_mod, ONLY: iso_eau,iso_HDO,iso_O18,iso_O17,iso_HTO, &
    130142        & bidouille_anti_divergence,ok_bidouille_wake, &
     
    180192       d_t_ajsb,d_q_ajsb, &
    181193       d_t_ajs,d_q_ajs,d_u_ajs,d_v_ajs, &
    182        d_t_ajs_w,d_q_ajs_w, &
    183        d_t_ajs_x,d_q_ajs_x, &
     194!       d_t_ajs_w,d_q_ajs_w, &
     195!       d_t_ajs_x,d_q_ajs_x, &
    184196       !
    185197       d_t_eva,d_q_eva,d_ql_eva,d_qi_eva, &
     
    194206       d_ts, &
    195207       !
    196        d_t_oli,d_u_oli,d_v_oli, &
     208!       d_t_oli,d_u_oli,d_v_oli, &
    197209       d_t_oro,d_u_oro,d_v_oro, &
    198210       d_t_oro_gw,d_u_oro_gw,d_v_oro_gw, &
     
    313325       sij, &
    314326       !
     327       rneblsvol, &
     328       zqsatl, zqsats, &
     329       qclr, qcld, qss, qvc, rnebclr, rnebss, gamma_ss, &
     330       Tcontr, qcontr, qcontr2, fcontrN, fcontrP, &
    315331       cldemi,  &
    316332       cldfra, cldtau, fiwc,  &
     
    366382#endif
    367383       !
    368 
    369384
    370385    IMPLICIT NONE
     
    509524    !======================================================================
    510525    !
    511     INTEGER ivap          ! indice de traceurs pour vapeur d'eau
    512     PARAMETER (ivap=1)
    513     INTEGER iliq          ! indice de traceurs pour eau liquide
    514     PARAMETER (iliq=2)
    515     !CR: on ajoute la phase glace
    516     INTEGER isol          ! indice de traceurs pour eau glace
    517     PARAMETER (isol=3)
    518     INTEGER irneb         ! indice de traceurs pour fraction nuageuse LS (optional)
    519     PARAMETER (irneb=4)   
     526    ! indices de traceurs eau vapeur, liquide, glace, fraction nuageuse LS (optional)
     527    INTEGER,SAVE :: ivap, iliq, isol, irneb
     528!$OMP THREADPRIVATE(ivap, iliq, isol, irneb)
    520529    !
    521530    !
     
    585594    !
    586595    !
    587     INTEGER debug
    588596    INTEGER n
    589597    !ym      INTEGER npoints
     
    642650    ! Upmost level reached by deep convection and related variable (jyg)
    643651    !
    644     INTEGER izero
     652!    INTEGER izero
    645653    INTEGER k_upper_cv
    646654    !------------------------------------------------------------------
     
    820828    REAL beta_prec_fisrt(klon,klev) ! taux de conv de l'eau cond (fisrt)
    821829    ! RomP <<<
    822     REAL          :: calday
    823830
    824831    !IM cf FH pour Tiedtke 080604
     
    876883    !C      EXTERNAL o3cm      ! initialiser l'ozone
    877884    EXTERNAL orbite    ! calculer l'orbite terrestre
    878     EXTERNAL phyetat0  ! lire l'etat initial de la physique
    879885    EXTERNAL phyredem  ! ecrire l'etat de redemarrage de la physique
    880886    EXTERNAL suphel    ! initialiser certaines constantes
     
    941947    real zqsat(klon,klev)
    942948    !
    943     INTEGER i, k, iq, j, nsrf, ll, l, itr
     949    INTEGER i, k, iq, nsrf, l, itr
    944950#ifdef ISO
    945951    real zxt_apres(ntraciso,klon)
     
    10631069
    10641070    REAL picefra(klon,klev)
     1071    REAL zrel_mount(klon)
    10651072    !IM cf. AM 081204 END
    10661073    !
     
    12721279
    12731280#ifdef INCA
     1281    REAL :: calday, zxsnow_dummy(klon)
    12741282    ! set de variables utilisees pour l'initialisation des valeurs provenant de INCA
    12751283    REAL, DIMENSION(klon,klev,naero_grp,nbands) :: init_tauinca
     
    13201328    phys_tstep=NINT(pdtphys)
    13211329#ifdef CPP_XIOS
    1322     IF (.NOT. debut .AND. is_omp_master) CALL xios_update_calendar(itap+1)
     1330! switch to XIOS LMDZ physics context
     1331    IF (.NOT. debut .AND. is_omp_master) THEN
     1332       CALL wxios_set_context()
     1333       CALL xios_update_calendar(itap+1)
     1334    ENDIF
    13231335#endif
    13241336
     
    13541366
    13551367    IF (first) THEN
     1368       ivap = strIdx(tracers(:)%name, addPhase('H2O', 'g'))
     1369       iliq = strIdx(tracers(:)%name, addPhase('H2O', 'l'))
     1370       isol = strIdx(tracers(:)%name, addPhase('H2O', 's'))
     1371       irneb= strIdx(tracers(:)%name, addPhase('H2O', 'r'))
    13561372       CALL init_etat0_limit_unstruct
    13571373       IF (.NOT. create_etat0_limit) CALL init_limit_read(days_elapsed)
     
    14061422          WRITE (lunout, *) ' ok_ice_sursat=y requires 4 H2O tracers ', &
    14071423               '(H2O_g, H2O_l, H2O_s, H2O_r) but nqo=', nqo, '. Might as well stop here.'
     1424          abort_message='see above'
     1425          CALL abort_physic(modname,abort_message,1)
     1426       ENDIF
     1427
     1428       IF (ok_plane_h2o.AND..NOT.ok_ice_sursat) THEN
     1429          WRITE (lunout, *) ' ok_plane_h2o=y requires ok_ice_sursat=y '
     1430          abort_message='see above'
     1431          CALL abort_physic(modname,abort_message,1)
     1432       ENDIF
     1433
     1434       IF (ok_plane_contrail.AND..NOT.ok_ice_sursat) THEN
     1435          WRITE (lunout, *) ' ok_plane_contrail=y requires ok_ice_sursat=y '
    14081436          abort_message='see above'
    14091437          CALL abort_physic(modname,abort_message,1)
     
    15421570       tau_overturning_th(:)=0.
    15431571
    1544        IF (type_trac == 'inca' .OR. type_trac == 'inco') THEN
     1572       IF (ANY(type_trac == ['inca','inco'])) THEN
    15451573          ! jg : initialisation jusqu'au ces variables sont dans restart
    15461574          ccm(:,:,:) = 0.
     
    18501878!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    18511879       ! Nouvelle initialisation pour le rayonnement RRTM
    1852        !
    18531880!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    18541881
    18551882       CALL iniradia(klon,klev,paprs(1,1:klev+1))
    18561883
    1857 
    18581884!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     1885       CALL wake_ini(rg,rd,rv,prt_level)
    18591886       CALL thermcell_ini(iflag_thermals,prt_level,tau_thermals,lunout, &
    18601887   &    RG,RD,RCPD,RKAPPA,RLVTT,RETV)
     1888       IF (ok_new_lscp) then
     1889           CALL lscp_ini(pdtphys,ok_ice_sursat)
     1890       endif
     1891
     1892!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     1893
    18611894       !
    18621895!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    21542187       !c         ENDDO
    21552188       !
    2156        IF (type_trac == 'inca' .OR. type_trac == 'inco') THEN                   ! ModThL
     2189       IF (ANY(type_trac == ['inca','inco'])) THEN ! ModThL
    21572190#ifdef INCA
    21582191          CALL VTe(VTphysiq)
     
    21612194          WRITE(lunout,*) 'initial time chemini', days_elapsed, calday
    21622195
    2163           CALL chemini(  &
    2164                rg, &
    2165                ra, &
    2166                cell_area, &
    2167                latitude_deg, &
    2168                longitude_deg, &
    2169                presnivs, &
    2170                calday, &
    2171                klon, &
    2172                nqtot, &
    2173                nqo+nqCO2, &
    2174                pdtphys, &
    2175                annee_ref, &
    2176                year_cur, &
    2177                day_ref,  &
    2178                day_ini, &
    2179                start_time, &
    2180                itau_phy, &
    2181                date0, &
    2182                io_lon, &
    2183                io_lat, &
    2184                chemistry_couple, &
    2185                init_source, &
    2186                init_tauinca, &
    2187                init_pizinca, &
    2188                init_cginca, &
    2189                init_ccminca)
     2196          call init_const_lmdz( &
     2197          ndays, nbsrf, is_oce,is_sic, is_ter,is_lic, calend, &
     2198          config_inca)
     2199
     2200          CALL init_inca_geometry( &
     2201               longitude, latitude, &
     2202               boundslon, boundslat, &
     2203               cell_area, ind_cell_glo)
     2204
     2205          if (grid_type==unstructured) THEN
     2206             CALL chemini(  pplay, &
     2207                  nbp_lon, nbp_lat, &
     2208                  latitude_deg, &
     2209                  longitude_deg, &
     2210                  presnivs, &
     2211                  calday, &
     2212                  klon, &
     2213                  nqtot, &
     2214                  nqo+nqCO2, &
     2215                  pdtphys, &
     2216                  annee_ref, &
     2217                  year_cur, &
     2218                  day_ref,  &
     2219                  day_ini, &
     2220                  start_time, &
     2221                  itau_phy, &
     2222                  date0, &
     2223                  chemistry_couple, &
     2224                  init_source, &
     2225                  init_tauinca, &
     2226                  init_pizinca, &
     2227                  init_cginca, &
     2228                  init_ccminca)
     2229          ELSE
     2230             CALL chemini(  pplay, &
     2231                  nbp_lon, nbp_lat, &
     2232                  latitude_deg, &
     2233                  longitude_deg, &
     2234                  presnivs, &
     2235                  calday, &
     2236                  klon, &
     2237                  nqtot, &
     2238                  nqo+nqCO2, &
     2239                  pdtphys, &
     2240                  annee_ref, &
     2241                  year_cur, &
     2242                  day_ref,  &
     2243                  day_ini, &
     2244                  start_time, &
     2245                  itau_phy, &
     2246                  date0, &
     2247                  chemistry_couple, &
     2248                  init_source, &
     2249                  init_tauinca, &
     2250                  init_pizinca, &
     2251                  init_cginca, &
     2252                  init_ccminca, &
     2253                  io_lon, &
     2254                  io_lat)
     2255          ENDIF
    21902256
    21912257
     
    22892355
    22902356
     2357
    22912358    ENDIF
    22922359    !
     
    23932460          ql_seri(i,k) = qx(i,k,iliq)
    23942461          !CR: ATTENTION, on rajoute la variable glace
    2395           IF (nqo.eq.2) THEN
     2462          IF (nqo.EQ.2) THEN             !--vapour and liquid only
    23962463             qs_seri(i,k) = 0.
    2397           ELSE IF (nqo.eq.3) THEN
     2464             rneb_seri(i,k) = 0.
     2465          ELSE IF (nqo.EQ.3) THEN        !--vapour, liquid and ice
    23982466             qs_seri(i,k) = qx(i,k,isol)
    2399           ELSE IF (nqo.eq.4) THEN
     2467             rneb_seri(i,k) = 0.
     2468          ELSE IF (nqo.EQ.4) THEN        !--vapour, liquid, ice and rneb
    24002469             qs_seri(i,k) = qx(i,k,isol)
    24012470             rneb_seri(i,k) = qx(i,k,irneb)
     
    24122481    do ixt=1,ntraciso
    24132482#ifdef ISOVERIF
    2414       write(*,*) 'physiq tmp 1762a: ixt,iqiso_vap=',ixt,iqiso(ixt,ivap)
    2415       write(*,*) 'physiq tmp 1762b: ixt,iqiso_liq=',ixt,iqiso(ixt,iliq)
     2483      write(*,*) 'physiq tmp 1762a: ixt,iqiso_vap=',ixt,iqIsoPha(ixt,ivap)
     2484      write(*,*) 'physiq tmp 1762b: ixt,iqiso_liq=',ixt,iqIsoPha(ixt,iliq)
    24162485      if (nqo.eq.3) then 
    2417         write(*,*) 'physiq tmp 1762c: ixt,iqiso_liq=',ixt,iqiso(ixt,iliq)
     2486        write(*,*) 'physiq tmp 1762c: ixt,iqiso_liq=',ixt,iqIsoPha(ixt,iliq)
    24182487      endif !if (nqo.eq.3) then
    24192488#endif
    2420       if (ixt.gt.niso) write(*,*) 'izone=',tracers(iqiso(ixt,ivap))%iso_iZone
     2489      if (ixt.gt.niso) write(*,*) 'izone=',tracers(iqIsoPha(ixt,ivap))%iso_iZone
    24212490      DO k = 1, klev
    24222491       DO i = 1, klon
    2423           xt_seri(ixt,i,k)  = qx(i,k,iqiso(ixt,ivap))
    2424           xtl_seri(ixt,i,k) = qx(i,k,iqiso(ixt,iliq))
     2492          xt_seri(ixt,i,k)  = qx(i,k,iqIsoPha(ixt,ivap))
     2493          xtl_seri(ixt,i,k) = qx(i,k,iqIsoPha(ixt,iliq))
    24252494          if (nqo.eq.2) then
    24262495             xts_seri(ixt,i,k) = 0.
    24272496          else if (nqo.eq.3) then
    2428              xts_seri(ixt,i,k) = qx(i,k,iqiso(ixt,isol))
     2497             xts_seri(ixt,i,k) = qx(i,k,iqIsoPha(ixt,isol))
    24292498          endif
    24302499       enddo !DO i = 1, klon
     
    26612730       ! !! RomP >>>   td dyn traceur
    26622731       IF (nqtot > nqo) d_tr_dyn(:,:,:)= 0.0
     2732       ! !! RomP <<<
    26632733       d_rneb_dyn(:,:)=0.0
    2664        ! !! RomP <<<
    26652734       ancien_ok = .TRUE.
    26662735    ENDIF
     
    30323101      ! verif iso_eau
    30333102      !write(*,*) 'physiq tmp 2748: iso_eau=',iso_eau
    3034       !write(*,*) 'use_iso=',use_iso
    30353103      !write(*,*) 'iso_eau.gt.0=',iso_eau.gt.0
    30363104      !write(*,*) 'd_xt_vdf(iso_eau,1,1),d_q_vdf(1,1)=',d_xt_vdf(iso_eau,1,1),d_q_vdf(1,1)
     
    46124680    IF (ok_new_lscp) THEN
    46134681
    4614     CALL lscp(phys_tstep,missing_val,paprs,pplay, &
     4682    !--mise à jour de flight_m et flight_h2o dans leur module
     4683    IF (ok_plane_h2o .OR. ok_plane_contrail) THEN
     4684      CALL airplane(debut,pphis,pplay,paprs,t_seri)
     4685    ENDIF
     4686
     4687    CALL lscp(klon,klev,phys_tstep,missing_val,paprs,pplay, &
    46154688         t_seri, q_seri,ptconv,ratqs, &
    4616          d_t_lsc, d_q_lsc, d_ql_lsc, d_qi_lsc, rneb, rneb_seri, &
     4689         d_t_lsc, d_q_lsc, d_ql_lsc, d_qi_lsc, rneb, rneblsvol, rneb_seri, &
    46174690         cldliq, picefra, rain_lsc, snow_lsc, &
    4618          pfrac_impa, pfrac_nucl, pfrac_1nucl, &
    46194691         frac_impa, frac_nucl, beta_prec_fisrt, &
    46204692         prfl, psfl, rhcl,  &
    46214693         zqasc, fraca,ztv,zpspsk,ztla,zthl,iflag_cld_th, &
    4622          iflag_ice_thermo, ok_ice_sursat)
     4694         iflag_ice_thermo, ok_ice_sursat, zqsatl, zqsats, &
     4695         qclr, qcld, qss, qvc, rnebclr, rnebss, gamma_ss, &
     4696         Tcontr, qcontr, qcontr2, fcontrN, fcontrP )
    46234697
    46244698    ELSE
     4699
    46254700    CALL fisrtilp(phys_tstep,paprs,pplay, &
    46264701         t_seri, q_seri,ptconv,ratqs, &
     
    46944769       ENDDO
    46954770    ENDDO
    4696     IF (nqo==3) THEN
     4771    IF (nqo >= 3) THEN
    46974772    DO k = 1, klev
    46984773       DO i = 1, klon
     
    51165191    ENDDO
    51175192
    5118     IF (type_trac == 'inca' .OR. type_trac == 'inco') THEN      ! ModThL
     5193    IF (ANY(type_trac == ['inca','inco'])) THEN ! ModThL
    51195194#ifdef INCA
    51205195       CALL VTe(VTphysiq)
     
    55015576          !
    55025577          !--interactive CO2 in ppm from carbon cycle
    5503           IF (carbon_cycle_rad.AND..NOT.debut) THEN
    5504             RCO2=RCO2_glo
    5505           ENDIF
     5578          IF (carbon_cycle_rad) RCO2=RCO2_glo
    55065579          !
    55075580          IF (prt_level .GE.10) THEN
     
    55595632 
    55605633#ifndef CPP_XIOS
    5561           !--OB 30/05/2016 modified 21/10/2016
    5562           !--here we return swaero_diag and dryaod_diag to FALSE
    5563           !--and histdef will switch it back to TRUE if necessary
    5564           !--this is necessary to get the right swaero at first step
    5565           !--but only in the case of no XIOS as XIOS is covered elsewhere
    5566           IF (debut) swaerofree_diag = .FALSE.
    5567           IF (debut) swaero_diag = .FALSE.
    5568           IF (debut) dryaod_diag = .FALSE.
    5569           !--IM 15/09/2017 here we return ok_4xCO2atm to FALSE
    5570           !--as for swaero_diag, see above
    5571           IF (debut) ok_4xCO2atm = .FALSE.
    5572 
    55735634          !
    55745635          !IM 2eme calcul radiatif pour le cas perturbe ou au moins un
     
    57385799       DO i=1,klon
    57395800          itest(i)=0
    5740           !        IF ((zstd(i).gt.10.0)) THEN
    5741           IF (((zpic(i)-zmea(i)).GT.100.).AND.(zstd(i).GT.10.0)) THEN
     5801          zrel_mount(i)=zstd(i)/(max(zsig(i),1.E-8)*sqrt(cell_area(i)))
     5802          !zrel_mount: relative mountain height wrt relief explained by mean slope
     5803          ! -> condition on zrel_mount can deactivate the drag on tilted planar terrains
     5804          !    such as ice sheets (work by V. Wiener)
     5805          IF (((zpic(i)-zmea(i)).GT.100.).AND.(zstd(i).GT.10.0).AND.(zrel_mount(i).GE.zrel_mount_t)) THEN
    57425806             itest(i)=1
    57435807             igwd=igwd+1
     
    57925856       DO i=1,klon
    57935857          itest(i)=0
    5794           IF ((zpic(i)-zmea(i)).GT.100.) THEN
     5858          !zrel_mount: relative mountain height wrt relief explained by mean slope
     5859          ! -> condition on zrel_mount can deactivate the lifting on tilted planar terrains
     5860          !    such as ice sheets (work by V. Wiener)
     5861          zrel_mount(i)=zstd(i)/(max(zsig(i),1.E-8)*sqrt(cell_area(i)))
     5862          IF (((zpic(i)-zmea(i)).GT.100.).AND.(zrel_mount(i).GE.zrel_mount_t)) THEN
    57955863             itest(i)=1
    57965864             igwd=igwd+1
     
    62796347    ELSE
    62806348       sh_in(:,:) = qx(:,:,ivap)
    6281        IF (nqo .EQ. 3) THEN
     6349       IF (nqo >= 3) THEN
    62826350          ch_in(:,:) = qx(:,:,iliq) + qx(:,:,isol)
    62836351       ELSE
     
    63666434    ! Calculer le transport de l'eau et de l'energie (diagnostique)
    63676435    !
    6368     CALL transp (paprs,zxtsol, &
    6369          t_seri, q_seri, ql_seri, qs_seri, u_seri, v_seri, zphi, &
    6370          ve, vq, ue, uq, vwat, uwat)
     6436    CALL transp (paprs,zxtsol, t_seri, q_seri, ql_seri, qs_seri, u_seri, v_seri, zphi, &
     6437                 ue, ve, uq, vq, uwat, vwat)
    63716438    !
    63726439    !IM global posePB BEG
    63736440    IF(1.EQ.0) THEN
    63746441       !
    6375        CALL transp_lay (paprs,zxtsol, &
    6376             t_seri, q_seri, u_seri, v_seri, zphi, &
     6442       CALL transp_lay (paprs,zxtsol, t_seri, q_seri, u_seri, v_seri, zphi, &
    63776443            ve_lay, vq_lay, ue_lay, uq_lay)
    63786444       !
    63796445    ENDIF !(1.EQ.0) THEN
    63806446    !IM global posePB END
     6447    !
    63816448    ! Accumuler les variables a stocker dans les fichiers histoire:
    63826449    !
     
    63896456    d_t_ec(:,:)=0.
    63906457    forall (k=1: nbp_lev) exner(:, k) = (pplay(:, k)/paprs(:,1))**RKAPPA
    6391     CALL ener_conserv(klon,klev,pdtphys,u,v,t,qx(:,:,ivap),qx(:,:,iliq),qx(:,:,isol), &
     6458    CALL ener_conserv(klon,klev,pdtphys,u,v,t,qx,ivap,iliq,isol, &
    63926459         u_seri,v_seri,t_seri,q_seri,ql_seri,qs_seri,pbl_tke(:,:,is_ave)-tke0(:,:), &
    63936460         zmasse,exner,d_t_ec)
     
    64346501#endif
    64356502    !
    6436     IF (type_trac == 'inca' .OR. type_trac == 'inco') THEN
     6503    IF (ANY(type_trac == ['inca','inco'])) THEN
    64376504#ifdef INCA
    64386505       CALL VTe(VTphysiq)
     
    64516518            pphis, &
    64526519            zx_rh, &
    6453             aps, bps, ap, bp)
     6520            aps, bps, ap, bp, lafin)
    64546521
    64556522       CALL VTe(VTinca)
     
    64586525    ENDIF
    64596526
     6527    IF (type_trac == 'repr') THEN
     6528#ifdef REPROBUS
     6529        CALL coord_hyb_rep(paprs, pplay, aps, bps, ap, bp, cell_area)
     6530#endif
     6531    ENDIF
    64606532
    64616533    !
     
    64816553          d_qx(i,k,iliq) = ( ql_seri(i,k) - qx(i,k,iliq) ) / phys_tstep
    64826554          !CR: on ajoute le contenu en glace
    6483           IF (nqo.ge.3) THEN
     6555          IF (nqo >= 3) THEN
    64846556             d_qx(i,k,isol) = ( qs_seri(i,k) - qx(i,k,isol) ) / phys_tstep
    64856557          ENDIF
    64866558          !--ice_sursat: nqo=4, on ajoute rneb
    6487           IF (nqo.eq.4) THEN
     6559          IF (nqo == 4) THEN
    64886560             d_qx(i,k,irneb) = ( rneb_seri(i,k) - qx(i,k,irneb) ) / phys_tstep
    64896561          ENDIF
     
    64966568      DO k = 1, klev
    64976569       DO i = 1, klon
    6498           iq=iqiso(ixt,ivap)
     6570          iq=iqIsoPha(ixt,ivap)
    64996571          d_qx(i,k,iq) = ( xt_seri(ixt,i,k) - qx(i,k,iq) ) / phys_tstep
    6500           iq=iqiso(ixt,iliq)
     6572          iq=iqIsoPha(ixt,iliq)
    65016573          d_qx(i,k,iq) = ( xtl_seri(ixt,i,k) - qx(i,k,iq) ) / phys_tstep
    65026574          if (nqo.eq.3) then
    6503              iq=iqiso(ixt,isol)
     6575             iq=iqIsoPha(ixt,isol)
    65046576             d_qx(i,k,iq) = ( xts_seri(ixt,i,k) - qx(i,k,iq) ) / phys_tstep
    65056577          endif
     
    65076579      enddo ! DO k = 1, klev
    65086580    enddo !do ixt=1,ntraciso
    6509 !#ifdef ISOVERIF
    6510 !        write(*,*) 'physiq 6120: d_qx(1,1,:)=',d_qx(1,1,:)
    6511 !        write(*,*) 'qx(1,1,:)=',qx(1,1,:)
    6512 !        write(*,*) 'xt_seri(:,1,1)=',xt_seri(:,1,1)
    6513 !#endif
    6514 #endif
    6515 ! #ifdef ISO
     6581#endif
    65166582    ! DC: All iterations are cycled if nqtot==nqo, so no nqtot>nqo condition required
    65176583    itr = 0
     
    65736639    ql_ancien(:,:) = ql_seri(:,:)
    65746640    qs_ancien(:,:) = qs_seri(:,:)
     6641    rneb_ancien(:,:) = rneb_seri(:,:)
    65756642#ifdef ISO
    65766643    xt_ancien(:,:,:)=xt_seri(:,:,:)
     
    68326899#ifdef CPP_XIOS
    68336900       IF (is_omp_master) CALL xios_context_finalize
     6901
     6902#ifdef INCA
     6903       if (type_trac == 'inca') then
     6904          IF (is_omp_master .and. grid_type==unstructured) THEN
     6905             CALL finalize_inca
     6906          ENDIF
     6907       endif
     6908#endif
     6909
    68346910#endif
    68356911       WRITE(lunout,*) ' physiq fin, nombre de steps ou cvpas = 1 : ', Ncvpaseq1
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/reevap.F90

    r3927 r4446  
    99    USE add_phys_tend_mod, only : fl_cor_ebil
    1010#ifdef ISO
    11     USE infotrac_phy, ONLY: ntraciso   
     11    USE infotrac_phy, ONLY: ntiso   
    1212#ifdef ISOVERIF
    1313    USE isotopes_verif_mod
     
    3030
    3131#ifdef ISO
    32     REAL, DIMENSION(ntraciso,klon,klev), INTENT(in) :: xt_seri,xtl_seri,xts_seri
    33     REAL, DIMENSION(ntraciso,klon,klev), INTENT(out) :: d_xt_eva,d_xtl_eva,d_xts_eva
     32    REAL, DIMENSION(ntiso,klon,klev), INTENT(in) :: xt_seri,xtl_seri,xts_seri
     33    REAL, DIMENSION(ntiso,klon,klev), INTENT(out) :: d_xt_eva,d_xtl_eva,d_xts_eva
    3434    integer ixt
    3535#endif
     
    7676
    7777#ifdef ISO
    78          do ixt=1,ntraciso
     78         do ixt=1,ntiso
    7979            zb = MAX(0.0,xtl_seri(ixt,i,k))
    8080            d_xt_eva(ixt,i,k) = zb
    8181            d_xtl_eva(ixt,i,k) = -xtl_seri(ixt,i,k)
    8282            d_xts_eva(ixt,i,k) = 0.
    83          enddo ! do ixt=1,ntraciso
     83         enddo
    8484#ifdef ISOVERIF
    85       do ixt=1,ntraciso
     85      do ixt=1,ntiso
    8686        call iso_verif_noNaN(xt_seri(ixt,i,k), &
    8787     &     'physiq 2417: apres evap tot')
     
    136136
    137137#ifdef ISO
    138          do ixt=1,ntraciso
     138         do ixt=1,ntiso
    139139            zb = MAX(0.0,xtl_seri(ixt,i,k)+xts_seri(ixt,i,k))
    140140            d_xt_eva(ixt,i,k) = zb
    141141            d_xtl_eva(ixt,i,k) = -xtl_seri(ixt,i,k)
    142142            d_xts_eva(ixt,i,k) = -xts_seri(ixt,i,k)
    143          enddo ! do ixt=1,ntraciso
     143         enddo
    144144
    145145#ifdef ISOVERIF
    146       do ixt=1,ntraciso
     146      do ixt=1,ntiso
    147147      call iso_verif_noNaN(xt_seri(ixt,i,k), &
    148148     &     'physiq 2417: apres evap tot')
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/surf_land_bucket_mod.F90

    r4033 r4446  
    3535    USE indice_sol_mod
    3636#ifdef ISO
    37     use infotrac_phy, ONLY: ntraciso,niso
     37    use infotrac_phy, ONLY: ntiso,niso
    3838    USE isotopes_mod, ONLY: iso_eau, iso_HDO, iso_O18, iso_O17, &
    3939        ridicule_qsol
     
    6969    REAL, DIMENSION(klon), INTENT(IN)       :: swnet, lwnet
    7070#ifdef ISO
    71     REAL, DIMENSION(ntraciso,klon), INTENT(IN)      :: xtprecip_rain, xtprecip_snow
    72     REAL, DIMENSION(ntraciso,klon), INTENT(IN)      :: xtspechum   
     71    REAL, DIMENSION(ntiso,klon), INTENT(IN) :: xtprecip_rain, xtprecip_snow
     72    REAL, DIMENSION(ntiso,klon), INTENT(IN) :: xtspechum   
    7373#endif
    7474
     
    9191    REAL, DIMENSION(klon), INTENT(OUT)       :: dflux_s, dflux_l         
    9292#ifdef ISO
    93     REAL, DIMENSION(ntraciso,klon), INTENT(OUT)      :: xtevap
    94     REAL, DIMENSION(klon), INTENT(OUT)      :: h1
    95     REAL, DIMENSION(niso,klon), INTENT(OUT)      :: xtrunoff_diag
    96     REAL, DIMENSION(klon), INTENT(OUT)      :: runoff_diag
    97     REAL, DIMENSION(niso,klon), INTENT(IN)        :: Rland_ice
     93    REAL, DIMENSION(ntiso,klon), INTENT(OUT) :: xtevap
     94    REAL, DIMENSION(klon),       INTENT(OUT) :: h1
     95    REAL, DIMENSION(niso,klon),  INTENT(OUT) :: xtrunoff_diag
     96    REAL, DIMENSION(klon),       INTENT(OUT) :: runoff_diag
     97    REAL, DIMENSION(niso,klon),  INTENT(IN)  :: Rland_ice
    9898#endif
    9999
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/surf_land_mod.F90

    r4033 r4446  
    3030    USE dimphy
    3131    USE surface_data, ONLY    : ok_veget
    32 ! >> PC
    3332    USE carbon_cycle_mod
    34 ! << PC
    3533
    3634    ! See comments in each module surf_land_orchidee_xxx for compatiblity with ORCHIDEE
     
    5149    USE surf_land_orchidee_nounstruct_mod
    5250#else
     51#if ORCHIDEE_NOLIC
     52    ! Compilation with cpp key ORCHIDEE_NOLIC
     53    USE surf_land_orchidee_nolic_mod
     54#else
     55    ! Default version#else
    5356    USE surf_land_orchidee_mod
     57#endif
    5458#endif
    5559#endif
     
    6165    USE indice_sol_mod
    6266#ifdef ISO
    63     use infotrac_phy, ONLY: ntraciso,niso
     67    use infotrac_phy, ONLY: ntiso,niso
    6468    use isotopes_mod, ONLY: nudge_qsol, iso_eau
    6569#ifdef ISOVERIF
     
    6771#endif
    6872#endif
    69 
    70 ! >> PC
     73   
    7174    USE print_control_mod, ONLY: lunout
    72 ! << PC
    7375
    7476    INCLUDE "dimsoil.h"
     
    104106    REAL, DIMENSION(klon), INTENT(IN)       :: q2m, t2m
    105107#ifdef ISO
    106     REAL, DIMENSION(ntraciso,klon), INTENT(IN)       :: xtprecip_rain, xtprecip_snow
    107     REAL, DIMENSION(ntraciso,klon), INTENT(IN)       :: xtspechum
     108    REAL, DIMENSION(ntiso,klon), INTENT(IN)       :: xtprecip_rain, xtprecip_snow
     109    REAL, DIMENSION(ntiso,klon), INTENT(IN)       :: xtspechum
    108110#endif
    109111
     
    135137    REAL, DIMENSION(klon,nvm_lmdz), INTENT(OUT) :: height
    136138#ifdef ISO
    137     REAL, DIMENSION(ntraciso,klon), INTENT(OUT)      :: xtevap
     139    REAL, DIMENSION(ntiso,klon), INTENT(OUT)      :: xtevap
    138140    REAL, DIMENSION(klon), INTENT(OUT)      :: h1
    139141    REAL, DIMENSION(niso,klon), INTENT(OUT)      :: xtrunoff_diag
     
    181183!       write(*,*) 'surf_land 169: ok_veget=',ok_veget
    182184        do i=1,knon
    183          do ixt=1,ntraciso
     185         do ixt=1,ntiso
    184186           call iso_verif_noNaN(xtprecip_snow(ixt,i),'surf_land 146')
    185187         enddo
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/surf_landice_mod.F90

    r4033 r4446  
    3737#ifdef ISO   
    3838    USE fonte_neige_mod,  ONLY : xtrun_off_lic
    39     USE infotrac_phy, ONLY : ntraciso,niso
     39    USE infotrac_phy, ONLY : ntiso,niso
    4040    USE isotopes_routines_mod, ONLY: calcul_iso_surf_lic_vectall
    4141#ifdef ISOVERIF
     
    8282    REAL, DIMENSION(klon,nbsrf), INTENT(IN)       :: pctsrf
    8383#ifdef ISO
    84     REAL, DIMENSION(ntraciso,klon), INTENT(IN)        :: xtprecip_rain, xtprecip_snow
    85     REAL, DIMENSION(ntraciso,klon), INTENT(IN)        :: xtspechum
     84    REAL, DIMENSION(ntiso,klon), INTENT(IN)       :: xtprecip_rain, xtprecip_snow
     85    REAL, DIMENSION(ntiso,klon), INTENT(IN)       :: xtspechum
    8686#endif
    8787
     
    129129    REAL, DIMENSION(klon), INTENT(OUT)           :: runoff  !Land ice runoff
    130130#ifdef ISO
    131     REAL, DIMENSION(ntraciso,klon), INTENT(OUT)        :: xtevap     
     131    REAL, DIMENSION(ntiso,klon), INTENT(OUT)     :: xtevap     
    132132!    real, DIMENSION(niso,klon) :: xtrun_off_lic_0_diag ! est une variable globale de
    133133!    fonte_neige
     
    144144    INTEGER                  :: i,j,nt
    145145    REAL, DIMENSION(klon)    :: fqfonte,ffonte
     146    REAL, DIMENSION(klon)    :: run_off_lic_frac
    146147#ifdef ISO       
    147148      real, parameter :: t_coup = 273.15
     
    484485! Send run-off on land-ice to coupler if coupled ocean.
    485486! run_off_lic has been calculated in fonte_neige or surf_inlandsis
    486 !
    487 !****************************************************************************************
    488     IF (type_ocean=='couple') THEN
    489        CALL cpl_send_landice_fields(itime, knon, knindex, run_off_lic)
     487! If landice_opt>=2, corresponding call is done from surf_land_orchidee
     488!****************************************************************************************
     489    IF (type_ocean=='couple' .AND. landice_opt .LT. 2) THEN
     490       ! Compress fraction where run_off_lic is active (here all pctsrf(is_lic))
     491       run_off_lic_frac(:)=0.0
     492       DO j = 1, knon
     493          i = knindex(j)
     494          run_off_lic_frac(j) = pctsrf(i,is_lic)
     495       ENDDO
     496       
     497       CALL cpl_send_landice_fields(itime, knon, knindex, run_off_lic, run_off_lic_frac)
    490498    ENDIF
    491499
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/surf_ocean_mod.F90

    r3940 r4446  
    2020       z0m, z0h, SFRWL, alb_dir_new, alb_dif_new, evap, fluxsens, fluxlat, &
    2121       tsurf_new, dflux_s, dflux_l, lmt_bils, &
    22        flux_u1, flux_v1, delta_sst, delta_sal, ds_ns, dt_ns, dter, dser, tkt, tks, &
    23        taur, sss &
     22       flux_u1, flux_v1, delta_sst, delta_sal, ds_ns, dt_ns, dter, dser, &
     23       dt_ds, tkt, tks, taur, sss &
    2424#ifdef ISO
    2525        &       ,xtprecip_rain, xtprecip_snow,xtspechum,Roce, &
     
    3737    USE indice_sol_mod, ONLY : nbsrf, is_oce
    3838#ifdef ISO
    39   USE infotrac_phy, ONLY : ntraciso,niso
     39  USE infotrac_phy, ONLY : ntraciso=>ntiso,niso
    4040#ifdef ISOVERIF
    4141    USE isotopes_mod, ONLY: iso_eau,ridicule
     
    114114    ! minus foundation temperature. (Can be negative.) In K.
    115115
     116    REAL, intent(inout):: dter(:) ! (knon)
     117    ! Temperature variation in the diffusive microlayer, that is
     118    ! ocean-air interface temperature minus subskin temperature. In
     119    ! K.
     120
     121    REAL, intent(inout):: dser(:) ! (knon)
     122    ! Salinity variation in the diffusive microlayer, that is
     123    ! ocean-air interface salinity minus subskin salinity. In ppt.
     124
     125    real, intent(inout):: dt_ds(:) ! (knon)
     126    ! (tks / tkt) * dTer, in K
     127
    116128    ! Output variables
    117129    !**************************************************************************
     
    129141    REAL, DIMENSION(klon), INTENT(OUT)       :: flux_u1, flux_v1
    130142
    131     REAL, intent(out):: dter(:) ! (knon)
    132     ! Temperature variation in the diffusive microlayer, that is
    133     ! ocean-air interface temperature minus subskin temperature. In
    134     ! K.
    135 
    136     REAL, intent(out):: dser(:) ! (knon)
    137     ! Salinity variation in the diffusive microlayer, that is
    138     ! ocean-air interface salinity minus subskin salinity. In ppt.
    139 
    140143    REAL, intent(out):: tkt(:) ! (knon)
    141144    ! épaisseur (m) de la couche de diffusion thermique (microlayer)
     
    152155    ! defined for subscripts 1:knon, but we have to declare it with
    153156    ! size klon because of the coupling machinery.)
     157
    154158#ifdef ISO
    155159    REAL, DIMENSION(ntraciso,klon), INTENT(out)        :: xtevap ! isotopes in surface evaporation flux
     
    172176    real s_int(knon) ! ocean-air interface salinity, in ppt
    173177
    174     !******************************************************************************
     178    !**************************************************************************
    175179
    176180#ifdef ISO
     
    213217    ENDIF
    214218
    215 
    216219    rhoa = PS(:KNON) / (Rd * temp_air(:knon) * (1. + retv * spechum(:knon)))
    217 
    218220    !******************************************************************************
    219221    ! Switch according to type of ocean (couple, slab or forced)
     
    232234            qsurf, evap, fluxsens, fluxlat, flux_u1, flux_v1, &
    233235            tsurf_new, dflux_s, dflux_l, sens_prec_liq, sss, delta_sal, rhoa, &
    234             delta_sst)
     236            delta_sst, dTer, dSer, dt_ds)
    235237
    236238    CASE('slab')
     
    376378       delta_sst = t_int - tsurf_new(:knon)
    377379       delta_sal = s_int - sss(:knon)
    378        if (activate_ocean_skin >= 2) tsurf_new(:knon) = t_int
     380
     381       if (activate_ocean_skin == 2) then
     382          tsurf_new(:knon) = t_int
     383          if (type_ocean == 'couple') dt_ds = (tks / tkt) * dter
     384       end if
    379385    end if
    380 
     386   
    381387  END SUBROUTINE surf_ocean
    382388  !****************************************************************************
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/surf_seaice_mod.F90

    r3940 r4446  
    3535  USE indice_sol_mod
    3636#ifdef ISO
    37   USE infotrac_phy, ONLY : ntraciso,niso
     37  USE infotrac_phy, ONLY : ntiso,niso
    3838#endif
    3939
     
    7171    REAL, DIMENSION(klon,nbsrf), INTENT(IN)  :: pctsrf
    7272#ifdef ISO
    73     REAL, DIMENSION(ntraciso,klon), INTENT(IN)        :: xtprecip_rain, xtprecip_snow
     73    REAL, DIMENSION(ntiso,klon), INTENT(IN)        :: xtprecip_rain, xtprecip_snow
    7474    REAL, DIMENSION(klon), INTENT(IN)        :: xtspechum
    7575    REAL, DIMENSION(niso,klon), INTENT(IN)        :: Roce
     
    101101    REAL, DIMENSION(klon), INTENT(OUT)       :: flux_u1, flux_v1
    102102#ifdef ISO
    103     REAL, DIMENSION(ntraciso,klon), INTENT(OUT)        :: xtevap 
     103    REAL, DIMENSION(ntiso,klon), INTENT(OUT)        :: xtevap 
    104104#endif
    105105
  • LMDZ6/branches/Portage_acc/libf/phylmdiso/wake.F90

    r4036 r4446  
    3434  USE print_control_mod, ONLY: prt_level
    3535#ifdef ISO
    36   USE infotrac_phy, ONLY : ntraciso
     36  USE infotrac_phy, ONLY : ntraciso=>ntiso
    3737#ifdef ISOVERIF
    3838  USE isotopes_verif_mod
     
    25502550    d_deltaqw, sigmaw, d_sigmaw, alpha)
    25512551  ! ------------------------------------------------------
    2552   ! Dtermination du coefficient alpha tel que les tendances
     2552  ! D\'etermination du coefficient alpha tel que les tendances
    25532553  ! corriges alpha*d_G, pour toutes les grandeurs G, correspondent
    25542554  ! a une humidite positive dans la zone (x) et dans la zone (w).
Note: See TracChangeset for help on using the changeset viewer.