Sunday, March 26, 2017

Determining the DRY AIR GAS CONSTANT

Based on samplings of the earths atmosphere, the primary gases are the following:


  • Nitrogen - 78%
  • Oxygen - 21 %
  • Argon - .9 %
  • Carbon Dioxide .04 %




But that's not it, there are several trace elements in air that include neon, helium, methane, krypton, hydrogen, xenon, nitrous oxide, ozone, iodine, carbon monoxide and ammonia.

Each of the gases listed above have a moleculor mass as shown in the following Java code:

private static final double H2_MOLECULAR_MASS = 2.01588; // kg/kmol
private static final double HE_MOLECULAR_MASS = 4.002602; // kg/kmol
private static final double N2_MOLECULAR_MASS = 28.0134; // kg/kmol 
private static final double O2_MOLECULAR_MASS = 31.9988; // kg/kmol
private static final double NE_MOLECULAR_MASS = 20.1797; // kg/kmol
private static final double AR_MOLECULAR_MASS = 39.948; // kg/kmol
private static final double KR_MOLECULAR_MASS = 83.798; // kg/kmol
private static final double I2_MOLECULAR_MASS = 253.80894; // kg/kmol
private static final double XE_MOLECULAR_MASS = 131.293; // kg/kmol
private static final double CO2_MOLECULAR_MASS = 44.0095; // kg/kmol
private static final double CH4_MOLECULAR_MASS = 16.04246; // kg/kmol
private static final double N2O_MOLECULAR_MASS = 44.0128; // kg/kmol
private static final double OE_MOLECULAR_MASS = 47.9982; // kg/kmol
private static final double CO_MOLECULAR_MASS = 28.0101; // kg/kmol
private static final double NH3_MOLECULAR_MASS = 17.03052; // kg/kmol


Determining the Dry Air Gas Constant


Since we have the volume ratio and molecular mass of each gas component of air, we can multiple them together to get the molecular mass in the air for each gas.  And then with the total value, we can divide it into the universal gas constant (8314.32) to get the dry air gas constant.  The following air sample is from professor Shakhashiri chemical of the week newsletter and the table format is from the Engineering Toolbox's article on molecular mass.



Components
in Dry Air
Volume Ratio
compared to Dry Air
Molecular Mass -
M(kg/kmol)
Molecular
Mass in Air
nitrogen (N2) .7808 28.0134 21.87286272
oxygen (O2) .2095 31.9988 6.7037486
argon (AR) .0093 39.948 0.37151639999999997
carbon dioxide
(CO2)
.00033 44.0095 0.014523135000000001
neon (NE) .000018 20.1797 3.6323460000000003E-4
helium (HE) .0000052 4.002602 2.0813530400000002E-5
methane (CH4) .000002 16.04246 3.2084919999999996E-5
krypton (KR) .0000011 83.798 9.217780000000001E-5
hydrogen (H2) .0000005 2.01588 1.00794E-6
xenon (XE) .000000087 131.293 1.1422491E-5
nitrous oxide (N2) .0000005 44.0128 2.20064E-5
ozone (OE) .00000001 47.9982 4.79982E-7
iodine (I2) 0 253.80894 0.0
carbon monoxide
(CO) 
0 28.0101 0.0
ammonia (NH3) 0 16.04246 0.0
Total: 28.963194082663403


Now in three java statements... let's get the dry air gas constant!!!


private static final double UNIVERSAL_GAS_CONSTANT = 8314.32;  

private static final double MOLECULAR_WEIGHT_OF_DRY_AIR = 28.963194082663403

private static final double DRY_AIR_GAS_CONSTANT = (UNIVERSAL_GAS_CONSTANT / MOLECULAR_WEIGHT_OF_DRY_AIR);  

==> DRY_AIR_GAS_CONSTANT NOW EQUALS: 287.065

=====================================================
=====================================================
=====================================================

Want to try it yourself?  Use the following Java code taken from JAirDensity:

/*
 * JAirDensity 
 * Copyright (C) 2017 Robert James Liguori
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.gliesian.jairdensity;

//Reference: http://www.engineeringtoolbox.com/molecular-mass-air-d_679.html
public class DryAir {

    // ATOMIC MASSES http://www.convertunits.com/molarmass/
    private static final double H2_MOLECULAR_MASS = 2.01588; // 1
    private static final double HE_MOLECULAR_MASS = 4.002602; // 2
    private static final double N2_MOLECULAR_MASS = 28.0134; // 7 
    private static final double O2_MOLECULAR_MASS = 31.9988; //8
    private static final double NE_MOLECULAR_MASS = 20.1797; // 10
    private static final double AR_MOLECULAR_MASS = 39.948; // 18
    private static final double KR_MOLECULAR_MASS = 83.798; // 36
    private static final double I2_MOLECULAR_MASS = 253.80894; // 53
    private static final double XE_MOLECULAR_MASS = 131.293; // 54
    private static final double CO2_MOLECULAR_MASS = 44.0095;
    private static final double CH4_MOLECULAR_MASS = 16.04246;
    private static final double N2O_MOLECULAR_MASS = 44.0128;
    private static final double OE_MOLECULAR_MASS = 47.9982;
    private static final double CO_MOLECULAR_MASS = 28.0101;
    private static final double NH3_MOLECULAR_MASS = 17.03052;

    /// PPM * 
    // three major constituents of air
    private double nitrogen = 0; // N2
    private double oxygen = 0;   // O2
    private double argon = 0;    // Ar

    // Water vapor accounts for roughly 0.25% of the atmosphere by mass
    // Trace gases
    private double carbonDioxide = 0;  //CO2
    private double neon = 0;  // Ne 
    private double helium = 0; // He
    private double methane = 0; // CH4

    // Very Trace Gases
    private double krypton = 0; // Kr
    private double hydrogen = 0; // H2
    private double xenon = 0; // Xe
    private double nitrousOxide = 0;   // N2O
    private double ozone = 0;   // Oe
    private double iodine = 0;   // I2
    private double ammonia = 0;   // CO
    private double carbonMonoxide = 0;   // NH3

    public DryAir() {
        // Default Dataset
        this.useChemWiscEduDryAirDataset();
        //this.useThoughtCoDataset();
        //this.useWikipediaDryAirDataset();
    }

    // Allow user to setup there own air
    public DryAir(double nitrogenM, double oxygenM, double argonM, double carbonDioxideM, double neonM, double heliumM, double methaneM, double kryptonM, double hydrogenM, double xenonM, double nitrousOxideM, double ozoneM, double iodineM, double carbonMonoxideM, double ammoniaM) {

        /// PPM * 
        // three major constituents of air
        this.nitrogen = nitrogenM * N2_MOLECULAR_MASS; // N2
        this.oxygen = oxygenM * O2_MOLECULAR_MASS;   // O2
        this.argon = argonM * AR_MOLECULAR_MASS;  // Ar

        // Water vapor accounts for roughly 0.25% of the atmosphere by mass
        // Trace gases
        this.carbonDioxide = carbonDioxideM * CO2_MOLECULAR_MASS;  //CO2
        this.neon = neonM * NE_MOLECULAR_MASS;  // Ne 
        this.helium = heliumM * HE_MOLECULAR_MASS; // He
        this.methane = methaneM * CH4_MOLECULAR_MASS; // CH4

        // Very Trace Gases
        this.krypton = kryptonM * KR_MOLECULAR_MASS; // Kr
        this.hydrogen = hydrogenM * H2_MOLECULAR_MASS; // H2
        this.xenon = xenonM * XE_MOLECULAR_MASS; // Xe
        this.nitrousOxide = nitrousOxideM * N2O_MOLECULAR_MASS;   // H2
        this.ozone = ozoneM * OE_MOLECULAR_MASS;   // Oe
        this.iodine = iodineM * I2_MOLECULAR_MASS;   // I2
        this.carbonMonoxide = carbonMonoxideM * CO_MOLECULAR_MASS;   // CO
        this.ammonia = ammoniaM * NH3_MOLECULAR_MASS;   // NH3

    }

    // https://en.wikipedia.org/wiki/Atmosphere_of_Earth
    public void useWikipediaDryAirDataset() {
        /// PPM * 
        // three major constituents of air
        this.nitrogen = .780840 * N2_MOLECULAR_MASS; // N2
        this.oxygen = .209460 * O2_MOLECULAR_MASS;   // O2
        this.argon = .009340 * AR_MOLECULAR_MASS;  // Ar

        // Water vapor accounts for roughly 0.25% of the atmosphere by mass
        // Trace gases
        this.carbonDioxide = .00040000 * CO2_MOLECULAR_MASS;  //CO2
        this.neon = .00001818 * NE_MOLECULAR_MASS;  // Ne 
        this.helium = .00000524 * HE_MOLECULAR_MASS; // He
        this.methane = .00000179 * CH4_MOLECULAR_MASS; // CH4

        // Very Trace Gases
        this.krypton = 0 * KR_MOLECULAR_MASS; // Kr
        this.hydrogen = 0 * H2_MOLECULAR_MASS; // H2
        this.xenon = 0 * XE_MOLECULAR_MASS; // Xe
        this.nitrousOxide = 0 * N2O_MOLECULAR_MASS;   // H2
        this.ozone = 0 * OE_MOLECULAR_MASS;   // Oe
        this.iodine = 0 * I2_MOLECULAR_MASS;   //I2
        this.carbonMonoxide = 0.0 * CO_MOLECULAR_MASS;   // CO
        this.ammonia = 0.0 * NH3_MOLECULAR_MASS;   // NH3
    }

    // http://scifun.chem.wisc.edu/CHEMWEEK/PDF/airgas.pdf
    private void useChemWiscEduDryAirDataset() {
        this.nitrogen = .7808 * N2_MOLECULAR_MASS; // N2
        this.oxygen = .2095 * O2_MOLECULAR_MASS;   // O2
        this.argon = .0093 * AR_MOLECULAR_MASS;  // Ar

        this.carbonDioxide = .00033 * CO2_MOLECULAR_MASS;  //CO2
        this.neon = .000018 * NE_MOLECULAR_MASS;  // Ne 
        this.helium = .0000052 * HE_MOLECULAR_MASS; // He
        this.methane = .000002 * CH4_MOLECULAR_MASS; // CH4

        this.krypton = .0000011 * KR_MOLECULAR_MASS; // Kr
        this.hydrogen = .0000005 * H2_MOLECULAR_MASS; // H2
        this.xenon = .000000087 * XE_MOLECULAR_MASS; // Xe
        this.nitrousOxide = .0000005 * N2O_MOLECULAR_MASS;   // H2
        this.ozone = .00000001 * OE_MOLECULAR_MASS;   // Oe
        this.iodine = 0 * I2_MOLECULAR_MASS;   // I2
        this.carbonMonoxide = 0.0 * CO_MOLECULAR_MASS;   // CO
        this.ammonia = 0.0 * NH3_MOLECULAR_MASS;   // NH3
    }

    //https://www.thoughtco.com/chemical-composition-of-air-604288
    private void useThoughtCoDataset() {
        this.nitrogen = .78084 * N2_MOLECULAR_MASS; // N2
        this.oxygen = .209476 * O2_MOLECULAR_MASS;   // O2
        this.argon = .00934 * AR_MOLECULAR_MASS;  // Ar

        this.carbonDioxide = .00014 * CO2_MOLECULAR_MASS;  //CO2
        this.neon = .00001818 * NE_MOLECULAR_MASS;  // Ne 
        this.helium = .00000524 * HE_MOLECULAR_MASS; // He
        this.methane = .000002 * CH4_MOLECULAR_MASS; // CH4

        this.krypton = .00000114 * KR_MOLECULAR_MASS; // Kr
        this.hydrogen = .0000005 * H2_MOLECULAR_MASS; // H2
        this.xenon = .000000087 * XE_MOLECULAR_MASS; // Xe
        this.nitrousOxide = .00000002 * N2O_MOLECULAR_MASS;   // H2
        this.ozone = .00000007 * OE_MOLECULAR_MASS;   // Oe
        this.iodine = .00000001 * I2_MOLECULAR_MASS;    // I2
        this.carbonMonoxide = 0.0 * CO_MOLECULAR_MASS;   // CO
        this.ammonia = 0.0 * NH3_MOLECULAR_MASS;   // NH3
    }

    /**
     * @return the ammonia
     */
    public double getAmmonia() {
        return ammonia;
    }

    /**
     * @param aAmmonia the ammonia to set
     */
    public void setAmmonia(double aAmmonia) {
        ammonia = aAmmonia;
    }

    /**
     * @return the carbonMonoxide
     */
    public double getCarbonMonoxide() {
        return carbonMonoxide;
    }

    /**
     * @param aCarbonMonoxide the carbonMonoxide to set
     */
    public void setCarbonMonoxide(double aCarbonMonoxide) {
        carbonMonoxide = aCarbonMonoxide;
    }

    /**
     * @return the iodine
     */
    public double getIodine() {
        return iodine;
    }

    /**
     * @param aIodine the iodine to set
     */
    public void setIodine(double aIodine) {
        iodine = aIodine;
    }

    /**
     * @return the nitrogen
     */
    public double getNitrogen() {
        return nitrogen;
    }

    /**
     * @param aNitrogen the nitrogen to set
     */
    public void setNitrogen(double aNitrogen) {
        nitrogen = aNitrogen;
    }

    /**
     * @return the oxygen
     */
    public double getOxygen() {
        return oxygen;
    }

    /**
     * @param aOxygen the oxygen to set
     */
    public void setOxygen(double aOxygen) {
        oxygen = aOxygen;
    }

    /**
     * @return the argon
     */
    public double getArgon() {
        return argon;
    }

    /**
     * @param aArgon the argon to set
     */
    public void setArgon(double aArgon) {
        argon = aArgon;
    }

    /**
     * @return the carbonDioxide
     */
    public double getCarbonDioxide() {
        return carbonDioxide;
    }

    /**
     * @param aCarbonDioxide the carbonDioxide to set
     */
    public void setCarbonDioxide(double aCarbonDioxide) {
        carbonDioxide = aCarbonDioxide;
    }

    /**
     * @return the neon
     */
    public double getNeon() {
        return neon;
    }

    /**
     * @param aNeon the neon to set
     */
    public void setNeon(double aNeon) {
        neon = aNeon;
    }

    /**
     * @return the helium
     */
    public double getHelium() {
        return helium;
    }

    /**
     * @param aHelium the helium to set
     */
    public void setHelium(double aHelium) {
        helium = aHelium;
    }

    /**
     * @return the methane
     */
    public double getMethane() {
        return methane;
    }

    /**
     * @param aMethane the methane to set
     */
    public void setMethane(double aMethane) {
        methane = aMethane;
    }

    /**
     * @return the krypton
     */
    public double getKrypton() {
        return krypton;
    }

    /**
     * @param aKrypton the krypton to set
     */
    public void setKrypton(double aKrypton) {
        krypton = aKrypton;
    }

    /**
     * @return the hydrogen
     */
    public double getHydrogen() {
        return hydrogen;
    }

    /**
     * @param aHydrogen the hydrogen to set
     */
    public void setHydrogen(double aHydrogen) {
        hydrogen = aHydrogen;
    }

    /**
     * @return the xenon
     */
    public double getXenon() {
        return xenon;
    }

    /**
     * @param aXenon the xenon to set
     */
    public void setXenon(double aXenon) {
        xenon = aXenon;
    }

    /**
     * @return the nitrousOxide
     */
    public double getNitrousOxide() {
        return nitrousOxide;
    }

    /**
     * @param aNitrousOxide the nitrousOxide to set
     */
    public void setNitrousOxide(double aNitrousOxide) {
        nitrousOxide = aNitrousOxide;
    }

    /**
     * @return the ozone
     */
    public double getOzone() {
        return ozone;
    }

    /**
     * @param aOzone the ozone to set
     */
    public void setOzone(double aOzone) {
        ozone = aOzone;
    }

    public String toString() {

        return "\nMolecular Mass in Air: " + getMoleculeMassInAir()
                + "\n  nitrogen       " + getNitrogen()
                + "\n  oxygen         " + getOxygen()
                + "\n  argon          " + getArgon()
                + "\n  carbonDioxide  " + getCarbonDioxide()
                + "\n  neon           " + getNeon()
                + "\n  helium         " + getHelium()
                + "\n  methane        " + getMethane()
                + "\n  krypton        " + getKrypton()
                + "\n  hydrogen       " + getHydrogen()
                + "\n  xenon          " + getXenon()
                + "\n  nitrousOxide   " + getNitrousOxide()
                + "\n  ozone          " + getOzone()
                + "\n  iodine         " + getIodine()
                + "\n  carbonMonoxide " + getCarbonMonoxide()
                + "\n  ammonia        " + getAmmonia();
    }

    public double getMoleculeMassInAir() {

        return getOxygen()
                + getNitrogen()
                + getCarbonDioxide()
                + getHydrogen()
                + getArgon()
                + getNeon()
                + getHelium()
                + getKrypton()
                + getMethane()
                + getNitrousOxide()
                + getXenon()
                + getOzone()
                + getIodine();
    }

    public static void main(String[] args) {

        DryAir da = new DryAir();

        da.useWikipediaDryAirDataset();
        System.out.println(da);

        da.useChemWiscEduDryAirDataset();
        System.out.println(da);

        da.useThoughtCoDataset();
        System.out.println(da);

    }

}



No comments:

Post a Comment

The source code for gliesians.com is for sale on Ebay.

I've decided to shut down gliesians.com and sell the source code. If anyone is looking to purchase the related source, you can find it...