Ticket #650: test_slant_tec.f90

File test_slant_tec.f90, 1.6 KB (added by Ian Culverwell, 4 years ago)

test_slant_tec.f90

Line 
1PROGRAM test_slant_tec
2
3IMPLICIT NONE
4
5INTEGER, PARAMETER :: nstate = 4
6INTEGER, PARAMETER :: nobs = 80
7INTEGER, PARAMETER :: n_test = 10
8
9INTEGER :: i,j
10
11REAL :: r_leo(nobs),r_gps(nobs)
12REAL :: x(nstate),x_tl(nstate),xp(nstate)
13REAL :: impact(nobs)
14REAL :: slant_tec(nobs,n_test)
15REAL :: slant_tec_tl(nobs),slant_tec0(nobs)
16REAL :: kmat(nobs,nstate)
17REAL :: cos_alpha,rel_error
18
19real :: v(nstate,nstate),w(nstate)
20
21REAL :: erad
22
23erad = 6.371e6
24
25r_leo(:) = erad + 8.0e5 ! 800 km
26
27r_gps(:) = erad + 2.2e7 ! 22000km
28
29x(1) = 3.0e-4 !!! e12*e-16
30x(2) = erad + 3.0e5 ! 300 km
31x(3) = 5.0e4
32x(4) = 0.1
33!!x(4) = 0.0
34
35
36Call Random_Number(x_tl)
37
38do i = 1,nobs
39
40 impact(i) = erad + 1.0e5 + REAL(i)*5000.0
41
42enddo
43
44
45! this is a test of the tangent linear
46
47do i=1,n_test
48
49 xp(:)=x(:) + x_tl(:)
50
51 CALL comp_slant_tec(nstate,nobs,r_leo,r_gps,xp,impact,slant_tec(:,i))
52
53 CALL comp_slant_tec_tl&
54 &(nstate,nobs,r_leo,r_gps,x,x_tl,impact,slant_tec0,slant_tec_tl)
55
56 do j = 1,nobs
57 write (6,*)i,j,slant_tec(j,i)-slant_tec0(j),slant_tec0(j),slant_tec_tl(j)
58 enddo
59
60 cos_alpha = DOT_PRODUCT(slant_tec_tl,slant_tec(:,i)-slant_tec0)/&
61 &SQRT(DOT_PRODUCT(slant_tec_tl,slant_tec_tl)*&
62 &DOT_PRODUCT((slant_tec(:,i)-slant_tec0),(slant_tec(:,i)-slant_tec0)))
63
64
65 write (6,*) 'cos_alpha=',cos_alpha
66
67 x_tl(:) = 0.1*x_tl(:)
68
69
70enddo
71
72!
73! compute kmat
74!
75
76do i = 1,nstate
77
78 x_tl(:) = 0.0
79
80 x_tl(i) = 1.0
81
82 CALL comp_slant_tec_tl&
83 &(nstate,nobs,r_leo,r_gps,x,x_tl,impact,slant_tec0,slant_tec_tl)
84
85! matrix containing the gradient of slants w.r.t. the VaryChap params.
86
87 kmat(:,i) = slant_tec_tl(:)
88
89enddo
90
91end
92
93
94
95
96
97
98