diff --git a/analysis/runAnalysis.cpp b/analysis/runAnalysis.cpp index 657847e8..b35bf760 100644 --- a/analysis/runAnalysis.cpp +++ b/analysis/runAnalysis.cpp @@ -895,7 +895,9 @@ void runAnalysis::basic( std::shared_ptr db, SubPhase &Averages, const int N = d_N[0]*d_N[1]*d_N[2]; // Check which analysis steps we need to perform - int timestep = db->getWithDefault( "timestep", 0 ); + auto color_db = db->getDatabase( "Color" ); + + int timestep = color_db->getWithDefault( "timestep", 0 ); auto type = computeAnalysisType( timestep ); if ( type == AnalysisType::AnalyzeNone ) return; diff --git a/models/ColorModel.cpp b/models/ColorModel.cpp index b5597861..6b4fbd86 100644 --- a/models/ColorModel.cpp +++ b/models/ColorModel.cpp @@ -521,6 +521,9 @@ void ScaLBL_ColorModel::Run(){ capillary_number = color_db->getScalar( "capillary_number" ); SET_CAPILLARY_NUMBER=true; } + if (color_db->keyExists( "timestep" )){ + timestep = color_db->getScalar( "timestep" ); + } if (BoundaryCondition != 0 && SET_CAPILLARY_NUMBER==true){ if (rank == 0) printf("WARINING: capillary number target only supported for BC = 0 \n"); SET_CAPILLARY_NUMBER=false; @@ -607,7 +610,8 @@ void ScaLBL_ColorModel::Run(){ PROFILE_START("Loop"); //std::shared_ptr analysis_db; bool Regular = false; - runAnalysis analysis( analysis_db, rank_info, ScaLBL_Comm, Dm, Np, Regular, Map ); + auto current_db = db->cloneDatabase(); + runAnalysis analysis( current_db, rank_info, ScaLBL_Comm, Dm, Np, Regular, Map ); //analysis.createThreads( analysis_method, 4 ); while (timestep < timestepMax ) { //if ( rank==0 ) { printf("Running timestep %i (%i MB)\n",timestep+1,(int)(Utilities::getMemoryUsage()/1048576)); } @@ -690,8 +694,9 @@ void ScaLBL_ColorModel::Run(){ // Run the analysis //analysis.run( timestep, *Averages, Phi, Pressure, Velocity, fq, Den ); - analysis_db->putScalar("timestep",timestep); - analysis.basic( analysis_db, *Averages, Phi, Pressure, Velocity, fq, Den ); + color_db->putScalar("timestep",timestep); + current_db->putDatabase("Color", color_db); + analysis.basic( current_db, *Averages, Phi, Pressure, Velocity, fq, Den ); if (rank==0 && timestep%analysis_interval == 0 && BoundaryCondition > 0){ printf("....inlet pressure=%f \n",din); @@ -793,6 +798,7 @@ void ScaLBL_ColorModel::Run(){ } if (rank == 0) printf(" -- adjust force by factor %f \n ",capillary_number / Ca); Averages->SetParams(rhoA,rhoB,tauA,tauB,Fx,Fy,Fz,alpha,beta); + color_db->putVector("F",{Fx,Fy,Fz}); } CURRENT_STEADY_TIMESTEPS = 0; } @@ -815,6 +821,7 @@ void ScaLBL_ColorModel::Run(){ if (IMAGE_INDEX < IMAGE_COUNT){ std::string next_image = ImageList[IMAGE_INDEX]; if (rank==0) printf("***Loading next image in sequence (%i) ***\n",IMAGE_INDEX); + color_db->putScalar("image_index",IMAGE_INDEX); ImageInit(next_image); } else{