Index: trunk/LMDZ.MARS/libf/phymars/conf_phys.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/conf_phys.F	(revision 4143)
+++ trunk/LMDZ.MARS/libf/phymars/conf_phys.F	(revision 4150)
@@ -50,4 +50,5 @@
      &      coal_coeff_mode,full_coag_equations
       use lwxn_mod, only: lwxn_linear, lwxn_alphan, lwxn_ncouche
+      use tracer_mass_fixer_dyn_mod, only: call_mass_fixer_dyn
       use callkeys_mod, only: startphy_file, activice, activeco2ice,
      &                        calladj, callatke, callcond,
@@ -1258,4 +1259,12 @@
         endif
 
+c        ----------------------------------------------------------
+
+! Tracer mass fixer for dynamics
+
+         write(*,*) "call tracer mass fixer for dynamics?"
+         call getin_p("call_mass_fixer_dyn", call_mass_fixer_dyn)
+         write(*,*) "call_mass_fixer_dyn = ", call_mass_fixer_dyn
+
 ! Test of incompatibility:
 ! if photochem is used, then water should be used too
Index: trunk/LMDZ.MARS/libf/phymars/iostart.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/iostart.F90	(revision 4143)
+++ trunk/LMDZ.MARS/libf/phymars/iostart.F90	(revision 4150)
@@ -8,4 +8,5 @@
     
     ! restartfi.nc file dimension identifiers: (see open_restartphy())
+    INTEGER,SAVE :: idim0  ! "scalar" dimension
     INTEGER,SAVE :: idim1  ! "index" dimension
     INTEGER,SAVE :: idim2  ! "physical_points" dimension
@@ -510,4 +511,11 @@
         write(*,*)'open_restartphy: problem writing title '
         write(*,*)trim(nf90_strerror(ierr))
+      ENDIF
+
+      ierr=NF90_DEF_DIM(nid_restart,"scalar",1,idim0)
+      IF (ierr/=NF90_NOERR) THEN
+        write(*,*)'open_restartphy: problem defining scalar dimension '
+        write(*,*)trim(nf90_strerror(ierr))
+        CALL abort_physic("open_restartphy","Failed defining scalar",1)
       ENDIF
 
@@ -1061,4 +1069,7 @@
         ENDIF
         return ! nothing left to do
+      ELSEIF (var_size==1) THEN
+        ! We know it is a scalar
+        idim1d=idim0
       ELSEIF (var_size==length) THEN
         ! We know it is a "controle" kind of 1D array
Index: trunk/LMDZ.MARS/libf/phymars/phyetat0_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/phyetat0_mod.F90	(revision 4143)
+++ trunk/LMDZ.MARS/libf/phymars/phyetat0_mod.F90	(revision 4150)
@@ -26,4 +26,9 @@
 use nonoro_gwd_mix_mod,  only: du_eddymix_gwd, dv_eddymix_gwd, de_eddymix_rto, &
                                df_eddymix_flx, dh_eddymix_gwd, dq_eddymix_gwd
+use tracer_mass_fixer_dyn_mod, only: mass_predyn_co, mass_predyn_o2, mass_predyn_h2, mass_predyn_ho2,  &
+                                     mass_predyn_h2o2, mass_predyn_n2, mass_predyn_ar, mass_predyn_he, &
+                                     found_startfi_co, found_startfi_o2, found_startfi_h2, found_startfi_ho2, &
+                                     found_startfi_h2o2, found_startfi_n2, found_startfi_ar, found_startfi_he, &
+                                     call_mass_fixer_dyn
 use compute_dtau_mod,    only: dtau
 use dust_rad_adjust_mod, only: dust_rad_adjust_prev,dust_rad_adjust_next
@@ -718,4 +723,63 @@
              minval(df_eddymix_flx ), maxval(df_eddymix_flx )
 
+! Correction to tracer mass non-conservation in dynamics
+if (startphy_file .and. call_mass_fixer_dyn) then
+   call get_var("mass_predyn_co", mass_predyn_co, found)
+   if (found) then
+      found_startfi_co = .true.
+   else
+      write(*,*) "phyetat0: <mass_predyn_co> not in file"
+   endif
+
+   call get_var("mass_predyn_o2", mass_predyn_o2, found)
+   if (found) then
+      found_startfi_o2 = .true.
+   else
+      write(*,*) "phyetat0: <mass_predyn_o2> not in file"
+   endif
+
+   call get_var("mass_predyn_h2", mass_predyn_h2, found)
+   if (found) then
+      found_startfi_h2 = .true.
+   else
+      write(*,*) "phyetat0: <mass_predyn_h2> not in file"
+   endif
+
+   call get_var("mass_predyn_ho2", mass_predyn_ho2, found)
+   if (found) then
+      found_startfi_ho2 = .true.
+   else
+      write(*,*) "phyetat0: <mass_predyn_ho2> not in file"
+   endif
+
+   call get_var("mass_predyn_h2o2", mass_predyn_h2o2, found)
+   if (found) then
+      found_startfi_h2o2 = .true.
+   else
+      write(*,*) "phyetat0: <mass_predyn_h2o2> not in file"
+   endif
+
+   call get_var("mass_predyn_n2", mass_predyn_n2, found)
+   if (found) then
+      found_startfi_n2 = .true.
+   else
+      write(*,*) "phyetat0: <mass_predyn_n2> not in file"
+   endif
+
+   call get_var("mass_predyn_ar", mass_predyn_ar, found)
+   if (found) then
+      found_startfi_ar = .true.
+   else
+      write(*,*) "phyetat0: <mass_predyn_ar> not in file"
+   endif
+
+   call get_var("mass_predyn_he", mass_predyn_he, found)
+   if (found) then
+      found_startfi_he = .true.
+   else
+      write(*,*) "phyetat0: <mass_predyn_he> not in file"
+   endif
+endif ! if (startphy_file .and. call_mass_fixer_dyn)
+
 ! tracer on surface
 if (nq.ge.1) then
Index: trunk/LMDZ.MARS/libf/phymars/phyredem.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/phyredem.F90	(revision 4143)
+++ trunk/LMDZ.MARS/libf/phymars/phyredem.F90	(revision 4150)
@@ -198,4 +198,5 @@
   use iostart,             only: open_restartphy, close_restartphy, put_var, put_field
   use tracer_mod,          only: noms ! tracer names
+  use tracer_mod,          only: igcm_co, igcm_o2, igcm_h2, igcm_ho2, igcm_h2o2, igcm_n2, igcm_ar, igcm_he
   use nonoro_gwd_ran_mod,  only: du_nonoro_gwd, dv_nonoro_gwd
   use compute_dtau_mod,    only: dtau
@@ -206,4 +207,5 @@
   use comslope_mod,        only: nslope
   use paleoclimate_mod,    only: paleoclimate
+  use tracer_mass_fixer_dyn_mod, only: call_mass_fixer_dyn, mass_predyn
   use callkeys_mod,        only: calltherm, dustinjection, calllott_nonoro
   use callkeys_mod, only: CLFvarying
@@ -392,4 +394,32 @@
   endif
 
+  ! Correction to tracer mass non-conservations in dynamics
+  if (call_mass_fixer_dyn) then
+    if (igcm_co .ne. 0) then
+      call put_var("mass_predyn_co", "Global mass of CO before the last physiq step ends", mass_predyn(igcm_co))
+    endif
+    if (igcm_o2 .ne. 0) then
+      call put_var("mass_predyn_o2", "Global mass of O2 before the last physiq step ends", mass_predyn(igcm_o2))
+    endif
+    if (igcm_h2 .ne. 0) then
+      call put_var("mass_predyn_h2", "Global mass of H2 before the last physiq step ends", mass_predyn(igcm_h2))
+    endif
+    if (igcm_ho2 .ne. 0) then
+      call put_var("mass_predyn_ho2", "Global mass of HO2 before the last physiq step ends", mass_predyn(igcm_ho2))
+    endif
+    if (igcm_h2o2 .ne. 0) then
+      call put_var("mass_predyn_h2o2", "Global mass of H2O2 before the last physiq step ends", mass_predyn(igcm_h2o2))
+    endif
+    if (igcm_n2 .ne. 0) then
+      call put_var("mass_predyn_n2", "Global mass of N2 before the last physiq step ends", mass_predyn(igcm_n2))
+    endif
+    if (igcm_ar .ne. 0) then
+      call put_var("mass_predyn_ar", "Global mass of Ar before the last physiq step ends", mass_predyn(igcm_ar))
+    endif
+    if (igcm_he .ne. 0) then
+      call put_var("mass_predyn_he", "Global mass of He before the last physiq step ends", mass_predyn(igcm_he))
+    endif
+  endif
+
   ! Close file
   call close_restartphy
Index: trunk/LMDZ.MARS/libf/phymars/phys_state_var_init_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/phys_state_var_init_mod.F90	(revision 4143)
+++ trunk/LMDZ.MARS/libf/phymars/phys_state_var_init_mod.F90	(revision 4150)
@@ -65,4 +65,6 @@
       use comslope_mod, ONLY: nslope,end_comslope_h,ini_comslope_h
       use paleoclimate_mod, ONLY: end_paleoclimate_h,ini_paleoclimate_h
+      use tracer_mass_fixer_dyn_mod, only: ini_tracer_mass_fixer_dyn, &
+                                           end_tracer_mass_fixer_dyn
       use netcdf
 #ifndef MESOSCALE
@@ -200,4 +202,8 @@
       call ini_paleoclimate_h(ngrid,nslope)
 
+      ! allocate arrays in "tracer_mass_fixer_dyn_mod"
+      call end_tracer_mass_fixer_dyn
+      call ini_tracer_mass_fixer_dyn(nq)
+
       END SUBROUTINE phys_state_var_init
 
Index: trunk/LMDZ.MARS/libf/phymars/physiq_mod.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/physiq_mod.F	(revision 4143)
+++ trunk/LMDZ.MARS/libf/phymars/physiq_mod.F	(revision 4150)
@@ -275,6 +275,4 @@
       REAL,INTENT(in) :: pt(ngrid,nlayer) ! temperature (K)
       REAL,INTENT(in) :: pq(ngrid,nlayer,nq) ! tracers (.../kg_of_air)
-      REAL pq_corrdyn(ngrid,nlayer,nq) ! tracer mass mixing ratio after correcting
-                                       ! mass non-conservations in dynamics
       REAL,INTENT(in) :: flxw(ngrid,nlayer) ! vertical mass flux (ks/s) at lower boundary of layer
 
@@ -286,6 +284,4 @@
       REAL,INTENT(out) :: pdt(ngrid,nlayer) ! temperature tendency (K/s)
       REAL,INTENT(out) :: pdq(ngrid,nlayer,nq) ! tracer tendencies (../kg/s)
-      REAL pdq_corrdyn(ngrid,nlayer,nq) ! tracer mass mixing ratio tendencies in order to correct
-                                        ! mass non-conservations in dynamics
       REAL,INTENT(out) :: pdpsrf(ngrid) ! surface pressure tendency (Pa/s)
 
@@ -451,11 +447,4 @@
       real colden(ngrid,nq)     ! vertical column of tracers
       real mass(nq)             ! global mass of tracers (g)
-      real, allocatable, save :: mass_predyn(:) ! tracer mass in the whole atmosphere
-                                                ! before dynamics
-      real mass_postdyn(nq) ! tracer mass in the whole atmosphere after dynamics
-
-!$OMP THREADPRIVATE(mass_predyn)
-
-      real masscorrfac(nq) ! mass correction factor for non-conservations in dynamics
       REAL mtot(ngrid)          ! Total mass of water vapor (kg/m2)
       REAL mstormdtot(ngrid)    ! Total mass of stormdust tracer (kg/m2)
@@ -826,7 +815,4 @@
      &                              presnivs,pseudoalt,mlayer)
 #endif
-
-         allocate(mass_predyn(nq))
-
       ENDIF        !  (end of "if firstcall")
 
@@ -892,56 +878,4 @@
       zplay(:,:) = pplay(:,:)
       ps(:) = pplev(:,1)
-
-c     Correct mass non-conservation in dynamics
-c     ~~~~~~~~~~~~~~~~~~
-      call compute_global_mass(pq, ngrid, nlayer, nq, zplev,
-     &                         mass_postdyn)
-
-      if (.not.firstcall) then ! At first call, mass_predyn does not exist
-         do iq = 1, nq
-            if (noms(iq) .ne. "dust_mass" .and.
-     &          noms(iq) .ne. "dust_number" .and.
-     &          noms(iq) .ne. "ccn_mass" .and.
-     &          noms(iq) .ne. "ccn_number" .and.
-     &          noms(iq) .ne. "ccnco2_mass" .and.
-     &          noms(iq) .ne. "ccnco2_number" .and.
-     &          noms(iq) .ne. "stormdust_mass" .and.
-     &          noms(iq) .ne. "stormdust_number" .and.
-     &          noms(iq) .ne. "topdust_mass" .and.
-     &          noms(iq) .ne. "topdust_number") then
-               masscorrfac(iq) = mass_predyn(iq)/mass_postdyn(iq)
-            endif
-         enddo
-
-         pq_corrdyn = pq
-         do ig = 1, ngrid
-            do l = 1, min(nlayer, 40) ! Correction only applied to the lowest 40 layers
-               do iq = 1, nq
-                  if (noms(iq) .ne. "dust_mass" .and.
-     &                noms(iq) .ne. "dust_number" .and.
-     &                noms(iq) .ne. "ccn_mass" .and.
-     &                noms(iq) .ne. "ccn_number" .and.
-     &                noms(iq) .ne. "ccnco2_mass" .and.
-     &                noms(iq) .ne. "ccnco2_number" .and.
-     &                noms(iq) .ne. "stormdust_mass" .and.
-     &                noms(iq) .ne. "stormdust_number" .and.
-     &                noms(iq) .ne. "topdust_mass" .and.
-     &                noms(iq) .ne. "topdust_number" .and.
-     &                iq .ne. igcm_co2) then
-                     ! Correcting species other than CO2
-                     pq_corrdyn(ig, l, iq) =
-     &                    pq(ig, l, iq) * masscorrfac(iq)
-                     ! Adjust CO2 to compensate for mass creation/loss
-                     pq_corrdyn(ig, l, igcm_co2) = 
-     &                    pq_corrdyn(ig, l, igcm_co2) -
-     &                    pq(ig, l, iq) * (masscorrfac(iq) - 1.)
-                  endif
-               enddo
-            enddo
-         enddo
-
-         pdq_corrdyn = (pq_corrdyn - pq)/ptimestep ! Mass fixer pdq
-         pdq = pdq + pdq_corrdyn
-      endif
 
 !#ifndef MESOSCALE
@@ -2634,7 +2568,4 @@
         ENDDO
       ENDDO
-
-      call compute_global_mass(zq, ngrid, nlayer, nq, zplev, 
-     &                         mass_predyn)
 
       ! Density
@@ -4199,51 +4130,3 @@
       END SUBROUTINE physiq
 
-      subroutine compute_global_mass(zq, ngrid, nlayer, nq, zplev, mass)
-
-         use tracer_mod, only: mmol
-         use comcstfi_h, only: g
-         use geometry_mod, only: cell_area
-         use tracer_mod, only: noms
-         use planetwide_mod, only: planetwide_sumval
-
-         real, intent(in)    :: zq(ngrid, nlayer, nq)
-         integer, intent(in) :: ngrid
-         integer, intent(in) :: nlayer
-         integer, intent(in) :: nq
-         real, intent(in)    :: zplev(ngrid, nlayer + 1)
-         real, intent(out)   :: mass(nq)
-         real    colden(ngrid, nq)
-         integer iq, ig, l
-
-         do iq = 1, nq
-            if (noms(iq) .ne. "dust_mass" .and.
-     &          noms(iq) .ne. "dust_number" .and.
-     &          noms(iq) .ne. "ccn_mass" .and.
-     &          noms(iq) .ne. "ccn_number" .and.
-     &          noms(iq) .ne. "ccnco2_mass" .and.
-     &          noms(iq) .ne. "ccnco2_number" .and.
-     &          noms(iq) .ne. "stormdust_mass" .and.
-     &          noms(iq) .ne. "stormdust_number" .and.
-     &          noms(iq) .ne. "topdust_mass" .and.
-     &          noms(iq) .ne. "topdust_number") then
-
-               do ig = 1, ngrid
-                   colden(ig, iq) = 0.
-               end do
-               do l = 1, nlayer
-                  do ig = 1, ngrid
-                     colden(ig, iq) = colden(ig, iq) + zq(ig, l, iq)*
-     &                                (zplev(ig, l) - zplev(ig, l+1))*
-     &                                6.022e22/(mmol(iq)*g)
-                  end do
-               end do
-
-               call planetwide_sumval(colden(:, iq)/6.022e23
-     &                    *mmol(iq)*1.e4*cell_area, mass(iq))
-
-            end if
-         end do
-
-      end subroutine
-
       END MODULE physiq_mod
Index: trunk/LMDZ.MARS/libf/phymars/tracer_mass_fixer_dyn_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/tracer_mass_fixer_dyn_mod.F90	(revision 4150)
+++ trunk/LMDZ.MARS/libf/phymars/tracer_mass_fixer_dyn_mod.F90	(revision 4150)
@@ -0,0 +1,213 @@
+module tracer_mass_fixer_dyn_mod
+
+implicit none
+
+logical, save           :: call_mass_fixer_dyn = .false. ! flag for correcting mass non-conservations due to dynamics
+logical, save           :: found_startfi_co    = .false. ! flags for finding mass_predyn_<tracer name> in startfi.nc
+logical, save           :: found_startfi_o2    = .false.
+logical, save           :: found_startfi_h2    = .false.
+logical, save           :: found_startfi_ho2   = .false.
+logical, save           :: found_startfi_h2o2  = .false.
+logical, save           :: found_startfi_n2    = .false.
+logical, save           :: found_startfi_ar    = .false.
+logical, save           :: found_startfi_he    = .false.
+real, allocatable, save :: mass_predyn(:)                ! tracer mass at the end of physiq before dynamics starts
+! tracer mass at the end of the last physiq step for writing and reading startfi
+real, save              :: mass_predyn_co, mass_predyn_o2, mass_predyn_h2, mass_predyn_ho2, & 
+                           mass_predyn_h2o2, mass_predyn_n2, mass_predyn_ar, mass_predyn_he
+
+!$omp threadprivate(call_mass_fixer_dyn)
+!$omp threadprivate(found_startfi_co, found_startfi_o2, found_startfi_h2, found_startfi_ho2)
+!$omp threadprivate(found_startfi_h2o2, found_startfi_n2,found_startfi_ar,found_startfi_he)
+!$omp threadprivate(mass_predyn)
+!$omp threadprivate(mass_predyn_co, mass_predyn_o2, mass_predyn_h2, mass_predyn_ho2)
+!$omp threadprivate(mass_predyn_h2o2, mass_predyn_n2, mass_predyn_ar, mass_predyn_he)
+
+contains
+
+    subroutine tracer_mass_fixer_dyn(ngrid, nlayer, nq, ptimestep, pq, zplev, firstcall, pdq_corrdyn)
+
+        !--------------------------------------------------------------------------------
+        ! Correction of mass mixing ratios for tracers that represent a significant fraction of their constituent elements
+        ! at the beginning of physiq, to ensure mass conservation during dynamics.
+        ! Y. LUO  03/2026
+        !---------------------------------------------------------------------------------
+
+        use tracer_mod, only: noms, igcm_co, igcm_o2, igcm_h2, igcm_ho2, igcm_h2o2, igcm_n2, igcm_ar, igcm_he
+
+        implicit none
+
+        integer, intent(in)  :: ngrid                          ! number of atmospheric columns
+        integer, intent(in)  :: nlayer                         ! number of atmospheric layers
+        integer, intent(in)  :: nq                             ! number of tracers in traceur.def
+        real,    intent(in)  :: ptimestep                      ! physics timestep (s)
+        real,    intent(in)  :: pq(ngrid, nlayer, nq)          ! tracer mass mixing ratios (kg per 1 kg of air)
+        real,    intent(in)  :: zplev(ngrid, nlayer + 1)       ! inter-layer pressure (Pa)
+        logical, intent(in)  :: firstcall                      ! True at the first call
+        real,    intent(out) :: pdq_corrdyn(ngrid, nlayer, nq) ! tracer mass mixing ratio tendencies in order to correct
+                                                               ! mass non-conservations in dynamics
+
+        real mass_postdyn(nq)              ! tracer mass when dynamics ends and physics starts
+        real masscorrfac(nq)               ! correction factor for mass non-conservations in dynamics
+        real pq_corrdyn(ngrid, nlayer, nq) ! tracer mass mixing ratio after correcting mass non-conservations in dynamics
+
+        call compute_tracer_mass_global(ngrid, nlayer, nq, pq, zplev, mass_postdyn)
+
+        pq_corrdyn = pq
+
+        if (igcm_co .ne. 0 .and. (.not. firstcall .or. found_startfi_co)) then
+            masscorrfac(igcm_co) = mass_predyn(igcm_co) / mass_postdyn(igcm_co)
+            pq_corrdyn(:, :, igcm_co) = pq(:, :, igcm_co) * masscorrfac(igcm_co)
+        endif
+
+        if (igcm_o2 .ne. 0 .and. (.not. firstcall .or. found_startfi_o2)) then
+            masscorrfac(igcm_o2) = mass_predyn(igcm_o2) / mass_postdyn(igcm_o2)
+            pq_corrdyn(:, :, igcm_o2) = pq(:, :, igcm_o2) * masscorrfac(igcm_o2)
+        endif
+
+        if (igcm_h2 .ne. 0 .and. (.not. firstcall .or. found_startfi_h2)) then
+            masscorrfac(igcm_h2) = mass_predyn(igcm_h2) / mass_postdyn(igcm_h2)
+            pq_corrdyn(:, :, igcm_h2) = pq(:, :, igcm_h2) * masscorrfac(igcm_h2)
+        endif
+
+        if (igcm_ho2 .ne. 0 .and. (.not. firstcall .or. found_startfi_ho2)) then
+            masscorrfac(igcm_ho2) = mass_predyn(igcm_ho2) / mass_postdyn(igcm_ho2)
+            pq_corrdyn(:, :, igcm_ho2) = pq(:, :, igcm_ho2) * masscorrfac(igcm_ho2)
+        endif
+
+        if (igcm_h2o2 .ne. 0 .and. (.not. firstcall .or. found_startfi_h2o2)) then
+            masscorrfac(igcm_h2o2) = mass_predyn(igcm_h2o2) / mass_postdyn(igcm_h2o2)
+            pq_corrdyn(:, :, igcm_h2o2) = pq(:, :, igcm_h2o2) * masscorrfac(igcm_h2o2)
+        endif
+
+        if (igcm_n2 .ne. 0 .and. (.not. firstcall .or. found_startfi_n2)) then
+            masscorrfac(igcm_n2) = mass_predyn(igcm_n2) / mass_postdyn(igcm_n2)
+            pq_corrdyn(:, :, igcm_n2) = pq(:, :, igcm_n2) * masscorrfac(igcm_n2)
+        endif
+
+        if (igcm_ar .ne. 0 .and. (.not. firstcall .or. found_startfi_ar)) then
+            masscorrfac(igcm_ar) = mass_predyn(igcm_ar) / mass_postdyn(igcm_ar)
+            pq_corrdyn(:, :, igcm_ar) = pq(:, :, igcm_ar) * masscorrfac(igcm_ar)
+        endif
+
+        if (igcm_he .ne. 0 .and. (.not. firstcall .or. found_startfi_he)) then
+            masscorrfac(igcm_he) = mass_predyn(igcm_he) / mass_postdyn(igcm_he)
+            pq_corrdyn(:, :, igcm_he) = pq(:, :, igcm_he) * masscorrfac(igcm_he)
+        endif
+
+        pdq_corrdyn = (pq_corrdyn - pq) / ptimestep
+
+    end subroutine tracer_mass_fixer_dyn
+
+    subroutine compute_tracer_mass_global(ngrid, nlayer, nq, pq, zplev, mass)
+
+        use tracer_mod, only: mmol
+        use comcstfi_h, only: g
+        use geometry_mod, only: cell_area
+        use tracer_mod, only: noms
+        use planetwide_mod, only: planetwide_sumval
+
+        implicit none
+
+        integer, intent(in)  :: ngrid                    ! number of atmospheric columns
+        integer, intent(in)  :: nlayer                   ! number of atmospheric layers
+        integer, intent(in)  :: nq                       ! number of tracers in traceur.def
+        real,    intent(in)  :: pq(ngrid, nlayer, nq)    ! tracer mass mixing ratios (kg per 1 kg of air)
+        real,    intent(in)  :: zplev(ngrid, nlayer + 1) ! inter-layer pressure (Pa)
+        real,    intent(out) :: mass(nq)                 ! tracer mass in the whole atmosphere
+
+        real    colden(ngrid, nq) ! tracer column density (molecules cm-2)
+        integer iq, ig, l
+
+        do iq = 1, nq
+            if (noms(iq) .eq. "co" .or. &
+                noms(iq) .eq. "o2" .or. &
+                noms(iq) .eq. "h2" .or. &
+                noms(iq) .eq. "ho2" .or. &
+                noms(iq) .eq. "h2o2" .or. &
+                noms(iq) .eq. "n2" .or. &
+                noms(iq) .eq. "ar" .or. &
+                noms(iq) .eq. "he") then
+
+                do ig = 1, ngrid
+                    colden(ig, iq) = 0.
+                enddo
+
+                do l = 1, nlayer
+                    do ig = 1, ngrid
+                        colden(ig, iq) = colden(ig, iq) + & 
+                                         pq(ig, l, iq) *  &
+                                         (zplev(ig, l) - zplev(ig, l+1)) * &
+                                         6.022e22 / (mmol(iq) * g)
+                    enddo
+                enddo
+
+                call planetwide_sumval( &
+                     colden(:, iq) / 6.022e23 * mmol(iq) * 1.e4 * cell_area, &
+                     mass(iq) )
+
+            endif
+        enddo
+
+    end subroutine compute_tracer_mass_global
+
+    subroutine set_mass_predyn_from_startfi
+
+        use tracer_mod, only: igcm_co, igcm_o2, igcm_h2, igcm_ho2, &
+                              igcm_h2o2, igcm_n2, igcm_ar, igcm_he
+
+        implicit none
+
+        if (igcm_co.ne.0 .and. found_startfi_co) then
+            mass_predyn(igcm_co) = mass_predyn_co
+        endif
+        
+        if (igcm_o2.ne.0 .and. found_startfi_o2) then
+            mass_predyn(igcm_o2) = mass_predyn_o2
+        endif
+
+        if (igcm_h2.ne.0 .and. found_startfi_h2) then
+            mass_predyn(igcm_h2) = mass_predyn_h2
+        endif
+
+        if (igcm_ho2.ne.0 .and. found_startfi_ho2) then
+            mass_predyn(igcm_ho2) = mass_predyn_ho2
+        endif
+
+        if (igcm_h2o2.ne.0 .and. found_startfi_h2o2) then
+            mass_predyn(igcm_h2o2) = mass_predyn_h2o2
+        endif
+
+        if (igcm_n2.ne.0 .and. found_startfi_n2) then
+            mass_predyn(igcm_n2) = mass_predyn_n2
+        endif
+        
+        if (igcm_ar.ne.0 .and. found_startfi_ar) then
+            mass_predyn(igcm_ar) = mass_predyn_ar
+        endif
+
+        if (igcm_he.ne.0 .and. found_startfi_he) then
+            mass_predyn(igcm_he) = mass_predyn_he
+        endif
+
+    end subroutine set_mass_predyn_from_startfi
+
+    subroutine ini_tracer_mass_fixer_dyn(nq)
+
+        implicit none
+
+        integer, intent(in) :: nq  ! number of tracers in traceur.def
+
+        allocate(mass_predyn(nq))
+
+    end subroutine ini_tracer_mass_fixer_dyn
+
+    subroutine end_tracer_mass_fixer_dyn
+
+        implicit none
+
+        if (allocated(mass_predyn)) deallocate(mass_predyn)
+
+    end subroutine end_tracer_mass_fixer_dyn
+
+end module tracer_mass_fixer_dyn_mod
