Index: trunk/LMDZ.COMMON/makelmdz_fcm
===================================================================
--- trunk/LMDZ.COMMON/makelmdz_fcm	(revision 3585)
+++ trunk/LMDZ.COMMON/makelmdz_fcm	(revision 3586)
@@ -611,5 +611,5 @@
 vcs_info=""
 vcs_diff=""
-vcs_status=""
+vcs_stat=""
 for dir in "$LMDGCM/.."/*; do
     # Skip if it is not a directory or the name contains "git" or "svn"
@@ -619,13 +619,13 @@
     # Determine the version control system for each subdirectory
     if command -v svn > /dev/null && svn info "$dir" > /dev/null 2>&1; then # SVN
-        vcs_info+="\n=== SVN Information for $(basename "$dir") ===\n$(svn info "$dir")\n"
-        vcs_diff+="\n=== SVN Diff for $(basename "$dir") ===\n$(svn diff "$dir")\n"
-        vcs_status+="\n=== SVN Status for $(basename "$dir") ===\n$(svn status "$dir")\n"
+        vcs_info+="\n-> SVN Information for \"$(basename "$dir")\"\n$(svn info "$dir")\n"
+        vcs_diff+="\n-> SVN Diff for \"$(basename "$dir")\"\n$(svn diff "$dir")\n"
+        vcs_stat+="\n-> SVN Status for \"$(basename "$dir")\"\n$(svn status "$dir")\n"
     elif command -v git > /dev/null && git -C "$dir" rev-parse --is-inside-work-tree > /dev/null 2>&1; then # Git
-        vcs_info+="=== Git Information for $(basename "$dir") ===\n$(git -C "$dir" log -1 --pretty=format:"%H%n%an%n%ad%n%s")\n"
-        vcs_diff+="\n=== Git Diff for $(basename "$dir") ===\n$(git -C "$dir" diff)\n"
-        vcs_status+="\n=== Git Status for $(basename "$dir") ===\n$(git -C "$dir" status --short)\n"
+        vcs_info+="-> Git Information for \"$(basename "$dir")\"\n$(git -C "$dir" log -1 --pretty=format:"%H%n%an%n%ad%n%s")\n"
+        vcs_diff+="\n-> Git Diff for \"$(basename "$dir")\"\n$(git -C "$dir" diff)\n"
+        vcs_stat+="\n-> Git Status for \"$(basename "$dir")\"\n$(git -C "$dir" status --short)\n"
     else # None
-        vcs_info+="\n=== No version control system for $(basename "$dir") ===\n"
+        vcs_info+="\n-> No version control system for \"$(basename "$dir")\"\n"
     fi
 done
@@ -659,6 +659,6 @@
 
 write(*,'(a)') '======= Compilation details ======='
-write(*,'(a)') '> Date: ${current_date}'
-write(*,'(a)') '> Command: ${compilation_command}'
+write(*,'(a)') '-> Date: ${current_date}'
+write(*,'(a)') '-> Command: ${compilation_command}'
 write(*,*)
 EOF
@@ -670,15 +670,15 @@
     done <<< "$(echo -e "$vcs_info")"
 else
-    echo "write(*,'(a)') '=== No version control system ==='" >> "$info_file"
-fi
-
-if [ -n "$vcs_status" ]; then
+    echo "write(*,'(a)') '==== No version control system ===='" >> "$info_file"
+fi
+
+if [ -n "$vcs_stat" ]; then
     echo "write(*,*)" >> "$info_file"
-    echo "write(*,'(a)') '=== Version Control Status ==='" >> "$info_file"
-    echo "write(*,'(a)') '> Writing status result to the file \"${res_file}\".'" >> "$info_file"
+    echo "write(*,'(a)') '====== Version Control Status ====='" >> "$info_file"
+    echo "write(*,'(a)') '-> Writing status result to the file \"${res_file}\".'" >> "$info_file"
     echo "open(unit = 1, file = \"${res_file}\",status = 'replace',action = 'write')" >> "$info_file"
     while IFS= read -r line; do
         echo "write(1,'(a)') '${line//\'/\'\'}'" >> "$info_file"
-    done <<< "$(echo -e "$vcs_status")"
+    done <<< "$(echo -e "$vcs_stat")"
     echo "close(1)" >> "$info_file"
 fi
@@ -687,5 +687,5 @@
     echo "write(*,*)" >> "$info_file"
     echo "write(*,'(a)') '====== Version Control Diff ======='" >> "$info_file"
-    echo "write(*,'(a)') '> Writing diff result to the file \"${res_file}\".'" >> "$info_file"
+    echo "write(*,'(a)') '-> Writing diff result to the file \"${res_file}\".'" >> "$info_file"
     echo "open(unit = 1, file = \"${res_file}\",status = 'unknown',position = 'append',action = 'write')" >> "$info_file"
     while IFS= read -r line; do
Index: trunk/LMDZ.MARS/changelog.txt
===================================================================
--- trunk/LMDZ.MARS/changelog.txt	(revision 3585)
+++ trunk/LMDZ.MARS/changelog.txt	(revision 3586)
@@ -4760,2 +4760,6 @@
 - Correction of r3581: the key-words to get 'albedo_perennialco2(1:2)" from the "callphys.def" are now 'albedo_perennialco2_north' and 'albedo_perennialco2_south'.
 - Moving 'albedo_perennialco2' from the 'paleoclimate' module to the 'surfdat_h' module.
+
+== 20/01/2025 == JBC
+- Albedo is now set properly in every situation given the presence of CO2/H2O ice and frost + water albedo is done solely in "physiq".
+- Small update to make the display of code version status/diff clearer.
Index: trunk/LMDZ.MARS/libf/phymars/albedocaps.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/albedocaps.F90	(revision 3585)
+++ trunk/LMDZ.MARS/libf/phymars/albedocaps.F90	(revision 3586)
@@ -6,7 +6,6 @@
 use ioipsl_getin_p_mod, only: getin_p
 use geometry_mod, only: latitude ! grid point latitudes (rad)
-use surfdat_h, only: TESicealbedo, TESice_Ncoef, TESice_Scoef,       &
-                     emisice, albedice, watercaptag, albedo_h2o_cap, &
-                     emissiv, albedodat, albedo_perennialco2
+use surfdat_h, only: TESicealbedo, TESice_Ncoef, TESice_Scoef, &
+                     emisice, emissiv, albedice, albedodat, albedo_perennialco2
 USE mod_phys_lmdz_transfert_para, ONLY: bcast
 USE mod_phys_lmdz_para, ONLY: is_master
@@ -96,6 +95,18 @@
         icap = 1 ! Northern hemisphere
     endif
-
-    if (piceco2(ig) > 0) then ! CO2 frost
+    
+    ! Initialization with bare ground
+    ! set emissivity of surface to be bare ground emissivity
+    emisref(ig) = emissiv
+    ! set the surface albedo to bare ground albedo
+    psolaralb(ig,:) = albedodat(ig)
+
+    ! CO2 perennial ice
+    if (paleoclimate .and. piceco2_peren(ig) > 0.) then
+        psolaralb(ig,:) = albedo_perennialco2(icap)
+        emisref(ig) = emisice(icap)
+    endif
+    ! CO2 frost
+    if (piceco2(ig) > 0.) then
         ! set emissivity of surface to be the ice emissivity
         emisref(ig) = emisice(icap)
@@ -105,22 +116,7 @@
             psolaralb(ig,2) = psolaralb(ig,1)
         else
-            psolaralb(ig,1) = albedice(icap)
-            psolaralb(ig,2) = albedice(icap)
+            psolaralb(ig,:) = albedice(icap)
         endif
-    else if (paleoclimate .and. piceco2_peren(ig) > 0.) then ! CO2 perennial ice
-        psolaralb(ig,1) = albedo_perennialco2(icap)
-        psolaralb(ig,2) = albedo_perennialco2(icap)
-        emisref(ig) = emisice(icap)
-    else if (watercaptag(ig) .and. water) then ! H2O ice in polar caps
-        ! there is a water ice cap: set the surface albedo to the water ice one
-        ! to do : emissivity
-        emisref(ig) = 1
-        psolaralb(ig,:) = albedo_h2o_cap
-    else ! Bare ground
-        ! set emissivity of surface to be bare ground emissivity
-        emisref(ig) = emissiv
-        ! set the surface albedo to bare ground albedo
-        psolaralb(ig,:) = albedodat(ig)
-    endif ! of if (piceco2(ig).gt.0)
+    endif
 enddo ! of ig=1,ngrid
 
Index: trunk/LMDZ.MARS/libf/phymars/co2condens_mod.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/co2condens_mod.F	(revision 3585)
+++ trunk/LMDZ.MARS/libf/phymars/co2condens_mod.F	(revision 3586)
@@ -612,10 +612,9 @@
         alb_tmp = psolaralb(:,:,islope)
         emisref_tmp = 0.
-        perennial_co2ice_tmp =  perennial_co2ice(:,islope) 
+        perennial_co2ice_tmp =  perennial_co2ice(:,islope)
         CALL albedocaps(zls,ngrid,piceco2_tmp,perennial_co2ice_tmp,
      &                  alb_tmp,emisref_tmp)
         perennial_co2ice(:,islope) = perennial_co2ice_tmp
-        psolaralb(:,1,islope) =  alb_tmp(:,1)
-        psolaralb(:,2,islope) =  alb_tmp(:,2)
+        psolaralb(:,:,islope) =  alb_tmp(:,:)
         emisref(:,islope) = emisref_tmp
       ENDDO
Index: trunk/LMDZ.MARS/libf/phymars/dyn1d/init_testphys1d_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/dyn1d/init_testphys1d_mod.F90	(revision 3585)
+++ trunk/LMDZ.MARS/libf/phymars/dyn1d/init_testphys1d_mod.F90	(revision 3586)
@@ -140,4 +140,5 @@
 obliquit = 25.2           ! Obliquity (deg) ~25.2
 eccentric = 0.0934        ! Eccentricity (0.0934)
+Lsperi = 251.             ! Solar longitude of perihelion
 
 ! Planetary Boundary Layer and Turbulence parameters
Index: trunk/LMDZ.MARS/libf/phymars/dyn1d/testphys1d.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/dyn1d/testphys1d.F90	(revision 3585)
+++ trunk/LMDZ.MARS/libf/phymars/dyn1d/testphys1d.F90	(revision 3586)
@@ -6,7 +6,7 @@
 use phyredem,            only: physdem0, physdem1
 use watersat_mod,        only: watersat
-use tracer_mod,          only: igcm_h2o_vap, igcm_h2o_ice, igcm_co2, noms
+use tracer_mod,          only: igcm_h2o_vap, igcm_h2o_ice, noms
 use comcstfi_h,          only: pi, g, rcp, cpp
-use time_phylmdz_mod, only: daysec
+use time_phylmdz_mod,    only: daysec
 use dimradmars_mod,      only: tauvis, totcloudfrac, albedo
 use dust_param_mod,      only: tauscaling
Index: trunk/LMDZ.MARS/libf/phymars/physiq_mod.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/physiq_mod.F	(revision 3585)
+++ trunk/LMDZ.MARS/libf/phymars/physiq_mod.F	(revision 3586)
@@ -2366,19 +2366,26 @@
 c              ALWAYS PLACE these lines after co2condens !!!
 c       -------------------------------------------------------------
-         do ig=1,ngrid
+         do ig = 1,ngrid
           do islope = 1,nslope
-           if ((qsurf(ig,igcm_co2,islope).eq.0).and.
-     &        (qsurf(ig,igcm_h2o_ice,islope)
-     &       .gt.frost_albedo_threshold)) then
-             if ((watercaptag(ig)).and.(cst_cap_albedo)) then
-               albedo(ig,1,islope) = albedo_h2o_cap
-               albedo(ig,2,islope) = albedo_h2o_cap
-             else
-               albedo(ig,1,islope) = albedo_h2o_frost
-               albedo(ig,2,islope) = albedo_h2o_frost
-             endif !((watercaptag(ig)).and.(cst_cap_albedo)) then
-c              write(*,*) "frost thickness", qsurf(ig,igcm_h2o_ice)
-c              write(*,*) "physiq.F frost :"
-c     &        ,latitude(ig)*180./pi, longitude(ig)*180./pi
+           if (abs(qsurf(ig,igcm_co2,islope)) < 1.e-10) then ! No CO2 frost
+
+             if (qsurf(ig,igcm_h2o_ice,islope) > frost_albedo_threshold)
+     & then ! There is H2O frost
+               if (cst_cap_albedo .and. watercaptag(ig) .and.
+     & abs(perennial_co2ice(ig,islope)) < 1.e-10) then ! Water cap remains unchanged by water frost deposition and no CO2 perennial ice
+                 albedo(ig,:,islope) = albedo_h2o_cap
+                 emis(ig,islope) = 1.
+               else
+                 albedo(ig,:,islope) = albedo_h2o_frost
+                 emis(ig,islope) = 1.
+               endif
+             else ! No H2O frost
+               if (abs(perennial_co2ice(ig,islope)) < 1.e-10 .and.
+     & watercaptag(ig)) then ! No CO2 perennial ice but there is water cap
+                 albedo(ig,:,islope) = albedo_h2o_cap
+                 emis(ig,islope) = 1.
+               endif
+             endif
+
            endif
           enddo ! islope
