//### //***************************************************************************** // * // Include Name: arrays * // * // File Name: arrays.h * // * // Purpose: Contains array sizes for include files and local arrays * // * // Author: Robert L. Reese * // * // Date: February 13, 2004 * // * // Language: Borland C++ Compiler, Version 4.5 * // * // Hardware: IBM Cosmpatible PC * // * // Operating System: Microsoft Windows 98 * // * // Update History: * // * // Name Date Revision Changes * // ---- ---- --------- ------- * // * // R.L. Reese 02/13/04 0 Initial Release * // R.L. Reese 04/06/06 A Increased size of adata, * // atom, len_file and len_reread * // Added integration values * // * //----------------------------------------------------------------------------* // * // Usage: * // * // #define "arrays.h" * // * //----------------------------------------------------------------------------* // * // Definitions: * // * // Local Variables: * // ---------------- * // * // None * // * // Global Variables: * // ----------------- * // * // None * // * // Constants: * // --------- * // * // general * // adata_len - Integer variable used as length of adata array * // b_size - Integer variable used as size of b array * // blank_length - Integer variable used as length of blank array * // blank_size - Integer value of size of blank array * // coefx_size - Integer value of size of coefx array * // date_char - Integer variable used number of chars in a date * // ibuf_blanks - Integer value of number of blanks to set in ibuf * // idata_size - Integer value of size of idata array in react_read * // lank_size - Integer value of size of lank array in react_read * // lmt_size - Integer variable used as size of lmt array * // max_atoms - Integer containing maximum number of atoms * // num_buf_size - Integer value of size of num_buf array in react_read * // real_buf_len - Integer variable used as size of real_buf * // stop_or_go_len - Integer value of length of stop_or_go character array * // thermodat_len - Integer value of length of text "THERMODAT" * // double.h * // matrix_columns - Integer value of number of matrix columns * // matrix_rows - Integer value of number of matrix rows * // misc.h and species.h * // element_max - Integer value of maximum number of elements allowed * // len_file - Integer value of length of file names * // len_reread - Integer value of length of re-read buffer for * // read_error * // reacts_max - Integer value of maximum mole values per record * // size_char - Integer value used as len of char to replace default * // length of 4 characters in one word for FORTRAN 4 and * // FORTRAN 77 conversion * // species_max - Integer value of maximum number of species allowed * // points.h and speces.h * // npt_out - Integer value of total points output on a page * // t_p_size - Integer value of total number of pressures and * // temperatures allowed * // react.cpp * // atom_temp_len - Integer value of length of atom_temp array * // rdata_len - Integer value of length of rdata_array * // speces.h * // b_values_number- Integer value of number of integration sets per * // species * // b_values_sets - Integer value of number of integration sets * // coeff_sets - Integer value of number of sets in coefficient values * // coeff_values - Integer value of number of coefficient values in a set* // sub_size - Integer value of middle size of sub array * // temp_max - Integer value of column dimension of temp array * // total_char - Integer value of total characters in species name * // * // Prototypes: * // ----------- * // * // None * // * //***************************************************************************** //### // general const int adata_len = 1024; const int b_size = 10 ; const int blank_length = 15; const int blank_size = 1024; const int coefx_size = 20 ; const int date_char = 6; const int ibuf_blanks = 21; const int idata_size = 1024; const int lank_size = 16; const int lmt_size = 15 ; const int mt_size = 10 ; const int max_atoms = 102 ; const int num_buf_size = 21; const int real_buf_len = 16; const int stop_or_go_len = 1024; const int thermodat_len = 9; // double.h const int matrix_columns = 21; const int matrix_rows = 20; // misc.h const int element_max = 15; const int len_file = 1024; const int len_reread = 1024; const int reacts_max = 5; const int size_char = 4; const int species_max = 100; // points.h const int npt_out = 6; const int t_p_size = 45; // react.cpp const int atom_temp_len = 2; const int rdata_len = 81; // speces.h const int b_values_number = 2; const int b_values_sets = 2; const int coeff_sets = 2; const int coeff_values = 7; const int sub_size = 8; const int temp_max = 2; const int total_char = 32; // end arrays.h //### //***************************************************************************** // * // Include Name : atoms * // * // File Name: atoms.h * // * // Purpose: Contains atomic symbols and weights for function react * // * // Author: Robert L. Reese * // * // Date: January 28, 2004 * // * // Language: Borland C++ Compiler, Version 4.5 * // * // Hardware: IBM Cosmpatible PC * // * // Operating System: Microsoft Windows 98 * // * // Update History: * // * // Name Date Revision Changes * // ---- ---- --------- ------- * // * // R.L. Reese 01/28/04 0 Initial Release * // R.L. Reese 04/13/06 A Added "E" to atom table * // * //----------------------------------------------------------------------------* // * // Usage: * // * // #include "atoms.h" * // * //----------------------------------------------------------------------------* // * // Definitions: * // * // Local Variables: * // ---------------- * // * // None * // * // Pointers * // ----------------- * // * // None * // * // Global Variables: * // ----------------- * // * // None * // * // Constants: * // --------- * // * // local * // atom - Real array containing atomic weight of the elements * // iatom - Character*2 array containing atomic symbol of * // elements * // arrays.h * // max_atoms - Integer containing maximum number of atoms * // * //***************************************************************************** //### // atomic symbols. const char iatom[][max_atoms] = {"H ", "HE", "LI", "BE", "B ", "C ", "N ", "O ", "F ", "NE", "NA", "MG", "AL", "SI", "P ", "S ", "CL", "AR", "K ", "CA", "SC", "TI", "V ", "CR", "MN", "FE", "CO", "NI", "CU", "ZN", "GA", "GE", "AS", "SE", "BR", "KR", "RB", "SR", "Y ", "ZR", "NB", "MO", "TC", "RU", "RH", "PD", "AG", "CD", "IN", "SN", "SB", "TE", "I ", "XE", "CS", "BA", "LA", "CE", "PR", "ND", "PM", "SM", "EU", "GD", "TB", "DY", "HO", "ER", "TM", "YB", "LU", "HF", "TA", "W ", "RE", "OS", "IR", "PT", "AU", "HG", "TL", "PB", "BI", "PO", "AT", "RN", "FR", "RA", "AC", "TH", "PA", "U ", "NP", "PU", "AM", "CM", "BK", "CF", "ES", "FM", "D ", "E "}; // atomic weights. const float atom[max_atoms] = {1.00797, 4.0026, 6.939, 9.0122, 10.811, 12.01115, 14.0067, 15.9994, 18.9984, 20.183, 22.9898, 24.312, 26.9815, 28.086, 30.9738, 32.064, 35.453, 39.948, 39.102, 40.0800, 44.956, 47.90 , 50.942, 51.996, 54.938, 55.847, 58.9332, 58.710, 63.54 , 65.370, 69.720, 72.590, 74.9216, 78.96 , 79.909, 83.80 , 85.470, 87.620, 88.905, 91.220, 92.906 , 95.940, 99.00 , 101.070, 102.905, 106.400, 107.870, 112.400 , 114.820, 118.69 , 121.750, 127.600,126.9044, 131.300, 132.905 , 137.340, 138.910 , 140.120, 140.907, 144.240, 145.000, 150.350 , 151.960, 157.250 , 158.924, 162.500, 164.930, 167.260, 168.934 , 173.040, 174.997 , 178.490, 180.948, 183.850, 186.200, 190.200 , 192.200, 195.090 , 196.967, 200.590, 204.370, 207.190, 208.980 , 210.000, 210.000 , 222.000, 223.000, 226.000, 227.000, 232.038 , 231.000, 238.030 , 237.000, 242.000, 243.000, 247.000, 249.000 , 251.000, 254.000 , 253.000, 2.014102,.000548579903} ; // end file atoms.h //### //***************************************************************************** // * // Include Name : constant * // * // File Name: constant.h * // * // Purpose: Contains constants and sizes for different routines. * // * // Author: Robert L. Reese * // * // Date: November 26, 2003 * // * // Language: Borland C++ Compiler, Version 4.5 * // * // Hardware: IBM Cosmpatible PC * // * // Operating System: Microsoft Windows 98 * // * // Update History: * // * // Name Date Revision Changes * // ---- ---- --------- ------- * // * // R.L. Reese 11/26/03 0 Initial Release * // R.L. Reese 04/12/06 A Added newt_position value for * // default positon of new_thermo * // Corrected error in Yes_Flag * // * //----------------------------------------------------------------------------* // * // Usage: * // * // #include "constant.h" * // * //----------------------------------------------------------------------------* // * // Definitions: * // * // Local Variables: * // ---------------- * // * // None * // * // Pointers * // ----------------- * // * // None * // * // Global Variables: * // ----------------- * // * // None * // * // Constants: * // --------- * // * // general * // ablank - Character*1 containing a blank * // code_length - Integer value of length of code words in input data * // iblank - Character*1 containing a blank * // itn - Integer value of intital iteration count * // not_flag - Character containing flag off character (default) * // nreac_test - Integer value of number of reactants for ternary * // system * // num_radix - Integer radix value used in converting integers * // r - Real value of universal gas constant * // string_end - Character containing end of string control character * // t_p_default - Real value of input temperature or pressure input * // t_p_records - Integer value of number of temp or press records * // yes_flag - Character containing "T" character * // check_input.cpp * // flag_position - Integer variable used as position of tem and gas * // input flags default * // kase_default - Integer variable used as default value for kase * // kase_inc - Integer value of increment to use for kase position * // kase_loop - Integer value of loop index to get kase value * // kase_moves - Integer value of maximum number of moves for kase * // kase_position - Integer variable used as position of kase default * // kase_test - Integer value to test for default of kase value * // newt_position - Integer variable used as position of new_thermo * // input flag default * // rsize_inc - Integer value of increment to use for rsize position * // rsize_loop - Integer value of loop index to get rsize value * // rsize_moves - Integer value of maximum number of moves for rsize * // rsize_position - Integer value used as position of rsize default * // rsize_test - Integer value to test for default of rsize value * // tri_inc - Integer value of increment to use for rsize position * // tri_loop - Integer value of loop index to get rsize value * // tri_moves - Integer value of maximum number of moves for rsize * // tri_position - Integer value used as position of rsize default * // tri_test - Integer value to test for default of rsize value * // check_insert.cpp and check_omit.cpp * // first_name - Integer value of number of characters in name * // first_start - Integer value of start of first name * // max_names - Integer value of maximum number of names in one * // record * // second_check - Integer value for check if second name present * // second_name - Integer value for start of second name * // check_systems.cpp * // third_add_indx - Integer value of index to third add value in ternary * // system * // coeff_read.cpp * // coeff_length - Integer value of length of each coefficient value * // coeff_num_set - Integer value of number of coefficients per temp set * // coeff_records - Integer value of number of records per species * // full_record - Integer value of lengh of record with 5 values * // num_coeff_full - Integer value of number of values in full record * // num_coeff_part - Integer value of number of values in partial record * // partial_index - Integer value of index to partial record * // partial_record - Integer value of length of record with 4 values * // second_index - Integer value of index to second set of values * // third_index - Integer value of index to third set of values * // cphs.cpp * // coeff_break_pt - Real value of break point temp between high and low * // coefficients * // high_coeff - Integer index to set of high coefficients * // low_coeff - Integer index to set of low coefficients * // phase_range - Integer value to use for plus/minus search of * // condensed species being used * // eqlbrm.cpp * // asize_value - Real value used for test of greatest delta G * // eqlbrm_blank - Character*1 containing blank character * // last_temp - Integer value index to temperature to check for * // current temperature range * // ncond_test - Integer value to use for singularity test * // nocon2_test - Integer value to use for second singularity test * // size_1_value - Real initial value used for control size of output * // values of gaseous species * // smalno - Real value used to reassign value of 1 x 10-6 to * // gaseous specie mole fraction the first time a * // singular matrix occurs * // smnol - Real value used to reassign value of -13.815511 to * // gaseous specie log nj value the first time a singular* // matrix occurs if the mole fraction is not equal to 0 * // sum_all - Real variable used for storing summations * // fcoeff.cpp * // names - Character array containing element names of gases * // names_inc - Integer value of increment for names array chars * // names_size - Integer value of size of names array * // fpcalc.cpp * // po_test - Real value of used to initialize po * // gauss.cpp * // bigno - Real value that stores value of 1 x 1038 to be used * // for locating the maximum coefficient in each row of * // the matrix * // get_estimates.cpp * // e - Real value used as base of natural system of * // logarithims * // deln_test - Double precision value to use in testing deln * // sum_all_compare - Real value used to compare sum_all variable * // sum_all_test - Real value used to test sum_all variable * // sum1_value - Real value default for sum1 * // get_value.cpp * // add_end - Integer value of end of add value field * // add_index - Integer value of add index in loop * // add_offset - Integer value of offset of add value * // base_end - Integer value of end of base valu field * // base_offset - Integer value of offset of base value * // field_length - Integer value of field length of three values * // num_values - Integer value of number of values to get * // top_end - Integer value of end of top value field * // top_offset - Integer value of offset of top value * // values_moved - Integer value of number of values to move * // increment_add.cpp * // add_factor - Integer value to multiply add by for comparison * // increment_only.cpp * // zerot_value - Integer value to use for rtest test * // init.cpp * // ennl_initial - Real value of initial value of ennl * // enn_initial - Real value of initial value of enn * // intread.cpp * // f1001 - Char pointer to empty file error message * // f1002 - Char pointer to warning message * // nbytes_default - Integer value of nbytes default size * // itnumb_get.cpp * // ak1 - Double precision array to use in calculation for * // data in Janaf tables * // ak2 - Double precision array to use in calculation for * // data in Janaf tables * // ak4 - Double precision array to use in calculation for * // data in Janaf tables * // co_name - Character containing "CO" * // co2_name - Character containing "CO2" * // fco_min - Real value of default for fco and fco2 * // fco_multiply - Real value multiplier for fco and fco2 fugacity * // calculation * // fh2_min - Real value of default for fh2 * // fh2_multiply - Real value multiplier for fh2 fugacity calculation * // h2_name - Character containing "H2" * // h2o_name - Character containing "H2O" * // num_logs - Integer value for number of logs to use in * // calculations from data in Janaf Tables * // o2_name - Character containing "O2" * // oxfug_value - Real value multiplier for O2 fugacity calculation * // ten_compare - Real value used in comparison of temp value for * // fugacity calculation * // linelen.cpp * // exclamation - Character containing exclamation symbol which is last * // valid alpha character in ASCII table * // line_decrement - Integer value used to adjust length returned from * // strnlen for end of line characters * // max_line_len - Integer value of maximum characters in an input * // record * // loop_read.cpp * // insert - Character*4 containing code word indicating a * // istop - Character*4 containing code word indicating end * // mit - Character*4 containing code word indicating omit * // name_list - Character*4 containing code word indicating name * // reac - Character*4 containing code to indicate Reactant * // molewt.cpp * // newmol_test - Integer value to use for test to determine if new * // search is to be bypassed * // switch_index - Integer value to use for index in switching values * // third_add - Integer value to use for third index of add array * // third_base - Integer value to use for third index of base array * // third_top - Integer value to use for third index of top array * // omit_insert.cpp * // jj_bug_fix - Integer value of fix for bug in temporary storage * // counter * // kount_reset - Integer value used to reset kount variable * // out1.cpp and out1_moles.cpp * // ib - Character*2 contining blanks * // jt_value - Integer value of maximum size of output line values * // oxfug_val - Real value of maximum size of oxygen fugacity * // qfi_factor_1 - Real value of first value in calculating qfi * // qfi_factor_2 - Real value of second value in calculating qfi * // qfi_factor_3 - Real value of third value in calculating qfi * // trace_limit - Real value of limit of trace * // v_limit - Real value of size of v value * // process_pressure.cpp * // blank_index - Integer value pointing to start of blanked field * // count_decrement - Integer value to subtract from nbytes_count for * // pressure default test * // decrement_count - Integer value to subtract from nbytes_count for * // temperature default test * // field_width - Integer value of output field width for pressures * // initial_nbytes - Integer value to ending position of first input * // pressure * // kelvin - Integer value of Kelvin conversion factor * // max_out_values - Integer value to number of output values per line * // max_t_p - Integer value of maximum number of values allowed * // max_temp - Real value of maximum temperature allowed * // round_up - Real value of value used to round up for below zero * // Kelvin test * // values_record - Integer value of maximum values per input record * // read_coeff.cpp * // date_start - Integer value of start of date field in input record * // default_volume - Integer value for test to default volume * // ibuf_end - Integer value of end of mole value field in ibuf * // iend - Character*4 containing 'ENDD' * // max_vol_size - Integer value to test for position of volume value * // mole_inc - Integer value to increment kount for mole value * // mole_length - Integer value of number of digits in mole value * // mole_name_set - Integer value of number of sets of moles and names * // name_adjust - Integer value for adjusting length of name record * // no_volume - Integer value for test for no volume value present * // phaz_start - Integer value of start of phase field in input record* // set_increment - Integer value of increment for mole and name set * // short_mole - Integer value to test for length of mole record * // short_name - Integer value to test for length of name record * // temp_length - Integer value of length of temperatures fields * // vol_ibuf_end - Integer value of length of volume field * // volume_offset - Integer value of start of volume field in input file * // read_react.cpp * // length_field - Integer value of length of element and mole fields * // max_length - Integer value of length of reactant records * // mole_pairs - Integer value of number of element and mole pairs * // mole_moves - Integer value of number of moves for mole value * // name_count_inc - Integer value of element name increment * // redkw.cpp * // th - Real value = 0.333333D0 * // remove_and_add.cpp * // ll_test - Integer value to use for test to determine which * // new_test - Integer value to use for test to determine if one * // reactant is to be added or removed * // second_add - Integer value to use for second index of add array * // rkcalc.cpp * // aaa - Real array containing REDLICH-KWONG A values * // (divided by one million * // bbb - Real array containing REDLICH-KWONG B values * // rr - Real value of gas constant in CC BAR/DEG Mole * // saxena.cpp * // pccc - Real array containing critical pressures for certain* // gases * // poo - Real value = 4000.0 bars * // tccc - Real array containing critical temperatures for * // certain gases * // search.cpp * // elem_size - Integer value of number of characters in element * // name * // gas - Character*2 containing 'G' * // ms_increment - Integer variable used as do loop increment for * // finding species in record * // ns_increment - Integer variable used as do loop increment for * // outputting species names used in current problem * // second_temp - Integer variable used as index to second temp on * // coefficient record * // test_condensed.cpp * // num_int_max - Integer value for maximum of num_int allowed * // num_moles - Integer value of number of moles to use to * // to determine if species is to be removed * // thermp.cpp * // newmol_reset - Integer value to reset newmol to for next run * // thermp_sub.cpp * // noconv_test - Integer value of maximum number of no convergence * // results * // npt_test - Integer value of maximum number of npt's for output * // zero_test_1 - Real value for first test for variance in testing * // for zero * // zero_test_2 - Real value for second test for variance in testing * // for zero * // zero_test_3 - Real value for third test for variance in testing * // for zero * // * //***************************************************************************** //### // General constants const char ablank[] = " "; const int code_length = 4; const char iblank = ' '; const int itn = 35 ; const char not_flag = 'F'; const int nreac_test = 3; const int num_radix = 10; const float r = 8314.3/4184. ; const char string_end = '\0'; const float t_p_default = -32767.0; const int t_p_records = 5; const char yes_flag = 'T'; // Constants for check_input const int flag_position = 3; const int kase_default = 1; const int kase_inc = 2; const int kase_loop = 4; const int kase_moves = 5; const int kase_position = 4; const int kase_test = 7; const int newt_position = 30; const int rsize_inc = 7; const int rsize_loop = 10; const int rsize_moves = 11; const int rsize_position = 9; const int rsize_test = 18; const int tri_inc = 18; const int tri_loop = 8; const int tri_moves = 9; const int tri_position = 20; const int tri_test = 27; // Constants for check_insert and check_omit and omit_insert const int first_name = 8; const int first_start = 31; const int max_names = 2; const int second_check = 45; const int second_name = 46; // Constants for check_systems const int third_add_indx = 2; // Constants for coeff_read and coeff_read_new const int coeff_length = 15; const int coeff_num_set = 7; const int coeff_records = 3; const int full_record = 76; const int integration_test= 2; const int num_coeff_full = 5; const int num_coeff_part = 4; const int partial_index = 2; const int partial_record = 61; const int second_index = 5; const int third_index = 3; // Constant for cphs const float coeff_break_pt = 1000.0; const int high_coeff = 0; const int low_coeff = 1; const int phase_range = 10; // Constants for eqlbrm const float asize_value = -1.E+36 ; const char eqlbrm_blank[] = " " ; const int last_temp = 2 ; const int ncond_test = 2 ; const int nocon2_test = 2 ; const float size_1_value = 18.420681 ; const float smalno = 1.E-6 ; const float smnol = -13.815511 ; double sum_all ; // Constants for fcoeff const int names_size = 104; const int names_inc = 4; const char names[][names_size] = {"A","R"," "," ", "H","2"," "," ", "N","2"," "," ", "O","2"," "," ", "F","2"," "," ", "C","L","2"," ", "N","H","3"," ", "N","2","H","4", "H","C","N"," ", "C","O"," "," ", "C","O","2"," ", "N","2","O"," ", "N","O"," "," ", "N","2","O","4", "S","O","2"," ", "H","2","S"," ", "H","F"," "," ", "S","I","F","4", "H","C","L"," ", "C","H","4"," ", "H","2","O"," ", "C","H","C","L", "C","H","2","C", "C","H","3","C", "C","C","L","4", "C","O","C","L"}; // Constant for fpcalc const float po_test = 4000.0 ; // Constants for gauss const double bigno = 1.E+38 ; // Constants for get_estimates const double deln_test = 0.9e-99; const float e = 2.7182818; const float sum_all_compare = 0.5E-5; const float sum_all_test = 2.0 ; const float sum1_value = -9.212 ; // Constants for get_value const int add_end = 72; const int add_index = 2; const int add_offset = 63; const int base_end = 54; const int base_offset = 47; const int field_length = 10; const int num_values = 3; const int top_end = 64; const int top_offset = 56; const int values_moved = 9; // Constant for increment_add const float add_factor = 0.5 ; // Constant for increment_only const float zerot_value = 1.0E-4 ; // Constants for init const float enn_initial = .1 ; const float ennl_initial = -2.3025851 ; // Constants for init_read const char *f1001 = " ERROR! -- File is empty.\n"; const char *f1002 = " Make sure there is a line feed at end of STOP.\n"; const int nbytes_default = 80; // Constants for itnumb_get // *** // COEFFICIENTS FOR EQUILIBRIUM CONSTANTS FROM DATA IN JANAF TABLES // k1: C+O2 = CO2; k2:C+.5O2 = CO;k4: H2+.5O2 = H2O // EQUATION FORM IS LOG10(K) = A1+A2*T+A3*T**2 ... AND FIT FROM // 500-2300K // *** // const double ak1[8] = {.114463e3,-.243442e2,.248074e1,-.114863e0,.584013e-3, .154925e-3,-.555708e-5,.592449e-7} ; const double ak2[8] = {.36845e2,-.689197e1,.711475e0,-.337899e-1,.223693e-3, .4365e-4,-.162723e-5,.178614e-7} ; const double ak4[8] = {.687667e2,-.153556e2,.158928e1,-.759149e-1,.535197e-3, .96958e-4,-.366479e-5,.407351e-7} ; const char co_name[] = "CO"; const char co2_name[] = "CO2"; const float fco_min = 1.E-20 ; const float fco_multiply = 2.0 ; const float fh2_min = 1.E-20 ; const float fh2_multiply = 2.0 ; const char h2_name[] = "H2"; const char h2o_name[] = "H2O"; const int num_logs = 8 ; const char o2_name[] = "O2"; const float oxfug_value = 0.434294 ; const float ten_compare = 5.E-6 ; // Constants for linelen const char exclamation = '!'; const int line_decrement = 2; const int max_line_len = 80; // Constants for loop_read const char insert[] = "INSE" ; const char istop[] = "STOP" ; const char mit[] = "OMIT" ; const char name_list[] = "NAME" ; const char reac[] = "REAC" ; // Constants for molewt const int newmol_test = 2 ; const int switch_index = 1 ; const int third_add = 2 ; const int third_base = 2 ; const int third_top = 2 ; // Constants for omit_insert const int jj_bug_fix = 14; const int kount_reset = 4; // Constants for out1 and out1_moles const char ib = ' ' ; const int jt_value = 6 ; const float oxfug_val = 10000.0 ; const float qfi_factor_1 = 7.51 ; const float qfi_factor_2 = 29382.0 ; const float qfi_factor_3 = 0.050 ; const double trace_limit = 9.e-7 ; const double v_limit = 1.e-100 ; // Constant for process_pressure and temp_press const int blank_index = 4; const int count_decrement = 3; const int decrement_count = 4; const int field_width = 5; const int initial_nbytes = 6; const float kelvin = 273.15 ; const int max_out_values = 6; const int max_t_p = 45; const float max_temp = 5000.0; const float round_up = 0.0001; const int values_record = 9; // Constant for read_coeff const int date_start = 38; const int default_volume = 52; const int ibuf_end = 10; const char iend[] = "ENDD" ; const int max_vol_size = 66; const int mole_inc = 2; const int mole_length = 3; const int mole_name_set = 10; const int name_adjust = 4; const int no_volume = 51; const int phaz_start = 47; const int set_increment = 5; const int short_mole = 66; const int short_name = 68; const int temp_length = 10; const int vol_ibuf_end = 15; const int volume_offset = 50; // Constants for read_react const int length_field = 9; const int max_length = 73; const int mole_pairs = 5; const int mole_moves = 7; const int name_count_inc = 2; // Constant for redkw const float th = 0.333333E0 ; // Constants for remove_and_add const int ll_test = 2 ; const int new_test = 2 ; const int second_add = 1 ; // Constants for rkcalc // THE FOLLOWING ARRAYS GIVE THE REDLICH-KWONG A AND B PARAMETERS // FROM HOLLOWAY 1987 IN BAR UNITS. // REDLICH-KWONG A AND B PARAMETERS, FROM HOLLOWAY 1987 // THE A PARAMETER IS DIVIDED BY ONE MILLION const float aaa[26] = // AR H2 N2 O2 F2 CL2 NH3 N2H4 HCN {16.9, 1.81, 15.6, 17.5, 58.3, 13.6, 86.8, 100., 244., // C0 C02 N2O NO N2O2 S02 H2S HF SIF4 17.2, 83., 68.7, 19.8, 112.6, 133.1, 89.,78., 85.6, // HCL CH4 H2O CH3CL CH2CL2 CHCL3 CCL4 COCL2 67.4, 32., 88.,156.0, 248.8,359.1,472.1,229.6}; const float bbb[26] = // AR H2 N2 O2 F2 CL2 NH3 N2H4 HCN {22.3,15.34, 26.8, 22.1, 33.7, 39., 25.9, 60., 61., // C0 C02 N2O NO N2O2 S02 H2S HF SIF4 27.4,29.7, 30.8, 20., 30.7, 34.7, 20.,12.8,50.1, // HCL CH4 H2O CH3CL CH2CL2 CHCL3 CCL4 COCL2 28.12, 29.7, 14.6, 44.8, 60.4, 70.6, 87.8, 57.8}; // GAS CONSTANT IN CC BAR/DEG MOLE const float rr = 82.05 ; // Constants for saxena const float poo = 4000.0; // Critical temperatures and pressures. // const float tccc[26] = // AR H2 N2 O2 F2 CL2 NH3 N2H4 {150.8,43.6,126.2,154.58,144.3,417.,405.6,653., // HCN C0 C02 N2O NO N2O2 S02 H2S 456.8,132.9,304.2,309.56,180., 431., 430.8,373.2, // HF SIF4 HCL CH4 H2O CH3CL CH2CL2 CHCL3 CCL4 COCL2 461.,259.,324.6,190.7,647.14,416.3, 510., 536.4,556.4, 455.}; const float pccc[26] = // AR H2 N2 O2 F2 CL2 NH3 N2H4 {48.1,20.46,33.5,49.77,51.47, 76., 111.3, 145., // HCN C0 C02 N2O NO N2O2 S02 H2S HF 53.2, 34.95,73.9, 71.5, 64., 100.,134.3, 78.8, 64., // SIF4 HCL CH4 H2O CH3CL CH2CL2 CHCL3 CCL4 COCL2 36.7, 82., 46.4, 218.,65.92, 60.0, 54.0, 45.0, 56.0}; // Constant for search const int elem_size = 2; const char gas = 'G' ; const int ms_increment = 2 ; const int ns_increment = 2 ; const int second_temp = 2 ; // Constants for test_condensed const int num_int_max = 15 ; const int num_moles = 10 ; // Constant for thermp const int newmol_reset = 2 ; // Constants for thermp_sub const int noconv_test = 2 ; const int npt_test = 6 ; const float zero_test_1 = 1.0E-03 ; const float zero_test_2 = 1.0E-06 ; const float zero_test_3 = 1.0E-10 ; // end constant.h //### //***************************************************************************** // * // Include Name: double * // * // File Name: double.h * // * // Purpose: Contains double precision arrays for the matrix * // * // Author: Robert L. Reese * // * // Date: June 01, 1973 * // * // Language: Borland C++ Compiler, Version 4.5 * // * // Hardware: IBM Cosmpatible PC * // * // Operating System: Microsoft Windows 98 * // * // Update History: * // * // Name Date Revision Changes * // ---- ---- --------- ------- * // * // R.L. Reese 06/01/73 0 Initial Release * // R.L. Reese 11/23/03 A Converted to C++ * // * //----------------------------------------------------------------------------* // * // Usage: * // * // #include "double.h" * // * //----------------------------------------------------------------------------* // * // Definitions: * // * // Local Variables: * // ---------------- * // * // None * // * // Global Variables: * // ----------------- * // * // g - Double precision array of elements of the matrix * // x - Double precision array for answer region for matrix * // solution (Lagrangian Multiplier) * // * // Local Common Blocks: * // ------------------- * // * // None * // * // Constants: * // --------- * // * // arrays.h * // matrix_columns - Integer value of number of matrix columns * // matrix_rows - Integer value of number of matrix rows * // * // Include Files: * // -------------- * // * // None * // * // Prototypes: * // ----------- * // * // None * // * //***************************************************************************** //### extern double g[matrix_rows][matrix_columns] ; extern double x[matrix_rows] ; // end double.h //### //***************************************************************************** // * // Include Name: extern * // * // File Name: extern.h * // * // Purpose: Contains all the include *.h files variables to be used * // as externals in the appropiate functions. Only used in main * // function therm * // * // Author: Robert L. Reese * // * // Date: January 07, 2004 * // * // Language: Borland C++ Compiler, Version 4.5 * // * // Hardware: IBM Cosmpatible PC * // * // Operating System: Microsoft Windows 98 * // * // Update History: * // * // Name Date Revision Changes * // ---- ---- --------- ------- * // * // R.L. Reese 01/07/04 0 Initial Release * // R.L. Reese 04/12/06 A Added new_thermo flag * // * //----------------------------------------------------------------------------* // * // Usage: * // * // #include "extern.h" * // * //----------------------------------------------------------------------------* // * // Definitions: * // * // Local Variables: * // ---------------- * // * // None * // * // Global Variables: * // ----------------- * // * // Descriptions can be found in the appropiate *.h files for each group * // * // Local Common Blocks: * // ------------------- * // * // None * // * // Constants: * // --------- * // * // None * // * // Include Files: * // -------------- * // * // None * // * // Prototypes: * // ----------- * // * // None * // * //***************************************************************************** //### // externals for double.h include file double g[matrix_rows][matrix_columns] ; double x[matrix_rows] ; // externals for indx.h include file int imat ; int iq1 ; int kase ; int nc ; int newmol ; int nlm ; int nmin ; int nmix ; int nomit ; int np ; int npt ; int nrat ; int nreac ; int ns ; int nsert ; int nt ; // variables used as logical flags int alter ; int plus ; int systm ; // externals for misc.h include file float enn ; float ennl ; float pp ; float sumn ; float tm ; float tri ; float tt ; float add[element_max] ; float anum[element_max][reacts_max] ; float base[element_max] ; float bo[element_max] ; float top[element_max] ; float vol[species_max] ; double gamma[species_max] ; int noconv ; char llmt[size_char][element_max] ; char name[size_char][element_max][reacts_max] ; char infile[len_file] ; char re_read[len_reread] ; char outfile[len_file] ; // externals for points.h include file float p[t_p_size] ; float ppp[npt_out] ; float t[t_p_size] ; float totn[npt_out] ; float ttt[npt_out] ; float free_energy[npt_out] ; float fo2c[npt_out] ; float fo2h[npt_out] ; float gtotn[npt_out] ; float oxfug[npt_out] ; float rsize ; int newest ; int gas_input ; int new_thermo ; int pressure_number; int tem ; int temp_number; // externals for speces.h include file float a[element_max][species_max] ; float temp[species_max][temp_max] ; double b_values[b_values_sets][b_values_number][species_max]; double coef[coeff_sets][coeff_values][species_max] ; double en[species_max][npt_out] ; double enln[species_max] ; double ho[species_max] ; double s[species_max] ; int iuse[species_max] ; int juse[species_max] ; char ensert[total_char][species_max] ; char omit[total_char][species_max] ; char sub[size_char][sub_size][species_max] ; // externals for function eqlbrm which previous values from function eqlbrm // are used again in next entry to eqlbrm float fco ; float fco2 ; float fh2 ; float fh2o ; // externals for function molewt which previous value from function molewt // are used again in next entry to molewt double aa[element_max] ; float bb[element_max] ; float to[element_max] ; int ll; int removed; // end extern.h //### //***************************************************************************** // * // Include Name: indx * // * // File Name: indx.h * // * // Purpose: Contains index constants and variables * // * // Author: Robert L. Reese * // * // Date: June 01, 1972 * // * // Language: Borland C++ Compiler, Version 4.5 * // * // Hardware: IBM Cosmpatible PC * // * // Operating System: Microsoft Windows 98 * // * // Update History: * // * // Name Date Revision Changes * // ---- ---- --------- ------- * // * // R.L. Reese 06/01/73 0 Initial Release * // R.L. Reese 11/23/03 A Converted to C++ * // * //----------------------------------------------------------------------------* // * // Usage: * // * // #include "indx.h" * // * //----------------------------------------------------------------------------* // * // Definitions: * // * // Local Variables: * // ---------------- * // * // None * // * // Global Variables: * // ----------------- * // * // alter - Logical variable used to indicate reactant mole * // mole fractions with unequal top and base values * // are to be altered * // imat - Integer variable used as number of rows in matrix * // iq1 - Integer variable used as number of elements plus the * // number of condensed species included in matrix * // equations plus one * // kase - Integer identification number for problem being * // considered * // nc - Integer value of number of condensed species being * // considered in the system * // newmol - Integer variable used in react, search and molewt. * // Reset and initialized in this routine * // nlm - Integer value of number of elements in the system * // nmin - Integer value of number of elements that are put * // into temporary storage for systm and plus problems * // nmix - Integer variable used as increment multiplier for mole * // fraction computations in plus and systm problems * // nomit - Integer value of number of species to be omitted * // np - Integer variable used as number of P values input * // npt - Integer variable used as index for data saved for output* // nrat - Integer variable used to determine if the reactants * // should be added or incremented in systm and plus * // problems * // nreac - Integer value containing number of reactant records * // ns - Integer variable of number of species being considered * // in the system * // nsert - Integer value of number of species listed on * // insert Records * // nt - Integer variable used as number of T values input * // plus - Logical variable used to indicate if reactants are to be* // added to the system or if a ternary system is being * // considered * // systm - Logical variable used to denote that a ternary * // system is being considered * // * // Constants: * // --------- * // * // None * // * // Prototypes: * // ----------- * // * // None * // * //***************************************************************************** //### extern int imat ; extern int iq1 ; extern int kase ; extern int nc ; extern int newmol ; extern int nlm ; extern int nmin ; extern int nmix ; extern int nomit ; extern int np ; extern int npt ; extern int nrat ; extern int nreac ; extern int ns ; extern int nsert ; extern int nt ; // logical variables extern int alter ; extern int plus ; extern int systm ; // End of indx.h //### //***************************************************************************** // * // Include Name: misc * // * // File Name: misc.h * // * // Purpose: Contains index constants and variables * // * // Author: Robert L. Reese * // * // Date: June 01, 1973 * // * // Language: Borland C++ Compiler, Version 4.5 * // * // Hardware: IBM Cosmpatible PC * // * // Operating System: Microsoft Windows 98 * // * // Update History: * // * // Name Date Revision Changes * // ---- ---- --------- ------- * // * // R.L. Reese 06/01/73 0 Initial Release * // R.L. Reese 11/23/03 A Converted to C++ * // R.L. Reese 04/13/06 B Added therm_file * // * //----------------------------------------------------------------------------* // * // Usage: * // * // #include "misc.h" * // * //----------------------------------------------------------------------------* // * // Definitions: * // * // Local Variables: * // ---------------- * // * // None * // * // Global Variables: * // ----------------- * // * // add - Real array containing increment of ith reactant mole * // fraction * // anum - Real value of stochiometric coefficients of elements * // in the reactant records * // base - Real value of first value of mole fraction of ith * // reactant * // bo - Real array used as assigned Kg-atoms of element i per* // Kg of total reactant * // enn - Real value of n, moles of miture, KG-moles/KG * // ennl - Real value of log of enn * // gamma - Real array of fugacity coeffiecients for gases * // idata - Character*4 array used to read code record names * // to determine what input data follows * // infile - Character*80 variable for input file name * // llmt - Character*4 array containing alphameric symbols for * // the elements in the system being studied * // message_offset - Integer value for offset of message number to use * // name - Character*4 containing alphameric symbols for the * // elements as given in the reactant records * // noconv - Integer value that accumulates number of times there * // is no solution to a T-P point * // outfile - Character*80 variable for output file name * // pp - Real value of assigned P for current point * // re_read - Character*80 buffer used to read previous record * // sumn - Real value of moles of mixture sumation * // thermfile - Character*80 variable for thermo file name * // tm - Real value of log P divided by n * // top - Real array containing final value of mole fraction of* // ith reactant * // tri - Real variable containing increment value of mole * // fraction for all reactants of ternary system * // tt - Real value of assigned T for current point * // vol - Real value of molar volume of species * // * // Constants: * // --------- * // * // arrays.h * // element_max - Integer value of maximum number of elements allowed * // len_file - Integer value of length of file names * // len_reread - Integer value of length of re-read buffer for * // read_error * // reacts_max - Integer value of maximum mole values per record * // size_char - Integer value used as len of char to replace default * // length of 4 characters in one word for FORTRAN 4 and * // FORTRAN 77 conversion * // species_max - Integer value of maximu number of species allowed * // * // Include Files: * // ------------- * // * // None * // * // Prototypes: * // ----------- * // * // None * // * //***************************************************************************** //### extern float enn ; extern float ennl ; extern float pp ; extern float sumn ; extern float tm ; extern float tri ; extern float tt ; extern float add[element_max] ; extern float anum[element_max][reacts_max] ; extern float base[element_max] ; extern float bo[element_max] ; extern float top[element_max] ; extern float vol[species_max] ; extern double gamma[species_max] ; extern int noconv ; extern char llmt[4][element_max] ; extern char name[4][element_max][reacts_max] ; extern char infile[len_file] ; extern char re_read[len_reread] ; extern char outfile[len_file] ; extern char thermfile[len_file] ; // end misc.h //### //***************************************************************************** // * // Include Name: points * // * // File Name: points.h * // * // Purpose: Contains constants and variables for temperature and pressure* // use * // * // Author: Robert L. Reese * // * // Date: November 23, 2003 * // * // Language: Borland C++ Compiler, Version 4.5 * // * // Hardware: IBM Cosmpatible PC * // * // Operating System: Microsoft Windows 98 * // * // Update History: * // * // Name Date Revision Changes * // ---- ---- --------- ------- * // * // R.L. Reese 06/01/73 0 Initial Release * // R.L. Reese 11/23/03 A Converted to C++ * // R.L. Reese 04/12/06 B Added new_thermo flag for * // choosing type of thermo data * // * //----------------------------------------------------------------------------* // * // Usage: * // * // #include "points.h" * // * //----------------------------------------------------------------------------* // * // Definitions: * // * // Local Variables: * // ---------------- * // * // None * // * // Global Variables: * // ----------------- * // * // fo2c - Real array of fugacity of O2C * // fo2h - Real array of fugacity of O2H * // free_energy - Real array of free energy * // gas_input - Logical value of gas input flag * // gtotn - Real array of total n for gases * // new - Logical used to test for new addition to run * // new_thermo - Logical value of new type of thermodynamic file * // oxfug - Real value of oxygen fugacity * // p - Real values of P in bars that have been input * // ppp - Real array of static P stored for output * // pressure_number - Integer number of input pressure values * // rsize - Real value used to determine size of mole fraction * // values for gas specie to be output * // t - Real values of T in Kelvin that have been input * // tem - Logical variable used to denote that for each * // assigned T there is an assigned P * // temp_number - Integer number of input temperature values * // totn - Real array of summation of n used in calculation * // of mole fraction * // ttt - Real array of T stored for output * // * // Constants: * // --------- * // * // arrays.h * // npt_out - Integer value of total points output on a page * // t_p_size - Integer value of total number of pressures and * // temperatures allowed * // * // Prototypes: * // ----------- * // * // None * // * //***************************************************************************** //### extern float p[t_p_size] ; extern float ppp[npt_out] ; extern float t[t_p_size] ; extern float totn[npt_out] ; extern float ttt[npt_out] ; extern float free_energy[npt_out] ; extern float fo2c[npt_out] ; extern float fo2h[npt_out] ; extern float gtotn[npt_out] ; extern float oxfug[npt_out] ; extern float rsize ; extern int gas_input ; extern int new_thermo ; extern int newest ; extern int pressure_number; extern int tem ; extern int temp_number; // end points.h //### //***************************************************************************** // * // Include Name: speces * // * // File Name: speces.h * // * // Purpose: Contains species variables * // * // Author: Robert L. Reese * // * // Date: June 06, 1973 * // * // Language: Borland C++ Compiler, Version 4.5 * // * // Hardware: IBM Cosmpatible PC * // * // Operating System: Microsoft Windows 98 * // * // Update History: * // * // Name Date Revision Changes * // ---- ---- --------- ------- * // * // R.L. Reese 06/01/73 0 Initial Release * // R.L. Reese 11/23/03 A Converted to C++ * // R.L. Reese 04/13/06 B Added integration values * // * //----------------------------------------------------------------------------* // * // Usage: * // * // #include "speces.h" * // * //----------------------------------------------------------------------------* // * // Definitions: * // * // Local Variables: * // ---------------- * // * // None * // * // Global Variables: * // ----------------- * // * // a - Real array of Stoichiometric coefficients of ith * // element in jth species * // coef - Real value in empirical equations for thermodynamic * // functions. coef(i,j,k): i = 1 for upper T interval * // and 2 for the lower one: j = 1,...7 for the 7 * // coefficients, aj: k = 1,....100 for the number of * // species * // en - Real array of nj, Kg-moles of jth species/ Kg of * // mixture * // enln - Real array of ln nj = ln(en) * // ensert - Character*4 array of ith specie of n species which * // are specified to be considered or input * // ho - Real array of hj, dimensionless enthalpy for * // species j * // iuse - Integer value used to identify status of ith specie * // juse - Integer value used to identify which phase of a * // condensed specie should be used or if the specie * // fits the T range * // omit - Character*4 array containing names of specie to be * // omitted from current system * // s - Real value of dimensionless entropy calculated from * // coefficients for the reaction species * // sub - Character*4 array containing names of species read * // from thermodynamic data. * // temp - Real array of T range of individual condensed * // specie * // speces.h * // * // Constants: * // --------- * // * // arrays.h * // b_values_number- Integer value of number of integration sets per * // species * // b_values_sets - Integer value of number of integration sets * // coeff_sets - Integer value of number of sets in coefficient values * // coeff_values - Integer value of number of coefficient values in a set* // element_max - Integer value of maximum number of elements allowed * // species_max - Integer value of maximu number of species allowed * // npt_out - Integer value of total points output on a page * // size_char - Integer value used as len of char to replace default * // length of 4 characters in one word for FORTRAN 4 and * // FORTRAN 77 conversion * // sub_size - Integer value of middle size of sub array * // temp_max - Integer value of column dimension of temp array * // total_char - Integer value of total characters in species name * // * // Prototypes: * // ----------- * // * // None * // * //***************************************************************************** //### extern float a[element_max][species_max] ; extern float temp[species_max][temp_max] ; extern double b_values[b_values_sets][b_values_number][species_max]; extern double coef[coeff_sets][coeff_values][species_max] ; extern double en[species_max][npt_out] ; extern double enln[species_max] ; extern double ho[species_max] ; extern double s[species_max] ; extern int iuse[species_max] ; extern int juse[species_max] ; extern char ensert[total_char][species_max] ; extern char omit[total_char][species_max] ; extern char sub[size_char][sub_size][species_max] ; // end speces.h