Index: LMDZ5/trunk/libf/dyn3d/comconst.h
===================================================================
--- LMDZ5/trunk/libf/dyn3d/comconst.h	(revision 1504)
+++ LMDZ5/trunk/libf/dyn3d/comconst.h	(revision 1505)
@@ -11,5 +11,5 @@
      &                   ,dissip_factz,dissip_deltaz,dissip_zref        &
      &                   ,tau_top_bound,                                &
-     & daylen,year_day,molmass
+     & daylen,year_day,molmass, ihf
 
 
@@ -35,4 +35,5 @@
       REAL molmass ! (g/mol) molar mass of the atmosphere
 
+      REAL ihf ! (W/m2) Intrinsic heat flux (for giant planets)
 
 !-----------------------------------------------------------------------
Index: LMDZ5/trunk/libf/dyn3d/conf_planete.F90
===================================================================
--- LMDZ5/trunk/libf/dyn3d/conf_planete.F90	(revision 1504)
+++ LMDZ5/trunk/libf/dyn3d/conf_planete.F90	(revision 1505)
@@ -64,3 +64,7 @@
 CALL getin('omeg',omeg)
 
+! Intrinsic heat flux (default: none) (only used if planet_type="giant")
+ihf = 0.
+call getin('ihf',ihf)
+
 END SUBROUTINE conf_planete
Index: LMDZ5/trunk/libf/dyn3d/iniacademic.F90
===================================================================
--- LMDZ5/trunk/libf/dyn3d/iniacademic.F90	(revision 1504)
+++ LMDZ5/trunk/libf/dyn3d/iniacademic.F90	(revision 1505)
@@ -178,4 +178,10 @@
            tetajl(j,l)=teta0-delt_y*ddsin*ddsin+eps*ddsin &
                 -delt_z*(1.-ddsin*ddsin)*log(zsig)
+           if (planet_type=="giant") then
+             tetajl(j,l)=teta0+(delt_y*                   &
+                ((sin(rlatu(j)*3.14159*eps+0.0001))**2)   &
+                / ((rlatu(j)*3.14159*eps+0.0001)**2))     &
+                -delt_z*log(zsig)
+           endif
            ! Profil stratospherique isotherme (+vortex)
            w_pv=(1.-tanh((rlatu(j)-phi_pv)/dphi_pv))/2.
Index: LMDZ5/trunk/libf/dyn3d/leapfrog.F
===================================================================
--- LMDZ5/trunk/libf/dyn3d/leapfrog.F	(revision 1504)
+++ LMDZ5/trunk/libf/dyn3d/leapfrog.F	(revision 1505)
@@ -437,5 +437,11 @@
           ENDDO
         ENDDO ! of DO l=1,llm 
-          call friction(ucov,vcov,dtvr)
+        
+        if (planet_type.eq."giant") then
+          ! add an intrinsic heat flux at the base of the atmosphere
+          teta(:,1)=teta(:,1)+dtvr*aire(:)*ihf/cpp/masse(:,1)
+        endif
+
+        call friction(ucov,vcov,dtvr)
         
         ! Sponge layer (if any)
Index: LMDZ5/trunk/libf/dyn3dpar/comconst.h
===================================================================
--- LMDZ5/trunk/libf/dyn3dpar/comconst.h	(revision 1504)
+++ LMDZ5/trunk/libf/dyn3dpar/comconst.h	(revision 1505)
@@ -11,5 +11,5 @@
      &                   ,dissip_factz,dissip_deltaz,dissip_zref        &
      &                   ,tau_top_bound,                                &
-     & daylen,year_day,molmass
+     & daylen,year_day,molmass, ihf
 
 
@@ -35,4 +35,5 @@
       REAL molmass ! (g/mol) molar mass of the atmosphere
 
+      REAL ihf ! (W/m2) Intrinsic heat flux (for giant planets)
 
 !-----------------------------------------------------------------------
Index: LMDZ5/trunk/libf/dyn3dpar/conf_planete.F90
===================================================================
--- LMDZ5/trunk/libf/dyn3dpar/conf_planete.F90	(revision 1504)
+++ LMDZ5/trunk/libf/dyn3dpar/conf_planete.F90	(revision 1505)
@@ -64,3 +64,7 @@
 CALL getin('omeg',omeg)
 
+! Intrinsic heat flux (default: none) (only used if planet_type="giant")
+ihf = 0.
+call getin('ihf',ihf)
+
 END SUBROUTINE conf_planete
Index: LMDZ5/trunk/libf/dyn3dpar/iniacademic.F90
===================================================================
--- LMDZ5/trunk/libf/dyn3dpar/iniacademic.F90	(revision 1504)
+++ LMDZ5/trunk/libf/dyn3dpar/iniacademic.F90	(revision 1505)
@@ -178,4 +178,10 @@
            tetajl(j,l)=teta0-delt_y*ddsin*ddsin+eps*ddsin &
                 -delt_z*(1.-ddsin*ddsin)*log(zsig)
+           if (planet_type=="giant") then
+             tetajl(j,l)=teta0+(delt_y*                   &
+                ((sin(rlatu(j)*3.14159*eps+0.0001))**2)   &
+                / ((rlatu(j)*3.14159*eps+0.0001)**2))     &
+                -delt_z*log(zsig)
+           endif
            ! Profil stratospherique isotherme (+vortex)
            w_pv=(1.-tanh((rlatu(j)-phi_pv)/dphi_pv))/2.
Index: LMDZ5/trunk/libf/dyn3dpar/leapfrog_p.F
===================================================================
--- LMDZ5/trunk/libf/dyn3dpar/leapfrog_p.F	(revision 1504)
+++ LMDZ5/trunk/libf/dyn3dpar/leapfrog_p.F	(revision 1505)
@@ -977,4 +977,13 @@
 !$OMP END DO
 
+!$OMP MASTER
+       if (planet_type.eq."giant") then
+         ! add an intrinsic heat flux at the base of the atmosphere
+         teta(ijb:ije,1) = teta(ijb:ije,1)
+     &        + dtvr * aire(ijb:ije) * ihf / cpp / masse(ijb:ije,1)
+       endif
+!$OMP END MASTER
+!$OMP BARRIER
+
        call Register_Hallo(ucov,ip1jmp1,llm,0,1,1,0,Request_Physic)
        call Register_Hallo(vcov,ip1jm,llm,1,1,1,1,Request_Physic)
