Changeset 1047 for trunk/LMDZ.MARS/libf


Ignore:
Timestamp:
Sep 23, 2013, 9:56:47 AM (12 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
Files:
11 added
15 deleted
84 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
  • trunk/LMDZ.MARS/libf/dyn3d/ini_archive.F

    r38 r1047  
    3434c=======================================================================
    3535 
     36      use comsoil_h, only: nsoilmx, mlayer
    3637      implicit none
    3738
     
    4849#include "serre.h"
    4950#include "control.h"
    50 #include"comsoil.h"
     51!#include"comsoil.h"
    5152
    5253#include "netcdf.inc"
  • trunk/LMDZ.MARS/libf/dyn3d/lect_start_archive.F

    r1036 r1047  
    1       SUBROUTINE lect_start_archive(nqtot,date,tsurf,tsoil,emis,q2,
     1      SUBROUTINE lect_start_archive(ngrid,nlayer,nqtot,
     2     &     date,tsurf,tsoil,emis,q2,
    23     &     t,ucov,vcov,ps,co2ice,h,phisold_newgrid,
    34     &     q,qsurf,surfith,nid)
     
    1718c=======================================================================
    1819      use infotrac, only: tnom
     20      use comsoil_h, only: nsoilmx, layer, mlayer, volcapa, inertiedat
    1921      implicit none
    2022
    2123#include "dimensions.h"
    22 #include "dimphys.h"
    23 #include "surfdat.h"
    24 #include "comsoil.h"
    25 #include "dimradmars.h"
    26 #include "yomaer.h"
     24!#include "dimphys.h"
     25!#include "surfdat.h"
     26!#include "comsoil.h"
     27!#include "dimradmars.h"
     28!#include "yomaer.h"
    2729#include "planete.h"
    2830#include "paramet.h"
     
    4951c et autres:
    5052c----------
     53      integer,intent(in) :: ngrid ! number of atmospheric columns
     54                                  ! on new physics grid
     55      integer,intent(in) :: nlayer ! number of atmospheric layers
     56                                   ! on new grid
    5157      integer,intent(in) :: nqtot ! number of advected tracers
    5258
     
    98104c variable physique
    99105c------------------
    100       REAL tsurf(ngridmx) ! surface temperature
    101       REAL tsoil(ngridmx,nsoilmx) ! soil temperature
    102       REAL co2ice(ngridmx) ! CO2 ice layer
    103       REAL emis(ngridmx)
    104       REAL q2(ngridmx,nlayermx+1),qsurf(ngridmx,nqtot)
    105 c     REAL phisfi(ngridmx)
     106      REAL tsurf(ngrid) ! surface temperature
     107      REAL tsoil(ngrid,nsoilmx) ! soil temperature
     108      REAL co2ice(ngrid) ! CO2 ice layer
     109      REAL emis(ngrid)
     110      REAL q2(ngrid,nlayer+1),qsurf(ngrid,nqtot)
     111c     REAL phisfi(ngrid)
    106112
    107113      INTEGER i,j,l
     
    176182
    177183      real surfith(iip1,jjp1) ! surface thermal inertia
    178 !      real surfithfi(ngridmx)
     184!      real surfithfi(ngrid)
    179185      ! surface thermal inertia at old horizontal grid resolution
    180186      real, dimension(:,:), allocatable :: surfithold
     
    335341      allocate(varp1 (imold+1,jmold+1,llm+1))
    336342
    337       write(*,*) 'q2',ngridmx,nlayermx+1
     343      write(*,*) 'q2',ngrid,nlayer+1
    338344      write(*,*) 'q2S',iip1,jjp1,llm+1
    339345      write(*,*) 'q2old',imold+1,jmold+1,lmold+1
     
    10001006      call interp_horiz (tsurfold,tsurfs,imold,jmold,iim,jjm,1,
    10011007     &                   rlonuold,rlatvold,rlonu,rlatv)
    1002       call gr_dyn_fi (1,iim+1,jjm+1,ngridmx,tsurfs,tsurf)
     1008      call gr_dyn_fi (1,iim+1,jjm+1,ngrid,tsurfs,tsurf)
    10031009c     write(44,*) 'tsurf', tsurf
    10041010
     
    10071013!     &                  imold,jmold,iim,jjm,nsoilmx,
    10081014!     &                   rlonuold,rlatvold,rlonu,rlatv)
    1009 !      call gr_dyn_fi (nsoilmx,iim+1,jjm+1,ngridmx,tsoils,tsoil)
     1015!      call gr_dyn_fi (nsoilmx,iim+1,jjm+1,ngrid,tsoils,tsoil)
    10101016c     write(45,*) 'tsoil',tsoil
    10111017
     
    10131019      call interp_horiz (emisold,emiss,imold,jmold,iim,jjm,1,
    10141020     &                   rlonuold,rlatvold,rlonu,rlatv)
    1015       call gr_dyn_fi (1,iim+1,jjm+1,ngridmx,emiss,emis)
     1021      call gr_dyn_fi (1,iim+1,jjm+1,ngrid,emiss,emis)
    10161022c     write(46,*) 'emis',emis
    10171023c-----------------------------------------------------------------------
     
    11301136
    11311137      ! Reshape inertiedatS to scalar grid as inertiedat
    1132       call gr_dyn_fi (nsoilmx,iim+1,jjm+1,ngridmx,
     1138      call gr_dyn_fi (nsoilmx,iim+1,jjm+1,ngrid,
    11331139     &                  inertiedatS,inertiedat)
    11341140     
     
    12031209
    12041210      ! Reshape tsoilS to scalar grid as tsoil
    1205        call gr_dyn_fi (nsoilmx,iim+1,jjm+1,ngridmx,tsoilS,tsoil)
     1211       call gr_dyn_fi (nsoilmx,iim+1,jjm+1,ngrid,tsoilS,tsoil)
    12061212
    12071213
     
    12291235     &                   rlonuold,rlatvold,rlonu,rlatv)
    12301236      write (*,*) 'lect_start_archive: q2s ', q2s (1,2,1)  ! INFO
    1231       call gr_dyn_fi (llm+1,iim+1,jjm+1,ngridmx,q2s,q2)
     1237      call gr_dyn_fi (llm+1,iim+1,jjm+1,ngrid,q2s,q2)
    12321238      write (*,*) 'lect_start_archive: q2 ', q2 (1,2)  ! INFO
    12331239c     write(47,*) 'q2',q2
     
    12781284      enddo
    12791285
    1280       call gr_dyn_fi (nqtot,iim+1,jjm+1,ngridmx,qsurfs,qsurf)
     1286      call gr_dyn_fi (nqtot,iim+1,jjm+1,ngrid,qsurfs,qsurf)
    12811287
    12821288c traceurs 3D
     
    13291335      enddo
    13301336     
    1331       call gr_dyn_fi (1,iim+1,jjm+1,ngridmx,co2ices,co2ice)
     1337      call gr_dyn_fi (1,iim+1,jjm+1,ngrid,co2ices,co2ice)
    13321338
    13331339c-----------------------------------------------------------------------
  • trunk/LMDZ.MARS/libf/dyn3d/newstart.F

    r1036 r1047  
    1919      use infotrac, only: iniadvtrac, nqtot, tnom
    2020      use tracer_mod, only: noms, igcm_h2o_vap, igcm_h2o_ice
     21      use surfdat_h, only: phisfi, z0, zmea, zstd, zsig, zgam, zthe,
     22     &                     albedodat, z0_default
     23      use comsoil_h, only: inertiedat, layer, mlayer, nsoilmx
    2124      implicit none
    2225
    2326#include "dimensions.h"
     27      integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm)
    2428#include "dimphys.h"
    25 #include "surfdat.h"
    26 #include "comsoil.h"
    27 #include "dimradmars.h"
    28 #include "yomaer.h"
     29!#include "surfdat.h"
     30!#include "comsoil.h"
     31!#include "dimradmars.h"
     32!#include "yomaer.h"
    2933#include "planete.h"
    3034#include "paramet.h"
     
    404408
    405409        write(*,*) 'Reading file START_ARCHIVE'
    406         CALL lect_start_archive(nqtot,date,tsurf,tsoil,emis,q2,
    407      .   t,ucov,vcov,ps,co2ice,teta,phisold_newgrid,q,qsurf,
     410        CALL lect_start_archive(ngridmx,llm,nqtot,
     411     &   date,tsurf,tsoil,emis,q2,
     412     &   t,ucov,vcov,ps,co2ice,teta,phisold_newgrid,q,qsurf,
    408413     &   surfith,nid)
    409414        write(*,*) "OK, read start_archive file"
     
    425430        write(*,*) 'Reading file STARTFI'
    426431        fichnom = 'startfi.nc'
    427         CALL phyetat0 (fichnom,tab0,Lmodif,nsoilmx,nqtot,
     432        CALL phyetat0 (fichnom,tab0,Lmodif,nsoilmx,ngridmx,llm,nqtot,
    428433     .        day_ini,time,
    429434     .        tsurf,tsoil,emis,q2,qsurf,co2ice)
     
    858863          endif
    859864         
    860           call inichim_newstart(nq, q, qsurf, ps, flagh2o, flagthermo)
     865          call inichim_newstart(ngridmx, nq, q, qsurf, ps,
     866     &                          flagh2o, flagthermo)
    861867
    862868         ! We want to have the very same value at lon -180 and lon 180
     
    14721478C
    14731479
    1474       call physdem0("restartfi.nc",lonfi,latfi,nsoilmx,nqtot,
    1475      .              dtphys,real(day_ini),0.0,
     1480      call physdem0("restartfi.nc",lonfi,latfi,nsoilmx,ngridmx,llm,
     1481     .              nqtot,dtphys,real(day_ini),0.0,
    14761482     .              airefi,albfi,ithfi,zmea,zstd,zsig,zgam,zthe)
    1477       call physdem1("restartfi.nc",nsoilmx,nqtot,
     1483      call physdem1("restartfi.nc",nsoilmx,ngridmx,llm,nqtot,
    14781484     .              dtphys,hour_ini,
    14791485     .              tsurf,tsoil,co2ice,emis,q2,qsurf)
  • trunk/LMDZ.MARS/libf/dyn3d/start2archive.F

    r1036 r1047  
    2020
    2121      use infotrac, only: iniadvtrac, nqtot, tnom
     22      use comsoil_h, only: nsoilmx, inertiedat
     23      use surfdat_h, only: ini_surfdat_h
     24      use comsoil_h, only: ini_comsoil_h
    2225      implicit none
    2326
    2427#include "dimensions.h"
     28      integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm)
    2529#include "paramet.h"
    2630#include "comconst.h"
     
    3438#include "description.h"
    3539
    36 #include "dimphys.h"
    37 #include "comsoil.h"
     40!#include "dimphys.h"
     41!#include "comsoil.h"
    3842!#include"advtrac.h"
    3943#include "netcdf.inc"
     
    6266      REAL tsoil(ngridmx,nsoilmx) ! Soil temperature
    6367      REAL co2ice(ngridmx)      ! CO2 ice layer
    64       REAL q2(ngridmx,nlayermx+1)
     68      REAL q2(ngridmx,llm+1)
    6569      REAL,ALLOCATABLE :: qsurf(:,:)
    6670      REAL emis(ngridmx)
     
    126130      allocate(qsurf(ngridmx,nqtot))
    127131      allocate(qsurfS(ip1jmp1,nqtot))
     132      call ini_surfdat_h(ngridmx)
     133      call ini_comsoil_h(ngridmx)
     134     
    128135
    129136      fichnom = 'start.nc'
     
    135142      Lmodif=0
    136143
    137       CALL phyetat0 (fichnom,0,Lmodif,nsoilmx,nqtot,day_ini_fi,timefi,
    138      .      tsurf,tsoil,emis,q2,qsurf,co2ice)
     144      CALL phyetat0 (fichnom,0,Lmodif,nsoilmx,ngridmx,llm,nqtot,
     145     &      day_ini_fi,timefi,tsurf,tsoil,emis,q2,qsurf,co2ice)
    139146
    140147       ierr = NF_OPEN (fichnom, NF_NOWRITE,nid1)
  • trunk/LMDZ.MARS/libf/dyn3d/write_archive.F

    r38 r1047  
    3232c=======================================================================
    3333
     34      use comsoil_h, only: nsoilmx
    3435      implicit none
    3536
  • trunk/LMDZ.MARS/libf/phymars/aerkind.h

    r38 r1047  
    44!------------------------------------------------------------------
    55
    6 !     Don't forget to set up the right number of scatterer
    7 !       (naerkind) in dimradmars.h!
     6!     Don't forget that naerkind is set in scatterers.h
     7!       (built when compiling with makegcm -s #)
     8
    89      character*20  name_iaer(naerkind)  ! name of the scatterers
    910!     Scatterer: DUST
  • trunk/LMDZ.MARS/libf/phymars/aeropacity.F

    r1036 r1047  
    77      use tracer_mod, only: noms, igcm_h2o_ice, igcm_dust_mass,
    88     &                      igcm_dust_submicron, rho_dust, rho_ice
     9      use comgeomfi_h, only: lati ! grid point latitudes (rad)
     10      use yomaer_h, only: tauvis
    911       IMPLICIT NONE
    1012c=======================================================================
     
    3436c   pq                Dust mixing ratio (used if tracer =T and active=T).
    3537c   reffrad(ngrid,nlayer,naerkind)  Aerosol effective radius
    36 c   QREFvis3d(ngridmx,nlayermx,naerkind) \ 3d extinction coefficients
    37 c   QREFir3d(ngridmx,nlayermx,naerkind)  / at reference wavelengths;
    38 c   omegaREFvis3d(ngridmx,nlayermx,naerkind) \ 3d single scat. albedo
    39 c   omegaREFir3d(ngridmx,nlayermx,naerkind)  / at reference wavelengths;
     38c   QREFvis3d(ngrid,nlayer,naerkind) \ 3d extinction coefficients
     39c   QREFir3d(ngrid,nlayer,naerkind)  / at reference wavelengths;
     40c   omegaREFvis3d(ngrid,nlayer,naerkind) \ 3d single scat. albedo
     41c   omegaREFir3d(ngrid,nlayer,naerkind)  / at reference wavelengths;
    4042c
    4143c   output:
     
    4850c
    4951c=======================================================================
    50 #include "dimensions.h"
    51 #include "dimphys.h"
     52!#include "dimensions.h"
     53!#include "dimphys.h"
    5254#include "callkeys.h"
    5355#include "comcstfi.h"
    54 #include "comgeomfi.h"
    55 #include "dimradmars.h"
    56 #include "yomaer.h"
     56!#include "comgeomfi.h"
     57!#include "dimradmars.h"
     58!#include "yomaer.h"
    5759!#include "tracer.h"
     60! naerkind is set in scatterers.h (built when compiling with makegcm -s #)
     61#include"scatterers.h"
    5862#include "planete.h"
    5963#include "aerkind.h"
     
    7377      REAL tauref(ngrid), tau(ngrid,naerkind)
    7478      REAL aerosol(ngrid,nlayer,naerkind)
    75       REAL dsodust(ngridmx,nlayermx)
     79      REAL dsodust(ngrid,nlayer)
    7680      REAL reffrad(ngrid,nlayer,naerkind)
    7781      REAL nueffrad(ngrid,nlayer,naerkind)
    78       REAL QREFvis3d(ngridmx,nlayermx,naerkind)
    79       REAL QREFir3d(ngridmx,nlayermx,naerkind)
    80       REAL omegaREFvis3d(ngridmx,nlayermx,naerkind)
    81       REAL omegaREFir3d(ngridmx,nlayermx,naerkind)
     82      REAL QREFvis3d(ngrid,nlayer,naerkind)
     83      REAL QREFir3d(ngrid,nlayer,naerkind)
     84      REAL omegaREFvis3d(ngrid,nlayer,naerkind)
     85      REAL omegaREFir3d(ngrid,nlayer,naerkind)
    8286c
    8387c    Local variables :
     
    8589      INTEGER l,ig,iq,i,j
    8690      INTEGER iaer           ! Aerosol index
    87       real topdust(ngridmx)
     91      real topdust(ngrid)
    8892      real zlsconst, zp
    8993      real taueq,tauS,tauN
    9094c     Mean Qext(vis)/Qext(ir) profile
    91       real msolsir(nlayermx,naerkind)
     95      real msolsir(nlayer,naerkind)
    9296c     Mean Qext(ir)/Qabs(ir) profile
    93       real mqextsqabs(nlayermx,naerkind)
     97      real mqextsqabs(nlayer,naerkind)
    9498c     Variables used when multiple particle sizes are used
    9599c       for dust or water ice particles in the radiative transfer
    96100c       (see callradite.F for more information).
    97       REAL taudusttmp(ngridmx)! Temporary dust opacity
     101      REAL taudusttmp(ngrid)! Temporary dust opacity
    98102                               !   used before scaling
    99       REAL tauscaling(ngridmx) ! Scaling factor for qdust and Ndust
    100       REAL taudustvis(ngridmx) ! Dust opacity after scaling
    101       REAL taudusttes(ngridmx) ! Dust opacity at IR ref. wav. as
     103      REAL tauscaling(ngrid) ! Scaling factor for qdust and Ndust
     104      REAL taudustvis(ngrid) ! Dust opacity after scaling
     105      REAL taudusttes(ngrid) ! Dust opacity at IR ref. wav. as
    102106                               !   "seen" by the GCM.
    103       REAL taucloudvis(ngridmx)! Cloud opacity at visible
     107      REAL taucloudvis(ngrid)! Cloud opacity at visible
    104108                               !   reference wavelength
    105       REAL taucloudtes(ngridmx)! Cloud opacity at infrared
     109      REAL taucloudtes(ngrid)! Cloud opacity at infrared
    106110                               !   reference wavelength using
    107111                               !   Qabs instead of Qext
     
    111115c   ---------------------
    112116
    113       REAL topdust0(ngridmx)
    114       SAVE topdust0
     117      REAL,SAVE,ALLOCATABLE :: topdust0(:)
     118
    115119c     Level under which the dust mixing ratio is held constant
    116120c       when computing the dust opacity in each layer
     
    135139
    136140      IF (firstcall) THEN
     141        ! allocate local saved arrays
     142        allocate(nqdust(nq))
     143        allocate(topdust0(ngrid))
     144       
    137145        ! identify scatterers that are dust
    138146        naerdust=0
     
    145153        ENDDO
    146154        ! identify tracers which are dust
    147         allocate(nqdust(nq))
    148155        i=0
    149156        DO iq=1,nq
     
    174181          WRITE(*,*) "Aerosol # ",iaer
    175182          DO l=1,nlayer
    176             DO ig=1,ngridmx
     183            DO ig=1,ngrid
    177184              msolsir(l,iaer)=msolsir(l,iaer)+
    178185     &              QREFvis3d(ig,l,iaer)/
     
    181188     &              (1.E0-omegaREFir3d(ig,l,iaer))**(-1)
    182189            ENDDO
    183             msolsir(l,iaer)=msolsir(l,iaer)/REAL(ngridmx)
    184             mqextsqabs(l,iaer)=mqextsqabs(l,iaer)/REAL(ngridmx)
     190            msolsir(l,iaer)=msolsir(l,iaer)/REAL(ngrid)
     191            mqextsqabs(l,iaer)=mqextsqabs(l,iaer)/REAL(ngrid)
    185192          ENDDO
    186193          WRITE(*,*) "solsir: ",msolsir(:,iaer)
     
    199206c     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    200207      IF(iaervar.eq.1) THEN
    201          do ig=1, ngridmx
     208         do ig=1, ngrid
    202209          tauref(ig)=max(tauvis,1.e-9) ! tauvis=cste (set in callphys.def
    203210                                       ! or read in starfi
     
    220227c            taueq= 0.2 +(0.5-0.2) *(cos(0.5*(ls+pi-4.363)))**14
    221228c           endif
    222         do ig=1,ngrid/2  ! Northern hemisphere
    223           tauref(ig)= tauN +
    224      &    (taueq-tauN)*0.5*(1+tanh((45-lati(ig)*180./pi)*6/60))
    225         end do
    226         do ig=ngrid/2+1, ngridmx  ! Southern hemisphere
    227           tauref(ig)= tauS +
    228      &    (taueq-tauS)*0.5*(1+tanh((45+lati(ig)*180./pi)*6/60))
    229         end do
     229        do ig=1,ngrid
     230          if (lati(ig).ge.0) then
     231          ! Northern hemisphere
     232            tauref(ig)= tauN +
     233     &      (taueq-tauN)*0.5*(1+tanh((45-lati(ig)*180./pi)*6/60))
     234          else
     235          ! Southern hemisphere
     236            tauref(ig)= tauS +
     237     &      (taueq-tauS)*0.5*(1+tanh((45+lati(ig)*180./pi)*6/60))
     238          endif
     239        enddo ! of do ig=1,ngrid
    230240      ELSE IF (iaervar.eq.5) THEN   ! << Escalier Scenario>>
    231241c         tauref(1) = 0.2
     
    397407c       3. Outputs -- Now done in physiq.F
    398408!        IF (ngrid.NE.1) THEN
    399 !          CALL WRITEDIAGFI(ngridmx,'tauVIS','tauext VIS refwvl',
     409!          CALL WRITEDIAGFI(ngrid,'tauVIS','tauext VIS refwvl',
    400410!     &      ' ',2,taucloudvis)
    401 !          CALL WRITEDIAGFI(ngridmx,'tauTES','tauabs IR refwvl',
     411!          CALL WRITEDIAGFI(ngrid,'tauTES','tauabs IR refwvl',
    402412!     &      ' ',2,taucloudtes)
    403413!          IF (callstats) THEN
    404 !            CALL wstats(ngridmx,'tauVIS','tauext VIS refwvl',
     414!            CALL wstats(ngrid,'tauVIS','tauext VIS refwvl',
    405415!     &        ' ',2,taucloudvis)
    406 !            CALL wstats(ngridmx,'tauTES','tauabs IR refwvl',
     416!            CALL wstats(ngrid,'tauTES','tauabs IR refwvl',
    407417!     &        ' ',2,taucloudtes)
    408418!          ENDIF
     
    452462c output for debug
    453463c        IF (ngrid.NE.1) THEN
    454 c             CALL WRITEDIAGFI(ngridmx,'taudusttmp','virtual tau dust',
     464c             CALL WRITEDIAGFI(ngrid,'taudusttmp','virtual tau dust',
    455465c     &      '#',2,taudusttmp)
    456 c             CALL WRITEDIAGFI(ngridmx,'tausca','tauscaling',
     466c             CALL WRITEDIAGFI(ngrid,'tausca','tauscaling',
    457467c     &      '#',2,tauscaling)
    458468c        ELSE
    459 c             CALL WRITEDIAGFI(ngridmx,'taudusttmp','virtual tau dust',
     469c             CALL WRITEDIAGFI(ngrid,'taudusttmp','virtual tau dust',
    460470c     &      '#',0,taudusttmp)
    461 c             CALL WRITEDIAGFI(ngridmx,'tausca','tauscaling',
     471c             CALL WRITEDIAGFI(ngrid,'tausca','tauscaling',
    462472c     &      '#',0,tauscaling)
    463473c        ENDIF
     
    477487c      dsodust(1:ngrid,1:nlayer) = 0.
    478488c      DO iaer=1,naerdust
    479 c        DO l=1,nlayermx
     489c        DO l=1,nlayer
    480490c          DO ig=1,ngrid
    481491c            dsodust(ig,l) = dsodust(ig,l) +
     
    486496c        IF (ngrid.NE.1) THEN
    487497c          write(txt2,'(i1.1)') iaer
    488 c          call WRITEDIAGFI(ngridmx,'taudust'//txt2,
     498c          call WRITEDIAGFI(ngrid,'taudust'//txt2,
    489499c     &                    'Dust col opacity',
    490500c     &                    ' ',2,tau(1,iaerdust(iaer)))
    491501c          IF (callstats) THEN
    492 c            CALL wstats(ngridmx,'taudust'//txt2,
     502c            CALL wstats(ngrid,'taudust'//txt2,
    493503c     &                 'Dust col opacity',
    494504c     &                 ' ',2,tau(1,iaerdust(iaer)))
     
    498508
    499509c      IF (ngrid.NE.1) THEN
    500 c       CALL WRITEDIAGFI(ngridmx,'dsodust','tau*g/dp',
     510c       CALL WRITEDIAGFI(ngrid,'dsodust','tau*g/dp',
    501511c    &                    'm2.kg-1',3,dsodust)
    502512c        IF (callstats) THEN
    503 c          CALL wstats(ngridmx,'dsodust',
     513c          CALL wstats(ngrid,'dsodust',
    504514c     &               'tau*g/dp',
    505515c     &               'm2.kg-1',3,dsodust)
  • trunk/LMDZ.MARS/libf/phymars/aeroptproperties.F

    r784 r1047  
    44     &                            QREFvis3d,QREFir3d,
    55     &                            omegaREFvis3d,omegaREFir3d)
     6      use dimradmars_mod, only: nir, nsun
     7      use yomaer_h, only: radiustab, nsize, QVISsQREF, omegavis, gvis,
     8     &                    QIRsQREF, omegaIR, gIR, QREFvis, QREFir,
     9     &                    omegaREFvis, omegaREFir
    610      IMPLICIT NONE
    711c     =============================================================
     
    2630#include "dimphys.h"
    2731#include "callkeys.h"
    28 #include "dimradmars.h"
    29 #include "yomaer.h"
     32!#include "dimradmars.h"
     33!#include "yomaer.h"
     34! naerkind is set in scatterers.h (built when compiling with makegcm -s #)
     35#include"scatterers.h"
    3036
    3137c     Local variables
     
    4955      INTEGER :: grid_i,grid_j
    5056c     Intermediate variable
    51       REAL :: var_tmp,var3d_tmp(ngridmx,nlayermx)
     57      REAL :: var_tmp,var3d_tmp(ngrid,nlayer)
    5258c     Bilinear interpolation factors
    5359      REAL :: kx,ky,k1,k2,k3,k4
     
    8793
    8894c     Radius axis of the interpolation grid
    89       REAL,SAVE :: refftab(refftabsize,naerkind,2)
     95      REAL,SAVE,ALLOCATABLE :: refftab(:,:,:)
    9096c     Variance axis of the interpolation grid
    91       REAL,SAVE :: nuefftab(nuefftabsize,naerkind,2)
     97      REAL,SAVE,ALLOCATABLE :: nuefftab(:,:,:)
    9298c     Volume ratio of the grid
    9399      REAL,SAVE :: logvratgrid(naerkind,2)
     
    96102     &                = .false.
    97103c     Optical properties of the grid (VISIBLE)
    98       REAL,SAVE :: qsqrefVISgrid(refftabsize,nuefftabsize,nsun,naerkind)
    99       REAL,SAVE :: qextVISgrid(refftabsize,nuefftabsize,nsun,naerkind)
    100       REAL,SAVE :: qscatVISgrid(refftabsize,nuefftabsize,nsun,naerkind)
    101       REAL,SAVE :: omegVISgrid(refftabsize,nuefftabsize,nsun,naerkind)
    102       REAL,SAVE :: gVISgrid(refftabsize,nuefftabsize,nsun,naerkind)
     104      REAL,SAVE,ALLOCATABLE :: qsqrefVISgrid(:,:,:,:)
     105      REAL,SAVE,ALLOCATABLE :: qextVISgrid(:,:,:,:)
     106      REAL,SAVE,ALLOCATABLE :: qscatVISgrid(:,:,:,:)
     107      REAL,SAVE,ALLOCATABLE :: omegVISgrid(:,:,:,:)
     108      REAL,SAVE,ALLOCATABLE :: gVISgrid(:,:,:,:)
    103109c     Optical properties of the grid (INFRARED)
    104       REAL,SAVE :: qsqrefIRgrid(refftabsize,nuefftabsize,nir,naerkind)
    105       REAL,SAVE :: qextIRgrid(refftabsize,nuefftabsize,nir,naerkind)
    106       REAL,SAVE :: qscatIRgrid(refftabsize,nuefftabsize,nir,naerkind)
    107       REAL,SAVE :: omegIRgrid(refftabsize,nuefftabsize,nir,naerkind)
    108       REAL,SAVE :: gIRgrid(refftabsize,nuefftabsize,nir,naerkind)
     110      REAL,SAVE,ALLOCATABLE :: qsqrefIRgrid(:,:,:,:)
     111      REAL,SAVE,ALLOCATABLE :: qextIRgrid(:,:,:,:)
     112      REAL,SAVE,ALLOCATABLE :: qscatIRgrid(:,:,:,:)
     113      REAL,SAVE,ALLOCATABLE :: omegIRgrid(:,:,:,:)
     114      REAL,SAVE,ALLOCATABLE :: gIRgrid(:,:,:,:)
    109115c     Optical properties of the grid (REFERENCE WAVELENGTHS)
    110116      REAL,SAVE :: qrefVISgrid(refftabsize,nuefftabsize,naerkind)
     
    124130      REAL,SAVE :: radGAUSb(ngau,naerkind,2)
    125131
    126       REAL,SAVE :: qsqrefVISa(nsun,ngau,naerkind)
    127       REAL,SAVE :: qrefVISa(ngau,naerkind)
    128       REAL,SAVE :: qsqrefVISb(nsun,ngau,naerkind)
    129       REAL,SAVE :: qrefVISb(ngau,naerkind)
    130       REAL,SAVE :: omegVISa(nsun,ngau,naerkind)
    131       REAL,SAVE :: omegrefVISa(ngau,naerkind)
    132       REAL,SAVE :: omegVISb(nsun,ngau,naerkind)
    133       REAL,SAVE :: omegrefVISb(ngau,naerkind)
    134       REAL,SAVE :: gVISa(nsun,ngau,naerkind)
    135       REAL,SAVE :: gVISb(nsun,ngau,naerkind)
    136 
    137       REAL,SAVE :: qsqrefIRa(nir,ngau,naerkind)
    138       REAL,SAVE :: qrefIRa(ngau,naerkind)
    139       REAL,SAVE :: qsqrefIRb(nir,ngau,naerkind)
    140       REAL,SAVE :: qrefIRb(ngau,naerkind)
    141       REAL,SAVE :: omegIRa(nir,ngau,naerkind)
    142       REAL,SAVE :: omegrefIRa(ngau,naerkind)
    143       REAL,SAVE :: omegIRb(nir,ngau,naerkind)
    144       REAL,SAVE :: omegrefIRb(ngau,naerkind)
    145       REAL,SAVE :: gIRa(nir,ngau,naerkind)
    146       REAL,SAVE :: gIRb(nir,ngau,naerkind)
     132      REAL,SAVE,ALLOCATABLE :: qsqrefVISa(:,:,:)
     133      REAL,SAVE,ALLOCATABLE :: qrefVISa(:,:)
     134      REAL,SAVE,ALLOCATABLE :: qsqrefVISb(:,:,:)
     135      REAL,SAVE,ALLOCATABLE :: qrefVISb(:,:)
     136      REAL,SAVE,ALLOCATABLE :: omegVISa(:,:,:)
     137      REAL,SAVE,ALLOCATABLE :: omegrefVISa(:,:)
     138      REAL,SAVE,ALLOCATABLE :: omegVISb(:,:,:)
     139      REAL,SAVE,ALLOCATABLE :: omegrefVISb(:,:)
     140      REAL,SAVE,ALLOCATABLE :: gVISa(:,:,:)
     141      REAL,SAVE,ALLOCATABLE :: gVISb(:,:,:)
     142
     143      REAL,SAVE,ALLOCATABLE :: qsqrefIRa(:,:,:)
     144      REAL,SAVE,ALLOCATABLE :: qrefIRa(:,:)
     145      REAL,SAVE,ALLOCATABLE :: qsqrefIRb(:,:,:)
     146      REAL,SAVE,ALLOCATABLE :: qrefIRb(:,:)
     147      REAL,SAVE,ALLOCATABLE :: omegIRa(:,:,:)
     148      REAL,SAVE,ALLOCATABLE :: omegrefIRa(:,:)
     149      REAL,SAVE,ALLOCATABLE :: omegIRb(:,:,:)
     150      REAL,SAVE,ALLOCATABLE :: omegrefIRb(:,:)
     151      REAL,SAVE,ALLOCATABLE :: gIRa(:,:,:)
     152      REAL,SAVE,ALLOCATABLE :: gIRb(:,:,:)
    147153
    148154      REAL :: radiusm
     
    152158c     ------
    153159
    154       INTEGER :: ngrid,nlayer
     160      INTEGER,INTENT(IN) :: ngrid,nlayer
    155161c     Aerosol effective radius used for radiative transfer (meter)
    156       REAL :: reffrad(ngridmx,nlayermx,naerkind)
     162      REAL,INTENT(IN) :: reffrad(ngrid,nlayer,naerkind)
    157163c     Aerosol effective variance used for radiative transfer (n.u.)
    158       REAL :: nueffrad(ngridmx,nlayermx,naerkind)
     164      REAL,INTENT(IN) :: nueffrad(ngrid,nlayer,naerkind)
    159165
    160166c     Outputs
    161167c     -------
    162168
    163       REAL :: QVISsQREF3d(ngridmx,nlayermx,nsun,naerkind)
    164       REAL :: omegaVIS3d(ngridmx,nlayermx,nsun,naerkind)
    165       REAL :: gVIS3d(ngridmx,nlayermx,nsun,naerkind)
    166 
    167       REAL :: QIRsQREF3d(ngridmx,nlayermx,nir,naerkind)
    168       REAL :: omegaIR3d(ngridmx,nlayermx,nir,naerkind)
    169       REAL :: gIR3d(ngridmx,nlayermx,nir,naerkind)
    170 
    171       REAL :: QREFvis3d(ngridmx,nlayermx,naerkind)
    172       REAL :: QREFir3d(ngridmx,nlayermx,naerkind)
    173 
    174       REAL :: omegaREFvis3d(ngridmx,nlayermx,naerkind)
    175       REAL :: omegaREFir3d(ngridmx,nlayermx,naerkind)
     169      REAL,INTENT(OUT) :: QVISsQREF3d(ngrid,nlayer,nsun,naerkind)
     170      REAL,INTENT(OUT) :: omegaVIS3d(ngrid,nlayer,nsun,naerkind)
     171      REAL,INTENT(OUT) :: gVIS3d(ngrid,nlayer,nsun,naerkind)
     172
     173      REAL,INTENT(OUT) :: QIRsQREF3d(ngrid,nlayer,nir,naerkind)
     174      REAL,INTENT(OUT) :: omegaIR3d(ngrid,nlayer,nir,naerkind)
     175      REAL,INTENT(OUT) :: gIR3d(ngrid,nlayer,nir,naerkind)
     176
     177      REAL,INTENT(OUT) :: QREFvis3d(ngrid,nlayer,naerkind)
     178      REAL,INTENT(OUT) :: QREFir3d(ngrid,nlayer,naerkind)
     179
     180      REAL,INTENT(OUT) :: omegaREFvis3d(ngrid,nlayer,naerkind)
     181      REAL,INTENT(OUT) :: omegaREFir3d(ngrid,nlayer,naerkind)
    176182
    177183c     Tests
     
    181187      INTEGER, PARAMETER :: out_iaer = 2
    182188      INTEGER :: out_ndim
    183       REAL :: out_qext(ngridmx,nlayermx)
    184       REAL :: out_omeg(ngridmx,nlayermx)
    185       REAL :: out_g(ngridmx,nlayermx)
     189      REAL :: out_qext(ngrid,nlayer)
     190      REAL :: out_omeg(ngrid,nlayer)
     191      REAL :: out_g(ngrid,nlayer)
    186192      INTEGER :: out_nchannel
    187193      CHARACTER*1 :: out_str
     
    190196c     -----------------------------------------------
    191197      IF (firstcall) THEN
     198c       0.0 Allocate all local saved arrays:
     199        allocate(refftab(refftabsize,naerkind,2))
     200        allocate(nuefftab(nuefftabsize,naerkind,2))
     201        ! Optical properties of the grid (VISIBLE)
     202        allocate(qsqrefVISgrid(refftabsize,nuefftabsize,nsun,naerkind))
     203        allocate(qextVISgrid(refftabsize,nuefftabsize,nsun,naerkind))
     204        allocate(qscatVISgrid(refftabsize,nuefftabsize,nsun,naerkind))
     205        allocate(omegVISgrid(refftabsize,nuefftabsize,nsun,naerkind))
     206        allocate(gVISgrid(refftabsize,nuefftabsize,nsun,naerkind))
     207        ! Optical properties of the grid (INFRARED)
     208        allocate(qsqrefIRgrid(refftabsize,nuefftabsize,nir,naerkind))
     209        allocate(qextIRgrid(refftabsize,nuefftabsize,nir,naerkind))
     210        allocate(qscatIRgrid(refftabsize,nuefftabsize,nir,naerkind))
     211        allocate(omegIRgrid(refftabsize,nuefftabsize,nir,naerkind))
     212        allocate(gIRgrid(refftabsize,nuefftabsize,nir,naerkind))
     213       
     214        allocate(qsqrefVISa(nsun,ngau,naerkind))
     215        allocate(qrefVISa(ngau,naerkind))
     216        allocate(qsqrefVISb(nsun,ngau,naerkind))
     217        allocate(qrefVISb(ngau,naerkind))
     218        allocate(omegVISa(nsun,ngau,naerkind))
     219        allocate(omegrefVISa(ngau,naerkind))
     220        allocate(omegVISb(nsun,ngau,naerkind))
     221        allocate(omegrefVISb(ngau,naerkind))
     222        allocate(gVISa(nsun,ngau,naerkind))
     223        allocate(gVISb(nsun,ngau,naerkind))
     224       
     225        allocate(qsqrefIRa(nir,ngau,naerkind))
     226        allocate(qrefIRa(ngau,naerkind))
     227        allocate(qsqrefIRb(nir,ngau,naerkind))
     228        allocate(qrefIRb(ngau,naerkind))
     229        allocate(omegIRa(nir,ngau,naerkind))
     230        allocate(omegrefIRa(ngau,naerkind))
     231        allocate(omegIRb(nir,ngau,naerkind))
     232        allocate(omegrefIRb(ngau,naerkind))
     233        allocate(gIRa(nir,ngau,naerkind))
     234        allocate(gIRb(nir,ngau,naerkind))
     235       
    192236c       0.1 Pi!
    193237        pi = 2. * asin(1.e0)
     
    758802     &                  k2*omegrefIRgrid(grid_i+1,1,iaer)
    759803          ENDIF                  ! --------------------------------
    760         ENDDO !nlayermx
    761       ENDDO !ngridmx
     804        ENDDO !nlayer
     805      ENDDO !ngrid
    762806c==================================================================
    763807      ELSE                                          ! VARYING NUEFF
     
    11711215     &                  k4*omegrefIRgrid(grid_i,grid_j+1,iaer)
    11721216          ENDIF                  ! --------------------------------
    1173         ENDDO !nlayermx
    1174       ENDDO !ngridmx
     1217        ENDDO !nlayer
     1218      ENDDO !ngrid
    11751219
    11761220      ENDIF ! varyingnueff
  • trunk/LMDZ.MARS/libf/phymars/albedocaps.F90

    r801 r1047  
    55
    66! to use the 'getin' routine
    7 use ioipsl_getincom
    8 
     7use ioipsl_getincom, only: getin
     8#ifdef MESOSCALE
     9use comgeomfi_h
     10#endif
     11use surfdat_h, only: TESicealbedo, TESice_Ncoef, TESice_Scoef, &
     12                     emisice, albedice, watercaptag, albedo_h2o_ice, &
     13                     emissiv, albedodat
    914implicit none
    1015
    1116#include"dimensions.h"
    1217#include"dimphys.h"
    13 #include"surfdat.h"
     18!#include"surfdat.h"
    1419#include"callkeys.h"
    15 #ifdef MESOSCALE
    16 #include"comgeomfi.h"
    17 #endif
     20!#ifdef MESOSCALE
     21!#include"comgeomfi.h"
     22!#endif
    1823
    1924! arguments:
     
    98103subroutine TES_icecap_albedo(zls,ig,alb,icap)
    99104
     105use comgeomfi_h, only: lati, long
     106use surfdat_h, only: albedice, TESice_Ncoef, TESice_Scoef
    100107implicit none
    101108#include"dimensions.h"
    102109#include"dimphys.h"
    103 #include"surfdat.h"
    104 #include"comgeomfi.h"
     110!#include"surfdat.h"
     111!#include"comgeomfi.h"
    105112#include"netcdf.inc"
    106113#include"datafile.h"
  • trunk/LMDZ.MARS/libf/phymars/blendrad.F

    r38 r1047  
    1010c  the scale over which this happens are set in the nlteparams.h file.
    1111c  Above layer NLAYLTE the tendency is purely the sum of NLTE contributions.
    12 c  (Note : nlaylte is calculated by "nlthermeq" and stored in common "yomlw.h")
     12c  (Note : nlaylte is calculated by "nlthermeq" and stored in module "yomlw_h")
    1313c  Stephen Lewis 6/2000 FF
    1414c
     15      use yomlw_h, only: nlaylte
    1516      implicit none
    16 #include "dimensions.h"
    17 #include "dimphys.h"
    18 #include "dimradmars.h"
     17!#include "dimensions.h"
     18!#include "dimphys.h"
     19!#include "dimradmars.h"
    1920#include "nlteparams.h"
    20 #include "yomlw.h"
     21!#include "yomlw.h"
    2122
    2223c     Input:
  • trunk/LMDZ.MARS/libf/phymars/calldrag_noro.F

    r38 r1047  
    44
    55
    6                                                    
     6       use surfdat_h, only: zstd, zsig, zgam, zthe
     7       use dimradmars_mod, only: ndomainsz
    78       IMPLICIT NONE
    89c=======================================================================
     
    1617c        ("sub-domain") to save memory and
    1718c        be able run on a workstation at high resolution
    18 c        The sub-grid size is defined in dimradmars.h.
     19c        The sub-grid size is defined in dimradmars_mod.
    1920c
    2021c   author:   
     
    5455c    ------------------
    5556c
    56 #include "dimensions.h"
    57 #include "dimphys.h"
    58 #include "dimradmars.h"
    59 #include "surfdat.h"
     57!#include "dimensions.h"
     58!#include "dimphys.h"
     59!#include "dimradmars.h"
     60!#include "surfdat.h"
    6061
    6162c-----------------------------------------------------------------------
     
    7576c    -----------------
    7677
    77       REAL sigtest(nlayermx+1)
    78       INTEGER igwd,igwdim,itest(ngridmx)
    79 
    80       INTEGER ndomain
    81       parameter (ndomain = (ngridmx-1) / ndomainsz + 1)
     78      REAL sigtest(nlayer+1)
     79      INTEGER igwd,igwdim,itest(ngrid)
     80
     81      INTEGER,SAVE :: ndomain
     82!      parameter (ndomain = (ngrid-1) / ndomainsz + 1)
    8283
    8384      INTEGER l,ig
    8485      INTEGER jd,ig0,nd
    8586
    86       REAL zulow(ngridmx),zvlow(ngridmx)
    87       REAL zustr(ngridmx),zvstr(ngridmx)
    88 
    89       REAL zplev(ndomainsz,nlayermx+1)
    90       REAL zplay(ndomainsz,nlayermx)
    91       REAL zt(ndomainsz,nlayermx)
    92       REAL zu(ndomainsz,nlayermx)
    93       REAL zv(ndomainsz,nlayermx)
     87      REAL zulow(ngrid),zvlow(ngrid)
     88      REAL zustr(ngrid),zvstr(ngrid)
     89
     90      REAL zplev(ndomainsz,nlayer+1)
     91      REAL zplay(ndomainsz,nlayer)
     92      REAL zt(ndomainsz,nlayer)
     93      REAL zu(ndomainsz,nlayer)
     94      REAL zv(ndomainsz,nlayer)
    9495      INTEGER zidx(ndomainsz)
    95       REAL zzdtgw(ndomainsz,nlayermx)
    96       REAL zzdugw(ndomainsz,nlayermx)
    97       REAL zzdvgw(ndomainsz,nlayermx)
     96      REAL zzdtgw(ndomainsz,nlayer)
     97      REAL zzdugw(ndomainsz,nlayer)
     98      REAL zzdvgw(ndomainsz,nlayer)
    9899
    99100      logical ll
     
    114115
    115116      IF (firstcall) THEN
    116          do l=1,nlayermx+1
     117        ndomain = (ngrid-1) / ndomainsz + 1
     118
     119         do l=1,nlayer+1
    117120           sigtest(l)=pplev(1,l)/pplev(1,1)
    118121         enddo
    119          call sugwd(nlayermx,sigtest)
    120 
    121          if (ngridmx .EQ. 1) then
     122         call sugwd(nlayer,sigtest)
     123
     124         if (ngrid .EQ. 1) then
    122125           if (ndomainsz .NE. 1) then
    123126             print*
    124127             print*,'ATTENTION !!!'
    125128             print*,'pour tourner en 1D, meme pour drag_noro '
    126              print*,'fixer ndomainsz=1 dans phymars/dimradmars.h'
     129             print*,'fixer ndomainsz=1 dans phymars/dimradmars_mod'
    127130             print*
    128131             call exit(1)
     
    139142        ig0=(jd-1)*ndomainsz
    140143        if (jd.eq.ndomain) then
    141           nd=ngridmx-ig0
     144          nd=ngrid-ig0
    142145        else
    143146          nd=ndomainsz
  • trunk/LMDZ.MARS/libf/phymars/callradite.F

    r1036 r1047  
    55     &     nuice,co2ice)
    66
    7        IMPLICIT NONE
     7      use dimradmars_mod, only: ndomainsz, nflev, nsun, nir
     8      use yomlw_h, only: gcp, nlaylte
     9      IMPLICIT NONE
    810c=======================================================================
    911c   subject:
     
    1820c   The calculations are only performed for the first "nlaylte"
    1921c   parameters (nlaylte is calculated by subroutine "nlthermeq"
    20 c   and stored in common "yomlw.h").
     22c   and stored in module "yomlw_h").
    2123c
    2224c   The purpose of this subroutine is to:
     
    2527c        ("sub-domain") to save memory and
    2628c        be able run on a workstation at high resolution
    27 c        The sub-grid size is defined in dimradmars.h
     29c        The sub-grid size is defined in dimradmars_mod
    2830c      3) Compute the 3D scattering parameters depending on the
    2931c        size distribution of the different tracers (added by JBM)
     
    7476c   
    7577c   This version has been modified to only calculate radiative tendencies
    76 c   over layers 1..NFLEV (set in dimradmars.h).  Returns zero for higher
     78c   over layers 1..NFLEV (set in dimradmars_mod).  Returns zero for higher
    7779c   layers, if any.
    7880c   In other routines, nlayermx -> nflev.
     
    8587c   ----------
    8688c   Here, solar band#1 is spectral interval between "long1vis" and "long2vis"
    87 c   set in dimradmars.h
     89c   set in dimradmars_mod
    8890c   Here, solar band#2 is spectral interval between "long2vis" and "long3vis"
    89 c   set in dimradmars.h
     91c   set in dimradmars_mod
    9092c
    9193c   input:
     
    105107c                                        (see below)
    106108c   emis                  Thermal IR surface emissivity (no unit)
    107 c   mu0(ngridmx)           cos of solar zenith angle
     109c   mu0(ngrid)           cos of solar zenith angle
    108110c                           (=1 when sun at zenith)
    109111c   pplay(ngrid,nlayer)    pressure (Pa) in the middle of each layer
     
    111113c   pt(ngrid,nlayer)       atmospheric temperature in each layer (K)
    112114c   tsurf(ngrid)           surface temperature (K)
    113 c   fract(ngridmx)         day fraction of the time interval
     115c   fract(ngrid)         day fraction of the time interval
    114116c                          =1 during the full day ; =0 during the night
    115117c   declin                 latitude of subsolar point
     
    136138c   aerosol(ngrid,nlayer,naerkind)    aerosol extinction optical depth
    137139c                         at reference wavelength "longrefvis" set
    138 c                         in dimradmars.h , in each layer, for one of
     140c                         in dimradmars_h , in each layer, for one of
    139141c                         the "naerkind" kind of aerosol optical
    140142c                         properties.
     
    145147c    -------------
    146148c
    147 #include "dimensions.h"
    148 #include "dimphys.h"
    149 #include "dimradmars.h"
     149!#include "dimensions.h"
     150!#include "dimphys.h"
     151!#include "dimradmars.h"
    150152#include "comcstfi.h"
    151153#include "callkeys.h"
    152 #include "yomlw.h"
     154!#include "yomlw.h"
     155! naerkind is set in scatterers.h (built when compiling with makegcm -s #)
     156#include"scatterers.h"
    153157#include "aerkind.h"
    154158
     
    156160c    Input/Output
    157161c    ------------
    158       INTEGER icount       
    159       INTEGER ngrid,nlayer,nq
    160       INTEGER igout
    161 
    162       REAL pq(ngrid,nlayer,nq)
    163       REAL tauscaling(ngridmx) ! Conversion factor for
     162      INTEGER,INTENT(IN) :: icount       
     163      INTEGER,INTENT(IN) :: ngrid,nlayer,nq
     164      INTEGER,INTENT(IN) :: igout
     165
     166      REAL,INTENT(IN) :: pq(ngrid,nlayer,nq)
     167      REAL,INTENT(IN) :: tauscaling(ngrid) ! Conversion factor for
    164168                               ! qdust and Ndust
    165       REAL albedo(ngrid,2),emis(ngrid)
    166       REAL ls,zday
    167 
    168       REAL pplev(ngrid,nlayer+1),pplay(ngrid,nlayer)
    169       REAL pt(ngrid,nlayer)
    170       REAL tsurf(ngrid)
    171       REAL dist_sol,mu0(ngrid),fract(ngrid)
    172       REAL dtlw(ngridmx,nlayermx),dtsw(ngridmx,nlayermx)
    173       REAL fluxsurf_lw(ngridmx), fluxtop_lw(ngridmx)
    174       REAL fluxsurf_sw(ngridmx,2), fluxtop_sw(ngridmx,2)
    175 
    176       REAL tauref(ngrid), tau(ngrid,naerkind)
    177       REAL taucloudtes(ngridmx)! Cloud opacity at infrared
     169      REAL,INTENT(IN) :: albedo(ngrid,2),emis(ngrid)
     170      REAL,INTENT(IN) :: ls,zday
     171
     172      REAL,INTENT(IN) :: pplev(ngrid,nlayer+1),pplay(ngrid,nlayer)
     173      REAL,INTENT(IN) :: pt(ngrid,nlayer)
     174      REAL,INTENT(IN) :: tsurf(ngrid)
     175      REAL,INTENT(IN) :: dist_sol,mu0(ngrid),fract(ngrid)
     176      REAL,INTENT(OUT) :: dtlw(ngrid,nlayer),dtsw(ngrid,nlayer)
     177      REAL,INTENT(OUT) :: fluxsurf_lw(ngrid), fluxtop_lw(ngrid)
     178      REAL,INTENT(OUT) :: fluxsurf_sw(ngrid,2), fluxtop_sw(ngrid,2)
     179
     180      REAL,INTENT(OUT) :: tauref(ngrid), tau(ngrid,naerkind)
     181      REAL,INTENT(OUT) :: taucloudtes(ngrid)! Cloud opacity at infrared
    178182                               !   reference wavelength using
    179183                               !   Qabs instead of Qext
    180184                               !   (direct comparison with TES)
    181       REAL aerosol(ngrid,nlayer,naerkind)
    182       REAL rdust(ngridmx,nlayermx)  ! Dust geometric mean radius (m)
    183       REAL rice(ngridmx,nlayermx)   ! Ice geometric mean radius (m)
    184       REAL nuice(ngridmx,nlayermx)  ! Estimated effective variance
    185       REAL co2ice(ngridmx)           ! co2 ice surface layer (kg.m-2)
     185      REAL,INTENT(OUT) :: aerosol(ngrid,nlayer,naerkind)
     186      REAL,INTENT(OUT) :: rdust(ngrid,nlayer)  ! Dust geometric mean radius (m)
     187      REAL,INTENT(OUT) :: rice(ngrid,nlayer)   ! Ice geometric mean radius (m)
     188      REAL,INTENT(OUT) :: nuice(ngrid,nlayer)  ! Estimated effective variance
     189      REAL,INTENT(IN) :: co2ice(ngrid)           ! co2 ice surface layer (kg.m-2)
    186190
    187191c
     
    194198
    195199      real  cste_mars ! solar constant on Mars (Wm-2)
    196       REAL ptlev(ngridmx,nlayermx+1)
    197 
    198       INTEGER ndomain
    199       parameter (ndomain = (ngridmx-1) / ndomainsz + 1)
     200      REAL ptlev(ngrid,nlayer+1)
     201
     202      INTEGER,SAVE :: ndomain
    200203
    201204c     Thermal IR net radiative budget (W m-2)
     
    232235      REAL :: nueffrad(ngrid,nlayer,naerkind)
    233236c     Aerosol optical properties
    234       REAL :: QVISsQREF3d(ngridmx,nlayermx,nsun,naerkind)
    235       REAL :: omegaVIS3d(ngridmx,nlayermx,nsun,naerkind)
    236       REAL :: gVIS3d(ngridmx,nlayermx,nsun,naerkind)
    237 
    238       REAL :: QIRsQREF3d(ngridmx,nlayermx,nir,naerkind)
    239       REAL :: omegaIR3d(ngridmx,nlayermx,nir,naerkind)
    240       REAL :: gIR3d(ngridmx,nlayermx,nir,naerkind)
    241 
    242       REAL :: QREFvis3d(ngridmx,nlayermx,naerkind)
    243       REAL :: QREFir3d(ngridmx,nlayermx,naerkind)
    244 
    245       REAL :: omegaREFvis3d(ngridmx,nlayermx,naerkind)
    246       REAL :: omegaREFir3d(ngridmx,nlayermx,naerkind)
     237      REAL :: QVISsQREF3d(ngrid,nlayer,nsun,naerkind)
     238      REAL :: omegaVIS3d(ngrid,nlayer,nsun,naerkind)
     239      REAL :: gVIS3d(ngrid,nlayer,nsun,naerkind)
     240
     241      REAL :: QIRsQREF3d(ngrid,nlayer,nir,naerkind)
     242      REAL :: omegaIR3d(ngrid,nlayer,nir,naerkind)
     243      REAL :: gIR3d(ngrid,nlayer,nir,naerkind)
     244
     245      REAL :: QREFvis3d(ngrid,nlayer,naerkind)
     246      REAL :: QREFir3d(ngrid,nlayer,naerkind)
     247
     248      REAL :: omegaREFvis3d(ngrid,nlayer,naerkind)
     249      REAL :: omegaREFir3d(ngrid,nlayer,naerkind)
    247250
    248251c   local saved variables
    249252c   ---------------------
    250253
    251       real pview(ngridmx)
    252       save pview
     254      real,save,allocatable :: pview(:)
    253255     
    254256      real zco2   ! volume fraction of CO2 in Mars atmosphere
     
    266268
    267269      IF (firstcall) THEN
     270        ! compute ndomain and allocate local saved arrays
     271        ndomain= (ngrid-1) / ndomainsz + 1
     272        allocate(pview(ngrid))
    268273
    269274c        Please name the different scatterers here ----------------
    270275c        PLEASE MAKE SURE that you set up the right number of
    271 c          scatterers in dimradmars.h (naerkind);
     276c          scatterers in scatterers.h (naerkind);
    272277          name_iaer(1) = "dust_conrath"   !! default choice is good old Conrath profile
    273278          IF (doubleq.AND.active) name_iaer(1) = "dust_doubleq" !! two-moment scheme
     
    328333           write(*,*) "               expected ",naerkind
    329334           write(*,*) "please make sure that the number of"
    330            write(*,*) "scatterers in dimradmars.h, the names"
     335           write(*,*) "scatterers in scatterers.h, the names"
    331336           write(*,*) "in callradite.F, and the flags in"
    332337           write(*,*) "callphys.def are all consistent!"
     
    353358           WRITE(*,*) 'If activice is TRUE, water has to be set'
    354359           WRITE(*,*) 'to TRUE, and "naerkind" must be at least'
    355            WRITE(*,*) 'equal to 2 in dimradmars.h.'
     360           WRITE(*,*) 'equal to 2 in scatterers.h.'
    356361           CALL ABORT
    357362         ELSE IF ( (.NOT.activice).AND.(naerkind.GT.1) ) THEN
     
    364369c        Loading the optical properties in external look-up tables:
    365370         CALL SUAER
    366          CALL SULW
     371!         CALL SULW ! this step is now done in ini_yomlw_h
    367372
    368373         write(*,*) 'Splitting radiative calculations: ',
    369      $              ' ngridmx,ngrid,ndomainsz,ndomain',
    370      $                ngridmx,ngrid,ndomainsz,ndomain
    371          if (ngridmx .EQ. 1) then
     374     $              ' ngrid,ndomainsz,ndomain',
     375     $                ngrid,ndomainsz,ndomain
     376         if (ngrid .EQ. 1) then
    372377           if (ndomainsz .NE. 1) then
    373378             print*
    374379             print*,'ATTENTION !!!'
    375380             print*,'pour tourner en 1D, '
    376              print*,'fixer ndomainsz=1 dans phymars/dimradmars.h'
     381             print*,'fixer ndomainsz=1 dans phymars/dimradmars_h'
    377382             print*
    378383             call exit(1)
     
    409414        ig0=(jd-1)*ndomainsz
    410415        if (jd.eq.ndomain) then
    411          nd=ngridmx-ig0
     416         nd=ngrid-ig0
    412417        else
    413418         nd=ndomainsz
  • trunk/LMDZ.MARS/libf/phymars/callsedim.F

    r1036 r1047  
    2929c   -------------
    3030     
    31 #include "dimensions.h"
    32 #include "dimphys.h"
     31!#include "dimensions.h"
     32!#include "dimphys.h"
    3333#include "comcstfi.h"
    3434!#include "tracer.h"
     
    5252      real,intent(out) :: rice(ngrid,nlay)  ! H2O Ice geometric mean radius (m)
    5353c     Sedimentation radius of water ice
    54       real,intent(in) :: rsedcloud(ngridmx,nlayermx)
     54      real,intent(in) :: rsedcloud(ngrid,nlay)
    5555c     Cloud density (kg.m-3)
    56       real,intent(inout) :: rhocloud(ngridmx,nlayermx)
     56      real,intent(inout) :: rhocloud(ngrid,nlay)
    5757c    Traceurs :
    5858      real,intent(in) :: pq(ngrid,nlay,nq)  ! tracers (kg/kg)
     
    130130      IF (firstcall) THEN
    131131         
    132          IF(ngrid.NE.ngridmx) THEN
    133             PRINT*,'STOP dans callsedim'
    134             PRINT*,'probleme de dimensions :'
    135             PRINT*,'ngrid  =',ngrid
    136             PRINT*,'ngridmx  =',ngridmx
    137             STOP
    138          ENDIF
    139 
    140132c       Doubleq: initialization
    141133        IF (doubleq) THEN
  • trunk/LMDZ.MARS/libf/phymars/co2snow.F

    r890 r1047  
    22     &         ,pplev,pcondicea,pcondices,pfallice,pemisurf)
    33
    4        IMPLICIT NONE
     4      use surfdat_h, only: iceradius, dtemisice
     5      IMPLICIT NONE
    56
    67c=======================================================================
     
    1718#include "dimphys.h"
    1819#include "comcstfi.h"
    19 #include "surfdat.h"
     20!#include "surfdat.h"
    2021#include "callkeys.h"
    2122
  • trunk/LMDZ.MARS/libf/phymars/convadj.F

    r1036 r1047  
    3131!     ------------
    3232
    33 #include "dimensions.h"
    34 #include "dimphys.h"
     33!#include "dimensions.h"
     34!#include "dimphys.h"
    3535#include "comcstfi.h"
    3636#include "callkeys.h"
     
    6363
    6464      INTEGER ig,i,l,l1,l2,jj
    65       INTEGER jcnt, jadrs(ngridmx)
    66 
    67       REAL sig(nlayermx+1),sdsig(nlayermx),dsig(nlayermx)
    68       REAL zu(ngridmx,nlayermx),zv(ngridmx,nlayermx)
    69       REAL zh(ngridmx,nlayermx)
    70       REAL zu2(ngridmx,nlayermx),zv2(ngridmx,nlayermx)
    71       REAL zh2(ngridmx,nlayermx), zhc(ngridmx,nlayermx)
     65      INTEGER jcnt, jadrs(ngrid)
     66
     67      REAL sig(nlay+1),sdsig(nlay),dsig(nlay)
     68      REAL zu(ngrid,nlay),zv(ngrid,nlay)
     69      REAL zh(ngrid,nlay)
     70      REAL zu2(ngrid,nlay),zv2(ngrid,nlay)
     71      REAL zh2(ngrid,nlay), zhc(ngrid,nlay)
    7272      REAL zhm,zsm,zdsm,zum,zvm,zalpha,zhmc
    7373
     
    7575      INTEGER iq,ico2
    7676      save ico2
    77       REAL zq(ngridmx,nlayermx,nq), zq2(ngridmx,nlayermx,nq)
     77      REAL zq(ngrid,nlay,nq), zq2(ngrid,nlay,nq)
    7878      REAL zqm(nq),zqco2m
    7979      real m_co2, m_noco2, A , B
     
    8282      real mtot1, mtot2 , mm1, mm2
    8383       integer l1ref, l2ref
    84       LOGICAL vtest(ngridmx),down,firstcall
     84      LOGICAL vtest(ngrid),down,firstcall
    8585      save firstcall
    8686      data firstcall/.true./
     
    9494
    9595      IF (firstcall) THEN
    96         IF(ngrid.NE.ngridmx) THEN
    97            PRINT*
    98            PRINT*,'STOP in convadj'
    99            PRINT*,'ngrid    =',ngrid
    100            PRINT*,'ngridmx  =',ngridmx
    101         ENDIF
     96
    10297        ico2=0
    10398        if (tracer) then
  • trunk/LMDZ.MARS/libf/phymars/dimphys.h

    r38 r1047  
    44! ngridmx : number of horizontal grid points
    55! note: the -1/jjm term will be 0; unless jj=1
    6       integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm)   
     6!      integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm)   
    77! nlayermx : number of atmospheric layers
    88      integer, parameter :: nlayermx = llm
    99! nsoilmx : number of subterranean layers
    1010!EM: old soil routine:      integer, parameter :: nsoilmx = 10
    11       integer, parameter :: nsoilmx = 18
     11!      integer, parameter :: nsoilmx = 18 ! nsoilmx is now in comsoil_h
    1212!-----------------------------------------------------------------------
  • trunk/LMDZ.MARS/libf/phymars/drag_noro.F

    r38 r1047  
    5151C
    5252c
     53      use dimradmars_mod, only:  ndlo2
    5354      IMPLICIT none
    5455c======================================================================
     
    6970c d_v-----output-R-increment de la vitesse v
    7071c======================================================================
    71 #include "dimensions.h"
    72 #include "dimphys.h"
    73 #include "dimradmars.h"
     72!#include "dimensions.h"
     73!#include "dimphys.h"
     74!#include "dimradmars.h"
    7475#include "comcstfi.h"
    7576c
     
    8889c Variables locales:
    8990c
    90       REAL paprs(NDLO2,nlayermx+1)
    91       REAL paprsf(NDLO2,nlayermx)
    92       REAL zgeom(NDLO2,nlayermx)
    93       REAL pdtdt(NDLO2,nlayermx)
    94       REAL pdudt(NDLO2,nlayermx), pdvdt(NDLO2,nlayermx)
    95       REAL pt(NDLO2,nlayermx), pu(NDLO2,nlayermx)
    96       REAL pv(NDLO2,nlayermx)
     91      REAL paprs(NDLO2,klev+1)
     92      REAL paprsf(NDLO2,klev)
     93      REAL zgeom(NDLO2,klev)
     94      REAL pdtdt(NDLO2,klev)
     95      REAL pdudt(NDLO2,klev), pdvdt(NDLO2,klev)
     96      REAL pt(NDLO2,klev), pu(NDLO2,klev)
     97      REAL pv(NDLO2,klev)
    9798c
    9899c initialiser les variables de sortie (pour securite)
  • trunk/LMDZ.MARS/libf/phymars/dustdevil.F

    r1036 r1047  
    33
    44      use tracer_mod, only: alpha_devil
     5      use surfdat_h, only: z0_default
    56      IMPLICIT NONE
    67
     
    2829c   -------------
    2930
    30 #include "dimensions.h"
    31 #include "dimphys.h"
     31!#include "dimensions.h"
     32!#include "dimphys.h"
    3233#include "comcstfi.h"     
    3334c#include "comconst.h"        ! TEMPORAIRE AVEC ANLDEVIL !!!!
    34 #include "surfdat.h"
    35 #include "comgeomfi.h"
     35!#include "surfdat.h"
     36!#include "comgeomfi.h"
    3637!#include "tracer.h"
    3738c   arguments:
     
    6263
    6364
    64       REAL devila(ngridmx)
    65       integer ltop(ngridmx)
     65      REAL devila(ngrid)
     66      integer ltop(ngrid)
    6667      real b,rho,Fs,wind
    6768
     
    7778
    7879c   TEMPORAIRE AVEC ANLDEVIL : *************
    79 c        real b_diag(ngridmx)
    80 c       real localtime(ngridmx)
     80c        real b_diag(ngrid)
     81c       real localtime(ngrid)
    8182c       common/temporaire/localtime
    82 c      real ztop(ngridmx),magwind(ngridmx),t1(ngridmx)
     83c      real ztop(ngrid),magwind(ngrid),t1(ngrid)
    8384c      real rcp ,cpp
    8485c      rcp = kappa
     
    9596        write(*,*) 'In dustdevil :'
    9697        write(*,*) '    q2top= ',q2top,'     seuil= ', seuil
    97 c       un petit test de coherence:
    98          IF(ngrid.NE.ngridmx) THEN
    99             PRINT*,'STOP dans coefdifv'
    100             PRINT*,'probleme de dimensions :'
    101             PRINT*,'ngrid  =',ngrid
    102             PRINT*,'ngridmx  =',ngridmx
    103             STOP
    104          ENDIF
    10598
    10699c A rough estimation of the horizontal drag coefficient Cd
     
    218211c     TEMPORAIRE AVEC ANLDEVIL:
    219212c     IF (ngrid.gt.1) THEN
    220 c      do ig=2,ngridmx-1
     213c      do ig=2,ngrid-1
    221214c       write(77,88) lati(ig)*180./pi,localtime(ig),
    222215c    &        -12.*log(pplev(ig,ltop(ig))/pplev(ig,1)),
     
    226219c88    format (f7.3,1x,f7.3,1x,f6.3,1x,f6.4,1x,f7.4,1x,
    227220c    &        f7.3,1x,f7.3,1x,f9.3)
    228 c      do ig=1,ngridmx
     221c      do ig=1,ngrid
    229222c       ztop(ig) = -12.*log(pplev(ig,ltop(ig))/pplev(ig,1))
    230223c       magwind(ig) = sqrt(pu(ig,1)**2+pv(ig,1)**2)
     
    232225c      end do
    233226
    234 c       call WRITEDIAGFI(ngridmx,'dqs_dev','dqs devil',
     227c       call WRITEDIAGFI(ngrid,'dqs_dev','dqs devil',
    235228c    &               'kg.m-2.s-1',2,pdqs_dev)
    236 c       call WRITEDIAGFI(ngridmx,'wind','wind',
     229c       call WRITEDIAGFI(ngrid,'wind','wind',
    237230c    &               'm.s-1',2,magwind)
    238 c       call WRITEDIAGFI(ngridmx,'ztop','top pbl',
     231c       call WRITEDIAGFI(ngrid,'ztop','top pbl',
    239232c    &               'km',2,ztop)
    240 c       call WRITEDIAGFI(ngridmx,'tsurf','tsurf',
     233c       call WRITEDIAGFI(ngrid,'tsurf','tsurf',
    241234c    &               'K',2,ptsurf)
    242 c       call WRITEDIAGFI(ngridmx,'T1','T(1)',
     235c       call WRITEDIAGFI(ngrid,'T1','T(1)',
    243236c    &               'K',2,t1)
    244 c       call WRITEDIAGFI(ngridmx,'b','b',
     237c       call WRITEDIAGFI(ngrid,'b','b',
    245238c    &               ' ',2,b_diag)
    246239c     END If
  • trunk/LMDZ.MARS/libf/phymars/dustlift.F

    r1038 r1047  
    2424c   -------------
    2525
    26 #include "dimensions.h"
    27 #include "dimphys.h"
     26!#include "dimensions.h"
     27!#include "dimphys.h"
    2828#include "comcstfi.h"
    2929!#include "tracer.h"
     
    4747c   ------
    4848      INTEGER ig,iq
    49       REAL fhoriz(ngridmx)  ! Horizontal dust flux
     49      REAL fhoriz(ngrid)  ! Horizontal dust flux
    5050      REAL ust,us
    5151      REAL stress_seuil
  • trunk/LMDZ.MARS/libf/phymars/flusv.F

    r38 r1047  
    11      SUBROUTINE flusv(KDLON,nsf,n,omega,g,tau,emis,bh,bsol,fah,fdh)
     2      use dimradmars_mod, only: ndlo2, ndlon
    23      IMPLICIT NONE
    34c.......................................................................
     
    3738#include "dimensions.h"
    3839#include "dimphys.h"
    39 #include "dimradmars.h"
     40!#include "dimradmars.h"
    4041c.......................................................................
    4142c  declaration des arguments
     
    271272
    272273      SUBROUTINE sys3v(KDLON,n,a,b,d,e,y)
     274      use dimradmars_mod, only: ndlon, ndlo2
    273275      IMPLICIT NONE
    274276c.......................................................................
     
    293295#include "dimensions.h"
    294296#include "dimphys.h"
    295 #include "dimradmars.h"
     297!#include "dimradmars.h"
    296298c.......................................................................
    297299c  declaration des arguments
  • trunk/LMDZ.MARS/libf/phymars/getslopes.F90

    r998 r1047  
    1 subroutine getslopes(geopot)
     1subroutine getslopes(ngrid,geopot)
    22   
     3use comgeomfi_h, only: long, lati
     4use slope_mod, only: theta_sl, psi_sl
    35implicit none
    46
    57#include "dimensions.h"
    6 #include "dimphys.h"
    7 #include "slope.h"
    8 #include "comgeomfi.h"
     8!#include "dimphys.h"
     9!#include "slope.h"
     10!#include "comgeomfi.h"
    911#include "comcstfi.h"
    1012
     
    1618! TN 04/1013
    1719
    18 
    19 real geopot(ngridmx)     ! geopotential on phy grid
     20integer,intent(in) :: ngrid ! nnumber of atmospheric columns
     21real,intent(in) :: geopot(ngrid)     ! geopotential on phy grid
    2022real topogrid(iim,jjm+1) ! topography on lat/lon grid with poles and only one -180/180 point
    2123real latigrid(iim,jjm+1),longgrid(iim,jjm+1) ! meshgrid of latitude and longitude values (radians)
     
    4345latigrid(:,1) = lati(1)
    4446longgrid(:,1) = long(1)
    45 topogrid(:,jjm+1) = geopot(ngridmx)/g
    46 latigrid(:,jjm+1) = lati(ngridmx)
    47 longgrid(:,jjm+1) = long(ngridmx)
     47topogrid(:,jjm+1) = geopot(ngrid)/g
     48latigrid(:,jjm+1) = lati(ngrid)
     49longgrid(:,jjm+1) = long(ngrid)
    4850
    4951
  • trunk/LMDZ.MARS/libf/phymars/gwprofil.F

    r38 r1047  
    5252C     PASSAGE OF THE NEW GWDRAG TO I.F.S. (F. LOTT, 22/11/93)
    5353C-----------------------------------------------------------------------
     54      use dimradmars_mod, only: ndlo2
    5455      implicit none
    5556C
     
    5960#include "dimensions.h"
    6061#include "dimphys.h"
    61 #include "dimradmars.h"
     62!#include "dimradmars.h"
    6263      integer klon,klev,kidia,kfdia
    6364#include "yoegwd.h"
  • trunk/LMDZ.MARS/libf/phymars/gwstress.F

    r38 r1047  
    4545C
    4646C-----------------------------------------------------------------------
     47      use dimradmars_mod, only: ndlo2
    4748      implicit none
    4849#include "dimensions.h"
    4950#include "dimphys.h"
    50 #include "dimradmars.h"
     51!#include "dimradmars.h"
    5152      integer klon,klev,kidia,kfdia
    5253
  • trunk/LMDZ.MARS/libf/phymars/improvedclouds.F

    r1036 r1047  
    1010     &                      igcm_dust_number, igcm_ccn_mass,
    1111     &                      igcm_ccn_number
     12      use conc_mod, only: mmean
    1213      implicit none
    1314     
     
    3334c           A. Spiga, optimization (February 2012)
    3435c------------------------------------------------------------------
    35 #include "dimensions.h"
    36 #include "dimphys.h"
     36!#include "dimensions.h"
     37!#include "dimphys.h"
    3738#include "comcstfi.h"
    3839#include "callkeys.h"
    3940!#include "tracer.h"
    40 #include "comgeomfi.h"
    41 #include "dimradmars.h"
     41!#include "comgeomfi.h"
     42!#include "dimradmars.h"
    4243#include "microphys.h"
    43 #include "conc.h"
     44!#include "conc.h"
    4445c------------------------------------------------------------------
    4546c     Inputs:
     
    5758      REAL pdq(ngrid,nlay,nq)    ! tendance avant condensation
    5859                                 !   (kg/kg.s-1)
    59       REAL tauscaling(ngridmx)     ! Convertion factor for qdust and Ndust
     60      REAL tauscaling(ngrid)     ! Convertion factor for qdust and Ndust
    6061
    6162c     Outputs:
     
    7778      INTEGER ig,l,i
    7879     
    79       REAL zq(ngridmx,nlayermx,nq)  ! local value of tracers
    80       REAL zq0(ngridmx,nlayermx,nq) ! local initial value of tracers
    81       REAL zt(ngridmx,nlayermx)       ! local value of temperature
    82       REAL zqsat(ngridmx,nlayermx)    ! saturation
     80      REAL zq(ngrid,nlay,nq)  ! local value of tracers
     81      REAL zq0(ngrid,nlay,nq) ! local initial value of tracers
     82      REAL zt(ngrid,nlay)       ! local value of temperature
     83      REAL zqsat(ngrid,nlay)    ! saturation
    8384      REAL lw                         !Latent heat of sublimation (J.kg-1)
    8485      REAL cste
     
    101102      REAL rice(ngrid,nlay)      ! Ice mass mean radius (m)
    102103                                 ! (r_c in montmessin_2004)
    103       REAL rhocloud(ngridmx,nlayermx)  ! Cloud density (kg.m-3)
    104       REAL rdust(ngridmx,nlayermx) ! Dust geometric mean radius (m)
     104      REAL rhocloud(ngrid,nlay)  ! Cloud density (kg.m-3)
     105      REAL rdust(ngrid,nlay) ! Dust geometric mean radius (m)
    105106
    106107      REAL res      ! Resistance growth
     
    259260      dev2 = 1. / ( sqrt(2.) * sigma_ice )
    260261
    261       call watersat(ngridmx*nlayermx,zt,pplay,zqsat)
     262      call watersat(ngrid*nlay,zt,pplay,zqsat)
    262263           
    263264      countcells = 0
  • trunk/LMDZ.MARS/libf/phymars/inifis.F

    r1036 r1047  
    4848      USE ioipsl_getincom, only : getin
    4949      use tracer_mod, only : nqmx, nuice_sed, ccn_factor
    50      
     50      use comsoil_h, only: ini_comsoil_h
     51#ifdef MESOSCALE
     52      use comsoil_h, only: volcapa !!MESOSCALE -- needed to fill volcapa
     53#endif     
     54      use comgeomfi_h, only: long, lati, area, totarea
     55      use comdiurn_h, only: sinlat, coslat, sinlon, coslon
     56      use surfdat_h, only: ini_surfdat_h, albedo_h2o_ice, inert_h2o_ice,
     57     &                     frost_albedo_threshold
     58      use comsaison_h, only: ini_comsaison_h
     59      use slope_mod, only: ini_slope_mod
     60      use dimradmars_mod, only: ini_dimradmars_mod
     61      use yomaer_h,only: ini_yomaer_h, tauvis
     62      use yomlw_h, only: ini_yomlw_h
     63      use conc_mod, only: ini_conc_mod
    5164      IMPLICIT NONE
    5265#include "dimensions.h"
     
    5467#include "planete.h"
    5568#include "comcstfi.h"
    56 #include "comsaison.h"
    57 #include "comdiurn.h"
    58 #include "comgeomfi.h"
     69!#include "comsaison.h"
     70!#include "comdiurn.h"
     71!#include "comgeomfi.h"
    5972#include "callkeys.h"
    60 #include "surfdat.h"
    61 #include "dimradmars.h"
    62 #include "yomaer.h"
     73!#include "surfdat.h"
     74!#include "dimradmars.h"
     75!#include "yomaer.h"
    6376#include "datafile.h"
    64 #include "slope.h"
     77!#include "slope.h"
    6578#include "microphys.h"
    6679!#include "tracer.h"
     80! naerkind is set in scatterers.h (built when compiling with makegcm -s #)
     81#include"scatterers.h"
    6782#ifdef MESOSCALE
    68 #include "comsoil.h"     !!MESOSCALE -- needed to fill volcapa
     83!#include "comsoil.h"     !!MESOSCALE -- needed to fill volcapa
    6984#include "meso_inc/meso_inc_inifisvar.F"
    7085#endif
     
    107122!     The usual Tests
    108123!     --------------
    109       IF (nlayer.NE.nlayermx) THEN
    110          PRINT*,'STOP in inifis'
    111          PRINT*,'Probleme de dimensions :'
    112          PRINT*,'nlayer     = ',nlayer
    113          PRINT*,'nlayermx   = ',nlayermx
    114          STOP
    115       ENDIF
    116 
    117       IF (ngrid.NE.ngridmx) THEN
    118          PRINT*,'STOP in inifis'
    119          PRINT*,'Probleme de dimensions :'
    120          PRINT*,'ngrid     = ',ngrid
    121          PRINT*,'ngridmx   = ',ngridmx
    122          STOP
    123       ENDIF
     124!      IF (nlayer.NE.nlayermx) THEN
     125!         PRINT*,'STOP in inifis'
     126!         PRINT*,'Probleme de dimensions :'
     127!         PRINT*,'nlayer     = ',nlayer
     128!         PRINT*,'nlayermx   = ',nlayermx
     129!         STOP
     130!      ENDIF
     131
     132!      IF (ngrid.NE.ngridmx) THEN
     133!         PRINT*,'STOP in inifis'
     134!         PRINT*,'Probleme de dimensions :'
     135!         PRINT*,'ngrid     = ',ngrid
     136!         PRINT*,'ngridmx   = ',ngridmx
     137!         STOP
     138!      ENDIF
    124139
    125140! --------------------------------------------------------------
     
    765780!     ------------------------
    766781
    767       ! in 'comgeomfi.h'
     782      ! allocate "slope_mod" arrays
     783      call ini_slope_mod(ngrid)
     784     
     785      ! allocate "comsaison_h" arrays
     786      call ini_comsaison_h(ngrid)
     787     
     788      ! allocate "surfdat_h" arrays
     789      call ini_surfdat_h(ngrid)
     790     
     791      ! allocate "comgeomfi_h" arrays
     792      allocate(lati(ngrid))
     793      allocate(long(ngrid))
     794      allocate(area(ngrid))
     795     
     796      ! fill "comgeomfi_h" data
    768797      CALL SCOPY(ngrid,plon,1,long,1)
    769798      CALL SCOPY(ngrid,plat,1,lati,1)
    770799      CALL SCOPY(ngrid,parea,1,area,1)
    771       totarea=SSUM(ngridmx,area,1)
    772 
    773       ! in 'comdiurn.h'
     800      totarea=SSUM(ngrid,area,1)
     801
     802      ! allocate "comdiurn_h" data
     803      allocate(sinlat(ngrid))
     804      allocate(coslat(ngrid))
     805      allocate(sinlon(ngrid))
     806      allocate(coslon(ngrid))
     807     
     808      ! fill "comdiurn_h" data
    774809      DO ig=1,ngrid
    775810         sinlat(ig)=sin(plat(ig))
     
    781816      pi=2.*asin(1.) ! NB: pi is a common in comcstfi.h
    782817
    783 !     managing the tracers, and tests:
    784 !     -------------------------------
    785 !     Ehouarn: removed; as these tests are now done in initracer.F
    786 !      if(tracer) then
    787 !
    788 !!          when photochem is used, nqchem_min is the rank
    789 !!          of the first chemical species
    790 !
    791 !! Ehouarn: nqchem_min is now meaningless and no longer used
    792 !!       nqchem_min = 1
    793 !       if (photochem .or. callthermos) then
    794 !         chem = .true.
    795 !       end if
    796 !
    797 !       if (water .or. thermoswater) h2o = .true.
    798 !
    799 !!          TESTS
    800 !
    801 !       print*,'inifis: TRACERS:'
    802 !       write(*,*) "    chem=",chem,"    h2o=",h2o
    803 !!       write(*,*) "   doubleq=",doubleq
    804 !!       write(*,*) "   dustbin=",dustbin
    805 !
    806 !       if ((doubleq).and.(h2o).and.
    807 !     $     (chem)) then
    808 !         print*,' 2 dust tracers (doubleq)'
    809 !         print*,' 1 water vapour tracer'
    810 !         print*,' 1 water ice tracer'
    811 !         print*,nq-4,' chemistry tracers'
    812 !       endif
    813 !
    814 !       if ((doubleq).and.(h2o).and.
    815 !     $     .not.(chem)) then
    816 !         print*,' 2 dust tracers (doubleq)'
    817 !         print*,' 1 water vapour tracer'
    818 !         print*,' 1 water ice tracer'
    819 !         if (nq.LT.4) then
    820 !           print*,'nq should be at least equal to'
    821 !           print*,'4 with these options.'
    822 !           stop
    823 !         endif
    824 !       endif
    825 !
    826 !       if (.not.(doubleq).and.(h2o).and.
    827 !     $     (chem)) then
    828 !         if (dustbin.gt.0) then
    829 !           print*,dustbin,' dust bins'
    830 !         endif
    831 !         print*,nq-2-dustbin,' chemistry tracers'
    832 !         print*,' 1 water vapour tracer'
    833 !         print*,' 1 water ice tracer'
    834 !       endif
    835 !
    836 !       if (.not.(doubleq).and.(h2o).and.
    837 !     $     .not.(chem)) then
    838 !         if (dustbin.gt.0) then
    839 !           print*,dustbin,' dust bins'
    840 !         endif
    841 !         print*,' 1 water vapour tracer'
    842 !         print*,' 1 water ice tracer'
    843 !         if (nq.gt.(dustbin+2)) then
    844 !           print*,'nq should be ',(dustbin+2),
    845 !     $            ' with these options...'
    846 !                  print*,'(or check callphys.def)'
    847 !         endif
    848 !         if (nq.lt.(dustbin+2)) then
    849 !           write(*,*) "inifis: nq.lt.(dustbin+2)"
    850 !           stop
    851 !         endif
    852 !       endif
    853 !
    854 !      endif ! of if (tracer)
    855 !
    856 !      RETURN
     818      ! allocate "comsoil_h" arrays
     819      call ini_comsoil_h(ngrid)
     820           
     821      ! set some variables in "dimradmars_mod"
     822      call ini_dimradmars_mod(ngrid,nlayer)
     823     
     824      ! allocate arrays in "yomaer_h"
     825      call ini_yomaer_h
     826     
     827      ! allocate arrays in "yomlw_h"
     828      call ini_yomlw_h(ngrid)
     829     
     830      ! allocate arrays in "conc_mod"
     831      call ini_conc_mod(ngrid,nlayer)
     832     
    857833      END
  • trunk/LMDZ.MARS/libf/phymars/initracer.F

    r1038 r1047  
    2626
    2727
    28 #include "dimensions.h"
    29 #include "dimphys.h"
     28!#include "dimensions.h"
     29!#include "dimphys.h"
    3030#include "comcstfi.h"
    3131#include "callkeys.h"
    3232!#include "tracer.h"
    3333!#include "advtrac.h"
    34 #include "comgeomfi.h"
    35 
    36 #include "surfdat.h"
     34!#include "comgeomfi.h"
     35
     36!#include "surfdat.h"
    3737
    3838      integer,intent(in) :: ngrid ! number of atmospheric columns
     
    6868      allocate(alpha_lift(nq))
    6969      allocate(alpha_devil(nq))
    70       allocate(dryness(ngridmx))
     70      allocate(dryness(ngrid))
    7171      allocate(igcm_dustbin(nq))
    7272
  • trunk/LMDZ.MARS/libf/phymars/iniwrite.F

    r999 r1047  
    11      SUBROUTINE iniwrite(nid,idayref,phis)
     2
     3      use comsoil_h, only: mlayer, nsoilmx
    24      IMPLICIT NONE
    35
     
    3032#include "description.h"
    3133#include "serre.h"
    32 #include"dimphys.h"
    33 #include"comsoil.h"
     34!#include"dimphys.h"
     35!#include"comsoil.h"
    3436
    3537c   Arguments:
     
    253255
    254256!-------------------------------
    255 ! (soil) depth variable mlayer() (known from comsoil.h)
     257! (soil) depth variable mlayer() (known from comsoil_h)
    256258!-------------------------------
    257259      ierr=NF_REDEF (nid) ! Enter NetCDF (re-)define mode
  • trunk/LMDZ.MARS/libf/phymars/iniwritesoil.F90

    r38 r1047  
    1 subroutine iniwritesoil(nid)
     1subroutine iniwritesoil(nid,ngrid)
    22
    33! initialization routine for 'writediagoil'. Here we create/define
     
    55! (time-independent) parameters.
    66
     7use comsoil_h, only: mlayer, inertiedat, nsoilmx
     8
    79implicit none
    810
    911#include"dimensions.h"
    10 #include"dimphys.h"
     12!#include"dimphys.h"
    1113#include"paramet.h"
    1214#include"comcstfi.h"
    1315#include"comgeom.h"
    14 #include"comsoil.h"
     16!#include"comsoil.h"
    1517#include"netcdf.inc"
    1618
    1719! Arguments:
     20integer,intent(in) :: ngrid
    1821integer,intent(in) :: nid ! NetCDF output file ID
    1922
     
    154157ierr=NF_PUT_VAR_REAL(nid,varid,mlayer)
    155158#endif
    156 ! Note mlayer(0:nsoilmx-1) known from comsoil.h
     159! Note mlayer(0:nsoilmx-1) known from comsoil_h
    157160if (ierr.ne.NF_NOERR) then
    158161  write(*,*)"iniwritesoil: Error, could not write depth variable"
     
    240243
    241244! Recast data along 'dynamics' grid
    242 ! Note: inertiedat is known from comsoil.h
     245! Note: inertiedat is known from comsoil_h
    243246
    244247do l=1,nsoilmx
     
    246249  do i=1,iip1
    247250    data3(i,1,l)=inertiedat(1,l)
    248     data3(i,jjp1,l)=inertiedat(ngridmx,l)
     251    data3(i,jjp1,l)=inertiedat(ngrid,l)
    249252  enddo
    250253  ! rest of the grid
  • trunk/LMDZ.MARS/libf/phymars/lwb.F

    r38 r1047  
    77c----------------------------------------------------------------------
    88
     9      use dimradmars_mod, only: ndlon, ndlo2, kflev , nir
     10      use yomlw_h, only: nlaylte, xi , tstand, xp
    911      implicit none
    1012 
    11 #include "dimensions.h"
    12 #include "dimphys.h"
    13 #include "dimradmars.h"
    14 #include "callkeys.h"
     13!#include "dimensions.h"
     14!#include "dimphys.h"
     15!#include "dimradmars.h"
     16!#include "callkeys.h"
    1517
    16 #include "yomlw.h"
     18!#include "yomlw.h"
    1719
    1820c----------------------------------------------------------------------
  • trunk/LMDZ.MARS/libf/phymars/lwdiff.F

    r38 r1047  
    44     .         ,pemis,pfluc)
    55
     6      use dimradmars_mod, only: nir, npademx, nabsmx, nflev, ndlon,
     7     &                          ndlo2
     8      use yomlw_h, only: nlaylte
    69      IMPLICIT NONE
    710 
    8 #include "dimensions.h"
    9 #include "dimphys.h"
    10 #include "dimradmars.h"
     11!#include "dimensions.h"
     12!#include "dimphys.h"
     13!#include "dimradmars.h"
    1114#include "callkeys.h"
    1215#include "comcstfi.h"
    1316
    14 #include "yomaer.h"
    15 #include "yomlw.h"
     17!#include "yomaer.h"
     18!#include "yomlw.h"
    1619C-----------------------------------------------------------------------
    1720C
  • trunk/LMDZ.MARS/libf/phymars/lwflux.F

    r38 r1047  
    1111c----------------------------------------------------------------------
    1212
     13      use dimradmars_mod, only: ndlo2, nir, ndlon, nuco2, nflev
     14      use yomlw_h, only: nlaylte, xi, xi_ground, gcp
    1315      implicit none
    1416 
    1517
    16 #include "dimensions.h"
    17 #include "dimphys.h"
    18 #include "dimradmars.h"
     18!#include "dimensions.h"
     19!#include "dimphys.h"
     20!#include "dimradmars.h"
    1921#include "callkeys.h"
    2022#include "comg1d.h"
    2123 
    22 #include "yomlw.h"
     24!#include "yomlw.h"
    2325
    2426c----------------------------------------------------------------------
     
    6567
    6668      integer ja,jl,j,i,ig1d,ig,l,ndim
    67       parameter(ndim = ndlon*(nuco2+1)*(nflev+2)*(nflev+2))
     69!      parameter(ndim = ndlon*(nuco2+1)*(nflev+2)*(nflev+2))
    6870      real  ksidb (ndlon,nuco2+1,0:nflev+1,0:nflev+1) ! net exchange rate (W/m2)
    6971
     
    7779c     To compute IR flux in the atmosphere  (For diagnostic only !!)
    7880      logical computeflux
    79       real coefd(ngridmx,nuco2,nflev+1,nflev+1)
    80       real coefu(ngridmx,nuco2,0:nflev,nflev+1)
    81       real flw_up(ngridmx,nflev+1), flw_dn(ngridmx,nflev+1) ! fluxes (W/m2)
    82 
    83 
     81      real coefd(kdlon,nuco2,nflev+1,nflev+1)
     82      real coefu(kdlon,nuco2,0:nflev,nflev+1)
     83      real flw_up(kdlon,nflev+1), flw_dn(kdlon,nflev+1) ! fluxes (W/m2)
     84
     85
     86      ndim = ndlon*(nuco2+1)*(nflev+2)*(nflev+2)
    8487      call zerophys(ndim, ksidb)
    8588
     
    364367      if (callg2d) then
    365368
    366       ig1d = ngridmx/2 + 1
    367 c     ig1d = ngridmx
     369      ig1d = kdlon/2 + 1
     370c     ig1d = kdlon
    368371
    369372      if ((ig0+1).LE.ig1d .and. ig1d.LE.(ig0+kdlon)
    370      .    .OR.  ngridmx.EQ.1   ) then
     373     .    .OR.  kdlon.EQ.1   ) then
    371374
    372375          ig = ig1d-ig0
  • trunk/LMDZ.MARS/libf/phymars/lwi.F

    r38 r1047  
    44
    55
     6      use dimradmars_mod, only: ndlo2, ndlon, nflev, nir
     7      use yomlw_h, only: gcp, nlaylte, xi
    68      implicit none
    79
    810
    9 #include "dimensions.h"
    10 #include "dimphys.h"
    11 #include "dimradmars.h"
     11!#include "dimensions.h"
     12!#include "dimphys.h"
     13!#include "dimradmars.h"
    1214#include "comg1d.h"
    1315#include "callkeys.h"
    1416#include "comcstfi.h"
    15 #include "yomlw.h"
     17!#include "yomlw.h"
    1618 
    1719CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
  • trunk/LMDZ.MARS/libf/phymars/lwmain.F

    r353 r1047  
    99c----------------------------------------------------------------------
    1010c     LWMAIN     organizes the LTE longwave calculations
    11 c     for layer 1 to layer "nlaylte" (stored in  "yomlw.h")
    12 c----------------------------------------------------------------------
    13 
     11c     for layer 1 to layer "nlaylte" (stored in  "yomlw_h")
     12c----------------------------------------------------------------------
     13
     14      use dimradmars_mod, only: ndlo2, nflev, nir, ndlon, nuco2
     15      use yomlw_h, only: nlaylte, xi
    1416      implicit none
    1517 
    16 #include "dimensions.h"
    17 #include "dimphys.h"
    18 #include "dimradmars.h"
     18!#include "dimensions.h"
     19!#include "dimphys.h"
     20!#include "dimradmars.h"
    1921#include "callkeys.h"
    2022#include "comg1d.h"
    21  
    22 #include "yomlw.h"
     23! naerkind is set in scatterers.h (built when compiling with makegcm -s #)
     24#include"scatterers.h"
     25!#include "yomlw.h"
    2326
    2427c----------------------------------------------------------------------
     
    4043      real aerosol(ndlo2,kflev,naerkind)      !  aerosol extinction optical
    4144c                         depth at reference wavelength "longrefvis" set
    42 c                         in dimradmars.h , in each layer, for one of
     45c                         in dimradmars_mod , in each layer, for one of
    4346c                         the "naerkind" kind of aerosol optical properties.
    4447
     
    9598        firstcall = .false.
    9699
    97         do jkk = 0 , nlaylte+1
    98           do jk = 0 , nlaylte+1
    99             do ja = 1 , nuco2
    100               do jl = 1 , ngridmx
    101                   xi (jl,ja,jk,jkk)=0.
    102               enddo
    103             enddo
    104           enddo
    105         enddo
     100        xi (:,:,:,:)=0.
    106101
    107102      endif
     
    184179c         do jk = 0 , nlaylte+1
    185180c           do ja = 1 , nuco2
    186 c             do jl = 1 , ngridmx
     181c             do jl = 1 , ngrid
    187182c      if (xi (jl,ja,jk,jkk) .LT. 0
    188183c    .       .OR. xi (jl,ja,jk,jkk) .GT. 1 ) then
  • trunk/LMDZ.MARS/libf/phymars/lwtt.F

    r38 r1047  
    77c----------------------------------------------------------------------
    88
     9      use dimradmars_mod, only : ndlon, ndlo2
     10      use yomlw_h, only: ga, gb, cst_voigt
    911      implicit none
    1012
    11 #include "dimensions.h"
    12 #include "dimphys.h"
    13 #include "dimradmars.h"
    14 #include "yomlw.h"
     13!#include "dimensions.h"
     14!#include "dimphys.h"
     15!#include "dimradmars.h"
     16!#include "yomlw.h"
    1517
    1618c----------------------------------------------------------------------
  • trunk/LMDZ.MARS/libf/phymars/lwu.F

    r626 r1047  
    3131c-----------------------------------------------------------------------
    3232 
     33      use dimradmars_mod, only: ndlo2, nir, nuco2, ndlon, nflev
     34      use yomlw_h, only: nlaylte, tref, at, bt, cst_voigt
    3335      implicit none
    3436
    35 #include "dimensions.h"
    36 #include "dimphys.h"
    37 #include "dimradmars.h"
     37!#include "dimensions.h"
     38!#include "dimphys.h"
     39!#include "dimradmars.h"
    3840#include "comcstfi.h"
    3941
    40 #include "yomaer.h"
    41 #include "yomlw.h"
     42!#include "yomaer.h"
     43!#include "yomlw.h"
     44! naerkind is set in scatterers.h (built when compiling with makegcm -s #)
     45#include"scatterers.h"
    4246
    4347#include "callkeys.h"
     
    5660      real aerosol (ndlo2,kflev,naerkind) ! aerosol extinction optical depth
    5761c                         at reference wavelength "longrefvis" set
    58 c                         in dimradmars.h , in each layer, for one of
     62c                         in dimradmars_mod , in each layer, for one of
    5963c                         the "naerkind" kind of aerosol optical properties.
    6064      REAL QIRsQREF3d(ndlo2,kflev,nir,naerkind)  ! 3d ext. coef.
  • trunk/LMDZ.MARS/libf/phymars/lwxb.F

    r38 r1047  
    3333c----------------------------------------------------------------------
    3434
     35      use dimradmars_mod, only: ndlo2, nuco2, ndlon, nflev
     36      use yomlw_h, only: xi, nlaylte
    3537      implicit none
    3638
    37 #include "dimensions.h"
    38 #include "dimphys.h"
    39 #include "dimradmars.h"
    40 #include "callkeys.h"
     39!#include "dimensions.h"
     40!#include "dimphys.h"
     41!#include "dimradmars.h"
     42!#include "callkeys.h"
    4143 
    42 #include "yomlw.h"
     44!#include "yomlw.h"
    4345
    4446c----------------------------------------------------------------------
  • trunk/LMDZ.MARS/libf/phymars/lwxd.F

    r38 r1047  
    3232c----------------------------------------------------------------------
    3333
     34      use dimradmars_mod, only: ndlon, nuco2, nflev, ndlo2
     35      use yomlw_h, only: nlaylte, xi, xi_emis
    3436      implicit none
    3537
    36 #include "dimensions.h"
    37 #include "dimphys.h"
    38 #include "dimradmars.h"
     38!#include "dimensions.h"
     39!#include "dimphys.h"
     40!#include "dimradmars.h"
    3941 
    40 #include "yomlw.h"
     42!#include "yomlw.h"
    4143#include "callkeys.h"
    4244
     
    6062
    6163      integer ja,jl,jk,jkk,ndim
    62       parameter(ndim = ndlon*nuco2*(nflev+2)*(nflev+2))
     64!      parameter(ndim = ndlon*nuco2*(nflev+2)*(nflev+2))
    6365
    6466
     
    7476
    7577c----------------------------------------------------------------------
     78      ndim = ndlon*nuco2*(nflev+2)*(nflev+2)
    7679      call zerophys(ndim,ksi_emis)
    7780c----------------------------------------------------------------------
  • trunk/LMDZ.MARS/libf/phymars/lwxn.F

    r38 r1047  
    7070c-----------------------------------------------------------------------
    7171
     72      use dimradmars_mod, only: ndlo2, nuco2, ndlon, nflev
     73      use yomlw_h, only: nlaylte, xi, xi_ground, xi_emis
    7274      implicit none
    7375
    74 #include "dimensions.h"
    75 #include "dimphys.h"
    76 #include "dimradmars.h"
     76!#include "dimensions.h"
     77!#include "dimphys.h"
     78!#include "dimradmars.h"
    7779 
    78 #include "yomlw.h"
     80!#include "yomlw.h"
    7981#include "callkeys.h"
    8082
  • trunk/LMDZ.MARS/libf/phymars/newcondens.F

    r1036 r1047  
    77                                                   
    88       use tracer_mod, only: noms
     9       use surfdat_h, only: emissiv, phisfi
    910       IMPLICIT NONE
    1011c=======================================================================
     
    3031c
    3132c                    \
    32 c    pdt(ngrid,nlayermx)   \  derivee temporelle physique avant condensation
     33c    pdt(ngrid,nlayer)\  derivee temporelle physique avant condensation
    3334c                     /  ou sublimation pour  pt,ptsrf
    3435c    pdtsrf(ngrid)   /
     
    3738c   -------
    3839c
    39 c    pdpsrf(ngrid)   \  derivee temporelle physique (contribution de
    40 c    pdtc(ngrid,nlayermx) /  la condensation ou sublimation) pour Ps,pt,ptsrf
    41 c    pdtsrfc(ngrid) /
     40c    pdpsrf(ngrid)      \  derivee temporelle physique (contribution de
     41c    pdtc(ngrid,nlayer) /  la condensation ou sublimation) pour Ps,pt,ptsrf
     42c    pdtsrfc(ngrid)    /
    4243c
    4344c   Entree/sortie
     
    5556c
    5657#include "dimensions.h"
    57 #include "dimphys.h"
     58!#include "dimphys.h"
    5859#include "comcstfi.h"
    59 #include "surfdat.h"
    60 #include "comgeomfi.h"
     60!#include "surfdat.h"
     61!#include "comgeomfi.h"
    6162#include "comvert.h"
    62 #include "paramet.h"
     63!#include "paramet.h"
    6364#include "callkeys.h"
    6465!#include "tracer.h"
     
    114115c --------------------------------------------     
    115116      INTEGER i,j
    116       REAL Fluxmean(jjp1)
     117c      REAL Fluxmean(jjp1)
    117118      INTEGER l,ig,iq,icap,nmix
    118119      LOGICAL transparency, fluxdependent
     
    166167      real,parameter :: cpice=1000. ! (J.kg-1.K-1) specific heat of CO2 ice
    167168      REAL,SAVE :: acond,bcond,ccond
    168 !      REAL,SAVE :: albediceF(ngridmx)
     169!      REAL,SAVE :: albediceF(ngrid)
    169170      real,save :: m_co2, m_noco2, A , B
    170171
     
    225226c       zfallice(ngrid,l):amount of ice falling from layer l (kg/m2/s)
    226227c                           
    227 c       pdtc(ngrid,nlayermx)  : dT/dt due to cond/sub
     228c       pdtc(ngrid,nlayer)  : dT/dt due to cond/sub
    228229c
    229230c
     
    675676                end do
    676677                Sm(1)  = masse(1)
    677                 do l =2,nlayermx
     678                do l =2,nlayer
    678679                  do iq=1,nq
    679680                     zq(l,iq)=pq(ig,l,iq)
     
    733734c        END DO
    734735c     END DO
    735 c     call WRITEDIAGFI(ngridmx,'tconda1',
     736c     call WRITEDIAGFI(ngrid,'tconda1',
    736737c    &'Taux de condensation CO2 atmospherique /Pa',
    737738c    & 'kg.m-2.Pa-1.s-1',3,tconda1)
    738 c     call WRITEDIAGFI(ngridmx,'tconda2',
     739c     call WRITEDIAGFI(ngrid,'tconda2',
    739740c    &'Taux de condensation CO2 atmospherique /m',
    740741c    & 'kg.m-3.s-1',3,tconda2)
    741742
    742743! output falling co2 ice in 1st layer:
    743 !      call WRITEDIAGFI(ngridmx,'fallice',
     744!      call WRITEDIAGFI(ngrid,'fallice',
    744745!     &'Precipitation of co2 ice',
    745746!     & 'kg.m-2.s-1',2,zfallice(1,1))
  • trunk/LMDZ.MARS/libf/phymars/newsedim.F

    r530 r1047  
    1414c   -------------
    1515
    16 #include "dimensions.h"
    17 #include "dimphys.h"
     16!#include "dimensions.h"
     17!#include "dimphys.h"
    1818#include "comcstfi.h"
    1919c
     
    3333c    Traceurs :
    3434      real,intent(inout) :: pqi(ngrid,nlay)  ! traceur   (e.g. ?/kg)
    35       real,intent(out) :: wq(ngridmx,nlay+1)  ! flux de traceur durant timestep (?/m-2)
     35      real,intent(out) :: wq(ngrid,nlay+1)  ! flux de traceur durant timestep (?/m-2)
    3636      real,intent(in) :: beta ! correction for the shape of the particles
    3737                !   (see Murphy et al. JGR 1990 vol.95)
     
    5050c    Traceurs :
    5151c    ~~~~~~~~
    52       real traversee (ngridmx,nlayermx)
    53       real vstokes(ngridmx,nlayermx)
    54       real w(ngridmx,nlayermx)
     52      real traversee (ngrid,nlay)
     53      real vstokes(ngrid,nlay)
     54      real w(ngrid,nlay)
    5555      real ptop, dztop, Ep, Stra
    5656
     
    7171
    7272      IF (firstcall) THEN
    73          IF(ngrid.NE.ngridmx) THEN
    74             PRINT*,'STOP dans newsedim'
    75             PRINT*,'probleme de dimensions :'
    76             PRINT*,'ngrid  =',ngrid
    77             PRINT*,'ngridmx  =',ngridmx
    78             STOP
    79          ENDIF
     73
    8074         firstcall=.false.
    8175
     
    211205      end do
    212206
    213       call vlz_fi(ngrid,pqi,2.,masse,w,wq)
     207      call vlz_fi(ngrid,nlay,pqi,2.,masse,w,wq)
    214208c         write(*,*) ' newsed: wq(6), wq(7), q(6)',
    215209c    &                wq(1,6),wq(1,7),pqi(1,6)
  • trunk/LMDZ.MARS/libf/phymars/nirco2abs.F

    r1036 r1047  
    33                                                   
    44       use tracer_mod, only: igcm_co2, igcm_o
     5       use comdiurn_h, only: sinlon, coslon, sinlat, coslat
    56       IMPLICIT NONE
    67c=======================================================================
     
    3031c   nlayer                Number of layer
    3132c   dist_sol              sun-Mars distance (AU)
    32 c   mu0(ngridmx)         
    33 c   fract(ngridmx)        day fraction of the time interval
     33c   mu0(ngrid)         
     34c   fract(ngrid        day fraction of the time interval
    3435c   declin                latitude of subslar point
    3536c
     
    4546c    ------------------
    4647c
    47 #include "dimensions.h"
    48 #include "dimphys.h"
     48!#include "dimensions.h"
     49!#include "dimphys.h"
    4950#include "comcstfi.h"
    5051#include "callkeys.h"
    51 #include "comdiurn.h"
     52!#include "comdiurn.h"
    5253#include "nirdata.h"
    5354!#include "tracer.h"
     
    6263      integer,intent(in) :: nq ! number of tracers
    6364      real,intent(in) :: pq(ngrid,nlayer,nq) ! tracers
    64       real,intent(in) :: mu0(ngridmx) ! solar angle
    65       real,intent(in) :: fract(ngridmx) ! day fraction of the time interval
     65      real,intent(in) :: mu0(ngrid) ! solar angle
     66      real,intent(in) :: fract(ngrid) ! day fraction of the time interval
    6667      real,intent(in) :: declin ! latitude of sub-solar point
    6768     
     
    7172c    -----------------
    7273      INTEGER l,ig, n, nstep,i
    73       REAL co2heat0, zmu(ngridmx)
     74      REAL co2heat0, zmu(ngrid)
    7475
    7576c     special diurnal=F
    76       real mu0_int(ngridmx),fract_int(ngridmx),zday_int
     77      real mu0_int(ngrid),fract_int(ngrid),zday_int
    7778      real ztim1,ztim2,ztim3,step
    7879
  • trunk/LMDZ.MARS/libf/phymars/nlte_tcool.F

    r759 r1047  
    2222c***********************************************************************
    2323
     24      use conc_mod, only: cpnew, mmean
    2425      implicit none
    2526
     
    2930      include 'nlte_commons.h'
    3031      include "chimiedata.h"
    31       include "conc.h"
     32!      include "conc.h"
    3233
    3334
  • trunk/LMDZ.MARS/libf/phymars/nltecool.F

    r1036 r1047  
    3131
    3232      use tracer_mod, only: igcm_co2, igcm_co, igcm_o, igcm_n2, mmol
     33      use conc_mod, only: mmean
    3334      implicit none
    3435
     
    3738#include "dimphys.h"
    3839#include "chimiedata.h"
    39 #include "conc.h" !Added to have "dynamic composition" in the scheme
     40!#include "conc.h" !Added to have "dynamic composition" in the scheme
    4041!#include "tracer.h" !"
    4142#include "callkeys.h"
  • trunk/LMDZ.MARS/libf/phymars/nlthermeq.F

    r38 r1047  
    11      subroutine nlthermeq(ngrid, nlayer, pplev, pplay)
    22c
    3 c  Compute the number of layers nlaylte (stored in common yomlw.h)
     3c  Compute the number of layers nlaylte (stored in module yomlw_h)
    44c  over which local thermodynamic equilibrium
    55c  radiation scheme should be run to be sure of covering at least to a
     
    88c  Stephen Lewis 6/2000
    99c  Modified Y. Wanherdrick/ F. Forget 09/2000
    10 
     10      use yomlw_h, only: nlaylte
    1111      implicit none
    12 #include "dimensions.h"
    13 #include "dimphys.h"
    14 #include "dimradmars.h"
     12!#include "dimensions.h"
     13!#include "dimphys.h"
     14!#include "dimradmars.h"
    1515#include "nlteparams.h"
    16 #include "yomlw.h"
     16!#include "yomlw.h"
    1717#include "callkeys.h"
    1818
  • trunk/LMDZ.MARS/libf/phymars/orodrag.F

    r38 r1047  
    7171C     F.LOTT + M. MILLER    E.C.M.W.F.     22/11/94
    7272C-----------------------------------------------------------------------
     73      use dimradmars_mod, only: ndlo2
    7374      implicit none
    7475C
     
    7677#include "dimensions.h"
    7778#include "dimphys.h"
    78 #include "dimradmars.h"
    79       integer klon,klev,kidia,kfdia
    80       parameter(kidia=1,kfdia=NDLO2)
     79!#include "dimradmars.h"
     80      integer klon,klev,kidia
     81      parameter(kidia=1)
     82      integer, save :: kfdia ! =NDLO2
    8183
    8284#include "comcstfi.h"
     
    153155 110  CONTINUE
    154156C
     157      kfdia=NDLO2
     158     
    155159c     ZTMST=TWODT
    156160c     IF(NSTEP.EQ.NSTART) ZTMST=0.5*TWODT
  • trunk/LMDZ.MARS/libf/phymars/orosetup.F

    r38 r1047  
    4646C
    4747C-----------------------------------------------------------------------
     48      use dimradmars_mod, only: ndlo2
    4849      implicit none
    4950C
     
    5152#include "dimensions.h"
    5253#include "dimphys.h"
    53 #include "dimradmars.h"
     54!#include "dimradmars.h"
    5455      integer klon,klev,kidia,kfdia
    5556
  • trunk/LMDZ.MARS/libf/phymars/phyetat0.F

    r1036 r1047  
    1       SUBROUTINE phyetat0 (fichnom,tab0,Lmodif,nsoil,nq,
     1      SUBROUTINE phyetat0 (fichnom,tab0,Lmodif,nsoil,ngrid,nlay,nq,
    22     .           day_ini,time0,
    33     .           tsurf,tsoil,emis,q2,qsurf,co2ice)
     
    55      use netcdf
    66      use infotrac, only: nqtot, tnom
     7      use surfdat_h, only: phisfi, albedodat, z0, z0_default,
     8     &                     zmea, zstd, zsig, zgam, zthe
    79
    810      implicit none
     
    1719c======================================================================
    1820!#include "netcdf.inc"
    19 #include "dimensions.h"
    20 #include "dimphys.h"
     21!#include "dimensions.h"
     22!#include "dimphys.h"
    2123!#include "comgeomfi.h"
    22 #include "surfdat.h"
     24!#include "surfdat.h"
    2325#include "planete.h"
    24 #include "dimradmars.h"
    25 #include "yomaer.h"
     26!#include "dimradmars.h"
     27!#include "yomaer.h"
    2628#include "comcstfi.h"
    2729!#include "tracer.h"
     
    3537!  ---------
    3638!  inputs:
    37       character*(*) fichnom ! "startfi.nc" file
    38       integer tab0
    39       integer Lmodif
    40       integer nsoil ! # of soil layers
    41       integer nq
    42       integer day_ini
    43       real time0
     39      character*(*),intent(in) :: fichnom ! "startfi.nc" file
     40      integer,intent(in) :: tab0
     41      integer,intent(in) :: Lmodif
     42      integer,intent(in) :: nsoil ! # of soil layers
     43      integer,intent(in) :: ngrid ! # of atmospheric columns
     44      integer,intent(in) :: nlay ! # of atmospheric layers
     45      integer,intent(in) :: nq
     46      integer :: day_ini
     47      real :: time0
    4448
    4549!  outputs:
    46       real tsurf(ngridmx) ! surface temperature
    47       real tsoil(ngridmx,nsoil) ! soil temperature
    48       real emis(ngridmx) ! surface emissivity
    49       real q2(ngridmx, llm+1) !
    50       real qsurf(ngridmx,nq) ! tracers on surface
    51       real co2ice(ngridmx) ! co2 ice cover
     50      real,intent(out) :: tsurf(ngrid) ! surface temperature
     51      real,intent(out) :: tsoil(ngrid,nsoil) ! soil temperature
     52      real,intent(out) :: emis(ngrid) ! surface emissivity
     53      real,intent(out) :: q2(ngrid,nlay+1) !
     54      real,intent(out) :: qsurf(ngrid,nq) ! tracers on surface
     55      real,intent(out) :: co2ice(ngrid) ! co2 ice cover
    5256
    5357!======================================================================
    5458!  Local variables:
    5559
    56       real surffield(ngridmx) ! to temporarily store a surface field
     60      real surffield(ngrid) ! to temporarily store a surface field
    5761      real xmin,xmax ! to display min and max of a field
    5862c
     
    248252         CALL abort
    249253      ENDIF
    250       xmin = 1.0E+20
    251       xmax = -1.0E+20
    252       DO i = 1, ngridmx
    253          xmin = MIN(zmea(i),xmin)
    254          xmax = MAX(zmea(i),xmax)
    255       ENDDO
     254      xmin = MINVAL(zmea)
     255      xmax = MAXVAL(zmea)
    256256      PRINT*,'<zmea>:', xmin, xmax
    257257c
     
    270270         CALL abort
    271271      ENDIF
    272       xmin = 1.0E+20
    273       xmax = -1.0E+20
    274       DO i = 1, ngridmx
    275          xmin = MIN(zstd(i),xmin)
    276          xmax = MAX(zstd(i),xmax)
    277       ENDDO
     272      xmin = MINVAL(zstd)
     273      xmax = MAXVAL(zstd)
    278274      PRINT*,'<zstd>:', xmin, xmax
    279275c
     
    292288         CALL abort
    293289      ENDIF
    294       xmin = 1.0E+20
    295       xmax = -1.0E+20
    296       DO i = 1, ngridmx
    297          xmin = MIN(zsig(i),xmin)
    298          xmax = MAX(zsig(i),xmax)
    299       ENDDO
     290      xmin = MINVAL(zsig)
     291      xmax = MAXVAL(zsig)
    300292      PRINT*,'<zsig>:', xmin, xmax
    301293c
     
    314306         CALL abort
    315307      ENDIF
    316       xmin = 1.0E+20
    317       xmax = -1.0E+20
    318       DO i = 1, ngridmx
    319          xmin = MIN(zgam(i),xmin)
    320          xmax = MAX(zgam(i),xmax)
    321       ENDDO
     308      xmin = MINVAL(zgam)
     309      xmax = MAXVAL(zgam)
    322310      PRINT*,'<zgam>:', xmin, xmax
    323311c
     
    336324         CALL abort
    337325      ENDIF
    338       xmin = 1.0E+20
    339       xmax = -1.0E+20
    340       DO i = 1, ngridmx
    341          xmin = MIN(zthe(i),xmin)
    342          xmax = MAX(zthe(i),xmax)
    343       ENDDO
     326      xmin = MINVAL(zthe)
     327      xmax = MAXVAL(zthe)
    344328      PRINT*,'<zthe>:', xmin, xmax
    345329     
     
    417401      corner(1)=1
    418402      corner(2)=indextime
    419       edges(1)=ngridmx
     403      edges(1)=ngrid
    420404      edges(2)=1
    421405      ierr=nf90_inq_varid(nid,"co2ice",nvarid)
     
    486470!         IF (nbsrf >= 2) THEN
    487471!            DO nsrf = 2, nbsrf
    488 !               DO i = 1, ngridmx
     472!               DO i = 1, ngrid
    489473!                  tsurf(i,nsrf) = tsurf(i,1)
    490474!               ENDDO
     
    506490!               PRINT*, "phyetat0: Le champ <tsoil> est absent"
    507491!               PRINT*, "          Il prend donc la valeur de surface"
    508 !               DO i=1, ngridmx
     492!               DO i=1, ngrid
    509493!                  tsoil(i,isoil,nsrf)=tsurf(i,nsrf)
    510494!               ENDDO
     
    549533
    550534!
    551 ! surface roughness length (NB: z0 is a common in surfdat.h)
     535! surface roughness length (NB: z0 is a common in surfdat_h)
    552536!
    553537      ierr=nf90_inq_varid(nid,"z0",nvarid)
     
    577561      corner(2)=1
    578562      corner(3)=indextime
    579       edges(1)=ngridmx
    580       edges(2)=llm+1
     563      edges(1)=ngrid
     564      edges(2)=nlay+1
    581565      edges(3)=1
    582566      ierr=nf90_inq_varid(nid,"q2",nvarid)
     
    602586      corner(1)=1
    603587      corner(2)=indextime
    604       edges(1)=ngridmx
     588      edges(1)=ngrid
    605589      edges(2)=1
    606590      IF(nq.GE.1) THEN
     
    628612     &                  ' not found in file'
    629613             write(*,*) trim(txt), ' set to 0'
    630              do ig=1,ngridmx
     614             do ig=1,ngrid
    631615               qsurf(ig,iq)=0.
    632616             end do
     
    635619           !ierr=nf90_get_var(nid,nvarid,qsurf(1,iq))
    636620           ierr=nf90_get_var(nid,nvarid,surffield,corner,edges)
    637            qsurf(1:ngridmx,iq)=surffield(1:ngridmx)
     621           qsurf(1:ngrid,iq)=surffield(1:ngrid)
    638622             IF (ierr.NE.nf90_noerr) THEN
    639623               PRINT*, 'phyetat0: Lecture echouee pour <',trim(txt),'>'
     
    644628           xmin = 1.0E+20
    645629           xmax = -1.0E+20
    646            xmin = MINVAL(qsurf(1:ngridmx,iq))
    647            xmax = MAXVAL(qsurf(1:ngridmx,iq))
     630           xmin = MINVAL(qsurf(1:ngrid,iq))
     631           xmax = MAXVAL(qsurf(1:ngrid,iq))
    648632           PRINT*,'tracer on surface <',trim(txt),'>:',xmin,xmax
    649633         ENDDO
     
    660644!            if (yes.eq.'y') then
    661645!              write(*,*) 'OK, let s reindex qsurf'
    662 !                 do ig=1,ngridmx
     646!                 do ig=1,ngrid
    663647!                    do iq=nqtot,nqtot-nqold+1,-1
    664648!                       qsurf(ig,iq)=qsurf(ig,iq-nqtot+nqold)
     
    675659! as well as thermal inertia and volumetric heat capacity
    676660
    677       call soil_settings(nid,ngridmx,nsoil,tsurf,tsoil,indextime)
     661      call soil_settings(nid,ngrid,nsoil,tsurf,tsoil,indextime)
    678662c
    679663c Fermer le fichier:
  • trunk/LMDZ.MARS/libf/phymars/physdem.F

    r1036 r1047  
    1       subroutine physdem0(filename,lonfi,latfi,nsoil,nq,
     1      subroutine physdem0(filename,lonfi,latfi,nsoil,ngrid,nlay,nq,
    22     .                   phystep,day_ini,time,airefi,
    33     .                   alb,ith,pzmea,pzstd,pzsig,pzgam,pzthe)
    44
    55      use infotrac, only: nqtot, tnom
     6      use comsoil_h, only: inertiedat, volcapa, mlayer
     7      use comgeomfi_h, only: area
     8      use surfdat_h, only: albedodat, zmea, zstd, zsig, zgam, zthe,
     9     &                     z0_default, albedice, emisice, emissiv,
     10     &                     iceradius, dtemisice, phisfi, z0
     11      use yomaer_h, only: tauvis
    612      implicit none
    713c
     
    3238#include "ener.h"
    3339#include "netcdf.inc"
    34 #include "dimphys.h"
     40!#include "dimphys.h"
    3541!#include "advtrac.h"
    3642#include "callkeys.h"
     
    4349
    4450      REAL day_ini
    45       INTEGER nsoil,nq
     51      INTEGER,INTENT(IN) :: nsoil,ngrid,nlay,nq
    4652      integer ierr,idim1,idim2,idim3,idim4,idim5,idim6,nvarid
    4753
    4854c
    4955      REAL phystep,time
    50       REAL latfi(ngridmx), lonfi(ngridmx)
    51 !      REAL champhys(ngridmx)
     56      REAL latfi(ngrid), lonfi(ngrid)
     57!      REAL champhys(ngrid)
    5258      INTEGER length
    5359      PARAMETER (length=100)
     
    6268#include "clesph0.h"
    6369#include "fxyprim.h"
    64 #include "comgeomfi.h"
    65 #include "surfdat.h"
    66 #include "comsoil.h"
     70!#include "comgeomfi.h"
     71!#include "surfdat.h"
     72!#include "comsoil.h"
    6773#include "planete.h"
    68 #include "dimradmars.h"
    69 #include "yomaer.h"
     74!#include "dimradmars.h"
     75!#include "yomaer.h"
    7076#include "comcstfi.h"
    7177
    72       real airefi(ngridmx)
    73       real alb(ngridmx),ith(ngridmx,nsoil)
    74       real pzmea(ngridmx),pzstd(ngridmx)
    75       real pzsig(ngridmx),pzgam(ngridmx),pzthe(ngridmx)
     78      real airefi(ngrid)
     79      real alb(ngrid),ith(ngrid,nsoil)
     80      real pzmea(ngrid),pzstd(ngrid)
     81      real pzsig(ngrid),pzgam(ngrid),pzthe(ngrid)
    7682      integer ig
    7783
     
    8692
    8793      ! copy airefi(:) to area(:)
    88       CALL SCOPY(ngridmx,airefi,1,area,1)
    89       ! note: area() is defined in comgeomfi.h
    90 
    91 
    92       DO ig=1,ngridmx
    93          albedodat(ig)=alb(ig) ! note: albedodat() is defined in surfdat.h
    94          zmea(ig)=pzmea(ig) ! note: zmea() is defined in surfdat.h
    95          zstd(ig)=pzstd(ig) ! note: zstd() is defined in surfdat.h
    96          zsig(ig)=pzsig(ig) ! note: zsig() is defined in surfdat.h
    97          zgam(ig)=pzgam(ig) ! note: zgam() is defined in surfdat.h
    98          zthe(ig)=pzthe(ig) ! note: zthe() is defined in surfdat.h
     94      CALL SCOPY(ngrid,airefi,1,area,1)
     95      ! note: area() is defined in comgeomfi_h
     96
     97
     98      DO ig=1,ngrid
     99         albedodat(ig)=alb(ig) ! note: albedodat() is defined in surfdat_h
     100         zmea(ig)=pzmea(ig) ! note: zmea() is defined in surfdat_h
     101         zstd(ig)=pzstd(ig) ! note: zstd() is defined in surfdat_h
     102         zsig(ig)=pzsig(ig) ! note: zsig() is defined in surfdat_h
     103         zgam(ig)=pzgam(ig) ! note: zgam() is defined in surfdat_h
     104         zthe(ig)=pzthe(ig) ! note: zthe() is defined in surfdat_h
    99105      ENDDO
    100106
    101       inertiedat(:,:)=ith(:,:) ! note inertiedat() is defined in comsoil.h
     107      inertiedat(:,:)=ith(:,:) ! note inertiedat() is defined in comsoil_h
    102108c
    103109c  things to store in the physics start file:
     
    121127      endif
    122128c
    123       ierr = NF_DEF_DIM (nid,"physical_points",ngridmx,idim2)
     129      ierr = NF_DEF_DIM (nid,"physical_points",ngrid,idim2)
    124130      if (ierr.ne.NF_NOERR) then
    125131        WRITE(6,*)'physdem0: Problem defining physical_points dimension'
     
    164170      ENDDO
    165171
    166       write(*,*) "physdem0: ngridmx: ",ngridmx
     172      write(*,*) "physdem0: ngrid: ",ngrid
    167173
    168174ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
     
    170176ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
    171177c Informations on the physics grid
    172       tab_cntrl(1) = float(ngridmx)  ! number of nodes on physics grid
    173       tab_cntrl(2) = float(nlayermx) ! number of atmospheric layers
     178      tab_cntrl(1) = float(ngrid)  ! number of nodes on physics grid
     179      tab_cntrl(2) = float(nlay) ! number of atmospheric layers
    174180      tab_cntrl(3) = day_ini + int(time)      ! initial day
    175181      tab_cntrl(4) = time -int(time)          ! initial time of day
     
    260266     
    261267
    262 ! write mid-layer depths mlayer() !known from comsoil.h
     268! write mid-layer depths mlayer() !known from comsoil_h
    263269
    264270      ierr = NF_REDEF (nid) ! Enter NetCDF (re-)define mode
     
    464470#endif
    465471
    466 ! surface roughness length (z0 is a common in surfdat.h)
     472! surface roughness length (z0 is a common in surfdat_h)
    467473
    468474      ierr = NF_REDEF (nid)
     
    691697
    692698
    693       subroutine physdem1(filename,nsoil,nq,
     699      subroutine physdem1(filename,nsoil,ngrid,nlay,nq,
    694700     .                   phystep,time,
    695701     .                   tsurf,tsoil,co2ice,emis,q2,qsurf)
    696702      use infotrac, only: nqtot, tnom
     703      use surfdat_h, only: emis
    697704      implicit none
    698705c
     
    721728#include "ener.h"
    722729#include "netcdf.inc"
    723 #include "dimphys.h"
     730!#include "dimphys.h"
    724731!#include "advtrac.h"
    725732#include "callkeys.h"
     
    732739
    733740      REAL day_ini
    734       INTEGER nsoil,nq
     741      INTEGER,INTENT(IN) :: nsoil,ngrid,nlay,nq
    735742      integer ierr,nvarid
    736743
    737744c
    738745      REAL phystep,time
    739 !      REAL champhys(ngridmx)
    740       REAL tsurf(ngridmx)
     746!      REAL champhys(ngrid)
     747      REAL tsurf(ngrid)
    741748
    742749      INTEGER nb
     
    753760#include "clesph0.h"
    754761#include "fxyprim.h"
    755 #include "comgeomfi.h"
    756 #include "surfdat.h"
    757 #include "comsoil.h"
     762!#include "comgeomfi.h"
     763!#include "surfdat.h"
     764!#include "comsoil.h"
    758765#include "planete.h"
    759 #include "dimradmars.h"
    760 #include "yomaer.h"
     766!#include "dimradmars.h"
     767!#include "yomaer.h"
    761768#include "comcstfi.h"
    762769
    763       real co2ice(ngridmx),tsoil(ngridmx,nsoil),emis(ngridmx)
    764       real q2(ngridmx, llm+1),qsurf(ngridmx,nq)
     770      real co2ice(ngrid),tsoil(ngrid,nsoil),emis(ngrid)
     771      real q2(ngrid,nlay+1),qsurf(ngrid,nq)
    765772      integer ig
    766773
     
    815822      corner(2)=1
    816823      corner(3)=nb
    817       edges(1)=ngridmx
     824      edges(1)=ngrid
    818825      edges(2)=nsoil
    819826      edges(3)=1
     
    838845      corner(2)=1
    839846      corner(3)=nb
    840       edges(1)=ngridmx
     847      edges(1)=ngrid
    841848      edges(2)=llm+1
    842849      edges(3)=1
     
    861868      corner(1)=1
    862869      corner(2)=nb
    863       edges(1)=ngridmx
     870      edges(1)=ngrid
    864871      edges(2)=1
    865872     
     
    946953        write(*,*)'physdem1: moving surface water ice to index ',nqtot
    947954        do iq=nqtot,nqtot
    948           qsurf(1:ngridmx,iq)=qsurf(1:ngridmx,iq-1)
    949           qsurf(1:ngridmx,iq-1)=0
     955          qsurf(1:ngrid,iq)=qsurf(1:ngrid,iq-1)
     956          qsurf(1:ngrid,iq-1)=0
    950957        enddo
    951958      ENDIF
  • trunk/LMDZ.MARS/libf/phymars/physiq.F

    r1038 r1047  
    1717     &                      igcm_dust_mass, igcm_dust_number, igcm_h2o2,
    1818     &                      nuice_ref, rho_ice, rho_dust, ref_r0
    19 
     19      use comsoil_h, only: inertiedat, ! soil thermal inertia
     20     &                     nsoilmx ! number of subsurface layers
     21      use eofdump_mod, only: eofdump
     22      use comgeomfi_h, only: long, lati, area
     23      use comdiurn_h, only: sinlon, coslon, sinlat, coslat
     24      use surfdat_h, only: phisfi, albedodat, zmea, zstd, zsig, zgam,
     25     &                     zthe, z0, albedo_h2o_ice,
     26     &                     frost_albedo_threshold
     27      use comsaison_h, only: dist_sol, declin, mu0, fract
     28      use slope_mod, only: theta_sl, psi_sl
     29      use conc_mod, only: rnew, cpnew, mmean
    2030      IMPLICIT NONE
    2131c=======================================================================
     
    105115c   -------
    106116c
    107 c    pdu(ngrid,nlayermx)       |
    108 c    pdv(ngrid,nlayermx)       |  Temporal derivative of the corresponding
    109 c    pdt(ngrid,nlayermx)       |  variables due to physical processes.
    110 c    pdq(ngrid,nlayermx,nq)    |
    111 c    pdpsrf(ngrid)             |
     117c    pdu(ngrid,nlayer)       |
     118c    pdv(ngrid,nlayer)       |  Temporal derivative of the corresponding
     119c    pdt(ngrid,nlayer)       |  variables due to physical processes.
     120c    pdq(ngrid,nlayer,nq)    |
     121c    pdpsrf(ngrid)           |
    112122c    tracerdyn                 call tracer in dynamical part of GCM ?
    113123
     
    120130#include "dimensions.h"
    121131#include "dimphys.h"
    122 #include "comgeomfi.h"
    123 #include "surfdat.h"
    124 #include "comsoil.h"
    125 #include "comdiurn.h"
     132!#include "comgeomfi.h"
     133!#include "surfdat.h"
     134!#include "comsoil.h"
     135!#include "comdiurn.h"
    126136#include "callkeys.h"
    127137#include "comcstfi.h"
    128138#include "planete.h"
    129 #include "comsaison.h"
     139!#include "comsaison.h"
    130140#include "control.h"
    131 #include "dimradmars.h"
     141!#include "dimradmars.h"
     142! naerkind is set in scatterers.h (built when compiling with makegcm -s #)
     143#include"scatterers.h"
    132144#include "comg1d.h"
    133145!#include "tracer.h"
     
    138150#include "param.h"
    139151#include "param_v4.h"
    140 #include "conc.h"
     152!#include "conc.h"
    141153
    142154#include "netcdf.inc"
    143155
    144 #include "slope.h"
     156!#include "slope.h"
    145157
    146158#ifdef MESOSCALE
     
    158170      INTEGER ngrid,nlayer,nq
    159171      REAL ptimestep
    160       REAL pplev(ngridmx,nlayer+1),pplay(ngridmx,nlayer)
    161       REAL pphi(ngridmx,nlayer)
    162       REAL pu(ngridmx,nlayer),pv(ngridmx,nlayer)
    163       REAL pt(ngridmx,nlayer),pq(ngridmx,nlayer,nq)
    164       REAL pw(ngridmx,nlayer) !Mars pvervel transmit par dyn3d
    165       REAL zh(ngridmx,nlayermx)      ! potential temperature (K)
     172      REAL pplev(ngrid,nlayer+1),pplay(ngrid,nlayer)
     173      REAL pphi(ngrid,nlayer)
     174      REAL pu(ngrid,nlayer),pv(ngrid,nlayer)
     175      REAL pt(ngrid,nlayer),pq(ngrid,nlayer,nq)
     176      REAL pw(ngrid,nlayer) !Mars pvervel transmit par dyn3d
     177      REAL zh(ngrid,nlayer)      ! potential temperature (K)
    166178      LOGICAL firstcall,lastcall
    167179
     
    173185c   --------
    174186c     physical tendencies
    175       REAL pdu(ngridmx,nlayer),pdv(ngridmx,nlayer)
    176       REAL pdt(ngridmx,nlayer),pdq(ngridmx,nlayer,nq)
    177       REAL pdpsrf(ngridmx) ! surface pressure tendency
     187      REAL pdu(ngrid,nlayer),pdv(ngrid,nlayer)
     188      REAL pdt(ngrid,nlayer),pdq(ngrid,nlayer,nq)
     189      REAL pdpsrf(ngrid) ! surface pressure tendency
    178190
    179191
     
    181193c ----------------------
    182194c     aerosol (dust or ice) extinction optical depth  at reference wavelength
    183 c     "longrefvis" set in dimradmars.h , for one of the "naerkind"  kind of
     195c     "longrefvis" set in dimradmars_mod , for one of the "naerkind"  kind of
    184196c      aerosol optical properties  :
    185       REAL aerosol(ngridmx,nlayermx,naerkind)
    186 
    187       INTEGER day_ini  ! Initial date of the run (sol since Ls=0)
    188       INTEGER icount     ! counter of calls to physiq during the run.
    189       REAL tsurf(ngridmx)            ! Surface temperature (K)
    190       REAL tsoil(ngridmx,nsoilmx)    ! sub-surface temperatures (K)
    191       REAL co2ice(ngridmx)           ! co2 ice surface layer (kg.m-2) 
    192       REAL albedo(ngridmx,2)        ! Surface albedo in each solar band
    193       REAL emis(ngridmx)             ! Thermal IR surface emissivity
    194       REAL dtrad(ngridmx,nlayermx)  ! Net atm. radiative heating rate (K.s-1)
    195       REAL fluxrad_sky(ngridmx)      ! rad. flux from sky absorbed by surface (W.m-2)
    196       REAL fluxrad(ngridmx)          ! Net radiative surface flux (W.m-2)
    197       REAL capcal(ngridmx)          ! surface heat capacity (J m-2 K-1)
    198       REAL fluxgrd(ngridmx)          ! surface conduction flux (W.m-2)
     197      REAL,SAVE,ALLOCATABLE :: aerosol(:,:,:)
     198
     199      INTEGER,SAVE :: day_ini  ! Initial date of the run (sol since Ls=0)
     200      INTEGER,SAVE :: icount     ! counter of calls to physiq during the run.
     201      REAL,SAVE,ALLOCATABLE :: tsurf(:)   ! Surface temperature (K)
     202      REAL,SAVE,ALLOCATABLE :: tsoil(:,:) ! sub-surface temperatures (K)
     203      REAL,SAVE,ALLOCATABLE :: co2ice(:)  ! co2 ice surface layer (kg.m-2) 
     204      REAL,SAVE,ALLOCATABLE :: albedo(:,:) ! Surface albedo in each solar band
     205      REAL,SAVE,ALLOCATABLE :: emis(:)    ! Thermal IR surface emissivity
     206      REAL,SAVE,ALLOCATABLE :: dtrad(:,:) ! Net atm. radiative heating rate (K.s-1)
     207      REAL,SAVE,ALLOCATABLE :: fluxrad_sky(:) ! rad. flux from sky absorbed by surface (W.m-2)
     208      REAL,SAVE,ALLOCATABLE :: fluxrad(:) ! Net radiative surface flux (W.m-2)
     209      REAL,SAVE,ALLOCATABLE :: capcal(:) ! surface heat capacity (J m-2 K-1)
     210      REAL,SAVE,ALLOCATABLE :: fluxgrd(:) ! surface conduction flux (W.m-2)
    199211      REAL,ALLOCATABLE,SAVE :: qsurf(:,:) ! tracer on surface (e.g. kg.m-2)
    200       REAL q2(ngridmx,nlayermx+1)    ! Turbulent Kinetic Energy
     212      REAL,SAVE,ALLOCATABLE :: q2(:,:)    ! Turbulent Kinetic Energy
    201213     
    202214c     Variables used by the water ice microphysical scheme:
    203       REAL rice(ngridmx,nlayermx)    ! Water ice geometric mean radius (m)
    204       REAL nuice(ngridmx,nlayermx)   ! Estimated effective variance
     215      REAL rice(ngrid,nlayer)    ! Water ice geometric mean radius (m)
     216      REAL nuice(ngrid,nlayer)   ! Estimated effective variance
    205217                                     !   of the size distribution
    206       real rsedcloud(ngridmx,nlayermx) ! Cloud sedimentation radius
    207       real rhocloud(ngridmx,nlayermx)  ! Cloud density (kg.m-3)
    208       REAL surfdust(ngridmx,nlayermx) ! dust surface area (m2/m3, if photochemistry)
    209       REAL surfice(ngridmx,nlayermx)  !  ice surface area (m2/m3, if photochemistry)
    210       REAL inertiesoil(ngridmx,nsoilmx)! Time varying subsurface
    211                                        ! thermal inertia (J.s-1/2.m-2.K-1)
    212                                        ! (used only when tifeedback=.true.)
     218      real rsedcloud(ngrid,nlayer) ! Cloud sedimentation radius
     219      real rhocloud(ngrid,nlayer)  ! Cloud density (kg.m-3)
     220      REAL surfdust(ngrid,nlayer) ! dust surface area (m2/m3, if photochemistry)
     221      REAL surfice(ngrid,nlayer)  !  ice surface area (m2/m3, if photochemistry)
     222      REAL inertiesoil(ngrid,nsoilmx) ! Time varying subsurface
     223                                      ! thermal inertia (J.s-1/2.m-2.K-1)
     224                                      ! (used only when tifeedback=.true.)
    213225
    214226c     Variables used by the slope model
     
    219231      REAL sky
    220232
    221       SAVE day_ini, icount, time_phys
    222       SAVE aerosol, tsurf,tsoil
    223       SAVE co2ice,albedo,emis, q2
    224       SAVE capcal,fluxgrd,dtrad,fluxrad,fluxrad_sky
    225 
    226       REAL stephan   
    227       DATA stephan/5.67e-08/  ! Stephan Boltzman constant
    228       SAVE stephan
     233      REAL,PARAMETER :: stephan = 5.67e-08 ! Stephan Boltzman constant
    229234
    230235c Local variables :
     
    237242      INTEGER l,ig,ierr,igout,iq,tapphys
    238243
    239       REAL fluxsurf_lw(ngridmx)      !incident LW (IR) surface flux (W.m-2)
    240       REAL fluxsurf_sw(ngridmx,2)    !incident SW (solar) surface flux (W.m-2)
    241       REAL fluxtop_lw(ngridmx)       !Outgoing LW (IR) flux to space (W.m-2)
    242       REAL fluxtop_sw(ngridmx,2)     !Outgoing SW (solar) flux to space (W.m-2)
    243       REAL tauref(ngridmx)           ! Reference column optical depth at odpref
     244      REAL fluxsurf_lw(ngrid)      !incident LW (IR) surface flux (W.m-2)
     245      REAL fluxsurf_sw(ngrid,2)    !incident SW (solar) surface flux (W.m-2)
     246      REAL fluxtop_lw(ngrid)       !Outgoing LW (IR) flux to space (W.m-2)
     247      REAL fluxtop_sw(ngrid,2)     !Outgoing SW (solar) flux to space (W.m-2)
     248      REAL tauref(ngrid)           ! Reference column optical depth at odpref
    244249      real,parameter :: odpref=610. ! DOD reference pressure (Pa)
    245       REAL tau(ngridmx,naerkind)     ! Column dust optical depth at each point
     250      REAL tau(ngrid,naerkind)     ! Column dust optical depth at each point
    246251      REAL zls                       !  solar longitude (rad)
    247252      REAL zday                      ! date (time since Ls=0, in martian days)
    248       REAL zzlay(ngridmx,nlayermx)   ! altitude at the middle of the layers
    249       REAL zzlev(ngridmx,nlayermx+1) ! altitude at layer boundaries
     253      REAL zzlay(ngrid,nlayer)     ! altitude at the middle of the layers
     254      REAL zzlev(ngrid,nlayer+1)  ! altitude at layer boundaries
    250255!      REAL latvl1,lonvl1             ! Viking Lander 1 point (for diagnostic)
    251256
    252257c     Tendancies due to various processes:
    253       REAL dqsurf(ngridmx,nq)
    254       REAL zdtlw(ngridmx,nlayermx)     ! (K/s)
    255       REAL zdtsw(ngridmx,nlayermx)     ! (K/s)
    256 !      REAL cldtlw(ngridmx,nlayermx)     ! (K/s) LW heating rate for clear area
    257 !      REAL cldtsw(ngridmx,nlayermx)     ! (K/s) SW heating rate for clear area
    258       REAL zdtnirco2(ngridmx,nlayermx) ! (K/s)
    259       REAL zdtnlte(ngridmx,nlayermx)   ! (K/s)
    260       REAL zdtsurf(ngridmx)            ! (K/s)
    261       REAL zdtcloud(ngridmx,nlayermx)
    262       REAL zdvdif(ngridmx,nlayermx),zdudif(ngridmx,nlayermx)  ! (m.s-2)
    263       REAL zdhdif(ngridmx,nlayermx), zdtsdif(ngridmx)         ! (K/s)
    264       REAL zdvadj(ngridmx,nlayermx),zduadj(ngridmx,nlayermx)  ! (m.s-2)
    265       REAL zdhadj(ngridmx,nlayermx)                           ! (K/s)
    266       REAL zdtgw(ngridmx,nlayermx)                            ! (K/s)
    267       REAL zdugw(ngridmx,nlayermx),zdvgw(ngridmx,nlayermx)    ! (m.s-2)
    268       REAL zdtc(ngridmx,nlayermx),zdtsurfc(ngridmx)
    269       REAL zdvc(ngridmx,nlayermx),zduc(ngridmx,nlayermx)
    270 
    271       REAL zdqdif(ngridmx,nlayermx,nq), zdqsdif(ngridmx,nq)
    272       REAL zdqsed(ngridmx,nlayermx,nq), zdqssed(ngridmx,nq)
    273       REAL zdqdev(ngridmx,nlayermx,nq), zdqsdev(ngridmx,nq)
    274       REAL zdqadj(ngridmx,nlayermx,nq)
    275       REAL zdqc(ngridmx,nlayermx,nq)
    276       REAL zdqcloud(ngridmx,nlayermx,nq)
    277       REAL zdqscloud(ngridmx,nq)
    278       REAL zdqchim(ngridmx,nlayermx,nq)
    279       REAL zdqschim(ngridmx,nq)
    280 
    281       REAL zdteuv(ngridmx,nlayermx)    ! (K/s)
    282       REAL zdtconduc(ngridmx,nlayermx) ! (K/s)
    283       REAL zdumolvis(ngridmx,nlayermx)
    284       REAL zdvmolvis(ngridmx,nlayermx)
    285       real zdqmoldiff(ngridmx,nlayermx,nq)
     258      REAL dqsurf(ngrid,nq)
     259      REAL zdtlw(ngrid,nlayer)     ! (K/s)
     260      REAL zdtsw(ngrid,nlayer)     ! (K/s)
     261!      REAL cldtlw(ngrid,nlayer)     ! (K/s) LW heating rate for clear area
     262!      REAL cldtsw(ngrid,nlayer)     ! (K/s) SW heating rate for clear area
     263      REAL zdtnirco2(ngrid,nlayer) ! (K/s)
     264      REAL zdtnlte(ngrid,nlayer)   ! (K/s)
     265      REAL zdtsurf(ngrid)            ! (K/s)
     266      REAL zdtcloud(ngrid,nlayer)
     267      REAL zdvdif(ngrid,nlayer),zdudif(ngrid,nlayer)  ! (m.s-2)
     268      REAL zdhdif(ngrid,nlayer), zdtsdif(ngrid)         ! (K/s)
     269      REAL zdvadj(ngrid,nlayer),zduadj(ngrid,nlayer)  ! (m.s-2)
     270      REAL zdhadj(ngrid,nlayer)                           ! (K/s)
     271      REAL zdtgw(ngrid,nlayer)                            ! (K/s)
     272      REAL zdugw(ngrid,nlayer),zdvgw(ngrid,nlayer)    ! (m.s-2)
     273      REAL zdtc(ngrid,nlayer),zdtsurfc(ngrid)
     274      REAL zdvc(ngrid,nlayer),zduc(ngrid,nlayer)
     275
     276      REAL zdqdif(ngrid,nlayer,nq), zdqsdif(ngrid,nq)
     277      REAL zdqsed(ngrid,nlayer,nq), zdqssed(ngrid,nq)
     278      REAL zdqdev(ngrid,nlayer,nq), zdqsdev(ngrid,nq)
     279      REAL zdqadj(ngrid,nlayer,nq)
     280      REAL zdqc(ngrid,nlayer,nq)
     281      REAL zdqcloud(ngrid,nlayer,nq)
     282      REAL zdqscloud(ngrid,nq)
     283      REAL zdqchim(ngrid,nlayer,nq)
     284      REAL zdqschim(ngrid,nq)
     285
     286      REAL zdteuv(ngrid,nlayer)    ! (K/s)
     287      REAL zdtconduc(ngrid,nlayer) ! (K/s)
     288      REAL zdumolvis(ngrid,nlayer)
     289      REAL zdvmolvis(ngrid,nlayer)
     290      real zdqmoldiff(ngrid,nlayer,nq)
    286291
    287292c     Local variable for local intermediate calcul:
    288       REAL zflubid(ngridmx)
    289       REAL zplanck(ngridmx),zpopsk(ngridmx,nlayermx)
    290       REAL zdum1(ngridmx,nlayermx)
    291       REAL zdum2(ngridmx,nlayermx)
     293      REAL zflubid(ngrid)
     294      REAL zplanck(ngrid),zpopsk(ngrid,nlayer)
     295      REAL zdum1(ngrid,nlayer)
     296      REAL zdum2(ngrid,nlayer)
    292297      REAL ztim1,ztim2,ztim3, z1,z2
    293298      REAL ztime_fin
    294       REAL zdh(ngridmx,nlayermx)
     299      REAL zdh(ngrid,nlayer)
    295300      INTEGER length
    296301      PARAMETER (length=100)
     
    298303c local variables only used for diagnostic (output in file "diagfi" or "stats")
    299304c -----------------------------------------------------------------------------
    300       REAL ps(ngridmx), zt(ngridmx,nlayermx)
    301       REAL zu(ngridmx,nlayermx),zv(ngridmx,nlayermx)
    302       REAL zq(ngridmx,nlayermx,nq)
    303       REAL fluxtop_sw_tot(ngridmx), fluxsurf_sw_tot(ngridmx)
     305      REAL ps(ngrid), zt(ngrid,nlayer)
     306      REAL zu(ngrid,nlayer),zv(ngrid,nlayer)
     307      REAL zq(ngrid,nlayer,nq)
     308      REAL fluxtop_sw_tot(ngrid), fluxsurf_sw_tot(ngrid)
    304309      character*2 str2
    305310!      character*5 str5
    306       real zdtdif(ngridmx,nlayermx), zdtadj(ngridmx,nlayermx)
    307       REAL tauscaling(ngridmx)   ! Convertion factor for qdust and Ndust
    308       SAVE tauscaling            ! in case iradia NE 1
    309       real rdust(ngridmx,nlayermx) ! dust geometric mean radius (m)
     311      real zdtdif(ngrid,nlayer), zdtadj(ngrid,nlayer)
     312      REAL,SAVE,ALLOCATABLE :: tauscaling(:)   ! Convertion factor for qdust and Ndust
     313      real rdust(ngrid,nlayer) ! dust geometric mean radius (m)
    310314      integer igmin, lmin
    311315      logical tdiag
    312316
    313       real co2col(ngridmx)        ! CO2 column
     317      real co2col(ngrid)        ! CO2 column
    314318      ! pplev and pplay are dynamical inputs and must not be modified in the physics.
    315319      ! instead, use zplay and zplev :
    316       REAL zplev(ngrid,nlayermx+1),zplay(ngrid,nlayermx)
     320      REAL zplev(ngrid,nlayer+1),zplay(ngrid,nlayer)
    317321!      REAL zstress(ngrid),cd
    318       real tmean, zlocal(nlayermx)
    319       real rho(ngridmx,nlayermx)  ! density
    320       real vmr(ngridmx,nlayermx)  ! volume mixing ratio
    321       real rhopart(ngridmx,nlayermx) ! number density of a given species
    322       real colden(ngridmx,nq)     ! vertical column of tracers
    323       REAL mtot(ngridmx)          ! Total mass of water vapor (kg/m2)
    324       REAL icetot(ngridmx)        ! Total mass of water ice (kg/m2)
    325       REAL Nccntot(ngridmx)       ! Total number of ccn (nbr/m2)
    326       REAL Mccntot(ngridmx)       ! Total mass of ccn (kg/m2)
    327       REAL rave(ngridmx)          ! Mean water ice effective radius (m)
    328       REAL opTES(ngridmx,nlayermx)! abs optical depth at 825 cm-1
    329       REAL tauTES(ngridmx)        ! column optical depth at 825 cm-1
     322      real tmean, zlocal(nlayer)
     323      real rho(ngrid,nlayer)  ! density
     324      real vmr(ngrid,nlayer)  ! volume mixing ratio
     325      real rhopart(ngrid,nlayer) ! number density of a given species
     326      real colden(ngrid,nq)     ! vertical column of tracers
     327      REAL mtot(ngrid)          ! Total mass of water vapor (kg/m2)
     328      REAL icetot(ngrid)        ! Total mass of water ice (kg/m2)
     329      REAL Nccntot(ngrid)       ! Total number of ccn (nbr/m2)
     330      REAL Mccntot(ngrid)       ! Total mass of ccn (kg/m2)
     331      REAL rave(ngrid)          ! Mean water ice effective radius (m)
     332      REAL opTES(ngrid,nlayer)  ! abs optical depth at 825 cm-1
     333      REAL tauTES(ngrid)        ! column optical depth at 825 cm-1
    330334      REAL Qabsice                ! Water ice absorption coefficient
    331       REAL taucloudtes(ngridmx)! Cloud opacity at infrared
     335      REAL taucloudtes(ngrid! Cloud opacity at infrared
    332336                               !   reference wavelength using
    333337                               !   Qabs instead of Qext
    334338                               !   (direct comparison with TES)
    335339                               
    336       REAL dqdustsurf(ngridmx) ! surface q dust flux (kg/m2/s)
    337       REAL dndustsurf(ngridmx) ! surface n dust flux (number/m2/s)
    338       REAL ndust(ngridmx,nlayermx) ! true n dust (kg/kg)
    339       REAL qdust(ngridmx,nlayermx) ! true q dust (kg/kg)
    340       REAL nccn(ngridmx,nlayermx)  ! true n ccn (kg/kg)
    341       REAL qccn(ngridmx,nlayermx)  ! true q ccn (kg/kg)
     340      REAL dqdustsurf(ngrid) ! surface q dust flux (kg/m2/s)
     341      REAL dndustsurf(ngrid) ! surface n dust flux (number/m2/s)
     342      REAL ndust(ngrid,nlayer) ! true n dust (kg/kg)
     343      REAL qdust(ngrid,nlayer) ! true q dust (kg/kg)
     344      REAL nccn(ngrid,nlayer)  ! true n ccn (kg/kg)
     345      REAL qccn(ngrid,nlayer)  ! true q ccn (kg/kg)
    342346
    343347c Test 1d/3d scavenging
    344       real h2otot(ngridmx)
    345       REAL satu(ngridmx,nlayermx)  ! satu ratio for output
    346       REAL zqsat(ngridmx,nlayermx) ! saturation
    347 
    348       REAL time_phys
     348      real h2otot(ngrid)
     349      REAL satu(ngrid,nlayer)  ! satu ratio for output
     350      REAL zqsat(ngrid,nlayer) ! saturation
     351
     352      REAL,SAVE :: time_phys
    349353
    350354! Added for new NLTE scheme
    351355
    352       real co2vmr_gcm(ngridmx,nlayermx)
    353       real n2vmr_gcm(ngridmx,nlayermx)
    354       real ovmr_gcm(ngridmx,nlayermx)
    355       real covmr_gcm(ngridmx,nlayermx)
     356      real co2vmr_gcm(ngrid,nlayer)
     357      real n2vmr_gcm(ngrid,nlayer)
     358      real ovmr_gcm(ngrid,nlayer)
     359      real covmr_gcm(ngrid,nlayer)
    356360
    357361
    358362c Variables for PBL
    359       REAL zz1(ngridmx)
    360       REAL lmax_th_out(ngridmx),zmax_th(ngridmx)
    361       REAL, SAVE :: wstar(ngridmx)
    362       REAL, SAVE :: hfmax_th(ngridmx)
    363       REAL pdu_th(ngridmx,nlayermx),pdv_th(ngridmx,nlayermx)
    364       REAL pdt_th(ngridmx,nlayermx),pdq_th(ngridmx,nlayermx,nq)
    365       INTEGER lmax_th(ngridmx),dimout,n_out,n
     363      REAL zz1(ngrid)
     364      REAL lmax_th_out(ngrid),zmax_th(ngrid)
     365      REAL,SAVE,ALLOCATABLE :: wstar(:)
     366      REAL,SAVE,ALLOCATABLE :: hfmax_th(:)
     367      REAL pdu_th(ngrid,nlayer),pdv_th(ngrid,nlayer)
     368      REAL pdt_th(ngrid,nlayer),pdq_th(ngrid,nlayer,nq)
     369      INTEGER lmax_th(ngrid),dimout,n_out,n
    366370      CHARACTER(50) zstring
    367       REAL dtke_th(ngridmx,nlayermx+1)
    368       REAL zcdv(ngridmx), zcdh(ngridmx)
     371      REAL dtke_th(ngrid,nlayer+1)
     372      REAL zcdv(ngrid), zcdh(ngrid)
    369373      REAL, ALLOCATABLE, DIMENSION(:,:) :: T_out
    370374      REAL, ALLOCATABLE, DIMENSION(:,:) :: u_out ! Interpolated teta and u at z_out
    371       REAL u_out1(ngridmx)
    372       REAL T_out1(ngridmx)
     375      REAL u_out1(ngrid)
     376      REAL T_out1(ngrid)
    373377      REAL, ALLOCATABLE, DIMENSION(:) :: z_out     ! height of interpolation between z0 and z1 [meters]
    374       REAL ustar(ngridmx),tstar(ngridmx)  ! friction velocity and friction potential temp
    375       REAL L_mo(ngridmx),vhf(ngridmx),vvv(ngridmx)
    376 !      REAL zu2(ngridmx)
    377       REAL sensibFlux(ngridmx)
     378      REAL ustar(ngrid),tstar(ngrid)  ! friction velocity and friction potential temp
     379      REAL L_mo(ngrid),vhf(ngrid),vvv(ngrid)
     380!      REAL zu2(ngrid)
     381      REAL sensibFlux(ngrid)
    378382
    379383c=======================================================================
     
    388392        ! allocate local (saved) arrays:
    389393        allocate(qsurf(ngrid,nq))
     394        allocate(tsoil(ngrid,nsoilmx))
     395        allocate(tsurf(ngrid))
     396        allocate(aerosol(ngrid,nlayer,naerkind))
     397        allocate(co2ice(ngrid))
     398        allocate(albedo(ngrid,2))
     399        allocate(emis(ngrid))
     400        allocate(dtrad(ngrid,nlayer))
     401        allocate(fluxrad_sky(ngrid))
     402        allocate(fluxrad(ngrid))
     403        allocate(capcal(ngrid))
     404        allocate(fluxgrd(ngrid))
     405        allocate(q2(ngrid,nlayer+1))
     406        allocate(tauscaling(ngrid))
     407        allocate(wstar(ngrid))
     408        allocate(hfmax_th(ngrid))
    390409       
    391410c        variables set to 0
     
    406425! Read netcdf initial physical parameters.
    407426         CALL phyetat0 ("startfi.nc",0,0,
    408      &         nsoilmx,nq,
     427     &         nsoilmx,ngrid,nlayer,nq,
    409428     &         day_ini,time_phys,
    410429     &         tsurf,tsoil,emis,q2,qsurf,co2ice)
     
    469488
    470489         if (.not.callthermos .and. .not.photochem) then
    471                  do l=1,nlayermx
    472                   do ig=1,ngridmx
     490                 do l=1,nlayer
     491                  do ig=1,ngrid
    473492                   rnew(ig,l)=r
    474493                   cpnew(ig,l)=cpp
     
    482501         if(thermochem) call chemthermos_readini
    483502
    484         IF (tracer.AND.water.AND.(ngridmx.NE.1)) THEN
     503        IF (tracer.AND.water.AND.(ngrid.NE.1)) THEN
    485504          write(*,*)"physiq: water_param Surface water ice albedo:",
    486505     .                  albedo_h2o_ice
     
    488507
    489508#ifndef MESOSCALE
    490          if (callslope) call getslopes(phisfi)
     509         if (callslope) call getslopes(ngrid,phisfi)
    491510                           
    492          call physdem0("restartfi.nc",long,lati,nsoilmx,nq,
     511         call physdem0("restartfi.nc",long,lati,nsoilmx,ngrid,nlayer,nq,
    493512     .                 ptimestep,pday,time_phys,area,
    494513     .                 albedodat,inertiedat,zmea,zstd,zsig,zgam,zthe)
     
    503522c ---------------------------------------------------
    504523c
    505       IF (ngrid.NE.ngridmx) THEN
    506          PRINT*,'STOP in PHYSIQ'
    507          PRINT*,'Probleme de dimensions :'
    508          PRINT*,'ngrid     = ',ngrid
    509          PRINT*,'ngridmx   = ',ngridmx
    510          STOP
    511       ENDIF
    512524
    513525c     Initialize various variables
     
    580592
    581593      if(photochem.or.callthermos) then
    582          call concentrations(nq,zplay,pt,pdt,pq,pdq,ptimestep)
     594         call concentrations(ngrid,nlayer,nq,
     595     &                       zplay,pt,pdt,pq,pdq,ptimestep)
    583596      endif
    584597#endif
     
    812825c Richardson based surface layer model.
    813826        IF ( .not.calltherm .and. callrichsl ) THEN
    814           DO ig=1, ngridmx
     827          DO ig=1, ngrid
    815828             IF (zh(ig,1) .lt. tsurf(ig)) THEN
    816829               wstar(ig)=1.
     
    12261239     $                       surfdust, surfice)
    12271240!           call photochemistry
    1228             call calchim(nq,
     1241            call calchim(ngrid,nlayer,nq,
    12291242     &                   ptimestep,zplay,zplev,pt,pdt,dist_sol,mu0,
    12301243     $                   zzlev,zzlay,zday,pq,pdq,zdqchim,zdqschim,
     
    12931306
    12941307      if (callthermos) then
    1295         call thermosphere(zplev,zplay,dist_sol,
     1308        call thermosphere(ngrid,nlayer,nq,zplev,zplay,dist_sol,
    12961309     $     mu0,ptimestep,ptime,zday,tsurf,zzlev,zzlay,
    12971310     &     pt,pq,pu,pv,pdt,pdq,
     
    13311344
    13321345
    1333       IF (tracer.AND.water.AND.(ngridmx.NE.1)) THEN
     1346      IF (tracer.AND.water.AND.(ngrid.NE.1)) THEN
    13341347#ifndef MESOSCALE
    13351348         if (caps.and.(obliquit.lt.27.)) then
     
    13561369           endif
    13571370         enddo  ! of do ig=1,ngrid
    1358       ENDIF  ! of IF (tracer.AND.water.AND.(ngridmx.NE.1))
     1371      ENDIF  ! of IF (tracer.AND.water.AND.(ngrid.NE.1))
    13591372
    13601373c
     
    14151428      ! Potential Temperature
    14161429
    1417        DO ig=1,ngridmx
    1418           DO l=1,nlayermx
     1430       DO ig=1,ngrid
     1431          DO l=1,nlayer
    14191432              zh(ig,l) = zt(ig,l)*(zplev(ig,1)/zplay(ig,l))**rcp
    14201433          ENDDO
     
    15531566           
    15541567           
    1555           call physdem1("restartfi.nc",nsoilmx,nq,
     1568          call physdem1("restartfi.nc",nsoilmx,ngrid,nlayer,nq,
    15561569     .                ptimestep,ztime_fin,
    15571570     .                tsurf,tsoil,co2ice,emis,q2,qsurf)
     
    15981611             tauTES(:)=0
    15991612             do ig=1,ngrid
    1600                do l=1,nlayermx
     1613               do l=1,nlayer
    16011614                 mtot(ig) = mtot(ig) +
    16021615     &                      zq(ig,l,igcm_h2o_vap) *
     
    16191632c               if (icetot(ig)*1e3.lt.0.01) rave(ig)=0.
    16201633             enddo
    1621              call watersat(ngridmx*nlayermx,zt,zplay,zqsat)
     1634             call watersat(ngrid*nlayer,zt,zplay,zqsat)
    16221635             satu(:,:) = zq(:,:,igcm_h2o_vap)/zqsat(:,:)
    16231636
     
    16271640               rave(:)=0
    16281641               do ig=1,ngrid
    1629                  do l=1,nlayermx
     1642                 do l=1,nlayer
    16301643                    Nccntot(ig) = Nccntot(ig) +
    16311644     &              zq(ig,l,igcm_ccn_number)*tauscaling(ig)
     
    16491662               rave(:)=0
    16501663               do ig=1,ngrid
    1651                  do l=1,nlayermx
     1664                 do l=1,nlayer
    16521665                 rave(ig) = rave(ig) +
    16531666     &                      zq(ig,l,igcm_h2o_ice) *
     
    17221735           if (tracer) then
    17231736             if (water) then
    1724                vmr=zq(1:ngridmx,1:nlayermx,igcm_h2o_vap)
    1725      &      *mmean(1:ngridmx,1:nlayermx)/mmol(igcm_h2o_vap)
     1737               vmr=zq(1:ngrid,1:nlayer,igcm_h2o_vap)
     1738     &      *mmean(1:ngrid,1:nlayer)/mmol(igcm_h2o_vap)
    17261739               call wstats(ngrid,"vmr_h2ovap",
    17271740     &                    "H2O vapor volume mixing ratio","mol/mol",
    17281741     &                    3,vmr)
    1729                vmr=zq(1:ngridmx,1:nlayermx,igcm_h2o_ice)
    1730      &      *mmean(1:ngridmx,1:nlayermx)/mmol(igcm_h2o_ice)
     1742               vmr=zq(1:ngrid,1:nlayer,igcm_h2o_ice)
     1743     &      *mmean(1:ngrid,1:nlayer)/mmol(igcm_h2o_ice)
    17311744               call wstats(ngrid,"vmr_h2oice",
    17321745     &                    "H2O ice volume mixing ratio","mol/mol",
    17331746     &                    3,vmr)
    1734                vmr=zqsat(1:ngridmx,1:nlayermx)
    1735      &      *mmean(1:ngridmx,1:nlayermx)/mmol(igcm_h2o_vap)
     1747               vmr=zqsat(1:ngrid,1:nlayer)
     1748     &      *mmean(1:ngrid,1:nlayer)/mmol(igcm_h2o_vap)
    17361749               call wstats(ngrid,"vmr_h2osat",
    17371750     &                    "saturation volume mixing ratio","mol/mol",
     
    17661779     &                      2,tauTES)
    17671780               else
    1768                  call wstats(ngridmx,'tauTES',
     1781                 call wstats(ngrid,'tauTES',
    17691782     &                   'tau abs 825 cm-1',
    17701783     &                  '',2,taucloudtes)
     
    17761789           if (dustbin.ne.0) then
    17771790         
    1778              call wstats(ngridmx,'tau','taudust','SI',2,tau(1,1))
     1791             call wstats(ngrid,'tau','taudust','SI',2,tau(1,1))
    17791792             
    17801793             if (doubleq) then
    1781 c            call wstats(ngridmx,'qsurf','qsurf',
     1794c            call wstats(ngrid,'qsurf','qsurf',
    17821795c     &                       'kg.m-2',2,qsurf(1,igcm_dust_mass))
    1783 c            call wstats(ngridmx,'Nsurf','N particles',
     1796c            call wstats(ngrid,'Nsurf','N particles',
    17841797c     &                       'N.m-2',2,qsurf(1,igcm_dust_number))
    1785 c            call wstats(ngridmx,'dqsdev','ddevil lift',
     1798c            call wstats(ngrid,'dqsdev','ddevil lift',
    17861799c    &                       'kg.m-2.s-1',2,zdqsdev(1,1))
    1787 c            call wstats(ngridmx,'dqssed','sedimentation',
     1800c            call wstats(ngrid,'dqssed','sedimentation',
    17881801c     &                       'kg.m-2.s-1',2,zdqssed(1,1))
    1789 c            call wstats(ngridmx,'dqsdif','diffusion',
     1802c            call wstats(ngrid,'dqsdif','diffusion',
    17901803c     &                       'kg.m-2.s-1',2,zdqsdif(1,1))
    1791                call wstats(ngridmx,'dqsdust',
     1804               call wstats(ngrid,'dqsdust',
    17921805     &                        'deposited surface dust mass',
    17931806     &                        'kg.m-2.s-1',2,dqdustsurf)
    1794                call wstats(ngridmx,'dqndust',
     1807               call wstats(ngrid,'dqndust',
    17951808     &                        'deposited surface dust number',
    17961809     &                        'number.m-2.s-1',2,dndustsurf)
    1797                call wstats(ngridmx,'reffdust','reffdust',
     1810               call wstats(ngrid,'reffdust','reffdust',
    17981811     &                        'm',3,rdust*ref_r0)
    1799                call wstats(ngridmx,'dustq','Dust mass mr',
     1812               call wstats(ngrid,'dustq','Dust mass mr',
    18001813     &                        'kg/kg',3,qdust)
    1801                call wstats(ngridmx,'dustN','Dust number',
     1814               call wstats(ngrid,'dustN','Dust number',
    18021815     &                        'part/kg',3,ndust)
    18031816             else
    18041817               do iq=1,dustbin
    18051818                 write(str2(1:2),'(i2.2)') iq
    1806                  call wstats(ngridmx,'q'//str2,'mix. ratio',
     1819                 call wstats(ngrid,'q'//str2,'mix. ratio',
    18071820     &                         'kg/kg',3,zq(1,1,iq))
    1808                  call wstats(ngridmx,'qsurf'//str2,'qsurf',
     1821                 call wstats(ngrid,'qsurf'//str2,'qsurf',
    18091822     &                         'kg.m-2',2,qsurf(1,iq))
    18101823               end do
     
    18121825
    18131826             if (scavenging) then
    1814                call wstats(ngridmx,'ccnq','CCN mass mr',
     1827               call wstats(ngrid,'ccnq','CCN mass mr',
    18151828     &                        'kg/kg',3,qccn)
    1816                call wstats(ngridmx,'ccnN','CCN number',
     1829               call wstats(ngrid,'ccnN','CCN number',
    18171830     &                        'part/kg',3,nccn)
    18181831             endif ! (scavenging)
     
    18951908        qsurfice(1:ngrid) = qsurf(1:ngrid,igcm_h2o_ice)
    18961909        vmr=1.e6 * zq(1:ngrid,1:nlayer,igcm_h2o_ice)
    1897      .           *mmean(1:ngridmx,1:nlayermx) / mmol(igcm_h2o_ice)
     1910     .           *mmean(1:ngrid,1:nlayer) / mmol(igcm_h2o_ice)
    18981911      ENDIF
    18991912      !! Dust quantity integration along the vertical axe
     
    19011914      IF (igcm_dust_mass .ne. 0) THEN
    19021915      do ig=1,ngrid
    1903        do l=1,nlayermx
     1916       do l=1,nlayer
    19041917        dustot(ig) = dustot(ig) +
    19051918     &               zq(ig,l,igcm_dust_mass)
     
    19531966c        call WRITEDIAGFI(ngrid,"ssurf","Surface stress","N.m-2",2,
    19541967c    &                  zstress)
    1955 c        call WRITEDIAGFI(ngridmx,'sw_htrt','sw heat. rate',
     1968c        call WRITEDIAGFI(ngrid,'sw_htrt','sw heat. rate',
    19561969c    &                   'w.m-2',3,zdtsw)
    1957 c        call WRITEDIAGFI(ngridmx,'lw_htrt','lw heat. rate',
     1970c        call WRITEDIAGFI(ngrid,'lw_htrt','lw heat. rate',
    19581971c    &                   'w.m-2',3,zdtlw)
    19591972            if (.not.activice) then
    1960                CALL WRITEDIAGFI(ngridmx,'tauTESap',
     1973               CALL WRITEDIAGFI(ngrid,'tauTESap',
    19611974     &                         'tau abs 825 cm-1',
    19621975     &                         '',2,tauTES)
    19631976             else
    1964                CALL WRITEDIAGFI(ngridmx,'tauTES',
     1977               CALL WRITEDIAGFI(ngrid,'tauTES',
    19651978     &                         'tau abs 825 cm-1',
    19661979     &                         '',2,taucloudtes)
     
    19982011         ! Compute co2 column
    19992012         co2col(:)=0
    2000          do l=1,nlayermx
     2013         do l=1,nlayer
    20012014           do ig=1,ngrid
    20022015             co2col(ig)=co2col(ig)+
     
    20162029#ifdef MESOINI
    20172030            !!!! waterice = q01, voir readmeteo.F90
    2018             call WRITEDIAGFI(ngridmx,'q01',noms(igcm_h2o_ice),
     2031            call WRITEDIAGFI(ngrid,'q01',noms(igcm_h2o_ice),
    20192032     &                      'kg/kg',3,
    2020      &                       zq(1:ngridmx,1:nlayermx,igcm_h2o_ice))
     2033     &                       zq(1:ngrid,1:nlayer,igcm_h2o_ice))
    20212034            !!!! watervapor = q02, voir readmeteo.F90
    2022             call WRITEDIAGFI(ngridmx,'q02',noms(igcm_h2o_vap),
     2035            call WRITEDIAGFI(ngrid,'q02',noms(igcm_h2o_vap),
    20232036     &                      'kg/kg',3,
    2024      &                       zq(1:ngridmx,1:nlayermx,igcm_h2o_vap))
     2037     &                       zq(1:ngrid,1:nlayer,igcm_h2o_vap))
    20252038            !!!! surface waterice qsurf02 (voir readmeteo)
    2026             call WRITEDIAGFI(ngridmx,'qsurf02','surface tracer',
     2039            call WRITEDIAGFI(ngrid,'qsurf02','surface tracer',
    20272040     &                      'kg.m-2',2,
    2028      &                       qsurf(1:ngridmx,igcm_h2o_ice))
     2041     &                       qsurf(1:ngrid,igcm_h2o_ice))
    20292042#endif
    20302043
    2031             CALL WRITEDIAGFI(ngridmx,'mtot',
     2044            CALL WRITEDIAGFI(ngrid,'mtot',
    20322045     &                       'total mass of water vapor',
    20332046     &                       'kg/m2',2,mtot)
    2034             CALL WRITEDIAGFI(ngridmx,'icetot',
     2047            CALL WRITEDIAGFI(ngrid,'icetot',
    20352048     &                       'total mass of water ice',
    20362049     &                       'kg/m2',2,icetot)
    2037             vmr=zq(1:ngridmx,1:nlayermx,igcm_h2o_ice)
    2038      &      *mmean(1:ngridmx,1:nlayermx)/mmol(igcm_h2o_ice)
    2039             call WRITEDIAGFI(ngridmx,'vmr_h2oice','h2o ice vmr',
     2050            vmr=zq(1:ngrid,1:nlayer,igcm_h2o_ice)
     2051     &      *mmean(1:ngrid,1:nlayer)/mmol(igcm_h2o_ice)
     2052            call WRITEDIAGFI(ngrid,'vmr_h2oice','h2o ice vmr',
    20402053     &                       'mol/mol',3,vmr)
    2041             vmr=zq(1:ngridmx,1:nlayermx,igcm_h2o_vap)
    2042      &      *mmean(1:ngridmx,1:nlayermx)/mmol(igcm_h2o_vap)
    2043             call WRITEDIAGFI(ngridmx,'vmr_h2ovap','h2o vap vmr',
     2054            vmr=zq(1:ngrid,1:nlayer,igcm_h2o_vap)
     2055     &      *mmean(1:ngrid,1:nlayer)/mmol(igcm_h2o_vap)
     2056            call WRITEDIAGFI(ngrid,'vmr_h2ovap','h2o vap vmr',
    20442057     &                       'mol/mol',3,vmr)
    2045             CALL WRITEDIAGFI(ngridmx,'reffice',
     2058            CALL WRITEDIAGFI(ngrid,'reffice',
    20462059     &                       'Mean reff',
    20472060     &                       'm',2,rave)
     
    20522065     &                    "mass condensation nuclei","kg/m2",
    20532066     &                    2,Mccntot)
    2054             call WRITEDIAGFI(ngridmx,'rice','Ice particle size',
     2067            call WRITEDIAGFI(ngrid,'rice','Ice particle size',
    20552068     &                       'm',3,rice)
    2056             call WRITEDIAGFI(ngridmx,'h2o_ice_s',
     2069            call WRITEDIAGFI(ngrid,'h2o_ice_s',
    20572070     &                       'surface h2o_ice',
    20582071     &                       'kg.m-2',2,qsurf(1,igcm_h2o_ice))
    2059             CALL WRITEDIAGFI(ngridmx,'albedo',
     2072            CALL WRITEDIAGFI(ngrid,'albedo',
    20602073     &                         'albedo',
    20612074     &                         '',2,albedo(1,1))
    20622075              if (tifeedback) then
    2063                  call WRITEDIAGSOIL(ngridmx,"soiltemp",
     2076                 call WRITEDIAGSOIL(ngrid,"soiltemp",
    20642077     &                              "Soil temperature","K",
    20652078     &                              3,tsoil)
    2066                  call WRITEDIAGSOIL(ngridmx,'soilti',
     2079                 call WRITEDIAGSOIL(ngrid,'soilti',
    20672080     &                       'Soil Thermal Inertia',
    20682081     &                       'J.s-1/2.m-2.K-1',3,inertiesoil)
     
    20742087             iq=nq
    20752088c            write(str2(1:2),'(i2.2)') iq
    2076 c            call WRITEDIAGFI(ngridmx,'dqs'//str2,'dqscloud',
     2089c            call WRITEDIAGFI(ngrid,'dqs'//str2,'dqscloud',
    20772090c    &                       'kg.m-2',2,zdqscloud(1,iq))
    2078 c            call WRITEDIAGFI(ngridmx,'dqch'//str2,'var chim',
     2091c            call WRITEDIAGFI(ngrid,'dqch'//str2,'var chim',
    20792092c    &                       'kg/kg',3,zdqchim(1,1,iq))
    2080 c            call WRITEDIAGFI(ngridmx,'dqd'//str2,'var dif',
     2093c            call WRITEDIAGFI(ngrid,'dqd'//str2,'var dif',
    20812094c    &                       'kg/kg',3,zdqdif(1,1,iq))
    2082 c            call WRITEDIAGFI(ngridmx,'dqa'//str2,'var adj',
     2095c            call WRITEDIAGFI(ngrid,'dqa'//str2,'var adj',
    20832096c    &                       'kg/kg',3,zdqadj(1,1,iq))
    2084 c            call WRITEDIAGFI(ngridmx,'dqc'//str2,'var c',
     2097c            call WRITEDIAGFI(ngrid,'dqc'//str2,'var c',
    20852098c    &                       'kg/kg',3,zdqc(1,1,iq))
    20862099           endif  !(water.and..not.photochem)
     
    20912104c        ----------------------------------------------------------
    20922105
    2093         call WRITEDIAGFI(ngridmx,'tauref',
     2106        call WRITEDIAGFI(ngrid,'tauref',
    20942107     &                    'Dust ref opt depth','NU',2,tauref)
    20952108
    20962109         if (tracer.and.(dustbin.ne.0)) then
    2097           call WRITEDIAGFI(ngridmx,'tau','taudust','SI',2,tau(1,1))
     2110          call WRITEDIAGFI(ngrid,'tau','taudust','SI',2,tau(1,1))
    20982111           if (doubleq) then
    2099 c            call WRITEDIAGFI(ngridmx,'qsurf','qsurf',
     2112c            call WRITEDIAGFI(ngrid,'qsurf','qsurf',
    21002113c     &                       'kg.m-2',2,qsurf(1,igcm_dust_mass))
    2101 c            call WRITEDIAGFI(ngridmx,'Nsurf','N particles',
     2114c            call WRITEDIAGFI(ngrid,'Nsurf','N particles',
    21022115c     &                       'N.m-2',2,qsurf(1,igcm_dust_number))
    2103 c            call WRITEDIAGFI(ngridmx,'dqsdev','ddevil lift',
     2116c            call WRITEDIAGFI(ngrid,'dqsdev','ddevil lift',
    21042117c    &                       'kg.m-2.s-1',2,zdqsdev(1,1))
    2105 c            call WRITEDIAGFI(ngridmx,'dqssed','sedimentation',
     2118c            call WRITEDIAGFI(ngrid,'dqssed','sedimentation',
    21062119c     &                       'kg.m-2.s-1',2,zdqssed(1,1))
    2107 c            call WRITEDIAGFI(ngridmx,'dqsdif','diffusion',
     2120c            call WRITEDIAGFI(ngrid,'dqsdif','diffusion',
    21082121c     &                       'kg.m-2.s-1',2,zdqsdif(1,1))
    2109              call WRITEDIAGFI(ngridmx,'dqsdust',
     2122             call WRITEDIAGFI(ngrid,'dqsdust',
    21102123     &                        'deposited surface dust mass',
    21112124     &                        'kg.m-2.s-1',2,dqdustsurf)
    2112              call WRITEDIAGFI(ngridmx,'dqndust',
     2125             call WRITEDIAGFI(ngrid,'dqndust',
    21132126     &                        'deposited surface dust number',
    21142127     &                        'number.m-2.s-1',2,dndustsurf)
    2115              call WRITEDIAGFI(ngridmx,'reffdust','reffdust',
     2128             call WRITEDIAGFI(ngrid,'reffdust','reffdust',
    21162129     &                        'm',3,rdust*ref_r0)
    2117              call WRITEDIAGFI(ngridmx,'dustq','Dust mass mr',
     2130             call WRITEDIAGFI(ngrid,'dustq','Dust mass mr',
    21182131     &                        'kg/kg',3,qdust)
    2119              call WRITEDIAGFI(ngridmx,'dustN','Dust number',
     2132             call WRITEDIAGFI(ngrid,'dustN','Dust number',
    21202133     &                        'part/kg',3,ndust)
    21212134#ifdef MESOINI
    21222135!     !!! to initialize mesoscale we need scaled variables
    21232136!     !!! because this must correspond to starting point for tracers
    2124 !             call WRITEDIAGFI(ngridmx,'dustq','Dust mass mr',
    2125 !     &           'kg/kg',3,pq(1:ngridmx,1:nlayermx,igcm_dust_mass))
    2126 !             call WRITEDIAGFI(ngridmx,'dustN','Dust number',
    2127 !     &           'part/kg',3,pq(1:ngridmx,1:nlayermx,igcm_dust_number))
    2128 !             call WRITEDIAGFI(ngridmx,'ccn','Nuclei mass mr',
    2129 !     &           'kg/kg',3,pq(1:ngridmx,1:nlayermx,igcm_ccn_mass))
    2130 !             call WRITEDIAGFI(ngridmx,'ccnN','Nuclei number',
    2131 !     &           'part/kg',3,pq(1:ngridmx,1:nlayermx,igcm_ccn_number))
    2132               call WRITEDIAGFI(ngridmx,'dustq','Dust mass mr',
     2137!             call WRITEDIAGFI(ngrid,'dustq','Dust mass mr',
     2138!     &           'kg/kg',3,pq(1:ngrid,1:nlayer,igcm_dust_mass))
     2139!             call WRITEDIAGFI(ngrid,'dustN','Dust number',
     2140!     &           'part/kg',3,pq(1:ngrid,1:nlayer,igcm_dust_number))
     2141!             call WRITEDIAGFI(ngrid,'ccn','Nuclei mass mr',
     2142!     &           'kg/kg',3,pq(1:ngrid,1:nlayer,igcm_ccn_mass))
     2143!             call WRITEDIAGFI(ngrid,'ccnN','Nuclei number',
     2144!     &           'part/kg',3,pq(1:ngrid,1:nlayer,igcm_ccn_number))
     2145              call WRITEDIAGFI(ngrid,'dustq','Dust mass mr',
    21332146     &                        'kg/kg',3,pq(1,1,igcm_dust_mass))
    2134               call WRITEDIAGFI(ngridmx,'dustN','Dust number',
     2147              call WRITEDIAGFI(ngrid,'dustN','Dust number',
    21352148     &                        'part/kg',3,pq(1,1,igcm_dust_number))
    2136               call WRITEDIAGFI(ngridmx,'ccn','Nuclei mass mr',
     2149              call WRITEDIAGFI(ngrid,'ccn','Nuclei mass mr',
    21372150     &                        'kg/kg',3,pq(1,1,igcm_ccn_mass))
    2138               call WRITEDIAGFI(ngridmx,'ccnN','Nuclei number',
     2151              call WRITEDIAGFI(ngrid,'ccnN','Nuclei number',
    21392152     &                        'part/kg',3,pq(1,1,igcm_ccn_number))
    21402153#endif
     
    21422155             do iq=1,dustbin
    21432156               write(str2(1:2),'(i2.2)') iq
    2144                call WRITEDIAGFI(ngridmx,'q'//str2,'mix. ratio',
     2157               call WRITEDIAGFI(ngrid,'q'//str2,'mix. ratio',
    21452158     &                         'kg/kg',3,zq(1,1,iq))
    2146                call WRITEDIAGFI(ngridmx,'qsurf'//str2,'qsurf',
     2159               call WRITEDIAGFI(ngrid,'qsurf'//str2,'qsurf',
    21472160     &                         'kg.m-2',2,qsurf(1,iq))
    21482161             end do
     
    21502163
    21512164           if (scavenging) then
    2152              call WRITEDIAGFI(ngridmx,'ccnq','CCN mass mr',
     2165             call WRITEDIAGFI(ngrid,'ccnq','CCN mass mr',
    21532166     &                        'kg/kg',3,qccn)
    2154              call WRITEDIAGFI(ngridmx,'ccnN','CCN number',
     2167             call WRITEDIAGFI(ngrid,'ccnN','CCN number',
    21552168     &                        'part/kg',3,nccn)
    21562169           endif ! (scavenging)
    21572170
    21582171c          if (submicron) then
    2159 c            call WRITEDIAGFI(ngridmx,'dustsubm','subm mass mr',
     2172c            call WRITEDIAGFI(ngrid,'dustsubm','subm mass mr',
    21602173c    &                        'kg/kg',3,pq(1,1,igcm_dust_submicron))
    21612174c          endif ! (submicron)
     
    21692182         if(callthermos) then
    21702183
    2171             call WRITEDIAGFI(ngridmx,"q15um","15 um cooling","K/s",
     2184            call WRITEDIAGFI(ngrid,"q15um","15 um cooling","K/s",
    21722185     $           3,zdtnlte)
    2173             call WRITEDIAGFI(ngridmx,"quv","UV heating","K/s",
     2186            call WRITEDIAGFI(ngrid,"quv","UV heating","K/s",
    21742187     $           3,zdteuv)
    2175             call WRITEDIAGFI(ngridmx,"cond","Thermal conduction","K/s",
     2188            call WRITEDIAGFI(ngrid,"cond","Thermal conduction","K/s",
    21762189     $           3,zdtconduc)
    2177             call WRITEDIAGFI(ngridmx,"qnir","NIR heating","K/s",
     2190            call WRITEDIAGFI(ngrid,"qnir","NIR heating","K/s",
    21782191     $           3,zdtnirco2)
    21792192
     
    22082221!        endif
    22092222
    2210         call WRITEDIAGFI(ngridmx,'zmax_th',
     2223        call WRITEDIAGFI(ngrid,'zmax_th',
    22112224     &              'hauteur du thermique','m',
    22122225     &                         2,zmax_th)
    2213         call WRITEDIAGFI(ngridmx,'hfmax_th',
     2226        call WRITEDIAGFI(ngrid,'hfmax_th',
    22142227     &              'maximum TH heat flux','K.m/s',
    22152228     &                         2,hfmax_th)
    2216         call WRITEDIAGFI(ngridmx,'wstar',
     2229        call WRITEDIAGFI(ngrid,'wstar',
    22172230     &              'maximum TH vertical velocity','m/s',
    22182231     &                         2,wstar)
     
    22652278         if(calltherm) then
    22662279
    2267         call WRITEDIAGFI(ngridmx,'lmax_th',
     2280        call WRITEDIAGFI(ngrid,'lmax_th',
    22682281     &              'hauteur du thermique','point',
    22692282     &                         0,lmax_th_out)
    2270         call WRITEDIAGFI(ngridmx,'zmax_th',
     2283        call WRITEDIAGFI(ngrid,'zmax_th',
    22712284     &              'hauteur du thermique','m',
    22722285     &                         0,zmax_th)
    2273         call WRITEDIAGFI(ngridmx,'hfmax_th',
     2286        call WRITEDIAGFI(ngrid,'hfmax_th',
    22742287     &              'maximum TH heat flux','K.m/s',
    22752288     &                         0,hfmax_th)
    2276         call WRITEDIAGFI(ngridmx,'wstar',
     2289        call WRITEDIAGFI(ngrid,'wstar',
    22772290     &              'maximum TH vertical velocity','m/s',
    22782291     &                         0,wstar)
     
    22802293         co2col(:)=0.
    22812294         if (tracer) then
    2282          do l=1,nlayermx
     2295         do l=1,nlayer
    22832296           do ig=1,ngrid
    22842297             co2col(ig)=co2col(ig)+
     
    23052318!         call WRITEDIAGFI(ngrid,"dtrad","rad. heat. rate",              &
    23062319!     &              "K.s-1",1,dtrad/zpopsk)
    2307 !        call WRITEDIAGFI(ngridmx,'sw_htrt','sw heat. rate',
     2320!        call WRITEDIAGFI(ngrid,'sw_htrt','sw heat. rate',
    23082321!     &                   'w.m-2',1,zdtsw/zpopsk)
    2309 !        call WRITEDIAGFI(ngridmx,'lw_htrt','lw heat. rate',
     2322!        call WRITEDIAGFI(ngrid,'lw_htrt','lw heat. rate',
    23102323!     &                   'w.m-2',1,zdtlw/zpopsk)
    23112324         call WRITEDIAGFI(ngrid,"co2ice","co2 ice thickness"
     
    23132326
    23142327! or output in diagfi.nc (for testphys1d)
    2315          call WRITEDIAGFI(ngridmx,'ps','Surface pressure','Pa',0,ps)
    2316          call WRITEDIAGFI(ngridmx,'temp','Temperature',
     2328         call WRITEDIAGFI(ngrid,'ps','Surface pressure','Pa',0,ps)
     2329         call WRITEDIAGFI(ngrid,'temp','Temperature',
    23172330     &                       'K',1,zt)
    23182331     
     
    23212334            do iq=1,nq
    23222335c              CALL writeg1d(ngrid,nlayer,zq(1,1,iq),noms(iq),'kg/kg')
    2323                call WRITEDIAGFI(ngridmx,trim(noms(iq)),
     2336               call WRITEDIAGFI(ngrid,trim(noms(iq)),
    23242337     &              trim(noms(iq)),'kg/kg',1,zq(1,1,iq))
    23252338            end do
    23262339           if (doubleq) then
    2327              call WRITEDIAGFI(ngridmx,'rdust','rdust',
     2340             call WRITEDIAGFI(ngrid,'rdust','rdust',
    23282341     &                        'm',1,rdust)
    23292342           endif
    23302343           if (water.AND.tifeedback) then
    2331              call WRITEDIAGFI(ngridmx,"soiltemp",
     2344             call WRITEDIAGFI(ngrid,"soiltemp",
    23322345     &                              "Soil temperature","K",
    23332346     &                              1,tsoil)
    2334              call WRITEDIAGFI(ngridmx,'soilti',
     2347             call WRITEDIAGFI(ngrid,'soilti',
    23352348     &                       'Soil Thermal Inertia',
    23362349     &                       'J.s-1/2.m-2.K-1',1,inertiesoil)
     
    23452358
    23462359             tauTES=0
    2347              do l=1,nlayermx
     2360             do l=1,nlayer
    23482361               Qabsice = min(
    23492362     &             max(0.4e6*rice(1,l)*(1.+nuice_ref)-0.05 ,0.),1.2
     
    23552368               tauTES=tauTES+ opTES(1,l)
    23562369             enddo
    2357              CALL WRITEDIAGFI(ngridmx,'tauTESap',
     2370             CALL WRITEDIAGFI(ngrid,'tauTESap',
    23582371     &                         'tau abs 825 cm-1',
    23592372     &                         '',0,tauTES)
    23602373           else
    23612374
    2362              CALL WRITEDIAGFI(ngridmx,'tauTES',
     2375             CALL WRITEDIAGFI(ngrid,'tauTES',
    23632376     &                         'tau abs 825 cm-1',
    23642377     &                         '',0,taucloudtes)
     
    23772390           h2otot = h2otot+mtot+icetot
    23782391
    2379              CALL WRITEDIAGFI(ngridmx,'h2otot',
     2392             CALL WRITEDIAGFI(ngrid,'h2otot',
    23802393     &                         'h2otot',
    23812394     &                         'kg/m2',0,h2otot)
    2382              CALL WRITEDIAGFI(ngridmx,'mtot',
     2395             CALL WRITEDIAGFI(ngrid,'mtot',
    23832396     &                         'mtot',
    23842397     &                         'kg/m2',0,mtot)
    2385              CALL WRITEDIAGFI(ngridmx,'icetot',
     2398             CALL WRITEDIAGFI(ngrid,'icetot',
    23862399     &                         'icetot',
    23872400     &                         'kg/m2',0,icetot)
     
    24012414
    24022415              Nccntot= 0
    2403               call watersat(ngridmx*nlayermx,zt,zplay,zqsat)
    2404                do l=1,nlayermx
     2416              call watersat(ngrid*nlayer,zt,zplay,zqsat)
     2417               do l=1,nlayer
    24052418                   Nccntot = Nccntot +
    24062419     &              zq(1,l,igcm_ccn_number)*tauscaling(1)
     
    24132426               call WRITEDIAGFI(ngrid,"satu","vap in satu","kg/kg",1,
    24142427     &                    satu)
    2415                CALL WRITEDIAGFI(ngridmx,'Nccntot',
     2428               CALL WRITEDIAGFI(ngrid,'Nccntot',
    24162429     &                         'Nccntot',
    24172430     &                         'nbr/m2',0,Nccntot)
    24182431
    2419              call WRITEDIAGFI(ngridmx,'zdqsed_dustq'
     2432             call WRITEDIAGFI(ngrid,'zdqsed_dustq'
    24202433     & ,'sedimentation q','kg.m-2.s-1',1,zdqsed(1,:,igcm_dust_mass))
    2421              call WRITEDIAGFI(ngridmx,'zdqsed_dustN'
     2434             call WRITEDIAGFI(ngrid,'zdqsed_dustN'
    24222435     &,'sedimentation N','Nbr.m-2.s-1',1,
    24232436     &                                 zdqsed(1,:,igcm_dust_number))
     
    24362449           endif ! of if (scavenging)
    24372450
    2438            CALL WRITEDIAGFI(ngridmx,'reffice',
     2451           CALL WRITEDIAGFI(ngrid,'reffice',
    24392452     &                      'reffice',
    24402453     &                      'm',0,rave)
    24412454
    24422455           do iq=1,nq
    2443              call WRITEDIAGFI(ngridmx,trim(noms(iq))//'_s',
     2456             call WRITEDIAGFI(ngrid,trim(noms(iq))//'_s',
    24442457     &            trim(noms(iq))//'_s','kg/kg',0,qsurf(1,iq))
    24452458           end do
    24462459     
    2447         call WRITEDIAGFI(ngridmx,'zdqcloud_ice','cloud ice',
     2460        call WRITEDIAGFI(ngrid,'zdqcloud_ice','cloud ice',
    24482461     &            'kg.m-2.s-1',1,zdqcloud(1,:,igcm_h2o_ice))
    2449         call WRITEDIAGFI(ngridmx,'zdqcloud_vap','cloud vap',
     2462        call WRITEDIAGFI(ngrid,'zdqcloud_vap','cloud vap',
    24502463     &            'kg.m-2.s-1',1,zdqcloud(1,:,igcm_h2o_vap))
    2451         call WRITEDIAGFI(ngridmx,'zdqcloud','cloud ice',
     2464        call WRITEDIAGFI(ngrid,'zdqcloud','cloud ice',
    24522465     &            'kg.m-2.s-1',1,zdqcloud(1,:,igcm_h2o_ice)
    24532466     &                          +zdqcloud(1,:,igcm_h2o_vap))
  • trunk/LMDZ.MARS/libf/phymars/read_dust_scenario.F90

    r677 r1047  
    44
    55use netcdf
     6use comgeomfi_h, only: lati, long
    67implicit none
    78
    89#include "dimensions.h"
    910#include "dimphys.h"
    10 #include "comgeomfi.h"
     11!#include "comgeomfi.h"
    1112#include "datafile.h"
    1213#include "callkeys.h"
  • trunk/LMDZ.MARS/libf/phymars/simpleclouds.F

    r1036 r1047  
    2929c                            of the typical CCN profile, Oct. 2011)
    3030c------------------------------------------------------------------
    31 #include "dimensions.h"
    32 #include "dimphys.h"
     31!#include "dimensions.h"
     32!#include "dimphys.h"
    3333#include "comcstfi.h"
    3434#include "callkeys.h"
    3535!#include "tracer.h"
    36 #include "comgeomfi.h"
    37 #include "dimradmars.h"
     36!#include "comgeomfi.h"
     37!#include "dimradmars.h"
     38! naerkind is set in scatterers.h (built when compiling with makegcm -s #)
     39#include"scatterers.h"
     40
    3841c------------------------------------------------------------------
    3942c     Arguments:
     
    5255      real pdq(ngrid,nlay,nq)    ! tendance avant condensation
    5356                                 !   (kg/kg.s-1)
    54       REAL tau(ngridmx,naerkind) ! Column dust optical depth at each point
     57      REAL tau(ngrid,naerkind)  ! Column dust optical depth at each point
    5558
    5659c     Output:
     
    6568c     Local variables:
    6669
    67       LOGICAL firstcall
    68       DATA firstcall/.true./
    69       SAVE firstcall
    70 
     70      LOGICAL,SAVE :: firstcall = .true.
    7171           
    72       REAL rhocloud(ngridmx,nlayermx)  ! Cloud density (kg.m-3)
     72      REAL rhocloud(ngrid,nlay)  ! Cloud density (kg.m-3)
    7373
    7474      INTEGER ig,l
    7575
    76       REAL zq(ngridmx,nlayermx,nq)    ! local value of tracers
    77       REAL zq0(ngridmx,nlayermx,nq)   ! local initial value of tracers
    78       REAL zt(ngridmx,nlayermx)       ! local value of temperature
    79       REAL zqsat(ngridmx,nlayermx)    ! saturation
     76      REAL zq(ngrid,nlay,nq)    ! local value of tracers
     77      REAL zq0(ngrid,nlay,nq)   ! local initial value of tracers
     78      REAL zt(ngrid,nlay)       ! local value of temperature
     79      REAL zqsat(ngrid,nlay)    ! saturation
    8080      REAL*8 dzq                      ! masse de glace echangee (kg/kg)
    8181      REAL lw                         !Latent heat of sublimation (J.kg-1)
    8282      REAL,PARAMETER :: To=273.15     ! reference temperature, T=273.15 K
    83       real rdusttyp(ngridmx,nlayermx) ! Typical dust geom. mean radius (m)
    84       REAL ccntyp(ngridmx,nlayermx)
     83      real rdusttyp(ngrid,nlay) ! Typical dust geom. mean radius (m)
     84      REAL ccntyp(ngrid,nlay)
    8585                                      ! Typical dust number density (#/kg)
    8686c     CCN reduction factor
     
    120120c     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    121121
    122       call watersat(ngridmx*nlayermx,zt,pplay,zqsat)
     122      call watersat(ngrid*nlay,zt,pplay,zqsat)
    123123
    124124c     taux de condensation (kg/kg/s-1) dans les differentes couches
     
    147147c     ~~~~~~~~~~~~~~~
    148148      do l=1, nlay
    149         do ig=1,ngridmx
     149        do ig=1,ngrid
    150150          pdqcloud(ig,l,igcm_h2o_vap)=(zq(ig,l,igcm_h2o_vap)
    151151     &                            -zq0(ig,l,igcm_h2o_vap))/ptimestep
     
    159159c     ice crystal radius
    160160      do l=1, nlay
    161         do ig=1,ngridmx
     161        do ig=1,ngrid
    162162          call updaterice_typ(zq(ig,l,igcm_h2o_ice),
    163163     &       tau(ig,1),pzlay(ig,l),rice(ig,l))
  • trunk/LMDZ.MARS/libf/phymars/soil.F

    r833 r1047  
    33     &          timestep,tsurf,tsoil,
    44     &          capcal,fluxgrd)
     5      use comsoil_h, only: layer, mlayer, volcapa
     6      use surfdat_h, only: watercaptag, inert_h2o_ice
    57      implicit none
    68
     
    1113
    1214!  Note: depths of layers and mid-layers, soil thermal inertia and
    13 !        heat capacity are commons in comsoil.h
     15!        heat capacity are commons in comsoil_h
    1416!-----------------------------------------------------------------------
    1517
     
    1719#include "dimphys.h"
    1820
    19 #include"comsoil.h"
     21!#include"comsoil.h"
    2022
    21 #include"surfdat.h"
     23!#include"surfdat.h"
    2224#include"callkeys.h"
    2325
     
    3840
    3941! local saved variables:
    40 !      real,save :: layer(ngridmx,nsoilmx)      ! layer depth
    41       real,save :: mthermdiff(ngridmx,0:nsoilmx-1) ! mid-layer thermal diffusivity
    42       real,save :: thermdiff(ngridmx,nsoilmx-1) ! inter-layer thermal diffusivity
    43       real,save :: coefq(0:nsoilmx-1)           ! q_{k+1/2} coefficients
    44       real,save :: coefd(ngridmx,nsoilmx-1)     ! d_k coefficients
    45       real,save :: alph(ngridmx,nsoilmx-1)      ! alpha_k coefficients
    46       real,save :: beta(ngridmx,nsoilmx-1)      ! beta_k coefficients
     42      real,save,allocatable :: mthermdiff(:,:)  ! mid-layer thermal diffusivity
     43      real,save,allocatable :: thermdiff(:,:)   ! inter-layer thermal diffusivity
     44      real,save,allocatable :: coefq(:)         ! q_{k+1/2} coefficients
     45      real,save,allocatable :: coefd(:,:)       ! d_k coefficients
     46      real,save,allocatable :: alph(:,:)        ! alpha_k coefficients
     47      real,save,allocatable :: beta(:,:)        ! beta_k coefficients
    4748      real,save :: mu
    4849     
     
    5152
    5253! 0. Initialisations and preprocessing step
     54      if (firstcall) then
     55        ! allocate local saved arrays:
     56        allocate(mthermdiff(ngrid,0:nsoil-1))
     57        allocate(thermdiff(ngrid,nsoil-1))
     58        allocate(coefq(0:nsoil-1))
     59        allocate(coefd(ngrid,nsoil-1))
     60        allocate(alph(ngrid,nsoil-1))
     61        allocate(beta(ngrid,nsoil-1))
     62      endif
     63     
    5364      if (firstcall.or.tifeedback) then
    5465      ! note: firstcall is set to .true. or .false. by the caller
  • trunk/LMDZ.MARS/libf/phymars/soil_settings.F

    r999 r1047  
    22
    33      use netcdf
     4      use comsoil_h, only: layer, mlayer, inertiedat, volcapa
    45      implicit none
    56
     
    3132!======================================================================
    3233
    33 #include "dimensions.h"
    34 #include "dimphys.h"
    35 
    36 #include "comsoil.h"
    37 !#include "netcdf.inc"
    3834!======================================================================
    3935!  arguments
    4036!  ---------
    4137!  inputs:
    42       integer nid       ! Input Netcdf file ID
    43       integer ngrid     ! # of horizontal grid points
    44       integer nsoil     ! # of soil layers
    45       real tsurf(ngrid) ! surface temperature
    46       integer indextime ! position on time axis
     38      integer,intent(in) :: nid ! Input Netcdf file ID
     39      integer,intent(in) :: ngrid       ! # of horizontal grid points
     40      integer,intent(in) :: nsoil       ! # of soil layers
     41      real,intent(in) :: tsurf(ngrid)  ! surface temperature
     42      integer,intent(in) :: indextime   ! position on time axis
    4743!  output:
    48       real tsoil(ngridmx,nsoilmx)       ! soil temperature
     44      real,intent(out) :: tsoil(ngrid,nsoil)    ! soil temperature
    4945
    5046!======================================================================
     
    184180      enddo
    185181
    186 ! 2. Volumetric heat capacity (note: it is declared in comsoil.h)
     182! 2. Volumetric heat capacity (note: it is declared in comsoil_h)
    187183! ---------------------------
    188184! "volcapa" is (so far) 0D and written in "controle" table of startfi file
     
    217213!      endif
    218214
    219 ! 3. Thermal inertia (note: it is declared in comsoil.h)
     215! 3. Thermal inertia (note: it is declared in comsoil_h)
    220216! ------------------
    221217
     
    306302        corner(2)=1
    307303        corner(3)=indextime
    308         edges(1)=ngridmx
    309         edges(2)=nsoilmx
     304        edges(1)=ngrid
     305        edges(2)=nsoil
    310306        edges(3)=1
    311307        !ierr=nf90_get_var(nid,nvarid,tsoil,corner,edges)
  • trunk/LMDZ.MARS/libf/phymars/soil_tifeedback.F

    r1036 r1047  
    22
    33      use tracer_mod, only: nqmx, igcm_h2o_ice, rho_ice
     4      use comsoil_h, only: layer, inertiedat
     5      use surfdat_h, only: watercaptag, inert_h2o_ice
    46      IMPLICIT NONE
    57
     
    1214c   - One layer of surface water ice (the thickness is given
    1315c     by the variable icecover (in kg of ice per m2) and the thermal
    14 c     inertia is prescribed by inert_h2o_ice (see surfdat.h and inifis));
     16c     inertia is prescribed by inert_h2o_ice (see surfdat_h and inifis));
    1517c   - A transitional layer of mixed thermal inertia;
    1618c   - A last layer of regolith below the ice cover whose thermal inertia
     
    2527#include "dimensions.h"
    2628#include "dimphys.h"
    27 #include "comsoil.h"
     29!#include "comsoil.h"
    2830!#include "tracer.h"
    29 #include "surfdat.h"
     31!#include "surfdat.h"
    3032
    3133c Local variables
  • trunk/LMDZ.MARS/libf/phymars/suaer.F90

    r411 r1047  
    11SUBROUTINE suaer
     2use dimradmars_mod, only: longrefvis, longrefir, nsizemax, long1vis, &
     3                         long2vis, long3vis, long1ir, long2ir, long1co2, &
     4                         long2co2, nsun, nir
     5use yomaer_h, only: radiustab, gvis, omegavis, QVISsQREF, gIR, omegaIR, &
     6                    QIRsQREF, QREFvis, QREFir, omegaREFvis, omegaREFir, &
     7                    nsize
    28IMPLICIT NONE
    39!==================================================================
     
    3440#include "callkeys.h"
    3541#include "datafile.h"
    36 #include "dimensions.h"
    37 #include "dimphys.h"
    38 #include "dimradmars.h"     
    39 #include "yomaer.h"
     42!#include "dimensions.h"
     43!#include "dimphys.h"
     44!#include "dimradmars.h"     
     45!#include "yomaer.h"
     46! naerkind is set in scatterers.h (built when compiling with makegcm -s #)
     47#include"scatterers.h"
    4048#include "aerkind.h"
    4149
     
    350358   write(*,*) "       nsizemax=",nsizemax
    351359   write(*,*) "       you must increase the value of nsizemax"
    352    write(*,*) "       in dimradmars.h !"
     360   write(*,*) "       in dimradmars_mod !"
    353361   stop
    354362 endif
     
    362370!   and not epref, which is a different parameter);
    363371!   Reference wavelengths are defined for each aerosol in
    364 !   dimradmars.h.
     372!   dimradmars_mod.
    365373
    366374  CALL aerave ( nwvl,&
     
    420428!   and not epref, which is a different parameter);
    421429!   Reference wavelengths are defined for each aerosol in
    422 !   dimradmars.h.
     430!   dimradmar_mod.
    423431
    424432  CALL aerave ( nwvl,&
     
    448456!         Single scattering properties
    449457!           in each of the "nir" bands
    450 !           (cf. dimradmars.h)
     458!           (cf. dimradmars_mod)
    451459
    452460! iir=1 : central 15um CO2 bands   
  • trunk/LMDZ.MARS/libf/phymars/surfini.F

    r1041 r1047  
    44      use netcdf
    55      use tracer_mod, only: nqmx, noms, dryness
     6      use comgeomfi_h, only: long, lati
     7      use surfdat_h, only: watercaptag, frost_albedo_threshold,
     8     &                     albedo_h2o_ice, inert_h2o_ice, albedodat,
     9     &                     albedice
    610      IMPLICIT NONE
    711c=======================================================================
     
    1418c   -------------
    1519#include "dimensions.h"
    16 #include "dimphys.h"
    17 #include "surfdat.h"
     20!#include "dimphys.h"
     21!#include "surfdat.h"
    1822#include "callkeys.h"
    1923!#include "tracer.h"
    20 #include "comgeomfi.h"
     24!#include "comgeomfi.h"
    2125#include "comcstfi.h"
    2226
     
    8488         alternate = 0
    8589         
    86          if (ngridmx .ne. 1) then
     90         if (ngrid .ne. 1) then
    8791           watercaptag(:) = .false.
    8892           longwatercaptag(:) = .false.
     
    98102#ifdef MESOSCALE
    99103
    100       do ig=1,ngridmx
     104      do ig=1,ngrid
    101105
    102106         !write(*,*) "all qsurf to zero. dirty."
     
    123127
    124128
    125       IF (ngridmx .eq. 1) THEN ! special case for 1d --> do nothing
    126      
    127          print*, 'ngridmx = 1, do no put ice caps in surfini.F'
     129      IF (ngrid .eq. 1) THEN ! special case for 1d --> do nothing
     130     
     131         print*, 'ngrid = 1, do no put ice caps in surfini.F'
    128132
    129133      ELSE IF (icelocationmode .eq. 1) THEN
     
    187191      !print*,'jjm,iim',jjm,iim ! jjm =  nb lati , iim = nb longi
    188192
    189       ! loop over the GCM grid - except for poles (ig=1 and ngridmx)
    190       do ig=2,ngridmx-1
     193      ! loop over the GCM grid - except for poles (ig=1 and ngrid)
     194      do ig=2,ngrid-1
    191195     
    192196        ! loop over the surface file grid     
     
    212216     &     lonice(1+mod(ig-2,iim),:) + nb_ice(ig,:) ! lonice is USELESS ...
    213217
    214       enddo ! of do ig=2,ngridmx-1
     218      enddo ! of do ig=2,ngrid-1
    215219     
    216220
     
    220224      latice(1,:)   = nb_ice(1,:)
    221225      lonice(1,:)   = nb_ice(1,:)
    222       latice(jjm,:) = nb_ice(ngridmx,:)
    223       lonice(iim,:) = nb_ice(ngridmx,:)
     226      latice(jjm,:) = nb_ice(ngrid,:)
     227      lonice(iim,:) = nb_ice(ngrid,:)
    224228     
    225229     
     
    319323
    320324           
    321         else if (ngridmx .ne. 1) then
     325        else if (ngrid .ne. 1) then
    322326       
    323327      print*,'No predefined ice location for this resolution :',iim,jjm
     
    328332        endif
    329333
    330         do ig=1,ngridmx
     334        do ig=1,ngrid
    331335          if (longwatercaptag(ig)) watercaptag(ig) = .true.
    332336        enddo
     
    337341        print*,'Surfini: ice caps defined by lat and lon values'
    338342
    339          do ig=1,ngridmx
     343         do ig=1,ngrid
    340344         
    341345c-------- Towards olympia planitia water caps -----------
     
    392396c--------------------------------------------------------
    393397c--------------------------------------------------------
    394       end do ! of (ngridmx)
     398      end do ! of (ngrid)
    395399
    396400
     
    406410        ! print caps locations - useful for plots too
    407411        print*,'latitude | longitude | ig'
    408         do ig=1,ngridmx
     412        do ig=1,ngrid
    409413          dryness (ig) = icedryness
    410414
  • trunk/LMDZ.MARS/libf/phymars/swmain.F

    r38 r1047  
    55     &                QVISsQREF3d,omegaVIS3d,gVIS3d)
    66
     7      use dimradmars_mod, only: ndlo2, ndlon, nflev, nsun
     8      use yomlw_h, only: nlaylte, gcp
    79      IMPLICIT NONE
    810     
    9 #include "dimensions.h"
    10 #include "dimphys.h"
    11 #include "dimradmars.h"
     11!#include "dimensions.h"
     12!#include "dimphys.h"
     13!#include "dimradmars.h"
    1214
    13 #include "yomaer.h"
    14 #include "yomlw.h"
     15!#include "yomaer.h"
     16!#include "yomlw.h"
     17! naerkind is set in scatterers.h (built when compiling with makegcm -s #)
     18#include"scatterers.h"
    1519#include "callkeys.h"
    1620c     
     
    4246c   aerosol               aerosol extinction optical depth
    4347c                         at reference wavelength "longrefvis" set
    44 c                         in dimradmars.h , in each layer, for one of
     48c                         in dimradmars_mod , in each layer, for one of
    4549c                         the "naerkind" kind of aerosol optical properties.
    4650c    Pfract :        day fraction of the time interval
     
    134138C------------------------------------------------------------------
    135139c  2 spectral interval in solar spectrum :
    136 c  - INU=1: between wavelength "long1vis" and "long2vis" set in dimradmars.h
    137 c  - INU=2: between wavelength "long2vis" and "long3vis" set in dimradmars.h
     140c  - INU=1: between wavelength "long1vis" and "long2vis" set in dimradmars_mod
     141c  - INU=2: between wavelength "long2vis" and "long3vis" set in dimradmars_mod
    138142
    139143      DO INU = 1,2
  • trunk/LMDZ.MARS/libf/phymars/swr_fouquart.F

    r38 r1047  
    44     S     ,  PFD,PFU )
    55
     6      use dimradmars_mod, only: sunfr, ndlo2, nsun, ndlon, nflev
     7      use yomlw_h, only: nlaylte
    68      IMPLICIT NONE
    79C     
    8 #include "dimensions.h"
    9 #include "dimphys.h"
    10 #include "dimradmars.h"
     10!#include "dimensions.h"
     11!#include "dimphys.h"
     12!#include "dimradmars.h"
    1113#include "callkeys.h"
    12 
    13 #include "yomaer.h"
    14 #include "yomlw.h"
     14! naerkind is set in scatterers.h (built when compiling with makegcm -s #)
     15#include"scatterers.h"
     16!#include "yomaer.h"
     17!#include "yomlw.h"
    1518
    1619C     
     
    3740c   aerosol               aerosol extinction optical depth
    3841c                         at reference wavelength "longrefvis" set
    39 c                         in dimradmars.h , in each layer, for one of
     42c                         in dimradmars_mod , in each layer, for one of
    4043c                         the "naerkind" kind of aerosol optical properties.
    4144c    albedo   hemispheric surface albedo
     
    378381      SUBROUTINE DEDD (KDLON,PGG,PREF,PRMUZ,PTO1,PW
    379382     S                ,      PRE1,PRE2,PTR1,PTR2         )
     383      use dimradmars_mod, only: ndlo2
    380384      implicit none
    381385C
    382 #include "dimensions.h"
    383 #include "dimphys.h"
    384 #include "dimradmars.h"
     386!#include "dimensions.h"
     387!#include "dimphys.h"
     388!#include "dimradmars.h"
    385389C
    386390C**** *DEDD* - DELTA-EDDINGTON IN A CLOUDY LAYER
  • trunk/LMDZ.MARS/libf/phymars/swr_toon.F

    r38 r1047  
    44     S     ,  PFD,PFU )
    55
     6      use dimradmars_mod, only: sunfr, ndlo2, nsun, nflev, ndlon
     7      use yomlw_h, only: nlaylte
     8     
    69      IMPLICIT NONE
    710C     
    8 #include "dimensions.h"
    9 #include "dimphys.h"
    10 #include "dimradmars.h"
     11!#include "dimensions.h"
     12!#include "dimphys.h"
     13!#include "dimradmars.h"
    1114#include "callkeys.h"
    12 
    13 #include "yomaer.h"
    14 #include "yomlw.h"
     15! naerkind is set in scatterers.h (built when compiling with makegcm -s #)
     16#include"scatterers.h"
     17!#include "yomaer.h"
     18!#include "yomlw.h"
    1519
    1620C     
     
    3640c   aerosol               aerosol extinction optical depth
    3741c                         at reference wavelength "longrefvis" set
    38 c                         in dimradmars.h , in each layer, for one of
     42c                         in dimradmars_mod , in each layer, for one of
    3943c                         the "naerkind" kind of aerosol optical properties.
    4044c    albedo   hemispheric surface albedo
  • trunk/LMDZ.MARS/libf/phymars/tabfi.F

    r672 r1047  
    4343c
    4444c=======================================================================
    45  
     45
     46      use comsoil_h, only: volcapa ! soil volumetric heat capacity
     47      use surfdat_h, only: z0_default, emissiv, emisice, albedice,
     48     &                     iceradius, dtemisice, iceradius
     49      use yomaer_h, only: tauvis
    4650      implicit none
    4751 
    48 #include "dimensions.h"
    49 #include "dimphys.h"
     52!#include "dimensions.h"
     53!#include "dimphys.h"
    5054#include "comcstfi.h"
    51 #include "comgeomfi.h"
     55!#include "comgeomfi.h"
    5256#include "planete.h"
    53 #include "surfdat.h"
    54 #include "comsoil.h"
     57!#include "surfdat.h"
     58!#include "comsoil.h"
    5559#include "netcdf.inc"
    56 #include "dimradmars.h"
    57 #include "yomaer.h"
     60!#include "dimradmars.h"
     61!#include "yomaer.h"
    5862
    5963c-----------------------------------------------------------------------
     
    165169c  Initialization of some physical constants
    166170c informations on physics grid
    167       if(ngridmx.ne.tab_cntrl(tab0+1)) then
    168          print*,'tabfi: WARNING !!! tab_cntrl(tab0+1).ne.ngridmx'
    169          print*,tab_cntrl(tab0+1),ngridmx
    170       endif
     171!      if(ngridmx.ne.tab_cntrl(tab0+1)) then
     172!         print*,'tabfi: WARNING !!! tab_cntrl(tab0+1).ne.ngridmx'
     173!         print*,tab_cntrl(tab0+1),ngridmx
     174!      endif
    171175      lmax = nint(tab_cntrl(tab0+2))
    172176      day_ini = tab_cntrl(tab0+3)
     
    225229      write(*,*) 'Reading tab_cntrl when calling tabfi before changes'
    226230      write(*,*) '*****************************************************'
    227       write(*,5) '(1)      = ngridmx?',tab_cntrl(tab0+1),real(ngridmx)
     231      write(*,5) '(1)      = ngridmx?',tab_cntrl(tab0+1)!,real(ngridmx)
    228232      write(*,5) '(2)            lmax',tab_cntrl(tab0+2),real(lmax)
    229233      write(*,5) '(3)         day_ini',tab_cntrl(tab0+3),real(day_ini)
     
    491495      write(*,*) 'Reading tab_cntrl when calling tabfi AFTER changes'
    492496      write(*,*) '*****************************************************'
    493       write(*,5) '(1)      = ngridmx?',tab_cntrl(tab0+1),real(ngridmx)
     497      write(*,5) '(1)      = ngridmx?',tab_cntrl(tab0+1)!,real(ngridmx)
    494498      write(*,5) '(2)            lmax',tab_cntrl(tab0+2),real(lmax)
    495499      write(*,5) '(3)         day_ini',tab_cntrl(tab0+3),real(day_ini)
  • trunk/LMDZ.MARS/libf/phymars/testphys1d.F

    r1036 r1047  
    44      USE ioipsl_getincom, only: getin
    55      use infotrac, only: nqtot, tnom
     6      use comsoil_h, only: volcapa, layer, mlayer, inertiedat
     7      use comgeomfi_h, only: lati, long, area
     8      use comdiurn_h, only: sinlat
     9      use surfdat_h, only: albedodat, z0_default, emissiv, emisice,
     10     &                     albedice, iceradius, dtemisice, z0,
     11     &                     zmea, zstd, zsig, zgam, zthe, phisfi,
     12     &                     watercaptag
     13      use slope_mod, only: theta_sl, psi_sl
     14      use yomaer_h, only: tauvis
    615      IMPLICIT NONE
    716
     
    2736#include "dimensions.h"
    2837#include "dimphys.h"
    29 #include "dimradmars.h"
    30 #include "comgeomfi.h"
    31 #include "surfdat.h"
    32 #include "slope.h"
    33 #include "comsoil.h"
    34 #include "comdiurn.h"
     38!#include "dimradmars.h"
     39!#include "comgeomfi.h"
     40!#include "surfdat.h"
     41!#include "slope.h"
     42!#include "comsoil.h"
     43!#include "comdiurn.h"
    3544#include "callkeys.h"
    3645#include "comcstfi.h"
    3746#include "planete.h"
    38 #include "comsaison.h"
    39 #include "yomaer.h"
     47!#include "comsaison.h"
     48!#include "yomaer.h"
    4049#include "control.h"
    4150#include "comvert.h"
     
    91100      Logical  tracerdyn
    92101      integer :: nq=1 ! number of tracers
     102      real :: latitude, longitude
    93103
    94104      character*2 str2
     
    447457c  latitude/longitude
    448458c  ------------------
    449       lati(1)=0 ! default value for lati(1)
     459      latitude=0 ! default value for latitude
    450460      PRINT *,'latitude (in degrees) ?'
    451       call getin("latitude",lati(1))
    452       write(*,*) " latitude = ",lati(1)
    453       lati(1)=lati(1)*pi/180.E+0
    454       long(1)=0.E+0
    455       long(1)=long(1)*pi/180.E+0
     461      call getin("latitude",latitude)
     462      write(*,*) " latitude = ",latitude
     463      latitude=latitude*pi/180.E+0
     464      longitude=0.E+0
     465      longitude=longitude*pi/180.E+0
     466
     467!  "inifis" does some initializations (some of which have already been
     468!  done above!) and loads parameters set in callphys.def
     469!  and allocates some arrays
     470!Mars possible matter with dtphys in input and include!!!
     471      CALL inifis(1,llm,nq,day0,daysec,dtphys,
     472     &            latitude,longitude,1.0,rad,g,r,cpp)
     473
    456474
    457475c  Initialize albedo / soil thermal inertia
     
    502520c   everything is controled by surface pressure
    503521      phisfi(1)=0.E+0
    504 
    505 c  "inifis" does some initializations (some of which have already been
    506 c  done above!) and loads parameters set in callphys.def
    507 
    508 !Mars possible matter with dtphys in input and include!!!
    509       CALL inifis(1,llm,nq,day0,daysec,dtphys,
    510      .            lati,long,area,rad,g,r,cpp)
    511522
    512523c   Initialization to take into account prescribed winds
     
    629640c Check if the surface is a water ice reservoir
    630641c --------------------------------------------------
    631       watercaptag(ngridmx)=.false. ! Default: no water ice reservoir
     642      watercaptag(1)=.false. ! Default: no water ice reservoir
    632643      print *,'Water ice cap on ground ?'
    633644      call getin("watercaptag",watercaptag)
     
    652663c  It is needed to transfert physics variables to "physiq"...
    653664
    654       call physdem0("startfi.nc",long,lati,nsoilmx,nq,
     665      call physdem0("startfi.nc",long,lati,nsoilmx,ngridmx,llm,nq,
    655666     .              dtphys,float(day0),time,area,
    656667     .              albedodat,inertiedat,zmea,zstd,zsig,zgam,zthe)
    657       call physdem1("startfi.nc",nsoilmx,nq,
     668      call physdem1("startfi.nc",nsoilmx,ngridmx,llm,nq,
    658669     .              dtphys,time,
    659670     .              tsurf,tsoil,co2ice,emis,q2,qsurf)
  • trunk/LMDZ.MARS/libf/phymars/updatereffrad.F

    r1036 r1047  
    3030c    -------------
    3131c
    32 #include "dimensions.h"
    33 #include "dimphys.h"
     32!#include "dimensions.h"
     33!#include "dimphys.h"
    3434#include "comcstfi.h"
    3535#include "callkeys.h"
    36 #include "dimradmars.h"
     36!#include "dimradmars.h"
    3737!#include "tracer.h"
     38! naerkind is set in scatterers.h (built when compiling with makegcm -s #)
     39#include"scatterers.h"
    3840#include "aerkind.h"
    39 #include "yomaer.h"
     41!#include "yomaer.h"
    4042
    4143c-----------------------------------------------------------------------
     
    4547      INTEGER ngrid,nlayer
    4648c     Ice geometric mean radius (m)
    47       REAL :: rice(ngridmx,nlayermx)
     49      REAL :: rice(ngrid,nlayer)
    4850c     Estimated effective variance of the size distribution (n.u.)
    49       REAL :: nuice(ngridmx,nlayermx)
     51      REAL :: nuice(ngrid,nlayer)
    5052c     Tracer mass mixing ratio (kg/kg)
    5153      REAL pq(ngrid,nlayer,nqmx)
    52       REAL rdust(ngridmx,nlayermx) ! Dust geometric mean radius (m)
     54      REAL rdust(ngrid,nlayer) ! Dust geometric mean radius (m)
    5355     
    5456      REAL pplay(ngrid,nlayer) ! altitude at the middle of the layers
     
    6062
    6163c     Aerosol effective radius used for radiative transfer (meter)
    62       REAL :: reffrad(ngridmx,nlayermx,naerkind)
     64      REAL :: reffrad(ngrid,nlayer,naerkind)
    6365c     Aerosol effective variance used for radiative transfer (n.u.)
    64       REAL :: nueffrad(ngridmx,nlayermx,naerkind)
     66      REAL :: nueffrad(ngrid,nlayer,naerkind)
    6567
    6668c     Local variables:
     
    7981c     For microphysics only:     
    8082      REAL Mo,No                       ! Mass and number of ccn
    81       REAL rhocloud(ngridmx,nlayermx)  ! Cloud density (kg.m-3)
    82       REAL tauscaling(ngridmx)         ! Convertion factor for qccn and Nccn
    83 
    84       LOGICAL firstcall
    85       DATA firstcall/.true./
    86       SAVE firstcall
     83      REAL rhocloud(ngrid,nlayer)  ! Cloud density (kg.m-3)
     84      REAL tauscaling(ngrid)         ! Convertion factor for qccn and Nccn
     85
     86      LOGICAL,SAVE :: firstcall=.true. , firstcall_alloc=.true.
    8787
    8888      REAL CBRT
    8989      EXTERNAL CBRT
    9090
    91       REAL,SAVE :: nueffdust(ngridmx,nlayermx) ! Dust effective variance
     91      REAL,SAVE,ALLOCATABLE :: nueffdust(:,:) ! Dust effective variance
    9292
    9393c     Local saved variables:
    9494c     ---------------------
    9595
     96        if (firstcall_alloc) then
     97          !allocate local saved arrays:
     98          allocate(nueffdust(ngrid,nlayer))
     99          firstcall_alloc=.false.
     100        endif
    96101
    97102c==================================================================
  • trunk/LMDZ.MARS/libf/phymars/vdif_kc.F

    r1036 r1047  
    1       SUBROUTINE vdif_kc(dt,g,zlev,zlay,u,v,teta,cd,q2,km,kn,zq)
    2 
    3       use tracer_mod, only: nqmx, noms
     1      SUBROUTINE vdif_kc(ngrid,nlay,nq,dt,g,
     2     &                   zlev,zlay,u,v,teta,cd,q2,km,kn,zq)
     3
     4      use tracer_mod, only: noms
    45      IMPLICIT NONE
    56c.......................................................................
    6 #include "dimensions.h"
    7 #include "dimphys.h"
     7!#include "dimensions.h"
     8!#include "dimphys.h"
    89!#include "tracer.h"
    910#include "callkeys.h"
     
    3233c.......................................................................
    3334      REAL dt,g
    34       REAL zlev(ngridmx,nlayermx+1)
    35       REAL zlay(ngridmx,nlayermx)
    36       REAL u(ngridmx,nlayermx)
    37       REAL v(ngridmx,nlayermx)
    38       REAL teta(ngridmx,nlayermx)
    39       REAL cd(ngridmx)
    40       REAL q2(ngridmx,nlayermx+1)
    41       REAL km(ngridmx,nlayermx+1)
    42       REAL kn(ngridmx,nlayermx+1)
    43       REAL zq(ngridmx,nlayermx,nqmx)
     35      REAL zlev(ngrid,nlay+1)
     36      REAL zlay(ngrid,nlay)
     37      REAL u(ngrid,nlay)
     38      REAL v(ngrid,nlay)
     39      REAL teta(ngrid,nlay)
     40      REAL cd(ngrid)
     41      REAL q2(ngrid,nlay+1)
     42      REAL km(ngrid,nlay+1)
     43      REAL kn(ngrid,nlay+1)
     44      REAL zq(ngrid,nlay,nq)
    4445c.......................................................................
    4546c
     
    5455c
    5556c.......................................................................
    56       INTEGER nlay,nlev,ngrid
    57       REAL unsdz(ngridmx,nlayermx)
    58       REAL unsdzdec(ngridmx,nlayermx+1)
    59       REAL q(ngridmx,nlayermx+1)
     57      INTEGER,INTENT(IN) :: nlay,ngrid,nq
     58      INTEGER nlev
     59      REAL unsdz(ngrid,nlay)
     60      REAL unsdzdec(ngrid,nlay+1)
     61      REAL q(ngrid,nlay+1)
    6062c.......................................................................
    6163c
     
    6769c
    6870c.......................................................................
    69       REAL kmpre(ngridmx,nlayermx+1)
     71      REAL kmpre(ngrid,nlay+1)
    7072      REAL qcstat
    7173      REAL q2cstat
     
    7577c
    7678c.......................................................................
    77       REAL long(ngridmx,nlayermx+1)
     79      REAL long(ngrid,nlay+1)
    7880c.......................................................................
    7981c
     
    98100      REAL mcstat
    99101      REAL m2cstat
    100       REAL m(ngridmx,nlayermx+1)
    101       REAL mpre(ngridmx,nlayermx+1)
    102       REAL m2(ngridmx,nlayermx+1)
    103       REAL n2(ngridmx,nlayermx+1)
     102      REAL m(ngrid,nlay+1)
     103      REAL mpre(ngrid,nlay+1)
     104      REAL m2(ngrid,nlay+1)
     105      REAL n2(ngrid,nlay+1)
    104106c.......................................................................
    105107c
     
    123125      LOGICAL gnsup
    124126      REAL gm
    125 c      REAL ri(ngridmx,nlayermx+1)
    126       REAL sn(ngridmx,nlayermx+1)
    127       REAL snq2(ngridmx,nlayermx+1)
    128       REAL sm(ngridmx,nlayermx+1)
    129       REAL smq2(ngridmx,nlayermx+1)
     127c      REAL ri(ngrid,nlay+1)
     128      REAL sn(ngrid,nlay+1)
     129      REAL snq2(ngrid,nlay+1)
     130      REAL sm(ngrid,nlay+1)
     131      REAL smq2(ngrid,nlay+1)
    130132c.......................................................................
    131133c
     
    186188      PARAMETER (q2min=1.E-3)
    187189      PARAMETER (q2max=1.E+2)
    188       PARAMETER (nlay=nlayermx)
    189       PARAMETER (nlev=nlayermx+1)
    190       PARAMETER (ngrid=ngridmx)
    191190c
    192191      PARAMETER (
     
    219218      save firstcall
    220219      data firstcall/.true./
    221       REAL zhc(ngridmx,nlayermx)
     220      REAL zhc(ngrid,nlay)
    222221c.......................................................................
    223222c  Initialization
     
    228227        if (tracer) then
    229228!     Prepare Special treatment if one of the tracers is CO2 gas
    230            do iq=1,nqmx
     229           do iq=1,nq
    231230             if (noms(iq).eq."co2") then
    232231                ico2=iq
     
    246245      endif !of if firstcall
    247246
     247      nlev=nlay+1
     248     
    248249c.......................................................................
    249250c  Special treatment for co2
  • trunk/LMDZ.MARS/libf/phymars/vdifc.F

    r1036 r1047  
    1313      use tracer_mod, only: noms, igcm_dust_mass, igcm_dust_number,
    1414     &                      igcm_dust_submicron, igcm_h2o_vap,
    15      &                      igcm_h2o_ice, dryness, alpha_lift, nqmx
     15     &                      igcm_h2o_ice, dryness, alpha_lift
     16      use surfdat_h, only: watercaptag, frost_albedo_threshold
    1617      IMPLICIT NONE
    1718
     
    3637c   -------------
    3738
    38 #include "dimensions.h"
    39 #include "dimphys.h"
     39!#include "dimensions.h"
     40!#include "dimphys.h"
    4041#include "comcstfi.h"
    4142#include "callkeys.h"
    42 #include "surfdat.h"
    43 #include "comgeomfi.h"
     43!#include "surfdat.h"
     44!#include "comgeomfi.h"
    4445!#include "tracer.h"
    4546#include "microphys.h"
     
    8586c   ------
    8687
    87       REAL ust(ngridmx),tst(ngridmx)
     88      REAL ust(ngrid),tst(ngrid)
    8889 
    8990      INTEGER ilev,ig,ilay,nlev
    9091
    91       REAL z4st,zdplanck(ngridmx)
    92       REAL zkv(ngridmx,nlayermx+1),zkh(ngridmx,nlayermx+1)
    93       REAL zkq(ngridmx,nlayermx+1)
    94       REAL zcdv(ngridmx),zcdh(ngridmx)
    95       REAL zcdv_true(ngridmx),zcdh_true(ngridmx)    ! drag coeff are used by the LES to recompute u* and hfx
    96       REAL zu(ngridmx,nlayermx),zv(ngridmx,nlayermx)
    97       REAL zh(ngridmx,nlayermx)
    98       REAL ztsrf2(ngridmx)
    99       REAL z1(ngridmx),z2(ngridmx)
    100       REAL za(ngridmx,nlayermx),zb(ngridmx,nlayermx)
    101       REAL zb0(ngridmx,nlayermx)
    102       REAL zc(ngridmx,nlayermx),zd(ngridmx,nlayermx)
     92      REAL z4st,zdplanck(ngrid)
     93      REAL zkv(ngrid,nlay+1),zkh(ngrid,nlay+1)
     94      REAL zkq(ngrid,nlay+1)
     95      REAL zcdv(ngrid),zcdh(ngrid)
     96      REAL zcdv_true(ngrid),zcdh_true(ngrid)    ! drag coeff are used by the LES to recompute u* and hfx
     97      REAL zu(ngrid,nlay),zv(ngrid,nlay)
     98      REAL zh(ngrid,nlay)
     99      REAL ztsrf2(ngrid)
     100      REAL z1(ngrid),z2(ngrid)
     101      REAL za(ngrid,nlay),zb(ngrid,nlay)
     102      REAL zb0(ngrid,nlay)
     103      REAL zc(ngrid,nlay),zd(ngrid,nlay)
    103104      REAL zcst1
    104       REAL zu2(ngridmx)
     105      REAL zu2(ngrid)
    105106
    106107      EXTERNAL SSUM,SCOPY
     
    111112c     variable added for CO2 condensation:
    112113c     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    113       REAL hh , zhcond(ngridmx,nlayermx)
    114       REAL latcond,tcond1mb
    115       REAL acond,bcond
    116       SAVE acond,bcond
    117       DATA latcond,tcond1mb/5.9e5,136.27/
     114      REAL hh , zhcond(ngrid,nlay)
     115      REAL,PARAMETER :: latcond=5.9e5
     116      REAL,PARAMETER :: tcond1mb=136.27
     117      REAL,SAVE :: acond,bcond
    118118     
    119119c     For latent heat release from ground ice sublimation   
    120 !      REAL tsrf_lw(ngridmx)
     120!      REAL tsrf_lw(ngrid)
    121121!      REAL alpha
    122122      REAL T1,T2
     
    127127c    ~~~~~~~
    128128      INTEGER iq
    129       REAL zq(ngridmx,nlayermx,nqmx)
    130       REAL zq1temp(ngridmx)
    131       REAL rho(ngridmx) ! near surface air density
    132       REAL qsat(ngridmx)
     129      REAL zq(ngrid,nlay,nq)
     130      REAL zq1temp(ngrid)
     131      REAL rho(ngrid) ! near surface air density
     132      REAL qsat(ngrid)
    133133
    134134      REAL kmixmin
     
    138138
    139139      INTEGER j,l
    140       REAL zcondicea(ngrid,nlayermx)
    141       REAL zt(ngridmx,nlayermx),ztcond(ngridmx,nlayermx+1)
    142       REAL betam(ngridmx,nlayermx),dmice(ngridmx,nlayermx)
    143       REAL pdtc(ngrid,nlayermx)
    144       REAL zhs(ngridmx,nlayermx)
    145       REAL ccond
    146       SAVE ccond
     140      REAL zcondicea(ngrid,nlay)
     141      REAL zt(ngrid,nlay),ztcond(ngrid,nlay+1)
     142      REAL betam(ngrid,nlay),dmice(ngrid,nlay)
     143      REAL pdtc(ngrid,nlay)
     144      REAL zhs(ngrid,nlay)
     145      REAL,SAVE :: ccond
    147146
    148147c     Theta_m formulation for mass-variation scheme :
    149148c     ~~~~~~~
    150149
    151       INTEGER ico2,llnt(ngridmx)
    152       SAVE ico2
    153       REAL m_co2, m_noco2, A , B
    154       SAVE A, B, m_co2, m_noco2
    155       REAL vmr_co2(ngridmx,nlayermx)
     150      INTEGER,SAVE :: ico2
     151      INTEGER llnt(ngrid)
     152      REAL,SAVE :: m_co2, m_noco2, A , B
     153      REAL vmr_co2(ngrid,nlay)
    156154      REAL qco2,mmean
    157155
    158       REAL sensibFlux(ngridmx)
     156      REAL,INTENT(OUT) :: sensibFlux(ngrid)
    159157
    160158#ifdef MESOSCALE
     
    165163
    166164      IF (firstcall) THEN
    167          IF(ngrid.NE.ngridmx) THEN
    168             PRINT*,'STOP dans vdifc'
    169             PRINT*,'probleme de dimensions :'
    170             PRINT*,'ngrid  =',ngrid
    171             PRINT*,'ngridmx  =',ngridmx
    172             STOP
    173          ENDIF
    174165c        To compute: Tcond= 1./(bcond-acond*log(.0095*p)) (p in pascal)
    175166         bcond=1./tcond1mb
     
    372363! Some usefull diagnostics for the new surface layer parametrization :
    373364
    374 !        call WRITEDIAGFI(ngridmx,'pcdv',
     365!        call WRITEDIAGFI(ngrid,'pcdv',
    375366!     &              'momentum drag','no units',
    376367!     &                         2,zcdv_true)
    377 !        call WRITEDIAGFI(ngridmx,'pcdh',
     368!        call WRITEDIAGFI(ngrid,'pcdh',
    378369!     &              'heat drag','no units',
    379370!     &                         2,zcdh_true)
    380 !        call WRITEDIAGFI(ngridmx,'ust',
     371!        call WRITEDIAGFI(ngrid,'ust',
    381372!     &              'friction velocity','m/s',2,ust)
    382 !       call WRITEDIAGFI(ngridmx,'tst',
     373!       call WRITEDIAGFI(ngrid,'tst',
    383374!     &              'friction temperature','K',2,tst)
    384 !        call WRITEDIAGFI(ngridmx,'rm-1',
     375!        call WRITEDIAGFI(ngrid,'rm-1',
    385376!     &              'aerodyn momentum conductance','m/s',
    386377!     &                         2,zcdv)
    387 !        call WRITEDIAGFI(ngridmx,'rh-1',
     378!        call WRITEDIAGFI(ngrid,'rh-1',
    388379!     &              'aerodyn heat conductance','m/s',
    389380!     &                         2,zcdh)
     
    693684c       Calcul du flux vertical au bas de la premiere couche (dust) :
    694685c       -----------------------------------------------------------
    695         do ig=1,ngridmx 
     686        do ig=1,ngrid 
    696687          rho(ig) = zb0(ig,1) /ptimestep
    697688c          zb(ig,1) = 0.
     
    740731c       ----------------------------------------
    741732        if (water) then
    742             call watersat(ngridmx,ptsrf,pplev(1,1),qsat)
     733            call watersat(ngrid,ptsrf,pplev(1,1),qsat)
    743734        end if
    744735
  • trunk/LMDZ.MARS/libf/phymars/vlz_fi.F

    r38 r1047  
    1       SUBROUTINE vlz_fi(ngrid,q,pente_max,masse,w,wq)
     1      SUBROUTINE vlz_fi(ngrid,nlay,q,pente_max,masse,w,wq)
    22c
    33c     Auteurs:   P.Le Van, F.Hourdin, F.Forget
     
    1616      IMPLICIT NONE
    1717c
    18 #include "dimensions.h"
    19 #include "dimphys.h"
     18!#include "dimensions.h"
     19!#include "dimphys.h"
    2020
    2121c
     
    2323c   Arguments:
    2424c   ----------
    25       integer ngrid
    26       real masse(ngrid,llm),pente_max
    27       REAL q(ngrid,llm)
    28       REAL w(ngrid,llm)
    29       REAL wq(ngrid,llm+1)
     25      integer,intent(in) :: ngrid ! number of atmospheric columns
     26      integer,intent(in) :: nlay ! number of atmospheric layers
     27      real masse(ngrid,nlay),pente_max
     28      REAL q(ngrid,nlay)
     29      REAL w(ngrid,nlay)
     30      REAL wq(ngrid,nlay+1)
    3031c
    3132c      Local
     
    3536c
    3637
    37       real dzq(ngridmx,llm),dzqw(ngridmx,llm),adzqw(ngridmx,llm),dzqmax
     38      real dzq(ngrid,nlay),dzqw(ngrid,nlay),adzqw(ngrid,nlay),dzqmax
    3839      real newmasse
    3940      real sigw, Mtot, MQtot
     
    4748c    sens de W
    4849
    49       do l=2,llm
     50      do l=2,nlay
    5051         do ij=1,ngrid
    5152            dzqw(ij,l)=q(ij,l-1)-q(ij,l)
     
    5455      enddo
    5556
    56       do l=2,llm-1
     57      do l=2,nlay-1
    5758         do ij=1,ngrid
    5859#ifdef CRAY
     
    7374      do ij=1,ngrid
    7475         dzq(ij,1)=0.
    75          dzq(ij,llm)=0.
     76         dzq(ij,nlay)=0.
    7677      enddo
    7778c ---------------------------------------------------------------
     
    8384c      No flux at the model top:
    8485       do ij=1,ngrid
    85           wq(ij,llm+1)=0.
     86          wq(ij,nlay+1)=0.
    8687       enddo
    8788
     
    8990c      ===============================
    9091
    91        do l = 1,llm          ! loop different than when w<0
     92       do l = 1,nlay          ! loop different than when w<0
    9293        do  ij = 1,ngrid
    9394
     
    107108            Mtot = masse(ij,m)
    108109            MQtot = masse(ij,m)*q(ij,m)
    109             if(m.ge.llm)goto 88
     110            if(m.ge.nlay)goto 88
    110111            do while(w(ij,l).gt.(Mtot+masse(ij,m+1)))
    111112                m=m+1
    112113                Mtot = Mtot + masse(ij,m)
    113114                MQtot = MQtot + masse(ij,m)*q(ij,m)
    114                 if(m.ge.llm)goto 88
     115                if(m.ge.nlay)goto 88
    115116            end do
    116117 88         continue
    117             if (m.lt.llm) then
     118            if (m.lt.nlay) then
    118119                sigw=(w(ij,l)-Mtot)/masse(ij,m+1)
    119120                wq(ij,l)=(MQtot + (w(ij,l)-Mtot)*
     
    137138       end do
    138139
    139        do l = 1,llm-1  ! loop different than when w>0
     140       do l = 1,nlay-1  ! loop different than when w>0
    140141        do  ij = 1,ngrid
    141142         if(w(ij,l+1).le.0)then
     
    176177 99    continue
    177178
    178       do l=1,llm
     179      do l=1,nlay
    179180         do ij=1,ngrid
    180181
  • trunk/LMDZ.MARS/libf/phymars/watercloud.F

    r1036 r1047  
    3434c   -------------
    3535
    36 #include "dimensions.h"
    37 #include "dimphys.h"
     36!#include "dimensions.h"
     37!#include "dimphys.h"
    3838#include "comcstfi.h"
    3939#include "callkeys.h"
    4040!#include "tracer.h"
    41 #include "comgeomfi.h"
    42 #include "dimradmars.h"
     41!#include "comgeomfi.h"
     42!#include "dimradmars.h"
     43! naerkind is set in scatterers.h (built when compiling with makegcm -s #)
     44#include"scatterers.h"
    4345
    4446c   Inputs:
     
    5860      real pdq(ngrid,nlay,nq)    ! tendence avant condensation  (kg/kg.s-1)
    5961
    60       REAL tau(ngridmx,naerkind) ! Column dust optical depth at each point
    61       REAL tauscaling(ngridmx)   ! Convertion factor for dust amount
    62       real rdust(ngridmx,nlay)   ! Dust geometric mean radius (m)
     62      REAL tau(ngrid,naerkind) ! Column dust optical depth at each point
     63      REAL tauscaling(ngrid)   ! Convertion factor for dust amount
     64      real rdust(ngrid,nlay)   ! Dust geometric mean radius (m)
    6365
    6466c   Outputs:
     
    7375      REAL nuice(ngrid,nlay)   ! Estimated effective variance
    7476                               !   of the size distribution
    75       real rsedcloud(ngridmx,nlay) ! Cloud sedimentation radius
    76       real rhocloud(ngridmx,nlay)  ! Cloud density (kg.m-3)
     77      real rsedcloud(ngrid,nlay) ! Cloud sedimentation radius
     78      real rhocloud(ngrid,nlay)  ! Cloud density (kg.m-3)
    7779
    7880c   local:
     
    106108
    107109      IF (firstcall) THEN
    108         IF(ngrid.NE.ngridmx) THEN
    109             PRINT*,'STOP dans watercloud'
    110             PRINT*,'probleme de dimensions :'
    111             PRINT*,'ngrid  =',ngrid
    112             PRINT*,'ngridmx  =',ngridmx
    113             STOP
    114         ENDIF
    115110         
    116111        if (nq.gt.nqmx) then
     
    445440c     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    446441c     Then that should not affect the ice particle radius
    447       do ig=1,ngridmx
     442      do ig=1,ngrid
    448443        if(pdpsrf(ig)*ptimestep.gt.0.9*(pplev(ig,1)-pplev(ig,2)))then
    449444          if(pdpsrf(ig)*ptimestep.gt.0.9*(pplev(ig,1)-pplev(ig,3)))
  • trunk/LMDZ.MARS/libf/phymars/writediagfi.F

    r1005 r1047  
    3939!
    4040!=================================================================
    41  
     41      use surfdat_h, only: phisfi
    4242      implicit none
    4343
    4444! Commons
    4545#include "dimensions.h"
    46 #include "dimphys.h"
     46!#include "dimphys.h"
    4747#include "paramet.h"
    4848#include "control.h"
     
    5252#include "netcdf.inc"
    5353#include "temps.h"
    54 #include "surfdat.h"
     54!#include "surfdat.h"
    5555
    5656! Arguments on input:
     
    192192      endif ! if (firstnom.eq.'1234567890')
    193193
    194       if (ngridmx.eq.1) then
     194      if (ngrid.eq.1) then
    195195        ! in testphys1d, for the 1d version of the GCM, iphysiq and irythme
    196196        ! are undefined; so set them to 1
  • trunk/LMDZ.MARS/libf/phymars/writediagsoil.F90

    r410 r1047  
    1212! Modifs: Aug.2010 Ehouarn: enforce outputs to be real*4
    1313
     14use comsoil_h, only: nsoilmx
     15
    1416implicit none
    1517
    1618#include"dimensions.h"
    17 #include"dimphys.h"
     19!#include"dimphys.h"
    1820#include"paramet.h"
    1921#include"control.h"
    20 #include"comsoil.h"
     22!#include"comsoil.h"
    2123#include"netcdf.inc"
    2224
     
    2931integer,intent(in) :: dimpx ! dimension of the variable (3,2 or 0)
    3032real,dimension(ngrid,nsoilmx),intent(in) :: px ! variable
    31 ! Note: nsoilmx is a common parameter set in 'dimphys.h'
     33! Note: nsoilmx is a parameter set in 'comsoil_h'
    3234
    3335! Local variables:
    3436real*4,dimension(iip1,jjp1,nsoilmx) :: data3 ! to store 3D data
    35 ! Note iip1,jjp1 known from paramet.h; nsoilmx known from dimphys.h
     37! Note iip1,jjp1 known from paramet.h; nsoilmx known from comsoil_h
    3638real*4,dimension(iip1,jjp1) :: data2 ! to store 2D data
    3739real*4 :: data0 ! to store 0D data
     
    8082 
    8183  ! Define dimensions and axis attributes
    82   call iniwritesoil(nid)
     84  call iniwritesoil(nid,ngrid)
    8385 
    8486  ! set zitau to -1 to be compatible with zitau incrementation step below
Note: See TracChangeset for help on using the changeset viewer.