Changeset 2000 for trunk/ICOSA_LMDZ


Ignore:
Timestamp:
Sep 19, 2018, 10:53:15 AM (6 years ago)
Author:
emillour
Message:

Dynamico-physics interfaces:

  • some OpenMP fixes.
  • small bug fix: in Dynamico vertical flux is positive when upwards, but in the physics positive is downwards, so change the sign when sending values to the physics.

EM

Location:
trunk/ICOSA_LMDZ/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ICOSA_LMDZ/src/distrib_icosa_lmdz.f90

    r1696 r2000  
    9090    INTEGER,POINTER :: index(:)
    9191   
     92!$OMP BARRIER
    9293    pos=0
    9394    DO ind=1,ndomain_distrib
     
    114115    INTEGER :: l
    115116   
     117!$OMP BARRIER
    116118    DO l=1,size(field_lmdz,2) 
    117119      pos=0
     
    141143    INTEGER :: l,q
    142144
     145!$OMP BARRIER
    143146    DO q=1,size(field_lmdz,3) 
    144147      DO l=1,size(field_lmdz,2) 
     
    167170    INTEGER,POINTER :: index(:)
    168171   
     172!$OMP BARRIER
    169173    pos=0
    170174    DO ind=1,ndomain_distrib
     
    189193    INTEGER :: l
    190194   
     195!$OMP BARRIER
    191196    DO l=1,size(field_lmdz,2) 
    192197      pos=0
     
    215220    INTEGER :: l,q
    216221   
     222!$OMP BARRIER
    217223    DO q=1,size(field_lmdz,3) 
    218224      DO l=1,size(field_lmdz,2) 
  • trunk/ICOSA_LMDZ/src/phystd/interface_icosa_lmdz.f90

    r1982 r2000  
    255255    ENDDO
    256256
    257 !$OMP BARRIER
    258257     
    259258    CALL transfer_icosa_to_lmdz(f_ind_cell_glo,ind_cell_glo)
     
    276275
    277276    ! Initialize tracer names, numbers, etc. for physics
    278 !$OMP MASTER
    279277    !Config  Key  = type_trac
    280278    !Config  Desc = Choix de couplage avec model de chimie INCA ou REPROBUS
     
    290288!    nqo=2
    291289!    nbtr=2
     290!$OMP MASTER
    292291    ALLOCATE(tname(nqtot))
     292!$OMP END MASTER
     293!$OMP BARRIER
    293294!    ALLOCATE(ttext(nqtot))
    294295!    ALLOCATE(niadv(nqtot))
     
    299300
    300301! read tname() from traceur.def file
     302    IF (is_mpi_root) THEN
     303!$OMP MASTER
    301304    OPEN(unit=42,file="traceur.def",form="formatted",status="old",iostat=ierr)
    302305    IF (ierr==0) THEN
     
    313316!$OMP END MASTER
    314317!$OMP BARRIER
     318    ENDIF ! of (is_mpi_root)
     319
     320    DO i=1,nqtot
     321      CALL bcast(tname(i))
     322    ENDDO
    315323
    316324!    CALL init_infotrac_phy(nqtot,nqo,nbtr,tname,ttext,type_trac,&
     
    325333!    CALL inifis(klon_omp,nlayer,nqtot,pdayref,punjours,nday,ptimestep, &
    326334!            latitude,longitude,cell_area,prad,pg,pr,pcpp)
    327 !$OMP MASTER
    328335
    329336    startphy_file=.true.
     
    332339    IF (startphy_file) THEN
    333340
     341      IF (is_mpi_root) THEN
     342!$OMP MASTER     
    334343      status=nf90_open('startfi.nc',NF90_NOWRITE,ncid)
    335344      if (status.ne.nf90_noerr) then
     
    348357      status=nf90_get_var(ncid,varid,tab_cntrl)
    349358      start_day=tab_cntrl(3)
    350       print*,"start_day YORGL",start_day
     359      print*,"initialize_physics_omp: start_day",start_day
    351360      status=nf90_close(ncid)
     361!$OMP END MASTER     
     362!$OMP BARRIER
     363      ENDIF ! of !IF (is_mpi_root)
     364     
     365      CALL bcast(start_day)
    352366
    353367    ELSE
     
    364378    ndays=nint(itaumax*(dt/day_length))! number of days to run
    365379    physics_timestep=dt*itau_physics
    366 !$OMP END MASTER
    367 !$OMP BARRIER
     380
    368381    CALL inifis(klon_omp,llm,nqtot,start_day,day_length,ndays,physics_timestep, &
    369382            latfi,lonfi,airefi,radius,g,kappa*cpp,cpp)
     
    596609
    597610    DO l=1,llm
    598       wflux_phy(:,l)=wflux_phy(:,l)*cell_area(:)
     611      ! Warning: In the physics, vertical flux convention is positive if downwards!
     612      wflux_phy(:,l)= - wflux_phy(:,l)*cell_area(:)
     613      ! Compute relative geopotential
    599614      phi_phy(:,l)=phi_phy(:,l)-phis_phy(:)
    600615    ENDDO
  • trunk/ICOSA_LMDZ/src/phyvenus/interface_icosa_lmdz.f90

    r1982 r2000  
    3838 
    3939  CHARACTER(len=30),SAVE,ALLOCATABLE :: tname(:) ! tracer names
     40  CHARACTER(len=33),SAVE,ALLOCATABLE :: ttext(:) ! tracer long name for diagnostics
    4041  REAL,SAVE :: pday ! number of ellapsed sols since Ls=0
    4142  REAL,SAVE :: ptime ! "universal time" as fraction of sol (e.g. 0.5 for noon)
     
    213214  CHARACTER(len=4)              :: type_trac
    214215!  CHARACTER(len=30),ALLOCATABLE :: tname(:)    ! tracer short name for restart and diagnostics
    215   CHARACTER(len=33),ALLOCATABLE :: ttext(:)     ! tracer long name for diagnostics
     216!  CHARACTER(len=33),ALLOCATABLE :: ttext(:)     ! tracer long name for diagnostics
    216217  TYPE(t_field),POINTER,SAVE    :: f_ind_cell_glo(:)
    217218 
     
    259260    ENDDO
    260261
    261 !$OMP BARRIER
    262262     
    263263    CALL transfer_icosa_to_lmdz(f_ind_cell_glo,ind_cell_glo)
     
    284284
    285285    ! Initialize tracer names, numbers, etc. for physics
     286
     287! init tracers model for standard lmdz case
    286288!$OMP MASTER
    287 
    288 ! init tracers model for standard lmdz case
    289289    ALLOCATE(tname(nqtot))
    290290    ALLOCATE(ttext(nqtot))
     291!$OMP END MASTER
     292!$OMP BARRIER
    291293
    292294! read tname() from traceur.def file
     295    IF (is_mpi_root) THEN
     296!$OMP MASTER
    293297    OPEN(unit=42,file="traceur.def",form="formatted",status="old",iostat=ierr)
    294298    IF (ierr==0) THEN
     
    306310!$OMP END MASTER
    307311!$OMP BARRIER
     312    ENDIF ! of (is_mpi_root)
     313
     314    DO i=1,nqtot
     315      CALL bcast(tname(i))
     316      CALL bcast(ttext(i))
     317    ENDDO
    308318
    309319   ! Get/set some constants for the physics
    310320
    311 !$OMP MASTER
    312321
    313322    startphy_file=.true.
     
    326335      ! Read in some information from the startphy.nc file
    327336
     337      IF (is_mpi_root) THEN
     338!$OMP MASTER     
    328339      status=nf90_open('startphy.nc',NF90_NOWRITE,ncid)
    329340      if (status.ne.nf90_noerr) then
     
    347358
    348359      status=nf90_close(ncid)
     360!$OMP END MASTER     
     361!$OMP BARRIER
     362      ENDIF ! of !IF (is_mpi_root)
     363     
     364      CALL bcast(day_ini)
     365      CALL bcast(annee_ref)
     366      CALL bcast(ptime)
    349367
    350368    ELSE
     
    365383    CALL getin('iflag_trac',iflag_trac)
    366384
    367 !$OMP END MASTER
    368 !$OMP BARRIER
    369385
    370386    ! Initialize some physical constants
     
    597613
    598614    DO l=1,llm
    599       wflux_phy(:,l)=wflux_phy(:,l)*cell_area(:)
     615      ! Warning: In the physics, vertical flux convention is positive if downwards!
     616      wflux_phy(:,l)= - wflux_phy(:,l)*cell_area(:)
     617      ! Compute relative geopotential
    600618      phi_phy(:,l)=phi_phy(:,l)-phis_phy(:)
    601619    ENDDO
Note: See TracChangeset for help on using the changeset viewer.