-
Notifications
You must be signed in to change notification settings - Fork 16
/
xmatch.f
65 lines (65 loc) · 1.76 KB
/
xmatch.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
56
57
58
59
60
61
62
63
64
65
FUNCTION XMATCH(DELIN,DELOUT,GAMMA,SS)
REAL AMX,AMX1,AMXP,D1,D2,DELIN,DELOUT,E1,E2,FM1,FM2,FMX,
1 FMXP,GAMI,GH,HI,TOLU,XMATCH,TOLK,TOLGAM
DOUBLE PRECISION GAMMA,SS,PI,PIBY2
COMMON/TOL/TOLK,TOLU,TOLGAM
PARAMETER (PI=3.1415926535897932384626433832795D0,PIBY2=PI/2)
C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
C THIS FUNCTION DOES THE FOLLOWING:
C -CALCULATES THE OPTIMUM LOCATION OF THE MATCHING RADIUS IN THE
C LAYER ZM
C
C INPUT VARIABLES:
C DELIN,DELOUT,GAMMA,SS
C
C OUTPUT VARIABLES:
C ZMX
C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
GAMI=SNGL(GAMMA)
HI=SNGL(SS)
XMATCH=0.0
D1=AMOD(DELIN,SNGL(PI))
D2=AMOD(DELOUT,SNGL(PI))
IF(D1.GT.TOLU.AND.D2.GT.TOLU.AND.(PI-D1).GT.TOLU.AND.(PI-D2).GT.
2TOLU)RETURN
E1=MIN(PI-D1,PI-D2)
E2=MAX(PI-D1,PI-D2)
AMX=0.5*(E1+E2)
FMX=0.5*(E2-E1)
AMXP=0.5*(E1+PI+E2)
IF(AMXP.GT.PI)AMXP=AMXP-PI
FMXP=PIBY2-FMX
GH=GAMI*HI
IF(GH.GE.AMX.AND.FMX.GE.FMXP)GO TO 10
IF(GH.GE.AMXP.AND.FMXP.GE.FMX)GO TO 12
C
C GH IS LESS THAN AMX & AMXP
C
FM1=AMIN1(E1,SNGL(PI-E2))
AMX1=AMIN1(AMX,AMXP)
IF(GH.LT.AMX1)GO TO 16
C
C GH IS BETWEEN AMX & AMXP
C
IF(E1.GE.AMX1)FM2=ABS(GH-E1)
IF(E1.LT.AMX1)FM2=ABS(GH-E2)
IF(FM2.GT.FM1.AND.FM2.GT.AMIN1(FMX,FMXP))XMATCH=HI
IF(AMIN1(FMX,FMXP).GT.FM1.AND.AMIN1(FMX,FMXP).GT.FM2)XMATCH=
2AMX1
RETURN
10 XMATCH=AMX/GAMI
RETURN
12 XMATCH=AMXP/GAMI
RETURN
16 IF(E1.GT.AMX1)GO TO 18
FM2=ABS(GH-E1)
IF(FM2.GT.FM1)XMATCH=HI
RETURN
18 FM2=GH-E2+PI
IF(FM2.GT.FM1)XMATCH=HI
RETURN
END