|
|
@@ -880,7 +880,8 @@ int residue(double t, N_Vector y, N_Vector ydot, N_Vector res, void *user_data){ |
|
|
|
/*Following using the Antoine Parameters to calculate the pressure of volatile component(n-heptane)*/ |
|
|
|
//Antoine parameter from NIST website |
|
|
|
double p_i=0.0 ; |
|
|
|
p_i = 1.0e5*pow(10,4.02832-(1268.636/(T(1)-56.199))) ; |
|
|
|
p_i = 1.0e5*pow(10,4.02832-(1268.636/(T(1)-56.199))) ; //FOR N-HEPTANE |
|
|
|
//p_i = 1.0e3*pow(2.71828,16.7-(4060.0/(T(1)-37.0))); //FOR WATER |
|
|
|
Yres(1,k_drop)=Y(1,k_drop) - p_i * data->gas->molecularWeight(k_drop-1) |
|
|
|
/ P(1) / data->gas->meanMolecularWeight(); |
|
|
|
|
|
|
@@ -1512,7 +1513,8 @@ void printTimescaleOutput(double t,N_Vector* y,FILE* output,UserData data) |
|
|
|
|
|
|
|
for(size_t i=1 ; i<= data->npts; i++){ |
|
|
|
fprintf(output, "%15.9e\t%15.9e\t",t,R(i)); |
|
|
|
|
|
|
|
fprintf(output, "%15.9e\t",T(i)); |
|
|
|
|
|
|
|
for(size_t k=1; k<=data->nsp;k++){ |
|
|
|
fprintf(output, "%15.9e\t",data->time_scale(i,k)); |
|
|
|
} |
|
|
@@ -1520,5 +1522,34 @@ void printTimescaleOutput(double t,N_Vector* y,FILE* output,UserData data) |
|
|
|
} |
|
|
|
fprintf(output, "\n"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void floorSmallValue(UserData data, N_Vector* y) |
|
|
|
{ |
|
|
|
double* ydata; |
|
|
|
ydata = N_VGetArrayPointer_OpenMP(*y); |
|
|
|
//double sum = 0.00; |
|
|
|
size_t k_bath = data->k_bath; |
|
|
|
|
|
|
|
/*Floor small values to zero*/ |
|
|
|
for (size_t i = 1; i <=data->npts; i++) { |
|
|
|
for (size_t k = 1; k <=data->nsp; k++) { |
|
|
|
if(fabs(Y(i,k))<=data->massFractionTolerance){ |
|
|
|
Y(i,k)=0.0e0; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/*Dump the error to the bath gas*/ |
|
|
|
for (size_t i = 1; i <=data->npts; i++) { |
|
|
|
double sum = 0.00; |
|
|
|
for (size_t k = 1; k <=data->nsp; k++) { |
|
|
|
if(k!=k_bath){ |
|
|
|
sum = sum + Y(i,k); |
|
|
|
} |
|
|
|
} |
|
|
|
Y(i,k_bath) = ONE-sum; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |