fix trivial bug in tau initialization
This commit is contained in:
13
cpu/Ion.cpp
13
cpu/Ion.cpp
@@ -3,7 +3,6 @@
|
||||
extern "C" void ScaLBL_D3Q7_AAodd_IonConcentration(int *neighborList, double *dist, double *Den, int start, int finish, int Np){
|
||||
int n,nread;
|
||||
double fq,Ci;
|
||||
printf("ScaLBL_D3Q7_AAodd_IonConcentration: entering the kernel successfully\n");
|
||||
for (n=start; n<finish; n++){
|
||||
|
||||
// q=0
|
||||
@@ -42,7 +41,6 @@ extern "C" void ScaLBL_D3Q7_AAodd_IonConcentration(int *neighborList, double *di
|
||||
|
||||
Den[n]=Ci;
|
||||
}
|
||||
printf("ScaLBL_D3Q7_AAodd_IonConcentration: exiting the loop successfully\n");
|
||||
}
|
||||
|
||||
extern "C" void ScaLBL_D3Q7_AAeven_IonConcentration(double *dist, double *Den, int start, int finish, int Np){
|
||||
@@ -95,24 +93,17 @@ extern "C" void ScaLBL_D3Q7_AAodd_Ion(int *neighborList, double *dist, double *D
|
||||
for (n=start; n<finish; n++){
|
||||
|
||||
//Load data
|
||||
printf("ScaLBL_D3Q7_AAodd_Ion: enetering the kernel successfully \n");
|
||||
Ci=Den[n];
|
||||
printf("ScaLBL_D3Q7_AAodd_Ion: load concentration successfully\n");
|
||||
Ex=ElectricField[n+0*Np];
|
||||
Ey=ElectricField[n+1*Np];
|
||||
Ez=ElectricField[n+2*Np];
|
||||
printf("ScaLBL_D3Q7_AAodd_Ion: load electric field successfully\n");
|
||||
ux=Velocity[n+0*Np];
|
||||
uy=Velocity[n+1*Np];
|
||||
uz=Velocity[n+2*Np];
|
||||
printf("ScaLBL_D3Q7_AAodd_Ion: load velocity field successfully\n");
|
||||
uEPx=zi*Di/Vt*Ex;
|
||||
uEPy=zi*Di/Vt*Ey;
|
||||
uEPz=zi*Di/Vt*Ez;
|
||||
|
||||
printf("ScaLBL_D3Q7_AAodd_Ion: load spatial data successfully\n");
|
||||
|
||||
|
||||
// q=0
|
||||
f0 = dist[n];
|
||||
// q=1
|
||||
@@ -134,8 +125,6 @@ extern "C" void ScaLBL_D3Q7_AAodd_Ion(int *neighborList, double *dist, double *D
|
||||
nr6 = neighborList[n+5*Np];
|
||||
f6 = dist[nr6];
|
||||
|
||||
printf("ScaLBL_D3Q7_AAodd_Ion: load D3Q7 dist data successfully\n");
|
||||
|
||||
// q=0
|
||||
dist[n] = f0*(1.0-rlx)+rlx*0.3333333333333333*Ci;
|
||||
|
||||
@@ -157,8 +146,6 @@ extern "C" void ScaLBL_D3Q7_AAodd_Ion(int *neighborList, double *dist, double *D
|
||||
// q = 6
|
||||
dist[nr5] = f6*(1.0-rlx) + rlx*0.1111111111111111*Ci*(1.0-4.5*(uz+uEPz));
|
||||
|
||||
|
||||
printf("ScaLBL_D3Q7_AAodd_Ion: data write successfully\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ void ScaLBL_IonModel::ReadParams(string filename,int num_iter,int num_iter_Stoke
|
||||
//First, convert ion diffusivity in physical unit to LB unit
|
||||
IonDiffusivity[i] = IonDiffusivity[i]*time_conv/(h*h*1.0e-12);//LB diffusivity has unit [lu^2/lt]
|
||||
//Second, re-calculate tau
|
||||
tau[i] = 0.5+k2_inv*IonDiffusivity[i];
|
||||
tau.push_back(0.5+k2_inv*IonDiffusivity[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -379,7 +379,6 @@ void ScaLBL_IonModel::Run(double *Velocity, double *ElectricField){
|
||||
// *************ODD TIMESTEP*************//
|
||||
timestep++;
|
||||
//Update ion concentration and charge density
|
||||
if (rank==0) printf("timestep=%i; updating ion concentration and charge density\n",timestep);
|
||||
for (int ic=0; ic<number_ion_species; ic++){
|
||||
ScaLBL_Comm->SendD3Q7AA(fq, ic); //READ FROM NORMAL
|
||||
ScaLBL_D3Q7_AAodd_IonConcentration(NeighborList, &fq[ic*Np*7],&Ci[ic*Np],ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
@@ -391,9 +390,7 @@ void ScaLBL_IonModel::Run(double *Velocity, double *ElectricField){
|
||||
}
|
||||
|
||||
//LB-Ion collison
|
||||
if (rank==0) printf("timestep=%i; execute collision step 1/2\n",timestep);
|
||||
for (int ic=0; ic<number_ion_species; ic++){
|
||||
if (rank==0) printf(" ic=%i; execute collsion step 1/2\n",ic);
|
||||
ScaLBL_D3Q7_AAodd_Ion(NeighborList, &fq[ic*Np*7],&Ci[ic*Np],Velocity,ElectricField,IonDiffusivity[ic],IonValence[ic],
|
||||
rlx[ic],Vt,ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
}
|
||||
@@ -401,9 +398,7 @@ void ScaLBL_IonModel::Run(double *Velocity, double *ElectricField){
|
||||
// Set boundary conditions
|
||||
/* ... */
|
||||
|
||||
if (rank==0) printf("timestep=%i; execute collision step 2/2\n",timestep);
|
||||
for (int ic=0; ic<number_ion_species; ic++){
|
||||
if (rank==0) printf(" ic=%i; execute collsion step 2/2\n",ic);
|
||||
ScaLBL_D3Q7_AAodd_Ion(NeighborList, &fq[ic*Np*7],&Ci[ic*Np],Velocity,ElectricField,IonDiffusivity[ic],IonValence[ic],
|
||||
rlx[ic],Vt,0, ScaLBL_Comm->LastExterior(), Np);
|
||||
}
|
||||
@@ -418,7 +413,6 @@ void ScaLBL_IonModel::Run(double *Velocity, double *ElectricField){
|
||||
// *************EVEN TIMESTEP*************//
|
||||
timestep++;
|
||||
//Update ion concentration and charge density
|
||||
if (rank==0) printf("timestep=%i; updating ion concentration and charge density\n",timestep);
|
||||
for (int ic=0; ic<number_ion_species; ic++){
|
||||
ScaLBL_Comm->SendD3Q7AA(fq, ic); //READ FORM NORMAL
|
||||
ScaLBL_D3Q7_AAeven_IonConcentration(&fq[ic*Np*7],&Ci[ic*Np],ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
@@ -429,7 +423,6 @@ void ScaLBL_IonModel::Run(double *Velocity, double *ElectricField){
|
||||
}
|
||||
|
||||
//LB-Ion collison
|
||||
if (rank==0) printf("timestep=%i; execute collision step 1/2\n",timestep);
|
||||
for (int ic=0; ic<number_ion_species; ic++){
|
||||
ScaLBL_D3Q7_AAeven_Ion(&fq[ic*Np*7],&Ci[ic*Np],Velocity,ElectricField,IonDiffusivity[ic],IonValence[ic],
|
||||
rlx[ic],Vt,ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
@@ -438,7 +431,6 @@ void ScaLBL_IonModel::Run(double *Velocity, double *ElectricField){
|
||||
// Set boundary conditions
|
||||
/* ... */
|
||||
|
||||
if (rank==0) printf("timestep=%i; execute collision step 2/2\n",timestep);
|
||||
for (int ic=0; ic<number_ion_species; ic++){
|
||||
ScaLBL_D3Q7_AAeven_Ion(&fq[ic*Np*7],&Ci[ic*Np],Velocity,ElectricField,IonDiffusivity[ic],IonValence[ic],
|
||||
rlx[ic],Vt,0, ScaLBL_Comm->LastExterior(), Np);
|
||||
|
||||
Reference in New Issue
Block a user