source: LMDZ6/branches/Amaury_dev/libf/phylmd/Dust/read_vent.F @ 5088

Last change on this file since 5088 was 5088, checked in by abarral, 4 months ago

Remove all managed netcdf77 usage (excluding external: rrtm, ecrad)
Remove call to netcdf.inc
Replace USE lmdz_netcdf by USE netcdf
Replace lmdz_netcdf.F90 by lmdz_netcdf_format.F90

File size: 3.6 KB
Line 
1      SUBROUTINE read_vent(debutphy, step, nbjour, u10m_ec, v10m_ec)
2      USE dimphy
3      USE mod_grid_phy_lmdz
4      USE mod_phys_lmdz_para
5      USE netcdf, ONLY: nf90_get_var
6!      USE write_field_phy
7      IMPLICIT NONE
8      INCLUDE "dimensions.h"
9c       INCLUDE "dimphy.h"
10      INCLUDE "paramet.h"
11c
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)
16c
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      real 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
29c
30!$OMP MASTER
31      IF (is_mpi_root .AND. is_omp_root) THEN
32      if (debutphy) then
33c
34         ncidu1=NCOPN('u10m.nc',NCNOWRIT,rcode)
35         varidu1=NCVID(ncidu1,'U10M',rcode)
36         ncidv1=NCOPN('v10m.nc',NCNOWRIT,rcode)
37         varidv1=NCVID(ncidv1,'V10M',rcode)
38c
39      endif
40c
41      start(1)=1
42      start(2)=1
43      start(4)=0
44
45!      count(1)=iip1
46      count(1)=nbp_lon+1
47!      count(2)=jjp1
48      count(2)=nbp_lat
49      count(3)=1
50      count(4)=0
51c
52      start(3)=step
53
54      status=nf90_get_var(ncidu1,varidu1,u10m_nc_glo,start,count)
55
56      status=nf90_get_var(ncidv1,varidv1,v10m_nc_glo,start,count)
57
58
59!      print *,'beforebidcor u10m_nc', u10m_nc(1,jjp1)
60!      print *,'beforebidcor v10m_nc', v10m_nc(1,jjp1)
61
62!       print *,status
63!      call correctbid(iim,jjp1,u10m_nc)
64!      call correctbid(iim,jjp1,v10m_nc)
65      call correctbid(nbp_lon,nbp_lat,u10m_nc_glo)
66      call correctbid(nbp_lon,nbp_lat,v10m_nc_glo)
67
68!      print *,'afterbidcor u10m_nc', u10m_nc(1,jjp1)
69!      print *,'afterbidcor v10m_nc', v10m_nc(1,jjp1)
70c
71c--upside down + physical grid
72c
73!      u10m_ec(1)=u10m_nc(1,jjp1)
74!      v10m_ec(1)=v10m_nc(1,jjp1)
75      u10m_ec_glo(1)=u10m_nc_glo(1,nbp_lat)
76      v10m_ec_glo(1)=v10m_nc_glo(1,nbp_lat)
77      ig=2
78!      DO j=2,jjm
79!         DO i = 1, iim
80      DO j=2,nbp_lat-1
81         DO i = 1, nbp_lon
82!           u10m_ec(ig)=u10m_nc(i,jjp1+1-j)
83!           v10m_ec(ig)=v10m_nc(i,jjp1+1-j)
84           u10m_ec_glo(ig)=u10m_nc_glo(i,nbp_lat+1-j)
85           v10m_ec_glo(ig)=v10m_nc_glo(i,nbp_lat+1-j)
86           ig=ig+1
87!         print *,u10m_ec(ig) ,v10m_ec(ig)
88         ENDDO
89      ENDDO
90      u10m_ec_glo(ig)=u10m_nc_glo(1,1)
91      v10m_ec_glo(ig)=v10m_nc_glo(1,1)
92
93
94!      end if master
95      ENDIF
96!$OMP END MASTER
97!$OMP BARRIER
98      CALL scatter(u10m_ec_glo,u10m_ec)
99      CALL scatter(v10m_ec_glo,v10m_ec)
100
101!      print *,'JE  tamagno viento ig= ', ig
102!      print *,'READ_VENT U = ',SUM(u10m_ec),MINVAL(u10m_ec),
103!     .                                      MAXVAL(u10m_ec)
104!      print *,'READ_VENT V = ',SUM(v10m_ec),MINVAL(v10m_ec),
105!     .                                      MAXVAL(v10m_ec)
106!       print *,'u v 1 ', u10m_ec(1),v10m_ec(1)
107!       print *,'u v klon ', u10m_ec(klon),v10m_ec(klon)
108      RETURN
109      END
110
111c added by JE from the nh SPLA, dyn3d/read_reanalyse.F which is not available any more
112      subroutine correctbid(iim,nl,x)
113      integer iim,nl
114      real x(iim+1,nl)
115      integer i,l
116      real zz
117
118      do l=1,nl
119         do i=2,iim-1
120            if(abs(x(i,l))>1.e10) then
121               zz=0.5*(x(i-1,l)+x(i+1,l))
122c              print*,'correction ',i,l,x(i,l),zz
123               x(i,l)=zz
124            endif
125         enddo
126      enddo
127
128      return
129      end
130
131
132
Note: See TracBrowser for help on using the repository browser.