Initial commit of "Rocket Workbench".
Taken from sources in CVS at:
https://sourceforge.net/projects/rocketworkbench/
Sources extracted in two steps:
1. Pull entire project tree into a subdir "rwb" via "rsync":
rsync -a a.cvs.sourceforge.net::cvsroot/rocketworkbench/ rwb/.
2. Export sources:
export CVSROOT=$(pwd)/rwb
SUBDIRS="analyser cpropep cpropep-web CVSROOT data libcompat libcpropep libnum libsimulation libthermo prop rocketworkbench rockflight"
mkdir rwbx; cd rwbx
cvs export -D now ${SUBDIRS}
After this (and some backups for safety), the directory content was
added to a Git repo:
git init .
git add *
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
ROOT = ../../..
|
||||
include $(ROOT)/config/presrc.mk
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
CC = bcc32
|
||||
CPP32 = cpp32
|
||||
LIBRARIAN = tlib
|
||||
LINKER = ilink32
|
||||
RC = brc32
|
||||
|
||||
COPT = -3 -O2 -w-8004 -w-8012 -w-8057 -IC:\borland\bcc55\include
|
||||
LDOPT = -LC:\borland\bcc55\lib
|
||||
|
||||
INCLUDEDIR = -I..\..\libnum\ -I.
|
||||
|
||||
DEF = -DBORLAND
|
||||
|
||||
COMPAT_LIBNAME = compat.lib
|
||||
CPROPEP_LIBNAME = cpropep.lib
|
||||
THERMO_LIBNAME = thermo.lib
|
||||
|
||||
COMPAT_LIBOBJS = compat.obj getopt.obj
|
||||
THERMO_LIBOBJS = load.obj thermo.obj
|
||||
CPROPEP_LIBOBJS = equilibrium.obj print.obj performance.obj derivative.obj
|
||||
|
||||
TLIBCOMPAT = +compat.obj +getopt.obj
|
||||
TLIBTHERMO = +load.obj +thermo.obj
|
||||
TLIBCPROPEP = +equilibrium.obj +print.obj +performance.obj +derivative.obj
|
||||
.SUFFIXES: .c
|
||||
|
||||
all: $(CPROPEP_LIBNAME) $(THERMO_LIBNAME) $(COMPAT_LIBNAME)
|
||||
|
||||
.c.obj:
|
||||
$(CC) $(DEF) $(INCLUDEDIR) $(COPT) -c $*.c -o $*.obj
|
||||
|
||||
$(COMPAT_LIBNAME): $(COMPAT_LIBOBJS)
|
||||
tlib $@ $(TLIBCOMPAT)
|
||||
|
||||
$(CPROPEP_LIBNAME): $(CPROPEP_LIBOBJS)
|
||||
tlib $@ $(TLIBCPROPEP)
|
||||
|
||||
$(THERMO_LIBNAME): $(THERMO_LIBOBJS)
|
||||
tlib $@ $(TLIBTHERMO)
|
||||
|
||||
clean:
|
||||
del *.obj
|
||||
del *.bak
|
||||
del *.tds
|
||||
|
||||
deep-clean: clean
|
||||
del $(COMPAT_LIBNAME)
|
||||
del $(CPROPEP_LIBNAME)
|
||||
del $(THERMO_LIBNAME)
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifndef const_h
|
||||
#define const_h
|
||||
|
||||
/* molar gaz constant in J/(mol K)*/
|
||||
#define R 8.31451
|
||||
|
||||
/* earth gravitational acceleration */
|
||||
#define Ge 9.80665
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
#ifndef conversion_h
|
||||
#define conversion_h
|
||||
|
||||
|
||||
/* pressure units */
|
||||
enum
|
||||
{
|
||||
ATM,
|
||||
PSI,
|
||||
BAR,
|
||||
KPA
|
||||
};
|
||||
|
||||
/* Transform calories to joules */
|
||||
#define CAL_TO_JOULE 4.1868
|
||||
|
||||
/* Transform pound/(cubic inch) to gram/(cubic centimeter) */
|
||||
#define LBS_IN3_TO_G_CM3 27.679905
|
||||
|
||||
/* Transform different pressure units */
|
||||
|
||||
#define ATM_TO_PA 101325.0
|
||||
#define ATM_TO_PSI 14.695949
|
||||
#define ATM_TO_BAR 1.01325
|
||||
|
||||
#define BAR_TO_PSI 14.503774
|
||||
|
||||
#define BAR_TO_ATM 0.98692327
|
||||
#define PSI_TO_ATM 0.068045964
|
||||
#define KPA_TO_ATM 0.0098692327
|
||||
|
||||
/* Length */
|
||||
|
||||
#define M_TO_CM 100.0
|
||||
#define M_TO_IN 39.370079
|
||||
|
||||
#define IN_TO_M 0.0254
|
||||
|
||||
/* Surface */
|
||||
|
||||
#define M2_TO_CM2 10000.0
|
||||
#define M2_TO_IN2 1550.0031
|
||||
|
||||
/* Volume */
|
||||
|
||||
#define M3_TO_CM3 1000000.0
|
||||
#define M3_TO_IN3 61023.744
|
||||
|
||||
/* Mass flow */
|
||||
|
||||
#define KG_S_TO_LB_S 2.2046226
|
||||
|
||||
|
||||
/* force */
|
||||
|
||||
/* newton to pound-force */
|
||||
#define N_TO_LBF 0.22480894
|
||||
#define LBF_TO_N 4.4482216
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef derivative_h
|
||||
#define derivative_h
|
||||
|
||||
#include "equilibrium.h"
|
||||
|
||||
int derivative(equilibrium_t *e);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,156 @@
|
||||
#ifndef equilibrium_h
|
||||
#define equilibrium_h
|
||||
/* equilibrium.h - Calculation of Complex Chemical Equilibrium */
|
||||
/* $Id: equilibrium.h,v 1.1.1.1 2001/07/20 03:19:06 antoine Exp $ */
|
||||
/* Copyright (C) 2000 */
|
||||
/* Antoine Lefebvre <antoine.lefebvre@polymtl.ca> */
|
||||
/* Mark Pinese <pinese@cyberwizards.com.au> */
|
||||
/* */
|
||||
/* Licensed under the GPLv2 */
|
||||
|
||||
#include "libcompat/include/compat.h"
|
||||
#include "type.h"
|
||||
|
||||
#define GRAM_TO_MOL(g, sp) g/propellant_molar_mass(sp)
|
||||
|
||||
#define _min(a, b, c) __min( __min(a, b), c)
|
||||
#define _max(a, b, c) __max( __max(a, b), c)
|
||||
|
||||
extern int global_verbose;
|
||||
|
||||
|
||||
/***************************************************************
|
||||
FUNCTION PROTOTYPE SECTION
|
||||
****************************************************************/
|
||||
|
||||
int set_verbose(equilibrium_t *e, int v);
|
||||
|
||||
/************************************************************
|
||||
FUNCTION: This function search for all elements present in
|
||||
the composition and fill the list with the
|
||||
corresponding number.
|
||||
|
||||
PARAMETER: e is of type equilibrium_t and hold the information
|
||||
about the propellant composition.
|
||||
|
||||
COMMENTS: It fill the member element in equilibrium_t
|
||||
|
||||
DATE: February 6, 2000
|
||||
|
||||
AUTHOR: Antoine Lefebvre
|
||||
**************************************************************/
|
||||
int list_element(equilibrium_t *e);
|
||||
int reset_element_list(equilibrium_t *e);
|
||||
|
||||
int list_product(equilibrium_t *e);
|
||||
|
||||
/***************************************************************
|
||||
FUNCTION: This function initialize the equilibrium structure.
|
||||
The function allocate memory for all the structure
|
||||
it need. It is important to call dealloc_equilibrium
|
||||
after.
|
||||
|
||||
AUTHOR: Antoine Lefebvre
|
||||
|
||||
DATE: February 27, 2000
|
||||
****************************************************************/
|
||||
int initialize_equilibrium(equilibrium_t *e);
|
||||
|
||||
|
||||
/***************************************************************
|
||||
FUNCTION: Dealloc what have been allocated by
|
||||
initialize_equilibrium
|
||||
***************************************************************/
|
||||
int dealloc_equilibrium(equilibrium_t *e);
|
||||
|
||||
int reset_equilibrium(equilibrium_t *e);
|
||||
|
||||
int copy_equilibrium(equilibrium_t *dest, equilibrium_t *src);
|
||||
|
||||
int compute_thermo_properties(equilibrium_t *e);
|
||||
|
||||
/***************************************************************
|
||||
FUNCTION: Set the state at which we want to compute the
|
||||
equilibrium.
|
||||
|
||||
PARAMETER: e is a pointer to an equilibrium_t structure
|
||||
T is the temperature in deg K
|
||||
P is the pressure in atm
|
||||
|
||||
AUTHOR: Antoine Lefebvre
|
||||
****************************************************************/
|
||||
int set_state(equilibrium_t *e, double T, double P);
|
||||
|
||||
|
||||
/***************************************************************
|
||||
FUNCTION: Add a new molecule in the propellant
|
||||
|
||||
PARAMETER: e is a pointer to the equilibrium_t structure
|
||||
sp is the number of the molecule in the list
|
||||
mol is the quantity in mol
|
||||
|
||||
AUTHOR: Antoine Lefebvre
|
||||
****************************************************************/
|
||||
int add_in_propellant(equilibrium_t *e, int sp, double mol);
|
||||
|
||||
/***************************************************************
|
||||
FUNCTION: Return the stochiometric coefficient of an element
|
||||
in a molecule. If the element isn't present, it return 0.
|
||||
|
||||
COMMENTS: There is a different function for the product and for the
|
||||
propellant.
|
||||
|
||||
AUTHOR: Antoine Lefebvre
|
||||
****************************************************************/
|
||||
int product_element_coef(int element, int molecule);
|
||||
/*int propellant_element_coef(int element, int molecule);*/
|
||||
|
||||
|
||||
|
||||
/***************************************************************
|
||||
FUNCTION: This function fill the matrix in function of the data
|
||||
store in the structure equilibrium_t. The solution
|
||||
of this matrix give corresction to initial estimate.
|
||||
|
||||
COMMENTS: It use the theory explain in
|
||||
"Computer Program for Calculation of Complex Chemical
|
||||
Equilibrium Compositions, Rocket Performance, Incident
|
||||
and Reflected Shocks, and Chapman-Jouguet Detonations"
|
||||
by Gordon and McBride
|
||||
|
||||
AUTHOR: Antoine Lefebvre
|
||||
****************************************************************/
|
||||
|
||||
|
||||
/*#ifdef TRUE_ARRAY*/
|
||||
/*int fill_equilibrium_matrix(double *matrix, equilibrium_t *e, problem_t P);*/
|
||||
int fill_matrix(double *matrix, equilibrium_t *e, problem_t P);
|
||||
/*#else*/
|
||||
/*int fill_equilibrium_matrix(double **matrix, equilibrium_t *e, problem_t P);*/
|
||||
/*int fill_matrix(double **matrix, equilibrium_t *e, problem_t P);*/
|
||||
/*#endif*/
|
||||
|
||||
|
||||
/****************************************************************
|
||||
FUNCTION: This function compute the equilibrium composition at
|
||||
at specific pressure/temperature point. It use fill_matrix
|
||||
to obtain correction to initial estimate. It correct the
|
||||
value until equilibrium is obtain.
|
||||
|
||||
AUTHOR: Antoine Lefebvre
|
||||
******************************************************************/
|
||||
int equilibrium(equilibrium_t *equil, problem_t P);
|
||||
|
||||
|
||||
double product_molar_mass(equilibrium_t *e);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
#ifndef performance_h
|
||||
#define performance_h
|
||||
|
||||
#include "libcompat/include/compat.h"
|
||||
#include "return.h"
|
||||
|
||||
#include "equilibrium.h"
|
||||
#include "derivative.h"
|
||||
|
||||
|
||||
int frozen_performance(equilibrium_t *e, exit_condition_t exit_type,
|
||||
double value);
|
||||
int shifting_performance(equilibrium_t *e, exit_condition_t exit_type,
|
||||
double value);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
#ifndef print_h
|
||||
#define print_h
|
||||
|
||||
#include "type.h"
|
||||
|
||||
#include "equilibrium.h"
|
||||
#include "derivative.h"
|
||||
#include "performance.h"
|
||||
|
||||
#define PROPELLANT_NAME(sp) (propellant_list + sp)->name
|
||||
|
||||
extern FILE * errorfile;
|
||||
extern FILE * outputfile;
|
||||
|
||||
int print_error_message(int error_code);
|
||||
|
||||
/***************************************************************
|
||||
FUNCTION: Print the information of a specie in the thermo_list
|
||||
|
||||
PARAMETER: an integer corresponding to the molecule
|
||||
|
||||
AUTHOR: Antoine Lefebvre
|
||||
***************************************************************/
|
||||
int print_propellant_info(int sp);
|
||||
int print_thermo_info(int sp);
|
||||
|
||||
|
||||
/*************************************************************
|
||||
FUNCTION: Print the content of the respective list with the
|
||||
number which refer to the molecule
|
||||
|
||||
AUTHOR: Antoine Lefebvre
|
||||
modification by Mark Pinese
|
||||
**************************************************************/
|
||||
int print_thermo_list(void);
|
||||
int print_propellant_list(void);
|
||||
|
||||
/*************************************************************
|
||||
FUNCTION: Print the list of condensed species in the product
|
||||
|
||||
PARAMETER: a structure of tupe product_t
|
||||
|
||||
AUTHOR: Antoine Lefebvre
|
||||
**************************************************************/
|
||||
int print_condensed(product_t p);
|
||||
|
||||
|
||||
|
||||
/*************************************************************
|
||||
FUNCTION: Print the list of gazeous species in the product
|
||||
|
||||
PARAMETER: a structure of tupe product_t
|
||||
|
||||
AUTHOR: Antoine Lefebvre
|
||||
**************************************************************/
|
||||
int print_gazeous(product_t p);
|
||||
|
||||
int print_product_composition(equilibrium_t *e, short npt);
|
||||
|
||||
int print_product_properties(equilibrium_t *e, short npt);
|
||||
|
||||
int print_propellant_composition(equilibrium_t *e);
|
||||
|
||||
/*int print_derivative_results(deriv_t *d);*/
|
||||
/*int print_performance_information(performance_t *p);*/
|
||||
|
||||
int print_performance_information(equilibrium_t *e, short npt);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef RETURN_H
|
||||
#define RETURN_H
|
||||
|
||||
/* Codes used in some functions by Antoine Lefebvre */
|
||||
#define SUCCESS 0
|
||||
#define ERROR -1
|
||||
|
||||
/*
|
||||
Return codes
|
||||
Mark Pinese 24/4/2000
|
||||
*/
|
||||
|
||||
#define ERR_MALLOC -1
|
||||
#define ERR_FOPEN -2
|
||||
#define ERR_EOF -3
|
||||
#define ERR_NOT_ALLOC -4
|
||||
#define ERR_TOO_MUCH_PRODUCT -5
|
||||
#define ERR_EQUILIBRIUM -6
|
||||
#define ERR_AERA_RATIO -7
|
||||
#define ERR_RATIO_TYPE -8
|
||||
|
||||
#endif /* !defined(RETURN_H) */
|
||||
@@ -0,0 +1,161 @@
|
||||
#ifndef type_h
|
||||
#define type_h
|
||||
|
||||
#define MAX_PRODUCT 400 /* Maximum species in product */
|
||||
#define MAX_ELEMENT 15 /* Maximum different element */
|
||||
#define MAX_COMP 20 /* Maximum different ingredient in
|
||||
composition */
|
||||
|
||||
#include "libcompat/include/compat.h"
|
||||
|
||||
/****************************************************************
|
||||
TYPE: Enumeration of the possible state of a substance
|
||||
*****************************************************************/
|
||||
typedef enum
|
||||
{
|
||||
GAS,
|
||||
CONDENSED,
|
||||
STATE_LAST
|
||||
} state_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
TP, /* assign temperature and pressure */
|
||||
HP, /* assign enthalpy and pressure */
|
||||
SP /* assign entropy and pressure */
|
||||
} problem_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SUBSONIC_AREA_RATIO,
|
||||
SUPERSONIC_AREA_RATIO,
|
||||
PRESSURE
|
||||
} exit_condition_t;
|
||||
|
||||
|
||||
/********************************************
|
||||
Note: Specific impulse have unit of m/s
|
||||
Ns/kg = (kg m / s^2) * (s / kg)
|
||||
= (m / s)
|
||||
|
||||
It is habitual to found in literature
|
||||
specific impulse in units of second.
|
||||
It is in reality Isp/g where g is
|
||||
the earth acceleration.
|
||||
**********************************************/
|
||||
typedef struct _performance_prop
|
||||
{
|
||||
double ae_at; /* Exit aera / Throat aera */
|
||||
double a_dotm; /* Exit aera / mass flow rate (m/s/atm) */
|
||||
double cstar; /* Characteristic velocity */
|
||||
double cf; /* Coefficient of thrust */
|
||||
double Ivac; /* Specific impulse (vacuum) */
|
||||
double Isp; /* Specific impulse */
|
||||
|
||||
} performance_prop_t;
|
||||
|
||||
|
||||
/***************************************************************
|
||||
TYPE: Hold the composition of a specific propellant
|
||||
ncomp is the number of component
|
||||
molecule[ ] hold the number in propellant_list corresponding
|
||||
to the molecule
|
||||
coef[ ] hold the stochiometric coefficient
|
||||
|
||||
NOTE: It should be great to allocate the memory of the array in
|
||||
function of the number of element
|
||||
|
||||
DATE: February 6, 2000
|
||||
****************************************************************/
|
||||
typedef struct _composition
|
||||
{
|
||||
short ncomp; /* Number of different component */
|
||||
short molecule[MAX_COMP]; /* Molecule code */
|
||||
double coef[MAX_COMP]; /* Moles of molecule */
|
||||
double density; /* Density of propellant */
|
||||
} composition_t;
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
TYPE: Hold the composition of the combustion product. The molecule
|
||||
are separate between their different possible state.
|
||||
|
||||
NOTE: This structure should be initialize with the function
|
||||
initialize_product.
|
||||
|
||||
DATE: February 13, 2000
|
||||
******************************************************************/
|
||||
typedef struct _product
|
||||
{
|
||||
bool element_listed; /* true if element have been listed */
|
||||
bool product_listed; /* true if product have been listed */
|
||||
bool isequil; /* true if equilibrium is ok */
|
||||
|
||||
/* coefficient matrix for the gases */
|
||||
unsigned short A[MAX_ELEMENT][MAX_PRODUCT];
|
||||
|
||||
short n_element; /* n. of different element */
|
||||
short element[MAX_ELEMENT]; /* element list */
|
||||
short n[STATE_LAST]; /* n. of species for each state */
|
||||
short n_condensed; /* n. of total possible condensed */
|
||||
short species[STATE_LAST][MAX_PRODUCT]; /* possible species in each state */
|
||||
double coef[STATE_LAST][MAX_PRODUCT]; /* coef. of each molecule */
|
||||
|
||||
} product_t;
|
||||
|
||||
/* Structure to hold information during the iteration procedure */
|
||||
typedef struct _iteration_var
|
||||
{
|
||||
double n; /* mol/g of the mixture */
|
||||
double ln_n; /* ln(n) */
|
||||
double sumn; /* sum of all the nj */
|
||||
double delta_ln_n; /* delta ln(n) in the iteration process */
|
||||
double delta_ln_T; /* delta ln(T) in the iteration process */
|
||||
double delta_ln_nj[MAX_PRODUCT]; /* delta ln(nj) in the iteration process */
|
||||
double ln_nj[MAX_PRODUCT]; /* ln(nj) nj are the individual mol/g */
|
||||
|
||||
} iteration_var_t;
|
||||
|
||||
/**********************************************
|
||||
Hold information on equilibrium properties once
|
||||
it have been compute
|
||||
|
||||
June 14, 2000
|
||||
***********************************************/
|
||||
typedef struct _equilib_prop
|
||||
{
|
||||
double P; /* Pressure (atm) */
|
||||
double T; /* Temperature (K) */
|
||||
double H; /* Enthalpy (kJ/kg) */
|
||||
double U; /* Internal energy (kJ/kg) */
|
||||
double G; /* Gibbs free energy (kJ/kg) */
|
||||
double S; /* Entropy (kJ/(kg)(K)) */
|
||||
double M; /* Molar mass (g/mol) */
|
||||
double dV_P; /* (d ln(V) / d ln(P))t */
|
||||
double dV_T; /* (d ln(V) / d ln(T))p */
|
||||
double Cp; /* Specific heat (kJ/(kg)(K)) */
|
||||
double Cv; /* Specific heat (kJ/(kg)(K)) */
|
||||
double Isex; /* Isentropic exponent (gamma) */
|
||||
double Vson; /* Sound speed (m/s) */
|
||||
} equilib_prop_t;
|
||||
|
||||
|
||||
typedef struct _new_equilibrium
|
||||
{
|
||||
bool equilibrium_ok; /* true if the equilibrium have been compute */
|
||||
bool properties_ok; /* true if the properties have been compute */
|
||||
bool performance_ok; /* true if the performance have been compute */
|
||||
|
||||
/*temporarily*/
|
||||
double entropy;
|
||||
|
||||
iteration_var_t itn;
|
||||
composition_t propellant;
|
||||
product_t product;
|
||||
equilib_prop_t properties;
|
||||
performance_prop_t performance;
|
||||
|
||||
} equilibrium_t;
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,3 @@
|
||||
ROOT = ../../../..
|
||||
include $(ROOT)/config/makedef
|
||||
include $(ROOT)/config/libsrc.mk
|
||||
@@ -0,0 +1,242 @@
|
||||
/* derivative.c - Fill the mattrix to compute thermochemical derivative
|
||||
relative to logarithm of pressure and temperature */
|
||||
/* $Id: derivative.c,v 1.1.1.1 2001/07/20 03:19:01 antoine Exp $ */
|
||||
/* Copyright (C) 2000 */
|
||||
/* Antoine Lefebvre <antoine.lefebvre@polymtl.ca> */
|
||||
/* Mark Pinese <pinese@cyberwizards.com.au> */
|
||||
/* */
|
||||
/* Licensed under the GPLv2 */
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "libnum/include/num.h"
|
||||
|
||||
#include "libcpropep/include/derivative.h"
|
||||
#include "libcpropep/include/equilibrium.h"
|
||||
#include "libcpropep/include/performance.h"
|
||||
|
||||
#include "libcpropep/include/print.h"
|
||||
#include "libcpropep/include/return.h"
|
||||
|
||||
#include "libcompat/include/compat.h"
|
||||
#include "libthermo/include/thermo.h"
|
||||
|
||||
int fill_temperature_derivative_matrix(double *matrix, equilibrium_t *e);
|
||||
int fill_pressure_derivative_matrix(double *matrix, equilibrium_t *e);
|
||||
|
||||
/* Compute the specific_heat of the mixture using thermodynamics
|
||||
derivative with respect to logarithm of temperature */
|
||||
double mixture_specific_heat(equilibrium_t *e, double *sol)
|
||||
{
|
||||
short i, j;
|
||||
double cp, tmp;
|
||||
|
||||
product_t *p = &(e->product);
|
||||
equilib_prop_t *pr = &(e->properties);
|
||||
|
||||
cp = 0.0;
|
||||
/* Compute Cp/R */
|
||||
for (i = 0; i < p->n_element; i++)
|
||||
{
|
||||
tmp = 0.0;
|
||||
for (j = 0; j < p->n[GAS]; j++)
|
||||
tmp += p->A[i][j] * p->coef[GAS][j] *
|
||||
enthalpy_0(p->species[GAS][j], pr->T);
|
||||
|
||||
cp += tmp * sol[i];
|
||||
|
||||
}
|
||||
|
||||
for (i = 0; i < p->n[CONDENSED]; i++)
|
||||
{
|
||||
cp += enthalpy_0(p->species[CONDENSED][i], pr->T)
|
||||
* sol[i + p->n_element];
|
||||
}
|
||||
|
||||
tmp = 0.0;
|
||||
for (i = 0; i < p->n[GAS]; i++)
|
||||
{
|
||||
tmp += p->coef[GAS][i] * enthalpy_0(p->species[GAS][i], pr->T);
|
||||
}
|
||||
cp += tmp * sol[p->n_element + p->n[CONDENSED]];
|
||||
|
||||
cp += mixture_specific_heat_0(e, pr->T);
|
||||
|
||||
for (i = 0; i < p->n[GAS]; i++)
|
||||
{
|
||||
cp += p->coef[GAS][i] * pow(enthalpy_0(p->species[GAS][i], pr->T), 2);
|
||||
}
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
int derivative(equilibrium_t *e)
|
||||
{
|
||||
short size;
|
||||
double *matrix;
|
||||
double *sol;
|
||||
|
||||
product_t *p = &(e->product);
|
||||
equilib_prop_t *prop = &(e->properties);
|
||||
|
||||
|
||||
/* the size of the coefficient matrix */
|
||||
size = p->n_element + p->n[CONDENSED] + 1;
|
||||
|
||||
matrix = (double *) malloc (size * (size + 1) * sizeof(double));
|
||||
|
||||
/* allocate the memory for the solution vector */
|
||||
sol = (double *) calloc (size, sizeof(double));
|
||||
|
||||
fill_temperature_derivative_matrix(matrix, e);
|
||||
|
||||
if (NUM_lu(matrix, sol, size) == -1)
|
||||
{
|
||||
fprintf(outputfile, "The matrix is singular.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (global_verbose > 2)
|
||||
{
|
||||
fprintf(outputfile, "Temperature derivative results.\n");
|
||||
NUM_print_vec(sol, size);
|
||||
}
|
||||
|
||||
prop->Cp = mixture_specific_heat(e, sol)*R;
|
||||
prop->dV_T = 1 + sol[e->product.n_element + e->product.n[CONDENSED]];
|
||||
}
|
||||
|
||||
fill_pressure_derivative_matrix(matrix, e);
|
||||
|
||||
if (NUM_lu(matrix, sol, size) == -1)
|
||||
{
|
||||
fprintf(outputfile, "The matrix is singular.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (global_verbose > 2)
|
||||
{
|
||||
fprintf(outputfile, "Pressure derivative results.\n");
|
||||
NUM_print_vec(sol, size);
|
||||
}
|
||||
prop->dV_P = sol[e->product.n_element + e->product.n[CONDENSED]] - 1;
|
||||
|
||||
}
|
||||
|
||||
prop->Cv = prop->Cp + e->itn.n * R * pow(prop->dV_T, 2)/prop->dV_P;
|
||||
prop->Isex = -(prop->Cp / prop->Cv) / prop->dV_P;
|
||||
prop->Vson = sqrt(1000 * e->itn.n * R * e->properties.T * prop->Isex);
|
||||
|
||||
free(matrix);
|
||||
free(sol);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Fill the matrix with the coefficient for evaluating derivatives with
|
||||
respect to logarithm of temperature at constant pressure */
|
||||
int fill_temperature_derivative_matrix(double *matrix, equilibrium_t *e)
|
||||
{
|
||||
|
||||
short j, k, size;
|
||||
double tmp;
|
||||
|
||||
short idx_cond, idx_n, idx_T;
|
||||
|
||||
product_t *p = &(e->product);
|
||||
equilib_prop_t *pr = &(e->properties);
|
||||
|
||||
idx_cond = p->n_element;
|
||||
idx_n = p->n_element + p->n[CONDENSED];
|
||||
idx_T = p->n_element + p->n[CONDENSED] + 1;
|
||||
|
||||
/* the size of the coefficient matrix */
|
||||
size = p->n_element + p->n[CONDENSED] + 1;
|
||||
|
||||
/* fill the common part */
|
||||
fill_matrix(matrix, e, TP);
|
||||
|
||||
/* del ln(n)/ del ln(T) */
|
||||
matrix[idx_n + size * idx_n] = 0.0;
|
||||
|
||||
/* right side */
|
||||
for (j = 0; j < p->n_element; j++)
|
||||
{
|
||||
tmp = 0.0;
|
||||
for (k = 0; k < p->n[GAS]; k++)
|
||||
tmp -= p->A[j][k] * p->coef[GAS][k] * enthalpy_0(p->species[GAS][k],
|
||||
pr->T);
|
||||
matrix[j + size * idx_T] = tmp;
|
||||
}
|
||||
|
||||
for (j = 0; j < p->n[CONDENSED]; j++) /* row */
|
||||
matrix[j + idx_cond + size * idx_T] =
|
||||
-enthalpy_0( p->species[CONDENSED][j], pr->T);
|
||||
|
||||
tmp = 0.0;
|
||||
for (k = 0; k < p->n[GAS]; k++)
|
||||
tmp -= p->coef[GAS][k]*enthalpy_0(p->species[GAS][k], pr->T);
|
||||
|
||||
matrix[idx_n + size * idx_T] = tmp;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Fill the matrix with the coefficient for evaluating derivatives with
|
||||
respect to logarithm of pressure at constant temperature */
|
||||
int fill_pressure_derivative_matrix(double *matrix, equilibrium_t *e)
|
||||
{
|
||||
|
||||
short j, k, size;
|
||||
double tmp;
|
||||
|
||||
short idx_cond, idx_n, idx_T;
|
||||
|
||||
product_t *p = &(e->product);
|
||||
|
||||
idx_cond = p->n_element;
|
||||
idx_n = p->n_element + p->n[CONDENSED];
|
||||
idx_T = p->n_element + p->n[CONDENSED] + 1;
|
||||
|
||||
/* the size of the coefficient matrix */
|
||||
size = p->n_element + p->n[CONDENSED] + 1;
|
||||
|
||||
/* fill the common part */
|
||||
fill_matrix(matrix, e, TP);
|
||||
|
||||
/* del ln(n)/ del ln(T) */
|
||||
matrix[idx_n + size * idx_n] = 0.0;
|
||||
|
||||
/* right side */
|
||||
for (j = 0; j < p->n_element; j++)
|
||||
{
|
||||
tmp = 0.0;
|
||||
for (k = 0; k < p->n[GAS]; k++)
|
||||
tmp += p->A[j][k] * p->coef[GAS][k];
|
||||
|
||||
matrix[j + size * idx_T] = tmp;
|
||||
}
|
||||
|
||||
for (j = 0; j < p->n[CONDENSED]; j++) /* row */
|
||||
matrix[j + idx_cond + size * idx_T] = 0.0;
|
||||
|
||||
tmp = 0.0;
|
||||
for (k = 0; k < p->n[GAS]; k++)
|
||||
tmp += p->coef[GAS][k];
|
||||
|
||||
matrix[idx_n + size * idx_T] = tmp;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
LIBNAME = libcpropep.a
|
||||
LIBOBJS = equilibrium.o print.o performance.o derivative.o
|
||||
@@ -0,0 +1,564 @@
|
||||
/* performance.c - Compute performance caracteristic of a motor
|
||||
considering equilibrium */
|
||||
/* $Id: performance.c,v 1.3 2001/10/08 03:22:01 antoine Exp $ */
|
||||
/* Copyright (C) 2000 */
|
||||
/* Antoine Lefebvre <antoine.lefebvre@polymtl.ca> */
|
||||
/* Mark Pinese <pinese@cyberwizards.com.au> */
|
||||
/* */
|
||||
/* Licensed under the GPLv2 */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "libcpropep/include/performance.h"
|
||||
#include "libcpropep/include/derivative.h"
|
||||
#include "libcpropep/include/print.h"
|
||||
#include "libcpropep/include/equilibrium.h"
|
||||
#include "libcpropep/include/const.h"
|
||||
#include "libcpropep/include/return.h"
|
||||
|
||||
#include "libcompat/include/compat.h"
|
||||
#include "libthermo/include/thermo.h"
|
||||
|
||||
#define TEMP_ITERATION_MAX 8
|
||||
#define PC_PT_ITERATION_MAX 5
|
||||
#define PC_PE_ITERATION_MAX 6
|
||||
|
||||
|
||||
double compute_temperature(equilibrium_t *e, double pressure,
|
||||
double p_entropy);
|
||||
|
||||
|
||||
/* Entropy of the product at the exit pressure and temperature */
|
||||
double product_entropy_exit(equilibrium_t *e, double pressure, double temp)
|
||||
{
|
||||
double ent;
|
||||
double t = e->properties.T;
|
||||
double p = e->properties.P;
|
||||
e->properties.T = temp;
|
||||
e->properties.P = pressure;
|
||||
ent = product_entropy(e); /* entropy at the new pressure */
|
||||
e->properties.T = t;
|
||||
e->properties.P = p;
|
||||
return ent;
|
||||
}
|
||||
|
||||
/* Enthalpy of the product at the exit temperature */
|
||||
double product_enthalpy_exit(equilibrium_t *e, double temp)
|
||||
{
|
||||
double enth;
|
||||
double t = e->properties.T;
|
||||
e->properties.T = temp;
|
||||
enth = product_enthalpy(e);
|
||||
e->properties.T = t;
|
||||
return enth;
|
||||
}
|
||||
|
||||
/* The temperature could be found by entropy conservation with a
|
||||
specified pressure */
|
||||
double compute_temperature(equilibrium_t *e, double pressure, double p_entropy)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
double delta_lnt;
|
||||
double temperature;
|
||||
|
||||
/* The first approximation is the chamber temperature */
|
||||
temperature = e->properties.T;
|
||||
|
||||
do
|
||||
{
|
||||
delta_lnt = (p_entropy - product_entropy_exit(e, pressure, temperature))
|
||||
/ mixture_specific_heat_0(e, temperature);
|
||||
|
||||
temperature = exp (log(temperature) + delta_lnt);
|
||||
|
||||
i++;
|
||||
|
||||
} while (fabs(delta_lnt) >= 0.5e-4 && i < TEMP_ITERATION_MAX);
|
||||
|
||||
if (i == TEMP_ITERATION_MAX)
|
||||
{
|
||||
fprintf(errorfile,
|
||||
"Temperature do not converge in %d iterations. Don't thrust results.\n",
|
||||
TEMP_ITERATION_MAX);
|
||||
}
|
||||
|
||||
return temperature;
|
||||
}
|
||||
|
||||
int frozen_performance(equilibrium_t *e, exit_condition_t exit_type,
|
||||
double value)
|
||||
{
|
||||
int err_code;
|
||||
|
||||
short i;
|
||||
|
||||
double sound_velocity;
|
||||
double flow_velocity;
|
||||
double pc_pt; /* Chamber pressure / Throat pressure */
|
||||
double pc_pe; /* Chamber pressure / Exit pressure */
|
||||
double log_pc_pe; /* log(pc_pe) */
|
||||
double ae_at; /* Exit aera / Throat aera */
|
||||
double cp_cv;
|
||||
double chamber_entropy;
|
||||
double exit_pressure = 0;
|
||||
|
||||
equilibrium_t *t = e + 1; /* throat equilibrium */
|
||||
equilibrium_t *ex = e + 2; /* exit equilibrium */
|
||||
|
||||
/* find the equilibrium composition in the chamber */
|
||||
if (!(e->product.isequil))
|
||||
{
|
||||
if ((err_code = equilibrium(e, HP)) != SUCCESS)
|
||||
{
|
||||
fprintf(outputfile,
|
||||
"No equilibrium, performance evaluation aborted.\n");
|
||||
return err_code;
|
||||
}
|
||||
}
|
||||
|
||||
/* Simplification due to frozen equilibrium */
|
||||
e->properties.dV_T = 1.0;
|
||||
e->properties.dV_P = -1.0;
|
||||
e->properties.Cp = mixture_specific_heat_0(e, e->properties.T) * R;
|
||||
e->properties.Cv = e->properties.Cp - e->itn.n * R;
|
||||
e->properties.Isex = e->properties.Cp/e->properties.Cv;
|
||||
|
||||
compute_thermo_properties(e);
|
||||
|
||||
chamber_entropy = product_entropy(e);
|
||||
|
||||
/* begin computation of throat caracteristic */
|
||||
copy_equilibrium(t, e);
|
||||
|
||||
cp_cv = e->properties.Cp/e->properties.Cv;
|
||||
|
||||
/* first estimate of Pc/Pt */
|
||||
pc_pt = pow (cp_cv/2 + 0.5, cp_cv/(cp_cv - 1));
|
||||
|
||||
i = 0;
|
||||
do
|
||||
{
|
||||
|
||||
t->properties.T = compute_temperature(t, e->properties.P/pc_pt,
|
||||
chamber_entropy);
|
||||
|
||||
/* Cp of the combustion point assuming frozen */
|
||||
t->properties.Cp = mixture_specific_heat_0(e, t->properties.T) * R;
|
||||
/* Cv = Cp - nR (for frozen) */
|
||||
t->properties.Cv = t->properties.Cp - t->itn.n * R;
|
||||
t->properties.Isex = t->properties.Cp/t->properties.Cv;
|
||||
|
||||
compute_thermo_properties(t);
|
||||
|
||||
sound_velocity = sqrt(1000 * e->itn.n * R * t->properties.T *
|
||||
t->properties.Isex);
|
||||
|
||||
flow_velocity = sqrt(2000*(product_enthalpy(e)*R*e->properties.T -
|
||||
product_enthalpy_exit(e, t->properties.T)*
|
||||
R*t->properties.T));
|
||||
|
||||
pc_pt = pc_pt / ( 1 + ((pow(flow_velocity, 2) - pow(sound_velocity, 2))
|
||||
/(1000*(t->properties.Isex + 1)*
|
||||
t->itn.n * R *t->properties.T)));
|
||||
i++;
|
||||
} while ((fabs((pow(flow_velocity, 2) - pow(sound_velocity, 2))
|
||||
/pow(flow_velocity, 2)) > 0.4e-4) &&
|
||||
(i < PC_PT_ITERATION_MAX));
|
||||
|
||||
if (i == PC_PT_ITERATION_MAX)
|
||||
{
|
||||
fprintf(errorfile,
|
||||
"Throat pressure do not converge in %d iterations. Don't thrust results\n",
|
||||
PC_PT_ITERATION_MAX);
|
||||
}
|
||||
|
||||
/*printf("%d iterations to evaluate throat pressure.\n", i);*/
|
||||
|
||||
t->properties.P = e->properties.P/pc_pt;
|
||||
t->performance.Isp = t->properties.Vson = sound_velocity;
|
||||
|
||||
compute_thermo_properties(t);
|
||||
|
||||
/* Now compute exit properties */
|
||||
copy_equilibrium(ex, e);
|
||||
|
||||
if (exit_type == PRESSURE)
|
||||
{
|
||||
exit_pressure = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
ae_at = value;
|
||||
|
||||
/* Initial estimate of pressure ratio */
|
||||
if (exit_type == SUPERSONIC_AREA_RATIO)
|
||||
{
|
||||
if ((ae_at > 1.0) && (ae_at < 2.0))
|
||||
{
|
||||
log_pc_pe = log(pc_pt) + sqrt (3.294*pow(ae_at,2) + 1.535*log(ae_at));
|
||||
}
|
||||
else if (ae_at >= 2.0)
|
||||
{
|
||||
log_pc_pe = t->properties.Isex + 1.4 * log(ae_at);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Aera ratio out of range ( < 1.0 )\n");
|
||||
return ERR_AERA_RATIO;
|
||||
}
|
||||
}
|
||||
else if (exit_type == SUBSONIC_AREA_RATIO)
|
||||
{
|
||||
if ((ae_at > 1.0) && (ae_at < 1.09))
|
||||
{
|
||||
log_pc_pe = 0.9 * log(pc_pt) /
|
||||
(ae_at + 10.587 * pow(log(ae_at), 3) + 9.454 * log(ae_at));
|
||||
}
|
||||
else if (ae_at >= 1.09)
|
||||
{
|
||||
log_pc_pe = log(pc_pt) /
|
||||
(ae_at + 10.587 * pow(log(ae_at), 3) + 9.454 * log(ae_at));
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Aera ratio out of range ( < 1.0 )\n");
|
||||
return ERR_AERA_RATIO;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return ERR_RATIO_TYPE;
|
||||
}
|
||||
|
||||
|
||||
/* Improved the estimate */
|
||||
i = 0;
|
||||
do
|
||||
{
|
||||
pc_pe = exp(log_pc_pe);
|
||||
ex->properties.P = exit_pressure = e->properties.P/pc_pe;
|
||||
ex->properties.T = compute_temperature(e, exit_pressure,
|
||||
chamber_entropy);
|
||||
/* Cp of the combustion point assuming frozen */
|
||||
ex->properties.Cp = mixture_specific_heat_0(e, ex->properties.T) * R;
|
||||
/* Cv = Cp - nR (for frozen) */
|
||||
ex->properties.Cv = ex->properties.Cp - ex->itn.n * R;
|
||||
ex->properties.Isex = ex->properties.Cp/ex->properties.Cv;
|
||||
|
||||
compute_thermo_properties(ex);
|
||||
|
||||
sound_velocity = sqrt(1000 * ex->itn.n * R * ex->properties.T *
|
||||
ex->properties.Isex);
|
||||
|
||||
ex->performance.Isp =
|
||||
flow_velocity = sqrt(2000*(product_enthalpy(e)*R*e->properties.T -
|
||||
product_enthalpy_exit(e, ex->properties.T)*
|
||||
R*ex->properties.T));
|
||||
|
||||
ex->performance.ae_at =
|
||||
(ex->properties.T * t->properties.P * t->performance.Isp) /
|
||||
(t->properties.T * ex->properties.P * ex->performance.Isp);
|
||||
|
||||
log_pc_pe = log_pc_pe +
|
||||
(ex->properties.Isex*pow(flow_velocity, 2)/
|
||||
(pow(flow_velocity, 2) - pow(sound_velocity,2))) *
|
||||
(log(ae_at) - log(ex->performance.ae_at));
|
||||
|
||||
i++;
|
||||
|
||||
} while ( (fabs((log_pc_pe - log(pc_pe))) > 0.00004) &&
|
||||
(i < PC_PE_ITERATION_MAX) );
|
||||
|
||||
if (i == PC_PE_ITERATION_MAX)
|
||||
{
|
||||
fprintf(errorfile,
|
||||
"Exit pressure do not converge in %d iterations. Don't thrust results\n",
|
||||
PC_PE_ITERATION_MAX);
|
||||
}
|
||||
|
||||
/*printf("%d iterations to evaluate exit pressure.\n", i); */
|
||||
|
||||
pc_pe = exp(log_pc_pe);
|
||||
exit_pressure = e->properties.P/pc_pe;
|
||||
|
||||
}
|
||||
|
||||
ex->properties.T = compute_temperature(e, exit_pressure,
|
||||
chamber_entropy);
|
||||
/* We must check if the exit temperature is more than 50 K lower
|
||||
than any transition temperature of condensed species.
|
||||
In this case the results are not good and must be reject. */
|
||||
|
||||
ex->properties.P = exit_pressure;
|
||||
ex->performance.Isp = sqrt(2000*(product_enthalpy(e)*R*e->properties.T -
|
||||
product_enthalpy_exit(e, ex->properties.T)*
|
||||
R*ex->properties.T));
|
||||
|
||||
|
||||
/* units are (m/s/atm) */
|
||||
ex->performance.a_dotm = 1000 * R * ex->properties.T * ex->itn.n /
|
||||
(ex->properties.P * ex->performance.Isp);
|
||||
|
||||
/* Cp of the combustion point assuming frozen */
|
||||
ex->properties.Cp = mixture_specific_heat_0(e, ex->properties.T) * R;
|
||||
/* Cv = Cp - nR (for frozen) */
|
||||
ex->properties.Cv = ex->properties.Cp - ex->itn.n * R;
|
||||
ex->properties.Isex = ex->properties.Cp/ex->properties.Cv;
|
||||
|
||||
compute_thermo_properties(ex);
|
||||
|
||||
ex->properties.Vson = sqrt(1000 * e->itn.n * R * ex->properties.T *
|
||||
e->properties.Isex);
|
||||
|
||||
|
||||
t->performance.a_dotm = 1000 * R * t->properties.T
|
||||
* t->itn.n / (t->properties.P * t->performance.Isp);
|
||||
t->performance.ae_at = 1.0;
|
||||
t->performance.cstar = e->properties.P * t->performance.a_dotm;
|
||||
t->performance.cf = t->performance.Isp /
|
||||
(e->properties.P * t->performance.a_dotm);
|
||||
t->performance.Ivac = t->performance.Isp + t->properties.P
|
||||
* t->performance.a_dotm;
|
||||
|
||||
ex->performance.ae_at =
|
||||
(ex->properties.T * t->properties.P * t->performance.Isp) /
|
||||
(t->properties.T * ex->properties.P * ex->performance.Isp);
|
||||
ex->performance.cstar = e->properties.P * t->performance.a_dotm;
|
||||
ex->performance.cf = ex->performance.Isp /
|
||||
(e->properties.P * t->performance.a_dotm);
|
||||
ex->performance.Ivac = ex->performance.Isp + ex->properties.P
|
||||
* ex->performance.a_dotm;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int shifting_performance(equilibrium_t *e, exit_condition_t exit_type,
|
||||
double value)
|
||||
{
|
||||
int err_code;
|
||||
short i;
|
||||
double sound_velocity = 0.0;
|
||||
double flow_velocity;
|
||||
double pc_pt;
|
||||
double pc_pe;
|
||||
double log_pc_pe;
|
||||
double ae_at;
|
||||
double chamber_entropy;
|
||||
double exit_pressure = 0;
|
||||
|
||||
equilibrium_t *t = e + 1; /* throat equilibrium */
|
||||
equilibrium_t *ex = e + 2; /* exit equilibrium */
|
||||
|
||||
/* find the equilibrium composition in the chamber */
|
||||
if (!(e->product.isequil))
|
||||
/* if the equilibrium have not already been compute */
|
||||
{
|
||||
if ((err_code = equilibrium(e, HP)) < 0)
|
||||
{
|
||||
fprintf(outputfile, "No equilibrium, performance evaluation aborted.\n");
|
||||
return err_code;
|
||||
}
|
||||
}
|
||||
|
||||
/* Begin by first aproximate the new equilibrium to be
|
||||
the same as the chamber equilibrium */
|
||||
|
||||
copy_equilibrium(t, e);
|
||||
|
||||
chamber_entropy = product_entropy(e);
|
||||
|
||||
/* Computing throat condition */
|
||||
/* Approximation of the throat pressure */
|
||||
pc_pt = pow(t->properties.Isex/2 + 0.5,
|
||||
t->properties.Isex/(t->properties.Isex - 1) );
|
||||
|
||||
t->entropy = chamber_entropy;
|
||||
|
||||
i = 0;
|
||||
do
|
||||
{
|
||||
t->properties.P = e->properties.P/pc_pt;
|
||||
|
||||
/* We must compute the new equilibrium each time */
|
||||
if ((err_code = equilibrium(t, SP)) < 0)
|
||||
{
|
||||
fprintf(outputfile, "No equilibrium, performance evaluation aborted.\n");
|
||||
return err_code;
|
||||
}
|
||||
|
||||
sound_velocity = sqrt (1000*t->itn.n*R*t->properties.T*
|
||||
t->properties.Isex);
|
||||
|
||||
flow_velocity = sqrt (2000*(product_enthalpy(e)*R*e->properties.T -
|
||||
product_enthalpy(t)*R*t->properties.T));
|
||||
|
||||
pc_pt = pc_pt / ( 1 + ((pow(flow_velocity, 2) - pow(sound_velocity, 2))
|
||||
/(1000*(t->properties.Isex + 1)*t->itn.n*R*
|
||||
t->properties.T)));
|
||||
i++;
|
||||
} while ((fabs((pow(flow_velocity, 2) - pow(sound_velocity, 2))
|
||||
/pow(flow_velocity, 2)) > 0.4e-4) &&
|
||||
(i < PC_PT_ITERATION_MAX));
|
||||
|
||||
if (i == PC_PT_ITERATION_MAX)
|
||||
{
|
||||
fprintf(errorfile, "Throat pressure do not converge in %d iterations."
|
||||
" Don't thrust results.\n", PC_PT_ITERATION_MAX);
|
||||
}
|
||||
|
||||
/*printf("%d iterations to evaluate throat pressure.\n", i);*/
|
||||
|
||||
t->properties.P = e->properties.P/pc_pt;
|
||||
t->properties.Vson = sound_velocity;
|
||||
t->performance.Isp = sound_velocity;
|
||||
|
||||
|
||||
t->performance.a_dotm = 1000 * R *
|
||||
t->properties.T * t->itn.n /
|
||||
(t->properties.P * t->performance.Isp);
|
||||
|
||||
copy_equilibrium(ex, e);
|
||||
|
||||
if (exit_type == PRESSURE)
|
||||
{
|
||||
exit_pressure = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
ae_at = value;
|
||||
|
||||
/* Initial estimate of pressure ratio */
|
||||
if (exit_type == SUPERSONIC_AREA_RATIO)
|
||||
{
|
||||
if ((ae_at > 1.0) && (ae_at < 2.0))
|
||||
{
|
||||
log_pc_pe = log(pc_pt) + sqrt (3.294*pow(ae_at,2) + 1.535*log(ae_at));
|
||||
}
|
||||
else if (ae_at >= 2.0)
|
||||
{
|
||||
log_pc_pe = t->properties.Isex + 1.4 * log(ae_at);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Aera ratio out of range ( < 1.0 )\n");
|
||||
return ERR_AERA_RATIO;
|
||||
}
|
||||
}
|
||||
else if (exit_type == SUBSONIC_AREA_RATIO)
|
||||
{
|
||||
if ((ae_at > 1.0) && (ae_at < 1.09))
|
||||
{
|
||||
log_pc_pe = 0.9 * log(pc_pt) /
|
||||
(ae_at + 10.587 * pow(log(ae_at), 3) + 9.454 * log(ae_at));
|
||||
}
|
||||
else if (ae_at >= 1.09)
|
||||
{
|
||||
log_pc_pe = log(pc_pt) /
|
||||
(ae_at + 10.587 * pow(log(ae_at), 3) + 9.454 * log(ae_at));
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Aera ratio out of range ( < 1.0 )\n");
|
||||
return ERR_AERA_RATIO;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return ERR_RATIO_TYPE;
|
||||
}
|
||||
|
||||
|
||||
/* Improved the estimate */
|
||||
ex->entropy = chamber_entropy;
|
||||
i = 0;
|
||||
do
|
||||
{
|
||||
pc_pe = exp(log_pc_pe);
|
||||
ex->properties.P = exit_pressure = e->properties.P/pc_pe;
|
||||
|
||||
|
||||
/* Find the exit equilibrium */
|
||||
if ((err_code = equilibrium(ex, SP)) < 0)
|
||||
{
|
||||
fprintf(outputfile,
|
||||
"No equilibrium, performance evaluation aborted.\n");
|
||||
return err_code;
|
||||
}
|
||||
|
||||
sound_velocity = ex->properties.Vson;
|
||||
|
||||
ex->performance.Isp =
|
||||
flow_velocity = sqrt(2000*(product_enthalpy(e)*R*e->properties.T -
|
||||
product_enthalpy(ex)*R*ex->properties.T));
|
||||
|
||||
ex->performance.ae_at =
|
||||
(ex->properties.T * t->properties.P * t->performance.Isp) /
|
||||
(t->properties.T * ex->properties.P * ex->performance.Isp);
|
||||
|
||||
log_pc_pe = log_pc_pe +
|
||||
(ex->properties.Isex*pow(flow_velocity, 2)/
|
||||
(pow(flow_velocity, 2) - pow(sound_velocity,2))) *
|
||||
(log(ae_at) - log(ex->performance.ae_at));
|
||||
i++;
|
||||
} while ((fabs((log_pc_pe - log(pc_pe))) > 0.00004) &&
|
||||
(i < PC_PE_ITERATION_MAX));
|
||||
|
||||
if (i == PC_PE_ITERATION_MAX)
|
||||
{
|
||||
fprintf(errorfile, "Exit pressure do not converge in %d iteration."
|
||||
" Don't thrust results.\n", PC_PE_ITERATION_MAX);
|
||||
}
|
||||
|
||||
/*printf("%d iterations to evaluate exit pressure.\n", i);*/
|
||||
|
||||
pc_pe = exp(log_pc_pe);
|
||||
exit_pressure = e->properties.P/pc_pe;
|
||||
}
|
||||
|
||||
ex->entropy = chamber_entropy;
|
||||
ex->properties.P = exit_pressure;
|
||||
|
||||
/* Find the exit equilibrium */
|
||||
if ((err_code = equilibrium(ex, SP)) < 0)
|
||||
{
|
||||
fprintf(outputfile, "No equilibrium, performance evaluation aborted.\n");
|
||||
return err_code;
|
||||
}
|
||||
|
||||
flow_velocity = sqrt(2000*(product_enthalpy(e)*R*e->properties.T -
|
||||
product_enthalpy(ex)*R*ex->properties.T));
|
||||
|
||||
|
||||
ex->performance.Isp = flow_velocity;
|
||||
|
||||
ex->performance.a_dotm = 1000 * R *
|
||||
ex->properties.T * ex->itn.n /
|
||||
(ex->properties.P * ex->performance.Isp);
|
||||
|
||||
t->performance.ae_at = 1.0;
|
||||
t->performance.cstar = e->properties.P * t->performance.a_dotm;
|
||||
t->performance.cf = t->performance.Isp /
|
||||
(e->properties.P * t->performance.a_dotm);
|
||||
t->performance.Ivac = t->performance.Isp + t->properties.P
|
||||
* t->performance.a_dotm;
|
||||
|
||||
ex->performance.ae_at =
|
||||
(ex->properties.T * t->properties.P * t->performance.Isp) /
|
||||
(t->properties.T * ex->properties.P * ex->performance.Isp);
|
||||
ex->performance.cstar = e->properties.P * t->performance.a_dotm;
|
||||
ex->performance.cf = ex->performance.Isp /
|
||||
(e->properties.P * t->performance.a_dotm);
|
||||
ex->performance.Ivac = ex->performance.Isp + ex->properties.P
|
||||
* ex->performance.a_dotm;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,428 @@
|
||||
/* print.c - Output functions */
|
||||
/* $Id: print.c,v 1.1.1.1 2001/07/20 03:19:05 antoine Exp $ */
|
||||
/* Copyright (C) 2000 */
|
||||
/* Antoine Lefebvre <antoine.lefebvre@polymtl.ca> */
|
||||
/* Mark Pinese <pinese@cyberwizards.com.au> */
|
||||
/* */
|
||||
/* Licensed under the GPLv2 */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "libcpropep/include/print.h"
|
||||
#include "libcpropep/include/performance.h"
|
||||
#include "libcpropep/include/equilibrium.h"
|
||||
#include "libcpropep/include/conversion.h"
|
||||
#include "libcpropep/include/const.h"
|
||||
|
||||
#include "libthermo/include/thermo.h"
|
||||
|
||||
char header[][32] = {
|
||||
"CHAMBER",
|
||||
"THROAT",
|
||||
"EXIT" };
|
||||
|
||||
char err_message[][64] = {
|
||||
"Error allocating memory",
|
||||
"Error opening file",
|
||||
"Error EOF",
|
||||
"Error memory not allocated",
|
||||
"Error too much product",
|
||||
"Error in equilibrium",
|
||||
"Error bad aera ratio",
|
||||
"Error bad aera ratio type"};
|
||||
|
||||
FILE * errorfile;
|
||||
FILE * outputfile;
|
||||
|
||||
int print_error_message(int error_code)
|
||||
{
|
||||
fprintf(errorfile, "%s\n", err_message[-error_code - 1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int print_propellant_info(int sp)
|
||||
{
|
||||
int j;
|
||||
|
||||
if (sp > num_propellant || sp < 0)
|
||||
return -1;
|
||||
|
||||
fprintf(outputfile, "Code %-35s Enthalpy Density Composition\n", "Name");
|
||||
fprintf(outputfile, "%d %-35s % .4f % .2f", sp,
|
||||
(propellant_list + sp)->name,
|
||||
(propellant_list + sp)->heat,
|
||||
(propellant_list + sp)->density);
|
||||
|
||||
fprintf(outputfile, " ");
|
||||
|
||||
/* print the composition */
|
||||
for (j = 0; j < 6; j++)
|
||||
{
|
||||
if (!((propellant_list + sp)->coef[j] == 0))
|
||||
fprintf(outputfile, "%d%s ", (propellant_list + sp)->coef[j],
|
||||
symb[ (propellant_list + sp)->elem[j] ]);
|
||||
}
|
||||
fprintf(outputfile, "\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int print_thermo_info(int sp)
|
||||
{
|
||||
int i, j;
|
||||
thermo_t *s;
|
||||
|
||||
if (sp > num_thermo || sp < 0)
|
||||
return -1;
|
||||
|
||||
s = (thermo_list + sp);
|
||||
|
||||
fprintf(outputfile, "---------------------------------------------\n");
|
||||
fprintf(outputfile, "Name: \t\t\t%s\n", s->name);
|
||||
fprintf(outputfile, "Comments: \t\t%s\n", s->comments);
|
||||
fprintf(outputfile, "Id: \t\t\t%s\n", s->id);
|
||||
fprintf(outputfile, "Chemical formula:\t");
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
if (!(s->coef[i] == 0))
|
||||
fprintf(outputfile, "%d%s", s->coef[i], symb[ s->elem[i]]);
|
||||
}
|
||||
fprintf(outputfile, "\n");
|
||||
fprintf(outputfile, "State:\t\t\t");
|
||||
switch (s->state)
|
||||
{
|
||||
case GAS:
|
||||
fprintf(outputfile, "GAZ\n");
|
||||
break;
|
||||
case CONDENSED:
|
||||
fprintf(outputfile, "CONDENSED\n");
|
||||
break;
|
||||
default:
|
||||
printf("UNRECOGNIZE\n");
|
||||
}
|
||||
|
||||
fprintf(outputfile, "\n");
|
||||
fprintf(outputfile, "Molecular weight: \t\t% f g/mol\n", s->weight);
|
||||
fprintf(outputfile, "Heat of formation at 298.15 K : % f J/mol\n", s->heat);
|
||||
fprintf(outputfile, "Assign enthalpy : % f J/mol\n", s->enth);
|
||||
fprintf(outputfile, "HO(298.15) - HO(0): \t\t% f J/mol\n", s->dho);
|
||||
fprintf(outputfile, "Number of temperature range: % d\n\n", s->nint);
|
||||
|
||||
for (i = 0; i < s->nint; i++)
|
||||
{
|
||||
fprintf(outputfile, "Interval: %f - %f \n", s->range[i][0],
|
||||
s->range[i][1]);
|
||||
for (j = 0; j < 9; j++)
|
||||
fprintf(outputfile, "% .9e ", s->param[i][j]);
|
||||
fprintf(outputfile, "\n\n");
|
||||
}
|
||||
fprintf(outputfile, "---------------------------------------------\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int print_thermo_list(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < num_thermo; i++)
|
||||
fprintf(outputfile, "%-4d %-15s % .2f\n", i, (thermo_list + i)->name,
|
||||
(thermo_list + i)->heat);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int print_propellant_list(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < num_propellant; i++)
|
||||
fprintf(outputfile, "%-4d %-30s %5f\n", i, (propellant_list + i)->name,
|
||||
(propellant_list +i)->heat);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int print_condensed(product_t p)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < p.n[CONDENSED]; i ++)
|
||||
fprintf(outputfile, "%s ",
|
||||
(thermo_list + p.species[CONDENSED][i])->name );
|
||||
fprintf(outputfile, "\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int print_gazeous(product_t p)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < p.n[GAS]; i++)
|
||||
fprintf(outputfile, "%s ", (thermo_list + p.species[GAS][i])->name);
|
||||
fprintf(outputfile, "\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int print_product_composition(equilibrium_t *e, short npt)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
double mol_g = e->itn.n;
|
||||
|
||||
/* we have to build a list of all condensed species present
|
||||
in the three equilibrium */
|
||||
int n = 0;
|
||||
int condensed_list[MAX_PRODUCT];
|
||||
|
||||
/* ok become false if the species already exist in the list */
|
||||
int ok = 1;
|
||||
|
||||
double qt;
|
||||
|
||||
for (i = 0; i < e->product.n[CONDENSED]; i++)
|
||||
mol_g += e->product.coef[CONDENSED][i];
|
||||
|
||||
fprintf(outputfile, "\nMolar fractions\n\n");
|
||||
for (i = 0; i < e->product.n[GAS]; i++)
|
||||
{
|
||||
if (e->product.coef[GAS][i]/e->itn.n > 0.0)
|
||||
{
|
||||
fprintf(outputfile, "%-20s",
|
||||
(thermo_list + e->product.species[GAS][i])->name);
|
||||
|
||||
for (j = 0; j < npt; j++)
|
||||
fprintf(outputfile, " %11.4e", (e+j)->product.coef[GAS][i]/mol_g);
|
||||
fprintf(outputfile,"\n");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* build the list of condensed */
|
||||
for (i = 0; i < npt; i++)
|
||||
{
|
||||
for (j = 0; j < (e+i)->product.n[CONDENSED]; j++)
|
||||
{
|
||||
for (k = 0; k < n; k++)
|
||||
{
|
||||
/* check if the condensed are to be include in the list */
|
||||
if (condensed_list[k] == (e+i)->product.species[CONDENSED][j])
|
||||
{
|
||||
/* we do not have to include the species */
|
||||
ok = 0;
|
||||
break;
|
||||
}
|
||||
} /* k */
|
||||
|
||||
if (ok)
|
||||
{
|
||||
condensed_list[n] = (e+i)->product.species[CONDENSED][j];
|
||||
n++;
|
||||
}
|
||||
|
||||
/* reset the flag */
|
||||
ok = 1;
|
||||
} /* j */
|
||||
} /* i */
|
||||
|
||||
|
||||
if (n > 0)
|
||||
{
|
||||
fprintf(outputfile, "Condensed species\n");
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
fprintf(outputfile, "%-20s",
|
||||
(thermo_list + condensed_list[i])->name);
|
||||
|
||||
for (j = 0; j < npt; j++)
|
||||
{
|
||||
/* search in the product of each equilibrium if the
|
||||
condensed is present */
|
||||
|
||||
qt = 0.0;
|
||||
|
||||
for (k = 0; k < (e+j)->product.n[CONDENSED]; k++)
|
||||
{
|
||||
if (condensed_list[i] == (e+j)->product.species[CONDENSED][k])
|
||||
{
|
||||
qt = (e+j)->product.coef[CONDENSED][k];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(outputfile, " %11.4e", qt/mol_g);
|
||||
}
|
||||
fprintf(outputfile,"\n");
|
||||
|
||||
}
|
||||
}
|
||||
fprintf(outputfile, "\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int print_propellant_composition(equilibrium_t *e)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
fprintf(outputfile, "Propellant composition\n");
|
||||
fprintf(outputfile, "Code %-35s mol Mass (g) Composition\n", "Name");
|
||||
for (i = 0; i < e->propellant.ncomp; i++)
|
||||
{
|
||||
fprintf(outputfile, "%-4d %-35s %.4f %.4f ", e->propellant.molecule[i],
|
||||
PROPELLANT_NAME(e->propellant.molecule[i]), e->propellant.coef[i],
|
||||
e->propellant.coef[i] *
|
||||
propellant_molar_mass(e->propellant.molecule[i]));
|
||||
|
||||
fprintf(outputfile, " ");
|
||||
/* print the composition */
|
||||
for (j = 0; j < 6; j++)
|
||||
{
|
||||
if (!((propellant_list + e->propellant.molecule[i])->coef[j] == 0))
|
||||
fprintf(outputfile, "%d%s ",
|
||||
(propellant_list + e->propellant.molecule[i])->coef[j],
|
||||
symb[(propellant_list + e->propellant.molecule[i])->elem[j]]);
|
||||
}
|
||||
fprintf(outputfile, "\n");
|
||||
}
|
||||
fprintf(outputfile, "Density : % .3f g/cm^3\n", e->propellant.density);
|
||||
|
||||
if (e->product.element_listed)
|
||||
{
|
||||
fprintf(outputfile, "%d different elements\n", e->product.n_element);
|
||||
/* Print those elements */
|
||||
for (i = 0; i < e->product.n_element; i++)
|
||||
fprintf(outputfile, "%s ", symb[e->product.element[i]] );
|
||||
fprintf(outputfile, "\n");
|
||||
}
|
||||
|
||||
fprintf(outputfile, "Total mass: % f g\n", propellant_mass(e));
|
||||
|
||||
fprintf(outputfile, "Enthalpy : % .2f kJ/kg\n",
|
||||
propellant_enthalpy(e));
|
||||
|
||||
fprintf(outputfile, "\n");
|
||||
|
||||
if (e->product.product_listed)
|
||||
{
|
||||
fprintf(outputfile, "%d possible gazeous species\n", e->product.n[GAS]);
|
||||
if (global_verbose > 1)
|
||||
print_gazeous(e->product);
|
||||
fprintf(outputfile, "%d possible condensed species\n\n",
|
||||
e->product.n_condensed);
|
||||
if (global_verbose > 1)
|
||||
print_condensed(e->product);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int print_performance_information (equilibrium_t *e, short npt)
|
||||
{
|
||||
short i;
|
||||
|
||||
fprintf(outputfile, "Ae/At : ");
|
||||
for (i = 1; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.5f", (e+i)->performance.ae_at);
|
||||
fprintf(outputfile, "\n");
|
||||
|
||||
fprintf(outputfile, "A/dotm (m/s/atm) : ");
|
||||
for (i = 1; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.5f", (e+i)->performance.a_dotm);
|
||||
fprintf(outputfile, "\n");
|
||||
|
||||
fprintf(outputfile, "C* (m/s) : ");
|
||||
for (i = 1; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.5f", (e+i)->performance.cstar);
|
||||
fprintf(outputfile, "\n");
|
||||
|
||||
fprintf(outputfile, "Cf : ");
|
||||
for (i = 1; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.5f", (e+i)->performance.cf);
|
||||
fprintf(outputfile, "\n");
|
||||
|
||||
fprintf(outputfile, "Ivac (m/s) : ");
|
||||
for (i = 1; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.5f", (e+i)->performance.Ivac);
|
||||
fprintf(outputfile, "\n");
|
||||
|
||||
fprintf(outputfile, "Isp (m/s) : ");
|
||||
for (i = 1; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.5f", (e+i)->performance.Isp);
|
||||
fprintf(outputfile, "\n");
|
||||
|
||||
fprintf(outputfile, "Isp/g (s) : ");
|
||||
for (i = 1; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.5f", (e+i)->performance.Isp/Ge);
|
||||
fprintf(outputfile, "\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int print_product_properties(equilibrium_t *e, short npt)
|
||||
{
|
||||
short i;
|
||||
|
||||
fprintf(outputfile, " ");
|
||||
for (i = 0; i < npt; i++)
|
||||
fprintf(outputfile, " %11s", header[i]);
|
||||
fprintf(outputfile, "\n");
|
||||
|
||||
fprintf(outputfile, "Pressure (atm) :");
|
||||
for (i = 0; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.3f", (e+i)->properties.P);
|
||||
fprintf(outputfile, "\n");
|
||||
fprintf(outputfile, "Temperature (K) :");
|
||||
for (i = 0; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.3f", (e+i)->properties.T);
|
||||
fprintf(outputfile, "\n");
|
||||
fprintf(outputfile, "H (kJ/kg) :");
|
||||
for (i = 0; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.3f", (e+i)->properties.H);
|
||||
fprintf(outputfile, "\n");
|
||||
fprintf(outputfile, "U (kJ/kg) :");
|
||||
for (i = 0; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.3f", (e+i)->properties.U);
|
||||
fprintf(outputfile, "\n");
|
||||
fprintf(outputfile, "G (kJ/kg) :");
|
||||
for (i = 0; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.3f", (e+i)->properties.G);
|
||||
fprintf(outputfile, "\n");
|
||||
fprintf(outputfile, "S (kJ/(kg)(K) :");
|
||||
for (i = 0; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.3f", (e+i)->properties.S);
|
||||
fprintf(outputfile, "\n");
|
||||
fprintf(outputfile, "M (g/mol) :");
|
||||
for (i = 0; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.3f", (e+i)->properties.M);
|
||||
fprintf(outputfile, "\n");
|
||||
|
||||
fprintf(outputfile, "(dLnV/dLnP)t :");
|
||||
for (i = 0; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.5f", (e+i)->properties.dV_P);
|
||||
fprintf(outputfile, "\n");
|
||||
fprintf(outputfile, "(dLnV/dLnT)p :");
|
||||
for (i = 0; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.5f", (e+i)->properties.dV_T);
|
||||
fprintf(outputfile, "\n");
|
||||
fprintf(outputfile, "Cp (kJ/(kg)(K)) :");
|
||||
for (i = 0; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.5f", (e+i)->properties.Cp);
|
||||
fprintf(outputfile, "\n");
|
||||
fprintf(outputfile, "Cv (kJ/(kg)(K)) :");
|
||||
for (i = 0; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.5f", (e+i)->properties.Cv);
|
||||
fprintf(outputfile, "\n");
|
||||
fprintf(outputfile, "Cp/Cv :");
|
||||
for (i = 0; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.5f", (e+i)->properties.Cp/(e+i)->properties.Cv);
|
||||
fprintf(outputfile, "\n");
|
||||
fprintf(outputfile, "Gamma :");
|
||||
for (i = 0; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.5f", (e+i)->properties.Isex);
|
||||
fprintf(outputfile, "\n");
|
||||
fprintf(outputfile, "Vson (m/s) :");
|
||||
for (i = 0; i < npt; i++)
|
||||
fprintf(outputfile, " % 11.5f", (e+i)->properties.Vson);
|
||||
fprintf(outputfile, "\n");
|
||||
fprintf(outputfile, "\n");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user