Changeset 1709


Ignore:
Timestamp:
03/17/10 14:24:21 (15 years ago)
Author:
Max Voronkov
Message:

implemented hydrostatic model of the atmosphere

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STAtmosphere.cpp

    r1708 r1709  
    4545// casa includes
    4646#include <casa/Utilities/Assert.h>
     47#include <casa/Quanta.h>
     48
     49// std includes
     50#include <cmath>
    4751
    4852using namespace casa;
     
    6165 **/
    6266STAtmosphere::STAtmosphere(double wvScale, double maxAlt, size_t nLayers) :
    63    itsGndTemperature(288.), itsPressure(101325.), itsHumidity(0.5),
     67   itsGndTemperature(288.), itsGndPressure(101325.), itsGndHumidity(0.5),
    6468   itsLapseRate(0.0065), itsWVScale(wvScale), itsMaxAlt(maxAlt),
    6569   itsHeights(nLayers), itsTemperatures(nLayers),
     
    8387STAtmosphere::STAtmosphere(double temperature, double pressure, double humidity, double lapseRate,
    8488               double wvScale, double maxAlt, size_t nLayers) :
    85    itsGndTemperature(temperature), itsPressure(pressure), itsHumidity(humidity),
     89   itsGndTemperature(temperature), itsGndPressure(pressure), itsGndHumidity(humidity),
    8690   itsLapseRate(lapseRate), itsWVScale(wvScale), itsMaxAlt(maxAlt),
    8791   itsHeights(nLayers), itsTemperatures(nLayers),
     
    100104{
    101105  itsGndTemperature = temperature;
    102   itsPressure = pressure;
    103   itsHumidity = humidity;
     106  itsGndPressure = pressure;
     107  itsGndHumidity = humidity;
    104108  recomputeAtmosphereModel();
    105109}
     
    111115void STAtmosphere::recomputeAtmosphereModel()
    112116{
     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  }
    113139}
    114140 
     
    121147{
    122148  const size_t result = itsHeights.size();
     149  DebugAssert(result > 0, AipsError);
    123150  DebugAssert(itsTemperatures.size() == result, AipsError);
    124151  DebugAssert(itsDryPressures.size() == result, AipsError);
     
    127154}
    128155
     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 **/
     166double 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  
    121121  size_t nLayers() const;
    122122 
     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   
    123135private:
    124136 
     
    143155 
    144156  // ground level pressure (Pascals)
    145   double itsPressure;
     157  double itsGndPressure;
    146158 
    147159  // ground level humidity (fraction)
    148   double itsHumidity;
     160  double itsGndHumidity;
    149161 
    150162  // lapse rate (K/m)
Note: See TracChangeset for help on using the changeset viewer.