Index: /trunk/LMDZ.MARS/README
===================================================================
--- /trunk/LMDZ.MARS/README	(revision 1273)
+++ /trunk/LMDZ.MARS/README	(revision 1274)
@@ -2123,2 +2123,9 @@
 - Checked consistency before/after modification in debug mode
 - Checked performance is not impacted (same as before)
+
+== 21/05/2014 == EM
+- Bug fix in thermosphere.F, always initialize all tendencies to zero. (only
+  really matters in cases when only some of the included parametrizations
+  are used).
+
+
Index: /trunk/LMDZ.MARS/libf/aeronomars/thermosphere.F
===================================================================
--- /trunk/LMDZ.MARS/libf/aeronomars/thermosphere.F	(revision 1273)
+++ /trunk/LMDZ.MARS/libf/aeronomars/thermosphere.F	(revision 1274)
@@ -6,5 +6,5 @@
 
       use conc_mod, only: rnew, cpnew
-      USE comcstfi_h
+      USE comcstfi_h, only: r, cpp
       implicit none
 
@@ -14,26 +14,26 @@
       integer,intent(in) :: nlayer ! number of atmospheric layers
       integer,intent(in) :: nq ! number of advected tracers
-      REAL pplay(ngrid,nlayer)
-      real pplev(ngrid,nlayer+1)
-      REAL zzlay(ngrid,nlayer)
-      real zzlev(ngrid,nlayer+1)
-      REAL pt(ngrid,nlayer)
-      real zday
-      REAL dist_sol
-      real mu0(ngrid)
-      real pq(ngrid,nlayer,nq)
-      real ptimestep
-      real ptime
-      real tsurf(ngrid)
-      REAL pu(ngrid,nlayer),pv(ngrid,nlayer)
-      REAL pdt(ngrid,nlayer),pdq(ngrid,nlayer,nq)
+      REAL,INTENT(in) :: pplay(ngrid,nlayer)
+      REAL,INTENT(in) :: pplev(ngrid,nlayer+1)
+      REAL,INTENT(in) :: zzlay(ngrid,nlayer)
+      REAL,INTENT(in) :: zzlev(ngrid,nlayer+1)
+      REAL,INTENT(in) :: pt(ngrid,nlayer)
+      REAL,INTENT(in) :: zday
+      REAL,INTENT(in) :: dist_sol
+      REAL,INTENT(in) :: mu0(ngrid)
+      REAL,INTENT(in) :: pq(ngrid,nlayer,nq)
+      REAL,INTENT(in) :: ptimestep
+      REAL,INTENT(in) :: ptime
+      REAL,INTENT(in) :: tsurf(ngrid)
+      REAL,INTENT(in) :: pu(ngrid,nlayer),pv(ngrid,nlayer)
+      REAL,INTENT(in) :: pdt(ngrid,nlayer),pdq(ngrid,nlayer,nq)
 
-      REAL zdteuv(ngrid,nlayer)
-      REAL zdtconduc(ngrid,nlayer)
-      REAL zdumolvis(ngrid,nlayer)
-      REAL zdvmolvis(ngrid,nlayer)
-      real zdqmoldiff(ngrid,nlayer,nq)
+      REAL,INTENT(out) :: zdteuv(ngrid,nlayer)
+      REAL,INTENT(out) :: zdtconduc(ngrid,nlayer)
+      REAL,INTENT(out) :: zdumolvis(ngrid,nlayer)
+      REAL,INTENT(out) :: zdvmolvis(ngrid,nlayer)
+      REAL,INTENT(out) :: zdqmoldiff(ngrid,nlayer,nq)
 
-      INTEGER l,ig
+      INTEGER :: l,ig
       logical,save :: firstcall=.true.
 
@@ -50,6 +50,13 @@
       endif
 
+      ! initialize tendencies to zero in all cases
+      ! (tendencies are added later on, even if parametrization is not called)
+      zdteuv(1:ngrid,1:nlayer)=0
+      zdtconduc(1:ngrid,1:nlayer)=0
+      zdumolvis(1:ngrid,1:nlayer)=0
+      zdvmolvis(1:ngrid,1:nlayer)=0
+      zdqmoldiff(1:ngrid,1:nlayer,1:nq)=0
+      
       if (calleuv) then
-        zdteuv(1:ngrid,1:nlayer)=0
         call euvheat(ngrid,nlayer,nq,pt,pdt,pplev,pplay,zzlay,
      $               mu0,ptimestep,ptime,zday,pq,pdq,zdteuv)
@@ -57,5 +64,4 @@
 
       if (callconduct) THEN
-        zdtconduc(1:ngrid,1:nlayer)=0
         call conduction(ngrid,nlayer,ptimestep,pplay,pplev,pt,zdteuv,
      $                   tsurf,zzlev,zzlay,zdtconduc)
@@ -63,9 +69,7 @@
 
       if (callmolvis) THEN
-        zdumolvis(1:ngrid,1:nlayer)=0
         call molvis(ngrid,nlayer,ptimestep,pplay,pplev,pt,
      &                zdteuv,zdtconduc,pu,
      $                   tsurf,zzlev,zzlay,zdumolvis)
-        zdvmolvis(1:ngrid,1:nlayer)=0
         call molvis(ngrid,nlayer,ptimestep,pplay,pplev,pt,
      &                zdteuv,zdtconduc,pv,
@@ -74,5 +78,4 @@
 
       if (callmoldiff) THEN
-        zdqmoldiff(1:ngrid,1:nlayer,1:nq)=0
         call moldiff_red(ngrid,nlayer,nq,
      &                   pplay,pplev,pt,pdt,pq,pdq,ptimestep,
@@ -80,5 +83,4 @@
       endif
 
-      return
       end
 
