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 |
---|
6 | c |
---|
7 | #include "dimensions.h" |
---|
8 | #include "paramet.h" |
---|
9 | #include "netcdf.inc" |
---|
10 | c |
---|
11 | INTEGER step, nbjour |
---|
12 | LOGICAL debutphy |
---|
13 | real dust_ec(klon) |
---|
14 | real dust_ec_glo(klon_glo) |
---|
15 | c |
---|
16 | 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 |
---|
25 | c |
---|
26 | !$OMP MASTER |
---|
27 | IF (is_mpi_root .AND. is_omp_root) THEN |
---|
28 | if (debutphy) then |
---|
29 | c |
---|
30 | ncid1=NCOPN('dust.nc',NCNOWRIT,rcode) |
---|
31 | varid1=NCVID(ncid1,'EMISSION',rcode) |
---|
32 | c |
---|
33 | endif |
---|
34 | c |
---|
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 |
---|
45 | c |
---|
46 | start(3)=step |
---|
47 | c |
---|
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 |
---|
55 | c |
---|
56 | ! call correctbid(iim,jjp1,dust_nc) |
---|
57 | call correctbid(nbp_lon,nbp_lat,dust_nc_glo) |
---|
58 | c |
---|
59 | c--upside down + physical grid |
---|
60 | c |
---|
61 | c--OB=change jjp1 to 1 here |
---|
62 | ! dust_ec(1)=MAX(dust_nc(1,jjp1),0.0) |
---|
63 | dust_ec(1)=MAX(dust_nc(1,nbp_lat),0.0) |
---|
64 | ig=2 |
---|
65 | ! DO j=2,jjm |
---|
66 | DO j=2,nbp_lat-1 |
---|
67 | ! DO i = 1, iim |
---|
68 | DO i = 1, nbp_lon |
---|
69 | c--OB=change jjp1+1-j to j here |
---|
70 | ! dust_ec(ig)=MAX(dust_nc(i,jjp1+1-j),0.0) |
---|
71 | dust_ec_glo(ig)=MAX(dust_nc_glo(i,nbp_lat+1-j),0.0) |
---|
72 | ig=ig+1 |
---|
73 | ENDDO |
---|
74 | ENDDO |
---|
75 | c--OB=change second 1 to jjp1 here |
---|
76 | dust_ec_glo(ig)=MAX(dust_nc_glo(1,1),0.0) |
---|
77 | ! end if master |
---|
78 | ENDIF |
---|
79 | !$OMP END MASTER |
---|
80 | !$OMP BARRIER |
---|
81 | CALL scatter(dust_ec_glo,dust_ec) |
---|
82 | c |
---|
83 | RETURN |
---|
84 | END |
---|