Gaseqs

Contents:
Introduction
Simplest Example
Solving Equations
Using Memories
Learned Equations
Other Stuff
Log File and Error Recovery
Source

Introduction

The fun in Gas Dynamics is to figure out what equations to use in what order to solve problems. But grinding out the numbers is a drag. Gaseqs is intended to solve this problem by quickly (and correctly!) evaluating the equations for you.

Use gaseqs to solve problems with the book next to you; gaseqs won't tell you what equations to use; it simply evaluates the equations you select.

Gaseqs does not have the power of Mathcad. However, it does not require knowledge of programming. It is probably also quicker for simple problems.

The examples below show how the program works. Best is to do the examples while you are reading this, to see how it works.

Simplest Example

To use gaseqs, download the Windows 98+ program by clicking here, and unzip it to your desktop (c:\windows\desktop, or wherever you want to put it.) Double click gaseqs.exe to use it.

Alternatively, log in to the Engineering cluster (X-Win32 or telnet) and execute the command:

~dommelen/bin/gaseqs

You will see the following screen:

For help see http://www.eng.famu.fsu.edu/~dommelen/courses/gas/software/gaseqs/

Available equations (eqno=equation_number to select):
Saved Equations:
    none              none              none                         none
Learned Equation:
    none           
Thermodynamics:
    1.9r p            1.9r T            1.9r rho          1.22 cp        
    1.23 cv           1.36 s2-s1/cv    1.37m s2-s1/cv  
Isentropic States:
  1.43pt p2/p1      1.43tp T2/T1      1.43pr p2/p1      1.43rp rho2/rho1 
Speed of Sound:
    3.19 a            3.20 a         
Stagnation Quantities:
    3.28 Tt/T        3.28i M            3.30 pt/p        3.30i M
    3.31 rhot/rho    3.31i M
Normal Shock:
    3.51 M2           3.53 r2/r1        3.57 p2/p1        3.59 T2/T1     
    3.64 pt2/pt1
Heat Addition:
    3.85 p/p*         3.86 T/T*         3.88 pt/pt*       3.89 Tt/Tt*
Friction:
   3.103 T/T*        3.104 p/p*        3.106 pt/pt*      3.107 4fL*/D
Quasi 1D flow:
    5.20 A/A*         5/28 Me        
Shock Tubes:
    7.23 MR           7.94 p4/p1

============================= Active Equations =============================
Stagnation Quantities: pt/p from M
eqno        pt/p     (    gamma           M       )
3.30      1.00000        1.40000            0.
============================================================================

Enter "exit"  or "name=new_value" [eqno=]: 

Now suppose you are given that the Mach number at a point is 2 and you are asked to evaluate the ratio of total to static temperature Tt/T at that point. The relevant equation is (3.28) in the third edition of the book. So select equation (3.28) using

eqno=3.28

or more simply, just enter

3.28

(The part "eqno=" is does not have to be entered, since it is the default, as shown within the square brackets of the prompt above.

The screen now shows equation 3.28 with default values:

============================= Active Equations =============================
Tt/T as a function of the local Mach number M                   
eqno        Tt/T     (    gamma           M       )
3.28      1.00000        1.40000            0.     
============================================================================
 
Enter "exit"  or "name=new_value" [M=]: 

Note that if we are talking air, gamma is already set to the right value 1.4. Now, simply set M to the desired value 2 using

M=2

(case sensitive, so you must use a capital M) or more simply

2

since M is the default. The screen will show the correct answer Tt/T=1.8:

============================= Active Equations =============================
Tt/T as a function of the local Mach number M                   
eqno        Tt/T     (    gamma           M       )
3.28      1.80000        1.40000       2.00000     
============================================================================
Tt/T =   1.80000    
Enter "exit"  or "name=new_value" [M=]: 

and be ready to accept the next input. Note the updated equation 3.28 just above the answer.

If you enter

A1

you will see the corresponding line from Table A1:

       M           pt/p        rhot/rho        Tt/T          A/A*
   2.00000       7.82445       4.34692       1.80000       1.68750
Enter "exit"  or "name=new_value" [M=]: 

This works whenever an equation is selected for which the first argument is gamma and the last M, like 3.28 in this case. The 5 entries in table A1 are also in memory locations `m, `p, `r, `t, and `a, (these are backward quotes), until you use A1 again. For example, to verify that (pt/p)/(Tt/T) is really rhot/rho, enter "eval=`p/`t". The program responds:

The expression evaluates to:    4.34692
Enter "exit"  or "name=new_value" [M=]:

Especially for big equations, it is much quicker and safer to use gaseqs than to use your calculator. Try 3.59 of the book for M=2 and gamma=1.2 with a calculator and with gaseqs. And we can do more with gaseqs, as shown in the following sections.

Solving Equations

As a more complicated example, let us now use equation 3.28 to find the Mach number given that the temperature ratio Tt/T=2. (The correct Mach number is about 2.25 according to table A1). We now need to solve 3.28 for M given Tt/T=2. The program can help doing this.

If you did the previous example, your screen should still show:

Enter "exit"  or "name=new_value" [M=]: M=2
============================= Active Equations =============================
Tt/T as a function of the local Mach number M                   
eqno        Tt/T     (    gamma           M       )
3.28      1.80000        1.40000       2.00000     
============================================================================
Tt/T =   1.80000    
Enter "exit"  or "name=new_value" [M=]: 

Enter the desired value 2 for Tt/T:

Tt/T=2

The program responds

Please enter the variable to search for or "quit" [M]:

Since you do not want to find the value of gamma, but of M, simply press return since M is the default. The program continues:

I need the endpoints of a range of M to search in:
First end point to use or "quit" [   2.00000    ]:

What happens here is that while the program will search for you for the correct M so that Tt/T equals the desired 2, it needs two Mach numbers to search in between. You must give those. Also, at one of the two Mach numbers you give it, Tt/T must be too low (less than 2), and at the other too high (greater than 2). Note that the program suggests the current value of M it has, 2, as the first of the two. Just hit return to accept it. Then the program comes back to ask for the other:

Other end point to use or "quit": 

The program cannot think of another good M value, so it leaves it to you. If you try 1, you get into trouble:

 *** the two values:
        Tt/T(    2.00000) =    1.80000
     and
        Tt/T(    1.00000) =    1.20000
     should enclose the desired value
        Tt/T =    2.00000
     Please enter a value for M that gives a value of Tt/T that is
     greater than    2.00000    , or "quit":

The difficulty is that Tt/T at M=1 and M=2 are both less than the desired value 2. So try entering 3. That works; the program responds with the desired solution:

============================= Active Equations =============================
Tt/T as a function of the local Mach number M                   
eqno        Tt/T     (    gamma           M       )
3.28      2.00000        1.40000       2.23607     
============================================================================
Desired value has been found for M =   2.23607    
Enter "exit"  or "name=new_value" [M=]: 

The desired Mach number is shown to be 2.23607. That is more accurate than the 2.25 we estimated from table A1.

Using Memories

Suppose we are given that the Mach number is 2 and the temperature 288 K and we are asked to find the total temperature. We could find Tt/T as in the simplest example above and type in the found numbers in our calculator, but gaseqs has a simple calculator build in.

If you followed the examples above, your screen shows:

============================= Active Equations =============================
Tt/T as a function of the local Mach number M                   
eqno        Tt/T     (    gamma           M       )
3.28      2.00000        1.40000       2.23607     
============================================================================
Desired value has been found for M =   2.23607    
Enter "exit"  or "name=new_value" [M=]: 

Now enter the following

M=2>TR

This sets the Mach number to 2 ("M=" could have been left out) and stores the resulting temperature ratio Tt/T to a memory location named "TR". The ">" instructs the program to store the result of the equation Tt/T to memory. The program responds:

Tt/T =   1.80000     (stored to memory TR)
Enter "exit"  or "name=new_value" [M=]: 

To find the total temperature, now multiply this temperature ratio with 288 using the "eval" function:

eval=TR*288

The program prints the result:

The expression evaluates to:    518.400    
Enter "exit"  or "name=new_value" [M=]: 

The program shows the answer to be 518.4.

Notes:

Learned Equations

Suppose you want to evaluate Tt1/T2 across a normal shock a lot of times, or find M1 given Tt1/T2. Having an equation giving Tt1/T2 as a function of the Mach number M1 would make this easy, but there is no such function in gaseqs. Fortunately, you can make this function yourself, by making the program learn how to evaluate it. The steps follow. First enter:

learn

This makes the program start learning what you do. It responds:

============================= Active Equations =============================
Tt/T as a function of the local Mach number M                   
eqno        Tt/T     (    gamma           M       )
3.28      1.80000        1.40000       2.00000     
The current learned equation                                    
eqno         ???     ()
 LEARN         0.      
============================================================================
Learning...
LEARNING Enter "exit"  or "name=new_value" [M=]: 

Note that in addition to the current equation (3.28), we also have an equation called LEARN with so far nothing in it. Now evaluate Tt1/T2 for a sample Mach number M1 (we will use 2) by storing M1, then using that to evaluate Tt1/T1 using equation (3.28), T2/T1 using equation (3.59), and dividing the results. So, first store 2 in a memory location M1:

store=2>M1

The program responds:

============================= Active Equations =============================
Tt/T as a function of the local Mach number M                   
eqno        Tt/T     (    gamma           M       )
3.28      1.80000        1.40000       2.00000     
The current learned equation                                    
eqno         M1      (      M1      )
 LEARN    2.00000        2.00000     
============================================================================
The value stored in M1 is:    2.00000    
LEARNING Enter "exit"  or "name=new_value" [M=]: 

Note that we now have a learned function that accepts a Mach number M1 and returns that same Mach number. Not very useful! But it will be. Set the Mach number M in 3.28 equal to the memory value M1 and store the result for Tt/T in memory location a1:

M=M1>a1

"M=" could have been left out. The program responds:

============================= Active Equations =============================
Tt/T as a function of the local Mach number M                   
eqno        Tt/T     (    gamma           M       )
3.28      1.80000        1.40000       2.00000     
The current learned equation                                    
eqno     3.28:Tt/T   (      M1      )
 LEARN    1.80000        2.00000     
============================================================================
Tt/T =   1.80000     (stored to memory a1)
LEARNING Enter "exit"  or "name=new_value" [M=]: 

We now have a learned function that computes the value of Tt/T from M1 using 3.28. It does exactly the same as 3.28! Still not very useful. Select equation (3.59):

eqno=3.59

The learned equation stays the same.

============================= Active Equations =============================
Temperature ratio T2/T1 across a normal shock from M1           
eqno       T2/T1     (    gamma           M1      )
3.59      1.00000        1.40000       1.00000     
The current learned equation                                    
eqno     3.28:Tt/T   (      M1      )
 LEARN    1.80000        2.00000     
============================================================================
 
LEARNING Enter "exit"  or "name=new_value" [M1=]: 

Set the Mach number in 3.59 to memory value M1 and store the result for T2/T1 in a2:

M1=M1>a2

The program shows:

============================= Active Equations =============================
Temperature ratio T2/T1 across a normal shock from M1           
eqno       T2/T1     (    gamma           M1      )
3.59      1.68750        1.40000       2.00000     
The current learned equation                                    
eqno     3.59:T2/T1  (      M1      )
 LEARN    1.68750        2.00000     
============================================================================
T2/T1 =   1.68750     (stored to memory a2)
LEARNING Enter "exit"  or "name=new_value" [M1=]: 

The learned equation now does the same as 3.59. But, finally, divide a1 by a2 and store the resulting temperature ratio Tt1/T2 in memory location TR:

eval=a1/a2>TR

The program responds:

============================= Active Equations =============================
Temperature ratio T2/T1 across a normal shock from M1           
eqno       T2/T1     (    gamma           M1      )
3.59      1.68750        1.40000       2.00000     
The current learned equation                                    
eqno         TR      (      M1      )
 LEARN    1.06667        2.00000     
============================================================================
The expression evaluates to:    1.06667    
LEARNING Enter "exit"  or "name=new_value" [M1=]: 

TR is the value we want. We are done. Enter:

end

to end the learning process. The program responds:

============================= Active Equations =============================
The current learned equation                                    
eqno         TR      (      M1      )
learned   1.06667        2.00000     
============================================================================
Equation learned
Enter "exit"  or "name=new_value" [M1=]: 

We now have the learned equation called "learned" that evaluates TR=Tt1/T2 given M1. Try it out by giving M1 the value 1. You should get 1.2. Also, for large Mach numbers, like 20, you will get fairly close to 1 since T2 is relatively close to Tt2 which equals Tt1. For infinite Mach number, the value is about 1.029

Notes:

learn
store=1.4>gm
store=2>M1
eqno=3.28
gamma=gm
M=M1>a1
eqno=3.59
gamma=gm
M1=M1>a2
eval=a1/a2>TR
end

Other Stuff

If you enter "A1" at the prompt, you will get a line from Table A1, but only if the currently selected function has gamma as its first argument and M as its last. Many functions are of that form. (If the selected function is not, simply select 3.28.) The columns will be stored to memory locations `m (M), `p (pt/p), `r (rhot/rho), `t (Tt/T), and `a (A/A*).

Similarly, if you enter "A2" you get an abbreviated table A2. The columns will be stored to ~m (M1), ~p (p2/p1), ~r (rho2/rho1), ~t (T2/T1), ~P (pt2/pt1), ~q (pt2/p1), and ~M (M2).

Similarly, if you enter "A3" you get an abbreviated table A3. The columns will be stored to ~m (M), ~p (p/p*), ~r (rho/rho*), ~t (T/T*), ~P (pt/pt*), and ~T (Tt/Tt*).

Similarly, if you enter "A4" you get an abbreviated table A4. The columns will be stored to ~m (M), ~t (T/T*), ~p (p/p*), ~r (rho/rho*), ~P (pt/pt*), and ~f (4fL*/D).

Log File and Error Recovery

The program maintains a log file of all screen output called gaseqs.log. You can print that for a hardcopy of what was computed.

Also, if the program crashed on you or you made a mistake somewhere, you can recover your work from the log file. Copy the log file to a recovery file using either of the following two Unix commands:

cp gaseqs.log gaseqs.rcv
grep '^input-->' gaseqs.log > gaseqs.rcv

The difference between the two is that the first copies all output to the recovery file and the second only what you input during execution. In any case, edit this file with an editor such as pico to correct the input that you messed up;

pico -w gaseqs.rcv

and then run the gaseqs program again. It will now take all inputs from the recovery file until that runs out. Since you corrected your mistake it will do it right this time.

Don't forget to delete the recovery file after you have what you want. Otherwise it will keep recovering whenever you rerun the program. Delete gaseqs.rcv with:

rm gaseqs.rcv

Source

The Fortran source files are here. They are copyrighted.


Up to the software page