1 /***************************************************************************
5 ----------------------------------------------------------------------------
7 FUNCTION: Gravity model for LaRCsim
9 ----------------------------------------------------------------------------
11 MODULE STATUS: developmental
13 ----------------------------------------------------------------------------
15 GENEALOGY: Created by Bruce Jackson on September 25, 1992.
17 ----------------------------------------------------------------------------
19 DESIGNED BY: Bruce Jackson
21 CODED BY: Bruce Jackson
23 MAINTAINED BY: Bruce Jackson
25 ----------------------------------------------------------------------------
31 940111 Changed include files to "ls_types.h" and
32 "ls_constants.h" from "ls_eom.h"; also changed DATA types
38 Revision 1.1 2002/09/10 01:14:02 curt
41 Revision 1.1.1.1 1999/06/17 18:07:34 curt
44 Revision 1.1.1.1 1999/04/05 21:32:45 curt
45 Start of 0.6.x branch.
47 Revision 1.3 1998/08/06 12:46:39 curt
50 Revision 1.2 1998/01/19 18:40:26 curt
51 Tons of little changes to clean up the code and to remove fatal errors
52 when building with the c++ compiler.
54 Revision 1.1 1997/05/29 00:09:56 curt
55 Initial Flight Gear revision.
57 * Revision 1.2 1994/01/11 18:50:35 bjax
58 * Corrected include files (was ls_eom.h) and DATA types changed
61 * Revision 1.1 1992/12/30 13:18:46 bjax
65 ----------------------------------------------------------------------------
67 REFERENCES: Stevens, Brian L.; and Lewis, Frank L.: "Aircraft
68 Control and Simulation", Wiley and Sons, 1992.
71 ----------------------------------------------------------------------------
75 ----------------------------------------------------------------------------
79 ----------------------------------------------------------------------------
83 ----------------------------------------------------------------------------
87 --------------------------------------------------------------------------*/
89 #include "ls_constants.h"
90 #include "ls_gravity.h"
93 #define GM 1.4076431E16
96 void ls_gravity( SCALAR radius, SCALAR lat, SCALAR *gravity )
99 SCALAR radius_ratio, rrsq, sinsqlat;
101 radius_ratio = radius/EQUATORIAL_RADIUS;
102 rrsq = radius_ratio*radius_ratio;
103 sinsqlat = sin(lat)*sin(lat);
104 *gravity = (GM/(radius*radius))
105 *sqrt(2.25*rrsq*rrsq*J2*J2*(5*sinsqlat*sinsqlat -2*sinsqlat + 1)
106 + 3*rrsq*J2*(1 - 3*sinsqlat) + 1);