source: trunk/MagicSoft/slalib/atmdsp.c@ 13662

Last change on this file since 13662 was 731, checked in by tbretz, 24 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 4.6 KB
Line 
1#include "slalib.h"
2#include "slamac.h"
3void slaAtmdsp ( double tdk, double pmb, double rh, double wl1,
4 double a1, double b1, double wl2, double *a2, double *b2 )
5/*
6** - - - - - - - - - -
7** s l a A t m d s p
8** - - - - - - - - - -
9**
10** Apply atmospheric-dispersion adjustments to refraction coefficients.
11**
12** Given:
13** tdk double ambient temperature, degrees K
14** pmb double ambient pressure, millibars
15** rh double ambient relative humidity, 0-1
16** wl1 double reference wavelength, micrometre (0.4 recommended)
17** a1 double refraction coefficient A for wavelength wl1 (radians)
18** b1 double refraction coefficient B for wavelength wl1 (radians)
19** wl2 double wavelength for which adjusted A,B required
20**
21** Returned:
22** *a2 double refraction coefficient A for wavelength wl2 (radians)
23** *b2 double refraction coefficient B for wavelength wl2 (radians)
24**
25** Notes:
26**
27** 1 To use this routine, first call slaRefco specifying wl1 as the
28** wavelength. This yields refraction coefficients a1,b1, correct
29** for that wavelength. Subsequently, calls to slaAtmdsp specifying
30** different wavelengths will produce new, slightly adjusted
31** refraction coefficients which apply to the specified wavelength.
32**
33** 2 Most of the atmospheric dispersion happens between 0.7 micrometre
34** and the UV atmospheric cutoff, and the effect increases strongly
35** towards the UV end. For this reason a blue reference wavelength
36** is recommended, for example 0.4 micrometres.
37**
38** 3 The accuracy, for this set of conditions:
39**
40** height above sea level 2000 m
41** latitude 29 deg
42** pressure 793 mB
43** temperature 17 degC
44** humidity 50%
45** lapse rate 0.0065 degC/m
46** reference wavelength 0.4 micrometre
47** star elevation 15 deg
48**
49** is about 2.5 mas RMS between 0.3 and 1.0 micrometres, and stays
50** within 4 mas for the whole range longward of 0.3 micrometres
51** (compared with a total dispersion from 0.3 to 20.0 micrometres
52** of about 11 arcsec). These errors are typical for ordinary
53** conditions and the given elevation; in extreme conditions values
54** a few times this size may occur, while at higher elevations the
55** errors become much smaller.
56**
57** 4 If either wavelength exceeds 100 micrometres, the radio case
58** is assumed and the returned refraction coefficients are the
59** same as the given ones.
60**
61** 5 The algorithm consists of calculation of the refractivity of the
62** air at the observer for the two wavelengths, using the methods
63** of the slaRefro routine, and then scaling of the two refraction
64** coefficients according to classical refraction theory. This
65** amounts to scaling the A coefficient in proportion to (n-1) and
66** the B coefficient almost in the same ratio (see R.M.Green,
67** "Spherical Astronomy", Cambridge University Press, 1985).
68**
69** Last revision: 25 June 1996
70**
71** Copyright P.T.Wallace. All rights reserved.
72*/
73{
74 double tdkok, pmbok, rhok, psat, pwo, w1, wlok, wlsq, w2, dn1, dn2, f;
75
76
77/* Check for radio wavelengths. */
78 if ( wl1 > 100.0 || wl2 > 100.0 ) {
79
80 /* Radio: no dispersion. */
81 *a2 = a1;
82 *b2 = b1;
83 } else {
84
85 /* Optical: keep arguments within safe bounds. */
86 tdkok = gmax ( tdk, 100.0 );
87 tdkok = gmin ( tdkok, 500.0 );
88 pmbok = gmax ( pmb, 0.0 );
89 pmbok = gmin ( pmbok, 10000.0 );
90 rhok = gmax ( rh, 0.0 );
91 rhok = gmin ( rhok, 1.0 );
92
93 /* Atmosphere parameters at the observer. */
94 psat = pow ( 10.0, -8.7115 + 0.03477 * tdkok );
95 pwo = rhok * psat;
96 w1 = 11.2684e-6 * pwo;
97
98 /* Refractivity at the observer for first wavelength. */
99 wlok = gmax ( wl1, 0.1 );
100 wlsq = wlok * wlok;
101 w2 = 77.5317e-6 + ( 0.43909e-6 + 0.00367e-6 / wlsq ) / wlsq;
102 dn1 = ( w2 * pmbok - w1 ) / tdkok;
103
104 /* Refractivity at the observer for second wavelength. */
105 wlok = gmax ( wl2, 0.1 );
106 wlsq = wlok * wlok;
107 w2 = 77.5317e-6 + ( 0.43909e-6 + 0.00367e-6 / wlsq ) / wlsq;
108 dn2 = ( w2 * pmbok - w1 ) / tdkok;
109
110 /* Scale the refraction coefficients (see Green 4.31, p93). */
111 if ( dn1 != 0.0 ) {
112 f = dn2 / dn1;
113 *a2 = a1 * f;
114 *b2 = b1 * f;
115 if ( dn1 != a1 )
116 *b2 = *b2 * ( 1.0 + dn1 * ( dn1 - dn2 ) /
117 ( 2.0 * ( dn1 - a1 ) ) );
118 } else {
119 *a2 = a1;
120 *b2 = b1;
121 }
122 }
123}
Note: See TracBrowser for help on using the repository browser.