Ignore:
Timestamp:
Dec 20, 2012, 5:54:26 PM (12 years ago)
Author:
emillour
Message:

Generic GCM:

  • Fixed sedimentation issue: ensure in callsedim that the correct radii are provided to newsedim and also that the updated temperature and tracer mixing ratios are used to compute sedimentation.
  • Updated the way aerosol radii are considered and used; routines in radii_mod (h2o_reffrad, co2_reffrad, etc.) only handle a single aerosol. The idea here is that these can be called from anywhere and that the caller doesn't need to have the full (naerkind size) array of aerosol radii.
  • cleanup (addition of intent(..) to routine arguments) in various routines

EM

Location:
trunk/LMDZ.GENERIC/libf/phystd
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/libf/phystd/aeropacity.F90

    r804 r858  
    55       use aerosol_mod
    66       USE comgeomfi_h
    7        USE tracer_h
     7       USE tracer_h, only: noms,rho_co2,rho_ice
    88                 
    99       implicit none
     
    4646#include "comvert.h"
    4747
    48       INTEGER ngrid,nlayer,nq
    49 
    50       REAL pplay(ngrid,nlayer)
    51       REAL pplev(ngrid,nlayer+1)
    52       REAL pq(ngrid,nlayer,nq)
    53       REAL aerosol(ngrid,nlayer,naerkind)
    54       REAL reffrad(ngrid,nlayer,naerkind)
    55       REAL QREFvis3d(ngrid,nlayermx,naerkind)
    56       REAL QREFir3d(ngrid,nlayermx,naerkind)
    57 
    58       REAL tau_col(ngrid)
    59 !      REAL tauref(ngrid), tau_col(ngrid)
    60 
    61       real cloudfrac(ngrid,nlayermx)
     48      INTEGER,INTENT(IN) :: ngrid  ! number of atmospheric columns
     49      INTEGER,INTENT(IN) :: nlayer ! number of atmospheric layers
     50      INTEGER,INTENT(IN) :: nq     ! number of tracers
     51      REAL,INTENT(IN) :: pplay(ngrid,nlayer) ! mid-layer pressure (Pa)
     52      REAL,INTENT(IN) :: pplev(ngrid,nlayer+1) ! inter-layer pressure (Pa)
     53      REAL,INTENT(IN) :: pq(ngrid,nlayer,nq) ! tracers (.../kg_of_air)
     54      REAL,INTENT(OUT) :: aerosol(ngrid,nlayer,naerkind) ! aerosol optical depth
     55      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)
     58      REAL,INTENT(OUT):: tau_col(ngrid) !column integrated visible optical depth
     59      ! BENJAMIN MODIFS
     60      real,intent(in) :: cloudfrac(ngrid,nlayermx) ! cloud fraction
     61      real,intent(out) :: totcloudfrac(ngrid) ! total cloud fraction
     62      logical,intent(in) :: clearsky
     63
    6264      real aerosol0
    6365
    6466      INTEGER l,ig,iq,iaer
    6567
    66       LOGICAL firstcall
    67       DATA firstcall/.true./
    68       SAVE firstcall
     68      LOGICAL,SAVE :: firstcall=.true.
    6969
    7070      REAL CBRT
     
    7979      REAL taudusttmp(ngrid) ! Temporary dust opacity used before scaling
    8080      REAL tauh2so4tmp(ngrid) ! Temporary h2so4 opacity used before scaling
    81       ! BENJAMIN MODIFS
     81
    8282      real CLFtot
    83       real totcloudfrac(ngrid)
    84       logical clearsky
    8583
    8684      ! identify tracers
  • trunk/LMDZ.GENERIC/libf/phystd/callcorrk.F90

    r787 r858  
    11      subroutine callcorrk(ngrid,nlayer,pq,nq,qsurf,           &
    22          albedo,emis,mu0,pplev,pplay,pt,                      &
    3           tsurf,fract,dist_star,aerosol,muvar,           &
     3          tsurf,fract,dist_star,aerosol,muvar,                 &
    44          dtlw,dtsw,fluxsurf_lw,                               &
    55          fluxsurf_sw,fluxtop_lw,fluxabs_sw,fluxtop_dn,        &
    66          OLR_nu,OSR_nu,                                       &
    7           reffrad,nueffrad,tau_col,cloudfrac,totcloudfrac,     &
     7          tau_col,cloudfrac,totcloudfrac,                      &
    88          clearsky,firstcall,lastcall)
    99
     
    1515      use gases_h
    1616      use radii_mod, only : su_aer_radii,co2_reffrad,h2o_reffrad,dust_reffrad,h2so4_reffrad
    17       use aerosol_mod
    18 
     17      use aerosol_mod, only : iaero_co2,iaero_h2o,iaero_dust,iaero_h2so4
    1918      USE tracer_h
    2019
     
    4544!     Layer #nlayermx is the layer at the top.
    4645
    47 !     INPUT
    48       INTEGER icount
    49       INTEGER ngrid,nlayer
    50       REAL aerosol(ngrid,nlayermx,naerkind) ! aerosol tau (kg/kg)
    51       REAL albedo(ngrid)                    ! SW albedo
    52       REAL emis(ngrid)                      ! LW emissivity
    53       REAL pplay(ngrid,nlayermx)            ! pres. level in GCM mid of layer
    54       REAL pplev(ngrid,nlayermx+1)          ! pres. level at GCM layer boundaries
    55 
    56       REAL pt(ngrid,nlayermx)               ! air temperature (K)
    57       REAL tsurf(ngrid)                     ! surface temperature (K)
    58       REAL dist_star,mu0(ngrid)             ! distance star-planet (AU)
    59       REAL fract(ngrid)                     ! fraction of day
     46      INTEGER,INTENT(IN) :: ngrid ! number of atmospheric columns
     47      INTEGER,INTENT(IN) :: nlayer ! number of atmospheric layers
     48      REAL,INTENT(IN) :: pq(ngrid,nlayer,nq) ! tracers (.../kg_of_air)
     49      integer,intent(in) :: nq ! number of tracers
     50      REAL,INTENT(IN) :: qsurf(ngrid,nq) ! tracer on surface (kg.m-2)
     51      REAL,INTENT(IN) :: albedo(ngrid)   ! SW albedo
     52      REAL,INTENT(IN) :: emis(ngrid)     ! LW emissivity
     53      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)
     57      REAL,INTENT(IN) :: tsurf(ngrid)        ! surface temperature (K)
     58      REAL,INTENT(IN) :: fract(ngrid)        ! fraction of day
     59      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
     64      REAL,INTENT(OUT) :: fluxsurf_lw(ngrid)   ! incident LW flux to surf (W/m2)
     65      REAL,INTENT(OUT) :: fluxsurf_sw(ngrid)   ! incident SW flux to surf (W/m2)
     66      REAL,INTENT(OUT) :: fluxtop_lw(ngrid)    ! outgoing LW flux to space (W/m2)
     67      REAL,INTENT(OUT) :: fluxabs_sw(ngrid)    ! SW flux absorbed by planet (W/m2)
     68      REAL,INTENT(OUT) :: fluxtop_dn(ngrid)    ! incident top of atmosphere SW flux (W/m2)
     69      REAL,INTENT(OUT) :: OLR_nu(ngrid,L_NSPECTI)! Outgoing LW radition in each band (Normalized to the band width (W/m2/cm-1)
     70      REAL,INTENT(OUT) :: OSR_nu(ngrid,L_NSPECTV)! Outgoing SW radition in each band (Normalized to the band width (W/m2/cm-1)
     71      REAL,INTENT(OUT) :: tau_col(ngrid) ! diagnostic from aeropacity
     72!     for H2O cloud fraction in aeropacity
     73      real,intent(in) :: cloudfrac(ngrid,nlayermx)
     74      real,intent(out) :: totcloudfrac(ngrid)
     75      logical,intent(in) :: clearsky
     76      logical,intent(in) :: firstcall ! signals first call to physics
     77      logical,intent(in) :: lastcall ! signals last call to physics
    6078
    6179!     Globally varying aerosol optical properties on GCM grid
     
    7290!      REAL :: omegaREFir3d(ngrid,nlayermx,naerkind) ! not sure of the point of these...
    7391
    74       !!! this is a local instance of a variable saved in physiq.F and being an argument
    75       REAL, INTENT(INOUT) :: reffrad(ngrid,nlayer,naerkind)
    76       REAL, INTENT(INOUT) :: nueffrad(ngrid,nlayermx,naerkind)
    77 
    78 !!     OUTPUT
    79       REAL dtsw(ngrid,nlayermx) ! heating rate (K/s) due to SW
    80       REAL dtlw(ngrid,nlayermx) ! heating rate (K/s) due to LW
    81       REAL fluxsurf_lw(ngrid)   ! incident LW flux to surf (W/m2)
    82       REAL fluxtop_lw(ngrid)    ! outgoing LW flux to space (W/m2)
    83       REAL fluxsurf_sw(ngrid)   ! incident SW flux to surf (W/m2)
    84       REAL fluxabs_sw(ngrid)    ! SW flux absorbed by planet (W/m2)
    85       REAL fluxtop_dn(ngrid)    ! incident top of atmosphere SW flux (W/m2)
    86       REAL OLR_nu(ngrid,L_NSPECTI)! Outgoing LW radition in each band (Normalized to the band width (W/m2/cm-1)
    87       REAL OSR_nu(ngrid,L_NSPECTV)! Outgoing SW radition in each band (Normalized to the band width (W/m2/cm-1)
     92      REAL,ALLOCATABLE,SAVE :: reffrad(:,:,:) ! aerosol effective radius (m)
     93      REAL,ALLOCATABLE,SAVE :: nueffrad(:,:,:) ! aerosol effective variance
    8894
    8995!-----------------------------------------------------------------------
     
    117123
    118124      INTEGER ig,l,k,nw,iaer,irad
     125      INTEGER icount
    119126
    120127      real fluxtoplanet
     
    126133
    127134      real*8 qvar(L_LEVELS)          ! mixing ratio of variable component (mol/mol)
    128       REAL pq(ngrid,nlayer,nq)
    129       REAL qsurf(ngrid,nq)       ! tracer on surface (e.g. kg.m-2)
    130       integer nq
    131135
    132136!     Local aerosol optical properties for each column on RADIATIVE grid
    133       real*8  QXVAER(L_LEVELS+1,L_NSPECTV,naerkind)
    134       real*8  QSVAER(L_LEVELS+1,L_NSPECTV,naerkind)
    135       real*8  GVAER(L_LEVELS+1,L_NSPECTV,naerkind)
    136       real*8  QXIAER(L_LEVELS+1,L_NSPECTI,naerkind)
    137       real*8  QSIAER(L_LEVELS+1,L_NSPECTI,naerkind)
    138       real*8  GIAER(L_LEVELS+1,L_NSPECTI,naerkind)
    139 
    140       save qxvaer, qsvaer, gvaer
    141       save qxiaer, qsiaer, giaer
     137      real*8,save ::  QXVAER(L_LEVELS+1,L_NSPECTV,naerkind)
     138      real*8,save ::  QSVAER(L_LEVELS+1,L_NSPECTV,naerkind)
     139      real*8,save ::  GVAER(L_LEVELS+1,L_NSPECTV,naerkind)
     140      real*8,save ::  QXIAER(L_LEVELS+1,L_NSPECTI,naerkind)
     141      real*8,save ::  QSIAER(L_LEVELS+1,L_NSPECTI,naerkind)
     142      real*8,save ::  GIAER(L_LEVELS+1,L_NSPECTI,naerkind)
    142143
    143144      !REAL :: QREFvis3d(ngrid,nlayermx,naerkind)
     
    147148      real, dimension(:,:,:), save, allocatable :: QREFir3d
    148149
    149       REAL tau_col(ngrid) ! diagnostic from aeropacity
    150150
    151151!     Misc.
    152       logical firstcall, lastcall, nantest
     152      logical nantest
    153153      real*8  tempv(L_NSPECTV)
    154154      real*8  tempi(L_NSPECTI)
     
    169169      real*8 NFLUXGNDV_nu(L_NSPECTV)
    170170
    171 !     for H2O cloud fraction in aeropacity
    172       real cloudfrac(ngrid,nlayermx)
    173       real totcloudfrac(ngrid)
    174       logical clearsky
    175171
    176172      ! for weird cloud test
     
    179175      real maxrad, minrad
    180176           
    181       real CBRT
    182       external CBRT
     177      real,external :: CBRT
    183178
    184179!     included by RW for runaway greenhouse 1D study
    185       real muvar(ngrid,nlayermx+1)
    186180      real vtmp(nlayermx)
    187181      REAL*8 muvarrad(L_LEVELS)
     
    208202!--------------------------------------------------
    209203!     Effective radius and variance of the aerosols
     204         allocate(reffrad(ngrid,nlayer,naerkind))
     205         allocate(nueffrad(ngrid,nlayer,naerkind))
     206
    210207         if(naerkind.gt.4)then
    211208            print*,'Code not general enough to deal with naerkind > 4 yet.'
     
    262259         endif
    263260
    264          firstcall=.false.   
    265 
    266       end if
     261      end if ! of if (firstcall)
    267262
    268263!=======================================================================
     
    274269
    275270         if ((iaer.eq.iaero_co2).and.tracer.and.(igcm_co2_ice.gt.0)) then ! treat condensed co2 particles.
    276             call co2_reffrad(ngrid,nq,pq,reffrad)
     271            call co2_reffrad(ngrid,nq,pq,reffrad(1,1,iaero_co2))
    277272            print*,'Max. CO2 ice particle size = ',maxval(reffrad(1:ngrid,1:nlayermx,iaer))/1.e-6,' um'
    278273            print*,'Min. CO2 ice particle size = ',minval(reffrad(1:ngrid,1:nlayermx,iaer))/1.e-6,' um'
    279274         end if
    280275         if ((iaer.eq.iaero_h2o).and.water) then ! treat condensed water particles. to be generalized for other aerosols
    281             call h2o_reffrad(ngrid,nq,pq,pt,reffrad,nueffrad)
     276            call h2o_reffrad(ngrid,pq(1,1,igcm_h2o_ice),pt, &
     277                             reffrad(1,1,iaero_h2o),nueffrad(1,1,iaero_h2o))
    282278            print*,'Max. H2O cloud particle size = ',maxval(reffrad(1:ngrid,1:nlayermx,iaer))/1.e-6,' um'
    283279            print*,'Min. H2O cloud particle size = ',minval(reffrad(1:ngrid,1:nlayermx,iaer))/1.e-6,' um'
    284280         endif
    285281         if(iaer.eq.iaero_dust)then
    286             call dust_reffrad(ngrid,reffrad)
     282            call dust_reffrad(ngrid,reffrad(1,1,iaero_dust))
    287283            print*,'Dust particle size = ',reffrad(1,1,iaer)/1.e-6,' um'
    288284         endif
    289285         if(iaer.eq.iaero_h2so4)then
    290             call h2so4_reffrad(ngrid,reffrad)
     286            call h2so4_reffrad(ngrid,reffrad(1,1,iaero_h2so4))
    291287            print*,'H2SO4 particle size =',reffrad(1,1,iaer)/1.e-6,' um'
    292288         endif
     
    638634            print*,'Minimum temperature is outside the radiative'
    639635            print*,'transfer kmatrix bounds, exiting.'
     636            print*,"k=",k," tlevrad(k)=",tlevrad(k)
     637            print*,"tgasmin=",tgasmin
    640638            !print*,'WARNING, OVERRIDING FOR TEST'
    641639            call abort
  • trunk/LMDZ.GENERIC/libf/phystd/callsedim.F

    r787 r858  
    11      SUBROUTINE callsedim(ngrid,nlay, ptimestep,
    2      $                pplev,zlev, pt,
    3      &                pq, pdqfi, pdqsed,pdqs_sed,nq,rfall)
     2     &                pplev,zlev, pt, pdt,
     3     &                pq, pdqfi, pdqsed,pdqs_sed,nq)
    44
    5       USE tracer_h
     5      use radinc_h, only : naerkind
     6      use radii_mod, only: h2o_reffrad
     7      use aerosol_mod, only : iaero_h2o
     8      USE tracer_h, only : igcm_co2_ice,igcm_h2o_ice,radius,rho_q
    69
    710      IMPLICIT NONE
     
    3336c   ----------
    3437
    35       INTEGER ngrid              ! number of horizontal grid points
    36       INTEGER nlay               ! number of atmospheric layers
    37       REAL ptimestep             ! physics time step (s)
    38       REAL pplev(ngrid,nlay+1)  ! pressure at inter-layers (Pa)
    39       REAL pt(ngrid,nlay)        ! temperature at mid-layer (K)
    40       REAL zlev(ngrid,nlay+1)    ! altitude at layer boundaries
    41 
    42 
    43 c    Traceurs :
    44       integer nq             ! number of tracers
    45       real pq(ngrid,nlay,nq)  ! tracers (kg/kg)
    46       real pdqfi(ngrid,nlay,nq)  ! tendency before sedimentation (kg/kg.s-1)
    47       real pdqsed(ngrid,nlay,nq) ! tendency due to sedimentation (kg/kg.s-1)
    48       real pdqs_sed(ngrid,nq)    ! flux at surface (kg.m-2.s-1)
     38      integer,intent(in):: ngrid ! number of horizontal grid points
     39      integer,intent(in):: nlay  ! number of atmospheric layers
     40      real,intent(in):: ptimestep  ! physics time step (s)
     41      real,intent(in):: pplev(ngrid,nlay+1) ! pressure at inter-layers (Pa)
     42      real,intent(in):: pt(ngrid,nlay)      ! temperature at mid-layer (K)
     43      real,intent(in):: pdt(ngrid,nlay) ! tendency on temperature
     44      real,intent(in):: zlev(ngrid,nlay+1)  ! altitude at layer boundaries
     45      integer,intent(in) :: nq ! number of tracers
     46      real,intent(in) :: pq(ngrid,nlay,nq)  ! tracers (kg/kg)
     47      real,intent(in) :: pdqfi(ngrid,nlay,nq)  ! tendency on tracers before
     48                                               ! sedimentation (kg/kg.s-1)
     49     
     50      real,intent(out) :: pdqsed(ngrid,nlay,nq) ! tendency due to sedimentation (kg/kg.s-1)
     51      real,intent(out) :: pdqs_sed(ngrid,nq)    ! flux at surface (kg.m-2.s-1)
    4952     
    5053c   local:
     
    5356      INTEGER l,ig, iq
    5457
    55       real zqi(ngrid,nlayermx,nq) ! to locally store tracers
    56       real masse (ngrid,nlayermx) ! Layer mass (kg.m-2)
    57       real epaisseur (ngrid,nlayermx) ! Layer thickness (m)
    58       real wq(ngrid,nlayermx+1) ! displaced tracer mass (kg.m-2)
     58      ! for particles with varying radii:
     59      real reffrad(ngrid,nlay,naerkind) ! particle radius (m)
     60      real nueffrad(ngrid,nlay,naerkind) ! aerosol effective radius variance
     61
     62      real zqi(ngrid,nlay,nq) ! to locally store tracers
     63      real zt(ngrid,nlay) ! to locally store temperature (K)
     64      real masse (ngrid,nlay) ! Layer mass (kg.m-2)
     65      real epaisseur (ngrid,nlay) ! Layer thickness (m)
     66      real wq(ngrid,nlay+1) ! displaced tracer mass (kg.m-2)
    5967c      real dens(ngrid,nlayermx) ! Mean density of the ice part. accounting for dust core
    60       real rfall(ngrid,nlayermx)
    6168
    6269
    63       LOGICAL firstcall
    64       SAVE firstcall
    65       DATA firstcall/.true./
     70      LOGICAL,SAVE :: firstcall=.true.
    6671
    6772c    ** un petit test de coherence
     
    8085          masse(ig,l)=(pplev(ig,l) - pplev(ig,l+1)) /g
    8186          epaisseur(ig,l)= zlev(ig,l+1) - zlev(ig,l)
     87          zt(ig,l)=pt(ig,l)+pdt(ig,l)*ptimestep
    8288        end do
    8389      end do
     
    8894!  of general tracers.]
    8995 
    90       zqi(1:ngrid,1:nlay,1:nq) = 0.
    9196      do iq=1,nq
    9297       if((radius(iq).gt.1.e-9).and.(iq.ne.igcm_co2_ice)) then   
    93 !         (no sedim for gases; co2_ice sedim is done elsewhere)     
     98!         (no sedim for gases, and co2_ice sedim is done in condense_cloud)     
    9499
    95100! store locally updated tracers
     
    106111! Water         
    107112          if (water.and.(iq.eq.igcm_h2o_ice)) then
     113            ! compute radii for h2o_ice
     114             call h2o_reffrad(ngrid,zqi(1,1,igcm_h2o_ice),zt,
     115     &                reffrad(1,1,iaero_h2o),nueffrad(1,1,iaero_h2o))
     116            ! call sedimentation for h2o_ice
    108117             call newsedim(ngrid,nlay,ngrid*nlay,ptimestep,
    109      &            pplev,masse,epaisseur,pt,rfall,rho_q(iq),zqi,wq)
     118     &            pplev,masse,epaisseur,zt,reffrad(1,1,iaero_h2o),
     119     &            rho_q(iq),zqi(1,1,igcm_h2o_ice),wq)
    110120
    111121! General Case
    112122          else
    113123             call newsedim(ngrid,nlay,1,ptimestep,
    114      &            pplev,masse,epaisseur,pt,radius(iq),rho_q(iq),
    115      &            zqi,wq)
     124     &            pplev,masse,epaisseur,zt,radius(iq),rho_q(iq),
     125     &            zqi(1,1,iq),wq)
    116126          endif
    117127
  • trunk/LMDZ.GENERIC/libf/phystd/condense_cloud.F90

    r787 r858  
    44          piceco2,psolaralb,pemisurf, &
    55          pdtc,pdtsrfc,pdpsrf,pduc,pdvc, &
    6           pdqc,reffrad)
     6          pdqc)
    77
    88      use radinc_h, only : naerkind
     
    6565!     Arguments
    6666
    67       INTEGER ngrid, nlayer, nq
    68 
    69       REAL ptimestep
    70       REAL pplay(ngrid,nlayer),pplev(ngrid,nlayer+1)
    71       REAL pcapcal(ngrid)
    72       REAL pt(ngrid,nlayer)
    73       REAL ptsrf(ngrid)
    74       REAL pphi(ngrid,nlayer)
    75       REAL pdt(ngrid,nlayer),pdtsrf(ngrid),pdtc(ngrid,nlayer)
    76       REAL pdtsrfc(ngrid),pdpsrf(ngrid)
    77 !      REAL piceco2(ngrid),psolaralb(ngrid,2),pemisurf(ngrid)
    78       REAL piceco2(ngrid),psolaralb(ngrid),pemisurf(ngrid)
    79 
    80       REAL pu(ngrid,nlayer) ,  pv(ngrid,nlayer)
    81       REAL pdu(ngrid,nlayer) , pdv(ngrid,nlayer)
    82       REAL pduc(ngrid,nlayer) , pdvc(ngrid,nlayer)
    83       REAL pq(ngrid,nlayer,nq),pdq(ngrid,nlayer,nq)
    84       REAL pdqc(ngrid,nlayer,nq), pdqsc(ngrid,nq)
    85 
    86       REAL reffrad(ngrid,nlayer,naerkind)
    87 
    88 
     67      INTEGER,INTENT(IN) :: ngrid
     68      INTEGER,INTENT(IN) :: nlayer
     69      INTEGER,INTENT(IN) :: nq
     70      REAL,INTENT(IN) :: ptimestep
     71      REAL,INTENT(IN) :: pcapcal(ngrid)
     72      REAL,INTENT(IN) :: pplay(ngrid,nlayer)
     73      REAL,INTENT(IN) :: pplev(ngrid,nlayer+1)
     74      REAL,INTENT(IN) :: ptsrf(ngrid)
     75      REAL,INTENT(IN) :: pt(ngrid,nlayer)
     76      REAL,INTENT(IN) :: pphi(ngrid,nlayer)
     77      REAL,INTENT(IN) :: pdt(ngrid,nlayer)
     78      REAL,INTENT(IN) :: pdu(ngrid,nlayer)
     79      REAL,INTENT(IN) :: pdv(ngrid,nlayer)
     80      REAL,INTENT(IN) :: pdtsrf(ngrid)
     81      REAL,INTENT(IN) :: pu(ngrid,nlayer)
     82      REAL,INTENT(IN) :: pv(ngrid,nlayer)
     83      REAL,INTENT(IN) :: pq(ngrid,nlayer,nq)
     84      REAL,INTENT(IN) :: pdq(ngrid,nlayer,nq)
     85      REAL,INTENT(INOUT) :: piceco2(ngrid)
     86      REAL,INTENT(OUT) :: psolaralb(ngrid)
     87      REAL,INTENT(OUT) :: pemisurf(ngrid)
     88      REAL,INTENT(OUT) :: pdtc(ngrid,nlayer)
     89      REAL,INTENT(OUT) :: pdtsrfc(ngrid)
     90      REAL,INTENT(OUT) :: pdpsrf(ngrid)
     91      REAL,INTENT(OUT) :: pduc(ngrid,nlayer)
     92      REAL,INTENT(OUT) :: pdvc(ngrid,nlayer)
     93      REAL,INTENT(OUT) :: pdqc(ngrid,nlayer,nq)
    8994
    9095!-----------------------------------------------------------------------
     
    9398      INTEGER l,ig,icap,ilay,it,iq
    9499
     100      REAL reffrad(ngrid,nlayer) ! radius (m) of the co2 ice particles
    95101      REAL*8 zt(ngrid,nlayermx)
    96102      REAL zq(ngrid,nlayermx,nq)
     
    123129!     Saved local variables
    124130
    125       REAL latcond
    126       REAL ccond
    127       REAL cpice
     131      REAL,SAVE :: latcond=5.9e5
     132      REAL,SAVE :: ccond
     133      REAL,SAVE :: cpice=1000.
    128134      REAL,SAVE,ALLOCATABLE,DIMENSION(:) :: emisref
    129       SAVE cpice
    130       SAVE latcond,ccond
    131 
    132       LOGICAL firstcall
    133       SAVE firstcall
    134       REAL SSUM
    135       EXTERNAL SSUM
    136 
    137       DATA latcond /5.9e5/
    138       DATA cpice /1000./
    139       DATA firstcall/.true./
    140 
    141       REAL CBRT
    142       EXTERNAL CBRT
     135
     136      LOGICAL,SAVE :: firstcall=.true.
     137      REAL,EXTERNAL :: SSUM
     138
     139      REAL,EXTERNAL :: CBRT
    143140
    144141      INTEGER,SAVE :: i_co2ice=0      ! co2 ice
     
    154151!     Initializations
    155152
    156       call zerophys(ngrid*nlayer*nq,pdqc)
    157       call zerophys(ngrid*nlayer*nq,pdtc)
    158       call zerophys(ngrid*nlayermx*nq,zq)
    159       call zerophys(ngrid*nlayermx,zt)
     153      pdqc(1:ngrid,1:nlayer,1:nq)=0
     154      pdtc(1:ngrid,1:nlayer)=0
     155      zq(1:ngrid,1:nlayer,1:nq)=0
     156      zt(1:ngrid,1:nlayer)=0
    160157
    161158!     Initialisation
     
    320317            DO ig=1,ngrid
    321318
    322                reff = reffrad(ig,ilay,iaero_co2)
     319               reff = reffrad(ig,ilay)
    323320
    324321               call stokes                      &
  • trunk/LMDZ.GENERIC/libf/phystd/newsedim.F

    r787 r858  
    2323!   ---------
    2424
    25       INTEGER ngrid,nlay,naersize
    26       REAL ptimestep            ! pas de temps physique (s)
    27       REAL pplev(ngrid,nlay+1)   ! pression aux inter-couches (Pa)
    28       REAL pt(ngrid,nlay)    ! temperature au centre des couches (K)
    29       real masse (ngrid,nlay) ! masse d'une couche (kg)
    30       real epaisseur (ngrid,nlay)  ! epaisseur d'une couche (m)
    31       real rd(naersize)             ! particle radius (m)
    32       real rho             ! particle density (kg.m-3)
    33 
    34 
    35 c    Traceurs :
    36       real pqi(ngrid,nlay)  ! traceur   (e.g. ?/kg)
    37       real wq(ngrid,nlay+1)  ! flux de traceur durant timestep (?/m-2)
     25      integer,intent(in) :: ngrid  ! number of atmospheric columns
     26      integer,intent(in) :: nlay  ! number of atmospheric layers
     27      integer,intent(in) :: naersize   ! number of particle sizes (1 or number
     28                                       ! of grid boxes)
     29      real,intent(in) :: ptimestep ! physics time step (s)
     30      real,intent(in) :: pplev(ngrid,nlay+1)   ! inter-layer pressures (Pa)
     31      real,intent(in) :: pt(ngrid,nlay)    ! mid-layer temperatures (K)
     32      real,intent(in) :: masse (ngrid,nlay) ! atmospheric mass (kg)
     33      real,intent(in) :: epaisseur (ngrid,nlay)  ! thickness of atm. layers (m)
     34      real,intent(in) :: rd(naersize) ! particle radius (m)
     35      real,intent(in) :: rho ! particle density (kg.m-3)
     36      real,intent(inout) :: pqi(ngrid,nlay)  ! tracer   (e.g. ?/kg)
     37      real,intent(out) :: wq(ngrid,nlay+1)  ! flux of tracer during timestep (?/m-2)
    3838     
    3939c   local:
     
    4343      REAL rfall
    4444
    45       LOGICAL firstcall
    46       SAVE firstcall
     45      LOGICAL,SAVE :: firstcall=.true.
    4746
    4847c    Traceurs :
     
    5352      real ptop, dztop, Ep, Stra
    5453
    55       DATA firstcall/.true./
    5654
    5755c    Physical constant
    5856c    ~~~~~~~~~~~~~~~~~
    59       REAL visc, molrad
    6057c     Gas molecular viscosity (N.s.m-2)
    61       data visc/1.e-5/       ! CO2
     58      real,parameter :: visc=1.e-5       ! CO2
    6259c     Effective gas molecular radius (m)
    63       data molrad/2.2e-10/   ! CO2
     60      real,parameter :: molrad=2.2e-10   ! CO2
    6461
    6562c     local and saved variable
    66       real a,b
    67       save a,b
     63      real,save :: a,b
    6864
    6965c    ** un petit test de coherence
  • trunk/LMDZ.GENERIC/libf/phystd/physiq.F90

    r804 r858  
    1212      use gases_h
    1313      use radcommon_h, only: sigma
    14       use radii_mod, only: h2o_reffrad, co2_reffrad
     14      use radii_mod, only: h2o_reffrad, co2_reffrad, h2o_cloudrad
    1515      use aerosol_mod
    1616      use surfdat_h
     
    132132!   inputs:
    133133!   -------
    134       integer ngrid,nlayer,nq
    135       real ptimestep
    136       real pplev(ngrid,nlayer+1),pplay(ngrid,nlayer)
    137       real pphi(ngrid,nlayer)
    138       real pu(ngrid,nlayer),pv(ngrid,nlayer)
    139       real pt(ngrid,nlayer),pq(ngrid,nlayer,nq)
    140       real pw(ngrid,nlayer)        ! pvervel transmitted by dyn3d
    141       real zh(ngrid,nlayermx)      ! potential temperature (K)
    142       logical firstcall,lastcall
    143 
    144       real pday
    145       real ptime
    146       logical tracerdyn
    147 
    148       character*20 nametrac(nq)   ! name of the tracer from dynamics
     134      integer,intent(in) :: ngrid ! number of atmospheric columns
     135      integer,intent(in) :: nlayer ! number of atmospheric layers
     136      integer,intent(in) :: nq ! number of tracers
     137      character*20,intent(in) :: nametrac(nq) ! name of the tracer from dynamics
     138      logical,intent(in) :: firstcall ! signals first call to physics
     139      logical,intent(in) :: lastcall ! signals last call to physics
     140      real,intent(in) :: pday ! number of elapsed sols since reference Ls=0
     141      real,intent(in) :: ptime ! "universal time", given as fraction of sol (e.g.: 0.5 for noon)
     142      real,intent(in) :: ptimestep ! physics timestep (s)
     143      real,intent(in) :: pplev(ngrid,nlayer+1) ! inter-layer pressure (Pa)
     144      real,intent(in) :: pplay(ngrid,nlayer) ! mid-layer pressure (Pa)
     145      real,intent(in) :: pphi(ngrid,nlayer) ! geopotential at mid-layer (m2s-2)
     146      real,intent(in) :: pu(ngrid,nlayer) ! zonal wind component (m/s)
     147      real,intent(in) :: pv(ngrid,nlayer) ! meridional wind component (m/s)
     148      real,intent(in) :: pt(ngrid,nlayer) ! temperature (K)
     149      real,intent(in) :: pq(ngrid,nlayer,nq) ! tracers (.../kg_of_air)
     150      real,intent(in) :: pw(ngrid,nlayer)    ! vertical velocity (m/s)
     151
     152
    149153
    150154!   outputs:
    151155!   --------
    152156!     physical tendencies
    153       real pdu(ngrid,nlayer),pdv(ngrid,nlayer)
    154       real pdt(ngrid,nlayer),pdq(ngrid,nlayer,nq)
    155       real pdpsrf(ngrid) ! surface pressure tendency
    156 
     157      real,intent(out) :: pdu(ngrid,nlayer) ! zonal wind tendency (m/s/s)
     158      real,intent(out) :: pdv(ngrid,nlayer) ! meridional wind tendency (m/s/s)
     159      real,intent(out) :: pdt(ngrid,nlayer) ! temperature tendency (K/s)
     160      real,intent(out) :: pdq(ngrid,nlayer,nq) ! tracer tendencies (../kg/s)
     161      real,intent(out) :: pdpsrf(ngrid) ! surface pressure tendency (Pa/s)
     162      logical,intent(out) :: tracerdyn ! signal to the dynamics to advect tracers or not
    157163
    158164! Local saved variables:
     
    190196!     for the "naerkind" optically active aerosols:
    191197      real aerosol(ngrid,nlayermx,naerkind)
     198      real zh(ngrid,nlayermx)      ! potential temperature (K)
    192199
    193200      character*80 fichier
     
    390397      real,allocatable,dimension(:,:,:),save :: reffrad ! aerosol effective radius (m)
    391398      real,allocatable,dimension(:,:,:),save :: nueffrad ! aerosol effective radius variance
    392       real :: nueffrad_dummy(ngrid,nlayermx,naerkind) !! AS. This is temporary. Check below why.
     399!      real :: nueffrad_dummy(ngrid,nlayermx,naerkind) !! AS. This is temporary. Check below why.
    393400      real :: reffh2oliq(ngrid,nlayermx) ! liquid water particles effective radius (m)
    394401      real :: reffh2oice(ngrid,nlayermx) ! water ice particles effective radius (m)
    395       real reffH2O(ngrid,nlayermx)
     402   !   real reffH2O(ngrid,nlayermx)
    396403      real reffcol(ngrid,naerkind)
    397404
     
    406413!=======================================================================
    407414
    408       !!! ALLOCATE SAVED ARRAYS
    409       IF (.not. ALLOCATED(tsurf)) ALLOCATE(tsurf(ngrid))
    410       IF (.not. ALLOCATED(tsoil)) ALLOCATE(tsoil(ngrid,nsoilmx))   
    411       IF (.not. ALLOCATED(albedo)) ALLOCATE(albedo(ngrid))         
    412       IF (.not. ALLOCATED(albedo0)) ALLOCATE(albedo0(ngrid))         
    413       IF (.not. ALLOCATED(rnat)) ALLOCATE(rnat(ngrid))         
    414       IF (.not. ALLOCATED(emis)) ALLOCATE(emis(ngrid))   
    415       IF (.not. ALLOCATED(dtrad)) ALLOCATE(dtrad(ngrid,nlayermx))
    416       IF (.not. ALLOCATED(fluxrad_sky)) ALLOCATE(fluxrad_sky(ngrid))
    417       IF (.not. ALLOCATED(fluxrad)) ALLOCATE(fluxrad(ngrid))   
    418       IF (.not. ALLOCATED(capcal)) ALLOCATE(capcal(ngrid))   
    419       IF (.not. ALLOCATED(fluxgrd)) ALLOCATE(fluxgrd(ngrid)) 
    420       IF (.not. ALLOCATED(qsurf)) ALLOCATE(qsurf(ngrid,nq)) 
    421       IF (.not. ALLOCATED(q2)) ALLOCATE(q2(ngrid,nlayermx+1))
    422       IF (.not. ALLOCATED(ztprevious)) ALLOCATE(ztprevious(ngrid,nlayermx))
    423       IF (.not. ALLOCATED(cloudfrac)) ALLOCATE(cloudfrac(ngrid,nlayermx))
    424       IF (.not. ALLOCATED(totcloudfrac)) ALLOCATE(totcloudfrac(ngrid))
    425       IF (.not. ALLOCATED(qsurf_hist)) ALLOCATE(qsurf_hist(ngrid,nq))
    426       IF (.not. ALLOCATED(reffrad)) ALLOCATE(reffrad(ngrid,nlayermx,naerkind))
    427       IF (.not. ALLOCATED(nueffrad)) ALLOCATE(nueffrad(ngrid,nlayermx,naerkind))
    428       IF (.not. ALLOCATED(ice_initial)) ALLOCATE(ice_initial(ngrid))
    429       IF (.not. ALLOCATED(ice_min)) ALLOCATE(ice_min(ngrid))
    430 
    431       IF (.not. ALLOCATED(fluxsurf_lw)) ALLOCATE(fluxsurf_lw(ngrid))
    432       IF (.not. ALLOCATED(fluxsurf_sw)) ALLOCATE(fluxsurf_sw(ngrid))
    433       IF (.not. ALLOCATED(fluxtop_lw)) ALLOCATE(fluxtop_lw(ngrid))
    434       IF (.not. ALLOCATED(fluxabs_sw)) ALLOCATE(fluxabs_sw(ngrid))
    435       IF (.not. ALLOCATED(fluxtop_dn)) ALLOCATE(fluxtop_dn(ngrid))
    436       IF (.not. ALLOCATED(fluxdyn)) ALLOCATE(fluxdyn(ngrid))
    437       IF (.not. ALLOCATED(OLR_nu)) ALLOCATE(OLR_nu(ngrid,L_NSPECTI))
    438       IF (.not. ALLOCATED(OSR_nu)) ALLOCATE(OSR_nu(ngrid,L_NSPECTV))
    439       IF (.not. ALLOCATED(sensibFlux)) ALLOCATE(sensibFlux(ngrid))
    440       IF (.not. ALLOCATED(zdtlw)) ALLOCATE(zdtlw(ngrid,nlayermx))
    441       IF (.not. ALLOCATED(zdtsw)) ALLOCATE(zdtsw(ngrid,nlayermx))
    442       IF (.not. ALLOCATED(tau_col)) ALLOCATE(tau_col(ngrid))
    443 
    444 !=======================================================================
    445 
    446415! 1. Initialisation
    447416! -----------------
     
    450419!  ---------------------------------------
    451420      if (firstcall) then
     421
     422        !!! ALLOCATE SAVED ARRAYS
     423        ALLOCATE(tsurf(ngrid))
     424        ALLOCATE(tsoil(ngrid,nsoilmx))   
     425        ALLOCATE(albedo(ngrid))         
     426        ALLOCATE(albedo0(ngrid))         
     427        ALLOCATE(rnat(ngrid))         
     428        ALLOCATE(emis(ngrid))   
     429        ALLOCATE(dtrad(ngrid,nlayermx))
     430        ALLOCATE(fluxrad_sky(ngrid))
     431        ALLOCATE(fluxrad(ngrid))   
     432        ALLOCATE(capcal(ngrid))   
     433        ALLOCATE(fluxgrd(ngrid)) 
     434        ALLOCATE(qsurf(ngrid,nq)) 
     435        ALLOCATE(q2(ngrid,nlayermx+1))
     436        ALLOCATE(ztprevious(ngrid,nlayermx))
     437        ALLOCATE(cloudfrac(ngrid,nlayermx))
     438        ALLOCATE(totcloudfrac(ngrid))
     439        ALLOCATE(qsurf_hist(ngrid,nq))
     440        ALLOCATE(reffrad(ngrid,nlayermx,naerkind))
     441        ALLOCATE(nueffrad(ngrid,nlayermx,naerkind))
     442        ALLOCATE(ice_initial(ngrid))
     443        ALLOCATE(ice_min(ngrid))
     444        ALLOCATE(fluxsurf_lw(ngrid))
     445        ALLOCATE(fluxsurf_sw(ngrid))
     446        ALLOCATE(fluxtop_lw(ngrid))
     447        ALLOCATE(fluxabs_sw(ngrid))
     448        ALLOCATE(fluxtop_dn(ngrid))
     449        ALLOCATE(fluxdyn(ngrid))
     450        ALLOCATE(OLR_nu(ngrid,L_NSPECTI))
     451        ALLOCATE(OSR_nu(ngrid,L_NSPECTV))
     452        ALLOCATE(sensibFlux(ngrid))
     453        ALLOCATE(zdtlw(ngrid,nlayermx))
     454        ALLOCATE(zdtsw(ngrid,nlayermx))
     455        ALLOCATE(tau_col(ngrid))
    452456
    453457         !! this is defined in comsaison_h
     
    710714                      zdtlw,zdtsw,fluxsurf_lw,fluxsurf_sw,fluxtop_lw,    &
    711715                      fluxabs_sw,fluxtop_dn,OLR_nu,OSR_nu,               &
    712                       reffrad,nueffrad,tau_col,cloudfrac,totcloudfrac,   &
     716                      tau_col,cloudfrac,totcloudfrac,                    &
    713717                      clearsky,firstcall,lastcall)     
    714718
     
    724728                      zdtlw1,zdtsw1,fluxsurf_lw1,fluxsurf_sw1,fluxtop_lw1, &
    725729                      fluxabs_sw1,fluxtop_dn,OLR_nu1,OSR_nu1,              &
    726                       reffrad,nueffrad,tau_col1,cloudfrac,totcloudfrac,    &
     730                      tau_col1,cloudfrac,totcloudfrac,                     &
    727731                      clearsky,firstcall,lastcall)
    728732                 clearsky = .false.  ! just in case.     
     
    10031007              qsurf(1,igcm_co2_ice),albedo,emis,            &
    10041008              zdtc,zdtsurfc,pdpsrf,zduc,zdvc,               &
    1005               zdqc,reffrad)
     1009              zdqc)
    10061010
    10071011
     
    11891193
    11901194           call callsedim(ngrid,nlayer,ptimestep,           &
    1191                 pplev,zzlev,pt,pq,pdq,zdqsed,zdqssed,nq,reffH2O)
     1195                pplev,zzlev,pt,pdt,pq,pdq,zdqsed,zdqssed,nq)
    11921196
    11931197           !-------------------------
     
    14681472         reffcol(1:ngrid,1:naerkind)=0.0
    14691473         if(co2cond.and.(iaero_co2.ne.0))then
    1470             call co2_reffrad(ngrid,nq,zq,reffrad)
     1474            call co2_reffrad(ngrid,nq,zq,reffrad(1,1,iaero_co2))
    14711475            do ig=1,ngrid
    14721476               reffcol(ig,iaero_co2) = SUM(zq(ig,1:nlayermx,igcm_co2_ice)*reffrad(ig,1:nlayermx,iaero_co2)*mass(ig,1:nlayermx))
     
    14741478         endif
    14751479         if(water.and.(iaero_h2o.ne.0))then
    1476 
    1477             !! AS: This modifies reffrad and nueffrad
    1478             !!     ... and those are saved in physiq
    1479             !!     To be conservative with previous versions,
    1480             !!     ... I put nueffrad_dummy so that nueffrad
    1481             !!     ... is not modified, but shouldn't it be modified actually?
    1482             call h2o_reffrad(ngrid,nq,zq,zt,reffrad,nueffrad_dummy)
     1480            call h2o_reffrad(ngrid,zq(1,1,igcm_h2o_ice),zt, &
     1481                             reffrad(1,1,iaero_h2o),nueffrad(1,1,iaero_h2o))
    14831482            do ig=1,ngrid
    14841483               reffcol(ig,iaero_h2o) = SUM(zq(ig,1:nlayermx,igcm_h2o_ice)*reffrad(ig,1:nlayermx,iaero_h2o)*mass(ig,1:nlayermx))
  • trunk/LMDZ.GENERIC/libf/phystd/radii_mod.F90

    r787 r858  
    3535      use radinc_h, only: naerkind
    3636      use aerosol_mod
    37       USE tracer_h
    38       Implicit none
    39 
    40 #include "callkeys.h"
    41 #include "dimensions.h"
    42 #include "dimphys.h"
    43 
    44       integer :: ngrid
    45 
    46       real, intent(inout) :: reffrad(ngrid,nlayermx,naerkind)      !aerosols radii (K)
    47       real, intent(inout) :: nueffrad(ngrid,nlayermx,naerkind)     !variance     
     37!      USE tracer_h
     38      Implicit none
     39
     40#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     
    4848
    4949      logical, save :: firstcall=.true.
     
    119119
    120120!==================================================================
    121    subroutine h2o_reffrad(ngrid,nq,pq,pt,reffrad,nueffrad)
     121!   subroutine h2o_reffrad(ngrid,nq,pq,pt,reffrad,nueffrad)
     122   subroutine h2o_reffrad(ngrid,pq,pt,reffrad,nueffrad)
    122123!==================================================================
    123124!     Purpose
     
    130131!
    131132!==================================================================
    132       use radinc_h, only: naerkind
     133!      use radinc_h, only: naerkind
    133134      use watercommon_h, Only: T_h2O_ice_liq,T_h2O_ice_clouds,rhowater,rhowaterice
    134       use aerosol_mod, only : iaero_h2o
    135       USE tracer_h
     135!      use aerosol_mod, only : iaero_h2o
     136!      USE tracer_h, only: igcm_h2o_ice
    136137      Implicit none
    137138
     
    141142#include "comcstfi.h"
    142143
    143       integer :: ngrid,nq
    144 
    145       real, intent(in) :: pq(ngrid,nlayermx,nq) !tracer mixing ratios (kg/kg)
    146       real, intent(in) :: pt(ngrid,nlayermx)      !temperature (K)
    147       real, intent(inout) :: reffrad(ngrid,nlayermx,naerkind)      !aerosols radii (K)
    148       real, intent(inout) :: nueffrad(ngrid,nlayermx,naerkind) ! dispersion     
     144      integer,intent(in) :: ngrid
     145!      intent,integer(in) :: nq
     146
     147!      real, intent(in) :: pq(ngrid,nlayermx,nq) !tracer mixing ratios (kg/kg)
     148      real, intent(in) :: pq(ngrid,nlayermx) !water ice mixing ratios (kg/kg)
     149      real, intent(in) :: pt(ngrid,nlayermx) !temperature (K)
     150      real, intent(out) :: reffrad(ngrid,nlayermx)      !aerosol radii
     151!      real, intent(out) :: reffrad(ngrid,nlayermx,naerkind)      !aerosols radii
     152      real, intent(out) :: nueffrad(ngrid,nlayermx) ! dispersion     
     153!      real, intent(out) :: nueffrad(ngrid,nlayermx,naerkind) ! dispersion     
    149154
    150155      integer :: ig,l
     
    158163               zfice = 1.0 - (pt(ig,l)-T_h2O_ice_clouds) / (T_h2O_ice_liq-T_h2O_ice_clouds)
    159164               zfice = MIN(MAX(zfice,0.0),1.0)
    160                reffrad(ig,l,iaero_h2o)= rad_h2o * (1.-zfice) + rad_h2o_ice * zfice
    161                nueffrad(ig,l,iaero_h2o) = coef_chaud * (1.-zfice) + coef_froid * zfice
     165!               reffrad(ig,l,iaero_h2o)= rad_h2o * (1.-zfice) + rad_h2o_ice * zfice
     166               reffrad(ig,l)= rad_h2o * (1.-zfice) + rad_h2o_ice * zfice
     167!               nueffrad(ig,l,iaero_h2o) = coef_chaud * (1.-zfice) + coef_froid * zfice
     168               nueffrad(ig,l) = coef_chaud * (1.-zfice) + coef_froid * zfice
    162169            enddo
    163170         enddo
     
    167174               zfice = 1.0 - (pt(ig,l)-T_h2O_ice_clouds) / (T_h2O_ice_liq-T_h2O_ice_clouds)
    168175               zfice = MIN(MAX(zfice,0.0),1.0)
    169                zrad_liq  = CBRT( 3*pq(ig,l,igcm_h2o_ice)/(4*Nmix_h2o*pi*rhowater) )
    170                zrad_ice  = CBRT( 3*pq(ig,l,igcm_h2o_ice)/(4*Nmix_h2o_ice*pi*rhowaterice) )
    171                nueffrad(ig,l,iaero_h2o) = coef_chaud * (1.-zfice) + coef_froid * zfice
     176!              zrad_liq  = CBRT( 3*pq(ig,l,igcm_h2o_ice)/(4*Nmix_h2o*pi*rhowater) )
     177               zrad_liq  = CBRT( 3*pq(ig,l)/(4*Nmix_h2o*pi*rhowater) )
     178!              zrad_ice  = CBRT( 3*pq(ig,l,igcm_h2o_ice)/(4*Nmix_h2o_ice*pi*rhowaterice) )
     179               zrad_ice  = CBRT( 3*pq(ig,l)/(4*Nmix_h2o_ice*pi*rhowaterice) )
     180!               nueffrad(ig,l,iaero_h2o) = coef_chaud * (1.-zfice) + coef_froid * zfice
     181               nueffrad(ig,l) = coef_chaud * (1.-zfice) + coef_froid * zfice
    172182               zrad = zrad_liq * (1.-zfice) + zrad_ice * zfice
    173                reffrad(ig,l,iaero_h2o) = min(max(zrad,1.e-6),100.e-6)
     183!              reffrad(ig,l,iaero_h2o) = min(max(zrad,1.e-6),100.e-6)
     184               reffrad(ig,l) = min(max(zrad,1.e-6),100.e-6)
    174185               enddo
    175186            enddo     
     
    193204!==================================================================
    194205      use watercommon_h, Only: rhowater,rhowaterice
    195       USE tracer_h
     206!      USE tracer_h
    196207      Implicit none
    197208
     
    201212#include "comcstfi.h"
    202213
    203       integer :: ngrid
     214      integer,intent(in) :: ngrid
    204215
    205216      real, intent(in) :: pql(ngrid,nlayermx) !condensed water mixing ratios (kg/kg)
     
    236247!
    237248!==================================================================
    238       use radinc_h, only: naerkind
    239       use aerosol_mod, only : iaero_co2
    240       USE tracer_h
     249!      use radinc_h, only: naerkind
     250!      use aerosol_mod, only : iaero_co2
     251      USE tracer_h, only:igcm_co2_ice,rho_co2
    241252      Implicit none
    242253
     
    246257#include "comcstfi.h"
    247258
    248       integer :: ngrid,nq
     259      integer,intent(in) :: ngrid,nq
    249260
    250261      real, intent(in) :: pq(ngrid,nlayermx,nq) !tracer mixing ratios (kg/kg)
    251       real, intent(inout) :: reffrad(ngrid,nlayermx,naerkind)      !aerosols radii (K)
     262!      real, intent(out) :: reffrad(ngrid,nlayermx,naerkind)      !aerosols radii (K)
     263      real, intent(out) :: reffrad(ngrid,nlayermx)      !aerosols radii (K)
    252264
    253265      integer :: ig,l
     
    258270
    259271      if (radfixed) then
    260          reffrad(1:ngrid,1:nlayermx,iaero_co2) = 5.e-5 ! CO2 ice
     272!         reffrad(1:ngrid,1:nlayermx,iaero_co2) = 5.e-5 ! CO2 ice
     273         reffrad(1:ngrid,1:nlayermx) = 5.e-5 ! CO2 ice
    261274      else
    262275         do l=1,nlayermx
    263276            do ig=1,ngrid
    264277               zrad = CBRT( 3*pq(ig,l,igcm_co2_ice)/(4*Nmix_co2*pi*rho_co2) )
    265                reffrad(ig,l,iaero_co2) = min(max(zrad,1.e-6),100.e-6)
     278!               reffrad(ig,l,iaero_co2) = min(max(zrad,1.e-6),100.e-6)
     279               reffrad(ig,l) = min(max(zrad,1.e-6),100.e-6)
    266280            enddo
    267281         enddo     
     
    285299!
    286300!==================================================================
    287       use radinc_h, only: naerkind
    288       use aerosol_mod, only : iaero_dust
    289       Implicit none
    290 
    291 #include "callkeys.h"
    292 #include "dimensions.h"
    293 #include "dimphys.h"
    294 
    295       integer :: ngrid
    296 
    297       real, intent(inout) :: reffrad(ngrid,nlayermx,naerkind)      !aerosols radii (K)
     301!      use radinc_h, only: naerkind
     302!      use aerosol_mod, only : iaero_dust
     303      Implicit none
     304
     305#include "callkeys.h"
     306#include "dimensions.h"
     307#include "dimphys.h"
     308
     309      integer,intent(in) :: ngrid
     310
     311!      real, intent(out) :: reffrad(ngrid,nlayermx,naerkind)      !aerosols radii (K)
     312      real, intent(out) :: reffrad(ngrid,nlayermx)      !aerosols radii (K)
    298313           
    299       reffrad(1:ngrid,1:nlayermx,iaero_dust) = 2.e-6 ! dust
     314!      reffrad(1:ngrid,1:nlayermx,iaero_dust) = 2.e-6 ! dust
     315      reffrad(1:ngrid,1:nlayermx) = 2.e-6 ! dust
    300316
    301317   end subroutine dust_reffrad
     
    315331!
    316332!==================================================================
    317       use radinc_h, only: naerkind
    318       use aerosol_mod, only : iaero_h2so4
    319       Implicit none
    320 
    321 #include "callkeys.h"
    322 #include "dimensions.h"
    323 #include "dimphys.h"
    324 
    325       integer :: ngrid
    326 
    327       real, intent(inout) :: reffrad(ngrid,nlayermx,naerkind)      !aerosols radii (K)
     333!      use radinc_h, only: naerkind
     334!      use aerosol_mod, only : iaero_h2so4
     335      Implicit none
     336
     337#include "callkeys.h"
     338#include "dimensions.h"
     339#include "dimphys.h"
     340
     341      integer,intent(in) :: ngrid
     342
     343!      real, intent(out) :: reffrad(ngrid,nlayermx,naerkind)      !aerosols radii (K)
     344      real, intent(out) :: reffrad(ngrid,nlayermx)      !aerosols radii (K)
    328345               
    329       reffrad(1:ngrid,1:nlayermx,iaero_h2so4) = 1.e-6 ! h2so4
     346!      reffrad(1:ngrid,1:nlayermx,iaero_h2so4) = 1.e-6 ! h2so4
     347      reffrad(1:ngrid,1:nlayermx) = 1.e-6 ! h2so4
    330348
    331349   end subroutine h2so4_reffrad
  • trunk/LMDZ.GENERIC/libf/phystd/rain.F90

    r787 r858  
    2828#include "callkeys.h"
    2929
    30       integer ngrid,nq
    31 
    32 !     Pre-arguments (for universal model)
    33       real pq(ngrid,nlayermx,nq)       ! tracer (kg/kg)
    34       real qsurf(ngrid,nq)             ! tracer at the surface (kg.m-2)
    35       REAL pdt(ngrid,nlayermx),pdq(ngrid,nlayermx,nq)
    36 
    37       real dqrain(ngrid,nlayermx,nq)   ! tendency of H2O precipitation (kg/kg.s-1)
    38       real dqsrain(ngrid)                ! rain flux at the surface (kg.m-2.s-1)
    39       real dqssnow(ngrid)                ! snow flux at the surface (kg.m-2.s-1)
    40       REAL d_t(ngrid,nlayermx)           ! temperature increment
    41 
    4230!     Arguments
    43       REAL ptimestep                    ! time interval
    44       REAL pplev(ngrid,nlayermx+1)    ! inter-layer pressure
    45       REAL pplay(ngrid,nlayermx)      ! mid-layer pressure
    46       REAL t(ngrid,nlayermx)          ! input temperature (K)
     31      integer,intent(in) :: ngrid ! number of atmospherci columns
     32      integer,intent(in) :: nq ! number of tracers
     33      real,intent(in) :: ptimestep    ! time interval
     34      real,intent(in) :: pplev(ngrid,nlayermx+1) ! inter-layer pressure (Pa)
     35      real,intent(in) :: pplay(ngrid,nlayermx)   ! mid-layer pressure (Pa)
     36      real,intent(in) :: t(ngrid,nlayermx) ! input temperature (K)
     37      real,intent(in) :: pdt(ngrid,nlayermx) ! input tendency on temperature (K/s)     
     38      real,intent(in) :: pq(ngrid,nlayermx,nq)  ! tracers (kg/kg)
     39      real,intent(in) :: pdq(ngrid,nlayermx,nq) ! input tendency on tracers
     40      real,intent(out) :: d_t(ngrid,nlayermx) ! temperature tendency (K/s)
     41      real,intent(out) :: dqrain(ngrid,nlayermx,nq) ! tendency of H2O precipitation (kg/kg.s-1)
     42      real,intent(out) :: dqsrain(ngrid)  ! rain flux at the surface (kg.m-2.s-1)
     43      real,intent(out) :: dqssnow(ngrid)  ! snow flux at the surface (kg.m-2.s-1)
     44      real,intent(in) :: rneb(ngrid,nlayermx) ! cloud fraction
     45
    4746      REAL zt(ngrid,nlayermx)         ! working temperature (K)
    4847      REAL ql(ngrid,nlayermx)         ! liquid water (Kg/Kg)
    4948      REAL q(ngrid,nlayermx)          ! specific humidity (Kg/Kg)
    50       REAL rneb(ngrid,nlayermx)       ! cloud fraction
    5149      REAL d_q(ngrid,nlayermx)        ! water vapor increment
    5250      REAL d_ql(ngrid,nlayermx)       ! liquid water / ice increment
    5351
    5452!     Subroutine options
    55       REAL seuil_neb                    ! Nebulosity threshold
    56       PARAMETER (seuil_neb=0.001)
     53      REAL,PARAMETER :: seuil_neb=0.001  ! Nebulosity threshold
    5754
    5855      INTEGER,save :: precip_scheme      ! id number for precipitaion scheme
     
    6764      REAL,SAVE :: c1
    6865
    69       INTEGER ninter
    70       PARAMETER (ninter=5)
    71 
    72       logical evap_prec                 ! Does the rain evaporate?
    73       parameter(evap_prec=.true.)
     66      INTEGER,PARAMETER :: ninter=5
     67
     68      logical,parameter :: evap_prec=.true. ! Does the rain evaporate?
    7469
    7570!     for simple scheme
    76       real t_crit
    77       PARAMETER (t_crit=218.0)
     71      real,parameter :: t_crit=218.0
    7872      real lconvert
    7973
     
    10094      INTEGER, SAVE :: i_ice=0  ! water ice
    10195
    102       LOGICAL firstcall
    103       SAVE firstcall
     96      LOGICAL,SAVE :: firstcall=.true.
    10497
    10598!     Online functions
     
    108101      fall2v (zzz) =10.6 * ((zzz)**0.31)  !for use with radii
    109102
    110       DATA firstcall /.true./
    111103
    112104      IF (firstcall) THEN
  • trunk/LMDZ.GENERIC/libf/phystd/totalcloudfrac.F90

    r787 r858  
    44      use comdiurn_h
    55      USE comgeomfi_h
    6       USE tracer_h
     6      USE tracer_h, only: igcm_h2o_ice
    77      implicit none
    88
     
    2424#include "callkeys.h"
    2525
    26       integer ngrid, nq
     26      integer,intent(in) :: ngrid        ! number of atmospheric columns
     27      integer,intent(in) :: nq           ! number of tracers
     28      real,intent(in) :: rneb(ngrid,nlayermx)    ! cloud fraction     
     29      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)
    2733
    28       real rneb(ngrid,nlayermx)             ! cloud fraction     
    29       real pplev(ngrid,nlayermx+1)
    30       real pq(ngrid,nlayermx,nq)
    31       real tau(ngrid,nlayermx)
    32 
    33       real totalrneb(ngrid)                 ! total cloud fraction
    3434      real, dimension(nlayermx+1) :: masse
    3535      integer, parameter          :: recovery=7
Note: See TracChangeset for help on using the changeset viewer.