source: LMDZ6/branches/Amaury_dev/libf/phylmd/Dust/read_vent.f90 @ 5182

Last change on this file since 5182 was 5160, checked in by abarral, 3 months ago

Put .h into modules

File size: 3.5 KB
Line 
1SUBROUTINE read_vent(debutphy, step, nbjour, u10m_ec, v10m_ec)
2  USE dimphy
3  USE lmdz_grid_phy
4  USE lmdz_phys_para
5  USE netcdf, ONLY: nf90_get_var, nf90_open, nf90_inq_varid, nf90_nowrite
6USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm
7  USE lmdz_paramet
8  IMPLICIT NONE
9
10
11
12  INTEGER :: step, nbjour
13  LOGICAL :: debutphy
14  REAL :: u10m_ec(klon), v10m_ec(klon)
15  REAL :: u10m_ec_glo(klon_glo), v10m_ec_glo(klon_glo)
16
17  !  real u10m_nc(iip1,jjp1) !, v10m_nc(iip1,jjm) ! dim 97x72
18  !  real v10m_nc(iip1,jjp1)  ! dim 97x73
19  REAL :: u10m_nc_glo(nbp_lon + 1, nbp_lat) !, v10m_nc(iip1,jjm) ! dim 97x72
20  REAL :: v10m_nc_glo(nbp_lon + 1, nbp_lat)  ! dim 97x73
21  INTEGER :: rcode
22  INTEGER :: ncidu1, varidu1, ncidv1, varidv1
23  save ncidu1, varidu1, ncidv1, varidv1
24  !$OMP THREADPRIVATE(ncidu1, varidu1, ncidv1, varidv1)
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      ncidu1 = nf90_open('u10m.nc', nf90_nowrite, rcode)
32      varidu1 = nf90_inq_varid(ncidu1, 'U10M', rcode)
33      ncidv1 = nf90_open('v10m.nc', nf90_nowrite, rcode)
34      varidv1 = nf90_inq_varid(ncidv1, 'V10M', rcode)
35
36    endif
37
38    start(1) = 1
39    start(2) = 1
40    start(4) = 0
41
42    ! count(1)=iip1
43    count(1) = nbp_lon + 1
44    ! count(2)=jjp1
45    count(2) = nbp_lat
46    count(3) = 1
47    count(4) = 0
48
49    start(3) = step
50
51    status = nf90_get_var(ncidu1, varidu1, u10m_nc_glo, start, count)
52
53    status = nf90_get_var(ncidv1, varidv1, v10m_nc_glo, start, count)
54
55
56    ! PRINT *,'beforebidcor u10m_nc', u10m_nc(1,jjp1)
57    ! PRINT *,'beforebidcor v10m_nc', v10m_nc(1,jjp1)
58
59    !  PRINT *,status
60    ! CALL correctbid(iim,jjp1,u10m_nc)
61    ! CALL correctbid(iim,jjp1,v10m_nc)
62    CALL correctbid(nbp_lon, nbp_lat, u10m_nc_glo)
63    CALL correctbid(nbp_lon, nbp_lat, v10m_nc_glo)
64
65    ! PRINT *,'afterbidcor u10m_nc', u10m_nc(1,jjp1)
66    ! PRINT *,'afterbidcor v10m_nc', v10m_nc(1,jjp1)
67
68    !--upside down + physical grid
69
70    !  u10m_ec(1)=u10m_nc(1,jjp1)
71    !  v10m_ec(1)=v10m_nc(1,jjp1)
72    u10m_ec_glo(1) = u10m_nc_glo(1, nbp_lat)
73    v10m_ec_glo(1) = v10m_nc_glo(1, nbp_lat)
74    ig = 2
75    ! DO j=2,jjm
76    !    DO i = 1, iim
77    DO j = 2, nbp_lat - 1
78      DO i = 1, nbp_lon
79        ! u10m_ec(ig)=u10m_nc(i,jjp1+1-j)
80        ! v10m_ec(ig)=v10m_nc(i,jjp1+1-j)
81        u10m_ec_glo(ig) = u10m_nc_glo(i, nbp_lat + 1 - j)
82        v10m_ec_glo(ig) = v10m_nc_glo(i, nbp_lat + 1 - j)
83        ig = ig + 1
84        ! PRINT *,u10m_ec(ig) ,v10m_ec(ig)
85      ENDDO
86    ENDDO
87    u10m_ec_glo(ig) = u10m_nc_glo(1, 1)
88    v10m_ec_glo(ig) = v10m_nc_glo(1, 1)
89
90
91    ! end if master
92  ENDIF
93  !$OMP END MASTER
94  !$OMP BARRIER
95  CALL scatter(u10m_ec_glo, u10m_ec)
96  CALL scatter(v10m_ec_glo, v10m_ec)
97
98  ! PRINT *,'JE  tamagno viento ig= ', ig
99  ! PRINT *,'READ_VENT U = ',SUM(u10m_ec),MINVAL(u10m_ec),
100  ! .                                      MAXVAL(u10m_ec)
101  !  PRINT *,'READ_VENT V = ',SUM(v10m_ec),MINVAL(v10m_ec),
102  ! .                                      MAXVAL(v10m_ec)
103  !   PRINT *,'u v 1 ', u10m_ec(1),v10m_ec(1)
104  !   PRINT *,'u v klon ', u10m_ec(klon),v10m_ec(klon)
105
106END SUBROUTINE read_vent
107
108! added by JE from the nh SPLA, dyn3d/read_reanalyse.F which is not available any more
109SUBROUTINE correctbid(iim, nl, x)
110  INTEGER :: iim, nl
111  REAL :: x(iim + 1, nl)
112  INTEGER :: i, l
113  REAL :: zz
114
115  DO l = 1, nl
116    DO i = 2, iim - 1
117      IF(abs(x(i, l))>1.e10) THEN
118        zz = 0.5 * (x(i - 1, l) + x(i + 1, l))
119        ! PRINT*,'correction ',i,l,x(i,l),zz
120        x(i, l) = zz
121      endif
122    enddo
123  enddo
124
125
126END SUBROUTINE  correctbid
127
128
129
Note: See TracBrowser for help on using the repository browser.