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