From 439584b22b51cd2e854f1267cc16236037bd91e4 Mon Sep 17 00:00:00 2001 From: JamesEMcclure Date: Wed, 30 Jun 2021 10:34:19 -0400 Subject: [PATCH 1/2] fix protocol bug --- tests/lbpm_color_simulator.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/lbpm_color_simulator.cpp b/tests/lbpm_color_simulator.cpp index 3dade4d5..44a99d8b 100644 --- a/tests/lbpm_color_simulator.cpp +++ b/tests/lbpm_color_simulator.cpp @@ -72,7 +72,7 @@ int main( int argc, char **argv ) bool ContinueSimulation = true; /* Variables for simulation protocols */ - auto PROTOCOL = ColorModel.color_db->getWithDefault( "protocol", "none" ); + auto PROTOCOL = ColorModel.color_db->getWithDefault( "protocol", "default" ); /* image sequence protocol */ int IMAGE_INDEX = 0; int IMAGE_COUNT = 0; @@ -123,6 +123,7 @@ int main( int argc, char **argv ) else{ if (rank==0) printf("Finished simulating image sequence \n"); ColorModel.timestep = ColorModel.timestepMax; + ContinueSimulation = false; } } /*********************************************************/ @@ -144,7 +145,7 @@ int main( int argc, char **argv ) double speedB = sqrt(vB_x*vB_x + vB_y*vB_y + vB_z*vB_z); /* stop simulation if previous point was sufficiently close to the endpoint*/ if (volA*speedA < ENDPOINT_THRESHOLD*volB*speedB) ContinueSimulation = false; - if (ContinueSimulation){ + if (ContinueSimulation && SKIP_TIMESTEPS > 0 ){ while (skip_time < SKIP_TIMESTEPS && fabs(SaturationChange) < fabs(FRACTIONAL_FLOW_INCREMENT) ){ timestep += ANALYSIS_INTERVAL; if (PROTOCOL == "fractional flow") { From 8ef4651db84865552b309da31c2516adcfc34366 Mon Sep 17 00:00:00 2001 From: JamesEMcclure Date: Wed, 30 Jun 2021 10:39:28 -0400 Subject: [PATCH 2/2] create legacy mode for color simulator --- tests/lbpm_color_simulator.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/lbpm_color_simulator.cpp b/tests/lbpm_color_simulator.cpp index 44a99d8b..a0b2859c 100644 --- a/tests/lbpm_color_simulator.cpp +++ b/tests/lbpm_color_simulator.cpp @@ -34,15 +34,15 @@ int main( int argc, char **argv ) // Load the input database auto db = std::make_shared( argv[1] ); if (argc > 2) { - SimulationMode = "development"; + SimulationMode = "legacy"; } if ( rank == 0 ) { printf( "********************************************************\n" ); printf( "Running Color LBM \n" ); printf( "********************************************************\n" ); - if (SimulationMode == "development") - printf("**** DEVELOPMENT MODE ENABLED *************\n"); + if (SimulationMode == "legacy") + printf("**** LEGACY MODE ENABLED *************\n"); } // Initialize compute device int device = ScaLBL_SetDevice( rank ); @@ -66,7 +66,10 @@ int main( int argc, char **argv ) // structure and allocate variables ColorModel.Initialize(); // initializing the model will set initial conditions for variables - if (SimulationMode == "development"){ + if (SimulationMode == "legacy"){ + ColorModel.Run(); + } + else { double MLUPS=0.0; int timestep = 0; bool ContinueSimulation = true; @@ -174,9 +177,8 @@ int main( int argc, char **argv ) /*********************************************************/ } } - else - ColorModel.Run(); - + + PROFILE_STOP( "Main" ); auto file = db->getWithDefault( "TimerFile", "lbpm_color_simulator" ); auto level = db->getWithDefault( "TimerLevel", 1 );