source: trunk/FACT++/erfa/src/refco.c@ 18679

Last change on this file since 18679 was 18348, checked in by tbretz, 9 years ago
File size: 10.0 KB
Line 
1#include "erfa.h"
2
3void eraRefco(double phpa, double tc, double rh, double wl,
4 double *refa, double *refb)
5/*
6** - - - - - - - - -
7** e r a 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** Given:
18** phpa double pressure at the observer (hPa = millibar)
19** tc double ambient temperature at the observer (deg C)
20** rh double relative humidity at the observer (range 0-1)
21** wl double wavelength (micrometers)
22**
23** Returned:
24** refa double* tan Z coefficient (radians)
25** refb double* tan^3 Z coefficient (radians)
26**
27** Notes:
28**
29** 1) The model balances speed and accuracy to give good results in
30** applications where performance at low altitudes is not paramount.
31** Performance is maintained across a range of conditions, and
32** applies to both optical/IR and radio.
33**
34** 2) The model omits the effects of (i) height above sea level (apart
35** from the reduced pressure itself), (ii) latitude (i.e. the
36** flattening of the Earth), (iii) variations in tropospheric lapse
37** rate and (iv) dispersive effects in the radio.
38**
39** The model was tested using the following range of conditions:
40**
41** lapse rates 0.0055, 0.0065, 0.0075 deg/meter
42** latitudes 0, 25, 50, 75 degrees
43** heights 0, 2500, 5000 meters ASL
44** pressures mean for height -10% to +5% in steps of 5%
45** temperatures -10 deg to +20 deg with respect to 280 deg at SL
46** relative humidity 0, 0.5, 1
47** wavelengths 0.4, 0.6, ... 2 micron, + radio
48** zenith distances 15, 45, 75 degrees
49**
50** The accuracy with respect to raytracing through a model
51** atmosphere was as follows:
52**
53** worst RMS
54**
55** optical/IR 62 mas 8 mas
56** radio 319 mas 49 mas
57**
58** For this particular set of conditions:
59**
60** lapse rate 0.0065 K/meter
61** latitude 50 degrees
62** sea level
63** pressure 1005 mb
64** temperature 280.15 K
65** humidity 80%
66** wavelength 5740 Angstroms
67**
68** the results were as follows:
69**
70** ZD raytrace eraRefco Saastamoinen
71**
72** 10 10.27 10.27 10.27
73** 20 21.19 21.20 21.19
74** 30 33.61 33.61 33.60
75** 40 48.82 48.83 48.81
76** 45 58.16 58.18 58.16
77** 50 69.28 69.30 69.27
78** 55 82.97 82.99 82.95
79** 60 100.51 100.54 100.50
80** 65 124.23 124.26 124.20
81** 70 158.63 158.68 158.61
82** 72 177.32 177.37 177.31
83** 74 200.35 200.38 200.32
84** 76 229.45 229.43 229.42
85** 78 267.44 267.29 267.41
86** 80 319.13 318.55 319.10
87**
88** deg arcsec arcsec arcsec
89**
90** The values for Saastamoinen's formula (which includes terms
91** up to tan^5) are taken from Hohenkerk and Sinclair (1985).
92**
93** 3) A wl value in the range 0-100 selects the optical/IR case and is
94** wavelength in micrometers. Any value outside this range selects
95** the radio case.
96**
97** 4) Outlandish input parameters are silently limited to
98** mathematically safe values. Zero pressure is permissible, and
99** causes zeroes to be returned.
100**
101** 5) The algorithm draws on several sources, as follows:
102**
103** a) The formula for the saturation vapour pressure of water as
104** a function of temperature and temperature is taken from
105** Equations (A4.5-A4.7) of Gill (1982).
106**
107** b) The formula for the water vapour pressure, given the
108** saturation pressure and the relative humidity, is from
109** Crane (1976), Equation (2.5.5).
110**
111** c) The refractivity of air is a function of temperature,
112** total pressure, water-vapour pressure and, in the case
113** of optical/IR, wavelength. The formulae for the two cases are
114** developed from Hohenkerk & Sinclair (1985) and Rueger (2002).
115**
116** d) The formula for beta, the ratio of the scale height of the
117** atmosphere to the geocentric distance of the observer, is
118** an adaption of Equation (9) from Stone (1996). The
119** adaptations, arrived at empirically, consist of (i) a small
120** adjustment to the coefficient and (ii) a humidity term for the
121** radio case only.
122**
123** e) The formulae for the refraction constants as a function of
124** n-1 and beta are from Green (1987), Equation (4.31).
125**
126** References:
127**
128** Crane, R.K., Meeks, M.L. (ed), "Refraction Effects in the Neutral
129** Atmosphere", Methods of Experimental Physics: Astrophysics 12B,
130** Academic Press, 1976.
131**
132** Gill, Adrian E., "Atmosphere-Ocean Dynamics", Academic Press,
133** 1982.
134**
135** Green, R.M., "Spherical Astronomy", Cambridge University Press,
136** 1987.
137**
138** Hohenkerk, C.Y., & Sinclair, A.T., NAO Technical Note No. 63,
139** 1985.
140**
141** Rueger, J.M., "Refractive Index Formulae for Electronic Distance
142** Measurement with Radio and Millimetre Waves", in Unisurv Report
143** S-68, School of Surveying and Spatial Information Systems,
144** University of New South Wales, Sydney, Australia, 2002.
145**
146** Stone, Ronald C., P.A.S.P. 108, 1051-1058, 1996.
147**
148** Copyright (C) 2013-2015, NumFOCUS Foundation.
149** Derived, with permission, from the SOFA library. See notes at end of file.
150*/
151{
152 int optic;
153 double p, t, r, w, ps, pw, tk, wlsq, gamma, beta;
154
155/* Decide whether optical/IR or radio case: switch at 100 microns. */
156 optic = ( wl <= 100.0 );
157
158/* Restrict parameters to safe values. */
159 t = ERFA_GMAX ( tc, -150.0 );
160 t = ERFA_GMIN ( t, 200.0 );
161 p = ERFA_GMAX ( phpa, 0.0 );
162 p = ERFA_GMIN ( p, 10000.0 );
163 r = ERFA_GMAX ( rh, 0.0 );
164 r = ERFA_GMIN ( r, 1.0 );
165 w = ERFA_GMAX ( wl, 0.1 );
166 w = ERFA_GMIN ( w, 1e6 );
167
168/* Water vapour pressure at the observer. */
169 if ( p > 0.0 ) {
170 ps = pow ( 10.0, ( 0.7859 + 0.03477*t ) /
171 ( 1.0 + 0.00412*t ) ) *
172 ( 1.0 + p * ( 4.5e-6 + 6e-10*t*t ) );
173 pw = r * ps / ( 1.0 - (1.0-r)*ps/p );
174 } else {
175 pw = 0.0;
176 }
177
178/* Refractive index minus 1 at the observer. */
179 tk = t + 273.15;
180 if ( optic ) {
181 wlsq = w * w;
182 gamma = ( ( 77.53484e-6 +
183 ( 4.39108e-7 + 3.666e-9/wlsq ) / wlsq ) * p
184 - 11.2684e-6*pw ) / tk;
185 } else {
186 gamma = ( 77.6890e-6*p - ( 6.3938e-6 - 0.375463/tk ) * pw ) / tk;
187 }
188
189/* Formula for beta from Stone, with empirical adjustments. */
190 beta = 4.4474e-6 * tk;
191 if ( ! optic ) beta -= 0.0074 * pw * beta;
192
193/* Refraction constants from Green. */
194 *refa = gamma * ( 1.0 - beta );
195 *refb = - gamma * ( beta - gamma / 2.0 );
196
197/* Finished. */
198
199}
200/*----------------------------------------------------------------------
201**
202**
203** Copyright (C) 2013-2015, NumFOCUS Foundation.
204** All rights reserved.
205**
206** This library is derived, with permission, from the International
207** Astronomical Union's "Standards of Fundamental Astronomy" library,
208** available from http://www.iausofa.org.
209**
210** The ERFA version is intended to retain identical functionality to
211** the SOFA library, but made distinct through different function and
212** file names, as set out in the SOFA license conditions. The SOFA
213** original has a role as a reference standard for the IAU and IERS,
214** and consequently redistribution is permitted only in its unaltered
215** state. The ERFA version is not subject to this restriction and
216** therefore can be included in distributions which do not support the
217** concept of "read only" software.
218**
219** Although the intent is to replicate the SOFA API (other than
220** replacement of prefix names) and results (with the exception of
221** bugs; any that are discovered will be fixed), SOFA is not
222** responsible for any errors found in this version of the library.
223**
224** If you wish to acknowledge the SOFA heritage, please acknowledge
225** that you are using a library derived from SOFA, rather than SOFA
226** itself.
227**
228**
229** TERMS AND CONDITIONS
230**
231** Redistribution and use in source and binary forms, with or without
232** modification, are permitted provided that the following conditions
233** are met:
234**
235** 1 Redistributions of source code must retain the above copyright
236** notice, this list of conditions and the following disclaimer.
237**
238** 2 Redistributions in binary form must reproduce the above copyright
239** notice, this list of conditions and the following disclaimer in
240** the documentation and/or other materials provided with the
241** distribution.
242**
243** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
244** the International Astronomical Union nor the names of its
245** contributors may be used to endorse or promote products derived
246** from this software without specific prior written permission.
247**
248** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
249** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
250** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
251** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
252** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
253** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
254** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
255** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
256** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
257** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
258** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
259** POSSIBILITY OF SUCH DAMAGE.
260**
261*/
Note: See TracBrowser for help on using the repository browser.