source: LMDZ6/trunk/libf/phylmd/Dust/read_dust.F90 @ 5267

Last change on this file since 5267 was 5249, checked in by abarral, 3 days ago

Replace uses of cpp key NC_DOUBLE

File size: 1.8 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
6  IMPLICIT NONE
7  !
8  INCLUDE "dimensions.h"
9  INCLUDE "paramet.h"
10  INCLUDE "netcdf.inc"
11  !
12  INTEGER :: step, nbjour
13  LOGICAL :: debutphy
14  real :: dust_ec(klon)
15  real :: dust_ec_glo(klon_glo)
16  !
17  ! as      real dust_nc(iip1,jjp1)
18  real :: dust_nc_glo(nbp_lon+1,nbp_lat)
19  real :: rcode
20  integer :: ncid1, varid1, ncid2, varid2
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=NCOPN('dust.nc',NCNOWRIT,rcode)
32     varid1=NCVID(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.