Index: trunk/mesoscale/LMD_MM_MARS/SIMU/runmeso
===================================================================
--- trunk/mesoscale/LMD_MM_MARS/SIMU/runmeso	(revision 75)
+++ trunk/mesoscale/LMD_MM_MARS/SIMU/runmeso	(revision 76)
@@ -164,5 +164,7 @@
       0) tracers='1' ;;
       1) tracers='2' ;;
-     11) tracers='5' ;;
+      2) tracers='1' ;;
+      3) tracers='2' ;;
+     11) tracers='4' ;;
       *) tracers='1' ;;
   esac
Index: trunk/mesoscale/LMD_MM_MARS/SRC/WRFV2/Registry/Registry.EM
===================================================================
--- trunk/mesoscale/LMD_MM_MARS/SRC/WRFV2/Registry/Registry.EM	(revision 75)
+++ trunk/mesoscale/LMD_MM_MARS/SRC/WRFV2/Registry/Registry.EM	(revision 76)
@@ -111,13 +111,9 @@
 ####
 state  real  -         ikjftb  scalar  1  -  -                         -
-state  real  QH2O      ikjftb  scalar  1  -  i01rhusdf=(bdy_interp:dt) "QH2O"       "Water vapor mixing ratio"   "kg kg-1"
-state  real  QH2O_ICE  ikjftb  scalar  1  -  i01rhusdf=(bdy_interp:dt) "QH2O_ICE"   "Water ice mixing ratio"     "kg kg-1"
-state  real  QDUST     ikjftb  scalar  1  -  i01rhusdf=(bdy_interp:dt) "QDUST"      "Dust mixing ratio"          "kg kg-1"
-####
-state  real  Qco2        ikjftb  scalar  1  -  i01rhusdf=(bdy_interp:dt)  "Qco2"         "CO2 mixing ratio"          "kg kg-1"
-#state  real  Qdust_mass  ikjftb  scalar  1  -  i01rhusdf=(bdy_interp:dt)  "Qdust_mass"   "dust_mass mixing ratio"    "kg kg-1"
-state  real  Qdust_number  ikjftb  scalar  1  -  i01rhusdf=(bdy_interp:dt)  "Qdust_number"   "dust_number mixing ratio"    "kg kg-1"
-#state  real  Qh2o_vap  ikjftb  scalar  1  -  i01rhusdf=(bdy_interp:dt)  "Qh2o_vap"   "h2o_vap mixing ratio"    "kg kg-1"
-#state  real  Qh2o_ice  ikjftb  scalar  1  -  i01rhusdf=(bdy_interp:dt)  "Qh2o_ice"   "h2o_ice mixing ratio"    "kg kg-1"
+state  real  qh2o      ikjftb  scalar  1  -  i01rhusdf=(bdy_interp:dt)  "QH2O"          "Water vapor mixing ratio"   "kg kg-1"
+state  real  qh2o_ice  ikjftb  scalar  1  -  i01rhusdf=(bdy_interp:dt)  "QH2O_ICE"      "Water ice mixing ratio"     "kg kg-1"
+state  real  qdust     ikjftb  scalar  1  -  i01rhusdf=(bdy_interp:dt)  "QDUST"         "Dust mixing ratio"          "kg kg-1"
+state  real  qdustn    ikjftb  scalar  1  -  i01rhusdf=(bdy_interp:dt)  "QDUSTN"        "Dust_number mixing ratio"   "kg kg-1"
+state  real  qco2      ikjftb  scalar  1  -  i01rhusdf=(bdy_interp:dt)  "QCO2"          "CO2 mixing ratio"           "kg kg-1"
 ####
 ####
@@ -1322,21 +1318,20 @@
 ##### MARS OPTIONS
 ##
-## CHANGING THE OPTION CHANGE THE NUMBER OF TRACERS WITHOUT ANY NEED TO RECOMPILE ENTIRELY WRF
-## HOWEVER, YOU STILL NEED TO RECOMPILE THE PHYSICS BEFORE CHANGING THE OPTION
-## JUST USE THE COMPILE_ALL SCRIPT FOR A FAST RECOMPILATION 
-## -------
-## ONE REMAINING PROBLEM IS THE FACT THAT YOU NEED TO RECOMPILE
-## ENTIRELY IF YOU DO NOT WANT TO OUTPUT THE TRACERS
-## (FOR EXAMPLE, IF THEY ARE TURNED OFF ...)
-## -------
+## CHANGING THE OPTION CHANGES TRACER REFERENCES WITHOUT ANY NEED TO RECOMPILE ENTIRELY LMD_MM 
+## --> EVEN IF FIELDS ARE SCHEDULED FOR OUTPUTS ABOVE [WITH h], THESE ARE NOT IN wrfout* FILES
+##       UNLESS THE CORRESPONDING mars OPTION IS SELECTED 
+## --> HOWEVER, YOU STILL NEED TO RECOMPILE THE PHYSICS BEFORE CHANGING THE OPTION
+##       AND PROBABLY YOU'LL ALSO HAVE TO CHANGE callphys.def
+## --> IF mars IS CHANGED IN THE NAMELIST, YOU HAVE TO RE-RUN real.exe
 ##
+## IF YOU ADD A mars REFERENCE BELOW, YOU HAVE TO RECOMPILE ENTIRELY THE MODEL
 ##
-package   nowater      mars==0                      -              moist:qv
-package   water        mars==1                      -              moist:qv;scalar:qh2o,qh2o_ice
-package   dust         mars==2                      -              moist:qv;scalar:qdust
-#package   newwater     mars==11                     -              scalar:qco2,qh2o,qh2o_ice
-#package   newwater     mars==11                     -              scalar:qco2,qh2o,qh2o_ice,qdust,qdust_number
-### NOTE: toujours CO2 en dernier 
-package   newwater     mars==11                     -              scalar:qh2o,qh2o_ice,qdust,qdust_number,qco2
+## THE ORDER of TRACERS IN EACH OPTION IS VERY IMPORTANT
+##
+package   default      mars==0                      -              -
+package   water        mars==1                      -              scalar:qh2o,qh2o_ice
+package   dust1        mars==2                      -              scalar:qdust
+package   dust2eq      mars==3                      -              scalar:qdust,qdustn
+package   newwater     mars==11                     -              scalar:qh2o,qh2o_ice,qdust,qdustn
 ##### MARS OPTIONS
 ##### MARS OPTIONS
@@ -1352,5 +1347,5 @@
 package   ncepcloud3    mp_physics==98               -             moist:qv,qc,qr
 package   ncepcloud5    mp_physics==99               -             moist:qv,qc,qr,qi,qs
-package   thompson       mp_physics==8               -             moist:qv,qc,qr,qi,qs,qg;scalar:qni
+package   thompson      mp_physics==8                -             moist:qv,qc,qr,qi,qs,qg;scalar:qni
 
 package   rrtmscheme    ra_lw_physics==1             -             -
Index: trunk/mesoscale/LMD_MM_MARS/SRC/WRFV2/dyn_em/module_initialize_real.F
===================================================================
--- trunk/mesoscale/LMD_MM_MARS/SRC/WRFV2/dyn_em/module_initialize_real.F	(revision 75)
+++ trunk/mesoscale/LMD_MM_MARS/SRC/WRFV2/dyn_em/module_initialize_real.F	(revision 76)
@@ -1259,8 +1259,13 @@
                             its , ite , jts , jte , kts , kte )
 
-                         
-if ( config_flags%mars == 2 ) then
-       print *, '**** ONE DUST BIN ****'
-       print *, '**** I assume this is dustq in met_em ****'
+                        
+!!!!!!****MARS****!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!! ****MARS MARS MARS for order in rank for each option, check in REGISTRY.EM
+!!!!!!       [a little bit too hardcoded here unfortunately... but e.g. P_QH2O must be known]
+!!!!!!       [there is a more flexible option with flags in metgrid.tbl, TBD?]
+!!!!!! NB: real_em.F must also be modified 
+!!!!!! NB2: qvapor is not used to avoid collision with earth-related calculations
+if ( ( config_flags%mars == 2 ) .OR. ( config_flags%mars == 3 ) ) then
+       print *, '**** INTERPOLATE DUSTQ **** RANK 2 in SCALAR'
        CALL vert_interp_old ( grid%em_dustq_gc , grid%em_pd_gc , scalar(:,:,:,2) , grid%em_pb , &
                                     num_metgrid_levels , 'Q' , &
@@ -1271,25 +1276,7 @@
                                     its , ite , jts , jte , kts , kte )
 endif        
-
-if ( (config_flags%mars == 1) .OR. (config_flags%mars == 11) ) then
-!if (size(scalar(0,0,0,:)) > 2) then
-!! autre possibilite: activer les flags dans metgrid.tbl
-!!
-!! pour l'instant les indices sont indiqués en dur en attendant plus souple
-!!
-!!
-
-        print *, '**** WATER CYCLE ON ****' 
-        print *, size(scalar(0,0,0,:)), P_QH2O, P_QH2O_ICE
-
-        
-        !!****MARS: initialization for water cycle
-        !!****MARS:
-        !!****MARS: -- note that -real.F was modified to include GCM QH2O boundary conditions
-        !!****MARS: 		 -qvapor was not used to avoid any terrestrial calculations in WRF unsuitable for Mars
-        !!****MARS:		 -any change and/or modification of variables has to be recorded in the Registry
-        !!****MARS:
-        !CALL vert_interp_old ( grid%em_hv_gc , grid%em_pd_gc , scalar(:,:,:,P_QH2O) , grid%em_pb , &
-        CALL vert_interp_old ( grid%em_hv_gc , grid%em_pd_gc , scalar(:,:,:,2) , grid%em_pb , &
+if ( ( config_flags%mars == 3 ) ) then
+       print *, '**** INTERPOLATE DUSTN **** RANK 3 in SCALAR'
+       CALL vert_interp_old ( grid%em_dustn_gc , grid%em_pd_gc , scalar(:,:,:,3) , grid%em_pb , &
                                     num_metgrid_levels , 'Q' , &
                                     interp_type , lagrange_order , lowest_lev_from_sfc , &
@@ -1298,6 +1285,9 @@
                                     ims , ime , jms , jme , kms , kme , &
                                     its , ite , jts , jte , kts , kte )
-        !CALL vert_interp_old ( grid%em_hi_gc , grid%em_pd_gc , scalar(:,:,:,P_QH2O_ICE) , grid%em_pb , &
-        CALL vert_interp_old ( grid%em_hi_gc , grid%em_pd_gc , scalar(:,:,:,3) , grid%em_pb , &
+endif        
+if ( ( config_flags%mars == 1 ) .OR. ( config_flags%mars == 11 ) ) then
+       print *, '**** INTERPOLATE HV **** RANK 2 in SCALAR'
+       !print *, size(scalar(0,0,0,:)), P_QH2O, P_QH2O_ICE
+       CALL vert_interp_old ( grid%em_hv_gc , grid%em_pd_gc , scalar(:,:,:,2) , grid%em_pb , &
                                     num_metgrid_levels , 'Q' , &
                                     interp_type , lagrange_order , lowest_lev_from_sfc , &
@@ -1306,12 +1296,16 @@
                                     ims , ime , jms , jme , kms , kme , &
                                     its , ite , jts , jte , kts , kte )
-        !!****MARS:
-
+       print *, '**** INTERPOLATE HI **** RANK 3 in SCALAR'
+       CALL vert_interp_old ( grid%em_hi_gc , grid%em_pd_gc , scalar(:,:,:,3) , grid%em_pb , &
+                                    num_metgrid_levels , 'Q' , &
+                                    interp_type , lagrange_order , lowest_lev_from_sfc , &
+                                    zap_close_levels , force_sfc_in_vinterp , &
+                                    ids , ide , jds , jde , kds , kde , &
+                                    ims , ime , jms , jme , kms , kme , &
+                                    its , ite , jts , jte , kts , kte )
 endif
 #ifdef NEWPHYS
-if (config_flags%mars == 11) then
-        print *, '**** DUST var RADIUS ON ****'
-        !print *, size(scalar(0,0,0,:)), P_QDUST, P_Qdust_number
-
+if ( config_flags%mars == 11 ) then
+       print *, '**** INTERPOLATE DUSTQ **** RANK 4 in SCALAR'             
        CALL vert_interp_old ( grid%em_dustq_gc , grid%em_pd_gc , scalar(:,:,:,4) , grid%em_pb , &
                                     num_metgrid_levels , 'Q' , &
@@ -1321,5 +1315,5 @@
                                     ims , ime , jms , jme , kms , kme , &
                                     its , ite , jts , jte , kts , kte )
-
+       print *, '**** INTERPOLATE DUSTQ **** RANK 5 in SCALAR'
        CALL vert_interp_old ( grid%em_dustn_gc , grid%em_pd_gc , scalar(:,:,:,5) , grid%em_pb , &
                                     num_metgrid_levels , 'Q' , &
@@ -1331,4 +1325,5 @@
 endif
 #endif
+!!!!!!****MARS****!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 #if 0
Index: trunk/mesoscale/LMD_MM_MARS/SRC/WRFV2/dyn_em/solve_em.F
===================================================================
--- trunk/mesoscale/LMD_MM_MARS/SRC/WRFV2/dyn_em/solve_em.F	(revision 75)
+++ trunk/mesoscale/LMD_MM_MARS/SRC/WRFV2/dyn_em/solve_em.F	(revision 76)
@@ -2692,8 +2692,13 @@
      IF ( ( config_flags%specified .or. config_flags%nested ) .and. rk_step == 1) THEN
 
-!!!!****MARS MARS MARS: what to do with tracers at the boundaries ???
-IF (  ( (config_flags%mars .eq.  1) .AND. (is .EQ. 2) ) &    !! 1   pass only water vapor
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!****MARS MARS MARS: what to do with tracers at the boundaries ??? !!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!IF (  ( (config_flags%mars .eq.  1) .AND. (is .EQ. 2) ) &    !! 1   pass only water vapor
+IF  ( (  config_flags%mars .eq.  1                    ) &    !! 1   pass water vapor AND ice
  .OR. (  config_flags%mars .eq.  2                    ) &    !! 2   pass the dust tracer
- .OR. ( (config_flags%mars .eq. 11) .AND. (is .EQ. 2) ) &    !! 11  pass only water vapor
+ .OR. (  config_flags%mars .eq.  3                    ) &    !! 3   pass dust Q and N 
+! .OR. ( (config_flags%mars .eq. 11) .AND. (is .EQ. 2) ) &    !! 11  pass only water vapor
+ .OR. (  config_flags%mars .eq. 11                    ) &    !! 11  pass EVERYTHING
  .OR. config_flags%nested ) THEN                             !! *   pass all tracers if nested
          CALL relax_bdy_scalar ( scalar_tend(ims,kms,jms,is),            &
@@ -2752,8 +2757,9 @@
                               k_start    , k_end               )
 
-!!!!****MARS: if parent domain and any other tracer than water vapor, no bdy and simple zero flux bdy condition
-IF (  config_flags%specified  ) THEN
-IF (      ((config_flags%mars .eq. 1 ) .and. (is .ne. 2))  &   
-     .OR. ((config_flags%mars .eq. 11) .and. (is .ne. 2))  ) THEN
+!!!!!****MARS: if parent domain and any other tracer than water vapor, no bdy and simple zero flux bdy condition
+IF ( config_flags%specified ) THEN
+!IF (      ((config_flags%mars .eq. 1 ) .and. (is .ne. 2))  &   
+!     .OR. ((config_flags%mars .eq. 11) .and. (is .ne. 2))  ) THEN
+IF ( config_flags%mars .gt. 50 ) THEN
 
      !!! YOU HAVE TO ADD A CONDITION HERE IF YOU ADD A mars OPTION in REGISTRY  !!!
Index: trunk/mesoscale/LMD_MM_MARS/SRC/WRFV2/main/real_em.F
===================================================================
--- trunk/mesoscale/LMD_MM_MARS/SRC/WRFV2/main/real_em.F	(revision 75)
+++ trunk/mesoscale/LMD_MM_MARS/SRC/WRFV2/main/real_em.F	(revision 76)
@@ -711,4 +711,5 @@
 !!!!!MARS: ... mais il est facile d'en ajouter... ajouter simplement des tableaux type q2bdy3dtemp1 
 IF ( (config_flags%mars .eq. 1) .OR. &
+     (config_flags%mars .eq. 3) .OR. &
      (config_flags%mars .eq. 11) ) THEN
       CALL couple ( grid%em_mu_2 , grid%em_mub , q2bdy3dtemp1 , grid%scalar(:,:,:,3) , 't' , grid%msft , &
@@ -784,4 +785,5 @@
 ENDIF
 IF ( (config_flags%mars .eq. 1) .OR. &
+     (config_flags%mars .eq. 3) .OR. &
      (config_flags%mars .eq. 11) ) THEN
       CALL stuff_bdy     ( q2bdy3dtemp1 , grid%scalar_b(:,:,:,:,3)   , 'T' , ijds , ijde , spec_bdy_width      , &
@@ -860,4 +862,5 @@
 ENDIF
 IF ( (config_flags%mars .eq. 1) .OR. &
+     (config_flags%mars .eq. 3) .OR. &
      (config_flags%mars .eq. 11) ) THEN
       CALL couple ( grid%em_mu_2 , grid%em_mub , q2bdy3dtemp2 , grid%scalar(:,:,:,3) , 't' , grid%msft , &
@@ -937,4 +940,5 @@
 ENDIF
 IF ( (config_flags%mars .eq. 1) .OR. &
+     (config_flags%mars .eq. 3) .OR. &
      (config_flags%mars .eq. 11) ) THEN
       CALL stuff_bdytend ( q2bdy3dtemp2 , q2bdy3dtemp1 , REAL(interval_seconds) ,grid%scalar_bt(:,:,:,:,3) , 'T' , &
@@ -1107,4 +1111,5 @@
 ENDIF
 IF ( (config_flags%mars .eq. 1) .OR. &
+     (config_flags%mars .eq. 3) .OR. &
      (config_flags%mars .eq. 11) ) THEN
         CALL stuff_bdy     ( q2bdy3dtemp1 , grid%scalar_b(:,:,:,:,3)   , 'T', ijds , ijde , spec_bdy_width      , &
Index: trunk/mesoscale/LMD_MM_MARS/SRC/WRFV2/phys/module_lmd_driver.F
===================================================================
--- trunk/mesoscale/LMD_MM_MARS/SRC/WRFV2/phys/module_lmd_driver.F	(revision 75)
+++ trunk/mesoscale/LMD_MM_MARS/SRC/WRFV2/phys/module_lmd_driver.F	(revision 76)
@@ -618,22 +618,44 @@
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!
-#ifdef NEWPHYS
-!!! name of tracers -- see Registry.EM for order and traceur.def for names
+
+SELECT CASE (MARS_MODE) !! ONLY ALLOW FOR MODES DEFINED IN Registry.EM
+   CASE(4-10,12:)      !! -- CHANGE THIS if YOU ADDED CASES in REGISTRY.EM
+   PRINT *, 'NOT SUPPORTED, to be done'
+   STOP
+END SELECT
+!!!!!!!!!!!!!!!!!!! FOR REFERENCE ; FROM REGISTRY.EM
+!package   default      mars==0                      -              -
+!package   water        mars==1                      -              scalar:qh2o,qh2o_ice
+!package   dust1        mars==2                      -              scalar:qdust
+!package   dust2eq      mars==3                      -              scalar:qdust,qdustn
+!package   newwater     mars==11                     -              scalar:qh2o,qh2o_ice,qdust,qdustn
+!!!!!!!!!!!!!!!!!!! FOR REFERENCE
+
+#ifdef NEWPHYS
+!!! name of tracers to mimic entries in tracer.def 
+!!! ----> IT IS IMPORTANT TO KEEP SAME ORDERING AS IN THE REGISTRY !!!!
+!!!                               SAME NAMING   AS IN THE LMD PHYSICS !!!!
 SELECT CASE (MARS_MODE)
-    CASE(0)  !! NO TRACERS (mars=0)
+    CASE(0)  
       wtnom(nq) = 'co2'
     CASE(1)
-      wtnom(1) = 'h2o_vap'  
-      wtnom(2) = 'h2o_ice'
+      wtnom(1)  = 'h2o_vap'     
+      wtnom(2)  = 'h2o_ice'     
     CASE(2)
-      wtnom(1) = 'dust01'      
-    CASE(11) !! newwater mars==11 scalar:qh2o,qh2o_ice,qdust,qdust_number,qco2
-      wtnom(1) = 'h2o_vap'
-      wtnom(2) = 'h2o_ice'
-      wtnom(3) = 'dust_mass'
-      wtnom(4) = 'dust_number'
-      wtnom(nq) = 'co2'
+      wtnom(1)  = 'dust01'      
+    CASE(3)
+      wtnom(1)  = 'dust_mass'
+      wtnom(2)  = 'dust_number'
+    CASE(11) 
+      wtnom(1)  = 'h2o_vap'
+      wtnom(2)  = 'h2o_ice'
+      wtnom(3)  = 'dust_mass'
+      wtnom(4)  = 'dust_number'
 END SELECT
 #endif
+
+
+!!*******************************************!!
+!!*******************************************!!
 
 DO j = jps,jpe
@@ -685,4 +707,7 @@
     water_vapor_prof(:) = 0.
     water_ice_prof(:) = 0.
+    CASE(3:)
+    print *, 'OOOPS... not ready yet.'
+    STOP
 END SELECT
 #endif
@@ -799,20 +824,27 @@
 !-------------------!
 SELECT CASE (MARS_MODE)
-    CASE(0)  !! NO TRACERS (mars=0)
+    CASE(0)  
     qsurf_val(:)=0.
-    CASE(1)  !! WATER CYCLE (mars=1)
-#ifdef NEWPHYS    
+    CASE(1) 
+    qsurf_val(1)=0. 
     qsurf_val(2)=MARS_WICE(i,j)    !! logique avec wtnom(2) = 'h2o_ice' defini ci-dessus
+                                   !! ----- retrocompatible ancienne physique
+                                   !! ----- [H2O ice is tracer nqmx in qsurf in LMD physics]
+    CASE(2)  
+    qsurf_val(1)=10000.            !! infinite amount of dust, basically
+#ifdef NEWPHYS
+    CASE(3)
+    qsurf_val(:)=0.                !!! temporaire, a definir            
+    CASE(11) 
     qsurf_val(1)=0.
+    qsurf_val(2)=MARS_WICE(i,j)    !! logique avec wtnom(2) = 'h2o_ice' defini ci-dessus
+    !!!! petit probleme... alors QSURF sorti dans wrfout n'est pas h2o_ice !
+    qsurf_val(3)=10000.            !! infinite amount of dust, basically
 #else
-    qsurf_val(2)=MARS_WICE(i,j)    !! attention... H2O ice is tracer nqmx in qsurf in LMD physics
-    qsurf_val(1)=0.
-#endif    
-    CASE(2)  !! DUST CYCLE (mars=2)
-    qsurf_val(1)=10000.    !! infinite amount, basically
-#ifdef NEWPHYS
-    CASE(11)
-    qsurf_val(:)=0. !! provisoire        
-#endif
+    CASE(3:)
+    print *, 'OOOPS... not ready yet.'
+    STOP
+#endif
+
 END SELECT
 
@@ -950,4 +982,7 @@
     CASE(2)  !! DUST CYCLE (mars=2)
     pq(subs,:,nq) = water_vapor_prof(:) !! NB: which is 0, actually (see above)
+    CASE(3:)
+    print *, 'OOOPS... not ready yet.'
+    STOP    
 END SELECT
 #endif
@@ -1158,5 +1193,7 @@
         !!! Dust 
         SCALAR(i,kps:kpe,j,2)=SCALAR(i,kps:kpe,j,2)+pdq(subs,kps:kpe,nq)
-!!CASE(11) !!!
+CASE(3:)
+        print *, 'OOOPS... not ready yet.'
+        STOP    
 END SELECT
 #endif
