45 from fireworks.utilities.fw_utilities
import explicit_serialize
46 import gasConductivity
49 weightedAverageCode=
r''' 54 void gasMixtureConductivity 56 const modena_model_t* model, 61 {% block variables %}{% endblock %} 63 double kgasmix=0; // gas mixture conductivity 66 for (i=0;i<x_size;i++) { 69 for (i=0;i<x_size;i++) { 70 kgasmix = kgasmix + gas_thermal_conductivity[i]*x[i]/sumx; 83 void gasMixtureConductivity 85 const modena_model_t* model, 90 {% block variables %}{% endblock %} 92 double kgasmix=0; // gas mixture conductivity 93 double Rg=8.314; // gas constant 95 double xi[4]; // normalized molar fractions 96 double k[4]; // thermal conductivities 97 double Tc[4]={304.17,511.7,154.58,126.19}; // critical temperatures 98 double pc[4]={7.386e6,45.1e5,5.043e6,3.396e6}; // critical pressures 99 double M[4]={44e-3,70e-3,32e-3,28e-3}; // molar masses 103 for (i=0;i<x_size;i++) { 105 k[i]=gas_thermal_conductivity[i]; 107 for (i=0;i<x_size;i++) { 108 xi[i] = x[i]/y; // normalize molar fractions 109 gam[i]=210*pow(Tc[i]*pow(M[i],3)/pow(pc[i],4),1.0/6.0); 111 for (i=0;i<x_size;i++) { 112 for (j=0;j<x_size;j++) { 113 y=gam[j]*(exp(0.0464*T/Tc[i])-exp(-0.2412*T/Tc[i]))/\ 114 gam[i]/(exp(0.0464*T/Tc[j])-exp(-0.2412*T/Tc[j])); 115 A[i][j]=pow(1+pow(y,0.5)*pow(M[i]/M[j],0.25),2)/\ 116 pow(8*(1+M[i]/M[j]),0.5); 119 for (i=0;i<x_size;i++) { 121 for (j=0;j<x_size;j++) { 124 kgasmix = kgasmix + xi[i]*k[i]/y; 126 outputs[0] = kgasmix; 132 lindsayBromleyCode=
r''' 137 void gasMixtureConductivity 139 const modena_model_t* model, 140 const double* inputs, 144 {% block variables %}{% endblock %} 146 double kgasmix=0; // gas mixture conductivity 147 double Rg=8.314; // gas constant 149 double xi[4]; // normalized molar fractions 150 double k[4]; // thermal conductivities 151 double Tb[4]={194.75,322.4,90.19,77.36}; // boiling point temperatures 152 double cp[4]; // thermal capacities at constant pressure 153 double M[4]={44e-3,70e-3,32e-3,28e-3}; // molar masses 154 double S[4]; // Sutherland constants 155 double gam[4]; // heat capacity ratio 156 double cv[4]; // thermal capacities at constant volume 160 cp[0]=24.99735+55.18696*t-33.69137*t*t+7.948387*t*t*t-0.136638/t/t; // CO2 161 cp[1]=-25.6132057+226.4176882*t+574.2688767*t*t-670.5517907*t*t*t+\ 162 0.6765321/t/t; // CyP 163 cp[2]=31.32234-20.23531*t+57.86644*t*t-36.50624*t*t*t-0.007374/t/t; // O2 164 cp[3]=28.98641+1.853978*t-9.647459*t*t+16.63537*t*t*t+0.000117/t/t; // N2 165 for (i=0;i<x_size;i++) { 167 k[i]=gas_thermal_conductivity[i]; 169 for (i=0;i<x_size;i++) { 170 // normalize molar fractions 174 gam[i] = cp[i]/cv[i]; 176 for (i=0;i<x_size;i++) { 177 for (j=0;j<x_size;j++) { 178 y=k[i]/k[j]*cp[j]/cp[i]*(9-5/gam[j])/(9-5/gam[i]); 179 A[i][j]=0.25*pow(1+pow(y*pow(M[j]/M[i],0.75)*(T+S[i])/\ 180 (T+S[j]),0.5),2)*(T+sqrt(S[i]*S[j]))/(T+S[j]); 183 for (i=0;i<x_size;i++) { 185 for (j=0;j<x_size;j++) { 188 kgasmix = kgasmix + xi[i]*k[i]/y; 190 outputs[0] = kgasmix; 197 f_gasMixtureConductivity = CFunction(
201 'T': {
'min': 273,
'max': 550},
202 'x': {
'index': gasConductivity.species,
'min': 0,
'max': 1},
203 'gas_thermal_conductivity': {
'index': gasConductivity.species,
207 'gasMixtureConductivity': {
'min': 0,
'max': +9e99,
'argPos': 0},
210 'param0': {
'min': -9e99,
'max': +9e99,
'argPos': 0},
211 'param1': {
'min': -9e99,
'max': +9e99,
'argPos': 1},
212 'param2': {
'min': -9e99,
'max': +9e99,
'argPos': 2},
219 m_gasMixtureConductivity = ForwardMappingModel(
220 _id=
'gasMixtureConductivity',
221 surrogateFunction=f_gasMixtureConductivity,
222 substituteModels=[gasConductivity.m_CO2_thermal_conductivity,\
223 gasConductivity.m_CyP_thermal_conductivity,\
224 gasConductivity.m_O2_thermal_conductivity,\
225 gasConductivity.m_N2_thermal_conductivity],
226 parameters=[1, 1, 1],