Index: /trunk/LMDZ.GENERIC/changelog.txt
===================================================================
--- /trunk/LMDZ.GENERIC/changelog.txt	(revision 3745)
+++ /trunk/LMDZ.GENERIC/changelog.txt	(revision 3746)
@@ -2076,2 +2076,6 @@
 Minor fix in tabfi: the physics time step stored in the startfi file should
 not overwrite the real value of dtphys (computed in and passed by the dynamics).
+
+== 29/04/2025 == EM
+Minor fix in interpolate_continuum: handle the extreme case when temperature
+is below minimum value in the table.
Index: /trunk/LMDZ.GENERIC/libf/phystd/interpolate_continuum.F90
===================================================================
--- /trunk/LMDZ.GENERIC/libf/phystd/interpolate_continuum.F90	(revision 3745)
+++ /trunk/LMDZ.GENERIC/libf/phystd/interpolate_continuum.F90	(revision 3746)
@@ -53,4 +53,5 @@
 
       character(len=512) :: line
+      character(len=21),parameter :: rname="interpolate_continuum"
 
       integer i, pos, iT, iW, iB, count_norm, igas
@@ -224,5 +225,5 @@
             write(*,*) 'https://web.lmd.jussieu.fr/~lmdz/planets/generic/datagcm/continuum_data/'
           endif
-          call abort_physic("interpolate_continuum","missing input file",1)
+          call abort_physic(rname,"missing input file",1)
         endif
 
@@ -473,6 +474,6 @@
 	  call interpolate_T_abs_coeff(z_temp,temp_arr_CO2CO2,num_T_CO2CO2,abs_coef,abs_arr_CO2CO2_VI(ind_WN,:))
 	else
-	  print*,'You must select visible (VI) or infrared (IR) canal.'
-          stop
+	  print*,'You must select visible (VI) or infrared (IR) channel.'
+          call abort_physic(rname,"CO2CO2 bad channel",1)
 	endif
       elseif ((igas_X .eq. igas_N2) .and. (igas_Y .eq. igas_N2)) then
@@ -483,6 +484,6 @@
 	  call interpolate_T_abs_coeff(z_temp,temp_arr_N2N2,num_T_N2N2,abs_coef,abs_arr_N2N2_VI(ind_WN,:))
 	else
-	  print*,'You must select visible (VI) or infrared (IR) canal.'
-          stop
+	  print*,'You must select visible (VI) or infrared (IR) channel.'
+          call abort_physic(rname,"N2N2 bad channel",1)
 	endif
       elseif ((igas_X .eq. igas_O2) .and. (igas_Y .eq. igas_O2)) then
@@ -493,6 +494,6 @@
 	  call interpolate_T_abs_coeff(z_temp,temp_arr_O2O2,num_T_O2O2,abs_coef,abs_arr_O2O2_VI(ind_WN,:))
 	else
-	  print*,'You must select visible (VI) or infrared (IR) canal.'
-          stop
+	  print*,'You must select visible (VI) or infrared (IR) channel.'
+          call abort_physic(rname,"O2O2 bad channel",1)
 	endif
       elseif ((igas_X .eq. igas_CH4) .and. (igas_Y .eq. igas_CH4)) then
@@ -503,6 +504,6 @@
 	  call interpolate_T_abs_coeff(z_temp,temp_arr_CH4CH4,num_T_CH4CH4,abs_coef,abs_arr_CH4CH4_VI(ind_WN,:))
 	else
-	  print*,'You must select visible (VI) or infrared (IR) canal.'
-          stop
+	  print*,'You must select visible (VI) or infrared (IR) channel.'
+          call abort_physic(rname,"CH4CH4 bad channel",1)
 	endif	
       elseif ((igas_X .eq. igas_H2) .and. (igas_Y .eq. igas_H2)) then
@@ -513,6 +514,6 @@
 	  call interpolate_T_abs_coeff(z_temp,temp_arr_H2H2,num_T_H2H2,abs_coef,abs_arr_H2H2_VI(ind_WN,:))
 	else
-	  print*,'You must select visible (VI) or infrared (IR) canal.'
-          stop
+	  print*,'You must select visible (VI) or infrared (IR) channel.'
+          call abort_physic(rname,"H2H2 bad channel",1)
 	endif
       elseif ((igas_X .eq. igas_H2O) .and. (igas_Y .eq. igas_H2O)) then
@@ -523,6 +524,6 @@
 	  call interpolate_T_abs_coeff(z_temp,temp_arr_H2OH2O,num_T_H2OH2O,abs_coef,abs_arr_H2OH2O_VI(ind_WN,:))
 	else
-	  print*,'You must select visible (VI) or infrared (IR) canal.'
-          stop
+	  print*,'You must select visible (VI) or infrared (IR) channel.'
+          call abort_physic(rname,"H2OH2O bad channel",1)
 	endif
       elseif ((igas_X .eq. igas_N2) .and. (igas_Y .eq. igas_H2)) then
@@ -533,6 +534,6 @@
 	  call interpolate_T_abs_coeff(z_temp,temp_arr_N2H2,num_T_N2H2,abs_coef,abs_arr_N2H2_VI(ind_WN,:))
 	else
-	  print*,'You must select visible (VI) or infrared (IR) canal.'
-          stop
+	  print*,'You must select visible (VI) or infrared (IR) channel.'
+          call abort_physic(rname,"N2H2 bad channel",1)
 	endif
       elseif ((igas_X .eq. igas_N2) .and. (igas_Y .eq. igas_O2)) then
@@ -543,6 +544,6 @@
 	  call interpolate_T_abs_coeff(z_temp,temp_arr_N2O2,num_T_N2O2,abs_coef,abs_arr_N2O2_VI(ind_WN,:))
 	else
-	  print*,'You must select visible (VI) or infrared (IR) canal.'
-          stop
+	  print*,'You must select visible (VI) or infrared (IR) channel.'
+          call abort_physic(rname,"N2O2 bad channel",1)
 	endif
       elseif ((igas_X .eq. igas_N2) .and. (igas_Y .eq. igas_CH4)) then
@@ -553,6 +554,6 @@
 	  call interpolate_T_abs_coeff(z_temp,temp_arr_N2CH4,num_T_N2CH4,abs_coef,abs_arr_N2CH4_VI(ind_WN,:))
 	else
-	  print*,'You must select visible (VI) or infrared (IR) canal.'
-          stop
+	  print*,'You must select visible (VI) or infrared (IR) channel.'
+          call abort_physic(rname,"N2CH4 bad channel",1)
 	endif
       elseif ((igas_X .eq. igas_CO2) .and. (igas_Y .eq. igas_O2)) then
@@ -563,6 +564,6 @@
 	  call interpolate_T_abs_coeff(z_temp,temp_arr_CO2O2,num_T_CO2O2,abs_coef,abs_arr_CO2O2_VI(ind_WN,:))
 	else
-	  print*,'You must select visible (VI) or infrared (IR) canal.'
-          stop
+	  print*,'You must select visible (VI) or infrared (IR) channel.'
+          call abort_physic(rname,"CO2O2 bad channel",1)
 	endif
       elseif ((igas_X .eq. igas_H2) .and. (igas_Y .eq. igas_CH4)) then
@@ -573,6 +574,6 @@
 	  call interpolate_T_abs_coeff(z_temp,temp_arr_H2CH4,num_T_H2CH4,abs_coef,abs_arr_H2CH4_VI(ind_WN,:))
 	else
-	  print*,'You must select visible (VI) or infrared (IR) canal.'
-          stop
+	  print*,'You must select visible (VI) or infrared (IR) channel.'
+          call abort_physic(rname,"H2CH4 bad channel",1)
 	endif
       elseif ((igas_X .eq. igas_H2) .and. (igas_Y .eq. igas_He)) then
@@ -583,6 +584,6 @@
 	  call interpolate_T_abs_coeff(z_temp,temp_arr_H2He,num_T_H2He,abs_coef,abs_arr_H2He_VI(ind_WN,:))
 	else
-	  print*,'You must select visible (VI) or infrared (IR) canal.'
-          stop
+	  print*,'You must select visible (VI) or infrared (IR) channel.'
+          call abort_physic(rname,"H2He bad channel",1)
 	endif	
       elseif ((igas_X .eq. igas_H2O) .and. (igas_Y .eq. igas_N2)) then
@@ -593,6 +594,6 @@
 	  call interpolate_T_abs_coeff(z_temp,temp_arr_H2ON2,num_T_H2ON2,abs_coef,abs_arr_H2ON2_VI(ind_WN,:))
 	else
-	  print*,'You must select visible (VI) or infrared (IR) canal.'
-          stop
+	  print*,'You must select visible (VI) or infrared (IR) channel.'
+          call abort_physic(rname,"H2ON2 bad channel",1)
 	endif	
       elseif ((igas_X .eq. igas_H2O) .and. (igas_Y .eq. igas_O2)) then
@@ -603,6 +604,6 @@
 	  call interpolate_T_abs_coeff(z_temp,temp_arr_H2OO2,num_T_H2OO2,abs_coef,abs_arr_H2OO2_VI(ind_WN,:))
 	else
-	  print*,'You must select visible (VI) or infrared (IR) canal.'
-          stop
+	  print*,'You must select visible (VI) or infrared (IR) channel.'
+          call abort_physic(rname,"H2OO2 bad channel",1)
 	endif	
       elseif ((igas_X .eq. igas_H2O) .and. (igas_Y .eq. igas_CO2)) then
@@ -613,6 +614,6 @@
 	  call interpolate_T_abs_coeff(z_temp,temp_arr_H2OCO2,num_T_H2OCO2,abs_coef,abs_arr_H2OCO2_VI(ind_WN,:))
 	else
-	  print*,'You must select visible (VI) or infrared (IR) canal.'
-          stop
+	  print*,'You must select visible (VI) or infrared (IR) channel.'
+          call abort_physic(rname,"H2OCO2 bad channel",1)
 	endif
       elseif ((igas_X .eq. igas_CO2) .and. (igas_Y .eq. igas_H2)) then
@@ -623,6 +624,6 @@
 	  call interpolate_T_abs_coeff(z_temp,temp_arr_CO2H2,num_T_CO2H2,abs_coef,abs_arr_CO2H2_VI(ind_WN,:))
 	else
-	  print*,'You must select visible (VI) or infrared (IR) canal.'
-          stop
+	  print*,'You must select visible (VI) or infrared (IR) channel.'
+          call abort_physic(rname,"CO2H2 bad channel",1)
 	endif	
       elseif ((igas_X .eq. igas_CO2) .and. (igas_Y .eq. igas_CH4)) then
@@ -633,6 +634,6 @@
 	  call interpolate_T_abs_coeff(z_temp,temp_arr_CO2CH4,num_T_CO2CH4,abs_coef,abs_arr_CO2CH4_VI(ind_WN,:))
 	else
-	  print*,'You must select visible (VI) or infrared (IR) canal.'
-          stop
+	  print*,'You must select visible (VI) or infrared (IR) channel.'
+          call abort_physic(rname,"CO2CH4 bad channel",1)
 	endif									
       endif ! igas_X / igas_Y condition
@@ -777,5 +778,5 @@
             print*, 'Maximum temperature is ', maxval(temp_arr), ' K'
           endif
-          call abort_physic(rname,"temperature too low",1)
+          call abort_physic(rname,"temperature too high",1)
         else
           z_temp=maxval(temp_arr)
@@ -803,10 +804,10 @@
       
       integer iT
-      double precision z_temp
-      integer num_T
-      double precision temp_arr(num_T)
-      
-      double precision abs_coef
-      double precision abs_arr(num_T)
+      double precision,intent(in) :: z_temp
+      integer,intent(in) :: num_T
+      double precision,intent(in) :: temp_arr(num_T)
+      
+      double precision,intent(out) :: abs_coef
+      double precision,intent(in) :: abs_arr(num_T)
       
       ! Check where to interpolate
@@ -816,8 +817,15 @@
       end do
       
+      ! If below lowest temperature in temp_arr() 
+      if (iT==1) then
+        abs_coef=abs_arr(1)
+        return
+      endif
+      
       ! We proceed to a simple linear interpolation using the two most nearby temperatures
       if(iT .lt. num_T) then
         abs_coef=abs_arr(iT-1)+(abs_arr(iT)-abs_arr(iT-1))*(z_temp-temp_arr(iT-1))/(temp_arr(iT)-temp_arr(iT-1))
       else
+        ! If above highest temperature
         abs_coef=abs_arr(iT)
       endif
