C++ source code for performing temperature conversions and temperature math auto-magically.
C++ source code for calculating vapor pressure deficit (vpd). Uses the above mentioned temperature conversion classes.
This is for the DIY types that have some software background. Iād like to ask forum members to avoid the āwhatās this good forā type questions within this thread to avoid clutter. Youāll either know what this is or you wonāt (yet).
This is an on-going project with several associated threads with differing objectives. Additional source, documentation, etc can be found by clicking on the āsourcecodeā tag. Topics tagged sourcecode
Initial draft 9-1-2018.
Edit: Change VPD internal units to Celcius. Improved precision.
Edit: 9-4-2018 Improve type casting in the temperature conversion classes.
Edit: 9-9-2018 Added additional time specific constants to the Constants.h header.
Edit: 2-9-2020 Updated the conversion classes, see the updated code as posted later in this thread. Leaving the original source posted here in this post to avoid breaking any usage.
Temperature conversion classes:
//
// temperature_types.h
// Version timestamp: 9-4-2018, 4:23 PM
//
// Attribution : Copyright (c) 2018 Northern_Loki (sha256::6F290BF833967127BE26C92C8F6B1C1A3949C55A7EABCEF3ECC785CD2D38D30D)
// License is granted under the Creative Commons Attribution-ShareAlike 4.0 International. https://creativecommons.org/licenses/by-sa/4.0/
//
//
//
// Some usage wxamples:
//
// //Initialize some temperature variables
// celcius cel_temp = 32.0;
// celcius cel_temp2(31.0);
// kelvin kel_temp(280);
// farenheit far_temp(80);
// kelvin kel_temp2(cel_temp);
// farenheit far_temp2(kel_temp);
//
// //Print the value in celcius with alternatives
// std::cout << "Temperature celcius(32)" << cel_temp << std::endl;
// std::cout << "Temperature celcius(32): " << cel_temp.degrees_celcius << std::endl;
// std::cout << "Temperature celcius(32): " << cel_temp() << std::endl;
// std::cout << "Temperature F to c: " << (celcius) far_temp << std::endl;
// std::cout << "Temperature K to c: " << (celcius) kel_temp << std::endl;
// std::cout << "Temperature F to K: " << (kelvin) far_temp << std::endl;
// std::cout << "Temperature c to K: " << (kelvin) cel_temp << std::endl;
// std::cout << "Temperature c to F: " << (farenheit) cel_temp << std::endl;
// std::cout << "Temperature kelvin to F: " << (farenheit) kel_temp << std::endl;
//
// printf("Temperature: %8.3f\n", cel_temp());
//
// //Print the celcius value in kelvin
// std::cout << "Temperature c to K" << (kelvin)cel_temp << std::endl;
//
// //Print the celcius value in farenheit
// std::cout << "Temperature c to F" << (farenheit)cel_temp << std::endl;
//
// //Do some math with different units
// celcius cel_temp3 = 32.0;
// cel_temp2 = cel_temp3 + far_temp;
// cel_temp3++;
// cel_temp += 10;
// std::cout << "Temperature celcius (33): " << cel_temp3 << std::endl;
// std::cout << "Temperature celcius (32 + 80F): " << cel_temp2 << std::endl;
// std::cout << "Temperature celcius (42):" << cel_temp << std::endl;
// std::cout << "Temperature celcius + kelvin: " << cel_temp + kel_temp << std::endl;
//
// if (cel_temp > kel_temp) std::cout << "Celcius Temperature is greater" << std::endl;
// else if (cel_temp < kel_temp) std::cout << "Kelvin Temperature is greater" << std::endl;
// else if (cel_temp == kel_temp) std::cout << "Temperatures are equivalent" << std::endl;
//
# pragma once
# include <string>
# include <sstream>
# include <boost/variant.hpp>
# include <iostream>
# include "Constants.h"
class celcius; class kelvin; class Temperature; class farenheit;
typedef boost::variant<celcius, kelvin, farenheit, double> celcius_variant;
typedef boost::variant<celcius, kelvin, farenheit, double> kelvin_variant;
typedef boost::variant<celcius, kelvin, farenheit, double> farenheit_variant;
class farenheit
{
public:
double degrees_farenheit = 0;
farenheit()
: degrees_farenheit(0) {}
farenheit(const farenheit& c) { degrees_farenheit = c.degrees_farenheit; } // Copy contructor
farenheit(double r) { degrees_farenheit = r; }
farenheit(farenheit_variant &r);
void operator=(farenheit_variant &temp2);
virtual double operator-(farenheit_variant temp2);
virtual double operator+(farenheit_variant temp2);
virtual double operator*(farenheit_variant temp2);
virtual double operator/(farenheit_variant temp2);
virtual double operator-=(farenheit_variant temp2);
virtual double operator+=(farenheit_variant temp2);
virtual double operator++(int incr);
virtual double operator--(int incr);
virtual double operator*=(farenheit_variant temp2);
virtual double operator/=(farenheit_variant temp2);
virtual double operator()(farenheit_variant temp2);
virtual double operator()();
virtual double operator>(farenheit_variant temp2);
virtual double operator<(farenheit_variant temp2);
virtual double operator>=(farenheit_variant temp2);
virtual double operator<=(farenheit_variant temp2);
virtual double operator==(farenheit_variant temp2);
virtual operator celcius();
virtual operator kelvin();
friend std::ostream& operator<<(std::ostream& lhs, const farenheit& rhs)
{
return (lhs << rhs.degrees_farenheit);
}
};
class kelvin
{
public:
double degrees_kelvin = 0;
kelvin()
: degrees_kelvin(0) {}
kelvin(const kelvin& c) { degrees_kelvin = c.degrees_kelvin; } // Copy contructor
kelvin(double r) { degrees_kelvin = r; }
kelvin(kelvin_variant &r);
void operator=(kelvin_variant &temp2);
virtual double operator-(kelvin_variant temp2);
virtual double operator+(kelvin_variant temp2);
virtual double operator*(kelvin_variant temp2);
virtual double operator/(kelvin_variant temp2);
virtual double operator-=(kelvin_variant temp2);
virtual double operator+=(kelvin_variant temp2);
virtual double operator++(int incr);
virtual double operator--(int incr);
virtual double operator*=(kelvin_variant temp2);
virtual double operator/=(kelvin_variant temp2);
virtual double operator()(kelvin_variant temp2);
virtual double operator()();
virtual double operator>(kelvin_variant temp2);
virtual double operator<(kelvin_variant temp2);
virtual double operator>=(kelvin_variant temp2);
virtual double operator<=(kelvin_variant temp2);
virtual double operator==(kelvin_variant temp2);
virtual operator celcius();
virtual operator farenheit();
friend std::ostream& operator<<(std::ostream& lhs, const kelvin& rhs)
{
return (lhs << rhs.degrees_kelvin);
}
};
class celcius
{
public:
double degrees_celcius = 0;
celcius()
: degrees_celcius(0) {}
celcius(const celcius& c) { degrees_celcius = c.degrees_celcius; } // Copy contructor
celcius(double r) { degrees_celcius = r; }
celcius(celcius_variant &r);
void operator=(celcius_variant &temp2);
virtual double operator-(celcius_variant temp2);
virtual double operator+(celcius_variant temp2);
virtual double operator*(celcius_variant temp2);
virtual double operator/(celcius_variant temp2);
virtual double operator-=(celcius_variant temp2);
virtual double operator+=(celcius_variant temp2);
virtual double operator++(int incr);
virtual double operator--(int incr);
virtual double operator*=(celcius_variant temp2);
virtual double operator/=(celcius_variant temp2);
virtual double operator()(celcius_variant temp2);
virtual double operator()();
virtual double operator>(celcius_variant temp2);
virtual double operator<(celcius_variant temp2);
virtual double operator>=(celcius_variant temp2);
virtual double operator<=(celcius_variant temp2);
virtual double operator==(celcius_variant temp2);
virtual operator kelvin();
virtual operator farenheit();
friend std::ostream& operator<<(std::ostream& lhs, const celcius& rhs)
{
return (lhs << rhs.degrees_celcius);
}
};
class tcelcius_variant : public boost::static_visitor<double>
{
public:
double operator()(double temperature) const
{
return (temperature);
}
double operator()(celcius temperature) const
{
return (temperature.degrees_celcius);
}
double operator()(kelvin temperature) const
{
double temp = temperature.degrees_kelvin - 273.15;
return (temp);
}
double operator()(farenheit temperature) const
{
double temp = (temperature.degrees_farenheit - 32.0) * (5.0 / 9.0);
return (temp);
}
};
class tkelvin_variant : public boost::static_visitor<double>
{
public:
double operator()(double temperature) const
{
return (temperature);
}
double operator()(kelvin temperature) const
{
return (temperature.degrees_kelvin);
}
double operator()(celcius temperature) const
{
double temp = temperature.degrees_celcius + 273.15;
return (temp);
}
double operator()(farenheit temperature) const
{
double temp = (temperature.degrees_farenheit - 32.0) * (5.0 / 9.0) + 273.15;
return (temp);
}
};
class tfarenheit_variant : public boost::static_visitor<double>
{
public:
double operator()(double temperature) const
{
return (temperature);
}
double operator()(farenheit temperature) const
{
return (temperature.degrees_farenheit);
}
double operator()(celcius temperature) const
{
double temp = temperature.degrees_celcius * (9.0 / 5.0) + 32.0;
return (temp);
}
double operator()(kelvin temperature) const
{
double temp = (temperature.degrees_kelvin) * (9.0 / 5.0) - 459.67;
return (temp);
}
};
//
// Kelvin.cpp
// Version timestamp: 9-4-2018, 4:23 PM
//
// Attribution : Copyright (c) 2018 Northern_Loki (sha256::6F290BF833967127BE26C92C8F6B1C1A3949C55A7EABCEF3ECC785CD2D38D30D)
// License is granted under the Creative Commons Attribution-ShareAlike 4.0 International. https://creativecommons.org/licenses/by-sa/4.0/
//
# include "temperature_types.h"
kelvin::kelvin(kelvin_variant &r)
{
kelvin_variant c = r;
this->degrees_kelvin = boost::apply_visitor(tkelvin_variant(), c);
}
kelvin::operator farenheit()
{
//boost::apply_visitor(tcelcius_variant(), this);
double temp = (this->degrees_kelvin) * (9.0 / 5.0) - 459.67;
return (temp);
}
kelvin::operator celcius()
{
double temp = this->degrees_kelvin - 273.15;
return (temp);
}
void kelvin::operator=(kelvin_variant &temp2)
{
this->degrees_kelvin = boost::apply_visitor(tkelvin_variant(), temp2);
}
double kelvin::operator-(kelvin_variant temp2)
{
double temp = this->degrees_kelvin - boost::apply_visitor(tkelvin_variant(), temp2);
return (temp);
}
double kelvin::operator+(kelvin_variant temp2)
{
double temp = this->degrees_kelvin + boost::apply_visitor(tkelvin_variant(), temp2);
return (temp);
}
double kelvin::operator*(kelvin_variant temp2)
{
double temp = this->degrees_kelvin * boost::apply_visitor(tkelvin_variant(), temp2);
return (temp);
}
double kelvin::operator/(kelvin_variant temp2)
{
double temp = this->degrees_kelvin / boost::apply_visitor(tkelvin_variant(), temp2);
return (temp);
}
double kelvin::operator()(kelvin_variant temp2)
{
double temp = boost::apply_visitor(tkelvin_variant(), temp2);
return (temp);
}
double kelvin::operator()()
{
double temp = this->degrees_kelvin;
return (temp);
}
double kelvin::operator-=(kelvin_variant temp2)
{
this->degrees_kelvin = this->degrees_kelvin - boost::apply_visitor(tkelvin_variant(), temp2);
return (this->degrees_kelvin);
}
double kelvin::operator+=(kelvin_variant temp2)
{
this->degrees_kelvin = this->degrees_kelvin + boost::apply_visitor(tkelvin_variant(), temp2);
return (this->degrees_kelvin);
}
double kelvin::operator++(int incr)
{
this->degrees_kelvin += 1.0;
return (this->degrees_kelvin);
}
double kelvin::operator--(int incr)
{
this->degrees_kelvin -= 1.0;
return (this->degrees_kelvin);
}
double kelvin::operator*=(kelvin_variant temp2)
{
this->degrees_kelvin = this->degrees_kelvin * boost::apply_visitor(tkelvin_variant(), temp2);
return (this->degrees_kelvin);
}
double kelvin::operator/=(kelvin_variant temp2)
{
this->degrees_kelvin = this->degrees_kelvin / boost::apply_visitor(tkelvin_variant(), temp2);
return (this->degrees_kelvin);
}
double kelvin::operator>(kelvin_variant temp2)
{
if (this->degrees_kelvin > boost::apply_visitor(tkelvin_variant(), temp2)) return (1);
return (0);
}
double kelvin::operator<(kelvin_variant temp2)
{
if (this->degrees_kelvin < boost::apply_visitor(tkelvin_variant(), temp2)) return (1);
return (0);
}
double kelvin::operator==(kelvin_variant temp2)
{
if (this->degrees_kelvin == boost::apply_visitor(tkelvin_variant(), temp2)) return (1);
return (0);
}
double kelvin::operator>=(kelvin_variant temp2)
{
if (this->degrees_kelvin >= boost::apply_visitor(tkelvin_variant(), temp2)) return (1);
return (0);
}
double kelvin::operator<=(kelvin_variant temp2)
{
if (this->degrees_kelvin <= boost::apply_visitor(tkelvin_variant(), temp2)) return (1);
return (0);
}
//
// Farenheit.cpp
// Version timestamp: 9-4-2018, 4:23 PM
//
// Attribution : Copyright (c) 2018 Northern_Loki (sha256::6F290BF833967127BE26C92C8F6B1C1A3949C55A7EABCEF3ECC785CD2D38D30D)
// License is granted under the Creative Commons Attribution-ShareAlike 4.0 International. https://creativecommons.org/licenses/by-sa/4.0/
//
# include "temperature_types.h"
farenheit::farenheit(farenheit_variant &r)
{
farenheit_variant c = r;
this->degrees_farenheit = boost::apply_visitor(tfarenheit_variant(), c);
}
farenheit::operator kelvin()
{
//boost::apply_visitor(tcelcius_variant(), this);
double temp = (this->degrees_farenheit - 32.0) * (5.0 / 9.0) + 273.15;
return (temp);
}
farenheit::operator celcius()
{
double temp = (this->degrees_farenheit - 32.0) * (5.0 / 9.0);
return (temp);
}
void farenheit::operator=(farenheit_variant &temp2)
{
this->degrees_farenheit = boost::apply_visitor(tfarenheit_variant(), temp2);
}
double farenheit::operator-(farenheit_variant temp2)
{
double temp = this->degrees_farenheit - boost::apply_visitor(tfarenheit_variant(), temp2);
return (temp);
}
double farenheit::operator+(farenheit_variant temp2)
{
double temp = this->degrees_farenheit + boost::apply_visitor(tfarenheit_variant(), temp2);
return (temp);
}
double farenheit::operator*(farenheit_variant temp2)
{
double temp = this->degrees_farenheit * boost::apply_visitor(tfarenheit_variant(), temp2);
return (temp);
}
double farenheit::operator/(farenheit_variant temp2)
{
double temp = this->degrees_farenheit / boost::apply_visitor(tfarenheit_variant(), temp2);
return (temp);
}
double farenheit::operator()(farenheit_variant temp2)
{
double temp = boost::apply_visitor(tfarenheit_variant(), temp2);
return (temp);
}
double farenheit::operator()()
{
double temp = this->degrees_farenheit;
return (temp);
}
double farenheit::operator-=(farenheit_variant temp2)
{
this->degrees_farenheit = this->degrees_farenheit - boost::apply_visitor(tfarenheit_variant(), temp2);
return (this->degrees_farenheit);
}
double farenheit::operator+=(farenheit_variant temp2)
{
this->degrees_farenheit = this->degrees_farenheit + boost::apply_visitor(tfarenheit_variant(), temp2);
return (this->degrees_farenheit);
}
double farenheit::operator++(int incr)
{
this->degrees_farenheit += 1.0;
return (this->degrees_farenheit);
}
double farenheit::operator--(int incr)
{
this->degrees_farenheit -= 1.0;
return (this->degrees_farenheit);
}
double farenheit::operator*=(farenheit_variant temp2)
{
this->degrees_farenheit = this->degrees_farenheit * boost::apply_visitor(tfarenheit_variant(), temp2);
return (this->degrees_farenheit);
}
double farenheit::operator/=(farenheit_variant temp2)
{
this->degrees_farenheit = this->degrees_farenheit / boost::apply_visitor(tfarenheit_variant(), temp2);
return (this->degrees_farenheit);
}
double farenheit::operator>(farenheit_variant temp2)
{
if (this->degrees_farenheit > boost::apply_visitor(tfarenheit_variant(), temp2)) return (1);
return (0);
}
double farenheit::operator<(farenheit_variant temp2)
{
if (this->degrees_farenheit < boost::apply_visitor(tfarenheit_variant(), temp2)) return (1);
return (0);
}
double farenheit::operator==(farenheit_variant temp2)
{
if (this->degrees_farenheit == boost::apply_visitor(tfarenheit_variant(), temp2)) return (1);
return (0);
}
double farenheit::operator>=(farenheit_variant temp2)
{
if (this->degrees_farenheit >= boost::apply_visitor(tfarenheit_variant(), temp2)) return (1);
return (0);
}
double farenheit::operator<=(farenheit_variant temp2)
{
if (this->degrees_farenheit <= boost::apply_visitor(tfarenheit_variant(), temp2)) return (1);
return (0);
}
//
// Celcius.cpp
// Version timestamp: 9-4-2018, 4:23 PM
//
// Attribution : Copyright (c) 2018 Northern_Loki (sha256::6F290BF833967127BE26C92C8F6B1C1A3949C55A7EABCEF3ECC785CD2D38D30D)
// License is granted under the Creative Commons Attribution-ShareAlike 4.0 International. https://creativecommons.org/licenses/by-sa/4.0/
//
# include "temperature_types.h"
celcius::celcius(celcius_variant &r)
{
celcius_variant c = r;
this->degrees_celcius = boost::apply_visitor(tcelcius_variant(), c);
}
celcius::operator kelvin()
{
double temp = this->degrees_celcius + 273.15;
return (temp);
}
celcius::operator farenheit()
{
double temp = this->degrees_celcius * (9.0 / 5.0) + 32.0;
return (temp);
}
void celcius::operator=(celcius_variant &temp2)
{
this->degrees_celcius = boost::apply_visitor(tcelcius_variant(), temp2);
}
double celcius::operator-(celcius_variant temp2)
{
double temp = this->degrees_celcius - boost::apply_visitor(tcelcius_variant(), temp2);
return (temp);
}
double celcius::operator+(celcius_variant temp2)
{
double temp = this->degrees_celcius + boost::apply_visitor(tcelcius_variant(), temp2);
return (temp);
}
double celcius::operator++(int incr)
{
this->degrees_celcius += 1.0;
return (this->degrees_celcius);
}
double celcius::operator--(int incr)
{
this->degrees_celcius -= 1.0;
return (this->degrees_celcius);
}
double celcius::operator*(celcius_variant temp2)
{
double temp = this->degrees_celcius * boost::apply_visitor(tcelcius_variant(), temp2);
return (temp);
}
double celcius::operator/(celcius_variant temp2)
{
double temp = this->degrees_celcius / boost::apply_visitor(tcelcius_variant(), temp2);
return (temp);
}
double celcius::operator()(celcius_variant temp2)
{
double temp = boost::apply_visitor(tcelcius_variant(), temp2);
return (temp);
}
double celcius::operator()()
{
double temp = this->degrees_celcius;
return (temp);
}
double celcius::operator-=(celcius_variant temp2)
{
this->degrees_celcius = this->degrees_celcius - boost::apply_visitor(tcelcius_variant(), temp2);
return (this->degrees_celcius);
}
double celcius::operator+=(celcius_variant temp2)
{
this->degrees_celcius = this->degrees_celcius + boost::apply_visitor(tcelcius_variant(), temp2);
return (this->degrees_celcius);
}
double celcius::operator*=(celcius_variant temp2)
{
this->degrees_celcius = this->degrees_celcius * boost::apply_visitor(tcelcius_variant(), temp2);
return (this->degrees_celcius);
}
double celcius::operator/=(celcius_variant temp2)
{
this->degrees_celcius = this->degrees_celcius / boost::apply_visitor(tcelcius_variant(), temp2);
return (this->degrees_celcius);
}
double celcius::operator>(celcius_variant temp2)
{
if (this->degrees_celcius > boost::apply_visitor(tcelcius_variant(), temp2)) return (1);
return (0);
}
double celcius::operator<(celcius_variant temp2)
{
if (this->degrees_celcius < boost::apply_visitor(tcelcius_variant(), temp2)) return (1);
return (0);
}
double celcius::operator==(celcius_variant temp2)
{
if (this->degrees_celcius == boost::apply_visitor(tcelcius_variant(), temp2)) return (1);
return (0);
}
double celcius::operator>=(celcius_variant temp2)
{
if (this->degrees_celcius >= boost::apply_visitor(tcelcius_variant(), temp2)) return (1);
return (0);
}
double celcius::operator<=(celcius_variant temp2)
{
if (this->degrees_celcius <= boost::apply_visitor(tcelcius_variant(), temp2)) return (1);
return (0);
}
Vapor Pressure Deficit classes:
Moved, see post with the VPD class in thread below (ran out of space to make updates in this post).
Definitions :
//
// Constants.h
// Version timestamp: 9-26-2018, 10:45 PM
//
// Attribution : Copyright (c) 2018 Northern_Loki (sha256::6F290BF833967127BE26C92C8F6B1C1A3949C55A7EABCEF3ECC785CD2D38D30D)
// License is granted under the Creative Commons Attribution-ShareAlike 4.0 International. https://creativecommons.org/licenses/by-sa/4.0/
//
# pragma once
/* Euler's constant */
# define EULER 2.7182818284590452353602875
/* Avagadros Constant SI unit (1/mol) */
# define NA (6.022140758 * pow(10,23))
/* Boltzmann's constant (J/K) */
# define BOLTZMANN (1.38064852 * (pow(10,ā23)))
/* Stefan-Boltzmann's constant SI units (W/(m^2.K^4)) */
# define STEFAN_BOLTZMANN (5.67036713 * (pow(10,-8)))
/* Latent heat of vaporization 1ATM and 0 degrees C SI units (J/g) */
# define L0 2500
/* Latent heat of vaporization 1ATM and 20 degrees C SI units (J/g) */
# define L20 2450
/* Latent heat of vaporization 1ATM and 100 degrees C SI units (J/g) */
# define L100 2260
/* Density of dry air 1ATM and 0 degrees C SI units (kg/m^3) */
# define p_air0 1.2922
/* Isobaric heat capacity of dry air 1ATM and 0 degrees C SI units (J/kg K) */
# define Cp_air0 1010
/* Molecular weight of water (g/mol) */
# define M_H20 18.0
/**************/
/* Conversion */
/**************/
# define TO_DEGREE(radians) ((radians) * 57.295779513082320876798154814105)
# define TO_RADIAN(degrees) ((degrees) * 0.017453292519943295769236907684886)
/*********/
/* Time */
/********/
/* Julian J2000 */
# define J2000 (2451545.0)
/* Julian UNIX epoch 0h Jan 1, 1970 */
# define UNIX_JULIAN_EPOCH (2440587.5)
/* Julian days per year */
# define JULIAN_DAYS_YEAR (365.25)
/* Julian days per century */
# define JULIAN_DAYS_CENTURY (JULIAN_DAYS_YEAR) * 100.0
/* Solar days per century */
# define SOLAR_CENTURY (36524.22)
/* Hours per day*/
# define HOURS_DAY (24.0)
/* Minutes per hour */
# define MINUTES_HOUR (60.0)
/* Minutes per day */
# define MINUTES_DAY (MINUTES_HOUR) * (HOURS_DAY)
/* Seconds per minute*/
# define SECONDS_MINUTE (60.0)
/* Seconds per hour (3600) */
# define SECONDS_HOUR ((SECONDS_MINUTE) * (MINUTES_HOUR))
/* Seconds per day (86400) */
# define SECONDS_DAY ((HOURS_DAY) * (SECONDS_HOUR))
/* Mean tropical days per year */
# define MEAN_TROPICAL_DAYS_YEAR (365.242189)
/* Mean sidereal days per year */
# define SIDEREAL_DAYS_YEAR (365.25636)
/**************/
/* Distance */
/**************/
/* Astronomical units. Kilometers per AU */
# define AU_KM (149597870.700)
/**************/
/* Solar */
/*************/
/* Solar constant W/m^2 (averaged of a year) Page, 1986 */
# define SOLAR_CONSTANT 1366.9444
/* Planetary Atmospheric Albedo Mean */
# define ALBEDO_MEAN_Rp 0.3
/* Sun Blackbody Temperature in Kelvin */
# define SUN_BLACKBODY_TEMP 5777
/**************/
/* Pressure */
/*************/
/* Average atmospheric pressure at sea level (Pascals) */
# define ATM1_AVE 101325.0
/* Pascals to millibars */
# define TO_MILLIBAR(pascal) (pascal / 100.0)
/* Millibars to pascals */
# define TO_PASCAL(millibars) (millibars * 100.0)