Index: /trunk/LMDZ.MARS/changelog.txt
===================================================================
--- /trunk/LMDZ.MARS/changelog.txt	(revision 3036)
+++ /trunk/LMDZ.MARS/changelog.txt	(revision 3037)
@@ -4176,2 +4176,3 @@
 == 8/09/2023 == JBC
 In testphys1D.F, "dtphys" was renamed into a local variable "dttestphys" because "dtphys" is also a variable of time_phylmdz_mod.F90. Thus, it could have been modified by the physics through the module (for ex. by tabfi.F when reading startfi.nc) and affect the dynamics which is prohibited.
+Some code cleaning in regards of tests in 1D.
Index: /trunk/LMDZ.MARS/libf/phymars/iniorbit.F
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/iniorbit.F	(revision 3036)
+++ /trunk/LMDZ.MARS/libf/phymars/iniorbit.F	(revision 3037)
@@ -69,5 +69,5 @@
       timeperi=2.*atan(sqrt((1.+e_elips)/(1.-e_elips))*tan(zx0/2.))
       PRINT*,'iniorbit: Perihelion solar long. Ls (deg)=',
-     &       360.-timeperi*180./pi
+     &       modulo(-timeperi*180./pi,360.)
 
       END
Index: /trunk/LMDZ.MARS/libf/phymars/phyetat0_mod.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/phyetat0_mod.F90	(revision 3036)
+++ /trunk/LMDZ.MARS/libf/phymars/phyetat0_mod.F90	(revision 3037)
@@ -634,9 +634,9 @@
 
     if (hdo) then
-    if (txt.eq."hdo_vap") then
-      txt="hdo_ice"
-      write(*,*) 'phyetat0: loading surface tracer', &
+      if (txt.eq."hdo_vap") then
+        txt="hdo_ice"
+        write(*,*) 'phyetat0: loading surface tracer', &
                            ' hdo_ice instead of hdo_vap'
-    endif
+      endif
     endif !hdo
 
@@ -651,5 +651,5 @@
           if (.not.found) then
             call abort_physic(modname, &
-                "phyetat0: Failed loading co2ice. there is neither the variable co2ice nor qsurf",1)
+                "phyetat0: Failed loading co2ice. There is neither the variable co2ice nor qsurf!",1)
           endif
         endif
@@ -663,31 +663,9 @@
       endif !endif co2
     else !(not startphy_file)
-      qsurf(:,iq,:)=0.
+      qsurf(:,iq,:)=0. ! co2ice is set to 0
     endif ! of if (startphy_file)
     write(*,*) "phyetat0: Surface tracer <",trim(txt),"> range:", &
                  minval(qsurf(:,iq,:)), maxval(qsurf(:,iq,:))
   enddo ! of do iq=1,nq
-
-    if (txt.eq."co2") then
-      ! We first check if co2ice exist in the startfi file (old way)
-      ! CO2 ice cover
-      if (startphy_file) then
-        call get_field("co2ice",qsurf(:,iq,:),found,indextime)
-      ! If not, we load the corresponding tracer in qsurf
-        if (.not.found) then
-          call get_field(txt,qsurf(:,iq,:),found,indextime)
-          if (.not.found) then
-            call abort_physic(modname, &
-                "phyetat0: Failed loading co2ice",1)
-          endif
-        endif
-      else
-       ! If we run without startfile, co2ice is set to 0
-        qsurf(:,iq,:)=0.
-      endif !if (startphy_file)
-        write(*,*) "phyetat0: CO2 ice cover <co2ice> range:", &
-            minval(qsurf(:,iq,:)), maxval(qsurf(:,iq,:))
-    endif
-
 endif ! of if (nq.ge.1)
 
Index: /trunk/LMDZ.MARS/libf/phymars/physiq_mod.F
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/physiq_mod.F	(revision 3036)
+++ /trunk/LMDZ.MARS/libf/phymars/physiq_mod.F	(revision 3037)
@@ -615,22 +615,22 @@
          ENDIF
        ENDDO
-       PRINT*,'Flat slope for islope = ',iflat
-       PRINT*,'corresponding criterium = ',def_slope_mean(iflat)
+       write(*,*)'Flat slope for islope = ',iflat
+       write(*,*)'corresponding criterium = ',def_slope_mean(iflat)
 
 #else
 ! MESOSCALE. Supposedly everything is already set in modules.
 ! So we just check. And we fill day_ini
-      print*,"check: --- in physiq.F"
-      print*,"check: rad,cpp,g,r,rcp,daysec"
-      print*,rad,cpp,g,r,rcp,daysec
-      PRINT*,'check: tsurf ',tsurf(1,:),tsurf(ngrid,:)
-      PRINT*,'check: tsoil ',tsoil(1,1,:),tsoil(ngrid,nsoilmx,:)
-      PRINT*,'check: inert ',inertiedat(1,1),inertiedat(ngrid,nsoilmx)      
-      PRINT*,'check: midlayer,layer ', mlayer(:),layer(:)
-      PRINT*,'check: tracernames ', noms
-      PRINT*,'check: emis ',emis(1,:),emis(ngrid,:)
-      PRINT*,'check: q2 ',q2(1,1),q2(ngrid,nlayer+1)
-      PRINT*,'check: qsurf ',qsurf(1,1,:),qsurf(ngrid,nq,:)
-      PRINT*,'check: co2ice ',qsurf(1,igcm_co2,:),qsurf(ngrid,igcm_co2,:)
+      write(*,*)"check: --- in physiq.F"
+      write(*,*)"check: rad,cpp,g,r,rcp,daysec"
+      write(*,*)rad,cpp,g,r,rcp,daysec
+      write(*,*)'check: tsurf ',tsurf(1,:),tsurf(ngrid,:)
+      write(*,*)'check: tsoil ',tsoil(1,1,:),tsoil(ngrid,nsoilmx,:)
+      write(*,*)'check: inert ',inertiedat(1,1),inertiedat(ngrid,nsoilmx)      
+      write(*,*)'check: midlayer,layer ', mlayer(:),layer(:)
+      write(*,*)'check: tracernames ', noms
+      write(*,*)'check: emis ',emis(1,:),emis(ngrid,:)
+      write(*,*)'check: q2 ',q2(1,1),q2(ngrid,nlayer+1)
+      write(*,*)'check: qsurf ',qsurf(1,1,:),qsurf(ngrid,nq,:)
+      write(*,*)'check: co2ice ',qsurf(1,igcm_co2,:),qsurf(ngrid,igcm_co2,:)
       !!!
       day_ini = pday
@@ -716,5 +716,5 @@
             ENDIF ! of IF (tifeedback)
          ELSE
-            PRINT*,
+            write(*,*)
      &     'PHYSIQ WARNING! Thermal conduction in the soil turned off'
             DO ig=1,ngrid
@@ -2496,6 +2496,6 @@
 
       IF (lwrite) THEN
-         PRINT*,'Global diagnostics for the physics'
-         PRINT*,'Variables and their increments x and dx/dt * dt'
+         write(*,*)'Global diagnostics for the physics'
+         write(*,*)'Variables and their increments x and dx/dt * dt'
          WRITE(*,'(a6,a10,2a15)') 'Ts','dTs','ps','dps'
          WRITE(*,'(2f10.5,2f15.5)')
@@ -3216,4 +3216,6 @@
      &                  "W.m-2",fluxsurf_dn_sw_tot(:,islope))
          ENDDO
+         call write_output("fluxtop_dn_sw","fluxtop_dn_sw",
+     &                  "W.m-2",fluxtop_dn_sw(:,1) + fluxtop_dn_sw(:,2))
          call write_output("fluxtop_lw","fluxtop_lw","W.m-2",
      &                  fluxtop_lw(:))
Index: /trunk/LMDZ.MARS/libf/phymars/tabfi.F
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/tabfi.F	(revision 3036)
+++ /trunk/LMDZ.MARS/libf/phymars/tabfi.F	(revision 3037)
@@ -570,6 +570,6 @@
       double precision pi,degrad 
       
-      parameter (pi=3.14159265358979d0)
-      parameter (degrad=57.2957795130823d0)
+      parameter (pi=4.d0*atan(1.d0))
+      parameter (degrad=180.d0/pi)
 
       e_elips=(aphelie-periheli)/(aphelie+periheli)      
