Ignore:
Timestamp:
Mar 20, 2014, 10:57:19 AM (10 years ago)
Author:
Laurent Fairhead
Message:

Merged trunk changes r1920:1997 into testing branch

Location:
LMDZ5/branches/testing
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LMDZ5/branches/testing

  • LMDZ5/branches/testing/libf/cosp/phys_cosp.F90

    r1910 r1999  
    77                        ok_mensuelCOSP,ok_journeCOSP,ok_hfCOSP, &
    88                        ecrit_mth,ecrit_day,ecrit_hf, &
    9                         Nptslmdz,Nlevlmdz,lon,lat, presnivs,overlaplmdz, &
     9                        Nptslmdz,Nlevlmdz,lon,lat, presnivs,overlaplmdz,sunlit, &
    1010                        ref_liq,ref_ice,fracTerLic,u_wind,v_wind,phis,phi,ph,p,skt,t, &
    1111                        sh,rh,tca,cca,mr_lsliq,mr_lsice,fl_lsrainI,fl_lssnowI, &
     
    2222! lon,lat,                              !Longitudes et latitudes de la grille LMDZ
    2323! ref_liq,ref_ice,                      !Rayons effectifs des particules liq et ice (en microm)
    24 ! fracTerLic,                               !Fraction terre a convertir en masque
     24! fracTerLic,                           !Fraction terre a convertir en masque
    2525! u_wind,v_wind,                        !Vents a 10m ???
    2626! phi,                                  !Geopotentiel
    27 ! phis,                                  !Geopotentiel sol
     27! phis,                                 !Geopotentiel sol
    2828! ph,                                   !pression pour chaque inter-couche
    2929! p,                                    !Pression aux milieux des couches
     
    7676  use ioipsl
    7777  use iophy
     78  use cosp_output_mod
     79  use cosp_output_write_mod
    7880 
    7981  IMPLICIT NONE
     
    8688  integer, save :: isccp_topheight,isccp_topheight_direction,overlap
    8789  integer,save  :: Ncolumns     ! Number of subcolumns in SCOPS
    88 !  integer,parameter :: Ncollmdz=20
    89   integer,parameter :: Ncolmax=100
    9090  integer, save :: Npoints      ! Number of gridpoints
    9191!$OMP THREADPRIVATE(Npoints)
     
    119119
    120120! Declaration necessaires pour les sorties IOIPSL
    121   integer :: ii,idayref
    122   real    :: zjulian,zstoday,zstomth,zstohf,zout,ecrit_day,ecrit_hf,ecrit_mth
     121  integer :: ii
     122  real    :: ecrit_day,ecrit_hf,ecrit_mth
    123123  logical :: ok_mensuelCOSP,ok_journeCOSP,ok_hfCOSP
    124   integer :: nhori,nvert,nvertp,nvertisccp,nvertmcosp,nvertcol
    125   integer, save :: nid_day_cosp,nid_mth_cosp,nid_hf_cosp
    126 !$OMP THREADPRIVATE(nid_day_cosp,nid_mth_cosp,nid_hf_cosp)
     124
    127125  logical, save :: debut_cosp=.true.
    128126!$OMP THREADPRIVATE(debut_cosp)
    129   integer :: itau_wcosp
    130   character(len=2) :: str2
    131   real,dimension(Ncolmax) :: column_ax
    132   character(len=10),save,dimension(Ncolmax) :: chcol
    133 
    134   integer, save :: Nlevout
    135 !$OMP THREADPRIVATE(Nlevout)
    136127
    137128  include "dimensions.h"
    138   include "temps.h" 
    139129 
    140130!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Input variables from LMDZ-GCM
     
    144134                                     zlev,zlev_half,mr_ozone,radliq,radice,dtau_s,dem_s,ref_liq,ref_ice
    145135  real,dimension(Nptslmdz,Nlevlmdz) ::  fl_lsrainI,fl_lssnowI,fl_ccrainI,fl_ccsnowI
    146   real,dimension(Nptslmdz)        :: lon,lat,skt,fracTerLic,u_wind,v_wind,phis
     136  real,dimension(Nptslmdz)        :: lon,lat,skt,fracTerLic,u_wind,v_wind,phis,sunlit         
    147137  real,dimension(Nlevlmdz)        :: presnivs
    148138  integer                         :: itap,k,ip
    149139  real                            :: dtime,freq_cosp
    150   logical, parameter              :: lCOSP=.FALSE.
    151 
     140 
    152141!
    153142   namelist/COSP_INPUT/cmor_nl,overlap,isccp_topheight,isccp_topheight_direction, &
     
    173162  CALL read_cosp_input
    174163
    175   do ii=1,Ncolumns
    176     write(str2,'(i2.2)')ii
    177     chcol(ii)="c"//str2
    178     column_ax(ii) = real(ii)
    179   enddo
    180 
    181164! Clefs Outputs
    182165  call read_cosp_output_nl(cosp_output_nl,cfg)
     
    187170   print*,'Fin lecture Namelists, debut_cosp =',debut_cosp
    188171
    189   print*,' Cles sorties cosp :'
     172  print*,' Cles des differents simulateurs cosp :'
    190173  print*,' Lradar_sim,Llidar_sim,Lisccp_sim,Lmisr_sim,Lrttov_sim', &
    191174          cfg%Lradar_sim,cfg%Llidar_sim,cfg%Lisccp_sim,cfg%Lmisr_sim,cfg%Lrttov_sim
     
    193176  endif ! debut_cosp
    194177
    195   print*,'Debut phys_cosp itap,dtime,freq_cosp,ecrit_mth,ecrit_day,ecrit_hf ', &
    196           itap,dtime,freq_cosp,ecrit_mth,ecrit_day,ecrit_hf
    197 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    198 ! Allocate local arrays
    199 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    200 !        call system_clock(t0,count_rate,count_max) !!! Only for testing purposes
    201        
    202        
     178!  print*,'Debut phys_cosp itap,dtime,freq_cosp,ecrit_mth,ecrit_day,ecrit_hf ', &
     179!          itap,dtime,freq_cosp,ecrit_mth,ecrit_day,ecrit_hf
    203180!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    204181! Allocate memory for gridbox type
     
    237214        gbx%q = rh*100.
    238215        gbx%sh = sh
    239         gbx%cca = cca !convective_cloud_amount (1)
     216! On ne veut pas que cosp distingue les nuages stratiformes et convectifs
     217! on passe les contenus totaux (conv+strat)
     218        gbx%cca = 0. !convective_cloud_amount (1)
    240219        gbx%tca = tca ! total_cloud_amount (1)
    241220        gbx%psfc = ph(:,1) !pression de surface
     
    253232        gbx%u_wind  = u_wind !eastward_wind (m s-1)
    254233        gbx%v_wind  = v_wind !northward_wind
    255 ! Attention
    256         gbx%sunlit  = 1
     234
     235! sunlit calcule a partir de la fraction d ensoleillement par jour
     236      do ip = 1, Npoints
     237        if (sunlit(ip).le.0.) then
     238           gbx%sunlit(ip)=0.
     239        else
     240           gbx%sunlit(ip)=1.
     241        endif
     242      enddo
    257243
    258244! A voir l equivalent LMDZ
     
    296282        call construct_cosp_vgrid(gbx,Nlr,use_vgrid,csat_vgrid,vgrid)
    297283
    298  if (debut_cosp) then
    299 ! Creer le fichier de sorie, definir les variable de sortie
    300   ! Axe verticale (Pa ou Km)
    301      Nlevout = vgrid%Nlvgrid
    302    
    303         do ii=1,Ncolumns
    304           column_ax(ii) = real(ii)
    305         enddo
    306 
    307  if (ok_mensuelCOSP) then
    308      include "ini_histmthCOSP.h"
    309  endif
    310  if (ok_journeCOSP) then
    311      include "ini_histdayCOSP.h"
    312  endif
    313  if (ok_hfCOSP) then
    314      include "ini_histhfCOSP.h"
    315  endif
    316 
    317    debut_cosp=.false.
    318   endif ! debut_cosp
    319 
    320284!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    321285       ! Allocate memory for other types
     
    329293        call construct_cosp_isccp(cfg,Npoints,Ncolumns,Nlevels,isccp)
    330294        call construct_cosp_misr(cfg,Npoints,misr)
     295
     296!+++++++++++++ Open output files and define output files axis !+++++++++++++
     297     if (debut_cosp) then
     298
     299        print *, ' Open outpts files and define axis'
     300        call cosp_output_open(Nlevlmdz, Ncolumns, presnivs, dtime, freq_cosp, &
     301                              ok_mensuelCOSP, ok_journeCOSP, ok_hfCOSP, &
     302                              ecrit_mth, ecrit_day, ecrit_hf, use_vgrid, vgrid)
     303
     304        debut_cosp=.false.
     305      endif ! debut_cosp
    331306!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    332307        ! Call simulator
     
    335310        call cosp(overlap,Ncolumns,cfg,vgrid,gbx,sgx,sgradar,sglidar,isccp,misr,stradar,stlidar)
    336311!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    337         ! Write outputs to CMOR-compliant NetCDF
    338 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    339 
    340 ! A traiter le cas ou l on a des valeurs indefinies
    341 ! Attention teste
    342 
    343 ! if(1.eq.0)then
    344 
    345 
    346    do k = 1,Nlevout
    347      do ip = 1,Npoints
    348      if(stlidar%lidarcld(ip,k).eq.R_UNDEF)then
    349       stlidar%lidarcld(ip,k)=0.
    350      endif
    351      enddo
    352 
    353 
    354      do ii= 1,SR_BINS
    355       do ip = 1,Npoints
    356        if(stlidar%cfad_sr(ip,ii,k).eq.R_UNDEF)then
    357         stlidar%cfad_sr(ip,ii,k)=0.
    358        endif
    359       enddo
    360      enddo
    361    enddo   
    362    
    363   do ip = 1,Npoints
    364    do k = 1,Nlevlmdz
    365      if(sglidar%beta_mol(ip,k).eq.R_UNDEF)then
    366       sglidar%beta_mol(ip,k)=0.
    367      endif
    368    
    369      do ii= 1,Ncolumns
    370        if(sglidar%beta_tot(ip,ii,k).eq.R_UNDEF)then
    371         sglidar%beta_tot(ip,ii,k)=0.
    372        endif 
    373      enddo
    374 
    375     enddo    !k = 1,Nlevlmdz
    376    enddo     !ip = 1,Npoints
    377 
    378    do k = 1,LIDAR_NCAT
    379     do ip = 1,Npoints
    380      if(stlidar%cldlayer(ip,k).eq.R_UNDEF)then
    381       stlidar%cldlayer(ip,k)=0.
    382      endif
    383     enddo
    384    enddo
    385 
    386 ! endif
    387 
    388    do ip = 1,Npoints
    389     if(isccp%totalcldarea(ip).eq.-1.E+30)then
    390       isccp%totalcldarea(ip)=0.
    391     endif
    392     if(isccp%meanptop(ip).eq.-1.E+30)then
    393       isccp%meanptop(ip)=0.
    394     endif
    395     if(isccp%meantaucld(ip).eq.-1.E+30)then
    396       isccp%meantaucld(ip)=0.
    397     endif
    398     if(isccp%meanalbedocld(ip).eq.-1.E+30)then
    399       isccp%meanalbedocld(ip)=0.
    400     endif
    401     if(isccp%meantb(ip).eq.-1.E+30)then
    402       isccp%meantb(ip)=0.
    403     endif
    404     if(isccp%meantbclr(ip).eq.-1.E+30)then
    405       isccp%meantbclr(ip)=0.
    406     endif
    407 
    408     do k=1,7
    409      do ii=1,7
    410      if(isccp%fq_isccp(ip,ii,k).eq.-1.E+30)then
    411       isccp%fq_isccp(ip,ii,k)=0.
    412      endif
    413      enddo
    414     enddo
    415 
    416     do ii=1,Ncolumns
    417      if(isccp%boxtau(ip,ii).eq.-1.E+30)then
    418        isccp%boxtau(ip,ii)=0.
    419      endif
    420     enddo
    421 
    422     do ii=1,Ncolumns
    423      if(isccp%boxptop(ip,ii).eq.-1.E+30)then
    424        isccp%boxptop(ip,ii)=0.
    425      endif
    426     enddo
    427    enddo
    428 
    429  if (ok_mensuelCOSP) then
    430   include "write_histmthCOSP.h"
    431  endif
    432  if (ok_journeCOSP) then
    433   include "write_histdayCOSP.h"
    434  endif
    435  if (ok_hfCOSP ) then
    436   include "write_histhfCOSP.h"
    437  endif
     312
     313!!!!!!!!!!!!!!!!!! Ecreture des sorties Cosp !!!!!!!!!!!!!!r!!!!!!:!!!!!
     314       print *, 'Calling write output'
     315        call cosp_output_write(Nlevlmdz, Npoints, Ncolumns, itap, dtime, freq_COSP, cfg, gbx, sglidar, stlidar, isccp)
    438316
    439317!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Note: See TracChangeset for help on using the changeset viewer.