From 59ffd7bfd66cbfa609386a069bd45aa34ba943bf Mon Sep 17 00:00:00 2001 From: Rex Zhe Li Date: Thu, 20 Aug 2020 22:47:10 -0400 Subject: [PATCH] fix several miscellaneous bugs --- models/IonModel.cpp | 20 +++++++++++--------- models/PoissonSolver.cpp | 2 +- models/StokesModel.cpp | 17 +++++++++-------- tests/lbpm_electrokinetic_dfh_simulator.cpp | 3 +++ 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/models/IonModel.cpp b/models/IonModel.cpp index d6265abe..55c848b9 100644 --- a/models/IonModel.cpp +++ b/models/IonModel.cpp @@ -48,6 +48,15 @@ void ScaLBL_IonModel::ReadParams(string filename,int num_iter,int num_iter_Stoke tau.push_back(0.5+k2_inv*time_conv/(h*1.0e-6)/(h*1.0e-6)*IonDiffusivity[0]); //--------------------------------------------------------------------------// + // Read domain parameters + if (domain_db->keyExists( "voxel_length" )){//default unit: um/lu + h = domain_db->getScalar( "voxel_length" ); + } + BoundaryCondition = 0; + if (domain_db->keyExists( "BC" )){ + BoundaryCondition = domain_db->getScalar( "BC" ); + } + // LB-Ion Model parameters //if (ion_db->keyExists( "timestepMax" )){ // timestepMax = ion_db->getScalar( "timestepMax" ); @@ -112,14 +121,6 @@ void ScaLBL_IonModel::ReadParams(string filename,int num_iter,int num_iter_Stoke BoundaryConditionSolid = ion_db->getScalar( "BC_Solid" ); } - // Read domain parameters - if (domain_db->keyExists( "voxel_length" )){//default unit: um/lu - h = domain_db->getScalar( "voxel_length" ); - } - BoundaryCondition = 0; - if (domain_db->keyExists( "BC" )){ - BoundaryCondition = domain_db->getScalar( "BC" ); - } if (rank==0) printf("*****************************************************\n"); if (rank==0) printf("LB Ion Transport Solver: \n"); @@ -275,7 +276,7 @@ void ScaLBL_IonModel::AssignSolidBoundary(double *ion_solid) label_count_global[idx]=sumReduce( Dm->Comm, label_count[idx]); if (rank==0){ - printf("LB Ion Solver: Ion Solid labels: %lu \n",NLABELS); + printf("LB Ion Solver: number of ion solid labels: %lu \n",NLABELS); for (unsigned int idx=0; idxFirstInterior(), ScaLBL_Comm->LastInterior(), Np); + ScaLBL_IonConcentration_Phys(Ci, h, ic, 0, ScaLBL_Comm->LastExterior(), Np); } DoubleArray PhaseField(Nx,Ny,Nz); diff --git a/models/PoissonSolver.cpp b/models/PoissonSolver.cpp index 3cf8a6d2..701c009c 100644 --- a/models/PoissonSolver.cpp +++ b/models/PoissonSolver.cpp @@ -224,7 +224,7 @@ void ScaLBL_Poisson::AssignSolidBoundary(double *poisson_solid) label_count_global[idx]=sumReduce( Dm->Comm, label_count[idx]); if (rank==0){ - printf("LB-Poisson Solver: Poisson Solid labels: %lu \n",NLABELS); + printf("LB-Poisson Solver: number of Poisson solid labels: %lu \n",NLABELS); for (unsigned int idx=0; idxkeyExists( "BC" )){ + BoundaryCondition = domain_db->getScalar( "BC" ); + } + if (domain_db->keyExists( "voxel_length" )){//default unit: um/lu + h = domain_db->getScalar( "voxel_length" ); + } + // Single-fluid Navier-Stokes Model parameters //if (stokes_db->keyExists( "timestepMax" )){ // timestepMax = stokes_db->getScalar( "timestepMax" ); @@ -75,14 +84,6 @@ void ScaLBL_StokesModel::ReadParams(string filename,int num_iter){ if (stokes_db->keyExists( "flux" )){ flux = stokes_db->getScalar( "flux" ); } - - // Read domain parameters - if (domain_db->keyExists( "BC" )){ - BoundaryCondition = domain_db->getScalar( "BC" ); - } - if (domain_db->keyExists( "voxel_length" )){//default unit: um/lu - h = domain_db->getScalar( "voxel_length" ); - } // Re-calculate model parameters due to parameter read mu=(tau-0.5)/3.0; diff --git a/tests/lbpm_electrokinetic_dfh_simulator.cpp b/tests/lbpm_electrokinetic_dfh_simulator.cpp index 7cf835da..156fbc18 100644 --- a/tests/lbpm_electrokinetic_dfh_simulator.cpp +++ b/tests/lbpm_electrokinetic_dfh_simulator.cpp @@ -98,6 +98,9 @@ int main(int argc, char **argv) PoissonSolver.getElectricalPotential(); IonModel.getIonConcentration(); + if (rank==0) printf("Maximum timestep is reached and the simulation is completed\n"); + if (rank==0) printf("*************************************************************\n"); + PROFILE_STOP("Main"); PROFILE_SAVE("lbpm_electrokinetic_simulator",1); // ****************************************************