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