/[lmdze]/trunk/dyn3d/grille_m.f
ViewVC logotype

Annotation of /trunk/dyn3d/grille_m.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 212 - (hide annotations)
Thu Jan 12 12:31:31 2017 UTC (7 years, 4 months ago) by guez
Original Path: trunk/Sources/dyn3d/grille_m.f
File size: 3818 byte(s)
Moved variables from module com_io_dyn to module inithist_m, where
they are defined.

Split grid_atob.f into grille_m.f and dist_sphe.f. Extracted ASCCI art
to documentation. In grille_m, use automatic arrays instead of maximum
size. In grille_m, instead of printing data for every problematic
point, print a single diagnostic message.

Removed variables top_height, overlap, lev_histhf, lev_histday,
lev_histmth, type_run, ok_isccp, ok_regdyn, lonmin_ins, lonmax_ins,
latmin_ins, latmax_ins of module clesphys, not used.

Removed variable itap of module histwrite_phy_m, not used. There is a
variable itap in module time_phylmdz.

Added output of tro3.

In physiq, no need to compute wo at every time-step, since we only use
it in radlwsw.

1 guez 212 module grille_m_m
2 guez 3
3 guez 212 ! From grid_atob.F, v 1.1.1.1, 2004/05/19 12:53:05
4 guez 3
5     IMPLICIT none
6    
7     contains
8    
9 guez 15 function grille_m(xdata, ydata, entree, x, y)
10 guez 3
11 guez 212 ! Z. X. Li (1er avril 1994) (voir aussi A. Harzallah et L. Fairhead)
12 guez 3
13 guez 212 ! M\'ethode na\"ive pour transformer un champ d'une grille fine \`a une
14     ! grille grossi\`ere. Je consid\`ere que les nouveaux points occupent
15     ! une zone adjacente qui comprend un ou plusieurs anciens points.
16 guez 3
17 guez 212 ! Aucune pond\'eration n'est consid\'er\'ee (voir
18     ! grille_p). Cf. grille_m.txt.
19 guez 3
20 guez 212 use dist_sphe_m, only: dist_sphe
21 guez 36 use nr_util, only: assert_eq
22 guez 3
23 guez 212 ! Coordonn\'ees :
24     REAL, intent(in):: xdata(:) ! (imdep)
25     REAL, intent(in):: ydata(:) ! (jmdep)
26 guez 3
27 guez 212 REAL, intent(in):: entree(:, :) ! (imdep, jmdep) champ \`a transformer
28 guez 3
29 guez 212 ! Coordonn\'ees :
30     REAL, intent(in):: x(:) ! (imar)
31     REAL, intent(in):: y(:) ! (jmar)
32    
33     real grille_m(size(x), size(y)) ! (imar, jmar) champ transform\'e
34    
35     ! Local:
36 guez 3 INTEGER imdep, jmdep, imar, jmar
37     INTEGER i, j, ii, jj
38 guez 212 REAL a(size(x)), b(size(x)) ! (imar)
39     real c(size(y)), d(size(y)) ! (jmar)
40     REAL number(size(x), size(y)) ! (imar, jmar)
41     REAL distans(size(xdata) * size(ydata)) ! (imdep * jmdep)
42 guez 3 INTEGER i_proche, j_proche, ij_proche
43     REAL zzmin
44    
45     !-------------------------
46    
47     print *, "Call sequence information: grille_m"
48    
49     imdep = assert_eq(size(xdata), size(entree, 1), "grille_m")
50     jmdep = assert_eq(size(ydata), size(entree, 2), "grille_m")
51     imar = size(x)
52     jmar = size(y)
53    
54     ! Calculer les limites des zones des nouveaux points
55    
56     a(1) = x(1) - (x(2)-x(1))/2.0
57     b(1) = (x(1)+x(2))/2.0
58     DO i = 2, imar-1
59     a(i) = b(i-1)
60     b(i) = (x(i)+x(i+1))/2.0
61     ENDDO
62     a(imar) = b(imar-1)
63     b(imar) = x(imar) + (x(imar)-x(imar-1))/2.0
64    
65     c(1) = y(1) - (y(2)-y(1))/2.0
66     d(1) = (y(1)+y(2))/2.0
67     DO j = 2, jmar-1
68     c(j) = d(j-1)
69     d(j) = (y(j)+y(j+1))/2.0
70     ENDDO
71     c(jmar) = d(jmar-1)
72     d(jmar) = y(jmar) + (y(jmar)-y(jmar-1))/2.0
73    
74     DO i = 1, imar
75     DO j = 1, jmar
76 guez 212 number(i, j) = 0.0
77     grille_m(i, j) = 0.0
78 guez 3 ENDDO
79     ENDDO
80    
81     ! Determiner la zone sur laquelle chaque ancien point se trouve
82    
83     DO ii = 1, imar
84     DO jj = 1, jmar
85     DO i = 1, imdep
86 guez 212 IF((xdata(i)-a(ii) >= 1.e-5.AND.xdata(i)-b(ii) <= 1.e-5).OR. &
87     (xdata(i)-a(ii) <= 1.e-5.AND.xdata(i)-b(ii) >= 1.e-5)) &
88 guez 3 THEN
89     DO j = 1, jmdep
90 guez 212 IF((ydata(j)-c(jj) >= 1.e-5.AND.ydata(j)-d(jj) <= 1.e-5) &
91 guez 3 .OR. (ydata(j)-c(jj) <= 1.e-5 .AND. &
92     ydata(j)-d(jj) >= 1.e-5)) THEN
93 guez 212 number(ii, jj) = number(ii, jj) + 1.0
94     grille_m(ii, jj) = grille_m(ii, jj) + entree(i, j)
95 guez 3 ENDIF
96     ENDDO
97     ENDIF
98     ENDDO
99     ENDDO
100     ENDDO
101    
102     DO i = 1, imar
103     DO j = 1, jmar
104 guez 212 IF (number(i, j) > 0.001) THEN
105     grille_m(i, j) = grille_m(i, j) / number(i, j)
106 guez 3 ELSE
107 guez 212 ! Si aucun ancien point ne tombe sur une zone, c'est un probl\`eme
108     CALL dist_sphe(x(i), y(j), xdata, ydata, imdep, jmdep, distans)
109 guez 3 ij_proche = 1
110     zzmin = distans(ij_proche)
111     DO ii = 2, imdep*jmdep
112 guez 212 IF (distans(ii) < zzmin) THEN
113 guez 3 zzmin = distans(ii)
114     ij_proche = ii
115     ENDIF
116     ENDDO
117     j_proche = (ij_proche-1)/imdep + 1
118     i_proche = ij_proche - (j_proche-1)*imdep
119 guez 212 grille_m(i, j) = entree(i_proche, j_proche)
120 guez 3 ENDIF
121     ENDDO
122     ENDDO
123    
124 guez 212 if (any(number <= 0.001)) print *, "problem in grille_m"
125    
126 guez 3 END function grille_m
127    
128 guez 212 end module grille_m_m

  ViewVC Help
Powered by ViewVC 1.1.21