From 6d576393b7dc22e8a9f562130c8ce2ce3259a548 Mon Sep 17 00:00:00 2001 From: James McClure Date: Thu, 12 Sep 2019 09:47:22 -0400 Subject: [PATCH 1/5] fix divide by zero --- analysis/SubPhase.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/analysis/SubPhase.cpp b/analysis/SubPhase.cpp index 232a1fb0..70a674b7 100644 --- a/analysis/SubPhase.cpp +++ b/analysis/SubPhase.cpp @@ -246,9 +246,15 @@ void SubPhase::Basic(){ count_w=sumReduce( Dm->Comm, count_w); count_n=sumReduce( Dm->Comm, count_n); - gwb.p=sumReduce( Dm->Comm, wb.p) / count_w; - gnb.p=sumReduce( Dm->Comm, nb.p) / count_n; - + if (count_w > 0.0) + gwb.p=sumReduce( Dm->Comm, wb.p) / count_w; + else + gwb.p = 0.0; + if (count_n > 0.0) + gnb.p=sumReduce( Dm->Comm, nb.p) / count_n; + else + gnb.p = 0.0; + // check for NaN bool err=false; if (gwb.V != gwb.V) err=true; From 89687f578ce6603f5467d8c889868fe709095ed5 Mon Sep 17 00:00:00 2001 From: James McClure Date: Fri, 13 Sep 2019 07:31:31 -0400 Subject: [PATCH 2/5] fix bug in vis write --- analysis/runAnalysis.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/analysis/runAnalysis.cpp b/analysis/runAnalysis.cpp index 7f8b8234..44883f22 100644 --- a/analysis/runAnalysis.cpp +++ b/analysis/runAnalysis.cpp @@ -208,13 +208,14 @@ private: class IOWorkItem: public ThreadPool::WorkItemRet { public: - IOWorkItem( std::shared_ptr vis_db_, std::vector& visData_, + IOWorkItem( std::shared_ptr input_db_, std::vector& visData_, SubPhase& Averages_, fillHalo& fillData_, runAnalysis::commWrapper&& comm_ ): - vis_db(vis_db_), visData(visData_), Averages(Averages_), fillData(fillData_), comm(std::move(comm_)) + input_db(input_db_), visData(visData_), Averages(Averages_), fillData(fillData_), comm(std::move(comm_)) { } ~IOWorkItem() { } virtual void run() { + auto vis_db = input_db->getDatabase( "Visualization" ); int timestep = vis_db->getWithDefault( "timestep", 0 ); PROFILE_START("Save Vis",1); @@ -939,7 +940,7 @@ void runAnalysis::basic( std::shared_ptr input_db, SubPhase &Averages, // Check which analysis steps we need to perform auto color_db = input_db->getDatabase( "Color" ); - auto vis_db = input_db->getDatabase( "Visualization" ); + //auto vis_db = input_db->getDatabase( "Visualization" ); int timestep = color_db->getWithDefault( "timestep", 0 ); auto type = computeAnalysisType( timestep ); @@ -1026,7 +1027,7 @@ void runAnalysis::basic( std::shared_ptr input_db, SubPhase &Averages, if (timestep%d_visualization_interval==0){ // Write the vis files - auto work = new IOWorkItem( vis_db, d_meshData, Averages, d_fillData, getComm() ); + auto work = new IOWorkItem( input_db, d_meshData, Averages, d_fillData, getComm() ); work->add_dependency(d_wait_analysis); work->add_dependency(d_wait_subphase); work->add_dependency(d_wait_vis); @@ -1036,10 +1037,11 @@ void runAnalysis::basic( std::shared_ptr input_db, SubPhase &Averages, PROFILE_STOP("run"); } -void runAnalysis::WriteVisData( std::shared_ptr vis_db, SubPhase &Averages, const double *Phi, double *Pressure, double *Velocity, double *fq, double *Den) +void runAnalysis::WriteVisData( std::shared_ptr input_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]; - int timestep = vis_db->getWithDefault( "timestep", 0 ); + auto db = input_db->getDatabase( "Color" ); + int timestep = db->getWithDefault( "timestep", 0 ); // Check which analysis steps we need to perform auto type = computeAnalysisType( timestep ); @@ -1058,7 +1060,7 @@ void runAnalysis::WriteVisData( std::shared_ptr vis_db, SubPhase &Aver PROFILE_START("write vis",1); // if (Averages.WriteVis == true){ - auto work2 = new IOWorkItem( vis_db, d_meshData, Averages, d_fillData, getComm() ); + auto work2 = new IOWorkItem( input_db, d_meshData, Averages, d_fillData, getComm() ); work2->add_dependency(d_wait_vis); d_wait_vis = d_tpool.add_work(work2); From c622b148152bea9407e72a1ece2723c7d32d799d Mon Sep 17 00:00:00 2001 From: James McClure Date: Fri, 13 Sep 2019 07:34:18 -0400 Subject: [PATCH 3/5] fix vis bug --- analysis/runAnalysis.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analysis/runAnalysis.cpp b/analysis/runAnalysis.cpp index 44883f22..206fcdad 100644 --- a/analysis/runAnalysis.cpp +++ b/analysis/runAnalysis.cpp @@ -270,7 +270,7 @@ public: private: IOWorkItem(); int timestep; - std::shared_ptr vis_db; + std::shared_ptr input_db; std::vector& visData; SubPhase& Averages; fillHalo& fillData; From c7ca6ec3aacd5c8482c19a95aa65d0853da1082e Mon Sep 17 00:00:00 2001 From: JamesEMcclure Date: Fri, 13 Sep 2019 08:16:26 -0400 Subject: [PATCH 4/5] fix vis bug --- analysis/runAnalysis.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/analysis/runAnalysis.cpp b/analysis/runAnalysis.cpp index 206fcdad..3c10239b 100644 --- a/analysis/runAnalysis.cpp +++ b/analysis/runAnalysis.cpp @@ -216,7 +216,9 @@ public: ~IOWorkItem() { } virtual void run() { auto vis_db = input_db->getDatabase( "Visualization" ); - int timestep = vis_db->getWithDefault( "timestep", 0 ); + auto db = input_db->getDatabase( "Colr" ); + + int timestep = db->getWithDefault( "timestep", 0 ); PROFILE_START("Save Vis",1); From e9f729911213789c840cdfc5afcd30f703bffb73 Mon Sep 17 00:00:00 2001 From: Rex Zhe Li Date: Fri, 13 Sep 2019 20:04:35 -0400 Subject: [PATCH 5/5] fix bug so that inlet/outlet layers can be properly considered when calculating Sw --- analysis/SubPhase.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/analysis/SubPhase.cpp b/analysis/SubPhase.cpp index 70a674b7..ab469ace 100644 --- a/analysis/SubPhase.cpp +++ b/analysis/SubPhase.cpp @@ -167,8 +167,8 @@ void SubPhase::Basic(){ // If inlet/outlet layers exist use these as default if (Dm->inlet_layers_x > 0) imin = Dm->inlet_layers_x; if (Dm->inlet_layers_y > 0) jmin = Dm->inlet_layers_y; - if (Dm->inlet_layers_z > 0) kmin = Dm->inlet_layers_z; - if (Dm->outlet_layers_z > 0) kmax = Dm->outlet_layers_z; + if (Dm->inlet_layers_z > 0 && Dm->kproc() == 0) kmin += Dm->inlet_layers_z; + if (Dm->outlet_layers_z > 0 && Dm->kproc() == Dm->nprocz()-1) kmax -= Dm->outlet_layers_z; nb.reset(); wb.reset(); @@ -370,7 +370,8 @@ void SubPhase::Full(){ // If inlet layers exist use these as default if (Dm->inlet_layers_x > 0) imin = Dm->inlet_layers_x; if (Dm->inlet_layers_y > 0) jmin = Dm->inlet_layers_y; - if (Dm->inlet_layers_z > 0) kmin = Dm->inlet_layers_z; + if (Dm->inlet_layers_z > 0 && Dm->kproc() == 0) kmin += Dm->inlet_layers_z; + if (Dm->outlet_layers_z > 0 && Dm->kproc() == Dm->nprocz()-1) kmax -= Dm->outlet_layers_z; nd.reset(); nc.reset(); wd.reset(); wc.reset(); iwn.reset(); iwnc.reset();