src/tpm/refraction.c
void
atm(double r, double *n, double *dndr)
{
    double T;	/* the temperature at r */

    /* enforce some limits on r */
    if (r < r0) {
	r = r0;
    } else if (r > (RE+HS)) {
	r = (RE+HS);
    }

    if (r <= (RE+HT)) {
	/* we're in the troposphere */

	T = T0 - C1 * (r - r0);

	*n = 1 + (C6 * pow(T/T0, C3-2) - C7 * pow(T/T0,C4-2)) * (T/T0);

	*dndr = -C8 * pow(T/T0, C3-2) + C9 * pow(T/T0, C4-2);
    } else {
	/* we're in the stratosphere */

	Tt = T0 - C1 * (rt - r0);

	*n = 1 + (nt - 1) * exp(-C2 * (r - rt)/Tt);

	*dndr = -(C2 / Tt) * (nt - 1) * exp(-C2 * (r - rt)/Tt);
    }

#ifdef DEBUG
    (void)fprintf(stdout, "atm: r %.15e\n", r);
    (void)fprintf(stdout, "atm: T %.15e\n", T);
    (void)fprintf(stdout, "atm: *n %.15e\n", *n);
    (void)fprintf(stdout, "atm: *dndr %.15e\n", *dndr);
#endif

    return;
}
/* this routine implements the model atmosphere */
this routine implements the model atmosphere
this routine implements the model atmosphere
void
atm(double r, double *n, double *dndr)
{
    double T;	
    if (r < r0) {
	r = r0;
    } else if (r > (RE+HS)) {
	r = (RE+HS);
    }
    if (r <= (RE+HT)) {
	T = T0 - C1 * (r - r0);
	*n = 1 + (C6 * pow(T/T0, C3-2) - C7 * pow(T/T0,C4-2)) * (T/T0);
	*dndr = -C8 * pow(T/T0, C3-2) + C9 * pow(T/T0, C4-2);
    } else {
	Tt = T0 - C1 * (rt - r0);
	*n = 1 + (nt - 1) * exp(-C2 * (r - rt)/Tt);
	*dndr = -(C2 / Tt) * (nt - 1) * exp(-C2 * (r - rt)/Tt);
    }
#ifdef DEBUG
    (void)fprintf(stdout, "atm: r %.15e\n", r);
    (void)fprintf(stdout, "atm: T %.15e\n", T);
    (void)fprintf(stdout, "atm: *n %.15e\n", *n);
    (void)fprintf(stdout, "atm: *dndr %.15e\n", *dndr);
#endif
    return;
}
void atm ( double r , double * n , double * dndr ) { double T ; if ( r < r0 ) { r = r0 ; } else if ( r > ( RE + HS ) ) { r = ( RE + HS ) ; } if ( r <= ( RE + HT ) ) { T = T0 - C1 * ( r - r0 ) ; * n = 1 + ( C6 * pow ( T / T0 , C3 - 2 ) - C7 * pow ( T / T0 , C4 - 2 ) ) * ( T / T0 ) ; * dndr = - C8 * pow ( T / T0 , C3 - 2 ) + C9 * pow ( T / T0 , C4 - 2 ) ; } else { Tt = T0 - C1 * ( rt - r0 ) ; * n = 1 + ( nt - 1 ) * exp ( - C2 * ( r - rt ) / Tt ) ; * dndr = - ( C2 / Tt ) * ( nt - 1 ) * exp ( - C2 * ( r - rt ) / Tt ) ; } #ifdef DEBUG ( void ) fprintf ( stdout , " \n " , r ) ; ( void ) fprintf ( stdout , " \n " , T ) ; ( void ) fprintf ( stdout , " \n " , * n ) ; ( void ) fprintf ( stdout , " \n " , * dndr ) ; #endif return ; }
this routine implements the model atmosphere
this routine implements the model atmosphere
/* the temperature at r */ /* enforce some limits on r */ /* we're in the troposphere */ /* we're in the stratosphere */