1 | subroutine lwi(nl,netrad,deltapsi,deltap,temp,coolrate) |
---|
2 | |
---|
3 | use dimphy |
---|
4 | use cpdet_mod, only: cpdet |
---|
5 | implicit none |
---|
6 | |
---|
7 | |
---|
8 | #include "dimensions.h" |
---|
9 | #include "YOMCST.h" |
---|
10 | #include "timerad.h" |
---|
11 | |
---|
12 | CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
---|
13 | C |
---|
14 | C - lwi - |
---|
15 | C |
---|
16 | C PURPOSE: Schema semi - implicite |
---|
17 | C |
---|
18 | C |
---|
19 | CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
---|
20 | |
---|
21 | |
---|
22 | c************************************************************************ |
---|
23 | c |
---|
24 | c 0. Declarations |
---|
25 | c ------------ |
---|
26 | c |
---|
27 | c------------------------------------------------------------------------- |
---|
28 | c 0.1 Arguments |
---|
29 | c --------- |
---|
30 | c Inputs |
---|
31 | c....... |
---|
32 | |
---|
33 | integer nl |
---|
34 | real deltapsi(0:nl+1,0:nl+1) ! Dpsi/DT = sum(nu)[ksi DB/DT] |
---|
35 | real netrad(0:nl) ! radiative budget (W/m**2) |
---|
36 | real deltap(nl) !epaisseur de la couche en pression (Pa) |
---|
37 | ! ADAPTATION GCM POUR CP(T) |
---|
38 | real temp(nl) !temperature de la couche |
---|
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 | c semi = 0.5 |
---|
73 | 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) = |
---|
90 | . ( deltapsi(i,nl+1) |
---|
91 | . + deltapsi(i,i+1) |
---|
92 | . + deltapsi(i,i-1) ) |
---|
93 | |
---|
94 | di(i) = 1. + semit * (RG/deltap(i)/cpdet(temp(i))) * spec(i) |
---|
95 | c print*,i,' di(i)=',di(i) |
---|
96 | enddo |
---|
97 | |
---|
98 | |
---|
99 | c couche nl |
---|
100 | c ------------ |
---|
101 | c , on enleve i,i+1 sinon on a 2 fois le cooling2space |
---|
102 | |
---|
103 | spec(nl) = |
---|
104 | . ( deltapsi(nl,nl+1) |
---|
105 | . + deltapsi(nl,nl-1) ) |
---|
106 | |
---|
107 | di(nl) = 1. + semit * (RG/deltap(nl)/cpdet(temp(nl)))*spec(nl) |
---|
108 | |
---|
109 | c------------------------------------------------------------------------- |
---|
110 | c 2.2 Calcul des hi |
---|
111 | c ------------- |
---|
112 | c |
---|
113 | |
---|
114 | do i = 1 , nl-1 |
---|
115 | |
---|
116 | spec(i) = deltapsi(i+1,i) |
---|
117 | |
---|
118 | hi(i) = - semit * (RG/deltap(i)/cpdet(temp(i))) * spec(i) |
---|
119 | |
---|
120 | enddo |
---|
121 | |
---|
122 | c print*,'hi(i)',hi(i) |
---|
123 | |
---|
124 | c------------------------------------------------------------------------- |
---|
125 | c 2.3 Calcul des bi |
---|
126 | c ------------- |
---|
127 | c |
---|
128 | |
---|
129 | |
---|
130 | do i = 2 , nl |
---|
131 | |
---|
132 | spec(i) = deltapsi(i-1,i) |
---|
133 | |
---|
134 | bi(i) = - semit * (RG/deltap(i)/cpdet(temp(i))) * spec(i) |
---|
135 | |
---|
136 | enddo |
---|
137 | |
---|
138 | c print*,'bi(i)',bi(i) |
---|
139 | |
---|
140 | c couche 1 |
---|
141 | c -------- |
---|
142 | c tant qu'on a pas un calcul propre de deltab(0) qui tienne compte de |
---|
143 | c la discontinuite de temperature au sol , on met b1 = 0 |
---|
144 | |
---|
145 | |
---|
146 | bi(1) = 0 |
---|
147 | |
---|
148 | c------------------------------------------------------------------------- |
---|
149 | c 2.4 |
---|
150 | c ------------- |
---|
151 | c |
---|
152 | |
---|
153 | c couche nl |
---|
154 | c ------------ |
---|
155 | |
---|
156 | c ci(nl) = ((RG/CP) * netrad(nl) / deltap(nl)) |
---|
157 | c . / di(nl) |
---|
158 | ci(nl) = netrad(nl) *RG/cpdet(temp(nl)) / deltap(nl) |
---|
159 | |
---|
160 | ai(nl) = - bi(nl) / di(nl) |
---|
161 | |
---|
162 | do i = nl-1 , 1 , -1 |
---|
163 | denom = di(i) + hi(i) * ai(i+1) |
---|
164 | |
---|
165 | c ci(i) = ( (RG/CP) * netrad(i) / deltap(i) |
---|
166 | c . - hi(i) * ci(i+1) ) / denom |
---|
167 | ci(i) = netrad(i) *RG/cpdet(temp(i)) / deltap(i) |
---|
168 | |
---|
169 | ai(i) = -bi(i) / denom |
---|
170 | enddo |
---|
171 | |
---|
172 | c------------------------------------------------------------------------- |
---|
173 | c 2.5 |
---|
174 | c ------------- |
---|
175 | c |
---|
176 | |
---|
177 | coolrate(1) = ci(1) |
---|
178 | |
---|
179 | do i = 2 , nl |
---|
180 | coolrate(i) = ci(i) + ai(i) * coolrate(i-1) |
---|
181 | c print*,i,' coolrate(i)=',coolrate(i) |
---|
182 | enddo |
---|
183 | |
---|
184 | c------------------------------------------------------------------------- |
---|
185 | |
---|
186 | RETURN |
---|
187 | END |
---|