source: LMDZ6/branches/Amaury_dev/libf/phylmd/Dust/read_dust.F @ 5093

Last change on this file since 5093 was 5088, checked in by abarral, 13 months ago

Remove all managed netcdf77 usage (excluding external: rrtm, ecrad)
Remove call to netcdf.inc
Replace USE lmdz_netcdf by USE netcdf
Replace lmdz_netcdf.F90 by lmdz_netcdf_format.F90

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