Ignore:
Timestamp:
Sep 23, 2013, 9:56:47 AM (11 years ago)
Author:
emillour
Message:

Mars GCM:

  • IMPORTANT CHANGE: Removed all reference/use of ngridmx (dimphys.h) in routines (necessary prerequisite to using parallel dynamics); in most cases this just means adding 'ngrid' as routine argument, and making local saved variables allocatable (and allocated at first call). In the process, had to convert many *.h files to equivalent modules: yomaer.h => yomaer_h.F90 , surfdat.h => surfdat_h.F90 , comsaison.h => comsaison_h.F90 , yomlw.h => yomlw_h.F90 , comdiurn.h => comdiurn_h.F90 , dimradmars.h => dimradmars_mod.F90 , comgeomfi.h => comgeomfi_h.F90, comsoil.h => comsoil_h.F90 , slope.h => slope_mod.F90
  • Also updated EOF routines, everything is now in eofdump_mod.F90
  • Removed unused routine lectfux.F (in dyn3d)

EM

Location:
trunk/LMDZ.MARS/libf/aeronomars
Files:
1 added
1 deleted
16 edited

Legend:

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

    r1036 r1047  
    1       subroutine calchim(nq,                                                &
     1      subroutine calchim(ngrid,nlayer,nq,                                   &
    22                         ptimestep,pplay,pplev,pt,pdt,dist_sol,mu0,         &
    33                         zzlev,zzlay,zday,pq,pdq,dqchim,dqschim,dqcloud,    &
     
    1313                            igcm_noplus, igcm_n2plus, igcm_hplus,         &
    1414                            igcm_hco2plus, igcm_elec, mmol
     15      use conc_mod, only: mmean ! mean molecular mass of the atmosphere
     16
    1517      implicit none
    1618
     
    3840!
    3941!    ptimestep                  timestep (s)
    40 !    pplay(ngridmx,nlayermx)    Pressure at the middle of the layers (Pa)
    41 !    pplev(ngridmx,nlayermx+1)  Intermediate pressure levels (Pa)
    42 !    pt(ngridmx,nlayermx)       Temperature (K)
    43 !    pdt(ngridmx,nlayermx)      Temperature tendency (K)
    44 !    pu(ngridmx,nlayermx)       u component of the wind (ms-1)
    45 !    pdu(ngridmx,nlayermx)      u component tendency (K)
    46 !    pv(ngridmx,nlayermx)       v component of the wind (ms-1)
    47 !    pdv(ngridmx,nlayermx)      v component tendency (K)
     42!    pplay(ngrid,nlayer)    Pressure at the middle of the layers (Pa)
     43!    pplev(ngrid,nlayer+1)  Intermediate pressure levels (Pa)
     44!    pt(ngrid,nlayer)       Temperature (K)
     45!    pdt(ngrid,nlayer)      Temperature tendency (K)
     46!    pu(ngrid,nlayer)       u component of the wind (ms-1)
     47!    pdu(ngrid,nlayer)      u component tendency (K)
     48!    pv(ngrid,nlayer)       v component of the wind (ms-1)
     49!    pdv(ngrid,nlayer)      v component tendency (K)
    4850!    dist_sol                   distance of the sun (AU)
    49 !    mu0(ngridmx)               cos of solar zenith angle (=1 when sun at zenith)
    50 !    pq(ngridmx,nlayermx,nqmx)  Advected fields, ie chemical species here
    51 !    pdq(ngridmx,nlayermx,nqmx) Previous tendencies on pq
    52 !    tauref(ngridmx)            Optical depth at 7 hPa
    53 !    co2ice(ngridmx)            co2 ice surface layer (kg.m-2)
    54 !    surfdust(ngridmx,nlayermx) dust surface area (m2/m3)
    55 !    surfice(ngridmx,nlayermx)  ice surface area (m2/m3)
     51!    mu0(ngrid)               cos of solar zenith angle (=1 when sun at zenith)
     52!    pq(ngrid,nlayer,nq)  Advected fields, ie chemical species here
     53!    pdq(ngrid,nlayer,nq) Previous tendencies on pq
     54!    tauref(ngrid)            Optical depth at 7 hPa
     55!    co2ice(ngrid)            co2 ice surface layer (kg.m-2)
     56!    surfdust(ngrid,nlayer) dust surface area (m2/m3)
     57!    surfice(ngrid,nlayer)  ice surface area (m2/m3)
    5658!
    5759!  Output:
    5860!
    59 !    dqchim(ngridmx,nlayermx,nqmx) ! tendencies on pq due to chemistry
    60 !    dqschim(ngridmx,nqmx)         ! tendencies on qsurf
    61 !
    62 !=======================================================================
    63 
    64 #include "dimensions.h"
    65 #include "dimphys.h"
     61!    dqchim(ngrid,nlayer,nq) ! tendencies on pq due to chemistry
     62!    dqschim(ngrid,nq)         ! tendencies on qsurf
     63!
     64!=======================================================================
     65
     66!#include "dimensions.h"
     67!#include "dimphys.h"
    6668#include "chimiedata.h"
    6769!#include "tracer.h"
    6870#include "comcstfi.h"
    6971#include "callkeys.h"
    70 #include "conc.h"
     72!#include "conc.h"
    7173
    7274!     input:
    7375
     76      integer,intent(in) :: ngrid ! number of atmospheric columns
     77      integer,intent(in) :: nlayer ! number of atmospheric layers
    7478      integer,intent(in) :: nq ! number of tracers
    7579      real :: ptimestep
    76       real :: pplay(ngridmx,nlayermx)    ! pressure at the middle of the layers
    77       real :: zzlay(ngridmx,nlayermx)    ! pressure at the middle of the layers
    78       real :: pplev(ngridmx,nlayermx+1)  ! intermediate pressure levels
    79       real :: zzlev(ngridmx,nlayermx+1)  ! altitude at layer boundaries
    80       real :: pt(ngridmx,nlayermx)       ! temperature
    81       real :: pdt(ngridmx,nlayermx)      ! temperature tendency
    82       real :: pu(ngridmx,nlayermx)       ! u component of the wind (m.s-1)
    83       real :: pdu(ngridmx,nlayermx)      ! u component tendency
    84       real :: pv(ngridmx,nlayermx)       ! v component of the wind (m.s-1)
    85       real :: pdv(ngridmx,nlayermx)      ! v component tendency
     80      real :: pplay(ngrid,nlayer)    ! pressure at the middle of the layers
     81      real :: zzlay(ngrid,nlayer)    ! pressure at the middle of the layers
     82      real :: pplev(ngrid,nlayer+1)  ! intermediate pressure levels
     83      real :: zzlev(ngrid,nlayer+1)  ! altitude at layer boundaries
     84      real :: pt(ngrid,nlayer)       ! temperature
     85      real :: pdt(ngrid,nlayer)      ! temperature tendency
     86      real :: pu(ngrid,nlayer)       ! u component of the wind (m.s-1)
     87      real :: pdu(ngrid,nlayer)      ! u component tendency
     88      real :: pv(ngrid,nlayer)       ! v component of the wind (m.s-1)
     89      real :: pdv(ngrid,nlayer)      ! v component tendency
    8690      real :: dist_sol                   ! distance of the sun (AU)
    87       real :: mu0(ngridmx)               ! cos of solar zenith angle (=1 when sun at zenith)
    88       real :: pq(ngridmx,nlayermx,nq)  ! tracers mass mixing ratio
    89       real :: pdq(ngridmx,nlayermx,nq) ! previous tendencies
     91      real :: mu0(ngrid)               ! cos of solar zenith angle (=1 when sun at zenith)
     92      real :: pq(ngrid,nlayer,nq)  ! tracers mass mixing ratio
     93      real :: pdq(ngrid,nlayer,nq) ! previous tendencies
    9094      real :: zday                       ! date (time since Ls=0, in martian days)
    91       real :: tauref(ngridmx)            ! optical depth at 7 hPa
    92       real :: co2ice(ngridmx)            ! co2 ice surface layer (kg.m-2)
    93       real :: surfdust(ngridmx,nlayermx) ! dust surface area (m2/m3)
    94       real :: surfice(ngridmx,nlayermx)  !  ice surface area (m2/m3)
     95      real :: tauref(ngrid)            ! optical depth at 7 hPa
     96      real :: co2ice(ngrid)            ! co2 ice surface layer (kg.m-2)
     97      real :: surfdust(ngrid,nlayer) ! dust surface area (m2/m3)
     98      real :: surfice(ngrid,nlayer)  !  ice surface area (m2/m3)
    9599
    96100!     output:
    97101
    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
     102      real :: dqchim(ngrid,nlayer,nq) ! tendencies on pq due to chemistry
     103      real :: dqschim(ngrid,nq)         ! tendencies on qsurf
     104      real :: dqcloud(ngrid,nlayer,nq)! tendencies on pq due to condensation
     105      real :: dqscloud(ngrid,nq)        ! tendencies on qsurf
    102106
    103107!     local variables:
     
    143147
    144148      real    :: latvl1, lonvl1
    145       real    :: zq(ngridmx,nlayermx,nq) ! pq+pdq*ptimestep before chemistry
     149      real    :: zq(ngrid,nlayer,nq) ! pq+pdq*ptimestep before chemistry
    146150                                           ! new mole fraction after
    147       real    :: zt(ngridmx,nlayermx)      ! temperature
    148       real    :: zu(ngridmx,nlayermx)      ! u component of the wind
    149       real    :: zv(ngridmx,nlayermx)      ! v component of the wind
     151      real    :: zt(ngrid,nlayer)      ! temperature
     152      real    :: zu(ngrid,nlayer)      ! u component of the wind
     153      real    :: zv(ngrid,nlayer)      ! v component of the wind
    150154      real    :: taucol                    ! optical depth at 7 hPa
    151155
     
    155159!     for each column of atmosphere:
    156160
    157       real :: zpress(nlayermx)       !  Pressure (mbar)
    158       real :: zdens(nlayermx)        !  Density  (cm-3)
    159       real :: ztemp(nlayermx)        !  Temperature (K)
    160       real :: zlocal(nlayermx)       !  Altitude (km)
    161       real :: zycol(nlayermx,nq)   !  Composition (mole fractions)
     161      real :: zpress(nlayer)       !  Pressure (mbar)
     162      real :: zdens(nlayer)        !  Density  (cm-3)
     163      real :: ztemp(nlayer)        !  Temperature (K)
     164      real :: zlocal(nlayer)       !  Altitude (km)
     165      real :: zycol(nlayer,nq)   !  Composition (mole fractions)
    162166      real :: szacol                 !  Solar zenith angle
    163       real :: surfice1d(nlayermx)    !  Ice surface area (cm2/cm3)
    164       real :: surfdust1d(nlayermx)   !  Dust surface area (cm2/cm3)
    165       real :: jo3(nlayermx)          !  Photodissociation rate O3->O1D (s-1)
     167      real :: surfice1d(nlayer)    !  Ice surface area (cm2/cm3)
     168      real :: surfdust1d(nlayer)   !  Dust surface area (cm2/cm3)
     169      real :: jo3(nlayer)          !  Photodissociation rate O3->O1D (s-1)
    166170
    167171!     for output:
     
    169173      logical :: output                 ! to issue calls to writediagfi and stats
    170174      parameter (output = .true.)
    171       real :: jo3_3d(ngridmx,nlayermx)  ! Photodissociation rate O3->O1D (s-1)
     175      real :: jo3_3d(ngrid,nlayer)  ! Photodissociation rate O3->O1D (s-1)
    172176
    173177!=======================================================================
     
    592596!=======================================================================
    593597
    594       do ig = 1,ngridmx
     598      do ig = 1,ngrid
    595599         
    596600         foundswitch = 0
    597          do l = 1,nlayermx
     601         do l = 1,nlayer
    598602            do i = 1,nbq
    599603               iq = niq(i) ! get tracer index
     
    626630            end if
    627631            if (.not. thermochem) then
    628                lswitch = min(50,nlayermx+1)
     632               lswitch = min(50,nlayer+1)
    629633            end if
    630634
    631          end do ! of do l=1,nlayermx
     635         end do ! of do l=1,nlayer
    632636
    633637         szacol = acos(mu0(ig))*180./pi
     
    647651!        ozone photolysis, for output
    648652
    649             do l = 1,nlayermx
     653            do l = 1,nlayer
    650654               jo3_3d(ig,l) = jo3(l)
    651655            end do
     
    653657!        condensation of h2o2
    654658
    655             call perosat(ig,ptimestep,pplev,pplay,                 &
     659            call perosat(ngrid, nlayer, nq,                        &
     660                         ig,ptimestep,pplev,pplay,                 &
    656661                         ztemp,zycol,dqcloud,dqscloud)
    657662         end if
     
    667672
    668673         if (depos) then
    669             call deposition(ig, ig_vl1, pplay, pplev, zzlay, zzlev,&
     674            call deposition(ngrid, nlayer, nq,                      &
     675                            ig, ig_vl1, pplay, pplev, zzlay, zzlev, &
    670676                            zu, zv, zt, zycol, ptimestep, co2ice)
    671677         end if
     
    679685
    680686!     tendency for the most abundant species = - sum of others
    681          do l = 1,nlayermx
     687         do l = 1,nlayer
    682688            iloc=maxloc(zycol(l,:))
    683689            iqmax=iloc(1)
     
    691697               end if
    692698            end do
    693          end do ! of do l = 1,nlayermx
     699         end do ! of do l = 1,nlayer
    694700
    695701!=======================================================================
     
    697703!=======================================================================
    698704
    699       end do ! of do ig=1,ngridmx
     705      end do ! of do ig=1,ngrid
    700706
    701707!=======================================================================
     
    707713
    708714      if (photochem .and. output) then
    709          if (ngridmx > 1) then
    710             call writediagfi(ngridmx,'jo3','j o3->o1d',    &
     715         if (ngrid > 1) then
     716            call writediagfi(ngrid,'jo3','j o3->o1d',    &
    711717                             's-1',3,jo3_3d(1,1))
    712718           if (callstats) then
    713               call wstats(ngridmx,'jo3','j o3->o1d',       &
     719              call wstats(ngrid,'jo3','j o3->o1d',       &
    714720                          's-1',3,jo3_3d(1,1))
    715721           endif
    716          end if ! of if (ngridmx.gt.1)
     722         end if ! of if (ngrid.gt.1)
    717723      end if ! of if (output)
    718724
  • trunk/LMDZ.MARS/libf/aeronomars/chemthermos.F90

    r1036 r1047  
    3333#include "comcstfi.h"
    3434#include "callkeys.h"
    35 #include "comdiurn.h"
     35!#include "comdiurn.h"
    3636#include "param.h"
    3737#include "param_v4.h"
  • trunk/LMDZ.MARS/libf/aeronomars/concentrations.F

    r1036 r1047  
    1       SUBROUTINE concentrations(nq,pplay,pt,pdt,pq,pdq,ptimestep)
     1      SUBROUTINE concentrations(ngrid,nlayer,nq,
     2     &                          pplay,pt,pdt,pq,pdq,ptimestep)
    23                                             
    34      use tracer_mod, only: igcm_co2, igcm_co, igcm_o, igcm_o1d,
     
    910     &                      igcm_nplus, igcm_noplus, igcm_n2plus,
    1011     &                      igcm_hplus, igcm_hco2plus, mmol
     12      use conc_mod, only: mmean, Akknew, rnew, cpnew
     13                         
    1114      implicit none
    1215
     
    1417! CALCULATION OF MEAN MOLECULAR MASS, Cp, Akk and R
    1518!
    16 ! mmean(ngridmx,nlayermx)       amu
    17 ! cpnew(ngridmx,nlayermx)       J/kg/K
    18 ! rnew(ngridmx,nlayermx)        J/kg/K
    19 ! akknew(ngridmx,nlayermx)      coefficient of thermal concduction
     19! mmean(ngrid,nlayer)   amu
     20! cpnew(ngrid,nlayer)   J/kg/K
     21! rnew(ngrid,nlayer)    J/kg/K
     22! akknew(ngrid,nlayer)  coefficient of thermal concduction
    2023!
    2124! version: April 2012 - Franck Lefevre
     
    2427!     declarations
    2528 
    26 #include "dimensions.h"
    27 #include "dimphys.h"
     29!#include "dimensions.h"
     30!#include "dimphys.h"
    2831#include "comcstfi.h"
    2932#include "callkeys.h"
    30 #include "comdiurn.h"
     33!#include "comdiurn.h"
    3134#include "chimiedata.h"
    3235!#include "tracer.h"
    33 #include "conc.h"
     36!#include "conc.h"
    3437
    3538!     input/output
    3639
     40      integer,intent(in) :: ngrid ! number of atmospheric columns
     41      integer,intent(in) :: nlayer ! number of atmospheric layers
    3742      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) :: pplay(ngrid,nlayer)
     44      real,intent(in) :: pt(ngrid,nlayer)
     45      real,intent(in) :: pdt(ngrid,nlayer)
     46      real,intent(in) :: pq(ngrid,nlayer,nq)
     47      real,intent(in) :: pdq(ngrid,nlayer,nq)
    4348      real,intent(in) :: ptimestep
    4449
     
    4954      integer,allocatable,save :: niq(:)
    5055      real          :: ni(nq), ntot
    51       real          :: zq(ngridmx, nlayermx, nq)
    52       real          :: zt(ngridmx, nlayermx)
     56      real          :: zq(ngrid, nlayer, nq)
     57      real          :: zt(ngrid, nlayer)
    5358      real,allocatable,save    :: aki(:)
    5459      real,allocatable,save    :: cpi(:)
     
    243248!     update temperature
    244249
    245       do l = 1,nlayermx
    246          do ig = 1,ngridmx
     250      do l = 1,nlayer
     251         do ig = 1,ngrid
    247252            zt(ig,l) = pt(ig,l) + pdt(ig,l)*ptimestep
    248253         end do
     
    251256!     update tracers
    252257
    253       do l = 1,nlayermx
    254          do ig = 1,ngridmx
     258      do l = 1,nlayer
     259         do ig = 1,ngrid
    255260            do i = 1,nbq
    256261               iq = niq(i)
     
    266271      mmean(:,:)  = 0.
    267272
    268       do l = 1,nlayermx
    269          do ig = 1,ngridmx
     273      do l = 1,nlayer
     274         do ig = 1,ngrid
    270275            do i = 1,nbq
    271276               iq = niq(i)
     
    283288      akknew(:,:) = 0.
    284289
    285       do l = 1,nlayermx
    286          do ig = 1,ngridmx
     290      do l = 1,nlayer
     291         do ig = 1,ngrid
    287292            ntot = pplay(ig,l)/(1.381e-23*zt(ig,l))*1.e-6  ! in #/cm3
    288293            do i = 1,nbq
  • trunk/LMDZ.MARS/libf/aeronomars/conduction.F

    r38 r1047  
    1        SUBROUTINE conduction(ptimestep,pplay,pplev,pt,pdt,
     1       SUBROUTINE conduction(ngrid,nlayer,ptimestep,pplay,pplev,pt,pdt,
    22     $                   tsurf,zzlev,zzlay,zdtconduc)
    33
     4      use conc_mod, only: Akknew, rnew, cpnew
    45      IMPLICIT NONE
    56
     
    1617c-----------------------------------------------------------------------
    1718
    18 #include "dimensions.h"
    19 #include "dimphys.h"
    20 #include "comcstfi.h"
    21 #include "surfdat.h"
    22 #include "chimiedata.h"
    23 #include "conc.h"
     19!#include "dimensions.h"
     20!#include "dimphys.h"
     21!#include "comcstfi.h"
     22!#include "surfdat.h"
     23!#include "chimiedata.h"
     24!#include "conc.h"
    2425
    2526c   arguments:
    2627c   ----------
    2728
    28       REAL ptimestep
    29       REAL pplay(ngridmx,nlayermx)
    30       real pplev(ngridmx,nlayermx+1)
    31       REAL zzlay(ngridmx,nlayermx)
    32       real zzlev(ngridmx,nlayermx+1)
    33       REAL pt(ngridmx,nlayermx)
    34       real pdt(ngridmx,nlayermx)
    35       real tsurf(ngridmx)
     29      integer,intent(in) :: ngrid ! number of atmospheric columns
     30      integer,intent(in) :: nlayer ! number of atmospheric layers
     31      real,intent(in) :: ptimestep
     32      REAL,intent(in) :: pplay(ngrid,nlayer)
     33      real,intent(in) :: pplev(ngrid,nlayer+1)
     34      REAL,intent(in) :: zzlay(ngrid,nlayer)
     35      real,intent(in) :: zzlev(ngrid,nlayer+1)
     36      REAL,intent(in) :: pt(ngrid,nlayer)
     37      real,intent(in) :: pdt(ngrid,nlayer)
     38      real,intent(in) :: tsurf(ngrid)
    3639
    37       real zdtconduc(ngridmx,nlayermx)
     40      real,intent(out) :: zdtconduc(ngrid,nlayer)
    3841
    3942c   local:
     
    4144
    4245      INTEGER i,ig,l
    43       INTEGER,SAVE :: ngrid, nz
    4446      real Akk
    4547      real,save :: phitop
    4648      real m,tmean
    47       REAL alpha(nlayermx)
    48       real zt(nlayermx)
    49       REAL lambda(nlayermx)
    50       real muvol(nlayermx)
    51       REAL C(nlayermx)
    52       real D(nlayermx)
    53       real den(nlayermx)
    54       REAL pdtc(nlayermx)
    55       real zlay(nlayermx)
    56       real zlev(nlayermx+1)
     49      REAL alpha(nlayer)
     50      real zt(nlayer)
     51      REAL lambda(nlayer)
     52      real muvol(nlayer)
     53      REAL C(nlayer)
     54      real D(nlayer)
     55      real den(nlayer)
     56      REAL pdtc(nlayer)
     57      real zlay(nlayer)
     58      real zlev(nlayer+1)
    5759
    5860c   constants used locally
     
    7880! Initialize phitop
    7981        phitop=0.0
    80 ! Initialize ngrid and nz
    81         ngrid=ngridmx
    82         nz=nlayermx
    8382       
    8483        firstcall = .false.
     
    9392        zlev(1)=zzlev(ig,1)
    9493     
    95         do i=2,nz
     94        do i=2,nlayer
    9695
    9796          zt(i)=pt(ig,i)+pdt(ig,i)*ptimestep
     
    107106        enddo
    108107       
    109 c        zlev(nz+1)= zlev(nz)
    110 c     &         -log(max(pplev(ig,nz+1),1.e-30)/pplev(ig,nz))
    111 c     &           *Rnew(ig,nz)*tmean/g
    112 c        if(pplev(ig,nz+1).eq.0.)
    113 c     &     zlev(nz+1)=zlev(nz)+(zlay(nz)-zlay(nz-1))
     108c        zlev(nlayer+1)= zlev(nlayer)
     109c     &         -log(max(pplev(ig,nlayer+1),1.e-30)/pplev(ig,nlayer))
     110c     &           *Rnew(ig,nlayer)*tmean/g
     111c        if(pplev(ig,nlayer+1).eq.0.)
     112c     &     zlev(nlayer+1)=zlev(nlayer)+(zlay(nlayer)-zlay(nlayer-1))
    114113     
    115         zlev(nz+1)= zlev(nz)+10000.
     114        zlev(nlayer+1)= zlev(nlayer)+10000.
    116115
    117116        Akk=Akknew(ig,1)
    118117        lambda(1) = Akk*tsurf(ig)**skk/zlay(1)   
    119118
    120         DO i = 2 , nz
     119        DO i = 2 , nlayer
    121120          Akk=Akknew(ig,i)
    122121          lambda(i)=Akk*zt(i)**skk/(zlay(i)-zlay(i-1))
    123122        ENDDO
    124         DO i=1,nz-1
     123        DO i=1,nlayer-1
    125124          muvol(i)=pplay(ig,i)/(rnew(ig,i)*zt(i))
    126125          alpha(i)=cpnew(ig,i)*(muvol(i)/ptimestep)
     
    128127        ENDDO
    129128
    130         muvol(nz)=pplay(ig,nz)/(rnew(ig,nz)*zt(nz))
    131         alpha(nz)=cpnew(ig,i)*(muvol(nz)/ptimestep)
    132      $                       *(zlev(nz+1)-zlev(nz))
     129        muvol(nlayer)=pplay(ig,nlayer)/(rnew(ig,nlayer)*zt(nlayer))
     130        alpha(nlayer)=cpnew(ig,i)*(muvol(nlayer)/ptimestep)
     131     $                       *(zlev(nlayer+1)-zlev(nlayer))
    133132
    134133c--------------------------------------------------------------------
     
    143142        D(1)=lambda(2)/den(1)           
    144143   
    145         DO i = 2,nz-1
     144        DO i = 2,nlayer-1
    146145          den(i)=alpha(i)+lambda(i+1)
    147146          den(i)=den(i)+lambda(i)*(1-D(i-1))
     
    154153        ENDDO
    155154
    156         den(nz)=alpha(nz) + lambda(nz) * (1-D(nz-1))
    157         C(nz)=C(nz-1)+zt(nz-1)-zt(nz)
    158         C(nz)=(C(nz)*lambda(nz)+phitop) / den(nz)
     155        den(nlayer)=alpha(nlayer) + lambda(nlayer) * (1-D(nlayer-1))
     156        C(nlayer)=C(nlayer-1)+zt(nlayer-1)-zt(nlayer)
     157        C(nlayer)=(C(nlayer)*lambda(nlayer)+phitop) / den(nlayer)
    159158               
    160159c----------------------------------------------------------------------
     
    164163c----------------------------------------------------------------------
    165164
    166         DO i=1,nz
     165        DO i=1,nlayer
    167166          pdtc(i)=0.
    168167        ENDDO
    169         pdtc(nz)=C(nz)
    170         DO i=nz-1,1,-1
     168        pdtc(nlayer)=C(nlayer)
     169        DO i=nlayer-1,1,-1
    171170          pdtc(i)=C(i)+D(i)*pdtc(i+1)
    172171        ENDDO
     
    177176c-----------------------------------------------------------------------
    178177   
    179         DO i=1,nz
     178        DO i=1,nlayer
    180179          zdtconduc(ig,i)=pdtc(i)/ptimestep
    181180        ENDDO
  • trunk/LMDZ.MARS/libf/aeronomars/deposition.F

    r1036 r1047  
    1       subroutine deposition(ig, ig_vl1, pplay, pplev, zzlay, zzlev,
     1      subroutine deposition(ngrid, nlayer, nq,
     2     &                      ig, ig_vl1, pplay, pplev, zzlay, zzlev,
    23     $                      zu, zv, zt, zycol, ptimestep, co2ice)
    34cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
     
    78cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
    89c
    9       use tracer_mod, only: nqmx
     10      use surfdat_h, only: z0 ! surface roughness
     11      use conc_mod, only: rnew ! specific gas constant
    1012      implicit none
    1113c
    12 #include "dimensions.h"
    13 #include "dimphys.h"
    14 #include "planete.h"
    15 #include "chimiedata.h"
    16 #include "conc.h"
    17 #include "surfdat.h"
     14!#include "dimensions.h"
     15!#include "dimphys.h"
     16!#include "planete.h"
     17!#include "chimiedata.h"
     18!#include "conc.h"
     19!#include "surfdat.h"
    1820c
    1921c     input
    2022c
    21       integer ig                         ! grid point index
    22       integer ig_vl1                     ! viking 1 grid point
    23       real    pplay(ngridmx,nlayermx)    ! pressure at the middle of the layers (pa)
    24       real    pplev(ngridmx,nlayermx+1)  ! pressure at layer boundaries (pa)
    25       real    zzlay(ngridmx,nlayermx)    ! altitude at the middle of the layers (m)
    26       real    zzlev(ngridmx,nlayermx+1)  ! altitude at layer boundaries (m)
    27       real    zu(ngridmx,nlayermx)       ! u component of the wind (m.s-1)
    28       real    zv(ngridmx,nlayermx)       ! v component of the wind (m.s-1)
    29       real    zt(ngridmx,nlayermx)       ! temperature (k)
    30       real    zycol(nlayermx,nqmx)       ! composition (volume mixing ratio)
    31       real    ptimestep                  ! physical timestep (s)
    32       real    co2ice(ngridmx)            ! co2 ice surface layer (kg.m-2)
     23      integer,intent(in) :: ngrid ! number of atmospheric columns
     24      integer,intent(in) :: nlayer ! number of atmospheric layers
     25      integer,intent(in) :: nq ! number of tracers
     26      integer ig                     ! grid point index
     27      integer ig_vl1                 ! viking 1 grid point
     28      real    pplay(ngrid,nlayer)    ! pressure at the middle of the layers (pa)
     29      real    pplev(ngrid,nlayer+1)  ! pressure at layer boundaries (pa)
     30      real    zzlay(ngrid,nlayer)    ! altitude at the middle of the layers (m)
     31      real    zzlev(ngrid,nlayer+1)  ! altitude at layer boundaries (m)
     32      real    zu(ngrid,nlayer)       ! u component of the wind (m.s-1)
     33      real    zv(ngrid,nlayer)       ! v component of the wind (m.s-1)
     34      real    zt(ngrid,nlayer)       ! temperature (k)
     35      real    zycol(nlayer,nq)       ! composition (volume mixing ratio)
     36      real    ptimestep              ! physical timestep (s)
     37      real    co2ice(ngrid)          ! co2 ice surface layer (kg.m-2)
    3338c
    3439c     local
  • trunk/LMDZ.MARS/libf/aeronomars/euvheat.F90

    r1036 r1047  
    1       SUBROUTINE euvheat(pt,pdt,pplev,pplay,zzlay, &
     1      SUBROUTINE euvheat(ngrid,nlayer,nq,pt,pdt,pplev,pplay,zzlay, &
    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,  &
     4      use tracer_mod, only: 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,   &
    77                            igcm_n, igcm_no, igcm_no2, igcm_n2d, mmol
     8      use conc_mod, only: rnew, cpnew
    89      IMPLICIT NONE
    910!=======================================================================
     
    1718!   input:
    1819!   -----
    19 !   mu0(ngridmx)           
     20!   mu0(ngrid)           
    2021!   pplay(ngrid,nlayer)   pressure at middle of layers (Pa)
    2122!
     
    3031!    ------------------
    3132!
    32 #include "dimensions.h"
    33 #include "dimphys.h"
    34 #include "comcstfi.h"
     33!#include "dimensions.h"
     34!#include "dimphys.h"
     35!#include "comcstfi.h"
    3536#include "callkeys.h"
    36 #include "comdiurn.h"
    37 #include "param.h"
    38 #include "param_v4.h"
    39 #include "chimiedata.h"
     37!#include "comdiurn.h"
     38!#include "param.h"
     39!#include "param_v4.h"
     40!#include "chimiedata.h"
    4041!#include "tracer.h"
    41 #include "conc.h"
     42!#include "conc.h"
    4243!-----------------------------------------------------------------------
    4344!    Input/Output
    4445!    ------------
    4546
    46       real :: pt(ngridmx,nlayermx)
    47       real :: pdt(ngridmx,nlayermx)
    48       real :: pplev(ngridmx,nlayermx+1)
    49       real :: pplay(ngridmx,nlayermx)
    50       real :: zzlay(ngridmx,nlayermx)
    51       real :: mu0(ngridmx)
     47      integer,intent(in) :: ngrid ! number of atmospheric columns
     48      integer,intent(in) :: nlayer ! number of atmospheric layers
     49      integer,intent(in) :: nq ! number of advected tracers
     50      real :: pt(ngrid,nlayer)
     51      real :: pdt(ngrid,nlayer)
     52      real :: pplev(ngrid,nlayer+1)
     53      real :: pplay(ngrid,nlayer)
     54      real :: zzlay(ngrid,nlayer)
     55      real :: mu0(ngrid)
    5256      real :: ptimestep,ptime
    5357      real :: zday
    54       real :: pq(ngridmx,nlayermx,nqmx)
    55       real :: pdq(ngridmx,nlayermx,nqmx)
    56 
    57       real :: pdteuv(ngridmx,nlayermx)
     58      real :: pq(ngrid,nlayer,nq)
     59      real :: pdq(ngrid,nlayer,nq)
     60
     61      real :: pdteuv(ngrid,nlayer)
    5862!
    5963!    Local variables :
     
    6367      INTEGER :: l,ig,n
    6468      integer,save :: euvmod
    65       real, allocatable :: rm(:,:)   ! number density (cm-3)
    66       real :: zq(ngridmx,nlayermx,nqmx) ! local updated tracer quantity
    67       real :: zt(ngridmx,nlayermx)      ! local updated atmospheric temperature
    68       real :: zlocal(nlayermx)
     69      real, allocatable, save :: rm(:,:)   ! number density (cm-3)
     70      real :: zq(ngrid,nlayer,nq) ! local updated tracer quantity
     71      real :: zt(ngrid,nlayer)      ! local updated atmospheric temperature
     72      real :: zlocal(nlayer)
    6973      real :: zenit
    70       real :: jtot(nlayermx)
     74      real :: jtot(nlayer)
    7175      real :: dens                                              ! amu/cm-3
    72       real :: tx(nlayermx)
     76      real :: tx(nlayer)
    7377!      real euveff     !UV heating efficiency
    7478     
     
    326330         end select
    327331       
     332         !Allocate density vector
     333         allocate(rm(nlayer,nespeuv))
     334
    328335         firstcall= .false.
    329336      endif                     ! of if (firstcall)
     
    331338!cccccccccccccccccccccccccccccccccccccccccccccccccccccccc
    332339
    333       !Number of species if not firstcall
    334 
    335 
    336       !Allocate density vector
    337       allocate(rm(nlayermx,nespeuv))
     340
    338341      ! build local updated values of tracers and temperature
    339       do l=1,nlayermx
    340         do ig=1,ngridmx
     342      do l=1,nlayer
     343        do ig=1,ngrid
    341344          ! chemical species
    342345          zq(ig,l,g_co2)=pq(ig,l,g_co2)+pdq(ig,l,g_co2)*ptimestep
     
    374377                                         ! set
    375378     
    376       do ig=1,ngridmx
     379      do ig=1,ngrid
    377380         zenit=acos(mu0(ig))*180./acos(-1.)
    378381         
    379          do l=1,nlayermx
     382         do l=1,nlayer
    380383            !Conversion to number density
    381384            dens=pplay(ig,l)/(rnew(ig,l)*zt(ig,l)) / 1.66e-21
     
    406409         tx(1)=zt(ig,1)
    407410
    408          do l=2,nlayermx
     411         do l=2,nlayer
    409412            tx(l)=zt(ig,l)
    410413            zlocal(l)=zzlay(ig,l)/1000.
     
    419422                       !Gonzalez-Galindo et al. JGR 2009) for details
    420423        !Calculates the UV heating from the total photoabsorption coefficient
    421         do l=1,nlayermx
     424        do l=1,nlayer
    422425          pdteuv(ig,l)=euveff*jtot(l)/10.                  &
    423426               /(cpnew(ig,l)*pplay(ig,l)/(rnew(ig,l)*zt(ig,l)))
     
    426429                                              !the actual Mars-Sun distance
    427430        enddo   
    428       enddo  ! of do ig=1,ngridmx
     431      enddo  ! of do ig=1,ngrid
    429432      !Deallocations
    430       deallocate(rm)
     433!      deallocate(rm)
    431434
    432435      return
  • trunk/LMDZ.MARS/libf/aeronomars/inichim_newstart.F90

    r1036 r1047  
    1       subroutine inichim_newstart(nq, pq, qsurf, ps, flagh2o, flagthermo)
     1      subroutine inichim_newstart(ngrid, nq, pq, qsurf, ps, &
     2                                  flagh2o, flagthermo)
    23
    34      use tracer_mod
     
    2526!
    2627!  pq(iip1,jjp1,llm,nq)  Advected fields, ie chemical species here
    27 !  qsurf(ngridmx,nq)     Amount of tracer on the surface (kg/m2)
     28!  qsurf(ngrid,nq)     Amount of tracer on the surface (kg/m2)
    2829!  ps(iip1,jjp1)           Surface pressure (Pa)
    2930!  flagh2o                 flag for initialisation of h2o (1: yes / 0: no)
     
    3334
    3435#include "dimensions.h"
    35 #include "dimphys.h"
     36!#include "dimphys.h"
    3637#include "paramet.h"
    3738!#include "tracer.h"
     
    4243! inputs :
    4344
     45      integer,intent(in) :: ngrid         ! number of atmospheric columns in the physics
    4446      integer,intent(in) :: nq                    ! number of tracers
    4547      real,intent(in) :: ps(iip1,jjp1)            ! surface pressure in the gcm (Pa)   
     
    5052
    5153      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
     54      real,intent(out) :: qsurf(ngrid,nq)     ! surface values (kg/m2) of tracers
    5355
    5456! local :
     
    586588         do n = 1,nspe
    587589            iq = niq(n)
    588             qsurf(1:ngridmx,iq) = 0.
     590            qsurf(1:ngrid,iq) = 0.
    589591         end do
    590592      end if
     
    604606         end do
    605607         ! set surface value to zero
    606          qsurf(1:ngridmx,igcm_ch4) = 0.
     608         qsurf(1:ngrid,igcm_ch4) = 0.
    607609      end if
    608610
     
    644646         ! surface value to 0
    645647
    646          qsurf(1:ngridmx,igcm_co2plus)  = 0.
    647          qsurf(1:ngridmx,igcm_o2plus)   = 0.
    648          qsurf(1:ngridmx,igcm_oplus)    = 0.
    649          qsurf(1:ngridmx,igcm_coplus)   = 0.
    650          qsurf(1:ngridmx,igcm_cplus)    = 0.
    651          qsurf(1:ngridmx,igcm_nplus)    = 0.
    652          qsurf(1:ngridmx,igcm_noplus)   = 0.
    653          qsurf(1:ngridmx,igcm_n2plus)   = 0.
    654          qsurf(1:ngridmx,igcm_hplus)    = 0.
    655          qsurf(1:ngridmx,igcm_hco2plus) = 0.
    656          qsurf(1:ngridmx,igcm_elec)     = 0.
     648         qsurf(1:ngrid,igcm_co2plus)  = 0.
     649         qsurf(1:ngrid,igcm_o2plus)   = 0.
     650         qsurf(1:ngrid,igcm_oplus)    = 0.
     651         qsurf(1:ngrid,igcm_coplus)   = 0.
     652         qsurf(1:ngrid,igcm_cplus)    = 0.
     653         qsurf(1:ngrid,igcm_nplus)    = 0.
     654         qsurf(1:ngrid,igcm_noplus)   = 0.
     655         qsurf(1:ngrid,igcm_n2plus)   = 0.
     656         qsurf(1:ngrid,igcm_hplus)    = 0.
     657         qsurf(1:ngrid,igcm_hco2plus) = 0.
     658         qsurf(1:ngrid,igcm_elec)     = 0.
    657659
    658660      else
  • trunk/LMDZ.MARS/libf/aeronomars/jthermcalc.F

    r1036 r1047  
    16801680!c***************************************************
    16811681
     1682      use comsaison_h, only: dist_sol
    16821683      implicit none
    16831684
     
    16861687      include "dimensions.h"
    16871688      include "dimphys.h"
    1688       include "comsaison.h"
     1689!      include "comsaison.h"
    16891690      include 'param.h'
    16901691      include 'param_v4.h'
  • trunk/LMDZ.MARS/libf/aeronomars/moldiff.F

    r1036 r1047  
    1       subroutine moldiff(pplay,pplev,pt,pdt,pq,pdq,ptimestep,
     1      subroutine moldiff(ngrid,nlayer,nq,
     2     &                   pplay,pplev,pt,pdt,pq,pdq,ptimestep,
    23     &                   zzlay,pdteuv,pdtconduc,pdqdiff)
    34
    4       use tracer_mod, only: nqmx, igcm_co2, igcm_co, igcm_o, igcm_o1d,
     5      use tracer_mod, only: igcm_co2, igcm_co, igcm_o, igcm_o1d,
    56     &                      igcm_o2, igcm_o3, igcm_h, igcm_h2, igcm_oh,
    67     &                      igcm_ho2, igcm_h2o2, igcm_n2, igcm_ar,
    78     &                      igcm_h2o_vap, mmol
     9      use conc_mod, only: rnew, mmean
    810      implicit none
    911
    10 #include "dimensions.h"
    11 #include "dimphys.h"
     12!#include "dimensions.h"
     13!#include "dimphys.h"
    1214#include "comcstfi.h"
    13 #include "callkeys.h"
    14 #include "comdiurn.h"
    15 #include "chimiedata.h"
     15!#include "callkeys.h"
     16!#include "comdiurn.h"
     17!#include "chimiedata.h"
    1618!#include "tracer.h"
    17 #include "conc.h"
     19!#include "conc.h"
    1820
    1921
     
    2123c Input/Output
    2224c
     25      integer,intent(in) :: ngrid ! number of atmospheric columns
     26      integer,intent(in) :: nlayer ! number of atmospheric layers
     27      integer,intent(in) :: nq ! number of advected tracers
    2328      real ptimestep
    24       real pplay(ngridmx,nlayermx)
    25       real zzlay(ngridmx,nlayermx)
    26       real pplev(ngridmx,nlayermx+1)
    27       real pq(ngridmx,nlayermx,nqmx)
    28       real pdq(ngridmx,nlayermx,nqmx)
    29       real pt(ngridmx,nlayermx)
    30       real pdt(ngridmx,nlayermx)
    31       real pdteuv(ngridmx,nlayermx)
    32       real pdtconduc(ngridmx,nlayermx)
    33       real pdqdiff(ngridmx,nlayermx,nqmx)
     29      real pplay(ngrid,nlayer)
     30      real zzlay(ngrid,nlayer)
     31      real pplev(ngrid,nlayer+1)
     32      real pq(ngrid,nlayer,nq)
     33      real pdq(ngrid,nlayer,nq)
     34      real pt(ngrid,nlayer)
     35      real pdt(ngrid,nlayer)
     36      real pdteuv(ngrid,nlayer)
     37      real pdtconduc(ngrid,nlayer)
     38      real pdqdiff(ngrid,nlayer,nq)
    3439c
    3540c Local
     
    4247      real del1,del2, tmean ,dalfinvdz, d
    4348      real hh,dcoef,dcoef1,ptfac, ntot, dens, dens2, dens3
    44       real hp(nlayermx)
    45       real tt(nlayermx)
    46       real qq(nlayermx,ncompmoldiff)
    47       real dmmeandz(nlayermx)
    48       real qnew(nlayermx,ncompmoldiff)
    49       real zlocal(nlayermx)
     49      real hp(nlayer)
     50      real tt(nlayer)
     51      real qq(nlayer,ncompmoldiff)
     52      real dmmeandz(nlayer)
     53      real qnew(nlayer,ncompmoldiff)
     54      real zlocal(nlayer)
    5055      real alf(ncompmoldiff-1,ncompmoldiff-1)
    51       real alfinv(nlayermx,ncompmoldiff-1,ncompmoldiff-1)
     56      real alfinv(nlayer,ncompmoldiff-1,ncompmoldiff-1)
    5257      real indx(ncompmoldiff-1)
    53       real b(nlayermx,ncompmoldiff-1)
     58      real b(nlayer,ncompmoldiff-1)
    5459      real y(ncompmoldiff-1,ncompmoldiff-1)
    55       real aa(nlayermx,ncompmoldiff-1,ncompmoldiff-1)
    56       real bb(nlayermx,ncompmoldiff-1,ncompmoldiff-1)
    57       real cc(nlayermx,ncompmoldiff-1,ncompmoldiff-1)
    58       real atri(nlayermx-2)
    59       real btri(nlayermx-2)
    60       real ctri(nlayermx-2)
    61       real rtri(nlayermx-2)
    62       real qtri(nlayermx-2)
     60      real aa(nlayer,ncompmoldiff-1,ncompmoldiff-1)
     61      real bb(nlayer,ncompmoldiff-1,ncompmoldiff-1)
     62      real cc(nlayer,ncompmoldiff-1,ncompmoldiff-1)
     63      real atri(nlayer-2)
     64      real btri(nlayer-2)
     65      real ctri(nlayer-2)
     66      real rtri(nlayer-2)
     67      real qtri(nlayer-2)
    6368      real alfdiag(ncompmoldiff-1)
    6469      real wi(ncompmoldiff), flux(ncompmoldiff), pote
     
    211216cccccccccccccccccccccccccccccccccccccccccccccccccccccccc
    212217
    213       nz=nlayermx
    214 
    215       do ig=1,ngridmx
     218      nz=nlayer
     219
     220      do ig=1,ngrid
    216221
    217222        do l=2,nz-1
     
    291296            write(*,*) 'ig, l=',ig, l
    292297            write(*,*) 'No molecular diffusion this time !'
    293             call zerophys(ngridmx*nlayermx*nqmx,pdqdiff)
     298            pdqdiff(1:ngrid,1:nlayer,1:nq)=0
    294299            return
    295300c           stop
  • trunk/LMDZ.MARS/libf/aeronomars/moldiff_red.F90

    r1036 r1047  
    1 subroutine moldiff_red(pplay,pplev,pt,pdt,pq,pdq,ptimestep,zzlay,pdteuv,pdtconduc,pdqdiff)
    2 
    3 use tracer_mod, only: nqmx, noms, mmol
     1subroutine moldiff_red(ngrid,nlayer,nq,pplay,pplev,pt,pdt,pq,pdq,&
     2                       ptimestep,zzlay,pdteuv,pdtconduc,pdqdiff)
     3
     4use tracer_mod, only: noms, mmol
    45
    56implicit none
    67
    7 #include "dimensions.h"
    8 #include "dimphys.h"
     8!#include "dimensions.h"
     9!#include "dimphys.h"
    910#include "comcstfi.h"
    10 #include "callkeys.h"
    11 #include "comdiurn.h"
    12 #include "chimiedata.h"
     11!#include "callkeys.h"
     12!#include "comdiurn.h"
     13!#include "chimiedata.h"
    1314!#include "tracer.h"
    14 #include "conc.h"
     15!#include "conc.h"
    1516#include "diffusion.h"
    1617
     
    1920! Input/Output
    2021!
     22      integer,intent(in) :: ngrid ! number of atmospheric columns
     23      integer,intent(in) :: nlayer ! number of atmospheric layers
     24      integer,intent(in) :: nq ! number of advected tracers
    2125      real ptimestep
    22       real pplay(ngridmx,nlayermx)
    23       real zzlay(ngridmx,nlayermx)
    24       real pplev(ngridmx,nlayermx+1)
    25       real pq(ngridmx,nlayermx,nqmx)
    26       real pdq(ngridmx,nlayermx,nqmx)
    27       real pt(ngridmx,nlayermx)
    28       real pdt(ngridmx,nlayermx)
    29       real pdteuv(ngridmx,nlayermx)
    30       real pdtconduc(ngridmx,nlayermx)
    31       real pdqdiff(ngridmx,nlayermx,nqmx)
     26      real pplay(ngrid,nlayer)
     27      real zzlay(ngrid,nlayer)
     28      real pplev(ngrid,nlayer+1)
     29      real pq(ngrid,nlayer,nq)
     30      real pdq(ngrid,nlayer,nq)
     31      real pt(ngrid,nlayer)
     32      real pdt(ngrid,nlayer)
     33      real pdteuv(ngrid,nlayer)
     34      real pdtconduc(ngrid,nlayer)
     35      real pdqdiff(ngrid,nlayer,nq)
    3236!
    3337! Local
     
    3741!      real hco2(ncompdiff),ho
    3842
    39       integer,dimension(nqmx) :: indic_diff
     43      integer,dimension(nq) :: indic_diff
    4044      integer ig,iq,nz,l,k,n,nn,p,ij0
    4145      integer istep,il,gcn,ntime,nlraf
     
    4448      real*8 rho0,D0,T0,H0,time0,dZ,time,dZraf,tdiff,Zmin,Zmax
    4549      real*8 FacEsc,invsgmu
    46       real*8 hp(nlayermx)
    47       real*8 pp(nlayermx)
    48       real*8 pint(nlayermx)
    49       real*8 tt(nlayermx),tnew(nlayermx),tint(nlayermx)
    50       real*8 zz(nlayermx)
     50      real*8 hp(nlayer)
     51      real*8 pp(nlayer)
     52      real*8 pint(nlayer)
     53      real*8 tt(nlayer),tnew(nlayer),tint(nlayer)
     54      real*8 zz(nlayer)
    5155      real*8,dimension(:,:),allocatable,save :: qq,qnew,qint,FacMass
    5256      real*8,dimension(:,:),allocatable,save :: rhoK,rhokinit
    53       real*8 rhoT(nlayermx)
    54       real*8 dmmeandz(nlayermx)
    55       real*8 massemoy(nlayermx)
     57      real*8 rhoT(nlayer)
     58      real*8 dmmeandz(nlayer)
     59      real*8 massemoy(nlayer)
    5660      real*8,dimension(:),allocatable :: Praf,Traf,Rraf,Mraf,Nraf,Draf,Hraf,Wraf
    5761      real*8,dimension(:),allocatable :: Zraf,Tdiffraf
     
    130134
    131135        ncompdiff=0
    132         indic_diff(1:nqmx)=0
     136        indic_diff(1:nq)=0
    133137       
    134         do nn=1,nqmx
     138        do nn=1,nq
    135139        do n=1,14
    136140        if (ListeDiff(n) .eq. noms(nn)) then
     
    151155! Store gcm indexes in gcmind
    152156        n=0
    153         do nn=1,nqmx
     157        do nn=1,nq
    154158        if (indic_diff(nn) .eq. 1) then
    155159        n=n+1
     
    162166! find vertical index above which diffusion is computed
    163167
    164         do l=1,nlayermx
     168        do l=1,nlayer
    165169        if (pplay(1,l) .gt. Pdiff) then
    166170        il0=l
     
    176180
    177181! allocatation des tableaux dependants du nombre d especes diffusees
    178         allocate(qq(nlayermx,ncompdiff))
    179         allocate(qnew(nlayermx,ncompdiff))
    180         allocate(qint(nlayermx,ncompdiff))
    181         allocate(FacMass(nlayermx,ncompdiff))
    182         allocate(rhok(nlayermx,ncompdiff))
    183         allocate(rhokinit(nlayermx,ncompdiff))
     182        allocate(qq(nlayer,ncompdiff))
     183        allocate(qnew(nlayer,ncompdiff))
     184        allocate(qint(nlayer,ncompdiff))
     185        allocate(FacMass(nlayer,ncompdiff))
     186        allocate(rhok(nlayer,ncompdiff))
     187        allocate(rhokinit(nlayer,ncompdiff))
    184188
    185189        allocate(wi(ncompdiff))
     
    212216       
    213217!       print*,'moldiff',i_h2,i_h,ncompdiff
    214       do ig=1,ngridmx
     218      do ig=1,ngrid
    215219        pp=dble(pplay(ig,:))
    216220
     
    218222
    219223!       CALL TMNEW(pt(ig,:),pdt(ig,:),pdtconduc(ig,:),pdteuv(ig,:)      &
    220 !     &  ,tt,ptimestep,nlayermx,ig)
    221         do l=1,nlayermx
     224!     &  ,tt,ptimestep,nlayer,ig)
     225        do l=1,nlayer
    222226          tt(l)=pt(ig,l)*1D0+(pdt(ig,l)*dble(ptimestep)+                &
    223227                              pdtconduc(ig,l)*dble(ptimestep)+          &
     
    228232              pdt(ig,l),pdtconduc(ig,l),pdteuv(ig,l),dble(ptimestep)
    229233          endif
    230         enddo ! of do l=1,nlayermx
     234        enddo ! of do l=1,nlayer
    231235
    232236! Update the mass mixing ratios modified by other processes
    233237
    234 !       CALL QMNEW(pq(ig,:,:),pdq(ig,:,:),qq,ptimestep,nlayermx,        &
     238!       CALL QMNEW(pq(ig,:,:),pdq(ig,:,:),qq,ptimestep,nlayer,        &
    235239!     &  ncompdiff,gcmind,ig)
    236240        do iq=1,ncompdiff
    237          do l=1,nlayermx
     241         do l=1,nlayer
    238242          qq(l,iq)=pq(ig,l,gcmind(iq))*1D0+(                            &
    239243                           pdq(ig,l,gcmind(iq))*dble(ptimestep))
    240244          qq(l,iq)=max(qq(l,iq),1d-30)
    241          enddo ! of do l=1,nlayermx
     245         enddo ! of do l=1,nlayer
    242246        enddo ! of do iq=1,ncompdiff
    243247
    244248! Compute the Pressure scale height
    245249
    246         CALL HSCALE(pp,hp,nlayermx)
     250        CALL HSCALE(pp,hp,nlayer)
    247251
    248252! Compute the atmospheric mass (in Dalton)
    249253
    250         CALL MMOY(massemoy,mmol,qq,gcmind,nlayermx,ncompdiff)
     254        CALL MMOY(massemoy,mmol,qq,gcmind,nlayer,ncompdiff)
    251255
    252256! Compute the vertical gradient of atmospheric mass
    253257
    254         CALL DMMOY(massemoy,hp,dmmeandz,nlayermx)
     258        CALL DMMOY(massemoy,hp,dmmeandz,nlayer)
    255259
    256260! Compute the altitude of each layer
    257261
    258         CALL ZVERT(pp,tt,massemoy,zz,nlayermx,ig)
     262        CALL ZVERT(pp,tt,massemoy,zz,nlayer,ig)
    259263
    260264! Compute the total mass density (kg/m3)
    261265       
    262         CALL RHOTOT(pp,tt,massemoy,qq,RHOT,RHOK,nlayermx,ncompdiff)
     266        CALL RHOTOT(pp,tt,massemoy,qq,RHOT,RHOK,nlayer,ncompdiff)
    263267        RHOKINIT=RHOK
    264268
     
    271275        Mtot1(1:ncompdiff)=0d0
    272276
    273         do l=il0,nlayermx
     277        do l=il0,nlayer
    274278        do nn=1,ncompdiff
    275279        Mtot1(nn)=Mtot1(nn)+1d0/g*qq(l,nn)*                             &
     
    279283
    280284        Zmin=zz(il0)
    281         Zmax=zz(nlayermx)
     285        Zmax=zz(nlayer)
    282286
    283287
     
    286290        if (Zmax .gt. 4000000.) then
    287291        Print*,'Zmax too high',ig,zmax,zmin
    288         do l=1,nlayermx
     292        do l=1,nlayer
    289293        print*,'old',zz(l),pt(ig,l),pdteuv(ig,l),pdq(ig,l,:)
    290294        print*,'l',l,rhot(l),tt(l),pp(l),massemoy(l),qq(l,:)
     
    321325        CALL UPPER_RESOL(pp,tt,zz,massemoy,RHOT,RHOK,                   &
    322326     &  qq,mmol,gcmind,Praf,Traf,Qraf,Mraf,Zraf,                        &
    323      &  Nraf,Nrafk,Rraf,Rrafk,il0,nlraf,ncompdiff,nlayermx,ig)
     327     &  Nraf,Nrafk,Rraf,Rrafk,il0,nlraf,ncompdiff,nlayer,ig)
    324328
    325329        Prafold=Praf
     
    330334
    331335        CALL GCMGRID_P(Zraf,Praf,Qraf,Traf,Nrafk,Rrafk,qq,qint,tt,tint  &
    332      &    ,pp,mmol,gcmind,nlraf,ncompdiff,nlayermx,ig)
     336     &    ,pp,mmol,gcmind,nlraf,ncompdiff,nlayer,ig)
    333337
    334338! We compute the mass correction factor of each specie at each pressure level
    335339
    336         CALL CORRMASS(qq,qint,FacMass,nlayermx,ncompdiff)
     340        CALL CORRMASS(qq,qint,FacMass,nlayer,ncompdiff)
    337341
    338342! Altitude step
     
    367371!       enddo
    368372
    369 !       do l=1,nlayermx
     373!       do l=1,nlayer
    370374!       print*,'l',l,zz(l),pp(l),tt(l),sum(qq(l,:)),massemoy(l)
    371375!       enddo
     
    374378! No change below il0
    375379       
    376         do l=1,nlayermx
     380        do l=1,nlayer
    377381         qnew(l,:)=qq(l,:) ! No effet below il0
    378382       enddo
     
    527531        print*,'Mraf',Mraf
    528532        stop
    529 !       pdqdiff(1:ngridmx,1:nlayermx,1:nqmx)=0.
     533!       pdqdiff(1:ngrid,1:nlayer,1:nq)=0.
    530534!       return
    531535!       Rrafk(l,nn)=1D-30*Rraf(l)
     
    572576
    573577        CALL GCMGRID_P2(Zraf,Praf,Qraf,Traf,Nrafk,Rrafk,qq,qnew,tt,tnew,&
    574      &   pp,mmol,gcmind,nlraf,ncompdiff,nlayermx,FacMass,ig)
    575 
    576         CALL RHOTOT(pp,tt,massemoy,qnew,RHOT,RHOK,nlayermx,ncompdiff)
     578     &   pp,mmol,gcmind,nlraf,ncompdiff,nlayer,FacMass,ig)
     579
     580        CALL RHOTOT(pp,tt,massemoy,qnew,RHOT,RHOK,nlayer,ncompdiff)
    577581
    578582        if (ig .eq. ij0) then
    579         do l=il0,nlayermx
     583        do l=il0,nlayer
    580584        write(*,'(i2,1x,19(e12.4,1x))') l,zz(l),tt(l),RHOK(l,1)/sum(RHOK(l,:)),RHOKINIT(l,1)/sum(RHOKINIT(l,:)),&
    581585     &  RHOK(l,2)/sum(RHOK(l,:)),RHOKINIT(l,2)/sum(RHOKINIT(l,:)),&
     
    590594        Mtot2(1:ncompdiff)=0d0
    591595
    592         do l=il0,nlayermx
     596        do l=il0,nlayer
    593597        do nn=1,ncompdiff
    594598        Mtot2(nn)=Mtot2(nn)+1d0/g*qnew(l,nn)*                           &
     
    600604
    601605!       do nn=1,ncompdiff
    602 !       CALL CheckMass2(qq,qnew,pplev(ig,:),il0,nlayermx,nn,ncompdiff)
     606!       CALL CheckMass2(qq,qnew,pplev(ig,:),il0,nlayer,nn,ncompdiff)
    603607!       enddo
    604608
    605609! Compute the diffusion trends du to diffusion
    606610
    607         do l=1,nlayermx
     611        do l=1,nlayer
    608612        do nn=1,ncompdiff
    609613        pdqdiff(ig,l,gcmind(nn))=(qnew(l,nn)-qq(l,nn))/ptimestep
  • trunk/LMDZ.MARS/libf/aeronomars/moldiffcoeff.F

    r1036 r1047  
    1919#include "dimphys.h"
    2020#include "callkeys.h"
    21 #include "comdiurn.h"
     21!#include "comdiurn.h"
    2222#include "chimiedata.h"
    2323!#include "tracer.h"
    24 #include "conc.h"
     24!#include "conc.h"
    2525
    2626c-----------------------------------------------------------------------
  • trunk/LMDZ.MARS/libf/aeronomars/moldiffcoeff_red.F

    r1036 r1047  
    1515#include "dimphys.h"
    1616#include "callkeys.h"
    17 #include "comdiurn.h"
     17!#include "comdiurn.h"
    1818#include "chimiedata.h"
    1919!#include "tracer.h"
    20 #include "conc.h"
     20!#include "conc.h"
    2121#include "diffusion.h"
    2222
  • trunk/LMDZ.MARS/libf/aeronomars/molvis.F

    r690 r1047  
    1        SUBROUTINE molvis(ptimestep,pplay,pplev,pt,pdteuv,pdtconduc
     1       SUBROUTINE molvis(ngrid,nlayer,ptimestep,
     2     &            pplay,pplev,pt,pdteuv,pdtconduc
    23     $           ,pvel,tsurf,zzlev,zzlay,zdvelmolvis)
     4     
     5      use conc_mod, only: cpnew, Akknew, rnew
    36      IMPLICIT NONE
    47
     
    1720c-----------------------------------------------------------------------
    1821
    19 #include "dimensions.h"
    20 #include "dimphys.h"
    21 #include "comcstfi.h"
    22 #include "surfdat.h"
    23 #include "chimiedata.h"
    24 #include "conc.h"
     22!#include "dimensions.h"
     23!#include "dimphys.h"
     24!#include "comcstfi.h"
     25!#include "surfdat.h"
     26!#include "chimiedata.h"
     27!#include "conc.h"
    2528
    2629c   arguments:
    2730c   ----------
    2831
     32      integer,intent(in) :: ngrid ! number of atmospheric columns
     33      integer,intent(in) :: nlayer ! number of atmospheric layers
    2934      REAL ptimestep
    30       REAL pplay(ngridmx,nlayermx)
    31       REAL pplev(ngridmx,nlayermx+1)
    32       REAL zzlay(ngridmx,nlayermx)
    33       REAL zzlev(ngridmx,nlayermx+1)
    34       real pt(ngridmx,nlayermx)
    35       real tsurf(ngridmx)
    36       REAL pvel(ngridmx,nlayermx)
    37       REAL pdvel(ngridmx,nlayermx)
    38       real pdteuv(ngridmx,nlayermx)
    39       real pdtconduc(ngridmx,nlayermx)
     35      REAL pplay(ngrid,nlayer)
     36      REAL pplev(ngrid,nlayer+1)
     37      REAL zzlay(ngrid,nlayer)
     38      REAL zzlev(ngrid,nlayer+1)
     39      real pt(ngrid,nlayer)
     40      real tsurf(ngrid)
     41      REAL pvel(ngrid,nlayer)
     42      REAL pdvel(ngrid,nlayer)
     43      real pdteuv(ngrid,nlayer)
     44      real pdtconduc(ngrid,nlayer)
    4045
    41       real zdvelmolvis(ngridmx,nlayermx)
     46      real zdvelmolvis(ngrid,nlayer)
    4247
    4348c   local:
    4449c   ------
    4550
    46       INTEGER l,ig, ngrid,nz
    47       real Akk,skk,phitop,velsurf,fac, m, tmean
    48       REAL zvel(nlayermx)
    49       real zt(nlayermx)
    50       REAL alpha(nlayermx)
    51       REAL lambda(nlayermx)
    52       real muvol(nlayermx)
    53       REAL C(nlayermx)
    54       real D(nlayermx)
    55       real den(nlayermx)
    56       REAL pdvelm(nlayermx)
    57       REAL zlay(nlayermx)
    58       real zlev(nlayermx+1)
     51      INTEGER l,ig, nz
     52      real Akk,phitop,fac, m, tmean
     53      REAL zvel(nlayer)
     54      real zt(nlayer)
     55      REAL alpha(nlayer)
     56      REAL lambda(nlayer)
     57      real muvol(nlayer)
     58      REAL C(nlayer)
     59      real D(nlayer)
     60      real den(nlayer)
     61      REAL pdvelm(nlayer)
     62      REAL zlay(nlayer)
     63      real zlev(nlayer+1)
    5964
    6065c   constants used locally
     
    6772
    6873
    69       PARAMETER (skk=0.69)
     74      REAL,PARAMETER :: skk=0.69
    7075
    71       PARAMETER (velsurf =0.0)
     76      REAL,PARAMETER :: velsurf =0.0
    7277     
    73       logical firstcall
    74       save firstcall
    75       data firstcall /.true./
     78      logical,save :: firstcall=.true.
     79
    7680c-----------------------------------------------------------------------
    7781c   calcul des coefficients alpha et lambda
     
    9094      phitop=0.0
    9195
    92       ngrid=ngridmx
    93       nz=nlayermx
     96      nz=nlayer
    9497
    9598      do ig=1,ngrid
  • trunk/LMDZ.MARS/libf/aeronomars/perosat.F

    r1036 r1047  
    1       SUBROUTINE perosat(ig, ptimestep,
     1      SUBROUTINE perosat(ngrid,nlayer,nq,ig, ptimestep,
    22     $                   pplev, pplay, zt,
    33     &                   zy, pdqcloud, pdqscloud)
    4       use tracer_mod, only: nqmx, igcm_h2o2, mmol
     4     
     5      use tracer_mod, only: igcm_h2o2, mmol
     6      use conc_mod, only: mmean
    57      IMPLICIT NONE
    68
     
    2224c   -------------
    2325
    24 #include "dimensions.h"
    25 #include "dimphys.h"
     26!#include "dimensions.h"
     27!#include "dimphys.h"
    2628#include "comcstfi.h"
    27 #include "chimiedata.h"
     29!#include "chimiedata.h"
    2830!#include "tracer.h"
    29 #include "conc.h"
     31!#include "conc.h"
    3032c
    3133c   arguments:
    3234c   ----------
    3335
     36      integer,intent(in) :: ngrid   ! number of atmospheric columns
     37      integer,intent(in) :: nlayer  ! number of atmospheric layers
     38      integer,intent(in) :: nq      ! number of tracers
    3439      INTEGER ig
    3540      REAL ptimestep                ! pas de temps physique (s)
    36       REAL pplev(ngridmx,nlayermx+1)! pression aux inter-couches (Pa)
    37       REAL pplay(ngridmx,nlayermx)  ! pression au milieu des couches (Pa)
    38       REAL zt(nlayermx)             ! temperature au centre des couches (K)
     41      REAL pplev(ngrid,nlayer+1)    ! pression aux inter-couches (Pa)
     42      REAL pplay(ngrid,nlayer)      ! pression au milieu des couches (Pa)
     43      REAL zt(nlayer             ! temperature au centre des couches (K)
    3944                                    ! deja mise a jour dans calchim
    4045
    4146c   Traceurs :
    42       real zy(nlayermx,nqmx)        ! traceur (fraction molaire sortie chimie)
    43       real pdqcloud(ngridmx,nlayermx,nqmx) ! tendance condensation (kg/kg.s-1)
    44       real pdqscloud(ngridmx,nqmx)         ! flux en surface (kg.m-2.s-1)
     47      real zy(nlayer,nq)        ! traceur (fraction molaire sortie chimie)
     48      real pdqcloud(ngrid,nlayer,nq) ! tendance condensation (kg/kg.s-1)
     49      real pdqscloud(ngrid,nq)         ! flux en surface (kg.m-2.s-1)
    4550     
    4651c   local:
     
    4954      INTEGER l,iq
    5055
    51       REAL zysat(nlayermx)
    52       REAL zynew(nlayermx)             ! mole fraction after condensation
     56      REAL zysat(nlayer)
     57      REAL zynew(nlayer             ! mole fraction after condensation
    5358      REAL psat_hg                     ! pression saturante (mm Hg)
    5459      REAL psat_hpa                    ! pression saturante (hPa)
     
    5762c     Pour diagnostique :
    5863c     ~~~~~~~~~~~~~~~~~
    59       REAL taucond(ngridmx,nlayermx)   ! taux de condensation (kg/kg/s-1)
     64      REAL taucond(ngrid,nlayer)   ! taux de condensation (kg/kg/s-1)
    6065
    6166c-----------------------------------------------------------------------
     
    8085c       domaine d'application: T < 220 K
    8186c
    82         do l = 1,nlayermx
     87        do l = 1,nlayer
    8388
    8489c       print *,'ig=',ig,' l=',l,' igcm_h2o2=',igcm_h2o2
     
    103108c       (Pour diagnostic seulement !)
    104109c
    105         do l=1, nlayermx
     110        do l=1, nlayer
    106111          taucond(ig,l)=max((zy(l,igcm_h2o2)-zysat(l))*mmol(igcm_h2o2)
    107112     $                         /(mmean(ig,l)*ptimestep),0.)
     
    111116c       ~~~~~~~~~~~~~~~~~~~~~~~~~~
    112117c
    113         do l=nlayermx,2, -1
     118        do l=nlayer,2, -1
    114119           if (zynew(l).gt.zysat(l)) then
    115120              zynew(l-1) =  zynew(l-1) + (zynew(l) - zysat(l))
     
    135140c       ~~~~~~~~~~~~~~~
    136141c
    137         do l=1, nlayermx
     142        do l=1, nlayer
    138143          pdqcloud(ig,l,igcm_h2o2)=(zynew(l) - zy(l,igcm_h2o2))
    139144     &                     *mmol(igcm_h2o2)/(mmean(ig,l)*ptimestep)
  • trunk/LMDZ.MARS/libf/aeronomars/surfacearea.F

    r1036 r1047  
    77      use tracer_mod, only: nuice_sed, igcm_dust_number,
    88     &                      igcm_ccn_number, varian, ccn_factor
     9      use conc_mod, only: rnew
    910      implicit none
    1011
     
    1819
    1920#include "dimensions.h"
    20 #include "dimphys.h"
     21!#include "dimphys.h"
    2122#include "comcstfi.h"
    2223#include "callkeys.h"
    2324!#include "tracer.h"
    24 #include "dimradmars.h"
     25!#include "dimradmars.h"
     26! naerkind is set in scatterers.h (built when compiling with makegcm -s #)
     27#include"scatterers.h"
    2528#include "chimiedata.h"
    26 #include "conc.h"
     29!#include "conc.h"
    2730
    2831! input
  • trunk/LMDZ.MARS/libf/aeronomars/thermosphere.F

    r1036 r1047  
    1       subroutine thermosphere(pplev,pplay,dist_sol,
     1      subroutine thermosphere(ngrid,nlayer,nq,
     2     &     pplev,pplay,dist_sol,
    23     $     mu0,ptimestep,ptime,zday,tsurf,zzlev,zzlay,
    34     &     pt,pq,pu,pv,pdt,pdq,
    45     $     zdteuv,zdtconduc,zdumolvis,zdvmolvis,zdqmoldiff)
    56
    6       use tracer_mod, only: nqmx ! number of advecter tracers
     7      use conc_mod, only: rnew, cpnew
    78      implicit none
    89
    9 #include "dimensions.h"
    10 #include "dimphys.h"
     10!#include "dimensions.h"
     11!#include "dimphys.h"
    1112#include "comcstfi.h"
    1213#include "callkeys.h"
    13 #include "comdiurn.h"
    14 #include "param.h"
    15 #include "param_v4.h"
    16 #include "chimiedata.h"
    17 #include "conc.h"
     14!#include "comdiurn.h"
     15!#include "param.h"
     16!#include "param_v4.h"
     17!#include "chimiedata.h"
     18!#include "conc.h"
    1819
    1920
    20       INTEGER l,ig
    21 
    22       REAL pplay(ngridmx,nlayermx)
    23       real pplev(ngridmx,nlayermx+1)
    24       REAL zzlay(ngridmx,nlayermx)
    25       real zzlev(ngridmx,nlayermx+1)
    26       REAL pt(ngridmx,nlayermx)
     21      integer,intent(in) :: ngrid ! number of atmospheric columns
     22      integer,intent(in) :: nlayer ! number of atmospheric layers
     23      integer,intent(in) :: nq ! number of advected tracers
     24      REAL pplay(ngrid,nlayer)
     25      real pplev(ngrid,nlayer+1)
     26      REAL zzlay(ngrid,nlayer)
     27      real zzlev(ngrid,nlayer+1)
     28      REAL pt(ngrid,nlayer)
    2729      real zday
    2830      REAL dist_sol
    29       real mu0(ngridmx)
    30       real pq(ngridmx,nlayermx,nqmx)
     31      real mu0(ngrid)
     32      real pq(ngrid,nlayer,nq)
    3133      real ptimestep
    3234      real ptime
    33       real tsurf(ngridmx)
    34       REAL pu(ngridmx,nlayermx),pv(ngridmx,nlayermx)
    35       REAL pdt(ngridmx,nlayermx),pdq(ngridmx,nlayermx,nqmx)
     35      real tsurf(ngrid)
     36      REAL pu(ngrid,nlayer),pv(ngrid,nlayer)
     37      REAL pdt(ngrid,nlayer),pdq(ngrid,nlayer,nq)
    3638
    37       REAL zdteuv(ngridmx,nlayermx)
    38       REAL zdtconduc(ngridmx,nlayermx)
    39       REAL zdumolvis(ngridmx,nlayermx)
    40       REAL zdvmolvis(ngridmx,nlayermx)
    41       real zdqmoldiff(ngridmx,nlayermx,nqmx)
     39      REAL zdteuv(ngrid,nlayer)
     40      REAL zdtconduc(ngrid,nlayer)
     41      REAL zdumolvis(ngrid,nlayer)
     42      REAL zdvmolvis(ngrid,nlayer)
     43      real zdqmoldiff(ngrid,nlayer,nq)
    4244
    43       logical firstcall
    44       save firstcall
    45       data firstcall /.true./
     45      INTEGER l,ig
     46      logical,save :: firstcall=.true.
    4647
    4748      if (firstcall) then
    4849        if (.not. tracer) then
    49           do l=1,nlayermx
    50             do ig=1,ngridmx
     50          do l=1,nlayer
     51            do ig=1,ngrid
    5152              rnew(ig,l)=r
    5253              cpnew(ig,l)=cpp
     
    5859
    5960      if (calleuv) then
    60         call zerophys(ngridmx*nlayermx,zdteuv)
    61         call euvheat(pt,pdt,pplev,pplay,zzlay,
     61        zdteuv(1:ngrid,1:nlayer)=0
     62        call euvheat(ngrid,nlayer,nq,pt,pdt,pplev,pplay,zzlay,
    6263     $               mu0,ptimestep,ptime,zday,pq,pdq,zdteuv)
    6364      endif
    6465
    6566      if (callconduct) THEN
    66         call zerophys(ngridmx*nlayermx,zdtconduc)
    67         call conduction(ptimestep,pplay,pplev,pt,zdteuv,
     67        zdtconduc(1:ngrid,1:nlayer)=0
     68        call conduction(ngrid,nlayer,ptimestep,pplay,pplev,pt,zdteuv,
    6869     $                   tsurf,zzlev,zzlay,zdtconduc)
    6970      endif
    7071
    7172      if (callmolvis) THEN
    72         call zerophys(ngridmx*nlayermx,zdumolvis)
    73         call molvis(ptimestep,pplay,pplev,pt,zdteuv,zdtconduc,pu,
     73        zdumolvis(1:ngrid,1:nlayer)=0
     74        call molvis(ngrid,nlayer,ptimestep,pplay,pplev,pt,
     75     &                zdteuv,zdtconduc,pu,
    7476     $                   tsurf,zzlev,zzlay,zdumolvis)
    75         call zerophys(ngridmx*nlayermx,zdvmolvis)
    76         call molvis(ptimestep,pplay,pplev,pt,zdteuv,zdtconduc,pv,
     77        zdvmolvis(1:ngrid,1:nlayer)=0
     78        call molvis(ngrid,nlayer,ptimestep,pplay,pplev,pt,
     79     &                zdteuv,zdtconduc,pv,
    7780     $                   tsurf,zzlev,zzlay,zdvmolvis)
    7881      endif
    7982
    8083      if (callmoldiff) THEN
    81         call zerophys(ngridmx*nlayermx*nqmx,zdqmoldiff)
    82         call moldiff_red(pplay,pplev,pt,pdt,pq,pdq,ptimestep,
     84        zdqmoldiff(1:ngrid,1:nlayer,1:nq)=0
     85        call moldiff_red(ngrid,nlayer,nq,
     86     &                   pplay,pplev,pt,pdt,pq,pdq,ptimestep,
    8387     &                   zzlay,zdteuv,zdtconduc,zdqmoldiff)
    8488      endif
Note: See TracChangeset for help on using the changeset viewer.