diff --git a/analysis/runAnalysis.cpp b/analysis/runAnalysis.cpp index d765eb25..3ae759c1 100644 --- a/analysis/runAnalysis.cpp +++ b/analysis/runAnalysis.cpp @@ -476,11 +476,9 @@ runAnalysis::commWrapper runAnalysis::getComm( ) /****************************************************************** * Constructor/Destructors * ******************************************************************/ -runAnalysis::runAnalysis( std::shared_ptr db, - const RankInfoStruct& rank_info, std::shared_ptr ScaLBL_Comm, std::shared_ptr Dm, - int Np, bool Regular, double beta, IntArray Map ): +runAnalysis::runAnalysis(std::shared_ptr db, const RankInfoStruct& rank_info, std::shared_ptr ScaLBL_Comm, std::shared_ptr Dm, + int Np, bool Regular, IntArray Map ): d_Np( Np ), - d_beta( beta ), d_regular ( Regular), d_rank_info( rank_info ), d_Map( Map ), @@ -518,6 +516,8 @@ runAnalysis::runAnalysis( std::shared_ptr db, auto restart_file = db->getScalar( "restart_file" ); d_restartFile = restart_file + "." + rankString; + + d_rank = MPI_WORLD_RANK(); writeIDMap(ID_map_struct(),0,id_map_filename); // Initialize IO for silo @@ -714,10 +714,12 @@ AnalysisType runAnalysis::computeAnalysisType( int timestep ) /****************************************************************** * Run the analysis * ******************************************************************/ -void runAnalysis::run( int timestep, TwoPhase& Averages, const double *Phi, +void runAnalysis::run( std::shared_ptr db, TwoPhase& Averages, const double *Phi, double *Pressure, double *Velocity, double *fq, double *Den) { int N = d_N[0]*d_N[1]*d_N[2]; + + int timestep = db->getWithDefault( "timestep", 0 ); // Check which analysis steps we need to perform auto type = computeAnalysisType( timestep ); @@ -882,7 +884,7 @@ void runAnalysis::run( int timestep, TwoPhase& Averages, const double *Phi, /****************************************************************** * Run the analysis * ******************************************************************/ -void runAnalysis::basic( int timestep, SubPhase &Averages, const double *Phi, double *Pressure, double *Velocity, double *fq, double *Den) +void runAnalysis::basic( std::shared_ptr db, SubPhase &Averages, const double *Phi, double *Pressure, double *Velocity, double *fq, double *Den) { int N = d_N[0]*d_N[1]*d_N[2]; diff --git a/analysis/runAnalysis.h b/analysis/runAnalysis.h index df73fafd..a23e961b 100644 --- a/analysis/runAnalysis.h +++ b/analysis/runAnalysis.h @@ -25,16 +25,16 @@ public: //! Constructor runAnalysis( std::shared_ptr db, const RankInfoStruct& rank_info, - std::shared_ptr ScaLBL_Comm, std::shared_ptr dm, int Np, bool Regular, double beta, IntArray Map ); + std::shared_ptr ScaLBL_Comm, std::shared_ptr dm, int Np, bool Regular, IntArray Map ); //! Destructor ~runAnalysis(); //! Run the next analysis - void run( int timestep, TwoPhase &Averages, const double *Phi, + void run( std::shared_ptr db, TwoPhase &Averages, const double *Phi, double *Pressure, double *Velocity, double *fq, double *Den ); - void basic( int timestep, SubPhase &Averages, const double *Phi, double *Pressure, double *Velocity, double *fq, double *Den ); + void basic( std::shared_ptr db, SubPhase &Averages, const double *Phi, double *Pressure, double *Velocity, double *fq, double *Den ); void WriteVisData( int timestep, SubPhase &Averages, const double *Phi, double *Pressure, double *Velocity, double *fq, double *Den); //! Finish all active analysis diff --git a/models/ColorModel.cpp b/models/ColorModel.cpp index 7bd2a8ce..338a46fb 100644 --- a/models/ColorModel.cpp +++ b/models/ColorModel.cpp @@ -542,7 +542,7 @@ 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, beta, Map ); + runAnalysis analysis( analysis_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)); } @@ -624,7 +624,9 @@ void ScaLBL_ColorModel::Run(){ // Run the analysis //analysis.run( timestep, *Averages, Phi, Pressure, Velocity, fq, Den ); - analysis.basic( timestep, *Averages, Phi, Pressure, Velocity, fq, Den ); + + analysis_db->putScalar("timestep",timestep); + analysis.basic( analysis_db, *Averages, Phi, Pressure, Velocity, fq, Den ); if (rank==0 && timestep%analysis_interval == 0 && BoundaryCondition > 0){ printf("....inlet pressure=%f \n",din); diff --git a/models/DFHModel.cpp b/models/DFHModel.cpp index f1794868..51187893 100644 --- a/models/DFHModel.cpp +++ b/models/DFHModel.cpp @@ -492,7 +492,7 @@ void ScaLBL_DFHModel::Run(){ bool Regular = true; PROFILE_START("Loop"); - runAnalysis analysis( analysis_db, rank_info, ScaLBL_Comm, Dm, Np, Regular, beta, Map ); + runAnalysis analysis( analysis_db, rank_info, ScaLBL_Comm, Dm, Np, Regular, Map ); while (timestep < timestepMax ) { //if ( rank==0 ) { printf("Running timestep %i (%i MB)\n",timestep+1,(int)(Utilities::getMemoryUsage()/1048576)); } PROFILE_START("Update"); @@ -573,7 +573,7 @@ void ScaLBL_DFHModel::Run(){ PROFILE_STOP("Update"); // Run the analysis - analysis.run( timestep, *Averages, Phi, Pressure, Velocity, fq, Den ); + analysis.run( analysis_db, *Averages, Phi, Pressure, Velocity, fq, Den ); } analysis.finish(); PROFILE_STOP("Loop"); diff --git a/tests/TestBubbleDFH.cpp b/tests/TestBubbleDFH.cpp index 63fd43d1..37d2c187 100644 --- a/tests/TestBubbleDFH.cpp +++ b/tests/TestBubbleDFH.cpp @@ -405,7 +405,7 @@ int main(int argc, char **argv) //************ MAIN ITERATION LOOP ***************************************/ PROFILE_START("Loop"); //std::shared_ptr analysis_db; - runAnalysis analysis( analysis_db, rank_info, ScaLBL_Comm, Dm, Np, pBC, beta, Map ); + runAnalysis analysis( analysis_db, rank_info, ScaLBL_Comm, Dm, Np, pBC, Map ); //analysis.createThreads( analysis_method, 4 ); while (timestep < timestepMax && err > tol ) { //if ( rank==0 ) { printf("Running timestep %i (%i MB)\n",timestep+1,(int)(Utilities::getMemoryUsage()/1048576)); } @@ -487,7 +487,7 @@ int main(int argc, char **argv) PROFILE_STOP("Update"); // Run the analysis - analysis.run( timestep, *Averages, Phi, Pressure, Velocity, fq, Den ); + analysis.run( analysis_db, *Averages, Phi, Pressure, Velocity, fq, Den ); } analysis.finish();