Gas Dynamics module¶
Gas Dynamics Tools.
billig¶
billig.py: Fred Billig’s correlations for hypersonic shockwave shapes.
These are a direct implementation of equations 5.36, 5.37 and 5.38 from J.D. Anderson’s text Hypersonic and High Temperature Gas Dynamics

cfpylib.gasdyn.billig.
delta_over_R
(M, axi)¶ Calculates the normalised standoff distance.

cfpylib.gasdyn.billig.
Rc_over_R
(M, axi)¶ Calculates the normalised radius of curvature of the shock.

cfpylib.gasdyn.billig.
x_from_y
(y, M, theta=0.0, axi=0, R_nose=1.0)¶ Determine the xcoordinate of a point on the shock wave.
Parameters:  y – ycoordinate of the point on the shock wave
 M – freestream Mach number
 theta – angle (in radians wrt freestream direction) of the downstream surface
 axi –
(int) axisymmetric flag:
== 0 : cylinderwedge== 1 : spherecone  R_nose – radius of the forebody (either cylinder or sphere)
It is assumed that, for the ideal gas, gamma=1.4. That’s the only value relevant to the data used for Billig’s correlations.

cfpylib.gasdyn.billig.
y_from_x
(x, M, theta=0.0, axi=0, R_nose=1.0)¶ Determine the ycoordinate of a point on the shock wave.
Parameters:  x – xcoordinate of the point on the shock wave
 M – freestream Mach number
 theta – angle (in radians wrt freestream direction) of the downstream surface
 axi –
(int) axisymmetric flag:
== 0 : cylinderwedge== 1 : spherecone  R_nose – radius of the forebody (either cylinder or sphere)
It is assumed that, for the ideal gas, gamma=1.4. That’s the only value relevant to the data used for Billig’s correlations.
ideal_gas_flow¶
ideal_gas_flow.py: Onedimensional steady flow of an ideal gas.
Contents:
Onedimensional flows:
 Isentropic flow relations. State zero (0) refers to the stagnation condition. State star is the sonic (throat) condition.
 1D (Normal) Shock Relations State 1 is before the shock and state 2 after the shock. Velocities are in a shockstationary frame.
 1D flow with heat addition (Rayleighline) State star is the (hypothetical) sonic condition.
Twodimensional flows:
 PrandtlMeyer functions
 Obliqueshock relations
 TaylorMaccoll conical flow

cfpylib.gasdyn.ideal_gas_flow.
A_Astar
(M, g=1.4)¶ Area ratio A/Astar for an isentropic, quasionedimensional flow.
Parameters:  M – Mach number at area A
 g – ratio of specific heats
Returns: A/Astar

cfpylib.gasdyn.ideal_gas_flow.
T0_T
(M, g=1.4)¶ Total to static temperature ratio for an adiabatic flow.
Parameters:  M – Mach number
 g – ratio of specific heats
Returns: T0/T

cfpylib.gasdyn.ideal_gas_flow.
p0_p
(M, g=1.4)¶ Total to static pressure ratio for an isentropic flow.
Parameters:  M – Mach number
 g – ratio of specific heats
Returns: p0/p

cfpylib.gasdyn.ideal_gas_flow.
r0_r
(M, g=1.4)¶ Stagnation to freestream density ratio for an isentropic flow.
Parameters:  M – Mach number
 g – ratio of specific heats
Returns: r0/r

cfpylib.gasdyn.ideal_gas_flow.
m2_shock
(M1, g=1.4)¶ Mach number M2 after a normal shock.
Parameters:  M1 – Mach number of incoming flow
 g – ratio of specific heats
Returns: M2

cfpylib.gasdyn.ideal_gas_flow.
r2_r1
(M1, g=1.4)¶ Density ratio r2/r1 across a normal shock.
Parameters:  M1 – Mach number of incoming flow
 g – ratio of specific heats
Returns: r2/r1

cfpylib.gasdyn.ideal_gas_flow.
u2_u1
(M1, g=1.4)¶ Velocity ratio u2/u1 across a normal shock.
Parameters:  M1 – Mach number of incoming flow
 g – ratio of specific heats
Returns: u2/u1

cfpylib.gasdyn.ideal_gas_flow.
p2_p1
(M1, g=1.4)¶ Static pressure ratio p2/p1 across a normal shock.
Parameters:  M1 – Mach number of incoming flow
 g – ratio of specific heats
Returns: p2/p1

cfpylib.gasdyn.ideal_gas_flow.
T2_T1
(M1, g=1.4)¶ Static temperature ratio T2/T1 across a normal shock.
Parameters:  M1 – Mach number of incoming flow
 g – ratio of specific heats
Returns: T2/T1

cfpylib.gasdyn.ideal_gas_flow.
p02_p01
(M1, g=1.4)¶ Stagnation pressure ratio p02/p01 across a normal shock.
Parameters:  M1 – Mach number of incoming flow
 g – ratio of specific heats
Returns: p02/p01

cfpylib.gasdyn.ideal_gas_flow.
DS_Cv
(M1, g=1.4)¶ Nodimensional entropy change ds across a normal shock.
Parameters:  M1 – Mach number of incoming flow
 g – ratio of specific heats Cp/Cv
Returns: ds/Cv

cfpylib.gasdyn.ideal_gas_flow.
T0_T0star
(M, g=1.4)¶ Total temperature ratio for flow with heat addition.
Parameters:  M – initial Mach number
 g – ratio of specific heats
Returns: T0/T0star where T0 is the total temperature of the initial flow and T0star is the total temperature that would be achieved if enough heat is added to get to sonic conditions.

cfpylib.gasdyn.ideal_gas_flow.
M_Rayleigh
(T0T0star, g=1.4)¶ Computes M from Total Temperature ratio for Rayleighline flow.
Parameters:  T0T0star – total temperature ratio (star indicating sonic conditions)
 g – ratio of specific heats
Returns: initial Mach number of flow
Note that supersonic flow is assumed for the initial guess.

cfpylib.gasdyn.ideal_gas_flow.
T_Tstar
(M, g=1.4)¶ Static temperature ratio T/Tstar for Rayleighline flow.
Parameters:  M – initial Mach number
 g – ratio of specific heats
Returns: T/Tstar where T is the static temperature of the initial flow and Tstar is the static temperature that would be achieved if enough heat is added to get to sonic conditions.

cfpylib.gasdyn.ideal_gas_flow.
p_pstar
(M, g=1.4)¶ Static pressure ratio p/pstar for Rayleighline flow.
Parameters:  M – initial Mach number
 g – ratio of specific heats
Returns: p/pstar where p is the static pressure of the initial flow and pstar is the static pressure that would be achieved if enough heat is added to get to sonic conditions.

cfpylib.gasdyn.ideal_gas_flow.
r_rstar
(M, g=1.4)¶ Density ratio r/rstar for Rayleighline flow.
Parameters:  M – initial Mach number
 g – ratio of specific heats
Returns: r/rstar where r is the density of the initial flow and rstar is the density that would be achieved if enough heat is added to get to sonic conditions.

cfpylib.gasdyn.ideal_gas_flow.
p0_p0star
(M, g=1.4)¶ Stagnation pressure ratio p0/p0star for Rayleighline flow.
Parameters:  M – initial Mach number
 g – ratio of specific heats
Returns: p0/p0star where p0 is the total pressure of the initial flow and p0star is the total pressure that would be achieved if enough heat is added to get to sonic conditions.

cfpylib.gasdyn.ideal_gas_flow.
PM1
(M, g=1.4)¶ PrandtlMeyer function.
Parameters:  M – Mach number
 g – ratio of specific heats
Returns: PrandtlMeyer function value (in radians)

cfpylib.gasdyn.ideal_gas_flow.
PM2
(nu, g=1.4)¶ Inverse PrandtlMeyer function.
Parameters:  nu – PrandtlMeyer function value (in radians)
 g – ratio of specific heats
Returns: Mach number
Solves the equation PM1(m, g)  nu = 0, assuming supersonic flow.

cfpylib.gasdyn.ideal_gas_flow.
beta_obl
(M1, theta, g=1.4)¶ Oblique shock wave angle.
Parameters:  M1 – upstream Mach number
 theta – flow deflection angle (radians)
Returns: shock angle with respect to initial flow direction (radians)

cfpylib.gasdyn.ideal_gas_flow.
theta_obl
(M1, beta, g=1.4)¶ Compute the deflection angle given the shock wave angle.
Parameters:  M1 – upstream Mach number
 beta – shock angle with respect to initial flow direction (radians)
Returns: theta, flow deflection angle (radians)

cfpylib.gasdyn.ideal_gas_flow.
M2_obl
(M1, beta, theta, g=1.4)¶ Mach number after an oblique shock.
Parameters:  M1 – upstream Mach number
 beta – shock angle with respect to initial flow direction (radians)
Returns: M2, Mach number in flow after the shock

cfpylib.gasdyn.ideal_gas_flow.
r2_r1_obl
(M1, beta, g=1.4)¶ Density ratio r2/r1 across an oblique shock.
Parameters:  M1 – upstream Mach number
 beta – shock angle with respect to initial flow direction (radians)
Returns: r2/r1

cfpylib.gasdyn.ideal_gas_flow.
u2_u1_obl
(M1, beta, g=1.4)¶ Flowspeed ratio u2/u1 across an oblique shock.
Parameters:  M1 – upstream Mach number
 beta – shock angle with respect to initial flow direction (radians)
Returns: u2/u1

cfpylib.gasdyn.ideal_gas_flow.
p2_p1_obl
(M1, beta, g=1.4)¶ Static pressure ratio p2/p1 across an oblique shock.
Parameters:  M1 – upstream Mach number
 beta – shock angle with respect to initial flow direction (radians)
Returns: p2/p1

cfpylib.gasdyn.ideal_gas_flow.
T2_T1_obl
(M1, beta, g=1.4)¶ Static temperature ratio T2/T1 across an oblique shock.
Parameters:  M1 – upstream Mach number
 beta – shock angle with respect to initial flow direction (radians)
Returns: T2/T1

cfpylib.gasdyn.ideal_gas_flow.
p02_p01_obl
(M1, beta, g=1.4)¶ Ratio of stagnation pressures p02/p01 across an oblique shock.
Parameters:  M1 – upstream Mach number
 beta – shock angle with respect to initial flow direction (radians)
Returns: p02/p01

cfpylib.gasdyn.ideal_gas_flow.
theta_cone
(V1, p1, T1, beta, R=287.1, g=1.4)¶ Compute the conesurface angle and conditions given the shock wave angle.
Parameters:  V1 – speed of gas into shock
 p1 – freestream pressure
 T1 – freestream static temperature
 beta – shock wave angle wrt stream direction (in radians)
 R – gas constant
 g – ratio of specific heats
Returns: tuple of theta_c, V_c, p_c, T_c: theta_c is stream deflection angle in radians V_c is the conesurface speed of gas in m/s p_c is the conesurface pressure T_c is the conesurface static temperature
The computation starts with the obliqueshock jump and then integrates across theta until V_theta goes through zero. The cone surface corresponds to V_theta == 0.

cfpylib.gasdyn.ideal_gas_flow.
beta_cone
(V1, p1, T1, theta, R=287.1, g=1.4)¶ Compute the conical shock wave angle given the conesurface deflection angle.
Parameters:  V1 – speed of gas into shock
 p1 – freestream pressure
 T1 – freestream static temperature
 theta – stream deflection angle (in radians)
 R – gas constant
 g – ratio of specific heats
Returns: shock wave angle wrt incoming stream direction (in radians)

cfpylib.gasdyn.ideal_gas_flow.
beta_cone2
(M1, theta, R=287.1, g=1.4)¶ Compute the conical shock wave angle given the conesurface deflection angle and free stream Mach number.
Parameters:  M1 – free stream Mach number
 theta – stream deflection angle (in radians)
 R – gas constant
 g – ratio of specific heats
Returns: shock wave angle wrt incoming stream direction (in radians)
cea2_gas¶
cea2_gas.py: Thermodynamic properties of a gas mixture in chemical equilibrium.
It interfaces to the CEA code by writing a small input file, running the CEA code as a child process and then reading the results from the CEA plot file.
See the report:
Bonnie J. McBride and Sanford Gordon
Computer Program for Calculation of Complex Chemical Equilibrium
Compositions and Applications II. Users Manual and Program
Description. NASA Reference Publication 1311, June 1996.
for details of the input and output file formats.

cfpylib.gasdyn.cea2_gas.
locate_executable_file
(name)¶ Locates an executable file, if available somewhere on the PATH.
Parameters: name – may be a simple file name or fullyqualified path. Returns: the full program name, if is is found and is executable, else None.

cfpylib.gasdyn.cea2_gas.
run_cea_program
(jobName, checkTableHeader=True)¶ Runs the CEA program on the specified job.
Parameters:  jobName – string that is used to construct input and output file names
 checkTableHeader – boolean flag to activate checking of output file table header. We use this as a test to see if the cea2 program has run the job succesfully.

cfpylib.gasdyn.cea2_gas.
get_cea2_float
(token_list)¶ Clean up the CEA2 shorthand notation for exponential format.
CEA2 seems to write exponentialformat numbers in a number of ways:
1.02321.023+21.023 2

class
cfpylib.gasdyn.cea2_gas.
Gas
(reactants={}, onlyList=[], inputUnits='massf', outputUnits='massf', with_ions=False, trace=1e06)¶ Provides the equation of state for the gas.

EOS
(problemType='pT', transProps=True)¶ Computes the gas state, taking into account the hightemperature effects.
It does this by writing a suitable input file for the CEA code, calling that code and then extracting the relevant results from the CEA output or plot file.
Parameters:  self – the gas state to be filled in
 problemType – a string specifying the type of CEA analysis: ‘pT’, ‘rhoT’, ‘rhoe’, ‘ps’, shock
 transProps – a boolean flag: False=don’t request transport props, True=request viscosity and thermalconductivity
Returns: None, but does update the contents of the gas state as a sideeffect.

__init__
(reactants={}, onlyList=[], inputUnits='massf', outputUnits='massf', with_ions=False, trace=1e06)¶ Set up a new object, from either a name of species list.
Parameters:  reactants – dictionary of reactants and their mixture fractions The keys used to specify the reactants in the mix and the (float) values are their mass or molefractions. The names are as per the CEA database. Note that other chemical species may be added to the mix by cea2.
 onlyList – list of strings limiting the species in the mix.
 inputUnits – string ‘moles’ or ‘massf’
 outputUnits – string ‘moles’ or ‘massf’
 with_ions – boolean flag indicating whether electrons and ions should be included in the mix
 trace – fraction below which a species will be neglected in CEA

clone
(newOutputUnits=None)¶ Clone the current Gas object to make another, just the same.
Returns: the new Gas object.

get_fractions
(speciesList)¶ Gets a list of mole or massfractions for the specified species.
Parameters: speciesList – the species names for which we want a list of fractions. Returns: list of floats representing the fractions of each species in the mix Note that the massfractions or molefractions are returned, based on the value of outputUnits in the Gas object.

set_pT
(p, T, transProps=True)¶ Fills out gas state from given pressure and temperature.
Parameters:  p – pressure, Pa
 T – temperature, K

set_ph
(p, h, transProps=True)¶ Fills out gas state from given pressure and enthalpy.
Parameters:  p – pressure, Pa
 h – enthalpy, J/kg

set_ps
(p, s, transProps=True)¶ Fills out gas state from given pressure and specific entropy.
Parameters:  p – pressure, Pa
 s – entropy, J/(kg.K)

set_rhoT
(rho, T, transProps=True)¶ Fills out gas state from given density and temperature.
Parameters:  rho – density, kg/m**3
 T – temperature, K

set_rhoe
(rho, e, transProps=True)¶ Fills out gas state from given density and internal energy.
Parameters:  rho – density, kg/m**3
 e – internal energy of mixture, J/kg

shock_process
(Us)¶ Compute the gas state after being processed by an incident shock.
Parameters: Us – shock speed into quiescent gas, m/s Returns: a reference to the postshock gas state (self)

write_state
(strm)¶ Writes the gas state data to the specified stream.


cfpylib.gasdyn.cea2_gas.
make_gas_from_name
(gasName, outputUnits='massf')¶ Manufacture a Gas object from a small library of options.
Parameters: gasName – one of the names for the special cases set out below Returns: a Gas object

cfpylib.gasdyn.cea2_gas.
list_gas_names
()¶ Returns: the list of gases available in make_gas_from_name()

cfpylib.gasdyn.cea2_gas.
make_reactants_dictionary
(species_list)¶ Creates the CEA reactants dictionary from a list of species in the lib/gas format :param species_list: lib/gas species list

cfpylib.gasdyn.cea2_gas.
get_species_composition
(sp, species_data)¶ Creates a list of mass or mole fractions for a species in lib/gas form from the CEA species_data dictionary :param sp: a single lib/gas species :param species_data: the CEA species_data dictionary

cfpylib.gasdyn.cea2_gas.
get_with_ions_flag
(species_list)¶ Determines the ‘with_ions’ flag from a list of species in the lib/gas format :param species_list: lib/gas species list
libgas_gas¶
libgas_gas.py: access the gas models from the libgas library using the cfpylib/gasdyn interface.

class
cfpylib.gasdyn.libgas_gas.
Gas
(fname='gasmodel.lua', massf=None, molef=None)¶ Provides the place to hold the libgas gas data object and gas model object.

__init__
(fname='gasmodel.lua', massf=None, molef=None)¶ Set up the libgas model from the generic input file.
Parameters:  fname – gasmodel config file
 massf – optional dictionary of mass fractions
 molef – optional dictionary of mole fractions
Rowan’s thermochemistry module uses the Lua file to define the gas model, in detail. There are so many options for this input file that we whimp out and delegate the construction of a suitable file to other tools. One such tool is gasmodel.py which, in turn, delegates all of it’s work to Rowan’s Lua program gasfile.lua.

clone
()¶ Clone the current Gas object to make another, just the same.
Returns: the new Gas object.

set_pT
(p, T, transProps=True)¶ Compute the thermodynamic state from given pressure and temperature.
Parameters:  p – pressure, Pa
 T – temperature, K
 transProps – if True, compute transport properties as well.

set_ps
(p, s, transProps=True)¶ Compute the thermodynamic state from given pressure and entropy
Parameters:  p – pressure, Pa
 s – entropy, J/(kg.K)
 transProps – if True, compute transport properties as well.

set_rhoT
(rho, T, transProps=True)¶ Compute the thermodynamic state from given density and temperature.
Parameters:  rho – density, kg/m**3
 T – temperature, K
 transProps – if True, compute transport properties as well.

write_state
(strm)¶ Writes the gas state data to the specified stream.


cfpylib.gasdyn.libgas_gas.
make_gas_from_name
(gasName)¶ Manufacture a Gas object from a small library of options.
Parameters: gasName – one of the names for the special cases set out below. We might also specify the details of the gas via a Lua gasmodel file or via a compressed lookup table, again in Lua format.

cfpylib.gasdyn.libgas_gas.
list_gas_names
()¶ Returns: the list of gases available in make_gas_from_name()
ideal_gas¶
ideal_gas.py: Thermodynamic properties of an ideal gas.
This module provides a lookalike Gas class for use in the gas flow functions. Whereever cea2_gas works, so should this.

class
cfpylib.gasdyn.ideal_gas.
Gas
(Mmass=28.96, gamma=1.4, name='air', s1=0.0, T1=298.15, p1=101325.0, mu_ref=1.716e05, T_ref=273.0, S_mu=111.0, Prandtl=0.71)¶ Provides the place to keep property data for the ideal gas.

__init__
(Mmass=28.96, gamma=1.4, name='air', s1=0.0, T1=298.15, p1=101325.0, mu_ref=1.716e05, T_ref=273.0, S_mu=111.0, Prandtl=0.71)¶ Set up a new object, from either a name of species list.
Parameters:  Mmass – molecular mass, g/mole
 gamma – ratio of specific heats
 name – string name of gas (something like a species name in cea2_gas)
 s1 – reference entropy, J/kg/K
 T1 – temperature for reference entropy, K
 p1 – pressure for reference entropy, Pa
 mu_ref – reference viscosity for Sutherland expression, Pa.s
 T_ref – reference temperature for Sutherland expression, degree K
 S_mu – constant (degree K) in Sutherlans expression
 Prandtl – mu.C_p/k

clone
()¶ Clone the current Gas object to make another, just the same.
Returns: the new Gas object.

set_pT
(p, T, transProps=True)¶ Fills out gas state from given pressure and temperature.
Parameters:  p – pressure, Pa
 T – temperature, K
 transProps – if True, compute transport properties as well.

set_ph
(p, h, transProps=True)¶ Fills out gas state from given pressure and enthalpy.
Parameters:  p – pressure, Pa
 h – enthalpy, J/kg

set_ps
(p, s, transProps=True)¶ Fills out gas state from given pressure and specific entropy.
Parameters:  p – pressure, Pa
 s – entropy, J/(kg.K)

set_rhoT
(rho, T, transProps=True)¶ Fills out gas state from given density and temperature.
Parameters:  rho – density, kg/m**3
 T – temperature, K

write_state
(strm)¶ Writes the gas state data to the specified stream.


cfpylib.gasdyn.ideal_gas.
make_gas_from_name
(gasName)¶ Manufacture a Gas object from a small library of options.
Parameters: gasName – one of the names for the special cases set out below

cfpylib.gasdyn.ideal_gas.
list_gas_names
()¶ Returns: the list of gases available in make_gas_from_name()
gas_flow¶
gas_flow.py – Gas flow calculations using CEA2 or ideal Gas objects.

cfpylib.gasdyn.gas_flow.
shock_ideal
(state1, Vs, state2)¶ Computes postshock conditions in the shock frame, assuming ideal gas.
Parameters:  state1 – preshock Gas state
 Vs – speed of gas coming into shock
 state2 – postshock Gas state
Returns: the postshock gas speed, V2 in the shockreference frame, Vg in the lab frame.

cfpylib.gasdyn.gas_flow.
normal_shock
(state1, Vs, state2, ideal_gas_guess=None, max_iterations=100, T2_ideal_truncation=20000.0)¶ Computes postshock conditions, using hightemperature gas properties and a shockstationary frame.
Parameters:  state1 – preshock gas state
 Vs – speed of gas coming into shock
 state2 – postshock gas state
 ideal_gas_guess – defaulting to None, otherwise a dictionary of the form {‘gam’:gam,’R’:R} thatis used for the ideal guess at the start of the function when Vs is too high and CEA can’t deal with the ideal guess for state 2
 max_iterations – Maximum amount of iterations for the NewtonRhapson solver that is trying to find the postshock properties.
 T2_ideal_truncation – A truncation of the initial T2 guess to be used when the ideal gas guess provides a temperature too high for cea to set an initial eq gas state, defaults to 20000.0.
Returns: the postshock gas speed, V2 in the shockreference frame, Vg in the lab frame.

cfpylib.gasdyn.gas_flow.
normal_shock_p2p1
(state1, p2p1)¶ Computes postshock conditions, using hightemperature gas properties and a shockstationary frame.
Parameters:  state1 – preshock gas state
 p2p1 – ration of pressure across the shock
Returns: a tuple of the incident shock speed, V1; the postshock gas speed, V2 in the shockreference frame; Vg in the lab frame; and the post shock state state2.

cfpylib.gasdyn.gas_flow.
reflected_shock
(state2, Vg, s5)¶ Computes state5 which has brought the gas to rest at the end of the shock tube.
Parameters:  state2 – the postincidentshock gas state
 Vg – the labframe velocity of the gas in state 2
 s5 – the stagnation state that will be filled in (as a side effect of this function)
Returns: Vr, the reflected shock speed in the lab frame.

cfpylib.gasdyn.gas_flow.
expand_from_stagnation
(p_over_p0, state0)¶ Given a stagnation condition state0, expand to a new pressure.
Parameters:  p_over_p0 – pressure ratio
 state0 – Gas object specifying stagnation conditions
Returns: new gas state and the corresponding velocity (in m/s) of the expanded stream.

cfpylib.gasdyn.gas_flow.
total_condition
(state1, V1)¶ Given a freestream condition and velocity, compute the corresponding stagnant condition at which the gas is brought to rest isentropically.
Parameters:  state1 – Gas object specifying freestream condition
 V1 – freestream velocity, m/s
Returns: Gas object specifying gas total conditions (isentropic, stagnant)

cfpylib.gasdyn.gas_flow.
pitot_condition
(state1, V1)¶ Given a freestream condition, compute the corresponding Pitot condition at which the gas is brought to rest, possibly through a shock.
Parameters:  state1 – Gas object specifying freestream condition
 V1 – freestream velocity, m/s
Returns: Gas object specifying gas impact conditions, possibly after processing be a normal shock.

cfpylib.gasdyn.gas_flow.
steady_flow_with_area_change
(state1, V1, A2_over_A1, tol=0.0001)¶ Given station 1 condition, velocity and arearatio A2/A1, compute the steady, isentropic condition at station 2.
Parameters:  state1 – Gas object specifying condition at station 1
 V1 – velocity at station 1, m/s
 A2_over_A1 – area ratio between stations A2/A1
 tol – tolerance for secant solver to find nozzle outlet condition
Returns: tuple (V2, state2) of conditions at station 2

cfpylib.gasdyn.gas_flow.
finite_wave_dp
(characteristic, V1, state1, p2, steps=100)¶ Process the gas isentropically, following a characteristic line.
See Section 7.6 Finite Nonlinear Waves in JD Anderson’s text Modern Compressible Flow.
Parameters:  characteristic – is either ‘cplus’ or ‘cminus’
 V1 – initial gas velocity, in m/s
 state1 – initial gas state
 p2 – new pressure after processing, in Pa
 steps – number of small steps to take through the process
Returns: flow condition after processing, as tuple (V2, state2)

cfpylib.gasdyn.gas_flow.
finite_wave_dv
(characteristic, V1, state1, V2_target, steps=100, Tmin=200.0)¶ Process the gas isentropically, following a characteristic line.
See Section 7.6 Finite Nonlinear Waves in JD Anderson’s text Modern Compressible Flow.
Parameters:  characteristic – is either ‘cplus’ or ‘cminus’
 V1 – initial gas velocity, in m/s
 state1 – initial gas state
 V2_target – desired velocity after processing, in m/s Note that we may not reach the requested velocity before pressure and temperature become too small.
 steps – number of small steps to take through the process
 Tmin – temperature (in Kelvin) below which we terminate the process. We have this minimum to avoid problems with the thermodynamic polynomials of CEA2 program. If you really want to work with very low temperatures, it’s probably best to use an ideal gas model.
Returns: flow condition after processing, as tuple (V2, state2)

cfpylib.gasdyn.gas_flow.
theta_oblique
(state1, V1, beta)¶ Compute the deflection angle and postshock conditions given the shock wave angle.
Parameters:  state1 – upstream gas condition
 V1 – speed of gas into shock
 beta – shock wave angle wrt stream direction (in radians)
Returns: tuple of theta, V2 and state2: theta is stream deflection angle in radians V2 is postshock speed of gas in m/s state2 is postshock gas state

cfpylib.gasdyn.gas_flow.
beta_oblique
(state1, V1, theta)¶ Compute the oblique shock wave angle given the deflection angle.
Parameters:  state1 – upstream gas condition
 V1 – speed of gas into shock
 theta – stream deflection angle (in radians)
Returns: shock wave angle wrt incoming stream direction (in radians)

cfpylib.gasdyn.gas_flow.
theta_cone
(state1, V1, beta)¶ Compute the conesurface angle and conditions given the shock wave angle.
Parameters:  state1 – upstream gas condition
 V1 – speed of gas into shock
 beta – shock wave angle wrt stream direction (in radians)
Returns: tuple of theta_c, V_c and state_c: theta_c is stream deflection angle in radians V_c is conesurface speed of gas in m/s state_c is conesurface gas state
The computation starts with the obliqueshock jump and then integrates across theta until V_theta goes through zero. The cone surface corresponds to V_theta == 0.

cfpylib.gasdyn.gas_flow.
beta_cone
(state1, V1, theta)¶ Compute the conical shock wave angle given the conesurface deflection angle.
Parameters:  state1 – upstream gas condition
 V1 – speed of gas into shock
 theta – stream deflection angle (in radians)
Returns: shock wave angle wrt incoming stream direction (in radians)
sutherland¶
sutherland.py – Sutherland form of viscosity and thermal conductivity for a few gases.
Species available: Air, N2, O2, H2, CO2, CO, Ar.
Reference for coefficients: White FM (2006) Viscous Fluid Flow, pp.28

cfpylib.gasdyn.sutherland.
sutherland
(T, T_ref, S)¶ Sutherland’s expression relating the quantity, at temperature T, to the value at the reference temperature.
Parameters:  T – temperature in degrees K
 T_ref – reference temperature (degrees K)
 S – Sutherland constant (degrees K)
Returns: ratio of property at temperature T to reference value.

cfpylib.gasdyn.sutherland.
mu
(T, gname)¶ Coefficient of dynamic viscosity.
Parameters:  T – temperature in degrees K
 gname – string specifying gas name (for dictionary lookup)
Returns: coefficient of dynamic viscosity, in Pa.s.

cfpylib.gasdyn.sutherland.
k
(T, gname)¶ Coefficient of thermal conductivity.
Parameters:  T – temperature in degrees K
 gname – string specifying gas name (for dictionary lookup)
Returns: thermal conductivity, in W/(m.K)