Real Gas Viscosity Method


Real Gas Viscosity Method

So far in this chapter, we have tested our equation solver methods on a simple test case. Now let's apply one of them to a realistic problem ”computing the viscosity coefficient of a multicomponent gas mixture. If you remember from Chapter 18, "Building Class Hierarchies,"we deferred implementation of the real gas viscosity method because it required the solution of a system of equations. We are now ready to implement that method. It is important to remember when reading this section to focus on the process. Even if you never need a real gas viscosity method, you can apply the process described in this section to set up and solve your own system of equations problems.

The viscosity coefficient of a multicomponent gas mixture can be obtained by solving Boltzmann's equation using a Sonine polynomial expansion. Because of the rapid convergence of the Sonine polynomials , an accurate representation of the mixture viscosity coefficient can be obtained by including only the first term in the expansion. The resulting equation is ”

Equation 19.20

graphics/19equ20.gif


On the surface Eq. (19.20) looks very simple. The mixture viscosity coefficient ( h ) is equal to the sum of the species mole fractions ( x j ) and the Sonine polynomial coefficients ( b j (1)). The trick is to evaluate the coefficients. It turns out they can be obtained by solving a system of equations.

Equation 19.21

graphics/19equ21.gif


The N parameter in Eq. (19.21) is the number of species in the gas mixture. The elements of the H matrix can be evaluated according to Eq. (19.22).

Equation 19.22

graphics/19equ22.gif


In Eq. (19.22), the x terms are the species mole fractions, the m terms are the species molar masses in gm/mole, T is the temperature, and graphics/19inl01.gif and graphics/19inl02.gif are reduced collision integrals. The Kronecker delta term, d ij , is equal to 1 if i = j and 0 otherwise . The µ ik term is the reduced mass of a species pair and is given by the expression in Eq. (19.23).

Equation 19.23

graphics/19equ23.gif


The process for computing the mixture viscosity coefficient is straightforward. We simply load up the H matrix and solve the system of equations Hx = b . The b vector will initially store the species mole fractions. Once the system of equations is solved , the b vector will be overwritten to contain the expansion coefficients. Once the expansion coefficients are obtained, we can compute the mixture viscosity coefficient according to Eq. (19.20).

We will augment the RealGas class, first described in Chapter 18, to include a getViscosity() method that will compute the real gas viscosity coefficient. The code listing for the method is shown next . The getViscosity() method uses the gaussian() method to solve the system of equations Hx = b .

 public double getViscosity() {   double viscosity, tmp, T, lnT, sqrtT;   int i,j,k,n;   double delta[][] =          new double[numSpecies][numSpecies];   double Omega11[][] =          new double[numSpecies][numSpecies];   double Omega22[][] =          new double[numSpecies][numSpecies];   double sqrtMu[][] =          new double[numSpecies][numSpecies];   double H[][] = new double[numSpecies][numSpecies];   double m[] = new double[numSpecies];   double b[] = new double[numSpecies];   //  species molar mass is converted to gm/mole   for (i=0; i<numSpecies; ++i) {     m[i] = 1000.0*getSpecies(i).getMolarMass();   }   //  Compute the Kronecker delta, reduced mass,   //  and define some local convenience variables   T = getTemperature();   lnT = Math.log(T);   sqrtT = Math.sqrt(T);   for (i=0; i<numSpecies; ++i) {     for (j=0; j<numSpecies; ++j) {       delta[i][j] = 0.0;       sqrtMu[i][j] =           Math.sqrt((m[i]*m[j])/(m[i]+m[j]));     }     delta[i][i] = 1.0;   }   //  Compute the collision integrals   for (i=0; i<numSpecies; ++i) {     for (j=0; j<numSpecies; ++j) {       tmp = A11[i][j]*lnT*lnT +             B11[i][j]*lnT + C11[i][j];       Omega11[i][j] = E11[i][j]*Math.pow(T,tmp);       tmp = A22[i][j]*lnT*lnT +             B22[i][j]*lnT + C22[i][j];       Omega22[i][j] = E22[i][j]*Math.pow(T,tmp);     }   }   //  Load up the b vector and the diagonal   //  H terms   for(i=0; i<numSpecies; ++i) {     b[i] = moleFr[i];     H[i][i] = 0.0;     for(k=0; k<numSpecies; ++k) {          H[i][i] += sqrtMu[i][k]*moleFr[k]*52979.0*      ((5.0/3.0)*m[i]*(1.0 - delta[i][k])*Omega11[i][k] +                 m[k]*(1.0 + delta[i][k])*Omega22[i][k])/                 (m[i] + m[k]);     }     H[i][i] *= moleFr[i]/(m[i]*sqrtT);   }   //  Load up the off-diagonal H terms   for(i=0; i<numSpecies; ++i) {     for(j=i+1; j<numSpecies; ++j) {       H[i][j] = sqrtMu[i][j]*moleFr[i]*moleFr[j]*  52979.0*(-(5.0/3.0)*Omega11[i][j] + Omega22[i][j])/                   ( sqrtT*(m[i] + m[j]) );     }     for(j=0; j<i; ++j) {       H[i][j] = sqrtMu[i][j]*moleFr[i]*moleFr[j]*  52979.0*(-(5.0/3.0)*Omega11[i][j] + Omega22[i][j])/                   ( sqrtT*(m[i] + m[j]) );     }   }   //  Solve Hx=b and compute viscosity convert it   //  to units of kg/m-s by multiplying value by 0.1   EqnSolver.gaussian(H,b);   viscosity = 0.0;   for(i=0; i<numSpecies; ++i) {     viscosity += moleFr[i]*b[i];   }   return 0.1*viscosity; } 

Let's test our new viscosity method by writing a driver program named ViscosityDemo.java . The program creates a FiveSpeciesAir object corresponding to a five species air gas mixture at a temperature of 1000 K. The getViscosity() method is called to compute the viscosity coefficient of the gas mixture. Because we have modified the RealGas.java class, you will have to recompile the RealGas.java source code in the TechJava\Gas directory (compile it from the package root directory).

 import TechJava.Gas.*; public class ViscosityDemo {    public static void main(String args[]) {       FiveSpeciesAir gas =            new FiveSpeciesAir(1000.0, 100000.0);       System.out.println("viscosity = " +           gas.getViscosity() + " kg/m-s");    } } 

Output ”

 viscosity = 4.56260372708E-5 kg/m-s 


Technical Java. Applications for Science and Engineering
Technical Java: Applications for Science and Engineering
ISBN: 0131018159
EAN: 2147483647
Year: 2003
Pages: 281
Authors: Grant Palmer

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net