add barrier to membrane transport
This commit is contained in:
@@ -1285,30 +1285,30 @@ void Membrane::SendD3Q7AA(double *dist){
|
|||||||
// Pack the distributions
|
// Pack the distributions
|
||||||
//...Packing for x face(q=2)................................
|
//...Packing for x face(q=2)................................
|
||||||
ScaLBL_D3Q19_Pack(2,dvcSendList_x,0,sendCount_x,sendbuf_x,dist,Np);
|
ScaLBL_D3Q19_Pack(2,dvcSendList_x,0,sendCount_x,sendbuf_x,dist,Np);
|
||||||
req1[0] = MPI_COMM_SCALBL.Isend(sendbuf_x, sendCount_x,rank_x,sendtag);
|
|
||||||
req2[0] = MPI_COMM_SCALBL.Irecv(recvbuf_X, recvCount_X,rank_X,recvtag);
|
req2[0] = MPI_COMM_SCALBL.Irecv(recvbuf_X, recvCount_X,rank_X,recvtag);
|
||||||
|
req1[0] = MPI_COMM_SCALBL.Isend(sendbuf_x, sendCount_x,rank_x,sendtag);
|
||||||
//...Packing for X face(q=1)................................
|
//...Packing for X face(q=1)................................
|
||||||
ScaLBL_D3Q19_Pack(1,dvcSendList_X,0,sendCount_X,sendbuf_X,dist,Np);
|
ScaLBL_D3Q19_Pack(1,dvcSendList_X,0,sendCount_X,sendbuf_X,dist,Np);
|
||||||
req1[1] = MPI_COMM_SCALBL.Isend(sendbuf_X, sendCount_X,rank_X,sendtag);
|
|
||||||
req2[1] = MPI_COMM_SCALBL.Irecv(recvbuf_x, recvCount_x,rank_x,recvtag);
|
req2[1] = MPI_COMM_SCALBL.Irecv(recvbuf_x, recvCount_x,rank_x,recvtag);
|
||||||
|
req1[1] = MPI_COMM_SCALBL.Isend(sendbuf_X, sendCount_X,rank_X,sendtag);
|
||||||
//for (int idx=0; idx<sendCount_X; idx++) printf(" SendX(%i)=%e \n",idx,sendbuf_X[idx]);
|
//for (int idx=0; idx<sendCount_X; idx++) printf(" SendX(%i)=%e \n",idx,sendbuf_X[idx]);
|
||||||
//...Packing for y face(q=4).................................
|
//...Packing for y face(q=4).................................
|
||||||
ScaLBL_D3Q19_Pack(4,dvcSendList_y,0,sendCount_y,sendbuf_y,dist,Np);
|
ScaLBL_D3Q19_Pack(4,dvcSendList_y,0,sendCount_y,sendbuf_y,dist,Np);
|
||||||
req1[2] = MPI_COMM_SCALBL.Isend(sendbuf_y, sendCount_y,rank_y,sendtag);
|
|
||||||
req2[2] = MPI_COMM_SCALBL.Irecv(recvbuf_Y, recvCount_Y,rank_Y,recvtag);
|
req2[2] = MPI_COMM_SCALBL.Irecv(recvbuf_Y, recvCount_Y,rank_Y,recvtag);
|
||||||
|
req1[2] = MPI_COMM_SCALBL.Isend(sendbuf_y, sendCount_y,rank_y,sendtag);
|
||||||
//...Packing for Y face(q=3).................................
|
//...Packing for Y face(q=3).................................
|
||||||
ScaLBL_D3Q19_Pack(3,dvcSendList_Y,0,sendCount_Y,sendbuf_Y,dist,Np);
|
ScaLBL_D3Q19_Pack(3,dvcSendList_Y,0,sendCount_Y,sendbuf_Y,dist,Np);
|
||||||
req1[3] = MPI_COMM_SCALBL.Isend(sendbuf_Y, sendCount_Y,rank_Y,sendtag);
|
|
||||||
req2[3] = MPI_COMM_SCALBL.Irecv(recvbuf_y, recvCount_y,rank_y,recvtag);
|
req2[3] = MPI_COMM_SCALBL.Irecv(recvbuf_y, recvCount_y,rank_y,recvtag);
|
||||||
|
req1[3] = MPI_COMM_SCALBL.Isend(sendbuf_Y, sendCount_Y,rank_Y,sendtag);
|
||||||
//for (int idx=0; idx<sendCount_Y; idx++) printf(" SendY(%i)=%e \n",idx,sendbuf_Y[idx]);
|
//for (int idx=0; idx<sendCount_Y; idx++) printf(" SendY(%i)=%e \n",idx,sendbuf_Y[idx]);
|
||||||
//...Packing for z face(q=6)................................
|
//...Packing for z face(q=6)................................
|
||||||
ScaLBL_D3Q19_Pack(6,dvcSendList_z,0,sendCount_z,sendbuf_z,dist,Np);
|
ScaLBL_D3Q19_Pack(6,dvcSendList_z,0,sendCount_z,sendbuf_z,dist,Np);
|
||||||
req1[4] = MPI_COMM_SCALBL.Isend(sendbuf_z, sendCount_z,rank_z,sendtag);
|
|
||||||
req2[4] = MPI_COMM_SCALBL.Irecv(recvbuf_Z, recvCount_Z,rank_Z,recvtag);
|
req2[4] = MPI_COMM_SCALBL.Irecv(recvbuf_Z, recvCount_Z,rank_Z,recvtag);
|
||||||
|
req1[4] = MPI_COMM_SCALBL.Isend(sendbuf_z, sendCount_z,rank_z,sendtag);
|
||||||
//...Packing for Z face(q=5)................................
|
//...Packing for Z face(q=5)................................
|
||||||
ScaLBL_D3Q19_Pack(5,dvcSendList_Z,0,sendCount_Z,sendbuf_Z,dist,Np);
|
ScaLBL_D3Q19_Pack(5,dvcSendList_Z,0,sendCount_Z,sendbuf_Z,dist,Np);
|
||||||
req1[5] = MPI_COMM_SCALBL.Isend(sendbuf_Z, sendCount_Z,rank_Z,sendtag);
|
|
||||||
req2[5] = MPI_COMM_SCALBL.Irecv(recvbuf_z, recvCount_z,rank_z,recvtag);
|
req2[5] = MPI_COMM_SCALBL.Irecv(recvbuf_z, recvCount_z,rank_z,recvtag);
|
||||||
|
req1[5] = MPI_COMM_SCALBL.Isend(sendbuf_Z, sendCount_Z,rank_Z,sendtag);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1341,6 +1341,7 @@ void Membrane::RecvD3Q7AA(double *dist){
|
|||||||
ScaLBL_D3Q7_Membrane_Unpack(5,dvcRecvDist_Z, dvcRecvLinks_Z,0,linkCount_Z[0],recvCount_Z,recvbuf_Z,dist,Np,coefficient_Z);
|
ScaLBL_D3Q7_Membrane_Unpack(5,dvcRecvDist_Z, dvcRecvLinks_Z,0,linkCount_Z[0],recvCount_Z,recvbuf_Z,dist,Np,coefficient_Z);
|
||||||
//..................................................................................
|
//..................................................................................
|
||||||
|
|
||||||
|
MPI_COMM_SCALBL.barrier();
|
||||||
//...................................................................................
|
//...................................................................................
|
||||||
Lock=false; // unlock the communicator after communications complete
|
Lock=false; // unlock the communicator after communications complete
|
||||||
//...................................................................................
|
//...................................................................................
|
||||||
|
|||||||
@@ -1447,100 +1447,100 @@ void ScaLBL_IonModel::Run(double *Velocity, double *ElectricField) {
|
|||||||
|
|
||||||
void ScaLBL_IonModel::RunMembrane(double *Velocity, double *ElectricField, double *Psi) {
|
void ScaLBL_IonModel::RunMembrane(double *Velocity, double *ElectricField, double *Psi) {
|
||||||
|
|
||||||
//Input parameter:
|
//Input parameter:
|
||||||
//1. Velocity is from StokesModel
|
//1. Velocity is from StokesModel
|
||||||
//2. ElectricField is from Poisson model
|
//2. ElectricField is from Poisson model
|
||||||
|
|
||||||
//LB-related parameter
|
//LB-related parameter
|
||||||
vector<double> rlx;
|
vector<double> rlx;
|
||||||
for (size_t ic = 0; ic < tau.size(); ic++) {
|
for (size_t ic = 0; ic < tau.size(); ic++) {
|
||||||
rlx.push_back(1.0 / tau[ic]);
|
rlx.push_back(1.0 / tau[ic]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//.......create and start timer............
|
//.......create and start timer............
|
||||||
//double starttime,stoptime,cputime;
|
//double starttime,stoptime,cputime;
|
||||||
//ScaLBL_Comm->Barrier(); comm.barrier();
|
//ScaLBL_Comm->Barrier(); comm.barrier();
|
||||||
//auto t1 = std::chrono::system_clock::now();
|
//auto t1 = std::chrono::system_clock::now();
|
||||||
|
|
||||||
for (size_t ic = 0; ic < number_ion_species; ic++) {
|
for (size_t ic = 0; ic < number_ion_species; ic++) {
|
||||||
|
|
||||||
/* set the mass transfer coefficients for the membrane */
|
/* set the mass transfer coefficients for the membrane */
|
||||||
IonMembrane->AssignCoefficients(dvcMap, Psi, ThresholdVoltage[ic],MassFractionIn[ic],
|
IonMembrane->AssignCoefficients(dvcMap, Psi, ThresholdVoltage[ic],MassFractionIn[ic],
|
||||||
MassFractionOut[ic],ThresholdMassFractionIn[ic],ThresholdMassFractionOut[ic]);
|
MassFractionOut[ic],ThresholdMassFractionIn[ic],ThresholdMassFractionOut[ic]);
|
||||||
|
|
||||||
timestep = 0;
|
timestep = 0;
|
||||||
while (timestep < timestepMax[ic]) {
|
while (timestep < timestepMax[ic]) {
|
||||||
//************************************************************************/
|
//************************************************************************/
|
||||||
// *************ODD TIMESTEP*************//
|
// *************ODD TIMESTEP*************//
|
||||||
timestep++;
|
timestep++;
|
||||||
|
|
||||||
//LB-Ion collison
|
//LB-Ion collison
|
||||||
IonMembrane->SendD3Q7AA(&fq[ic * Np * 7]); //READ FORM NORMAL
|
IonMembrane->SendD3Q7AA(&fq[ic * Np * 7]); //READ FORM NORMAL
|
||||||
|
|
||||||
ScaLBL_D3Q7_AAodd_Ion(
|
ScaLBL_D3Q7_AAodd_Ion(
|
||||||
IonMembrane->NeighborList, &fq[ic * Np * 7], &Ci[ic * Np],
|
IonMembrane->NeighborList, &fq[ic * Np * 7], &Ci[ic * Np],
|
||||||
&FluxDiffusive[3 * ic * Np], &FluxAdvective[3 * ic * Np],
|
&FluxDiffusive[3 * ic * Np], &FluxAdvective[3 * ic * Np],
|
||||||
&FluxElectrical[3 * ic * Np], Velocity, ElectricField,
|
&FluxElectrical[3 * ic * Np], Velocity, ElectricField,
|
||||||
IonDiffusivity[ic], IonValence[ic], rlx[ic], Vt,
|
IonDiffusivity[ic], IonValence[ic], rlx[ic], Vt,
|
||||||
ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||||
|
|
||||||
IonMembrane->RecvD3Q7AA(&fq[ic * Np * 7]); //WRITE INTO OPPOSITE
|
|
||||||
|
|
||||||
ScaLBL_D3Q7_AAodd_Ion(
|
IonMembrane->RecvD3Q7AA(&fq[ic * Np * 7]); //WRITE INTO OPPOSITE
|
||||||
IonMembrane->NeighborList, &fq[ic * Np * 7], &Ci[ic * Np],
|
|
||||||
&FluxDiffusive[3 * ic * Np], &FluxAdvective[3 * ic * Np],
|
ScaLBL_D3Q7_AAodd_Ion(
|
||||||
&FluxElectrical[3 * ic * Np], Velocity, ElectricField,
|
IonMembrane->NeighborList, &fq[ic * Np * 7], &Ci[ic * Np],
|
||||||
IonDiffusivity[ic], IonValence[ic], rlx[ic], Vt, 0,
|
&FluxDiffusive[3 * ic * Np], &FluxAdvective[3 * ic * Np],
|
||||||
ScaLBL_Comm->LastExterior(), Np);
|
&FluxElectrical[3 * ic * Np], Velocity, ElectricField,
|
||||||
|
IonDiffusivity[ic], IonValence[ic], rlx[ic], Vt, 0,
|
||||||
|
ScaLBL_Comm->LastExterior(), Np);
|
||||||
|
|
||||||
|
|
||||||
IonMembrane->IonTransport(&fq[ic * Np * 7],&Ci[ic * Np]);
|
IonMembrane->IonTransport(&fq[ic * Np * 7],&Ci[ic * Np]);
|
||||||
|
|
||||||
|
|
||||||
/* if (BoundaryConditionSolid == 1) {
|
/* if (BoundaryConditionSolid == 1) {
|
||||||
//TODO IonSolid may also be species-dependent
|
//TODO IonSolid may also be species-dependent
|
||||||
ScaLBL_Comm->SolidDirichletD3Q7(&fq[ic * Np * 7], IonSolid);
|
ScaLBL_Comm->SolidDirichletD3Q7(&fq[ic * Np * 7], IonSolid);
|
||||||
}
|
}
|
||||||
ScaLBL_Comm->Barrier();
|
ScaLBL_Comm->Barrier();
|
||||||
comm.barrier();
|
comm.barrier();
|
||||||
*/
|
*/
|
||||||
// *************EVEN TIMESTEP*************//
|
// *************EVEN TIMESTEP*************//
|
||||||
timestep++;
|
timestep++;
|
||||||
|
|
||||||
//LB-Ion collison
|
//LB-Ion collison
|
||||||
IonMembrane->SendD3Q7AA(&fq[ic * Np * 7]); //READ FORM NORMAL
|
IonMembrane->SendD3Q7AA(&fq[ic * Np * 7]); //READ FORM NORMAL
|
||||||
|
|
||||||
ScaLBL_D3Q7_AAeven_Ion(
|
ScaLBL_D3Q7_AAeven_Ion(
|
||||||
&fq[ic * Np * 7], &Ci[ic * Np], &FluxDiffusive[3 * ic * Np],
|
&fq[ic * Np * 7], &Ci[ic * Np], &FluxDiffusive[3 * ic * Np],
|
||||||
&FluxAdvective[3 * ic * Np], &FluxElectrical[3 * ic * Np],
|
&FluxAdvective[3 * ic * Np], &FluxElectrical[3 * ic * Np],
|
||||||
Velocity, ElectricField, IonDiffusivity[ic], IonValence[ic],
|
Velocity, ElectricField, IonDiffusivity[ic], IonValence[ic],
|
||||||
rlx[ic], Vt, ScaLBL_Comm->FirstInterior(),
|
rlx[ic], Vt, ScaLBL_Comm->FirstInterior(),
|
||||||
ScaLBL_Comm->LastInterior(), Np);
|
ScaLBL_Comm->LastInterior(), Np);
|
||||||
|
|
||||||
|
|
||||||
IonMembrane->RecvD3Q7AA(&fq[ic * Np * 7]); //WRITE INTO OPPOSITE
|
IonMembrane->RecvD3Q7AA(&fq[ic * Np * 7]); //WRITE INTO OPPOSITE
|
||||||
|
|
||||||
ScaLBL_D3Q7_AAeven_Ion(
|
ScaLBL_D3Q7_AAeven_Ion(
|
||||||
&fq[ic * Np * 7], &Ci[ic * Np], &FluxDiffusive[3 * ic * Np],
|
&fq[ic * Np * 7], &Ci[ic * Np], &FluxDiffusive[3 * ic * Np],
|
||||||
&FluxAdvective[3 * ic * Np], &FluxElectrical[3 * ic * Np],
|
&FluxAdvective[3 * ic * Np], &FluxElectrical[3 * ic * Np],
|
||||||
Velocity, ElectricField, IonDiffusivity[ic], IonValence[ic],
|
Velocity, ElectricField, IonDiffusivity[ic], IonValence[ic],
|
||||||
rlx[ic], Vt, 0, ScaLBL_Comm->LastExterior(), Np);
|
rlx[ic], Vt, 0, ScaLBL_Comm->LastExterior(), Np);
|
||||||
|
|
||||||
IonMembrane->IonTransport(&fq[ic * Np * 7],&Ci[ic * Np]);
|
|
||||||
|
|
||||||
ScaLBL_Comm->Barrier();
|
IonMembrane->IonTransport(&fq[ic * Np * 7],&Ci[ic * Np]);
|
||||||
comm.barrier();
|
|
||||||
|
|
||||||
/*
|
ScaLBL_Comm->Barrier();
|
||||||
|
comm.barrier();
|
||||||
|
|
||||||
|
/*
|
||||||
if (BoundaryConditionSolid == 1) {
|
if (BoundaryConditionSolid == 1) {
|
||||||
//TODO IonSolid may also be species-dependent
|
//TODO IonSolid may also be species-dependent
|
||||||
ScaLBL_Comm->SolidDirichletD3Q7(&fq[ic * Np * 7], IonSolid);
|
ScaLBL_Comm->SolidDirichletD3Q7(&fq[ic * Np * 7], IonSolid);
|
||||||
}
|
}
|
||||||
ScaLBL_Comm->Barrier();
|
ScaLBL_Comm->Barrier();
|
||||||
comm.barrier();
|
comm.barrier();
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Compute charge density for Poisson equation
|
//Compute charge density for Poisson equation
|
||||||
for (size_t ic = 0; ic < number_ion_species; ic++) {
|
for (size_t ic = 0; ic < number_ion_species; ic++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user