source: trunk/FACT++/pal/pal1Atmt.c@ 18980

Last change on this file since 18980 was 18347, checked in by tbretz, 9 years ago
File size: 3.6 KB
Line 
1/*
2*+
3* Name:
4* pal1Atmt
5
6* Purpose:
7* Calculate troposphere parameters
8
9* Language:
10* Starlink ANSI C
11
12* Type of Module:
13* Library routine
14
15* Invocation:
16* void pal1Atmt ( double r0, double t0, double alpha, double gamm2,
17* double delm2, double c1, double c2, double c3,
18* double c4, double c5, double c6, double r,
19* double *t, double *dn, double *rdndr );
20
21* Arguments:
22* r0 = double (Given)
23* Height of observer from centre of the Earth (metre)
24* t0 = double (Given)
25* Temperature of the observer (K)
26* alpha = double (Given)
27* Alpha (see HMNAO paper)
28* gamm2 = double (Given)
29* Gamma minus 2 (see HMNAO paper)
30* delm2 = double (Given)
31* Delta minus 2 (see HMNAO paper)
32* c1 = double (Given)
33* Useful term (see palRefro source)
34* c2 = double (Given)
35* Useful term (see palRefro source)
36* c3 = double (Given)
37* Useful term (see palRefro source)
38* c4 = double (Given)
39* Useful term (see palRefro source)
40* c5 = double (Given)
41* Useful term (see palRefro source)
42* c6 = double (Given)
43* Useful term (see palRefro source)
44* r = double (Given)
45* Current distance from the centre of the Earth (metre)
46* t = double * (Returned)
47* Temperature at r (K)
48* dn = double * (Returned)
49* Refractive index at r.
50* rdndr = double * (Returned)
51* r * rate the refractive index is changing at r.
52
53* Description:
54* Refractive index and derivative with respect to height for
55* the troposphere.
56
57* Authors:
58* TIMJ: Tim Jenness (JAC, Hawaii)
59* PTW: Patrick T. Wallace
60* {enter_new_authors_here}
61
62* Notes:
63* - Internal routine used by palRefro
64* - Note that in the optical case c5 and c6 are zero.
65
66* History:
67* 2012-08-24 (TIMJ):
68* Initial version, copied from Fortran SLA source.
69* Adapted with permission from the Fortran SLALIB library.
70* {enter_further_changes_here}
71
72* Copyright:
73* Copyright (C) 2004 Patrick T. Wallace
74* Copyright (C) 2012 Science and Technology Facilities Council.
75* All Rights Reserved.
76
77* Licence:
78* This program is free software; you can redistribute it and/or
79* modify it under the terms of the GNU General Public License as
80* published by the Free Software Foundation; either version 3 of
81* the License, or (at your option) any later version.
82*
83* This program is distributed in the hope that it will be
84* useful, but WITHOUT ANY WARRANTY; without even the implied
85* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
86* PURPOSE. See the GNU General Public License for more details.
87*
88* You should have received a copy of the GNU General Public License
89* along with this program; if not, write to the Free Software
90* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
91* MA 02110-1301, USA.
92
93* Bugs:
94* {note_any_bugs_here}
95*-
96*/
97
98#include <math.h>
99
100#include "palmac.h"
101#include "pal1.h"
102
103void pal1Atmt ( double r0, double t0, double alpha, double gamm2,
104 double delm2, double c1, double c2, double c3, double c4,
105 double c5, double c6, double r,
106 double *t, double *dn, double *rdndr ) {
107
108 double tt0;
109 double tt0gm2;
110 double tt0dm2;
111
112 *t = DMAX( DMIN( t0 - alpha*(r-r0), 320.0), 100.0 );
113 tt0 = *t / t0;
114 tt0gm2 = pow( tt0, gamm2 );
115 tt0dm2 = pow( tt0, delm2 );
116 *dn = 1.0 + ( c1 * tt0gm2 - ( c2 - c5 / *t ) * tt0dm2 ) * tt0;
117 *rdndr = r * ( -c3 * tt0gm2 + ( c4 - c6 / tt0 ) * tt0dm2 );
118
119}
Note: See TracBrowser for help on using the repository browser.