Index: trunk/LMDZ.MARS/libf/phymars/newstart.F
===================================================================
--- trunk/LMDZ.MARS/libf/dyn3d/newstart.F	(revision 1047)
+++ trunk/LMDZ.MARS/libf/phymars/newstart.F	(revision 1130)
@@ -17,9 +17,15 @@
 ! to use  'getin'
       use ioipsl_getincom, only: getin 
-      use infotrac, only: iniadvtrac, nqtot, tnom
-      use tracer_mod, only: noms, igcm_h2o_vap, igcm_h2o_ice
+      use infotrac, only: iniadvtrac, nqtot, tname
+      use tracer_mod, only: noms, igcm_dust_number, igcm_dust_mass,
+     &                      igcm_ccn_number, igcm_ccn_mass,
+     &                      igcm_h2o_vap, igcm_h2o_ice
       use surfdat_h, only: phisfi, z0, zmea, zstd, zsig, zgam, zthe,
      &                     albedodat, z0_default
       use comsoil_h, only: inertiedat, layer, mlayer, nsoilmx
+      use control_mod, only: day_step, iphysiq, anneeref
+      use phyredem, only: physdem0, physdem1
+      use iostart, only: open_startphy
+      use comgeomphy, only: initcomgeomphy
       implicit none
 
@@ -36,10 +42,10 @@
 #include "comvert.h"
 #include "comgeom2.h"
-#include "control.h"
+!#include "control.h"
 #include "logic.h"
 #include "description.h"
 #include "ener.h"
 #include "temps.h"
-#include "lmdstd.h"
+!#include "lmdstd.h"
 #include "comdissnew.h"
 #include "clesph0.h"
@@ -142,5 +148,5 @@
 c variables diverses
 c-------------------
-      real choix_1
+      real choix_1 ! ==0 : read start_archive file ; ==1: read start files
       character*80      fichnom
       integer Lmodif,iq
@@ -183,4 +189,8 @@
       preff  = 610.    ! for Mars, instead of 101325. (Earth)
       pa= 20           ! for Mars, instead of 500 (Earth)
+
+! initialize "serial/parallel" related stuff
+      CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
+      call initcomgeomphy
 
 ! Load tracer number and names:
@@ -316,7 +326,12 @@
 c-----------------------------------------------------------------------
       if (choix_1.eq.0) then
+         ! tabfi requires that input file be first opened by open_startphy(fichnom)
+         fichnom = 'start_archive.nc'
+         call open_startphy(fichnom)
          call tabfi (nid,Lmodif,tab0,day_ini,lllm,p_rad,
      .            p_omeg,p_g,p_mugaz,p_daysec,time)
       else if (choix_1.eq.1) then
+         fichnom = 'startfi.nc'
+         call open_startphy(fichnom)
          call tabfi (nid_fi,Lmodif,tab0,day_ini,lllm,p_rad,
      .            p_omeg,p_g,p_mugaz,p_daysec,time)
@@ -461,5 +476,5 @@
         txt=" "
         write(txt,'(a1,i2.2)') 'q',iq
-        if (txt.eq.tnom(iq)) then
+        if (txt.eq.tname(iq)) then
           count=count+1
         endif
@@ -471,7 +486,7 @@
       if (count.eq.nqtot) then
         write(*,*) 'Newstart: updating tracer names'
-        ! copy noms(:) to tnom(:) to have matching tracer names in physics
+        ! copy noms(:) to tname(:) to have matching tracer names in physics
         ! and dynamics
-        tnom(1:nqtot)=noms(1:nqtot)
+        tname(1:nqtot)=noms(1:nqtot)
       endif
 
@@ -497,4 +512,5 @@
      $ tracer'
       write(*,*) 'q=profile    : specify a profile for a tracer'
+      write(*,*) 'freedust     : rescale dust to a true value'
       write(*,*) 'ini_q        : tracers initialization for chemistry
      $ and water vapour'
@@ -723,5 +739,5 @@
           write(*,*) 'Which tracer name do you want to change ?'
           do iq=1,nqtot
-            write(*,'(i3,a3,a20)')iq,' : ',trim(tnom(iq))
+            write(*,'(i3,a3,a20)')iq,' : ',trim(tname(iq))
           enddo
           write(*,'(a35,i3)')
@@ -730,7 +746,7 @@
           read(*,*) iq
           if ((iq.ge.1).and.(iq.le.nqtot)) then
-            write(*,*)'Change tracer name ',trim(tnom(iq)),' to ?'
+            write(*,*)'Change tracer name ',trim(tname(iq)),' to ?'
             read(*,*) txt
-            tnom(iq)=txt
+            tname(iq)=txt
             write(*,*)'Do you want to change another tracer name (y/n)?'
             read(*,'(a)') yes 
@@ -768,5 +784,5 @@
              write(*,*) 'Which tracer do you want to modify ?'
              do iq=1,nqtot
-               write(*,*)iq,' : ',trim(tnom(iq))
+               write(*,*)iq,' : ',trim(tname(iq))
              enddo
              write(*,*) '(choose between 1 and ',nqtot,')'
@@ -777,5 +793,5 @@
                cycle
              endif
-             write(*,*)'mixing ratio of tracer ',trim(tnom(iq)),
+             write(*,*)'mixing ratio of tracer ',trim(tname(iq)),
      &                 ' ? (kg/kg)'
              read(*,*) val
@@ -787,5 +803,5 @@
                ENDDO
              ENDDO
-             write(*,*) 'SURFACE value of tracer ',trim(tnom(iq)),
+             write(*,*) 'SURFACE value of tracer ',trim(tname(iq)),
      &                   ' ? (kg/m2)'
              read(*,*) val
@@ -804,5 +820,5 @@
              write(*,*) 'Which tracer do you want to set?'
              do iq=1,nqtot
-               write(*,*)iq,' : ',trim(tnom(iq))
+               write(*,*)iq,' : ',trim(tname(iq))
              enddo
              write(*,*) '(choose between 1 and ',nqtot,')'
@@ -814,5 +830,5 @@
              endif
              ! look for input file 'profile_tracer'
-             txt="profile_"//trim(tnom(iq))
+             txt="profile_"//trim(tname(iq))
              open(41,file=trim(txt),status='old',form='formatted',
      &            iostat=ierr)
@@ -831,15 +847,45 @@
                    q(:,:,l,iq)=profile(l+1)
                  enddo
-                 write(*,*)'OK, tracer ',trim(tnom(iq)),' initialized ',
-     &                     'using values from file ',trim(txt)
+                 write(*,*)'OK, tracer ',trim(tname(iq)),
+     &               ' initialized ','using values from file ',trim(txt)
                else
                  write(*,*)'problem reading file ',trim(txt),' !'
-                 write(*,*)'No modifications to tracer ',trim(tnom(iq))
+                 write(*,*)'No modifications to tracer ',trim(tname(iq))
                endif
              else
                write(*,*)'Could not find file ',trim(txt),' !'
-               write(*,*)'No modifications to tracer ',trim(tnom(iq))
+               write(*,*)'No modifications to tracer ',trim(tname(iq))
              endif
              
+c       q=profile : initialize tracer with a given profile
+c       --------------------------------------------------
+        else if (trim(modif) .eq. 'freedust') then
+          do l=1,llm
+            do j=1,jjp1
+              do i=1,iip1
+                if (igcm_dust_number .ne. 0) 
+     &          q(i,j,l,igcm_dust_number)=
+     &                q(i,j,l,igcm_dust_number) * 1e-3 ! grosso modo
+                if (igcm_dust_mass .ne. 0) 
+     &          q(i,j,l,igcm_dust_mass)=
+     &                q(i,j,l,igcm_dust_mass)   * 1e-3 ! grosso modo
+                if (igcm_ccn_number .ne. 0) 
+     &          q(i,j,l,igcm_ccn_number)=
+     &                q(i,j,l,igcm_ccn_number) * 1e-3 ! grosso modo
+                if (igcm_ccn_mass .ne. 0) 
+     &          q(i,j,l,igcm_ccn_mass)=
+     &                q(i,j,l,igcm_ccn_mass)   * 1e-3 ! grosso modo
+              end do
+            end do
+          end do
+
+         ! We want to have the very same value at lon -180 and lon 180
+          do l = 1,llm
+             do j = 1,jjp1
+                do iq = 1,nqtot
+                   q(iip1,j,l,iq) = q(1,j,l,iq)
+                end do
+             end do
+          end do
 
 c       ini_q : Initialize tracers for chemistry
