1 | subroutine lwi(nl,nnu,netrad,deltab,deltap,ksi,coolrate) |
---|
2 | |
---|
3 | |
---|
4 | implicit none |
---|
5 | |
---|
6 | |
---|
7 | #include "dimensions.h" |
---|
8 | #include "dimphy.h" |
---|
9 | #include "comg1d.h" !pour grads 1D |
---|
10 | #include "YOMCST.h" |
---|
11 | #include "timerad.h" |
---|
12 | |
---|
13 | CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
---|
14 | C |
---|
15 | C - lwi - |
---|
16 | C |
---|
17 | C PURPOSE: Schema semi - implicite |
---|
18 | C |
---|
19 | C |
---|
20 | CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
---|
21 | |
---|
22 | |
---|
23 | c************************************************************************ |
---|
24 | c |
---|
25 | c 0. Declarations |
---|
26 | c ------------ |
---|
27 | c |
---|
28 | c------------------------------------------------------------------------- |
---|
29 | c 0.1 Arguments |
---|
30 | c --------- |
---|
31 | c Inputs |
---|
32 | c....... |
---|
33 | |
---|
34 | integer nl,nnu |
---|
35 | real ksi(0:nl+1,0:nl+1,nnu) !ksi factors |
---|
36 | real netrad(0:nl) ! radiative budget (W/m**2) |
---|
37 | real deltab(nl,nnu) !gradient de fonction de Planck |
---|
38 | real deltap(nl) !epaisseur de la couche en pression (Pa) |
---|
39 | |
---|
40 | c Outputs |
---|
41 | c........ |
---|
42 | |
---|
43 | real coolrate(nl) |
---|
44 | |
---|
45 | c------------------------------------------------------------------------- |
---|
46 | c 0.2 local arrays |
---|
47 | c ------------ |
---|
48 | c |
---|
49 | real di(nl) |
---|
50 | . , spec(nl) |
---|
51 | . , hi(nl) |
---|
52 | . , bi(nl) |
---|
53 | |
---|
54 | real ci(nl) |
---|
55 | . , ai(nl) |
---|
56 | |
---|
57 | real deltat |
---|
58 | |
---|
59 | real semi,semit,denom |
---|
60 | |
---|
61 | integer i,jl,band |
---|
62 | |
---|
63 | c************************************************************************ |
---|
64 | c |
---|
65 | c 1. Initialisations |
---|
66 | c --------------- |
---|
67 | c |
---|
68 | c----------------------------------------------------------------------- |
---|
69 | deltat = dtimerad |
---|
70 | c print*,'SEMI = ',semi, '(expl:0 semi-implicite:0.5 impl:1)' |
---|
71 | c semi = 0.5 |
---|
72 | semi = 0.5 |
---|
73 | c semi = 1. |
---|
74 | semit = semi * deltat |
---|
75 | |
---|
76 | c print*,'dtimerad,deltat,semit:',dtimerad,deltat,semit |
---|
77 | |
---|
78 | c************************************************************************ |
---|
79 | c |
---|
80 | c 2. |
---|
81 | c --------------- |
---|
82 | c |
---|
83 | c------------------------------------------------------------------------- |
---|
84 | c 2.1 Calcul des di |
---|
85 | c ------------- |
---|
86 | c |
---|
87 | |
---|
88 | do i = 1 , nl-1 |
---|
89 | spec(i) = 0.0e0 |
---|
90 | do band = 1, nnu |
---|
91 | spec(i) = spec(i) + |
---|
92 | . ( ksi(i,nl+1,band) |
---|
93 | . + ksi(i,i+1,band) |
---|
94 | . + ksi(i,i-1,band) ) * deltab(i,band) |
---|
95 | enddo |
---|
96 | |
---|
97 | di(i) = 1. + semit * (RG / deltap(i) / RCPD) * spec(i) |
---|
98 | c print*,i,' di(i)=',di(i) |
---|
99 | enddo |
---|
100 | |
---|
101 | |
---|
102 | c couche nl |
---|
103 | c ------------ |
---|
104 | c , on enleve i,i+1 sinon on a 2 fois le cooling2space |
---|
105 | |
---|
106 | spec(nl) = 0.0e0 |
---|
107 | do band = 1, nnu |
---|
108 | spec(nl) = spec(nl) + |
---|
109 | . ( ksi(nl,nl+1,band) |
---|
110 | . + ksi(nl,nl-1,band) ) * deltab(nl,band) |
---|
111 | enddo |
---|
112 | |
---|
113 | di(nl) = 1. + semit * (RG / deltap(nl) / RCPD) * spec(nl) |
---|
114 | |
---|
115 | c------------------------------------------------------------------------- |
---|
116 | c 2.2 Calcul des hi |
---|
117 | c ------------- |
---|
118 | c |
---|
119 | |
---|
120 | do i = 1 , nl-1 |
---|
121 | |
---|
122 | spec(i) = 0.0e0 |
---|
123 | do band = 1, nnu |
---|
124 | spec(i) = spec(i) + ksi(i,i+1,band) * deltab(i+1,band) |
---|
125 | enddo |
---|
126 | |
---|
127 | hi(i) = - semit * (RG / deltap(i) / RCPD) * spec(i) |
---|
128 | |
---|
129 | enddo |
---|
130 | |
---|
131 | c print*,'hi(i)',hi(i) |
---|
132 | |
---|
133 | c------------------------------------------------------------------------- |
---|
134 | c 2.3 Calcul des bi |
---|
135 | c ------------- |
---|
136 | c |
---|
137 | |
---|
138 | |
---|
139 | do i = 2 , nl |
---|
140 | |
---|
141 | spec(i) = 0.0e0 |
---|
142 | do band = 1, nnu |
---|
143 | spec(i) = spec(i) + ksi(i,i-1,band) * deltab(i-1,band) |
---|
144 | enddo |
---|
145 | |
---|
146 | bi(i) = - semit * (RG / deltap(i) / RCPD) * spec(i) |
---|
147 | |
---|
148 | enddo |
---|
149 | |
---|
150 | c print*,'bi(i)',bi(i) |
---|
151 | |
---|
152 | c couche 1 |
---|
153 | c -------- |
---|
154 | c tant qu'on a pas un calcul propre de deltab(0) qui tienne compte de |
---|
155 | c la discontinuite de temperature au sol , on met b1 = 0 |
---|
156 | |
---|
157 | |
---|
158 | bi(1) = 0 |
---|
159 | |
---|
160 | c------------------------------------------------------------------------- |
---|
161 | c 2.4 |
---|
162 | c ------------- |
---|
163 | c |
---|
164 | |
---|
165 | c couche nl |
---|
166 | c ------------ |
---|
167 | |
---|
168 | c ci(nl) = ((RG/RCPD) * netrad(nl) / deltap(nl)) |
---|
169 | c . / di(nl) |
---|
170 | ci(nl) = netrad(nl) *RG/RCPD / deltap(nl) |
---|
171 | |
---|
172 | ai(nl) = - bi(nl) / di(nl) |
---|
173 | |
---|
174 | do i = nl-1 , 1 , -1 |
---|
175 | denom = di(i) + hi(i) * ai(i+1) |
---|
176 | |
---|
177 | c ci(i) = ( (RG/RCPD) * netrad(i) / deltap(i) |
---|
178 | c . - hi(i) * ci(i+1) ) / denom |
---|
179 | ci(i) = netrad(i) *RG/RCPD / deltap(i) |
---|
180 | |
---|
181 | ai(i) = -bi(i) / denom |
---|
182 | enddo |
---|
183 | |
---|
184 | c------------------------------------------------------------------------- |
---|
185 | c 2.5 |
---|
186 | c ------------- |
---|
187 | c |
---|
188 | |
---|
189 | coolrate(1) = ci(1) |
---|
190 | |
---|
191 | do i = 2 , nl |
---|
192 | coolrate(i) = ci(i) + ai(i) * coolrate(i-1) |
---|
193 | c print*,i,' coolrate(i)=',coolrate(i) |
---|
194 | enddo |
---|
195 | |
---|
196 | c------------------------------------------------------------------------- |
---|
197 | |
---|
198 | RETURN |
---|
199 | END |
---|