[5246] | 1 | SUBROUTINE read_dust(debutphy, step, nbjour, dust_ec) |
---|
| 2 | USE dimphy |
---|
| 3 | USE mod_grid_phy_lmdz |
---|
| 4 | USE mod_phys_lmdz_para |
---|
[5270] | 5 | USE netcdf, ONLY: nf90_get_var, nf90_nowrite, nf90_open, nf90_inq_varid |
---|
[5337] | 6 | !!USE paramet_mod_h |
---|
[5271] | 7 | IMPLICIT NONE |
---|
[5246] | 8 | ! |
---|
[5271] | 9 | |
---|
[5272] | 10 | |
---|
[5246] | 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) |
---|
[5270] | 19 | INTEGER :: ncid1, varid1, ncid2, varid2, rcode |
---|
[2630] | 20 | |
---|
[5246] | 21 | save ncid1, varid1, ncid2, varid2 |
---|
[2630] | 22 | !$OMP THREADPRIVATE(ncid1, varid1, ncid2, varid2) |
---|
[5246] | 23 | integer :: start(4),count(4), status |
---|
| 24 | integer :: i, j, ig |
---|
| 25 | ! |
---|
[2630] | 26 | !$OMP MASTER |
---|
[5246] | 27 | IF (is_mpi_root .AND. is_omp_root) THEN |
---|
| 28 | if (debutphy) then |
---|
| 29 | ! |
---|
[5270] | 30 | ncid1=nf90_open('dust.nc',nf90_nowrite,rcode) |
---|
| 31 | varid1=nf90_inq_varid(ncid1,'EMISSION',rcode) |
---|
[5246] | 32 | ! |
---|
| 33 | endif |
---|
| 34 | ! |
---|
| 35 | start(1)=1 |
---|
| 36 | start(2)=1 |
---|
| 37 | start(4)=0 |
---|
[2630] | 38 | |
---|
[5246] | 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 | ! |
---|
| 46 | start(3)=step |
---|
| 47 | ! |
---|
[5249] | 48 | status = nf90_get_var(ncid1, varid1, dust_nc_glo, start, count) |
---|
| 49 | |
---|
[5246] | 50 | ! |
---|
| 51 | call correctbid(nbp_lon,nbp_lat,dust_nc_glo) |
---|
| 52 | ! |
---|
| 53 | !--upside down + physical grid |
---|
| 54 | ! |
---|
| 55 | !--OB=change jjp1 to 1 here ; |
---|
| 56 | !----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, nbp_lon |
---|
| 63 | !--OB=change jjp1+1-j to j here |
---|
| 64 | ! dust_ec(ig)=MAX(dust_nc(i,jjp1+1-j),0.0) |
---|
| 65 | dust_ec_glo(ig)=MAX(dust_nc_glo(i,nbp_lat+1-j),0.0) |
---|
| 66 | ig=ig+1 |
---|
| 67 | ENDDO |
---|
| 68 | ENDDO |
---|
| 69 | !--OB=change second 1 to jjp1 here |
---|
| 70 | dust_ec_glo(ig)=MAX(dust_nc_glo(1,1),0.0) |
---|
| 71 | ! end if master |
---|
| 72 | ENDIF |
---|
[2630] | 73 | !$OMP END MASTER |
---|
| 74 | !$OMP BARRIER |
---|
[5246] | 75 | CALL scatter(dust_ec_glo,dust_ec) |
---|
| 76 | ! |
---|
| 77 | RETURN |
---|
| 78 | END SUBROUTINE read_dust |
---|