1 | subroutine lwi (ig0,kdlon,kflev |
---|
2 | . ,psi,zdblay,pdp |
---|
3 | . ,newpcolc ) |
---|
4 | |
---|
5 | |
---|
6 | use dimradmars_mod, only: ndlo2, ndlon, nflev, nir |
---|
7 | use yomlw_h, only: gcp, nlaylte, xi |
---|
8 | USE comcstfi_h, ONLY: g, cpp |
---|
9 | USE time_phylmdz_mod, ONLY: dtphys |
---|
10 | implicit none |
---|
11 | |
---|
12 | #include "comg1d.h" |
---|
13 | #include "callkeys.h" |
---|
14 | |
---|
15 | CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
---|
16 | C |
---|
17 | C - lwi - |
---|
18 | C |
---|
19 | C PURPOSE: Shema semi - implicite |
---|
20 | C |
---|
21 | C |
---|
22 | CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
---|
23 | |
---|
24 | |
---|
25 | c************************************************************************ |
---|
26 | c |
---|
27 | c 0. Declarations |
---|
28 | c ------------ |
---|
29 | c |
---|
30 | c------------------------------------------------------------------------- |
---|
31 | c 0.1 Arguments |
---|
32 | c --------- |
---|
33 | c |
---|
34 | |
---|
35 | integer ig0,kdlon,kflev |
---|
36 | |
---|
37 | real psi(ndlo2,kflev) |
---|
38 | . , zdblay(ndlo2,nir,kflev) |
---|
39 | . , pdp(ndlo2,kflev) |
---|
40 | |
---|
41 | |
---|
42 | real newpcolc(ndlo2,kflev) |
---|
43 | |
---|
44 | c------------------------------------------------------------------------- |
---|
45 | c 0.2 local arrays |
---|
46 | c ------------ |
---|
47 | c |
---|
48 | real di(ndlon,nflev) |
---|
49 | . , hi(ndlon,nflev) |
---|
50 | . , bi(ndlon,nflev) |
---|
51 | |
---|
52 | real ci(ndlon,nflev) |
---|
53 | . , ai(ndlon,nflev) |
---|
54 | real deltat |
---|
55 | |
---|
56 | real semit, denom |
---|
57 | |
---|
58 | integer i, jl |
---|
59 | |
---|
60 | c************************************************************************ |
---|
61 | c |
---|
62 | c 1. Initialisations |
---|
63 | c --------------- |
---|
64 | c |
---|
65 | c----------------------------------------------------------------------- |
---|
66 | |
---|
67 | deltat = dtphys * iradia |
---|
68 | c print*,'SEMI = ',semi, '(expl:0 semi-implicite:0.5 impl:1)' |
---|
69 | semit = semi * deltat |
---|
70 | c semi = 0. |
---|
71 | |
---|
72 | c print*,'dtphys,iradia,deltat,semit:',dtphys,iradia,deltat,semit |
---|
73 | c print*,'g,cpp',g,cpp |
---|
74 | |
---|
75 | |
---|
76 | c************************************************************************ |
---|
77 | c |
---|
78 | c 2. |
---|
79 | c --------------- |
---|
80 | c |
---|
81 | c------------------------------------------------------------------------- |
---|
82 | c 2.1 Calcul des di |
---|
83 | c ------------- |
---|
84 | c |
---|
85 | |
---|
86 | |
---|
87 | do i = 1 , nlaylte-1 |
---|
88 | do jl = 1 , kdlon |
---|
89 | c ------------------- |
---|
90 | di(jl,i) = 1 + semit * (g / pdp(jl,i) / cpp) * ( |
---|
91 | . ( xi(ig0+jl,1,i,nlaylte+1) |
---|
92 | . + xi(ig0+jl,1,i,i+1) |
---|
93 | . + xi(ig0+jl,1,i,i-1) ) |
---|
94 | . * zdblay(jl,1,i) |
---|
95 | . + ( xi(ig0+jl,2,i,nlaylte+1) |
---|
96 | . + xi(ig0+jl,2,i,i+1) |
---|
97 | . + xi(ig0+jl,2,i,i-1) ) |
---|
98 | . * zdblay(jl,2,i) |
---|
99 | . ) |
---|
100 | c ------------------- |
---|
101 | enddo |
---|
102 | enddo |
---|
103 | |
---|
104 | c couche nlaylte |
---|
105 | c ------------ |
---|
106 | c , on enleve i,i+1 sinon on a 2 fois le cooling2space |
---|
107 | |
---|
108 | do jl = 1 , kdlon |
---|
109 | c ------------------- |
---|
110 | di(jl,nlaylte) = 1 + semit * (g / pdp(jl,nlaylte) / cpp) * ( |
---|
111 | . ( xi(ig0+jl,1,nlaylte,nlaylte+1) |
---|
112 | . + xi(ig0+jl,1,nlaylte,nlaylte-1) ) |
---|
113 | . * zdblay(jl,1,nlaylte) |
---|
114 | . + ( xi(ig0+jl,2,nlaylte,nlaylte+1) |
---|
115 | . + xi(ig0+jl,2,nlaylte,nlaylte-1) ) |
---|
116 | . * zdblay(jl,2,nlaylte) |
---|
117 | . ) |
---|
118 | c ------------------- |
---|
119 | enddo |
---|
120 | |
---|
121 | c------------------------------------------------------------------------- |
---|
122 | c 2.2 Calcul des hi |
---|
123 | c ------------- |
---|
124 | c |
---|
125 | |
---|
126 | do i = 1 , nlaylte-1 |
---|
127 | do jl = 1 , kdlon |
---|
128 | c ------------------- |
---|
129 | hi(jl,i) = - semit * (g / pdp(jl,i) / cpp) * |
---|
130 | . ( xi(ig0+jl,1,i,i+1) * zdblay(jl,1,i+1) |
---|
131 | . + xi(ig0+jl,2,i,i+1) * zdblay(jl,2,i+1) ) |
---|
132 | c ------------------- |
---|
133 | enddo |
---|
134 | enddo |
---|
135 | |
---|
136 | c------------------------------------------------------------------------- |
---|
137 | c 2.3 Calcul des bi |
---|
138 | c ------------- |
---|
139 | c |
---|
140 | |
---|
141 | |
---|
142 | do i = 2 , nlaylte |
---|
143 | do jl = 1 , kdlon |
---|
144 | c ------------------- |
---|
145 | bi(jl,i) = - semit * (g / pdp(jl,i) / cpp) * |
---|
146 | . ( xi(ig0+jl,1,i,i-1) * zdblay(jl,1,i-1) |
---|
147 | . + xi(ig0+jl,2,i,i-1) * zdblay(jl,2,i-1) ) |
---|
148 | c ------------------- |
---|
149 | enddo |
---|
150 | enddo |
---|
151 | |
---|
152 | |
---|
153 | c couche 1 |
---|
154 | c -------- |
---|
155 | c tant qu'on a pas un calcul propre de zdblay(0) qui tienne compte de |
---|
156 | c la discontinuite de temperature au sol , on met b1 = 0 |
---|
157 | |
---|
158 | |
---|
159 | do jl = 1 , kdlon |
---|
160 | bi(jl,1) = 0 |
---|
161 | enddo |
---|
162 | |
---|
163 | c------------------------------------------------------------------------- |
---|
164 | c 2.4 |
---|
165 | c ------------- |
---|
166 | c |
---|
167 | |
---|
168 | c couche nlaylte |
---|
169 | c ------------ |
---|
170 | |
---|
171 | do jl = 1 , kdlon |
---|
172 | c ------------------- |
---|
173 | ci(jl,nlaylte) = (gcp * psi(jl,nlaylte) / pdp(jl,nlaylte)) |
---|
174 | . / di(jl,nlaylte) |
---|
175 | |
---|
176 | ai(jl,nlaylte) = - bi(jl,nlaylte) / di(jl,nlaylte) |
---|
177 | c ------------------- |
---|
178 | enddo |
---|
179 | |
---|
180 | |
---|
181 | |
---|
182 | do i = nlaylte-1 , 1 , -1 |
---|
183 | do jl = 1 , kdlon |
---|
184 | c ------------------- |
---|
185 | denom = di(jl,i) + hi(jl,i) * ai(jl,i+1) |
---|
186 | |
---|
187 | ci(jl,i) = ( gcp * psi(jl,i) / pdp(jl,i) |
---|
188 | . - hi(jl,i) * ci(jl,i+1) ) / denom |
---|
189 | |
---|
190 | ai(jl,i) = -bi(jl,i) / denom |
---|
191 | c ------------------- |
---|
192 | enddo |
---|
193 | enddo |
---|
194 | |
---|
195 | |
---|
196 | c------------------------------------------------------------------------- |
---|
197 | c 2.5 |
---|
198 | c ------------- |
---|
199 | c |
---|
200 | |
---|
201 | c couche 1 |
---|
202 | c ------- |
---|
203 | do jl = 1 , kdlon |
---|
204 | newpcolc(jl,1) = ci(jl,1) |
---|
205 | enddo |
---|
206 | |
---|
207 | |
---|
208 | do i = 2 , nlaylte |
---|
209 | do jl = 1 , kdlon |
---|
210 | newpcolc(jl,i) = ci(jl,i) + ai(jl,i) * newpcolc(jl,i-1) |
---|
211 | enddo |
---|
212 | enddo |
---|
213 | |
---|
214 | |
---|
215 | |
---|
216 | c------------------------------------------------------------------------- |
---|
217 | RETURN |
---|
218 | END |
---|