source: trunk/src/STAtmosphere.cpp @ 1708

Last change on this file since 1708 was 1708, checked in by Max Voronkov, 14 years ago

added a skeleton of the class for atmosphere opacity model

File size: 5.5 KB
Line 
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// own includes
43#include "STAtmosphere.h"
44
45// casa includes
46#include <casa/Utilities/Assert.h>
47
48using namespace casa;
49using namespace asap;
50
51/**
52 * Default Constructor (apart from optional parameters).
53 * The class set up this way will assume International Standard Atmosphere (ISA) conditions,
54 * except for humidity. The latter is assumed to be 50%, which seems more realistic for
55 * Australian telescopes than 0%.
56 * @param[in] wvScale water vapour scale height (m), default is 1540m to match MIRIAD's model
57 * @param[in] maxAlt maximum altitude of the model atmosphere (m), plane parallel layers are spread linearly up to
58 *            this height, default is 10000m to match MIRIAD.
59 * @param[in] nLayers number of plane parallel layers in the model (essentially for a numberical integration),
60 *            default is 50 to match MIRIAD.
61 **/
62STAtmosphere::STAtmosphere(double wvScale, double maxAlt, size_t nLayers) :
63   itsGndTemperature(288.), itsPressure(101325.), itsHumidity(0.5),
64   itsLapseRate(0.0065), itsWVScale(wvScale), itsMaxAlt(maxAlt),
65   itsHeights(nLayers), itsTemperatures(nLayers),
66   itsDryPressures(nLayers), itsVapourPressures(nLayers)
67{
68  recomputeAtmosphereModel();
69}
70
71/**
72 * Constructor with explicitly given parameters of the atmosphere
73 * @param[in] temperature air temperature at the observatory (K)
74 * @param[in] pressure air pressure at the observatory (Pascals)
75 * @param[in] humidity air humidity at the observatory (fraction)
76 * @param[in] lapseRate temperature lapse rate (K/m), default is 0.0065 K/m to match MIRIAD and ISA
77 * @param[in] wvScale water vapour scale height (m), default is 1540m to match MIRIAD's model
78 * @param[in] maxAlt maximum altitude of the model atmosphere (m), plane parallel layers are spread linearly up to
79 *            this height, default is 10000m to match MIRIAD.
80 * @param[in] nLayers number of plane parallel layers in the model (essentially for a numberical integration),
81 *            default is 50 to match MIRIAD.
82 **/
83STAtmosphere::STAtmosphere(double temperature, double pressure, double humidity, double lapseRate,
84               double wvScale, double maxAlt, size_t nLayers) :
85   itsGndTemperature(temperature), itsPressure(pressure), itsHumidity(humidity),
86   itsLapseRate(lapseRate), itsWVScale(wvScale), itsMaxAlt(maxAlt),
87   itsHeights(nLayers), itsTemperatures(nLayers),
88   itsDryPressures(nLayers), itsVapourPressures(nLayers)
89{
90  recomputeAtmosphereModel();
91}
92               
93/**
94 * Set the new weather station data, recompute the model
95 * @param[in] temperature air temperature at the observatory (K)
96 * @param[in] pressure air pressure at the observatory (Pascals)
97 * @param[in] humidity air humidity at the observatory (fraction)
98 **/
99void STAtmosphere::setWeather(double temperature, double pressure, double humidity)
100{
101  itsGndTemperature = temperature;
102  itsPressure = pressure;
103  itsHumidity = humidity;
104  recomputeAtmosphereModel();
105}
106
107/**
108 * Build the atmosphere model based on exponential fall-off, ideal gas and hydrostatic
109 * equilibrium. The model parameters are taken from the data members of this class.
110 **/
111void STAtmosphere::recomputeAtmosphereModel()
112{
113}
114 
115/**
116 * Obtain the number of model layers, do consistency check that everything is
117 * resized accordingly
118 * @retrun number of model layers
119 **/
120size_t STAtmosphere::nLayers() const
121{
122  const size_t result = itsHeights.size();
123  DebugAssert(itsTemperatures.size() == result, AipsError);
124  DebugAssert(itsDryPressures.size() == result, AipsError);
125  DebugAssert(itsVapourPressures.size() == result, AipsError); 
126  return result;
127}
128
Note: See TracBrowser for help on using the repository browser.