1 | SUBROUTINE DSOLVER(NL,GAMA,CP,CM,CPM1,CMM1 |
---|
2 | ,,E1,E2,E3,E4,BTOP,BSURF,RSF,XK1,XK2) |
---|
3 | C VERSION OF SOLVER |
---|
4 | c PARAMETER (NMAX=201) |
---|
5 | PARAMETER (NMAX=401) |
---|
6 | IMPLICIT REAL (A-H,O-Z) |
---|
7 | DIMENSION GAMA(NL),CP(NL),CM(NL), |
---|
8 | ,CPM1(NL),CMM1(NL),XK1(NL),XK2(NL) |
---|
9 | ,,E1(NL),E2(NL),E3(NL),E4(NL) |
---|
10 | DIMENSION AF(NMAX),BF(NMAX),CF(NMAX),DF(NMAX),XK(NMAX) |
---|
11 | C********************************************************* |
---|
12 | C* THIS SUBROUTINE SOLVES FOR THE COEFFICIENTS OF THE * |
---|
13 | C* TWO STREAM SOLUTION FOR GENERAL BOUNDARY CONDITIONS * |
---|
14 | C* NO ASSUMPTION OF THE DEPENDENCE ON OPTICAL DEPTH OF * |
---|
15 | C* C-PLUS OR C-MINUS HAS BEEN MADE. * |
---|
16 | C* NL = NUMBER OF LAYERS IN THE MODEL * |
---|
17 | C* CP = C-PLUS EVALUATED AT TAO=0 (TOP) * |
---|
18 | C* CM = C-MINUS EVALUATED AT TAO=0 (TOP) * |
---|
19 | C* CPM1 = C-PLUS EVALUATED AT TAOSTAR (BOTTOM) * |
---|
20 | C* CMM1 = C-MINUS EVALUATED AT TAOSTAR (BOTTOM) * |
---|
21 | C* EP = EXP(LAMDA*DTAU) * |
---|
22 | C* EM = 1/EP * |
---|
23 | C* E1 = EP + GAMA *EM * |
---|
24 | C* E2 = EP - GAMA *EM * |
---|
25 | C* E3 = GAMA*EP + EM * |
---|
26 | C* E4 = GAMA*EP - EM * |
---|
27 | C* BTOP = THE DIFFUSE RADIATION INTO THE MODEL AT TOP * |
---|
28 | C* BSURF = THE DIFFUSE RADIATION INTO THE MODEL AT * |
---|
29 | C* THE BOTTOM: INCLUDES EMMISION AND REFLECTION * |
---|
30 | C* OF THE UNATTENUATED PORTION OF THE DIRECT * |
---|
31 | C* BEAM. BSTAR+RSF*FO*EXP(-TAOSTAR/U0) * |
---|
32 | C* RSF = REFLECTIVITY OF THE SURFACE * |
---|
33 | C* XK1 = COEFFICIENT OF THE POSITIVE EXP TERM * |
---|
34 | C* XK2 = COEFFICIENT OF THE NEGATIVE EXP TERM * |
---|
35 | C********************************************************* |
---|
36 | L=2*NL |
---|
37 | C************MIXED COEFFICENTS********** |
---|
38 | C* THIS VERSION AVOIDS SINGULARITIES ASSOC. |
---|
39 | C* WIRH W0=0 BY SOLVING FOR XK1+XK2, AND XK1-XK2. |
---|
40 | AF(1)=0.0 |
---|
41 | BF(1)=GAMA(1)+1. |
---|
42 | CF(1)=GAMA(1)-1. |
---|
43 | DF(1)=BTOP-CMM1(1) |
---|
44 | N=0 |
---|
45 | LM2=L-2 |
---|
46 | C* EVEN TERMS |
---|
47 | DO 10 I=2,LM2,2 |
---|
48 | N=N+1 |
---|
49 | AF(I)=(E1(N)+E3(N))*(GAMA(N+1)-1.) |
---|
50 | BF(I)=(E2(N)+E4(N))*(GAMA(N+1)-1.) |
---|
51 | CF(I)=2.*(1.-GAMA(N+1)**2) |
---|
52 | DF(I)=(GAMA(N+1)-1.) * (CPM1(N+1) - CP(N)) |
---|
53 | & + (1.-GAMA(N+1))* (CM(N)-CMM1(N+1)) |
---|
54 | 10 CONTINUE |
---|
55 | N=0 |
---|
56 | LM1=L-1 |
---|
57 | DO 20 I=3,LM1,2 |
---|
58 | N=N+1 |
---|
59 | AF(I)=2.*(1.-GAMA(N)**2) |
---|
60 | BF(I)=(E1(N)-E3(N))*(1.+GAMA(N+1)) |
---|
61 | CF(I)=(E1(N)+E3(N))*(GAMA(N+1)-1.) |
---|
62 | DF(I)=E3(N)*(CPM1(N+1) - CP(N)) |
---|
63 | & + E1(N)*(CM(N) - CMM1(N+1)) |
---|
64 | 20 CONTINUE |
---|
65 | AF(L)=E1(NL)-RSF*E3(NL) |
---|
66 | BF(L)=E2(NL)-RSF*E4(NL) |
---|
67 | CF(L)=0.0 |
---|
68 | DF(L)=BSURF-CP(NL)+RSF*CM(NL) |
---|
69 | CALL DTRIDGL(L,AF,BF,CF,DF,XK) |
---|
70 | C***UNMIX THE COEFFICIENTS**** |
---|
71 | DO 28 N=1,NL |
---|
72 | XK1(N)=XK(2*N-1)+XK(2*N) |
---|
73 | XK2(N)=XK(2*N-1)-XK(2*N) |
---|
74 | C NOW TEST TO SEE IF XK2 IS REALLY ZERO TO THE LIMIT OF THE |
---|
75 | C MACHINE ACCURACY = 1 .E -30 |
---|
76 | C XK2 IS THE COEFFICEINT OF THE GROWING EXPONENTIAL AND MUST |
---|
77 | C BE TREATED CAREFULLY |
---|
78 | IF (XK2(N) .EQ. 0.0) GO TO 28 |
---|
79 | IF (ABS (XK2(N)/XK(2*N-1)) .LT. 1.E-30) XK2(N)=0.0 |
---|
80 | 28 CONTINUE |
---|
81 | RETURN |
---|
82 | END |
---|