Calculation of wet bulb temperature is not based on specific formula but by bisection method.
For temperature greater or equal to 0°C:
- temperature is saved as prev
- specific humidity is saved as specific humidity prev
- loop is started
- dew point is calculated based on specific humidity prev
- temperature difference is calculated by taken half of result of subtracting dew point from temperature prev
- temperature prev is calculated by subtracting absolute difference from temperature prev
- enthalpy is calculated by original temperature and original specific humidity
- specific humidity prev is calculated by enthalpy and temperature prev
- if temperature difference is greater or equal epsilon, loop 3. is started again
For temperature less than 0°C:
- temperature is saved as prev
- specific humidity is saved as specific humidity prev
- loop is started
- max specific humidity is calculated based on temperature prev
- specific humidity difference is calculated by taken half of result of subtracting specific humidity prev from max specific humidity
- specific humidity prev is calculated by subtracting absolute difference from specific humidity prev
- enthalpy is calculated by original temperature and original specific humidity
- temperature prev is calculated by enthalpy and specific humidity prev
- if scaled specific humidity difference is greater or equal epsilon, loop 3. is started again