LCOV - code coverage report
Current view: top level - air_casawvr/src - basicphys.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 5 0.0 %
Date: 2024-10-28 15:53:10 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /**
       2             :    Bojan Nikolic <bn204@mrao.cam.ac.uk>, <bojan@bnikolic.co.uk>
       3             :    Initial version February 2008
       4             :    Maintained by ESO since 2013.
       5             : 
       6             :    This file is part of LibAIR and is licensed under GNU Public
       7             :    License Version 2
       8             : 
       9             :    \file basicphys.hpp
      10             :    Renamed basicphys.h 2023
      11             : 
      12             :    Basic physics definitions
      13             : */
      14             : 
      15             : #ifndef _LIBAIR_BASICPHYS_HPP__
      16             : #define _LIBAIR_BASICPHYS_HPP__
      17             : 
      18             : #include <cmath>
      19             : 
      20             : namespace LibAIR2 {
      21             : 
      22             :   /**
      23             :      Value taken from the "am" program. Units [K * cm^2 * GHz^3 /
      24             :      watt].
      25             :    */
      26             :   const double CSquared_On_TwoK = 1.0/3.0723613e-17;
      27             : 
      28             :   /** Conversion of mm of perciptible water vapour to molecules per cm
      29             :       squared.
      30             :    */
      31             :   const double pmw_mm_to_n = 3.3427e21;
      32             : 
      33             :   /** Molecular mass of the main isotope of water, in atomic mass
      34             :       units.
      35             :    */
      36             :   const double h2o_1_mass_amu = 18.0105646863;
      37             : 
      38             :   /**
      39             :      Atomic mass unit in terms of kilograms.
      40             :    */
      41             :   const double amu_kg = 1.660538782e-27;
      42             : 
      43             :   /**  Constants for standard dry air equation of state
      44             :    */
      45             :   namespace STP2 {
      46             :     /** Loschmidt constant [cm^-3] (IUPAP 1987) */
      47             :     const double N_STP = 2.686763e19;
      48             : 
      49             :     /** Standard temperature  [K] */
      50             :     const double T_STP = 273.15;
      51             :     
      52             :     /** Standard pressure  [mbar] */ 
      53             :     const double P_STP =        1013.25         ; 
      54             :   }
      55             : 
      56             : 
      57             :   /**
      58             :      Computes:
      59             :      \f$
      60             :      \frac{2h}{c^2} \frac{\nu^3}{e^{\frac{h\nu}{kT}-1}}
      61             :      \f$
      62             :    */
      63             :   template<class fT>
      64           0 :   fT BPlanck( fT f, 
      65             :               fT T)
      66             :   {
      67           0 :     const fT  TWOH_ON_CSQUARED = 1.4744992e-18;
      68           0 :     const fT  H_ON_K           = 4.7992375e-2;
      69             : 
      70           0 :     return TWOH_ON_CSQUARED * f*(f*f) /
      71           0 :       ( exp( H_ON_K / T * f) -1 );
      72             : 
      73             :   }
      74             : 
      75             :   /**
      76             :      Converts water column c to extra path. c is in mm, path is mm.
      77             :      
      78             :      Equation taken from Alison Stirling's memo #496-1.
      79             :    */
      80             :   double SW_WaterToPath_Simplified( double c, 
      81             :                                     double T);
      82             : 
      83             :   /** \brief Compute the absolute humidity from relative humdity,
      84             :      pressure and temperature
      85             : 
      86             :      The current implementation of this function is after the atm
      87             :      program.
      88             :      
      89             :      \param rh relative humidity as a fraction
      90             :      \param T  Temperature of air in K
      91             :      \param P  Pressure of air in mBar
      92             : 
      93             :      \return absolue humidity in g/m^3
      94             :    */
      95             :   double AbsHum(double rh,
      96             :                 double T,
      97             :                 double P);
      98             : 
      99             : }
     100             : 
     101             : #endif

Generated by: LCOV version 1.16