Ignore:
Timestamp:
07/16/14 18:05:01 (10 years ago)
Author:
milmd
Message:

Last LMDZ version (1315) with OpenMP directives and other stuff

Location:
codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf
Files:
1 added
2 deleted
85 edited

Legend:

Unmodified
Added
Removed
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/dyn3d_common/cpdet_mod.F90

    r222 r227  
    142142! Parallel version of t2tpot, for an arbitrary number of columns 
    143143      USE control_mod, only : planet_type 
     144      USE parallel_lmdz, only : OMP_CHUNK 
    144145      IMPLICIT none 
    145146 
     
    179180! Parallel version of t2tpot, over the full dynamics (scalar) grid 
    180181! (more efficient than multiple calls to t2tpot_p() with slices of data) 
    181       USE parallel_lmdz, only : jj_begin,jj_end 
     182      USE parallel_lmdz, only : jj_begin,jj_end,OMP_CHUNK 
    182183      USE control_mod, only : planet_type 
    183184      IMPLICIT none 
     
    223224! Parallel version of tpot2t, for an arbitrary number of columns 
    224225      USE control_mod, only : planet_type 
     226      USE parallel_lmdz, only : OMP_CHUNK 
    225227      IMPLICIT none 
    226228! for cpp, nu_venus and t0_venus: 
     
    259261! Parallel version of tpot2t, over the full dynamics (scalar) grid 
    260262! (more efficient than multiple calls to tpot2t_p() with slices of data) 
    261       USE parallel_lmdz, only : jj_begin,jj_end 
     263      USE parallel_lmdz, only : jj_begin,jj_end,OMP_CHUNK 
    262264      USE control_mod, only : planet_type 
    263265      IMPLICIT none 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/dyn3dpar/gcm.F

    r222 r227  
    599599c       write(78,*) 'q',q 
    600600 
    601 c$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/,/logici/,/logicl/) 
     601!c$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/,/logici/,/logicl/) 
     602!variable temps no longer exists 
     603c$OMP PARALLEL DEFAULT(SHARED) 
     604c$OMP1 COPYIN(/temps_r/,/temps_i/,/temps_c/,/logici/,/logicl/) 
    602605      CALL leapfrog_p(ucov,vcov,teta,ps,masse,phis,q, 
    603606     .              time_0) 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/dyn3dpar/sponge_mod_p.F90

    r222 r227  
    3131 
    3232      USE Write_Field_p 
    33       use parallel_lmdz, only: pole_sud,pole_nord,jj_begin,jj_end 
     33      use parallel_lmdz, only: pole_sud,pole_nord,jj_begin,jj_end,OMP_CHUNK 
    3434      implicit none 
    3535#include "dimensions.h" 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/aeropacity.F90

    r222 r227  
    3030!     pq                Aerosol mixing ratio 
    3131!     reffrad(ngrid,nlayer,naerkind)         Aerosol effective radius 
    32 !     QREFvis3d(ngrid,nlayermx,naerkind) \ 3d extinction coefficients 
    33 !     QREFir3d(ngrid,nlayermx,naerkind)  / at reference wavelengths 
     32!     QREFvis3d(ngrid,nlayer,naerkind) \ 3d extinction coefficients 
     33!     QREFir3d(ngrid,nlayer,naerkind)  / at reference wavelengths 
    3434! 
    3535!     Output 
     
    4040!======================================================================= 
    4141 
    42 #include "dimensions.h" 
    43 #include "dimphys.h" 
     42!#include "dimensions.h" 
     43!#include "dimphys.h" 
    4444#include "callkeys.h" 
    4545#include "comcstfi.h" 
    46 #include "comvert.h" 
     46!#include "comvert.h" 
    4747 
    4848      INTEGER,INTENT(IN) :: ngrid  ! number of atmospheric columns 
     
    5454      REAL,INTENT(OUT) :: aerosol(ngrid,nlayer,naerkind) ! aerosol optical depth 
    5555      REAL,INTENT(IN) :: reffrad(ngrid,nlayer,naerkind) ! aerosol effective radius 
    56       REAL,INTENT(IN) :: QREFvis3d(ngrid,nlayermx,naerkind) ! extinction coefficient in the visible 
    57       REAL,INTENT(IN) :: QREFir3d(ngrid,nlayermx,naerkind) 
     56      REAL,INTENT(IN) :: QREFvis3d(ngrid,nlayer,naerkind) ! extinction coefficient in the visible 
     57      REAL,INTENT(IN) :: QREFir3d(ngrid,nlayer,naerkind) 
    5858      REAL,INTENT(OUT):: tau_col(ngrid) !column integrated visible optical depth 
    5959      ! BENJAMIN MODIFS 
    60       real,intent(in) :: cloudfrac(ngrid,nlayermx) ! cloud fraction 
     60      real,intent(in) :: cloudfrac(ngrid,nlayer) ! cloud fraction 
    6161      real,intent(out) :: totcloudfrac(ngrid) ! total cloud fraction 
    6262      logical,intent(in) :: clearsky 
     
    6767 
    6868      LOGICAL,SAVE :: firstcall=.true. 
     69!$OMP THREADPRIVATE(firstcall) 
    6970      REAL CBRT 
    7071      EXTERNAL CBRT 
     
    7273      INTEGER,SAVE :: i_co2ice=0      ! co2 ice 
    7374      INTEGER,SAVE :: i_h2oice=0      ! water ice 
     75!$OMP THREADPRIVATE(i_co2ice,i_h2oice) 
    7476      CHARACTER(LEN=20) :: tracername ! to temporarily store text 
    7577 
     
    135137           iaer=iaero_co2 
    136138!       1. Initialization 
    137             aerosol(1:ngrid,1:nlayermx,iaer)=0.0 
     139            aerosol(1:ngrid,1:nlayer,iaer)=0.0 
    138140!       2. Opacity calculation 
    139141            if (noaero) then ! aerosol set to zero 
    140              aerosol(1:ngrid,1:nlayermx,iaer)=0.0 
     142             aerosol(1:ngrid,1:nlayer,iaer)=0.0 
    141143            elseif (aerofixco2.or.(i_co2ice.eq.0)) then !  CO2 ice cloud prescribed 
    142                aerosol(1:ngrid,1:nlayermx,iaer)=1.e-9 
     144               aerosol(1:ngrid,1:nlayer,iaer)=1.e-9 
    143145               !aerosol(1:ngrid,12,iaer)=4.0 ! single cloud layer option 
    144146            else 
     
    172174           iaer=iaero_h2o 
    173175!       1. Initialization 
    174             aerosol(1:ngrid,1:nlayermx,iaer)=0.0 
     176            aerosol(1:ngrid,1:nlayer,iaer)=0.0 
    175177!       2. Opacity calculation 
    176178            if (aerofixh2o.or.(i_h2oice.eq.0).or.clearsky) then 
    177                aerosol(1:ngrid,1:nlayermx,iaer) =1.e-9 
     179               aerosol(1:ngrid,1:nlayer,iaer) =1.e-9 
    178180 
    179181               ! put cloud at cloudlvl 
     
    226228 
    227229               if(CLFvarying)then 
    228                   call totalcloudfrac(ngrid,nq,cloudfrac,totcloudfrac,pplev,pq,aerosol(1:ngrid,1:nlayermx,iaer)) 
     230                  call totalcloudfrac(ngrid,nlayer,nq,cloudfrac,totcloudfrac,pplev,pq,aerosol(1,1,iaer)) 
    229231                  do ig=1, ngrid 
    230232                     do l=1,nlayer-1 ! to stop the rad tran bug 
     
    253255          iaer=iaero_dust 
    254256!         1. Initialization  
    255           aerosol(1:ngrid,1:nlayermx,iaer)=0.0 
     257          aerosol(1:ngrid,1:nlayer,iaer)=0.0 
    256258           
    257259          topdust=30.0 ! km  (used to be 10.0 km) LK 
     
    264266!             Typical mixing ratio profile 
    265267 
    266                  zp=(preff/pplay(ig,l))**(70./topdust) 
     268                 zp=(pplev(ig,1)/pplay(ig,l))**(70./topdust) 
    267269                 expfactor=max(exp(0.007*(1.-max(zp,1.))),1.e-3) 
    268270 
     
    277279!          Rescaling each layer to reproduce the choosen (or assimilated) 
    278280!          dust extinction opacity at visible reference wavelength, which 
    279 !          is scaled to the "preff" reference surface pressure available in comvert.h 
    280 !          and stored in startfi.nc 
     281!          is scaled to the surface pressure pplev(ig,1) 
    281282 
    282283            taudusttmp(1:ngrid)=0. 
     
    291292                  aerosol(ig,l,iaer) = max(1E-20, & 
    292293                          dusttau & 
    293                        *  pplev(ig,1) / preff & 
     294                       *  pplev(ig,1) / pplev(ig,1) & 
    294295                       *  aerosol(ig,l,iaer) & 
    295296                       /  taudusttmp(ig)) 
     
    307308 
    308309!       1. Initialization 
    309          aerosol(1:ngrid,1:nlayermx,iaer)=0.0 
     310         aerosol(1:ngrid,1:nlayer,iaer)=0.0 
    310311 
    311312 
     
    317318!              Typical mixing ratio profile 
    318319 
    319                zp=(preff/pplay(ig,l))**(70./30) !emulating topdust 
     320               zp=(pplev(ig,1)/pplay(ig,l))**(70./30) !emulating topdust 
    320321               expfactor=max(exp(0.007*(1.-max(zp,1.))),1.e-3) 
    321322 
     
    335336               aerosol(ig,l,iaer) = max(1E-20, & 
    336337                          1 & 
    337                        *  pplev(ig,1) / preff & 
     338                       *  pplev(ig,1) / pplev(ig,1) & 
    338339                       *  aerosol(ig,l,iaer) & 
    339340                       /  tauh2so4tmp(ig)) 
     
    367368           iaer=iaero_back2lay 
    368369!       1. Initialization 
    369             aerosol(1:ngrid,1:nlayermx,iaer)=0.0 
     370            aerosol(1:ngrid,1:nlayer,iaer)=0.0 
    370371!       2. Opacity calculation 
    371372          DO ig=1,ngrid 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/aeroptproperties.F90

    r222 r227  
    3232!     ============================================================== 
    3333 
    34 #include "dimensions.h" 
    35 #include "dimphys.h" 
     34!#include "dimensions.h" 
     35!#include "dimphys.h" 
    3636#include "callkeys.h" 
    3737 
     
    6060      INTEGER :: grid_i,grid_j 
    6161!     Intermediate variable 
    62       REAL :: var_tmp,var3d_tmp(ngrid,nlayermx) 
     62      REAL :: var_tmp,var3d_tmp(ngrid,nlayer) 
    6363!     Bilinear interpolation factors 
    6464      REAL :: kx,ky,k1,k2,k3,k4 
     
    6767!     Pi! 
    6868      REAL,SAVE :: pi 
     69!$OMP THREADPRIVATE(pi) 
    6970!     Variables used by the Gauss-Legendre integration: 
    7071      INTEGER radius_id,gausind 
     
    8788                      0.08327674160932,0.06267204829828, & 
    8889                      0.04060142982019,0.01761400714091/ 
     90!$OMP THREADPRIVATE(radgaus,weightgaus) 
    8991!     Indices 
    9092      INTEGER :: i,j,k,l,m,iaer,idomain 
     
    102104!     Grid used to remember which calculation is done 
    103105      LOGICAL,SAVE :: checkgrid(refftabsize,nuefftabsize,naerkind,2) = .false. 
     106!$OMP THREADPRIVATE(refftab,nuefftab,logvratgrid,vratgrid,checkgrid) 
    104107!     Optical properties of the grid (VISIBLE) 
    105108      REAL,SAVE :: qsqrefVISgrid(refftabsize,nuefftabsize,L_NSPECTV,naerkind) 
     
    108111      REAL,SAVE :: omegVISgrid(refftabsize,nuefftabsize,L_NSPECTV,naerkind) 
    109112      REAL,SAVE :: gVISgrid(refftabsize,nuefftabsize,L_NSPECTV,naerkind) 
     113!$OMP THREADPRIVATE(qsqrefVISgrid,qextVISgrid,qscatVISgrid,omegVISgrid,gVISgrid) 
    110114!     Optical properties of the grid (INFRARED) 
    111115      REAL,SAVE :: qsqrefIRgrid(refftabsize,nuefftabsize,L_NSPECTI,naerkind) 
     
    114118      REAL,SAVE :: omegIRgrid(refftabsize,nuefftabsize,L_NSPECTI,naerkind) 
    115119      REAL,SAVE :: gIRgrid(refftabsize,nuefftabsize,L_NSPECTI,naerkind) 
     120!$OMP THREADPRIVATE(qsqrefIRgrid,qextIRgrid,qscatIRgrid,omegIRgrid,gIRgrid) 
    116121!     Optical properties of the grid (REFERENCE WAVELENGTHS) 
    117122      REAL,SAVE :: qrefVISgrid(refftabsize,nuefftabsize,naerkind) 
     
    121126      REAL,SAVE :: omegrefVISgrid(refftabsize,nuefftabsize,naerkind) 
    122127      REAL,SAVE :: omegrefIRgrid(refftabsize,nuefftabsize,naerkind) 
     128!$OMP THREADPRIVATE(qrefVISgrid,qscatrefVISgrid,qrefIRgrid,qscatrefIRgrid,omegrefVISgrid,& 
     129        !$OMP omegrefIRgrid) 
    123130!     Firstcall 
    124131      LOGICAL,SAVE :: firstcall = .true. 
     132!$OMP THREADPRIVATE(firstcall) 
    125133!     Variables used by the Gauss-Legendre integration: 
    126134      REAL,SAVE :: normd(refftabsize,nuefftabsize,naerkind,2) 
    127135      REAL,SAVE :: dista(refftabsize,nuefftabsize,naerkind,2,ngau) 
    128136      REAL,SAVE :: distb(refftabsize,nuefftabsize,naerkind,2,ngau) 
     137!$OMP THREADPRIVATE(normd,dista,distb) 
    129138 
    130139      REAL,SAVE :: radGAUSa(ngau,naerkind,2) 
    131140      REAL,SAVE :: radGAUSb(ngau,naerkind,2) 
     141!$OMP THREADPRIVATE(radGAUSa,radGAUSb) 
    132142 
    133143      REAL,SAVE :: qsqrefVISa(L_NSPECTV,ngau,naerkind) 
     
    141151      REAL,SAVE :: gVISa(L_NSPECTV,ngau,naerkind) 
    142152      REAL,SAVE :: gVISb(L_NSPECTV,ngau,naerkind) 
     153!$OMP THREADPRIVATE(qsqrefVISa,qrefVISa,qsqrefVISb,qrefVISb,omegVISa, & 
     154        !$OMP omegrefVISa,omegVISb,omegrefVISb,gVISa,gVISb) 
    143155 
    144156      REAL,SAVE :: qsqrefIRa(L_NSPECTI,ngau,naerkind) 
     
    152164      REAL,SAVE :: gIRa(L_NSPECTI,ngau,naerkind) 
    153165      REAL,SAVE :: gIRb(L_NSPECTI,ngau,naerkind) 
     166!$OMP THREADPRIVATE(qsqrefIRa,qrefIRa,qsqrefIRb,qrefIRb,omegIRa,omegrefIRa,& 
     167        !$OMP omegIRb,omegrefIRb,gIRa,gIRb) 
    154168 
    155169      REAL :: radiusm 
     
    161175      INTEGER :: ngrid,nlayer 
    162176!     Aerosol effective radius used for radiative transfer (meter) 
    163       REAL :: reffrad(ngrid,nlayermx,naerkind) 
     177      REAL,INTENT(IN) :: reffrad(ngrid,nlayer,naerkind) 
    164178!     Aerosol effective variance used for radiative transfer (n.u.) 
    165       REAL :: nueffrad(ngrid,nlayermx,naerkind) 
     179      REAL,INTENT(IN) :: nueffrad(ngrid,nlayer,naerkind) 
    166180 
    167181!     Outputs 
    168182!     ------- 
    169183 
    170       REAL :: QVISsQREF3d(ngrid,nlayermx,L_NSPECTV,naerkind) 
    171       REAL :: omegaVIS3d(ngrid,nlayermx,L_NSPECTV,naerkind) 
    172       REAL :: gVIS3d(ngrid,nlayermx,L_NSPECTV,naerkind) 
    173  
    174       REAL :: QIRsQREF3d(ngrid,nlayermx,L_NSPECTI,naerkind) 
    175       REAL :: omegaIR3d(ngrid,nlayermx,L_NSPECTI,naerkind) 
    176       REAL :: gIR3d(ngrid,nlayermx,L_NSPECTI,naerkind) 
    177  
    178       REAL :: QREFvis3d(ngrid,nlayermx,naerkind) 
    179       REAL :: QREFir3d(ngrid,nlayermx,naerkind) 
    180  
    181       REAL :: omegaREFvis3d(ngrid,nlayermx,naerkind) 
    182       REAL :: omegaREFir3d(ngrid,nlayermx,naerkind) 
     184      REAL,INTENT(OUT) :: QVISsQREF3d(ngrid,nlayer,L_NSPECTV,naerkind) 
     185      REAL,INTENT(OUT) :: omegaVIS3d(ngrid,nlayer,L_NSPECTV,naerkind) 
     186      REAL,INTENT(OUT) :: gVIS3d(ngrid,nlayer,L_NSPECTV,naerkind) 
     187 
     188      REAL,INTENT(OUT) :: QIRsQREF3d(ngrid,nlayer,L_NSPECTI,naerkind) 
     189      REAL,INTENT(OUT) :: omegaIR3d(ngrid,nlayer,L_NSPECTI,naerkind) 
     190      REAL,INTENT(OUT) :: gIR3d(ngrid,nlayer,L_NSPECTI,naerkind) 
     191 
     192      REAL,INTENT(OUT) :: QREFvis3d(ngrid,nlayer,naerkind) 
     193      REAL,INTENT(OUT) :: QREFir3d(ngrid,nlayer,naerkind) 
     194 
     195      REAL :: omegaREFvis3d(ngrid,nlayer,naerkind) 
     196      REAL :: omegaREFir3d(ngrid,nlayer,naerkind) 
    183197 
    184198      DO iaer = 1, naerkind ! Loop on aerosol kind 
     
    724738                        k2*omegrefIRgrid(grid_i+1,1,iaer) 
    725739          ENDIF                  ! -------------------------------- 
    726         ENDDO !nlayermx 
     740        ENDDO !nlayer 
    727741      ENDDO !ngrid 
    728742 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/aerosol_mod.F90

    r222 r227  
    1616! two-layer simple aerosol model 
    1717      integer :: iaero_back2lay = 0 
     18!$OMP THREADPRIVATE(iaero_co2,iaero_h2o,iaero_dust,iaero_h2so4,noaero,iaero_back2lay) 
    1819       
    1920!================================================================== 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/ave_stelspec.F90

    r222 r227  
    3838      integer ifine 
    3939 
    40       real,allocatable :: lam(:),stel_f(:) 
     40      real,allocatable,save :: lam(:),stel_f(:)         !read by master 
    4141      real band,lamm,lamp 
    4242      real dl 
     
    116116         End Select 
    117117 
     118!$OMP MASTER 
    118119         allocate(lam(Nfine),stel_f(Nfine)) 
    119120 
     
    153154           close(111) 
    154155         endif 
     156!$OMP END MASTER 
     157!$OMP BARRIER 
    155158          
    156159         ! sum data by band 
     
    173176          
    174177         STELLAR(1:L_NSPECTV)=STELLAR(1:L_NSPECTV)/sum(STELLAR(1:L_NSPECTV)) 
    175          deallocate(lam,stel_f) 
    176           
     178!$OMP BARRIER 
     179!$OMP MASTER 
     180         if (allocated(lam)) deallocate(lam) 
     181         if (allocated(stel_f)) deallocate(stel_f) 
     182!$OMP END MASTER 
     183!$OMP BARRIER          
    177184      endif 
    178185 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/bilinearbig.F90

    r222 r227  
    1414      real*8 f2d_arr(nX,nY) 
    1515      real*8,save :: x,y 
     16!$OMP THREADPRIVATE(x,y) 
    1617 
    1718      integer strlen 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/calc_cpp_mugaz.F90

    r222 r227  
    2020      implicit none 
    2121 
    22 #include "dimensions.h" 
    23 #include "dimphys.h" 
     22!#include "dimensions.h" 
     23!#include "dimphys.h" 
    2424#include "comcstfi.h" 
    2525#include "callkeys.h" 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/calcenergy_kcm.F90

    r222 r227  
    1 subroutine calcenergy_kcm(Tsurf,T,Play,Plev,Qsurf,Q,muvar,Eatmtot) 
     1subroutine calcenergy_kcm(nlayer,Tsurf,T,Play,Plev,Qsurf,Q,muvar,Eatmtot) 
    22 
    33 
     
    1111!     ---------------------------------------------------------------- 
    1212 
    13 #include "dimensions.h" 
    14 #include "dimphys.h" 
     13!#include "dimensions.h" 
     14!#include "dimphys.h" 
    1515#include "comcstfi.h" 
    1616!#include "callkeys.h" 
     
    1919 
    2020  ! inputs 
    21   real Tsurf,T(1:nlayermx) 
    22   real Play(1:nlayermx),Plev(1:nlayermx+1) 
    23   real Qsurf,Q(1:nlayermx) 
    24   real muvar(1,nlayermx+1) 
     21  integer,intent(in) :: nlayer 
     22  real Tsurf,T(1:nlayer) 
     23  real Play(1:nlayer),Plev(1:nlayer+1) 
     24  real Qsurf,Q(1:nlayer) 
     25  real muvar(1,nlayer+1) 
    2526 
    2627  ! internal 
     
    2930  real s_c,rho_v,L 
    3031  double precision p_v, s_v, nul 
    31   real VMR(1:nlayermx) 
     32  real VMR(1:nlayer) 
    3233 
    3334  ! output 
     
    4142 
    4243 
    43   do il=1,nlayermx 
     44  do il=1,nlayer 
    4445     VMR(il)=Q(il)*(muvar(1,il+1)/mH2O) 
    4546  end do 
     
    4748 
    4849  Eatmtot = 0.0 
    49   do il=1,nlayermx 
     50  do il=1,nlayer 
    5051 
    5152 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/callcorrk.F90

    r222 r227  
    1212      use watercommon_h 
    1313      use datafile_mod, only: datadir 
    14       use ioipsl_getincom  
     14!      use ioipsl_getincom  
     15      use ioipsl_getincom_p 
    1516      use gases_h 
    1617      use radii_mod, only : su_aer_radii,co2_reffrad,h2o_reffrad,dust_reffrad,h2so4_reffrad,back2lay_reffrad 
     
    3536!================================================================== 
    3637 
    37 #include "dimphys.h" 
     38!#include "dimphys.h" 
    3839#include "comcstfi.h" 
    3940#include "callkeys.h" 
     
    4243!     Declaration of the arguments (INPUT - OUTPUT) on the LMD GCM grid 
    4344!     Layer #1 is the layer near the ground.  
    44 !     Layer #nlayermx is the layer at the top. 
     45!     Layer #nlayer is the layer at the top. 
    4546 
    4647      INTEGER,INTENT(IN) :: ngrid ! number of atmospheric columns 
     
    5253      REAL,INTENT(IN) :: emis(ngrid)     ! LW emissivity 
    5354      real,intent(in) :: mu0(ngrid) ! cosine of sun incident angle 
    54       REAL,INTENT(IN) :: pplev(ngrid,nlayermx+1)  ! inter-layer pressure (Pa) 
    55       REAL,INTENT(IN) :: pplay(ngrid,nlayermx)    ! mid-layer pressure (Pa) 
    56       REAL,INTENT(IN) :: pt(ngrid,nlayermx)  ! air temperature (K) 
     55      REAL,INTENT(IN) :: pplev(ngrid,nlayer+1)  ! inter-layer pressure (Pa) 
     56      REAL,INTENT(IN) :: pplay(ngrid,nlayer)    ! mid-layer pressure (Pa) 
     57      REAL,INTENT(IN) :: pt(ngrid,nlayer)  ! air temperature (K) 
    5758      REAL,INTENT(IN) :: tsurf(ngrid)        ! surface temperature (K) 
    5859      REAL,INTENT(IN) :: fract(ngrid)        ! fraction of day 
    5960      REAL,INTENT(IN) :: dist_star           ! distance star-planet (AU) 
    60       REAL,INTENT(OUT) :: aerosol(ngrid,nlayermx,naerkind) ! aerosol tau (kg/kg) 
    61       real,intent(in) :: muvar(ngrid,nlayermx+1) 
    62       REAL,INTENT(OUT) :: dtlw(ngrid,nlayermx) ! heating rate (K/s) due to LW 
    63       REAL,INTENT(OUT) :: dtsw(ngrid,nlayermx) ! heating rate (K/s) due to SW 
     61      REAL,INTENT(OUT) :: aerosol(ngrid,nlayer,naerkind) ! aerosol tau (kg/kg) 
     62      real,intent(in) :: muvar(ngrid,nlayer+1) 
     63      REAL,INTENT(OUT) :: dtlw(ngrid,nlayer) ! heating rate (K/s) due to LW 
     64      REAL,INTENT(OUT) :: dtsw(ngrid,nlayer) ! heating rate (K/s) due to SW 
    6465      REAL,INTENT(OUT) :: fluxsurf_lw(ngrid)   ! incident LW flux to surf (W/m2) 
    6566      REAL,INTENT(OUT) :: fluxsurf_sw(ngrid)   ! incident SW flux to surf (W/m2) 
     
    7172      REAL,INTENT(OUT) :: tau_col(ngrid) ! diagnostic from aeropacity 
    7273!     for H2O cloud fraction in aeropacity 
    73       real,intent(in) :: cloudfrac(ngrid,nlayermx) 
     74      real,intent(in) :: cloudfrac(ngrid,nlayer) 
    7475      real,intent(out) :: totcloudfrac(ngrid) 
    7576      logical,intent(in) :: clearsky 
     
    7980!     Globally varying aerosol optical properties on GCM grid 
    8081!     Not needed everywhere so not in radcommon_h 
    81       REAL :: QVISsQREF3d(ngrid,nlayermx,L_NSPECTV,naerkind) 
    82       REAL :: omegaVIS3d(ngrid,nlayermx,L_NSPECTV,naerkind) 
    83       REAL :: gVIS3d(ngrid,nlayermx,L_NSPECTV,naerkind) 
    84  
    85       REAL :: QIRsQREF3d(ngrid,nlayermx,L_NSPECTI,naerkind) 
    86       REAL :: omegaIR3d(ngrid,nlayermx,L_NSPECTI,naerkind) 
    87       REAL :: gIR3d(ngrid,nlayermx,L_NSPECTI,naerkind) 
    88  
    89 !      REAL :: omegaREFvis3d(ngrid,nlayermx,naerkind) 
    90 !      REAL :: omegaREFir3d(ngrid,nlayermx,naerkind) ! not sure of the point of these... 
     82      REAL :: QVISsQREF3d(ngrid,nlayer,L_NSPECTV,naerkind) 
     83      REAL :: omegaVIS3d(ngrid,nlayer,L_NSPECTV,naerkind) 
     84      REAL :: gVIS3d(ngrid,nlayer,L_NSPECTV,naerkind) 
     85 
     86      REAL :: QIRsQREF3d(ngrid,nlayer,L_NSPECTI,naerkind) 
     87      REAL :: omegaIR3d(ngrid,nlayer,L_NSPECTI,naerkind) 
     88      REAL :: gIR3d(ngrid,nlayer,L_NSPECTI,naerkind) 
     89 
     90!      REAL :: omegaREFvis3d(ngrid,nlayer,naerkind) 
     91!      REAL :: omegaREFir3d(ngrid,nlayer,naerkind) ! not sure of the point of these... 
    9192 
    9293      REAL,ALLOCATABLE,SAVE :: reffrad(:,:,:) ! aerosol effective radius (m) 
    9394      REAL,ALLOCATABLE,SAVE :: nueffrad(:,:,:) ! aerosol effective variance 
     95!$OMP THREADPRIVATE(reffrad,nueffrad) 
    9496 
    9597!----------------------------------------------------------------------- 
     
    128130      logical global1d 
    129131      save szangle,global1d 
     132!$OMP THREADPRIVATE(szangle,global1d) 
    130133      real*8 taugsurf(L_NSPECTV,L_NGAUSS-1) 
    131134      real*8 taugsurfi(L_NSPECTI,L_NGAUSS-1) 
     
    141144      real*8,save ::  GIAER(L_LEVELS+1,L_NSPECTI,naerkind) 
    142145 
    143       !REAL :: QREFvis3d(ngrid,nlayermx,naerkind) 
    144       !REAL :: QREFir3d(ngrid,nlayermx,naerkind) 
     146      !REAL :: QREFvis3d(ngrid,nlayer,naerkind) 
     147      !REAL :: QREFir3d(ngrid,nlayer,naerkind) 
    145148      !save QREFvis3d, QREFir3d  
    146149      real, dimension(:,:,:), save, allocatable :: QREFvis3d 
    147150      real, dimension(:,:,:), save, allocatable :: QREFir3d 
     151!$OMP THREADPRIVATE(QXVAER,QSVAER,GVAER,QXIAER,QSIAER,GIAER,QREFvis3d,QREFir3d) 
    148152 
    149153 
     
    177181 
    178182!     included by RW for runaway greenhouse 1D study 
    179       real vtmp(nlayermx) 
     183      real vtmp(nlayer) 
    180184      REAL*8 muvarrad(L_LEVELS) 
    181185 
     
    195199         !!! ALLOCATED instances are necessary because of CLFvarying 
    196200         !!! strategy to call callcorrk twice in physiq... 
    197          IF(.not.ALLOCATED(QREFvis3d)) ALLOCATE(QREFvis3d(ngrid,nlayermx,naerkind)) 
    198          IF(.not.ALLOCATED(QREFir3d)) ALLOCATE(QREFir3d(ngrid,nlayermx,naerkind)) 
     201         IF(.not.ALLOCATED(QREFvis3d)) ALLOCATE(QREFvis3d(ngrid,nlayer,naerkind)) 
     202         IF(.not.ALLOCATED(QREFir3d)) ALLOCATE(QREFir3d(ngrid,nlayer,naerkind)) 
    199203         ! Effective radius and variance of the aerosols 
    200204         IF(.not.ALLOCATED(reffrad)) allocate(reffrad(ngrid,nlayer,naerkind)) 
     
    207211            call abort 
    208212         endif 
    209          call su_aer_radii(ngrid,reffrad,nueffrad) 
     213         call su_aer_radii(ngrid,nlayer,reffrad,nueffrad) 
    210214          
    211215          
     
    214218!     set up correlated k 
    215219         print*, "callcorrk: Correlated-k data base folder:",trim(datadir) 
    216          call getin("corrkdir",corrkdir) 
     220         call getin_p("corrkdir",corrkdir) 
    217221         print*, "corrkdir = ",corrkdir 
    218222         write( tmp1, '(i3)' ) L_NSPECTI 
     
    238242           PRINT*, 'Simulate global averaged conditions ?' 
    239243           global1d = .false. ! default value 
    240            call getin("global1d",global1d) 
     244           call getin_p("global1d",global1d) 
    241245           write(*,*) "global1d = ",global1d 
    242246           ! Test of incompatibility: 
     
    251255             PRINT *,'(assumed for averaged solar flux S/4)' 
    252256             szangle=60.0  ! default value 
    253              call getin("szangle",szangle) 
     257             call getin_p("szangle",szangle) 
    254258             write(*,*) "szangle = ",szangle 
    255259           endif 
     
    266270 
    267271         if ((iaer.eq.iaero_co2).and.tracer.and.(igcm_co2_ice.gt.0)) then ! treat condensed co2 particles. 
    268             call co2_reffrad(ngrid,nq,pq,reffrad(1,1,iaero_co2)) 
    269             print*,'Max. CO2 ice particle size = ',maxval(reffrad(1:ngrid,1:nlayermx,iaer))/1.e-6,' um' 
    270             print*,'Min. CO2 ice particle size = ',minval(reffrad(1:ngrid,1:nlayermx,iaer))/1.e-6,' um' 
     272            call co2_reffrad(ngrid,nlayer,nq,pq,reffrad(1,1,iaero_co2)) 
     273            print*,'Max. CO2 ice particle size = ',maxval(reffrad(1:ngrid,1:nlayer,iaer))/1.e-6,' um' 
     274            print*,'Min. CO2 ice particle size = ',minval(reffrad(1:ngrid,1:nlayer,iaer))/1.e-6,' um' 
    271275         end if 
    272276         if ((iaer.eq.iaero_h2o).and.water) then ! treat condensed water particles. to be generalized for other aerosols 
    273             call h2o_reffrad(ngrid,pq(1,1,igcm_h2o_ice),pt, & 
     277            call h2o_reffrad(ngrid,nlayer,pq(1,1,igcm_h2o_ice),pt, & 
    274278                             reffrad(1,1,iaero_h2o),nueffrad(1,1,iaero_h2o)) 
    275             print*,'Max. H2O cloud particle size = ',maxval(reffrad(1:ngrid,1:nlayermx,iaer))/1.e-6,' um' 
    276             print*,'Min. H2O cloud particle size = ',minval(reffrad(1:ngrid,1:nlayermx,iaer))/1.e-6,' um' 
     279            print*,'Max. H2O cloud particle size = ',maxval(reffrad(1:ngrid,1:nlayer,iaer))/1.e-6,' um' 
     280            print*,'Min. H2O cloud particle size = ',minval(reffrad(1:ngrid,1:nlayer,iaer))/1.e-6,' um' 
    277281         endif 
    278282         if(iaer.eq.iaero_dust)then 
    279             call dust_reffrad(ngrid,reffrad(1,1,iaero_dust)) 
     283            call dust_reffrad(ngrid,nlayer,reffrad(1,1,iaero_dust)) 
    280284            print*,'Dust particle size = ',reffrad(1,1,iaer)/1.e-6,' um' 
    281285         endif 
    282286         if(iaer.eq.iaero_h2so4)then 
    283             call h2so4_reffrad(ngrid,reffrad(1,1,iaero_h2so4)) 
     287            call h2so4_reffrad(ngrid,nlayer,reffrad(1,1,iaero_h2so4)) 
    284288            print*,'H2SO4 particle size =',reffrad(1,1,iaer)/1.e-6,' um' 
    285289         endif 
     
    318322            do iaer=1,naerkind 
    319323               DO nw=1,L_NSPECTV  
    320                   do l=1,nlayermx 
    321  
    322                      temp1=QVISsQREF3d(ig,nlayermx+1-l,nw,iaer)         & 
    323                          *QREFvis3d(ig,nlayermx+1-l,iaer) 
    324  
    325                      temp2=QVISsQREF3d(ig,max(nlayermx-l,1),nw,iaer)    & 
    326                          *QREFvis3d(ig,max(nlayermx-l,1),iaer) 
     324                  do l=1,nlayer 
     325 
     326                     temp1=QVISsQREF3d(ig,nlayer+1-l,nw,iaer)         & 
     327                         *QREFvis3d(ig,nlayer+1-l,iaer) 
     328 
     329                     temp2=QVISsQREF3d(ig,max(nlayer-l,1),nw,iaer)    & 
     330                         *QREFvis3d(ig,max(nlayer-l,1),iaer) 
    327331 
    328332                     qxvaer(2*l,nw,iaer)  = temp1 
    329333                     qxvaer(2*l+1,nw,iaer)=(temp1+temp2)/2 
    330334 
    331                      temp1=temp1*omegavis3d(ig,nlayermx+1-l,nw,iaer) 
    332                      temp2=temp2*omegavis3d(ig,max(nlayermx-l,1),nw,iaer) 
     335                     temp1=temp1*omegavis3d(ig,nlayer+1-l,nw,iaer) 
     336                     temp2=temp2*omegavis3d(ig,max(nlayer-l,1),nw,iaer) 
    333337 
    334338                     qsvaer(2*l,nw,iaer)  = temp1 
    335339                     qsvaer(2*l+1,nw,iaer)=(temp1+temp2)/2 
    336340 
    337                      temp1=gvis3d(ig,nlayermx+1-l,nw,iaer) 
    338                      temp2=gvis3d(ig,max(nlayermx-l,1),nw,iaer) 
     341                     temp1=gvis3d(ig,nlayer+1-l,nw,iaer) 
     342                     temp2=gvis3d(ig,max(nlayer-l,1),nw,iaer) 
    339343 
    340344                     gvaer(2*l,nw,iaer)  = temp1 
     
    344348 
    345349                  qxvaer(1,nw,iaer)=qxvaer(2,nw,iaer) 
    346                   qxvaer(2*nlayermx+1,nw,iaer)=0. 
     350                  qxvaer(2*nlayer+1,nw,iaer)=0. 
    347351 
    348352                  qsvaer(1,nw,iaer)=qsvaer(2,nw,iaer) 
    349                   qsvaer(2*nlayermx+1,nw,iaer)=0. 
     353                  qsvaer(2*nlayer+1,nw,iaer)=0. 
    350354 
    351355                  gvaer(1,nw,iaer)=gvaer(2,nw,iaer) 
    352                   gvaer(2*nlayermx+1,nw,iaer)=0. 
     356                  gvaer(2*nlayer+1,nw,iaer)=0. 
    353357 
    354358               end do 
     
    356360!     longwave 
    357361               DO nw=1,L_NSPECTI  
    358                   do l=1,nlayermx 
    359  
    360                      temp1=QIRsQREF3d(ig,nlayermx+1-l,nw,iaer)         & 
    361                           *QREFir3d(ig,nlayermx+1-l,iaer) 
    362  
    363                      temp2=QIRsQREF3d(ig,max(nlayermx-l,1),nw,iaer)    & 
    364                           *QREFir3d(ig,max(nlayermx-l,1),iaer) 
     362                  do l=1,nlayer 
     363 
     364                     temp1=QIRsQREF3d(ig,nlayer+1-l,nw,iaer)         & 
     365                          *QREFir3d(ig,nlayer+1-l,iaer) 
     366 
     367                     temp2=QIRsQREF3d(ig,max(nlayer-l,1),nw,iaer)    & 
     368                          *QREFir3d(ig,max(nlayer-l,1),iaer) 
    365369 
    366370                     qxiaer(2*l,nw,iaer)  = temp1 
    367371                     qxiaer(2*l+1,nw,iaer)=(temp1+temp2)/2 
    368372 
    369                      temp1=temp1*omegair3d(ig,nlayermx+1-l,nw,iaer) 
    370                      temp2=temp2*omegair3d(ig,max(nlayermx-l,1),nw,iaer) 
     373                     temp1=temp1*omegair3d(ig,nlayer+1-l,nw,iaer) 
     374                     temp2=temp2*omegair3d(ig,max(nlayer-l,1),nw,iaer) 
    371375 
    372376                     qsiaer(2*l,nw,iaer)  = temp1 
    373377                     qsiaer(2*l+1,nw,iaer)=(temp1+temp2)/2 
    374378 
    375                      temp1=gir3d(ig,nlayermx+1-l,nw,iaer) 
    376                      temp2=gir3d(ig,max(nlayermx-l,1),nw,iaer) 
     379                     temp1=gir3d(ig,nlayer+1-l,nw,iaer) 
     380                     temp2=gir3d(ig,max(nlayer-l,1),nw,iaer) 
    377381 
    378382                     giaer(2*l,nw,iaer)  = temp1 
     
    382386 
    383387                  qxiaer(1,nw,iaer)=qxiaer(2,nw,iaer) 
    384                   qxiaer(2*nlayermx+1,nw,iaer)=0. 
     388                  qxiaer(2*nlayer+1,nw,iaer)=0. 
    385389 
    386390                  qsiaer(1,nw,iaer)=qsiaer(2,nw,iaer) 
    387                   qsiaer(2*nlayermx+1,nw,iaer)=0. 
     391                  qsiaer(2*nlayer+1,nw,iaer)=0. 
    388392 
    389393                  giaer(1,nw,iaer)=giaer(2,nw,iaer) 
    390                   giaer(2*nlayermx+1,nw,iaer)=0. 
     394                  giaer(2*nlayer+1,nw,iaer)=0. 
    391395 
    392396               end do 
     
    481485      elseif(varfixed)then 
    482486 
    483          do l=1,nlayermx        ! here we will assign fixed water vapour profiles globally 
     487         do l=1,nlayer        ! here we will assign fixed water vapour profiles globally 
    484488            RH = satval * ((pplay(ig,l)/pplev(ig,1) - 0.02) / 0.98) 
    485489            if(RH.lt.0.0) RH=0.0 
     
    507511!         call watersat(Ttemp,ptemp,qsat) 
    508512 
    509          qvar(2*nlayermx+1)= RH * qsat ! ~realistic profile (e.g. 80% saturation at ground) 
     513         qvar(2*nlayer+1)= RH * qsat ! ~realistic profile (e.g. 80% saturation at ground) 
    510514  
    511515      else 
     
    541545       
    542546            muvarrad(1) = muvarrad(2) 
    543             muvarrad(2*nlayermx+1)=muvar(ig,1) 
     547            muvarrad(2*nlayer+1)=muvar(ig,1) 
    544548 
    545549            print*,'Recalculating qvar with VARIABLE epsi for kastprof' 
     
    579583       
    580584         muvarrad(1) = muvarrad(2) 
    581          muvarrad(2*nlayermx+1)=muvar(ig,1)          
     585         muvarrad(2*nlayer+1)=muvar(ig,1)          
    582586      endif 
    583587       
     
    607611 
    608612      tlevrad(1) = tlevrad(2) 
    609       tlevrad(2*nlayermx+1)=tsurf(ig) 
     613      tlevrad(2*nlayer+1)=tsurf(ig) 
    610614       
    611615      tmid(1) = tlevrad(2) 
     
    866870        IF( ALLOCATED( gasi ) ) DEALLOCATE( gasi ) 
    867871        IF( ALLOCATED( gasv ) ) DEALLOCATE( gasv ) 
     872!$OMP BARRIER 
     873!$OMP MASTER 
    868874        IF( ALLOCATED( pgasref ) ) DEALLOCATE( pgasref ) 
    869875        IF( ALLOCATED( tgasref ) ) DEALLOCATE( tgasref ) 
    870876        IF( ALLOCATED( wrefvar ) ) DEALLOCATE( wrefvar ) 
    871877        IF( ALLOCATED( pfgasref ) ) DEALLOCATE( pfgasref ) 
     878!$OMP END MASTER 
     879!$OMP BARRIER    
    872880        IF ( ALLOCATED(reffrad)) DEALLOCATE(reffrad) 
    873881        IF ( ALLOCATED(nueffrad)) DEALLOCATE(nueffrad) 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/callkeys.h

    r222 r227  
    117117      real J2 
    118118      real MassPlanet 
     119       
     120      logical :: iscallphys=.false.!existence of callphys.def 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/callsedim.F

    r222 r227  
    2828c   ------------- 
    2929 
    30 #include "dimensions.h" 
    31 #include "dimphys.h" 
     30!#include "dimensions.h" 
     31!#include "dimphys.h" 
    3232#include "comcstfi.h" 
    3333#include "callkeys.h" 
     
    6565      real epaisseur (ngrid,nlay) ! Layer thickness (m) 
    6666      real wq(ngrid,nlay+1) ! displaced tracer mass (kg.m-2) 
    67 c      real dens(ngrid,nlayermx) ! Mean density of the ice part. accounting for dust core 
     67c      real dens(ngrid,nlay) ! Mean density of the ice part. accounting for dust core 
    6868 
    6969 
    7070      LOGICAL,SAVE :: firstcall=.true. 
     71!$OMP THREADPRIVATE(firstcall) 
    7172 
    7273c    ** un petit test de coherence 
     
    125126          if (water.and.(iq.eq.igcm_h2o_ice)) then 
    126127            ! compute radii for h2o_ice  
    127              call h2o_reffrad(ngrid,zqi(1,1,igcm_h2o_ice),zt, 
     128             call h2o_reffrad(ngrid,nlay,zqi(1,1,igcm_h2o_ice),zt, 
    128129     &                reffrad(1,1,iaero_h2o),nueffrad(1,1,iaero_h2o)) 
    129130            ! call sedimentation for h2o_ice 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/comdiurn_h.F90

    r222 r227  
    66       real, allocatable, dimension(:) :: sinlon, coslon, sinlat, coslat 
    77       logical :: ldiurn 
     8!$OMP THREADPRIVATE(sinlon,coslon,sinlat,coslat,ldiurn) !ldiurn is unused 
    89 
    910       end module comdiurn_h 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/comgeomfi_h.F90

    r222 r227  
    66       REAL,ALLOCATABLE,DIMENSION(:) :: long,lati,area 
    77       REAL :: totarea, totarea_planet 
     8!$OMP THREADPRIVATE(long,lati,area,totarea) 
    89 
    910       end module comgeomfi_h 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/comsaison_h.F90

    r222 r227  
    99 
    1010       real, allocatable, dimension(:) :: mu0,fract 
     11!$OMP THREADPRIVATE(isaison,callsais,dist_star,declin,mu0,fract) 
    1112 
    1213       end module comsaison_h 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/comsoil_h.F90

    r222 r227  
    1414       !     in physdem (or set via tabfi, or initialized in 
    1515       !                 soil_settings.F) 
     16!$OMP THREADPRIVATE(layer,mlayer,inertiedat,volcapa) 
    1617 
    1718contains 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/condense_cloud.F90

    r222 r227  
    3232!     ptsrf(ngrid)          Surface temperature 
    3333!      
    34 !     pdt(ngrid,nlayermx)   Time derivative before condensation/sublimation of pt 
     34!     pdt(ngrid,nlayer)   Time derivative before condensation/sublimation of pt 
    3535!     pdtsrf(ngrid)         Time derivative before condensation/sublimation of ptsrf 
    3636!     pqsurf(ngrid,nq)      Sedimentation flux at the surface (kg.m-2.s-1) 
     
    3838!     Outputs 
    3939!     ------- 
    40 !     pdpsrf(ngrid)         \  Contribution of condensation/sublimation 
    41 !     pdtc(ngrid,nlayermx)  /  to the time derivatives of Ps, pt, and ptsrf 
    42 !     pdtsrfc(ngrid)       / 
     40!     pdpsrf(ngrid)       \  Contribution of condensation/sublimation 
     41!     pdtc(ngrid,nlayer)  /  to the time derivatives of Ps, pt, and ptsrf 
     42!     pdtsrfc(ngrid)     / 
    4343!      
    4444!     Both 
     
    5656!================================================================== 
    5757 
    58 #include "dimensions.h" 
    59 #include "dimphys.h" 
     58!#include "dimensions.h" 
     59!#include "dimphys.h" 
    6060#include "comcstfi.h" 
    61 #include "comvert.h" 
     61!#include "comvert.h" 
    6262#include "callkeys.h" 
    6363 
     
    9999 
    100100      REAL reffrad(ngrid,nlayer) ! radius (m) of the co2 ice particles 
    101       REAL*8 zt(ngrid,nlayermx) 
    102       REAL zq(ngrid,nlayermx,nq) 
     101      REAL*8 zt(ngrid,nlayer) 
     102      REAL zq(ngrid,nlayer,nq) 
    103103      REAL zcpi 
    104       REAL ztcond (ngrid,nlayermx) 
    105       REAL ztnuc (ngrid,nlayermx) 
     104      REAL ztcond (ngrid,nlayer) 
     105      REAL ztnuc (ngrid,nlayer) 
    106106      REAL ztcondsol(ngrid)  
    107107      REAL zdiceco2(ngrid) 
    108       REAL zcondicea(ngrid,nlayermx), zcondices(ngrid) 
     108      REAL zcondicea(ngrid,nlayer), zcondices(ngrid) 
    109109      REAL zfallice(ngrid), Mfallice(ngrid)  
    110       REAL zmflux(nlayermx+1) 
    111       REAL zu(nlayermx),zv(nlayermx) 
     110      REAL zmflux(nlayer+1) 
     111      REAL zu(nlayer),zv(nlayer) 
    112112      REAL ztsrf(ngrid) 
    113       REAL ztc(nlayermx), ztm(nlayermx+1)  
    114       REAL zum(nlayermx+1) , zvm(nlayermx+1) 
     113      REAL ztc(nlayer), ztm(nlayer+1)  
     114      REAL zum(nlayer+1) , zvm(nlayer+1) 
    115115      LOGICAL condsub(ngrid) 
    116116      REAL subptimestep 
    117117      Integer Ntime 
    118       real masse (ngrid,nlayermx), w(ngrid,nlayermx,nq) 
    119       real wq(ngrid,nlayermx+1) 
     118      real masse (ngrid,nlayer), w(ngrid,nlayer,nq) 
     119      real wq(ngrid,nlayer+1) 
    120120      real vstokes,reff 
    121121 
    122122!     Special diagnostic variables 
    123       real tconda1(ngrid,nlayermx) 
    124       real tconda2(ngrid,nlayermx) 
    125       real zdtsig (ngrid,nlayermx) 
    126       real zdt (ngrid,nlayermx) 
     123      real tconda1(ngrid,nlayer) 
     124      real tconda2(ngrid,nlayer) 
     125      real zdtsig (ngrid,nlayer) 
     126      real zdt (ngrid,nlayer) 
    127127 
    128128!----------------------------------------------------------------------- 
     
    133133      REAL,SAVE :: cpice=1000. 
    134134      REAL,SAVE,ALLOCATABLE,DIMENSION(:) :: emisref 
     135!$OMP THREADPRIVATE(latcond,ccond,cpice,emisref) 
    135136 
    136137      LOGICAL,SAVE :: firstcall=.true. 
     138!$OMP THREADPRIVATE(firstcall) 
    137139      REAL,EXTERNAL :: SSUM 
    138140 
     
    140142 
    141143      INTEGER,SAVE :: i_co2ice=0      ! co2 ice 
     144!$OMP THREADPRIVATE(i_co2ice) 
    142145      CHARACTER(LEN=20) :: tracername ! to temporarily store text 
    143146 
     
    205208!     zcondices(ngrid)     condensation rate on the ground  (kg/m2/s) 
    206209!     zfallice(ngrid)      flux of ice falling on surface   (kg/m2/s) 
    207 !     pdtc(ngrid,nlayermx) dT/dt due to phase changes       (K/s) 
     210!     pdtc(ngrid,nlayer) dT/dt due to phase changes       (K/s) 
    208211      
    209212 
     
    301304             
    302305!     sedimentation computed from radius computed from q in module radii_mod 
    303          call co2_reffrad(ngrid,nq,zq,reffrad) 
     306         call co2_reffrad(ngrid,nlayer,nq,zq,reffrad) 
    304307          
    305308         do  ilay=1,nlayer 
     
    321324!     Computing q after sedimentation 
    322325 
    323          call vlz_fi(ngrid,zq(1,1,i_co2ice),2.,masse,w(1,1,i_co2ice),wq) 
     326         call vlz_fi(ngrid,nlayer,zq(1,1,i_co2ice),2.,masse,w(1,1,i_co2ice),wq) 
    324327 
    325328 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/convadj.F

    r222 r227  
    2929!     ------------ 
    3030 
    31 #include "dimensions.h" 
    32 #include "dimphys.h" 
     31!#include "dimensions.h" 
     32!#include "dimphys.h" 
    3333#include "comcstfi.h" 
    3434#include "callkeys.h" 
     
    5757      INTEGER jcnt, jadrs(ngrid) 
    5858 
    59       REAL sig(nlayermx+1),sdsig(nlayermx),dsig(nlayermx) 
    60       REAL zu(ngrid,nlayermx),zv(ngrid,nlayermx) 
    61       REAL zh(ngrid,nlayermx) 
    62       REAL zu2(ngrid,nlayermx),zv2(ngrid,nlayermx) 
    63       REAL zh2(ngrid,nlayermx), zhc(ngrid,nlayermx) 
     59      REAL sig(nlay+1),sdsig(nlay),dsig(nlay) 
     60      REAL zu(ngrid,nlay),zv(ngrid,nlay) 
     61      REAL zh(ngrid,nlay) 
     62      REAL zu2(ngrid,nlay),zv2(ngrid,nlay) 
     63      REAL zh2(ngrid,nlay), zhc(ngrid,nlay) 
    6464      REAL zhm,zsm,zdsm,zum,zvm,zalpha,zhmc 
    6565 
     
    6767      INTEGER iq,ico2 
    6868      save ico2 
    69       REAL zq(ngrid,nlayermx,nq), zq2(ngrid,nlayermx,nq) 
     69!$OMP THREADPRIVATE(ico2) 
     70      REAL zq(ngrid,nlay,nq), zq2(ngrid,nlay,nq) 
    7071      REAL zqm(nq),zqco2m 
    7172      real m_co2, m_noco2, A , B 
    7273      save A, B 
     74!$OMP THREADPRIVATE(A,B) 
    7375 
    7476      real mtot1, mtot2 , mm1, mm2 
     
    7779      save firstcall 
    7880      data firstcall/.true./ 
     81!$OMP THREADPRIVATE(firstcall) 
    7982 
    8083!     for conservation test 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/dimphy.F90

    r222 r227  
    22   
    33  INTEGER,SAVE :: klon   ! number of atmospheric columns (for this OpenMP subgrid) 
    4   INTEGER,SAVE :: klev   ! number of atmospheric layers 
    5   INTEGER,SAVE :: klevp1 ! number of atmospheric layers+1 
    6   INTEGER,SAVE :: klevm1 ! number of atmospheric layers-1 
     4  INTEGER,SAVE :: klev   ! number of atmospheric layers, read by master 
     5  INTEGER,SAVE :: klevp1 ! number of atmospheric layers+1, read by master 
     6  INTEGER,SAVE :: klevm1 ! number of atmospheric layers-1, read by master 
    77!  INTEGER,SAVE :: kflev 
    88 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/evap.F

    r222 r227  
    1       subroutine evap(ngrid,nq,dtime,pt, pq, pdq, pdt,   
     1      subroutine evap(ngrid,nlayer,nq,dtime,pt, pq, pdq, pdt,   
    22     $     dqevap,dtevap, qevap, tevap)  
    33         
     
    77      implicit none 
    88 
    9 #include "dimensions.h" 
    10 #include "dimphys.h" 
     9!#include "dimensions.h" 
     10!#include "dimphys.h" 
    1111#include "comcstfi.h" 
    1212 
     
    2424!================================================================== 
    2525 
    26       INTEGER ngrid,nq 
     26      INTEGER ngrid,nlayer,nq 
    2727 
    2828! Arguments: 
    29       REAL pt(ngrid,nlayermx)  
    30       REAL pq(ngrid,nlayermx,nq)  
    31       REAL pdt(ngrid,nlayermx)  
    32       REAL pdq(ngrid,nlayermx,nq)  
    33       REAL dqevap(ngrid,nlayermx) 
    34       REAL dtevap(ngrid,nlayermx) 
    35       REAL qevap(ngrid,nlayermx,nq) 
     29      REAL pt(ngrid,nlayer)  
     30      REAL pq(ngrid,nlayer,nq)  
     31      REAL pdt(ngrid,nlayer)  
     32      REAL pdq(ngrid,nlayer,nq)  
     33      REAL dqevap(ngrid,nlayer) 
     34      REAL dtevap(ngrid,nlayer) 
     35      REAL qevap(ngrid,nlayer,nq) 
    3636      REAL dtime 
    3737  
    3838! Local: 
    39       REAL tevap(ngrid,nlayermx)  
     39      REAL tevap(ngrid,nlayer)  
    4040      REAL zlvdcp 
    4141      REAL zlsdcp 
     
    4747! 
    4848 
    49       DO l=1,nlayermx 
     49      DO l=1,nlayer 
    5050        DO ig=1,ngrid 
    5151         qevap(ig,l,igcm_h2o_vap)=pq(ig,l,igcm_h2o_vap)  
     
    5757      ENDDO 
    5858 
    59       DO l = 1, nlayermx   
     59      DO l = 1, nlayer 
    6060        DO ig = 1, ngrid 
    6161         zlvdcp=RLVTT/RCPD!/(1.0+RVTMP2*qevap(ig,l,igcm_h2o_vap)) 
     
    7777      ENDDO 
    7878 
    79       RETURN 
    8079      END 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/forceWCfn.F

    r222 r227  
    1       subroutine forceWCfn(ngrid,nq,pplev,pt,dq,dqs) 
     1      subroutine forceWCfn(ngrid,nlayer,nq,pplev,pt,dq,dqs) 
    22 
    33      USE tracer_h 
     
    1818!================================================================== 
    1919 
    20 #include "dimensions.h" 
    21 #include "dimphys.h" 
     20!#include "dimensions.h" 
     21!#include "dimphys.h" 
    2222#include "comcstfi.h" 
    2323 
    24       INTEGER ngrid,nq 
     24      INTEGER ngrid,nlayer,nq 
    2525 
    2626      real masse, Wtot, Wdiff 
    2727 
    28       real pplev(ngrid,nlayermx+1) 
     28      real pplev(ngrid,nlayer+1) 
    2929      real pt(ngrid) 
    3030 
    3131      real dqs(ngrid,nq)  
    32       real dq(ngrid,nlayermx,nq) 
     32      real dq(ngrid,nlayer,nq) 
    3333 
    3434      integer iq, ig, ilay 
     
    3737        do ig=1,ngrid 
    3838           Wtot = 0.0 
    39            do ilay=1,nlayermx 
     39           do ilay=1,nlayer 
    4040              masse = (pplev(ig,ilay) - pplev(ig,ilay+1))/g 
    4141              Wtot  = Wtot + masse*dq(ig,ilay,iq) 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/gases_h.F90

    r222 r227  
    1414      integer :: ngasmx 
    1515      integer :: vgas 
    16       character*20,allocatable,DIMENSION(:) :: gnom ! name of the gas 
     16      character*20,allocatable,DIMENSION(:) :: gnom ! name of the gas, read by master 
    1717      real,allocatable,DIMENSION(:) :: gfrac 
    1818 
     
    3131      integer :: igas_C2H2 
    3232      integer :: igas_C2H6 
     33!!$OMP THREADPRIVATE(ngasmx,vgas,gnom,gfrac,& 
     34!       !$OMP igas_H2,igas_He,igas_H2O,igas_CO2,igas_CO,igas_N2,& 
     35!       !$OMP igas_O2,igas_SO2,igas_H2S,igas_CH4,igas_NH3,igas_C2H2,igas_C2H6) 
    3336 
    3437      end module gases_h 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/hydrol.F90

    r222 r227  
    44     pctsrf_sic,sea_ice) 
    55 
    6   use ioipsl_getincom  
     6!  use ioipsl_getincom  
     7  use ioipsl_getincom_p 
    78  use watercommon_h, only: T_h2O_ice_liq, RLFTT, rhowater, mx_eau_sol 
    89  USE surfdat_h 
     
    3940!================================================================== 
    4041 
    41 #include "dimensions.h" 
    42 #include "dimphys.h" 
     42!#include "dimensions.h" 
     43!#include "dimphys.h" 
    4344#include "comcstfi.h" 
    4445#include "callkeys.h" 
     
    5051      real albedoice 
    5152      save albedoice 
     53!$OMP THREADPRIVATE(albedoice) 
    5254 
    5355      real snowlayer 
     
    5961      logical,save :: activerunoff ! enable simple runoff scheme? 
    6062      logical,save :: oceanalbvary ! ocean albedo varies with the diurnal cycle? 
     63!$OMP THREADPRIVATE(oceanbulkavg,activerunoff,oceanalbvary) 
    6164 
    6265!     Arguments 
     
    6669      real totalrunoff, tsea, oceanarea 
    6770      save oceanarea 
     71!$OMP THREADPRIVATE(runoff,oceanarea) 
    6872 
    6973      real ptimestep 
     
    96100 
    97101      integer, save :: ivap, iliq, iice 
     102!$OMP THREADPRIVATE(ivap,iliq,iice) 
    98103 
    99104      logical, save :: firstcall 
     105!$OMP THREADPRIVATE(firstcall) 
    100106 
    101107      data firstcall /.true./ 
     
    108114         write(*,*)"Activate runnoff into oceans?" 
    109115         activerunoff=.false. 
    110          call getin("activerunoff",activerunoff) 
     116         call getin_p("activerunoff",activerunoff) 
    111117         write(*,*)" activerunoff = ",activerunoff 
    112118          
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/ini_archive.F

    r222 r227  
    4040 
    4141#include "dimensions.h" 
    42 #include "dimphys.h" 
     42!#include "dimphys.h" 
    4343#include "paramet.h" 
    4444#include "comconst.h" 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/inifis.F

    r222 r227  
    1010      use comsoil_h, only: ini_comsoil_h 
    1111      use control_mod, only: ecritphy 
     12      use planete_mod, only: nres 
    1213      use planetwide_mod, only: planetwide_sumval 
    1314 
     
    4950      use datafile_mod, only: datadir 
    5051! to use  'getin' 
    51       USE ioipsl_getincom  
     52!      USE ioipsl_getincom  
     53      USE ioipsl_getincom_p 
    5254      IMPLICIT NONE 
    53 #include "dimensions.h" 
    54 #include "dimphys.h" 
    55 #include "planete.h" 
     55!#include "dimensions.h" 
     56!#include "dimphys.h" 
     57!#include "planete.h" 
    5658#include "comcstfi.h" 
    5759#include "callkeys.h" 
     
    7880      real psurf,pN2 ! added by RW for Gliese 581d N2+CO2 
    7981 
     82!$OMP MASTER 
    8083      rad=prad 
    8184      daysec=pdaysec 
     
    8891      avocado = 6.02214179e23   ! added by RW 
    8992 
    90 ! -------------------------------------------------------- 
    91 !     The usual Tests 
    92 !     -------------- 
    93       IF (nlayer.NE.nlayermx) THEN 
    94          PRINT*,'STOP in inifis' 
    95          PRINT*,'Probleme de dimensions :' 
    96          PRINT*,'nlayer     = ',nlayer 
    97          PRINT*,'nlayermx   = ',nlayermx 
    98          STOP 
    99       ENDIF 
     93!$OMP END MASTER 
     94!$OMP BARRIER 
    10095 
    10196      ! read in 'ecritphy' (frequency of calls to physics, in dynamical steps) 
    10297      ! (also done in dyn3d/defrun_new but not in LMDZ.COMMON) 
    103       call getin("ecritphy",ecritphy) 
     98      call getin_p("ecritphy",ecritphy) 
    10499 
    105100! -------------------------------------------------------------- 
     
    107102! -------------------------------------------------------------- 
    108103      
     104!$OMP MASTER      
    109105      ! check that 'callphys.def' file is around 
    110106      OPEN(99,file='callphys.def',status='old',form='formatted' 
    111107     &     ,iostat=ierr) 
    112108      CLOSE(99) 
     109      IF(ierr.EQ.0) iscallphys=.true. !iscallphys initialised as false in callkeys.h 
     110!$OMP END MASTER 
     111!$OMP BARRIER 
    113112       
    114       IF(ierr.EQ.0) THEN 
     113!!!      IF(ierr.EQ.0) THEN 
     114      IF(iscallphys) THEN 
    115115         PRINT* 
    116116         PRINT* 
     
    121121         write(*,*) "Directory where external input files are:" 
    122122         ! default 'datadir' is set in "datadir_mod" 
    123          call getin("datadir",datadir) ! default path 
     123         call getin_p("datadir",datadir) ! default path 
    124124         write(*,*) " datadir = ",trim(datadir) 
    125125 
    126126         write(*,*) "Run with or without tracer transport ?" 
    127127         tracer=.false. ! default value 
    128          call getin("tracer",tracer) 
     128         call getin_p("tracer",tracer) 
    129129         write(*,*) " tracer = ",tracer 
    130130 
     
    132132     &      " due to tracer evaporation/condensation?" 
    133133         mass_redistrib=.false. ! default value 
    134          call getin("mass_redistrib",mass_redistrib) 
     134         call getin_p("mass_redistrib",mass_redistrib) 
    135135         write(*,*) " mass_redistrib = ",mass_redistrib 
    136136 
     
    138138         write(*,*) "(if diurnal=false, diurnal averaged solar heating)" 
    139139         diurnal=.true. ! default value 
    140          call getin("diurnal",diurnal) 
     140         call getin_p("diurnal",diurnal) 
    141141         write(*,*) " diurnal = ",diurnal 
    142142 
     
    145145     &   "set in 'start'" 
    146146         season=.true. ! default value 
    147          call getin("season",season) 
     147         call getin_p("season",season) 
    148148         write(*,*) " season = ",season 
    149149 
    150150         write(*,*) "Tidally resonant rotation ?" 
    151151         tlocked=.false. ! default value 
    152          call getin("tlocked",tlocked) 
     152         call getin_p("tlocked",tlocked) 
    153153         write(*,*) "tlocked = ",tlocked 
    154154 
    155155         write(*,*) "Saturn ring shadowing ?" 
    156156         rings_shadow = .false. 
    157          call getin("rings_shadow", rings_shadow) 
     157         call getin_p("rings_shadow", rings_shadow) 
    158158         write(*,*) "rings_shadow = ", rings_shadow 
    159159          
    160160         write(*,*) "Compute latitude-dependent gravity field?" 
    161161         oblate = .false. 
    162          call getin("oblate", oblate) 
     162         call getin_p("oblate", oblate) 
    163163         write(*,*) "oblate = ", oblate 
    164164 
    165165         write(*,*) "Flattening of the planet (a-b)/a " 
    166166         flatten = 0.0 
    167          call getin("flatten", flatten) 
     167         call getin_p("flatten", flatten) 
    168168         write(*,*) "flatten = ", flatten 
    169169          
     
    171171         write(*,*) "Needed if oblate=.true.: J2" 
    172172         J2 = 0.0 
    173          call getin("J2", J2) 
     173         call getin_p("J2", J2) 
    174174         write(*,*) "J2 = ", J2 
    175175          
    176176         write(*,*) "Needed if oblate=.true.: Planet mass (*1e24 kg)" 
    177177         MassPlanet = 0.0 
    178          call getin("MassPlanet", MassPlanet) 
     178         call getin_p("MassPlanet", MassPlanet) 
    179179         write(*,*) "MassPlanet = ", MassPlanet          
    180180 
    181181         write(*,*) "Needed if oblate=.true.: Planet mean radius (m)" 
    182182         Rmean = 0.0 
    183          call getin("Rmean", Rmean) 
     183         call getin_p("Rmean", Rmean) 
    184184         write(*,*) "Rmean = ", Rmean 
    185185          
     
    193193         write(*,*) "Tidal resonance ratio ?" 
    194194         nres=0          ! default value 
    195          call getin("nres",nres) 
     195         call getin_p("nres",nres) 
    196196         write(*,*) "nres = ",nres 
    197197 
    198198         write(*,*) "Write some extra output to the screen ?" 
    199199         lwrite=.false. ! default value 
    200          call getin("lwrite",lwrite) 
     200         call getin_p("lwrite",lwrite) 
    201201         write(*,*) " lwrite = ",lwrite 
    202202 
    203203         write(*,*) "Save statistics in file stats.nc ?" 
    204204         callstats=.true. ! default value 
    205          call getin("callstats",callstats) 
     205         call getin_p("callstats",callstats) 
    206206         write(*,*) " callstats = ",callstats 
    207207 
    208208         write(*,*) "Test energy conservation of model physics ?" 
    209209         enertest=.false. ! default value 
    210          call getin("enertest",enertest) 
     210         call getin_p("enertest",enertest) 
    211211         write(*,*) " enertest = ",enertest 
    212212 
    213213         write(*,*) "Check to see if cpp values used match gases.def ?" 
    214214         check_cpp_match=.true. ! default value 
    215          call getin("check_cpp_match",check_cpp_match) 
     215         call getin_p("check_cpp_match",check_cpp_match) 
    216216         write(*,*) " check_cpp_match = ",check_cpp_match 
    217217 
    218218         write(*,*) "call radiative transfer ?" 
    219219         callrad=.true. ! default value 
    220          call getin("callrad",callrad) 
     220         call getin_p("callrad",callrad) 
    221221         write(*,*) " callrad = ",callrad 
    222222 
    223223         write(*,*) "call correlated-k radiative transfer ?" 
    224224         corrk=.true. ! default value 
    225          call getin("corrk",corrk) 
     225         call getin_p("corrk",corrk) 
    226226         write(*,*) " corrk = ",corrk 
    227227 
    228228         write(*,*) "prohibit calculations outside corrk T grid?" 
    229229         strictboundcorrk=.true. ! default value 
    230          call getin("strictboundcorrk",strictboundcorrk) 
     230         call getin_p("strictboundcorrk",strictboundcorrk) 
    231231         write(*,*) "strictboundcorrk = ",strictboundcorrk 
    232232 
     
    234234     &              "(matters only if callrad=T)" 
    235235         callgasvis=.false. ! default value 
    236          call getin("callgasvis",callgasvis) 
     236         call getin_p("callgasvis",callgasvis) 
    237237         write(*,*) " callgasvis = ",callgasvis 
    238238         
     
    240240     &              "(matters only if callrad=T)" 
    241241         continuum=.true. ! default value 
    242          call getin("continuum",continuum) 
     242         call getin_p("continuum",continuum) 
    243243         write(*,*) " continuum = ",continuum 
    244244 
    245245         write(*,*) "use analytic function for H2O continuum ?" 
    246246         H2Ocont_simple=.false. ! default value 
    247          call getin("H2Ocont_simple",H2Ocont_simple) 
     247         call getin_p("H2Ocont_simple",H2Ocont_simple) 
    248248         write(*,*) " H2Ocont_simple = ",H2Ocont_simple 
    249249  
    250250         write(*,*) "call turbulent vertical diffusion ?" 
    251251         calldifv=.true. ! default value 
    252          call getin("calldifv",calldifv) 
     252         call getin_p("calldifv",calldifv) 
    253253         write(*,*) " calldifv = ",calldifv 
    254254 
    255255         write(*,*) "use turbdiff instead of vdifc ?" 
    256256         UseTurbDiff=.true. ! default value 
    257          call getin("UseTurbDiff",UseTurbDiff) 
     257         call getin_p("UseTurbDiff",UseTurbDiff) 
    258258         write(*,*) " UseTurbDiff = ",UseTurbDiff 
    259259 
    260260         write(*,*) "call convective adjustment ?" 
    261261         calladj=.true. ! default value 
    262          call getin("calladj",calladj) 
     262         call getin_p("calladj",calladj) 
    263263         write(*,*) " calladj = ",calladj 
    264264 
    265265         write(*,*) "call CO2 condensation ?" 
    266266         co2cond=.false. ! default value 
    267          call getin("co2cond",co2cond) 
     267         call getin_p("co2cond",co2cond) 
    268268         write(*,*) " co2cond = ",co2cond 
    269269! Test of incompatibility 
     
    275275         write(*,*) "CO2 supersaturation level ?" 
    276276         co2supsat=1.0 ! default value 
    277          call getin("co2supsat",co2supsat) 
     277         call getin_p("co2supsat",co2supsat) 
    278278         write(*,*) " co2supsat = ",co2supsat 
    279279 
    280280         write(*,*) "Radiative timescale for Newtonian cooling ?" 
    281281         tau_relax=30. ! default value 
    282          call getin("tau_relax",tau_relax) 
     282         call getin_p("tau_relax",tau_relax) 
    283283         write(*,*) " tau_relax = ",tau_relax 
    284284         tau_relax=tau_relax*24*3600 ! convert Earth days --> seconds 
     
    286286         write(*,*)"call thermal conduction in the soil ?" 
    287287         callsoil=.true. ! default value 
    288          call getin("callsoil",callsoil) 
     288         call getin_p("callsoil",callsoil) 
    289289         write(*,*) " callsoil = ",callsoil 
    290290          
     
    292292     &             " physical timestep" 
    293293         iradia=1 ! default value 
    294          call getin("iradia",iradia) 
     294         call getin_p("iradia",iradia) 
    295295         write(*,*)" iradia = ",iradia 
    296296        
    297297         write(*,*)"Rayleigh scattering ?" 
    298298         rayleigh=.false. 
    299          call getin("rayleigh",rayleigh) 
     299         call getin_p("rayleigh",rayleigh) 
    300300         write(*,*)" rayleigh = ",rayleigh 
    301301 
    302302         write(*,*) "Use blackbody for stellar spectrum ?" 
    303303         stelbbody=.false. ! default value 
    304          call getin("stelbbody",stelbbody) 
     304         call getin_p("stelbbody",stelbbody) 
    305305         write(*,*) " stelbbody = ",stelbbody 
    306306 
    307307         write(*,*) "Stellar blackbody temperature ?" 
    308308         stelTbb=5800.0 ! default value 
    309          call getin("stelTbb",stelTbb) 
     309         call getin_p("stelTbb",stelTbb) 
    310310         write(*,*) " stelTbb = ",stelTbb 
    311311 
    312312         write(*,*)"Output mean OLR in 1D?" 
    313313         meanOLR=.false. 
    314          call getin("meanOLR",meanOLR) 
     314         call getin_p("meanOLR",meanOLR) 
    315315         write(*,*)" meanOLR = ",meanOLR 
    316316 
    317317         write(*,*)"Output spectral OLR in 3D?" 
    318318         specOLR=.false. 
    319          call getin("specOLR",specOLR) 
     319         call getin_p("specOLR",specOLR) 
    320320         write(*,*)" specOLR = ",specOLR 
    321321 
    322322         write(*,*)"Operate in kastprof mode?" 
    323323         kastprof=.false. 
    324          call getin("kastprof",kastprof) 
     324         call getin_p("kastprof",kastprof) 
    325325         write(*,*)" kastprof = ",kastprof 
    326326 
    327327         write(*,*)"Uniform absorption in radiative transfer?" 
    328328         graybody=.false. 
    329          call getin("graybody",graybody) 
     329         call getin_p("graybody",graybody) 
    330330         write(*,*)" graybody = ",graybody 
    331331 
     
    333333         write(*,*) "Use slab-ocean ?" 
    334334         ok_slab_ocean=.false.         ! default value 
    335          call getin("ok_slab_ocean",ok_slab_ocean) 
     335         call getin_p("ok_slab_ocean",ok_slab_ocean) 
    336336         write(*,*) "ok_slab_ocean = ",ok_slab_ocean 
    337337 
    338338         write(*,*) "Use slab-sea-ice ?" 
    339339         ok_slab_sic=.true.         ! default value 
    340          call getin("ok_slab_sic",ok_slab_sic) 
     340         call getin_p("ok_slab_sic",ok_slab_sic) 
    341341         write(*,*) "ok_slab_sic = ",ok_slab_sic 
    342342 
    343343         write(*,*) "Use heat transport for the ocean ?" 
    344344         ok_slab_heat_transp=.true.   ! default value 
    345          call getin("ok_slab_heat_transp",ok_slab_heat_transp) 
     345         call getin_p("ok_slab_heat_transp",ok_slab_heat_transp) 
    346346         write(*,*) "ok_slab_heat_transp = ",ok_slab_heat_transp 
    347347 
     
    357357         write(*,*)"Stratospheric temperature for kastprof mode?" 
    358358         Tstrat=167.0 
    359          call getin("Tstrat",Tstrat) 
     359         call getin_p("Tstrat",Tstrat) 
    360360         write(*,*)" Tstrat = ",Tstrat 
    361361 
    362362         write(*,*)"Remove lower boundary?" 
    363363         nosurf=.false. 
    364          call getin("nosurf",nosurf) 
     364         call getin_p("nosurf",nosurf) 
    365365         write(*,*)" nosurf = ",nosurf 
    366366 
     
    375375     .             "... matters only if callsoil=F" 
    376376         intheat=0. 
    377          call getin("intheat",intheat) 
     377         call getin_p("intheat",intheat) 
    378378         write(*,*)" intheat = ",intheat 
    379379 
    380380         write(*,*)"Use Newtonian cooling for radiative transfer?" 
    381381         newtonian=.false. 
    382          call getin("newtonian",newtonian) 
     382         call getin_p("newtonian",newtonian) 
    383383         write(*,*)" newtonian = ",newtonian 
    384384 
     
    399399         write(*,*)"Test physics timescale in 1D?" 
    400400         testradtimes=.false. 
    401          call getin("testradtimes",testradtimes) 
     401         call getin_p("testradtimes",testradtimes) 
    402402         write(*,*)" testradtimes = ",testradtimes 
    403403 
     
    411411         write(*,*)"Default planetary temperature?" 
    412412         tplanet=215.0 
    413          call getin("tplanet",tplanet) 
     413         call getin_p("tplanet",tplanet) 
    414414         write(*,*)" tplanet = ",tplanet 
    415415 
    416416         write(*,*)"Which star?" 
    417417         startype=1 ! default value = Sol 
    418          call getin("startype",startype) 
     418         call getin_p("startype",startype) 
    419419         write(*,*)" startype = ",startype 
    420420 
    421421         write(*,*)"Value of stellar flux at 1 AU?" 
    422422         Fat1AU=1356.0 ! default value = Sol today 
    423          call getin("Fat1AU",Fat1AU) 
     423         call getin_p("Fat1AU",Fat1AU) 
    424424         write(*,*)" Fat1AU = ",Fat1AU 
    425425 
     
    429429         write(*,*)"Varying H2O cloud fraction?" 
    430430         CLFvarying=.false.     ! default value 
    431          call getin("CLFvarying",CLFvarying) 
     431         call getin_p("CLFvarying",CLFvarying) 
    432432         write(*,*)" CLFvarying = ",CLFvarying 
    433433 
    434434         write(*,*)"Value of fixed H2O cloud fraction?" 
    435435         CLFfixval=1.0                ! default value 
    436          call getin("CLFfixval",CLFfixval) 
     436         call getin_p("CLFfixval",CLFfixval) 
    437437         write(*,*)" CLFfixval = ",CLFfixval 
    438438 
    439439         write(*,*)"fixed radii for Cloud particles?" 
    440440         radfixed=.false. ! default value 
    441          call getin("radfixed",radfixed) 
     441         call getin_p("radfixed",radfixed) 
    442442         write(*,*)" radfixed = ",radfixed 
    443443 
     
    448448         write(*,*)"Number mixing ratio of CO2 ice particles:" 
    449449         Nmix_co2=1.e6 ! default value 
    450          call getin("Nmix_co2",Nmix_co2) 
     450         call getin_p("Nmix_co2",Nmix_co2) 
    451451         write(*,*)" Nmix_co2 = ",Nmix_co2 
    452452 
    453453!         write(*,*)"Number of radiatively active aerosols:" 
    454454!         naerkind=0. ! default value 
    455 !         call getin("naerkind",naerkind) 
     455!         call getin_p("naerkind",naerkind) 
    456456!         write(*,*)" naerkind = ",naerkind 
    457457 
    458458         write(*,*)"Opacity of dust (if used):" 
    459459         dusttau=0. ! default value 
    460          call getin("dusttau",dusttau) 
     460         call getin_p("dusttau",dusttau) 
    461461         write(*,*)" dusttau = ",dusttau 
    462462 
    463463         write(*,*)"Radiatively active CO2 aerosols?" 
    464464         aeroco2=.false.     ! default value 
    465          call getin("aeroco2",aeroco2) 
     465         call getin_p("aeroco2",aeroco2) 
    466466         write(*,*)" aeroco2 = ",aeroco2 
    467467 
    468468         write(*,*)"Fixed CO2 aerosol distribution?" 
    469469         aerofixco2=.false.     ! default value 
    470          call getin("aerofixco2",aerofixco2) 
     470         call getin_p("aerofixco2",aerofixco2) 
    471471         write(*,*)" aerofixco2 = ",aerofixco2 
    472472 
    473473         write(*,*)"Radiatively active water ice?" 
    474474         aeroh2o=.false.     ! default value 
    475          call getin("aeroh2o",aeroh2o) 
     475         call getin_p("aeroh2o",aeroh2o) 
    476476         write(*,*)" aeroh2o = ",aeroh2o 
    477477 
    478478         write(*,*)"Fixed H2O aerosol distribution?" 
    479479         aerofixh2o=.false.     ! default value 
    480          call getin("aerofixh2o",aerofixh2o) 
     480         call getin_p("aerofixh2o",aerofixh2o) 
    481481         write(*,*)" aerofixh2o = ",aerofixh2o 
    482482 
    483483         write(*,*)"Radiatively active sulfuric acid aersols?" 
    484484         aeroh2so4=.false.     ! default value 
    485          call getin("aeroh2so4",aeroh2so4) 
     485         call getin_p("aeroh2so4",aeroh2so4) 
    486486         write(*,*)" aeroh2so4 = ",aeroh2so4 
    487487          
     
    490490         write(*,*)"Radiatively active two-layer aersols?" 
    491491         aeroback2lay=.false.     ! default value 
    492          call getin("aeroback2lay",aeroback2lay) 
     492         call getin_p("aeroback2lay",aeroback2lay) 
    493493         write(*,*)" aeroback2lay = ",aeroback2lay 
    494494 
     
    496496     &              "in the tropospheric layer (visible)" 
    497497         obs_tau_col_tropo=8.D0 
    498          call getin("obs_tau_col_tropo",obs_tau_col_tropo) 
     498         call getin_p("obs_tau_col_tropo",obs_tau_col_tropo) 
    499499         write(*,*)" obs_tau_col_tropo = ",obs_tau_col_tropo 
    500500 
     
    502502     &              "in the stratospheric layer (visible)" 
    503503         obs_tau_col_strato=0.08D0 
    504          call getin("obs_tau_col_strato",obs_tau_col_strato) 
     504         call getin_p("obs_tau_col_strato",obs_tau_col_strato) 
    505505         write(*,*)" obs_tau_col_strato = ",obs_tau_col_strato 
    506506 
    507507         write(*,*)"TWOLAY AEROSOL: pres_bottom_tropo? in pa" 
    508508         pres_bottom_tropo=66000.0 
    509          call getin("pres_bottom_tropo",pres_bottom_tropo) 
     509         call getin_p("pres_bottom_tropo",pres_bottom_tropo) 
    510510         write(*,*)" pres_bottom_tropo = ",pres_bottom_tropo 
    511511 
    512512         write(*,*)"TWOLAY AEROSOL: pres_top_tropo? in pa" 
    513513         pres_top_tropo=18000.0 
    514          call getin("pres_top_tropo",pres_top_tropo) 
     514         call getin_p("pres_top_tropo",pres_top_tropo) 
    515515         write(*,*)" pres_top_tropo = ",pres_top_tropo 
    516516 
    517517         write(*,*)"TWOLAY AEROSOL: pres_bottom_strato? in pa" 
    518518         pres_bottom_strato=2000.0 
    519          call getin("pres_bottom_strato",pres_bottom_strato) 
     519         call getin_p("pres_bottom_strato",pres_bottom_strato) 
    520520         write(*,*)" pres_bottom_strato = ",pres_bottom_strato 
    521521 
    522522         write(*,*)"TWOLAY AEROSOL: pres_top_strato? in pa" 
    523523         pres_top_strato=100.0 
    524          call getin("pres_top_strato",pres_top_strato) 
     524         call getin_p("pres_top_strato",pres_top_strato) 
    525525         write(*,*)" pres_top_strato = ",pres_top_strato 
    526526 
     
    528528     &              "tropospheric layer, in meters" 
    529529         size_tropo=2.e-6 
    530          call getin("size_tropo",size_tropo) 
     530         call getin_p("size_tropo",size_tropo) 
    531531         write(*,*)" size_tropo = ",size_tropo 
    532532 
     
    534534     &              "stratospheric layer, in meters" 
    535535         size_strato=1.e-7 
    536          call getin("size_strato",size_strato) 
     536         call getin_p("size_strato",size_strato) 
    537537         write(*,*)" size_strato = ",size_strato 
    538538 
     
    541541         write(*,*)"Cloud pressure level (with kastprof only):" 
    542542         cloudlvl=0. ! default value 
    543          call getin("cloudlvl",cloudlvl) 
     543         call getin_p("cloudlvl",cloudlvl) 
    544544         write(*,*)" cloudlvl = ",cloudlvl 
    545545 
     
    547547         Tstrat=167.0 
    548548         varactive=.false. 
    549          call getin("varactive",varactive) 
     549         call getin_p("varactive",varactive) 
    550550         write(*,*)" varactive = ",varactive 
    551551 
    552552         write(*,*)"Is the variable gas species distribution set?" 
    553553         varfixed=.false. 
    554          call getin("varfixed",varfixed) 
     554         call getin_p("varfixed",varfixed) 
    555555         write(*,*)" varfixed = ",varfixed 
    556556 
    557557         write(*,*)"What is the saturation % of the variable species?" 
    558558         satval=0.8 
    559          call getin("satval",satval) 
     559         call getin_p("satval",satval) 
    560560         write(*,*)" satval = ",satval 
    561561 
     
    570570         write(*,*) "Gravitationnal sedimentation ?" 
    571571         sedimentation=.false. ! default value 
    572          call getin("sedimentation",sedimentation) 
     572         call getin_p("sedimentation",sedimentation) 
    573573         write(*,*) " sedimentation = ",sedimentation 
    574574 
    575575         write(*,*) "Compute water cycle ?" 
    576576         water=.false. ! default value 
    577          call getin("water",water) 
     577         call getin_p("water",water) 
    578578         write(*,*) " water = ",water 
    579579          
     
    587587         write(*,*) "Include water condensation ?" 
    588588         watercond=.false. ! default value 
    589          call getin("watercond",watercond) 
     589         call getin_p("watercond",watercond) 
    590590         write(*,*) " watercond = ",watercond 
    591591 
     
    599599         write(*,*) "Include water precipitation ?" 
    600600         waterrain=.false. ! default value 
    601          call getin("waterrain",waterrain) 
     601         call getin_p("waterrain",waterrain) 
    602602         write(*,*) " waterrain = ",waterrain 
    603603 
    604604         write(*,*) "Include surface hydrology ?" 
    605605         hydrology=.false. ! default value 
    606          call getin("hydrology",hydrology) 
     606         call getin_p("hydrology",hydrology) 
    607607         write(*,*) " hydrology = ",hydrology 
    608608 
    609609         write(*,*) "Evolve surface water sources ?" 
    610610         sourceevol=.false. ! default value 
    611          call getin("sourceevol",sourceevol) 
     611         call getin_p("sourceevol",sourceevol) 
    612612         write(*,*) " sourceevol = ",sourceevol 
    613613 
    614614         write(*,*) "Ice evolution timestep ?" 
    615615         icetstep=100.0 ! default value 
    616          call getin("icetstep",icetstep) 
     616         call getin_p("icetstep",icetstep) 
    617617         write(*,*) " icetstep = ",icetstep 
    618618 
    619619         write(*,*) "Snow albedo ?" 
    620620         albedosnow=0.5         ! default value 
    621          call getin("albedosnow",albedosnow) 
     621         call getin_p("albedosnow",albedosnow) 
    622622         write(*,*) " albedosnow = ",albedosnow 
    623623 
    624624         write(*,*) "Maximum ice thickness ?" 
    625625         maxicethick=2.0         ! default value 
    626          call getin("maxicethick",maxicethick) 
     626         call getin_p("maxicethick",maxicethick) 
    627627         write(*,*) " maxicethick = ",maxicethick 
    628628 
    629629         write(*,*) "Freezing point of seawater ?" 
    630630         Tsaldiff=-1.8          ! default value 
    631          call getin("Tsaldiff",Tsaldiff) 
     631         call getin_p("Tsaldiff",Tsaldiff) 
    632632         write(*,*) " Tsaldiff = ",Tsaldiff 
    633633 
    634634         write(*,*) "Does user want to force cpp and mugaz?" 
    635635         force_cpp=.false. ! default value 
    636          call getin("force_cpp",force_cpp) 
     636         call getin_p("force_cpp",force_cpp) 
    637637         write(*,*) " force_cpp = ",force_cpp 
    638638 
     
    640640           mugaz = -99999. 
    641641           PRINT *,'MEAN MOLECULAR MASS in g mol-1 ?' 
    642            call getin("mugaz",mugaz) 
     642           call getin_p("mugaz",mugaz) 
    643643           IF (mugaz.eq.-99999.) THEN 
    644644               PRINT *, "mugaz must be set if force_cpp = T" 
     
    649649           cpp = -99999. 
    650650           PRINT *,'SPECIFIC HEAT CAPACITY in J K-1 kg-1 ?' 
    651            call getin("cpp",cpp) 
     651           call getin_p("cpp",cpp) 
    652652           IF (cpp.eq.-99999.) THEN 
    653653               PRINT *, "cpp must be set if force_cpp = T" 
     
    711711      ENDDO 
    712712 
     713!$OMP MASTER 
    713714      pi=2.*asin(1.) ! NB: pi is a common in comcstfi.h 
     715!$OMP END MASTER 
     716!$OMP BARRIER 
    714717 
    715718      ! allocate "comsoil_h" arrays 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/iniorbit.F

    r222 r227  
    11      SUBROUTINE iniorbit 
    22     $     (papoastr,pperiastr,pyear_day,pperi_day,pobliq) 
     3       
     4      USE planete_mod, only: apoastr, periastr, year_day, obliquit, 
     5     &                       peri_day, e_elips, p_elips, timeperi 
    36      IMPLICIT NONE 
    47 
     
    1922c   ---------- 
    2023c   - Doit etre appele avant d'utiliser orbite. 
    21 c   - initialise une partie du common planete.h 
     24c   - initialise une partie du common planete_mod 
    2225c 
    2326c   Arguments: 
     
    3538c   ------------- 
    3639 
    37 #include "planete.h" 
     40!#include "planete.h" 
    3841#include "comcstfi.h" 
    3942 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/iniphysiq.F90

    r222 r227  
    1717                       rlatd ! latitudes 
    1818use infotrac, only : nqtot ! number of advected tracers 
     19use planete_mod, only: ini_planete_mod 
    1920 
    2021implicit none 
     22include "dimensions.h" 
     23include "comvert.h" 
    2124 
    2225real,intent(in) :: prad ! radius of the planet (m) 
     
    5861ENDIF 
    5962 
    60 !$OMP PARALLEL PRIVATE(ibegin,iend)  
    61 !$OMP+        SHARED(parea,pcu,pcv,plon,plat) 
     63!$OMP PARALLEL PRIVATE(ibegin,iend) &  
     64        !$OMP SHARED(parea,pcu,pcv,plon,plat) 
    6265       
    6366offset=0 
     
    6770rlond(1:klon_omp)=plon(offset+klon_omp_begin:offset+klon_omp_end) 
    6871rlatd(1:klon_omp)=plat(offset+klon_omp_begin:offset+klon_omp_end) 
     72 
     73! copy over preff , ap() and bp()  
     74call ini_planete_mod(nlayer,preff,ap,bp) 
    6975 
    7076! copy some fundamental parameters to physics  
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/initracer.F

    r222 r227  
    2424 
    2525#include "dimensions.h" 
    26 #include "dimphys.h" 
     26!#include "dimphys.h" 
    2727#include "comcstfi.h" 
    2828#include "callkeys.h" 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/iniwrite_specIR.F

    r222 r227  
    3434#include "netcdf.inc" 
    3535#include "serre.h" 
    36 #include"dimphys.h" 
     36!#include"dimphys.h" 
    3737 
    3838c   Arguments: 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/iniwrite_specVI.F

    r222 r227  
    3434#include "netcdf.inc" 
    3535#include "serre.h" 
    36 #include"dimphys.h" 
     36!#include"dimphys.h" 
    3737 
    3838c   Arguments: 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/interpolateH2H2.F90

    r222 r227  
    4343      logical firstcall 
    4444 
    45       save wn_arr, temp_arr, abs_arr 
     45      save wn_arr, temp_arr, abs_arr !read by master 
    4646 
    4747      character*100 dt_file 
     
    7272         dt_file=TRIM(datadir)//'/continuum_data/H2-H2_norm_2011.cia' 
    7373 
     74!$OMP MASTER 
    7475         open(33,file=dt_file,form='formatted',status='old',iostat=ios) 
    7576         if (ios.ne.0) then        ! file not found 
     
    102103         endif 
    103104         close(33) 
     105!$OMP END MASTER 
     106!$OMP BARRIER 
    104107 
    105108         print*,'interpolateH2H2: At wavenumber ',wn,' cm^-1' 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/interpolateH2He.F90

    r222 r227  
    4545      logical firstcall 
    4646 
    47       save wn_arr, temp_arr, abs_arr 
     47      save wn_arr, temp_arr, abs_arr !read by master 
    4848 
    4949      character*100 dt_file 
     
    7373!     1.1 Open the ASCII files 
    7474         dt_file=TRIM(datadir)//'/continuum_data/H2-He_norm_2011.cia' 
    75  
     75          
     76!$OMP MASTER 
    7677         open(33,file=dt_file,form='formatted',status='old',iostat=ios) 
    7778         if (ios.ne.0) then        ! file not found 
     
    104105         endif 
    105106         close(33) 
     107!$OMP END MASTER 
     108!$OMP BARRIER 
    106109 
    107110         print*,'interpolateH2He: At wavenumber ',wn,' cm^-1' 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/interpolateH2Ocont_CKD.F90

    r222 r227  
    4343      logical firstcall 
    4444 
    45       save wn_arr, temp_arr, abs_arrS, abs_arrF 
     45      save wn_arr, temp_arr, abs_arrS, abs_arrF !read by master 
    4646 
    4747      character*100 dt_file 
     
    5757!     1.1 Open the ASCII files 
    5858 
     59!$OMP MASTER 
    5960         ! nu array 
    6061         dt_file=TRIM(datadir)//'/continuum_data/H2O_CONT_NU.dat' 
     
    129130         print*,'   H2O pressure ',presS,' Pa' 
    130131         print*,'   air pressure ',presF,' Pa' 
     132!$OMP END MASTER 
     133!$OMP BARRIER 
    131134          
    132135      endif 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/interpolateN2H2.F90

    r222 r227  
    4444  logical firstcall 
    4545 
    46   save wn_arr, temp_arr, abs_arr 
     46  save wn_arr, temp_arr, abs_arr !read by master 
    4747 
    4848  character*100 dt_file 
     
    7272     dt_file=TRIM(datadir)//'/continuum_data/N2-H2_2011.cia' 
    7373 
     74!$OMP MASTER 
    7475     open(33,file=dt_file,form='formatted',status='old',iostat=ios) 
    7576     if (ios.ne.0) then        ! file not found 
     
    102103     endif 
    103104     close(33) 
     105!$OMP END MASTER 
     106!$OMP BARRIER 
    104107 
    105108     print*,'interpolateN2H2: At wavenumber ',wn,' cm^-1' 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/interpolateN2N2.F90

    r222 r227  
    4343  logical firstcall 
    4444 
    45   save wn_arr, temp_arr, abs_arr 
     45  save wn_arr, temp_arr, abs_arr !read by master 
    4646 
    4747  character*100 dt_file 
     
    7070     dt_file=TRIM(datadir)//'/continuum_data/N2-N2_2011.cia' 
    7171 
     72!$OMP MASTER 
    7273     open(33,file=dt_file,form='formatted',status='old',iostat=ios) 
    7374     if (ios.ne.0) then        ! file not found 
     
    100101     endif 
    101102     close(33) 
     103!$OMP END MASTER 
     104!$OMP BARRIER 
    102105 
    103106     print*,'interpolateN2N2: At wavenumber ',wn,' cm^-1' 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/iostart.F90

    r222 r227  
    55    INTEGER,SAVE :: nid_start ! NetCDF file identifier for startfi.nc file 
    66    INTEGER,SAVE :: nid_restart ! NetCDF file identifier for restartfi.nc file 
     7!$OMP THREADPRIVATE(nid_start,nid_restart) 
    78     
    89    ! restartfi.nc file dimension identifiers: (see open_restartphy()) 
     
    1617    INTEGER,SAVE :: idim8 ! "ocean_layers" dimension 
    1718    INTEGER,SAVE :: timeindex ! current time index (for time-dependent fields) 
     19!$OMP THREADPRIVATE(idim1,idim2,idim3,idim4,idim5,idim6,idim7,timeindex) 
    1820    INTEGER,PARAMETER :: length=100 ! size of tab_cntrl array 
    1921     
     
    473475    INTEGER                     :: ierr 
    474476    LOGICAL,SAVE :: already_created=.false. 
     477!$OMP THREADPRIVATE(already_created) 
    475478     
    476479    IF (is_master) THEN 
     
    956959     INTEGER :: idim1d 
    957960     logical,save :: firsttime=.true. 
     961!$OMP THREADPRIVATE(firsttime) 
    958962          
    959963    IF (is_master) THEN 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/kcm1d.F90

    r222 r227  
    77  use ioipsl_getincom, only: getin 
    88  use comsaison_h, only: mu0, fract, dist_star 
     9  use planete_mod 
    910!  use control_mod 
    1011 
     
    3031 
    3132#include "dimensions.h" 
    32 #include "dimphys.h" 
     33!#include "dimphys.h" 
    3334#include "callkeys.h" 
    3435#include "comcstfi.h" 
    35 #include "planete.h" 
     36!#include "planete.h" 
    3637!#include "control.h" 
    3738 
     
    4243  integer nlayer,nlevel,nq 
    4344  integer ilay,ilev,iq,iw,iter 
    44   real play(nlayermx)     ! Pressure at the middle of the layers [Pa] 
    45   real zlay(nlayermx)     ! Altitude at middle of the layers [km] 
    46   real plev(nlayermx+1)   ! Intermediate pressure levels [Pa] 
    47   real temp(nlayermx)     ! temperature at the middle of the layers [K] 
     45  real play(llm)     ! Pressure at the middle of the layers [Pa] 
     46  real zlay(llm)     ! Altitude at middle of the layers [km] 
     47  real plev(llm+1)   ! Intermediate pressure levels [Pa] 
     48  real temp(llm)     ! temperature at the middle of the layers [K] 
    4849  real,allocatable :: q(:,:)   ! tracer mixing ratio [kg/kg] 
    4950  real,allocatable :: vmr(:,:) ! tracer mixing ratio [mol/mol] 
     
    5354  real emis, albedo 
    5455 
    55   real muvar(nlayermx+1) 
    56  
    57   real dtsw(nlayermx) ! heating rate (K/s) due to SW 
    58   real dtlw(nlayermx) ! heating rate (K/s) due to LW 
     56  real muvar(llm+1) 
     57 
     58  real dtsw(llm) ! heating rate (K/s) due to SW 
     59  real dtlw(llm) ! heating rate (K/s) due to LW 
    5960  real fluxsurf_lw   ! incident LW flux to surf (W/m2) 
    6061  real fluxtop_lw    ! outgoing LW flux to space (W/m2) 
     
    6465 
    6566  ! not used 
    66   real reffrad(nlayermx,naerkind) 
    67   real nueffrad(nlayermx,naerkind) 
    68   real cloudfrac(nlayermx) 
     67  real reffrad(llm,naerkind) 
     68  real nueffrad(llm,naerkind) 
     69  real cloudfrac(llm) 
    6970  real totcloudfrac 
    7071  real tau_col 
    7172 
    7273  real dTstrat 
    73   real aerosol(nlayermx,naerkind) ! aerosol tau (kg/kg) 
     74  real aerosol(llm,naerkind) ! aerosol tau (kg/kg) 
    7475  real OLR_nu(1,L_NSPECTI) 
    7576  real OSR_nu(1,L_NSPECTV) 
     
    9394 
    9495 
    95   nlayer=nlayermx 
     96  nlayer=llm 
    9697  nlevel=nlayer+1 
    9798 
     
    225226        ! allocate arrays which depend on number of tracers 
    226227        allocate(nametrac(nq)) 
    227         allocate(q(nlayermx,nq)) 
    228         allocate(vmr(nlayermx,nq)) 
     228        allocate(q(nlayer,nq)) 
     229        allocate(vmr(nlayer,nq)) 
    229230        allocate(qsurf(nq)) 
    230231 
     
    268269 
    269270     !    Create vertical profiles 
    270      call kcmprof_fn(psurf,qsurf(1),tsurf,    & 
     271     call kcmprof_fn(nlayer,psurf,qsurf(1),tsurf,    & 
    271272          tstrat,play,plev,zlay,temp,q(:,1),muvar(1)) 
    272273 
     
    316317  ! Calculate total atmospheric energy 
    317318  Eatmtot=0.0 
    318   !  call calcenergy_kcm(tsurf,temp,play,plev,qsurf,& 
     319  !  call calcenergy_kcm(nlayer,tsurf,temp,play,plev,qsurf,& 
    319320  !     q(:,1),muvar,Eatmtot) 
    320321 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/kcmprof_fn.F90

    r222 r227  
    1 subroutine kcmprof_fn(psurf_rcm,qsurf_rcm,Tsurf_rcm,Tstra_rcm,P_rcm,Pl_rcm,z_rcm,T_rcm,q_rcm,m_rcm) 
     1subroutine kcmprof_fn(nlayer,psurf_rcm,qsurf_rcm,Tsurf_rcm,Tstra_rcm,P_rcm,Pl_rcm,z_rcm,T_rcm,q_rcm,m_rcm) 
    22 
    33use params_h 
     
    1212!     ---------------------------------------------------------------- 
    1313 
    14 #include "dimensions.h" 
    15 #include "dimphys.h" 
     14!#include "dimensions.h" 
     15!#include "dimphys.h" 
    1616#include "comcstfi.h" 
    1717#include "callkeys.h" 
     
    2121 
    2222  ! rcm inputs 
     23  integer nlayer 
    2324  real Tsurf_rcm,Tstra_rcm 
    2425 
    2526  ! rcm outputs 
    2627  real psurf_rcm,qsurf_rcm 
    27   real P_rcm(1:nlayermx) 
    28   real Pl_rcm(1:nlayermx+1) 
    29   real z_rcm(1:nlayermx) 
    30   real T_rcm(1:nlayermx),q_rcm(1:nlayermx) 
    31   real m_rcm(1:nlayermx+1) 
     28  real P_rcm(1:nlayer) 
     29  real Pl_rcm(1:nlayer+1) 
     30  real z_rcm(1:nlayer) 
     31  real T_rcm(1:nlayer),q_rcm(1:nlayer) 
     32  real m_rcm(1:nlayer+1) 
    3233 
    3334  ! rcm for interpolation (should really use log coords?) 
     
    161162 
    162163  ! define fine pressure grid 
    163   dlogp_rcm = -(log(psurf_rcm)-log(ptop))/nlayermx 
     164  dlogp_rcm = -(log(psurf_rcm)-log(ptop))/nlayer 
    164165 
    165166  P_rcm(1)  = psurf_rcm*exp(dlogp_rcm) 
    166   do ilay_rcm=1,nlayermx-1 
     167  do ilay_rcm=1,nlayer-1 
    167168     P_rcm(ilay_rcm+1) = P_rcm(ilay_rcm)*exp(dlogp_rcm) 
    168169  enddo 
    169170 
    170171  Pl_rcm(1) = psurf_rcm 
    171   do ilev_rcm=2,nlayermx 
     172  do ilev_rcm=2,nlayer 
    172173     ! log-linear interpolation 
    173174     Pl_rcm(ilev_rcm) = exp( log( P_rcm(ilev_rcm)*P_rcm(ilev_rcm-1) )/2 ) 
     
    318319  do ilay=2,nlay 
    319320 
    320      if(ilay_rcm.le.nlayermx)then 
     321     if(ilay_rcm.le.nlayer)then 
    321322     ! interpolate rcm variables 
    322323 
     
    349350 
    350351  ifinal_rcm=ilay_rcm-1 
    351   if(ifinal_rcm.lt.nlayermx)then 
     352  if(ifinal_rcm.lt.nlayer)then 
    352353     if(verbose)then 
    353354        print*,'Interpolation in kcmprof stopped at layer',ilay_rcm,'!' 
    354355     endif 
    355356 
    356      do ilay_rcm=ifinal_rcm+1,nlayermx 
     357     do ilay_rcm=ifinal_rcm+1,nlayer 
    357358 
    358359        z_rcm(ilay_rcm) = z_rcm(ilay_rcm-1) 
     
    364365  endif 
    365366 
    366   do ilay=2,nlayermx 
     367  do ilay=2,nlayer 
    367368     if(T_rcm(ilay).lt.Ttop)then 
    368369        T_rcm(ilay)=Ttop 
     
    373374  if(co2cond)then 
    374375     print*,'CO2 condensation haircut - assumes CO2-dominated atmosphere!' 
    375      do ilay=2,nlayermx 
     376     do ilay=2,nlayer 
    376377        if(P_rcm(ilay).lt.518000.)then 
    377378           TCO2cond = (-3167.8)/(log(.01*P_rcm(ilay))-23.23) ! Fanale's formula 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/largescale.F90

    r222 r227  
    1       subroutine largescale(ngrid,nq,ptimestep, pplev, pplay, pt, pq,   & 
    2                         pdt, pdq, pdtlsc, pdqvaplsc, pdqliqlsc, rneb) 
     1      subroutine largescale(ngrid,nlayer,nq,ptimestep, pplev, pplay,    & 
     2                    pt, pq, pdt, pdq, pdtlsc, pdqvaplsc, pdqliqlsc, rneb) 
    33 
    44 
    55!     to use  'getin' 
    6       use ioipsl_getincom  
     6!      use ioipsl_getincom  
     7      use ioipsl_getincom_p 
    78      use watercommon_h, only : RLVTT, RCPD, RVTMP2,  & 
    89          T_h2O_ice_clouds,T_h2O_ice_liq,Psat_waterDP,Lcpdqsat_waterDP 
     
    2324!================================================================== 
    2425 
    25 #include "dimensions.h"  
    26 #include "dimphys.h" 
     26!#include "dimensions.h"  
     27!#include "dimphys.h" 
    2728#include "comcstfi.h" 
    2829 
    2930#include "callkeys.h" 
    3031 
    31       INTEGER ngrid,nq 
     32      INTEGER ngrid,nlayer,nq 
    3233 
    3334!     Arguments 
    3435      REAL ptimestep                 ! intervalle du temps (s) 
    35       REAL pplev(ngrid,nlayermx+1) ! pression a inter-couche 
    36       REAL pplay(ngrid,nlayermx)   ! pression au milieu de couche 
    37       REAL pt(ngrid,nlayermx)      ! temperature (K) 
    38       REAL pq(ngrid,nlayermx,nq) ! tracer mixing ratio (kg/kg) 
    39       REAL pdt(ngrid,nlayermx)     ! physical temperature tenedency (K/s) 
    40       REAL pdq(ngrid,nlayermx,nq)! physical tracer tenedency (K/s) 
    41       REAL pdtlsc(ngrid,nlayermx)  ! incrementation de la temperature (K) 
    42       REAL pdqvaplsc(ngrid,nlayermx) ! incrementation de la vapeur d'eau 
    43       REAL pdqliqlsc(ngrid,nlayermx) ! incrementation de l'eau liquide 
    44       REAL rneb(ngrid,nlayermx)    ! fraction nuageuse 
     36      REAL pplev(ngrid,nlayer+1) ! pression a inter-couche 
     37      REAL pplay(ngrid,nlayer)   ! pression au milieu de couche 
     38      REAL pt(ngrid,nlayer)      ! temperature (K) 
     39      REAL pq(ngrid,nlayer,nq) ! tracer mixing ratio (kg/kg) 
     40      REAL pdt(ngrid,nlayer)     ! physical temperature tenedency (K/s) 
     41      REAL pdq(ngrid,nlayer,nq)! physical tracer tenedency (K/s) 
     42      REAL pdtlsc(ngrid,nlayer)  ! incrementation de la temperature (K) 
     43      REAL pdqvaplsc(ngrid,nlayer) ! incrementation de la vapeur d'eau 
     44      REAL pdqliqlsc(ngrid,nlayer) ! incrementation de l'eau liquide 
     45      REAL rneb(ngrid,nlayer)    ! fraction nuageuse 
    4546 
    4647 
    4748!     Options du programme 
    4849      REAL, SAVE :: ratqs   ! determine largeur de la distribution de vapeur 
     50!$OMP THREADPRIVATE(ratqs) 
    4951 
    5052!     Variables locales 
     
    6365       
    6466! evaporation calculations 
    65       REAL dqevap(ngrid,nlayermx),dtevap(ngrid,nlayermx)      
    66       REAL qevap(ngrid,nlayermx,nq) 
    67       REAL tevap(ngrid,nlayermx) 
     67      REAL dqevap(ngrid,nlayer),dtevap(ngrid,nlayer)      
     68      REAL qevap(ngrid,nlayer,nq) 
     69      REAL tevap(ngrid,nlayer) 
    6870 
    6971      DOUBLE PRECISION zx_q(ngrid) 
    7072      LOGICAL,SAVE :: firstcall=.true. 
     73!$OMP THREADPRIVATE(firstcall) 
    7174 
    7275 
     
    7578         write(*,*) "value for ratqs? " 
    7679         ratqs=0.2 ! default value 
    77          call getin("ratqs",ratqs) 
     80         call getin_p("ratqs",ratqs) 
    7881         write(*,*) " ratqs = ",ratqs 
    7982 
     
    8386!     GCM -----> subroutine variables, initialisation of outputs 
    8487 
    85       pdtlsc(1:ngrid,1:nlayermx)  = 0.0 
    86       pdqvaplsc(1:ngrid,1:nlayermx)  = 0.0 
    87       pdqliqlsc(1:ngrid,1:nlayermx) = 0.0 
    88       rneb(1:ngrid,1:nlayermx) = 0.0 
     88      pdtlsc(1:ngrid,1:nlayer)  = 0.0 
     89      pdqvaplsc(1:ngrid,1:nlayer)  = 0.0 
     90      pdqliqlsc(1:ngrid,1:nlayer) = 0.0 
     91      rneb(1:ngrid,1:nlayer) = 0.0 
    8992      Lcp=RLVTT/RCPD 
    9093 
    9194 
    9295      ! Evaporate cloud water/ice 
    93       call evap(ngrid,nq,ptimestep,pt,pq,pdq,pdt,dqevap,dtevap,qevap,tevap) 
     96      call evap(ngrid,nlayer,nq,ptimestep,pt,pq,pdq,pdt,dqevap,dtevap,qevap,tevap) 
    9497      ! note: we use qevap but not tevap in largescale/moistadj 
    9598            ! otherwise is a big mess 
     
    97100 
    98101!  Boucle verticale (du haut vers le bas) 
    99    DO k = nlayermx, 1, -1 
     102   DO k = nlayer, 1, -1 
    100103 
    101104      zt(1:ngrid)=pt(1:ngrid,k)+(pdt(1:ngrid,k)+dtevap(1:ngrid,k))*ptimestep 
     
    171174         pdtlsc(1:ngrid,k)  = pdqliqlsc(1:ngrid,k)*real(Lcp) 
    172175 
    173    Enddo ! k= nlayermx, 1, -1 
     176   Enddo ! k= nlayer, 1, -1 
    174177  
    175178 
    176       return 
    177179      end 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/lect_start_archive.F

    r222 r227  
    1       SUBROUTINE lect_start_archive(date,tsurf,tsoil,emis,q2, 
     1      SUBROUTINE lect_start_archive(ngrid,nlayer, 
     2     &     date,tsurf,tsoil,emis,q2, 
    23     &     t,ucov,vcov,ps,h,phisold_newgrid, 
    34     &     q,qsurf,surfith,nid, 
     
    3031 
    3132#include "dimensions.h" 
    32 #include "dimphys.h" 
     33!#include "dimphys.h" 
    3334!#include "planete.h" 
    3435#include "paramet.h" 
     
    4748c======================================================================= 
    4849 
     50      INTEGER,INTENT(IN) :: ngrid, nlayer 
     51 
    4952c Old variables dimensions (from file) 
    5053c------------------------------------ 
     
    99102c variable physique 
    100103c------------------ 
    101       REAL tsurf(ngridmx) ! surface temperature 
    102       REAL tsoil(ngridmx,nsoilmx) ! soil temperature 
    103       REAL co2ice(ngridmx) ! CO2 ice layer 
    104       REAL emis(ngridmx) 
    105       REAL q2(ngridmx,nlayermx+1),qsurf(ngridmx,nqtot) 
    106       REAL tslab(ngridmx,noceanmx) 
    107       REAL rnat(ngridmx),pctsrf_sic(ngridmx) 
    108       REAL tsea_ice(ngridmx),sea_ice(ngridmx) 
    109 c     REAL phisfi(ngridmx) 
     104      REAL tsurf(ngrid) ! surface temperature 
     105      REAL tsoil(ngrid,nsoilmx) ! soil temperature 
     106      REAL co2ice(ngrid) ! CO2 ice layer 
     107      REAL emis(ngrid) 
     108      REAL q2(ngrid,llm+1),qsurf(ngrid,nqtot) 
     109      REAL tslab(ngrid,noceanmx) 
     110      REAL rnat(ngrid),pctsrf_sic(ngrid) 
     111      REAL tsea_ice(ngrid),sea_ice(ngrid) 
     112c     REAL phisfi(ngrid) 
    110113 
    111114      INTEGER i,j,l 
     
    322325      allocate(varp1 (imold+1,jmold+1,llm+1)) 
    323326 
    324       write(*,*) 'q2',ngridmx,nlayermx+1 
     327      write(*,*) 'q2',ngrid,llm+1 
    325328      write(*,*) 'q2S',iip1,jjp1,llm+1 
    326329      write(*,*) 'q2old',imold+1,jmold+1,lmold+1 
     
    10521055      call interp_horiz (tsurfold,tsurfs,imold,jmold,iim,jjm,1, 
    10531056     &                   rlonuold,rlatvold,rlonu,rlatv) 
    1054       call gr_dyn_fi (1,iim+1,jjm+1,ngridmx,tsurfs,tsurf) 
     1057      call gr_dyn_fi (1,iim+1,jjm+1,ngrid,tsurfs,tsurf) 
    10551058c     write(44,*) 'tsurf', tsurf 
    10561059 
     
    10591062!     &                  imold,jmold,iim,jjm,nsoilmx, 
    10601063!     &                   rlonuold,rlatvold,rlonu,rlatv) 
    1061 !      call gr_dyn_fi (nsoilmx,iim+1,jjm+1,ngridmx,tsoils,tsoil) 
     1064!      call gr_dyn_fi (nsoilmx,iim+1,jjm+1,ngrid,tsoils,tsoil) 
    10621065c     write(45,*) 'tsoil',tsoil 
    10631066 
     
    10651068      call interp_horiz (emisold,emiss,imold,jmold,iim,jjm,1, 
    10661069     &                   rlonuold,rlatvold,rlonu,rlatv) 
    1067       call gr_dyn_fi (1,iim+1,jjm+1,ngridmx,emiss,emis) 
     1070      call gr_dyn_fi (1,iim+1,jjm+1,ngrid,emiss,emis) 
    10681071c     write(46,*) 'emis',emis 
    10691072 
     
    12011204 
    12021205      ! Reshape inertiedatS to scalar grid as inertiedat 
    1203       call gr_dyn_fi (nsoilmx,iim+1,jjm+1,ngridmx, 
     1206      call gr_dyn_fi (nsoilmx,iim+1,jjm+1,ngrid, 
    12041207     &                  inertiedatS,inertiedat) 
    12051208       
     
    12871290 
    12881291      ! Reshape tsoilS to scalar grid as tsoil 
    1289        call gr_dyn_fi (nsoilmx,iim+1,jjm+1,ngridmx,tsoilS,tsoil) 
     1292       call gr_dyn_fi (nsoilmx,iim+1,jjm+1,ngrid,tsoilS,tsoil) 
    12901293 
    12911294c----------------------------------------------------------------------- 
     
    12941297      call interp_horiz (tslabold,tslabs,imold,jmold,iim,jjm,noceanmx, 
    12951298     &                   rlonuold,rlatvold,rlonu,rlatv) 
    1296       call gr_dyn_fi (1,iim+1,jjm+1,ngridmx,tslabs,tslab) 
     1299      call gr_dyn_fi (1,iim+1,jjm+1,ngrid,tslabs,tslab) 
    12971300 
    12981301      call interp_horiz (rnatold,rnats,imold,jmold,iim,jjm,1, 
    12991302     &                   rlonuold,rlatvold,rlonu,rlatv) 
    1300       call gr_dyn_fi (1,iim+1,jjm+1,ngridmx,rnats,rnat) 
     1303      call gr_dyn_fi (1,iim+1,jjm+1,ngrid,rnats,rnat) 
    13011304 
    13021305      call interp_horiz (pctsrf_sicold,pctsrf_sics,imold,jmold,iim, 
    13031306     &                   jjm,1,rlonuold,rlatvold,rlonu,rlatv) 
    1304       call gr_dyn_fi (1,iim+1,jjm+1,ngridmx,pctsrf_sics,pctsrf_sic) 
     1307      call gr_dyn_fi (1,iim+1,jjm+1,ngrid,pctsrf_sics,pctsrf_sic) 
    13051308 
    13061309      call interp_horiz (tsea_iceold,tsea_ices,imold,jmold,iim,jjm,1, 
    13071310     &                   rlonuold,rlatvold,rlonu,rlatv) 
    1308       call gr_dyn_fi (1,iim+1,jjm+1,ngridmx,tsea_ices,tsea_ice) 
     1311      call gr_dyn_fi (1,iim+1,jjm+1,ngrid,tsea_ices,tsea_ice) 
    13091312 
    13101313      call interp_horiz (sea_iceold,sea_ices,imold,jmold,iim,jjm,1, 
    13111314     &                   rlonuold,rlatvold,rlonu,rlatv) 
    1312       call gr_dyn_fi (1,iim+1,jjm+1,ngridmx,sea_ices,sea_ice) 
     1315      call gr_dyn_fi (1,iim+1,jjm+1,ngrid,sea_ices,sea_ice) 
    13131316 
    13141317c----------------------------------------------------------------------- 
     
    13341337     &                   rlonuold,rlatvold,rlonu,rlatv) 
    13351338      write (*,*) 'lect_start_archive: q2s ', q2s (1,2,1)  ! INFO 
    1336       call gr_dyn_fi (llm+1,iim+1,jjm+1,ngridmx,q2s,q2) 
     1339      call gr_dyn_fi (llm+1,iim+1,jjm+1,ngrid,q2s,q2) 
    13371340      write (*,*) 'lect_start_archive: q2 ', q2 (1,2)  ! INFO 
    13381341c     write(47,*) 'q2',q2 
     
    13841387      enddo 
    13851388 
    1386       call gr_dyn_fi (nqtot,iim+1,jjm+1,ngridmx,qsurfs,qsurf) 
     1389      call gr_dyn_fi (nqtot,iim+1,jjm+1,ngrid,qsurfs,qsurf) 
    13871390 
    13881391c traceurs 3D 
     
    14351438      enddo 
    14361439       
    1437 !      call gr_dyn_fi (1,iim+1,jjm+1,ngridmx,co2ices,co2ice) 
     1440!      call gr_dyn_fi (1,iim+1,jjm+1,ngrid,co2ices,co2ice) 
    14381441! no need to transfer "co2ice" any more; it is in qsurf(igcm_co2_ice) 
    14391442 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/mass_redistribution.F90

    r222 r227  
    99       USE comgeomfi_h 
    1010       USE tracer_h 
     11       USE planete_mod, only: bp 
    1112 
    1213       IMPLICIT NONE 
     
    5051!    ------------------ 
    5152! 
    52 #include "dimensions.h" 
    53 #include "dimphys.h" 
     53!#include "dimensions.h" 
     54!#include "dimphys.h" 
    5455#include "comcstfi.h" 
    55 #include "comvert.h" 
    56 #include "paramet.h" 
     56!#include "comvert.h" 
     57!#include "paramet.h" 
    5758#include "callkeys.h" 
    5859 
     
    8485 
    8586!    vertical reorganization of sigma levels 
    86       REAL zzu(nlayermx),zzv(nlayermx) 
    87       REAL zzq(nlayermx,nq),zzt(nlayermx) 
     87      REAL zzu(nlayer),zzv(nlayer) 
     88      REAL zzq(nlayer,nq),zzt(nlayer) 
    8889!    Dummy variables       
    8990      INTEGER n,l,ig,iq 
    90       REAL zdtsig(ngrid,nlayermx) 
    91       REAL zmass(ngrid,nlayermx),zzmass(nlayermx),w(nlayermx+1) 
    92       REAL zdmass_sum(ngrid,nlayermx+1) 
    93       REAL zmflux(nlayermx+1) 
    94       REAL zq1(nlayermx) 
     91      REAL zdtsig(ngrid,nlayer) 
     92      REAL zmass(ngrid,nlayer),zzmass(nlayer),w(nlayer+1) 
     93      REAL zdmass_sum(ngrid,nlayer+1) 
     94      REAL zmflux(nlayer+1) 
     95      REAL zq1(nlayer) 
    9596      REAL ztsrf(ngrid) 
    96       REAL ztm(nlayermx+1)  
    97       REAL zum(nlayermx+1) , zvm(nlayermx+1) 
    98       REAL zqm(nlayermx+1,nq),zqm1(nlayermx+1) 
     97      REAL ztm(nlayer+1)  
     98      REAL zum(nlayer+1) , zvm(nlayer+1) 
     99      REAL zqm(nlayer+1,nq),zqm1(nlayer+1) 
     100      REAL sigma(nlayer+1) 
    99101 
    100102!   local saved variables 
    101103      LOGICAL, SAVE :: firstcall=.true. 
     104!$OMP THREADPRIVATE(firstcall) 
    102105 
    103106!---------------------------------------------------------------------- 
     
    127130 
    128131      DO ig=1,ngrid 
    129          zdmass_sum(ig,nlayermx+1)=0. 
    130          DO l = nlayermx, 1, -1 
     132         zdmass_sum(ig,nlayer+1)=0. 
     133         DO l = nlayer, 1, -1 
    131134           zmass(ig,l) = (pplev(ig,l)-pplev(ig,l+1))/glat(ig) 
    132135           zdmass_sum(ig,l)= zdmass_sum(ig,l+1)+pdmassmr(ig,l) 
     
    181184!  Correction to account for redistribution between sigma or hybrid  
    182185!  layers when changing surface pressure 
    183 !  zzx quantities have dimension (nlayermx) to speed up calculation 
     186!  zzx quantities have dimension (nlayer) to speed up calculation 
    184187! ************************************************************* 
    185188 
    186189      DO ig=1,ngrid 
    187          zzt(1:nlayermx)  = pt(ig,1:nlayermx) + pdt(ig,1:nlayermx) * ptimestep 
    188          zzu(1:nlayermx)  = pu(ig,1:nlayermx) + pdu(ig,1:nlayermx) * ptimestep 
    189          zzv(1:nlayermx)  = pv(ig,1:nlayermx) + pdv(ig,1:nlayermx) * ptimestep 
    190          zzq(1:nlayermx,1:nq)=pq(ig,1:nlayermx,1:nq)+pdq(ig,1:nlayermx,1:nq)*ptimestep ! must add the water that has fallen??? 
     190         zzt(1:nlayer)  = pt(ig,1:nlayer) + pdt(ig,1:nlayer) * ptimestep 
     191         zzu(1:nlayer)  = pu(ig,1:nlayer) + pdu(ig,1:nlayer) * ptimestep 
     192         zzv(1:nlayer)  = pv(ig,1:nlayer) + pdv(ig,1:nlayer) * ptimestep 
     193         zzq(1:nlayer,1:nq)=pq(ig,1:nlayer,1:nq)+pdq(ig,1:nlayer,1:nq)*ptimestep ! must add the water that has fallen??? 
    191194 
    192195!  Mass fluxes of air through the sigma levels (kg.m-2.s-1)  (>0 when up) 
    193196!  """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    194  
    195197         zmflux(1) = zmassboil(ig) 
     198         sigma(1)=1 
    196199         DO l=1,nlayer 
     200           ! Ehouarn: shouldn't we rather compute sigma levels than use bp()? 
     201!           sigma(l+1)=pplev(ig,l+1)/pplev(ig,1) 
     202!           zmflux(l+1) = zmflux(l) + pdmassmr(ig,l) - & 
     203!                        (sigma(l)-sigma(l+1))*(zdmass_sum(ig,1)+zmflux(1)) 
     204!            if (abs(zmflux(l+1)).lt.1E-13.OR.sigma(l+1).eq.0.) zmflux(l+1)=0. 
     205           ! Ehouarn: but for now leave things as before 
    197206            zmflux(l+1) = zmflux(l) + pdmassmr(ig,l) - (bp(l)-bp(l+1))*(zdmass_sum(ig,1)+zmflux(1)) 
    198207! zmflux set to 0 if very low to avoid: top layer is disappearing in v1ld   
     
    202211! Mass of each layer 
    203212! ------------------  
    204          zzmass(1:nlayermx)=zmass(ig,1:nlayermx)*(1.+pdpsrfmr(ig)*ptimestep/pplev(ig,1)) 
     213         zzmass(1:nlayer)=zmass(ig,1:nlayer)*(1.+pdpsrfmr(ig)*ptimestep/pplev(ig,1)) 
    205214 
    206215 
     
    219228          
    220229!        Van Leer scheme: 
    221          w(1:nlayermx+1)=-zmflux(1:nlayermx+1)*ptimestep 
     230         w(1:nlayer+1)=-zmflux(1:nlayer+1)*ptimestep 
    222231         call vl1d(zzt,2.,zzmass,w,ztm)  
    223232         call vl1d(zzu ,2.,zzmass,w,zum)  
    224233         call vl1d(zzv ,2.,zzmass,w,zvm)  
    225234         do iq=1,nq 
    226            zq1(1:nlayermx)=zzq(1:nlayermx,iq) 
     235           zq1(1:nlayer)=zzq(1:nlayer,iq) 
    227236           zqm1(1)=zqm(1,iq) 
    228237!               print*,iq 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/mod_grid_phy_lmdz.F90

    r222 r227  
    1212  INTEGER,SAVE :: nbp_lev  ! == llm 
    1313  INTEGER,SAVE :: klon_glo 
     14!$OMP THREADPRIVATE(nbp_lon,nbp_lat,nbp_lev,klon_glo) 
    1415 
    1516  INTERFACE grid1dTo2d_glo 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/mod_phys_lmdz_mpi_data.F90

    r222 r227  
    1616  INTEGER,SAVE :: klon_mpi_end 
    1717  INTEGER,SAVE :: klon_mpi 
     18!!$OMP THREADPRIVATE(ii_begin,ii_end,jj_begin,jj_end,jj_nb,ij_begin,& 
     19!       !$OMP ij_end,ij_nb,klon_mpi_begin,klon_mpi_end,klon_mpi) 
    1820   
    1921  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: jj_para_nb 
     
    3133  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: klon_mpi_para_begin 
    3234  INTEGER,SAVE,ALLOCATABLE,DIMENSION(:) :: klon_mpi_para_end  
     35!!$OMP THREADPRIVATE(jj_para_nb,jj_para_begin,jj_para_end,ii_para_begin,ii_para_end,& 
     36!       !$OMP ij_para_nb,ij_para_begin,ij_para_end,klon_mpi_para_nb,klon_mpi_para_begin,& 
     37!       !$OMP klon_mpi_para_end) 
    3338 
    3439   
     
    3843  LOGICAL,SAVE :: is_mpi_root 
    3944  LOGICAL,SAVE :: is_using_mpi 
     45!!$OMP THREADPRIVATE(mpi_rank,mpi_size,mpi_root,is_mpi_root,is_using_mpi) 
    4046   
    4147   
     
    4349  LOGICAL,SAVE :: is_south_pole 
    4450  INTEGER,SAVE :: COMM_LMDZ_PHY 
     51!!$OMP THREADPRIVATE(is_north_pole,is_south_pole,COMM_LMDZ_PHY) 
    4552 
    4653CONTAINS 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/mod_phys_lmdz_para.F90

    r222 r227  
    1313   
    1414!$OMP THREADPRIVATE(klon_loc,is_master) 
     15!$OMP THREADPRIVATE(is_sequential,is_parallel) 
    1516   
    1617CONTAINS 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/moistadj.F90

    r222 r227  
    1 subroutine moistadj(ngrid, nq, pt, pq, pdq, pplev, pplay, pdtmana, pdqmana, ptimestep, rneb) 
     1subroutine moistadj(ngrid, nlayer, nq, pt, pq, pdq, pplev, pplay, pdtmana, pdqmana, ptimestep, rneb) 
    22 
    33  use watercommon_h, only: T_h2O_ice_liq, RLVTT, RCPD, RCPV, Psat_water, Lcpdqsat_water 
    4   USE tracer_h 
     4  USE tracer_h, only: igcm_h2o_vap, igcm_h2o_ice 
    55 
    66  implicit none 
     
    2020!===================================================================== 
    2121 
    22 #include "dimensions.h" 
    23 #include "dimphys.h" 
     22!#include "dimensions.h" 
     23!#include "dimphys.h" 
    2424#include "comcstfi.h" 
    2525 
    26       INTEGER ngrid, nq 
    27  
    28       REAL pt(ngrid,nlayermx)            ! temperature (K) 
    29       REAL pq(ngrid,nlayermx,nq)       ! tracer (kg/kg) 
    30       REAL pdq(ngrid,nlayermx,nq) 
    31  
    32       REAL pdqmana(ngrid,nlayermx,nq)  ! tendency of tracers (kg/kg.s-1) 
    33       REAL pdtmana(ngrid,nlayermx)       ! temperature increment 
     26      INTEGER,INTENT(IN) :: ngrid, nlayer, nq 
     27 
     28      REAL,INTENT(IN) :: pt(ngrid,nlayer) ! temperature (K) 
     29      REAL,INTENT(IN) :: pq(ngrid,nlayer,nq) ! tracer (kg/kg) 
     30      REAL,INTENT(IN) :: pdq(ngrid,nlayer,nq) 
     31      REAL,INTENT(IN) :: pplev(ngrid,nlayer+1) ! inter-layer pressure (Pa) 
     32      REAL,INTENT(IN) :: pplay(ngrid,nlayer)   ! mid-layer pressure (Pa) 
     33      REAL,INTENT(IN) :: ptimestep ! physics timestep (s) 
     34      REAL,INTENT(OUT) :: pdqmana(ngrid,nlayer,nq)  ! tracer tendencies (kg/kg.s-1) 
     35      REAL,INTENT(OUT) :: pdtmana(ngrid,nlayer) ! temperature increment(K/s) 
     36      REAL,INTENT(OUT) :: rneb(ngrid,nlayer) ! cloud fraction  
    3437 
    3538!     local variables 
    36       REAL zt(ngrid,nlayermx)      ! temperature (K) 
    37       REAL zq(ngrid,nlayermx)      ! humidite specifique (kg/kg) 
    38       REAL pplev(ngrid,nlayermx+1) ! pression a inter-couche (Pa) 
    39       REAL pplay(ngrid,nlayermx)   ! pression au milieu de couche (Pa) 
    40  
    41       REAL d_t(ngrid,nlayermx)     ! temperature increment 
    42       REAL d_q(ngrid,nlayermx)     ! incrementation pour vapeur d'eau 
    43       REAL d_ql(ngrid,nlayermx)    ! incrementation pour l'eau liquide 
    44       REAL rneb(ngrid,nlayermx) ! cloud fraction  
    45       REAL ptimestep 
     39      REAL zt(ngrid,nlayer)      ! temperature (K) 
     40      REAL zq(ngrid,nlayer)      ! humidite specifique (kg/kg) 
     41 
     42      REAL d_t(ngrid,nlayer)     ! temperature increment 
     43      REAL d_q(ngrid,nlayer)     ! incrementation pour vapeur d'eau 
     44      REAL d_ql(ngrid,nlayer)    ! incrementation pour l'eau liquide 
    4645 
    4746!      REAL t_coup 
     
    5554      INTEGER k1, k1p, k2, k2p 
    5655      LOGICAL itest(ngrid) 
    57       REAL delta_q(ngrid, nlayermx) 
    58       DOUBLE PRECISION :: cp_new_t(nlayermx), v_cptt(ngrid,nlayermx) 
    59       REAL cp_delta_t(nlayermx) 
    60       DOUBLE PRECISION :: v_cptj(nlayermx), v_cptjk1, v_ssig 
     56      REAL delta_q(ngrid, nlayer) 
     57      DOUBLE PRECISION :: cp_new_t(nlayer), v_cptt(ngrid,nlayer) 
     58      REAL cp_delta_t(nlayer) 
     59      DOUBLE PRECISION :: v_cptj(nlayer), v_cptjk1, v_ssig 
    6160      REAL v_p, v_t, v_zqs,v_cptt2,v_pratio,v_dlnpsat 
    62       REAL zqs(ngrid,nlayermx), zdqs(ngrid,nlayermx),zpsat(ngrid,nlayermx),zdlnpsat(ngrid,nlayermx) 
     61      REAL zqs(ngrid,nlayer), zdqs(ngrid,nlayer),zpsat(ngrid,nlayer),zdlnpsat(ngrid,nlayer) 
    6362      REAL zq1(ngrid), zq2(ngrid) 
    64       DOUBLE PRECISION :: gamcpdz(ngrid,2:nlayermx) 
     63      DOUBLE PRECISION :: gamcpdz(ngrid,2:nlayer) 
    6564      DOUBLE PRECISION :: zdp, zdpm 
    6665 
     
    6867      REAL zflo ! flotabilite 
    6968 
    70       DOUBLE PRECISION :: local_q(ngrid,nlayermx),local_t(ngrid,nlayermx) 
     69      DOUBLE PRECISION :: local_q(ngrid,nlayer),local_t(ngrid,nlayer) 
    7170 
    7271      REAL zdelta, zcor, zcvm5 
     
    7877      INTEGER,SAVE :: i_h2o=0  ! water vapour 
    7978      INTEGER,SAVE :: i_ice=0  ! water ice 
    80  
    81       LOGICAL firstcall 
    82       SAVE firstcall 
    83  
    84       DATA firstcall /.TRUE./ 
     79!$OMP THREADPRIVATE(i_h2o,i_ice) 
     80 
     81      LOGICAL,SAVE :: firstcall=.TRUE. 
     82!$OMP THREADPRIVATE(firstcall) 
    8583 
    8684      IF (firstcall) THEN 
     
    9694 
    9795!     GCM -----> subroutine variables 
    98       zq(1:ngrid,1:nlayermx)    = pq(1:ngrid,1:nlayermx,i_h2o)+ pdq(1:ngrid,1:nlayermx,i_h2o)*ptimestep 
    99       zt(1:ngrid,1:nlayermx)    = pt(1:ngrid,1:nlayermx) 
    100       pdqmana(1:ngrid,1:nlayermx,1:nq)=0.0 
    101  
    102       DO k = 1, nlayermx 
     96      zq(1:ngrid,1:nlayer)    = pq(1:ngrid,1:nlayer,i_h2o)+ pdq(1:ngrid,1:nlayer,i_h2o)*ptimestep 
     97      zt(1:ngrid,1:nlayer)    = pt(1:ngrid,1:nlayer) 
     98      pdqmana(1:ngrid,1:nlayer,1:nq)=0.0 
     99 
     100      DO k = 1, nlayer 
    103101       DO i = 1, ngrid 
    104102         if(zq(i,k).lt.0.)then 
     
    108106      ENDDO 
    109107       
    110       local_q(1:ngrid,1:nlayermx) = zq(1:ngrid,1:nlayermx) 
    111       local_t(1:ngrid,1:nlayermx) = zt(1:ngrid,1:nlayermx) 
    112       rneb(1:ngrid,1:nlayermx) = 0.0 
    113       d_ql(1:ngrid,1:nlayermx) = 0.0 
    114       d_t(1:ngrid,1:nlayermx)  = 0.0 
    115       d_q(1:ngrid,1:nlayermx)  = 0.0 
     108      local_q(1:ngrid,1:nlayer) = zq(1:ngrid,1:nlayer) 
     109      local_t(1:ngrid,1:nlayer) = zt(1:ngrid,1:nlayer) 
     110      rneb(1:ngrid,1:nlayer) = 0.0 
     111      d_ql(1:ngrid,1:nlayer) = 0.0 
     112      d_t(1:ngrid,1:nlayer)  = 0.0 
     113      d_q(1:ngrid,1:nlayer)  = 0.0 
    116114 
    117115!     Calculate v_cptt 
    118       DO k = 1, nlayermx 
     116      DO k = 1, nlayer 
    119117         DO i = 1, ngrid 
    120118            v_cptt(i,k) = RCPD * local_t(i,k) 
     
    128126 
    129127!     Calculate Gamma * Cp * dz: (gamma is the critical gradient) 
    130       DO k = 2, nlayermx 
     128      DO k = 2, nlayer 
    131129         DO i = 1, ngrid 
    132130            zdp = pplev(i,k)-pplev(i,k+1) 
     
    159157  810 CONTINUE ! look for k1, the base of the column 
    160158      k2 = k2 + 1 
    161       IF (k2 .GT. nlayermx) GOTO 9999 
     159      IF (k2 .GT. nlayer) GOTO 9999 
    162160      zflo = v_cptt(i,k2-1) - v_cptt(i,k2) - gamcpdz(i,k2) 
    163161      zsat=(local_q(i,k2-1)-zqs(i,k2-1))*(pplev(i,k2-1)-pplev(i,k2))   & 
     
    169167 
    170168  820 CONTINUE !! look for k2, the top of the column 
    171       IF (k2 .EQ. nlayermx) GOTO 821 
     169      IF (k2 .EQ. nlayer) GOTO 821 
    172170      k2p = k2 + 1 
    173171      zsat=zsat+(pplev(i,k2p)-pplev(i,k2p+1))*(local_q(i,k2p)-zqs(i,k2p)) 
     
    227225!      ENDDO 
    228226 
    229       DO k = 2, nlayermx 
     227      DO k = 2, nlayer 
    230228         zdpm = pplev(i,k-1) - pplev(i,k) 
    231229         zdp = pplev(i,k) - pplev(i,k+1) 
     
    272270! a l'endroit ou la vapeur d'eau est diminuee par l'ajustement): 
    273271 
    274       DO k = 1, nlayermx 
     272      DO k = 1, nlayer 
    275273      DO i = 1, ngrid 
    276274         IF (itest(i)) THEN 
     
    291289         ENDIF 
    292290      ENDDO 
    293       DO k = 1, nlayermx 
     291      DO k = 1, nlayer 
    294292      DO i = 1, ngrid 
    295293         IF (itest(i)) THEN 
     
    300298      ENDDO 
    301299      ENDDO 
    302       DO k = 1, nlayermx 
     300      DO k = 1, nlayer 
    303301      DO i = 1, ngrid 
    304302         IF (itest(i)) THEN 
     
    308306      ENDDO 
    309307 
    310       DO k = 1, nlayermx 
     308      DO k = 1, nlayer 
    311309      DO i = 1, ngrid 
    312310          local_q(i, k) = MAX(local_q(i, k), seuil_vap) 
     
    314312      ENDDO 
    315313 
    316       DO k = 1, nlayermx 
     314      DO k = 1, nlayer 
    317315      DO i = 1, ngrid 
    318316         d_t(i,k) = local_t(i,k) - zt(i,k) 
     
    322320 
    323321!     now subroutine -----> GCM variables 
    324       DO k = 1, nlayermx 
     322      DO k = 1, nlayer 
    325323         DO i = 1, ngrid 
    326324             
     
    333331 
    334332 
    335       RETURN 
    336333   END 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/newsedim.F

    r222 r227  
    1616!   ------------ 
    1717 
    18 #include "dimensions.h" 
    19 #include "dimphys.h" 
     18!#include "dimensions.h" 
     19!#include "dimphys.h" 
    2020#include "comcstfi.h" 
    2121 
     
    4444 
    4545      LOGICAL,SAVE :: firstcall=.true. 
     46!$OMP THREADPRIVATE(firstcall) 
    4647 
    4748c    Traceurs : 
    4849c    ~~~~~~~~  
    49       real traversee (ngrid,nlayermx) 
    50       real vstokes(ngrid,nlayermx) 
    51       real w(ngrid,nlayermx) 
     50      real traversee (ngrid,nlay) 
     51      real vstokes(ngrid,nlay) 
     52      real w(ngrid,nlay) 
    5253      real ptop, dztop, Ep, Stra 
    5354 
     
    6263c     local and saved variable 
    6364      real,save :: a,b 
     65!$OMP THREADPRIVATE(a,b) 
    6466 
    6567c    ** un petit test de coherence 
     
    191193      end do 
    192194 
    193       call vlz_fi(ngrid,pqi,2.,masse,w,wq) 
     195      call vlz_fi(ngrid,nlay,pqi,2.,masse,w,wq) 
    194196c         write(*,*) ' newsed: wq(6), wq(7), q(6)', 
    195197c    &                wq(1,6),wq(1,7),pqi(1,6) 
    196198 
    197       RETURN 
    198199      END 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/newstart.F

    r222 r227  
    2323      use datafile_mod, only: datadir 
    2424! to use  'getin' 
    25       USE ioipsl_getincom, only: getin 
     25!      USE ioipsl_getincom, only: getin 
     26      USE ioipsl_getincom_p, only: getin_p 
    2627      use control_mod, only: day_step, iphysiq, anneeref 
    2728      use phyredem, only: physdem0, physdem1 
     
    3233 
    3334#include "dimensions.h" 
    34 #include "dimphys.h" 
    35 #include "planete.h" 
     35!#include "dimphys.h" 
     36      integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm)  
     37!#include "planete.h" 
    3638#include "paramet.h" 
    3739#include "comconst.h" 
     
    98100      real emisread             ! added by RW 
    99101      REAL,ALLOCATABLE :: qsurf(:,:) 
    100       REAL q2(ngridmx,nlayermx+1) 
     102      REAL q2(ngridmx,llm+1) 
    101103!      REAL rnaturfi(ngridmx) 
    102104      real alb(iip1,jjp1),albfi(ngridmx) ! albedos 
     
    171173 
    172174!     added by BC for cloud fraction setup 
    173       REAL hice(ngridmx),cloudfrac(ngridmx,nlayermx) 
     175      REAL hice(ngridmx),cloudfrac(ngridmx,llm) 
    174176      REAL totalfrac(ngridmx) 
    175177 
     
    341343        write(*,*) 'Reading file STARTFI' 
    342344        fichnom = 'startfi.nc' 
    343         CALL phyetat0 (ngridmx,fichnom,tab0,Lmodif,nsoilmx,nqtot, 
    344      .        day_ini,time, 
     345        CALL phyetat0 (ngridmx,llm,fichnom,tab0,Lmodif,nsoilmx, 
     346     .        nqtot,day_ini,time, 
    345347     .        tsurf,tsoil,emis,q2,qsurf,   !) ! temporary modif by RDW 
    346348     .        cloudfrac,totalfrac,hice,rnat,pctsrf_sic,tslab,tsea_ice, 
     
    480482!    First get the correct value of datadir, if not already done: 
    481483        ! default 'datadir' is set in "datafile_mod" 
    482         call getin("datadir",datadir) 
     484        call getin_p("datadir",datadir) 
    483485        write(*,*) 'Available surface data files are:' 
    484486        filestring='ls '//trim(datadir)//' | grep .nc' 
     
    534536 
    535537        write(*,*) 'Reading file START_ARCHIVE' 
    536         CALL lect_start_archive(date,tsurf,tsoil,emis,q2, 
     538        CALL lect_start_archive(ngridmx,llm, 
     539     &   date,tsurf,tsoil,emis,q2, 
    537540     &   t,ucov,vcov,ps,teta,phisold_newgrid,q,qsurf, 
    538541     &   surfith,nid, 
     
    956959                 ucov(1:iip1,1:jjp1,1:llm)=0. 
    957960                 vcov(1:iip1,1:jjm,1:llm)=0. 
    958                  q2(1:ngridmx,1:nlayermx+1)=0. 
     961                 q2(1:ngridmx,1:llm+1)=0. 
    959962               else 
    960963                 write(*,*)'problem reading file ',trim(txt),' !' 
     
    12961299          ucov(1:iip1,1:jjp1,1:llm)=0 
    12971300          vcov(1:iip1,1:jjm,1:llm)=0 
    1298           q2(1:ngridmx,1:nlayermx+1)=0 
     1301          q2(1:ngridmx,1:llm+1)=0 
    12991302 
    13001303c       radequi : Radiative equilibrium profile of temperatures and no winds 
     
    13261329          ucov(1:iip1,1:jjp1,1:llm)=0 
    13271330          vcov(1:iip1,1:jjm,1:llm)=0 
    1328           q2(1:ngridmx,1:nlayermx+1)=0 
     1331          q2(1:ngridmx,1:llm+1)=0 
    13291332 
    13301333c       coldstart : T set 1K above CO2 frost point and no winds 
     
    13621365          ucov(1:iip1,1:jjp1,1:llm)=0 
    13631366          vcov(1:iip1,1:jjm,1:llm)=0 
    1364           q2(1:ngridmx,1:nlayermx+1)=0 
     1367          q2(1:ngridmx,1:llm+1)=0 
    13651368 
    13661369 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/newtrelax.F90

    r222 r227  
    1 subroutine newtrelax(ngrid,mu0,sinlat,popsk,temp,pplay,pplev,dtrad,firstcall)  
     1subroutine newtrelax(ngrid,nlayer,mu0,sinlat,popsk,temp,pplay,pplev,dtrad,firstcall)  
    22         
    33  implicit none 
    44 
    5 #include "dimensions.h" 
    6 #include "dimphys.h" 
     5!#include "dimensions.h" 
     6!#include "dimphys.h" 
    77#include "comcstfi.h" 
    88#include "callkeys.h" 
     
    2121!================================================================== 
    2222  
    23   integer ngrid 
    2423  
    2524  ! Input 
    26   real mu0(ngrid)                    ! cosine of sun incident angle 
    27   real sinlat(ngrid)                 ! sine of latitude 
    28   real temp(ngrid,nlayermx)          ! temperature at each layer (K) 
    29   real pplay(ngrid,nlayermx)         ! pressure at each layer (Pa) 
    30   real pplev(ngrid,nlayermx+1)       ! pressure at each level (Pa) 
    31   real popsk(ngrid,nlayermx)         ! pot. T to T converter 
     25  integer,intent(in) :: ngrid, nlayer 
     26  logical,intent(in) :: firstcall 
     27  real,intent(in) :: mu0(ngrid)            ! cosine of sun incident angle 
     28  real,intent(in) :: sinlat(ngrid)         ! sine of latitude 
     29  real,intent(in) :: temp(ngrid,nlayer)    ! temperature at each layer (K) 
     30  real,intent(in) :: pplay(ngrid,nlayer)   ! pressure at each layer (Pa) 
     31  real,intent(in) :: pplev(ngrid,nlayer+1) ! pressure at each level (Pa) 
     32  real,intent(in) :: popsk(ngrid,nlayer)   ! pot. T to T converter 
    3233 
    3334  ! Output 
    34   real dtrad(ngrid,nlayermx)  
     35  real,intent(out) :: dtrad(ngrid,nlayer)  
    3536 
    3637  ! Internal 
    3738  real Trelax_V, Trelax_H 
    3839  real,allocatable,dimension(:,:),save :: Trelax 
     40!$OMP THREADPRIVATE(Trelax) 
    3941 
    4042  real T_trop ! relaxation temperature at tropopause (K) 
     
    4446  real sig, f_sig, sig_trop 
    4547  integer l,ig 
    46   logical firstcall 
    4748 
    4849 
     
    5354  if(firstcall) then 
    5455 
    55      ALLOCATE(Trelax(ngrid,nlayermx)) 
     56     ALLOCATE(Trelax(ngrid,nlayer)) 
    5657 
    5758     print*,'-----------------------------------------------------' 
     
    6667           T_surf = 126. + 239.*mu0(ig) 
    6768           T_trop = 140. + 52.*mu0(ig) 
    68            do l=1,nlayermx 
     69           do l=1,nlayer 
    6970 
    7071              if(mu0(ig).le.0.0)then ! night side 
     
    8687        sig_trop=(T_trop/T_surf)**(1./rcp) 
    8788 
    88         do l=1,nlayermx 
     89        do l=1,nlayer 
    8990           do ig=1,ngrid 
    9091 
     
    109110     endif 
    110111 
    111      firstcall=.false. 
    112   
    113112  endif 
    114113 
    115114  ! Calculate radiative forcing 
    116   do l=1,nlayermx 
     115  do l=1,nlayer 
    117116     do ig=1,ngrid 
    118117        dtrad(ig,l) = -(temp(ig,l) - Trelax(ig,l)) / tau_relax 
     
    129128  !call writediagfi(ngrid,'ThetaZ','stellar zenith angle','deg',2,mu0) 
    130129 
    131   return 
    132130end subroutine newtrelax 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/ocean_slab_mod.F90

    r222 r227  
    1515 
    1616 
    17 #include "dimensions.h" 
    18 #include "dimphys.h" 
     17!#include "dimensions.h" 
     18!#include "dimphys.h" 
    1919#include "comcstfi.h" 
    2020#include "callkeys.h" 
     
    2626   
    2727  !LOGICAL, PRIVATE, SAVE  :: ok_slab_sic,ok_slab_heaT_h2O_ice_liqBS 
    28   !$OMP THREADPRIVATE(ok_slab_sic,ok_slab_heaT_h2O_ice_liqBS) 
     28  !!$OMP THREADPRIVATE(ok_slab_sic,ok_slab_heaT_h2O_ice_liqBS) 
    2929  !INTEGER, PRIVATE, SAVE                           :: slab_ekman, slab_cadj 
    30   !$OMP THREADPRIVATE(slab_ekman,slab_cadj) 
     30  !!$OMP THREADPRIVATE(slab_ekman,slab_cadj) 
    3131  INTEGER, PRIVATE, SAVE                           :: lmt_pas, julien, idayvrai 
    3232  !$OMP THREADPRIVATE(lmt_pas,julien,idayvrai) 
     
    6767 
    6868 
    69 #include "dimensions.h" 
    70 #include "dimphys.h" 
     69!#include "dimensions.h" 
     70!#include "dimphys.h" 
    7171#include "comcstfi.h" 
    7272#include "callkeys.h" 
     
    210210      use slab_ice_h 
    211211 
    212 #include "dimensions.h" 
    213 #include "dimphys.h" 
     212!#include "dimensions.h" 
     213!#include "dimphys.h" 
    214214#include "comcstfi.h" 
    215215#include "callkeys.h" 
     
    451451    use slab_ice_h  
    452452 
    453 #include "dimensions.h" 
    454 #include "comcstfi.h" 
     453!#include "dimensions.h" 
     454!#include "comcstfi.h" 
    455455!    INCLUDE "iniprint.h" 
    456456#include "callkeys.h" 
     
    534534!  Transport diffusif 
    535535!         IF (ok_soil_hdiff) THEN 
    536              CALL divgrad_phy(noceanmx,tmp_tslab_loc,dtdiff_loc) 
     536             CALL divgrad_phy(ngrid,noceanmx,tmp_tslab_loc,dtdiff_loc) 
    537537             dtdiff_loc=dtdiff_loc*soil_hdiff*50./SUM(slabh)!*100. 
    538538 !           dtdiff_loc(:,1)=dtdiff_loc(:,1)*soil_hdiff*50./SUM(slabh)*0.8 
     
    544544! Calcul  de transport par Ekman 
    545545 
    546           CALL slab_ekman2(taux_slab,tauy_slab,tslab,dtekman_loc) 
     546          CALL slab_ekman2(ngrid,taux_slab,tauy_slab,tslab,dtekman_loc) 
    547547 
    548548 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/orbite.F

    r222 r227  
    11      subroutine orbite(pls,pdist_star,pdecli) 
     2       
     3      use planete_mod, only: p_elips, e_elips, timeperi, obliquit 
    24      implicit none 
    35 
     
    2325c   ------------- 
    2426 
    25 #include "planete.h" 
     27!#include "planete.h" 
    2628#include "comcstfi.h" 
    2729 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/phyetat0.F90

    r222 r227  
    1 subroutine phyetat0 (ngrid,fichnom,tab0,Lmodif,nsoil,nq, & 
     1subroutine phyetat0 (ngrid,nlayer,fichnom,tab0,Lmodif,nsoil,nq, & 
    22                     day_ini,time,tsurf,tsoil, & 
    33                     emis,q2,qsurf,cloudfrac,totcloudfrac,hice, & 
     
    2020!====================================================================== 
    2121#include "netcdf.inc" 
    22 #include "dimensions.h" 
    23 #include "dimphys.h" 
    24 #include "planete.h" 
     22!#include "dimensions.h" 
     23!#include "dimphys.h" 
     24!#include "planete.h" 
    2525#include "comcstfi.h" 
    2626 
     
    3333!  inputs: 
    3434  integer,intent(in) :: ngrid 
     35  integer,intent(in) :: nlayer 
    3536  character*(*),intent(in) :: fichnom ! "startfi.nc" file 
    3637  integer,intent(in) :: tab0 
     
    4546  real,intent(out) :: tsoil(ngrid,nsoil) ! soil temperature 
    4647  real,intent(out) :: emis(ngrid) ! surface emissivity 
    47   real,intent(out) :: q2(ngrid, llm+1) !  
     48  real,intent(out) :: q2(ngrid,nlayer+1) !  
    4849  real,intent(out) :: qsurf(ngrid,nq) ! tracers on surface 
    4950! real co2ice(ngrid) ! co2 ice cover 
    50   real,intent(out) :: cloudfrac(ngrid,nlayermx) 
     51  real,intent(out) :: cloudfrac(ngrid,nlayer) 
    5152  real,intent(out) :: hice(ngrid), totcloudfrac(ngrid) 
    5253  real,intent(out) :: pctsrf_sic(ngrid),tslab(ngrid,noceanmx)   
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/phyredem.F90

    r222 r227  
    1717                      put_var, put_field, length 
    1818  use mod_grid_phy_lmdz, only : klon_glo 
     19  use planete_mod, only: year_day, periastr, apoastr, peri_day, & 
     20                         obliquit, z0, lmixmin, emin_turb 
    1921 
    2022  implicit none 
    21 #include "planete.h" 
     23!#include "planete.h" 
    2224#include "comcstfi.h" 
    2325  character(len=*), intent(in) :: filename 
     
    147149!#include "temps.h" 
    148150#include "comcstfi.h" 
    149 #include "planete.h" 
     151!#include "planete.h" 
    150152#include "callkeys.h" 
    151153!====================================================================== 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/physiq.F90

    r222 r227  
    55                  pplev,pplay,pphi,        & 
    66                  pu,pv,pt,pq,             & 
    7                   pw,                      & 
     7                  flxw,                    & 
    88                  pdu,pdv,pdt,pdq,pdpsrf,tracerdyn) 
    99  
     
    1212      use gases_h, only: gnom, gfrac 
    1313      use radcommon_h, only: sigma, eclipse, glat, grav 
    14       use radii_mod, only: h2o_reffrad, co2_reffrad, h2o_cloudrad 
     14      use radii_mod, only: h2o_reffrad, co2_reffrad 
    1515      use aerosol_mod, only: iaero_co2, iaero_h2o 
    1616      use surfdat_h, only: phisfi, albedodat, zmea, zstd, zsig, zgam, zthe, & 
     
    3232      use planetwide_mod, only: planetwide_minval,planetwide_maxval,planetwide_sumval 
    3333      use mod_phys_lmdz_para, only : is_master 
    34  
     34      use planete_mod, only: apoastr, periastr, year_day, peri_day, & 
     35                            obliquit, nres, z0 
    3536 
    3637      implicit none 
     
    9798!    ptdyn(ngrid,nlayer)     / corresponding variables 
    9899!    pqdyn(ngrid,nlayer,nq) / 
    99 !    pw(ngrid,?)           vertical velocity 
     100!    flxw(ngrid,nlayer)      vertical mass flux (kg/s) at layer lower boundary 
    100101! 
    101102!   output 
    102103!   ------ 
    103104! 
    104 !    pdu(ngrid,nlayermx)        \ 
    105 !    pdv(ngrid,nlayermx)         \  Temporal derivative of the corresponding 
    106 !    pdt(ngrid,nlayermx)         /  variables due to physical processes. 
    107 !    pdq(ngrid,nlayermx)        / 
     105!    pdu(ngrid,nlayer)        \ 
     106!    pdv(ngrid,nlayer)         \  Temporal derivative of the corresponding 
     107!    pdt(ngrid,nlayer)         /  variables due to physical processes. 
     108!    pdq(ngrid,nlayer)        / 
    108109!    pdpsrf(ngrid)             / 
    109110!    tracerdyn                 call tracer in dynamical part of GCM ? 
     
    131132!    ------------------ 
    132133 
    133 #include "dimensions.h" 
    134 #include "dimphys.h" 
     134!#include "dimensions.h" 
     135!#include "dimphys.h" 
    135136#include "callkeys.h" 
    136137#include "comcstfi.h" 
    137 #include "planete.h" 
     138!#include "planete.h" 
    138139!#include "control.h" 
    139140#include "netcdf.inc" 
     
    160161      real,intent(in) :: pt(ngrid,nlayer) ! temperature (K) 
    161162      real,intent(in) :: pq(ngrid,nlayer,nq) ! tracers (.../kg_of_air) 
    162       real,intent(in) :: pw(ngrid,nlayer)    ! vertical velocity (m/s) 
    163  
     163      real,intent(in) :: flxw(ngrid,nlayer) ! vertical mass flux (ks/s) 
     164                                            ! at lower boundary of layer 
    164165 
    165166 
     
    179180!     "longrefvis" set in dimradmars.h , for one of the "naerkind"  kind of 
    180181!      aerosol optical properties: 
    181 !      real aerosol(ngrid,nlayermx,naerkind)  
     182!      real aerosol(ngrid,nlayer,naerkind)  
    182183!     this is now internal to callcorrk and hence no longer needed here 
    183184 
     
    187188      real, dimension(:,:),allocatable,save ::  tsoil  ! sub-surface temperatures (K) 
    188189      real, dimension(:),allocatable,save :: albedo ! Surface albedo 
     190!$OMP THREADPRIVATE(tsurf,tsoil,albedo) 
    189191 
    190192      real,dimension(:),allocatable,save :: albedo0 ! Surface albedo 
    191193      real,dimension(:),allocatable,save :: rnat ! added by BC 
     194!$OMP THREADPRIVATE(albedo0,rnat) 
    192195 
    193196      real,dimension(:),allocatable,save :: emis ! Thermal IR surface emissivity 
     
    199202      real,dimension(:,:),allocatable,save :: qsurf ! tracer on surface (e.g. kg.m-2) 
    200203      real,dimension(:,:),allocatable,save :: q2 ! Turbulent Kinetic Energy  
     204!$OMP THREADPRIVATE(emis,dtrad,fluxrad_sky,fluxrad,capcal,fluxgrd,qsurf,q2) 
    201205 
    202206      save day_ini, icount 
     207!$OMP THREADPRIVATE(day_ini,icount) 
    203208 
    204209! Local variables : 
     
    207212!     aerosol (dust or ice) extinction optical depth  at reference wavelength  
    208213!     for the "naerkind" optically active aerosols: 
    209       real aerosol(ngrid,nlayermx,naerkind)  
    210       real zh(ngrid,nlayermx)      ! potential temperature (K) 
     214      real aerosol(ngrid,nlayer,naerkind)  
     215      real zh(ngrid,nlayer)      ! potential temperature (K) 
     216      real pw(ngrid,nlayer) ! vertical velocity (m/s) (>0 when downwards) 
    211217 
    212218      character*80 fichier  
     
    225231      real,dimension(:,:),allocatable,save :: zdtsw ! (K/s) 
    226232      real,dimension(:),allocatable,save :: sensibFlux ! turbulent flux given by the atm to the surface 
     233!$OMP THREADPRIVATE(fluxsurf_lw,fluxsurf_sw,fluxtop_lw,fluxabs_sw,fluxtop_dn,fluxdyn,OLR_nu,OSR_nu,& 
     234        !$OMP zdtlw,zdtsw,sensibFlux) 
    227235 
    228236      real zls                       ! solar longitude (rad) 
    229237      real zday                      ! date (time since Ls=0, in martian days) 
    230       real zzlay(ngrid,nlayermx)   ! altitude at the middle of the layers 
    231       real zzlev(ngrid,nlayermx+1) ! altitude at layer boundaries 
     238      real zzlay(ngrid,nlayer)   ! altitude at the middle of the layers 
     239      real zzlev(ngrid,nlayer+1) ! altitude at layer boundaries 
    232240      real latvl1,lonvl1             ! Viking Lander 1 point (for diagnostic) 
    233241 
    234242!     Tendencies due to various processes: 
    235243      real dqsurf(ngrid,nq) 
    236       real cldtlw(ngrid,nlayermx)                           ! (K/s) LW heating rate for clear areas 
    237       real cldtsw(ngrid,nlayermx)                           ! (K/s) SW heating rate for clear areas 
     244      real cldtlw(ngrid,nlayer)                           ! (K/s) LW heating rate for clear areas 
     245      real cldtsw(ngrid,nlayer)                           ! (K/s) SW heating rate for clear areas 
    238246      real zdtsurf(ngrid)                                   ! (K/s) 
    239       real dtlscale(ngrid,nlayermx) 
    240       real zdvdif(ngrid,nlayermx),zdudif(ngrid,nlayermx)  ! (m.s-2) 
    241       real zdhdif(ngrid,nlayermx), zdtsdif(ngrid)         ! (K/s) 
    242       real zdtdif(ngrid,nlayermx)                             ! (K/s) 
    243       real zdvadj(ngrid,nlayermx),zduadj(ngrid,nlayermx)  ! (m.s-2) 
    244       real zdhadj(ngrid,nlayermx)                           ! (K/s) 
    245       real zdtgw(ngrid,nlayermx)                            ! (K/s) 
    246       real zdtmr(ngrid,nlayermx) 
    247       real zdugw(ngrid,nlayermx),zdvgw(ngrid,nlayermx)    ! (m.s-2) 
    248       real zdtc(ngrid,nlayermx),zdtsurfc(ngrid) 
    249       real zdvc(ngrid,nlayermx),zduc(ngrid,nlayermx) 
    250       real zdumr(ngrid,nlayermx),zdvmr(ngrid,nlayermx) 
     247      real dtlscale(ngrid,nlayer) 
     248      real zdvdif(ngrid,nlayer),zdudif(ngrid,nlayer)  ! (m.s-2) 
     249      real zdhdif(ngrid,nlayer), zdtsdif(ngrid)         ! (K/s) 
     250      real zdtdif(ngrid,nlayer)                       ! (K/s) 
     251      real zdvadj(ngrid,nlayer),zduadj(ngrid,nlayer)  ! (m.s-2) 
     252      real zdhadj(ngrid,nlayer)                           ! (K/s) 
     253      real zdtgw(ngrid,nlayer)                            ! (K/s) 
     254      real zdtmr(ngrid,nlayer) 
     255      real zdugw(ngrid,nlayer),zdvgw(ngrid,nlayer)    ! (m.s-2) 
     256      real zdtc(ngrid,nlayer),zdtsurfc(ngrid) 
     257      real zdvc(ngrid,nlayer),zduc(ngrid,nlayer) 
     258      real zdumr(ngrid,nlayer),zdvmr(ngrid,nlayer) 
    251259      real zdtsurfmr(ngrid) 
    252260       
    253       real zdmassmr(ngrid,nlayermx),zdpsrfmr(ngrid) 
     261      real zdmassmr(ngrid,nlayer),zdpsrfmr(ngrid) 
    254262      real zdmassmr_col(ngrid) 
    255263 
    256       real zdqdif(ngrid,nlayermx,nq), zdqsdif(ngrid,nq) 
    257       real zdqevap(ngrid,nlayermx) 
    258       real zdqsed(ngrid,nlayermx,nq), zdqssed(ngrid,nq) 
    259       real zdqdev(ngrid,nlayermx,nq), zdqsdev(ngrid,nq) 
    260       real zdqadj(ngrid,nlayermx,nq) 
    261       real zdqc(ngrid,nlayermx,nq) 
    262       real zdqmr(ngrid,nlayermx,nq),zdqsurfmr(ngrid,nq) 
    263       real zdqlscale(ngrid,nlayermx,nq) 
     264      real zdqdif(ngrid,nlayer,nq), zdqsdif(ngrid,nq) 
     265      real zdqevap(ngrid,nlayer) 
     266      real zdqsed(ngrid,nlayer,nq), zdqssed(ngrid,nq) 
     267      real zdqdev(ngrid,nlayer,nq), zdqsdev(ngrid,nq) 
     268      real zdqadj(ngrid,nlayer,nq) 
     269      real zdqc(ngrid,nlayer,nq) 
     270      real zdqmr(ngrid,nlayer,nq),zdqsurfmr(ngrid,nq) 
     271      real zdqlscale(ngrid,nlayer,nq) 
    264272      real zdqslscale(ngrid,nq) 
    265       real zdqchim(ngrid,nlayermx,nq) 
     273      real zdqchim(ngrid,nlayer,nq) 
    266274      real zdqschim(ngrid,nq) 
    267275 
    268       real zdteuv(ngrid,nlayermx)    ! (K/s) 
    269       real zdtconduc(ngrid,nlayermx) ! (K/s) 
    270       real zdumolvis(ngrid,nlayermx) 
    271       real zdvmolvis(ngrid,nlayermx) 
    272       real zdqmoldiff(ngrid,nlayermx,nq) 
     276      real zdteuv(ngrid,nlayer)    ! (K/s) 
     277      real zdtconduc(ngrid,nlayer) ! (K/s) 
     278      real zdumolvis(ngrid,nlayer) 
     279      real zdvmolvis(ngrid,nlayer) 
     280      real zdqmoldiff(ngrid,nlayer,nq) 
    273281 
    274282!     Local variables for local calculations: 
    275283      real zflubid(ngrid) 
    276       real zplanck(ngrid),zpopsk(ngrid,nlayermx) 
    277       real zdum1(ngrid,nlayermx) 
    278       real zdum2(ngrid,nlayermx) 
     284      real zplanck(ngrid),zpopsk(ngrid,nlayer) 
     285      real zdum1(ngrid,nlayer) 
     286      real zdum2(ngrid,nlayer) 
    279287      real ztim1,ztim2,ztim3, z1,z2 
    280288      real ztime_fin 
    281       real zdh(ngrid,nlayermx) 
     289      real zdh(ngrid,nlayer) 
    282290      real gmplanet 
    283291      real taux(ngrid),tauy(ngrid) 
     
    288296! local variables only used for diagnostics (output in file "diagfi" or "stats") 
    289297! ------------------------------------------------------------------------------ 
    290       real ps(ngrid), zt(ngrid,nlayermx) 
    291       real zu(ngrid,nlayermx),zv(ngrid,nlayermx) 
    292       real zq(ngrid,nlayermx,nq) 
     298      real ps(ngrid), zt(ngrid,nlayer) 
     299      real zu(ngrid,nlayer),zv(ngrid,nlayer) 
     300      real zq(ngrid,nlayer,nq) 
    293301      character*2 str2 
    294302      character*5 str5 
    295       real zdtadj(ngrid,nlayermx) 
    296       real zdtdyn(ngrid,nlayermx) 
     303      real zdtadj(ngrid,nlayer) 
     304      real zdtdyn(ngrid,nlayer) 
    297305      real,allocatable,dimension(:,:),save :: ztprevious 
    298       real reff(ngrid,nlayermx) ! effective dust radius (used if doubleq=T) 
     306!$OMP THREADPRIVATE(ztprevious) 
     307      real reff(ngrid,nlayer) ! effective dust radius (used if doubleq=T) 
    299308      real qtot1,qtot2            ! total aerosol mass 
    300309      integer igmin, lmin 
    301310      logical tdiag 
    302311 
    303       real zplev(ngrid,nlayermx+1),zplay(ngrid,nlayermx) 
     312      real zplev(ngrid,nlayer+1),zplay(ngrid,nlayer) 
    304313      real zstress(ngrid), cd 
    305       real hco2(nq), tmean, zlocal(nlayermx) 
    306       real vmr(ngrid,nlayermx) ! volume mixing ratio 
     314      real hco2(nq), tmean, zlocal(nlayer) 
     315      real vmr(ngrid,nlayer) ! volume mixing ratio 
    307316 
    308317      real time_phys 
     
    310319!     reinstated by RW for diagnostic 
    311320      real,allocatable,dimension(:),save :: tau_col 
     321!$OMP THREADPRIVATE(tau_col) 
    312322       
    313323!     included by RW to reduce insanity of code 
     
    318328 
    319329!     included by RW for H2O precipitation 
    320       real zdtrain(ngrid,nlayermx) 
    321       real zdqrain(ngrid,nlayermx,nq) 
     330      real zdtrain(ngrid,nlayer) 
     331      real zdqrain(ngrid,nlayer,nq) 
    322332      real zdqsrain(ngrid) 
    323333      real zdqssnow(ngrid) 
     
    325335 
    326336!     included by RW for H2O Manabe scheme 
    327       real dtmoist(ngrid,nlayermx) 
    328       real dqmoist(ngrid,nlayermx,nq) 
    329  
    330       real qvap(ngrid,nlayermx) 
    331       real dqvaplscale(ngrid,nlayermx) 
    332       real dqcldlscale(ngrid,nlayermx) 
    333       real rneb_man(ngrid,nlayermx) 
    334       real rneb_lsc(ngrid,nlayermx) 
     337      real dtmoist(ngrid,nlayer) 
     338      real dqmoist(ngrid,nlayer,nq) 
     339 
     340      real qvap(ngrid,nlayer) 
     341      real dqvaplscale(ngrid,nlayer) 
     342      real dqcldlscale(ngrid,nlayer) 
     343      real rneb_man(ngrid,nlayer) 
     344      real rneb_lsc(ngrid,nlayer) 
    335345 
    336346!     included by RW to account for surface cooling by evaporation 
     
    339349 
    340350!     to test energy conservation (RW+JL) 
    341       real mass(ngrid,nlayermx),massarea(ngrid,nlayermx) 
     351      real mass(ngrid,nlayer),massarea(ngrid,nlayer) 
    342352      real dEtot, dEtots, AtmToSurf_TurbFlux 
    343353      real,save :: dEtotSW, dEtotsSW, dEtotLW, dEtotsLW 
    344       real dEzRadsw(ngrid,nlayermx),dEzRadlw(ngrid,nlayermx),dEzdiff(ngrid,nlayermx) 
     354!$OMP THREADPRIVATE(dEtotSW, dEtotsSW, dEtotLW, dEtotsLW) 
     355      real dEzRadsw(ngrid,nlayer),dEzRadlw(ngrid,nlayer),dEzdiff(ngrid,nlayer) 
    345356      real dEdiffs(ngrid),dEdiff(ngrid) 
    346       real madjdE(ngrid), lscaledE(ngrid),madjdEz(ngrid,nlayermx), lscaledEz(ngrid,nlayermx) 
     357      real madjdE(ngrid), lscaledE(ngrid),madjdEz(ngrid,nlayer), lscaledEz(ngrid,nlayer) 
    347358!JL12 conservation test for mean flow kinetic energy has been disabled temporarily 
    348359      real dtmoist_max,dtmoist_min 
     
    351362 
    352363!     included by BC for evaporation      
    353       real qevap(ngrid,nlayermx,nq) 
    354       real tevap(ngrid,nlayermx) 
    355       real dqevap1(ngrid,nlayermx) 
    356       real dtevap1(ngrid,nlayermx) 
     364      real qevap(ngrid,nlayer,nq) 
     365      real tevap(ngrid,nlayer) 
     366      real dqevap1(ngrid,nlayer) 
     367      real dtevap1(ngrid,nlayer) 
    357368 
    358369!     included by BC for hydrology 
    359370      real,allocatable,save :: hice(:) 
     371 !$OMP THREADPRIVATE(hice)      
    360372 
    361373!     included by RW to test water conservation (by routine) 
     
    365377      logical watertest 
    366378      save watertest 
     379!$OMP THREADPRIVATE(watertest) 
    367380 
    368381!     included by RW for RH diagnostic 
    369       real qsat(ngrid,nlayermx), RH(ngrid,nlayermx), H2Omaxcol(ngrid),psat_tmp 
     382      real qsat(ngrid,nlayer), RH(ngrid,nlayer), H2Omaxcol(ngrid),psat_tmp 
    370383 
    371384!     included by RW for hydrology 
     
    378391!     included by BC for double radiative transfer call 
    379392      logical clearsky 
    380       real zdtsw1(ngrid,nlayermx) 
    381       real zdtlw1(ngrid,nlayermx) 
     393      real zdtsw1(ngrid,nlayer) 
     394      real zdtlw1(ngrid,nlayer) 
    382395      real fluxsurf_lw1(ngrid)      
    383396      real fluxsurf_sw1(ngrid)   
     
    392405      real,allocatable,dimension(:,:),save :: cloudfrac 
    393406      real,allocatable,dimension(:),save :: totcloudfrac 
     407!$OMP THREADPRIVATE(cloudfrac,totcloudfrac) 
    394408 
    395409!     included by RW for vdifc water conservation test 
     
    400414!      double precision qsurf_hist(ngrid,nq) 
    401415      real,allocatable,dimension(:,:),save :: qsurf_hist 
     416!$OMP THREADPRIVATE(qsurf_hist) 
    402417 
    403418!     included by RW for temp convadj conservation test 
    404       real playtest(nlayermx) 
    405       real plevtest(nlayermx) 
    406       real ttest(nlayermx) 
    407       real qtest(nlayermx) 
     419      real playtest(nlayer) 
     420      real plevtest(nlayer) 
     421      real ttest(nlayer) 
     422      real qtest(nlayer) 
    408423      integer igtest 
    409424 
    410425!     included by RW for runway greenhouse 1D study 
    411       real muvar(ngrid,nlayermx+1) 
     426      real muvar(ngrid,nlayer+1) 
    412427 
    413428!     included by RW for variable H2O particle sizes 
    414429      real,allocatable,dimension(:,:,:),save :: reffrad ! aerosol effective radius (m) 
    415430      real,allocatable,dimension(:,:,:),save :: nueffrad ! aerosol effective radius variance 
    416 !      real :: nueffrad_dummy(ngrid,nlayermx,naerkind) !! AS. This is temporary. Check below why. 
    417       real :: reffh2oliq(ngrid,nlayermx) ! liquid water particles effective radius (m) 
    418       real :: reffh2oice(ngrid,nlayermx) ! water ice particles effective radius (m) 
    419    !   real reffH2O(ngrid,nlayermx) 
     431!$OMP THREADPRIVATE(reffrad,nueffrad) 
     432!      real :: nueffrad_dummy(ngrid,nlayer,naerkind) !! AS. This is temporary. Check below why. 
     433      real :: reffh2oliq(ngrid,nlayer) ! liquid water particles effective radius (m) 
     434      real :: reffh2oice(ngrid,nlayer) ! water ice particles effective radius (m) 
     435   !   real reffH2O(ngrid,nlayer) 
    420436      real reffcol(ngrid,naerkind) 
    421437 
     
    427443      integer num_run 
    428444      logical,save :: ice_update 
     445!$OMP THREADPRIVATE(ice_initial,ice_min,ice_update) 
    429446 
    430447!     included by MS to compute the daily average of rings shadowing 
     
    445462      real, dimension(:),allocatable,save :: zmasq 
    446463      integer, dimension(:),allocatable,save ::knindex  
     464!$OMP THREADPRIVATE(pctsrf_sic,tslab,tsea_ice,sea_ice,zmasq,knindex) 
    447465 
    448466      real :: tsurf2(ngrid) 
     
    469487        ALLOCATE(rnat(ngrid))          
    470488        ALLOCATE(emis(ngrid))    
    471         ALLOCATE(dtrad(ngrid,nlayermx)) 
     489        ALLOCATE(dtrad(ngrid,nlayer)) 
    472490        ALLOCATE(fluxrad_sky(ngrid)) 
    473491        ALLOCATE(fluxrad(ngrid))     
     
    475493        ALLOCATE(fluxgrd(ngrid))   
    476494        ALLOCATE(qsurf(ngrid,nq))   
    477         ALLOCATE(q2(ngrid,nlayermx+1))  
    478         ALLOCATE(ztprevious(ngrid,nlayermx)) 
    479         ALLOCATE(cloudfrac(ngrid,nlayermx)) 
     495        ALLOCATE(q2(ngrid,nlayer+1))  
     496        ALLOCATE(ztprevious(ngrid,nlayer)) 
     497        ALLOCATE(cloudfrac(ngrid,nlayer)) 
    480498        ALLOCATE(totcloudfrac(ngrid)) 
    481499        ALLOCATE(hice(ngrid)) 
    482500        ALLOCATE(qsurf_hist(ngrid,nq)) 
    483         ALLOCATE(reffrad(ngrid,nlayermx,naerkind)) 
    484         ALLOCATE(nueffrad(ngrid,nlayermx,naerkind)) 
     501        ALLOCATE(reffrad(ngrid,nlayer,naerkind)) 
     502        ALLOCATE(nueffrad(ngrid,nlayer,naerkind)) 
    485503        ALLOCATE(ice_initial(ngrid)) 
    486504        ALLOCATE(ice_min(ngrid))  
     
    494512        ALLOCATE(OSR_nu(ngrid,L_NSPECTV)) 
    495513        ALLOCATE(sensibFlux(ngrid)) 
    496         ALLOCATE(zdtlw(ngrid,nlayermx)) 
    497         ALLOCATE(zdtsw(ngrid,nlayermx)) 
     514        ALLOCATE(zdtlw(ngrid,nlayer)) 
     515        ALLOCATE(zdtsw(ngrid,nlayer)) 
    498516        ALLOCATE(tau_col(ngrid)) 
    499517        ALLOCATE(pctsrf_sic(ngrid)) 
     
    541559!        read startfi (initial parameters) 
    542560!        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    543          call phyetat0(ngrid,"startfi.nc",0,0,nsoilmx,nq,   & 
     561         call phyetat0(ngrid,nlayer,"startfi.nc",0,0,nsoilmx,nq,   & 
    544562               day_ini,time_phys,tsurf,tsoil,emis,q2,qsurf,   & 
    545563               cloudfrac,totcloudfrac,hice,  & 
     
    587605 
    588606 
    589            CALL init_masquv(zmasq) 
     607           CALL init_masquv(ngrid,zmasq) 
    590608 
    591609 
     
    628646         ice_update=.false. 
    629647         if(sourceevol)then 
     648!$OMP MASTER 
    630649            open(128,file='num_run',form='formatted', & 
    631650                     status="old",iostat=ierr) 
     
    637656            read(128,*) num_run  
    638657            close(128) 
     658!$OMP END MASTER 
     659!$OMP BARRIER 
    639660         
    640661            if(num_run.ne.0.and.mod(num_run,2).eq.0)then 
     
    721742!     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    722743       
    723       pdu(1:ngrid,1:nlayermx) = 0.0 
    724       pdv(1:ngrid,1:nlayermx) = 0.0 
     744      pdu(1:ngrid,1:nlayer) = 0.0 
     745      pdv(1:ngrid,1:nlayer) = 0.0 
    725746      if ( .not.nearco2cond ) then 
    726          pdt(1:ngrid,1:nlayermx) = 0.0 
     747         pdt(1:ngrid,1:nlayer) = 0.0 
    727748      endif 
    728       pdq(1:ngrid,1:nlayermx,1:nq) = 0.0 
     749      pdq(1:ngrid,1:nlayer,1:nq) = 0.0 
    729750      pdpsrf(1:ngrid)       = 0.0 
    730751      zflubid(1:ngrid)      = 0.0 
     
    773794!     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    774795 
    775       zzlay(1:ngrid,1:nlayermx)=pphi(1:ngrid,1:nlayermx) 
    776       do l=1,nlayermx          
     796      zzlay(1:ngrid,1:nlayer)=pphi(1:ngrid,1:nlayer) 
     797      do l=1,nlayer          
    777798      zzlay(1:ngrid,l)= zzlay(1:ngrid,l)/glat(1:ngrid) 
    778799      enddo 
     
    802823      enddo 
    803824 
     825     ! Compute vertical velocity (m/s) from vertical mass flux 
     826     ! w = F / (rho*area) and rho = r*T/P 
     827     ! but first linearly interpolate mass flux to mid-layers 
     828     do l=1,nlayer-1 
     829       pw(1:ngrid,l)=0.5*(flxw(1:ngrid,l)+flxw(1:ngrid,l+1)) 
     830     enddo 
     831     pw(1:ngrid,nlayer)=0.5*flxw(1:ngrid,nlayer) ! since flxw(nlayer+1)=0 
     832     do l=1,nlayer 
     833       pw(1:ngrid,l)=(pw(1:ngrid,l)*pplay(1:ngrid,l)) /  & 
     834                     (r*pt(1:ngrid,l)*area(1:ngrid)) 
     835     enddo 
    804836 
    805837!----------------------------------------------------------------------- 
     
    892924              endif 
    893925              if(water) then 
    894                   muvar(1:ngrid,1:nlayermx)=mugaz/(1.e0+(1.e0/epsi-1.e0)*pq(1:ngrid,1:nlayermx,igcm_h2o_vap))  
    895                   muvar(1:ngrid,nlayermx+1)=mugaz/(1.e0+(1.e0/epsi-1.e0)*pq(1:ngrid,nlayermx,igcm_h2o_vap))  
     926                  muvar(1:ngrid,1:nlayer)=mugaz/(1.e0+(1.e0/epsi-1.e0)*pq(1:ngrid,1:nlayer,igcm_h2o_vap))  
     927                  muvar(1:ngrid,nlayer+1)=mugaz/(1.e0+(1.e0/epsi-1.e0)*pq(1:ngrid,nlayer,igcm_h2o_vap))  
    896928                  ! take into account water effect on mean molecular weight 
    897929              else 
    898                   muvar(1:ngrid,1:nlayermx+1)=mugaz 
     930                  muvar(1:ngrid,1:nlayer+1)=mugaz 
    899931              endif  
    900932       
     
    950982                    tau_col(ig)     = ntf*tau_col1(ig)     + tf*tau_col(ig) 
    951983                     
    952                     zdtlw(ig,1:nlayermx) = ntf*zdtlw1(ig,1:nlayermx) + tf*zdtlw(ig,1:nlayermx) 
    953                     zdtsw(ig,1:nlayermx) = ntf*zdtsw1(ig,1:nlayermx) + tf*zdtsw(ig,1:nlayermx) 
     984                    zdtlw(ig,1:nlayer) = ntf*zdtlw1(ig,1:nlayer) + tf*zdtlw(ig,1:nlayer) 
     985                    zdtsw(ig,1:nlayer) = ntf*zdtsw1(ig,1:nlayer) + tf*zdtsw(ig,1:nlayer) 
    954986 
    955987                    OSR_nu(ig,1:L_NSPECTV) = ntf*OSR_nu1(ig,1:L_NSPECTV) + tf*OSR_nu(ig,1:L_NSPECTV)                    
     
    9761008 
    9771009!             Net atmospheric radiative heating rate (K.s-1) 
    978               dtrad(1:ngrid,1:nlayermx)=zdtsw(1:ngrid,1:nlayermx)+zdtlw(1:ngrid,1:nlayermx) 
     1010              dtrad(1:ngrid,1:nlayer)=zdtsw(1:ngrid,1:nlayer)+zdtlw(1:ngrid,1:nlayer) 
    9791011 
    9801012           elseif(newtonian)then 
     
    9821014!          b) Call Newtonian cooling scheme 
    9831015!          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    984               call newtrelax(ngrid,mu0,sinlat,zpopsk,pt,pplay,pplev,dtrad,firstcall) 
     1016              call newtrelax(ngrid,nlayer,mu0,sinlat,zpopsk,pt,pplay,pplev,dtrad,firstcall) 
    9851017 
    9861018              zdtsurf(1:ngrid) = +(pt(1:ngrid,1)-tsurf(1:ngrid))/ptimestep 
     
    10011033 
    10021034 
    1003               dtrad(1:ngrid,1:nlayermx)=0.0 
     1035              dtrad(1:ngrid,1:nlayer)=0.0 
    10041036              ! hence no atmospheric radiative heating 
    10051037 
     
    10151047        zplanck(1:ngrid)=emis(1:ngrid)*sigma*zplanck(1:ngrid)*zplanck(1:ngrid) 
    10161048        fluxrad(1:ngrid)=fluxrad_sky(1:ngrid)-zplanck(1:ngrid) 
    1017         pdt(1:ngrid,1:nlayermx)=pdt(1:ngrid,1:nlayermx)+dtrad(1:ngrid,1:nlayermx) 
     1049        pdt(1:ngrid,1:nlayer)=pdt(1:ngrid,1:nlayer)+dtrad(1:ngrid,1:nlayer) 
    10181050 
    10191051!------------------------- 
     
    10481080         zflubid(1:ngrid)=fluxrad(1:ngrid)+fluxgrd(1:ngrid) 
    10491081 
    1050          zdum1(1:ngrid,1:nlayermx)=0.0 
    1051          zdum2(1:ngrid,1:nlayermx)=0.0 
     1082         zdum1(1:ngrid,1:nlayer)=0.0 
     1083         zdum2(1:ngrid,1:nlayer)=0.0 
    10521084 
    10531085 
     
    10661098         else 
    10671099          
    1068            zdh(1:ngrid,1:nlayermx)=pdt(1:ngrid,1:nlayermx)/zpopsk(1:ngrid,1:nlayermx) 
     1100           zdh(1:ngrid,1:nlayer)=pdt(1:ngrid,1:nlayer)/zpopsk(1:ngrid,1:nlayer) 
    10691101  
    10701102           call vdifc(ngrid,nlayer,nq,rnat,zpopsk,   & 
     
    10771109              taux,tauy,lastcall) 
    10781110 
    1079            zdtdif(1:ngrid,1:nlayermx)=zdhdif(1:ngrid,1:nlayermx)*zpopsk(1:ngrid,1:nlayermx) ! for diagnostic only 
    1080            zdqevap(1:ngrid,1:nlayermx)=0. 
     1111           zdtdif(1:ngrid,1:nlayer)=zdhdif(1:ngrid,1:nlayer)*zpopsk(1:ngrid,1:nlayer) ! for diagnostic only 
     1112           zdqevap(1:ngrid,1:nlayer)=0. 
    10811113 
    10821114         end if !turbdiff 
    10831115 
    1084          pdv(1:ngrid,1:nlayermx)=pdv(1:ngrid,1:nlayermx)+zdvdif(1:ngrid,1:nlayermx) 
    1085          pdu(1:ngrid,1:nlayermx)=pdu(1:ngrid,1:nlayermx)+zdudif(1:ngrid,1:nlayermx) 
    1086          pdt(1:ngrid,1:nlayermx)=pdt(1:ngrid,1:nlayermx)+zdtdif(1:ngrid,1:nlayermx) 
     1116         pdv(1:ngrid,1:nlayer)=pdv(1:ngrid,1:nlayer)+zdvdif(1:ngrid,1:nlayer) 
     1117         pdu(1:ngrid,1:nlayer)=pdu(1:ngrid,1:nlayer)+zdudif(1:ngrid,1:nlayer) 
     1118         pdt(1:ngrid,1:nlayer)=pdt(1:ngrid,1:nlayer)+zdtdif(1:ngrid,1:nlayer) 
    10871119         zdtsurf(1:ngrid)=zdtsurf(1:ngrid)+zdtsdif(1:ngrid) 
    10881120 
     
    10941126 
    10951127         if (tracer) then  
    1096            pdq(1:ngrid,1:nlayermx,1:nq)=pdq(1:ngrid,1:nlayermx,1:nq)+ zdqdif(1:ngrid,1:nlayermx,1:nq) 
     1128           pdq(1:ngrid,1:nlayer,1:nq)=pdq(1:ngrid,1:nlayer,1:nq)+ zdqdif(1:ngrid,1:nlayer,1:nq) 
    10971129           dqsurf(1:ngrid,1:nq)=dqsurf(1:ngrid,1:nq) + zdqsdif(1:ngrid,1:nq) 
    10981130         end if ! of if (tracer) 
     
    11711203      if(calladj) then 
    11721204 
    1173          zdh(1:ngrid,1:nlayermx) = pdt(1:ngrid,1:nlayermx)/zpopsk(1:ngrid,1:nlayermx) 
    1174          zduadj(1:ngrid,1:nlayermx)=0.0 
    1175          zdvadj(1:ngrid,1:nlayermx)=0.0 
    1176          zdhadj(1:ngrid,1:nlayermx)=0.0 
     1205         zdh(1:ngrid,1:nlayer) = pdt(1:ngrid,1:nlayer)/zpopsk(1:ngrid,1:nlayer) 
     1206         zduadj(1:ngrid,1:nlayer)=0.0 
     1207         zdvadj(1:ngrid,1:nlayer)=0.0 
     1208         zdhadj(1:ngrid,1:nlayer)=0.0 
    11771209 
    11781210 
     
    11841216              zdqadj) 
    11851217 
    1186          pdu(1:ngrid,1:nlayermx) = pdu(1:ngrid,1:nlayermx) + zduadj(1:ngrid,1:nlayermx) 
    1187          pdv(1:ngrid,1:nlayermx) = pdv(1:ngrid,1:nlayermx) + zdvadj(1:ngrid,1:nlayermx) 
    1188          pdt(1:ngrid,1:nlayermx)    = pdt(1:ngrid,1:nlayermx) + zdhadj(1:ngrid,1:nlayermx)*zpopsk(1:ngrid,1:nlayermx) 
    1189          zdtadj(1:ngrid,1:nlayermx) = zdhadj(1:ngrid,1:nlayermx)*zpopsk(1:ngrid,1:nlayermx) ! for diagnostic only 
     1218         pdu(1:ngrid,1:nlayer) = pdu(1:ngrid,1:nlayer) + zduadj(1:ngrid,1:nlayer) 
     1219         pdv(1:ngrid,1:nlayer) = pdv(1:ngrid,1:nlayer) + zdvadj(1:ngrid,1:nlayer) 
     1220         pdt(1:ngrid,1:nlayer)    = pdt(1:ngrid,1:nlayer) + zdhadj(1:ngrid,1:nlayer)*zpopsk(1:ngrid,1:nlayer) 
     1221         zdtadj(1:ngrid,1:nlayer) = zdhadj(1:ngrid,1:nlayer)*zpopsk(1:ngrid,1:nlayer) ! for diagnostic only 
    11901222 
    11911223         if(tracer) then  
    1192             pdq(1:ngrid,1:nlayermx,1:nq) = pdq(1:ngrid,1:nlayermx,1:nq) + zdqadj(1:ngrid,1:nlayermx,1:nq)  
     1224            pdq(1:ngrid,1:nlayer,1:nq) = pdq(1:ngrid,1:nlayer,1:nq) + zdqadj(1:ngrid,1:nlayer,1:nq)  
    11931225         end if 
    11941226 
     
    12401272              zdqc) 
    12411273 
    1242          pdt(1:ngrid,1:nlayermx)=pdt(1:ngrid,1:nlayermx)+zdtc(1:ngrid,1:nlayermx) 
    1243          pdv(1:ngrid,1:nlayermx)=pdv(1:ngrid,1:nlayermx)+zdvc(1:ngrid,1:nlayermx) 
    1244          pdu(1:ngrid,1:nlayermx)=pdu(1:ngrid,1:nlayermx)+zduc(1:ngrid,1:nlayermx) 
     1274         pdt(1:ngrid,1:nlayer)=pdt(1:ngrid,1:nlayer)+zdtc(1:ngrid,1:nlayer) 
     1275         pdv(1:ngrid,1:nlayer)=pdv(1:ngrid,1:nlayer)+zdvc(1:ngrid,1:nlayer) 
     1276         pdu(1:ngrid,1:nlayer)=pdu(1:ngrid,1:nlayer)+zduc(1:ngrid,1:nlayer) 
    12451277         zdtsurf(1:ngrid) = zdtsurf(1:ngrid) + zdtsurfc(1:ngrid) 
    12461278 
    1247          pdq(1:ngrid,1:nlayermx,1:nq)=pdq(1:ngrid,1:nlayermx,1:nq)+ zdqc(1:ngrid,1:nlayermx,1:nq)  
     1279         pdq(1:ngrid,1:nlayer,1:nq)=pdq(1:ngrid,1:nlayer,1:nq)+ zdqc(1:ngrid,1:nlayer,1:nq)  
    12481280         ! Note: we do not add surface co2ice tendency 
    12491281         ! because qsurf(:,igcm_co2_ice) is updated in condens_co2cloud 
     
    12831315!             ---------------- 
    12841316 
    1285                dqmoist(1:ngrid,1:nlayermx,1:nq)=0. 
    1286                dtmoist(1:ngrid,1:nlayermx)=0. 
    1287  
    1288                call moistadj(ngrid,nq,pt,pq,pdq,pplev,pplay,dtmoist,dqmoist,ptimestep,rneb_man) 
    1289  
    1290                pdq(1:ngrid,1:nlayermx,igcm_h2o_vap) = pdq(1:ngrid,1:nlayermx,igcm_h2o_vap)   & 
    1291                           +dqmoist(1:ngrid,1:nlayermx,igcm_h2o_vap) 
    1292                pdq(1:ngrid,1:nlayermx,igcm_h2o_ice) =pdq(1:ngrid,1:nlayermx,igcm_h2o_ice)     & 
    1293                           +dqmoist(1:ngrid,1:nlayermx,igcm_h2o_ice) 
    1294                pdt(1:ngrid,1:nlayermx) = pdt(1:ngrid,1:nlayermx)+dtmoist(1:ngrid,1:nlayermx) 
     1317               dqmoist(1:ngrid,1:nlayer,1:nq)=0. 
     1318               dtmoist(1:ngrid,1:nlayer)=0. 
     1319 
     1320               call moistadj(ngrid,nlayer,nq,pt,pq,pdq,pplev,pplay,dtmoist,dqmoist,ptimestep,rneb_man) 
     1321 
     1322               pdq(1:ngrid,1:nlayer,igcm_h2o_vap) = pdq(1:ngrid,1:nlayer,igcm_h2o_vap)   & 
     1323                          +dqmoist(1:ngrid,1:nlayer,igcm_h2o_vap) 
     1324               pdq(1:ngrid,1:nlayer,igcm_h2o_ice) =pdq(1:ngrid,1:nlayer,igcm_h2o_ice)     & 
     1325                          +dqmoist(1:ngrid,1:nlayer,igcm_h2o_ice) 
     1326               pdt(1:ngrid,1:nlayer) = pdt(1:ngrid,1:nlayer)+dtmoist(1:ngrid,1:nlayer) 
    12951327 
    12961328               !------------------------- 
     
    13211353!        Large scale condensation/evaporation 
    13221354!        -------------------------------- 
    1323                call largescale(ngrid,nq,ptimestep,pplev,pplay,pt,pq,pdt,pdq,dtlscale,dqvaplscale,dqcldlscale,rneb_lsc) 
    1324  
    1325                pdt(1:ngrid,1:nlayermx) = pdt(1:ngrid,1:nlayermx)+dtlscale(1:ngrid,1:nlayermx) 
    1326                pdq(1:ngrid,1:nlayermx,igcm_h2o_vap) = pdq(1:ngrid,1:nlayermx,igcm_h2o_vap)+dqvaplscale(1:ngrid,1:nlayermx) 
    1327                pdq(1:ngrid,1:nlayermx,igcm_h2o_ice) = pdq(1:ngrid,1:nlayermx,igcm_h2o_ice)+dqcldlscale(1:ngrid,1:nlayermx) 
     1355               call largescale(ngrid,nlayer,nq,ptimestep,pplev,pplay,pt,pq,pdt,pdq,dtlscale,dqvaplscale,dqcldlscale,rneb_lsc) 
     1356 
     1357               pdt(1:ngrid,1:nlayer) = pdt(1:ngrid,1:nlayer)+dtlscale(1:ngrid,1:nlayer) 
     1358               pdq(1:ngrid,1:nlayer,igcm_h2o_vap) = pdq(1:ngrid,1:nlayer,igcm_h2o_vap)+dqvaplscale(1:ngrid,1:nlayer) 
     1359               pdq(1:ngrid,1:nlayer,igcm_h2o_ice) = pdq(1:ngrid,1:nlayer,igcm_h2o_ice)+dqcldlscale(1:ngrid,1:nlayer) 
    13281360 
    13291361               !------------------------- 
     
    13631395            if(waterrain)then 
    13641396 
    1365                zdqrain(1:ngrid,1:nlayermx,1:nq) = 0.0 
     1397               zdqrain(1:ngrid,1:nlayer,1:nq) = 0.0 
    13661398               zdqsrain(1:ngrid)    = 0.0 
    13671399               zdqssnow(1:ngrid)    = 0.0 
    13681400 
    1369                call rain(ngrid,nq,ptimestep,pplev,pplay,pt,pdt,pq,pdq,            & 
     1401               call rain(ngrid,nlayer,nq,ptimestep,pplev,pplay,pt,pdt,pq,pdq,            & 
    13701402                   zdtrain,zdqrain,zdqsrain,zdqssnow,cloudfrac) 
    13711403 
    1372                pdq(1:ngrid,1:nlayermx,igcm_h2o_vap) = pdq(1:ngrid,1:nlayermx,igcm_h2o_vap) & 
    1373                      +zdqrain(1:ngrid,1:nlayermx,igcm_h2o_vap) 
    1374                pdq(1:ngrid,1:nlayermx,igcm_h2o_ice) = pdq(1:ngrid,1:nlayermx,igcm_h2o_ice) & 
    1375                      +zdqrain(1:ngrid,1:nlayermx,igcm_h2o_ice) 
    1376                pdt(1:ngrid,1:nlayermx) = pdt(1:ngrid,1:nlayermx)+zdtrain(1:ngrid,1:nlayermx) 
     1404               pdq(1:ngrid,1:nlayer,igcm_h2o_vap) = pdq(1:ngrid,1:nlayer,igcm_h2o_vap) & 
     1405                     +zdqrain(1:ngrid,1:nlayer,igcm_h2o_vap) 
     1406               pdq(1:ngrid,1:nlayer,igcm_h2o_ice) = pdq(1:ngrid,1:nlayer,igcm_h2o_ice) & 
     1407                     +zdqrain(1:ngrid,1:nlayer,igcm_h2o_ice) 
     1408               pdt(1:ngrid,1:nlayer) = pdt(1:ngrid,1:nlayer)+zdtrain(1:ngrid,1:nlayer) 
    13771409               dqsurf(1:ngrid,igcm_h2o_vap) = dqsurf(1:ngrid,igcm_h2o_vap)+zdqsrain(1:ngrid) ! a bug was here 
    13781410               dqsurf(1:ngrid,igcm_h2o_ice) = dqsurf(1:ngrid,igcm_h2o_ice)+zdqssnow(1:ngrid) 
     
    14191451!        -------------  
    14201452        if (sedimentation) then  
    1421            zdqsed(1:ngrid,1:nlayermx,1:nq) = 0.0 
     1453           zdqsed(1:ngrid,1:nlayer,1:nq) = 0.0 
    14221454           zdqssed(1:ngrid,1:nq)  = 0.0 
    14231455 
     
    14551487              ! and as in rain.F90, whether it falls as rain or snow depends 
    14561488              ! only on the surface temperature 
    1457            pdq(1:ngrid,1:nlayermx,1:nq) = pdq(1:ngrid,1:nlayermx,1:nq) + zdqsed(1:ngrid,1:nlayermx,1:nq) 
     1489           pdq(1:ngrid,1:nlayer,1:nq) = pdq(1:ngrid,1:nlayer,1:nq) + zdqsed(1:ngrid,1:nlayer,1:nq) 
    14581490           dqsurf(1:ngrid,1:nq) = dqsurf(1:ngrid,1:nq) + zdqssed(1:ngrid,1:nq) 
    14591491 
     
    14831515         if(mass_redistrib) then 
    14841516 
    1485             zdmassmr(1:ngrid,1:nlayermx) = mass(1:ngrid,1:nlayermx) * & 
    1486                (   zdqevap(1:ngrid,1:nlayermx)                          & 
    1487                  + zdqrain(1:ngrid,1:nlayermx,igcm_h2o_vap)             & 
    1488                  + dqmoist(1:ngrid,1:nlayermx,igcm_h2o_vap)             & 
    1489                  + dqvaplscale(1:ngrid,1:nlayermx) ) 
     1517            zdmassmr(1:ngrid,1:nlayer) = mass(1:ngrid,1:nlayer) * & 
     1518               (   zdqevap(1:ngrid,1:nlayer)                          & 
     1519                 + zdqrain(1:ngrid,1:nlayer,igcm_h2o_vap)             & 
     1520                 + dqmoist(1:ngrid,1:nlayer,igcm_h2o_vap)             & 
     1521                 + dqvaplscale(1:ngrid,1:nlayer) ) 
    14901522 
    14911523            do ig = 1, ngrid 
    1492                zdmassmr_col(ig)=SUM(zdmassmr(ig,1:nlayermx)) 
     1524               zdmassmr_col(ig)=SUM(zdmassmr(ig,1:nlayer)) 
    14931525            enddo 
    14941526             
     
    15031535          
    15041536 
    1505             pdq(1:ngrid,1:nlayermx,1:nq) = pdq(1:ngrid,1:nlayermx,1:nq) + zdqmr(1:ngrid,1:nlayermx,1:nq) 
     1537            pdq(1:ngrid,1:nlayer,1:nq) = pdq(1:ngrid,1:nlayer,1:nq) + zdqmr(1:ngrid,1:nlayer,1:nq) 
    15061538            dqsurf(1:ngrid,1:nq)         = dqsurf(1:ngrid,1:nq) + zdqsurfmr(1:ngrid,1:nq) 
    1507             pdt(1:ngrid,1:nlayermx)        = pdt(1:ngrid,1:nlayermx) + zdtmr(1:ngrid,1:nlayermx) 
    1508             pdu(1:ngrid,1:nlayermx)        = pdu(1:ngrid,1:nlayermx) + zdumr(1:ngrid,1:nlayermx) 
    1509             pdv(1:ngrid,1:nlayermx)        = pdv(1:ngrid,1:nlayermx) + zdvmr(1:ngrid,1:nlayermx) 
     1539            pdt(1:ngrid,1:nlayer)        = pdt(1:ngrid,1:nlayer) + zdtmr(1:ngrid,1:nlayer) 
     1540            pdu(1:ngrid,1:nlayer)        = pdu(1:ngrid,1:nlayer) + zdumr(1:ngrid,1:nlayer) 
     1541            pdv(1:ngrid,1:nlayer)        = pdv(1:ngrid,1:nlayer) + zdvmr(1:ngrid,1:nlayer) 
    15101542            pdpsrf(1:ngrid)                = pdpsrf(1:ngrid) + zdpsrfmr(1:ngrid) 
    15111543            zdtsurf(1:ngrid)               = zdtsurf(1:ngrid) + zdtsurfmr(1:ngrid) 
    15121544             
    1513 !           print*,'after mass redistrib, q=',pq(211,1:nlayermx,igcm_h2o_vap)+ptimestep*pdq(211,1:nlayermx,igcm_h2o_vap)  
     1545!           print*,'after mass redistrib, q=',pq(211,1:nlayer,igcm_h2o_vap)+ptimestep*pdq(211,1:nlayer,igcm_h2o_vap)  
    15141546         endif 
    15151547 
     
    16721704  
    16731705      ! temperature, zonal and meridional wind 
    1674       zt(1:ngrid,1:nlayermx) = pt(1:ngrid,1:nlayermx) + pdt(1:ngrid,1:nlayermx)*ptimestep 
    1675       zu(1:ngrid,1:nlayermx) = pu(1:ngrid,1:nlayermx) + pdu(1:ngrid,1:nlayermx)*ptimestep 
    1676       zv(1:ngrid,1:nlayermx) = pv(1:ngrid,1:nlayermx) + pdv(1:ngrid,1:nlayermx)*ptimestep 
     1706      zt(1:ngrid,1:nlayer) = pt(1:ngrid,1:nlayer) + pdt(1:ngrid,1:nlayer)*ptimestep 
     1707      zu(1:ngrid,1:nlayer) = pu(1:ngrid,1:nlayer) + pdu(1:ngrid,1:nlayer)*ptimestep 
     1708      zv(1:ngrid,1:nlayer) = pv(1:ngrid,1:nlayer) + pdv(1:ngrid,1:nlayer)*ptimestep 
    16771709 
    16781710      ! diagnostic 
    1679       zdtdyn(1:ngrid,1:nlayermx)     = pt(1:ngrid,1:nlayermx)-ztprevious(1:ngrid,1:nlayermx) 
    1680       ztprevious(1:ngrid,1:nlayermx) = zt(1:ngrid,1:nlayermx) 
     1711      zdtdyn(1:ngrid,1:nlayer)     = pt(1:ngrid,1:nlayer)-ztprevious(1:ngrid,1:nlayer) 
     1712      ztprevious(1:ngrid,1:nlayer) = zt(1:ngrid,1:nlayer) 
    16811713 
    16821714      if(firstcall)then 
    1683          zdtdyn(1:ngrid,1:nlayermx)=0.0 
     1715         zdtdyn(1:ngrid,1:nlayer)=0.0 
    16841716      endif 
    16851717 
     
    16901722 
    16911723      ! tracers 
    1692       zq(1:ngrid,1:nlayermx,1:nq) = pq(1:ngrid,1:nlayermx,1:nq) + pdq(1:ngrid,1:nlayermx,1:nq)*ptimestep 
     1724      zq(1:ngrid,1:nlayer,1:nq) = pq(1:ngrid,1:nlayer,1:nq) + pdq(1:ngrid,1:nlayer,1:nq)*ptimestep 
    16931725 
    16941726      ! surface pressure 
     
    17981830         do iq=1,nq 
    17991831           do ig=1,ngrid 
    1800               qcol(ig,iq) = SUM( zq(ig,1:nlayermx,iq) * mass(ig,1:nlayermx)) 
     1832              qcol(ig,iq) = SUM( zq(ig,1:nlayer,iq) * mass(ig,1:nlayer)) 
    18011833           enddo 
    18021834         enddo 
     
    18051837         reffcol(1:ngrid,1:naerkind)=0.0 
    18061838         if(co2cond.and.(iaero_co2.ne.0))then 
    1807             call co2_reffrad(ngrid,nq,zq,reffrad(1,1,iaero_co2)) 
     1839            call co2_reffrad(ngrid,nlayer,nq,zq,reffrad(1,1,iaero_co2)) 
    18081840            do ig=1,ngrid 
    1809                reffcol(ig,iaero_co2) = SUM(zq(ig,1:nlayermx,igcm_co2_ice)*reffrad(ig,1:nlayermx,iaero_co2)*mass(ig,1:nlayermx)) 
     1841               reffcol(ig,iaero_co2) = SUM(zq(ig,1:nlayer,igcm_co2_ice)*reffrad(ig,1:nlayer,iaero_co2)*mass(ig,1:nlayer)) 
    18101842            enddo 
    18111843         endif 
    18121844         if(water.and.(iaero_h2o.ne.0))then 
    1813             call h2o_reffrad(ngrid,zq(1,1,igcm_h2o_ice),zt, & 
     1845            call h2o_reffrad(ngrid,nlayer,zq(1,1,igcm_h2o_ice),zt, & 
    18141846                             reffrad(1,1,iaero_h2o),nueffrad(1,1,iaero_h2o)) 
    18151847            do ig=1,ngrid 
    1816                reffcol(ig,iaero_h2o) = SUM(zq(ig,1:nlayermx,igcm_h2o_ice)*reffrad(ig,1:nlayermx,iaero_h2o)*mass(ig,1:nlayermx)) 
     1848               reffcol(ig,iaero_h2o) = SUM(zq(ig,1:nlayer,igcm_h2o_ice)*reffrad(ig,1:nlayer,iaero_h2o)*mass(ig,1:nlayer)) 
    18171849            enddo 
    18181850         endif 
     
    19892021              end do 
    19902022            if (water) then 
    1991                vmr=zq(1:ngrid,1:nlayermx,igcm_h2o_vap)*mugaz/mmol(igcm_h2o_vap) 
     2023               vmr=zq(1:ngrid,1:nlayer,igcm_h2o_vap)*mugaz/mmol(igcm_h2o_vap) 
    19922024               call wstats(ngrid,"vmr_h2ovapor",                           & 
    19932025                          "H2O vapour volume mixing ratio","mol/mol",       &  
     
    21832215 
    21842216        ! deallocate gas variables 
     2217!$OMP BARRIER 
     2218!$OMP MASTER 
    21852219        IF ( ALLOCATED( gnom ) ) DEALLOCATE( gnom ) 
    21862220        IF ( ALLOCATED( gfrac ) ) DEALLOCATE( gfrac )  ! both allocated in su_gases.F90 
     2221!$OMP END MASTER 
     2222!$OMP BARRIER 
    21872223 
    21882224        ! deallocate saved arrays 
     
    22032239        IF ( ALLOCATED(q2)) DEALLOCATE(q2) 
    22042240        IF ( ALLOCATED(ztprevious)) DEALLOCATE(ztprevious) 
     2241        IF ( ALLOCATED(hice)) DEALLOCATE(hice) 
    22052242        IF ( ALLOCATED(cloudfrac)) DEALLOCATE(cloudfrac) 
    22062243        IF ( ALLOCATED(totcloudfrac)) DEALLOCATE(totcloudfrac) 
     
    22232260        IF ( ALLOCATED(zdtsw)) DEALLOCATE(zdtsw) 
    22242261        IF ( ALLOCATED(tau_col)) DEALLOCATE(tau_col) 
     2262        IF ( ALLOCATED(pctsrf_sic)) DEALLOCATE(pctsrf_sic) 
     2263        IF ( ALLOCATED(tslab)) DEALLOCATE(tslab) 
     2264        IF ( ALLOCATED(tsea_ice)) DEALLOCATE(tsea_ice) 
     2265        IF ( ALLOCATED(sea_ice)) DEALLOCATE(sea_ice) 
     2266        IF ( ALLOCATED(zmasq)) DEALLOCATE(zmasq) 
     2267        IF ( ALLOCATED(knindex)) DEALLOCATE(knindex) 
    22252268 
    22262269        !! this is defined in comsaison_h 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/radcommon_h.F90

    r222 r227  
    6161! gIR      :  mean assymetry factor 
    6262 
    63       REAL*8 BWNI(L_NSPECTI+1), WNOI(L_NSPECTI), DWNI(L_NSPECTI), WAVEI(L_NSPECTI) 
    64       REAL*8 BWNV(L_NSPECTV+1), WNOV(L_NSPECTV), DWNV(L_NSPECTV), WAVEV(L_NSPECTV) 
     63      REAL*8 BWNI(L_NSPECTI+1), WNOI(L_NSPECTI), DWNI(L_NSPECTI), WAVEI(L_NSPECTI) !BWNI read by master in setspi 
     64      REAL*8 BWNV(L_NSPECTV+1), WNOV(L_NSPECTV), DWNV(L_NSPECTV), WAVEV(L_NSPECTV) !BWNV read by master in setspv 
    6565      REAL*8 STELLARF(L_NSPECTV), TAURAY(L_NSPECTV), TAURAYVAR(L_NSPECTV) 
     66!$OMP THREADPRIVATE(WNOI,DWNI,WAVEI,& 
     67        !$OMP WNOV,DWNV,WAVEV,& 
     68        !$OMP STELLARF,TAURAY,TAURAYVAR) 
    6669 
    6770      REAL*8 blami(L_NSPECTI+1) 
    6871      REAL*8 blamv(L_NSPECTV+1) ! these are needed by suaer.F90 
     72!$OMP THREADPRIVATE(blami,blamv) 
    6973 
    7074      !! AS: introduced to avoid doing same computations again for continuum 
    7175      INTEGER, DIMENSION(:,:,:), ALLOCATABLE :: indi 
    7276      INTEGER, DIMENSION(:,:,:), ALLOCATABLE :: indv 
     77!$OMP THREADPRIVATE(indi,indv) 
    7378 
    7479      !!! ALLOCATABLE STUFF SO THAT DIMENSIONS ARE READ in *.dat FILES -- AS 12/2011   
     
    7984      real*8 pgasmin, pgasmax 
    8085      real*8 tgasmin, tgasmax 
     86!$OMP THREADPRIVATE(gasi,gasv,&  !wrefvar,pgasref,tgasref,pfgasref read by master in sugas_corrk 
     87        !$OMP FZEROI,FZEROV)     !pgasmin,pgasmax,tgasmin,tgasmax read by master in sugas_corrk 
    8188 
    8289      real QVISsQREF(L_NSPECTV,naerkind,nsizemax) 
     
    8693      real omegair(L_NSPECTI,naerkind,nsizemax) 
    8794      real gir(L_NSPECTI,naerkind,nsizemax) 
     95!$OMP THREADPRIVATE(QVISsQREF,omegavis,gvis,QIRsQREF,omegair,gir) 
    8896 
    8997 
     
    102110 
    103111      DOUBLE PRECISION :: radiustab(naerkind,2,nsizemax) 
     112!$OMP THREADPRIVATE(lamrefir,lamrefvis,radiustab) !nsize read by suaer_corrk 
    104113 
    105114! Extinction coefficient at reference wavelengths; 
     
    121130 
    122131      real*8 gweight(L_NGAUSS) 
     132!$OMP THREADPRIVATE(QREFvis,QREFir,omegaREFvis,omegaREFir,&     ! gweight read by master in sugas_corrk 
     133                !$OMP tstellar,planckir,PTOP,TAUREF) 
    123134 
    124135!     If the gas optical depth (top to the surface) is less than 
     
    137148      real*8 glat_ig 
    138149      save glat_ig 
     150!$OMP THREADPRIVATE(Cmk,glat_ig) 
    139151 
    140152      ! extinction of incoming sunlight (Saturn's rings, eclipses, etc...) 
     
    143155      !Latitude-dependent gravity 
    144156      REAL, DIMENSION(:), ALLOCATABLE :: glat 
     157!$OMP THREADPRIVATE(glat,eclipse) 
    145158 
    146159      end module radcommon_h 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/radii_mod.F90

    r222 r227  
    1212      real, save ::  Nmix_h2o 
    1313      real, save ::  Nmix_h2o_ice 
     14!$OMP THREADPRIVATE(rad_h2o,rad_h2o_ice,Nmix_h2o,Nmix_h2o_ice) 
    1415      real, parameter ::  coef_chaud=0.13 
    1516      real, parameter ::  coef_froid=0.09 
     
    2021 
    2122!================================================================== 
    22    subroutine su_aer_radii(ngrid,reffrad,nueffrad) 
     23   subroutine su_aer_radii(ngrid,nlayer,reffrad,nueffrad) 
    2324!================================================================== 
    2425!     Purpose 
     
    3233!================================================================== 
    3334 ! to use  'getin' 
    34       use ioipsl_getincom  
     35!      use ioipsl_getincom  
     36      use ioipsl_getincom_p 
    3537      use radinc_h, only: naerkind 
    3638      use aerosol_mod 
     
    3941 
    4042      include "callkeys.h" 
    41       include "dimensions.h" 
    42       include "dimphys.h" 
    43  
    44       integer,intent(in) :: ngrid 
    45  
    46       real, intent(out) :: reffrad(ngrid,nlayermx,naerkind)      !aerosols radii (K) 
    47       real, intent(out) :: nueffrad(ngrid,nlayermx,naerkind)     !variance      
     43!      include "dimensions.h" 
     44!      include "dimphys.h" 
     45 
     46      integer,intent(in) :: ngrid 
     47      integer,intent(in) :: nlayer 
     48 
     49      real, intent(out) :: reffrad(ngrid,nlayer,naerkind)      !aerosols radii (K) 
     50      real, intent(out) :: nueffrad(ngrid,nlayer,naerkind)     !variance      
    4851 
    4952      logical, save :: firstcall=.true. 
     53!$OMP THREADPRIVATE(firstcall) 
    5054      integer :: iaer    
    5155       
     
    5862 
    5963            if(iaer.eq.iaero_co2)then ! CO2 ice 
    60                reffrad(1:ngrid,1:nlayermx,iaer) = 1.e-4 
    61                nueffrad(1:ngrid,1:nlayermx,iaer) = 0.1  
     64               reffrad(1:ngrid,1:nlayer,iaer) = 1.e-4 
     65               nueffrad(1:ngrid,1:nlayer,iaer) = 0.1  
    6266            endif 
    6367 
    6468            if(iaer.eq.iaero_h2o)then ! H2O ice 
    65                reffrad(1:ngrid,1:nlayermx,iaer) = 1.e-5 
    66                nueffrad(1:ngrid,1:nlayermx,iaer) = 0.1  
     69               reffrad(1:ngrid,1:nlayer,iaer) = 1.e-5 
     70               nueffrad(1:ngrid,1:nlayer,iaer) = 0.1  
    6771            endif 
    6872 
    6973            if(iaer.eq.iaero_dust)then ! dust 
    70                reffrad(1:ngrid,1:nlayermx,iaer) = 1.e-5 
    71                nueffrad(1:ngrid,1:nlayermx,iaer) = 0.1  
     74               reffrad(1:ngrid,1:nlayer,iaer) = 1.e-5 
     75               nueffrad(1:ngrid,1:nlayer,iaer) = 0.1  
    7276            endif 
    7377  
    7478            if(iaer.eq.iaero_h2so4)then ! H2O ice 
    75                reffrad(1:ngrid,1:nlayermx,iaer) = 1.e-6 
    76                nueffrad(1:ngrid,1:nlayermx,iaer) = 0.1  
     79               reffrad(1:ngrid,1:nlayer,iaer) = 1.e-6 
     80               nueffrad(1:ngrid,1:nlayer,iaer) = 0.1  
    7781            endif 
    7882             
    7983            if(iaer.eq.iaero_back2lay)then ! Two-layer aerosols 
    80                reffrad(1:ngrid,1:nlayermx,iaer) = 2.e-6 
    81                nueffrad(1:ngrid,1:nlayermx,iaer) = 0.1  
     84               reffrad(1:ngrid,1:nlayer,iaer) = 2.e-6 
     85               nueffrad(1:ngrid,1:nlayer,iaer) = 0.1  
    8286            endif 
    8387 
     
    98102            write(*,*)"radius of H2O water particles:" 
    99103            rad_h2o=13. ! default value 
    100             call getin("rad_h2o",rad_h2o) 
     104            call getin_p("rad_h2o",rad_h2o) 
    101105            write(*,*)" rad_h2o = ",rad_h2o 
    102106 
    103107            write(*,*)"radius of H2O ice particles:" 
    104108            rad_h2o_ice=35. ! default value 
    105             call getin("rad_h2o_ice",rad_h2o_ice) 
     109            call getin_p("rad_h2o_ice",rad_h2o_ice) 
    106110            write(*,*)" rad_h2o_ice = ",rad_h2o_ice 
    107111 
     
    110114            write(*,*)"Number mixing ratio of H2O water particles:" 
    111115            Nmix_h2o=1.e6 ! default value 
    112             call getin("Nmix_h2o",Nmix_h2o) 
     116            call getin_p("Nmix_h2o",Nmix_h2o) 
    113117            write(*,*)" Nmix_h2o = ",Nmix_h2o 
    114118 
    115119            write(*,*)"Number mixing ratio of H2O ice particles:" 
    116120            Nmix_h2o_ice=Nmix_h2o ! default value 
    117             call getin("Nmix_h2o_ice",Nmix_h2o_ice) 
     121            call getin_p("Nmix_h2o_ice",Nmix_h2o_ice) 
    118122            write(*,*)" Nmix_h2o_ice = ",Nmix_h2o_ice 
    119123         endif 
     
    126130 
    127131!================================================================== 
    128    subroutine h2o_reffrad(ngrid,pq,pt,reffrad,nueffrad) 
     132   subroutine h2o_reffrad(ngrid,nlayer,pq,pt,reffrad,nueffrad) 
    129133!================================================================== 
    130134!     Purpose 
     
    141145 
    142146      include "callkeys.h" 
    143       include "dimensions.h" 
    144       include "dimphys.h" 
     147!      include "dimensions.h" 
     148!      include "dimphys.h" 
    145149      include "comcstfi.h" 
    146150 
    147151      integer,intent(in) :: ngrid 
    148  
    149       real, intent(in) :: pq(ngrid,nlayermx) !water ice mixing ratios (kg/kg) 
    150       real, intent(in) :: pt(ngrid,nlayermx) !temperature (K) 
    151       real, intent(out) :: reffrad(ngrid,nlayermx)      !aerosol radii 
    152       real, intent(out) :: nueffrad(ngrid,nlayermx) ! dispersion       
     152      integer,intent(in) :: nlayer 
     153 
     154      real, intent(in) :: pq(ngrid,nlayer) !water ice mixing ratios (kg/kg) 
     155      real, intent(in) :: pt(ngrid,nlayer) !temperature (K) 
     156      real, intent(out) :: reffrad(ngrid,nlayer)      !aerosol radii 
     157      real, intent(out) :: nueffrad(ngrid,nlayer) ! dispersion       
    153158 
    154159      integer :: ig,l 
     
    158163 
    159164      if (radfixed) then 
    160          do l=1,nlayermx 
     165         do l=1,nlayer 
    161166            do ig=1,ngrid 
    162167               zfice = 1.0 - (pt(ig,l)-T_h2O_ice_clouds) / (T_h2O_ice_liq-T_h2O_ice_clouds) 
     
    167172         enddo 
    168173      else 
    169          do l=1,nlayermx 
     174         do l=1,nlayer 
    170175            do ig=1,ngrid 
    171176               zfice = 1.0 - (pt(ig,l)-T_h2O_ice_clouds) / (T_h2O_ice_liq-T_h2O_ice_clouds) 
     
    186191 
    187192!================================================================== 
    188    subroutine h2o_cloudrad(ngrid,pql,reffliq,reffice) 
     193   subroutine h2o_cloudrad(ngrid,nlayer,pql,reffliq,reffice) 
    189194!================================================================== 
    190195!     Purpose 
     
    201206 
    202207      include "callkeys.h" 
    203       include "dimensions.h" 
    204       include "dimphys.h" 
     208!      include "dimensions.h" 
     209!      include "dimphys.h" 
    205210      include "comcstfi.h" 
    206211 
    207212      integer,intent(in) :: ngrid 
    208  
    209       real, intent(in) :: pql(ngrid,nlayermx) !condensed water mixing ratios (kg/kg) 
    210       real, intent(out) :: reffliq(ngrid,nlayermx),reffice(ngrid,nlayermx)     !liquid and ice water particle radii (m) 
     213      integer,intent(in) :: nlayer 
     214 
     215      real, intent(in) :: pql(ngrid,nlayer) !condensed water mixing ratios (kg/kg) 
     216      real, intent(out) :: reffliq(ngrid,nlayer),reffice(ngrid,nlayer)     !liquid and ice water particle radii (m) 
    211217 
    212218      real,external :: CBRT             
     
    214220 
    215221      if (radfixed) then 
    216          reffliq(1:ngrid,1:nlayermx)= rad_h2o 
    217          reffice(1:ngrid,1:nlayermx)= rad_h2o_ice 
     222         reffliq(1:ngrid,1:nlayer)= rad_h2o 
     223         reffice(1:ngrid,1:nlayer)= rad_h2o_ice 
    218224      else 
    219          do k=1,nlayermx 
     225         do k=1,nlayer 
    220226           do i=1,ngrid 
    221227             reffliq(i,k) = CBRT(3*pql(i,k)/(4*Nmix_h2o*pi*rhowater)) 
     
    234240 
    235241!================================================================== 
    236    subroutine co2_reffrad(ngrid,nq,pq,reffrad) 
     242   subroutine co2_reffrad(ngrid,nlayer,nq,pq,reffrad) 
    237243!================================================================== 
    238244!     Purpose 
     
    249255 
    250256      include "callkeys.h" 
    251       include "dimensions.h" 
    252       include "dimphys.h" 
     257!      include "dimensions.h" 
     258!      include "dimphys.h" 
    253259      include "comcstfi.h" 
    254260 
    255       integer,intent(in) :: ngrid,nq 
    256  
    257       real, intent(in) :: pq(ngrid,nlayermx,nq) !tracer mixing ratios (kg/kg) 
    258       real, intent(out) :: reffrad(ngrid,nlayermx)      !co2 ice particles radii (K) 
     261      integer,intent(in) :: ngrid,nlayer,nq 
     262 
     263      real, intent(in) :: pq(ngrid,nlayer,nq) !tracer mixing ratios (kg/kg) 
     264      real, intent(out) :: reffrad(ngrid,nlayer)      !co2 ice particles radii (m) 
    259265 
    260266      integer :: ig,l 
     
    265271 
    266272      if (radfixed) then 
    267          reffrad(1:ngrid,1:nlayermx) = 5.e-5 ! CO2 ice 
     273         reffrad(1:ngrid,1:nlayer) = 5.e-5 ! CO2 ice 
    268274      else 
    269          do l=1,nlayermx 
     275         do l=1,nlayer 
    270276            do ig=1,ngrid 
    271277               zrad = CBRT( 3*pq(ig,l,igcm_co2_ice)/(4*Nmix_co2*pi*rho_co2) ) 
     
    281287 
    282288!================================================================== 
    283    subroutine dust_reffrad(ngrid,reffrad) 
     289   subroutine dust_reffrad(ngrid,nlayer,reffrad) 
    284290!================================================================== 
    285291!     Purpose 
     
    294300      Implicit none 
    295301 
    296       include "callkeys.h" 
    297       include "dimensions.h" 
    298       include "dimphys.h" 
    299  
    300       integer,intent(in) :: ngrid 
    301  
    302       real, intent(out) :: reffrad(ngrid,nlayermx)      !dust particles radii (K) 
     302!      include "callkeys.h" 
     303!      include "dimensions.h" 
     304!      include "dimphys.h" 
     305 
     306      integer,intent(in) :: ngrid 
     307      integer,intent(in) :: nlayer 
     308 
     309      real, intent(out) :: reffrad(ngrid,nlayer)      !dust particles radii (m) 
    303310             
    304       reffrad(1:ngrid,1:nlayermx) = 2.e-6 ! dust 
     311      reffrad(1:ngrid,1:nlayer) = 2.e-6 ! dust 
    305312 
    306313   end subroutine dust_reffrad 
     
    309316 
    310317!================================================================== 
    311    subroutine h2so4_reffrad(ngrid,reffrad) 
     318   subroutine h2so4_reffrad(ngrid,nlayer,reffrad) 
    312319!================================================================== 
    313320!     Purpose 
     
    322329      Implicit none 
    323330 
    324       include "callkeys.h" 
    325       include "dimensions.h" 
    326       include "dimphys.h" 
    327  
    328       integer,intent(in) :: ngrid 
    329  
    330       real, intent(out) :: reffrad(ngrid,nlayermx)      !h2so4 particle radii (K) 
     331!      include "callkeys.h" 
     332!      include "dimensions.h" 
     333!      include "dimphys.h" 
     334 
     335      integer,intent(in) :: ngrid 
     336      integer,intent(in) :: nlayer 
     337 
     338      real, intent(out) :: reffrad(ngrid,nlayer)      !h2so4 particle radii (m) 
    331339                 
    332       reffrad(1:ngrid,1:nlayermx) = 1.e-6 ! h2so4 
     340      reffrad(1:ngrid,1:nlayer) = 1.e-6 ! h2so4 
    333341 
    334342   end subroutine h2so4_reffrad 
     
    352360 
    353361     include "callkeys.h" 
    354      include "dimensions.h" 
    355      include "dimphys.h" 
    356  
    357       integer,intent(in) :: ngrid 
    358  
    359       real, intent(out) :: reffrad(ngrid,nlayermx)      ! particle radii  
     362!     include "dimensions.h" 
     363!     include "dimphys.h" 
     364 
     365      integer,intent(in) :: ngrid 
     366 
     367      real, intent(out) :: reffrad(ngrid,nlayer)      ! particle radii (m) 
    360368      REAL,INTENT(IN) :: pplev(ngrid,nlayer+1) ! inter-layer pressure (Pa) 
    361369      INTEGER,INTENT(IN) :: nlayer ! number of atmospheric layers 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/radinc_h.F90

    r222 r227  
    6363      ! These are set in sugas_corrk 
    6464      ! [uses allocatable arrays] -- AS 12/2011 
    65       integer :: L_NPREF, L_NTREF, L_REFVAR, L_PINT 
     65      integer :: L_NPREF, L_NTREF, L_REFVAR, L_PINT   !L_NPREF, L_NTREF, L_REFVAR, L_PINT read by master in sugas_corrk 
    6666 
    6767      integer, parameter :: L_NGAUSS  = 17 
     
    9292      character (len=100) :: corrkdir 
    9393      save corrkdir 
     94!$OMP THREADPRIVATE(corrkdir) 
    9495 
    9596      character (len=100) :: banddir 
    9697      save banddir 
     98!$OMP THREADPRIVATE(banddir) 
    9799 
    98100      end module radinc_h 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/rain.F90

    r222 r227  
    1 subroutine rain(ngrid,nq,ptimestep,pplev,pplay,t,pdt,pq,pdq,d_t,dqrain,dqsrain,dqssnow,rneb) 
    2  
    3  
    4   use ioipsl_getincom, only: getin 
     1subroutine rain(ngrid,nlayer,nq,ptimestep,pplev,pplay,t,pdt,pq,pdq,d_t,dqrain,dqsrain,dqssnow,rneb) 
     2 
     3 
     4! to use  'getin' 
     5!  use ioipsl_getincom  
     6  use ioipsl_getincom_p 
    57  use watercommon_h, only: T_h2O_ice_liq,T_h2O_ice_clouds, RLVTT, RCPD, RCPV, RV, RVTMP2,Psat_water,Tsat_water,rhowater 
    68  use radii_mod, only: h2o_cloudrad 
     
    2224!================================================================== 
    2325 
    24   include "dimensions.h" 
    25   include "dimphys.h" 
     26!  include "dimensions.h" 
     27!  include "dimphys.h" 
    2628  include "comcstfi.h" 
    2729  include "callkeys.h" 
    2830 
    2931!     Arguments 
    30       integer,intent(in) :: ngrid ! number of atmospherci columns 
     32      integer,intent(in) :: ngrid ! number of atmospheric columns 
     33      integer,intent(in) :: nlayer ! number of atmospheric layers 
    3134      integer,intent(in) :: nq ! number of tracers 
    3235      real,intent(in) :: ptimestep    ! time interval 
    33       real,intent(in) :: pplev(ngrid,nlayermx+1) ! inter-layer pressure (Pa) 
    34       real,intent(in) :: pplay(ngrid,nlayermx)   ! mid-layer pressure (Pa) 
    35       real,intent(in) :: t(ngrid,nlayermx) ! input temperature (K) 
    36       real,intent(in) :: pdt(ngrid,nlayermx) ! input tendency on temperature (K/s)       
    37       real,intent(in) :: pq(ngrid,nlayermx,nq)  ! tracers (kg/kg) 
    38       real,intent(in) :: pdq(ngrid,nlayermx,nq) ! input tendency on tracers 
    39       real,intent(out) :: d_t(ngrid,nlayermx) ! temperature tendency (K/s) 
    40       real,intent(out) :: dqrain(ngrid,nlayermx,nq) ! tendency of H2O precipitation (kg/kg.s-1) 
     36      real,intent(in) :: pplev(ngrid,nlayer+1) ! inter-layer pressure (Pa) 
     37      real,intent(in) :: pplay(ngrid,nlayer)   ! mid-layer pressure (Pa) 
     38      real,intent(in) :: t(ngrid,nlayer) ! input temperature (K) 
     39      real,intent(in) :: pdt(ngrid,nlayer) ! input tendency on temperature (K/s)       
     40      real,intent(in) :: pq(ngrid,nlayer,nq)  ! tracers (kg/kg) 
     41      real,intent(in) :: pdq(ngrid,nlayer,nq) ! input tendency on tracers 
     42      real,intent(out) :: d_t(ngrid,nlayer) ! temperature tendency (K/s) 
     43      real,intent(out) :: dqrain(ngrid,nlayer,nq) ! tendency of H2O precipitation (kg/kg.s-1) 
    4144      real,intent(out) :: dqsrain(ngrid)  ! rain flux at the surface (kg.m-2.s-1) 
    4245      real,intent(out) :: dqssnow(ngrid)  ! snow flux at the surface (kg.m-2.s-1) 
    43       real,intent(in) :: rneb(ngrid,nlayermx) ! cloud fraction 
    44  
    45       REAL zt(ngrid,nlayermx)         ! working temperature (K) 
    46       REAL ql(ngrid,nlayermx)         ! liquid water (Kg/Kg) 
    47       REAL q(ngrid,nlayermx)          ! specific humidity (Kg/Kg) 
    48       REAL d_q(ngrid,nlayermx)        ! water vapor increment 
    49       REAL d_ql(ngrid,nlayermx)       ! liquid water / ice increment 
     46      real,intent(in) :: rneb(ngrid,nlayer) ! cloud fraction 
     47 
     48      REAL zt(ngrid,nlayer)         ! working temperature (K) 
     49      REAL ql(ngrid,nlayer)         ! liquid water (Kg/Kg) 
     50      REAL q(ngrid,nlayer)          ! specific humidity (Kg/Kg) 
     51      REAL d_q(ngrid,nlayer)        ! water vapor increment 
     52      REAL d_ql(ngrid,nlayer)       ! liquid water / ice increment 
    5053 
    5154!     Subroutine options 
     
    6265      REAL,PARAMETER :: Kboucher=1.19E8 
    6366      REAL,SAVE :: c1 
     67!$OMP THREADPRIVATE(precip_scheme,rainthreshold,cloud_sat,precip_timescale,Cboucher,c1) 
    6468 
    6569      INTEGER,PARAMETER :: ninter=5 
    6670 
    6771      logical,save :: evap_prec ! Does the rain evaporate? 
     72!$OMP THREADPRIVATE(evap_prec) 
    6873 
    6974!     for simple scheme 
     
    7378!     Local variables 
    7479      INTEGER i, k, n 
    75       REAL zqs(ngrid,nlayermx),Tsat(ngrid,nlayermx), zdelta, zcor 
     80      REAL zqs(ngrid,nlayer),Tsat(ngrid,nlayer), zdelta, zcor 
    7681      REAL zrfl(ngrid), zrfln(ngrid), zqev, zqevt 
    7782 
     
    8085      REAL zchau(ngrid),zfroi(ngrid),zfrac(ngrid),zneb(ngrid) 
    8186 
    82       real reffh2oliq(ngrid,nlayermx),reffh2oice(ngrid,nlayermx) 
     87      real reffh2oliq(ngrid,nlayer),reffh2oice(ngrid,nlayer) 
    8388   
    8489      real ttemp, ptemp, psat_tmp 
    85       real tnext(ngrid,nlayermx) 
    86  
    87       real l2c(ngrid,nlayermx) 
     90      real tnext(ngrid,nlayer) 
     91 
     92      real l2c(ngrid,nlayer) 
    8893      real dWtot 
    8994 
     
    9297      INTEGER, SAVE :: i_vap=0  ! water vapour 
    9398      INTEGER, SAVE :: i_ice=0  ! water ice 
     99!$OMP THREADPRIVATE(i_vap,i_ice) 
    94100 
    95101      LOGICAL,SAVE :: firstcall=.true. 
     102!$OMP THREADPRIVATE(firstcall) 
    96103 
    97104!     Online functions 
     
    114121         write(*,*) "Precipitation scheme to use?" 
    115122         precip_scheme=1 ! default value 
    116          call getin("precip_scheme",precip_scheme) 
     123         call getin_p("precip_scheme",precip_scheme) 
    117124         write(*,*) " precip_scheme = ",precip_scheme 
    118125 
     
    120127            write(*,*) "rainthreshold in simple scheme?" 
    121128            rainthreshold=0. ! default value 
    122             call getin("rainthreshold",rainthreshold) 
     129            call getin_p("rainthreshold",rainthreshold) 
    123130            write(*,*) " rainthreshold = ",rainthreshold 
    124131 
     
    126133            write(*,*) "cloud water saturation level in non simple scheme?" 
    127134            cloud_sat=2.6e-4   ! default value 
    128             call getin("cloud_sat",cloud_sat) 
     135            call getin_p("cloud_sat",cloud_sat) 
    129136            write(*,*) " cloud_sat = ",cloud_sat 
    130137            write(*,*) "precipitation timescale in non simple scheme?" 
    131138            precip_timescale=3600.  ! default value 
    132             call getin("precip_timescale",precip_timescale) 
     139            call getin_p("precip_timescale",precip_timescale) 
    133140            write(*,*) " precip_timescale = ",precip_timescale 
    134141 
     
    136143            write(*,*) "multiplicative constant in Boucher 95 precip scheme" 
    137144            Cboucher=1.   ! default value 
    138             call getin("Cboucher",Cboucher) 
     145            call getin_p("Cboucher",Cboucher) 
    139146            write(*,*) " Cboucher = ",Cboucher   
    140147            c1=1.00*1.097/rhowater*Cboucher*Kboucher   
     
    144151         write(*,*) "re-evaporate precipitations?" 
    145152         evap_prec=.true. ! default value 
    146          call getin("evap_prec",evap_prec) 
     153         call getin_p("evap_prec",evap_prec) 
    147154         write(*,*) " evap_prec = ",evap_prec 
    148155 
     
    151158 
    152159!     GCM -----> subroutine variables 
    153       DO k = 1, nlayermx 
     160      DO k = 1, nlayer 
    154161      DO i = 1, ngrid 
    155162 
     
    172179 
    173180!     Initialise the outputs 
    174       d_t(1:ngrid,1:nlayermx) = 0.0 
    175       d_q(1:ngrid,1:nlayermx) = 0.0 
    176       d_ql(1:ngrid,1:nlayermx) = 0.0 
     181      d_t(1:ngrid,1:nlayer) = 0.0 
     182      d_q(1:ngrid,1:nlayer) = 0.0 
     183      d_ql(1:ngrid,1:nlayer) = 0.0 
    177184      zrfl(1:ngrid) = 0.0 
    178185      zrfln(1:ngrid) = 0.0 
    179186 
    180187      ! calculate saturation mixing ratio 
    181       DO k = 1, nlayermx 
     188      DO k = 1, nlayer 
    182189         DO i = 1, ngrid 
    183190            ttemp = zt(i,k)  
     
    190197 
    191198      ! get column / layer conversion factor 
    192       DO k = 1, nlayermx 
     199      DO k = 1, nlayer 
    193200         DO i = 1, ngrid 
    194201            l2c(i,k)=(pplev(i,k)-pplev(i,k+1))/g 
     
    199206      ! We carry the rain with us and calculate that added by warm/cold precipitation 
    200207      ! processes and that subtracted by evaporation at each level. 
    201       DO k = nlayermx, 1, -1 
     208      DO k = nlayer, 1, -1 
    202209 
    203210         IF (evap_prec) THEN ! note no rneb dependence! 
     
    273280 
    274281 !recalculate liquid water particle radii 
    275            call h2o_cloudrad(ngrid,ql,reffh2oliq,reffh2oice) 
     282           call h2o_cloudrad(ngrid,nlayer,ql,reffh2oliq,reffh2oice) 
    276283 
    277284           SELECT CASE(precip_scheme) 
     
    357364         endif ! if precip_scheme=1 
    358365 
    359       ENDDO ! of DO k = nlayermx, 1, -1 
     366      ENDDO ! of DO k = nlayer, 1, -1 
    360367 
    361368!     Rain or snow on the ground 
     
    376383!     now subroutine -----> GCM variables 
    377384      if (evap_prec) then 
    378         dqrain(1:ngrid,1:nlayermx,i_vap)=d_q(1:ngrid,1:nlayermx)/ptimestep 
    379         d_t(1:ngrid,1:nlayermx)=d_t(1:ngrid,1:nlayermx)/ptimestep 
     385        dqrain(1:ngrid,1:nlayer,i_vap)=d_q(1:ngrid,1:nlayer)/ptimestep 
     386        d_t(1:ngrid,1:nlayer)=d_t(1:ngrid,1:nlayer)/ptimestep 
    380387      else 
    381         dqrain(1:ngrid,1:nlayermx,i_vap)=0.0 
    382         d_t(1:ngrid,1:nlayermx)=0.0 
     388        dqrain(1:ngrid,1:nlayer,i_vap)=0.0 
     389        d_t(1:ngrid,1:nlayer)=0.0 
    383390      endif 
    384       dqrain(1:ngrid,1:nlayermx,i_ice) = d_ql(1:ngrid,1:nlayermx)/ptimestep 
     391      dqrain(1:ngrid,1:nlayer,i_ice) = d_ql(1:ngrid,1:nlayer)/ptimestep 
    385392 
    386393    end subroutine rain 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/setspi.F90

    r222 r227  
    9292      endif 
    9393     
     94!$OMP MASTER     
    9495      nb=0 
    9596      ierr=0 
     
    121122      BWNI(L_NSPECTI)  =lastband(1) 
    122123      BWNI(L_NSPECTI+1)=lastband(2) 
     124!$OMP END MASTER 
     125!$OMP BARRIER 
    123126 
    124127      print*,'' 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/setspv.F90

    r222 r227  
    6969         call abort 
    7070      endif 
    71      
     71         
     72!$OMP MASTER         
    7273      nb=0 
    7374      ierr=0 
     
    9899      BWNV(L_NSPECTV)  =lastband(1) 
    99100      BWNV(L_NSPECTV+1)=lastband(2) 
    100  
     101!$OMP END MASTER 
     102!$OMP BARRIER 
    101103 
    102104      print*,'setspv: VI band limits:' 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/soil.F

    r222 r227  
    1717!----------------------------------------------------------------------- 
    1818 
    19       include "dimensions.h" 
    20       include "dimphys.h" 
     19!      include "dimensions.h" 
     20!      include "dimphys.h" 
    2121 
    2222 
     
    4545      real,dimension(:,:),save,allocatable :: beta ! beta_k coefficients 
    4646      real,save :: mu 
     47!$OMP THREADPRIVATE(mthermdiff,thermdiff,coefq,coefd,alph,beta,mu) 
    4748             
    4849! local variables: 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/start2archive.F

    r222 r227  
    2727! to use  'getin' 
    2828      USE ioipsl_getincom 
     29      USE planete_mod 
    2930 
    3031      implicit none 
    3132 
    3233#include "dimensions.h" 
     34      integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm)  
    3335#include "paramet.h" 
    3436#include "comconst.h" 
     
    4143#include "ener.h" 
    4244 
    43 #include "dimphys.h" 
    44 #include "planete.h" 
     45!#include "dimphys.h" 
     46!#include "planete.h" 
    4547!#include"advtrac.h" 
    4648#include "netcdf.inc" 
     
    6971      REAL tsoil(ngridmx,nsoilmx) ! Soil temperature 
    7072      REAL co2ice(ngridmx)      ! CO2 ice layer 
    71       REAL q2(ngridmx,nlayermx+1) 
     73      REAL q2(ngridmx,llm+1) 
    7274      REAL,ALLOCATABLE :: qsurf(:,:) 
    7375      REAL emis(ngridmx) 
     
    8082!     added by FF for cloud fraction setup 
    8183      REAL hice(ngridmx) 
    82       REAL cloudfrac(ngridmx,nlayermx),totalcloudfrac(ngridmx) 
     84      REAL cloudfrac(ngridmx,llm),totalcloudfrac(ngridmx) 
    8385 
    8486!     added by BC for slab ocean 
     
    199201 
    200202 
    201       CALL phyetat0 (ngridmx,fichnom,0,Lmodif,nsoilmx,nqtot,day_ini_fi, 
    202      .      timefi, 
     203      CALL phyetat0 (ngridmx,llm,fichnom,0,Lmodif,nsoilmx,nqtot, 
     204     .      day_ini_fi,timefi, 
    203205     .      tsurf,tsoil,emis,q2,qsurf, 
    204206!       change FF 05/2011 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/stellarlong.F

    r222 r227  
    11      SUBROUTINE stellarlong(pday,pstellong) 
     2       
     3      USE planete_mod, ONLY: year_day, peri_day, e_elips, timeperi 
    24      IMPLICIT NONE 
    35 
     
    4042c   ------------- 
    4143 
    42 #include "planete.h" 
     44!#include "planete.h" 
    4345#include "comcstfi.h" 
    4446 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/stokes.F90

    r222 r227  
    3333      real a,b,molrad,visc 
    3434      save a,b 
     35!$OMP THREADPRIVATE(a,b) 
    3536   
    3637      LOGICAL firstcall 
    3738      SAVE firstcall 
    3839      DATA firstcall/.true./ 
     40!$OMP THREADPRIVATE(firstcall) 
    3941 
    4042      if (firstcall) then 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/su_gases.F90

    r222 r227  
    2020  !================================================================== 
    2121 
     22!$OMP MASTER 
    2223  ! load gas names from file 'gases.def' 
    2324  open(90,file='gases.def',status='old',form='formatted',iostat=ierr) 
     
    122123  endif 
    123124  close(90) 
     125!$OMP END MASTER 
     126!$OMP BARRIER 
    124127 
    125128end subroutine su_gases 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/suaer_corrk.F90

    r222 r227  
    4646#include "callkeys.h" 
    4747!     Optical properties (read in external ASCII files) 
    48       INTEGER          :: nwvl  ! Number of wavelengths in 
    49                                 ! the domain (VIS or IR) 
     48      INTEGER,SAVE      :: nwvl  ! Number of wavelengths in 
     49                                ! the domain (VIS or IR), read by master 
    5050 
    5151!      REAL             :: solsir ! visible to infrared ratio 
     
    5353 
    5454      REAL, DIMENSION(:),& 
    55       ALLOCATABLE, SAVE :: wvl  ! Wavelength axis 
     55      ALLOCATABLE, SAVE :: wvl  ! Wavelength axis, read by master 
    5656      REAL, DIMENSION(:),& 
    57       ALLOCATABLE, SAVE :: radiusdyn ! Particle size axis 
     57      ALLOCATABLE, SAVE :: radiusdyn ! Particle size axis, read by master 
    5858 
    5959      REAL, DIMENSION(:,:),& 
    60       ALLOCATABLE, SAVE :: ep,& ! Extinction coefficient Qext 
    61       omeg,&                    ! Single Scattering Albedo 
    62       gfactor                   ! Assymetry Factor 
     60      ALLOCATABLE, SAVE :: ep,& ! Extinction coefficient Qext, read by master 
     61      omeg,&                    ! Single Scattering Albedo, read by master 
     62      gfactor                   ! Assymetry Factor, read by master 
    6363 
    6464!     Local variables: 
     
    9898 
    9999      CHARACTER(LEN=30), DIMENSION(naerkind,2), SAVE :: file_id 
     100!$OMP THREADPRIVATE(file_id) 
    100101!---- Please indicate the names of the optical property files below 
    101102!     Please also choose the reference wavelengths of each aerosol 
     
    203204!     1.1 Open the ASCII file 
    204205 
     206!$OMP MASTER 
    205207            INQUIRE(FILE=TRIM(datadir)//& 
    206208         '/'//TRIM(file_id(iaer,idomain)),& 
     
    339341      endif 
    340342 
     343!$OMP END MASTER 
     344!$OMP BARRIER 
    341345 
    342346 
     
    432436!======================================================================== 
    433437 
    434       DEALLOCATE(wvl)           ! wvl 
    435       DEALLOCATE(radiusdyn)     ! radiusdyn 
    436       DEALLOCATE(ep)            ! ep  
    437       DEALLOCATE(omeg)          ! omeg  
    438       DEALLOCATE(gfactor)       ! g 
     438!$OMP BARRIER 
     439!$OMP MASTER 
     440      IF (ALLOCATED(wvl)) DEALLOCATE(wvl)                 ! wvl 
     441      IF (ALLOCATED(radiusdyn)) DEALLOCATE(radiusdyn)     ! radiusdyn 
     442      IF (ALLOCATED(ep)) DEALLOCATE(ep)                   ! ep  
     443      IF (ALLOCATED(omeg)) DEALLOCATE(omeg)               ! omeg  
     444      IF (ALLOCATED(gfactor)) DEALLOCATE(gfactor)         ! g 
     445!$OMP END MASTER 
     446!$OMP BARRIER 
    439447 
    440448      END DO                    ! Loop on iaer 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/sugas_corrk.F90

    r222 r227  
    2828 
    2929      use gases_h 
    30       use ioipsl_getincom  
     30!      use ioipsl_getincom 
     31      use ioipsl_getincom_p  
    3132      implicit none 
    3233 
     
    4546 
    4647      ! ALLOCATABLE ARRAYS -- AS 12/2011 
    47       REAL*8, DIMENSION(:,:,:,:,:), ALLOCATABLE :: gasi8, gasv8 
    48       character*20,allocatable,DIMENSION(:) :: gastype ! for check with gnom 
     48      REAL*8, DIMENSION(:,:,:,:,:), ALLOCATABLE,SAVE :: gasi8, gasv8    !read by master 
     49      character*20,allocatable,DIMENSION(:),SAVE :: gastype ! for check with gnom, read by master 
    4950 
    5051      real*8 x, xi(4), yi(4), ans, p 
     
    7677      endif 
    7778 
     79!$OMP MASTER 
    7880      ! check that database matches varactive toggle 
    7981      open(111,file=TRIM(file_path),form='formatted') 
     
    261263      tgasmin = tgasref(1) 
    262264      tgasmax = tgasref(L_NTREF) 
     265!$OMP END MASTER 
     266!$OMP BARRIER 
    263267 
    264268!----------------------------------------------------------------------- 
     
    302306         write(*,*)"graybody: constant absorption coefficient in visible:" 
    303307         kappa_VI=-100000. 
    304          call getin("kappa_VI",kappa_VI) 
     308         call getin_p("kappa_VI",kappa_VI) 
    305309         write(*,*)" kappa_VI = ",kappa_VI 
    306310         kappa_VI=kappa_VI*1.e4* mugaz * 1.672621e-27    ! conversion from m^2/kg to cm^2/molecule          
     
    309313         write(*,*)"graybody: constant absorption coefficient in InfraRed:" 
    310314         kappa_IR=-100000. 
    311          call getin("kappa_IR",kappa_IR) 
     315         call getin_p("kappa_IR",kappa_IR) 
    312316         write(*,*)" kappa_IR = ",kappa_IR        
    313317         kappa_IR=kappa_IR*1.e4* mugaz * 1.672621e-27    ! conversion from m^2/kg to cm^2/molecule  
     
    320324      End if 
    321325 
     326!$OMP MASTER          
    322327!      print*,corrkdir(1:4) 
    323328      ! VISIBLE 
     
    361366         gasv8(1:L_NTREF,1:L_NPREF,1:L_REFVAR,1:L_NSPECTV,1:L_NGAUSS)=0.0 
    362367      endif 
     368!$OMP END MASTER 
     369!$OMP BARRIER 
    363370 
    364371      ! INFRA-RED 
    365372      if ((corrkdir(1:4).eq.'null'))then       !.or.(TRIM(corrkdir).eq.'null_LowTeffStar')) then 
    366373         print*,'Infrared corrk gaseous absorption is set to zero if graybody=F' 
     374!$OMP MASTER          
    367375         gasi8(1:L_NTREF,1:L_NPREF,1:L_REFVAR,1:L_NSPECTI,1:L_NGAUSS)=0.0 
    368       else   
     376!$OMP END MASTER 
     377!$OMP BARRIER 
     378      else  
    369379         file_id='/corrk_data/'//trim(adjustl(banddir))//'/corrk_gcm_IR.dat'  
    370380         file_path=TRIM(datadir)//TRIM(file_id) 
     
    379389         endif 
    380390          
     391!$OMP MASTER                     
    381392         open(111,file=TRIM(file_path),form='formatted') 
    382393         read(111,*) gasi8 
    383394         close(111) 
     395!$OMP END MASTER 
     396!$OMP BARRIER 
    384397      
    385398         ! 'fzero' is a currently unused feature that allows optimisation 
     
    423436      endif 
    424437 
     438!$OMP MASTER                  
    425439      if(nIR_limit.eq.0) then 
    426440         gasi8(1:L_NTREF,1:L_NPREF,1:L_REFVAR,1:L_NSPECTI,1:L_NGAUSS)=   & 
     
    465479         end do 
    466480      end do 
     481!$OMP END MASTER 
     482!$OMP BARRIER 
    467483 
    468484!     Interpolate the values:  first the longwave 
     
    653669 
    654670!     Deallocate local arrays 
     671!$OMP BARRIER 
     672!$OMP MASTER 
    655673      IF( ALLOCATED( gasi8 ) ) DEALLOCATE( gasi8 ) 
    656674      IF( ALLOCATED( gasv8 ) ) DEALLOCATE( gasv8 ) 
    657675      IF( ALLOCATED( pgasref ) ) DEALLOCATE( pgasref ) 
    658676      IF( ALLOCATED( gastype ) ) DEALLOCATE( gastype ) 
     677!$OMP END MASTER 
     678!$OMP BARRIER 
    659679 
    660680      return 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/surf_heat_transp_mod.F90

    r222 r227  
    77CONTAINS 
    88 
    9       SUBROUTINE divgrad_phy(nlevs,temp,delta) 
     9      SUBROUTINE divgrad_phy(ngrid,nlevs,temp,delta) 
    1010 
    1111 
     
    1414 
    1515#include "dimensions.h" 
    16 #include "dimphys.h" 
     16!#include "dimphys.h" 
    1717#include "paramet.h" 
    1818#include "comcstfi.h" 
     
    2020#include "comhdiff.h" 
    2121       
    22       INTEGER nlevs, ll 
    23       REAL temp(ngridmx,nlevs) 
     22      INTEGER,INTENT(IN) :: ngrid, nlevs 
     23      REAL,INTENT(IN) :: temp(ngrid,nlevs) 
     24      REAL,INTENT(OUT) :: delta(ngrid,nlevs) 
    2425      REAL delta_2d(ip1jmp1,nlevs) 
    25       REAL delta(ngridmx,nlevs) 
     26      INTEGER :: ll 
    2627      REAL ghx(ip1jmp1,nlevs), ghy(ip1jm,nlevs) 
    2728 
    2829 
    29       CALL gr_fi_dyn(nlevs,ngridmx,iip1,jjp1,temp,delta_2d) 
     30      CALL gr_fi_dyn(nlevs,ngrid,iip1,jjp1,temp,delta_2d) 
    3031      CALL grad(nlevs,delta_2d,ghx,ghy) 
    3132      DO ll=1,nlevs 
     
    3637      END DO 
    3738      CALL diverg(nlevs,ghx,ghy,delta_2d) 
    38       CALL gr_dyn_fi(nlevs,iip1,jjp1,ngridmx,delta_2d,delta) 
     39      CALL gr_dyn_fi(nlevs,iip1,jjp1,ngrid,delta_2d,delta) 
    3940 
    4041 
     
    4344 
    4445 
    45       SUBROUTINE init_masquv(zmasq) 
     46      SUBROUTINE init_masquv(ngrid,zmasq) 
    4647      
    4748      IMPLICIT NONE 
    4849 
    4950#include "dimensions.h" 
    50 #include "dimphys.h" 
     51!#include "dimphys.h" 
    5152#include "paramet.h" 
    5253#include "comcstfi.h"    
     
    5556 
    5657 
    57       REAL zmasq(ngridmx) 
     58      INTEGER,INTENT(IN) :: ngrid 
     59      REAL zmasq(ngrid) 
    5860      REAL zmasq_2d(ip1jmp1) 
    5961      REAL ff(ip1jm) 
     
    6668      zmasqv=1. 
    6769 
    68       CALL gr_fi_dyn(1,ngridmx,iip1,jjp1,zmasq,zmasq_2d) 
     70      CALL gr_fi_dyn(1,ngrid,iip1,jjp1,zmasq,zmasq_2d) 
    6971 
    7072      DO i=1,ip1jmp1-1 
     
    104106 
    105107 
    106       SUBROUTINE slab_ekman2(tx_phy,ty_phy,ts_phy,dt_phy) 
     108      SUBROUTINE slab_ekman2(ngrid,tx_phy,ty_phy,ts_phy,dt_phy) 
    107109   
    108110          use slab_ice_h  
     
    111113       
    112114#include "dimensions.h" 
    113 #include "dimphys.h" 
     115!#include "dimphys.h" 
    114116#include "paramet.h" 
    115117#include "comcstfi.h" 
     
    118120#include "comhdiff.h" 
    119121 
     122      INTEGER,INTENT(IN) :: ngrid 
    120123      INTEGER ij 
    121124      REAL txv(ip1jm),fluxm(ip1jm),tyv(ip1jm) 
     
    123126      REAL tyu(ip1jmp1),txu(ip1jmp1),fluxz(ip1jmp1),fluxv(ip1jmp1) 
    124127      REAL dt(ip1jmp1,noceanmx),ts(ip1jmp1,noceanmx) 
    125       REAL tx_phy(ngridmx),ty_phy(ngridmx) 
    126       REAL dt_phy(ngridmx,noceanmx),ts_phy(ngridmx,noceanmx) 
     128      REAL tx_phy(ngrid),ty_phy(ngrid) 
     129      REAL dt_phy(ngrid,noceanmx),ts_phy(ngrid,noceanmx) 
    127130 
    128131 
     
    130133 
    131134! Passage taux,y sur grilles 2d 
    132       CALL gr_fi_dyn(1,ngridmx,iip1,jjp1,tx_phy,txu) 
    133       CALL gr_fi_dyn(1,ngridmx,iip1,jjp1,ty_phy,tyu) 
     135      CALL gr_fi_dyn(1,ngrid,iip1,jjp1,tx_phy,txu) 
     136      CALL gr_fi_dyn(1,ngrid,iip1,jjp1,ty_phy,tyu) 
    134137! Passage grille u,v 
    135138! Multiplication par f ou eps. 
     
    144147             
    145148! Calcul de T, Tdeep 
    146       CALL gr_fi_dyn(2,ngridmx,iip1,jjp1,ts_phy,ts) 
     149      CALL gr_fi_dyn(2,ngrid,iip1,jjp1,ts_phy,ts) 
    147150        
    148151! Flux de masse 
     
    222225 
    223226! Retour grille physique 
    224       CALL gr_dyn_fi(2,iip1,jjp1,ngridmx,dt,dt_phy) 
     227      CALL gr_dyn_fi(2,iip1,jjp1,ngrid,dt,dt_phy) 
    225228 
    226229 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/surface_nature.F

    r222 r227  
    3333!================================================================== 
    3434 
    35 #include "dimensions.h" 
    36 #include "dimphys.h" 
     35!#include "dimensions.h" 
     36!#include "dimphys.h" 
    3737#include "comcstfi.h" 
    3838#include "callkeys.h" 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/surfdat_h.F90

    r222 r227  
    55 
    66       real,allocatable,dimension(:) :: albedodat ! albedo of bare ground 
     7!$OMP THREADPRIVATE(albedodat) 
    78       ! Ehouarn: moved inertiedat to comsoil.h 
    89       !      real inertiedat, ! thermal inertia 
    910       real,allocatable,dimension(:) :: phisfi ! geopotential at ground level 
     11!$OMP THREADPRIVATE(phisfi) 
    1012       real,dimension(2) :: albedice 
    1113       real,dimension(2) :: emisice ! ice emissivity; 1:Northern hemisphere 2:Southern hemisphere 
    1214       real emissiv 
    1315       real,dimension(2) :: iceradius, dtemisice 
     16!$OMP THREADPRIVATE(albedice,emisice,emissiv,iceradius,dtemisice) 
    1417       real,allocatable,dimension(:) :: zmea,zstd,zsig,zgam,zthe 
     18!$OMP THREADPRIVATE(zmea,zstd,zsig,zgam,zthe) 
    1519 
    1620       real,allocatable,dimension(:) :: dryness  !"Dryness coefficient" for grnd water ice sublimation 
     
    1822 
    1923       logical,allocatable,dimension(:) :: watercaptag !! was in watercap.h 
     24!$OMP THREADPRIVATE(dryness,watercaptag) 
    2025 
    2126       end module surfdat_h 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/surfini.F

    r222 r227  
    1515c   Declarations: 
    1616c   ------------- 
    17 #include "dimensions.h" 
    18 #include "dimphys.h" 
     17!#include "dimensions.h" 
     18!#include "dimphys.h" 
    1919#include "callkeys.h" 
    2020c 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/tabfi.F

    r222 r227  
    3434c                              comparer avec le day_ini dynamique) 
    3535c 
    36 c      - lmax:    tab_cntrl(tab0+2) (pour test avec nlayermx) 
     36c      - lmax:    tab_cntrl(tab0+2) (pour test avec nlayer) 
    3737c 
    3838c      - p_rad 
     
    5151      use iostart, only: get_var 
    5252      use mod_phys_lmdz_para, only: is_parallel 
     53      use planete_mod, only: year_day, periastr, apoastr, peri_day, 
     54     &                       obliquit, z0, lmixmin, emin_turb 
    5355 
    5456      implicit none 
    5557  
    5658#include "comcstfi.h" 
    57 #include "planete.h" 
     59!#include "planete.h" 
    5860#include "netcdf.inc" 
    5961#include "callkeys.h" 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/totalcloudfrac.F90

    r222 r227  
    1       subroutine totalcloudfrac(ngrid,nq,rneb,totalrneb,pplev,pq,tau) 
     1      subroutine totalcloudfrac(ngrid,nlayer,nq,rneb,totalrneb,pplev,pq,tau) 
    22 
    33      use watercommon_h 
     
    1919!================================================================== 
    2020 
    21 #include "dimensions.h" 
    22 #include "dimphys.h" 
     21!#include "dimensions.h" 
     22!#include "dimphys.h" 
    2323#include "comcstfi.h" 
    2424#include "callkeys.h" 
    2525 
    2626      integer,intent(in) :: ngrid        ! number of atmospheric columns 
     27      integer,intent(in) :: nlayer       ! number of atmospheric layers 
    2728      integer,intent(in) :: nq           ! number of tracers 
    28       real,intent(in) :: rneb(ngrid,nlayermx)    ! cloud fraction      
     29      real,intent(in) :: rneb(ngrid,nlayer)    ! cloud fraction      
    2930      real,intent(out) :: totalrneb(ngrid)       ! total cloud fraction  
    30       real,intent(in) :: pplev(ngrid,nlayermx+1) ! inter-layer pressure (Pa) 
    31       real,intent(in) :: pq(ngrid,nlayermx,nq)   ! tracers (.../kg_of_air) 
    32       real,intent(in) :: tau(ngrid,nlayermx) 
     31      real,intent(in) :: pplev(ngrid,nlayer+1) ! inter-layer pressure (Pa) 
     32      real,intent(in) :: pq(ngrid,nlayer,nq)   ! tracers (.../kg_of_air) 
     33      real,intent(in) :: tau(ngrid,nlayer) 
    3334 
    34       real, dimension(nlayermx+1) :: masse 
     35      real, dimension(nlayer+1) :: masse 
    3536      integer, parameter          :: recovery=7 
    3637      integer ltau_max 
     
    4748      real clear,tau_min 
    4849      real, parameter ::  tau_c=0.1 !threshold of optical depth for the calculation of total cloud fraction  
    49       real rneb2(nlayermx) 
     50      real rneb2(nlayer) 
    5051 
    5152 
     
    5556         if (recovery.eq.1) then 
    5657            clear = (1.-rneb(ig,1)) 
    57             do l=2,nlayermx        
     58            do l=2,nlayer       
    5859               clear = clear*(1.-rneb(ig,l)) 
    5960            enddo 
     
    6263         elseif (recovery.eq.2) then 
    6364            totalrneb(ig) = rneb(ig,1) 
    64             do l=2,14 !nlayermx        
     65            do l=2,14 !nlayer     
    6566               totalrneb(ig) = max(rneb(ig,l),totalrneb(ig)) 
    6667            enddo 
     
    6869         elseif (recovery.eq.3) then 
    6970            totalrneb(ig) = rneb(ig,1) 
    70             do l=2,nlayermx        
     71            do l=2,nlayer     
    7172               totalrneb(ig) = min(rneb(ig,l),totalrneb(ig)) 
    7273            enddo 
     
    7778         elseif (recovery.eq.5) then 
    7879            totalrneb(ig) = rneb(ig,1)             
    79             do l=1,nlayermx 
     80            do l=1,nlayer 
    8081               masse(l)=pq(ig,l,igcm_h2o_ice)*(pplev(ig,l)-pplev(ig,l+1)) 
    8182            enddo 
     
    8586         elseif (recovery.eq.6) then 
    8687            totalrneb(ig) = 0.             
    87             do l=1,nlayermx 
     88            do l=1,nlayer 
    8889               masse(l)=pq(ig,l,igcm_h2o_ice)*(pplev(ig,l)-pplev(ig,l+1)) 
    8990               masse(l)=max(masse(l),0.) 
    9091            enddo 
    9192            massetot=sum(masse,dim=1) 
    92             do l=1,nlayermx 
     93            do l=1,nlayer 
    9394               totalrneb(ig) = totalrneb(ig)+rneb(ig,l)*masse(l)/massetot 
    9495            enddo 
     
    9697         elseif (recovery.eq.7) then 
    9798 
    98             rneb2(:)=rneb(ig,1:nlayermx) 
    99             tau_min=MIN(tau_c,MAXVAL(tau(ig,1:nlayermx))/2.) 
    100             do l=1,nlayermx 
     99            rneb2(:)=rneb(ig,1:nlayer) 
     100            tau_min=MIN(tau_c,MAXVAL(tau(ig,1:nlayer))/2.) 
     101            do l=1,nlayer 
    101102               if(tau(ig,l)<tau_min) rneb2(l)=0.         
    102103            enddo 
    103             totalrneb(ig)=maxval(rneb2(1:nlayermx)) 
     104            totalrneb(ig)=maxval(rneb2(1:nlayer)) 
    104105 
    105106         endif                  ! (recovery=)    
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/tracer_h.F90

    r222 r227  
    1919      real rho_co2     ! CO2 ice density (kg.m-3) 
    2020      real ref_r0        ! for computing reff=ref_r0*r0 (in log.n. distribution) 
     21!$OMP THREADPRIVATE(noms,mmol,radius,rho_q,qext,alpha_lift,alpha_devil,qextrhor, & 
     22        !$OMP varian,r3n_q,rho_dust,rho_ice,rho_co2,ref_r0) 
    2123 
    2224! tracer indexes: these are initialized in initracer and should be 0 if the 
     
    4749      integer :: igcm_ar_n2 ! for simulations using co2 +neutral gaz 
    4850      integer :: igcm_co2_ice ! CO2 ice  
     51!$OMP THREADPRIVATE(igcm_dustbin,igcm_dust_mass,igcm_dust_number,igcm_h2o_vap,igcm_h2o_ice, & 
     52        !$OMP igcm_co2,igcm_co,igcm_o,igcm_o1d,igcm_o2,igcm_o3,igcm_h,igcm_h2,igcm_oh,      & 
     53        !$OMP igcm_ho2,igcm_h2o2,igcm_n2,igcm_ar,igcm_ar_n2,igcm_co2_ice) 
    4954 
    5055       end module tracer_h 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/turbdiff.F90

    r222 r227  
    4141!     ------------ 
    4242 
    43       include "dimensions.h" 
    44       include "dimphys.h" 
     43!      include "dimensions.h" 
     44!      include "dimphys.h" 
    4545      include "comcstfi.h" 
    4646      include "callkeys.h" 
     
    4848!     arguments 
    4949!     --------- 
    50       INTEGER,INTENT(IN) :: ngrid,nlay 
     50      INTEGER,INTENT(IN) :: ngrid 
     51      INTEGER,INTENT(IN) :: nlay 
    5152      REAL,INTENT(IN) :: ptimestep 
    5253      REAL,INTENT(IN) :: pplay(ngrid,nlay),pplev(ngrid,nlay+1) 
     
    8687 
    8788      REAL z4st,zdplanck(ngrid) 
    88       REAL zkv(ngrid,nlayermx+1),zkh(ngrid,nlayermx+1) 
     89      REAL zkv(ngrid,nlay+1),zkh(ngrid,nlay+1) 
    8990      REAL zcdv(ngrid),zcdh(ngrid) 
    9091      REAL zcdv_true(ngrid),zcdh_true(ngrid) 
    91       REAL zu(ngrid,nlayermx),zv(ngrid,nlayermx) 
    92       REAL zh(ngrid,nlayermx),zt(ngrid,nlayermx) 
     92      REAL zu(ngrid,nlay),zv(ngrid,nlay) 
     93      REAL zh(ngrid,nlay),zt(ngrid,nlay) 
    9394      REAL ztsrf(ngrid) 
    9495      REAL z1(ngrid),z2(ngrid) 
    95       REAL zmass(ngrid,nlayermx) 
    96       REAL zfluxv(ngrid,nlayermx),zfluxt(ngrid,nlayermx),zfluxq(ngrid,nlayermx) 
    97       REAL zb0(ngrid,nlayermx) 
    98       REAL zExner(ngrid,nlayermx),zovExner(ngrid,nlayermx) 
    99       REAL zcv(ngrid,nlayermx),zdv(ngrid,nlayermx)  !inversion coefficient for winds 
    100       REAL zct(ngrid,nlayermx),zdt(ngrid,nlayermx)  !inversion coefficient for temperature 
    101       REAL zcq(ngrid,nlayermx),zdq(ngrid,nlayermx)  !inversion coefficient for tracers 
     96      REAL zmass(ngrid,nlay) 
     97      REAL zfluxv(ngrid,nlay),zfluxt(ngrid,nlay),zfluxq(ngrid,nlay) 
     98      REAL zb0(ngrid,nlay) 
     99      REAL zExner(ngrid,nlay),zovExner(ngrid,nlay) 
     100      REAL zcv(ngrid,nlay),zdv(ngrid,nlay)  !inversion coefficient for winds 
     101      REAL zct(ngrid,nlay),zdt(ngrid,nlay)  !inversion coefficient for temperature 
     102      REAL zcq(ngrid,nlay),zdq(ngrid,nlay)  !inversion coefficient for tracers 
    102103      REAL zcst1 
    103104      REAL zu2!, a 
     
    106107 
    107108      LOGICAL,SAVE :: firstcall=.true. 
     109!$OMP THREADPRIVATE(firstcall) 
    108110       
    109111!     Tracers 
    110112!     ------- 
    111113      INTEGER iq 
    112       REAL zq(ngrid,nlayermx,nq) 
    113       REAL zqnoevap(ngrid,nlayermx) !special for water case to compute where evaporated water goes. 
    114       REAL pdqevap(ngrid,nlayermx) !special for water case to compute where evaporated water goes. 
     114      REAL zq(ngrid,nlay,nq) 
     115      REAL zqnoevap(ngrid,nlay) !special for water case to compute where evaporated water goes. 
     116      REAL pdqevap(ngrid,nlay) !special for water case to compute where evaporated water goes. 
    115117      REAL zdmassevap(ngrid) 
    116118      REAL rho(ngrid)         ! near-surface air density 
     
    123125 
    124126      integer, save :: ivap, iliq, iliq_surf,iice_surf ! also make liq for clarity on surface... 
     127!$OMP THREADPRIVATE(ivap,iliq,iliq_surf,iice_surf) 
    125128 
    126129      real, parameter :: karman=0.4 
     
    241244!     ------------------------------------------------------  
    242245 
    243       call vdif_kc(ngrid,ptimestep,g,pzlev,pzlay,pu,pv,zh,zcdv_true,pq2,zkv,zkh) !JL12 why not call vdif_kc with updated winds and temperature  
     246      call vdif_kc(ngrid,nlay,ptimestep,g,pzlev,pzlay,pu,pv,zh,zcdv_true,pq2,zkv,zkh) !JL12 why not call vdif_kc with updated winds and temperature  
    244247       
    245248!     Adding eddy mixing to mimic 3D general circulation in 1D 
     
    262265  
    263266!JL12 calculate the flux coefficients (tables multiplied elements by elements) 
    264       zfluxv(1:ngrid,1:nlayermx)=zkv(1:ngrid,1:nlayermx)*zb0(1:ngrid,1:nlayermx) 
     267      zfluxv(1:ngrid,1:nlay)=zkv(1:ngrid,1:nlay)*zb0(1:ngrid,1:nlay) 
    265268       
    266269!----------------------------------------------------------------------- 
     
    364367!     JL12 calculate the flux coefficients (tables multiplied elements by elements) 
    365368!     --------------------------------------------------------------- 
    366       zfluxq(1:ngrid,1:nlayermx)=zkh(1:ngrid,1:nlayermx)*zb0(1:ngrid,1:nlayermx) !JL12 we save zfluxq which doesn't need the Exner factor 
    367       zfluxt(1:ngrid,1:nlayermx)=zfluxq(1:ngrid,1:nlayermx)*zExner(1:ngrid,1:nlayermx) 
     369      zfluxq(1:ngrid,1:nlay)=zkh(1:ngrid,1:nlay)*zb0(1:ngrid,1:nlay) !JL12 we save zfluxq which doesn't need the Exner factor 
     370      zfluxt(1:ngrid,1:nlay)=zfluxq(1:ngrid,1:nlay)*zExner(1:ngrid,1:nlay) 
    368371 
    369372      DO ig=1,ngrid 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/vdif_cd.F

    r222 r227  
    5555      DATA firstcal/.true./ 
    5656      SAVE b,c,d,karman,c2b,c3bc,c3b,firstcal,umin2 
     57!$OMP THREADPRIVATE(b,c,d,karman,c2b,c3bc,c3b,firstcal,umin2) 
    5758 
    5859c----------------------------------------------------------------------- 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/vdif_kc.F

    r222 r227  
    1       SUBROUTINE vdif_kc(ngrid,dt,g,zlev,zlay,u,v,teta,cd,q2,km,kn) 
     1      SUBROUTINE vdif_kc(ngrid,nlay,dt,g,zlev,zlay,u,v,teta,cd,q2,km,kn) 
    22      IMPLICIT NONE 
    33c....................................................................... 
    4 #include "dimensions.h" 
    5 #include "dimphys.h" 
     4!#include "dimensions.h" 
     5!#include "dimphys.h" 
    66c....................................................................... 
    77c 
     
    2828c....................................................................... 
    2929      INTEGER,INTENT(IN) :: ngrid 
     30      INTEGER,INTENT(IN) :: nlay 
    3031      REAL,INTENT(IN) :: dt,g 
    31       REAL,INTENT(IN) :: zlev(ngrid,nlayermx+1) 
    32       REAL,INTENT(IN) :: zlay(ngrid,nlayermx) 
    33       REAL,INTENT(IN) :: u(ngrid,nlayermx) 
    34       REAL,INTENT(IN) :: v(ngrid,nlayermx) 
    35       REAL,INTENT(IN) :: teta(ngrid,nlayermx) 
     32      REAL,INTENT(IN) :: zlev(ngrid,nlay+1) 
     33      REAL,INTENT(IN) :: zlay(ngrid,nlay) 
     34      REAL,INTENT(IN) :: u(ngrid,nlay) 
     35      REAL,INTENT(IN) :: v(ngrid,nlay) 
     36      REAL,INTENT(IN) :: teta(ngrid,nlay) 
    3637      REAL,INTENT(IN) :: cd(ngrid) 
    37       REAL,INTENT(INOUT) :: q2(ngrid,nlayermx+1) 
    38       REAL,INTENT(OUT) :: km(ngrid,nlayermx+1) 
    39       REAL,INTENT(OUT) :: kn(ngrid,nlayermx+1) 
     38      REAL,INTENT(INOUT) :: q2(ngrid,nlay+1) 
     39      REAL,INTENT(OUT) :: km(ngrid,nlay+1) 
     40      REAL,INTENT(OUT) :: kn(ngrid,nlay+1) 
    4041c....................................................................... 
    4142c 
     
    5051c 
    5152c....................................................................... 
    52       INTEGER,PARAMETER :: nlay=nlayermx 
    53       INTEGER,PARAMETER :: nlev=nlayermx+1 
    54       REAL unsdz(ngrid,nlayermx) 
    55       REAL unsdzdec(ngrid,nlayermx+1) 
    56       REAL q(ngrid,nlayermx+1) 
     53      INTEGER :: nlev 
     54      REAL unsdz(ngrid,nlay) 
     55      REAL unsdzdec(ngrid,nlay+1) 
     56      REAL q(ngrid,nlay+1) 
    5757c....................................................................... 
    5858c 
     
    6464c 
    6565c....................................................................... 
    66       REAL kmpre(ngrid,nlayermx+1) 
     66      REAL kmpre(ngrid,nlay+1) 
    6767      REAL qcstat 
    6868      REAL q2cstat 
     
    7272c 
    7373c....................................................................... 
    74       REAL long(ngrid,nlayermx+1) 
     74      REAL long(ngrid,nlay+1) 
    7575c....................................................................... 
    7676c 
     
    9595      REAL mcstat 
    9696      REAL m2cstat 
    97       REAL m(ngrid,nlayermx+1) 
    98       REAL mpre(ngrid,nlayermx+1) 
    99       REAL m2(ngrid,nlayermx+1) 
    100       REAL n2(ngrid,nlayermx+1) 
     97      REAL m(ngrid,nlay+1) 
     98      REAL mpre(ngrid,nlay+1) 
     99      REAL m2(ngrid,nlay+1) 
     100      REAL n2(ngrid,nlay+1) 
    101101c....................................................................... 
    102102c 
     
    120120      LOGICAL gnsup 
    121121      REAL gm 
    122 c      REAL ri(ngrid,nlayermx+1) 
    123       REAL sn(ngrid,nlayermx+1) 
    124       REAL snq2(ngrid,nlayermx+1) 
    125       REAL sm(ngrid,nlayermx+1) 
    126       REAL smq2(ngrid,nlayermx+1) 
     122c      REAL ri(ngrid,nlaye+1) 
     123      REAL sn(ngrid,nlay+1) 
     124      REAL snq2(ngrid,nlay+1) 
     125      REAL sm(ngrid,nlay+1) 
     126      REAL smq2(ngrid,nlay+1) 
    127127c....................................................................... 
    128128c 
     
    179179 
    180180! initialization of local variables: 
     181      nlev=nlay+1 
    181182      long(:,:)=0. 
    182183      n2(:,:)=0. 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/vdifc.F

    r222 r227  
    3838!     ------------ 
    3939 
    40 #include "dimensions.h" 
    41 #include "dimphys.h" 
     40!#include "dimensions.h" 
     41!#include "dimphys.h" 
    4242#include "comcstfi.h" 
    4343#include "callkeys.h" 
     
    7777 
    7878      REAL z4st,zdplanck(ngrid) 
    79       REAL zkv(ngrid,nlayermx+1),zkh(ngrid,nlayermx+1) 
     79      REAL zkv(ngrid,nlay+1),zkh(ngrid,nlay+1) 
    8080      REAL zcdv(ngrid),zcdh(ngrid) 
    8181      REAL zcdv_true(ngrid),zcdh_true(ngrid) 
    82       REAL zu(ngrid,nlayermx),zv(ngrid,nlayermx) 
    83       REAL zh(ngrid,nlayermx) 
     82      REAL zu(ngrid,nlay),zv(ngrid,nlay) 
     83      REAL zh(ngrid,nlay) 
    8484      REAL ztsrf2(ngrid) 
    8585      REAL z1(ngrid),z2(ngrid) 
    86       REAL za(ngrid,nlayermx),zb(ngrid,nlayermx) 
    87       REAL zb0(ngrid,nlayermx) 
    88       REAL zc(ngrid,nlayermx),zd(ngrid,nlayermx) 
     86      REAL za(ngrid,nlay),zb(ngrid,nlay) 
     87      REAL zb0(ngrid,nlay) 
     88      REAL zc(ngrid,nlay),zd(ngrid,nlay) 
    8989      REAL zcst1 
    9090      REAL zu2!, a 
    91       REAL zcq(ngrid,nlayermx),zdq(ngrid,nlayermx) 
     91      REAL zcq(ngrid,nlay),zdq(ngrid,nlay) 
    9292      REAL evap(ngrid) 
    9393      REAL zcq0(ngrid),zdq0(ngrid) 
     
    9696      LOGICAL firstcall 
    9797      SAVE firstcall 
     98!$OMP THREADPRIVATE(firstcall) 
    9899       
    99100      LOGICAL lastcall 
     
    101102!     variables added for CO2 condensation 
    102103!     ------------------------------------ 
    103       REAL hh                   !, zhcond(ngrid,nlayermx) 
     104      REAL hh                   !, zhcond(ngrid,nlay) 
    104105!     REAL latcond,tcond1mb 
    105106!     REAL acond,bcond 
    106107!     SAVE acond,bcond 
     108!!$OMP THREADPRIVATE(acond,bcond) 
    107109!     DATA latcond,tcond1mb/5.9e5,136.27/ 
    108110 
     
    110112!     ------- 
    111113      INTEGER iq 
    112       REAL zq(ngrid,nlayermx,nq) 
     114      REAL zq(ngrid,nlay,nq) 
    113115      REAL zq1temp(ngrid) 
    114116      REAL rho(ngrid)         ! near-surface air density 
     
    123125      real z1_T(ngrid), z2_T(ngrid) 
    124126      real zb_T(ngrid) 
    125       real zc_T(ngrid,nlayermx) 
    126       real zd_T(ngrid,nlayermx) 
     127      real zc_T(ngrid,nlay) 
     128      real zd_T(ngrid,nlay) 
    127129      real lat1(ngrid), lat2(ngrid) 
    128130      real surfh2otot 
     
    132134      integer ivap, iice ! also make liq for clarity on surface... 
    133135      save ivap, iice 
     136!$OMP THREADPRIVATE(ivap,iice) 
    134137 
    135138      real, parameter :: karman=0.4 
     
    249252!     ------------------------------------------------------  
    250253 
    251       call vdif_kc(ngrid,ptimestep,g,pzlev,pzlay 
     254      call vdif_kc(ngrid,nlay,ptimestep,g,pzlev,pzlay 
    252255     &     ,pu,pv,ph,zcdv_true 
    253256     &     ,pq2,zkv,zkh) 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/vlz_fi.F

    r222 r227  
    1       SUBROUTINE vlz_fi(ngrid,q,pente_max,masse,w,wq) 
     1      SUBROUTINE vlz_fi(ngrid,nlayer,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, nlayer 
     26      real,intent(in) :: masse(ngrid,nlayer),pente_max 
     27      REAL,INTENT(INOUT) :: q(ngrid,nlayer) 
     28      REAL,INTENT(INOUT) :: w(ngrid,nlayer) 
     29      REAL,INTENT(OUT) :: wq(ngrid,nlayer+1) 
    3030c 
    3131c      Local  
     
    3535c 
    3636 
    37       real dzq(ngrid,llm),dzqw(ngrid,llm),adzqw(ngrid,llm),dzqmax 
     37      real dzq(ngrid,nlayer),dzqw(ngrid,nlayer),adzqw(ngrid,nlayer) 
     38      real dzqmax 
    3839      real newmasse 
    3940      real sigw, Mtot, MQtot 
     
    4748c    sens de W 
    4849 
    49       do l=2,llm 
     50      do l=2,nlayer 
    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,nlayer-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,nlayer)=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,nlayer+1)=0. 
    8687       enddo 
    8788 
     
    8990c      =============================== 
    9091 
    91        do l = 1,llm          ! loop different than when w<0 
     92       do l = 1,nlayer          ! 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.nlayer)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.nlayer)goto 88 
    115116            end do 
    116117 88         continue 
    117             if (m.lt.llm) then 
     118            if (m.lt.nlayer) 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,nlayer-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,nlayer 
    179180         do ij=1,ngrid 
    180181 
     
    191192 
    192193 
    193  
    194       return 
    195194      end 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/watercommon_h.F90

    r222 r227  
    1919 
    2020      real, save :: epsi, RCPD, RCPV, RV, RVTMP2 
     21!$OMP THREADPRIVATE(epsi,RCPD,RCPV,RV,RVTMP2) 
    2122       
    2223      contains 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/writediagfi.F

    r222 r227  
    6868 
    6969      real*4,save :: date 
     70!$OMP THREADPRIVATE(date) 
    7071 
    7172      REAL phis(ip1jmp1) 
     
    7879      integer,save :: zitau=0 
    7980      character(len=20),save :: firstnom='1234567890' 
     81!$OMP THREADPRIVATE(zitau,firstnom) 
    8082 
    8183! Ajouts 
    8284      integer, save :: ntime=0 
     85!$OMP THREADPRIVATE(ntime) 
    8386      integer :: idim,varid 
    8487      integer :: nid 
     
    9598      character(len=120),save :: nom_def(n_nom_def_max) 
    9699      logical,save :: firstcall=.true. 
     100!$OMP THREADPRIVATE(firstcall)  !diagfi_def,n_nom_def,nom_def read in diagfi.def 
    97101       
    98102#ifndef MESOSCALE 
     
    128132         firstcall=.false. 
    129133 
     134!$OMP MASTER 
    130135  !      Open diagfi.def definition file if there is one: 
    131136         open(99,file="diagfi.def",status='old',form='formatted', 
     
    151156            diagfi_def=.false. 
    152157         endif 
     158!$OMP END MASTER 
     159!$OMP BARRIER 
    153160      END IF ! of IF (firstcall) 
    154161 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/writediagsoil.F90

    r222 r227  
    4646character(len=20),save :: firstname="1234567890" 
    4747integer,save :: zitau=0 
     48!$OMP THREADPRIVATE(date,isample,ntime,firstname,zitau) 
    4849 
    4950character(len=30) :: filename="diagsoil.nc" 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/writediagspecIR.F

    r222 r227  
    5454! Commons 
    5555#include "dimensions.h" 
    56 #include "dimphys.h" 
     56!#include "dimphys.h" 
    5757#include "paramet.h" 
    5858!#include "control.h" 
     
    9191      data firstnom /'1234567890'/ 
    9292      data zitau /0/ 
     93!$OMP THREADPRIVATE(firstnom,zitau,date) 
    9394 
    9495! Ajouts 
    9596      integer, save :: ntime=0 
     97!$OMP THREADPRIVATE(ntime) 
    9698      integer :: idim,varid 
    9799      integer :: nid 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/writediagspecVI.F

    r222 r227  
    5454! Commons 
    5555#include "dimensions.h" 
    56 #include "dimphys.h" 
     56!#include "dimphys.h" 
    5757#include "paramet.h" 
    5858!#include "control.h" 
     
    9191      data firstnom /'1234567890'/ 
    9292      data zitau /0/ 
     93!$OMP THREADPRIVATE(firstnom,zitau,date) 
    9394 
    9495! Ajouts 
    9596      integer, save :: ntime=0 
     97!$OMP THREADPRIVATE(ntime) 
    9698      integer :: idim,varid 
    9799      integer :: nid 
  • codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/libf/phystd/wstats.F90

    r222 r227  
    77 
    88#include "dimensions.h" 
    9 #include "dimphys.h" 
     9!#include "dimphys.h" 
    1010#include "comconst.h" 
    1111#include "statto.h" 
     
    2222character (len=50) :: namebis 
    2323character (len=50), save :: firstvar 
     24!$OMP THREADPRIVATE(firstvar) 
    2425integer :: ierr,varid,nbdim,nid 
    2526integer :: meanid,sdid 
     
    3031 
    3132integer, save :: step=0 
     33!$OMP THREADPRIVATE(firstcall,indx,step) 
    3234 
    3335! Added to work in parallel mode 
     
    293295 
    294296include "dimensions.h" 
    295 include "dimphys.h" 
     297!include "dimphys.h" 
    296298include "netcdf.inc" 
    297299 
Note: See TracChangeset for help on using the changeset viewer.