/*******************************************************************************
*$ Component_name:
*	TKep_5Freq
*$ Abstract:
*	Test program for Kepler Library routines routine Kep_5Freq().
*$ Keywords:
*	KEPLER, ORBITAL_MOTION
*	C, TEST_PROGRAM
*$ Declarations:
*	none
*$ Inputs:
*	none
*$ Outputs:
*	none
*$ Returns:
*	none
*$ Detailed_description:
*	This program tests Kepler Library routine Kep_5Freq(), to confirm that
*	returns values compatible with Kep_Omega(), Kep_Kappa(), Kep_Nu(),
*	Kep_Apse() and Kep_Node().
*	compatible results.
*
*	The user is prompted for the number of gravitational moments to use in
*	the Saturn gravity model.  Then, the user is prompted repeatedly for an
*	orbital radius.  The program prints the following information:
*		(1) Omega, based on calls to Kep_5Freq() and Kep_Omega().
*		(2) Kappa, based on calls to Kep_5Freq() and Kep_Kappa().
*		(3) Nu, based on calls to Kep_5Freq() and Kep_Nu().
*		(4) Apsidal precession rate, based on calls to Kep_5Freq() and
*		    Kep_Apse().
*		(5) Nodal regression rate, based on calls to Kep_5Freq() and
*		    Kep_Node().
*$ External_references:
*	Kep_SetPlanet(), Kep_Omega(), Kep_Kappa(), Kep_Nu(), Kep_Apse(),
*	Kep_Node(), Kep_5Freq().
*$ Examples:
*	In general, each pair of numbers on the same line should be equal.
*$ Error_handling:
*	none
*$ Limitations:
*	none
*$ Author_and_institution:
*	Mark R. Showalter
*	NASA/Ames Research Center
*$ Version_and_date:
*	1991 June 18
*$ Change_history:
*	none
*******************************************************************************/
#include <stdio.h>
#include "kepler.h"

main()
{
KEP_PLANET	saturn;
static double	rSaturn = 60330.e0,
		gm = 3.7931200e7,
		Js[] = {16297.e-6, -910.e-6, 107.e-6, -10.e-6, 2.e-6, -0.5e-6};
static int	nJs_max=6;
int		nJs, status;
double		radius, omega, kappa, nu, apse, node, test;

/*
 * Establish saturn gravity field
 */
	printf( "Enter number of gravitational moments: " );
	scanf( "%d", &nJs );
	if (nJs > nJs_max) nJs = nJs_max;

	Kep_SetPlanet( rSaturn, gm, Js, nJs, &saturn );

	while (1) {
/*
 * Get radius for calculation
 */
		printf( "Enter radius (km): " );
		status = scanf( "%lf", &radius );
		if (status == EOF) break;

 		Kep_5Freq(&saturn, radius, &omega, &kappa, &nu, &apse, &node);

/* Output (1) */
 		test = Kep_Omega(&saturn, radius);
		printf( "Omega:  % .15e  % .15e\n", omega, test);

/* Output (2) */
 		test = Kep_Kappa(&saturn, radius);
		printf( "Kappa:  % .15e  % .15e\n", kappa, test);

/* Output (3) */
 		test = Kep_Nu(&saturn, radius);
		printf( "Nu:     % .15e  % .15e\n", nu, test);

/* Output (4) */
 		test = Kep_Apse(&saturn, radius);
		printf( "Apse:   % .15e  % .15e\n", apse, test);

/* Output (5) */
 		test = Kep_Node(&saturn, radius);
		printf( "Node:   % .15e  % .15e\n", node, test);
	}

	printf( "\n" );
}

/******************************************************************************/
