source: trunk/FACT++/sofa/src/refco.c@ 18355

Last change on this file since 18355 was 18346, checked in by tbretz, 11 years ago
File size: 11.4 KB
Line 
1#include "sofa.h"
2
3void iauRefco(double phpa, double tc, double rh, double wl,
4 double *refa, double *refb)
5/*
6** - - - - - - - - -
7** i a u R e f c o
8** - - - - - - - - -
9**
10** Determine the constants A and B in the atmospheric refraction model
11** dZ = A tan Z + B tan^3 Z.
12**
13** Z is the "observed" zenith distance (i.e. affected by refraction)
14** and dZ is what to add to Z to give the "topocentric" (i.e. in vacuo)
15** zenith distance.
16**
17** This function is part of the International Astronomical Union's
18** SOFA (Standards of Fundamental Astronomy) software collection.
19**
20** Status: support function.
21**
22** Given:
23** phpa double pressure at the observer (hPa = millibar)
24** tc double ambient temperature at the observer (deg C)
25** rh double relative humidity at the observer (range 0-1)
26** wl double wavelength (micrometers)
27**
28** Returned:
29** refa double* tan Z coefficient (radians)
30** refb double* tan^3 Z coefficient (radians)
31**
32** Notes:
33**
34** 1) The model balances speed and accuracy to give good results in
35** applications where performance at low altitudes is not paramount.
36** Performance is maintained across a range of conditions, and
37** applies to both optical/IR and radio.
38**
39** 2) The model omits the effects of (i) height above sea level (apart
40** from the reduced pressure itself), (ii) latitude (i.e. the
41** flattening of the Earth), (iii) variations in tropospheric lapse
42** rate and (iv) dispersive effects in the radio.
43**
44** The model was tested using the following range of conditions:
45**
46** lapse rates 0.0055, 0.0065, 0.0075 deg/meter
47** latitudes 0, 25, 50, 75 degrees
48** heights 0, 2500, 5000 meters ASL
49** pressures mean for height -10% to +5% in steps of 5%
50** temperatures -10 deg to +20 deg with respect to 280 deg at SL
51** relative humidity 0, 0.5, 1
52** wavelengths 0.4, 0.6, ... 2 micron, + radio
53** zenith distances 15, 45, 75 degrees
54**
55** The accuracy with respect to raytracing through a model
56** atmosphere was as follows:
57**
58** worst RMS
59**
60** optical/IR 62 mas 8 mas
61** radio 319 mas 49 mas
62**
63** For this particular set of conditions:
64**
65** lapse rate 0.0065 K/meter
66** latitude 50 degrees
67** sea level
68** pressure 1005 mb
69** temperature 280.15 K
70** humidity 80%
71** wavelength 5740 Angstroms
72**
73** the results were as follows:
74**
75** ZD raytrace iauRefco Saastamoinen
76**
77** 10 10.27 10.27 10.27
78** 20 21.19 21.20 21.19
79** 30 33.61 33.61 33.60
80** 40 48.82 48.83 48.81
81** 45 58.16 58.18 58.16
82** 50 69.28 69.30 69.27
83** 55 82.97 82.99 82.95
84** 60 100.51 100.54 100.50
85** 65 124.23 124.26 124.20
86** 70 158.63 158.68 158.61
87** 72 177.32 177.37 177.31
88** 74 200.35 200.38 200.32
89** 76 229.45 229.43 229.42
90** 78 267.44 267.29 267.41
91** 80 319.13 318.55 319.10
92**
93** deg arcsec arcsec arcsec
94**
95** The values for Saastamoinen's formula (which includes terms
96** up to tan^5) are taken from Hohenkerk and Sinclair (1985).
97**
98** 3) A wl value in the range 0-100 selects the optical/IR case and is
99** wavelength in micrometers. Any value outside this range selects
100** the radio case.
101**
102** 4) Outlandish input parameters are silently limited to
103** mathematically safe values. Zero pressure is permissible, and
104** causes zeroes to be returned.
105**
106** 5) The algorithm draws on several sources, as follows:
107**
108** a) The formula for the saturation vapour pressure of water as
109** a function of temperature and temperature is taken from
110** Equations (A4.5-A4.7) of Gill (1982).
111**
112** b) The formula for the water vapour pressure, given the
113** saturation pressure and the relative humidity, is from
114** Crane (1976), Equation (2.5.5).
115**
116** c) The refractivity of air is a function of temperature,
117** total pressure, water-vapour pressure and, in the case
118** of optical/IR, wavelength. The formulae for the two cases are
119** developed from Hohenkerk & Sinclair (1985) and Rueger (2002).
120**
121** d) The formula for beta, the ratio of the scale height of the
122** atmosphere to the geocentric distance of the observer, is
123** an adaption of Equation (9) from Stone (1996). The
124** adaptations, arrived at empirically, consist of (i) a small
125** adjustment to the coefficient and (ii) a humidity term for the
126** radio case only.
127**
128** e) The formulae for the refraction constants as a function of
129** n-1 and beta are from Green (1987), Equation (4.31).
130**
131** References:
132**
133** Crane, R.K., Meeks, M.L. (ed), "Refraction Effects in the Neutral
134** Atmosphere", Methods of Experimental Physics: Astrophysics 12B,
135** Academic Press, 1976.
136**
137** Gill, Adrian E., "Atmosphere-Ocean Dynamics", Academic Press,
138** 1982.
139**
140** Green, R.M., "Spherical Astronomy", Cambridge University Press,
141** 1987.
142**
143** Hohenkerk, C.Y., & Sinclair, A.T., NAO Technical Note No. 63,
144** 1985.
145**
146** Rueger, J.M., "Refractive Index Formulae for Electronic Distance
147** Measurement with Radio and Millimetre Waves", in Unisurv Report
148** S-68, School of Surveying and Spatial Information Systems,
149** University of New South Wales, Sydney, Australia, 2002.
150**
151** Stone, Ronald C., P.A.S.P. 108, 1051-1058, 1996.
152**
153** This revision: 2013 October 9
154**
155** SOFA release 2015-02-09
156**
157** Copyright (C) 2015 IAU SOFA Board. See notes at end.
158*/
159{
160 int optic;
161 double p, t, r, w, ps, pw, tk, wlsq, gamma, beta;
162
163/* Decide whether optical/IR or radio case: switch at 100 microns. */
164 optic = ( wl <= 100.0 );
165
166/* Restrict parameters to safe values. */
167 t = gmax ( tc, -150.0 );
168 t = gmin ( t, 200.0 );
169 p = gmax ( phpa, 0.0 );
170 p = gmin ( p, 10000.0 );
171 r = gmax ( rh, 0.0 );
172 r = gmin ( r, 1.0 );
173 w = gmax ( wl, 0.1 );
174 w = gmin ( w, 1e6 );
175
176/* Water vapour pressure at the observer. */
177 if ( p > 0.0 ) {
178 ps = pow ( 10.0, ( 0.7859 + 0.03477*t ) /
179 ( 1.0 + 0.00412*t ) ) *
180 ( 1.0 + p * ( 4.5e-6 + 6e-10*t*t ) );
181 pw = r * ps / ( 1.0 - (1.0-r)*ps/p );
182 } else {
183 pw = 0.0;
184 }
185
186/* Refractive index minus 1 at the observer. */
187 tk = t + 273.15;
188 if ( optic ) {
189 wlsq = w * w;
190 gamma = ( ( 77.53484e-6 +
191 ( 4.39108e-7 + 3.666e-9/wlsq ) / wlsq ) * p
192 - 11.2684e-6*pw ) / tk;
193 } else {
194 gamma = ( 77.6890e-6*p - ( 6.3938e-6 - 0.375463/tk ) * pw ) / tk;
195 }
196
197/* Formula for beta from Stone, with empirical adjustments. */
198 beta = 4.4474e-6 * tk;
199 if ( ! optic ) beta -= 0.0074 * pw * beta;
200
201/* Refraction constants from Green. */
202 *refa = gamma * ( 1.0 - beta );
203 *refb = - gamma * ( beta - gamma / 2.0 );
204
205/* Finished. */
206
207/*----------------------------------------------------------------------
208**
209** Copyright (C) 2015
210** Standards Of Fundamental Astronomy Board
211** of the International Astronomical Union.
212**
213** =====================
214** SOFA Software License
215** =====================
216**
217** NOTICE TO USER:
218**
219** BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
220** CONDITIONS WHICH APPLY TO ITS USE.
221**
222** 1. The Software is owned by the IAU SOFA Board ("SOFA").
223**
224** 2. Permission is granted to anyone to use the SOFA software for any
225** purpose, including commercial applications, free of charge and
226** without payment of royalties, subject to the conditions and
227** restrictions listed below.
228**
229** 3. You (the user) may copy and distribute SOFA source code to others,
230** and use and adapt its code and algorithms in your own software,
231** on a world-wide, royalty-free basis. That portion of your
232** distribution that does not consist of intact and unchanged copies
233** of SOFA source code files is a "derived work" that must comply
234** with the following requirements:
235**
236** a) Your work shall be marked or carry a statement that it
237** (i) uses routines and computations derived by you from
238** software provided by SOFA under license to you; and
239** (ii) does not itself constitute software provided by and/or
240** endorsed by SOFA.
241**
242** b) The source code of your derived work must contain descriptions
243** of how the derived work is based upon, contains and/or differs
244** from the original SOFA software.
245**
246** c) The names of all routines in your derived work shall not
247** include the prefix "iau" or "sofa" or trivial modifications
248** thereof such as changes of case.
249**
250** d) The origin of the SOFA components of your derived work must
251** not be misrepresented; you must not claim that you wrote the
252** original software, nor file a patent application for SOFA
253** software or algorithms embedded in the SOFA software.
254**
255** e) These requirements must be reproduced intact in any source
256** distribution and shall apply to anyone to whom you have
257** granted a further right to modify the source code of your
258** derived work.
259**
260** Note that, as originally distributed, the SOFA software is
261** intended to be a definitive implementation of the IAU standards,
262** and consequently third-party modifications are discouraged. All
263** variations, no matter how minor, must be explicitly marked as
264** such, as explained above.
265**
266** 4. You shall not cause the SOFA software to be brought into
267** disrepute, either by misuse, or use for inappropriate tasks, or
268** by inappropriate modification.
269**
270** 5. The SOFA software is provided "as is" and SOFA makes no warranty
271** as to its use or performance. SOFA does not and cannot warrant
272** the performance or results which the user may obtain by using the
273** SOFA software. SOFA makes no warranties, express or implied, as
274** to non-infringement of third party rights, merchantability, or
275** fitness for any particular purpose. In no event will SOFA be
276** liable to the user for any consequential, incidental, or special
277** damages, including any lost profits or lost savings, even if a
278** SOFA representative has been advised of such damages, or for any
279** claim by any third party.
280**
281** 6. The provision of any version of the SOFA software under the terms
282** and conditions specified herein does not imply that future
283** versions will also be made available under the same terms and
284** conditions.
285*
286** In any published work or commercial product which uses the SOFA
287** software directly, acknowledgement (see www.iausofa.org) is
288** appreciated.
289**
290** Correspondence concerning SOFA software should be addressed as
291** follows:
292**
293** By email: sofa@ukho.gov.uk
294** By post: IAU SOFA Center
295** HM Nautical Almanac Office
296** UK Hydrographic Office
297** Admiralty Way, Taunton
298** Somerset, TA1 2DN
299** United Kingdom
300**
301**--------------------------------------------------------------------*/
302
303}
Note: See TracBrowser for help on using the repository browser.