Ignore:
Timestamp:
Sep 11, 2013, 2:34:44 PM (12 years ago)
Author:
emillour
Message:

Mars GCM: (a first step towards using parallel dynamics)

  • IMPORTANT CHANGE: Implemented dynamic tracers. It is no longer necessary to compile the model with the '-t #' option, number of tracers is simply read from tracer.def file (as before). Adapted makegcm_* scripts (and co.) accordingly. Technical aspects of the switch to dynamic tracers are:
    • advtrac.h (in dyn3d) removed and replaced by module infotrac.F
    • tracer.h (in phymars) removed and replaced by module tracer_mod.F90 (which contains nqmx, the number of tracers, etc. and can be used anywhere in the physics).
  • Included some side cleanups: removed unused files (in dyn3d) anldoppler2.F, anl_mcdstats.F and anl_stats-diag.F, and all the unecessary dimensions.* files in grid/dimension.
  • Checked that changes are clean and that GCM yields identical results (in debug mode) to previous svn version.

EM

Location:
trunk/LMDZ.MARS/libf/phymars
Files:
1 added
1 deleted
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/libf/phymars/aeropacity.F

    r677 r1036  
    44                                                   
    55! to use  'getin'
    6       USE ioipsl_getincom
     6      USE ioipsl_getincom, only: getin
     7      use tracer_mod, only: noms, igcm_h2o_ice, igcm_dust_mass,
     8     &                      igcm_dust_submicron, rho_dust, rho_ice
    79       IMPLICIT NONE
    810c=======================================================================
     
    5355#include "dimradmars.h"
    5456#include "yomaer.h"
    55 #include "tracer.h"
     57!#include "tracer.h"
    5658#include "planete.h"
    5759#include "aerkind.h"
     
    119121
    120122! indexes of water ice and dust tracers:
    121       INTEGER,SAVE :: nqdust(nqmx) ! to store the indexes of dust tracers
     123      INTEGER,ALLOCATABLE,SAVE :: nqdust(:) ! to store the indexes of dust tracers
    122124      INTEGER,SAVE :: i_ice=0  ! water ice
    123125      real,parameter :: odpref=610. ! DOD reference pressure (Pa)
     
    143145        ENDDO
    144146        ! identify tracers which are dust
     147        allocate(nqdust(nq))
    145148        i=0
    146149        DO iq=1,nq
  • trunk/LMDZ.MARS/libf/phymars/callradite.F

    r740 r1036  
    272272          name_iaer(1) = "dust_conrath"   !! default choice is good old Conrath profile
    273273          IF (doubleq.AND.active) name_iaer(1) = "dust_doubleq" !! two-moment scheme
    274           if (nqmx.gt.1) then
     274          if (nq.gt.1) then
    275275           ! trick to avoid problems compiling with 1 tracer
    276276           ! and picky compilers who know name_iaer(2) is out of bounds
     
    278278          IF (water.AND.activice) name_iaer(j) = "h2o_ice"      !! radiatively-active clouds
    279279          IF (submicron.AND.active) name_iaer(j) = "dust_submicron" !! JBM experimental stuff
    280           endif ! of if (nqmx.gt.1)
     280          endif ! of if (nq.gt.1)
    281281c        ----------------------------------------------------------
    282282
  • trunk/LMDZ.MARS/libf/phymars/callsedim.F

    r1005 r1036  
    55     &                tau,tauscaling)
    66! to use  'getin'
    7       USE ioipsl_getincom
    8       USE updaterad,only: updaterdust,updaterice_micro,updaterice_typ
     7      USE ioipsl_getincom, only: getin
     8      USE updaterad, only: updaterdust,updaterice_micro,updaterice_typ
     9      USE tracer_mod, only: noms, igcm_dust_mass, igcm_dust_number,
     10     &                      rho_dust, rho_q, radius, varian,
     11     &                      igcm_ccn_mass, igcm_ccn_number,
     12     &                      igcm_h2o_ice, nuice_sed, nuice_ref
    913      IMPLICIT NONE
    1014
     
    2832#include "dimphys.h"
    2933#include "comcstfi.h"
    30 #include "tracer.h"
     34!#include "tracer.h"
    3135#include "callkeys.h"
    3236
  • trunk/LMDZ.MARS/libf/phymars/calltherm_interface.F90

    r1033 r1036  
    4545
    4646      use comtherm_h
     47      use tracer_mod, only: nqmx,noms
    4748      implicit none
    4849
  • trunk/LMDZ.MARS/libf/phymars/convadj.F

    r161 r1036  
    66     &                   pdqadj)
    77
     8      use tracer_mod, only: noms, ! tracer names
     9     &                      igcm_h2o_vap ! index of water vapor tracer
    810      implicit none
    911
     
    3335#include "comcstfi.h"
    3436#include "callkeys.h"
    35 #include "tracer.h"
     37!#include "tracer.h"
    3638
    3739
     
    7375      INTEGER iq,ico2
    7476      save ico2
    75       REAL zq(ngridmx,nlayermx,nqmx), zq2(ngridmx,nlayermx,nqmx)
    76       REAL zqm(nqmx),zqco2m
     77      REAL zq(ngridmx,nlayermx,nq), zq2(ngridmx,nlayermx,nq)
     78      REAL zqm(nq),zqco2m
    7779      real m_co2, m_noco2, A , B
    7880      save A, B
     
    101103        if (tracer) then
    102104!     Prepare Special treatment if one of the tracers is CO2 gas
    103            do iq=1,nqmx
     105           do iq=1,nq
    104106             if (noms(iq).eq."co2") then
    105107                ico2=iq
  • trunk/LMDZ.MARS/libf/phymars/dustdevil.F

    r224 r1036  
    11      SUBROUTINE dustdevil(ngrid,nlay,nq, pplev,pu,pv,pt, ptsurf,pq2,
    22     &                pdqdev,pdqs_dev)
     3
     4      use tracer_mod, only: alpha_devil
    35      IMPLICIT NONE
    46
     
    3234#include "surfdat.h"
    3335#include "comgeomfi.h"
    34 #include "tracer.h"
     36!#include "tracer.h"
    3537c   arguments:
    3638c   ----------
  • trunk/LMDZ.MARS/libf/phymars/dustlift.F

    r310 r1036  
    22     $                  pcdh_true,pcdh,co2ice,
    33     $                  dqslift)
     4
     5      use tracer_mod, only: alpha_lift, radius
    46      IMPLICIT NONE
    57
     
    1921#include "dimphys.h"
    2022#include "comcstfi.h"
    21 #include "tracer.h"
     23!#include "tracer.h"
    2224
    2325c
  • trunk/LMDZ.MARS/libf/phymars/growthrate.F

    r633 r1036  
    11      subroutine growthrate(temp,pmid,psat,rcrystal,res)
    22
     3      use tracer_mod, only: rho_ice
    34      IMPLICIT NONE
    45
     
    2122#include "dimphys.h"
    2223#include "comcstfi.h"
    23 #include "tracer.h"
     24!#include "tracer.h"
    2425#include "microphys.h"
    2526
  • trunk/LMDZ.MARS/libf/phymars/improvedclouds.F

    r1020 r1036  
    66      USE ioipsl_getincom
    77      USE updaterad
     8      use tracer_mod, only: rho_ice, nuice_sed, igcm_h2o_vap,
     9     &                      igcm_h2o_ice, igcm_dust_mass,
     10     &                      igcm_dust_number, igcm_ccn_mass,
     11     &                      igcm_ccn_number
    812      implicit none
    913     
     
    3337#include "comcstfi.h"
    3438#include "callkeys.h"
    35 #include "tracer.h"
     39!#include "tracer.h"
    3640#include "comgeomfi.h"
    3741#include "dimradmars.h"
     
    7377      INTEGER ig,l,i
    7478     
    75       REAL zq(ngridmx,nlayermx,nqmx)  ! local value of tracers
    76       REAL zq0(ngridmx,nlayermx,nqmx) ! local initial value of tracers
     79      REAL zq(ngridmx,nlayermx,nq)  ! local value of tracers
     80      REAL zq0(ngridmx,nlayermx,nq) ! local initial value of tracers
    7781      REAL zt(ngridmx,nlayermx)       ! local value of temperature
    7882      REAL zqsat(ngridmx,nlayermx)    ! saturation
  • trunk/LMDZ.MARS/libf/phymars/inifis.F

    r1028 r1036  
    11      SUBROUTINE inifis(
    2      $           ngrid,nlayer
     2     $           ngrid,nlayer,nq
    33     $           ,day_ini,pdaysec,ptimestep
    44     $           ,plat,plon,parea
     
    4646!   -------------
    4747! to use  'getin'
    48       USE ioipsl_getincom
     48      USE ioipsl_getincom, only : getin
     49      use tracer_mod, only : nqmx, nuice_sed, ccn_factor
     50     
    4951      IMPLICIT NONE
    5052#include "dimensions.h"
     
    6264#include "slope.h"
    6365#include "microphys.h"
    64 #include "tracer.h"
     66!#include "tracer.h"
    6567#ifdef MESOSCALE
    6668#include "comsoil.h"     !!MESOSCALE -- needed to fill volcapa
    6769#include "meso_inc/meso_inc_inifisvar.F"
    6870#endif
    69       REAL prad,pg,pr,pcpp,pdaysec
    70 
    71       REAL ptimestep
    72       INTEGER day_ini
    73 
    74       INTEGER ngrid,nlayer
    75       REAL plat(ngrid),plon(ngrid),parea(ngridmx)
     71      REAL,INTENT(IN) :: prad,pg,pr,pcpp,pdaysec
     72
     73      REAL,INTENT(IN) :: ptimestep
     74      INTEGER,INTENT(IN) :: day_ini
     75
     76      INTEGER,INTENT(IN) :: ngrid,nlayer,nq
     77      REAL,INTENT(IN) :: plat(ngrid),plon(ngrid),parea(ngrid)
    7678      INTEGER ig,ierr
    7779 
     
    9597      daysec=pdaysec
    9698      dtphys=ptimestep
     99
     100      nqmx=nq
     101
    97102#ifdef MESOSCALE
    98103#include "meso_inc/meso_inc_inifisini.F"
     
    375380           stop
    376381         endif
    377          if (doubleq.and.submicron.and.(nqmx.LT.3)) then
     382         if (doubleq.and.submicron.and.(nq.LT.3)) then
    378383           print*,'If doubleq is used with a submicron tracer,'
    379384           print*,' then the number of tracers has to be'
     
    804809!         print*,' 1 water vapour tracer'
    805810!         print*,' 1 water ice tracer'
    806 !         print*,nqmx-4,' chemistry tracers'
     811!         print*,nq-4,' chemistry tracers'
    807812!       endif
    808813!
     
    812817!         print*,' 1 water vapour tracer'
    813818!         print*,' 1 water ice tracer'
    814 !         if (nqmx.LT.4) then
    815 !           print*,'nqmx should be at least equal to'
     819!         if (nq.LT.4) then
     820!           print*,'nq should be at least equal to'
    816821!           print*,'4 with these options.'
    817822!           stop
     
    824829!           print*,dustbin,' dust bins'
    825830!         endif
    826 !         print*,nqmx-2-dustbin,' chemistry tracers'
     831!         print*,nq-2-dustbin,' chemistry tracers'
    827832!         print*,' 1 water vapour tracer'
    828833!         print*,' 1 water ice tracer'
     
    836841!         print*,' 1 water vapour tracer'
    837842!         print*,' 1 water ice tracer'
    838 !         if (nqmx.gt.(dustbin+2)) then
    839 !           print*,'nqmx should be ',(dustbin+2),
     843!         if (nq.gt.(dustbin+2)) then
     844!           print*,'nq should be ',(dustbin+2),
    840845!     $            ' with these options...'
    841846!                  print*,'(or check callphys.def)'
    842847!         endif
    843 !         if (nqmx.lt.(dustbin+2)) then
    844 !           write(*,*) "inifis: nqmx.lt.(dustbin+2)"
     848!         if (nq.lt.(dustbin+2)) then
     849!           write(*,*) "inifis: nq.lt.(dustbin+2)"
    845850!           stop
    846851!         endif
  • trunk/LMDZ.MARS/libf/phymars/initracer.F

    r1005 r1036  
    1       SUBROUTINE initracer(qsurf,co2ice)
    2 
     1      SUBROUTINE initracer(ngrid,nq,qsurf,co2ice)
     2
     3       use infotrac, only: tnom
     4       use tracer_mod
    35       IMPLICIT NONE
    46c=======================================================================
     
    1113c
    1214c   Test of dimension :
    13 c   Initialize COMMON tracer in tracer.h, using tracer names provided
    14 c   by the dynamics in "advtrac.h"
     15c   Initialize tracer related data in tracer_mod, using tracer names provided
     16c   by the dynamics in "infotrac"
    1517c
    1618c
     
    2628#include "comcstfi.h"
    2729#include "callkeys.h"
    28 #include "tracer.h"
    29 #include "advtrac.h"
     30!#include "tracer.h"
     31!#include "advtrac.h"
    3032#include "comgeomfi.h"
    3133
    3234#include "surfdat.h"
    3335
    34       real qsurf(ngridmx,nqmx)       ! tracer on surface (e.g.  kg.m-2)
    35       real co2ice(ngridmx)           ! co2 ice mass on surface (e.g.  kg.m-2)
     36      integer,intent(in) :: ngrid ! number of atmospheric columns
     37      integer,intent(in) :: nq ! number of tracers
     38      real,intent(out) :: qsurf(ngrid,nq) ! tracer on surface (e.g.  kg.m-2)
     39      real,intent(out) :: co2ice(ngrid) ! co2 ice mass on surface (e.g.  kg.m-2)
     40
    3641      integer iq,ig,count
    3742      real r0_lift , reff_lift, nueff_lift
     
    4348
    4449c-----------------------------------------------------------------------
    45 c  radius(nqmx)      ! aerosol particle radius (m)
    46 c  rho_q(nqmx)       ! tracer densities (kg.m-3)
    47 c  alpha_lift(nqmx)  ! saltation vertical flux/horiz flux ratio (m-1)
    48 c  alpha_devil(nqmx) ! lifting coeeficient by dust devil
     50c  radius(nq)      ! aerosol particle radius (m)
     51c  rho_q(nq)       ! tracer densities (kg.m-3)
     52c  alpha_lift(nq)  ! saltation vertical flux/horiz flux ratio (m-1)
     53c  alpha_devil(nq) ! lifting coeeficient by dust devil
    4954c  rho_dust          ! Mars dust density
    5055c  rho_ice           ! Water ice density
     
    5560c-----------------------------------------------------------------------
    5661
     62! Initialization: allocate arrays in tracer_mod
     63      allocate(noms(nq))
     64      allocate(mmol(nq))
     65      allocate(radius(nq))
     66      allocate(rho_q(nq))
     67      allocate(alpha_lift(nq))
     68      allocate(alpha_devil(nq))
     69      allocate(dryness(ngridmx))
     70      allocate(igcm_dustbin(nq))
     71
    5772! Initialization: get tracer names from the dynamics and check if we are
    5873!                 using 'old' tracer convention ('q01',q02',...)
     
    6075      ! check if tracers have 'old' names
    6176      count=0
    62       do iq=1,nqmx
     77      do iq=1,nq
    6378        txt=" "
    6479        write(txt,'(a1,i2.2)') 'q',iq
     
    6681          count=count+1
    6782        endif
    68       enddo ! of do iq=1,nqmx
     83      enddo ! of do iq=1,nq
    6984     
    70       if (count.eq.nqmx) then
     85      if (count.eq.nq) then
    7186        write(*,*) "initracer: tracers seem to follow old naming ",
    7287     &             "convention (q01,q02,...)"
     
    7691
    7792      ! copy tracer names from dynamics
    78       do iq=1,nqmx
     93      do iq=1,nq
    7994        noms(iq)=tnom(iq)
    8095      enddo
     
    86101! Identify tracers by their names: (and set corresponding values of mmol)
    87102      ! 0. initialize tracer indexes to zero:
    88       do iq=1,nqmx
    89         igcm_dustbin(iq)=0
    90       enddo
     103      igcm_dustbin(1:nq)=0
     104
    91105      igcm_dust_mass=0
    92106      igcm_dust_number=0
     
    130144      count=0
    131145      if (dustbin.gt.0) then
    132         do iq=1,nqmx
     146        do iq=1,nq
    133147          txt=" "
    134148          write(txt,'(a4,i2.2)')'dust',count+1
     
    138152            mmol(iq)=100.
    139153          endif
    140         enddo !do iq=1,nqmx
     154        enddo !do iq=1,nq
    141155      endif ! of if (dustbin.gt.0)
    142156      if (doubleq) then
    143         do iq=1,nqmx
     157        do iq=1,nq
    144158          if (noms(iq).eq."dust_mass") then
    145159            igcm_dust_mass=iq
     
    153167      endif ! of if (doubleq)
    154168      if (microphys) then
    155         do iq=1,nqmx
     169        do iq=1,nq
    156170          if (noms(iq).eq."ccn_mass") then
    157171            igcm_ccn_mass=iq
     
    165179      endif ! of if (microphys)
    166180      if (submicron) then
    167         do iq=1,nqmx
     181        do iq=1,nq
    168182          if (noms(iq).eq."dust_submicron") then
    169183            igcm_dust_submicron=iq
     
    174188      endif ! of if (submicron)
    175189      ! 2. find chemistry and water tracers
    176       do iq=1,nqmx
     190      do iq=1,nq
    177191        if (noms(iq).eq."co2") then
    178192          igcm_co2=iq
     
    337351        endif
    338352
    339       enddo ! of do iq=1,nqmx
     353      enddo ! of do iq=1,nq
    340354     
    341355      ! check that we identified all tracers:
    342       if (count.ne.nqmx) then
     356      if (count.ne.nq) then
    343357        write(*,*) "initracer: found only ",count," tracers"
    344         write(*,*) "               expected ",nqmx
     358        write(*,*) "               expected ",nq
    345359        do iq=1,count
    346360          write(*,*)'      ',iq,' ',trim(noms(iq))
     
    349363      else
    350364        write(*,*) "initracer: found all expected tracers, namely:"
    351         do iq=1,nqmx
     365        do iq=1,nq
    352366          write(*,*)'      ',iq,' ',trim(noms(iq))
    353367        enddo
     
    365379       ! as qsurf(i_h2o_vap) & as qsurf(i_h2o_ice), so to be clean:
    366380       if (igcm_h2o_vap.ne.0) then
    367          qsurf(1:ngridmx,igcm_h2o_vap)=0
     381         qsurf(1:ngrid,igcm_h2o_vap)=0
    368382       endif
    369383      endif
    370384
    371385c------------------------------------------------------------
    372 c     Initialize tracers .... (in tracer.h)
     386c     Initialize tracers .... (in tracer_mod)
    373387c------------------------------------------------------------
    374388      ! start by setting everything to (default) zero
    375       rho_q(1:nqmx)=0     ! tracer density (kg.m-3)
    376       radius(1:nqmx)=0.   ! tracer particle radius (m)
    377       alpha_lift(1:nqmx) =0.  ! tracer saltation vertical flux/horiz flux ratio (m-1)
    378       alpha_devil(1:nqmx)=0.  ! tracer lifting coefficient by dust devils
     389      rho_q(1:nq)=0     ! tracer density (kg.m-3)
     390      radius(1:nq)=0.   ! tracer particle radius (m)
     391      alpha_lift(1:nq) =0.  ! tracer saltation vertical flux/horiz flux ratio (m-1)
     392      alpha_devil(1:nq)=0.  ! tracer lifting coefficient by dust devils
    379393
    380394
     
    393407c       iq=1: Q mass mixing ratio, iq=2: N number mixing ratio
    394408
    395         if( (nqmx.lt.2).or.(water.and.(nqmx.lt.4)) ) then
    396           write(*,*)'initracer: nqmx is too low : nqmx=', nqmx
     409        if( (nq.lt.2).or.(water.and.(nq.lt.4)) ) then
     410          write(*,*)'initracer: nq is too low : nq=', nq
    397411          write(*,*)'water= ',water,' doubleq= ',doubleq   
    398412        end if
     
    499513         alpha_lift(igcm_h2o_vap) =0.
    500514         alpha_devil(igcm_h2o_vap)=0.
    501          if(water.and.(nqmx.ge.2)) then
     515         if(water.and.(nq.ge.2)) then
    502516           radius(igcm_h2o_ice)=3.e-6
    503517           rho_q(igcm_h2o_ice)=rho_ice
    504518           alpha_lift(igcm_h2o_ice) =0.
    505519           alpha_devil(igcm_h2o_ice)=0.
    506          elseif(water.and.(nqmx.lt.2)) then
    507             write(*,*) 'nqmx is too low : nqmx=', nqmx
     520         elseif(water.and.(nq.lt.2)) then
     521            write(*,*) 'nq is too low : nq=', nq
    508522            write(*,*) 'water= ',water
    509523         endif
  • trunk/LMDZ.MARS/libf/phymars/newcondens.F

    r890 r1036  
    66     $                  fluxsurf_sw,zls)
    77                                                   
     8       use tracer_mod, only: noms
    89       IMPLICIT NONE
    910c=======================================================================
     
    6162#include "paramet.h"
    6263#include "callkeys.h"
    63 #include "tracer.h"
     64!#include "tracer.h"
    6465
    6566c-----------------------------------------------------------------------
     
    195196         if (tracer) then
    196197c          Prepare Special treatment if one of the tracer is CO2 gas
    197            do iq=1,nqmx
     198           do iq=1,nq
    198199             if (noms(iq).eq."co2") then
    199200                ico2=iq
     
    238239      END DO
    239240         
    240       DO iq=1,nqmx         
     241      DO iq=1,nq
    241242      DO l=1,nlayer
    242243         DO ig=1,ngrid
     
    531532             zu(l)   =pu(ig,l)   +pdu( ig,l)  *ptimestep
    532533             zv(l)   =pv(ig,l)   +pdv( ig,l)  *ptimestep
    533             do iq=1,nqmx
     534            do iq=1,nq
    534535             zq(l,iq)=pq(ig,l,iq)+pdq(ig,l,iq)*ptimestep
    535536            enddo
     
    564565            zum(1) = 0 
    565566            zvm(1) = 0 
    566             do iq=1,nqmx
     567            do iq=1,nq
    567568              zqm(1,iq)=0. ! most tracer do not condense !
    568569            enddo
     
    577578            call vl1d(zu ,2.,masse,w,zum)
    578579            call vl1d(zv ,2.,masse,w,zvm)
    579             do iq=1,nqmx
     580            do iq=1,nq
    580581             do l=1,nlayer
    581582              zq1(l)=zq(l,iq)
     
    602603            zum(nlayer+1)= zu(nlayer)  ! should not be used, but...
    603604            zvm(nlayer+1)= zv(nlayer)  ! should not be used, but...
    604             do iq=1,nqmx
     605            do iq=1,nq
    605606             zqm(nlayer+1,iq)= zq(nlayer,iq)
    606607            enddo
     
    637638
    638639c           Tendencies on Q
    639             do iq=1,nqmx
     640            do iq=1,nq
    640641!              if (noms(iq).eq.'co2') then
    641642              if (iq.eq.ico2) then
     
    668669             if(pq(ig,1,ico2)+(pdq(ig,1,ico2)+pdqc(ig,1,ico2))*ptimestep
    669670     &       .lt.qco2min) then
    670                 do iq=1,nqmx
     671                do iq=1,nq
    671672                  zq(1,iq)=pq(ig,1,iq)
    672673     &                     +(pdq(ig,1,iq)+pdqc(ig,1,iq))*ptimestep
     
    675676                Sm(1)  = masse(1)
    676677                do l =2,nlayermx
    677                   do iq=1,nqmx
     678                  do iq=1,nq
    678679                     zq(l,iq)=pq(ig,l,iq)
    679680     &                        +(pdq(ig,l,iq)+pdqc(ig,l,iq))*ptimestep
     
    693694                 end do
    694695 99              continue
    695                  do iq=1,nqmx
     696                 do iq=1,nq
    696697                   qmix=zq(nmix,iq)
    697698     &             +(Smq(nmix-1,iq)-zq(nmix,iq)*Sm(nmix-1))/mixmas
  • trunk/LMDZ.MARS/libf/phymars/nirco2abs.F

    r690 r1036  
    22     $     mu0,fract,declin,pdtnirco2)
    33                                                   
     4       use tracer_mod, only: igcm_co2, igcm_o
    45       IMPLICIT NONE
    56c=======================================================================
     
    5051#include "comdiurn.h"
    5152#include "nirdata.h"
    52 #include "tracer.h"
     53!#include "tracer.h"
    5354
    5455c-----------------------------------------------------------------------
  • trunk/LMDZ.MARS/libf/phymars/nltecool.F

    r472 r1036  
    3030c***************************************************************************
    3131
     32      use tracer_mod, only: igcm_co2, igcm_co, igcm_o, igcm_n2, mmol
    3233      implicit none
    3334
     
    3738#include "chimiedata.h"
    3839#include "conc.h" !Added to have "dynamic composition" in the scheme
    39 #include "tracer.h" !"
     40!#include "tracer.h" !"
    4041#include "callkeys.h"
    4142
  • trunk/LMDZ.MARS/libf/phymars/nuclea.F

    r706 r1036  
    1717#include "dimphys.h"
    1818#include "comcstfi.h"
    19 #include "tracer.h"
     19!#include "tracer.h"
    2020#include "microphys.h"
    2121
  • trunk/LMDZ.MARS/libf/phymars/phyetat0.F

    r999 r1036  
    44
    55      use netcdf
     6      use infotrac, only: nqtot, tnom
    67
    78      implicit none
     
    2526#include "comcstfi.h"
    2627!#include "tracer.h"
    27 #include "advtrac.h"
     28!#include "advtrac.h"
    2829#include "control.h"
    2930c======================================================================
     
    9697!                    qsurf02, ...)
    9798      count=0
    98       do iq=1,nqmx
     99      do iq=1,nqtot
    99100        txt= " "
    100101        write(txt,'(a5,i2.2)')'qsurf',iq
     
    108109        endif
    109110      enddo
    110       if (count.eq.nqmx) then
     111      if (count.eq.nqtot) then
    111112        write(*,*) "phyetat0:tracers seem to follow old naming ",
    112113     &             "convention (qsurf01,qsurf02,...)"
     
    650651c        case when new tracer are added in addition to old ones
    651652             write(*,*)'qsurf 1 to ', nqold,'were already present'
    652              write(*,*)'qsurf ', nqold+1,' to ', nqmx,'are new'
     653             write(*,*)'qsurf ', nqold+1,' to ', nqtot,'are new'
    653654!            yes=' '
    654655!            do while ((yes.ne.'y').and.(yes.ne.'n'))
    655656!             write(*,*) 'Would you like to reindex qsurf # 1 ->',nqold
    656 !             write(*,*) 'to #',nqmx-nqold+1,'->', nqmx,'   (y or n) ?'
     657!             write(*,*) 'to #',nqtot-nqold+1,'->', nqtot,'   (y or n) ?'
    657658!             read(*,fmt='(a)') yes
    658659!            end do
     
    660661!              write(*,*) 'OK, let s reindex qsurf'
    661662!                 do ig=1,ngridmx
    662 !                    do iq=nqmx,nqmx-nqold+1,-1
    663 !                       qsurf(ig,iq)=qsurf(ig,iq-nqmx+nqold)
     663!                    do iq=nqtot,nqtot-nqold+1,-1
     664!                       qsurf(ig,iq)=qsurf(ig,iq-nqtot+nqold)
    664665!                    end do
    665 !                    do iq=nqmx-nqold,1,-1
     666!                    do iq=nqtot-nqold,1,-1
    666667!                       qsurf(ig,iq)= 0.
    667668!                    end do
  • trunk/LMDZ.MARS/libf/phymars/physdem.F

    r999 r1036  
    33     .                   alb,ith,pzmea,pzstd,pzsig,pzgam,pzthe)
    44
     5      use infotrac, only: nqtot, tnom
    56      implicit none
    67c
     
    3233#include "netcdf.inc"
    3334#include "dimphys.h"
    34 #include "advtrac.h"
     35!#include "advtrac.h"
    3536#include "callkeys.h"
    3637c
     
    585586!                    qsurf02, ...)
    586587      count=0
    587       do iq=1,nqmx
     588      do iq=1,nqtot
    588589        txt= " "
    589590        write(txt,'(a1,i2.2)')'q',iq
     
    596597        endif
    597598      enddo
    598       if (count.eq.nqmx) then
     599      if (count.eq.nqtot) then
    599600        write(*,*) "physdem0:tracers seem to follow old naming ",
    600601     &             "convention (qsurf01,qsurf02,...)"
     
    602603        write(*,*) "     but you should run newstart to rename them"
    603604        oldtracernames=.true.
    604       endif ! of if (count.eq.nqmx)
     605      endif ! of if (count.eq.nqtot)
    605606
    606607      IF(nq.GE.1) THEN
     
    693694     .                   phystep,time,
    694695     .                   tsurf,tsoil,co2ice,emis,q2,qsurf)
     696      use infotrac, only: nqtot, tnom
    695697      implicit none
    696698c
     
    720722#include "netcdf.inc"
    721723#include "dimphys.h"
    722 #include "advtrac.h"
     724!#include "advtrac.h"
    723725#include "callkeys.h"
    724726c
     
    918920      IF (firstcall) THEN
    919921        count=0
    920         do iq=1,nqmx
     922        do iq=1,nqtot
    921923          txt= " "
    922924          write(txt,'(a1,i2.2)')'q',iq
     
    929931          endif
    930932        enddo
    931         if (count.eq.nqmx) then
     933        if (count.eq.nqtot) then
    932934          write(*,*) "physdem1:tracers seem to follow old naming ",
    933935     &               "convention (qsurf01,qsurf02,...)"
     
    935937          write(*,*) "     but you should run newstart to rename them"
    936938          oldtracernames=.true.
    937         endif ! of if (count.eq.nqmx)
     939        endif ! of if (count.eq.nqtot)
    938940      ENDIF ! of if(firstcall)
    939941     
    940942      ! If computing water cycle with ice, move surface ice
    941       ! back to qsurf(nqmx)
     943      ! back to qsurf(nqtot)
    942944      IF (oldtracernames .and. water) THEN
    943945       !"loop" to avoid potential out-of-bounds on arrays
    944         write(*,*)'physdem1: moving surface water ice to index ',nqmx
    945         do iq=nqmx,nqmx
     946        write(*,*)'physdem1: moving surface water ice to index ',nqtot
     947        do iq=nqtot,nqtot
    946948          qsurf(1:ngridmx,iq)=qsurf(1:ngridmx,iq-1)
    947949          qsurf(1:ngridmx,iq-1)=0
  • trunk/LMDZ.MARS/libf/phymars/physiq.F

    r1032 r1036  
    1212     $            )
    1313
    14 
     14      use tracer_mod, only: noms, mmol, igcm_co2, igcm_n2,
     15     &                      igcm_co, igcm_o, igcm_h2o_vap, igcm_h2o_ice,
     16     &                      igcm_ccn_mass, igcm_ccn_number,
     17     &                      igcm_dust_mass, igcm_dust_number, igcm_h2o2,
     18     &                      nuice_ref, rho_ice, rho_dust, ref_r0
     19
     20#ifdef MESOSCALE
     21      use infotrac !!! this is necessary for tracers
     22#endif
    1523      IMPLICIT NONE
    1624c=======================================================================
     
    103111c    pdv(ngrid,nlayermx)       |  Temporal derivative of the corresponding
    104112c    pdt(ngrid,nlayermx)       |  variables due to physical processes.
    105 c    pdq(ngrid,nlayermx,nqmx)  |
     113c    pdq(ngrid,nlayermx,nq  |
    106114c    pdpsrf(ngrid)             |
    107115c    tracerdyn                 call tracer in dynamical part of GCM ?
     
    126134#include "dimradmars.h"
    127135#include "comg1d.h"
    128 #include "tracer.h"
     136!#include "tracer.h"
    129137#include "nlteparams.h"
    130138#include "comvert.h"
     
    142150#include "wrf_output_2d.h"
    143151#include "wrf_output_3d.h"
    144 #include "advtrac.h"   !!! this is necessary for tracers (in dyn3d)
     152!#include "advtrac.h"   !!! this is necessary for tracers (in dyn3d)
    145153#include "meso_inc/meso_inc_var.F"
    146154#endif
     
    192200      REAL capcal(ngridmx)           ! surface heat capacity (J m-2 K-1)
    193201      REAL fluxgrd(ngridmx)          ! surface conduction flux (W.m-2)
    194       REAL qsurf(ngridmx,nqmx)      ! tracer on surface (e.g. kg.m-2)
     202      REAL,ALLOCATABLE,SAVE :: qsurf(:,:) ! tracer on surface (e.g. kg.m-2)
    195203      REAL q2(ngridmx,nlayermx+1)    ! Turbulent Kinetic Energy
    196204     
     
    217225      SAVE aerosol, tsurf,tsoil
    218226      SAVE co2ice,albedo,emis, q2
    219       SAVE capcal,fluxgrd,dtrad,fluxrad,fluxrad_sky,qsurf
     227      SAVE capcal,fluxgrd,dtrad,fluxrad,fluxrad_sky
    220228
    221229      REAL stephan   
     
    229237      EXTERNAL CBRT
    230238
    231       CHARACTER*80 fichier
    232       INTEGER l,ig,ierr,igout,iq,i, tapphys
     239!      CHARACTER*80 fichier
     240      INTEGER l,ig,ierr,igout,iq,tapphys
    233241
    234242      REAL fluxsurf_lw(ngridmx)      !incident LW (IR) surface flux (W.m-2)
     
    243251      REAL zzlay(ngridmx,nlayermx)   ! altitude at the middle of the layers
    244252      REAL zzlev(ngridmx,nlayermx+1) ! altitude at layer boundaries
    245       REAL latvl1,lonvl1             ! Viking Lander 1 point (for diagnostic)
     253!      REAL latvl1,lonvl1             ! Viking Lander 1 point (for diagnostic)
    246254
    247255c     Tendancies due to various processes:
    248       REAL dqsurf(ngridmx,nqmx)
     256      REAL dqsurf(ngridmx,nq)
    249257      REAL zdtlw(ngridmx,nlayermx)     ! (K/s)
    250258      REAL zdtsw(ngridmx,nlayermx)     ! (K/s)
    251       REAL cldtlw(ngridmx,nlayermx)     ! (K/s) LW heating rate for clear area
    252       REAL cldtsw(ngridmx,nlayermx)     ! (K/s) SW heating rate for clear area
     259!      REAL cldtlw(ngridmx,nlayermx)     ! (K/s) LW heating rate for clear area
     260!      REAL cldtsw(ngridmx,nlayermx)     ! (K/s) SW heating rate for clear area
    253261      REAL zdtnirco2(ngridmx,nlayermx) ! (K/s)
    254262      REAL zdtnlte(ngridmx,nlayermx)   ! (K/s)
     
    264272      REAL zdvc(ngridmx,nlayermx),zduc(ngridmx,nlayermx)
    265273
    266       REAL zdqdif(ngridmx,nlayermx,nqmx), zdqsdif(ngridmx,nqmx)
    267       REAL zdqsed(ngridmx,nlayermx,nqmx), zdqssed(ngridmx,nqmx)
    268       REAL zdqdev(ngridmx,nlayermx,nqmx), zdqsdev(ngridmx,nqmx)
    269       REAL zdqadj(ngridmx,nlayermx,nqmx)
    270       REAL zdqc(ngridmx,nlayermx,nqmx)
    271       REAL zdqcloud(ngridmx,nlayermx,nqmx)
    272       REAL zdqscloud(ngridmx,nqmx)
    273       REAL zdqchim(ngridmx,nlayermx,nqmx)
    274       REAL zdqschim(ngridmx,nqmx)
     274      REAL zdqdif(ngridmx,nlayermx,nq), zdqsdif(ngridmx,nq)
     275      REAL zdqsed(ngridmx,nlayermx,nq), zdqssed(ngridmx,nq)
     276      REAL zdqdev(ngridmx,nlayermx,nq), zdqsdev(ngridmx,nq)
     277      REAL zdqadj(ngridmx,nlayermx,nq)
     278      REAL zdqc(ngridmx,nlayermx,nq)
     279      REAL zdqcloud(ngridmx,nlayermx,nq)
     280      REAL zdqscloud(ngridmx,nq)
     281      REAL zdqchim(ngridmx,nlayermx,nq)
     282      REAL zdqschim(ngridmx,nq)
    275283
    276284      REAL zdteuv(ngridmx,nlayermx)    ! (K/s)
     
    278286      REAL zdumolvis(ngridmx,nlayermx)
    279287      REAL zdvmolvis(ngridmx,nlayermx)
    280       real zdqmoldiff(ngridmx,nlayermx,nqmx)
     288      real zdqmoldiff(ngridmx,nlayermx,nq)
    281289
    282290c     Local variable for local intermediate calcul:
     
    295303      REAL ps(ngridmx), zt(ngridmx,nlayermx)
    296304      REAL zu(ngridmx,nlayermx),zv(ngridmx,nlayermx)
    297       REAL zq(ngridmx,nlayermx,nqmx)
     305      REAL zq(ngridmx,nlayermx,nq)
    298306      REAL fluxtop_sw_tot(ngridmx), fluxsurf_sw_tot(ngridmx)
    299307      character*2 str2
    300       character*5 str5
     308!      character*5 str5
    301309      real zdtdif(ngridmx,nlayermx), zdtadj(ngridmx,nlayermx)
    302310      REAL tauscaling(ngridmx)   ! Convertion factor for qdust and Ndust
     
    310318      ! instead, use zplay and zplev :
    311319      REAL zplev(ngrid,nlayermx+1),zplay(ngrid,nlayermx)
    312       REAL zstress(ngrid), cd
    313       real hco2(nqmx),tmean, zlocal(nlayermx)
     320!      REAL zstress(ngrid),cd
     321      real tmean, zlocal(nlayermx)
    314322      real rho(ngridmx,nlayermx)  ! density
    315323      real vmr(ngridmx,nlayermx)  ! volume mixing ratio
    316324      real rhopart(ngridmx,nlayermx) ! number density of a given species
    317       real colden(ngridmx,nqmx)   ! vertical column of tracers
     325      real colden(ngridmx,nq   ! vertical column of tracers
    318326      REAL mtot(ngridmx)          ! Total mass of water vapor (kg/m2)
    319327      REAL icetot(ngridmx)        ! Total mass of water ice (kg/m2)
     
    357365      REAL, SAVE :: hfmax_th(ngridmx)
    358366      REAL pdu_th(ngridmx,nlayermx),pdv_th(ngridmx,nlayermx)
    359       REAL pdt_th(ngridmx,nlayermx),pdq_th(ngridmx,nlayermx,nqmx)
     367      REAL pdt_th(ngridmx,nlayermx),pdq_th(ngridmx,nlayermx,nq)
    360368      INTEGER lmax_th(ngridmx),dimout,n_out,n
    361369      CHARACTER(50) zstring
     
    364372      REAL, ALLOCATABLE, DIMENSION(:,:) :: T_out
    365373      REAL, ALLOCATABLE, DIMENSION(:,:) :: u_out ! Interpolated teta and u at z_out
    366       REAL u_out1(ngridmx), T_out1(ngridmx)
     374!      REAL u_out1(ngridmx)
     375      REAL T_out1(ngridmx)
    367376      REAL, ALLOCATABLE, DIMENSION(:) :: z_out     ! height of interpolation between z0 and z1 [meters]
    368377      REAL ustar(ngridmx),tstar(ngridmx)  ! friction velocity and friction potential temp
    369378      REAL L_mo(ngridmx),vhf(ngridmx),vvv(ngridmx)
    370       REAL zu2(ngridmx),sensibFlux(ngridmx)
     379!      REAL zu2(ngridmx)
     380      REAL sensibFlux(ngridmx)
    371381
    372382c=======================================================================
     
    379389      IF (firstcall) THEN
    380390
     391        ! allocate local (saved) arrays:
     392        allocate(qsurf(ngrid,nq))
     393       
    381394c        variables set to 0
    382395c        ~~~~~~~~~~~~~~~~~~
     
    417430         tracerdyn=tracer
    418431         IF (tracer) THEN
    419             CALL initracer(qsurf,co2ice)
     432            CALL initracer(ngrid,nq,qsurf,co2ice)
    420433         ENDIF  ! end tracer
    421434
     
    570583
    571584      if(photochem.or.callthermos) then
    572          call concentrations(zplay,pt,pdt,pq,pdq,ptimestep)
     585         call concentrations(nq,zplay,pt,pdt,pq,pdq,ptimestep)
    573586      endif
    574587#endif
     
    12141227     $                       surfdust, surfice)
    12151228!           call photochemistry
    1216             call calchim(ptimestep,zplay,zplev,pt,pdt,dist_sol,mu0,
     1229            call calchim(nq,
     1230     &                   ptimestep,zplay,zplev,pt,pdt,dist_sol,mu0,
    12171231     $                   zzlev,zzlay,zday,pq,pdq,zdqchim,zdqschim,
    12181232     $                   zdqcloud,zdqscloud,tauref,co2ice,
  • trunk/LMDZ.MARS/libf/phymars/simpleclouds.F

    r740 r1036  
    44     &             nq,tau,rice)
    55      USE updaterad
     6      use tracer_mod, only: igcm_h2o_vap, igcm_h2o_ice
    67      implicit none
    78c------------------------------------------------------------------
     
    3233#include "comcstfi.h"
    3334#include "callkeys.h"
    34 #include "tracer.h"
     35!#include "tracer.h"
    3536#include "comgeomfi.h"
    3637#include "dimradmars.h"
     
    7374      INTEGER ig,l
    7475
    75       REAL zq(ngridmx,nlayermx,nqmx)  ! local value of tracers
    76       REAL zq0(ngridmx,nlayermx,nqmx) ! local initial value of tracers
     76      REAL zq(ngridmx,nlayermx,nq  ! local value of tracers
     77      REAL zq0(ngridmx,nlayermx,nq ! local initial value of tracers
    7778      REAL zt(ngridmx,nlayermx)       ! local value of temperature
    7879      REAL zqsat(ngridmx,nlayermx)    ! saturation
     
    9192c    -----------------
    9293
    93 c    On "update" la valeur de q(nqmx) (water vapor) et temperature.
     94c    On "update" la valeur de q(nq) (water vapor) et temperature.
    9495c    On effectue qqes calculs preliminaires sur les couches :
    9596
  • trunk/LMDZ.MARS/libf/phymars/soil_tifeedback.F

    r857 r1036  
    11      SUBROUTINE soil_tifeedback(ngrid,nsoil,icecover,newtherm_i)
     2
     3      use tracer_mod, only: nqmx, igcm_h2o_ice, rho_ice
    24      IMPLICIT NONE
    35
     
    2426#include "dimphys.h"
    2527#include "comsoil.h"
    26 #include "tracer.h"
     28!#include "tracer.h"
    2729#include "surfdat.h"
    2830
     
    4143
    4244      REAL icecover(ngrid,nqmx)         ! tracer on the surface (kg.m-2)
    43                                         ! last one (iq=nqmx) is surface
     45                                        ! (iq=igcm_h2o_ice) is surface
    4446                                        ! water ice
    4547c Outputs
  • trunk/LMDZ.MARS/libf/phymars/surfini.F

    r740 r1036  
    33      USE ioipsl_getincom
    44      use netcdf
     5      use tracer_mod, only: nqmx, noms, dryness
    56      IMPLICIT NONE
    67c=======================================================================
     
    1617#include "surfdat.h"
    1718#include "callkeys.h"
    18 #include "tracer.h"
     19!#include "tracer.h"
    1920#include "comgeomfi.h"
    2021#include "comcstfi.h"
  • trunk/LMDZ.MARS/libf/phymars/testphys1d.F

    r999 r1036  
    22      PROGRAM testphys1d
    33! to use  'getin'
    4       USE ioipsl_getincom
     4      USE ioipsl_getincom, only: getin
     5      use infotrac, only: nqtot, tnom
    56      IMPLICIT NONE
    67
     
    4243#include "comg1d.h"
    4344#include "logic.h"
    44 #include "advtrac.h"
     45!#include "advtrac.h"
    4546
    4647c --------------------------------------------------------------
     
    6465      REAL gru,grv   ! prescribed "geostrophic" background wind
    6566      REAL temp(nlayermx)   ! temperature at the middle of the layers
    66       REAL q(nlayermx,nqmx) ! tracer mixing ratio (e.g. kg/kg)
    67       REAL qsurf(nqmx)      ! tracer surface budget (e.g. kg.m-2)
     67      REAL,ALLOCATABLE :: q(:,:) ! tracer mixing ratio (e.g. kg/kg)
     68      REAL,ALLOCATABLE :: qsurf(:) ! tracer surface budget (e.g. kg.m-2)
    6869      REAL tsoil(nsoilmx)   ! subsurface soik temperature (K)
    6970      REAL co2ice           ! co2ice layer (kg.m-2)
     
    7677      REAL dudyn(nlayermx),dvdyn(nlayermx),dtempdyn(nlayermx)
    7778      REAL dpsurf   
    78       REAL dq(nlayermx,nqmx)
    79       REAL dqdyn(nlayermx,nqmx)
     79      REAL,ALLOCATABLE :: dq(:,:)
     80      REAL,ALLOCATABLE :: dqdyn(:,:)
    8081
    8182c   Various intermediate variables
     
    8485      REAL phi(nlayermx),h(nlayermx),s(nlayermx)
    8586      REAL pks, ptif, w(nlayermx)
    86       REAL qtotinit, mqtot(nqmx),qtot
     87      REAL qtotinit,qtot
     88      real,allocatable :: mqtot(:)
    8789      INTEGER ierr, aslun
    8890      REAL tmp1(0:nlayermx),tmp2(0:nlayermx)
     
    169171
    170172! while we're at it, check if there is a 'traceur.def' file
    171 ! and preocess it, if necessary. Otherwise initialize tracer names
     173! and process it.
    172174      if (tracer) then
    173175      ! load tracer names from file 'traceur.def'
     
    183185          ! read number of tracers:
    184186          read(90,*,iostat=ierr) nq
     187          nqtot=nq ! set value of nqtot (in infotrac module) as nq
    185188          if (ierr.ne.0) then
    186189            write(*,*) "testphys1d: error reading number of tracers"
    187190            write(*,*) "   (first line of traceur.def) "
    188191            stop
    189           else
    190             ! check that the number of tracers is indeed nqmx
    191             if (nq.ne.nqmx) then
    192               write(*,*) "testphys1d: error, wrong number of tracers:"
    193               write(*,*) "nq=",nq," whereas nqmx=",nqmx
    194               stop
    195             endif
    196192          endif
    197193        endif
     194        ! allocate arrays:
     195        allocate(tnom(nq))
     196        allocate(q(nlayermx,nq))
     197        allocate(qsurf(nq))
     198        allocate(dq(nlayermx,nq))
     199        allocate(dqdyn(nlayermx,nq))
     200        allocate(mqtot(nq))
     201       
    198202        ! read tracer names from file traceur.def
    199         do iq=1,nqmx
     203        do iq=1,nq
    200204          read(90,*,iostat=ierr) tnom(iq)
    201205          if (ierr.ne.0) then
     
    212216        ! "smarter" initialization of some tracers
    213217        ! (get values from "profile_*" files, if these are available)
    214         do iq=1,nqmx
     218        do iq=1,nq
    215219          txt=""
    216220          write(txt,"(a)") tnom(iq)
     
    346350            close(91)
    347351          endif ! of if (txt.eq."ccn_number")
    348         enddo ! of do iq=1,nqmx
     352        enddo ! of do iq=1,nq
    349353
    350354      else
    351       ! we still need to set (dummy) tracer names for physdem1
    352         nq=nqmx
     355      ! we still need to set (dummy) tracer number and names for physdem1
     356        nq=1
     357        ! allocate arrays:
     358        allocate(tnom(nq))
     359        allocate(q(nlayermx,nq))
     360        allocate(qsurf(nq))
     361        allocate(dq(nlayermx,nq))
     362        allocate(dqdyn(nlayermx,nq))
     363        allocate(mqtot(nq))
    353364        do iq=1,nq
    354365          write(str7,'(a1,i2.2)')'q',iq
     
    496507
    497508!Mars possible matter with dtphys in input and include!!!
    498       CALL inifis(1,llm,day0,daysec,dtphys,
     509      CALL inifis(1,llm,nq,day0,daysec,dtphys,
    499510     .            lati,long,area,rad,g,r,cpp)
    500511
     
    612623         ! thermo=0: initialize over all atmospheric layers
    613624         thermo=0
    614          call inichim_newstart(q,psurf,sig,nqmx,lati,long,area,
     625         call inichim_newstart(q,psurf,sig,nq,lati,long,area,
    615626     $   thermo,qsurf)
    616627      endif
     
    641652c  It is needed to transfert physics variables to "physiq"...
    642653
    643       call physdem0("startfi.nc",long,lati,nsoilmx,nqmx,
     654      call physdem0("startfi.nc",long,lati,nsoilmx,nq,
    644655     .              dtphys,float(day0),time,area,
    645656     .              albedodat,inertiedat,zmea,zstd,zsig,zgam,zthe)
    646       call physdem1("startfi.nc",nsoilmx,nqmx,
     657      call physdem1("startfi.nc",nsoilmx,nq,
    647658     .              dtphys,time,
    648659     .              tsurf,tsoil,co2ice,emis,q2,qsurf)
     
    688699c       --------------------
    689700!      write(*,*) "testphys1d avant q", q(1,:)
    690       CALL physiq (1,llm,nqmx,
     701      CALL physiq (1,llm,nq,
    691702     ,     firstcall,lastcall,
    692703     ,     day,time,dtphys,
     
    749760
    750761!       increment tracers
    751         DO iq = 1, nqmx
     762        DO iq = 1, nq
    752763          DO ilayer=1,nlayer
    753764             q(ilayer,iq)=q(ilayer,iq)+dtphys*dq(ilayer,iq)
  • trunk/LMDZ.MARS/libf/phymars/updaterad.F90

    r882 r1036  
    6262! Update ice radius if microphys == true
    6363subroutine updaterice_micro(qice,qccn,nccn,coeff,rice,rhocloud)
    64 implicit none
    65 
    66 #include "dimensions.h"
    67 #include "dimphys.h"
    68 #include "comcstfi.h"
    69 #include "tracer.h"
     64use tracer_mod, only: rho_dust, rho_ice
     65implicit none
     66
     67#include "dimensions.h"
     68#include "dimphys.h"
     69#include "comcstfi.h"
     70!#include "tracer.h"
    7071
    7172real, intent(in)  :: qice,qccn,nccn
     
    118119! Update ice radius from a typical profile if microphys == false
    119120subroutine updaterice_typ(qice,tau,pzlay,rice)
    120 implicit none
    121 
    122 #include "dimensions.h"
    123 #include "dimphys.h"
    124 #include "comcstfi.h"
    125 #include "tracer.h"
     121use tracer_mod, only: rho_ice
     122implicit none
     123
     124#include "dimensions.h"
     125#include "dimphys.h"
     126#include "comcstfi.h"
     127!#include "tracer.h"
    126128
    127129real, intent(in)  :: qice
     
    175177! To be used with doubleq == true. otherwise, rdust is constant !!!
    176178subroutine updaterdust(qdust,ndust,rdust,tauscaling)
    177 implicit none
    178 
    179 #include "dimensions.h"
    180 #include "dimphys.h"
    181 #include "comcstfi.h"
    182 #include "tracer.h"
     179use tracer_mod, only: r3n_q
     180implicit none
     181
     182#include "dimensions.h"
     183#include "dimphys.h"
     184#include "comcstfi.h"
     185!#include "tracer.h"
    183186
    184187real, intent(in) :: qdust,ndust ! needed if doubleq
     
    230233! geometric mean radius = mass mean radius x exp(-1.5 sigma0^2)
    231234subroutine updaterccn(qccn,nccn,rccn,tauscaling)
    232 implicit none
    233 
    234 #include "dimensions.h"
    235 #include "dimphys.h"
    236 #include "comcstfi.h"
    237 #include "tracer.h"
     235use tracer_mod, only: rho_dust
     236implicit none
     237
     238#include "dimensions.h"
     239#include "dimphys.h"
     240#include "comcstfi.h"
     241!#include "tracer.h"
    238242
    239243real, intent(in) :: qccn,nccn ! needed if doubleq
  • trunk/LMDZ.MARS/libf/phymars/updatereffrad.F

    r744 r1036  
    44     &                pq,tauscaling,tau,pplay)
    55       USE updaterad
     6       use tracer_mod, only: nqmx, igcm_dust_mass, igcm_dust_number,
     7     &                       igcm_h2o_ice, igcm_ccn_mass, radius,
     8     &                       igcm_ccn_number, nuice_ref, varian,
     9     &                       ref_r0, igcm_dust_submicron
    610       IMPLICIT NONE
    711c=======================================================================
     
    3135#include "callkeys.h"
    3236#include "dimradmars.h"
    33 #include "tracer.h"
     37!#include "tracer.h"
    3438#include "aerkind.h"
    3539#include "yomaer.h"
  • trunk/LMDZ.MARS/libf/phymars/vdif_kc.F

    r325 r1036  
    11      SUBROUTINE vdif_kc(dt,g,zlev,zlay,u,v,teta,cd,q2,km,kn,zq)
     2
     3      use tracer_mod, only: nqmx, noms
    24      IMPLICIT NONE
    35c.......................................................................
    46#include "dimensions.h"
    57#include "dimphys.h"
    6 #include "tracer.h"
     8!#include "tracer.h"
    79#include "callkeys.h"
    810c.......................................................................
  • trunk/LMDZ.MARS/libf/phymars/vdifc.F

    r1035 r1036  
    1111#endif
    1212     &                )
     13      use tracer_mod, only: noms, igcm_dust_mass, igcm_dust_number,
     14     &                      igcm_dust_submicron, igcm_h2o_vap,
     15     &                      igcm_h2o_ice, dryness, alpha_lift, nqmx
    1316      IMPLICIT NONE
    1417
     
    3942#include "surfdat.h"
    4043#include "comgeomfi.h"
    41 #include "tracer.h"
     44!#include "tracer.h"
    4245#include "microphys.h"
    4346
     
    4649c   ----------
    4750
    48       INTEGER ngrid,nlay
    49       REAL ptimestep
    50       REAL pplay(ngrid,nlay),pplev(ngrid,nlay+1)
    51       REAL pzlay(ngrid,nlay),pzlev(ngrid,nlay+1)
    52       REAL pu(ngrid,nlay),pv(ngrid,nlay),ph(ngrid,nlay),pt(ngrid,nlay)
    53       REAL ptsrf(ngrid),pemis(ngrid)
    54       REAL pdufi(ngrid,nlay),pdvfi(ngrid,nlay),pdhfi(ngrid,nlay)
    55       REAL pfluxsrf(ngrid)
    56       REAL pdudif(ngrid,nlay),pdvdif(ngrid,nlay),pdhdif(ngrid,nlay)
    57       REAL pdtsrf(ngrid),pcapcal(ngrid)
     51      INTEGER,INTENT(IN) :: ngrid,nlay
     52      REAL,INTENT(IN) :: ptimestep
     53      REAL,INTENT(IN) :: pplay(ngrid,nlay),pplev(ngrid,nlay+1)
     54      REAL,INTENT(IN) :: pzlay(ngrid,nlay),pzlev(ngrid,nlay+1)
     55      REAL,INTENT(IN) :: pu(ngrid,nlay),pv(ngrid,nlay)
     56      REAL,INTENT(IN) :: ph(ngrid,nlay)
     57      REAL :: pt(ngrid,nlay)
     58      REAL,INTENT(IN) :: ptsrf(ngrid),pemis(ngrid)
     59      REAL,INTENT(IN) :: pdufi(ngrid,nlay),pdvfi(ngrid,nlay)
     60      REAL,INTENT(IN) :: pdhfi(ngrid,nlay)
     61      REAL,INTENT(IN) :: pfluxsrf(ngrid)
     62      REAL,INTENT(OUT) :: pdudif(ngrid,nlay),pdvdif(ngrid,nlay)
     63      REAL,INTENT(OUT) :: pdtsrf(ngrid),pdhdif(ngrid,nlay)
     64      REAL,INTENT(IN) ::pcapcal(ngrid)
    5865      REAL pq2(ngrid,nlay+1)
    5966
    6067c    Argument added for condensation:
    61       REAL co2ice (ngrid), ppopsk(ngrid,nlay)
    62       logical lecrit
    63 
    64       REAL pz0(ngridmx) ! surface roughness length (m)
     68      REAL,INTENT(IN) :: co2ice (ngrid), ppopsk(ngrid,nlay)
     69      logical,INTENT(IN) :: lecrit
     70
     71      REAL,INTENT(IN) :: pz0(ngrid) ! surface roughness length (m)
    6572
    6673c    Argument added to account for subgrid gustiness :
    6774
    68       REAL wstar(ngridmx), hfmax(ngridmx), zi(ngridmx)
     75      REAL wstar(ngrid), hfmax(ngrid)!, zi(ngrid)
    6976
    7077c    Traceurs :
    71       integer nq
    72       REAL pqsurf(ngrid,nq)
    73       real pq(ngrid,nlay,nq), pdqfi(ngrid,nlay,nq)
    74       real pdqdif(ngrid,nlay,nq)
    75       real pdqsdif(ngrid,nq)
     78      integer,intent(in) :: nq
     79      REAL,INTENT(IN) :: pqsurf(ngrid,nq)
     80      real,intent(in) :: pq(ngrid,nlay,nq), pdqfi(ngrid,nlay,nq)
     81      real,intent(out) :: pdqdif(ngrid,nlay,nq)
     82      real,intent(out) :: pdqsdif(ngrid,nq)
    7683     
    7784c   local:
     
    99106      EXTERNAL SSUM,SCOPY
    100107      REAL SSUM
    101       LOGICAL firstcall
    102       SAVE firstcall
     108      LOGICAL,SAVE :: firstcall=.true.
    103109
    104110
     
    112118     
    113119c     For latent heat release from ground ice sublimation   
    114       REAL tsrf_lw(ngridmx)
    115       REAL alpha
     120!      REAL tsrf_lw(ngridmx)
     121!      REAL alpha
    116122      REAL T1,T2
    117123      SAVE T1,T2
     
    125131      REAL rho(ngridmx) ! near surface air density
    126132      REAL qsat(ngridmx)
    127       DATA firstcall/.true./
    128133
    129134      REAL kmixmin
     
    179184         if (tracer) then
    180185c          Prepare Special treatment if one of the tracer is CO2 gas
    181            do iq=1,nqmx
     186           do iq=1,nq
    182187             if (noms(iq).eq."co2") then
    183188                ico2=iq
     
    196201        firstcall=.false.
    197202      ENDIF
    198 
    199 
    200 
    201203
    202204
     
    398400
    399401      pt(:,:)=ph(:,:)*ppopsk(:,:)
    400       CALL yamada4(ngrid,nlay,ptimestep,g,r,pplev,pt
     402      CALL yamada4(ngrid,nlay,nq,ptimestep,g,r,pplev,pt
    401403     s   ,pzlev,pzlay,pu,pv,ph,pq,zcdv_true,pq2,zkv,zkh,zkq,ust
    402404     s   ,9)
    403 
    404405      ENDIF
    405406
     
    900901
    901902      RETURN
    902       END
     903      END SUBROUTINE vdifc
  • trunk/LMDZ.MARS/libf/phymars/watercloud.F

    r951 r1036  
    77      USE ioipsl_getincom
    88      USE updaterad
     9      use tracer_mod, only: nqmx, igcm_h2o_vap, igcm_h2o_ice,
     10     &                      igcm_dust_mass, igcm_dust_number,
     11     &                      igcm_ccn_mass, igcm_ccn_number,
     12     &                      rho_dust, nuice_sed, nuice_ref
    913      IMPLICIT NONE
    1014
     
    3438#include "comcstfi.h"
    3539#include "callkeys.h"
    36 #include "tracer.h"
     40!#include "tracer.h"
    3741#include "comgeomfi.h"
    3842#include "dimradmars.h"
  • trunk/LMDZ.MARS/libf/phymars/yamada4.F

    r690 r1036  
    88!************************************************************
    99!************************************************************
    10       SUBROUTINE yamada4(ngrid,nlay,dt,g,rconst,plev,temp
     10      SUBROUTINE yamada4(ngrid,nlay,nq,dt,g,rconst,plev,temp
    1111     s   ,zlev,zlay,u,v,phc,pq,cd,q2,km,kn,kq,ustar
    1212     s   ,iflag_pbl)
     13      use tracer_mod, only: noms
    1314      IMPLICIT NONE
    1415!.......................................................................
     
    1617#include "dimensions.h"
    1718#include "dimphys.h"
    18 #include "tracer.h"
     19!#include "tracer.h"
    1920#include "callkeys.h"
    2021!.......................................................................
     
    6162      INTEGER, INTENT(IN)    :: iflag_pbl,ngrid
    6263      INTEGER, INTENT(IN)    :: nlay
     64      INTEGER, INTENT(IN)    :: nq
    6365      REAL,    INTENT(INOUT) :: q2(ngrid,nlay+1)
    6466      REAL,    INTENT(OUT)   :: km(ngrid,nlay+1)
     
    119121      SAVE A, B
    120122      REAL teta(ngrid,nlay)
    121       REAL pq(ngrid,nlay,nqmx)
     123      REAL pq(ngrid,nlay,nq)
    122124      REAL kminfact
    123125      INTEGER i
     
    135137        if (tracer) then
    136138!     Prepare Special treatment if one of the tracers is CO2 gas
    137            do iq=1,nqmx
     139           do iq=1,nq
    138140             if (noms(iq).eq."co2") then
    139141                ico2=iq
     
    603605#include "dimensions.h"
    604606#include "dimphys.h"
    605 #include "tracer.h"
     607!#include "tracer.h"
    606608#include "callkeys.h"
    607609!.......................................................................
     
    684686#include "dimensions.h"
    685687#include "dimphys.h"
    686 #include "tracer.h"
     688!#include "tracer.h"
    687689#include "callkeys.h"
    688690!.......................................................................
Note: See TracChangeset for help on using the changeset viewer.