read Membrane ion concentration list

This commit is contained in:
James McClure
2022-04-19 10:53:16 -04:00
parent b51968c677
commit 481a258fbd

View File

@@ -165,15 +165,6 @@ void ScaLBL_IonModel::ReadParams(string filename, vector<int> &num_iter) {
} }
} }
if (ion_db->keyExists("MembraneIonConcentrationList")) {
MembraneIonConcentration.clear();
MembraneIonConcentration = ion_db->getVector<double>("MembraneIonConcentrationList");
if (MembraneIonConcentration.size() != number_ion_species) {
ERROR("Error: number_ion_species and MembraneIonConcentrationList must be "
"the same length! \n");
}
}
//Read solid boundary condition specific to Ion model //Read solid boundary condition specific to Ion model
BoundaryConditionSolid = 0; BoundaryConditionSolid = 0;
if (ion_db->keyExists("BC_Solid")) { if (ion_db->keyExists("BC_Solid")) {
@@ -432,6 +423,25 @@ void ScaLBL_IonModel::ReadParams(string filename) {
} }
} }
if (ion_db->keyExists("MembraneIonConcentrationList")) {
printf(".... Read MembraneIonConcentrationList \n");
MembraneIonConcentration.clear();
MembraneIonConcentration = ion_db->getVector<double>("MembraneIonConcentrationList");
if (MembraneIonConcentration.size() != number_ion_species) {
ERROR("Error: number_ion_species and MembraneIonConcentrationList must be "
"the same length! \n");
}
else {
for (size_t i = 0; i < MembraneIonConcentration.size(); i++) {
MembraneIonConcentration[i] =
MembraneIonConcentration[i] *
(h * h * h *
1.0e-18); //LB ion concentration has unit [mol/lu^3]
}
}
}
//Read solid boundary condition specific to Ion model //Read solid boundary condition specific to Ion model
BoundaryConditionSolid = 0; BoundaryConditionSolid = 0;
if (ion_db->keyExists("BC_Solid")) { if (ion_db->keyExists("BC_Solid")) {
@@ -791,10 +801,8 @@ void ScaLBL_IonModel::AssignIonConcentrationMembrane( double *Ci, int ic) {
double VALUE = 0.f; double VALUE = 0.f;
if (rank == 0){ if (rank == 0){
for (unsigned int ic=0; ic<MembraneIonConcentration.size();ic++){
printf(".... Set concentration(%i): inside=%f, outside=%f \n", ic, MembraneIonConcentration[ic], IonConcentration[ic]); printf(".... Set concentration(%i): inside=%f, outside=%f \n", ic, MembraneIonConcentration[ic], IonConcentration[ic]);
} }
}
for (int k = 0; k < Nz; k++) { for (int k = 0; k < Nz; k++) {
for (int j = 0; j < Ny; j++) { for (int j = 0; j < Ny; j++) {
for (int i = 0; i < Nx; i++) { for (int i = 0; i < Nx; i++) {
@@ -959,6 +967,7 @@ void ScaLBL_IonModel::Initialize() {
*/ */
if (rank == 0) if (rank == 0)
printf("LB Ion Solver: initializing D3Q7 distributions\n"); printf("LB Ion Solver: initializing D3Q7 distributions\n");
USE_MEMBRANE = true;
if (USE_MEMBRANE){ if (USE_MEMBRANE){
double *Ci_host; double *Ci_host;
if (rank == 0) if (rank == 0)
@@ -966,7 +975,6 @@ void ScaLBL_IonModel::Initialize() {
Ci_host = new double[number_ion_species * Np]; Ci_host = new double[number_ion_species * Np];
for (size_t ic = 0; ic < number_ion_species; ic++) { for (size_t ic = 0; ic < number_ion_species; ic++) {
AssignIonConcentrationMembrane( &Ci_host[ic * Np], ic); AssignIonConcentrationMembrane( &Ci_host[ic * Np], ic);
} }
ScaLBL_CopyToDevice(Ci, Ci_host, number_ion_species * sizeof(double) * Np); ScaLBL_CopyToDevice(Ci, Ci_host, number_ion_species * sizeof(double) * Np);
comm.barrier(); comm.barrier();