[2630] | 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 |
---|
[4743] | 7 | INCLUDE "dimensions.h" |
---|
| 8 | INCLUDE "paramet.h" |
---|
| 9 | INCLUDE "netcdf.inc" |
---|
[2630] | 10 | c |
---|
| 11 | INTEGER step, nbjour |
---|
| 12 | LOGICAL debutphy |
---|
| 13 | real dust_ec(klon) |
---|
| 14 | real dust_ec_glo(klon_glo) |
---|
| 15 | c |
---|
[3786] | 16 | c as real dust_nc(iip1,jjp1) |
---|
[2630] | 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 |
---|
[3786] | 61 | c--OB=change jjp1 to 1 here ; |
---|
| 62 | c----AS: OB's change is needed if lats N to S (90 to -90) in dust.nc |
---|
[2630] | 63 | ! dust_ec(1)=MAX(dust_nc(1,jjp1),0.0) |
---|
[3786] | 64 | dust_ec_glo(1)=MAX(dust_nc_glo(1,nbp_lat),0.0) |
---|
[2630] | 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 |
---|
| 70 | c--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 |
---|
| 76 | c--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) |
---|
| 83 | c |
---|
| 84 | RETURN |
---|
| 85 | END |
---|