Index: /trunk/LMDZ.MARS/changelog.txt
===================================================================
--- /trunk/LMDZ.MARS/changelog.txt	(revision 3131)
+++ /trunk/LMDZ.MARS/changelog.txt	(revision 3132)
@@ -4349,2 +4349,9 @@
 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.
+
+== 21/11/2023 == EM
+Bug fix in phyetat0, igcm_co2_tmp was not initialed when paleoclimate==.false.
+but used nonetheless. Added an if(paleoclimate) around computation of 
+perennial_co2ice() as it should only be computed in that context; also added
+an if(paleoclimate) around writting perennial_co2ice() to restartfi.nc in
+physdem1 for the same reason.
Index: /trunk/LMDZ.MARS/libf/phymars/phyetat0_mod.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/phyetat0_mod.F90	(revision 3131)
+++ /trunk/LMDZ.MARS/libf/phymars/phyetat0_mod.F90	(revision 3132)
@@ -781,5 +781,6 @@
 ! Perennial CO2 ice
 perennial_co2ice(:,:) = 0.
-if (startphy_file) then
+if (paleoclimate) then
+  if (startphy_file) then
     call get_field("perennial_co2ice",perennial_co2ice,found,indextime)
     if (.not. found) then
@@ -793,5 +794,5 @@
         endif
     endif ! not found
-else
+  else
     if (abs(latitude(ngrid) - (-pi/2.)) < 1.e-5) then
         do islope = 1,nslope
@@ -800,5 +801,6 @@
         enddo
     endif
-endif !startphy_file
+  endif !startphy_file
+endif ! of if (paleoclimate)
 
 ! close file:
Index: /trunk/LMDZ.MARS/libf/phymars/phyredem.F90
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/phyredem.F90	(revision 3131)
+++ /trunk/LMDZ.MARS/libf/phymars/phyredem.F90	(revision 3132)
@@ -227,5 +227,7 @@
  
   ! Perennial CO2 ice layer
-  call put_field("perennial_co2ice","CO2 ice cover",perennial_co2ice,time)
+  if(paleoclimate) then
+    call put_field("perennial_co2ice","CO2 ice cover",perennial_co2ice,time)
+  endif
 
   ! Surface temperature
