Преглед изворни кода

revise the isothermPosition function in residue.cpp

binary_fuel
Weiye Wang пре 1 година
родитељ
комит
d28fc466b5
9 измењених фајлова са 80 додато и 12 уклоњено
  1. BIN
      DropletCombustion8
  2. BIN
      DropletCombustion9
  3. +1
    -1
      Makefile
  4. +8
    -5
      main.cpp
  5. BIN
      main.o
  6. +2
    -0
      readme.md
  7. +68
    -6
      residue.cpp
  8. +1
    -0
      residue.h
  9. BIN
      residue.o

BIN
DropletCombustion8 Прегледај датотеку


BIN
DropletCombustion9 Прегледај датотеку


+ 1
- 1
Makefile Прегледај датотеку

@@ -7,7 +7,7 @@
compiler =g++
CANTERA_DIR =/opt/scientific/cantera-2.4_gnu_blas
IDA_DIR =/opt/scientific/sundials-3.1.1_intel_mkl
EXE =DropletCombustion5
EXE =DropletCombustion9
#DESTDIR =~/bin
DESTDIR = ../example



+ 8
- 5
main.cpp Прегледај датотеку

@@ -206,7 +206,10 @@ int main(){
t1=tNow;
/*Floor small value to zero*/
floorSmallValue(data, &y);
floorSmallValue(data, &y);
/*reset the tolerance after ignition*/
resetTolerance(data,&y,&atolv);

if(data->quasiSteady){
ier = IDASolve(mem, finalTime, &tNow, y, ydot, IDA_ONE_STEP);
@@ -227,14 +230,14 @@ int main(){
ier = IDAGetCurrentOrder(mem, &kcur);

if(data->adaptiveGrid==1 && data->moveGrid==1){
x=maxCurvPosition(ydata, data->nt, data->nvar,
data->grid->x, data->npts);
//x=maxCurvPosition(ydata, data->nt, data->nvar,
// data->grid->x, data->npts);

//x=isothermPosition(ydata, data->isotherm, data->nt,
// data->nvar, data->grid->x, data->npts);

//x=maxGradPosition(ydata, data->nt, data->nvar,
// data->grid->x, data->npts);
x=maxGradPosition(ydata, data->nt, data->nvar,
data->grid->x, data->npts);
dx=x-xOld;

if(dx*dxMin>0.0e0){



+ 2
- 0
readme.md Прегледај датотеку

@@ -1,3 +1,5 @@
Dropletcombustion5 is the version which floor the small mass fraction(smaller than massfractionTolerance) to 0.00 ;
Dropletcombustion6 is the version where the Antoine parameters are those of water ;
Version 7 change the hardcode some tolerance after ignition:Max T> 1800K
version 8: the x in the main.cpp is changed to the maxGradPosition
version 9: isothermPosition function in residue.cpp is revised for droplet combustion

+ 68
- 6
residue.cpp Прегледај датотеку

@@ -95,13 +95,28 @@ int maxCurvIndex(const double* y, const size_t nt,
return(pos);
}

//double isothermPosition(const double* y, const double T, const size_t nt,
// const size_t nvar, const double* x, const size_t nPts){
// double pos=x[nPts-1];
// size_t j;
// for (size_t i = 1; i <nPts; i++) {
// j=i*nvar+nt;
// if (y[j]<=T) {
// pos=x[i];
// break;
// }
// }
// return(pos);
//}

//******************* scan the temperature from left to right ******************//
double isothermPosition(const double* y, const double T, const size_t nt,
const size_t nvar, const double* x, const size_t nPts){
double pos=x[nPts-1];
double pos=x[0];
size_t j;
for (size_t i = 1; i <nPts; i++) {
for (size_t i = 0; i <nPts; i++) {
j=i*nvar+nt;
if (y[j]<=T) {
if (y[j]>=T) {
pos=x[i];
break;
}
@@ -833,7 +848,7 @@ int residue(double t, N_Vector y, N_Vector ydot, N_Vector res, void *user_data){
//dHvl= 5.2053e07*pow(1-Tr,0.3199 - 0.212*Tr + 0.25795*Tr*Tr)/18.01; //J/kg latent heat of vaporization of water
double Tr = T(1)/540.2; //Reduced Temperature:Droplet Temperature divided by critical temperature of liquid n-heptane, Source:NIST
dHvl = 5.366e5*exp(-0.2831*Tr) * pow((1-Tr),0.2831); //Unit:J/kg, latent heat of vaporization of liquid n-heptane, Source: NIST
dHvl = 5.366e5*exp(-0.2831*Tr) * pow((1-Tr),0.2831); //Unit:J/kg, latent heat of vaporization of liquid n-heptane, Source: NIST
/*Following section is related to the property of water*/
//rhol = 997.0;
@@ -880,8 +895,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))) ; //FOR N-HEPTANE
//p_i = 1.0e3*pow(2.71828,16.7-(4060.0/(T(1)-37.0))); //FOR WATER
p_i = 1.0e5*pow(10,4.02832-(1268.636/(T(1)-56.199))) ; //unit:Pa,FOR N-HEPTANE
//p_i = 1.0e3*pow(2.71828,16.7-(4060.0/(T(1)-37.0))); //Unit:Pa,FOR WATER
Yres(1,k_drop)=Y(1,k_drop) - p_i * data->gas->molecularWeight(k_drop-1)
/ P(1) / data->gas->meanMolecularWeight();
@@ -1553,3 +1568,50 @@ void floorSmallValue(UserData data, N_Vector* y)

}

void resetTolerance(UserData data, N_Vector* y,N_Vector* atolv)
{
double* ydata;
realtype* atolvdata;
ydata = N_VGetArrayPointer_OpenMP(*y);
atolvdata = N_VGetArrayPointer_OpenMP(*atolv);
double relTol,radTol,tempTol,presTol,massFracTol,bathGasTol,mdotTol;
double maxT=0.00, ignT=1800;
relTol = 1.0e-03 ;
radTol = 1.0e-05 ;
tempTol = 1.0e-01 ;
presTol = 1.0e00 ;
massFracTol = 1.0e-08;
bathGasTol = 1.0e-04 ;
mdotTol = 1.0e-09 ;


/*Get the maximum Tempture*/
for (size_t i =1;i <= data->npts;i++){
if(T(i) > maxT){
maxT = T(i);
}
}

/*reset the tolerance when maxT > ignT*/
if(maxT >= ignT){
data->relativeTolerance = relTol;

for(size_t i =1; i<=data->npts; i++){
atolT(i) = tempTol;
atolR(i) = radTol ;
atolP(i) = presTol ;
atolMdot(i) = mdotTol ;
for(size_t k =1; k<= data->nsp; k++){
if(k!=data->k_bath){
atolY(i,k) = massFracTol;
}else{
atolY(i,k) = bathGasTol;
}
}
}
}

}


+ 1
- 0
residue.h Прегледај датотеку

@@ -93,3 +93,4 @@ void getTimescale(UserData data, N_Vector* y);
void printTimescaleHeader(UserData data);
void printTimescaleOutput(double t,N_Vector* y,FILE* output,UserData data);
void floorSmallValue(UserData data, N_Vector* y);
void resetTolerance(UserData data, N_Vector* y,N_Vector* atolv);


Loading…
Откажи
Сачувај