Index: codes/icosagcm/trunk/src/timeloop_gcm.f90
===================================================================
--- codes/icosagcm/trunk/src/timeloop_gcm.f90	(revision 377)
+++ codes/icosagcm/trunk/src/timeloop_gcm.f90	(revision 387)
@@ -41,4 +41,6 @@
        STOP
     END IF
+
+    nqdyn = 1 ! one dynamical tracer = theta for the moment
 
     def='ARK2.3'
@@ -87,5 +89,5 @@
     CALL allocate_field(f_mass,field_t,type_real,llm,name='mass')
     CALL allocate_field(f_rhodz,field_t,type_real,llm,name='rhodz')
-    CALL allocate_field(f_theta_rhodz,field_t,type_real,llm,name='theta_rhodz')
+    CALL allocate_field(f_theta_rhodz,field_t,type_real,llm,nqdyn,name='theta_rhodz')
     CALL allocate_field(f_u,field_u,type_real,llm,name='u')
     CALL allocate_field(f_geopot,field_t,type_real,llm+1,name='geopot')
@@ -103,10 +105,10 @@
        CALL allocate_field(f_dps,field_t,type_real,name='dps')
        CALL allocate_field(f_dmass,field_t,type_real,llm, name='dmass')
-       CALL allocate_field(f_dtheta_rhodz,field_t,type_real,llm,name='dtheta_rhodz')
+       CALL allocate_field(f_dtheta_rhodz,field_t,type_real,llm,nqdyn,name='dtheta_rhodz')
        CALL allocate_field(f_du,field_u,type_real,llm,name='du')
        ! Model state at previous time step (RK/MLF)
        CALL allocate_field(f_psm1,field_t,type_real,name='psm1')
        CALL allocate_field(f_massm1,field_t,type_real,llm, name='massm1')
-       CALL allocate_field(f_theta_rhodzm1,field_t,type_real,llm,name='theta_rhodzm1')
+       CALL allocate_field(f_theta_rhodzm1,field_t,type_real,llm,nqdyn,name='theta_rhodzm1')
        CALL allocate_field(f_um1,field_u,type_real,llm,name='um1')
     CASE(hevi)
@@ -114,5 +116,5 @@
        CALL allocate_fields(nb_stage,f_dps_slow, field_t,type_real,name='dps_slow')
        CALL allocate_fields(nb_stage,f_dmass_slow, field_t,type_real,llm, name='dmass_slow')
-       CALL allocate_fields(nb_stage,f_dtheta_rhodz_slow, field_t,type_real,llm,name='dtheta_rhodz_fast')
+       CALL allocate_fields(nb_stage,f_dtheta_rhodz_slow, field_t,type_real,llm,nqdyn,name='dtheta_rhodz_fast')
        CALL allocate_fields(nb_stage,f_du_slow, field_u,type_real,llm,name='du_slow')
        CALL allocate_fields(nb_stage,f_du_fast, field_u,type_real,llm,name='du_fast')
@@ -131,5 +133,5 @@
        CALL allocate_field(f_psm2,field_t,type_real)
        CALL allocate_field(f_massm2,field_t,type_real,llm)
-       CALL allocate_field(f_theta_rhodzm2,field_t,type_real,llm)
+       CALL allocate_field(f_theta_rhodzm2,field_t,type_real,llm,nqdyn)
        CALL allocate_field(f_um2,field_u,type_real,llm)
     END SELECT
@@ -208,5 +210,5 @@
     fluxt_zero=.TRUE.
 
-    IF(positive_theta) CALL copy_theta_to_q1(f_theta_rhodz,f_rhodz,f_q)
+    IF(positive_theta) CALL copy_theta_to_q(f_theta_rhodz,f_rhodz,f_q)
 
     !$OMP MASTER
@@ -303,5 +305,5 @@
              END DO
           ENDIF
-          IF(positive_theta) CALL copy_q1_to_theta(f_theta_rhodz,f_rhodz,f_q)
+          IF(positive_theta) CALL copy_q_to_theta(f_theta_rhodz,f_rhodz,f_q)
        END IF
        
@@ -360,8 +362,8 @@
   END SUBROUTINE print_iteration
 
-  SUBROUTINE copy_theta_to_q1(f_theta_rhodz,f_rhodz,f_q)
+  SUBROUTINE copy_theta_to_q(f_theta_rhodz,f_rhodz,f_q)
     TYPE(t_field),POINTER :: f_theta_rhodz(:),f_rhodz(:), f_q(:)
-    REAL(rstd), POINTER :: theta_rhodz(:,:), rhodz(:,:), q(:,:,:)
-    INTEGER :: ind
+    REAL(rstd), POINTER :: theta_rhodz(:,:,:), rhodz(:,:), q(:,:,:)
+    INTEGER :: ind, iq
     DO ind=1, ndomain
        IF (.NOT. assigned_domain(ind)) CYCLE
@@ -371,12 +373,14 @@
        rhodz=f_rhodz(ind)
        q=f_q(ind)
-       q(:,:,1)  = theta_rhodz(:,:)/rhodz(:,:)
+       DO iq=1, nqdyn
+          q(:,:,iq)  = theta_rhodz(:,:,iq)/rhodz(:,:)
+       END DO
     END DO
-  END SUBROUTINE copy_theta_to_q1
-
-  SUBROUTINE copy_q1_to_theta(f_theta_rhodz,f_rhodz,f_q)
+  END SUBROUTINE copy_theta_to_q
+
+  SUBROUTINE copy_q_to_theta(f_theta_rhodz,f_rhodz,f_q)
     TYPE(t_field),POINTER :: f_theta_rhodz(:),f_rhodz(:), f_q(:)
-    REAL(rstd), POINTER :: theta_rhodz(:,:), rhodz(:,:), q(:,:,:)
-    INTEGER :: ind
+    REAL(rstd), POINTER :: theta_rhodz(:,:,:), rhodz(:,:), q(:,:,:)
+    INTEGER :: ind, iq
     DO ind=1, ndomain
        IF (.NOT. assigned_domain(ind)) CYCLE
@@ -386,7 +390,9 @@
        rhodz=f_rhodz(ind)
        q=f_q(ind)
-       theta_rhodz(:,:) = rhodz(:,:)*q(:,:,1)
+       DO iq=1,nqdyn
+          theta_rhodz(:,:,iq) = rhodz(:,:)*q(:,:,iq)
+       END DO
     END DO
-  END SUBROUTINE copy_q1_to_theta
+  END SUBROUTINE copy_q_to_theta
 
 END MODULE timeloop_gcm_mod
