Index: /trunk/LMDZ.COMMON/libf/evolution/pem.F90
===================================================================
--- /trunk/LMDZ.COMMON/libf/evolution/pem.F90	(revision 3128)
+++ /trunk/LMDZ.COMMON/libf/evolution/pem.F90	(revision 3129)
@@ -258,5 +258,5 @@
 
     ! Dummy variables to use the subroutine 'init_testphys1d'
-    logical                             :: startfiles_1D, therestart1D, therestartfi
+    logical                             :: therestart1D, therestartfi
     integer                             :: ndt, day0
     real                                :: ptif, pks, day, gru, grv, atm_wat_profile, atm_wat_tau
@@ -308,6 +308,20 @@
     allocate(q(1,llm,nqtot))
     allocate(longitude(1),latitude(1),cell_area(1))
-    call init_testphys1d(.true.,ngrid,nlayer,610.,nq,q,time_0,ps(1),ucov,vcov,teta,startfiles_1D,therestart1D, &
-                         therestartfi,ndt,ptif,pks,dtphys,zqsat,dq,dqdyn,day0,day,gru,grv,w,                   &
+
+    therestart1D = .false.
+    inquire(file = 'start1D_evol.txt',exist = therestart1D)
+    if (.not. therestart1D) then
+        write(*,*) 'There is no "start1D_evol.txt" file!'
+        error stop 'Initialization cannot be done for the 1D PEM.'
+    endif
+    therestartfi = .false.
+    inquire(file = 'startfi_evol.nc',exist = therestartfi)
+    if (.not. therestartfi) then
+        write(*,*) 'There is no "startfi_evol.nc" file!'
+        error stop 'Initialization cannot be done for the 1D PEM.'
+    endif
+
+    call init_testphys1d('start1D_evol.txt','startfi_evol.nc',.true.,therestart1D,therestartfi,ngrid,nlayer,610., &
+                         nq,q,time_0,ps(1),ucov,vcov,teta,ndt,ptif,pks,dtphys,zqsat,dq,dqdyn,day0,day,gru,grv,w,  &
                          play,plev,latitude,longitude,cell_area,atm_wat_profile,atm_wat_tau)
     ps(2) = ps(1)
Index: /trunk/LMDZ.MARS/changelog.txt
===================================================================
--- /trunk/LMDZ.MARS/changelog.txt	(revision 3128)
+++ /trunk/LMDZ.MARS/changelog.txt	(revision 3129)
@@ -4348,2 +4348,3 @@
 == 17/11/2023 == JBC
 Correction of a bug related to r3126: 'choice_ads' did not have a default value which made the model crash. 'choice_ads = 0' is the default value (no adsorption).
+Cleaning of the 1D initialization: any reference of the PEM has been removed from "init_testphys1D_mod.F90". This way is much cleaner even though it needs more code.
Index: /trunk/LMDZ.MARS/libf/phymars/dyn1d/init_testphys1d_mod.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/dyn1d/init_testphys1d_mod.F90	(revision 3128)
+++ /trunk/LMDZ.MARS/libf/phymars/dyn1d/init_testphys1d_mod.F90	(revision 3129)
@@ -5,6 +5,6 @@
 contains
 
-SUBROUTINE init_testphys1d(pem1d,ngrid,nlayer,odpref,nq,q,time,psurf,u,v,temp,startfiles_1D,therestart1D, &
-                           therestartfi,ndt,ptif,pks,dttestphys,zqsat,dq,dqdyn,day0,day,gru,grv,w,        &
+SUBROUTINE init_testphys1d(start1Dname,startfiname,startfiles_1D,therestart1D,therestartfi,ngrid,nlayer,odpref, &
+                           nq,q,time,psurf,u,v,temp,ndt,ptif,pks,dttestphys,zqsat,dq,dqdyn,day0,day,gru,grv,w,  &
                            play,plev,latitude,longitude,cell_area,atm_wat_profile,atm_wat_tau)
 
@@ -38,6 +38,6 @@
 use phys_state_var_init_mod,  only: phys_state_var_init
 use turb_mod,                 only: q2
-use nonoro_gwd_ran_mod, only: du_nonoro_gwd, dv_nonoro_gwd
-use conf_phys_mod, only: conf_phys
+use nonoro_gwd_ran_mod,       only: du_nonoro_gwd, dv_nonoro_gwd
+use conf_phys_mod,            only: conf_phys
 ! Mostly for XIOS outputs:
 use mod_const_mpi,            only: COMM_LMDZ
@@ -51,7 +51,8 @@
 ! Arguments
 !=======================================================================
-integer, intent(in) :: ngrid, nlayer
-real,    intent(in) :: odpref        ! DOD reference pressure (Pa)
-logical, intent(in) :: pem1d         ! If initialization for the 1D PEM
+integer,      intent(in) :: ngrid, nlayer
+real,         intent(in) :: odpref                                    ! DOD reference pressure (Pa)
+character(*), intent(in) :: start1Dname, startfiname                  ! Name of starting files for 1D
+logical,      intent(in) :: startfiles_1D, therestart1D, therestartfi ! Use of starting files for 1D
 
 integer, intent(inout) :: nq
@@ -62,5 +63,4 @@
 real, dimension(nlayer),             intent(out) :: u, v  ! zonal, meridional wind
 real, dimension(nlayer),             intent(out) :: temp  ! temperature at the middle of the layers
-logical,                             intent(out) :: startfiles_1D, therestart1D, therestartfi ! Use of starting files for 1D
 integer,                             intent(out) :: ndt
 real,                                intent(out) :: ptif, pks
@@ -91,5 +91,5 @@
 ! RV & JBC: Use of starting files for 1D
 logical                :: found
-character(len = 30)    :: header
+character(30)          :: header
 real, dimension(100)   :: tab_cntrl
 real, dimension(1,2,1) :: albedo_read ! surface albedo
@@ -100,8 +100,8 @@
 
 ! MVals: isotopes as in the dynamics (CRisi)
-integer                                        :: ifils, ipere, generation, ierr0
-character(len = 30), dimension(:), allocatable :: tnom_transp ! transporting fluid short name
-character(len = 80)                            :: line        ! to store a line of text
-logical                                        :: continu, there
+integer                                  :: ifils, ipere, generation, ierr0
+character(30), dimension(:), allocatable :: tnom_transp ! transporting fluid short name
+character(80)                            :: line        ! to store a line of text
+logical                                  :: continu
 
 ! LL: Possibility to add subsurface ice
@@ -113,57 +113,7 @@
 real :: flux_geo_tmp
 
-! JBC: To initialize the 1D PEM
-character(:), allocatable :: start1Dname, startfiname ! Name of starting files for 1D
-
 !=======================================================================
 ! Code
 !=======================================================================
-if (.not. pem1d) then
-    start1Dname = 'start1D.txt'
-    startfiname = 'startfi.nc'
-    startfiles_1D = .false.
-    !------------------------------------------------------
-    ! Loading run parameters from "run.def" file
-    !------------------------------------------------------
-    ! check if 'run.def' file is around. Otherwise reading parameters
-    ! from callphys.def via getin() routine won't work.
-    inquire(file = 'run.def',exist = there)
-    if (.not. there) then
-        write(*,*) 'Cannot find required file "run.def"'
-        write(*,*) '  (which should contain some input parameters along with the following line: INCLUDEDEF=callphys.def)'
-        write(*,*) ' ... might as well stop here ...'
-        error stop
-    endif
-
-    write(*,*)'Do you want to use starting files and/or to write restarting files?'
-    call getin("startfiles_1D",startfiles_1D)
-    write(*,*) " startfiles_1D = ", startfiles_1D
-else
-    start1dname = 'start1D_evol.txt'
-    startfiname = 'startfi_evol.nc'
-    startfiles_1D = .true.
-endif
-
-therestart1D = .false.
-therestartfi = .false.
-inquire(file = start1Dname,exist = therestart1D)
-if (startfiles_1D .and. .not. therestart1D) then
-    write(*,*) 'There is no "'//start1Dname//'" file!'
-    if (.not. pem1d) then
-        write(*,*) 'Initialization is done with default values.'
-    else
-        error stop 'Initialization cannot be done for the 1D PEM.'
-    endif
-endif
-inquire(file = startfiname,exist = therestartfi)
-if (.not. therestartfi) then
-    write(*,*) 'There is no "'//startfiname//'" file!'
-    if (.not. pem1d) then
-        write(*,*) 'Initialization is done with default values.'
-    else
-        error stop 'Initialization cannot be done for the 1D PEM.'
-    endif
-endif
-
 !------------------------------------------------------
 ! Prescribed constants to be set here
@@ -309,5 +259,5 @@
     time = time/24. ! convert time (hours) to fraction of sol
 else
-    call open_startphy(startfiname)
+    call open_startphy(trim(startfiname))
     call get_var("controle",tab_cntrl,found)
     if (.not. found) then
@@ -351,5 +301,5 @@
     call getin("psurf",psurf)
 else
-    open(3,file = start1Dname,status = "old",action = "read")
+    open(3,file = trim(start1Dname),status = "old",action = "read")
     read(3,*) header, psurf
 endif
@@ -683,6 +633,6 @@
     ! check if "h2o_vap" has already been initialized
     ! (it has been if there is a "profile_h2o_vap" file around)
-    inquire(file = "profile_h2o_vap",exist = there)
-    if (there) then
+    inquire(file = "profile_h2o_vap",exist = found)
+    if (found) then
         flagh2o = 0 ! 0: do not initialize h2o_vap
     else
Index: /trunk/LMDZ.MARS/libf/phymars/dyn1d/testphys1d.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/dyn1d/testphys1d.F90	(revision 3128)
+++ /trunk/LMDZ.MARS/libf/phymars/dyn1d/testphys1d.F90	(revision 3129)
@@ -15,4 +15,5 @@
 use turb_mod,            only: q2
 use write_output_mod,    only: write_output
+use ioipsl_getincom,     only: getin ! To use 'getin'
 use init_testphys1d_mod, only: init_testphys1d
 use writerestart1D_mod,  only: writerestart1D
@@ -89,5 +90,4 @@
 integer                 :: nq = 1 ! number of tracers
 real, dimension(1)      :: latitude, longitude, cell_area
-logical                 :: there
 character(2)            :: str2
 character(7)            :: str7
@@ -95,5 +95,5 @@
 
 ! RV & JBC: Use of starting files for 1D
-logical :: startfiles_1D, therestart1D, therestartfi
+logical :: startfiles_1D, therestart1D, therestartfi, there
 
 ! JN & JBC: Force atmospheric water profiles
@@ -115,6 +115,38 @@
 !call initcomgeomphy
 
-call init_testphys1d(.false.,ngrid,nlayer,odpref,nq,q,time,psurf,u,v,temp,startfiles_1D,therestart1D, &
-                     therestartfi,ndt,ptif,pks,dttestphys,zqsat,dq,dqdyn,day0,day,gru,grv,w,          &
+startfiles_1D = .false.
+!------------------------------------------------------
+! Loading run parameters from "run.def" file
+!------------------------------------------------------
+! check if 'run.def' file is around. Otherwise reading parameters
+! from callphys.def via getin() routine won't work.
+inquire(file = 'run.def',exist = there)
+if (.not. there) then
+    write(*,*) 'Cannot find required file "run.def"'
+    write(*,*) '  (which should contain some input parameters along with the following line: INCLUDEDEF=callphys.def)'
+    write(*,*) ' ... might as well stop here ...'
+    error stop
+endif
+
+startfiles_1D = .false. ! Default value
+write(*,*) 'Do you want to use starting files and/or to write restarting files?'
+call getin('startfiles_1D',startfiles_1D)
+write(*,*) 'startfiles_1D =', startfiles_1D
+
+therestart1D = .false. ! Default value
+inquire(file = 'start1D.txt',exist = therestart1D)
+if (startfiles_1D .and. .not. therestart1D) then
+    write(*,*) 'There is no "start1D.txt" file!'
+    write(*,*) 'Initialization is done with default values.'
+endif
+therestartfi = .false. ! Default value
+inquire(file = 'startfi.nc',exist = therestartfi)
+if (.not. therestartfi) then
+    write(*,*) 'There is no "startfi.nc" file!'
+    write(*,*) 'Initialization is done with default values.'
+endif
+
+call init_testphys1d('start1D.txt','startfi.nc',startfiles_1D,therestart1D,therestartfi,ngrid,nlayer,odpref, &
+                     nq,q,time,psurf,u,v,temp,ndt,ptif,pks,dttestphys,zqsat,dq,dqdyn,day0,day,gru,grv,w,     &
                      play,plev,latitude,longitude,cell_area,atm_wat_profile,atm_wat_tau)
 
