#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "../../util/source/compiler.h"
#include "../../util/source/useful.h"
#include "gas.h"
#include "tgas1.h"
#include "n2eq.h"
#include "co2eq.h"
#include "n2vibe.h"
#include "argon.h"
#include "lut.h"
#include "noneq/perf_gas_mix.h"
#include "noneq/mTg.h"
Defines | |
| #define | MAX_STEPS 30 |
| #define | MAX_RELATIVE_STEP 0.1 |
| #define | DBG_PT 0 |
| #define | DBG_RHOT 0 |
| #define | DBG_RHOP 0 |
| #define | HIGH_ORDER_DIFF 1 |
| #define | HIGH_ORDER_DIFF 1 |
| #define | EZERO 0.0 |
| #define | RA (ideal_gas[0].R) |
| #define | MA (ideal_gas[0].M) |
| #define | CVA (ideal_gas[0].C_v) |
| #define | CPA (ideal_gas[0].C_p) |
| #define | PRA (ideal_gas[0].Prandtl) |
| #define | RB (ideal_gas[1].R) |
| #define | MB (ideal_gas[1].M) |
| #define | CVB (ideal_gas[1].C_v) |
| #define | CPB (ideal_gas[1].C_p) |
| #define | PRB (ideal_gas[1].Prandtl) |
| #define | MAMB (sqrt(ideal_gas[0].M / ideal_gas[1].M)) |
| #define | RA (ideal_gas[0].R) |
| #define | MA (ideal_gas[0].M) |
| #define | CVA (ideal_gas[0].C_v) |
| #define | CPA (ideal_gas[0].C_p) |
| #define | PRA (ideal_gas[0].Prandtl) |
| #define | RB (ideal_gas[1].R) |
| #define | MB (ideal_gas[1].M) |
| #define | CVB (ideal_gas[1].C_v) |
| #define | CPB (ideal_gas[1].C_p) |
| #define | PRB (ideal_gas[1].Prandtl) |
| #define | MAMB (sqrt(ideal_gas[0].M / ideal_gas[1].M)) |
| #define | RA (ideal_gas[0].R) |
| #define | MA (ideal_gas[0].M) |
| #define | CVA (ideal_gas[0].C_v) |
| #define | CPA (ideal_gas[0].C_p) |
| #define | PRA (ideal_gas[0].Prandtl) |
| #define | RB (ideal_gas[1].R) |
| #define | MB (ideal_gas[1].M) |
| #define | CVB (ideal_gas[1].C_v) |
| #define | CPB (ideal_gas[1].C_p) |
| #define | PRB (ideal_gas[1].Prandtl) |
| #define | MAMB (sqrt(ideal_gas[0].M / ideal_gas[1].M)) |
| #define | DEBUG_LUT_MIX 0 |
| #define | MIN_MOLES 0.0 |
| #define | MIN_MASS_FRAC 1.0e-30 |
Functions | |
| int | copy_gas_data (struct gas_data *src, struct gas_data *dest) |
| Make a complete copy of the gas data. | |
| int | accumulate_gas_data (struct gas_data *src, struct gas_data *dest, double alpha) |
| Accumulative copy of the gas data. | |
| int | print_gas_data (struct gas_data *src) |
| Print all gas_state data to stdout. | |
| double * | copy_gas_data_to_buffer (struct gas_data *src, double *buf) |
| Copy the abbreviated gas_data into a linear data buffer. | |
| double * | copy_buffer_to_gas_data (struct gas_data *dest, double *buf) |
| Copy the abbreviated gas_data from a linear data buffer. | |
| int | number_of_values_in_gas_data_copy (void) |
| Returns the number of double elements in each gas data copy. | |
| int | set_ideal_gas_properties (int i, double R, double Gamma, double Prandtl, double Lewis, double mu_ref, double T_ref, double S) |
| int | set_type_of_gas (int gas_index) |
| Selects the gas model. | |
| int | gas_type (void) |
| eosfn * | get_EOS_function_pointer (void) |
| Returns the pointer to the current equation of state function. | |
| int | get_number_of_species (void) |
| int | get_number_of_vibrational_species (void) |
| int | separate_electron_energy (void) |
| double | gas_rhomin (void) |
| double | gas_pmin (void) |
| double | gas_amin (void) |
| double | gas_Tmin (void) |
| double | gas_Tmax (void) |
| gas_data * | new_gas_data_struct (void) |
| int | set_massf (struct gas_data *Q, int isp, double mf) |
| Set the mass fraction for a particular species. | |
| double | get_massf (struct gas_data *Q, int isp) |
| Get the mass fraction for a particular species. | |
| double | get_conc (struct gas_data *Q, int isp) |
| Get the molar concentration for a particular species. | |
| int | set_Tvib (struct gas_data *Q, int isp, double Tvib) |
| Set the vibrational temperature for a particular species. | |
| double | get_Tvib (struct gas_data *Q, int isp) |
| Get the vibrational temperature for a particular species. | |
| int | set_evib (struct gas_data *Q, int isp, double evib) |
| Set the vibrational energy for a particular species. | |
| double | get_evib (struct gas_data *Q, int isp) |
| Get the vibrational energy for a particular species. | |
| int | EOS_rhoe (struct gas_data *Q, int use_T_guess, int evaluate_visc_coeff) |
| Evaluate thermodynamic state from given density and specific internal energy. | |
| int | EOS_pT (struct gas_data *Q, int evaluate_visc_coeff) |
| Compute the density, specific internal energy and local speed of sound from the pressure and temperature. | |
| int | EOS_rhoT (struct gas_data *Q, int evaluate_visc_coeff) |
| Compute the gas properties from given density and temperature. | |
| int | EOS_rhop (struct gas_data *Q, int evaluate_visc_coeff) |
| Compute the gas properties from given density and pressure. | |
| double | dTdp_const_rho (struct gas_data *Q) |
| Compute the derivative of temperature wrt pressure. | |
| double | dTdrho_const_p (struct gas_data *Q) |
| Compute the derivative of temperature wrt density. | |
| int | eos_ideal_gas_one_species (struct gas_data *Q, int use_T_guess, int evaluate_visc_coeff) |
| Compute the pressure, temperature and local speed of sound from the density and the specific internal energy for a single-species ideal gas. | |
| int | eos_weird_167 (struct gas_data *Q, int use_T_guess, int evaluate_visc_coeff) |
| A strange nitrogen model to match DSMC calculations. | |
| int | eos_argon_power_law (struct gas_data *Q, int use_T_guess, int evaluate_visc_coeff) |
| An argon model with power-law viscosity to match DSMC calculations. | |
| int | eos_argon_lennard_jones (struct gas_data *Q, int use_T_guess, int evaluate_visc_coeff) |
| An argon model with Lennard-Jones viscosity and constants fitted to Chapman and Cowling's figure 10. | |
| int | eos_lut_one_species (struct gas_data *Q, int use_T_guess, int evaluate_visc_coeff) |
| A single-species gas using the look-up-table for properties. | |
| int | eos_lut_n_species (struct gas_data *Q, int use_T_guess, int evaluate_visc_coeff) |
| Multiple-species mix where all properties come from a number of look-up-tables. | |
| int | eos_equil_air_tannehill (struct gas_data *Q, int use_T_guess, int evaluate_visc_coeff) |
| Single-species mixture model for air. | |
| int | eos_equil_n2_paj (struct gas_data *Q, int use_T_guess, int evaluate_visc_coeff) |
| Nitrogen in chemical equilibrium. | |
| int | eos_equil_co2_iaj (struct gas_data *Q, int use_T_guess, int evaluate_visc_coeff) |
| Carbon-dioxide in chemical equilibrium. | |
| int | eos_equil_vib_n2 (struct gas_data *Q, int use_T_guess, int evaluate_visc_coeff) |
| Nonreaction nitrogen but with vibrational energy in thermodynamic equilibrium. | |
| int | eos_ideal_gas_binary_mix (struct gas_data *Q, int use_T_guess, int evaluate_visc_coeff) |
| Mix of two ideal gases. | |
| int | eos_equil_vib_n2_he_mix (struct gas_data *Q, int use_T_guess, int evaluate_visc_coeff) |
| Mix of nitrogen (species 0) with equilibrium vibrational energy with ideal helium (species 1). | |
| int | eos_ionize_ar_n2_mix (struct gas_data *Q, int use_T_guess, int evaluate_visc_coeff) |
| Mix of ideal nitrogen (species 0) with ionizing argon (species 1). | |
| int | eos_lut_mix (struct gas_data *Q, int use_T_guess, int evaluate_visc_coeff) |
| Look-Up-Table for one species plus mix of perfect gases. | |
| int | eos_null_function (struct gas_data *Q, int use_T_guess, int evaluate_visc_coeff) |
| Dummy function. | |
| double | fill_in_concentrations (int first_sp, int last_sp, double rho, double *f, double *mol_w, double *c) |
| double | fill_in_mass_fractions (int first_sp, int last_sp, double rho, double *c, double *mol_w, double *f) |
* Revisions as gas.c... * ------------------ * 28-Jan-96 : First built from pieces of physics.h, state.c * and transprt.c. * 29-May-96 : put nsp into this module * MAYBE_STATIC work vectors * 03-Nov-96 : Updated multi-species code. * 17-Nov-96 : merged viscous coefficients into the EOS calculation. * 05-Feb-97 : added Nitrogen in vibrational equilibrium * 08-Feb-97 : helium + nitrogen in vib. equil. * 01-Mar-97 : argon + air (perfect gases) * 16-Mar-97 : ionizing argon + inert nitrogen (vib. eq.) * 23-Mar-97 : mass fraction checking now done by decode_conserved() * 13-Apr-97 : optionally supply a guess for temperature * 22-Sep-97 : Number of species is set by set_type_of_gas() * 15-Oct-97 : Change pragmas to suit Cray * 01-Apr-99 : Added Look-up-table equation of state. * 12-Sep-99 : Two species gas using LUT * 26-Jul-02 : mixture of perfect gases ( R.Gollan ) * 28-Sep-02 : Moved to cfd/gas_models/source; separated from mb_cns * 2004 : MPI buffer copies, more access for scripting languages. * 12-Sep-05 : extra functions for Daniel's Riemann solver *
|
||||||||||||||||
|
Accumulative copy of the gas data. Typically used in the CFD code to replace bad-cell data. |
|
||||||||||||
|
Copy the abbreviated gas_data from a linear data buffer.
|
|
||||||||||||
|
Make a complete copy of the gas data. Typically used in the CFD code to make ghost-cell copies. |
|
||||||||||||
|
Copy the abbreviated gas_data into a linear data buffer.
|
|
|
Compute the derivative of temperature wrt pressure.
|
|
|
Compute the derivative of temperature wrt density.
|
|
||||||||||||||||
|
Compute the pressure, temperature and local speed of sound from the density and the specific internal energy for a single-species ideal gas.
* Also, the following elements of the gas state are updated... * p : pressure in Pa * T : absolute temperature, degrees K * a : sound speed, m/s * * ...and, if the viscous_flag is set... * mu : molecular viscosity in Pa.s * lmbda : second viscosity coefficient, Pa.s * k : thermal conductivity coefficient *
|
|
||||||||||||||||
|
Look-Up-Table for one species plus mix of perfect gases.
* The so-called-species are: * 0 LUT * 1 argon * 2 helium * 3 nitrogen * 4 air * This arrangement (of having LUT as species 0) allows us * to drop back to using the eos_lut_one_species() function * when the LUT gas is the only significant component. * |
|
||||||||||||||||
|
Multiple-species mix where all properties come from a number of look-up-tables. Note that only one table at a time provides the gas-mix properties. This table is determined by the dominant species (as measured by mass fraction). |
|
||||||||||||||||
|
A single-species gas using the look-up-table for properties. Note that a mix of gases in chemical equilibrium is handled by this model. Use the Chemical Equilibrium Analysis program from NASA Glenn to generate the table. The programs cea_driver.tcl and cea_to_binary.c are provided to automate the table generation process. |
|
||||||||||||
|
Compute the density, specific internal energy and local speed of sound from the pressure and temperature. The process used is going to be a bit slow but this function is not intended for use within the inner loops of the simulation code.
|
|
||||||||||||||||
|
Evaluate thermodynamic state from given density and specific internal energy. This is a convenience function so that we don't always have to deal with function pointers. The real work is delegated to the specialized EOS functions, one for each gas model.
|
|
||||||||||||
|
Compute the gas properties from given density and pressure. The process used is going to be a bit slow but this function is not intended for use within the inner loops of the simulation code.
|
|
||||||||||||
|
Compute the gas properties from given density and temperature. The process used is going to be a bit slow but this function is not intended for use within the inner loops of the simulation code.
|
|
||||||||||||
|
Get the molar concentration for a particular species. This function is mainly to allow convenient access from the SWIG interface. |
|
|
Returns the pointer to the current equation of state function. The CFD functions can then invoke the appropriate EOS for the gas model. |
|
||||||||||||
|
Get the vibrational energy for a particular species. This function is mainly to allow convenient access from the SWIG interface. |
|
||||||||||||
|
Get the mass fraction for a particular species. This function is mainly to allow convenient access from the SWIG interface. |
|
||||||||||||
|
Get the vibrational temperature for a particular species. This function is mainly to allow convenient access from the SWIG interface. |
|
|
Returns the number of double elements in each gas data copy. We need this to work out where we should be in the buffer for each copy. |
|
||||||||||||||||
|
Set the vibrational energy for a particular species. This function is mainly to allow convenient access from the SWIG interface. |
|
||||||||||||||||
|
Set the mass fraction for a particular species. This function is mainly to allow convenient access from the SWIG interface. |
|
||||||||||||||||
|
Set the vibrational temperature for a particular species. This function is mainly to allow convenient access from the SWIG interface. |
|
|
Selects the gas model. This is done by setting the gas model equation-of-state pointer and a few other gas-model specific constants.
|
1.4.4