Page:4SIGHT manual- a computer program for modelling degradation of underground low level waste concrete vaults (IA 4sightmanualcomp5612snyd).pdf/129

54. ION TRANSPORT '''54. Ion transport.'''

⟨Function declarations 23⟩ $$+\equiv$$ void ion-diffusion (void);

55. ion-diffusion.

void ion-diffusion {   int i, j, k   real cation_flux [10][NUM_SURFACES], anion.flux [10][NUM_SURFACES], upper_limit=$$5.0\cdot10^{+04}$$, lower_limit = 5.0\codt10^{+03}, max_flux_ratio; real tmp.cation [10][NUM_SURFACES], tmp.anion [10][NUM_SURFACES]; $$\Delta X$$[FIRST_CELL] = (real) (FIRST.CELL+1) - sulfate-depth; max_flux.ratio = 0.0; for(i = 0; i < num-cations ; i++) { for(k=FIRST.CELL + 1; k < NUM.SURFACES - 1; k++) { cation_flux [i].c[k] = cation[i].$$\eta$$ * (\xi[k] * cation [i].c[k + 1]- cation[i].c[k])/\$$Delta X$$[k]-$$\eta$$[k-1]* (cation[i].c[k]-cation[i].c[k-1])/$$\Delta X$$[k-1])/(0.5 * ($$\Delta X$$[k] + $$\Delta X$$[k-1]));      cation_flux[i][k]-=(1./$$\phi'^n$$[k])*v[k]*((cation[i].c[k+1]-cation[i].c[k-1])/($$\Delta X$$[k]+($$\Delta X$$[k-1])); if(cation[i].c[k]>0.0) max_flux_ratio=MAX(max_flux_ration,$$\Delta T$$*cation_flux[i][k]/cation[i].c[k]); } }  for( j=0; j < num_anions; j++) { for (k = FIRST_CELL_1; k < NUM_SURFACES-1; k++) { anion_flux[j][k]=anion[j].$$\eta$$*($$\xi$$[k] *(anion[j].c[k+1]- anion[j].c[k])/$$\Delta X$$[k]-$$\eta$$[k-1]*(anion[j].c[k]-anion[j].c[k-1]/$$\Delta X$$[k-1])/(0.5*($$\Delta X$$[k]+$$\Delta X$$[k-1]));     anion_flux[j][k]-=(1.$$\phi'^n$$v[k] *((anion[j].c[k+1]-anion[j].c[k-1])/(\Delta X)[k]+$$\Delta X$$[k-1]))); if (anion[j].c[k]>0.0) max_flux_ratio = MAX (max_flux_ratio, $$\Delta T$$ * anion_flux[j][k]/anion[j].c[k]); } }  if(max_flux_ration > upper_limt) $$\Delta T$$*= upper_limit/max_flux_ratio; if(max_flux_ration < lower_limt) $$\Delta T$$*= upperlower [sic]_limit/max_flux_ratio; for(k= FIRST_CELL+1; k<NUM_SURFACES-1;k++) { for(i=0; i< num_cations; i++) cation[i].c[k]+=$$\delta T$$*cation_flux[i][k]; for(j=0; j< num_cations; j++) cation[j].c[k]+=$$\delta T$$*cation_flux[j][k]; } k=NUM_SURFACES-1; for(i=0;i<num_cations;i++) cation[i].c[k]=cation[i].c[k-1] for(j=0;j<num_cations;j++) cation[j].c[k]=cation[j].c[k-1] for(i=0;i< num_cations; i++) for(k=FIRST_CELL; k < NUM_SURFACES; k++) cation[i].moles[k]=cation[i].c[k] * litre[k]*$$\Delta X$$[k]; for(j=0;i< num_anions; j++) for(k=FIRST_CELL; k < NUM_SURFACES; k++) anion[i].moles[k]=anion[i].c[k] * litre[k]*$$\Delta X$$[k]; }