Index: LMDZ5/branches/LMDZ5_SPLA/libf/phylmd/physiq.F90
===================================================================
--- LMDZ5/branches/LMDZ5_SPLA/libf/phylmd/physiq.F90	(revision 2174)
+++ LMDZ5/branches/LMDZ5_SPLA/libf/phylmd/physiq.F90	(revision 2175)
@@ -50,5 +50,8 @@
 #endif
   USE indice_sol_mod
-  USE phytrac_mod, ONLY : phytrac
+!JE20140507<<
+!  USE phytrac_mod, ONLY : phytrac
+  USE phytracr_spl_mod, ONLY : phytracr_spl, readregions_spl, readregionsdims2_spl, readscaleparams_spl , readscaleparamsnc_spl
+!JE20140507>>
 
 #ifdef CPP_RRTM
@@ -116,4 +119,5 @@
   include "iniprint.h"
   include "thermcell.h"
+  include "chem.h"  !SPLA
   !======================================================================
   LOGICAL ok_cvl  ! pour activer le nouveau driver pour convection KE
@@ -853,4 +857,128 @@
   REAL zzz
 
+  !ccccccccccccccccccccccccccccccccccccccccccccccccccccc
+  !cJE nov2013
+  !c  SPLA variable declaration
+  !c
+  !c
+  INTEGER ngridmx
+  !!c     integer nbsrf
+  !!c      PARAMETER (ngridmx=iim*(jjm-1)+2,nbsrf=4)
+  parameter (ngridmx=iim*(jjm-1)+2)
+  REAL,SAVE  :: scale_param_ssacc  !Scaling parameter for Fine Sea Salt
+  REAL,SAVE ::  scale_param_sscoa  !Scaling parameter for Coarse Sea Salt
+!  REAL scale_param_ind(nbreg_ind) !Scaling parameter for industrial emissions of SO2
+!  REAL scale_param_bb(nbreg_bb)  !Scaling parameter for biomas burning (SO2,BC & OM)
+!  REAL scale_param_ff(nbreg_ind)  !Scaling parameter for industrial emissions (fossil fuel)
+!  REAL scale_param_dustacc(nbreg_dust)  !Scaling parameter for Fine Dust
+!  REAL scale_param_dustcoa(nbreg_dust)  !Scaling parameter for Coarse Dust
+!  REAL scale_param_dustsco(nbreg_dust)  !Scaling parameter for SCoarse Dust
+  REAL, DIMENSION(:),ALLOCATABLE,SAVE :: scale_param_ind !Scaling parameter for industrial emissions of SO2
+  REAL, DIMENSION(:),ALLOCATABLE,SAVE :: scale_param_bb  !Scaling parameter for biomas burning (SO2,BC & OM)
+  REAL, DIMENSION(:),ALLOCATABLE,SAVE :: scale_param_ff  !Scaling parameter for industrial emissions (fossil fuel)
+  REAL, DIMENSION(:),ALLOCATABLE,SAVE :: scale_param_dustacc  !Scaling parameter for Fine Dust
+  REAL, DIMENSION(:),ALLOCATABLE,SAVE :: scale_param_dustcoa  !Scaling parameter for Coarse Dust
+  REAL, DIMENSION(:),ALLOCATABLE,SAVE :: scale_param_dustsco  !Scaling parameter for SCoarse Dust
+  REAL, DIMENSION(:),ALLOCATABLE,SAVE :: param_wstarBLperregion  !parameter for ..
+  REAL, DIMENSION(:),ALLOCATABLE,SAVE :: param_wstarWAKEperregion  !parameter for ..
+  !$OMP THREADPRIVATE(scale_param_ind,scale_param_bb,scale_param_ff)
+  !$OMP THREADPRIVATE(scale_param_dustacc,scale_param_dustcoa,scale_param_dustsco)
+  !$OMP THREADPRIVATE(scale_param_ssacc,scale_param_sscoa)
+  !$OMP THREADPRIVATE(param_wstarBLperregion,param_wstarWAKEperregion)
+  REAL, dimension(ngridmx) :: dust_ec, u10m_ec, v10m_ec
+  INTEGER, SAVE :: nbreg_dust, nbreg_ind, nbreg_bb, nbreg_ss,nbreg_wstardust
+  !$OMP THREADPRIVATE(nbreg_dust, nbreg_ind, nbreg_bb,nbreg_ss,nbreg_wstardust)
+  CHARACTER*800 fileregionsdimsind
+  CHARACTER*800 fileregionsdimsdust
+  CHARACTER*800 fileregionsdimsbb
+  CHARACTER*800 fileregionsdimswstar
+!  CHARACTER*800 filescaleparamsind
+!  CHARACTER*800 filescaleparamsdust
+!  CHARACTER*800 filescaleparamsbb
+  CHARACTER*100 paramname_ind
+  CHARACTER*100 paramname_bb
+  CHARACTER*100 paramname_ff
+  CHARACTER*100 paramname_dustacc
+  CHARACTER*100 paramname_dustcoa
+  CHARACTER*100 paramname_dustsco
+  CHARACTER*100 paramname_ssacc
+  CHARACTER*100 paramname_sscoa
+  CHARACTER*100 paramname_wstarBL
+  CHARACTER*100 paramname_wstarWAKE
+
+
+  CHARACTER*800 filescaleparams
+  CHARACTER*800 paramsname
+
+
+  !!------------------------ SULFUR emissions ----------------------------
+  REAL lmt_so2volc_cont(ngridmx)  ! emissions so2 volcan continuous
+  REAL lmt_altvolc_cont(ngridmx)  ! altitude  so2 volcan continuous
+  REAL lmt_so2volc_expl(ngridmx)  ! emissions so2 volcan explosive
+  REAL lmt_altvolc_expl(ngridmx)  ! altitude  so2 volcan explosive
+  REAL lmt_so2ff_l(ngridmx)       ! emissions so2 fossil fuel (low)
+  REAL lmt_so2ff_h(ngridmx)       ! emissions so2 fossil fuel (high)
+  REAL lmt_so2nff(ngridmx)        ! emissions so2 non-fossil fuel
+  REAL lmt_so2ba(ngridmx)         ! emissions de so2 bateau
+  REAL lmt_so2bb_l(ngridmx)       ! emissions de so2 biomass burning (low)
+  REAL lmt_so2bb_h(ngridmx)       ! emissions de so2 biomass burning (high)
+  REAL lmt_dmsconc(ngridmx)       ! concentration de dms oceanique
+  REAL lmt_dmsbio(ngridmx)        ! emissions de dms bio
+  REAL lmt_h2sbio(ngridmx)        ! emissions de h2s bio
+  !------------------------- BLACK CARBON emissions ----------------------
+  REAL lmt_bcff(ngridmx)       ! emissions de BC fossil fuels
+  REAL lmt_bcnff(ngridmx)      ! emissions de BC non-fossil fuels
+  REAL lmt_bcbb_l(ngridmx)     ! emissions de BC biomass basses
+  REAL lmt_bcbb_h(ngridmx)     ! emissions de BC biomass hautes
+  REAL lmt_bcba(ngridmx)       ! emissions de BC bateau
+  !------------------------ ORGANIC MATTER emissions ---------------------
+  REAL lmt_omff(ngridmx)     ! emissions de OM fossil fuels
+  REAL lmt_omnff(ngridmx)    ! emissions de OM non-fossil fuels
+  REAL lmt_ombb_l(ngridmx)   ! emissions de OM biomass basses
+  REAL lmt_ombb_h(ngridmx)   ! emissions de OM biomass hautes
+  REAL lmt_omnat(ngridmx)    ! emissions de OM Natural
+  REAL lmt_omba(ngridmx)     ! emissions de OM bateau
+
+  REAL lmt_sea_salt(ngridmx,ss_bins)    ! emissions de OM Natural
+  SAVE lmt_bcff,lmt_bcnff,lmt_bcbb_l,lmt_bcbb_h,lmt_bcba
+  SAVE lmt_omff,lmt_omnff,lmt_ombb_l,lmt_ombb_h,lmt_omnat,lmt_omba
+  SAVE lmt_so2ff_l,lmt_so2ff_h,lmt_so2nff,lmt_so2bb_l,lmt_so2bb_h
+  SAVE lmt_so2ba,lmt_so2volc_cont,lmt_altvolc_cont,lmt_so2volc_expl
+  SAVE lmt_altvolc_expl,lmt_dmsconc,lmt_dmsbio,lmt_h2sbio
+  !$OMP THREADPRIVATE(lmt_bcff,lmt_bcnff,lmt_bcbb_l,lmt_bcbb_h,lmt_bcba)
+  !$OMP THREADPRIVATE(lmt_omff,lmt_omnff,lmt_ombb_l,lmt_ombb_h,lmt_omnat,lmt_omba)
+  !$OMP THREADPRIVATE(lmt_so2ff_l,lmt_so2ff_h,lmt_so2nff,lmt_so2bb_l,lmt_so2bb_h)
+  !$OMP THREADPRIVATE(lmt_so2ba,lmt_so2volc_cont,lmt_altvolc_cont,lmt_so2volc_expl)
+  !$OMP THREADPRIVATE(lmt_altvolc_expl,lmt_dmsconc,lmt_dmsbio,lmt_h2sbio)
+
+  !-output phytrac variables
+  REAL diff_aod550_tot(ngridmx)  ! epaisseur optique total aerosol 550  nm
+  REAL diag_aod865_tot(ngridmx)  ! epaisseur optique total aerosol 865 nm
+  REAL diff_aod550_tr2(ngridmx)  ! epaisseur optique Traceur 2 aerosol 550 nm, diagnostic
+  REAL diag_aod865_tr2(ngridmx)  ! epaisseur optique Traceur 2 aerosol 865 nm, diagnostic
+  REAL diag_aod550_dust(ngridmx) ! epaisseur optique Dust coarse aerosol 550 nm, diagnostic
+  REAL diag_aod865_dust(ngridmx) ! epaisseur optique Dust coarse aerosol 865 nm, diagnostic
+  REAL diag_aod550_dustsco(ngridmx) ! epaisseur optique Dust SCOarse aerosol 550 nm, diagnostic
+  REAL diag_aod865_dustsco(ngridmx) ! epaisseur optique Dust SCOarse aerosol 865 nm, diagnostic
+  REAL diag_aod550_ss(ngridmx)   ! epaisseur optique Sels marins aerosol 550 nm, diagnostic
+  REAL diag_aod865_ss(ngridmx)   ! epaisseur optique Sels marins aerosol 865 nm, diagnostic
+  ! others
+  REAL tsol(ngridmx)
+  INTEGER :: ijulday
+  LOGICAL , parameter :: edgar = .true.
+  INTEGER , parameter :: flag_dms=4
+  INTEGER*4  nbjour
+  !c
+  !c end  SPLA variable declaration
+  !c JE 2013112
+  !c      print *,'Are you reading this line???????????????  JE0 '
+  !cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+ 
+!   DO i=1,6
+!   print *,'JE: i= ',i
+!   CALL checknanqfi(qx(:,:,i),1.,-1.,' q+tr realbeg physiq L959')
+!   ENDDO
+  
+
   !======================================================================
   ! Gestion calendrier : mise a jour du module phys_cal_mod
@@ -1450,5 +1578,10 @@
      ENDDO
   ENDDO
+!  !JE
+!  DO i=1,4 
+!   CALL checknanqfi(tr_seri(:,:,i),1.,-1.,' tr beginig physiq L1559')
+!  ENDDO
   !IM
+
   IF (ip_ebil_phy.ge.1) THEN 
      ztit='after dynamic'
@@ -3459,28 +3592,268 @@
   END IF
 
-  call phytrac ( &
-       itap,     days_elapsed+1,    jH_cur,   debut, &
-       lafin,    dtime,     u, v,     t, &
-       paprs,    pplay,     pmfu,     pmfd, &
-       pen_u,    pde_u,     pen_d,    pde_d, &
-       cdragh,   coefh(1:klon,1:klev,is_ave),   fm_therm, entr_therm, &
-       u1,       v1,        ftsol,    pctsrf, &
-       zustar,   zu10m,     zv10m, &
-       wstar(:,is_ave),    ale_bl,         ale_wake, &
-       rlat,     rlon, &
-       frac_impa,frac_nucl, beta_prec_fisrt,beta_prec, &
-       presnivs, pphis,     pphi,     albsol1, &
-       sh_in,    rhcl,      cldfra,   rneb, &
-       diafra,   cldliq,    itop_con, ibas_con, &
-       pmflxr,   pmflxs,    prfl,     psfl, &
-       da,       phi,       mp,       upwd, &
-       phi2,     d1a,       dam,      sij, wght_cvfd, &        !<<RomP+RL
-       wdtrainA, wdtrainM,  sigd,     clw,elij, &   !<<RomP
-       ev,       ep,        epmlmMm,  eplaMm, &     !<<RomP
-       dnwd,     aerosol_couple,      flxmass_w, &
-       tau_aero, piz_aero,  cg_aero,  ccm, &
-       rfname, &
-       d_tr_dyn, &                                 !<<RomP
-       tr_seri)
+  !JE ------------ SPLA ----------------
+!  IF(.FALSE.) THEN
+!   call phytrac ( &
+!       itap,     days_elapsed+1,    jH_cur,   debut, &
+!       lafin,    dtime,     u, v,     t, &
+!       paprs,    pplay,     pmfu,     pmfd, &
+!       pen_u,    pde_u,     pen_d,    pde_d, &
+!       cdragh,   coefh(1:klon,1:klev,is_ave),   fm_therm, entr_therm, &
+!       u1,       v1,        ftsol,    pctsrf, &
+!       zustar,   zu10m,     zv10m, &
+!       wstar(:,is_ave),    ale_bl,         ale_wake, &
+!       rlat,     rlon, &
+!       frac_impa,frac_nucl, beta_prec_fisrt,beta_prec, &
+!       presnivs, pphis,     pphi,     albsol1, &
+!       sh_in,    rhcl,      cldfra,   rneb, &
+!       diafra,   cldliq,    itop_con, ibas_con, &
+!       pmflxr,   pmflxs,    prfl,     psfl, &
+!       da,       phi,       mp,       upwd, &
+!       phi2,     d1a,       dam,      sij, wght_cvfd, &        !<<RomP+RL
+!       wdtrainA, wdtrainM,  sigd,     clw,elij, &   !<<RomP
+!       ev,       ep,        epmlmMm,  eplaMm, &     !<<RomP
+!       dnwd,     aerosol_couple,      flxmass_w, &
+!       tau_aero, piz_aero,  cg_aero,  ccm, &
+!       rfname, &
+!       d_tr_dyn, &                                 !<<RomP
+ !      tr_seri)
+ !ENDIF
+ IF (.TRUE.) THEN
+! DO i=1,nbtr
+! print *,'it check = ',i
+! CALL checknanqfi(tr_seri(:,:,i),1.,-1.,' tr before all')
+! CALL checknanqfi(q_seri(:,:),1.,-1.,' q before all')
+! CALL checknanqfi(t(:,:),1.,-1.,' t before all')
+! CALL checknanqfi(da(:,:),1.,-1.,' da before all')
+! !CALL checknanqfi(t_seri(:,:),1.,-1.,' t_seri before all')
+! ENDDO
+
+!  print*, 'mpi_size', mpi_size
+ ! print*, 'omp_size', omp_size
+
+
+  print *,'before spl...'
+  if (debut) then
+  nbreg_ind=1
+  nbreg_bb=1
+  nbreg_dust=1
+  nbreg_wstardust=1
+  fileregionsdimsind='regions_ind_meta'
+  fileregionsdimsdust='regions_dustacc_meta'
+  fileregionsdimsbb='regions_bb_meta'
+  fileregionsdimswstar='regions_pwstarwake_meta'
+  !nbreg_dust=readregionsdims_spl('hola')
+!  call  readregionsdims_spl(nbreg_ind,fileregionsdimsind, &
+!                            nbreg_dust,fileregionsdimsdust, &
+!                            nbreg_bb,fileregionsdimsbb)
+  call  readregionsdims2_spl(nbreg_ind,fileregionsdimsind)
+  call  readregionsdims2_spl(nbreg_dust,fileregionsdimsdust)
+  call  readregionsdims2_spl(nbreg_bb,fileregionsdimsbb)
+  call  readregionsdims2_spl(nbreg_wstardust,fileregionsdimswstar)
+
+!readregions_spl()
+
+  ALLOCATE(scale_param_ind(nbreg_ind))
+  ALLOCATE(scale_param_bb(nbreg_bb))
+  ALLOCATE(scale_param_ff(nbreg_ind))
+  ALLOCATE(scale_param_dustacc(nbreg_dust))
+  ALLOCATE(scale_param_dustcoa(nbreg_dust))
+  ALLOCATE(scale_param_dustsco(nbreg_dust))
+  ALLOCATE(param_wstarBLperregion(nbreg_wstardust))
+  ALLOCATE(param_wstarWAKEperregion(nbreg_wstardust))
+!   endif
+
+  !temporal hardcoded null inicialization of assimilation emmision factors
+  scale_param_ssacc=1.
+  scale_param_sscoa=1.
+  scale_param_ind(:)=1.
+  scale_param_bb(:)=1.
+  scale_param_ff(:)=1.
+  scale_param_dustacc(:)=1.
+  scale_param_dustcoa(:)=1.
+  scale_param_dustsco(:)=1.
+  param_wstarBLperregion(:)=1.
+  param_wstarWAKEperregion(:)=0.25
+
+!  filescaleparamsind='modind.bin'
+!  filescaleparamsdust='moddust.bin'
+!  filescaleparamsbb='modbb.bin'
+!  call  readscaleparams_spl(scale_param_ind, nbreg_ind, filescaleparamsind)
+!  call  readscaleparams_spl(scale_param_ff, nbreg_ind, filescaleparamsind)
+!  call  readscaleparams_spl(scale_param_bb, nbreg_bb, filescaleparamsbb)
+!  call  readscaleparams_spl(scale_param_dustacc, nbreg_dust, filescaleparamsdust)
+!  call  readscaleparams_spl(scale_param_dustcoa, nbreg_dust, filescaleparamsdust)
+!  call  readscaleparams_spl(scale_param_dustsco, nbreg_dust, filescaleparamsdust)
+
+  endif  
+
+  ! -- calcul de tsol
+  tsol = SUM(ftsol,dim=2)
+  ijulday=jD_cur-jD_1jan+1
+  nbjour = 1
+!  paramsname='dust'
+!  call readscaleparamsnc_spl(scale_param_dustsco, nbreg_dust, &
+!  filescaleparams,paramsname,ijulday,jH_cur, pdtphys,debut)
+
+  paramname_ind='ind'
+  paramname_bb='bb'
+  paramname_ff='ind'
+  paramname_dustacc='dustacc'
+  paramname_dustcoa='dustcoasco'
+  paramname_dustsco='dustcoasco'
+  paramname_wstarBL='pwstarbl'
+  paramname_wstarWAKE='pwstarwake'
+  paramname_ssacc='ss'
+  paramname_sscoa='ss'
+
+  filescaleparams='modvalues.nc'
+  CALL readscaleparamsnc_spl(scale_param_ind,                        &
+        nbreg_ind, paramname_ind,                                    &
+        scale_param_ff, nbreg_ind,paramname_ff,                      &
+        scale_param_bb, nbreg_bb,paramname_bb,                       &
+        scale_param_dustacc, nbreg_dust,paramname_dustacc,           &
+        scale_param_dustcoa, nbreg_dust,paramname_dustcoa,           &
+        scale_param_dustsco, nbreg_dust,paramname_dustsco,           &
+        param_wstarBLperregion, nbreg_wstardust, paramname_wstarBL, &
+        param_wstarWAKEperregion, nbreg_wstardust, paramname_wstarWAKE, &
+        scale_param_ssacc  ,  paramname_ssacc,                    &
+        scale_param_sscoa  ,  paramname_sscoa,                    &
+           filescaleparams,ijulday,jH_cur, pdtphys,debut)
+! add seasalt
+
+  print *,'JE : check scale_params'
+
+  print *, 'nbreg_ind', nbreg_ind   
+  print *, 'nbreg_dust', nbreg_dust  
+  print *, 'nbreg_bb', nbreg_bb   
+  print *, 'ind', scale_param_ind   
+  print *, 'dustacc', scale_param_dustacc  
+  print *, 'dustcoa', scale_param_dustcoa  
+  print *, 'dustsco', scale_param_dustsco
+  print *, 'wstardustBL', param_wstarBLperregion
+  print *, 'wstardustWAKE', param_wstarWAKEperregion
+  print *, 'dustsco', scale_param_dustsco
+  print *, 'ff', scale_param_ff  
+  print *, 'bb', scale_param_bb  
+  print *, 'ssacc', scale_param_ssacc
+  print *, 'sscoa', scale_param_sscoa
+
+  print *,'JE: before read_newemissions '
+  print *,'JE: jD_cur:',jD_cur,' ijulday:',ijulday,' jH_cur:',jH_cur,' pdtphys:',pdtphys
+  print *,'JE: now read_newemissions:'
+  call read_newemissions(ijulday,jH_cur ,edgar, flag_dms,debut, & !I
+                         pdtphys, lafin, nbjour, pctsrf,  &       !I
+                         t, rlat, rlon, &                         !I
+                         pmflxr, pmflxs, prfl, psfl, &            !I
+                                 u10m_ec, v10m_ec, dust_ec, &     !O
+                                 lmt_sea_salt, lmt_so2ff_l, &     !O
+                                 lmt_so2ff_h, lmt_so2nff, &       !O
+                                 lmt_so2ba, lmt_so2bb_l, lmt_so2bb_h, &  !O
+                                 lmt_so2volc_cont, lmt_altvolc_cont, &   !O
+                                 lmt_so2volc_expl, lmt_altvolc_expl, &   !O
+                                 lmt_dmsbio, lmt_h2sbio, lmt_dmsconc, &  !O
+                                 lmt_bcff, lmt_bcnff, lmt_bcbb_l, &      !O
+                                 lmt_bcbb_h, lmt_bcba, lmt_omff, &       !O
+                                 lmt_omnff, lmt_ombb_l, lmt_ombb_h, &    !O
+                                 lmt_omnat, lmt_omba)                    !O
+
+
+  print *,'Check emissions'
+  print *,'lmt_so2ff_l' , MINVAL(lmt_so2ff_l), MAXVAL(lmt_so2ff_l)
+  print *,'lmt_so2ff_h' , MINVAL(lmt_so2ff_h), MAXVAL(lmt_so2ff_h)
+  print *,'lmt_so2nff' , MINVAL(lmt_so2nff), MAXVAL(lmt_so2nff)
+  print *,'lmt_so2ba' , MINVAL(lmt_so2ba), MAXVAL(lmt_so2ba)
+  print *,'lmt_so2bb_l' , MINVAL(lmt_so2bb_l), MAXVAL(lmt_so2bb_l)
+  print *,'lmt_so2bb_h' , MINVAL(lmt_so2bb_h), MAXVAL(lmt_so2bb_h)
+  print *,'lmt_so2volc_cont' , MINVAL(lmt_so2volc_cont), MAXVAL(lmt_so2volc_cont)
+  print *,'lmt_altvolc_cont' , MINVAL(lmt_altvolc_cont), MAXVAL(lmt_altvolc_cont)
+  print *,'lmt_so2volc_expl' , MINVAL(lmt_so2volc_expl), MAXVAL(lmt_so2volc_expl)
+  print *,'lmt_altvolc_expl' , MINVAL(lmt_altvolc_expl), MAXVAL(lmt_altvolc_expl)
+  print *,'lmt_dmsbio' , MINVAL(lmt_dmsbio), MAXVAL(lmt_dmsbio)
+  print *,'lmt_h2sbio' , MINVAL(lmt_h2sbio), MAXVAL(lmt_h2sbio)
+  print *,'lmt_dmsconc' , MINVAL(lmt_dmsconc), MAXVAL(lmt_dmsconc)
+  print *,'lmt_bcff' , MINVAL(lmt_bcff), MAXVAL(lmt_bcff)
+  print *,'lmt_bcnff' , MINVAL(lmt_bcnff), MAXVAL(lmt_bcnff)
+  print *,'lmt_bcbb_l' , MINVAL(lmt_bcbb_l), MAXVAL(lmt_bcbb_l)
+  print *,'lmt_bcbb_h' , MINVAL(lmt_bcbb_h), MAXVAL(lmt_bcbb_h)
+  print *,'lmt_bcba' , MINVAL(lmt_bcba), MAXVAL(lmt_bcba)
+  print *,'lmt_omff' , MINVAL(lmt_omff), MAXVAL(lmt_omff)
+  print *,'lmt_omnff' , MINVAL(lmt_omnff), MAXVAL(lmt_omnff)
+  print *,'lmt_ombb_l' , MINVAL(lmt_ombb_l), MAXVAL(lmt_ombb_l)
+  print *,'lmt_ombb_h' , MINVAL(lmt_ombb_h), MAXVAL(lmt_ombb_h)
+  print *,'lmt_omnat' , MINVAL(lmt_omnat), MAXVAL(lmt_omnat)
+  print *,'lmt_omba' , MINVAL(lmt_omba), MAXVAL(lmt_omba)
+  !        CALL minmaxqfi2(clwcon,1e33,-1e33,'clwcon')
+  !        CALL minmaxqfi2(cldliq,1e33,-1e33,'cldliq')
+  !!        CALL minmaxqfi2(clwcon(:,:)/rnebcon(:,:),1e33,-1e33, 'clwcon/rnebcon')
+  !        CALL minmaxqfi2(clw,1e33,-1e33,'clw')
+  !        CALL minmaxqfi2(flwc,1e33,-1e33,'flwc')
+  !!        CALL minmaxqfi2(clw(:,:)*rnebcon(:,:),1e33,-1e33, 'clw*rnebcon')
+  !!        CALL minmaxqfi2(clwcon(:,:)*rnebcon(:,:),1e33,-1e33, 'clwcon*rnebcon')
+  print *,'JE iflag_con',iflag_con
+! DO i=1,nbtr
+! print *,'it check = ',i
+! CALL checknanqfi(tr_seri(:,:,i),1.,-1.,' tr before phytracr')
+! CALL checknanqfi(q_seri(:,:),1.,-1.,' q before phytracr')
+! CALL checknanqfi(t(:,:),1.,-1.,' t before phytracr')
+! !CALL checknanqfi(t_seri(:,:),1.,-1.,' t_seri before phytracr')
+! ENDDO
+
+
+
+  CALL phytracr_spl (debut,jD_cur,jH_cur,iflag_con, & !I
+                  pdtphys,ftsol,tsol, & !I
+!                  t_seri,q_seri,paprs,pplay,rhcl, & !I  !JE20140506 newfeed
+                  t,q_seri,paprs,pplay,rhcl, & !I
+                  pmfu, pmfd, pen_u, pde_u, pen_d, pde_d, & !I
+                  coefh(1:klon,1:klev,is_ave), cdragh, cdragm, u1, v1, & !I
+                  u_seri, v_seri, rlat,rlon, & !I
+                  pphis,pctsrf,pmflxr,pmflxs,prfl,psfl, & !I
+                  da,phi,phi2,d1a,dam,mp,ep,sigd,sij,clw,elij, & !I
+                  epmlmMm,eplaMm,upwd,dnwd,itop_con,ibas_con, & !I
+                  ev,wdtrainA,  wdtrainM, wght_cvfd, & !I
+                  fm_therm, entr_therm,rneb, & !I
+                  beta_prec_fisrt,beta_prec, & !I
+                  zu10m,zv10m,wstar(:,is_ave),ale_bl,ale_wake, &
+                  scale_param_ssacc, & !P
+                  scale_param_sscoa,scale_param_ind, & !P
+                  scale_param_bb,scale_param_ff, & !P
+                  scale_param_dustacc,scale_param_dustcoa, & !P
+                  scale_param_dustsco, & !P
+                  nbreg_dust,nbreg_ind,nbreg_bb, & !P
+                  param_wstarBLperregion,param_wstarWAKEperregion, &  !P
+                  nbreg_wstardust,  & !P 
+                  dust_ec,u10m_ec, v10m_ec, & !E
+                  lmt_sea_salt, & !E
+                  lmt_so2ff_l, lmt_so2ff_h, lmt_so2nff, & !E
+                  lmt_so2ba, lmt_so2bb_l, lmt_so2bb_h, & !E
+                  lmt_so2volc_cont, lmt_altvolc_cont, & !E
+                  lmt_so2volc_expl, lmt_altvolc_expl, & !E
+                  lmt_dmsbio, lmt_h2sbio, lmt_dmsconc, & !E
+                  lmt_bcff, lmt_bcnff, lmt_bcbb_l, lmt_bcbb_h, & !E
+                  lmt_bcba, & !E
+                  lmt_omff, lmt_omnff, lmt_ombb_l, lmt_ombb_h, & !E
+                  lmt_omnat, lmt_omba, & !E
+                  tr_seri, & !O
+                  diff_aod550_tot,diag_aod865_tot, & !O
+                  diff_aod550_tr2,diag_aod865_tr2, & !O
+                  diag_aod550_dust,diag_aod865_dust, & !O
+                  diag_aod550_dustsco,diag_aod865_dustsco, & !O
+                  diag_aod550_ss,diag_aod865_ss) !O
+!  ENDIF
+!   DO i=1,nbtr
+!   print *,'it check = ',i
+!   CALL checknanqfi(tr_seri(:,:,i),1.,-1.,' tr after phytracr')
+!   CALL checknanqfi(q_seri(:,:),1.,-1.,' q after phytracr')
+!   CALL checknanqfi(t(:,:),1.,-1.,' t after phytracr')
+!   !CALL checknanqfi(t_seri(:,:),1.,-1.,' t_seri before phytracr')
+!   ENDDO
+  !JE end
+
+   ENDIF
+
+
+
+
 
   IF (offline) THEN
@@ -3769,4 +4142,5 @@
 
   !On effectue les sorties:
+  print *,' JE: aqui deberia escribir la salida!!!!!!!!!!'
 
   CALL phys_output_write(itap, pdtphys, paprs, pphis,               &
@@ -3863,5 +4237,4 @@
 
   !      first=.false.
-
   RETURN
 END SUBROUTINE physiq
