#Metview Macro

#  **************************** LICENSE START ***********************************
# 
#  Copyright 2019 ECMWF. This software is distributed under the terms
#  of the Apache License version 2.0. In applying this license, ECMWF does not
#  waive the privileges and immunities granted to it by virtue of its status as
#  an Intergovernmental Organization or submit itself to any jurisdiction.
# 
#  ***************************** LICENSE END ************************************
# 
#=============================================================================
# Function      : saturation_mixing_ratio
#
# Syntax        : number saturation_mixing_ratio(t: number, p: number)
#                                          
# Category      : THERMODYNAMICS
#
# OneLineDesc   : Computes the saturation mixing ratio for a given temperature and pressure
#
# Description   : Computes the saturation mixing ratio for a given temperature and pressure
#
# Parameters    : t - temperature (K)
#		 		  p - pressure (Pa)
#           
# Return Value  : the saturation mixing ratio (kg/kg)
#
# Dependencies  : none
#
#===============================================================================

function saturation_mixing_ratio(t : number, p: number)

    e = saturation_vapour_pressure(t)
    return 0.621981*e/(p-e)

end saturation_mixing_ratio
