File:Air density dependence on temperature and relative humidity.svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 600 × 400 pixels, file size: 77 KB)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    Summary

    Description
    English: Effect of air temperature and relative humidity on the density of moist air.
    Date
    Source Own work
    Author Anas Emad

    Julia

    using Plots
    
    # Saturated water vapor pressure [Pa]
    # See Ham, 2005. Useful Equations and Tables in Micrometeorology
    function water_vapor_saturated_pressure(Ta, P)
        Ta  =  Ta - 273.15
        es  =  (1.0007 + (3.46e-5 * (P/1e3))) * 0.61121 *
            exp((17.502 * Ta)/(Ta + 240.97)) * 1e3
        return es
    
    end
    
    
    function water_vapor_density(e, Tair)
        Rs_v = 461.5 # J/(kg.K) specific gas constant for water vapor
        ρv = e/(Rs_v * Tair)
        return ρv
    end
    
    
    # Calculate dry air density ρa [ kg m-3]
    # P_a partial pressure of dry air [Pa]
    # Tair air temperature [Kelvin]
    function dry_air_density(P_a, Tair)
        Rs_a = 287.058 # J/(kg. K) specific gas constant for dry air
        ρa = P_a / (Rs_a  * Tair)
        return ρa
    end
    
    
    # Wet air density ρ [kg/m3]
    # Tair air temperature in [Kelvin]
    # P absolute atmospheric pressure [Pa]
    function wet_air_density(RH, Tair, P)
        es = water_vapor_saturated_pressure(Tair, P)
        e = es*RH/100
        ρv = water_vapor_density(e, Tair)
        ρa = dry_air_density(P - e, Tair)
        ρ = ρv + ρa
        return ρ
    end
    
    
    
    # Calculate reference density
    ρref = wet_air_density(0, 25 + 273.15, 1e5)
    
    # Define ranges
    Trange = (1:1:100) .+ 273.15
    RHrange = (0:20:100)
    
    
    # Create plot
    plot(Trange .- 273.15, wet_air_density.(0, Trange, 1e5) ./ ρref, label = "RH = 0 %")
    vline!([25], linestyle = :dash, label = missing)
    for rh in RHrange[2:end]
        display(plot!(Trange .- 273.15, wet_air_density.(rh, Trange, 1e5) ./ ρref, label = "RH = $(rh) %"))
    end
    xlabel!("Temperature [deg C]")
    ylabel!("Density ratio ρ/ρ_ref")
    annotate!(23,0.7, Plots.text("Ref", rotation = 90))
    
    
    savefig("air_density_changes_on_T_and_RH.svg")
    

    Licensing

    I, the copyright holder of this work, hereby publish it under the following license:
    w:en:Creative Commons
    attribution share alike
    This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
    You are free:
    • to share – to copy, distribute and transmit the work
    • to remix – to adapt the work
    Under the following conditions:
    • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
    • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

    Captions

    Air density dependence on temperature and relative humidity as a ratio to a reference density calculated at (25 C, 0% RH)

    Items portrayed in this file

    depicts

    20 November 2020

    image/svg+xml

    73e590eaeb24c4d3c55fcfd4a3f0bc6431a8bd63

    78,590 byte

    400 pixel

    600 pixel

    File history

    Click on a date/time to view the file as it appeared at that time.

    Date/TimeThumbnailDimensionsUserComment
    current17:22, 20 November 2020Thumbnail for version as of 17:22, 20 November 2020600 × 400 (77 KB)wikimediacommons>Anas EmadChange y-axis label

    There are no pages that use this file.