move image sequence loop out of flow adaptor loop

This commit is contained in:
JamesEMcclure 2021-06-15 16:33:05 -04:00
parent a30f547af2
commit 4beee9a9a8

View File

@ -106,6 +106,21 @@ int main( int argc, char **argv )
if (ColorModel.timestep > ColorModel.timestepMax){ if (ColorModel.timestep > ColorModel.timestepMax){
ContinueSimulation = false; ContinueSimulation = false;
} }
/* Load a new image if image sequence is specified */
if (PROTOCOL == "image sequence"){
IMAGE_INDEX++;
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);
ColorModel.color_db->putScalar<int>("image_index",IMAGE_INDEX);
Adapt.ImageInit(ColorModel, next_image);
}
else{
if (rank==0) printf("Finished simulating image sequence \n");
ColorModel.timestep = ColorModel.timestepMax;
}
}
/* update the fluid configuration with the flow adapter */ /* update the fluid configuration with the flow adapter */
int skip_time = 0; int skip_time = 0;
timestep = ColorModel.timestep; timestep = ColorModel.timestep;
@ -134,21 +149,9 @@ int main( int argc, char **argv )
double target_volume_change = FRACTIONAL_FLOW_INCREMENT*initialSaturation - SaturationChange; double target_volume_change = FRACTIONAL_FLOW_INCREMENT*initialSaturation - SaturationChange;
Adapt.ShellAggregation(ColorModel,target_volume_change); Adapt.ShellAggregation(ColorModel,target_volume_change);
} }
else if (PROTOCOL == "image sequence"){ /* Run some LBM timesteps to let the system relax a bit */
IMAGE_INDEX++;
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);
ColorModel.color_db->putScalar<int>("image_index",IMAGE_INDEX);
Adapt.ImageInit(ColorModel, next_image);
skip_time = SKIP_TIMESTEPS;
}
else{
if (rank==0) printf("Finished simulating image sequence \n");
ColorModel.timestep = ColorModel.timestepMax;
}
}
MLUPS = ColorModel.Run(timestep); MLUPS = ColorModel.Run(timestep);
/* Recompute the volume fraction now that the system has adjusted */
double volB = ColorModel.Averages->gwb.V; double volB = ColorModel.Averages->gwb.V;
double volA = ColorModel.Averages->gnb.V; double volA = ColorModel.Averages->gnb.V;
SaturationChange = volB/(volA + volB) - initialSaturation; SaturationChange = volB/(volA + volB) - initialSaturation;