source: LMDZ6/trunk/libf/phylmd/Dust/read_dust.f90 @ 5301

Last change on this file since 5301 was 5285, checked in by abarral, 4 days ago

As discussed internally, remove generic ONLY: ... for new _mod_h modules

File size: 1.9 KB
Line 
1SUBROUTINE read_dust(debutphy, step, nbjour, dust_ec)
2  USE dimphy
3  USE mod_grid_phy_lmdz
4  USE mod_phys_lmdz_para
5  USE netcdf, ONLY: nf90_get_var, nf90_nowrite, nf90_open, nf90_inq_varid
6  USE dimensions_mod, ONLY: iim, jjm, llm, ndm
7USE paramet_mod_h
8IMPLICIT NONE
9  !
10
11
12  !
13  INTEGER :: step, nbjour
14  LOGICAL :: debutphy
15  real :: dust_ec(klon)
16  real :: dust_ec_glo(klon_glo)
17  !
18  ! as      real dust_nc(iip1,jjp1)
19  real :: dust_nc_glo(nbp_lon+1,nbp_lat)
20  INTEGER :: ncid1, varid1, ncid2, varid2, rcode
21
22  save ncid1, varid1, ncid2, varid2
23!$OMP THREADPRIVATE(ncid1, varid1, ncid2, varid2)
24  integer :: start(4),count(4), status
25  integer :: i, j, ig
26  !
27!$OMP MASTER
28  IF (is_mpi_root .AND. is_omp_root) THEN
29  if (debutphy) then
30  !
31     ncid1=nf90_open('dust.nc',nf90_nowrite,rcode)
32     varid1=nf90_inq_varid(ncid1,'EMISSION',rcode)
33  !
34  endif
35  !
36  start(1)=1
37  start(2)=1
38  start(4)=0
39
40   ! count(1)=iip1
41  count(1)=nbp_lon+1
42   ! count(2)=jjp1
43  count(2)=nbp_lat
44  count(3)=1
45  count(4)=0
46  !
47  start(3)=step
48  !
49  status = nf90_get_var(ncid1, varid1, dust_nc_glo, start, count)
50
51  !
52  !  call correctbid(iim,jjp1,dust_nc)
53  call correctbid(nbp_lon,nbp_lat,dust_nc_glo)
54  !
55  !--upside down + physical grid
56  !
57  !--OB=change jjp1 to 1 here ;
58  !----AS: OB's change is needed if lats N to S (90 to -90) in dust.nc
59  !  dust_ec(1)=MAX(dust_nc(1,jjp1),0.0)
60  dust_ec_glo(1)=MAX(dust_nc_glo(1,nbp_lat),0.0)
61  ig=2
62   ! DO j=2,jjm
63  DO j=2,nbp_lat-1
64      ! DO i = 1, iim
65     DO i = 1, nbp_lon
66  !--OB=change jjp1+1-j to j here
67        ! dust_ec(ig)=MAX(dust_nc(i,jjp1+1-j),0.0)
68       dust_ec_glo(ig)=MAX(dust_nc_glo(i,nbp_lat+1-j),0.0)
69       ig=ig+1
70     ENDDO
71  ENDDO
72  !--OB=change second 1 to jjp1 here
73  dust_ec_glo(ig)=MAX(dust_nc_glo(1,1),0.0)
74   ! end if master
75  ENDIF
76!$OMP END MASTER
77!$OMP BARRIER
78  CALL scatter(dust_ec_glo,dust_ec)
79  !
80  RETURN
81END SUBROUTINE read_dust
Note: See TracBrowser for help on using the repository browser.