source: LMDZ6/branches/LMDZ_ECRad/libf/phylmd/Dust/read_dust.F @ 4993

Last change on this file since 4993 was 4727, checked in by idelkadi, 13 months ago

Merged trunk changes -r4488:4726 LMDZ_ECRad branch

File size: 2.1 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      IMPLICIT NONE
6c
7      INCLUDE "dimensions.h"
8      INCLUDE "paramet.h"
9      INCLUDE "netcdf.inc"
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
47c
48#ifdef NC_DOUBLE
49!      status=NF_GET_VARA_DOUBLE(ncid1,varid1,start,count,dust_nc)
50      status=NF_GET_VARA_DOUBLE(ncid1,varid1,start,count,dust_nc_glo)
51#else
52!      status=NF_GET_VARA_REAL(ncid1,varid1,start,count,dust_nc)
53      status=NF_GET_VARA_REAL(ncid1,varid1,start,count,dust_nc_glo)
54#endif
55c
56!      call correctbid(iim,jjp1,dust_nc)
57      call correctbid(nbp_lon,nbp_lat,dust_nc_glo)
58c
59c--upside down + physical grid
60c
61c--OB=change jjp1 to 1 here ;
62c----AS: OB's change is needed if lats N to S (90 to -90) in dust.nc
63!      dust_ec(1)=MAX(dust_nc(1,jjp1),0.0)
64      dust_ec_glo(1)=MAX(dust_nc_glo(1,nbp_lat),0.0)
65      ig=2
66!      DO j=2,jjm
67      DO j=2,nbp_lat-1
68!         DO i = 1, iim
69         DO i = 1, nbp_lon
70c--OB=change jjp1+1-j to j here
71!           dust_ec(ig)=MAX(dust_nc(i,jjp1+1-j),0.0)
72           dust_ec_glo(ig)=MAX(dust_nc_glo(i,nbp_lat+1-j),0.0)
73           ig=ig+1
74         ENDDO
75      ENDDO
76c--OB=change second 1 to jjp1 here
77      dust_ec_glo(ig)=MAX(dust_nc_glo(1,1),0.0)
78!      end if master
79      ENDIF
80!$OMP END MASTER
81!$OMP BARRIER
82      CALL scatter(dust_ec_glo,dust_ec)
83c
84      RETURN
85      END
Note: See TracBrowser for help on using the repository browser.