source: branches/FACT++_lidctrl_usb/pal/palRefco.c@ 19688

Last change on this file since 19688 was 18347, checked in by tbretz, 9 years ago
File size: 3.9 KB
Line 
1/*
2*+
3* Name:
4* palRefco
5
6* Purpose:
7* Determine constants in atmospheric refraction model
8
9* Language:
10* Starlink ANSI C
11
12* Type of Module:
13* Library routine
14
15* Invocation:
16* void palRefco ( double hm, double tdk, double pmb, double rh,
17* double wl, double phi, double tlr, double eps,
18* double *refa, double *refb );
19
20* Arguments:
21* hm = double (Given)
22* Height of the observer above sea level (metre)
23* tdk = double (Given)
24* Ambient temperature at the observer (K)
25* pmb = double (Given)
26* Pressure at the observer (millibar)
27* rh = double (Given)
28* Relative humidity at the observer (range 0-1)
29* wl = double (Given)
30* Effective wavelength of the source (micrometre)
31* phi = double (Given)
32* Latitude of the observer (radian, astronomical)
33* tlr = double (Given)
34* Temperature lapse rate in the troposphere (K/metre)
35* eps = double (Given)
36* Precision required to terminate iteration (radian)
37* refa = double * (Returned)
38* tan Z coefficient (radian)
39* refb = double * (Returned)
40* tan**3 Z coefficient (radian)
41
42* Description:
43* Determine the constants A and B in the atmospheric refraction
44* model dZ = A tan Z + B tan**3 Z.
45*
46* Z is the "observed" zenith distance (i.e. affected by refraction)
47* and dZ is what to add to Z to give the "topocentric" (i.e. in vacuo)
48* zenith distance.
49
50* Authors:
51* PTW: Patrick T. Wallace
52* TIMJ: Tim Jenness (JAC, Hawaii)
53* {enter_new_authors_here}
54
55* Notes:
56* - Typical values for the TLR and EPS arguments might be 0.0065 and
57* 1E-10 respectively.
58*
59* - The radio refraction is chosen by specifying WL > 100 micrometres.
60*
61* - The routine is a slower but more accurate alternative to the
62* palRefcoq routine. The constants it produces give perfect
63* agreement with palRefro at zenith distances arctan(1) (45 deg)
64* and arctan(4) (about 76 deg). It achieves 0.5 arcsec accuracy
65* for ZD < 80 deg, 0.01 arcsec accuracy for ZD < 60 deg, and
66* 0.001 arcsec accuracy for ZD < 45 deg.
67
68* History:
69* 2012-08-24 (TIMJ):
70* Initial version. A direct copy of the Fortran SLA implementation.
71* Adapted with permission from the Fortran SLALIB library.
72* {enter_further_changes_here}
73
74* Copyright:
75* Copyright (C) 2004 Rutherford Appleton Laboratory
76* Copyright (C) 2012 Science and Technology Facilities Council.
77* All Rights Reserved.
78
79* Licence:
80* This program is free software; you can redistribute it and/or
81* modify it under the terms of the GNU General Public License as
82* published by the Free Software Foundation; either version 3 of
83* the License, or (at your option) any later version.
84*
85* This program is distributed in the hope that it will be
86* useful, but WITHOUT ANY WARRANTY; without even the implied
87* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
88* PURPOSE. See the GNU General Public License for more details.
89*
90* You should have received a copy of the GNU General Public License
91* along with this program; if not, write to the Free Software
92* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
93* MA 02110-1301, USA.
94
95* Bugs:
96* {note_any_bugs_here}
97*-
98*/
99
100#include "pal.h"
101
102void palRefco ( double hm, double tdk, double pmb, double rh,
103 double wl, double phi, double tlr, double eps,
104 double *refa, double *refb ) {
105
106 double r1, r2;
107
108 /* Sample zenith distances: arctan(1) and arctan(4) */
109 const double ATN1 = 0.7853981633974483;
110 const double ATN4 = 1.325817663668033;
111
112 /* Determine refraction for the two sample zenith distances */
113 palRefro(ATN1,hm,tdk,pmb,rh,wl,phi,tlr,eps,&r1);
114 palRefro(ATN4,hm,tdk,pmb,rh,wl,phi,tlr,eps,&r2);
115
116 /* Solve for refraction constants */
117 *refa = (64.0*r1-r2)/60.0;
118 *refb = (r2-4.0*r1)/60.0;
119
120}
Note: See TracBrowser for help on using the repository browser.