OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
intpos.f
Go to the documentation of this file.
1 c -------------------------------------------------------------------
2 c subroutine intpos
3 c
4 c Orbit vector interpolation.
5 c
6 c Algorithm by Fred Patt.
7 c -------------------------------------------------------------------
8  subroutine intpos(sec1,pos1,vel1,sec2,pos2,vel2,sec,pos,vel)
9 c
10  implicit none
11 c
12  real*8 sec1,sec2,sec
13  real*8 pos1(3),pos2(3),pos(3)
14  real*8 vel1(3),vel2(3),vel(3)
15  real*8 a0(3),a1(3),a2(3),a3(3)
16  real*8 dt
17  real*8 x,x2,x3
18  integer*4 j
19 c
20  dt = sec2 - sec1
21 
22  if (dt .eq. 0.0) then
23  do j=1,3
24  pos(j) = pos1(j)
25  vel(j) = vel1(j)
26  enddo
27  return
28  endif
29 
30  do j=1,3
31  a0(j) = pos1(j)
32  a1(j) = vel1(j)*dt
33  a2(j) = 3.d0*pos2(j) - 3.d0*pos1(j)
34  . - 2.d0*vel1(j)*dt - vel2(j)*dt
35  a3(j) = 2.d0*pos1(j) - 2.d0*pos2(j)
36  . + vel1(j)*dt + vel2(j)*dt
37  end do
38 c
39  x = (sec - sec1)/dt
40  x2 = x*x
41  x3 = x2*x
42 c
43  do j=1,3
44  pos(j) = a0(j) + a1(j)*x + a2(j)*x2 + a3(j)*x3
45  vel(j) = (a1(j) + 2.*a2(j)*x + 3.*a3(j)*x2)/dt
46  end do
47 c
48  return
49  end
50 
51 
52 
53 
54 
55 
subroutine intpos(sec1, pos1, vel1, sec2, pos2, vel2, sec, pos, vel)
Definition: intpos.f:9
#define real
Definition: DbAlgOcean.cpp:26