source: LMDZ6/trunk/libf/phylmd/Dust/read_dust.f90

Last change on this file was 5272, checked in by abarral, 33 hours ago

Turn paramet.h into a module

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