Maxwell-Boltzmann Distribution Function

Computer Methods in Chemical Engineering


Problem Statement: The Maxwell-Boltzmann distribution function describes the distribution of the speed of gaseous molecules.

                m    1.5         m*v2
   f(T,v)=4p*(------)   *exp(- -----)*v2
              2p*k*T           2*k*T
   where
   v = Speed (m/sec)
   m = Mass of molecule = 32 g/mole for oxygen
   k = Boltzmann (gas) constant = 8.319 Joule/mole-K
   T = Temperature (K)
  1. Write a FORTRAN program to input m, T, and v. Evaluate f and print the result. (Make sure the units are consistent.)

    Solution:

  2. Rewrite the Boltzmann function from the last homework assignment as a FORTRAN function. Provide a main program that calls the Boltzmann function f(T,v). A user should not see any difference in the behavior of this executable program from that of the last homework assignment. (This is a practice in writing a subprogram).

    Solution:

  3. Modify the above FORTRAN program to print a table of the Boltzmann distribution function f(v) at various velocities v. (This is a practice in a simple DO-loop.)

    Solution:

  4. At a given temperature T, the cumulative Boltzmann distribution function F(v) gives the fraction of molecules having velocities less than v.
             óv
      F(v) = ô   f(T,V)dV
             õ0
    
    Modify the last FORTRAN program to numerically integrate the Boltzmann distribution function with the trapezoidal rule. (Rather than simply printing out the values of the Boltzmann distribution function, as was done in the last problem, we sum them up in a DO-loop in this problem. Thus, this problem incrementally builds on the last one.) What is the effect of the step size? Do small step sizes give better results?

    Solution:

    Effect of the step size is studied by running the program with the following conditions:
        Molecular mass (Dalton):  32.
        Temperatuer (K):         273.
        Velocity (m/sec):        500.
        ------------------------
        step size     Integral
        ------------------------
        500.        4.532006E-01   (step size is too corse)
        200.        5.266181E-01
        100.        6.775070E-01
         10.        6.821138E-01
          2.        6.821581E-01   (The answer, accurate to 4 significant digits,
          1.        6.821594E-01    is probably 6.822.)
          0.5       6.821603E-01
          0.1       6.820492E-01
          0.01      6.819008E-01
          0.001     6.799245E-01
          0.0001    6.953111E-01
          0.00001   7.211619E-01   (took forever to compute)
        ------------------------
    
    The answer, accurate to 4 significant digits, is probably 6.822. One would typically change the step size, or equivalently the number of steps, and study whether a change in the step size leads to a significantly different solution. This is a brute-force way of roughly estimating the accuracy of the result. It is important to realize that finer step sizes chews up more computation time and can actually leads to worse results because of round up error.

  5. Take out the trapezoidal integration algorithm from the above problem and place it in a FORTRAN function named TRAPZ
      TRAPZ (f, xlo, xhi, nstep)
        where TRAPZ returns the integral of f
              f     = the function to be integrated (input).
                      f is a function of one variable (i.e., f(x)).  f should be
                      declared as an external function in the calling program.
              xlo   = lower integration limit (input).
              xhi   = upper integration limit (input).
              nstep = number of integration steps (input).
    
              óxhi
      TRAPZ = ô  f(x)*dx
              õxlo
    
    TRAPZ should be able to handle almost any reasonably behaved function. Test your integration subprogram by calling the TRAPZ integration routine to calculate the integral of a few simple functions (e.g., f(x)=x, f(x)=sin(x), etc.) (Do not submit the programs you use to test your TRAPZ; submit only the integral of the Boltzmann distribution function.) After you are convinced that your integration subprogram TRAPZ is acting properly, apply it to calculate the cumulative Boltzmann function from the last homework assignment. (This is another practice in writing a subprogram. You should now have two functions besides the main program: a function TRAPZ which tells the computer how to integrate numerically and a function that specifies the integrand.)

    Solution:

  6. Rewrite the FORTRAN program from the above problem to calculate the cumulative Boltzmann function by calling a routine from a library, rather than implementing the trapezoidal rule yourself, as done above. (This is a practice in using an existing routine from a library. You may use a routine from any library of your choice. Of course, you should get results similar to the above program.)

    Solution:

  7. At a given temperature T, calculate the mean speed of molecules that follow the Maxwell-Boltzmann distribution.
                 ó¥
      v_ave(T) = ô   v*f(T,v)dv
                 õ0
    
    where f(T,v) is the Boltzmann distribution function given in earlier homework assignments. (This problem lets you practice writing a function, which can be modified slightly for the next problem. Specifically, you should start with an integrand function v*f and integrate it from 0 to ¥.)

    Solution:

  8. Given the mean speed (or equivalently the mean energy level) of molecules, write a program to find the temperature for a system that follows the Maxwell-Boltzmann distribution.

    Background. In reaction kinetics, we sometimes want to find the temperature at which the system has enough energy to undergo reaction. Energy and speed are related by: energy=mass*speed^2/2. This is a problem in solving a problem of the general form "f(x)=0". Specifically, the function "f=0" here is "v_mean(T) - given_mean_speed = 0", and the independent variable "x" in this problem is the temperature T.

    Solution:


Problem Statement:

  1. Write a Mathcad program to define the function f, and plot f(v) versus v for T=100°K, 200°K,..., 800°K.
  2. The fraction of molecules with speed less than c is given by the following cumulative distribution function:
                óc
       F(T,c) = ô  f(T,v) dv
                õ0
    
       integral (from 0 to c)  f(T,v) dv  (if you don't see the integral symbol above)
    
    Write a program to define the function F.
  3. The kinetic energy of a molecule is related to its velocity by:
       E = m*v2/2
    
    Find the temperature at which 10% of the oxygen molecules have energy higher than 10kJ/mole.
  4. Write a function that returns the average speed at T.
                ó¥
       vave(T) = ô  v*f(T,v) dv
                õ0
    
       integral (from 0 to infinity)  v*f(T,v) dv  (if you don't see the integral symbol above)
    

Solution:


Return to Prof. Nam Sun Wang's Home Page
Return to Computer Methods in Chemical Engineering (ENCH250)

Computer Methods in Chemical Engineering -- Maxwell-Boltzmann Distribution Function
Forward comments to:
Nam Sun Wang
Department of Chemical & Biomolecular Engineering
University of Maryland
College Park, MD 20742-2111
301-405-1910 (voice)
301-314-9126 (FAX)
e-mail: nsw@umd.edu ©1996-2006 by Nam Sun Wang
UMCP logo