[1708] | 1 | //#---------------------------------------------------------------------------
|
---|
| 2 | //# STAtmosphere.h: Model of atmospheric opacity
|
---|
| 3 | //#---------------------------------------------------------------------------
|
---|
| 4 | //# Copyright (C) 2004
|
---|
| 5 | //# ATNF
|
---|
| 6 | //#
|
---|
| 7 | //# The code is based on the Fortran code written by Bob Sault for MIRIAD.
|
---|
| 8 | //# Converted to C++ by Max Voronkov. This code uses a simple model of the
|
---|
| 9 | //# atmosphere and Liebe's model (1985) of the complex refractive index of
|
---|
| 10 | //# air.
|
---|
| 11 | //#
|
---|
| 12 | //# The model of the atmosphere is one with an exponential fall-off in
|
---|
| 13 | //# the water vapour content (scale height of 1540 m) and a temperature lapse
|
---|
| 14 | //# rate of 6.5 mK/m. Otherwise the atmosphere obeys the ideal gas equation
|
---|
| 15 | //# and hydrostatic equilibrium.
|
---|
| 16 | //#
|
---|
| 17 | //# This program is free software; you can redistribute it and/or modify it
|
---|
| 18 | //# under the terms of the GNU General Public License as published by the Free
|
---|
| 19 | //# Software Foundation; either version 2 of the License, or (at your option)
|
---|
| 20 | //# any later version.
|
---|
| 21 | //#
|
---|
| 22 | //# This program is distributed in the hope that it will be useful, but
|
---|
| 23 | //# WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 24 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
---|
| 25 | //# Public License for more details.
|
---|
| 26 | //#
|
---|
| 27 | //# You should have received a copy of the GNU General Public License along
|
---|
| 28 | //# with this program; if not, write to the Free Software Foundation, Inc.,
|
---|
| 29 | //# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
|
---|
| 30 | //#
|
---|
| 31 | //# Correspondence concerning this software should be addressed as follows:
|
---|
| 32 | //# Internet email: Malte.Marquarding@csiro.au
|
---|
| 33 | //# Postal address: Malte Marquarding,
|
---|
| 34 | //# Australia Telescope National Facility,
|
---|
| 35 | //# P.O. Box 76,
|
---|
| 36 | //# Epping, NSW, 2121,
|
---|
| 37 | //# AUSTRALIA
|
---|
| 38 | //#
|
---|
| 39 | //# $Id: STAtmosphere.h 1346 2007-04-26 03:24:41Z mar637 $
|
---|
| 40 | //#---------------------------------------------------------------------------
|
---|
| 41 |
|
---|
| 42 | #ifndef STATMOSPHERE_H
|
---|
| 43 | #define STATMOSPHERE_H
|
---|
| 44 |
|
---|
| 45 | #include <vector>
|
---|
| 46 |
|
---|
| 47 | namespace asap {
|
---|
| 48 |
|
---|
| 49 | /**
|
---|
| 50 | * This class implements opacity/atmospheric brightness temperature model
|
---|
| 51 | * equivalent to the model available in MIRIAD. The actual math is a
|
---|
| 52 | * convertion of the Fortran code written by Bob Sault for MIRIAD.
|
---|
| 53 | * It implements a simple model of the atmosphere and Liebe's model (1985)
|
---|
| 54 | * of the complex refractive index of air.
|
---|
| 55 | *
|
---|
| 56 | * The model of the atmosphere is one with an exponential fall-off in
|
---|
| 57 | * the water vapour content (scale height of 1540 m) and a temperature lapse
|
---|
| 58 | * rate of 6.5 mK/m. Otherwise the atmosphere obeys the ideal gas equation
|
---|
| 59 | * and hydrostatic equilibrium.
|
---|
| 60 | *
|
---|
| 61 | * Note, the model includes atmospheric lines up to 800 GHz, but was not
|
---|
| 62 | * rigorously tested above 100 GHz and for instruments located at
|
---|
| 63 | * a significant elevation. For high-elevation sites it may be necessary to
|
---|
| 64 | * adjust scale height and lapse rate.
|
---|
| 65 | *
|
---|
| 66 | * @brief The ASAP atmosphere opacity model
|
---|
| 67 | * @author Max Voronkov
|
---|
| 68 | * @date $Date: 2010-03-17 14:55:17 +1000 (Thu, 26 Apr 2007) $
|
---|
| 69 | * @version
|
---|
| 70 | */
|
---|
| 71 | class STAtmosphere {
|
---|
| 72 | public:
|
---|
| 73 | /**
|
---|
| 74 | * Default Constructor (apart from optional parameters).
|
---|
| 75 | * The class set up this way will assume International Standard Atmosphere (ISA) conditions,
|
---|
| 76 | * except for humidity. The latter is assumed to be 50%, which seems more realistic for
|
---|
| 77 | * Australian telescopes than 0%.
|
---|
| 78 | * @param[in] wvScale water vapour scale height (m), default is 1540m to match MIRIAD's model
|
---|
| 79 | * @param[in] maxAlt maximum altitude of the model atmosphere (m), plane parallel layers are spread linearly up to
|
---|
| 80 | * this height, default is 10000m to match MIRIAD.
|
---|
| 81 | * @param[in] nLayers number of plane parallel layers in the model (essentially for a numberical integration),
|
---|
| 82 | * default is 50 to match MIRIAD.
|
---|
| 83 | **/
|
---|
| 84 | explicit STAtmosphere(double wvScale = 1540., double maxAlt = 10000.0, size_t nLayers = 50);
|
---|
| 85 |
|
---|
| 86 | /**
|
---|
| 87 | * Constructor with explicitly given parameters of the atmosphere
|
---|
| 88 | * @param[in] temperature air temperature at the observatory (K)
|
---|
| 89 | * @param[in] pressure air pressure at the observatory (Pascals)
|
---|
| 90 | * @param[in] humidity air humidity at the observatory (fraction)
|
---|
| 91 | * @param[in] lapseRate temperature lapse rate (K/m), default is 0.0065 K/m to match MIRIAD and ISA
|
---|
| 92 | * @param[in] wvScale water vapour scale height (m), default is 1540m to match MIRIAD's model
|
---|
| 93 | * @param[in] maxAlt maximum altitude of the model atmosphere (m), plane parallel layers are spread linearly up to
|
---|
| 94 | * this height, default is 10000m to match MIRIAD.
|
---|
| 95 | * @param[in] nLayers number of plane parallel layers in the model (essentially for a numberical integration),
|
---|
| 96 | * default is 50 to match MIRIAD.
|
---|
| 97 | **/
|
---|
| 98 | STAtmosphere(double temperature, double pressure, double humidity, double lapseRate = 0.0065,
|
---|
| 99 | double wvScale = 1540., double maxAlt = 10000.0, size_t nLayers = 50);
|
---|
| 100 |
|
---|
| 101 | /**
|
---|
| 102 | * Set the new weather station data, recompute the model
|
---|
| 103 | * @param[in] temperature air temperature at the observatory (K)
|
---|
| 104 | * @param[in] pressure air pressure at the observatory (Pascals)
|
---|
| 105 | * @param[in] humidity air humidity at the observatory (fraction)
|
---|
| 106 | **/
|
---|
| 107 | void setWeather(double temperature, double pressure, double humidity);
|
---|
| 108 |
|
---|
| 109 | protected:
|
---|
| 110 | /**
|
---|
| 111 | * Build the atmosphere model based on exponential fall-off, ideal gas and hydrostatic
|
---|
| 112 | * equilibrium. The model parameters are taken from the data members of this class.
|
---|
| 113 | **/
|
---|
| 114 | void recomputeAtmosphereModel();
|
---|
| 115 |
|
---|
| 116 | /**
|
---|
| 117 | * Obtain the number of model layers, do consistency check that everything is
|
---|
| 118 | * resized accordingly
|
---|
| 119 | * @retrun number of model layers
|
---|
| 120 | **/
|
---|
| 121 | size_t nLayers() const;
|
---|
| 122 |
|
---|
[1709] | 123 | /**
|
---|
| 124 | * Determine the saturation pressure of water vapour for the given temperature.
|
---|
| 125 | *
|
---|
| 126 | * Reference:
|
---|
| 127 | * Waters, Refraction effects in the neutral atmosphere. Methods of
|
---|
| 128 | * Experimental Physics, vol 12B, p 186-200 (1976).
|
---|
| 129 | *
|
---|
| 130 | * @param[in] temperature temperature in K
|
---|
| 131 | * @return vapour saturation pressure (Pascals)
|
---|
| 132 | **/
|
---|
| 133 | static double wvSaturationPressure(double temperature);
|
---|
| 134 |
|
---|
[1708] | 135 | private:
|
---|
| 136 |
|
---|
| 137 | // heights of all model layers
|
---|
| 138 | std::vector<double> itsHeights;
|
---|
| 139 |
|
---|
| 140 | // temperatures of all model layers
|
---|
| 141 | std::vector<double> itsTemperatures;
|
---|
| 142 |
|
---|
| 143 | // partial pressures of dry component for all model layers
|
---|
| 144 | std::vector<double> itsDryPressures;
|
---|
| 145 |
|
---|
| 146 | // partial pressure of water vapour for all model layers
|
---|
| 147 | std::vector<double> itsVapourPressures;
|
---|
| 148 |
|
---|
| 149 | /**
|
---|
| 150 | * Atmosphere parameters
|
---|
| 151 | **/
|
---|
| 152 |
|
---|
| 153 | // ground level temperature (K)
|
---|
| 154 | double itsGndTemperature;
|
---|
| 155 |
|
---|
| 156 | // ground level pressure (Pascals)
|
---|
[1709] | 157 | double itsGndPressure;
|
---|
[1708] | 158 |
|
---|
| 159 | // ground level humidity (fraction)
|
---|
[1709] | 160 | double itsGndHumidity;
|
---|
[1708] | 161 |
|
---|
| 162 | // lapse rate (K/m)
|
---|
| 163 | double itsLapseRate;
|
---|
| 164 |
|
---|
| 165 | // water vapour scale height (m)
|
---|
| 166 | double itsWVScale;
|
---|
| 167 |
|
---|
| 168 | // altitude of the highest layer of the model (m)
|
---|
| 169 | double itsMaxAlt;
|
---|
| 170 | };
|
---|
| 171 |
|
---|
| 172 | } // namespace asap
|
---|
| 173 |
|
---|
| 174 | #endif // #ifndef STATMOSPHERE_H
|
---|
| 175 |
|
---|