Changeset 1712 for trunk


Ignore:
Timestamp:
03/17/10 17:11:56 (15 years ago)
Author:
Max Voronkov
Message:

added a method to calculate zenith opacity

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STAtmosphere.cpp

    r1711 r1712  
    147147{
    148148  const size_t result = itsHeights.size();
    149   DebugAssert(result > 0, AipsError);
     149  DebugAssert(result > 2, AipsError);
    150150  DebugAssert(itsTemperatures.size() == result, AipsError);
    151151  DebugAssert(itsDryPressures.size() == result, AipsError);
     
    353353}
    354354
     355/**
     356 * Calculate zenith opacity at the given frequency. This is a simplified version
     357 * of the routine implemented in MIRIAD, which calculates just zenith opacity and
     358 * nothing else. Note, that if the opacity is high, 1/sin(el) law is not correct
     359 * even in the plane parallel case due to refraction.
     360 * @param[in] freq frequency of interest in Hz
     361 * @return zenith opacity (nepers, i.e. dimensionless)
     362 **/
     363double STAtmosphere::zenithOpacity(double freq) const
     364{
     365  // essentially a numerical integration with the Trapezium method
     366  double tau = 0.;
     367  for (int layer = int(nLayers()) - 1; layer>=0; --layer) {
     368       double dH = 0.;
     369       if (layer == 0) {
     370           dH = 0.5*(itsHeights[1]-itsHeights[0]);
     371       } else if (layer + 1 == int(nLayers())) {
     372           dH = 0.5*(itsHeights[nLayers()-1]-itsHeights[nLayers()-2]);
     373       } else {
     374           dH = 0.5*(itsHeights[layer+1]-itsHeights[layer-1]);
     375       }
     376       // imaginary part of the total complex refractivity
     377       const double nImag = 1e-6*std::imag(dryRefractivity(freq,itsTemperatures[layer],itsDryPressures[layer],
     378             itsVapourPressures[layer])+vapourRefractivity(freq,itsTemperatures[layer],itsDryPressures[layer],
     379             itsVapourPressures[layer]));
     380       tau += dH*4.*casa::C::pi/QC::c.get().getValue()*freq*nImag;
     381  }
     382  return tau;
     383}
     384
  • trunk/src/STAtmosphere.h

    r1711 r1712  
    109109  void setWeather(double temperature, double pressure, double humidity);
    110110
     111  /**
     112   * Calculate zenith opacity at the given frequency. This is a simplified version
     113   * of the routine implemented in MIRIAD, which calculates just zenith opacity and
     114   * nothing else. Note, that if the opacity is high, 1/sin(el) law is not correct
     115   * even in the plane parallel case due to refraction.
     116   * @param[in] freq frequency of interest in Hz
     117   * @return zenith opacity (nepers, i.e. dimensionless)
     118   **/
     119  double zenithOpacity(double freq) const;
     120
    111121protected:
    112122  /**
Note: See TracChangeset for help on using the changeset viewer.