Ignore:
Timestamp:
Feb 23, 2010, 9:12:08 PM (14 years ago)
Author:
yann meurdesoif
Message:

YM : Parallelisation COSP MPI+OpenMP

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ4/branches/LMDZ4V5.0-dev/libf/cosp/phys_cosp.F90

    r1293 r1318  
    7070  USE MOD_COSP
    7171  USE mod_phys_lmdz_para
     72  USE mod_grid_phy_lmdz
    7273  use ioipsl
    7374  use iophy
     
    7677
    7778  ! Local variables
    78   character(len=64)  :: cosp_input_nl='cosp_input_nl.txt'
    79   character(len=64)  :: cosp_output_nl='cosp_output_nl.txt'
     79  character(len=64),PARAMETER  :: cosp_input_nl='cosp_input_nl.txt'
     80  character(len=64),PARAMETER  :: cosp_output_nl='cosp_output_nl.txt'
    8081  character(len=512), save :: finput ! Input file name
    8182  character(len=512), save :: cmor_nl
     
    8485  integer,parameter :: Ncollmdz=20
    8586  integer, save :: Npoints      ! Number of gridpoints
     87!$OMP THREADPRIVATE(Npoints)
    8688  integer, save :: Nlevels      ! Number of levels
    8789  Integer :: Nptslmdz,Nlevlmdz ! Nb de points issus de physiq.F
     
    9092  integer :: i
    9193  type(cosp_config),save :: cfg   ! Configuration options
     94!$OMP THREADPRIVATE(cfg)
    9295  type(cosp_gridbox) :: gbx ! Gridbox information. Input for COSP
    9396  type(cosp_subgrid) :: sgx     ! Subgrid outputs
     
    103106  integer :: Nlon,Nlat,geomode
    104107  real,save :: radar_freq,k2,ZenAng,co2,ch4,n2o,co,emsfc_lw
     108!$OMP THREADPRIVATE(emsfc_lw)
    105109  integer,dimension(RTTOV_MAX_CHANNELS),save :: Channels
    106110  real,dimension(RTTOV_MAX_CHANNELS),save :: Surfem
     
    115119  integer :: nhori,nvert,nvertp,nvertisccp,nvertm,nvertcol
    116120  integer, save :: nid_day_cosp,nid_mth_cosp,nid_hf_cosp
     121!$OMP THREADPRIVATE(nid_day_cosp,nid_mth_cosp,nid_hf_cosp)
    117122  logical, save :: debut_cosp=.true.
     123!$OMP THREADPRIVATE(debut_cosp)
    118124  integer :: itau_wcosp
    119   character(len=10),dimension(Ncollmdz) :: chcol=(/'c01','c02','c03','c04','c05','c06','c07','c08','c09','c10', &
     125  character(len=10),dimension(Ncollmdz),parameter :: chcol=(/'c01','c02','c03','c04','c05','c06','c07','c08','c09','c10', &
    120126                                                   'c11','c12','c13','c14','c15','c16','c17','c18','c19','c20'/)
    121127  real,dimension(Ncollmdz) :: column_ax
    122128  integer, save :: Nlevout
     129!$OMP THREADPRIVATE(Nlevout)
    123130
    124131  include "dimensions.h"
     
    139146!
    140147   namelist/COSP_INPUT/cmor_nl,overlap,isccp_topheight,isccp_topheight_direction, &
    141               npoints,npoints_it,ncolumns,nlevels,use_vgrid,nlr,csat_vgrid,finput, &
     148              npoints_it,ncolumns,nlevels,use_vgrid,nlr,csat_vgrid,finput, &
    142149              radar_freq,surface_radar,use_mie_tables, &
    143150              use_gas_abs,do_ray,melt_lay,k2,Nprmts_max_hydro,Naero,Nprmts_max_aero, &
     
    154161
    155162 if (debut_cosp) then
     163  NPoints=Nptslmdz
    156164! Lecture du namelist input
    157   open(10,file=cosp_input_nl,status='old')
    158   read(10,nml=cosp_input)
    159   close(10)
     165  CALL read_cosp_input
     166
    160167! Clefs Outputs
    161168  call read_cosp_output_nl(cosp_output_nl,cfg)
    162169
    163     if ( (Ncollmdz.ne.Ncolumns).or.(Nptslmdz.ne.Npoints).or.(Nlevlmdz.ne.Nlevels) ) then
     170    if ( (Ncollmdz.ne.Ncolumns).or. (Nlevlmdz.ne.Nlevels) ) then
    164171       print*,'Nb points Horiz, Vert, Sub-col passes par physiq.F = ', &
    165172               Nptslmdz, Nlevlmdz, Ncollmdz
     
    169176       call abort
    170177    endif
    171 
     178   
    172179    if (overlaplmdz.ne.overlap) then
    173180       print*,'Attention overlaplmdz different de overlap lu dans namelist '
     
    462469!  call system_clock(t1,count_rate,count_max)
    463470!  print *,(t1-t0)*1.0/count_rate
     471 
     472  CONTAINS
     473 
     474  SUBROUTINE read_cosp_input
    464475   
     476    IF (is_master) THEN
     477      OPEN(10,file=cosp_input_nl,status='old')
     478      READ(10,nml=cosp_input)
     479      CLOSE(10)
     480    ENDIF
     481    CALL bcast(cmor_nl)
     482    CALL bcast(overlap)
     483    CALL bcast(isccp_topheight)
     484    CALL bcast(isccp_topheight_direction)
     485    CALL bcast(npoints_it)
     486    CALL bcast(ncolumns)
     487    CALL bcast(nlevels)
     488    CALL bcast(use_vgrid)
     489    CALL bcast(nlr)
     490    CALL bcast(csat_vgrid)
     491    CALL bcast(finput)
     492    CALL bcast(radar_freq)
     493    CALL bcast(surface_radar)
     494    CALL bcast(use_mie_tables)
     495    CALL bcast(use_gas_abs)
     496    CALL bcast(do_ray)
     497    CALL bcast(melt_lay)
     498    CALL bcast(k2)
     499    CALL bcast(Nprmts_max_hydro)
     500    CALL bcast(Naero)
     501    CALL bcast(Nprmts_max_aero)
     502    CALL bcast(lidar_ice_type)
     503    CALL bcast(use_precipitation_fluxes)
     504    CALL bcast(use_reff)
     505    CALL bcast(platform)
     506    CALL bcast(satellite)
     507    CALL bcast(Instrument)
     508    CALL bcast(Nchannels)
     509    CALL bcast(Channels)
     510    CALL bcast(Surfem)
     511    CALL bcast(ZenAng)
     512    CALL bcast(co2)
     513    CALL bcast(ch4)
     514    CALL bcast(n2o)
     515    CALL bcast(co)
     516!$OMP BARRIER 
     517  END SUBROUTINE read_cosp_input
     518
    465519end subroutine phys_cosp
Note: See TracChangeset for help on using the changeset viewer.