libSUFR
a LIBrary of Some Useful Fortran Routines
All Classes Namespaces Files Functions Variables Pages
sufr_weather Module Reference

Procedures to deal with weather. More...

Functions/Subroutines

elemental real(double) function air_pressure (elev, press0)
 Compute the air pressure for a given elevation and pressure at sea level.
 
elemental real(double) function air_density (press, temp)
 Compute the air density for the given temperature and pressure.
 
elemental real function air_density_sp (press, temp)
 Compute the air density for the given temperature and pressure, single-precision wrapper for air_density()
 
elemental integer function beaufort (speed)
 Derive wind "force" on Beaufort scale from wind speed in m/s.
 
elemental real(double) function dew_point (tempc, rh)
 Compute the dew point from the temperature and relative humidity.
 
elemental real(double) function water_vapor_saturated_density (tempc)
 Compute the saturated water-vapor density in air for a given temperature.
 

Detailed Description

Procedures to deal with weather.

Function/Subroutine Documentation

◆ air_density()

elemental real(double) function sufr_weather::air_density ( real(double), intent(in) press,
real(double), intent(in) temp )

Compute the air density for the given temperature and pressure.

Parameters
pressPressure (Pa)
tempTemperature (K)
Return values
air_densityAir density (kg/m^3)
See also
https://en.wikipedia.org/wiki/Density_of_air

Definition at line 63 of file weather.f90.

References air_density(), and sufr_kinds::double.

Referenced by air_density(), air_density_sp(), and sufr_sports::cycling_power().

Here is the call graph for this function:

◆ air_density_sp()

elemental real function sufr_weather::air_density_sp ( real, intent(in) press,
real, intent(in) temp )

Compute the air density for the given temperature and pressure, single-precision wrapper for air_density()

Parameters
pressPressure (Pa)
tempTemperature (K)
Return values
air_density_spAir density (kg/m^3)
See also
https://en.wikipedia.org/wiki/Density_of_air

Definition at line 88 of file weather.f90.

References air_density(), and air_density_sp().

Referenced by air_density_sp().

Here is the call graph for this function:

◆ air_pressure()

elemental real(double) function sufr_weather::air_pressure ( real(double), intent(in) elev,
real(double), intent(in), optional press0 )

Compute the air pressure for a given elevation and pressure at sea level.

Parameters
elevElevation w.r.t. sea level (m)
press0Air pressure at sea level (e.g. mbar)
Return values
air_pressureAir pressure at the given elevation (same as press0, default: mbar)
See also
https://en.wikipedia.org/wiki/Scale_height

Definition at line 37 of file weather.f90.

References air_pressure(), and sufr_kinds::double.

Referenced by air_pressure().

Here is the call graph for this function:

◆ beaufort()

elemental integer function sufr_weather::beaufort ( real(double), intent(in) speed)

Derive wind "force" on Beaufort scale from wind speed in m/s.

Parameters
speedWind speed (m/s)
Return values
wind_speed_2_bftWind "force" on the Beaufort scale
See also
https://en.wikipedia.org/wiki/Beaufort_scale#Modern_scale

Definition at line 107 of file weather.f90.

References beaufort(), and sufr_kinds::double.

Referenced by beaufort().

Here is the call graph for this function:

◆ dew_point()

elemental real(double) function sufr_weather::dew_point ( real(double), intent(in) tempc,
real(double), intent(in) rh )

Compute the dew point from the temperature and relative humidity.

Parameters
tempcAir temperature (degrees Celsius)
RHRelative humidity (fraction)
Return values
dew_pointDew point (degrees Celsius)
See also
https://en.wikipedia.org/wiki/Dew_point

Definition at line 159 of file weather.f90.

References dew_point(), and sufr_kinds::double.

Referenced by dew_point().

Here is the call graph for this function:

◆ water_vapor_saturated_density()

elemental real(double) function sufr_weather::water_vapor_saturated_density ( real(double), intent(in) tempc)

Compute the saturated water-vapor density in air for a given temperature.

Parameters
tempcAir temperature (degrees Celsius)
Return values
water_vapor_saturated_densitySaturated water-vapor density (g/m^3)
Note
  • uses data from https://hyperphysics.phy-astr.gsu.edu/hbase/kinetic/relhum.html#c3:
    • for T= -10 - +60°C.
  • drops to 0 below T~-25°C;
  • significantly better results than original fit (3rd order polynomial):
    • for T<~-15°C and T>~45°C: by eye;
    • for -10°C < T < 60°C (range original fit -0°C < T < 40°C):
      • typical sigma 0.116 (T=0-40°C) -> 0.030 g/m^3 (T=-10-60°C);
      • max. abs. deviation: 0.168 g/m^3 (T=0-40°C; @T=0°C) -> 0.0445 g/m^3 (T=-10-60°C; @T=25°C)
      • max. rel. deviation: 3.46 % (T=0-40°C; @T=0°C) -> 0.194 % (T=-10-60°C; @T=25°C)

Definition at line 193 of file weather.f90.

References sufr_kinds::double, and water_vapor_saturated_density().

Referenced by water_vapor_saturated_density().

Here is the call graph for this function: