1 /*
2  *  - - - - - - - - - - - -
3  *   g a l _ a c c d r a g
4  *  - - - - - - - - - - - -
5  *
6  *  This routine is part of the General Astrodynamics Library
7  *
8  *  Description:
9  *
10  *     Computes the perturbational acceleration due to atmospheric
11  *     drag
12  *
13  *  Status:
14  *
15  *     support routine.
16  *
17  *  Given:
18  *
19  *     pv            d[2][3]        Position and velocity of satellite ( m, ms^-1 )
20  *     area             d           Satellite surface area ( m^2 )
21  *     mass             d           Satellite mass ( kg )
22  *     cd               d           Drag coefficient
23  *     p                d           Atmospheric density ( kg m^-3 )
24  *     omega            d           Planet rotation rate ( rad s^-1 )
25  *
26  *  Returned:
27  *
28  *     a               d[3]         Acceleration (a=d^2r/dt^2)
29  *
30  *  Called:
31  *
32  *     gal_sxp         scalar p-vector product
33  *     gal_pmp         p-vector subtraction
34  *     gal_pn          p-vector unit vector and modulus
35  *
36  *  References:
37  *
38  *     Satellite Orbits
39  *     Oliver Montenbruck, Eberhard Gill
40  *     Springer 2005
41  *     Pages 83-85
42  *
43  *  This revision:
44  *
45  *     2009 January 4
46  *
47  *  Copyright (C) 2009 Paul C. L. Willmott. See notes at end.
48  *
49  *-----------------------------------------------------------------------
50  */
51 
52 #include "gal_accdrag.h"
53 #include "gal_sxp.h"
54 #include "gal_pmp.h"
55 #include "gal_pn.h"
56 
57 void
gal_accdrag(double pv[2][3],double area,double mass,double cd,double p,double omega,double a[3])58 gal_accdrag
59   (
60     double pv[2][3],
61     double area,
62     double mass,
63     double cd,
64     double p,
65     double omega,
66     double a[3]
67   )
68 
69 {
70 
71   double vr[3], ev[3], or[3], vrm ;
72 
73 /*
74  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
75  */
76 
77 /*
78  * Calculate intermediates
79  */
80 
81   gal_sxp ( omega, pv[0], or ) ;
82   gal_pmp ( pv[1], or, vr ) ;
83   gal_pn ( vr, &vrm, ev ) ;
84 
85 /*
86  * Acceleration
87  */
88 
89   gal_sxp ( -0.5 * cd * area / mass * p * vrm * vrm, ev, a ) ;
90 
91 /*
92  * Finished.
93  */
94 
95 }
96 
97 /*
98  *  gal - General Astrodynamics Library
99  *  Copyright (C) 2009 Paul C. L. Willmott
100  *
101  *  This program is free software; you can redistribute it and/or modify
102  *  it under the terms of the GNU General Public License as published by
103  *  the Free Software Foundation; either version 2 of the License, or
104  *  (at your option) any later version.
105  *
106  *  This program is distributed in the hope that it will be useful,
107  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
108  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
109  *  GNU General Public License for more details.
110  *
111  *  You should have received a copy of the GNU General Public License along
112  *  with this program; if not, write to the Free Software Foundation, Inc.,
113  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
114  *
115  *  Contact:
116  *
117  *  Paul Willmott
118  *  vp9mu@amsat.org
119  */
120 
121