-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdifeq.f
55 lines (55 loc) · 1.75 KB
/
difeq.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
SUBROUTINE DIFEQ(K,K1,K2,JSF,IS1,ISF,INDEXV,NE,S,NSI,NSJ,Y,NYJ,NYK
*)
PARAMETER(M=41)
COMMON X(M),H,MM,N,C2,ANORM
DIMENSION Y(NYJ,NYK),S(NSI,NSJ),INDEXV(NYJ)
IF(K.EQ.K1) THEN
IF(MOD(N+MM,2).EQ.1)THEN
S(3,3+INDEXV(1))=1.
S(3,3+INDEXV(2))=0.
S(3,3+INDEXV(3))=0.
S(3,JSF)=Y(1,1)
ELSE
S(3,3+INDEXV(1))=0.
S(3,3+INDEXV(2))=1.
S(3,3+INDEXV(3))=0.
S(3,JSF)=Y(2,1)
ENDIF
ELSE IF(K.GT.K2) THEN
S(1,3+INDEXV(1))=-(Y(3,M)-C2)/(2.*(MM+1.))
S(1,3+INDEXV(2))=1.
S(1,3+INDEXV(3))=-Y(1,M)/(2.*(MM+1.))
S(1,JSF)=Y(2,M)-(Y(3,M)-C2)*Y(1,M)/(2.*(MM+1.))
S(2,3+INDEXV(1))=1.
S(2,3+INDEXV(2))=0.
S(2,3+INDEXV(3))=0.
S(2,JSF)=Y(1,M)-ANORM
ELSE
S(1,INDEXV(1))=-1.
S(1,INDEXV(2))=-.5*H
S(1,INDEXV(3))=0.
S(1,3+INDEXV(1))=1.
S(1,3+INDEXV(2))=-.5*H
S(1,3+INDEXV(3))=0.
TEMP=H/(1.-(X(K)+X(K-1))**2*.25)
TEMP2=.5*(Y(3,K)+Y(3,K-1))-C2*.25*(X(K)+X(K-1))**2
S(2,INDEXV(1))=TEMP*TEMP2*.5
S(2,INDEXV(2))=-1.-.5*TEMP*(MM+1.)*(X(K)+X(K-1))
S(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