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/aeronomars
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/libf/aeronomars/calchim.F90

    r658 r1036  
    1       subroutine calchim(ptimestep,pplay,pplev,pt,pdt,dist_sol,mu0,         &
     1      subroutine calchim(nq,                                                &
     2                         ptimestep,pplay,pplev,pt,pdt,dist_sol,mu0,         &
    23                         zzlev,zzlay,zday,pq,pdq,dqchim,dqschim,dqcloud,    &
    34                         dqscloud,tauref,co2ice,                            &
    45                         pu,pdu,pv,pdv,surfdust,surfice)
    56
     7      use tracer_mod, only: igcm_co2, igcm_co, igcm_o, igcm_o1d, igcm_o2, &
     8                            igcm_o3, igcm_h, igcm_h2, igcm_oh, igcm_ho2,  &
     9                            igcm_h2o2, igcm_ch4, igcm_n2, igcm_h2o_vap,   &
     10                            igcm_no, igcm_n, igcm_no2, igcm_n2d,          &
     11                            igcm_o2plus, igcm_co2plus, igcm_oplus,        &
     12                            igcm_coplus, igcm_cplus, igcm_nplus,          &
     13                            igcm_noplus, igcm_n2plus, igcm_hplus,         &
     14                            igcm_hco2plus, igcm_elec, mmol
    615      implicit none
    716
     
    5665#include "dimphys.h"
    5766#include "chimiedata.h"
    58 #include "tracer.h"
     67!#include "tracer.h"
    5968#include "comcstfi.h"
    6069#include "callkeys.h"
     
    6372!     input:
    6473
     74      integer,intent(in) :: nq ! number of tracers
    6575      real :: ptimestep
    6676      real :: pplay(ngridmx,nlayermx)    ! pressure at the middle of the layers
     
    7686      real :: dist_sol                   ! distance of the sun (AU)
    7787      real :: mu0(ngridmx)               ! cos of solar zenith angle (=1 when sun at zenith)
    78       real :: pq(ngridmx,nlayermx,nqmx)  ! tracers mass mixing ratio
    79       real :: pdq(ngridmx,nlayermx,nqmx) ! previous tendencies
     88      real :: pq(ngridmx,nlayermx,nq)  ! tracers mass mixing ratio
     89      real :: pdq(ngridmx,nlayermx,nq) ! previous tendencies
    8090      real :: zday                       ! date (time since Ls=0, in martian days)
    8191      real :: tauref(ngridmx)            ! optical depth at 7 hPa
     
    8696!     output:
    8797
    88       real :: dqchim(ngridmx,nlayermx,nqmx) ! tendencies on pq due to chemistry
    89       real :: dqschim(ngridmx,nqmx)         ! tendencies on qsurf
    90       real :: dqcloud(ngridmx,nlayermx,nqmx)! tendencies on pq due to condensation
    91       real :: dqscloud(ngridmx,nqmx)        ! tendencies on qsurf
     98      real :: dqchim(ngridmx,nlayermx,nq) ! tendencies on pq due to chemistry
     99      real :: dqschim(ngridmx,nq)         ! tendencies on qsurf
     100      real :: dqcloud(ngridmx,nlayermx,nq)! tendencies on pq due to condensation
     101      real :: dqscloud(ngridmx,nq)        ! tendencies on qsurf
    92102
    93103!     local variables:
    94104
    95105      integer,save :: nbq                   ! number of tracers used in the chemistry
    96       integer,save :: niq(nqmx)             ! array storing the indexes of the tracers
     106      integer,allocatable,save :: niq(:)    ! array storing the indexes of the tracers
    97107      integer :: iloc(1)            ! index of major species
    98108      integer :: ig,l,i,iq,iqmax
     
    133143
    134144      real    :: latvl1, lonvl1
    135       real    :: zq(ngridmx,nlayermx,nqmx) ! pq+pdq*ptimestep before chemistry
     145      real    :: zq(ngridmx,nlayermx,nq) ! pq+pdq*ptimestep before chemistry
    136146                                           ! new mole fraction after
    137147      real    :: zt(ngridmx,nlayermx)      ! temperature
     
    149159      real :: ztemp(nlayermx)        !  Temperature (K)
    150160      real :: zlocal(nlayermx)       !  Altitude (km)
    151       real :: zycol(nlayermx,nqmx)   !  Composition (mole fractions)
     161      real :: zycol(nlayermx,nq)   !  Composition (mole fractions)
    152162      real :: szacol                 !  Solar zenith angle
    153163      real :: surfice1d(nlayermx)    !  Ice surface area (cm2/cm3)
     
    172182         end if
    173183         ! find index of chemical tracers to use
     184         allocate(niq(nq))
    174185         ! Listed here are all tracers that can go into photochemistry
    175186         nbq = 0 ! to count number of tracers
  • trunk/LMDZ.MARS/libf/aeronomars/chemthermos.F90

    r705 r1036  
    22           zpress,zlocal,zenit,ptimestep,zday)
    33
     4      use tracer_mod, only: nqmx, igcm_co2, igcm_co, igcm_o, igcm_o1d,  &
     5                            igcm_o2, igcm_h, igcm_h2, igcm_oh, igcm_ho2,&
     6                            igcm_h2o2, igcm_h2o_vap, igcm_o3, igcm_n2,  &
     7                            igcm_n, igcm_no, igcm_no2, igcm_n2d,        &
     8                            igcm_co2plus, igcm_o2plus, igcm_coplus,     &
     9                            igcm_cplus, igcm_nplus, igcm_noplus,        &
     10                            igcm_n2plus, igcm_hplus, igcm_hco2plus,     &
     11                            igcm_elec, igcm_oplus
    412      IMPLICIT NONE
    513!=======================================================================
     
    2836#include "param.h"
    2937#include "param_v4.h"
    30 #include"tracer.h"
     38!#include"tracer.h"
    3139!-----------------------------------------------------------------------
    3240!    Input/Output
  • trunk/LMDZ.MARS/libf/aeronomars/concentrations.F

    r1035 r1036  
    1       SUBROUTINE concentrations(pplay,pt,pdt,pq,pdq,ptimestep)
     1      SUBROUTINE concentrations(nq,pplay,pt,pdt,pq,pdq,ptimestep)
    22                                             
     3      use tracer_mod, only: igcm_co2, igcm_co, igcm_o, igcm_o1d,
     4     &                      igcm_o2, igcm_o3, igcm_h, igcm_h2,
     5     &                      igcm_oh, igcm_ho2, igcm_n2, igcm_ar,
     6     &                      igcm_h2o_vap, igcm_n, igcm_no, igcm_no2,
     7     &                      igcm_n2d, igcm_co2plus, igcm_oplus,
     8     &                      igcm_o2plus, igcm_coplus, igcm_cplus,
     9     &                      igcm_nplus, igcm_noplus, igcm_n2plus,
     10     &                      igcm_hplus, igcm_hco2plus, mmol
    311      implicit none
    412
     
    2230#include "comdiurn.h"
    2331#include "chimiedata.h"
    24 #include "tracer.h"
     32!#include "tracer.h"
    2533#include "conc.h"
    2634
    2735!     input/output
    2836
    29       real pplay(ngridmx,nlayermx)
    30       real pt(ngridmx,nlayermx)
    31       real pdt(ngridmx,nlayermx)
    32       real pq(ngridmx,nlayermx,nqmx)
    33       real pdq(ngridmx,nlayermx,nqmx)
    34       real ptimestep
     37      integer,intent(in) :: nq ! number of tracers
     38      real,intent(in) :: pplay(ngridmx,nlayermx)
     39      real,intent(in) :: pt(ngridmx,nlayermx)
     40      real,intent(in) :: pdt(ngridmx,nlayermx)
     41      real,intent(in) :: pq(ngridmx,nlayermx,nq)
     42      real,intent(in) :: pdq(ngridmx,nlayermx,nq)
     43      real,intent(in) :: ptimestep
    3544
    3645!     local variables
    3746
    3847      integer       :: i, l, ig, iq
    39       integer, save :: nbq, niq(nqmx)
    40       real          :: ni(nqmx), ntot
    41       real          :: zq(ngridmx, nlayermx, nqmx)
     48      integer, save :: nbq
     49      integer,allocatable,save :: niq(:)
     50      real          :: ni(nq), ntot
     51      real          :: zq(ngridmx, nlayermx, nq)
    4252      real          :: zt(ngridmx, nlayermx)
    43       real, save    :: aki(nqmx)
    44       real, save    :: cpi(nqmx)
     53      real,allocatable,save    :: aki(:)
     54      real,allocatable,save    :: cpi(:)
    4555
    4656      logical, save :: firstcall = .true.
     
    4858      if (firstcall) then
    4959
     60         ! allocate local saved arrays:
     61         allocate(aki(nq))
     62         allocate(cpi(nq))
     63         allocate(niq(nq))
    5064!        find index of chemical tracers to use
    5165!        initialize thermal conductivity and specific heat coefficients
     
    217231         endif
    218232         
    219            
     233         ! tell the world about it:
     234         write(*,*) "concentrations: firstcall, nbq=",nbq
     235         write(*,*) "  niq(1:nbq)=",niq(1:nbq)
     236         write(*,*) "  aki(1:nbq)=",aki(1:nbq)
     237         write(*,*) "  cpi(1:nbq)=",cpi(1:nbq)
    220238
    221239         firstcall = .false.
  • trunk/LMDZ.MARS/libf/aeronomars/deposition.F

    r421 r1036  
    77cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
    88c
     9      use tracer_mod, only: nqmx
    910      implicit none
    1011c
  • trunk/LMDZ.MARS/libf/aeronomars/euvheat.F90

    r705 r1036  
    22           mu0,ptimestep,ptime,zday,pq,pdq,pdteuv)
    33
     4      use tracer_mod, only: nqmx, igcm_co2, igcm_co, igcm_o, igcm_o1d,  &
     5                            igcm_o2, igcm_h, igcm_h2, igcm_oh, igcm_ho2,&
     6                            igcm_h2o2, igcm_h2o_vap, igcm_o3, igcm_n2,  &
     7                            igcm_n, igcm_no, igcm_no2, igcm_n2d, mmol
    48      IMPLICIT NONE
    59!=======================================================================
     
    3438#include "param_v4.h"
    3539#include "chimiedata.h"
    36 #include "tracer.h"
     40!#include "tracer.h"
    3741#include "conc.h"
    3842!-----------------------------------------------------------------------
  • trunk/LMDZ.MARS/libf/aeronomars/inichim_newstart.F90

    r655 r1036  
    1       subroutine inichim_newstart(pq, qsurf, ps, flagh2o, flagthermo)
    2 
     1      subroutine inichim_newstart(nq, pq, qsurf, ps, flagh2o, flagthermo)
     2
     3      use tracer_mod
    34      implicit none
    45
     
    2324!  ----------
    2425!
    25 !  pq(iip1,jjp1,llm,nqmx)  Advected fields, ie chemical species here
    26 !  qsurf(ngridmx,nqmx)     Amount of tracer on the surface (kg/m2)
     26!  pq(iip1,jjp1,llm,nq)  Advected fields, ie chemical species here
     27!  qsurf(ngridmx,nq)     Amount of tracer on the surface (kg/m2)
    2728!  ps(iip1,jjp1)           Surface pressure (Pa)
    2829!  flagh2o                 flag for initialisation of h2o (1: yes / 0: no)
     
    3435#include "dimphys.h"
    3536#include "paramet.h"
    36 #include "tracer.h"
     37!#include "tracer.h"
    3738#include "comvert.h"
    3839#include "callkeys.h"
     
    4142! inputs :
    4243
     44      integer,intent(in) :: nq                    ! number of tracers
    4345      real,intent(in) :: ps(iip1,jjp1)            ! surface pressure in the gcm (Pa)   
    4446      integer,intent(in) :: flagh2o               ! flag for h2o initialisation
     
    4749! outputs :
    4850
    49       real,intent(out) :: pq(iip1,jjp1,llm,nqmx)  ! advected fields, ie chemical species
    50       real,intent(out) :: qsurf(ngridmx,nqmx)     ! surface values (kg/m2) of tracers
     51      real,intent(out) :: pq(iip1,jjp1,llm,nq)  ! advected fields, ie chemical species
     52      real,intent(out) :: qsurf(ngridmx,nq)     ! surface values (kg/m2) of tracers
    5153
    5254! local :
     
    7375
    7476! 1.1 initialize tracer indexes to zero:
    75 
     77      nqmx=nq ! initialize value of nqmx
     78     
    7679      do iq = 1,nqmx
    7780        igcm_dustbin(iq) = 0
  • trunk/LMDZ.MARS/libf/aeronomars/jthermcalc.F

    r658 r1036  
    10261026c**********************************************************************
    10271027
     1028      use tracer_mod, only: igcm_o, igcm_co2, igcm_o2, igcm_h2,
     1029     &                      igcm_h2o_vap, igcm_h2o2, igcm_co, igcm_h,
     1030     &                      igcm_o3, igcm_n2, igcm_n, igcm_no, igcm_no2,
     1031     &                      mmol
    10281032      implicit none
    10291033
     
    10321036      include "dimensions.h"
    10331037      include "dimphys.h"
    1034       include "tracer.h"
     1038!      include "tracer.h"
    10351039      include 'param.h'
    10361040      include 'param_v4.h'
  • trunk/LMDZ.MARS/libf/aeronomars/moldiff.F

    r690 r1036  
    22     &                   zzlay,pdteuv,pdtconduc,pdqdiff)
    33
    4 
     4      use tracer_mod, only: nqmx, igcm_co2, igcm_co, igcm_o, igcm_o1d,
     5     &                      igcm_o2, igcm_o3, igcm_h, igcm_h2, igcm_oh,
     6     &                      igcm_ho2, igcm_h2o2, igcm_n2, igcm_ar,
     7     &                      igcm_h2o_vap, mmol
    58      implicit none
    69
     
    1114#include "comdiurn.h"
    1215#include "chimiedata.h"
    13 #include "tracer.h"
     16!#include "tracer.h"
    1417#include "conc.h"
    1518
  • trunk/LMDZ.MARS/libf/aeronomars/moldiff_red.F90

    r1020 r1036  
    11subroutine moldiff_red(pplay,pplev,pt,pdt,pq,pdq,ptimestep,zzlay,pdteuv,pdtconduc,pdqdiff)
     2
     3use tracer_mod, only: nqmx, noms, mmol
    24
    35implicit none
     
    911#include "comdiurn.h"
    1012#include "chimiedata.h"
    11 #include "tracer.h"
     13!#include "tracer.h"
    1214#include "conc.h"
    1315#include "diffusion.h"
     
    904906
    905907        SUBROUTINE QMNEW(Q1,DQ,Q2,dtime,nl,nq,gc,ig)
     908        use tracer_mod, only: nqmx
    906909        IMPLICIT NONE
    907 #include "dimensions.h"
     910!#include "dimensions.h"
    908911
    909912        INTEGER,INTENT(IN) :: nl,nq
     
    939942
    940943        SUBROUTINE MMOY(massemoy,mmol,qq,gc,nl,nq)
    941         IMPLICIT NONE
    942 #include "dimensions.h"
     944        use tracer_mod, only: nqmx
     945        IMPLICIT NONE
     946!#include "dimensions.h"
    943947
    944948        INTEGER :: nl,nq,l
     
    10231027     & qq,mmol,gc,Praf,Traf,Qraf,Mraf,Zraf,                             &
    10241028     & Nraf,Nrafk,Rraf,Rrafk,il,nl,nq,nlx,ig)
     1029        use tracer_mod, only: nqmx
    10251030        IMPLICIT NONE
    1026 #include "dimensions.h"
     1031!#include "dimensions.h"
    10271032       
    10281033        INTEGER :: nl,nq,il,l,i,iq,nlx,iz,ig
     
    13641369        SUBROUTINE GCMGRID_P(Z,P,Q,T,Nk,Rk,qq,qnew,tt,tnew,             &
    13651370     &    pp,M,gc,nl,nq,nlx,ig)
    1366         IMPLICIT NONE
    1367 #include "dimensions.h"
     1371        use tracer_mod, only: nqmx
     1372        IMPLICIT NONE
     1373!#include "dimensions.h"
    13681374        INTEGER :: nl,nq,nlx,il,nn,iP,ig,compteur
    13691375        INTEGER,DIMENSION(1) :: indP
     
    14651471        SUBROUTINE GCMGRID_P2(Z,P,Q,T,Nk,Rk,qq,qnew,tt,tnew             &
    14661472     &   ,pp,M,gc,nl,nq,nlx,facM,ig)
     1473        use tracer_mod, only: nqmx
    14671474        IMPLICIT NONE
    1468 #include "dimensions.h"
     1475!#include "dimensions.h"
    14691476        INTEGER :: nl,nq,nlx,il,nn,iP,ig,compteur
    14701477        INTEGER,DIMENSION(1) :: indP
  • trunk/LMDZ.MARS/libf/aeronomars/moldiffcoeff.F

    r414 r1036  
    11      subroutine moldiffcoeff(dij)
     2
     3      use tracer_mod, only: igcm_co2, igcm_co, igcm_o, igcm_o1d,
     4     &                      igcm_o2, igcm_o3, igcm_h, igcm_h2, igcm_oh,
     5     &                      igcm_ho2, igcm_h2o2, igcm_n2, igcm_ar,
     6     &                      igcm_h2o_vap, mmol
    27
    38       IMPLICIT NONE
     
    1621#include "comdiurn.h"
    1722#include "chimiedata.h"
    18 #include "tracer.h"
     23!#include "tracer.h"
    1924#include "conc.h"
    2025
  • trunk/LMDZ.MARS/libf/aeronomars/moldiffcoeff_red.F

    r710 r1036  
    11      subroutine moldiffcoeff_red(dij,indic,gcmind,ncompdiff2)
    22
     3       use tracer_mod, only: nqmx, noms, mmol
    34       IMPLICIT NONE
    45c=======================================================================
     
    1617#include "comdiurn.h"
    1718#include "chimiedata.h"
    18 #include "tracer.h"
     19!#include "tracer.h"
    1920#include "conc.h"
    2021#include "diffusion.h"
  • trunk/LMDZ.MARS/libf/aeronomars/perosat.F

    r658 r1036  
    22     $                   pplev, pplay, zt,
    33     &                   zy, pdqcloud, pdqscloud)
     4      use tracer_mod, only: nqmx, igcm_h2o2, mmol
    45      IMPLICIT NONE
    56
     
    1415c
    1516c     WARNING : H2O2 mixing ratio is assumed to be q(igcm_h2o2)   
    16 c               index igcm_h2o2 is known from tracer.h
     17c               index igcm_h2o2 is known from tracer_mod
    1718c=======================================================================
    1819
     
    2526#include "comcstfi.h"
    2627#include "chimiedata.h"
    27 #include "tracer.h"
     28!#include "tracer.h"
    2829#include "conc.h"
    2930c
  • trunk/LMDZ.MARS/libf/aeronomars/photochemistry.F

    r690 r1036  
    1414     $                  surfice1d, jo3, tau)
    1515c
     16      use tracer_mod, only: nqmx
    1617      implicit none
    1718c
     
    2021#include "chimiedata.h"
    2122#include "callkeys.h"
    22 #include "tracer.h"
     23!#include "tracer.h"
    2324c
    2425cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
     
    11521153c*****************************************************************
    11531154c
     1155      use tracer_mod, only: nqmx, igcm_co2, igcm_co, igcm_o, igcm_o1d,
     1156     &                      igcm_o2, igcm_o3, igcm_h, igcm_h2, igcm_oh,
     1157     &                      igcm_ho2, igcm_h2o2, igcm_n2, igcm_h2o_vap,
     1158     &                      igcm_ch4
    11541159      implicit none
    11551160c
     
    11571162#include "dimphys.h"
    11581163#include "callkeys.h"
    1159 #include "tracer.h"
     1164!#include "tracer.h"
    11601165c
    11611166cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
     
    12501255c*****************************************************************
    12511256c
     1257      use tracer_mod, only: nqmx, igcm_co2, igcm_co, igcm_o, igcm_o1d,
     1258     &                      igcm_o2, igcm_o3, igcm_h, igcm_h2, igcm_oh,
     1259     &                      igcm_ho2, igcm_h2o2, igcm_n2, igcm_h2o_vap,
     1260     &                      igcm_ch4
    12521261      implicit none
    12531262c
     
    12551264#include "dimphys.h"
    12561265#include "callkeys.h"
    1257 #include "tracer.h"
     1266!#include "tracer.h"
    12581267c
    12591268cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  • trunk/LMDZ.MARS/libf/aeronomars/surfacearea.F

    r635 r1036  
    55     $                       surfdust, surfice)
    66
     7      use tracer_mod, only: nuice_sed, igcm_dust_number,
     8     &                      igcm_ccn_number, varian, ccn_factor
    79      implicit none
    810
     
    1921#include "comcstfi.h"
    2022#include "callkeys.h"
    21 #include "tracer.h"
     23!#include "tracer.h"
    2224#include "dimradmars.h"
    2325#include "chimiedata.h"
  • trunk/LMDZ.MARS/libf/aeronomars/thermosphere.F

    r658 r1036  
    44     $     zdteuv,zdtconduc,zdumolvis,zdvmolvis,zdqmoldiff)
    55
     6      use tracer_mod, only: nqmx ! number of advecter tracers
    67      implicit none
    78
Note: See TracChangeset for help on using the changeset viewer.