Changeset 4056


Ignore:
Timestamp:
Jan 12, 2022, 10:54:09 PM (2 years ago)
Author:
dcugnet
Message:

Most of the changes are intended to help to eventually remove the constraints about the tracers assumptions, in particular water tracers.

  • Remove index tables itr_indice and niadv, replaced by tracers(:)%isAdvected and tracers(:)%isH2OFamily. Most of the loops are now from 1 to nqtot:
    • DO iq=nqo+1,nqtot loops are replaced with: DO iq=1,nqtot

IF(tracers(iq)%isH2Ofamily) CYCLE

  • DO it=1,nbtr; iq=niadv(it+nqo)

and DO it=1,nqtottr; iq=itr_indice(it) loops are replaced with:

it = 0
DO iq = 1, nqtot

IF(.NOT.tracers(iq)%isAdvected .OR. tracers(iq)%isH2Ofamily) CYCLE
it = it+1

  • Move some StratAer? related code from infotrac to infotrac_phy
  • Remove "nqperes" variable:

DO iq=1,nqpere loops are replaced with:
DO iq=1,nqtot

IF(tracers(iq)%parent/='air') CYCLE

  • Cosmetic changes (justification, SELECT CASE instead of multiple IF...) mostly in advtrac* routines.
Location:
LMDZ6/trunk/libf
Files:
2 added
29 edited
1 moved

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/dyn3d/advtrac.F90

    r4050 r4056  
    11! $Id$
    22
    3 SUBROUTINE advtrac(pbaru,pbarv , p,  masse,q,iapptrac,teta, flxw, pk)
    4   !     Auteur :  F. Hourdin
    5   !
    6   !     Modif. P. Le Van     (20/12/97)
    7   !            F. Codron     (10/99)
    8   !            D. Le Croller (07/2001)
    9   !            M.A Filiberti (04/2002)
    10   !
    11   USE infotrac, ONLY: nqtot, tracers, nqperes,ok_iso_verif
    12   USE control_mod, ONLY: iapp_tracvl, day_step
    13   USE comconst_mod, ONLY: dtvr
    14 
    15   IMPLICIT NONE
    16   !
    17   include "dimensions.h"
    18   include "paramet.h"
    19   include "comdissip.h"
    20   include "comgeom2.h"
    21   include "description.h"
    22   include "iniprint.h"
    23 
    24   !-------------------------------------------------------------------
    25   !     Arguments
    26   !-------------------------------------------------------------------
    27   INTEGER,INTENT(OUT) :: iapptrac
    28   REAL,INTENT(IN) :: pbaru(ip1jmp1,llm)
    29   REAL,INTENT(IN) :: pbarv(ip1jm,llm)
    30   REAL,INTENT(INOUT) :: q(ip1jmp1,llm,nqtot)
    31   REAL,INTENT(IN) :: masse(ip1jmp1,llm)
    32   REAL,INTENT(IN) :: p( ip1jmp1,llmp1 )
    33   REAL,INTENT(IN) :: teta(ip1jmp1,llm)
    34   REAL,INTENT(IN) :: pk(ip1jmp1,llm)
    35   REAL,INTENT(OUT) :: flxw(ip1jmp1,llm)
    36   !-------------------------------------------------------------------
    37   !     Ajout PPM
    38   !--------------------------------------------------------
    39   REAL massebx(ip1jmp1,llm),masseby(ip1jm,llm)
    40   !-------------------------------------------------------------
    41   !     Variables locales
    42   !-------------------------------------------------------------
    43 
    44   REAL pbaruc(ip1jmp1,llm),pbarvc(ip1jm,llm)
    45   REAL massem(ip1jmp1,llm),zdp(ip1jmp1)
    46   REAL pbarug(ip1jmp1,llm),pbarvg(ip1jm,llm),wg(ip1jmp1,llm)
    47   REAL (kind=kind(1.d0)) :: t_initial, t_final, tps_cpu
    48   INTEGER iadvtr
    49   INTEGER ij,l,iq,iiq
    50   REAL zdpmin, zdpmax
    51   EXTERNAL  minmax
    52   SAVE iadvtr, massem, pbaruc, pbarvc
    53   DATA iadvtr/0/
    54   !----------------------------------------------------------
    55   !     Rajouts pour PPM
    56   !----------------------------------------------------------
    57   INTEGER indice,n
    58   REAL dtbon ! Pas de temps adaptatif pour que CFL<1
    59   REAL CFLmaxz,aaa,bbb ! CFL maximum
    60   REAL psppm(iim,jjp1) ! pression  au sol
    61   REAL unatppm(iim,jjp1,llm),vnatppm(iim,jjp1,llm)
    62   REAL qppm(iim*jjp1,llm,nqtot)
    63   REAL fluxwppm(iim,jjp1,llm)
    64   REAL apppm(llmp1), bpppm(llmp1)
    65   LOGICAL dum,fill
    66   DATA fill/.true./
    67   DATA dum/.true./
    68 
    69   integer,save :: countcfl=0
    70   real cflx(ip1jmp1,llm)
    71   real cfly(ip1jm,llm)
    72   real cflz(ip1jmp1,llm)
    73   real, save :: cflxmax(llm),cflymax(llm),cflzmax(llm)
    74   INTEGER :: iadv
    75 
    76   IF(iadvtr.EQ.0) THEN
    77      pbaruc(:,:)=0
    78      pbarvc(:,:)=0
    79   ENDIF
    80 
    81   !   accumulation des flux de masse horizontaux
    82   DO l=1,llm
    83      DO ij = 1,ip1jmp1
    84         pbaruc(ij,l) = pbaruc(ij,l) + pbaru(ij,l)
    85      ENDDO
    86      DO ij = 1,ip1jm
    87         pbarvc(ij,l) = pbarvc(ij,l) + pbarv(ij,l)
    88      ENDDO
    89   ENDDO
    90 
    91   !   selection de la masse instantannee des mailles avant le transport.
    92   IF(iadvtr.EQ.0) THEN
    93 
     3#define DEBUG_IO
     4#undef DEBUG_IO
     5SUBROUTINE advtrac(pbaru, pbarv, p, masse,q,iapptrac,teta, flxw, pk)
     6   !     Auteur :  F. Hourdin
     7   !
     8   !     Modif. P. Le Van     (20/12/97)
     9   !            F. Codron     (10/99)
     10   !            D. Le Croller (07/2001)
     11   !            M.A Filiberti (04/2002)
     12   !
     13   USE infotrac,     ONLY: nqtot, tracers,ok_iso_verif
     14   USE control_mod,  ONLY: iapp_tracvl, day_step
     15   USE comconst_mod, ONLY: dtvr
     16
     17   IMPLICIT NONE
     18   !
     19   include "dimensions.h"
     20   include "paramet.h"
     21   include "comdissip.h"
     22   include "comgeom2.h"
     23   include "description.h"
     24   include "iniprint.h"
     25
     26   !---------------------------------------------------------------------------
     27   !     Arguments
     28   !---------------------------------------------------------------------------
     29   INTEGER, INTENT(OUT) :: iapptrac
     30   REAL, INTENT(IN) :: pbaru(ip1jmp1,llm)
     31   REAL, INTENT(IN) :: pbarv(ip1jm,  llm)
     32   REAL, INTENT(INOUT) ::  q(ip1jmp1,llm,nqtot)
     33   REAL, INTENT(IN) :: masse(ip1jmp1,llm)
     34   REAL, INTENT(IN) ::     p(ip1jmp1,llmp1 )
     35   REAL, INTENT(IN) ::  teta(ip1jmp1,llm)
     36   REAL, INTENT(IN) ::    pk(ip1jmp1,llm)
     37   REAL, INTENT(OUT) :: flxw(ip1jmp1,llm)
     38   !---------------------------------------------------------------------------
     39   !     Ajout PPM
     40   !---------------------------------------------------------------------------
     41   REAL :: massebx(ip1jmp1,llm), masseby(ip1jm,llm)
     42   !---------------------------------------------------------------------------
     43   !     Variables locales
     44   !---------------------------------------------------------------------------
     45   INTEGER :: ij, l, iq, iiq, iadv
     46   REAL(KIND=KIND(1.d0)) :: t_initial, t_final, tps_cpu
     47   REAL :: zdp(ip1jmp1), zdpmin, zdpmax
     48   INTEGER, SAVE :: iadvtr=0
     49   REAL, DIMENSION(ip1jmp1,llm) :: pbaruc, pbarug, massem, wg
     50   REAL, DIMENSION(ip1jm,  llm) :: pbarvc, pbarvg
     51   EXTERNAL  minmax
     52   SAVE massem, pbaruc, pbarvc
     53   !---------------------------------------------------------------------------
     54   !     Rajouts pour PPM
     55   !---------------------------------------------------------------------------
     56   INTEGER indice, n
     57   REAL :: dtbon                       ! Pas de temps adaptatif pour que CFL<1
     58   REAL :: CFLmaxz, aaa, bbb           ! CFL maximum
     59   REAL, DIMENSION(iim,jjp1,llm) :: unatppm, vnatppm, fluxwppm
     60   REAL ::    qppm(iim*jjp1,llm,nqtot)
     61   REAL ::   psppm(iim,jjp1)           ! pression  au sol
     62   REAL, DIMENSION(llmp1) :: apppm, bpppm
     63   LOGICAL, SAVE :: dum=.TRUE., fill=.TRUE.
     64
     65   INTEGER, SAVE :: countcfl=0
     66   REAL, DIMENSION(ip1jmp1,llm) :: cflx, cflz
     67   REAL, DIMENSION(ip1jm  ,llm) :: cfly
     68   REAL, DIMENSION(llm), SAVE :: cflxmax, cflymax, cflzmax
     69
     70   IF(iadvtr == 0) THEN
     71      pbaruc(:,:)=0
     72      pbarvc(:,:)=0
     73   END IF
     74
     75   !--- Accumulation des flux de masse horizontaux
     76   DO l=1,llm
     77      DO ij = 1,ip1jmp1
     78         pbaruc(ij,l) = pbaruc(ij,l) + pbaru(ij,l)
     79      END DO
     80      DO ij = 1,ip1jm
     81         pbarvc(ij,l) = pbarvc(ij,l) + pbarv(ij,l)
     82      END DO
     83   END DO
     84
     85   !--- Selection de la masse instantannee des mailles avant le transport.
     86   IF(iadvtr == 0) THEN
    9487     CALL SCOPY(ip1jmp1*llm,masse,1,massem,1)
    95      !cc         CALL filtreg ( massem ,jjp1, llm,-2, 2, .TRUE., 1 )
    96      !
    97   ENDIF
    98 
    99   iadvtr   = iadvtr+1
    100   iapptrac = iadvtr
    101 
    102 
    103   !   Test pour savoir si on advecte a ce pas de temps
    104   IF ( iadvtr.EQ.iapp_tracvl ) THEN
    105 
    106      !c   ..  Modif P.Le Van  ( 20/12/97 )  ....
    107      !c
    108 
    109      !   traitement des flux de masse avant advection.
    110      !     1. calcul de w
    111      !     2. groupement des mailles pres du pole.
    112 
    113      CALL groupe( massem, pbaruc,pbarvc, pbarug,pbarvg,wg )
    114 
    115      ! ... Flux de masse diaganostiques traceurs
    116      flxw = wg / REAL(iapp_tracvl)
    117 
    118      !  test sur l'eventuelle creation de valeurs negatives de la masse
    119      DO l=1,llm-1
    120         DO ij = iip2+1,ip1jm
    121            zdp(ij) =    pbarug(ij-1,l)   - pbarug(ij,l) &
    122                 - pbarvg(ij-iip1,l) + pbarvg(ij,l) &
    123                 +       wg(ij,l+1)  - wg(ij,l)
    124         ENDDO
    125         CALL SCOPY( jjm -1 ,zdp(iip1+iip1),iip1,zdp(iip2),iip1 )
    126         DO ij = iip2,ip1jm
    127            zdp(ij)= zdp(ij)*dtvr/ massem(ij,l)
    128         ENDDO
    129 
    130 
    131         CALL minmax ( ip1jm-iip1, zdp(iip2), zdpmin,zdpmax )
    132 
    133         IF(MAX(ABS(zdpmin),ABS(zdpmax)).GT.0.5) THEN
    134            PRINT*,'WARNING DP/P l=',l,'  MIN:',zdpmin, &
    135                 '   MAX:', zdpmax
    136         ENDIF
    137 
    138      ENDDO
    139 
    140 
    141      !-------------------------------------------------------------------
    142      ! Calcul des criteres CFL en X, Y et Z
    143      !-------------------------------------------------------------------
    144 
    145      if (countcfl == 0. ) then
    146         cflxmax(:)=0.
    147         cflymax(:)=0.
    148         cflzmax(:)=0.
    149      endif
    150 
    151      countcfl=countcfl+iapp_tracvl
    152      cflx(:,:)=0.
    153      cfly(:,:)=0.
    154      cflz(:,:)=0.
    155      do l=1,llm
    156         do ij=iip2,ip1jm-1
    157            if (pbarug(ij,l)>=0.) then
    158               cflx(ij,l)=pbarug(ij,l)*dtvr/masse(ij,l)
    159            else
    160               cflx(ij,l)=-pbarug(ij,l)*dtvr/masse(ij+1,l)
    161            endif
    162         enddo
    163      enddo
    164      do l=1,llm
    165         do ij=iip2,ip1jm-1,iip1
    166            cflx(ij+iip1,l)=cflx(ij,l)
    167         enddo
    168      enddo
    169 
    170      do l=1,llm
    171         do ij=1,ip1jm
    172            if (pbarvg(ij,l)>=0.) then
    173               cfly(ij,l)=pbarvg(ij,l)*dtvr/masse(ij,l)
    174            else
    175               cfly(ij,l)=-pbarvg(ij,l)*dtvr/masse(ij+iip1,l)
    176            endif
    177         enddo
    178      enddo
    179 
    180      do l=2,llm
    181         do ij=1,ip1jm
    182            if (wg(ij,l)>=0.) then
    183               cflz(ij,l)=wg(ij,l)*dtvr/masse(ij,l)
    184            else
    185               cflz(ij,l)=-wg(ij,l)*dtvr/masse(ij,l-1)
    186            endif
    187         enddo
    188      enddo
    189 
    190      do l=1,llm
    191         cflxmax(l)=max(cflxmax(l),maxval(cflx(:,l)))
    192         cflymax(l)=max(cflymax(l),maxval(cfly(:,l)))
    193         cflzmax(l)=max(cflzmax(l),maxval(cflz(:,l)))
    194      enddo
    195 
    196 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    197      ! Par defaut, on sort le diagnostic des CFL tous les jours.
    198      ! Si on veut le sortir a chaque pas d'advection en cas de plantage
    199      !     if (countcfl==iapp_tracvl) then
    200 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    201      if (countcfl==day_step) then
    202         do l=1,llm
    203            write(lunout,*) 'L, CFL[xyz]max:', l, cflxmax(l), cflymax(l), &
    204                 cflzmax(l)
    205         enddo
    206         countcfl=0
    207      endif
    208 
    209      !-------------------------------------------------------------------
    210      !   Advection proprement dite (Modification Le Croller (07/2001)
    211      !-------------------------------------------------------------------
    212 
    213      !----------------------------------------------------
    214      !        Calcul des moyennes basées sur la masse
    215      !----------------------------------------------------
    216      call massbar(massem,massebx,masseby)         
    217 
    218      !-----------------------------------------------------------
    219      !     Appel des sous programmes d'advection
    220      !-----------------------------------------------------------
    221 
    222      if (ok_iso_verif) then
    223            write(*,*) 'advtrac 227'
    224            call check_isotopes_seq(q,ip1jmp1,'advtrac 162')
    225      endif !if (ok_iso_verif) then
    226 
    227      do iq=1,nqperes
    228         !        call clock(t_initial)
    229        iadv = tracers(iq)%iadv
    230        SELECT CASE(iadv)
     88   ! CALL filtreg ( massem ,jjp1, llm,-2, 2, .TRUE., 1 )
     89   END IF
     90
     91   iadvtr   = iadvtr+1
     92   iapptrac = iadvtr
     93
     94   !--- Test pour savoir si on advecte a ce pas de temps
     95   IF(iadvtr /= iapp_tracvl) RETURN
     96
     97   !   ..  Modif P.Le Van  ( 20/12/97 )  ....
     98   !
     99   !   traitement des flux de masse avant advection.
     100   !       1. calcul de w
     101   !       2. groupement des mailles pres du pole.
     102
     103   CALL groupe(massem, pbaruc, pbarvc, pbarug, pbarvg, wg)
     104
     105   !--- Flux de masse diaganostiques traceurs
     106   flxw = wg / REAL(iapp_tracvl)
     107
     108   !--- Test sur l'eventuelle creation de valeurs negatives de la masse
     109   DO l=1,llm-1
     110      DO ij = iip2+1,ip1jm
     111         zdp(ij) = pbarug(ij-1,l)    - pbarug(ij,l) &
     112                 - pbarvg(ij-iip1,l) + pbarvg(ij,l) &
     113                 +     wg(ij,l+1)    -     wg(ij,l)
     114      END DO
     115! ym  ---> pourquoi jjm-1 et non jjm ? a cause du pole ?
     116      CALL SCOPY( jjm -1 ,zdp(iip1+iip1),iip1,zdp(iip2),iip1 )
     117      DO ij = iip2,ip1jm
     118         zdp(ij)= zdp(ij)*dtvr/ massem(ij,l)
     119      END DO
     120
     121      CALL minmax ( ip1jm-iip1, zdp(iip2), zdpmin,zdpmax )
     122
     123      IF(MAX(ABS(zdpmin),ABS(zdpmax)) > 0.5) &
     124         WRITE(*,*)'WARNING DP/P l=',l,'  MIN:',zdpmin,' MAX:', zdpmax
     125
     126   END DO
     127
     128   !-------------------------------------------------------------------------
     129   ! Calcul des criteres CFL en X, Y et Z
     130   !-------------------------------------------------------------------------
     131   IF(countcfl == 0. ) then
     132      cflxmax(:)=0.
     133      cflymax(:)=0.
     134      cflzmax(:)=0.
     135   END IF
     136
     137   countcfl=countcfl+iapp_tracvl
     138   cflx(:,:)=0.
     139   cfly(:,:)=0.
     140   cflz(:,:)=0.
     141   DO l=1,llm
     142      DO ij=iip2,ip1jm-1
     143         IF(pbarug(ij,l)>=0.) then
     144            cflx(ij,l)=pbarug(ij,l)*dtvr/masse(ij,l)
     145         ELSE
     146            cflx(ij,l)=-pbarug(ij,l)*dtvr/masse(ij+1,l)
     147         END IF
     148      END DO
     149   END DO
     150
     151   DO l=1,llm
     152      DO ij=iip2,ip1jm-1,iip1
     153         cflx(ij+iip1,l)=cflx(ij,l)
     154      END DO
     155   END DO
     156
     157   DO l=1,llm
     158      DO ij=1,ip1jm
     159         IF(pbarvg(ij,l)>=0.) then
     160            cfly(ij,l)=pbarvg(ij,l)*dtvr/masse(ij,l)
     161         ELSE
     162            cfly(ij,l)=-pbarvg(ij,l)*dtvr/masse(ij+iip1,l)
     163         END IF
     164      END DO
     165   END DO
     166
     167   DO l=2,llm
     168      DO ij=1,ip1jm
     169         IF(wg(ij,l) >= 0.) THEN
     170            cflz(ij,l)=wg(ij,l)*dtvr/masse(ij,l)
     171         ELSE
     172            cflz(ij,l)=-wg(ij,l)*dtvr/masse(ij,l-1)
     173         END IF
     174      END DO
     175   END DO
     176
     177   DO l=1,llm
     178      cflxmax(l)=max(cflxmax(l),maxval(cflx(:,l)))
     179      cflymax(l)=max(cflymax(l),maxval(cfly(:,l)))
     180      cflzmax(l)=max(cflzmax(l),maxval(cflz(:,l)))
     181   END DO
     182
     183   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     184   ! Par defaut, on sort le diagnostic des CFL tous les jours.
     185   ! Si on veut le sortir a chaque pas d'advection en cas de plantage
     186   !       IF(countcfl==iapp_tracvl) then
     187   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     188   IF(countcfl==day_step) then
     189      DO l=1,llm
     190         WRITE(lunout,*) 'L, CFL[xyz]max:', l, cflxmax(l), cflymax(l), cflzmax(l)
     191      END DO
     192      countcfl=0
     193   END IF
     194
     195   !---------------------------------------------------------------------------
     196   !   Advection proprement dite (Modification Le Croller (07/2001)
     197   !---------------------------------------------------------------------------
     198
     199   !---------------------------------------------------------------------------
     200   !   Calcul des moyennes basees sur la masse
     201   !---------------------------------------------------------------------------
     202   CALL massbar(massem,massebx,masseby)
     203
     204#ifdef DEBUG_IO   
     205   CALL WriteField_u('massem',massem)
     206   CALL WriteField_u('wg',wg)
     207   CALL WriteField_u('pbarug',pbarug)
     208   CALL WriteField_v('pbarvg',pbarvg)
     209   CALL WriteField_u('p_tmp',p)
     210   CALL WriteField_u('pk_tmp',pk)
     211   CALL WriteField_u('teta_tmp',teta)
     212   DO iq=1,nqtot
     213      CALL WriteField_u('q_adv'//trim(int2str(iq)),q(:,:,iq))
     214   END DO
     215#endif
     216
     217   IF(ok_iso_verif) THEN
     218      WRITE(*,*) 'advtrac 227'
     219      CALL check_isotopes_seq(q,ip1jmp1,'advtrac 162')
     220   END IF
     221
     222   !-------------------------------------------------------------------------
     223   !       Appel des sous programmes d'advection
     224   !-------------------------------------------------------------------------
     225   DO iq = 1, nqtot
     226!     CALL clock(t_initial)
     227      IF(tracers(iq)%parent /= 'air') CYCLE
     228      iadv = tracers(iq)%iadv
     229      !-----------------------------------------------------------------------
     230      SELECT CASE(iadv)
     231      !-----------------------------------------------------------------------
    231232         CASE(0); CYCLE
    232          CASE(10)
    233         !   ----------------------------------------------------------------
    234         !   Schema de Van Leer I MUSCL
    235         !   ----------------------------------------------------------------
    236            ! CRisi: on fait passer tout q pour avoir acces aux fils
    237            
    238            !write(*,*) 'advtrac 239: iq,q(1721,19,:)=',iq,q(1721,19,:)     
    239            call vlsplt(q,2.,massem,wg,pbarug,pbarvg,dtvr,iq)
    240            
    241          CASE(14)
    242            !   ----------------------------------------------------------------
    243            !   Schema "pseudo amont" + test sur humidite specifique
    244            !    pour la vapeur d'eau. F. Codron
    245            !   ----------------------------------------------------------------
    246            !
    247            !write(*,*) 'advtrac 248: iq,q(1721,19,:)=',iq,q(1721,19,:)
    248            CALL vlspltqs( q, 2., massem, wg , &
    249                 pbarug,pbarvg,dtvr,p,pk,teta,iq)
    250            
    251          CASE(12)
    252            !   ----------------------------------------------------------------
    253            !   Schema de Frederic Hourdin
    254            !   ----------------------------------------------------------------
    255            !            Pas de temps adaptatif
    256            call adaptdt(iadv,dtbon,n,pbarug,massem)
    257            if (n.GT.1) then
    258               write(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=', &
    259                    dtvr,'n=',n
    260            endif
    261            do indice=1,n
    262               call advn(q(1,1,iq),massem,wg,pbarug,pbarvg,dtbon,1)
    263            end do
    264          CASE(13)
    265            !            Pas de temps adaptatif
    266            call adaptdt(iadv,dtbon,n,pbarug,massem)
    267            if (n.GT.1) then
    268               write(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=', &
    269                    dtvr,'n=',n
    270            endif
    271            do indice=1,n
    272               call advn(q(1,1,iq),massem,wg,pbarug,pbarvg,dtbon,2)
    273            end do
    274          CASE(20)
    275            !   ----------------------------------------------------------------
    276            !   Schema de pente SLOPES
    277            !   ----------------------------------------------------------------
    278            call pentes_ini (q(1,1,iq),wg,massem,pbarug,pbarvg,0)
    279 
    280          CASE(30)
    281            !   ----------------------------------------------------------------
    282            !   Schema de Prather
    283            !   ----------------------------------------------------------------
    284            !            Pas de temps adaptatif
    285            call adaptdt(iadv,dtbon,n,pbarug,massem)
    286            if (n.GT.1) then
    287               write(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=', &
    288                    dtvr,'n=',n
    289            endif
    290            call  prather(q(1,1,iq),wg,massem,pbarug,pbarvg, &
    291                 n,dtbon)
    292 
    293          CASE(11,16,17,18)
    294            !   ----------------------------------------------------------------
    295            !   Schemas PPM Lin et Rood
    296            !   ----------------------------------------------------------------
    297 
    298            !        Test sur le flux horizontal
    299            !        Pas de temps adaptatif
    300            call adaptdt(iadv,dtbon,n,pbarug,massem)
    301            if (n.GT.1) then
    302               write(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=', &
    303                    dtvr,'n=',n
    304            endif
    305            !        Test sur le flux vertical
    306            CFLmaxz=0.
    307            do l=2,llm
    308               do ij=iip2,ip1jm
    309                  aaa=wg(ij,l)*dtvr/massem(ij,l)
    310                  CFLmaxz=max(CFLmaxz,aaa)
    311                  bbb=-wg(ij,l)*dtvr/massem(ij,l-1)
    312                  CFLmaxz=max(CFLmaxz,bbb)
    313               enddo
    314            enddo
    315            if (CFLmaxz.GE.1) then
    316               write(*,*) 'WARNING vertical','CFLmaxz=', CFLmaxz
    317            endif
    318 
    319            !-----------------------------------------------------------
    320            !        Ss-prg interface LMDZ.4->PPM3d (ss-prg de Lin)
    321            !-----------------------------------------------------------
    322 
    323            call interpre(q(1,1,iq),qppm(1,1,iq),wg,fluxwppm,massem, &
    324                 apppm,bpppm,massebx,masseby,pbarug,pbarvg, &
    325                 unatppm,vnatppm,psppm)
    326 
    327            do indice=1,n
    328               !----------------------------------------------------------------
    329               !                         VL (version PPM) horiz. et PPM vert.
    330               !----------------------------------------------------------------
    331              SELECT CASE(iadv)
    332                CASE(11)
    333                  call ppm3d(1,qppm(1,1,iq), &
    334                       psppm,psppm, &
    335                       unatppm,vnatppm,fluxwppm,dtbon,2,2,2,1, &
    336                       iim,jjp1,2,llm,apppm,bpppm,0.01,6400000, &
    337                       fill,dum,220.)
    338 
    339                CASE(16)
    340                  !-------------------------------------------------------------
    341                  !                           Monotonic PPM
    342                  !-------------------------------------------------------------
    343                  call ppm3d(1,qppm(1,1,iq), &
    344                       psppm,psppm, &
    345                       unatppm,vnatppm,fluxwppm,dtbon,3,3,3,1, &
    346                       iim,jjp1,2,llm,apppm,bpppm,0.01,6400000, &
    347                       fill,dum,220.)
    348                  !-------------------------------------------------------------
    349 
    350                CASE(17)
    351                  !-------------------------------------------------------------
    352                  !                           Semi Monotonic PPM
    353                  !-------------------------------------------------------------
    354                  call ppm3d(1,qppm(1,1,iq), &
    355                       psppm,psppm, &
    356                       unatppm,vnatppm,fluxwppm,dtbon,4,4,4,1, &
    357                       iim,jjp1,2,llm,apppm,bpppm,0.01,6400000, &
    358                       fill,dum,220.)
    359                  !-------------------------------------------------------------
    360 
    361                CASE(18)
    362                  !-------------------------------------------------------------
    363                  !                         Positive Definite PPM
    364                  !-------------------------------------------------------------
    365                  call ppm3d(1,qppm(1,1,iq), &
    366                       psppm,psppm, &
    367                       unatppm,vnatppm,fluxwppm,dtbon,5,5,5,1, &
    368                       iim,jjp1,2,llm,apppm,bpppm,0.01,6400000, &
    369                       fill,dum,220.)
    370                  !-------------------------------------------------------------
    371              END SELECT
    372            enddo
    373            !-----------------------------------------------------------------
    374            !               Ss-prg interface PPM3d-LMDZ.4
    375            !-----------------------------------------------------------------
    376            call interpost(q(1,1,iq),qppm(1,1,iq))
    377          END SELECT
    378         !----------------------------------------------------------------------
    379 
    380         !-----------------------------------------------------------------
    381         ! On impose une seule valeur du traceur au pôle Sud j=jjm+1=jjp1
    382         ! et Nord j=1
    383         !-----------------------------------------------------------------
    384 
    385         !                  call traceurpole(q(1,1,iq),massem)
    386 
    387         ! calcul du temps cpu pour un schema donne
    388 
    389         !                  call clock(t_final)
    390         !ym                  tps_cpu=t_final-t_initial
    391         !ym                  cpuadv(iq)=cpuadv(iq)+tps_cpu
    392 
    393      end DO
    394 
    395      if (ok_iso_verif) then
    396            write(*,*) 'advtrac 402'
    397            call check_isotopes_seq(q,ip1jmp1,'advtrac 397')
    398      endif !if (ok_iso_verif) then
    399 
    400      !------------------------------------------------------------------
    401      !   on reinitialise a zero les flux de masse cumules
    402      !---------------------------------------------------
    403      iadvtr=0
    404 
    405   ENDIF ! if iadvtr.EQ.iapp_tracvl
     233         !--------------------------------------------------------------------
     234         CASE(10)  !--- Schema de Van Leer I MUSCL
     235         !--------------------------------------------------------------------
     236!           WRITE(*,*) 'advtrac 239: iq,q(1721,19,:)=',iq,q(1721,19,:)     
     237            CALL vlsplt(q,2.,massem,wg,pbarug,pbarvg,dtvr,iq)
     238
     239         !--------------------------------------------------------------------
     240         CASE(14)  !--- Schema "pseuDO amont" + test sur humidite specifique
     241                   !--- pour la vapeur d'eau. F. Codron
     242         !--------------------------------------------------------------------
     243!           WRITE(*,*) 'advtrac 248: iq,q(1721,19,:)=',iq,q(1721,19,:)
     244            CALL vlspltqs(q,2.,massem,wg,pbarug,pbarvg,dtvr,p,pk,teta,iq)
     245
     246         !--------------------------------------------------------------------
     247         CASE(12)  !--- Schema de Frederic Hourdin
     248         !--------------------------------------------------------------------
     249            CALL adaptdt(iadv,dtbon,n,pbarug,massem)   ! pas de temps adaptatif
     250            IF(n > 1) WRITE(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=',dtvr,'n=',n
     251            DO indice=1,n
     252              CALL advn(q(1,1,iq),massem,wg,pbarug,pbarvg,dtbon,1)
     253            END DO
     254
     255         !--------------------------------------------------------------------
     256         CASE(13)  !--- Pas de temps adaptatif
     257         !--------------------------------------------------------------------
     258            CALL adaptdt(iadv,dtbon,n,pbarug,massem)
     259            IF(n > 1) WRITE(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=',dtvr,'n=',n
     260            DO indice=1,n
     261               CALL advn(q(1,1,iq),massem,wg,pbarug,pbarvg,dtbon,2)
     262            END DO
     263
     264         !--------------------------------------------------------------------
     265         CASE(20)  !--- Schema de pente SLOPES
     266         !--------------------------------------------------------------------
     267            CALL pentes_ini (q(1,1,iq),wg,massem,pbarug,pbarvg,0)
     268
     269         !--------------------------------------------------------------------
     270         CASE(30)  !--- Schema de Prather
     271         !--------------------------------------------------------------------
     272            ! Pas de temps adaptatif
     273            CALL adaptdt(iadv,dtbon,n,pbarug,massem)
     274            IF(n > 1) WRITE(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=',dtvr,'n=',n
     275            CALL prather(q(1,1,iq),wg,massem,pbarug,pbarvg,n,dtbon)
     276
     277         !--------------------------------------------------------------------
     278         CASE(11,16,17,18)   !--- Schemas PPM Lin et Rood
     279         !--------------------------------------------------------------------
     280            ! Test sur le flux horizontal
     281            CALL adaptdt(iadv,dtbon,n,pbarug,massem)   ! pas de temps adaptatif
     282            IF(n > 1) WRITE(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=',dtvr,'n=',n
     283            ! Test sur le flux vertical
     284            CFLmaxz=0.
     285            DO l=2,llm
     286               DO ij=iip2,ip1jm
     287                  aaa=wg(ij,l)*dtvr/massem(ij,l)
     288                  CFLmaxz=max(CFLmaxz,aaa)
     289                  bbb=-wg(ij,l)*dtvr/massem(ij,l-1)
     290                  CFLmaxz=max(CFLmaxz,bbb)
     291               END DO
     292            END DO
     293            IF(CFLmaxz.GE.1) WRITE(*,*) 'WARNING vertical','CFLmaxz=', CFLmaxz
     294            !----------------------------------------------------------------
     295            !     Ss-prg interface LMDZ.4->PPM3d (ss-prg de Lin)
     296            !----------------------------------------------------------------
     297            CALL interpre(q(1,1,iq),qppm(1,1,iq),wg,fluxwppm,massem, &
     298                 apppm,bpppm,massebx,masseby,pbarug,pbarvg, &
     299                 unatppm,vnatppm,psppm)
     300
     301            !----------------------------------------------------------------
     302            DO indice=1,n     !--- VL (version PPM) horiz. et PPM vert.
     303            !----------------------------------------------------------------
     304               SELECT CASE(iadv)
     305                  !----------------------------------------------------------
     306                  CASE(11)
     307                  !----------------------------------------------------------
     308                     CALL ppm3d(1,qppm(1,1,iq),psppm,psppm,unatppm,vnatppm,fluxwppm,dtbon, &
     309                                2,2,2,1,iim,jjp1,2,llm,apppm,bpppm,0.01,6400000,fill,dum,220.)
     310                  !----------------------------------------------------------
     311                  CASE(16) !--- Monotonic PPM
     312                  !----------------------------------------------------------
     313                     CALL ppm3d(1,qppm(1,1,iq),psppm,psppm,unatppm,vnatppm,fluxwppm,dtbon, &
     314                                3,3,3,1,iim,jjp1,2,llm,apppm,bpppm,0.01,6400000,fill,dum,220.)
     315                  !----------------------------------------------------------
     316                  CASE(17) !--- Semi monotonic PPM
     317                  !----------------------------------------------------------
     318                     CALL ppm3d(1,qppm(1,1,iq),psppm,psppm,unatppm,vnatppm,fluxwppm,dtbon, &
     319                                4,4,4,1,iim,jjp1,2,llm,apppm,bpppm,0.01,6400000, fill,dum,220.)
     320                  !----------------------------------------------------------
     321                  CASE(18) !--- Positive Definite PPM
     322                  !----------------------------------------------------------
     323                     CALL ppm3d(1,qppm(1,1,iq),psppm,psppm,unatppm,vnatppm,fluxwppm,dtbon, &
     324                                5,5,5,1,iim,jjp1,2,llm,apppm,bpppm,0.01,6400000,fill,dum,220.)
     325               END SELECT
     326            !----------------------------------------------------------------
     327            END DO
     328            !----------------------------------------------------------------
     329            !     Ss-prg interface PPM3d-LMDZ.4
     330            !----------------------------------------------------------------
     331            CALL interpost(q(1,1,iq),qppm(1,1,iq))
     332      !----------------------------------------------------------------------
     333      END SELECT
     334      !----------------------------------------------------------------------
     335
     336      !----------------------------------------------------------------------
     337      ! On impose une seule valeur du traceur au pole Sud j=jjm+1=jjp1 et Nord j=1
     338      !----------------------------------------------------------------------
     339      !  CALL traceurpole(q(1,1,iq),massem)
     340
     341      !--- Calcul du temps cpu pour un schema donne
     342      !  CALL clock(t_final)
     343      !ym  tps_cpu=t_final-t_initial
     344      !ym  cpuadv(iq)=cpuadv(iq)+tps_cpu
     345
     346   END DO
     347
     348   IF(ok_iso_verif) then
     349      WRITE(*,*) 'advtrac 402'
     350      CALL check_isotopes_seq(q,ip1jmp1,'advtrac 397')
     351   END IF
     352
     353   !-------------------------------------------------------------------------
     354   !   on reinitialise a zero les flux de masse cumules
     355   !-------------------------------------------------------------------------
     356   iadvtr=0
    406357
    407358END SUBROUTINE advtrac
  • LMDZ6/trunk/libf/dyn3d/iniacademic.F90

    r4052 r4056  
    55
    66  USE filtreg_mod, ONLY: inifilr
    7   USE infotrac,    ONLY: nqtot,niso_possibles,ok_isotopes,ok_iso_verif,tnat,alpha_ideal, &
    8         & iqiso,iso_indnum, tracers
     7  USE infotrac,    ONLY: nqtot, niso_possibles, ok_isotopes, ok_iso_verif, tnat, alpha_ideal, &
     8                         iqiso, tracers, iso_indnum
    99  USE control_mod, ONLY: day_step,planet_type
     10  use exner_hyb_m, only: exner_hyb
     11  use exner_milieu_m, only: exner_milieu
    1012#ifdef CPP_IOIPSL
    1113  USE IOIPSL, ONLY: getin
     
    1517#endif
    1618  USE Write_Field
    17   use exner_hyb_m, only: exner_hyb
    18   use exner_milieu_m, only: exner_milieu
    1919  USE comconst_mod, ONLY: cpp, kappa, g, daysec, dtvr, pi, im, jm
    2020  USE logic_mod, ONLY: iflag_phys, read_start
     
    6262  real tetastrat ! potential temperature in the stratosphere, in K
    6363  real tetajl(jjp1,llm)
    64   INTEGER i,j,l,lsup,ij, iq
     64  INTEGER i,j,l,lsup,ij, iq, iName, iZone, iPhase, iqParent
    6565
    6666  REAL teta0,ttp,delt_y,delt_z,eps ! Constantes pour profil de T
     
    7171
    7272  real zz,ran1
    73   integer idum, iqParent, iName, iZone, iPhase
     73  integer idum
    7474
    7575  REAL zdtvr
     
    7777  character(len=*),parameter :: modname="iniacademic"
    7878  character(len=80) :: abort_message
    79 
    8079
    8180  ! Sanity check: verify that options selected by user are not incompatible
     
    131130        ps(:)=preff
    132131     endif
     132
    133133     ! ground geopotential
    134134     phis(:)=0.
    135135     CALL pression ( ip1jmp1, ap, bp, ps, p       )
     136
    136137     if (pressure_exner) then
    137138       CALL exner_hyb( ip1jmp1, ps, p, pks, pk)
     
    194195     CALL getin('tetanoise',tetanoise)
    195196
    196 
    197197     ! 2. Initialize fields towards which to relax
    198198     ! Friction
     
    247247     IF (.NOT. read_start) THEN
    248248        ! bulk initialization of temperature
    249 
    250249        IF (iflag_phys>10000) THEN
    251250        ! Particular case to impose a constant temperature T0=0.01*iflag_physx
     
    254253           teta(:,:)=tetarappel(:,:)
    255254        ENDIF
    256 
    257255        ! geopotential
    258256        CALL geopot(ip1jmp1,teta,pk,pks,phis,phi)
     
    287285              iName = tracers(iq)%iso_iName
    288286              if (.NOT.ok_isotopes .OR. iName <= 0) CYCLE
    289               iZone = tracers(iq)%iso_iZone
    290               iPhase= tracers(iq)%iso_iPhase
     287              iZone    = tracers(iq)%iso_iZone
     288              iPhase   = tracers(iq)%iso_iPhase
    291289              iqParent = tracers(iq)%iqParent
    292290              if (iZone == 0) q(:,:,iq) = q(:,:,iqParent)*tnat(iName) &
     
    298296        endif ! of if (planet_type=="earth")
    299297
    300         if (ok_iso_verif) then
    301            call check_isotopes_seq(q,1,ip1jmp1,'iniacademic_loc')
    302         endif !if (ok_iso_verif) then
     298        if (ok_iso_verif) call check_isotopes_seq(q,1,ip1jmp1,'iniacademic_loc')
    303299
    304300        ! add random perturbation to temperature
  • LMDZ6/trunk/libf/dyn3d_common/infotrac.F90

    r4052 r4056  
    1414  INTEGER, SAVE :: nbtr
    1515
    16 ! CRisi: on retranche les isotopes des traceurs habituels
    17 ! On fait un tableaux d'indices des traceurs qui passeront dans phytrac
     16! Nombre de traceurs passes a phytrac
    1817  INTEGER, SAVE :: nqtottr
    19   INTEGER, ALLOCATABLE, DIMENSION(:), SAVE :: itr_indice
    20 
    21 ! CRisi: nb traceurs peres= directement advectes par l'air
    22   INTEGER, SAVE :: nqperes
    23 
    24 ! ThL: nb traceurs INCA
    25   INTEGER, SAVE :: nqINCA
    2618
    2719! ThL: nb traceurs CO2
     
    3123  TYPE(trac_type), TARGET,  SAVE, ALLOCATABLE ::  tracers(:)    !=== TRACERS DESCRIPTORS VECTOR
    3224  TYPE(isot_type), TARGET,  SAVE, ALLOCATABLE :: isotopes(:)    !=== ISOTOPES PARAMETERS VECTOR
    33 
    34 ! niadv : vector keeping the coorspondance between all tracers(nqtot) treated in the
    35 !         dynamic part of the code and the tracers (nbtr+2) used in the physics part of the code.
    36   INTEGER, ALLOCATABLE, DIMENSION(:), SAVE    :: niadv ! equivalent dyn / physique
    3725
    3826  REAL :: qperemin,masseqmin,ratiomin ! MVals et CRisi
     
    5947  INTEGER,SAVE :: niso,ntraceurs_zone,ntraciso
    6048
    61 #ifdef CPP_StratAer
    62 !--CK/OB for stratospheric aerosols
    63   INTEGER, SAVE :: nbtr_bin
    64   INTEGER, SAVE :: nbtr_sulgas
    65   INTEGER, SAVE :: id_OCS_strat
    66   INTEGER, SAVE :: id_SO2_strat
    67   INTEGER, SAVE :: id_H2SO4_strat
    68   INTEGER, SAVE :: id_BIN01_strat
    69   INTEGER, SAVE :: id_TEST_strat
    70 #endif
    71  
    7249CONTAINS
    7350
     
    12097    LOGICAL :: continu,nouveau_traceurdef
    12198    INTEGER :: IOstatus ! gestion de la retrocompatibilite de traceur.def
    122     CHARACTER(len=maxlen) :: tchaine   
     99    CHARACTER(len=maxlen) :: tchaine, msg1
    123100    INTEGER, ALLOCATABLE  :: iqfils(:,:)
     101    INTEGER :: nqINCA
    124102
    125103    character(len=*),parameter :: modname="infotrac_init"
     
    142120    descrq(30)='PRA'
    143121   
    144 
    145     ! Coherence test between parameter type_trac, config_inca and preprocessing keys
    146     IF (type_trac=='inca') THEN
    147        WRITE(lunout,*) 'You have chosen to couple with INCA chemistry model : type_trac=', &
    148             type_trac,' config_inca=',config_inca
    149        IF (config_inca/='aero' .AND. config_inca/='aeNP' .AND. config_inca/='chem') THEN
    150           WRITE(lunout,*) 'Incoherence between type_trac and config_inca. Model stops. Modify run.def'
    151           CALL abort_gcm('infotrac_init','Incoherence between type_trac and config_inca',1)
    152        ENDIF
     122    !--- MESSAGE ABOUT THE CHOSEN CONFIGURATION
     123    WRITE(lunout,*)'type_trac='//TRIM(type_trac)
     124    msg1 = 'For type_trac = "'//TRIM(type_trac)//'":'
     125    SELECT CASE(type_trac)
     126      CASE('inca'); WRITE(lunout,*)TRIM(msg1)//' coupling with INCA chemistry model, config_inca='//config_inca
     127      CASE('inco'); WRITE(lunout,*)TRIM(msg1)//' coupling jointly with INCA and CO2 cycle'
     128      CASE('repr'); WRITE(lunout,*)TRIM(msg1)//' coupling with REPROBUS chemistry model'
     129      CASE('co2i'); WRITE(lunout,*)TRIM(msg1)//' you have chosen to run with CO2 cycle'
     130      CASE('coag'); WRITE(lunout,*)TRIM(msg1)//' tracers are treated for COAGULATION tests'
     131      CASE('lmdz'); WRITE(lunout,*)TRIM(msg1)//' tracers are treated in LMDZ only'
     132      CASE DEFAULT
     133        CALL abort_gcm(modname,'type_trac='//TRIM(type_trac)//' not possible yet.',1)
     134    END SELECT
     135
     136    !--- COHERENCE TEST BETWEEN "type_trac", "config_inca" AND PREPROCESSING KEYS
     137    SELECT CASE(type_trac)
     138      CASE('inca','inco'); IF(ALL(['aero', 'aeNP', 'chem']/=config_inca)) &
     139        CALL abort_gcm(modname, 'Incoherence between type_trac and config_inca. Please modify "run.def"',1)
    153140#ifndef INCA
    154        WRITE(lunout,*) 'To run this option you must add cpp key INCA and compile with INCA code'
    155        CALL abort_gcm('infotrac_init','You must compile with cpp key INCA',1)
     141        CALL abort_gcm(modname, 'You must add cpp key INCA and compile with INCA code',1)
    156142#endif
    157     ELSE IF (type_trac=='repr') THEN
    158        WRITE(lunout,*) 'You have chosen to couple with REPROBUS chemestry model : type_trac=', type_trac
     143      CASE('repr')
    159144#ifndef REPROBUS
    160        WRITE(lunout,*) 'To run this option you must add cpp key REPROBUS and compile with REPRPBUS code'
    161        CALL abort_gcm('infotrac_init','You must compile with cpp key REPROBUS',1)
     145        CALL abort_gcm(modname, 'You must add cpp key REPROBUS and compile with REPROBUS code',1)
    162146#endif
    163     ELSE IF (type_trac == 'co2i') THEN
    164        WRITE(lunout,*) 'You have chosen to run with CO2 cycle: type_trac=', type_trac
    165     ELSE IF (type_trac == 'coag') THEN
    166        WRITE(lunout,*) 'Tracers are treated for COAGULATION tests : type_trac=', type_trac
     147      CASE('coag')
    167148#ifndef CPP_StratAer
    168        WRITE(lunout,*) 'To run this option you must add cpp key StratAer and compile with StratAer code'
    169        CALL abort_gcm('infotrac_init','You must compile with cpp key StratAer',1)
     149        CALL abort_gcm(modname, 'You must add cpp key StratAer and compile with StratAer code',1)
    170150#endif
    171     ELSE IF (type_trac == 'lmdz') THEN
    172        WRITE(lunout,*) 'Tracers are treated in LMDZ only : type_trac=', type_trac
    173     ELSE IF (type_trac == 'inco') THEN ! ThL
    174        WRITE(lunout,*) 'Using jointly INCA and CO2 cycle: type_trac =', type_trac
    175        IF (config_inca/='aero' .AND. config_inca/='aeNP' .AND. config_inca/='chem') THEN
    176           WRITE(lunout,*) 'Incoherence between type_trac and config_inca. Model stops. Modify run.def'
    177           CALL abort_gcm('infotrac_init','Incoherence between type_trac and config_inca',1)
    178        ENDIF
    179 #ifndef INCA
    180        WRITE(lunout,*) 'To run this option you must add cpp key INCA and compilewith INCA code'
    181        CALL abort_gcm('infotrac_init','You must compile with cpp key INCA',1)
    182 #endif   
    183     ELSE
    184        WRITE(lunout,*) 'type_trac=',type_trac,' not possible. Model stops'
    185        CALL abort_gcm('infotrac_init','bad parameter',1)
    186     ENDIF
    187 
    188     ! Test if config_inca is other then none for run without INCA
    189     IF (type_trac/='inca' .AND. type_trac/='inco' .AND. config_inca/='none') THEN
    190        WRITE(lunout,*) 'config_inca will now be changed to none as you do not couple with INCA model'
    191        config_inca='none'
    192     ENDIF
     151    END SELECT
     152
     153    !--- Disable "config_inca" option for a run without INCA if it differs from "none"
     154    IF (ALL(['inca', 'inco', 'none'] /= config_inca)) THEN
     155      WRITE(lunout,*)'setting config_inca="none" as you do not couple with INCA model'
     156      config_inca = 'none'
     157    END IF
    193158
    194159!-----------------------------------------------------------------------
     
    198163!
    199164!-----------------------------------------------------------------------
    200     IF (type_trac == 'lmdz' .OR. type_trac == 'repr' .OR. type_trac == 'coag' .OR. type_trac == 'co2i') THEN
    201        IF (type_trac=='co2i') THEN
    202           nqCO2 = 1
    203        ELSE
    204           nqCO2 = 0
    205        ENDIF
    206        OPEN(90,file='traceur.def',form='formatted',status='old', iostat=ierr)
    207        IF(ierr.EQ.0) THEN
    208           WRITE(lunout,*) trim(modname),': Open traceur.def : ok'
    209           READ(90,*) nqtrue
    210           write(lunout,*) 'nqtrue=',nqtrue
    211        ELSE
    212           WRITE(lunout,*) trim(modname),': Failed opening traceur.def'
    213           CALL abort_gcm(modname,"file traceur.def not found!",1)
    214        ENDIF
    215 !jyg<
    216 !!       if ( planet_type=='earth') then
    217 !!         ! For Earth, water vapour & liquid tracers are not in the physics
    218 !!         nbtr=nqtrue-2
    219 !!       else
    220 !!         ! Other planets (for now); we have the same number of tracers
    221 !!         ! in the dynamics than in the physics
    222 !!         nbtr=nqtrue
    223 !!       endif
    224 !>jyg
    225     ELSE ! type_trac=inca or inco
    226        IF (type_trac=='inco') THEN
    227           nqCO2 = 1
    228        ELSE
    229           nqCO2 = 0
    230        ENDIF
    231 !jyg<
    232        ! The traceur.def file is used to define the number "nqo" of water phases
    233        ! present in the simulation. Default : nqo = 2.
    234        OPEN(90,file='traceur.def',form='formatted',status='old', iostat=ierr)
    235        IF(ierr.EQ.0) THEN
    236           WRITE(lunout,*) trim(modname),': Open traceur.def : ok'
    237           READ(90,*) nqo
    238        ELSE
    239           WRITE(lunout,*) trim(modname),': Failed opening traceur.def'
    240           CALL abort_gcm(modname,"file traceur.def not found!",1)
    241        ENDIF
    242        IF (nqo /= 2 .AND. nqo /= 3 ) THEN
    243           IF (nqo == 4 .AND. type_trac=='inco') THEN ! ThL
    244              WRITE(lunout,*) trim(modname),': you are coupling with INCA, and also using CO2i.'
    245              nqo = 3    ! A ameliorier... je force 3 traceurs eau...  ThL
    246              WRITE(lunout,*) trim(modname),': nqo = ',nqo
    247           ELSE
    248           WRITE(lunout,*) trim(modname),': nqo=',nqo, ' is not allowed. Only 2 or 3 water phases allowed'
    249           CALL abort_gcm('infotrac_init','Bad number of water phases',1)
    250           ENDIF
    251        ENDIF
    252        ! nbtr has been read from INCA by init_const_lmdz() in gcm.F
     165    OPEN(90,file='traceur.def',form='formatted',status='old', iostat=ierr)
     166    IF(ierr.EQ.0) THEN
     167       WRITE(lunout,*) trim(modname),': Open traceur.def : ok'
     168    ELSE
     169       WRITE(lunout,*) trim(modname),': Failed opening traceur.def'
     170       CALL abort_gcm(modname,"file traceur.def not found!",1)
     171    ENDIF
     172    nqCO2 = 0; IF(type_trac == 'inco') nqCO2 = 1
     173    SELECT CASE(type_trac)
     174       CASE('lmdz','repr','coag','co2i'); READ(90,*) nqtrue
     175       CASE('inca','inco');               READ(90,*) nqo
     176          ! The traceur.def file is used to define the number "nqo" of water phases
     177          ! present in the simulation. Default : nqo = 2.
     178          IF (nqo == 4 .AND. type_trac=='inco') nqo = 3
     179          IF(ALL([2,3] /= nqo)) THEN
     180             WRITE(lunout,*) trim(modname),': nqo=',nqo, ' is not allowed. Only 2 or 3 water phases allowed'
     181             CALL abort_gcm('infotrac_init','Bad number of water phases',1)
     182          END IF
     183          ! nbtr has been read from INCA by init_const_lmdz() in gcm.F
    253184#ifdef INCA
    254        CALL Init_chem_inca_trac(nqINCA)
     185          CALL Init_chem_inca_trac(nqINCA)
    255186#else
    256        nqINCA=0
     187          nqINCA=0
    257188#endif
    258        nbtr=nqINCA+nqCO2
    259        nqtrue=nbtr+nqo
    260        WRITE(lunout,*) trim(modname),': nqo = ',nqo
    261        WRITE(lunout,*) trim(modname),': nbtr = ',nbtr
    262        WRITE(lunout,*) trim(modname),': nqtrue = ',nqtrue
    263        WRITE(lunout,*) trim(modname),': nqCO2 = ',nqCO2
    264        WRITE(lunout,*) trim(modname),': nqINCA = ',nqINCA
    265        ALLOCATE(hadv_inca(nqINCA), vadv_inca(nqINCA), conv_flg_inca(nqINCA), pbl_flg_inca(nqINCA), solsym_inca(nqINCA))
    266     ENDIF   ! type_trac 'inca' ou 'inco'
     189          nbtr=nqINCA+nqCO2
     190          nqtrue=nbtr+nqo
     191          WRITE(lunout,*) trim(modname),': nqo    = ',nqo
     192          WRITE(lunout,*) trim(modname),': nbtr  = ',nbtr
     193          WRITE(lunout,*) trim(modname),': nqtrue = ',nqtrue
     194          WRITE(lunout,*) trim(modname),': nqCO2 = ',nqCO2
     195          WRITE(lunout,*) trim(modname),': nqINCA = ',nqINCA
     196          ALLOCATE(hadv_inca(nqINCA), vadv_inca(nqINCA), conv_flg_inca(nqINCA), pbl_flg_inca(nqINCA), solsym_inca(nqINCA))
     197    END SELECT
    267198!>jyg
    268199
     
    306237!    Get choice of advection schema from file tracer.def or from INCA
    307238!---------------------------------------------------------------------
    308     IF (type_trac == 'lmdz' .OR. type_trac == 'repr' .OR. type_trac == 'coag' .OR. type_trac == 'co2i') THEN
    309 
    310           ! Continue to read tracer.def
    311           DO iq=1,nqtrue
    312 
    313              write(*,*) 'infotrac 237: iq=',iq
    314              ! CRisi: ajout du nom du fluide transporteur
    315              ! mais rester retro compatible
    316              READ(90,'(I2,X,I2,X,A)',IOSTAT=IOstatus) hadv(iq),vadv(iq),tchaine
    317              write(lunout,*) 'iq,hadv(iq),vadv(iq)=',iq,hadv(iq),vadv(iq)
    318              write(lunout,*) 'tchaine=',trim(tchaine)
    319              write(*,*) 'infotrac 238: IOstatus=',IOstatus
    320              if (IOstatus.ne.0) then
    321                 CALL abort_gcm('infotrac_init','Pb dans la lecture de traceur.def',1)
    322              endif
    323              ! Y-a-t-il 1 ou 2 noms de traceurs? -> On regarde s'il y a un
    324              ! espace ou pas au milieu de la chaine.
    325              continu=.true.
    326              nouveau_traceurdef=.false.
    327              iiq=1
    328              do while (continu)
    329                 if (tchaine(iiq:iiq).eq.' ') then
    330                   nouveau_traceurdef=.true.
    331                   continu=.false.
    332                 else if (iiq.lt.LEN_TRIM(tchaine)) then
    333                   iiq=iiq+1
    334                 else
    335                   continu=.false.
    336                 endif
    337              enddo
    338              write(*,*) 'iiq,nouveau_traceurdef=',iiq,nouveau_traceurdef
    339              if (nouveau_traceurdef) then
    340                 write(lunout,*) 'C''est la nouvelle version de traceur.def'
    341                 tnom_0(iq)=TRIM(tchaine(1:iiq-1))
    342                 tnom_transp(iq)=TRIM(tchaine(iiq+1:))
    343              else
    344                 write(lunout,*) 'C''est l''ancienne version de traceur.def'
    345                 write(lunout,*) 'On suppose que les traceurs sont tous d''air'
    346                 tnom_0(iq)=tchaine
    347                 tnom_transp(iq) = 'air'
    348              endif
    349              write(lunout,*) 'tnom_0(iq)=<',trim(tnom_0(iq)),'>'
    350              write(lunout,*) 'tnom_transp(iq)=<',trim(tnom_transp(iq)),'>'
    351 
    352           ENDDO!DO iq=1,nqtrue
    353 
    354           CLOSE(90) 
     239    IF (ANY(['lmdz', 'repr', 'coag', 'co2i'] == type_trac)) THEN
     240
     241       ! Continue to read tracer.def
     242       DO iq=1,nqtrue
     243
     244          write(*,*) 'infotrac 237: iq=',iq
     245          ! CRisi: ajout du nom du fluide transporteur
     246          ! mais rester retro compatible
     247          READ(90,'(I2,X,I2,X,A)',IOSTAT=IOstatus) hadv(iq),vadv(iq),tchaine
     248          write(lunout,*) 'iq,hadv(iq),vadv(iq)=',iq,hadv(iq),vadv(iq)
     249          write(lunout,*) 'tchaine=',trim(tchaine)
     250          write(*,*) 'infotrac 238: IOstatus=',IOstatus
     251          if (IOstatus.ne.0) CALL abort_gcm('infotrac_init','Pb dans la lecture de traceur.def',1)
     252          ! Y-a-t-il 1 ou 2 noms de traceurs separes par un espace ?
     253          iiq = INDEX(tchaine(1:LEN_TRIM(tchaine)),' ')
     254          nouveau_traceurdef=iiq/=0
     255          write(*,*) 'iiq,nouveau_traceurdef=',iiq,nouveau_traceurdef
     256          if (nouveau_traceurdef) then
     257             IF(iq==1) write(lunout,*) "Nouvelle version de traceur.def"
     258             tnom_0     (iq) = tchaine(1:iiq-1)
     259             tnom_transp(iq) = tchaine(iiq+1:)
     260          else
     261             IF(iq==1) write(lunout,*) "Nouvelle version de traceur.def: traceurs d'air uniquement"
     262             tnom_0     (iq) = tchaine
     263             tnom_transp(iq) = 'air'
     264          endif
     265          write(lunout,*) 'tnom_0(iq)=<',trim(tnom_0(iq)),'>'
     266          write(lunout,*) 'tnom_transp(iq)=<',trim(tnom_transp(iq)),'>'
     267       ENDDO!DO iq=1,nqtrue
     268
     269       CLOSE(90) 
    355270
    356271       WRITE(lunout,*) trim(modname),': Valeur de traceur.def :'
     
    362277       IF ( planet_type=='earth') THEN
    363278         !CR: nombre de traceurs de l eau
    364          IF (tnom_0(3) == 'H2Oi') THEN
    365             nqo=3
    366          ELSE
    367             nqo=2
    368          ENDIF
     279         nqo=2; IF (tnom_0(3) == 'H2Oi') nqo=3
    369280         ! For Earth, water vapour & liquid tracers are not in the physics
    370281         nbtr=nqtrue-nqo
     
    375286       ENDIF
    376287
    377 #ifdef CPP_StratAer
    378        IF (type_trac == 'coag') THEN
    379          nbtr_bin=0
    380          nbtr_sulgas=0
    381          DO iq=1,nqtrue
    382            IF (tnom_0(iq)(1:3)=='BIN') THEN !check if tracer name contains 'BIN'
    383              nbtr_bin=nbtr_bin+1
    384            ENDIF
    385            IF (tnom_0(iq)(1:3)=='GAS') THEN !check if tracer name contains 'GAS'
    386              nbtr_sulgas=nbtr_sulgas+1
    387            ENDIF
    388          ENDDO
    389          print*,'nbtr_bin=',nbtr_bin
    390          print*,'nbtr_sulgas=',nbtr_sulgas
    391          DO iq=1,nqtrue
    392            IF (tnom_0(iq)=='GASOCS') THEN
    393              id_OCS_strat=iq-nqo
    394            ENDIF
    395            IF (tnom_0(iq)=='GASSO2') THEN
    396              id_SO2_strat=iq-nqo
    397            ENDIF
    398            IF (tnom_0(iq)=='GASH2SO4') THEN
    399              id_H2SO4_strat=iq-nqo
    400            ENDIF
    401            IF (tnom_0(iq)=='BIN01') THEN
    402              id_BIN01_strat=iq-nqo
    403            ENDIF
    404            IF (tnom_0(iq)=='GASTEST') THEN
    405              id_TEST_strat=iq-nqo
    406            ENDIF
    407          ENDDO
    408          print*,'id_OCS_strat  =',id_OCS_strat
    409          print*,'id_SO2_strat  =',id_SO2_strat
    410          print*,'id_H2SO4_strat=',id_H2SO4_strat
    411          print*,'id_BIN01_strat=',id_BIN01_strat
    412        ENDIF
     288    ENDIF
     289!jyg<
     290!
     291
     292! Transfert number of tracers to Reprobus
     293#ifdef REPROBUS
     294    IF (type_trac == 'repr') CALL Init_chem_rep_trac(nbtr,nqo,tnom_0)
    413295#endif
    414 
    415     ENDIF  ! (type_trac == 'lmdz' .OR. type_trac == 'repr' .OR. type_trac = 'coag' .OR. type_trac = 'co2i')
    416 !jyg<
    417 !
    418 
    419 ! Transfert number of tracers to Reprobus
    420     IF (type_trac == 'repr') THEN
    421 #ifdef REPROBUS
    422        CALL Init_chem_rep_trac(nbtr,nqo,tnom_0)
    423 #endif
    424     ENDIF
    425296!
    426297! Allocate variables depending on nbtr
     
    432303    IF (type_trac == 'inca' .OR. type_trac == 'inco') THEN   ! config_inca='aero' ou 'chem'
    433304!>jyg
    434 ! le module de chimie fournit les noms des traceurs
    435 ! et les schemas d'advection associes. excepte pour ceux lus
    436 ! dans traceur.def
    437 
    438           DO iq=1,nqo+nqCO2
    439 
    440              write(*,*) 'infotrac 237: iq=',iq
    441              ! CRisi: ajout du nom du fluide transporteur
    442              ! mais rester retro compatible
    443              READ(90,'(I2,X,I2,X,A)',IOSTAT=IOstatus) hadv(iq),vadv(iq),tchaine
    444              write(lunout,*) 'iq,hadv(iq),vadv(iq)=',iq,hadv(iq),vadv(iq)
    445              write(lunout,*) 'tchaine=',trim(tchaine)
    446              write(*,*) 'infotrac 238: IOstatus=',IOstatus
    447              if (IOstatus.ne.0) then
    448                 CALL abort_gcm('infotrac_init','Pb dans la lecture de traceur.def',1)
    449              endif
    450              ! Y-a-t-il 1 ou 2 noms de traceurs? -> On regarde s'il y a un
    451              ! espace ou pas au milieu de la chaine.
    452              continu=.true.
    453              nouveau_traceurdef=.false.
    454              iiq=1
    455 
    456              do while (continu)
    457                 if (tchaine(iiq:iiq).eq.' ') then
    458                   nouveau_traceurdef=.true.
    459                   continu=.false.
    460                 else if (iiq.lt.LEN_TRIM(tchaine)) then
    461                   iiq=iiq+1
    462                 else
    463                   continu=.false.
    464                 endif
    465              enddo
    466 
    467              write(*,*) 'iiq,nouveau_traceurdef=',iiq,nouveau_traceurdef
    468 
    469              if (nouveau_traceurdef) then
    470                 write(lunout,*) 'C''est la nouvelle version de traceur.def'
    471                 tnom_0(iq)=tchaine(1:iiq-1)
    472                 tnom_transp(iq)=tchaine(iiq+1:)
    473              else
    474                 write(lunout,*) 'C''est l''ancienne version de traceur.def'
    475                 write(lunout,*) 'On suppose que les traceurs sont tous d''air'
    476                 tnom_0(iq)=tchaine
    477                 tnom_transp(iq) = 'air'
    478              endif
    479 
    480              write(lunout,*) 'tnom_0(iq)=<',trim(tnom_0(iq)),'>'
    481              write(lunout,*) 'tnom_transp(iq)=<',trim(tnom_transp(iq)),'>'
    482 
    483           ENDDO  !DO iq=1,nqo
    484           CLOSE(90) 
    485 
    486  
     305! le module de chimie fournit les noms des traceurs et les schemas d'advection associes.
     306! excepte pour ceux lus dans traceur.def
     307
    487308#ifdef INCA
    488        CALL init_transport( &
    489             hadv_inca, &
    490             vadv_inca, &
    491             conv_flg_inca, &
    492             pbl_flg_inca,  &
    493             solsym_inca)
    494 
    495        conv_flg(1+nqCO2:nbtr) = conv_flg_inca
    496        pbl_flg(1+nqCO2:nbtr) = pbl_flg_inca
    497        solsym(1+nqCO2:nbtr) = solsym_inca
    498 
    499        IF (type_trac == 'inco') THEN
    500           conv_flg(1:nqCO2) = 1
    501           pbl_flg(1:nqCO2) = 1
    502           solsym(1:nqCO2) = 'CO2'
    503        ENDIF
     309       CALL init_transport(hadv_inca, vadv_inca, conv_flg_inca, pbl_flg_inca, solsym_inca)
     310       ! DC passive CO2 tracer is at index 1: H2O was removed ; nqCO2/=0 in "inco" case only
     311       conv_flg(1:nqCO2) = 1;   conv_flg(1+nqCO2:nbtr) = conv_flg_inca
     312        pbl_flg(1:nqCO2) = 1;    pbl_flg(1+nqCO2:nbtr) =  pbl_flg_inca
     313         solsym(1:nqCO2) = 'CO2'; solsym(1+nqCO2:nbtr) =   solsym_inca
    504314#endif
    505315
    506 !jyg<
    507        DO iq = nqo+nqCO2+1, nqtrue
    508           hadv(iq) = hadv_inca(iq-nqo-nqCO2)
    509           vadv(iq) = vadv_inca(iq-nqo-nqCO2)
    510           tnom_0(iq)=solsym_inca(iq-nqo-nqCO2)
    511           tnom_transp(iq) = 'air'
     316       itr = 0
     317       DO iq = 1, nqtot
     318          IF(iq > nqo+nqCO2) THEN
     319             itr = itr+1
     320             hadv  (iq) = hadv_inca  (itr)
     321             vadv  (iq) = vadv_inca  (itr)
     322             tnom_0(iq) = solsym_inca(itr)
     323             tnom_transp(iq) = 'air'
     324             CYCLE
     325          END IF
     326          write(*,*) 'infotrac 237: iq=',iq
     327          ! CRisi: ajout du nom du fluide transporteur en restant retro-compatible
     328          READ(90,'(I2,X,I2,X,A)',IOSTAT=IOstatus) hadv(iq),vadv(iq),tchaine
     329          write(lunout,*) 'iq,hadv(iq),vadv(iq)=',iq,hadv(iq),vadv(iq)
     330          write(lunout,*) 'tchaine=',trim(tchaine)
     331          write(*,*) 'infotrac 238: IOstatus=',IOstatus
     332          if (IOstatus.ne.0) CALL abort_gcm('infotrac_init','Pb dans la lecture de traceur.def',1)
     333          ! Y-a-t-il 1 ou 2 noms de traceurs separes par un espace ?
     334          iiq = INDEX(tchaine(1:LEN_TRIM(tchaine)),' ')
     335          nouveau_traceurdef=iiq/=0
     336          write(*,*) 'iiq,nouveau_traceurdef=',iiq,nouveau_traceurdef
     337          if (nouveau_traceurdef) then
     338             IF(iq==1) write(lunout,*) "Nouvelle version de traceur.def"
     339             tnom_0     (iq) = tchaine(1:iiq-1)
     340             tnom_transp(iq) = tchaine(iiq+1:)
     341          else
     342             IF(iq==1) write(lunout,*) "Nouvelle version de traceur.def: traceurs d'air uniquement"
     343             tnom_0     (iq) = tchaine
     344             tnom_transp(iq) = 'air'
     345          endif
     346          write(lunout,*) 'tnom_0(iq)=<',trim(tnom_0(iq)),'>'
     347          write(lunout,*) 'tnom_transp(iq)=<',trim(tnom_transp(iq)),'>'
    512348       END DO
    513 
     349       CLOSE(90) 
    514350    ENDIF ! (type_trac == 'inca' or 'inco')
    515351
     
    554390!
    555391    ALLOCATE(tracers(nqtot))
    556     ALLOCATE(niadv(nqtot))
    557392
    558393!-----------------------------------------------------------------------
     
    604439    END DO
    605440
    606 !
    607 ! Find vector keeping the correspodence between true and total tracers
    608 !
    609     niadv(:)=0
    610     iiq=0
     441    WRITE(lunout,*) trim(modname),': Information stored in infotrac :'
     442    WRITE(lunout,*) trim(modname),': iadv  name  long_name :'
     443
    611444    DO iq=1,nqtot
    612        IF(tracers(iq)%iadv.GE.0) THEN
    613           ! True tracer
    614           iiq=iiq+1
    615           niadv(iiq)=iq
    616        ENDIF
    617     END DO
    618 
    619 
    620     WRITE(lunout,*) trim(modname),': Information stored in infotrac :'
    621     WRITE(lunout,*) trim(modname),': iadv  niadv  name  long_name :'
    622 
    623     DO iq=1,nqtot
    624        WRITE(lunout,*) tracers(iq)%iadv,niadv(iq), ' ',trim(tracers(iq)%name),' ',trim(tracers(iq)%longName)
     445       WRITE(lunout,*) tracers(iq)%iadv,' ',trim(tracers(iq)%name),' ',trim(tracers(iq)%longName)
    625446    END DO
    626447
     
    645466! + verifier que tous les peres sont ecrits en premieres positions
    646467    ALLOCATE(iqfils(nqtot,nqtot))   
    647     nqperes=0
    648468    iqfils(:,:)=0
    649469    tracers(:)%iqParent=0
     
    652472        ! ceci est un traceur pere
    653473        WRITE(lunout,*) 'Le traceur',iq,', appele ',trim(tnom_0(iq)),', est un pere'
    654         nqperes=nqperes+1
    655474        tracers(iq)%iqParent=0
    656475      else !if (tnom_transp(iq) == 'air') then
     
    682501      endif !if (tnom_transp(iq) == 'air') then
    683502    enddo !DO iq=1,nqtot
    684     WRITE(lunout,*) 'infotrac: nqperes=',nqperes   
     503    WRITE(lunout,*) 'infotrac: nqGen0=',COUNT(tracers(:)%parent == 'air')
    685504    WRITE(lunout,*) 'nqChilds=',tracers(:)%nqChilds
    686505    WRITE(lunout,*) 'iqParent=',tracers(:)%iqParent
     
    738557    tracers(:)%isH2Ofamily = [(tracers(iq)%gen0Name(1:3) == 'H2O', iq=1, nqtot)]
    739558
    740 
    741559! detecter quels sont les traceurs isotopiques parmi des traceurs
    742560    call infotrac_isoinit(tnom_0,nqtrue)
     
    754572        write(lunout,*) 'infotrac 704: nqtottr,nqtot,nqo=',nqtottr,nqtot,nqo
    755573        ! Rq: nqtottr n'est pas forcement egal a nbtr dans le cas ou new_iq /= nqtrue
    756         ALLOCATE (itr_indice(nqtottr)) 
    757         itr_indice(:)=0 
    758         itr=0
    759         do iq=nqo+1, nqtot
    760           if (tracers(iq)%iso_iName.eq.0) then
    761             itr=itr+1
    762             write(*,*) 'itr=',itr
    763             itr_indice(itr)=iq
    764           endif !if (tracers(iq)%iso_iName.eq.0) then
    765         enddo
    766         if (itr.ne.nqtottr) then
     574        if (COUNT(tracers(:)%iso_iName == 0) /= nqtottr) &
    767575            CALL abort_gcm('infotrac_init','pb dans le calcul de nqtottr',1)
    768         endif
    769         write(lunout,*) 'itr_indice=',itr_indice
    770576!    endif !if (ntraciso.gt.0) then
    771577
  • LMDZ6/trunk/libf/dyn3dmem/advtrac_loc.F90

    r4055 r4056  
    1 !
    2 ! $Id$
    3 !
    4 c
    5 c
     1
    62#define DEBUG_IO
    73#undef DEBUG_IO
    8       SUBROUTINE advtrac_loc(pbarug,pbarvg ,wg,
    9      *                   p,  massem,q,teta,
    10      *                   pk   )
    11 
    12 c     Auteur :  F. Hourdin
    13 c
    14 c     Modif. P. Le Van     (20/12/97)
    15 c            F. Codron     (10/99)
    16 c            D. Le Croller (07/2001)
    17 c            M.A Filiberti (04/2002)
    18 c
    19       USE parallel_lmdz
    20       USE Write_Field_loc
    21       USE Write_Field
    22       USE Bands
    23       USE mod_hallo
    24       USE Vampir
    25       USE times
    26       USE infotrac, ONLY: nqtot, tracers, ok_iso_verif
    27       USE control_mod, ONLY: iapp_tracvl, day_step, planet_type
    28       USE advtrac_mod, ONLY: finmasse
    29       USE comconst_mod, ONLY: dtvr
    30       IMPLICIT NONE
    31 c
    32       include "dimensions.h"
    33       include "paramet.h"
    34       include "comdissip.h"
    35       include "comgeom2.h"
    36       include "description.h"
    37 
    38 c-------------------------------------------------------------------
    39 c     Arguments
    40 c-------------------------------------------------------------------
    41 c     Ajout PPM
    42 c--------------------------------------------------------
    43       REAL massebx(ijb_u:ije_u,llm),masseby(ijb_v:ije_v,llm)
    44 c--------------------------------------------------------
    45       INTEGER iapptrac
    46       REAL pbarug(ijb_u:ije_u,llm),pbarvg(ijb_v:ije_v,llm)
    47       REAL wg(ijb_u:ije_u,llm)
    48       REAL q(ijb_u:ije_u,llm,nqtot),massem(ijb_u:ije_u,llm)
    49       REAL p( ijb_u:ije_u,llmp1 ),teta(ijb_u:ije_u,llm)
    50       REAL pk(ijb_u:ije_u,llm)
    51 
    52 c-------------------------------------------------------------
    53 c     Variables locales
    54 c-------------------------------------------------------------
    55 
    56       REAL zdp(ijb_u:ije_u)
    57       REAL (kind=kind(1.d0)) :: t_initial, t_final, tps_cpu
    58       INTEGER,SAVE :: iadvtr=0
    59 c$OMP THREADPRIVATE(iadvtr)
    60       INTEGER ij,l,iq,iiq
    61       REAL zdpmin, zdpmax
    62 c----------------------------------------------------------
    63 c     Rajouts pour PPM
    64 c----------------------------------------------------------
    65       INTEGER indice,n
    66       REAL dtbon ! Pas de temps adaptatif pour que CFL<1
    67       REAL CFLmaxz,aaa,bbb ! CFL maximum
    68       REAL psppm(iim,jjb_u:jje_u) ! pression  au sol
    69       REAL unatppm(iim,jjb_u:jje_u,llm),vnatppm(iim,jjb_u:jje_u,llm)
    70       REAL qppm(iim*jjnb_u,llm,nqtot)
    71       REAL fluxwppm(iim,jjb_u:jje_u,llm)
    72       REAL apppm(llmp1), bpppm(llmp1)
    73       LOGICAL dum,fill
    74       DATA fill/.true./
    75       DATA dum/.true./
    76       integer ijb,ije,ijbu,ijbv,ijeu,ijev,j, iadv
    77       type(Request),SAVE :: testRequest
     4SUBROUTINE advtrac_loc(pbarug, pbarvg, wg, p, massem, q, teta, pk)
     5   !     Auteur :  F. Hourdin
     6   !
     7   !     Modif. P. Le Van     (20/12/97)
     8   !            F. Codron     (10/99)
     9   !            D. Le Croller (07/2001)
     10   !            M.A Filiberti (04/2002)
     11   !
     12   USE infotrac,     ONLY: nqtot, tracers,ok_iso_verif
     13   USE control_mod,  ONLY: iapp_tracvl, day_step, planet_type
     14   USE comconst_mod, ONLY: dtvr
     15   USE parallel_lmdz
     16   USE Write_Field_loc
     17   USE Write_Field
     18   USE Bands
     19   USE mod_hallo
     20   USE Vampir
     21   USE times
     22   USE advtrac_mod, ONLY: finmasse
     23
     24   IMPLICIT NONE
     25   !
     26   include "dimensions.h"
     27   include "paramet.h"
     28   include "comdissip.h"
     29   include "comgeom2.h"
     30   include "description.h"
     31!   include "iniprint.h"
     32
     33   !---------------------------------------------------------------------------
     34   !     Arguments
     35   !---------------------------------------------------------------------------
     36   REAL, INTENT(IN) ::  pbarug(ijb_u:ije_u,llm)
     37   REAL, INTENT(IN) ::  pbarvg(ijb_v:ije_v,llm)
     38   REAL, INTENT(IN) ::      wg(ijb_u:ije_u,llm)
     39   REAL, INTENT(IN) ::       p(ijb_u:ije_u,llmp1)
     40   REAL, INTENT(IN) ::  massem(ijb_u:ije_u,llm)
     41   REAL, INTENT(INOUT) ::    q(ijb_u:ije_u,llm,nqtot)
     42   REAL, INTENT(IN) ::    teta(ijb_u:ije_u,llm)
     43   REAL, INTENT(IN) ::      pk(ijb_u:ije_u,llm)
     44   !---------------------------------------------------------------------------
     45   !     Ajout PPM
     46   !---------------------------------------------------------------------------
     47   REAL :: massebx(ijb_u:ije_u,llm), masseby(ijb_v:ije_v,llm)
     48   !---------------------------------------------------------------------------
     49   !     Variables locales
     50   !---------------------------------------------------------------------------
     51   INTEGER :: ij, l, iq, iiq, iadv
     52   REAL(KIND=KIND(1.d0)) :: t_initial, t_final, tps_cpu
     53   REAL :: zdp(ijb_u:ije_u), zdpmin, zdpmax
     54   INTEGER, SAVE :: iadvtr=0
     55!$OMP THREADPRIVATE(iadvtr)
     56   EXTERNAL  minmax
     57
     58   !---------------------------------------------------------------------------
     59   !     Rajouts pour PPM
     60   !---------------------------------------------------------------------------
     61   INTEGER :: indice, n
     62   REAL :: dtbon                       ! Pas de temps adaptatif pour que CFL<1
     63   REAL :: CFLmaxz, aaa, bbb           ! CFL maximum
     64   REAL, DIMENSION(iim,jjb_u:jje_u,llm) :: unatppm, vnatppm, fluxwppm
     65   REAL ::    qppm(iim*jjnb_u,llm,nqtot)
     66   REAL ::   psppm(iim,jjb_u:jje_u)    ! pression  au sol
     67   REAL, DIMENSION(llmp1) :: apppm, bpppm
     68   LOGICAL, SAVE :: dum=.TRUE., fill=.TRUE.
     69   INTEGER :: ijb, ije, ijbu, ijbv, ijeu, ijev, j
     70   TYPE(Request),SAVE :: testRequest
    7871!$OMP THREADPRIVATE(testRequest)
    7972
    80 c  test sur l''eventuelle creation de valeurs negatives de la masse
    81          ijb=ij_begin
    82          ije=ij_end
    83          if (pole_nord) ijb=ij_begin+iip1
    84          if (pole_sud) ije=ij_end-iip1
    85          
    86 c$OMP DO SCHEDULE(STATIC,OMP_CHUNK)         
    87          DO l=1,llm-1
    88             DO ij = ijb+1,ije
    89               zdp(ij) =    pbarug(ij-1,l)   - pbarug(ij,l)
    90      s                  - pbarvg(ij-iip1,l) + pbarvg(ij,l)
    91      s                  +       wg(ij,l+1)  - wg(ij,l)
    92             ENDDO
    93            
    94 c            CALL SCOPY( jjm -1 ,zdp(iip1+iip1),iip1,zdp(iip2),iip1 )
    95 c ym  ---> pourquoi jjm-1 et non jjm ? a cause du pole ?
    96            
    97             do ij=ijb,ije-iip1+1,iip1
    98               zdp(ij)=zdp(ij+iip1-1)
    99             enddo
    100            
    101             DO ij = ijb,ije
    102                zdp(ij)= zdp(ij)*dtvr/ massem(ij,l)
    103             ENDDO
    104 
    105 
    106 c            CALL minmax ( ip1jm-iip1, zdp(iip2), zdpmin,zdpmax )
    107 c  ym ---> eventuellement a revoir
    108             CALL minmax ( ije-ijb+1, zdp(ijb), zdpmin,zdpmax )
    109            
    110             IF(MAX(ABS(zdpmin),ABS(zdpmax)).GT.0.5) THEN
    111             PRINT*,'WARNING DP/P l=',l,'  MIN:',zdpmin,
    112      s        '   MAX:', zdpmax
    113             ENDIF
    114 
    115          ENDDO
    116 c$OMP END DO NOWAIT
    117 
    118 c-------------------------------------------------------------------
    119 c   Advection proprement dite (Modification Le Croller (07/2001)
    120 c-------------------------------------------------------------------
    121 
    122 c----------------------------------------------------
    123 c        Calcul des moyennes basées sur la masse
    124 c----------------------------------------------------
    125 
    126 cym      ----> Normalement, inutile pour les schémas classiques
    127 cym      ----> Revérifier lors de la parallélisation des autres schemas
    128    
    129 cym          call massbar_p(massem,massebx,masseby)         
     73! Test sur l'eventuelle creation de valeurs negatives de la masse
     74   ijb = ij_begin; IF(pole_nord) ijb = ij_begin+iip1
     75   ije = ij_end;   IF(pole_sud)  ije = ij_end-iip1
     76
     77!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
     78   DO l=1,llm-1
     79      DO ij = ijb+1,ije
     80         zdp(ij) = pbarug(ij-1,l)    - pbarug(ij,l) &
     81                 - pbarvg(ij-iip1,l) + pbarvg(ij,l) &
     82                 +     wg(ij,l+1)    -     wg(ij,l)
     83      END DO
     84! ym  ---> pourquoi jjm-1 et non jjm ? a cause du pole ?
     85!     CALL SCOPY( jjm -1 ,zdp(iip1+iip1),iip1,zdp(iip2),iip1 )
     86      DO ij = ijb,ije-iip1+1,iip1
     87         zdp(ij)=zdp(ij+iip1-1)
     88      END DO
     89      DO ij = ijb,ije
     90         zdp(ij)= zdp(ij)*dtvr/ massem(ij,l)
     91      END DO
     92!     CALL minmax ( ip1jm-iip1, zdp(iip2), zdpmin,zdpmax )
     93! ym ---> eventuellement a revoir
     94      CALL minmax( ije-ijb+1, zdp(ijb), zdpmin,zdpmax )
     95      IF(MAX(ABS(zdpmin),ABS(zdpmax)) >0.5) &
     96         WRITE(*,*)'WARNING DP/P l=',l,'  MIN:',zdpmin,'   MAX:', zdpmax
     97   END DO
     98!$OMP END DO NOWAIT
     99
     100   !---------------------------------------------------------------------------
     101   !   Advection proprement dite (Modification Le Croller (07/2001)
     102   !---------------------------------------------------------------------------
     103
     104   !---------------------------------------------------------------------------
     105   !   Calcul des moyennes basees sur la masse
     106   !---------------------------------------------------------------------------
     107!ym   CALL massbar_p(massem,massebx,masseby)
     108!ym   ----> Normalement, inutile pour les schémas classiques
     109!ym   ----> Revérifier lors de la parallélisation des autres schemas
    130110
    131111#ifdef DEBUG_IO   
    132           CALL WriteField_u('massem',massem)
    133           CALL WriteField_u('wg',wg)
    134           CALL WriteField_u('pbarug',pbarug)
    135           CALL WriteField_v('pbarvg',pbarvg)
    136           CALL WriteField_u('p_tmp',p)
    137           CALL WriteField_u('pk_tmp',pk)
    138           CALL WriteField_u('teta_tmp',teta)
    139           do j=1,nqtot
    140             call WriteField_u('q_adv'//trim(int2str(j)),
    141      .                q(:,:,j))
    142           enddo
     112   CALL WriteField_u('massem',massem)
     113   CALL WriteField_u('wg',wg)
     114   CALL WriteField_u('pbarug',pbarug)
     115   CALL WriteField_v('pbarvg',pbarvg)
     116   CALL WriteField_u('p_tmp',p)
     117   CALL WriteField_u('pk_tmp',pk)
     118   CALL WriteField_u('teta_tmp',teta)
     119   DO iq=1,nqtot
     120      CALL WriteField_u('q_adv'//trim(int2str(iq)),q(:,:,iq))
     121   END DO
    143122#endif
    144123
    145124!         
    146 !       call Register_Hallo_v(pbarvg,llm,1,1,1,1,TestRequest)
    147 !
    148 !       call SendRequest(TestRequest)
    149 !c$OMP BARRIER
    150 !       call WaitRequest(TestRequest)
    151 c$OMP BARRIER
     125!  CALL Register_Hallo_v(pbarvg,llm,1,1,1,1,TestRequest)
     126!  CALL SendRequest(TestRequest)
     127!!$OMP BARRIER
     128!  CALL WaitRequest(TestRequest)
     129!$OMP BARRIER
    152130                 
    153           !write(*,*) 'advtrac 157: appel de vlspltgen_loc'
    154           call vlspltgen_loc( q, 2., massem, wg,pbarug,pbarvg,dtvr,p,
    155      *                        pk,teta )
     131!  WRITE(*,*) 'advtrac 157: appel de vlspltgen_loc'
     132   CALL vlspltgen_loc(q, tracers(:)%iadv, 2., massem, wg, pbarug, pbarvg, dtvr, p, pk, teta )
    156133
    157134#ifdef DEBUG_IO     
    158           do j=1,nqtot
    159             call WriteField_u('q_adv'//trim(int2str(j)),
    160      .                q(:,:,j))
    161           enddo
     135   DO iq = 1, nqtot
     136      CALL WriteField_u('q_adv'//trim(int2str(iq)),q(:,:,iq))
     137   END DO
    162138#endif
    163139         
    164           GOTO 1234     
    165 c-----------------------------------------------------------
    166 c     Appel des sous programmes d'advection
    167 c-----------------------------------------------------------
    168       do iq=1,nqtot
    169 c        call clock(t_initial)
    170         iadv = tracers(iq)%iadv
    171         SELECT CASE(iadv)
    172           CASE(0); CYCLE
    173           CASE(10)
    174 c   ----------------------------------------------------------------
    175 c   Schema de Van Leer I MUSCL
    176 c   ----------------------------------------------------------------
    177      
    178 !LF            call vlsplt_p(q(1,1,iq),2.,massem,wg,pbarug,pbarvg,dtvr)
    179 
    180           CASE(14)
    181 c   ----------------------------------------------------------------
    182 c   Schema "pseudo amont" + test sur humidite specifique
    183 C    pour la vapeur d'eau. F. Codron
    184 c   ----------------------------------------------------------------
    185 c
    186 cym           stop 'advtrac : appel à vlspltqs :schema non parallelise'
    187 !LF           CALL vlspltqs_p( q(1,1,1), 2., massem, wg ,
    188 !LF     *                 pbarug,pbarvg,dtvr,p,pk,teta )
    189           CASE(12)
    190 c   ----------------------------------------------------------------
    191 c   Schema de Frederic Hourdin
    192 c   ----------------------------------------------------------------
    193           stop 'advtrac : schema non parallelise'
    194 c            Pas de temps adaptatif
    195            call adaptdt(iadv,dtbon,n,pbarug,massem)
    196            if (n.GT.1) then
    197            write(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=',
    198      s             dtvr,'n=',n
    199            endif
    200            do indice=1,n
    201             call advn(q(1,1,iq),massem,wg,pbarug,pbarvg,dtbon,1)
    202            end do
    203           CASE(13)
    204           stop 'advtrac : schema non parallelise'
    205 c            Pas de temps adaptatif
    206            call adaptdt(iadv,dtbon,n,pbarug,massem)
    207            if (n.GT.1) then
    208            write(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=',
    209      s             dtvr,'n=',n
    210            endif
    211           do indice=1,n
    212             call advn(q(1,1,iq),massem,wg,pbarug,pbarvg,dtbon,2)
    213           end do
    214           CASE(20)
    215 c   ----------------------------------------------------------------
    216 c   Schema de pente SLOPES
    217 c   ----------------------------------------------------------------
    218           stop 'advtrac : schema non parallelise'
    219 
    220             call pentes_ini (q(1,1,iq),wg,massem,pbarug,pbarvg,0)
    221 
    222           CASE(30)
    223 c   ----------------------------------------------------------------
    224 c   Schema de Prather
    225 c   ----------------------------------------------------------------
    226           stop 'advtrac : schema non parallelise'
    227 c            Pas de temps adaptatif
    228            call adaptdt(iadv,dtbon,n,pbarug,massem)
    229            if (n.GT.1) then
    230            write(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=',
    231      s             dtvr,'n=',n
    232            endif
    233            call  prather(q(1,1,iq),wg,massem,pbarug,pbarvg,
    234      s                     n,dtbon)
    235           CASE(11,16,17,18)
    236 c   ----------------------------------------------------------------
    237 c   Schemas PPM Lin et Rood
    238 c   ----------------------------------------------------------------
    239 
    240            stop 'advtrac : schema non parallelise'
    241 
    242 c        Test sur le flux horizontal
    243 c        Pas de temps adaptatif
    244          call adaptdt(iadv,dtbon,n,pbarug,massem)
    245          if (n.GT.1) then
    246            write(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=',
    247      s             dtvr,'n=',n
    248          endif
    249 c        Test sur le flux vertical
    250          CFLmaxz=0.
    251          do l=2,llm
    252            do ij=iip2,ip1jm
    253             aaa=wg(ij,l)*dtvr/massem(ij,l)
    254             CFLmaxz=max(CFLmaxz,aaa)
    255             bbb=-wg(ij,l)*dtvr/massem(ij,l-1)
    256             CFLmaxz=max(CFLmaxz,bbb)
    257            enddo
    258          enddo
    259          if (CFLmaxz.GE.1) then
    260             write(*,*) 'WARNING vertical','CFLmaxz=', CFLmaxz
    261          endif
    262 
    263 c-----------------------------------------------------------
    264 c        Ss-prg interface LMDZ.4->PPM3d
    265 c-----------------------------------------------------------
    266 
    267           call interpre(q(1,1,iq),qppm(1,1,iq),wg,fluxwppm,massem,
    268      s                 apppm,bpppm,massebx,masseby,pbarug,pbarvg,
    269      s                 unatppm,vnatppm,psppm)
    270 
    271           do indice=1,n
    272 c---------------------------------------------------------------------
    273 c                         VL (version PPM) horiz. et PPM vert.
    274 c---------------------------------------------------------------------
    275             SELECT CASE(iadv)
    276               CASE(11)
    277 c                  Ss-prg PPM3d de Lin
    278                   call ppm3d(1,qppm(1,1,iq),
    279      s                       psppm,psppm,
    280      s                       unatppm,vnatppm,fluxwppm,dtbon,2,2,2,1,
    281      s                       iim,jjp1,2,llm,apppm,bpppm,0.01,6400000,
    282      s                       fill,dum,220.)
    283 
    284               CASE(16)
    285 c----------------------------------------------------------------------
    286 c                           Monotonic PPM
    287 c----------------------------------------------------------------------
    288 c                  Ss-prg PPM3d de Lin
    289                   call ppm3d(1,qppm(1,1,iq),
    290      s                       psppm,psppm,
    291      s                       unatppm,vnatppm,fluxwppm,dtbon,3,3,3,1,
    292      s                       iim,jjp1,2,llm,apppm,bpppm,0.01,6400000,
    293      s                       fill,dum,220.)
    294 c---------------------------------------------------------------------
    295 
    296               CASE(17)
    297 c---------------------------------------------------------------------
    298 c                           Semi Monotonic PPM
    299 c---------------------------------------------------------------------
    300 c                  Ss-prg PPM3d de Lin
    301                   call ppm3d(1,qppm(1,1,iq),
    302      s                       psppm,psppm,
    303      s                       unatppm,vnatppm,fluxwppm,dtbon,4,4,4,1,
    304      s                       iim,jjp1,2,llm,apppm,bpppm,0.01,6400000,
    305      s                       fill,dum,220.)
    306 c---------------------------------------------------------------------
    307 
    308               CASE(18)
    309 c---------------------------------------------------------------------
    310 c                         Positive Definite PPM
    311 c---------------------------------------------------------------------
    312 c                  Ss-prg PPM3d de Lin
    313                   call ppm3d(1,qppm(1,1,iq),
    314      s                       psppm,psppm,
    315      s                       unatppm,vnatppm,fluxwppm,dtbon,5,5,5,1,
    316      s                       iim,jjp1,2,llm,apppm,bpppm,0.01,6400000,
    317      s                       fill,dum,220.)
    318 c---------------------------------------------------------------------
    319             END SELECT
    320             enddo
    321 c-----------------------------------------------------------------
    322 c               Ss-prg interface PPM3d-LMDZ.4
    323 c-----------------------------------------------------------------
    324                   call interpost(q(1,1,iq),qppm(1,1,iq))
    325         END SELECT
    326 c----------------------------------------------------------------------
    327 
    328 c-----------------------------------------------------------------
    329 c On impose une seule valeur du traceur au pôle Sud j=jjm+1=jjp1
    330 c et Nord j=1
    331 c-----------------------------------------------------------------
    332 
    333 c                  call traceurpole(q(1,1,iq),massem)
    334 
    335 c calcul du temps cpu pour un schema donne
    336 
    337 
    338        end DO
    339 
    340 1234  CONTINUE
    341 c$OMP BARRIER
    342 
    343       if (planet_type=="earth") then
    344 
     140   GOTO 1234     
     141   !-------------------------------------------------------------------------
     142   !       Appel des sous programmes d'advection
     143   !-------------------------------------------------------------------------
     144   DO iq = 1, nqtot
     145!     CALL clock(t_initial)
     146      IF(tracers(iq)%parent /= 'air') CYCLE
     147      iadv = tracers(iq)%iadv
     148      !-----------------------------------------------------------------------
     149      SELECT CASE(iadv)
     150      !-----------------------------------------------------------------------
     151         CASE(0); CYCLE
     152         !--------------------------------------------------------------------
     153         CASE(10)  !--- Schema de Van Leer I MUSCL
     154         !--------------------------------------------------------------------
     155!           WRITE(*,*) 'advtrac 239: iq,q(1721,19,:)=',iq,q(1721,19,:)     
     156!LF         CALL vlsplt_p(q(1,1,iq),2.,massem,wg,pbarug,pbarvg,dtvr)
     157
     158         !--------------------------------------------------------------------
     159         CASE(14)  !--- Schema "pseuDO amont" + test sur humidite specifique
     160                   !--- pour la vapeur d'eau. F. Codron
     161         !--------------------------------------------------------------------
     162!           WRITE(*,*) 'advtrac 248: iq,q(1721,19,:)=',iq,q(1721,19,:)
     163            STOP 'advtrac : appel a vlspltqs :schema non parallelise'
     164!LF         CALL vlspltqs_p(q(1,1,1),2.,massem,wg,pbarug,pbarvg,dtvr,p,pk,teta )
     165
     166         !--------------------------------------------------------------------
     167         CASE(12)  !--- Schema de Frederic Hourdin
     168         !--------------------------------------------------------------------
     169            CALL adaptdt(iadv,dtbon,n,pbarug,massem)   ! pas de temps adaptatif
     170            IF(n > 1) WRITE(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=',dtvr,'n=',n
     171            DO indice=1,n
     172              CALL advn(q(1,1,iq),massem,wg,pbarug,pbarvg,dtbon,1)
     173            END DO
     174
     175         !--------------------------------------------------------------------
     176         CASE(13)  !--- Pas de temps adaptatif
     177         !--------------------------------------------------------------------
     178            STOP 'advtrac : schema non parallelise'
     179            CALL adaptdt(iadv,dtbon,n,pbarug,massem)
     180            IF(n > 1) WRITE(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=',dtvr,'n=',n
     181            DO indice=1,n
     182               CALL advn(q(1,1,iq),massem,wg,pbarug,pbarvg,dtbon,2)
     183            END DO
     184
     185         !--------------------------------------------------------------------
     186         CASE(20)  !--- Schema de pente SLOPES
     187         !--------------------------------------------------------------------
     188            STOP 'advtrac : schema non parallelise'
     189            CALL pentes_ini (q(1,1,iq),wg,massem,pbarug,pbarvg,0)
     190
     191         !--------------------------------------------------------------------
     192         CASE(30)  !--- Schema de Prather
     193         !--------------------------------------------------------------------
     194            STOP 'advtrac : schema non parallelise'
     195            ! Pas de temps adaptatif
     196            CALL adaptdt(iadv,dtbon,n,pbarug,massem)
     197            IF(n > 1) WRITE(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=',dtvr,'n=',n
     198            CALL prather(q(1,1,iq),wg,massem,pbarug,pbarvg,n,dtbon)
     199
     200         !--------------------------------------------------------------------
     201         CASE(11,16,17,18)   !--- Schemas PPM Lin et Rood
     202         !--------------------------------------------------------------------
     203            STOP 'advtrac : schema non parallelise'
     204            ! Test sur le flux horizontal
     205            CALL adaptdt(iadv,dtbon,n,pbarug,massem)   ! pas de temps adaptatif
     206            IF(n > 1) WRITE(*,*) 'WARNING horizontal dt=',dtbon,'dtvr=',dtvr,'n=',n
     207            ! Test sur le flux vertical
     208            CFLmaxz=0.
     209            DO l=2,llm
     210               DO ij=iip2,ip1jm
     211                  aaa=wg(ij,l)*dtvr/massem(ij,l)
     212                  CFLmaxz=max(CFLmaxz,aaa)
     213                  bbb=-wg(ij,l)*dtvr/massem(ij,l-1)
     214                  CFLmaxz=max(CFLmaxz,bbb)
     215               END DO
     216            END DO
     217            IF(CFLmaxz.GE.1) WRITE(*,*) 'WARNING vertical','CFLmaxz=', CFLmaxz
     218            !----------------------------------------------------------------
     219            !     Ss-prg interface LMDZ.4->PPM3d (ss-prg de Lin)
     220            !----------------------------------------------------------------
     221            CALL interpre(q(1,1,iq),qppm(1,1,iq),wg,fluxwppm,massem, &
     222                 apppm,bpppm,massebx,masseby,pbarug,pbarvg, &
     223                 unatppm,vnatppm,psppm)
     224
     225            !----------------------------------------------------------------
     226            DO indice=1,n     !--- VL (version PPM) horiz. et PPM vert.
     227            !----------------------------------------------------------------
     228               SELECT CASE(iadv)
     229                  !----------------------------------------------------------
     230                  CASE(11)
     231                  !----------------------------------------------------------
     232                     CALL ppm3d(1,qppm(1,1,iq),psppm,psppm,unatppm,vnatppm,fluxwppm,dtbon, &
     233                                2,2,2,1,iim,jjp1,2,llm,apppm,bpppm,0.01,6400000,fill,dum,220.)
     234                  !----------------------------------------------------------
     235                  CASE(16) !--- Monotonic PPM
     236                  !----------------------------------------------------------
     237                     CALL ppm3d(1,qppm(1,1,iq),psppm,psppm,unatppm,vnatppm,fluxwppm,dtbon, &
     238                                3,3,3,1,iim,jjp1,2,llm,apppm,bpppm,0.01,6400000,fill,dum,220.)
     239                  !----------------------------------------------------------
     240                  CASE(17) !--- Semi monotonic PPM
     241                  !----------------------------------------------------------
     242                     CALL ppm3d(1,qppm(1,1,iq),psppm,psppm,unatppm,vnatppm,fluxwppm,dtbon, &
     243                                4,4,4,1,iim,jjp1,2,llm,apppm,bpppm,0.01,6400000, fill,dum,220.)
     244                  !----------------------------------------------------------
     245                  CASE(18) !--- Positive Definite PPM
     246                  !----------------------------------------------------------
     247                     CALL ppm3d(1,qppm(1,1,iq),psppm,psppm,unatppm,vnatppm,fluxwppm,dtbon, &
     248                                5,5,5,1,iim,jjp1,2,llm,apppm,bpppm,0.01,6400000,fill,dum,220.)
     249               END SELECT
     250            !----------------------------------------------------------------
     251            END DO
     252            !----------------------------------------------------------------
     253            !     Ss-prg interface PPM3d-LMDZ.4
     254            !----------------------------------------------------------------
     255            CALL interpost(q(1,1,iq),qppm(1,1,iq))
     256      !----------------------------------------------------------------------
     257      END SELECT
     258      !----------------------------------------------------------------------
     259
     260      !----------------------------------------------------------------------
     261      ! On impose une seule valeur du traceur au pôle Sud j=jjm+1=jjp1 et Nord j=1
     262      !----------------------------------------------------------------------
     263      !  CALL traceurpole(q(1,1,iq),massem)
     264
     265      !--- Calcul du temps cpu pour un schema donne
     266      !  CALL clock(t_final)
     267      !ym  tps_cpu=t_final-t_initial
     268      !ym  cpuadv(iq)=cpuadv(iq)+tps_cpu
     269
     270   END DO
     271
     2721234 CONTINUE
     273!$OMP BARRIER
     274   IF(planet_type=="earth") THEN
    345275      ijb=ij_begin
    346276      ije=ij_end
    347 
    348 c$OMP DO SCHEDULE(STATIC,OMP_CHUNK)     
    349        DO l = 1, llm
     277!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)     
     278      DO l = 1, llm
    350279         DO ij = ijb, ije
    351            finmasse(ij,l) =  p(ij,l) - p(ij,l+1)
    352          ENDDO
    353        ENDDO
    354 c$OMP END DO
    355 
    356         ! CRisi: on passe nqtot et non nq
    357        CALL qminimum_loc( q, nqtot, finmasse )
    358 
    359       endif ! of if (planet_type=="earth")
    360 
    361        RETURN
    362        END
    363 
     280            finmasse(ij,l) =  p(ij,l) - p(ij,l+1)
     281         END DO
     282      END DO
     283!$OMP END DO
     284
     285      CALL qminimum_loc( q, nqtot, finmasse )
     286
     287   END IF ! of if (planet_type=="earth")
     288
     289END SUBROUTINE advtrac_loc
     290
  • LMDZ6/trunk/libf/dyn3dmem/call_calfis_mod.F90

    r4050 r4056  
    113113    TYPE(Request),SAVE :: Request_physic
    114114!$OMP THREADPRIVATE(Request_physic )
    115     INTEGER :: ijb,ije,l,j
     115    INTEGER :: ijb,ije,l,iq
    116116   
    117117   
     
    122122    CALL WriteField_u('pfi',p)
    123123    CALL WriteField_u('pkfi',pk)
    124     DO j=1,nqtot
    125       CALL WriteField_u('qfi'//trim(int2str(j)),q(:,:,j))
     124    DO iq=1,nqtot
     125      CALL WriteField_u('qfi'//trim(int2str(iq)),q(:,:,iq))
    126126    ENDDO
    127127#endif
     
    223223    CALL WriteField_u('pfi',p)
    224224    CALL WriteField_u('pkfi',pk)
    225     DO j=1,nqtot
    226       CALL WriteField_u('qfi'//trim(int2str(j)),q(:,:,j))
     225    DO iq=1,nqtot
     226      CALL WriteField_u('qfi'//trim(int2str(iq)),q(:,:,iq))
    227227    ENDDO
    228228#endif
     
    267267    CALL Register_Hallo_u(dpfi,1,1,0,0,1,Request_physic)
    268268
    269     DO j=1,nqtot
    270       CALL Register_Hallo_u(dqfi(:,:,j),llm,1,0,0,1,Request_physic)
     269    DO iq=1,nqtot
     270      CALL Register_Hallo_u(dqfi(:,:,iq),llm,1,0,0,1,Request_physic)
    271271    ENDDO
    272272       
     
    305305    CALL WriteField_u('dtetafi',dtetafi)
    306306    CALL WriteField_u('dpfi',dpfi)
    307     DO j=1,nqtot
    308       CALL WriteField_u('dqfi'//trim(int2str(j)),dqfi(:,:,j))
     307    DO iq=1,nqtot
     308      CALL WriteField_u('dqfi'//trim(int2str(iq)),dqfi(:,:,iq))
    309309    ENDDO
    310310#endif
     
    319319    CALL WriteField_u('tetafi',teta)
    320320    CALL WriteField_u('psfi',ps)
    321     DO j=1,nqtot
    322       CALL WriteField_u('qfi'//trim(int2str(j)),q(:,:,j))
     321    DO iq=1,nqtot
     322      CALL WriteField_u('qfi'//trim(int2str(iq)),q(:,:,iq))
    323323    ENDDO
    324324#endif
     
    329329    CALL WriteField_u('tetafi',teta)
    330330    CALL WriteField_u('psfi',ps)
    331     DO j=1,nqtot
    332       CALL WriteField_u('qfi'//trim(int2str(j)),q(:,:,j))
     331    DO iq=1,nqtot
     332      CALL WriteField_u('qfi'//trim(int2str(iq)),q(:,:,iq))
    333333    ENDDO
    334334#endif
     
    354354    CALL WriteField_u('tetafi',teta)
    355355    CALL WriteField_u('psfi',ps)
    356     DO j=1,nqtot
    357       CALL WriteField_u('qfi'//trim(int2str(j)),q(:,:,j))
     356    DO iq=1,nqtot
     357      CALL WriteField_u('qfi'//trim(int2str(iq)),q(:,:,iq))
    358358    ENDDO
    359359#endif
     
    401401    CALL WriteField_u('tetafi',teta_dyn)
    402402    CALL WriteField_u('psfi',ps_dyn)
    403     DO j=1,nqtot
    404       CALL WriteField_u('qfi'//trim(int2str(j)),q_dyn(:,:,j))
     403    DO iq=1,nqtot
     404      CALL WriteField_u('qfi'//trim(int2str(iq)),q_dyn(:,:,iq))
    405405    ENDDO
    406406#endif
  • LMDZ6/trunk/libf/dyn3dmem/iniacademic_loc.F90

    r4052 r4056  
    55
    66  USE filtreg_mod, ONLY: inifilr
     7  USE infotrac,    ONLY: nqtot, niso_possibles, ok_isotopes, ok_iso_verif, tnat, alpha_ideal, &
     8                         iqiso, tracers, iso_indnum
     9  USE control_mod, ONLY: day_step,planet_type
    710  use exner_hyb_m, only: exner_hyb
    811  use exner_milieu_m, only: exner_milieu
    9   USE infotrac, ONLY: nqtot, niso_possibles, ok_isotopes, ok_iso_verif, tnat, alpha_ideal, &
    10                       iqiso, tracers, iso_indnum
    11   USE control_mod, ONLY: day_step,planet_type
    1212  USE parallel_lmdz, ONLY: ijb_u, ije_u, ijb_v, ije_v
    1313#ifdef CPP_IOIPSL
     
    2323  USE temps_mod, ONLY: annee_ref, day_ini, day_ref
    2424  USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0
    25 
    2625
    2726  !   Author:    Frederic Hourdin      original: 15/01/93
     
    112111  ztot0      = 0.
    113112  stot0      = 0.
    114   ang0       = 0.     
     113  ang0       = 0.
    115114
    116115  if (llm == 1) then
     
    143142        ps_glo(:)=preff
    144143     endif
    145      
     144
    146145     ! ground geopotential
    147146     phis_glo(:)=0.
    148 
    149147     CALL pression ( ip1jmp1, ap, bp, ps_glo, p       )
    150148     if (pressure_exner) then
     
    155153     CALL massdair(p,masse_glo)
    156154  ENDIF
    157 
    158155
    159156  if (llm == 1) then
     
    281278        if (planet_type=="earth") then
    282279           ! Earth: first two tracers will be water
    283 
    284280           do iq=1,nqtot
    285281              q(ijb_u:ije_u,:,iq)=0.
    286 !              IF(tracers(iq)%name == 'H2O'//Phases_sep//'g') q(ijb_u:ije_u,:,iq)=1.e-10
     282!              IF(tracers(iq)%name == 'H2O'//phases_sep//'g') q(ijb_u:ije_u,:,iq)=1.e-10
    287283!              IF(tracers(iq)%name == 'H2O'//phases_sep//'l') q(ijb_u:ije_u,:,iq)=1.e-15
    288               if (tracers(iq)%name == 'H2Ov') q(ijb_u:ije_u,:,iq)=1.e-10
    289               if (tracers(iq)%name == 'H2Ol') q(ijb_u:ije_u,:,iq)=1.e-15
     284              IF(tracers(iq)%name == 'H2Ov') q(ijb_u:ije_u,:,iq)=1.e-10
     285              IF(tracers(iq)%name == 'H2Ol') q(ijb_u:ije_u,:,iq)=1.e-15
    290286
    291287              ! CRisi: init des isotopes
     
    293289              iName = tracers(iq)%iso_iName
    294290              if (.NOT.ok_isotopes .OR. iName <= 0) CYCLE
    295               iZone = tracers(iq)%iso_iZone
    296               iPhase= tracers(iq)%iso_iPhase
     291              iZone    = tracers(iq)%iso_iZone
     292              iPhase   = tracers(iq)%iso_iPhase
    297293              iqParent = tracers(iq)%iqParent
    298294              if (iZone == 0) q(ijb_u:ije_u,:,iq) = q(ijb_u:ije_u,:,iqParent)*tnat(iName) &
     
    304300        endif ! of if (planet_type=="earth")
    305301
    306         if (ok_iso_verif) then
    307            call check_isotopes(q,ijb_u,ije_u,'iniacademic_loc')
    308         endif !if (ok_iso_verif) then
     302        if (ok_iso_verif) call check_isotopes(q,ijb_u,ije_u,'iniacademic_loc')
    309303
    310304        ! add random perturbation to temperature
  • LMDZ6/trunk/libf/dyn3dmem/leapfrog_loc.F

    r3947 r4056  
    664664        call WriteField_u('pkf',pkf)
    665665        call WriteField_u('phis',phis)
    666         do j=1,nqtot
    667           call WriteField_u('q'//trim(int2str(j)),
    668      .                q(:,:,j))
     666        do iq=1,nqtot
     667          call WriteField_u('q'//trim(int2str(iq)),
     668     .                q(:,:,iq))
    669669        enddo
    670670      endif
  • LMDZ6/trunk/libf/dyn3dmem/vlspltgen_loc.F

    r4052 r4056  
    2828      USE VAMPIR
    2929      ! CRisi: on rajoute variables utiles d'infotrac 
    30       USE infotrac, ONLY : nqtot,nqperes, tracers,ok_iso_verif
     30      USE infotrac, ONLY : nqtot, tracers,ok_iso_verif
    3131      USE vlspltgen_mod
    3232      USE comconst_mod, ONLY: cpp
     
    196196
    197197c$OMP BARRIER           
    198 !      DO iq=1,nqtot
    199       DO iq=1,nqperes ! CRisi: on ne boucle que sur les pères= ceux qui sont transportés directement par l'air
    200        !write(*,*) 'vlspltgen 192: iq,iadv=',iq,tracers(iq)%iadv
     198      DO iq=1,nqtot
     199        ! CRisi: on ne boucle que sur les pères= ceux qui sont transportés directement par l'air
     200        IF(tracers(iq)%parent /= 'air') CYCLE
     201        !write(*,*) 'vlspltgen 192: iq,iadv=',iq,tracers(iq)%iadv
    201202#ifdef DEBUG_IO   
    202        CALL WriteField_u('zq',zq(:,:,iq))
    203        CALL WriteField_u('zm',zm(:,:,iq))
     203        CALL WriteField_u('zq',zq(:,:,iq))
     204        CALL WriteField_u('zm',zm(:,:,iq))
    204205#endif
    205206        SELECT CASE(tracers(iq)%iadv)
     
    264265        END SELECT
    265266     
    266       enddo !DO iq=1,nqperes
     267      enddo !DO iq=1,nqtot
    267268     
    268269     
     
    288289      endif !if (ok_iso_verif) then
    289290
    290       do iq=1,nqperes
     291      do iq=1,nqtot
     292        IF(tracers(iq)%parent /= 'air') CYCLE
    291293        !write(*,*) 'vlspltgen 279: iq=',iq
    292294
     
    328330      if (ok_iso_verif) then
    329331           call check_isotopes(zq,ij_begin,ij_end,'vlspltgen_loc 326')
    330       endif !if (ok_iso_verif) then       
    331       if (ok_iso_verif) then
    332332           ijb=ij_begin-2*iip1
    333333           ije=ij_end+2*iip1
     
    337337      endif !if (ok_iso_verif) then 
    338338
    339       do iq=1,nqperes
     339      do iq = 1, nqtot
     340       IF(tracers(iq)%parent /= 'air') CYCLE
    340341       !write(*,*) 'vlspltgen 321: iq=',iq
    341342#ifdef DEBUG_IO   
     
    358359      endif !if (ok_iso_verif) then
    359360
    360       do iq=1,nqperes
     361      do iq = 1, nqtot
     362       IF(tracers(iq)%parent /= 'air') CYCLE
    361363      !write(*,*) 'vlspltgen 349: iq=',iq
    362364#ifdef DEBUG_IO   
     
    419421
    420422c$OMP BARRIER
    421       do iq=1,nqperes
     423      do iq=1,nqtot
     424        IF(tracers(iq)%parent /= 'air') CYCLE
    422425      !write(*,*) 'vlspltgen 409: iq=',iq
    423426
     
    462465      endif !if (ok_iso_verif) then
    463466
    464       do iq=1,nqperes
     467      do iq=1,nqtot
     468        IF(tracers(iq)%parent /= 'air') CYCLE
    465469      !write(*,*) 'vlspltgen 449: iq=',iq
    466470#ifdef DEBUG_IO   
     
    475479        END SELECT
    476480       
    477        enddo !do iq=1,nqperes
     481       enddo !do iq=1,nqtot
    478482
    479483      if (ok_iso_verif) then
     
    481485      endif !if (ok_iso_verif) then
    482486
    483       do iq=1,nqperes
     487      do iq=1,nqtot
     488        IF(tracers(iq)%parent /= 'air') CYCLE
    484489      !write(*,*) 'vlspltgen 477: iq=',iq
    485490#ifdef DEBUG_IO   
     
    496501        END SELECT
    497502       
    498        enddo !do iq=1,nqperes
     503       enddo !do iq=1,nqtot
    499504
    500505      !write(*,*) 'vlspltgen 550: apres derniere serie de call vlx'
  • LMDZ6/trunk/libf/dynphy_lonlat/calfis.F

    r4046 r4056  
    2929c    Auteur :  P. Le Van, F. Hourdin
    3030c   .........
    31       USE infotrac, ONLY: nqtot, niadv, tracers
     31      USE infotrac, ONLY: nqtot, tracers
    3232      USE control_mod, ONLY: planet_type, nsplit_phys
    3333#ifdef CPP_PHYS
     
    135135c    -----------------
    136136
    137       INTEGER i,j,l,ig0,ig,iq,iiq
     137      INTEGER i,j,l,ig0,ig,iq,itr
    138138      REAL zpsrf(ngridmx)
    139139      REAL zplev(ngridmx,llm+1),zplay(ngridmx,llm)
     
    281281c   ---------------
    282282c
     283      itr=0
    283284      DO iq=1,nqtot
    284           iiq=niadv(iq)
     285         IF(.NOT.tracers(iq)%isAdvected) CYCLE
     286         itr = itr + 1
    285287         DO l=1,llm
    286             zqfi(1,l,iq) = pq(1,1,l,iiq)
    287             ig0          = 2
     288            zqfi(1,l,itr) = pq(1,1,l,iq)
     289            ig0           = 2
    288290            DO j=2,jjm
    289291               DO i = 1, iim
    290                   zqfi(ig0,l,iq)  = pq(i,j,l,iiq)
     292                  zqfi(ig0,l,itr) = pq(i,j,l,iq)
    291293                  ig0             = ig0 + 1
    292294               ENDDO
    293295            ENDDO
    294             zqfi(ig0,l,iq) = pq(1,jjp1,l,iiq)
     296            zqfi(ig0,l,itr) = pq(1,jjp1,l,iq)
    295297         ENDDO
    296298      ENDDO
     
    481483         lafin_split=lafin.and.isplit==nsplit_phys
    482484
     485!      if (planet_type=="earth") then
    483486        CALL call_physiq(ngridmx,llm,nqtot,tracers(:)%name,
    484487     &                   debut_split,lafin_split,
     
    490493     &                   flxwfi,pducov,
    491494     &                   zdufi,zdvfi,zdtfi,zdqfi,zdpsrf)
    492                              
    493 !      if (planet_type=="earth") then
    494 !
    495 !         CALL physiq (ngridmx,
    496 !     .             llm,
    497 !     .             debut_split,
    498 !     .             lafin_split,
    499 !     .             jD_cur,
    500 !     .             jH_cur_split,
    501 !     .             zdt_split,
    502 !     .             zplev,
    503 !     .             zplay,
    504 !     .             zphi,
    505 !     .             zphis,
    506 !     .             presnivs,
    507 !     .             zufi,
    508 !     .             zvfi, zrfi,
    509 !     .             ztfi,
    510 !     .             zqfi,
    511 !     .             flxwfi,
    512 !     .             zdufi,
    513 !     .             zdvfi,
    514 !     .             zdtfi,
    515 !     .             zdqfi,
    516 !     .             zdpsrf,
    517 !     .             pducov)
    518495!
    519496!      else if ( planet_type=="generic" ) then
     
    622599      pdqfi(:,:,:,:)=0.
    623600C
     601      itr = 0
    624602      DO iq=1,nqtot
    625          iiq=niadv(iq)
     603         IF(.NOT.tracers(iq)%isAdvected) CYCLE
     604         itr = itr + 1
    626605         DO l=1,llm
    627606            DO i=1,iip1
    628                pdqfi(i,1,l,iiq)    = zdqfi(1,l,iq)
    629                pdqfi(i,jjp1,l,iiq) = zdqfi(ngridmx,l,iq)
     607               pdqfi(i,1,l,iq)    = zdqfi(1,l,itr)
     608               pdqfi(i,jjp1,l,iq) = zdqfi(ngridmx,l,itr)
    630609            ENDDO
    631610            DO j=2,jjm
    632611               ig0=1+(j-2)*iim
    633612               DO i=1,iim
    634                   pdqfi(i,j,l,iiq) = zdqfi(ig0+i,l,iq)
     613                  pdqfi(i,j,l,iq) = zdqfi(ig0+i,l,itr)
    635614               ENDDO
    636                pdqfi(iip1,j,l,iiq) = pdqfi(1,j,l,iq)
     615               pdqfi(iip1,j,l,iq) = pdqfi(1,j,l,itr)
    637616            ENDDO
    638617         ENDDO
  • LMDZ6/trunk/libf/dynphy_lonlat/calfis_loc.F

    r4046 r4056  
    4545      USE Times
    4646#endif
    47       USE infotrac, ONLY: nqtot, niadv, tracers
     47      USE infotrac, ONLY: nqtot, tracers
    4848      USE control_mod, ONLY: planet_type, nsplit_phys
    4949#ifdef CPP_PHYS
     
    154154c    -----------------
    155155
    156       INTEGER i,j,l,ig0,ig,iq,iiq
     156      INTEGER i,j,l,ig0,ig,iq,itr
    157157      REAL,ALLOCATABLE,SAVE :: zpsrf(:)
    158158      REAL,ALLOCATABLE,SAVE :: zplev(:,:),zplay(:,:)
     
    366366c
    367367
     368      itr = 0
    368369      DO iq=1,nqtot
    369          iiq=niadv(iq)
     370         IF(.NOT.tracers(iq)%isAdvected) CYCLE
     371         itr = itr + 1
    370372c$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
    371373         DO l=1,llm
     
    375377             i=index_i(ig0)
    376378             j=index_j(ig0)
    377              zqfi(ig0,l,iq)  = pq(i,j,l,iiq)
     379             zqfi(ig0,l,itr)  = pq(i,j,l,iq)
    378380           enddo
    379381         ENDDO
     
    10691071C
    10701072!cdir NODEP
     1073      itr = 0
    10711074      DO iq=1,nqtot
    1072          iiq=niadv(iq)
     1075         IF(.NOT.tracers(iq)%isAdvected) CYCLE
     1076         itr = itr + 1
    10731077c$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
    10741078         DO l=1,llm
     
    10791083              i=index_i(ig0)
    10801084              j=index_j(ig0)
    1081               pdqfi(i,j,l,iiq) = zdqfi(ig0,l,iq)
    1082               if (i==1) pdqfi(iip1,j,l,iiq) = zdqfi(ig0,l,iq)
     1085              pdqfi(i,j,l,iq) = zdqfi(ig0,l,itr)
     1086              if (i==1) pdqfi(iip1,j,l,iq) = zdqfi(ig0,l,itr)
    10831087            ENDDO
    10841088           
    10851089            IF (is_north_pole_dyn) then
    10861090              DO i=1,iip1
    1087                 pdqfi(i,1,l,iiq)    = zdqfi(1,l,iq)
     1091                pdqfi(i,1,l,iq)    = zdqfi(1,l,itr)
    10881092              ENDDO
    10891093            ENDIF
     
    10911095            IF (is_south_pole_dyn) then
    10921096              DO i=1,iip1
    1093                 pdqfi(i,jjp1,l,iiq) = zdqfi(klon,l,iq)
     1097                pdqfi(i,jjp1,l,iq) = zdqfi(klon,l,itr)
    10941098              ENDDO
    10951099            ENDIF
  • LMDZ6/trunk/libf/dynphy_lonlat/phylmd/iniphysiq_mod.F90

    r4050 r4056  
    1717  USE vertical_layers_mod, ONLY : init_vertical_layers
    1818  USE infotrac, ONLY: nqtot,nqo,nbtr,nqCO2,tracers,type_trac,&
    19                       niadv,conv_flg,pbl_flg,solsym,&
     19                      conv_flg,pbl_flg,solsym,&
    2020                      ok_isotopes,ok_iso_verif,ok_isotrac,&
    2121                      ok_init_iso,niso_possibles,tnat,&
    2222                      alpha_ideal,use_iso,iqiso,iso_indnum,&
    2323                      indnum_fn_num,index_trac,&
    24                       niso,ntraceurs_zone,ntraciso,nqtottr,itr_indice
     24                      niso,ntraceurs_zone,ntraciso,nqtottr
    2525#ifdef CPP_StratAer
    26   USE infotrac, ONLY: nbtr_bin, nbtr_sulgas, id_OCS_strat, &
     26  USE infotrac_phy, ONLY: nbtr_bin, nbtr_sulgas, id_OCS_strat, &
    2727                      id_SO2_strat, id_H2SO4_strat, id_BIN01_strat
    2828
     
    145145  ! Initialize tracer names, numbers, etc. for physics
    146146  CALL init_infotrac_phy(nqtot,nqo,nbtr,nqtottr,nqCO2,tracers,type_trac,&
    147                          niadv,conv_flg,pbl_flg,solsym,&
     147                         conv_flg,pbl_flg,solsym,&
    148148                         ok_isotopes,ok_iso_verif,ok_isotrac,&
    149149                         ok_init_iso,niso_possibles,tnat,&
    150150                         alpha_ideal,use_iso,iqiso,iso_indnum,&
    151151                         indnum_fn_num,index_trac,&
    152                          niso,ntraceurs_zone,ntraciso,itr_indice &
    153 #ifdef CPP_StratAer
    154                          ,nbtr_bin,nbtr_sulgas&
    155                          ,id_OCS_strat,id_SO2_strat,id_H2SO4_strat,id_BIN01_strat&
    156 #endif
    157                          )
     152                         niso,ntraceurs_zone,ntraciso)
    158153
    159154  ! Initializations for Reprobus
  • LMDZ6/trunk/libf/phylmd/Dust/phys_output_write_spl_mod.F90

    r3805 r4056  
    381381    USE pbl_surface_mod, ONLY: snow
    382382    USE indice_sol_mod, ONLY: nbsrf
    383     USE infotrac, ONLY: nqtot, nqo, nbtr, type_trac
     383    USE infotrac, ONLY: nqtot, nbtr, type_trac
    384384    USE geometry_mod, ONLY: cell_area
    385385    USE surface_data, ONLY: type_ocean, version_ocean, ok_veget, landice_opt
     
    430430    INTEGER, PARAMETER :: jjmp1=jjm+1-1/jjm
    431431    INTEGER :: itau_w
    432     INTEGER :: i, iinit, iinitend=1, iff, iq, nsrf, k, ll, naero
     432    INTEGER :: i, iinit, iinitend=1, iff, iq, itr, nsrf, k, ll, naero
    433433    REAL, DIMENSION (klon) :: zx_tmp_fi2d
    434434    REAL, DIMENSION (klon,klev) :: zx_tmp_fi3d, zpt_conv
     
    16101610#endif
    16111611!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1612        IF (nqtot.GE.nqo+1) THEN
    1613          !AS: type_trac = 'lmdz' par defaut dans libf/dyn3d/conf_gcm.F90
    1614          !Changé par inca, repr(obus), coag(ulation), co2i(nteractif), PAS par SPLA
    1615          !Cet "if" est donc inutile : IF (type_trac == 'lmdz' .OR. type_trac == 'repr') THEN
    1616            DO iq=nqo+1,nqtot
    1617              CALL histwrite_phy(o_trac(iq-nqo), tr_seri(:,:,iq-nqo))
    1618              CALL histwrite_phy(o_dtr_vdf(iq-nqo),d_tr_cl(:,:,iq-nqo))
    1619              CALL histwrite_phy(o_dtr_the(iq-nqo),d_tr_th(:,:,iq-nqo))
    1620              CALL histwrite_phy(o_dtr_con(iq-nqo),d_tr_cv(:,:,iq-nqo))
    1621              CALL histwrite_phy(o_dtr_lessi_impa(iq-nqo),d_tr_lessi_impa(:,:,iq-nqo))
    1622              CALL histwrite_phy(o_dtr_lessi_nucl(iq-nqo),d_tr_lessi_nucl(:,:,iq-nqo))
    1623              CALL histwrite_phy(o_dtr_insc(iq-nqo),d_tr_insc(:,:,iq-nqo))
    1624              CALL histwrite_phy(o_dtr_bcscav(iq-nqo),d_tr_bcscav(:,:,iq-nqo))
    1625              CALL histwrite_phy(o_dtr_evapls(iq-nqo),d_tr_evapls(:,:,iq-nqo))
    1626              CALL histwrite_phy(o_dtr_ls(iq-nqo),d_tr_ls(:,:,iq-nqo))
    1627 !            CALL histwrite_phy(o_dtr_dyn(iq-nqo),d_tr_dyn(:,:,iq-nqo))
    1628 !            CALL histwrite_phy(o_dtr_cl(iq-nqo),d_tr_cl(:,:,iq-nqo))
    1629              CALL histwrite_phy(o_dtr_trsp(iq-nqo),d_tr_trsp(:,:,iq-nqo))
    1630              CALL histwrite_phy(o_dtr_sscav(iq-nqo),d_tr_sscav(:,:,iq-nqo))
    1631              CALL histwrite_phy(o_dtr_sat(iq-nqo),d_tr_sat(:,:,iq-nqo))
    1632              CALL histwrite_phy(o_dtr_uscav(iq-nqo),d_tr_uscav(:,:,iq-nqo))
     1612           itr = 0
     1613           DO iq = 1, nqtot
     1614             IF(tracers(iq)%isH2Ofamily) CYCLE
     1615             itr = itr+1
     1616             CALL histwrite_phy(o_trac(itr), tr_seri(:,:,itr))
     1617             CALL histwrite_phy(o_dtr_vdf(itr),d_tr_cl(:,:,itr))
     1618             CALL histwrite_phy(o_dtr_the(itr),d_tr_th(:,:,itr))
     1619             CALL histwrite_phy(o_dtr_con(itr),d_tr_cv(:,:,itr))
     1620             CALL histwrite_phy(o_dtr_lessi_impa(itr),d_tr_lessi_impa(:,:,itr))
     1621             CALL histwrite_phy(o_dtr_lessi_nucl(itr),d_tr_lessi_nucl(:,:,itr))
     1622             CALL histwrite_phy(o_dtr_insc(itr),d_tr_insc(:,:,itr))
     1623             CALL histwrite_phy(o_dtr_bcscav(itr),d_tr_bcscav(:,:,itr))
     1624             CALL histwrite_phy(o_dtr_evapls(itr),d_tr_evapls(:,:,itr))
     1625             CALL histwrite_phy(o_dtr_ls(itr),d_tr_ls(:,:,itr))
     1626!            CALL histwrite_phy(o_dtr_dyn(itr),d_tr_dyn(:,:,itr))
     1627!            CALL histwrite_phy(o_dtr_cl(itr),d_tr_cl(:,:,itr))
     1628             CALL histwrite_phy(o_dtr_trsp(itr),d_tr_trsp(:,:,itr))
     1629             CALL histwrite_phy(o_dtr_sscav(itr),d_tr_sscav(:,:,itr))
     1630             CALL histwrite_phy(o_dtr_sat(itr),d_tr_sat(:,:,itr))
     1631             CALL histwrite_phy(o_dtr_uscav(itr),d_tr_uscav(:,:,itr))
    16331632             zx_tmp_fi2d=0.
    16341633             IF (vars_defined) THEN
    16351634                DO k=1,klev
    1636                    zx_tmp_fi2d(:)=zx_tmp_fi2d(:)+zmasse(:,k)*tr_seri(:,k,iq-nqo)
     1635                   zx_tmp_fi2d(:)=zx_tmp_fi2d(:)+zmasse(:,k)*tr_seri(:,k,itr)
    16371636                ENDDO
    16381637             ENDIF
    1639              CALL histwrite_phy(o_trac_cum(iq-nqo), zx_tmp_fi2d)
     1638             CALL histwrite_phy(o_trac_cum(itr), zx_tmp_fi2d)
    16401639           ENDDO
    1641          !ENDIF
    1642        ENDIF
    16431640
    16441641       IF (.NOT.vars_defined) THEN
  • LMDZ6/trunk/libf/phylmd/Dust/phytracr_spl_mod.F90

    r4046 r4056  
    11041104      REAL, intent(in) ::  rlon(klon)       ! longitudes pour chaque point
    11051105!
    1106       INTEGER i, k, it, j, ig
     1106      INTEGER i, k, iq, itr, j, ig
    11071107!
    11081108! DEFINITION OF DIAGNOSTIC VARIABLES
     
    12601260
    12611261#ifdef IOPHYS_DUST
    1262       do it=1,nbtr
    1263          write(str2,'(i2.2)') it
    1264          call iophys_ecrit('TRA'//str2,klev,'SOURCE','',tr_seri(:,:,it))
     1262      itr = 0
     1263      DO iq = 1, nqtot
     1264         IF(tracers(iq)%isH2Ofamily) CYCLE
     1265         itr = itr+1
     1266         write(str2,'(i2.2)') itr
     1267         call iophys_ecrit('TRA'//str2,klev,'SOURCE','',tr_seri(:,:,itr))
    12651268      enddo
    12661269#endif
     
    14141417        id_codu=-1
    14151418        id_scdu=-1
    1416        !print *,nbtr
    1417        do it=1,nbtr
    1418         print *, it, tracers(it+nqo)%name
    1419         SELECT CASE(tracers(it+nqo)%name)
    1420           CASE('PREC'); id_prec=it
    1421           CASE('FINE'); id_fine=it
    1422           CASE('COSS'); id_coss=it
    1423           CASE('CODU'); id_codu=it
    1424           CASE('SCDU'); id_scdu=it
    1425         END SELECT
    1426        enddo
    1427        ! check consistency with dust emission scheme:
    1428        if (ok_chimeredust) then
     1419        itr = 0
     1420        do iq=1,nqtot
     1421          IF(tracers(iq)%isH2Ofamily) CYCLE
     1422          itr = itr+1
     1423          print *, itr, TRIM(tracers(iq)%name)
     1424          SELECT CASE(tracers(iq)%name)
     1425            CASE('PREC'); id_prec=itr
     1426            CASE('FINE'); id_fine=itr
     1427            CASE('COSS'); id_coss=itr
     1428            CASE('CODU'); id_codu=itr
     1429            CASE('SCDU'); id_scdu=itr
     1430          END SELECT
     1431        enddo
     1432        ! check consistency with dust emission scheme:
     1433        if (ok_chimeredust) then
    14291434          if (.not.( id_scdu>0 .and. id_codu>0 .and. id_fine>0)) then
    14301435             call abort_gcm('phytracr_mod', 'pb in ok_chimdust 0',1)
    14311436          endif
    1432        else
     1437        else
    14331438          if (id_scdu>0) then
    14341439       call abort_gcm('phytracr_mod', 'pb in ok_chimdust 1 SCDU',1)
     
    15601565! JE before put in zero
    15611566      IF (lminmax) THEN
    1562         DO it=1,nbtr
    1563         CALL checknanqfi(tr_seri(:,:,it),qmin,qmax,'nan init phytracr')
    1564         ENDDO       
    1565         DO it=1,nbtr
    1566         CALL minmaxqfi2(tr_seri(:,:,it),qmin,qmax,'minmax init phytracr')
     1567        DO itr=1,nbtr
     1568        CALL checknanqfi(tr_seri(:,:,itr),qmin,qmax,'nan init phytracr')
     1569        ENDDO
     1570        DO itr=1,nbtr
     1571        CALL minmaxqfi2(tr_seri(:,:,itr),qmin,qmax,'minmax init phytracr')
    15671572        ENDDO
    15681573        CALL minmaxsource(source_tr,qmin,qmax,'maxsource init phytracr')
  • LMDZ6/trunk/libf/phylmd/Dust/splaeropt_5wv_rrtm.F90

    r4046 r4056  
    99  USE DIMPHY
    1010  USE aero_mod
    11   USE infotrac_phy
     11  USE infotrac_phy, ONLY: nqtot, nbtr, tracers
    1212  USE phys_local_var_mod, ONLY: od550aer,od865aer,ec550aer,od550lt1aer
    1313  !
     
    3434  LOGICAL :: soluble
    3535 
    36   INTEGER :: i, k, m, itr, irh, aerindex
     36  INTEGER :: i, k, m, iq, itr, irh, aerindex
    3737  INTEGER :: spsol, spinsol, la
    3838  INTEGER :: RH_num(klon,klev)
     
    112112  ENDDO
    113113
    114   DO itr=1,nbtr    !--loop over tracers 
    115     SELECT CASE(tracers(itr+nqo)%name)
     114  itr = 0
     115  DO iq = 1, nqtot
     116    IF(tracers(iq)%isH2Ofamily) CYCLE
     117    itr = itr+1
     118    SELECT CASE(tracers(iq)%name)
    116119      CASE('PREC'); CYCLE                                  !--precursor
    117120      CASE('FINE'); soluble=.TRUE.;  spsol=1; aerindex=1   !--fine mode accumulation mode
     
    119122      CASE('CODU'); soluble=.FALSE.; spsol=1; aerindex=3   !--coarse mode dust
    120123      CASE('SCDU'); soluble=.FALSE.; spsol=2; aerindex=4   !--super coarse mode dust
    121       CASE DEFAULT; CALL abort_physic(modname,'I cannot do aerosol optics for '//tracers(itr+nqo)%name,1)
     124      CASE DEFAULT; CALL abort_physic(modname,'I cannot do aerosol optics for '//tracers(iq)%name,1)
    122125    END SELECT
    123126
  • LMDZ6/trunk/libf/phylmd/Dust/splaeropt_6bands_rrtm.F90

    r4046 r4056  
    88  USE dimphy
    99  USE aero_mod
    10   USE infotrac_phy
     10  USE infotrac_phy, ONLY: nqtot, nbtr, tracers
    1111  USE phys_local_var_mod, ONLY: abs550aer
    1212
     
    3535  !
    3636  LOGICAL :: soluble
    37   INTEGER :: i, k, irh, itr, inu
     37  INTEGER :: i, k, irh, iq, itr, inu
    3838  INTEGER :: aerindex, spsol, spinsol
    3939  INTEGER :: RH_num(klon,klev)
     
    165165  cg_ae(:,:,:,:)=0.
    166166   
    167   DO itr=1,nbtr    !--loop over tracers 
    168     SELECT CASE(tracers(itr+nqo)%name)
     167  itr = 0
     168  DO iq = 1, nqtot
     169    IF(tracers(iq)%isH2Ofamily) CYCLE
     170    itr = itr+1
     171    SELECT CASE(tracers(iq)%name)
    169172      CASE('PREC'); CYCLE                                  !--precursor
    170173      CASE('FINE'); soluble=.TRUE.;  spsol=1; aerindex=1   !--fine mode accumulation mode
     
    172175      CASE('CODU'); soluble=.FALSE.; spsol=1; aerindex=3   !--coarse mode dust
    173176      CASE('SCDU'); soluble=.FALSE.; spsol=2; aerindex=4   !--super coarse mode dust
    174       CASE DEFAULT; CALL abort_physic(modname,'I cannot do aerosol optics for '//tracers(itr+nqo)%name,1)
     177      CASE DEFAULT; CALL abort_physic(modname,'I cannot do aerosol optics for '//tracers(iq)%name,1)
    175178    END SELECT
    176179
  • LMDZ6/trunk/libf/phylmd/Dust/splaeropt_lw_rrtm.F90

    r4046 r4056  
    1010  USE dimphy
    1111  USE aero_mod
    12   USE infotrac_phy
     12  USE infotrac_phy, ONLY: nqtot, nbtr, tracers
    1313  USE phys_state_var_mod, ONLY : tau_aero_lw_rrtm
    1414  USE YOERAD, ONLY : NLW
     
    3030  INTEGER, PARAMETER :: naero=naero_soluble+naero_insoluble
    3131  !
    32   INTEGER inu, itr, spinsol
     32  INTEGER inu, itr, iq, spinsol
    3333  CHARACTER*20 modname
    3434  !
     
    5454    tau_aero_lw_rrtm = 0.0
    5555    !
    56     DO itr=1,nbtr
    57       SELECT CASE(tracers(itr+nqo)%name)
    58         CASE('PREC','FINE''COSS'); CYCLE                   !--precursor or fine/coarde accumulation mode
     56   
     57    itr = 0
     58    DO iq = 1, nqtot
     59      IF(tracers(iq)%isH2Ofamily) CYCLE
     60      itr = itr+1
     61      SELECT CASE(tracers(iq)%name)
     62        CASE('PREC','FINE','COSS'); CYCLE                  !--precursor or fine/coarde accumulation mode
    5963        CASE('CODU'); spinsol=1                            !--coarse mode dust
    6064        CASE('SCDU'); spinsol=2                            !--super coarse mode dust
    61         CASE DEFAULT; CALL abort_physic(modname,'I cannot do aerosol optics for '//tracers(itr+nqo)%name,1)
     65        CASE DEFAULT; CALL abort_physic(modname,'I cannot do aerosol optics for '//tracers(iq)%name,1)
    6266      END SELECT
    6367      !
  • LMDZ6/trunk/libf/phylmd/Dust/splaerosol_optic_rrtm.F90

    r4046 r4056  
    1313  USE dimphy
    1414  USE aero_mod
    15   USE infotrac_phy
     15  USE infotrac_phy, ONLY: nbtr, nqtot, tracers
    1616  USE YOMCST, ONLY: RD, RG
    1717
     
    4040  REAL, DIMENSION(klon,klev,nwave,naero_tot), INTENT(OUT)  :: tau3d_aero
    4141
    42   INTEGER i, k, itr
     42  INTEGER i, k, iq, itr
    4343  REAL, DIMENSION(klon,klev) :: zdm, zdh
    4444  REAL zrho, pdel
     
    5050  mass_solu_aero_pi(:,:) = 0.0
    5151  !
    52   DO itr=1,nbtr
    53     IF (tracers(itr+nqo)%name=='FINE') THEN
     52  itr = 0
     53  DO iq = 1, nqtot
     54    IF(tracers(iq)%isH2Ofamily) CYCLE
     55    itr = itr+1
     56    IF(tracers(iq)%name/='FINE') THEN
    5457      mass_solu_aero(:,:)    = tr_seri(:,:,itr)
    5558      mass_solu_aero_pi(:,:) = tr_seri(:,:,itr)
  • LMDZ6/trunk/libf/phylmd/infotrac_phy.F90

    r4052 r4056  
    2626!$OMP THREADPRIVATE(nqtottr)
    2727
    28 ! ThL : number of CO2 tracers                   ModThL
     28! ThL : number of CO2 tracers   ModThL
    2929  INTEGER, SAVE :: nqCO2
    3030!$OMP THREADPRIVATE(nqCO2)
    3131
    3232#ifdef CPP_StratAer
    33 ! nbtr_bin: number of aerosol bins for StratAer model
    34 ! nbtr_sulgas: number of sulfur gases for StratAer model
    35   INTEGER, SAVE :: nbtr_bin, nbtr_sulgas
    36 !$OMP THREADPRIVATE(nbtr_bin,nbtr_sulgas)
    37   INTEGER, SAVE :: id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat
    38 !$OMP THREADPRIVATE(id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat)
     33  !=== SPECIFIC TO STRATOSPHERIC AEROSOLS (CK/OB)
     34  INTEGER, SAVE ::  nbtr_bin, nbtr_sulgas         !--- number of aerosols bins and sulfur gases for StratAer model
     35!$OMP THREADPRIVATE(nbtr_bin, nbtr_sulgas)
     36  INTEGER, SAVE ::  id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat, id_TEST_strat
     37!$OMP THREADPRIVATE(id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat, id_TEST_strat)
    3938#endif
    40 
    41 ! CRisi: nb traceurs pères= directement advectés par l'air
    42   INTEGER, SAVE :: nqperes
    43 !$OMP THREADPRIVATE(nqperes)
    4439
    4540! Tracers parameters
    4641  TYPE(trac_type), TARGET, ALLOCATABLE, SAVE :: tracers(:)
    4742!$OMP THREADPRIVATE(tracers)
    48 
    49 ! niadv : vector keeping the coorspondance between all tracers(nqtot) treated in the
    50 !         dynamic part of the code and the tracers (nbtr+2) used in the physics part of the code.
    51   INTEGER, ALLOCATABLE, DIMENSION(:), SAVE    :: niadv ! equivalent dyn / physique
    52 !$OMP THREADPRIVATE(niadv)
    5343
    5444! conv_flg(it)=0 : convection desactivated for tracer number it
     
    8575!$OMP THREADPRIVATE(niso,ntraceurs_zone,ntraciso)
    8676
    87     INTEGER, ALLOCATABLE, DIMENSION(:), SAVE ::  itr_indice ! numéro iq entre 1 et nqtot qui correspond au traceur itr entre 1 et nqtottr
    88 !$OMP THREADPRIVATE(itr_indice)
    89  
    9077CONTAINS
    9178
    9279  SUBROUTINE init_infotrac_phy(nqtot_,nqo_,nbtr_,nqtottr_,nqCO2_,tracers_,type_trac_,&
    93                                niadv_,conv_flg_,pbl_flg_,solsym_,&
     80                               conv_flg_,pbl_flg_,solsym_,&
    9481                               ok_isotopes_,ok_iso_verif_,ok_isotrac_,&
    9582                               ok_init_iso_,niso_possibles_,tnat_,&
    9683                               alpha_ideal_,use_iso_,iqiso_,iso_indnum_,&
    9784                               indnum_fn_num_,index_trac_,&
    98                                niso_,ntraceurs_zone_,ntraciso_,itr_indice_&
    99 #ifdef CPP_StratAer
    100                                ,nbtr_bin_,nbtr_sulgas_&
    101                                ,id_OCS_strat_,id_SO2_strat_,id_H2SO4_strat_,id_BIN01_strat_&
    102 #endif
    103                                )
     85                               niso_,ntraceurs_zone_,ntraciso_)
    10486
    10587    ! transfer information on tracers from dynamics to physics
     
    11294    INTEGER,INTENT(IN) :: nqtottr_
    11395    INTEGER,INTENT(IN) :: nqCO2_
    114 #ifdef CPP_StratAer
    115     INTEGER,INTENT(IN) :: nbtr_bin_
    116     INTEGER,INTENT(IN) :: nbtr_sulgas_
    117     INTEGER,INTENT(IN) :: id_OCS_strat_
    118     INTEGER,INTENT(IN) :: id_SO2_strat_
    119     INTEGER,INTENT(IN) :: id_H2SO4_strat_
    120     INTEGER,INTENT(IN) :: id_BIN01_strat_
    121 #endif
    12296    TYPE(trac_type), INTENT(IN) :: tracers_(nqtot_) ! tracers descriptors
    12397    CHARACTER(len=*),INTENT(IN) :: type_trac_
    124     INTEGER,INTENT(IN) :: niadv_ (nqtot_) ! equivalent dyn / physique
    12598    INTEGER,INTENT(IN) :: conv_flg_(nbtr_)
    12699    INTEGER,INTENT(IN) :: pbl_flg_(nbtr_)
     
    142115    INTEGER,INTENT(IN) :: ntraceurs_zone_
    143116    INTEGER,INTENT(IN) :: ntraciso_
    144     INTEGER,INTENT(IN) :: itr_indice_(nqtottr_)
    145 
    146     CHARACTER(LEN=30) :: modname="init_infotrac_phy"
     117
     118    INTEGER :: iq, itr
     119    CHARACTER(LEN=maxlen), ALLOCATABLE :: tnames(:)
     120    CHARACTER(LEN=maxlen) :: modname="init_infotrac_phy"
    147121
    148122    nqtot=nqtot_
     
    153127    ALLOCATE(tracers(nqtot)); tracers(:) = tracers_(:)
    154128#ifdef CPP_StratAer
    155     nbtr_bin=nbtr_bin_
    156     nbtr_sulgas=nbtr_sulgas_
    157     id_OCS_strat=id_OCS_strat_
    158     id_SO2_strat=id_SO2_strat_
    159     id_H2SO4_strat=id_H2SO4_strat_
    160     id_BIN01_strat=id_BIN01_strat_
     129    IF (type_trac == 'coag') THEN
     130      nbtr_bin    = COUNT([(tracers(iq)%name(1:3)=='BIN', iq=1, nqtot)])
     131      nbtr_sulgas = COUNT([(tracers(iq)%name(1:3)=='GAS', iq=1, nqtot)])
     132      tnames = PACK(tracers(:)%name, MASK=.NOT.tracers(:)%isH2Ofamily)
     133      id_BIN01_strat = strIdx(tnames, 'BIN01'   )
     134      id_OCS_strat   = strIdx(tnames, 'GASOSC'  )
     135      id_SO2_strat   = strIdx(tnames, 'GASSO2'  )
     136      id_H2SO4_strat = strIdx(tnames, 'GASH2SO4')
     137      id_TEST_strat  = strIdx(tnames, 'GASTEST' )
     138      WRITE(lunout,*)'nbtr_bin       =', nbtr_bin
     139      WRITE(lunout,*)'nbtr_sulgas    =', nbtr_sulgas
     140      WRITE(lunout,*)'id_BIN01_strat =', id_BIN01_strat
     141      WRITE(lunout,*)'id_OCS_strat   =',   id_OCS_strat
     142      WRITE(lunout,*)'id_SO2_strat   =',   id_SO2_strat
     143      WRITE(lunout,*)'id_H2SO4_strat =', id_H2SO4_strat
     144      WRITE(lunout,*)'id_TEST_strat  =',  id_TEST_strat
     145    END IF
    161146#endif
    162147    type_trac = type_trac_
    163     ALLOCATE(niadv(nqtot))
    164     niadv(:)=niadv_(:)
    165148    ALLOCATE(conv_flg(nbtr))
    166149    conv_flg(:)=conv_flg_(:)
     
    207190    ENDIF ! of IF(ok_isotopes)
    208191
    209     ALLOCATE(itr_indice(nqtottr))
    210     itr_indice(:)=itr_indice_(:)
    211  
     192    WRITE(*,*) 'infotrac_phy 207: nqtottr=',nqtottr
     193    WRITE(*,*) 'ntraciso,niso=',ntraciso,niso
     194#ifdef ISOVERIF
     195    ! DC: the "1" will be replaced by iH2O (H2O isotopes group index)
     196    WRITE(*,*) 'iso_iName=',PACK(tracers(:)%iso_iName, MASK=tracers(:)%iso_iGroup==1)
     197#endif
     198
    212199  END SUBROUTINE init_infotrac_phy
    213200
  • LMDZ6/trunk/libf/phylmd/init_be.F90

    r2351 r4056  
    55
    66  USE dimphy
    7   USE infotrac_phy, ONLY : nbtr
    87  USE indice_sol_mod
    98  USE geometry_mod, ONLY : longitude, latitude
  • LMDZ6/trunk/libf/phylmd/phyetat0.F90

    r4046 r4056  
    2121       ale_wake, ale_bl_stat, ds_ns, dt_ns, delta_sst, delta_sal, ratqs_inter
    2222!FC
    23   USE geometry_mod, ONLY : longitude_deg, latitude_deg
    24   USE iostart, ONLY : close_startphy, get_field, get_var, open_startphy
    25   USE infotrac_phy, only: nbtr, nqo, type_trac, tracers, niadv
    26   USE traclmdz_mod,    ONLY : traclmdz_from_restart
    27   USE carbon_cycle_mod, ONLY : carbon_cycle_tr, carbon_cycle_cpl, co2_send
    28   USE indice_sol_mod, only: nbsrf, is_ter, epsfra, is_lic, is_oce, is_sic
    29   USE ocean_slab_mod, ONLY: nslay, tslab, seaice, tice, ocean_slab_init
     23  USE geometry_mod,     ONLY: longitude_deg, latitude_deg
     24  USE iostart,          ONLY: close_startphy, get_field, get_var, open_startphy
     25  USE infotrac_phy,     ONLY: nqtot, nbtr, type_trac, tracers
     26  USE traclmdz_mod,     ONLY: traclmdz_from_restart
     27  USE carbon_cycle_mod, ONLY: carbon_cycle_tr, carbon_cycle_cpl, co2_send
     28  USE indice_sol_mod,   ONLY: nbsrf, is_ter, epsfra, is_lic, is_oce, is_sic
     29  USE ocean_slab_mod,   ONLY: nslay, tslab, seaice, tice, ocean_slab_init
    3030  USE time_phylmdz_mod, ONLY: init_iteration, pdtphys, itau_phy
    3131#ifdef CPP_XIOS
     
    7575  INTEGER length
    7676  PARAMETER (length=100)
    77   INTEGER it, iiq, isw
     77  INTEGER it, iq, isw
    7878  REAL tab_cntrl(length), tabcntr0(length)
    7979  CHARACTER*7 str7
     
    448448
    449449  IF (type_trac == 'lmdz') THEN
    450      DO it=1, nbtr                                                                 
    451 !!        iiq=niadv(it+2)                                                           ! jyg
    452         iiq=niadv(it+nqo)                                                           ! jyg
    453         found=phyetat0_get(1,trs(:,it),"trs_"//TRIM(tracers(iiq)%name), &
    454                                   "Surf trac"//TRIM(tracers(iiq)%name),0.)
    455      ENDDO
     450     it = 0
     451     DO iq = 1, nqtot
     452        IF(.NOT.tracers(iq)%isAdvected .OR. tracers(iq)%isH2Ofamily) CYCLE
     453        it = it+1
     454        found=phyetat0_get(1,trs(:,it),"trs_"//TRIM(tracers(iq)%name), &
     455                                  "Surf trac"//TRIM(tracers(iq)%name),0.)
     456     END DO
    456457     CALL traclmdz_from_restart(trs)
    457458  ENDIF
    458459
     460!--OB now this is for co2i - ThL: and therefore also for inco
    459461  IF (type_trac == 'co2i' .OR. type_trac == 'inco') THEN
    460462     IF (carbon_cycle_cpl) THEN
     
    598600   CALL get_field(name, field, found)
    599601   IF (.NOT. found) THEN
    600      WRITE(lunout,*) "phyetat0: Le champ <",name,"> est absent"
     602     WRITE(lunout,*) "phyetat0: Le champ <",TRIM(name),"> est absent"
    601603     WRITE(lunout,*) "Depart legerement fausse. Mais je continue"
    602604     field(:,:)=default
  • LMDZ6/trunk/libf/phylmd/phyredem.F90

    r4046 r4056  
    3535  USE iostart, ONLY: open_restartphy, close_restartphy, enddef_restartphy, put_field, put_var
    3636  USE traclmdz_mod, ONLY : traclmdz_to_restart
    37   USE infotrac_phy, ONLY: type_trac, niadv, tracers, nbtr, nqo
     37  USE infotrac_phy, ONLY: type_trac, nqtot, tracers, nbtr
    3838  USE carbon_cycle_mod, ONLY : carbon_cycle_cpl, co2_send
    3939  USE indice_sol_mod, ONLY: nbsrf, is_oce, is_sic, is_ter, is_lic, epsfra
     
    7070  CHARACTER (len=2) :: str2
    7171  CHARACTER (len=256) :: nam, lnam
    72   INTEGER           :: it, iiq, pass
     72  INTEGER           :: it, iq, pass
    7373
    7474  !======================================================================
     
    326326    IF (type_trac == 'lmdz') THEN
    327327       CALL traclmdz_to_restart(trs)
    328        DO it=1, nbtr
    329 !!        iiq=niadv(it+2)                                                           ! jyg
    330           iiq=niadv(it+nqo)                                                           ! jyg
    331           CALL put_field(pass,"trs_"//tracers(iiq)%name, "", trs(:, it))
     328       it = 0
     329       DO iq = 1, nqtot
     330          IF(.NOT.tracers(iq)%isAdvected .OR. tracers(iq)%isH2Ofamily) CYCLE
     331          it = it+1
     332          CALL put_field(pass,"trs_"//tracers(iq)%name, "", trs(:, it))
    332333       END DO
    333334    END IF
     
    391392
    392393  IMPLICIT NONE
    393   INTEGER, INTENT(IN)            :: pass
     394  INTEGER, INTENT(IN)           :: pass
    394395  CHARACTER(LEN=*),  INTENT(IN) :: nam, lnam
    395396  REAL,              INTENT(IN) :: field(:,:)
  • LMDZ6/trunk/libf/phylmd/phys_output_mod.F90

    r4046 r4056  
    3535    USE iophy
    3636    USE dimphy
    37     USE infotrac_phy, ONLY: nqtot, nqo, niadv, tracers, type_trac
    38     USE strings_mod,  ONLY: maxlen
     37    USE infotrac_phy, ONLY: nqtot, tracers, type_trac, niso, ntraciso, maxlen
    3938    USE ioipsl
    4039    USE phys_cal_mod, only : hour, calend
     
    9695    CHARACTER(LEN=4), DIMENSION(nlevSTD)  :: clevSTD
    9796    REAL, DIMENSION(nlevSTD)              :: rlevSTD
    98     INTEGER                               :: nsrf, k, iq, iiq, iff, i, j, ilev, jq
     97    INTEGER                               :: nsrf, k, iq, iff, i, j, ilev, itr, ixt, iiso, izone
    9998    INTEGER                               :: naero
    10099    LOGICAL                               :: ok_veget
     
    115114    LOGICAL, DIMENSION(nfiles)            :: phys_out_filestations
    116115
    117     CHARACTER(LEN=50) :: outiso
    118     CHARACTER(LEN=20) :: unit
    119116    CHARACTER(LEN=maxlen) :: tnam, lnam, dn
    120117    INTEGER :: flag(nfiles)
     
    122119!!!!!!!!!! stockage dans une region limitee pour chaque fichier !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    123120    !                 entre [phys_out_lonmin,phys_out_lonmax] et [phys_out_latmin,phys_out_latmax]
    124 
    125     LOGICAL, DIMENSION(nfiles), SAVE  :: phys_out_regfkey       = (/ .FALSE., .FALSE., .FALSE., .FALSE., .FALSE., &
    126                                                                      .FALSE., .FALSE., .FALSE., .FALSE., .FALSE. /)
    127     REAL, DIMENSION(nfiles), SAVE     :: phys_out_lonmin        = (/ -180., -180., -180., -180., -180., &
    128                                                                      -180., -180., -180., -180., -180. /)
    129     REAL, DIMENSION(nfiles), SAVE     :: phys_out_lonmax        = (/  180.,  180.,  180.,  180.,  180., &
    130                                                                       180.,  180.,  180.,  180.,  180. /)
    131     REAL, DIMENSION(nfiles), SAVE     :: phys_out_latmin        = (/  -90.,  -90.,  -90.,  -90.,  -90., &
    132                                                                       -90.,  -90.,  -90.,  -90.,  -90. /)
    133     REAL, DIMENSION(nfiles), SAVE     :: phys_out_latmax        = (/   90.,   90.,   90.,   90.,   90., &
    134                                                                        90.,   90.,   90.,   90.,   90. /)
     121    LOGICAL, DIMENSION(nfiles), SAVE :: &
     122      phys_out_regfkey = [.FALSE., .FALSE., .FALSE., .FALSE., .FALSE., .FALSE., .FALSE., .FALSE., .FALSE., .FALSE.]
     123    REAL,    DIMENSION(nfiles), SAVE :: &
     124      phys_out_lonmin  = [  -180.,   -180.,   -180.,   -180.,   -180.,   -180.,   -180.,   -180.,   -180.,   -180.], &
     125      phys_out_lonmax  = [   180.,    180.,    180.,    180.,    180.,    180.,    180.,    180.,    180.,    180.], &
     126      phys_out_latmin  = [   -90.,    -90.,    -90.,    -90.,    -90.,    -90.,    -90.,    -90.,    -90.,    -90.], &
     127      phys_out_latmax  = [    90.,     90.,     90.,     90.,     90.,     90.,     90.,     90.,     90.,     90.]
    135128    REAL, DIMENSION(klev,2) :: Ahyb_bounds, Bhyb_bounds
    136129    REAL, DIMENSION(klev+1)   :: lev_index
     
    169162    ALLOCATE(o_dtr_dry(nqtot),o_dtr_vdf(nqtot))
    170163
    171     levmax = (/ klev, klev, klev, klev, klev, klev, nlevSTD, nlevSTD, nlevSTD, klev /)
     164    levmax = [klev, klev, klev, klev, klev, klev, nlevSTD, nlevSTD, nlevSTD, klev]
    172165
    173166    phys_out_filenames(1) = 'histmth'
     
    366359    CALL wxios_add_vaxis("bnds", 2, (/1.,2./))
    367360
    368      CALL wxios_add_vaxis("Alt", &
     361    CALL wxios_add_vaxis("Alt", &
    369362            levmax(iff) - levmin(iff) + 1, pseudoalt)
    370363
    371     IF (NSW.EQ.6) THEN
    372 !
    373 !wl1_sun: minimum bound of wavelength (in um)
    374 !
    375       wl1_sun(1)=0.180
    376       wl1_sun(2)=0.250
    377       wl1_sun(3)=0.440
    378       wl1_sun(4)=0.690
    379       wl1_sun(5)=1.190
    380       wl1_sun(6)=2.380
    381 !
    382 !wl2_sun: maximum bound of wavelength (in um)
    383 !
    384       wl2_sun(1)=0.250
    385       wl2_sun(2)=0.440
    386       wl2_sun(3)=0.690
    387       wl2_sun(4)=1.190
    388       wl2_sun(5)=2.380
    389       wl2_sun(6)=4.000
    390 !
    391     ELSE IF(NSW.EQ.2) THEN
    392 !
    393 !wl1_sun: minimum bound of wavelength (in um)
    394 !
    395       wl1_sun(1)=0.250
    396       wl1_sun(2)=0.690
    397 !
    398 !wl2_sun: maximum bound of wavelength (in um)
    399 !
    400       wl2_sun(1)=0.690
    401       wl2_sun(2)=4.000
    402     ENDIF
     364    ! wl1_sun/wl2_sun: minimum/maximum bound of wavelength (in um)
     365    SELECT CASE(NSW)
     366      CASE(6)
     367        wl1_sun(1:6) = [0.180, 0.250, 0.440, 0.690, 1.190, 2.380]
     368        wl2_sun(1:6) = [0.250, 0.440, 0.690, 1.190, 2.380, 4.000]
     369      CASE(2)
     370        wl1_sun(1:2) = [0.250, 0.690]
     371        wl2_sun(1:2) = [0.690, 4.000]
     372    END SELECT
    403373
    404374    DO ISW=1, NSW
     
    498468     ENDIF ! clef_files
    499469
    500        IF (nqtot>=nqo+1) THEN
    501 !
    502           DO iq=nqo+1,nqtot
    503             iiq=niadv(iq); jq = iq-nqo
    504             dn = 'd'//TRIM(tracers(iiq)%name)//'_'
     470          itr = 0
     471          DO iq = 1, nqtot
     472            IF(.NOT.tracers(iq)%isAdvected .OR. tracers(iq)%isH2Ofamily) CYCLE
     473            itr = itr + 1
     474            dn = 'd'//TRIM(tracers(iq)%name)//'_'
    505475
    506476            flag = [1, 5, 5, 5, 10, 10, 11, 11, 11, 11]
    507             lnam = 'Tracer '//TRIM(tracers(iiq)%longName)
    508             tnam = TRIM(tracers(iiq)%name); o_trac          (jq) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     477            lnam = 'Tracer '//TRIM(tracers(iq)%longName)
     478            tnam = TRIM(tracers(iq)%name);  o_trac          (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     479
    509480            flag = [4, 7, 7, 7, 10, 10, 11, 11, 11, 11]
    510             lnam = 'Tendance tracer '//TRIM(tracers(iiq)%longName)
    511             tnam = TRIM(dn)//'vdf';         o_dtr_vdf       (jq) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     481            lnam = 'Tendance tracer '//TRIM(tracers(iq)%longName)
     482            tnam = TRIM(dn)//'vdf';         o_dtr_vdf       (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    512483
    513484            flag = [5, 7, 7, 7, 10, 10, 11, 11, 11, 11]
    514             tnam = TRIM(dn)//'the';         o_dtr_the       (jq) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    515             tnam = TRIM(dn)//'con';         o_dtr_con       (jq) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     485            tnam = TRIM(dn)//'the';         o_dtr_the       (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     486            tnam = TRIM(dn)//'con';         o_dtr_con       (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    516487
    517488            flag = [7, 7, 7, 7, 10, 10, 11, 11, 11, 11]
    518             tnam = TRIM(dn)//'lessi_impa';  o_dtr_lessi_impa(jq) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    519             tnam = TRIM(dn)//'lessi_nucl';  o_dtr_lessi_nucl(jq) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    520             tnam = TRIM(dn)//'insc';        o_dtr_insc      (jq) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    521             tnam = TRIM(dn)//'bcscav';      o_dtr_bcscav    (jq) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    522             tnam = TRIM(dn)//'evapls';      o_dtr_evapls    (jq) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    523             tnam = TRIM(dn)//'ls';          o_dtr_ls        (jq) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    524             tnam = TRIM(dn)//'trsp';        o_dtr_trsp      (jq) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    525             tnam = TRIM(dn)//'sscav';       o_dtr_sscav     (jq) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    526             tnam = TRIM(dn)//'sat';         o_dtr_sat       (jq) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    527             tnam = TRIM(dn)//'uscav';       o_dtr_uscav     (jq) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    528 
    529             lnam = 'tracer tendency dry deposition'//TRIM(tracers(iiq)%longName)
    530             tnam = 'cum'//TRIM(dn)//'dry';  o_dtr_dry       (jq) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     489            tnam = TRIM(dn)//'lessi_impa';  o_dtr_lessi_impa(itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     490            tnam = TRIM(dn)//'lessi_nucl';  o_dtr_lessi_nucl(itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     491            tnam = TRIM(dn)//'insc';        o_dtr_insc      (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     492            tnam = TRIM(dn)//'bcscav';      o_dtr_bcscav    (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     493            tnam = TRIM(dn)//'evapls';      o_dtr_evapls    (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     494            tnam = TRIM(dn)//'ls';          o_dtr_ls        (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     495            tnam = TRIM(dn)//'trsp';        o_dtr_trsp      (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     496            tnam = TRIM(dn)//'sscav';       o_dtr_sscav     (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     497            tnam = TRIM(dn)//'sat';         o_dtr_sat       (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     498            tnam = TRIM(dn)//'uscav';       o_dtr_uscav     (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     499
     500            lnam = 'tracer tendency dry deposition'//TRIM(tracers(iq)%longName)
     501            tnam = 'cum'//TRIM(dn)//'dry';  o_dtr_dry       (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    531502
    532503            flag = [1, 4, 10, 10, 10, 10, 11, 11, 11, 11]
    533             lnam = 'Cumulated tracer '//TRIM(tracers(iiq)%longName)
    534             tnam = 'cum'//TRIM(tracers(iiq)%name); o_trac_cum(jq)= ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     504            lnam = 'Cumulated tracer '//TRIM(tracers(iq)%longName)
     505            tnam = 'cum'//TRIM(tracers(iq)%name); o_trac_cum(itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    535506          ENDDO
    536        ENDIF
    537507
    538508   ENDDO !  iff
     
    555525    ENDIF
    556526
    557 !  DO iq=nqo+1,nqtot
    558 !    iiq=niadv(iq)
    559 !    dn = 'd'//TRIM(tracers(iiq)%name)//'_'
    560 !    WRITE(*,'(a,i1,a,10i3)')'trac(',iiq,')%flag = ',o_trac(iiq)%flag
    561 !    WRITE(*,'(a,i1,a)')'trac(',iiq,')%tnam = '//TRIM(o_trac(iiq)%name)
    562 !    WRITE(*,'(a,i1,a)')'trac(',iiq,')%lnam = '//TRIM(o_trac(iiq)%description)
     527!  DO iq=1,nqtot
     528!    IF(.NOT.tracers(iq)%isAdvected .OR. tracers(iq)%isH2Ofamily) CYCLE
     529!    WRITE(*,'(a,i1,a,10i3)')'trac(',iq,')%flag = ',o_trac(iq)%flag
     530!    WRITE(*,'(a,i1,a)')'trac(',iq,')%name = '//TRIM(o_trac(iq)%name)
     531!    WRITE(*,'(a,i1,a)')'trac(',iq,')%description = '//TRIM(o_trac(iq)%description)
    563532!  END DO
    564533
  • LMDZ6/trunk/libf/phylmd/phys_output_write_mod.F90

    r4046 r4056  
    2525
    2626    USE dimphy, ONLY: klon, klev, klevp1
    27     USE infotrac_phy, ONLY: nbtr, nqtot, nqo, type_trac, tracers, niadv
     27    USE infotrac_phy, ONLY: nbtr, nqtot, nqo, type_trac, tracers, niso, ntraciso, maxlen
    2828    USE strings_mod,  ONLY: maxlen
    2929    USE mod_phys_lmdz_para, ONLY: is_north_pole_phy,is_south_pole_phy
     
    198198         o_map_emis_Anv, o_map_pcld_Anv, o_map_tcld_Anv, &
    199199         o_map_ntot, o_map_hc,o_map_hist,o_map_Cb,o_map_ThCi,o_map_Anv, &
     200#ifdef ISO
     201! Isotopes
     202         o_xtprecip,o_xtplul,o_xtpluc,o_xtovap,o_xtoliq,o_xtcond, &
     203         o_xtevap,o_dxtdyn,o_dxtldyn,o_dxtcon,o_dxtlsc,o_dxteva, &
     204         o_dxtajs,o_dxtvdf,o_dxtthe, o_dxtch4, &
     205         o_dxtprod_nucl,o_dxtcosmo,o_dxtdecroiss, &
     206#endif
     207! Tropopause
    200208         o_alt_tropo, &
    201 ! Tropopause
    202209         o_p_tropopause, o_z_tropopause, o_t_tropopause,  &
    203210         o_col_O3_strato, o_col_O3_tropo,                 &
     
    254261         rhlevSTD, O3STD, O3daySTD, uvSTD, vqSTD, vTSTD, wqSTD, vphiSTD, &
    255262         wTSTD, u2STD, v2STD, T2STD, missing_val_nf90, delta_sal, ds_ns, &
     263#ifdef ISO
     264        xtrain_con, xtsnow_con, xtrain_fall, xtsnow_fall, &
     265#endif
    256266         dt_ns, delta_sst
    257267
     
    320330         east_gwstress, west_gwstress, &
    321331         d_q_ch4, pmfd, pmfu, ref_liq, ref_ice, rhwriteSTD, &
     332#ifdef ISO
     333        xtrain_lsc, xtsnow_lsc, xt_seri, xtl_seri,xts_seri,xtevap, &
     334        d_xt_dyn,d_xtl_dyn,d_xt_con,d_xt_vdf,d_xt_ajsb, &
     335        d_xt_lsc,d_xt_eva,d_xt_ch4, &
     336        d_xt_ajs, d_xt_ajsb, &
     337        d_xt_prod_nucl,d_xt_cosmo,d_xt_decroiss, &
     338#endif
    322339         ep, epmax_diag, &  ! epmax_cape
    323340         p_tropopause, t_tropopause, z_tropopause
     
    367384    USE pbl_surface_mod, ONLY: snow
    368385    USE indice_sol_mod, ONLY: nbsrf
     386#ifdef ISO
     387    USE isotopes_mod, ONLY: iso_HTO
     388#endif
    369389    USE geometry_mod, ONLY: cell_area, latitude_deg, longitude_deg
    370390    USE surface_data, ONLY: type_ocean, version_ocean, ok_veget, landice_opt
     
    419439    ! Local
    420440    INTEGER :: itau_w
    421     INTEGER :: i, iinit, iinitend=1, iff, iq, iiq, nsrf, k, ll, naero
     441    INTEGER :: i, iinit, iinitend=1, iff, iq, nsrf, k, ll, naero
    422442    REAL, DIMENSION (klon) :: zx_tmp_fi2d, zpt_conv2d, wind100m
    423443    REAL, DIMENSION (klon,klev) :: zx_tmp_fi3d, zpt_conv
     
    439459#endif
    440460    REAL, PARAMETER :: un_jour=86400.
    441     INTEGER ISW
     461    INTEGER :: ISW, itr, ixt, it
    442462    CHARACTER*1 ch1
    443463    CHARACTER(LEN=maxlen) :: varname, dn
     
    452472    REAL,DIMENSION(klon,klev) :: z, dz
    453473    REAL,DIMENSION(klon)      :: zrho, zt
    454 
    455     INTEGER :: nqup
    456 
    457474
    458475    ! On calcul le nouveau tau:
     
    511528          CALL xios_get_handle("fields_strataer_trac_3D", group_handle)
    512529          ! On boucle sur les traceurs pour les ajouter au groupe puis fixer les attributs
    513           DO iq=nqo+1, nqtot
    514             iiq=niadv(iq)
    515             dn = 'd'//TRIM(tracers(iiq)%name)//'_'
    516             WRITE (lunout,*) 'XIOS var=', nqo, iq, nqtot, tracers(iiq)%name
     530          DO iq = 1, nqtot
     531            IF(.NOT.tracers(iq)%isAdvected .OR. tracers(iq)%isH2Ofamily) CYCLE
     532            dn = 'd'//TRIM(tracers(iq)%name)//'_'
     533            WRITE (lunout,*) 'XIOS var=', nqo, iq, nqtot, tracers(iq)%name
    517534
    518535            unt = "kg kg-1"
    519             varname=trim(tracers(iiq)%name)
     536            varname=trim(tracers(iq)%name)
    520537            CALL xios_add_child(group_handle, child, varname)
    521538            CALL xios_set_attr(child, name=varname, unit=unt)
     
    561578            CALL xios_add_child(group_handle, child, varname)
    562579            CALL xios_set_attr(child, name=varname, unit=unt)
    563           ENDDO
     580          END DO
    564581          !On ajoute les variables 2D traceurs par l interface fortran
    565582          CALL xios_get_handle("fields_strataer_trac_2D", group_handle)
    566583          ! On boucle sur les traceurs pour les ajouter au groupe puis fixer les attributs
    567           DO iq=nqo+1, nqtot
    568             iiq=niadv(iq)
     584          DO iq = 1, nqtot
     585            IF(.NOT.tracers(iq)%isAdvected .OR. tracers(iq)%isH2Ofamily) CYCLE
    569586
    570587            unt = "kg m-2"
    571             varname='cum'//trim(tracers(iiq)%name)
     588            varname='cum'//trim(tracers(iq)%name)
    572589            WRITE (lunout,*) 'XIOS var=', iq, nqtot, varname
    573590            CALL xios_add_child(group_handle, child, varname)
     
    575592
    576593            unt = "kg m-2 s-1"
    577             varname='cumd'//trim(tracers(iiq)%name)//'_dry'
     594            varname='cumd'//trim(tracers(iq)%name)//'_dry'
    578595            CALL xios_add_child(group_handle, child, varname)
    579596            CALL xios_set_attr(child, name=varname, unit=unt)
     
    611628       ENDIf
    612629       CALL histwrite_phy(o_aire, zx_tmp_fi2d)
     630
    613631       IF (vars_defined) THEN
    614632          DO i=1, klon
     
    24082426       IF (iflag_phytrac == 1 ) then
    24092427         IF (type_trac == 'lmdz' .OR. type_trac == 'coag') THEN
    2410            DO iq=nqo+1, nqtot
     2428           itr = 0
     2429           DO iq = 1, nqtot
     2430             IF(tracers(iq)%isH2Ofamily) CYCLE
     2431             itr = itr + 1
     2432!            write(*,*) 'phys_output_write_mod 2337: itr=',itr
    24112433             !--3D fields
    2412              CALL histwrite_phy(o_trac(iq-nqo), tr_seri(:,:,iq-nqo))
    2413              CALL histwrite_phy(o_dtr_vdf(iq-nqo),d_tr_cl(:,:,iq-nqo))
    2414              CALL histwrite_phy(o_dtr_the(iq-nqo),d_tr_th(:,:,iq-nqo))
    2415              CALL histwrite_phy(o_dtr_con(iq-nqo),d_tr_cv(:,:,iq-nqo))
    2416              CALL histwrite_phy(o_dtr_lessi_impa(iq-nqo),d_tr_lessi_impa(:,:,iq-nqo))
    2417              CALL histwrite_phy(o_dtr_lessi_nucl(iq-nqo),d_tr_lessi_nucl(:,:,iq-nqo))
    2418              CALL histwrite_phy(o_dtr_insc(iq-nqo),d_tr_insc(:,:,iq-nqo))
    2419              CALL histwrite_phy(o_dtr_bcscav(iq-nqo),d_tr_bcscav(:,:,iq-nqo))
    2420              CALL histwrite_phy(o_dtr_evapls(iq-nqo),d_tr_evapls(:,:,iq-nqo))
    2421              CALL histwrite_phy(o_dtr_ls(iq-nqo),d_tr_ls(:,:,iq-nqo))
    2422              CALL histwrite_phy(o_dtr_trsp(iq-nqo),d_tr_trsp(:,:,iq-nqo))
    2423              CALL histwrite_phy(o_dtr_sscav(iq-nqo),d_tr_sscav(:,:,iq-nqo))
    2424              CALL histwrite_phy(o_dtr_sat(iq-nqo),d_tr_sat(:,:,iq-nqo))
    2425              CALL histwrite_phy(o_dtr_uscav(iq-nqo),d_tr_uscav(:,:,iq-nqo))
     2434             CALL histwrite_phy(o_trac(itr), tr_seri(:,:,itr))
     2435             CALL histwrite_phy(o_dtr_vdf(itr),d_tr_cl(:,:,itr))
     2436             CALL histwrite_phy(o_dtr_the(itr),d_tr_th(:,:,itr))
     2437             CALL histwrite_phy(o_dtr_con(itr),d_tr_cv(:,:,itr))
     2438             CALL histwrite_phy(o_dtr_lessi_impa(itr),d_tr_lessi_impa(:,:,itr))
     2439             CALL histwrite_phy(o_dtr_lessi_nucl(itr),d_tr_lessi_nucl(:,:,itr))
     2440             CALL histwrite_phy(o_dtr_insc(itr),d_tr_insc(:,:,itr))
     2441             CALL histwrite_phy(o_dtr_bcscav(itr),d_tr_bcscav(:,:,itr))
     2442             CALL histwrite_phy(o_dtr_evapls(itr),d_tr_evapls(:,:,itr))
     2443             CALL histwrite_phy(o_dtr_ls(itr),d_tr_ls(:,:,itr))
     2444             CALL histwrite_phy(o_dtr_trsp(itr),d_tr_trsp(:,:,itr))
     2445             CALL histwrite_phy(o_dtr_sscav(itr),d_tr_sscav(:,:,itr))
     2446             CALL histwrite_phy(o_dtr_sat(itr),d_tr_sat(:,:,itr))
     2447             CALL histwrite_phy(o_dtr_uscav(itr),d_tr_uscav(:,:,itr))
    24262448            !--2D fields
    2427              CALL histwrite_phy(o_dtr_dry(iq-nqo), flux_tr_dry(:,iq-nqo))
     2449             CALL histwrite_phy(o_dtr_dry(itr), flux_tr_dry(:,itr))
    24282450             zx_tmp_fi2d=0.
    24292451             IF (vars_defined) THEN
    24302452                DO k=1,klev
    2431                    zx_tmp_fi2d(:)=zx_tmp_fi2d(:)+zmasse(:,k)*tr_seri(:,k,iq-nqo)
     2453                   zx_tmp_fi2d(:)=zx_tmp_fi2d(:)+zmasse(:,k)*tr_seri(:,k,itr)
    24322454                ENDDO
    24332455             ENDIF
    2434              CALL histwrite_phy(o_trac_cum(iq-nqo), zx_tmp_fi2d)
     2456             CALL histwrite_phy(o_trac_cum(itr), zx_tmp_fi2d)
    24352457           ENDDO !--iq
    24362458         ENDIF   !--type_trac
    24372459!
    24382460         IF (type_trac == 'co2i') THEN
    2439            DO iq=nqo+1, nqtot
     2461           itr = 0
     2462           DO iq = 1, nqtot
     2463             IF(tracers(iq)%isH2Ofamily) CYCLE
     2464             itr = itr + 1
     2465!            write(*,*) 'phys_output_write_mod 2370: itr=',itr
    24402466             !--3D fields
    2441              CALL histwrite_phy(o_trac(iq-nqo), tr_seri(:,:,iq-nqo))
    2442              CALL histwrite_phy(o_dtr_vdf(iq-nqo),d_tr_cl(:,:,iq-nqo))
    2443              CALL histwrite_phy(o_dtr_the(iq-nqo),d_tr_th(:,:,iq-nqo))
    2444              CALL histwrite_phy(o_dtr_con(iq-nqo),d_tr_cv(:,:,iq-nqo))
     2467             CALL histwrite_phy(o_trac(itr), tr_seri(:,:,itr))
     2468             CALL histwrite_phy(o_dtr_vdf(itr),d_tr_cl(:,:,itr))
     2469             CALL histwrite_phy(o_dtr_the(itr),d_tr_th(:,:,itr))
     2470             CALL histwrite_phy(o_dtr_con(itr),d_tr_cv(:,:,itr))
    24452471             !--2D fields
    24462472             !--CO2 burden
     
    24482474             IF (vars_defined) THEN
    24492475                DO k=1,klev
    2450                    zx_tmp_fi2d(:)=zx_tmp_fi2d(:)+zmasse(:,k)*tr_seri(:,k,iq-nqo)
     2476                   zx_tmp_fi2d(:)=zx_tmp_fi2d(:)+zmasse(:,k)*tr_seri(:,k,itr)
    24512477                ENDDO
    24522478             ENDIF
    2453              CALL histwrite_phy(o_trac_cum(iq-nqo), zx_tmp_fi2d)
     2479             CALL histwrite_phy(o_trac_cum(itr), zx_tmp_fi2d)
    24542480           ENDDO !--iq
    24552481           !--CO2 net fluxes
     
    24632489
    24642490         IF (type_trac == 'inco') THEN
    2465            nqup = nqo+1
    2466            DO iq=nqo+1, nqup
     2491           DO iq = 1, nqtot
     2492             IF(tracers(iq)%isH2Ofamily .OR. .NOT.tracers(iq)%isAdvected) CYCLE
     2493             itr = itr+1
     2494             IF(tracers(iq)%component /= 'co2i') CYCLE
    24672495             !--3D fields
    2468              CALL histwrite_phy(o_trac(iq-nqo), tr_seri(:,:,iq-nqo))
    2469              CALL histwrite_phy(o_dtr_vdf(iq-nqo),d_tr_cl(:,:,iq-nqo))
    2470              CALL histwrite_phy(o_dtr_the(iq-nqo),d_tr_th(:,:,iq-nqo))
    2471              CALL histwrite_phy(o_dtr_con(iq-nqo),d_tr_cv(:,:,iq-nqo))
     2496             CALL histwrite_phy(o_trac   (itr),tr_seri(:,:,itr))
     2497             CALL histwrite_phy(o_dtr_vdf(itr),d_tr_cl(:,:,itr))
     2498             CALL histwrite_phy(o_dtr_the(itr),d_tr_th(:,:,itr))
     2499             CALL histwrite_phy(o_dtr_con(itr),d_tr_cv(:,:,itr))
    24722500             !--2D fields
    24732501             !--CO2 burden
     
    24752503             IF (vars_defined) THEN
    24762504                DO k=1,klev
    2477                    zx_tmp_fi2d(:)=zx_tmp_fi2d(:)+zmasse(:,k)*tr_seri(:,k,iq-nqo)
     2505                   zx_tmp_fi2d(:)=zx_tmp_fi2d(:)+zmasse(:,k)*tr_seri(:,k,itr)
    24782506                ENDDO
    24792507             ENDIF
    2480              CALL histwrite_phy(o_trac_cum(iq-nqo), zx_tmp_fi2d)
     2508             CALL histwrite_phy(o_trac_cum(itr), zx_tmp_fi2d)
    24812509           ENDDO !--iq
    24822510           !--CO2 net fluxes
     
    25042532       end if
    25052533
     2534#ifdef ISO
     2535    do ixt=1,ntraciso
     2536!        write(*,*) 'ixt'
     2537        IF (vars_defined) zx_tmp_fi2d(:) = xtrain_fall(ixt,:) + xtsnow_fall(ixt,:)
     2538        CALL histwrite_phy(o_xtprecip(ixt), zx_tmp_fi2d)
     2539
     2540        IF (vars_defined) zx_tmp_fi2d(:) = xtrain_lsc(ixt,:) + xtsnow_lsc(ixt,:)
     2541        CALL histwrite_phy(o_xtplul(ixt), zx_tmp_fi2d)
     2542
     2543        IF (vars_defined) zx_tmp_fi2d(:) = xtrain_con(ixt,:) + xtsnow_con(ixt,:)
     2544        CALL histwrite_phy(o_xtpluc(ixt), zx_tmp_fi2d)
     2545        CALL histwrite_phy(o_xtevap(ixt),   xtevap(ixt,:))
     2546        CALL histwrite_phy(o_xtovap(ixt),  xt_seri(ixt,:,:))
     2547        CALL histwrite_phy(o_xtoliq(ixt), xtl_seri(ixt,:,:))
     2548
     2549        IF (vars_defined) zx_tmp_fi3d(:,:)=xtl_seri(ixt,:,:)+xts_seri(ixt,:,:)
     2550        CALL histwrite_phy(o_xtcond(ixt), zx_tmp_fi3d)
     2551        CALL histwrite_phy(o_dxtdyn(ixt),   d_xt_dyn(ixt,:,:))
     2552        CALL histwrite_phy(o_dxtldyn(ixt), d_xtl_dyn(ixt,:,:))
     2553
     2554        IF (vars_defined) zx_tmp_fi3d(:,:)=d_xt_con(ixt,:,:)/pdtphys
     2555        CALL histwrite_phy(o_dxtcon(ixt), zx_tmp_fi3d)
     2556
     2557        IF (vars_defined) zx_tmp_fi3d(:,:)=d_xt_lsc(ixt,:,:)/pdtphys
     2558        CALL histwrite_phy(o_dxtlsc(ixt), zx_tmp_fi3d)
     2559
     2560        IF (vars_defined) zx_tmp_fi3d(:,:)=d_xt_eva(ixt,:,:)/pdtphys
     2561        CALL histwrite_phy(o_dxteva(ixt), zx_tmp_fi3d)
     2562
     2563        IF (vars_defined) zx_tmp_fi3d(:,:)=d_xt_vdf(ixt,:,:)/pdtphys
     2564        CALL histwrite_phy(o_dxtvdf(ixt), zx_tmp_fi3d)
     2565
     2566        IF (vars_defined) zx_tmp_fi3d(:,:)=d_xt_ajsb(ixt,:,:)/pdtphys
     2567        CALL histwrite_phy(o_dxtajs(ixt), zx_tmp_fi3d)
     2568
     2569        IF (vars_defined) zx_tmp_fi3d(:,:)=(d_xt_ajs(ixt,:,:)-d_xt_ajsb(ixt,:,:))/pdtphys
     2570        CALL histwrite_phy(o_dxtthe(ixt), zx_tmp_fi3d)
     2571
     2572        IF (ok_qch4) THEN
     2573          IF (vars_defined) zx_tmp_fi3d(:,:)=d_xt_ch4(ixt,:,:)/pdtphys
     2574          CALL histwrite_phy(o_dxtch4(ixt), zx_tmp_fi3d)
     2575        END IF
     2576
     2577        IF (ixt == iso_HTO) THEN
     2578          IF (vars_defined) zx_tmp_fi3d(:,:)=d_xt_prod_nucl(ixt,:,:)/pdtphys
     2579          CALL histwrite_phy(o_dxtprod_nucl(ixt), zx_tmp_fi3d)
     2580
     2581          IF (vars_defined) zx_tmp_fi3d(:,:)=d_xt_cosmo(ixt,:,:)/pdtphys
     2582          CALL histwrite_phy(o_dxtcosmo(ixt), zx_tmp_fi3d)
     2583
     2584          IF (vars_defined) zx_tmp_fi3d(:,:)=d_xt_decroiss(ixt,:,:)/pdtphys
     2585          CALL histwrite_phy(o_dxtdecroiss(ixt), zx_tmp_fi3d)
     2586        END IF
     2587
     2588    !write(*,*) 'phys_output_write_mod 2531'
     2589    enddo !do ixt=1,ntraciso   
     2590#endif
     2591
    25062592       IF (.NOT.vars_defined) THEN
    25072593          !$OMP MASTER
  • LMDZ6/trunk/libf/phylmd/physiq_mod.F90

    r4009 r4056  
    3939    USE ioipsl_getin_p_mod, ONLY : getin_p
    4040    USE indice_sol_mod
    41     USE infotrac_phy, ONLY: nqtot, nbtr, nqo, type_trac, nqCO2
     41    USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, type_trac, nqCO2
     42    USE readTracFiles_mod, ONLY: phases_sep
     43    USE strings_mod,  ONLY: strIdx
    4244    USE iophy
    4345    USE limit_read_mod, ONLY : init_limit_read
     
    146148       !
    147149       d_t_vdf,d_q_vdf,d_u_vdf,d_v_vdf,d_t_diss, &
     150       d_t_vdf_x, d_t_vdf_w, &
     151       d_q_vdf_x, d_q_vdf_w, &
    148152       d_ts, &
    149153       !
     
    218222       zxfluxlat_x, zxfluxlat_w, &
    219223       !
    220        d_t_vdf_x, d_t_vdf_w, &
    221        d_q_vdf_x, d_q_vdf_w, &
    222224       pbl_tke_input, tke_dissip, l_mix, wprime,&
    223225       t_therm, q_therm, u_therm, v_therm, &
     
    356358    LOGICAL, SAVE :: ok_volcan ! pour activer les diagnostics volcaniques
    357359    !$OMP THREADPRIVATE(ok_volcan)
    358     INTEGER, SAVE :: flag_volc_surfstrat ! pour imposer le cool/heat rate à la surf ou dans la strato
     360    INTEGER, SAVE :: flag_volc_surfstrat ! pour imposer le cool/heat rate à la surf/strato
    359361    !$OMP THREADPRIVATE(flag_volc_surfstrat)
    360362    LOGICAL ok_cvl  ! pour activer le nouveau driver pour convection KE
     
    854856    real zqsat(klon,klev)
    855857    !
    856     INTEGER i, k, iq, j, nsrf, ll, l
     858    INTEGER i, k, iq, j, nsrf, ll, l, itr
    857859    !
    858860    REAL t_coup
     
    10351037
    10361038    CHARACTER (LEN=20) :: modname='physiq_mod'
    1037     CHARACTER*80 message, abort_message
     1039    CHARACTER*80 abort_message
    10381040    LOGICAL, SAVE ::  ok_sync, ok_sync_omp
    10391041    !$OMP THREADPRIVATE(ok_sync)
     
    13631365         iflag_phytrac = 1
    13641366       ENDIF
    1365 #endif 
     1367#endif
    13661368       nvm_lmdz = 13
    13671369       CALL getin_p('NVM',nvm_lmdz)
     
    22302232
    22312233    tke0(:,:)=pbl_tke(:,:,is_ave)
    2232     !CR:Nombre de traceurs de l'eau: nqo
    2233     !  IF (nqtot.GE.3) THEN
    2234     IF (nqtot.GE.(nqo+1)) THEN
    2235        !     DO iq = 3, nqtot       
    2236        DO iq = nqo+1, nqtot 
     2234    IF (nqtot > nqo) THEN
     2235       ! water isotopes are not included in tr_seri
     2236       itr = 0
     2237       DO iq = 1, nqtot
     2238         IF(tracers(iq)%isH2Ofamily) CYCLE
     2239         itr = itr+1
    22372240          DO  k = 1, klev
    22382241             DO  i = 1, klon
    2239                 !              tr_seri(i,k,iq-2) = qx(i,k,iq)
    2240                 tr_seri(i,k,iq-nqo) = qx(i,k,iq)
     2242                tr_seri(i,k,itr) = qx(i,k,iq)
    22412243             ENDDO
    22422244          ENDDO
    22432245       ENDDO
    22442246    ELSE
    2245        DO k = 1, klev
    2246           DO i = 1, klon
    2247              tr_seri(i,k,1) = 0.0
    2248           ENDDO
    2249        ENDDO
     2247! DC: make sure the final "1" index was meant for 1st H2O phase (vapor) !!!
     2248!       tr_seri(:,:,strIdx(tracers(:)%name,'H2O'//phases_sep//'g')) = 0.0
     2249       tr_seri(:,:,strIdx(tracers(:)%name,'H2Ov')) = 0.0
    22502250    ENDIF
    22512251!
     
    22542254    IF (debut) THEN
    22552255      WRITE(lunout,*)' WARNING: tr_ancien initialised to tr_seri'
    2256       DO iq = nqo+1, nqtot
    2257            tr_ancien(:,:,iq-nqo)=tr_seri(:,:,iq-nqo)
    2258       ENDDO
     2256       itr = 0
     2257       do iq = 1, nqtot
     2258         IF(tracers(iq)%isH2Ofamily) CYCLE
     2259         itr = itr+1
     2260         tr_ancien(:,:,itr)=tr_seri(:,:,itr)       
     2261       enddo
    22592262    ENDIF
    22602263    !
     
    22872290       d_qs_dyn2d(:)=(zx_tmp_fi2d(:)-prsw_ancien(:))/phys_tstep
    22882291       ! !! RomP >>>   td dyn traceur
    2289        IF (nqtot.GT.nqo) THEN     ! jyg
    2290           DO iq = nqo+1, nqtot      ! jyg
    2291               d_tr_dyn(:,:,iq-nqo)=(tr_seri(:,:,iq-nqo)-tr_ancien(:,:,iq-nqo))/phys_tstep ! jyg
    2292           ENDDO
    2293        ENDIF
     2292       IF (nqtot > nqo) d_tr_dyn(:,:,:)=(tr_seri(:,:,:)-tr_ancien(:,:,:))/phys_tstep
    22942293       ! !! RomP <<<
    22952294    ELSE
     
    23042303       d_qs_dyn2d(:) = 0.0
    23052304       ! !! RomP >>>   td dyn traceur
    2306        IF (nqtot.GT.nqo) THEN                                       ! jyg
    2307           DO iq = nqo+1, nqtot                                      ! jyg
    2308               d_tr_dyn(:,:,iq-nqo)= 0.0                             ! jyg
    2309           ENDDO
    2310        ENDIF
     2305       IF (nqtot > nqo) d_tr_dyn(:,:,:)= 0.0
    23112306       ! !! RomP <<<
    23122307       ancien_ok = .TRUE.
     
    25892584            debut,     lafin, &
    25902585            longitude_deg, latitude_deg, rugoro,  zrmu0,      &
    2591              sollwdown,    cldt,      &
     2586            sollwdown,    cldt,      &
    25922587            rain_fall, snow_fall, solsw,   solswfdiff, sollw,     &
    25932588            gustiness,                                &
     
    28572852         ENDDO
    28582853       ELSE
    2859                t_w(:,:) = t_seri(:,:)
     2854                t_w(:,:) = t_seri(:,:)
    28602855                q_w(:,:) = q_seri(:,:)
    28612856                t_x(:,:) = t_seri(:,:)
     
    30733068
    30743069       DO i = 1, klon
    3075           ema_pcb(i)  = paprs(i,ibas_con(i))
     3070          ! C Risi modif: pour éviter pb de dépassement d'indice dans les cas
     3071          ! où i n'est pas un point convectif et donc ibas_con(i)=0
     3072          ! c'est un pb indépendant des isotopes
     3073          if (ibas_con(i) > 0) then
     3074             ema_pcb(i)  = paprs(i,ibas_con(i))
     3075          else
     3076             ema_pcb(i)  = 0.0
     3077          endif
    30763078       ENDDO
    30773079       DO i = 1, klon
     
    35043506    wprime_ave(:,:)=0.
    35053507
    3506 
    35073508    DO nsrf = 1, nbsrf
    35083509       DO i = 1, klon
     
    35123513       ENDDO
    35133514    ENDDO
    3514 
    35153515
    35163516    CALL  calcratqs(klon,klev,prt_level,lunout,        &
     
    35303530       print *,'itap, ->fisrtilp ',itap
    35313531    ENDIF
     3532    !
    35323533
    35333534    picefra(:,:)=0.
     
    35563557         iflag_ice_thermo)
    35573558    ENDIF
     3559    !
    35583560    WHERE (rain_lsc < 0) rain_lsc = 0.
    35593561    WHERE (snow_lsc < 0) snow_lsc = 0.
     
    42674269 
    42684270#ifndef CPP_XIOS
    4269 
     4271          !--OB 30/05/2016 modified 21/10/2016
     4272          !--here we return swaero_diag and dryaod_diag to FALSE
     4273          !--and histdef will switch it back to TRUE if necessary
     4274          !--this is necessary to get the right swaero at first step
     4275          !--but only in the case of no XIOS as XIOS is covered elsewhere
     4276          IF (debut) swaerofree_diag = .FALSE.
     4277          IF (debut) swaero_diag = .FALSE.
     4278          IF (debut) dryaod_diag = .FALSE.
     4279          !--IM 15/09/2017 here we return ok_4xCO2atm to FALSE
     4280          !--as for swaero_diag, see above
     4281          IF (debut) ok_4xCO2atm = .FALSE.
     4282
     4283          !
    42704284          !IM 2eme calcul radiatif pour le cas perturbe ou au moins un
    42714285          !IM des taux doit etre different du taux actuel
     
    50525066    ENDDO
    50535067    !
    5054     !CR: nb de traceurs eau: nqo
    5055     !  IF (nqtot.GE.3) THEN
    5056     IF (nqtot.GE.(nqo+1)) THEN
    5057        !     DO iq = 3, nqtot
    5058        DO iq = nqo+1, nqtot
     5068    IF (nqtot > nqo+1) THEN
     5069       itr = 0
     5070       DO iq = 1, nqtot
     5071          IF(tracers(iq)%isH2Ofamily) CYCLE
     5072          itr = itr+1
    50595073          DO  k = 1, klev
    50605074             DO  i = 1, klon
    5061                 ! d_qx(i,k,iq) = ( tr_seri(i,k,iq-2) - qx(i,k,iq) ) / phys_tstep
    5062                 d_qx(i,k,iq) = ( tr_seri(i,k,iq-nqo) - qx(i,k,iq) ) / phys_tstep
     5075                d_qx(i,k,iq) = ( tr_seri(i,k,itr) - qx(i,k,iq) ) / phys_tstep
    50635076             ENDDO
    50645077          ENDDO
     
    51015114    CALL water_int(klon,klev,qs_ancien,zmasse,prsw_ancien)
    51025115    ! !! RomP >>>
    5103     !CR: nb de traceurs eau: nqo
    5104     IF (nqtot.GT.nqo) THEN
    5105        DO iq = nqo+1, nqtot
    5106           tr_ancien(:,:,iq-nqo) = tr_seri(:,:,iq-nqo)
    5107        ENDDO
    5108     ENDIF
     5116    IF (nqtot > nqo) tr_ancien(:,:,:) = tr_seri(:,:,:)
    51095117    ! !! RomP <<<
    51105118    !==========================================================================
  • LMDZ6/trunk/libf/phylmd/phytrac_mod.F90

    r4012 r4056  
    5656  SUBROUTINE phytrac_init()
    5757    USE dimphy
    58     USE infotrac_phy, ONLY: nbtr, nqCO2, type_trac
     58    USE infotrac_phy, ONLY: nbtr, type_trac
    5959    USE tracco2i_mod, ONLY: tracco2i_init
    6060    IMPLICIT NONE
     
    145145    USE phys_local_var_mod, ONLY: budg_dep_dry_h2so4, budg_dep_wet_h2so4
    146146    USE phys_local_var_mod, ONLY: budg_dep_dry_part,  budg_dep_wet_part
    147     USE infotrac, ONLY: nbtr_sulgas, id_OCS_strat, id_SO2_strat, id_H2SO4_strat
     147    USE infotrac_phy, ONLY: nbtr_sulgas, id_OCS_strat, id_SO2_strat, id_H2SO4_strat
    148148    USE aerophys
    149149#endif
     
    508508          iflag_con_trac= 1
    509509       CASE('inco')
    510           source(:,1:nqCO2) = 0.                          ! from CO2i   ModThL
    511           source(:,nqCO2+1:nbtr)=init_source(:,:)         ! from INCA   ModThL
    512           aerosol(1:nqCO2) = .FALSE.                      ! from CO2i   ModThL
    513           CALL tracinca_init(aerosol(nqCO2+1:nbtr),lessivage)     ! from INCA   ModThL
    514           pbl_flg(1:nqCO2) = 1              ! From CO2i         ModThL
    515           iflag_the_trac= 1           ! From CO2i
    516           iflag_vdf_trac= 1           ! From CO2i
    517           iflag_con_trac= 1           ! From CO2i
     510          source(:,1:nqCO2) = 0.                          ! from CO2i ModThL
     511          source(:,nqCO2+1:nbtr)=init_source(:,:)         ! from INCA ModThL
     512          aerosol(1:nqCO2) = .FALSE.                      ! from CO2i ModThL
     513          CALL tracinca_init(aerosol(nqCO2+1:nbtr),lessivage)     ! from INCA ModThL
     514          pbl_flg(1:nqCO2) = 1                            ! From CO2i ModThL
     515          iflag_the_trac = 1                              ! From CO2i
     516          iflag_vdf_trac = 1                              ! From CO2i
     517          iflag_con_trac = 1                              ! From CO2i
    518518#ifdef CPP_StratAer
    519519       CASE('coag')
  • LMDZ6/trunk/libf/phylmd/traclmdz_mod.F90

    r4050 r4056  
    6767   
    6868    USE dimphy
    69     USE infotrac_phy, ONLY: nbtr, tracers, niadv, solsym
     69    USE infotrac_phy, ONLY: nbtr
    7070   
    7171    ! Input argument
     
    8989    ! Initialization of the tracers should be done here only for those not found in the restart file.
    9090    USE dimphy
    91     USE infotrac_phy, ONLY: nbtr, nqo, tracers, pbl_flg, conv_flg, niadv
     91    USE infotrac_phy, ONLY: nbtr, nqtot, tracers, pbl_flg, conv_flg
    9292    USE regr_pr_comb_coefoz_m, ONLY: alloc_coefoz
    9393    USE press_coefoz_m, ONLY: press_coefoz
     
    114114       
    115115! Local variables   
    116     INTEGER :: ierr, it, iiq, i, k
     116    INTEGER :: ierr, it, iq, i, k
    117117    REAL, DIMENSION(klon_glo,klev) :: varglo ! variable temporaire sur la grille global   
    118118    REAL, DIMENSION(klev)          :: mintmp, maxtmp
     
    173173    id_rn=0; id_pb=0; id_aga=0; id_be=0; id_o3=0
    174174    id_pcsat=0; id_pcocsat=0; id_pcq=0; id_pcs0=0; id_pcos0=0; id_pcq0=0
    175     DO it=1,nbtr
    176 !!       iiq=niadv(it+2)                                                            ! jyg
    177        iiq=niadv(it+nqo)                                                            ! jyg
    178        SELECT CASE(strLower(tracers(iiq)%name))
     175    it = 0
     176    DO iq = 1, nqtot
     177       IF(.NOT.tracers(iq)%isAdvected .OR. tracers(iq)%isH2Ofamily) CYCLE
     178       it = it+1
     179       SELECT CASE(strLower(tracers(iq)%name))
    179180         CASE("rn");      id_rn     = it ! radon
    180181         CASE("pb");      id_pb     = it ! plomb
     
    189190         CASE("pcq0");    id_pcq0   = it
    190191         CASE DEFAULT
    191            WRITE(lunout,*) 'This is an unknown tracer in LMDZ : ', trim(tracers(iiq)%name)
     192           WRITE(lunout,*) 'This is an unknown tracer in LMDZ : ', trim(tracers(iq)%name)
    192193       END SELECT
    193194
    194        SELECT CASE(strLower(tracers(iiq)%name))
     195       SELECT CASE(strLower(tracers(iq)%name))
    195196         CASE("pb")                        !--- RomP >>> profil initial de PB210
    196197           OPEN(ilesfil2,file='prof.pb210',status='old',iostat=irr2)
     
    259260! Check if all tracers have restart values
    260261! ----------------------------------------------
    261     DO it=1,nbtr
    262 !!       iiq=niadv(it+2)                                                            ! jyg
    263        iiq=niadv(it+nqo)                                                            ! jyg
     262    it = 0
     263    DO iq = 1, nqtot
     264       IF(.NOT.tracers(iq)%isAdvected .OR. tracers(iq)%isH2Ofamily) CYCLE
     265       it = it+1
    264266       ! Test if tracer is zero everywhere.
    265267       ! Done by master process MPI and master thread OpenMP
     
    282284       IF (zero) THEN
    283285          ! The tracer was not found in restart file or it was equal zero everywhere.
    284           WRITE(lunout,*) "The tracer ",trim(tracers(iiq)%name)," will be initialized"
     286          WRITE(lunout,*) "The tracer ",trim(tracers(iq)%name)," will be initialized"
    285287          IF (it==id_pcsat .OR. it==id_pcq .OR. &
    286288               it==id_pcs0 .OR. it==id_pcq0) THEN
  • LMDZ6/trunk/libf/phylmdiso/phyetat0.F90

    r4050 r4056  
    2929       ale_wake, ale_bl_stat, ds_ns, dt_ns, delta_sst, delta_sal, ratqs_inter
    3030!FC
    31   USE geometry_mod, ONLY : longitude_deg, latitude_deg
    32   USE iostart, ONLY : close_startphy, get_field, get_var, open_startphy
    33   USE infotrac_phy, only: nbtr, nqo, type_trac, tracers, niadv, &
    34         itr_indice ! C Risi
    35   USE traclmdz_mod,    ONLY : traclmdz_from_restart
    36   USE carbon_cycle_mod, ONLY : carbon_cycle_tr, carbon_cycle_cpl, co2_send
    37   USE indice_sol_mod, only: nbsrf, is_ter, epsfra, is_lic, is_oce, is_sic
    38   USE ocean_slab_mod, ONLY: nslay, tslab, seaice, tice, ocean_slab_init
     31  USE geometry_mod,     ONLY: longitude_deg, latitude_deg
     32  USE iostart,          ONLY: close_startphy, get_field, get_var, open_startphy
     33  USE infotrac_phy,     ONLY: nqtot, nbtr, type_trac, tracers
     34  USE traclmdz_mod,     ONLY: traclmdz_from_restart
     35  USE carbon_cycle_mod, ONLY: carbon_cycle_tr, carbon_cycle_cpl, co2_send
     36  USE indice_sol_mod,   ONLY: nbsrf, is_ter, epsfra, is_lic, is_oce, is_sic
     37  USE ocean_slab_mod,   ONLY: nslay, tslab, seaice, tice, ocean_slab_init
    3938  USE time_phylmdz_mod, ONLY: init_iteration, pdtphys, itau_phy
    4039#ifdef CPP_XIOS
     
    9291  INTEGER length
    9392  PARAMETER (length=100)
    94   INTEGER it, iiq, isw
     93  INTEGER it, iq, isw
    9594  REAL tab_cntrl(length), tabcntr0(length)
    9695  CHARACTER*7 str7
     
    104103  REAL Rland_ice(niso,klon)
    105104#endif
    106   INTEGER iq
    107105  ! FH1D
    108106  !     real iolat(jjm+1)
     
    471469
    472470  IF (type_trac == 'lmdz') THEN
    473      DO it=1, nbtr                                                                 
    474 !!        iiq=niadv(it+2)                                                           ! jyg
    475 !        iiq=niadv(it+nqo)   C Risi: on efface pour remplacer         
    476         iq=itr_indice(it)                                                   
    477         iiq=niadv(iq)                                                        ! jyg
    478         found=phyetat0_get(1,trs(:,it),"trs_"//TRIM(tracers(iiq)%name), &
    479                                   "Surf trac"//TRIM(tracers(iiq)%name),0.)
    480      ENDDO
     471     it = 0
     472     DO iq = 1, nqtot
     473        IF(.NOT.tracers(iq)%isAdvected .OR. tracers(iq)%isH2Ofamily) CYCLE
     474        it = it+1
     475        found=phyetat0_get(1,trs(:,it),"trs_"//TRIM(tracers(iq)%name), &
     476                                  "Surf trac"//TRIM(tracers(iq)%name),0.)
     477     END DO
    481478     CALL traclmdz_from_restart(trs)
    482479  ENDIF
     
    656653   CALL get_field(name, field, found)
    657654   IF (.NOT. found) THEN
    658      WRITE(lunout,*) "phyetat0: Le champ <",name,"> est absent"
     655     WRITE(lunout,*) "phyetat0: Le champ <",TRIM(name),"> est absent"
    659656     WRITE(lunout,*) "Depart legerement fausse. Mais je continue"
    660657     field(:,:)=default
  • LMDZ6/trunk/libf/phylmdiso/phyredem.F90

    r4046 r4056  
    2323                                wake_delta_pbl_tke, zmax0, f0, sig1, w01,    &
    2424                                wake_deltat, wake_deltaq, wake_s, wake_dens, &
     25                                awake_dens, cv_gen,                          &
    2526                                wake_cstar,                                  &
    2627                                wake_pe, wake_fip, fm_therm, entr_therm,     &
     
    3839  USE iostart, ONLY: open_restartphy, close_restartphy, enddef_restartphy, put_field, put_var
    3940  USE traclmdz_mod, ONLY : traclmdz_to_restart
    40   USE infotrac_phy, ONLY: type_trac, niadv, tracers, nbtr, nqo,itr_indice
     41  USE infotrac_phy, ONLY: type_trac, nqtot, tracers, nbtr, niso, ntraciso
    4142#ifdef ISO
    42   USE infotrac_phy, ONLY: itr_indice,niso,ntraciso
    4343#ifdef ISOVERIF
    4444  USE isotopes_verif_mod
     
    7474  REAL Rland_ice(niso,klon)
    7575#endif
    76   INTEGER iq ! C Risi
    7776
    7877  INTEGER nid, nvarid, idim1, idim2, idim3
     
    8584  CHARACTER (len=2) :: str2
    8685  CHARACTER (len=256) :: nam, lnam
    87   INTEGER           :: it, iiq, pass
     86  INTEGER           :: it, iq, pass
    8887
    8988  !======================================================================
     
    185184    CALL put_field_srf1(pass,"TS","Temperature",ftsol(:,:))
    186185
    187 !!    CALL put_field_srf1(pass,"DELTA_TS","w-x surface temperature difference", delta_tsurf(:,:))
    188     CALL put_field_srf1(pass,"DELTATS","w-x surface temperature difference", delta_tsurf(:,:))
    189 
    190 !    CALL put_field_srf1(pass,"BETA_S","Aridity factor", beta_aridity(:,:))
    191     CALL put_field_srf1(pass,"BETAS","Aridity factor", beta_aridity(:,:))
     186    IF (iflag_pbl>1 .AND. iflag_wake>=1  .AND. iflag_pbl_split >=1) then
     187       CALL put_field_srf1(pass, "DELTATS", &
     188                      "w-x surface temperature difference",  delta_tsurf(:,:))
     189       CALL put_field_srf1(pass, "BETAS", "Aridity factor", beta_aridity(:,:))
     190    end IF
    192191!    End surface variables
    193192
     
    313312    CALL put_field(pass,"WAKE_DENS", "Wake num. /unit area", wake_dens)
    314313
     314    CALL put_field(pass,"AWAKE_DENS", "Active Wake num. /unit area", awake_dens)
     315
     316    CALL put_field(pass,"CV_GEN", "CB birth rate", cv_gen)
     317
    315318    CALL put_field(pass,"WAKE_CSTAR", "WAKE_CSTAR", wake_cstar)
    316319
     
    345348    IF (type_trac == 'lmdz') THEN
    346349       CALL traclmdz_to_restart(trs)
    347        DO it=1, nbtr
    348 !!        iiq=niadv(it+2)                                                           ! jyg
    349           !iiq=niadv(it+nqo) ! C Risi: on efface pour remplacer:
    350           iq=itr_indice(it)                                                           ! jyg
    351           iiq=niadv(iq)                                                           ! jyg
    352           CALL put_field(pass,"trs_"//tracers(iiq)%name, "", trs(:, it))
     350       it = 0
     351       DO iq = 1, nqtot
     352          IF(.NOT.tracers(iq)%isAdvected .OR. tracers(iq)%isH2Ofamily) CYCLE
     353          it = it+1
     354          CALL put_field(pass,"trs_"//tracers(iq)%name, "", trs(:, it))
    353355       END DO
     356    END IF
     357
     358    IF (type_trac == 'co2i' .OR. type_trac == 'inco') THEN
    354359       IF (carbon_cycle_cpl) THEN
    355360          IF (.NOT. ALLOCATED(co2_send)) THEN
     
    417422
    418423  IMPLICIT NONE
    419   INTEGER, INTENT(IN)            :: pass
     424  INTEGER, INTENT(IN)           :: pass
    420425  CHARACTER(LEN=*),  INTENT(IN) :: nam, lnam
    421426  REAL,              INTENT(IN) :: field(:,:)
     
    519524      CHARACTER*7 str7
    520525      CHARACTER*2 str2
    521       CHARACTER*50 striso_sortie
     526      CHARACTER*50 outiso
    522527      integer lnblnk
    523528#ifdef ISOTRAC
     
    564569
    565570     if (ixt.le.niso) then
    566         striso_sortie=striso(ixt)
     571        outiso=striso(ixt)
    567572     else
    568573#ifdef ISOTRAC
    569574        iiso=index_iso(ixt)
    570575        izone=index_zone(ixt)       
    571         striso_sortie=striso(iiso)//strtrac(izone)
     576        outiso=striso(iiso)//strtrac(izone)
    572577#else
    573578        write(*,*) 'phyredem 546: ixt,ntraciso=', ixt,ntraciso
     
    575580#endif
    576581     endif !if (ixt.le.niso) then
    577       write(*,*) 'phyredem 550: ixt,striso_sortie=',ixt,striso_sortie(1:lnblnk(striso_sortie))
     582      write(*,*) 'phyredem 550: ixt,outiso=',ixt,TRIM(outiso)
    578583     
    579584      iso_tmp_lonsrf(:,:)=fxtevap(ixt,:,:)
    580       CALL put_field_srf1(pass,"XTEVAP"//striso_sortie(1:lnblnk(striso_sortie)), &
    581      &           "Evaporation de surface",iso_tmp_lonsrf)
     585      CALL put_field_srf1(pass, "XTEVAP"//TRIM(outiso), "Evaporation de surface",iso_tmp_lonsrf)
    582586
    583587      iso_tmp_lonsrf(:,:)=xtsnow(ixt,:,:)
    584       CALL put_field_srf1(pass,"XTSNOW"//striso_sortie(1:lnblnk(striso_sortie)), &
    585      &           "NEIGE",iso_tmp_lonsrf)       
     588      CALL put_field_srf1(pass, "XTSNOW"//TRIM(outiso), "NEIGE",       iso_tmp_lonsrf)       
    586589
    587590      iso_tmp(:)=xtrain_fall(ixt,:)
    588       CALL put_field(pass,"xtrain_f"//striso_sortie(1:lnblnk(striso_sortie)), &
    589      &   "precipitation liquide",iso_tmp)
     591      CALL put_field(pass,    "xtrain_f"//TRIM(outiso), "precipitation liquide",iso_tmp)
    590592
    591593      iso_tmp(:)=xtsnow_fall(ixt,:)
    592       CALL put_field(pass,"xtsnow_f"//striso_sortie(1:lnblnk(striso_sortie)), &
    593      &    "precipitation solide",iso_tmp)
     594      CALL put_field(pass,    "xtsnow_f"//TRIM(outiso), "precipitation solide",iso_tmp)
    594595
    595596      iso_tmp_lonlev(:,:)=xt_ancien(ixt,:,:)
    596       CALL put_field(pass,"XTANCIEN"//striso_sortie(1:lnblnk(striso_sortie)), &
    597      &   "QANCIEN",iso_tmp_lonlev)
     597      CALL put_field(pass,    "XTANCIEN"//TRIM(outiso), "QANCIEN",     iso_tmp_lonlev)
    598598
    599599      iso_tmp_lonlev(:,:)=xtl_ancien(ixt,:,:)
    600       CALL put_field(pass,"XTLANCIEN"//striso_sortie(1:lnblnk(striso_sortie)), &
    601      &   "QLANCIEN",iso_tmp_lonlev)
     600      CALL put_field(pass,   "XTLANCIEN"//TRIM(outiso), "QLANCIEN",    iso_tmp_lonlev)
    602601
    603602      iso_tmp_lonlev(:,:)=xts_ancien(ixt,:,:)
    604       CALL put_field(pass,"XTSANCIEN"//striso_sortie(1:lnblnk(striso_sortie)), &
    605      &   "QSANCIEN",iso_tmp_lonlev)
     603      CALL put_field(pass,   "XTSANCIEN"//TRIM(outiso), "QSANCIEN",    iso_tmp_lonlev)
    606604
    607605      iso_tmp_lonlev(:,:)=wake_deltaxt(ixt,:,:)
    608       CALL put_field(pass,"WAKE_DELTAXT"//striso_sortie(1:lnblnk(striso_sortie)), &
    609      &   "WAKE_DELTAQ",iso_tmp_lonlev)
     606      CALL put_field(pass,"WAKE_DELTAXT"//TRIM(outiso), "WAKE_DELTAQ", iso_tmp_lonlev)
    610607
    611608      iso_tmp(:)=xtrun_off_lic_0(ixt,:)
    612       CALL put_field(pass,"XTRUNOFFLIC0"//striso_sortie(1:lnblnk(striso_sortie)), &
    613      &   "Runofflic0",iso_tmp)
     609      CALL put_field(pass,"XTRUNOFFLIC0"//TRIM(outiso), "Runofflic0",  iso_tmp)
    614610
    615611      iso_tmp_lonlev(:,:)=wake_deltaxt(ixt,:,:)
    616       CALL put_field(pass,"WAKE_DELTAXT"//striso_sortie(1:lnblnk(striso_sortie)), &
    617      &   "WAKE_DELTAXT",iso_tmp_lonlev)
     612      CALL put_field(pass,"WAKE_DELTAXT"//TRIM(outiso), "WAKE_DELTAXT",iso_tmp_lonlev)
    618613
    619614      ! variables seulement pour niso:
     
    621616
    622617      iso_tmp(:)=xtsol(ixt,:)
    623       CALL put_field(pass,"XTSOL"//striso_sortie(1:lnblnk(striso_sortie)), &
    624      &   "Eau dans le sol (mm)",iso_tmp)
     618      CALL put_field(pass,      "XTSOL"//TRIM(outiso), "Eau dans le sol (mm)",iso_tmp)
    625619
    626620      iso_tmp(:)=Rland_ice(ixt,:)
    627       CALL put_field(pass,"Rland_ice"//striso_sortie(1:lnblnk(striso_sortie)), &
    628      &   "ratio land ice",iso_tmp)
     621      CALL put_field(pass,  "Rland_ice"//TRIM(outiso), "ratio land ice",      iso_tmp)
    629622
    630623      endif ! if (ixt.le.niso) then
  • LMDZ6/trunk/libf/phylmdiso/phys_output_mod.F90

    r4050 r4056  
    3535    USE iophy
    3636    USE dimphy
    37     USE infotrac_phy, ONLY: nqtot, nqo, niadv, tracers, type_trac, maxlen, &
    38         nqtottr,itr_indice ! C Risi
     37    USE infotrac_phy, ONLY: nqtot, tracers, type_trac, niso, ntraciso, maxlen
    3938    USE ioipsl
    4039    USE phys_cal_mod, only : hour, calend
     
    5251#endif
    5352#ifdef ISO
    54     USE infotrac_phy,ONLY: niso, ntraciso
    5553    USE isotopes_mod, ONLY: striso,iso_HTO
    5654#ifdef ISOTRAC
     
    103101    CHARACTER(LEN=4), DIMENSION(nlevSTD)  :: clevSTD
    104102    REAL, DIMENSION(nlevSTD)              :: rlevSTD
    105     INTEGER                               :: nsrf, k, iq, iiq, iff, i, j, ilev
    106     INTEGER                               :: itr ! C Risi
     103    INTEGER                               :: nsrf, k, iq, iff, i, j, ilev, itr, ixt, iiso, izone
    107104    INTEGER                               :: naero
    108105    LOGICAL                               :: ok_veget
     
    124121
    125122#ifdef ISO
    126     INTEGER  :: ixt,iiso,izone
    127123    CHARACTER(LEN=LEN(striso)) :: outiso
    128124    CHARACTER(LEN=20) :: unit
     
    133129!!!!!!!!!! stockage dans une region limitee pour chaque fichier !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    134130    !                 entre [phys_out_lonmin,phys_out_lonmax] et [phys_out_latmin,phys_out_latmax]
    135 
    136     LOGICAL, DIMENSION(nfiles), SAVE  :: phys_out_regfkey       = (/ .FALSE., .FALSE., .FALSE., .FALSE., .FALSE., &
    137                                                                      .FALSE., .FALSE., .FALSE., .FALSE., .FALSE. /)
    138     REAL, DIMENSION(nfiles), SAVE     :: phys_out_lonmin        = (/ -180., -180., -180., -180., -180., &
    139                                                                      -180., -180., -180., -180., -180. /)
    140     REAL, DIMENSION(nfiles), SAVE     :: phys_out_lonmax        = (/  180.,  180.,  180.,  180.,  180., &
    141                                                                       180.,  180.,  180.,  180.,  180. /)
    142     REAL, DIMENSION(nfiles), SAVE     :: phys_out_latmin        = (/  -90.,  -90.,  -90.,  -90.,  -90., &
    143                                                                       -90.,  -90.,  -90.,  -90.,  -90. /)
    144     REAL, DIMENSION(nfiles), SAVE     :: phys_out_latmax        = (/   90.,   90.,   90.,   90.,   90., &
    145                                                                        90.,   90.,   90.,   90.,   90. /)
     131    LOGICAL, DIMENSION(nfiles), SAVE :: &
     132      phys_out_regfkey = [.FALSE., .FALSE., .FALSE., .FALSE., .FALSE., .FALSE., .FALSE., .FALSE., .FALSE., .FALSE.]
     133    REAL,    DIMENSION(nfiles), SAVE :: &
     134      phys_out_lonmin  = [  -180.,   -180.,   -180.,   -180.,   -180.,   -180.,   -180.,   -180.,   -180.,   -180.], &
     135      phys_out_lonmax  = [   180.,    180.,    180.,    180.,    180.,    180.,    180.,    180.,    180.,    180.], &
     136      phys_out_latmin  = [   -90.,    -90.,    -90.,    -90.,    -90.,    -90.,    -90.,    -90.,    -90.,    -90.], &
     137      phys_out_latmax  = [    90.,     90.,     90.,     90.,     90.,     90.,     90.,     90.,     90.,     90.]
    146138    REAL, DIMENSION(klev,2) :: Ahyb_bounds, Bhyb_bounds
    147139    REAL, DIMENSION(klev+1)   :: lev_index
     
    401393    CALL wxios_add_vaxis("bnds", 2, (/1.,2./))
    402394
    403      CALL wxios_add_vaxis("Alt", &
     395    CALL wxios_add_vaxis("Alt", &
    404396            levmax(iff) - levmin(iff) + 1, pseudoalt)
    405397
    406     IF (NSW.EQ.6) THEN
    407 !
    408 !wl1_sun: minimum bound of wavelength (in um)
    409 !
    410       wl1_sun(1)=0.180
    411       wl1_sun(2)=0.250
    412       wl1_sun(3)=0.440
    413       wl1_sun(4)=0.690
    414       wl1_sun(5)=1.190
    415       wl1_sun(6)=2.380
    416 !
    417 !wl2_sun: maximum bound of wavelength (in um)
    418 !
    419       wl2_sun(1)=0.250
    420       wl2_sun(2)=0.440
    421       wl2_sun(3)=0.690
    422       wl2_sun(4)=1.190
    423       wl2_sun(5)=2.380
    424       wl2_sun(6)=4.000
    425 !
    426     ELSE IF(NSW.EQ.2) THEN
    427 !
    428 !wl1_sun: minimum bound of wavelength (in um)
    429 !
    430       wl1_sun(1)=0.250
    431       wl1_sun(2)=0.690
    432 !
    433 !wl2_sun: maximum bound of wavelength (in um)
    434 !
    435       wl2_sun(1)=0.690
    436       wl2_sun(2)=4.000
    437     ENDIF
     398    ! wl1_sun/wl2_sun: minimum/maximum bound of wavelength (in um)
     399    SELECT CASE(NSW)
     400      CASE(6)
     401        wl1_sun(1:6) = [0.180, 0.250, 0.440, 0.690, 1.190, 2.380]
     402        wl2_sun(1:6) = [0.250, 0.440, 0.690, 1.190, 2.380, 4.000]
     403      CASE(2)
     404        wl1_sun(1:2) = [0.250, 0.690]
     405        wl2_sun(1:2) = [0.690, 4.000]
     406    END SELECT
    438407
    439408    DO ISW=1, NSW
     
    533502     ENDIF ! clef_files
    534503
    535         write(lunout,*) 'phys_output_mid 496: nqtottr=',nqtottr
    536         write(lunout,*) 'itr_indice=',itr_indice
    537 !       IF (nqtot>=nqo+1) THEN
    538 !
    539             !DO iq=nqo+1,nqtot
    540             ! C Risi: on modifie la boucle
    541           DO itr=1,nqtottr ! C Risi
    542             iq=itr_indice(itr)  ! C Risi
    543             write(*,*) 'phys_output_mid 503: itr=',itr
    544  
    545             iiq=niadv(iq)
    546             dn = 'd'//TRIM(tracers(iiq)%name)//'_'
     504          itr = 0
     505          DO iq = 1, nqtot
     506            IF(.NOT.tracers(iq)%isAdvected .OR. tracers(iq)%isH2Ofamily) CYCLE
     507            itr = itr + 1
     508            dn = 'd'//TRIM(tracers(iq)%name)//'_'
    547509
    548510            flag = [1, 5, 5, 5, 10, 10, 11, 11, 11, 11]
    549             lnam = 'Tracer '//TRIM(tracers(iiq)%longName)
    550             tnam = TRIM(tracers(iiq)%name); o_trac          (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     511            lnam = 'Tracer '//TRIM(tracers(iq)%longName)
     512            tnam = TRIM(tracers(iq)%name); o_trac          (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    551513
    552514            flag = [4, 7, 7, 7, 10, 10, 11, 11, 11, 11]
    553             lnam = 'Tendance tracer '//TRIM(tracers(iiq)%longName)
     515            lnam = 'Tendance tracer '//TRIM(tracers(iq)%longName)
    554516            tnam = TRIM(dn)//'vdf';         o_dtr_vdf       (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    555517
     
    570532            tnam = TRIM(dn)//'uscav';       o_dtr_uscav     (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    571533
    572             lnam = 'tracer tendency dry deposition'//TRIM(tracers(iiq)%longName)
     534            lnam = 'tracer tendency dry deposition'//TRIM(tracers(iq)%longName)
    573535            tnam = 'cum'//TRIM(dn)//'dry';  o_dtr_dry       (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    574536
    575537            flag = [1, 4, 10, 10, 10, 10, 11, 11, 11, 11]
    576             lnam = 'Cumulated tracer '//TRIM(tracers(iiq)%longName)
    577             tnam = 'cum'//TRIM(tracers(iiq)%name); o_trac_cum(itr)= ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     538            lnam = 'Cumulated tracer '//TRIM(tracers(iq)%longName)
     539            tnam = 'cum'//TRIM(tracers(iq)%name); o_trac_cum(itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    578540          ENDDO
    579541
    580542   ENDDO !  iff
    581543
    582         write(*,*) 'phys_output_mid 589'
    583544#ifdef ISO
     545    write(*,*) 'phys_output_mid 589'
    584546    do ixt=1,ntraciso
    585       if (ixt.le.niso) then
     547      if (ixt <= niso) then
    586548        outiso=striso(ixt)
    587549      else
     
    630592      END IF
    631593    enddo !do ixt=1,niso
    632 #endif
    633         write(*,*) 'phys_output_mid 596'
     594    write(*,*) 'phys_output_mid 596'
     595#endif
    634596
    635597
  • LMDZ6/trunk/libf/phylmdiso/physiq_mod.F90

    r4050 r4056  
    3939    USE ioipsl_getin_p_mod, ONLY : getin_p
    4040    USE indice_sol_mod
    41     USE infotrac_phy, ONLY: nqtot, nbtr, nqo, type_trac,ok_isotopes, &
    42         nqtottr,itr_indice ! C Risi
    43 
     41    USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, type_trac, nqCO2, ok_isotopes
     42    USE readTracFiles_mod, ONLY: phases_sep
     43    USE strings_mod,  ONLY: strIdx
    4444    USE iophy
    4545    USE limit_read_mod, ONLY : init_limit_read
     
    6161    USE phys_output_mod
    6262    USE phys_output_ctrlout_mod
    63     USE print_control_mod, ONLY: mydebug=>debug , lunout, prt_level
     63    USE print_control_mod, ONLY: mydebug=>debug , lunout, prt_level, &
     64         alert_first_call, call_alert, prt_alerte
    6465    USE readaerosol_mod, ONLY : init_aero_fromfile
    6566    USE readaerosolstrato_m, ONLY : init_readaerosolstrato
     
    123124#ifdef ISO
    124125    USE infotrac_phy, ONLY:  &
    125         iqiso,iso_indnum,tracers,ok_isotrac, &
    126         niso,ntraciso,nqtottr,itr_indice ! ajout C Risi pour isos
     126        iqiso,iso_indnum,ok_isotrac,niso, ntraciso
    127127     USE isotopes_mod, ONLY: iso_eau,iso_HDO,iso_O18,iso_O17,iso_HTO, &
    128128        & bidouille_anti_divergence,ok_bidouille_wake, &
     
    188188       !
    189189       d_t_vdf,d_q_vdf,d_u_vdf,d_v_vdf,d_t_diss, &
    190        d_t_vdf_w,d_q_vdf_w, &
    191        d_t_vdf_x,d_q_vdf_x, &
     190       d_t_vdf_x, d_t_vdf_w, &
     191       d_q_vdf_x, d_q_vdf_w, &
    192192       d_ts, &
    193193       !
     
    262262       zxfluxlat_x, zxfluxlat_w, &
    263263       !
    264        d_t_vdf_x, d_t_vdf_w, &
    265        d_q_vdf_x, d_q_vdf_w, &
    266264       pbl_tke_input, tke_dissip, l_mix, wprime,&
    267265       t_therm, q_therm, u_therm, v_therm, &
     
    939937    real zqsat(klon,klev)
    940938    !
    941     INTEGER i, k, iq, j, nsrf, ll, l
    942     INTEGER itr ! C Risi
     939    INTEGER i, k, iq, j, nsrf, ll, l, itr
    943940#ifdef ISO
    944941    real zxt_apres(ntraciso,klon)
     
    11331130!JLD    REAL zstophy, zout
    11341131
    1135     CHARACTER*20 modname
     1132    CHARACTER (LEN=20) :: modname='physiq_mod'
    11361133    CHARACTER*80 abort_message
    11371134    LOGICAL, SAVE ::  ok_sync, ok_sync_omp
     
    13061303    pi = 4. * ATAN(1.)
    13071304
     1305    ! set-up call to alerte function
     1306    call_alert = (alert_first_call .AND. is_master)
     1307   
    13081308    ! Ehouarn: set value of jjmp1 since it is no longer a "fixed parameter"
    13091309    jjmp1=nbp_lat
     
    14241424    forall (k=1: nbp_lev) zmasse(:, k) = (paprs(:, k)-paprs(:, k+1)) / rg
    14251425
    1426     modname = 'physiq'
    14271426
    14281427    IF (debut) THEN
     
    18531852
    18541853       CALL iniradia(klon,klev,paprs(1,1:klev+1))
    1855 
    1856        ! Initialisation des champs dans phytrac* qui sont utilisés par phys_output_write*
     1854       !
     1855!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     1856       ! Initialisation des champs dans phytrac* qui sont utilises par phys_output_write*
     1857       !
     1858!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     1859
    18571860#ifdef CPP_Dust
    18581861       ! Quand on utilise SPLA, on force iflag_phytrac=1
     
    18991902            ENDDO
    19001903          ENDDO
    1901         ELSE
     1904       ELSE
    19021905          pbl_tke(:,:,is_ave) = 0. !ym missing init : maybe must be initialized in the same way that for klon_glo==1 ??
    19031906!>jyg
     
    19491952          CALL abort_physic(modname,abort_message,1)
    19501953       ENDIF
     1954
     1955!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     1956       ! Initialisation pour la convection de K.E. et pour les poches froides
     1957       !
     1958!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     1959
    19511960       WRITE(lunout,*)"Clef pour la convection, iflag_con=", iflag_con
    1952        WRITE(lunout,*)"Clef pour le driver de la convection, ok_cvl=", &
    1953             ok_cvl
     1961       WRITE(lunout,*)"Clef pour le driver de la convection, ok_cvl=", ok_cvl
    19541962       !
    19551963       !KE43
     
    20042012             d_deltaxt_ajs_cv(:,:,:) = 0.
    20052013#endif
    2006           ENDIF
     2014          ENDIF  !  (iflag_wake>=1)
    20072015
    20082016          !        do i = 1,klon
     
    20152023       !   ALLOCATE(lonGCM(0), latGCM(0))
    20162024       !   ALLOCATE(iGCM(0), jGCM(0))
    2017        ENDIF
    2018 
     2025       ENDIF  !  (iflag_con.GE.3)
     2026       !
    20192027       DO i=1,klon
    20202028          rugoro(i) = f_rugoro * MAX(1.0e-05, zstd(i)*zsig(i)/2.0)
     
    20852093       !$OMP BARRIER
    20862094       missing_val=missing_val_omp
     2095       !
     2096       ! Now we activate some double radiation call flags only if some
     2097       ! diagnostics are requested, otherwise there is no point in doing this
     2098       IF (is_master) THEN
     2099         !--setting up swaero_diag to TRUE in XIOS case
     2100         IF (xios_field_is_active("topswad").OR.xios_field_is_active("topswad0").OR. &
     2101            xios_field_is_active("solswad").OR.xios_field_is_active("solswad0").OR. &
     2102            xios_field_is_active("topswai").OR.xios_field_is_active("solswai").OR.  &
     2103              (iflag_rrtm==1.AND.(xios_field_is_active("toplwad").OR.xios_field_is_active("toplwad0").OR. &
     2104                                  xios_field_is_active("sollwad").OR.xios_field_is_active("sollwad0"))))  &
     2105            !!!--for now these fields are not in the XML files so they are omitted
     2106            !!!  xios_field_is_active("toplwai").OR.xios_field_is_active("sollwai") !))) &
     2107            swaero_diag=.TRUE.
     2108 
     2109         !--setting up swaerofree_diag to TRUE in XIOS case
     2110         IF (xios_field_is_active("SWdnSFCcleanclr").OR.xios_field_is_active("SWupSFCcleanclr").OR. &
     2111            xios_field_is_active("SWupTOAcleanclr").OR.xios_field_is_active("rsucsaf").OR.   &
     2112            xios_field_is_active("rsdcsaf") .OR. xios_field_is_active("LWdnSFCcleanclr").OR. &
     2113            xios_field_is_active("LWupTOAcleanclr")) &
     2114            swaerofree_diag=.TRUE.
     2115 
     2116         !--setting up dryaod_diag to TRUE in XIOS case
     2117         DO naero = 1, naero_tot-1
     2118          IF (xios_field_is_active("dryod550_"//name_aero_tau(naero))) dryaod_diag=.TRUE.
     2119         ENDDO
     2120         !
     2121         !--setting up ok_4xCO2atm to TRUE in XIOS case
     2122         IF (xios_field_is_active("rsut4co2").OR.xios_field_is_active("rlut4co2").OR. &
     2123            xios_field_is_active("rsutcs4co2").OR.xios_field_is_active("rlutcs4co2").OR. &
     2124            xios_field_is_active("rsu4co2").OR.xios_field_is_active("rsucs4co2").OR. &
     2125            xios_field_is_active("rsd4co2").OR.xios_field_is_active("rsdcs4co2").OR. &
     2126            xios_field_is_active("rlu4co2").OR.xios_field_is_active("rlucs4co2").OR. &
     2127            xios_field_is_active("rld4co2").OR.xios_field_is_active("rldcs4co2")) &
     2128            ok_4xCO2atm=.TRUE.
     2129       ENDIF
     2130       !$OMP BARRIER
     2131       CALL bcast(swaero_diag)
     2132       CALL bcast(swaerofree_diag)
     2133       CALL bcast(dryaod_diag)
     2134       CALL bcast(ok_4xCO2atm)
    20872135#endif
    2088 
    2089 
     2136       !
    20902137       CALL printflag( tabcntr0,radpas,ok_journe, &
    20912138            ok_instan, ok_region )
    20922139       !
    20932140       !
    2094        !
    20952141       ! Prescrire l'ozone dans l'atmosphere
    2096        !
    20972142       !
    20982143       !c         DO i = 1, klon
     
    21502195#endif
    21512196       ENDIF
     2197       !
    21522198       IF (type_trac == 'repr') THEN
    21532199#ifdef REPROBUS
     
    21982244          SFRWL(6)=3.02191470E-02
    21992245       END SELECT
    2200 
    2201 
    22022246       !albedo SB <<<
    22032247
     
    23312375      ! RomP <<<
    23322376    ENDIF
    2333 
    23342377    !
    23352378    ! Ne pas affecter les valeurs entrees de u, v, h, et q
     
    24082451
    24092452    tke0(:,:)=pbl_tke(:,:,is_ave)
    2410     !C Risi:Nombre de traceurs de l'eau: nqo
    2411     !  IF (nqtot.GE.3) THEN
    2412     IF (nqtot.GE.(nqo+1)) THEN
    2413        !     DO iq = 3, nqtot       
    2414 !       DO iq = nqo+1, nqtot 
    2415        ! CR: on modifie directement le code ici.
    2416        ! les isotopes ne sont pas dispatchés dans tr_seri, il faut les enlever.
    2417        ! on a prévu pour ça un tableau d'indice dans infotrac
    2418 #ifdef ISOVERIF
    2419        write(*,*) 'physiq 1971: nqtottr=',nqtottr
    2420 #endif
    2421        do itr=1,nqtottr
    2422          iq=itr_indice(itr)
     2453    IF (nqtot > nqo) THEN
     2454       ! water isotopes are not included in tr_seri
     2455       itr = 0
     2456       DO iq = 1, nqtot
     2457         IF(tracers(iq)%isH2Ofamily) CYCLE
     2458         itr = itr+1
    24232459!#ifdef ISOVERIF
    24242460!         write(*,*) 'physiq 1973: itr,iq=',itr,iq
     
    24272463         DO  k = 1, klev
    24282464             DO  i = 1, klon
    2429                 tr_seri(i,k,itr) = qx(i,k,iq) ! modif C Risi
     2465                tr_seri(i,k,itr) = qx(i,k,iq)
    24302466             ENDDO
    2431           ENDDO !DO  k = 1, klev
    2432           !write(*,*) 'physiq 1980'
    2433        enddo !do itr=1,nqtottr
    2434 
    2435     ELSE !IF (nqtot.GE.(nqo+1)) THEN
    2436        DO k = 1, klev
    2437           DO i = 1, klon
    2438              tr_seri(i,k,1) = 0.0
    24392467          ENDDO
    24402468       ENDDO
    2441     ENDIF !IF (nqtot.GE.(nqo+1)) THEN
     2469    ELSE
     2470! DC: make sure the final "1" index was meant for 1st H2O phase (vapor) !!!
     2471!       tr_seri(:,:,strIdx(tracers(:)%name,'H2O'//phases_sep//'g')) = 0.0
     2472       tr_seri(:,:,strIdx(tracers(:)%name,'H2Ov')) = 0.0
     2473    ENDIF
    24422474!
    24432475! Temporary solutions adressing ticket #104 and the non initialisation of tr_ancien
     
    24452477    IF (debut) THEN
    24462478      WRITE(lunout,*)' WARNING: tr_ancien initialised to tr_seri'
    2447 !      DO iq = nqo+1, nqtot
    2448 !           tr_ancien(:,:,iq-nqo)=tr_seri(:,:,iq-nqo)
    2449 !      ENDDO
    2450        ! modif CRisi:
    2451        do itr=1,nqtottr
     2479       itr = 0
     2480       do iq = 1, nqtot
     2481         IF(tracers(iq)%isH2Ofamily) CYCLE
     2482         itr = itr+1
    24522483         tr_ancien(:,:,itr)=tr_seri(:,:,itr)       
    24532484       enddo
     
    25192550       d_qs_dyn2d(:)=(zx_tmp_fi2d(:)-prsw_ancien(:))/phys_tstep
    25202551       ! !! RomP >>>   td dyn traceur
    2521        IF (nqtot.GT.nqo) THEN     ! jyg
    2522 !          DO iq = nqo+1, nqtot      ! jyg
    2523           DO itr=1,nqtottr      ! C Risi modif directe
    2524               d_tr_dyn(:,:,itr)=(tr_seri(:,:,itr)-tr_ancien(:,:,itr))/phys_tstep ! jyg
    2525           ENDDO
    2526        ENDIF
     2552       IF (nqtot > nqo) d_tr_dyn(:,:,:)=(tr_seri(:,:,:)-tr_ancien(:,:,:))/phys_tstep
    25272553       ! !! RomP <<<
    25282554
     
    26272653
    26282654       ! !! RomP >>>   td dyn traceur
    2629        IF (nqtot.GT.nqo) THEN                                       ! jyg
    2630 !          DO iq = nqo+1, nqtot                                      ! jyg
    2631 !              d_tr_dyn(:,:,iq-nqo)= 0.0                             ! jyg
    2632 ! Modif C Risi:
    2633           DO itr=1,nqtottr
    2634                 d_tr_dyn(:,:,itr)= 0.0
    2635           ENDDO
    2636        ENDIF
     2655       IF (nqtot > nqo) d_tr_dyn(:,:,:)= 0.0
    26372656       ! !! RomP <<<
    26382657       ancien_ok = .TRUE.
     
    33633382            ENDDO
    33643383         ENDDO
    3365        ELSE !IF (iflag_wake>=1) THEN
     3384       ELSE
    33663385                t_w(:,:) = t_seri(:,:)
    33673386                q_w(:,:) = q_seri(:,:)
     
    37523771          ! où i n'est pas un point convectif et donc ibas_con(i)=0
    37533772          ! c'est un pb indépendant des isotopes
    3754           if (ibas_con(i).gt.0) then
    3755             ema_pcb(i)  = paprs(i,ibas_con(i))
    3756           else ! if (ibas_con(i).gt.0) then
    3757               ema_pcb(i)  = 0.0
    3758           endif ! if (ibas_con(i).gt.0) then
    3759 
     3773          if (ibas_con(i) > 0) then
     3774             ema_pcb(i)  = paprs(i,ibas_con(i))
     3775          else
     3776             ema_pcb(i)  = 0.0
     3777          endif
    37603778       ENDDO
    37613779       DO i = 1, klon
     
    44844502    ENDDO
    44854503
    4486    CALL  calcratqs(klon,klev,prt_level,lunout,        &
     4504    CALL  calcratqs(klon,klev,prt_level,lunout,        &
    44874505         iflag_ratqs,iflag_con,iflag_cld_th,pdtphys,  &
    44884506         ratqsbas,ratqshaut,ratqsp0, ratqsdp, &
     
    44924510         pbl_tke(:,:,is_ave),tke_dissip_ave,l_mix_ave,wprime_ave,t2m,q2m,fm_therm, &
    44934511         ratqs,ratqsc,ratqs_inter)
    4494 
    44954512
    44964513    !
     
    56085625                     ZLWFT0_i, ZFLDN0, ZFLUP0, &
    56095626                     ZSWFT0_i, ZFSDN0, ZFSUP0)
    5610           endif !ok_4xCO2atm
     5627          ENDIF !ok_4xCO2atm
    56115628       ENDIF ! aerosol_couple
    56125629       itaprad = 0
     
    64856502#endif
    64866503! #ifdef ISO
    6487     !
    6488     !CR: nb de traceurs eau: nqo
    6489     !  IF (nqtot.GE.3) THEN
    6490     IF (nqtot.GE.(nqo+1)) THEN
    6491        !     DO iq = 3, nqtot
    6492 !       DO iq = nqo+1, nqtot ! modif C Risi
    6493         do itr=1,nqtottr
    6494          iq=itr_indice(itr)
    6495           DO  k = 1, klev
    6496              DO  i = 1, klon
    6497                 ! d_qx(i,k,iq) = ( tr_seri(i,k,iq-2) - qx(i,k,iq) ) / phys_tstep
    6498                 d_qx(i,k,iq) = ( tr_seri(i,k,iq-nqo) - qx(i,k,iq) ) / phys_tstep
    6499              ENDDO
     6504    ! DC: All iterations are cycled if nqtot==nqo, so no nqtot>nqo condition required
     6505    itr = 0
     6506    DO iq = 1, nqtot
     6507       IF(tracers(iq)%isH2Ofamily) CYCLE
     6508       itr = itr+1
     6509       DO  k = 1, klev
     6510          DO  i = 1, klon
     6511             d_qx(i,k,iq) = ( tr_seri(i,k,itr) - qx(i,k,iq) ) / phys_tstep
    65006512          ENDDO
    6501        ENDDO ! !do itr=1,nqtottr
    6502     ENDIF
     6513       ENDDO
     6514    ENDDO
    65036515    !
    65046516    !IM rajout diagnostiques bilan KP pour analyse MJO par Jun-Ichi Yano
     
    65586570    CALL water_int(klon,klev,qs_ancien,zmasse,prsw_ancien)
    65596571    ! !! RomP >>>
    6560     !CR: nb de traceurs eau: nqo
    6561     IF (nqtot.GT.nqo) THEN
    6562        ! DO iq = nqo+1, nqtot ! modif C Risi
    6563        do itr=1,nqtottr
    6564           tr_ancien(:,:,itr) = tr_seri(:,:,itr)
    6565        ENDDO
    6566     ENDIF
     6572    IF (nqtot > nqo) tr_ancien(:,:,:) = tr_seri(:,:,:)
    65676573    ! !! RomP <<<
    65686574    !==========================================================================
     
    67956801! ISO
    67966802
     6803    ! Disabling calls to the prt_alerte function
     6804    alert_first_call = .FALSE.
     6805   
    67976806    IF (lafin) THEN
    67986807       itau_phy = itau_phy + itap
Note: See TracChangeset for help on using the changeset viewer.