Changeset 1709
- Timestamp:
- 03/17/10 14:24:21 (15 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STAtmosphere.cpp
r1708 r1709 45 45 // casa includes 46 46 #include <casa/Utilities/Assert.h> 47 #include <casa/Quanta.h> 48 49 // std includes 50 #include <cmath> 47 51 48 52 using namespace casa; … … 61 65 **/ 62 66 STAtmosphere::STAtmosphere(double wvScale, double maxAlt, size_t nLayers) : 63 itsGndTemperature(288.), its Pressure(101325.), itsHumidity(0.5),67 itsGndTemperature(288.), itsGndPressure(101325.), itsGndHumidity(0.5), 64 68 itsLapseRate(0.0065), itsWVScale(wvScale), itsMaxAlt(maxAlt), 65 69 itsHeights(nLayers), itsTemperatures(nLayers), … … 83 87 STAtmosphere::STAtmosphere(double temperature, double pressure, double humidity, double lapseRate, 84 88 double wvScale, double maxAlt, size_t nLayers) : 85 itsGndTemperature(temperature), its Pressure(pressure), itsHumidity(humidity),89 itsGndTemperature(temperature), itsGndPressure(pressure), itsGndHumidity(humidity), 86 90 itsLapseRate(lapseRate), itsWVScale(wvScale), itsMaxAlt(maxAlt), 87 91 itsHeights(nLayers), itsTemperatures(nLayers), … … 100 104 { 101 105 itsGndTemperature = temperature; 102 its Pressure = pressure;103 its Humidity = humidity;106 itsGndPressure = pressure; 107 itsGndHumidity = humidity; 104 108 recomputeAtmosphereModel(); 105 109 } … … 111 115 void STAtmosphere::recomputeAtmosphereModel() 112 116 { 117 AlwaysAssert(itsGndTemperature > 0, AipsError); 118 AlwaysAssert(itsGndPressure > 0., AipsError); 119 AlwaysAssert((itsGndHumidity >= 0.) && (itsGndHumidity<=1.), AipsError); 120 AlwaysAssert(itsMaxAlt > 0., AipsError); 121 AlwaysAssert(itsWVScale > 0., AipsError); 122 123 const double heightStep = itsMaxAlt/double(nLayers()); 124 // molar mass of the air 125 const double M = 28.96e-3; 126 // free-fall acceleration 127 const double g = 9.81; 128 const double wvGndSaturationPressure = wvSaturationPressure(itsGndTemperature); 129 for (size_t layer = 0; layer < nLayers(); ++layer) { 130 const double height = double(layer)*heightStep; 131 itsHeights[layer] = height; 132 itsTemperatures[layer] = itsGndTemperature/(1.+itsLapseRate*height/itsGndTemperature); 133 const double pressure = itsGndPressure * exp(-M*g/(QC::R.get().getValue()*itsGndTemperature)* 134 (height+0.5*itsLapseRate*height*height/itsGndTemperature)); 135 itsVapourPressures[layer] = casa::min(itsGndHumidity*exp(-height/itsWVScale)*wvGndSaturationPressure, 136 wvSaturationPressure(itsTemperatures[layer])); 137 itsDryPressures[layer] = pressure - itsVapourPressures[layer]; 138 } 113 139 } 114 140 … … 121 147 { 122 148 const size_t result = itsHeights.size(); 149 DebugAssert(result > 0, AipsError); 123 150 DebugAssert(itsTemperatures.size() == result, AipsError); 124 151 DebugAssert(itsDryPressures.size() == result, AipsError); … … 127 154 } 128 155 156 /** 157 * Determine the saturation pressure of water vapour for the given temperature. 158 * 159 * Reference: 160 * Waters, Refraction effects in the neutral atmosphere. Methods of 161 * Experimental Physics, vol 12B, p 186-200 (1976). 162 * 163 * @param[in] temperature temperature in K 164 * @return vapour saturation pressure (Pascals) 165 **/ 166 double STAtmosphere::wvSaturationPressure(double temperature) 167 { 168 if (temperature > 215.) { 169 return 0.; 170 } 171 const double theta = 300.0/temperature; 172 return 1e5/(41.51/std::pow(theta,5)*std::pow(10.,9.834*theta-10.0)); 173 } 174 -
trunk/src/STAtmosphere.h
r1708 r1709 121 121 size_t nLayers() const; 122 122 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 123 135 private: 124 136 … … 143 155 144 156 // ground level pressure (Pascals) 145 double its Pressure;157 double itsGndPressure; 146 158 147 159 // ground level humidity (fraction) 148 double its Humidity;160 double itsGndHumidity; 149 161 150 162 // lapse rate (K/m)
Note:
See TracChangeset
for help on using the changeset viewer.