membrane structure in IonModel

This commit is contained in:
James McClure 2022-03-18 11:20:09 -04:00
parent bfa6f5e5b8
commit bfe1de6be2
2 changed files with 7 additions and 9 deletions

View File

@ -1,6 +1,6 @@
/* Flow adaptor class for multiphase flow methods */
#include "analysis/Membrane.h"
#include "common/Membrane.h"
#include "analysis/distance.h"
Membrane::Membrane(std::shared_ptr <Domain> Dm, int *initialNeighborList, int Nsites) {
@ -1163,14 +1163,11 @@ void Membrane::RecvD37AA(double *dist){
// std::shared_ptr<Database> db){
void Membrane::AssignCoefficients(int *Map, double *Psi, double *Distance, string method){
}
/* Assign mass transfer coefficients to the membrane data structure */
double Threshold;
double MassFractionIn,MassFractionOut,ThresholdMassFractionIn,ThresholdMassFractionOut;
membrane_db = db->getDatabase("Membrane");
if (method == "Voltage Gated Potassium"){
MassFractionIn = 0.0;
MassFractionOut = 0.0;

View File

@ -584,10 +584,12 @@ void ScaLBL_IonModel::SetDomain() {
}
void ScaLBL_IonModel::SetMembrane() {
size_t NLABELS = 0;
membrane_db = db->getDatabase("Membrane");
/* set distance based on labels inside the membrane (all other labels will be outside) */
auto InsideMembraneLabels = membrane_db->getVector<int>("InsideMembraneLabels");
auto MembraneLabels = membrane_db->getVector<int>("MembraneLabels");
IonMembrane = std::shared_ptr<Membrane>(new Membrane(Dm, NeighborList, Np));
signed char LABEL = 0;
@ -608,7 +610,7 @@ void ScaLBL_IonModel::SetMembrane() {
membrane_id(i,j,k) = 1; // default value
LABEL = Dm->id[k*Nx*Ny + j*Nx + i];
for (size_t m=0; m<MembraneLabels.size(); m++){
if (LABEL == InsideMembraneLabels[m]) {
if (LABEL == MembraneLabels[m]) {
label_count[m] += 1.0;
membrane_id(i,j,k) = 0; // inside
m = MembraneLabels.size(); //exit loop
@ -623,7 +625,7 @@ void ScaLBL_IonModel::SetMembrane() {
if (rank == 0) {
printf("Membrane labels: %lu \n", MembraneLabels.size());
for (size_t m=0; m<MembraneLabels.size(); m++){
LABEL = InsideMembraneLabels[m];
LABEL = MembraneLabels[m];
double volume_fraction = double(label_count_global[m]) /
double((Nx - 2) * (Ny - 2) * (Nz - 2) * nprocs);
printf(" label=%d, volume fraction==%f\n", LABEL, volume_fraction);
@ -638,9 +640,8 @@ void ScaLBL_IonModel::SetMembrane() {
}
}
CalcDist(MembraneDistance, membrane_id, *Dm);
ComputeScalar(MembraneDistance, 0.0);
/* create the membrane data structure */
MembraneCount = M.Create(Dm, MembraneDistance, Map);
MembraneCount = IonMembrane->Create(Dm, MembraneDistance, Map);
// clean up
delete [] label_count;