fix force adaptation

This commit is contained in:
James E McClure 2020-05-22 13:12:54 -04:00
parent 14826cba1f
commit 48fe85f4ef

View File

@ -815,28 +815,6 @@ void ScaLBL_ColorModel::Run(){
color_db->putVector<double>("F",{Fx,Fy,Fz});
}
if ( isSteady ){
/*if (SET_CAPILLARY_NUMBER && fabs(capillary_number - Ca) / capillary_number > 2.0){
// reject steady points if they don't match the Ca well enough
double RESCALE_FORCE_FACTOR = capillary_number / Ca;
if (RESCALE_FORCE_FACTOR > 2.0) RESCALE_FORCE_FACTOR = 2.0;
if (RESCALE_FORCE_FACTOR < 0.5) RESCALE_FORCE_FACTOR = 0.5;
Fx *= RESCALE_FORCE_FACTOR;
Fy *= RESCALE_FORCE_FACTOR;
Fz *= RESCALE_FORCE_FACTOR;
force_mag = sqrt(Fx*Fx+Fy*Fy+Fz*Fz);
if (force_mag > 1e-3){
Fx *= 1e-3/force_mag; // impose ceiling for stability
Fy *= 1e-3/force_mag;
Fz *= 1e-3/force_mag;
}
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<double>("F",{Fx,Fy,Fz});
// simulate the point again with new force
CURRENT_STEADY_TIMESTEPS=0;
}
else {
*/
MORPH_ADAPT = true;
CURRENT_MORPH_TIMESTEPS=0;
delta_volume_target = Dm->Volume*volA *morph_delta; // set target volume change
@ -932,13 +910,9 @@ void ScaLBL_ColorModel::Run(){
printf(" Measured capillary number %f \n ",Ca);
}
if (SET_CAPILLARY_NUMBER ){
double RESCALE_FORCE_FACTOR = capillary_number / Ca;
if (RESCALE_FORCE_FACTOR > 2.0) RESCALE_FORCE_FACTOR = 2.0;
if (RESCALE_FORCE_FACTOR < 0.5) RESCALE_FORCE_FACTOR = 0.5;
Fx *= RESCALE_FORCE_FACTOR;
Fy *= RESCALE_FORCE_FACTOR;
Fz *= RESCALE_FORCE_FACTOR;
force_mag = sqrt(Fx*Fx+Fy*Fy+Fz*Fz);
Fx *= capillary_number / Ca;
Fy *= capillary_number / Ca;
Fz *= capillary_number / Ca;
if (force_mag > 1e-3){
Fx *= 1e-3/force_mag; // impose ceiling for stability
Fy *= 1e-3/force_mag;
@ -949,6 +923,8 @@ void ScaLBL_ColorModel::Run(){
color_db->putVector<double>("F",{Fx,Fy,Fz});
}
CURRENT_STEADY_TIMESTEPS = 0;
}
else{
if (rank==0){
printf("** Continue to simulate steady *** \n ");
@ -957,9 +933,6 @@ void ScaLBL_ColorModel::Run(){
}
morph_timesteps=0;
Ca_previous = Ca;
/*}
THIS IS WHERE YOU DISABLE STEADY POINT REJECTION
*/
}
if (MORPH_ADAPT ){
@ -1018,7 +991,6 @@ void ScaLBL_ColorModel::Run(){
}
MPI_Barrier(ScaLBL_Comm->MPI_COMM_SCALBL);
}
}
analysis.finish();
PROFILE_STOP("Loop");
PROFILE_SAVE("lbpm_color_simulator",1);