Merge branch 'master' of github.com:JamesEMcClure/LBPM-WIA into morphLBM
This commit is contained in:
commit
0e0bd27348
@ -209,7 +209,7 @@ void ScaLBL_ColorModel::AssignComponentLabels(double *phase)
|
|||||||
VALUE=LabelList[idx];
|
VALUE=LabelList[idx];
|
||||||
AFFINITY=AffinityList[idx];
|
AFFINITY=AffinityList[idx];
|
||||||
double volume_fraction = double(label_count_global[idx])/double((Nx-2)*(Ny-2)*(Nz-2)*nprocz);
|
double volume_fraction = double(label_count_global[idx])/double((Nx-2)*(Ny-2)*(Nz-2)*nprocz);
|
||||||
printf(" label=%i, affinity=%f, volume fraction==%f\n",int(VALUE),AFFINITY,volume_fraction);
|
printf(" label=%i, affinity=%f, volume fraction=%f\n",int(VALUE),AFFINITY,volume_fraction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,9 +413,11 @@ void ScaLBL_ColorModel::Run(){
|
|||||||
bool MORPH_ADAPT = false;
|
bool MORPH_ADAPT = false;
|
||||||
bool USE_MORPH = false;
|
bool USE_MORPH = false;
|
||||||
int morph_interval;
|
int morph_interval;
|
||||||
double morph_delta;
|
|
||||||
int morph_timesteps = 0;
|
int morph_timesteps = 0;
|
||||||
int ramp_timesteps = 50000;
|
int ramp_timesteps = 50000;
|
||||||
|
int MORPH_TIME = 0;
|
||||||
|
int MAX_MORPH_TIME = 20000;
|
||||||
|
double morph_delta;
|
||||||
double capillary_number;
|
double capillary_number;
|
||||||
double tolerance = 1.f;
|
double tolerance = 1.f;
|
||||||
double Ca_previous = 0.f;
|
double Ca_previous = 0.f;
|
||||||
@ -660,15 +662,24 @@ void ScaLBL_ColorModel::Run(){
|
|||||||
if (morph_delta < 0.f){
|
if (morph_delta < 0.f){
|
||||||
if (volB/(volA + volB) > TARGET_SATURATION){
|
if (volB/(volA + volB) > TARGET_SATURATION){
|
||||||
MORPH_ADAPT = false;
|
MORPH_ADAPT = false;
|
||||||
|
MORPH_TIME = 0;
|
||||||
TARGET_SATURATION = target_saturation[target_saturation_index++];
|
TARGET_SATURATION = target_saturation[target_saturation_index++];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if (volB/(volA + volB) < TARGET_SATURATION){
|
if (volB/(volA + volB) < TARGET_SATURATION){
|
||||||
MORPH_ADAPT = false;
|
MORPH_ADAPT = false;
|
||||||
|
MORPH_TIME = 0;
|
||||||
TARGET_SATURATION = target_saturation[target_saturation_index++];
|
TARGET_SATURATION = target_saturation[target_saturation_index++];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// maximum number of timesteps to spend on morphological adaptation
|
||||||
|
// this is to help get useful data when fluid connectivity breaks down
|
||||||
|
MORPH_TIME += analysis_interval;
|
||||||
|
if (MORPH_TIME > MAX_MORPH_TIME){
|
||||||
|
MORPH_ADAPT= false;
|
||||||
|
MORPH_TIME = 0;
|
||||||
|
}
|
||||||
MPI_Barrier(comm);
|
MPI_Barrier(comm);
|
||||||
morph_timesteps = 0;
|
morph_timesteps = 0;
|
||||||
}
|
}
|
||||||
|
@ -127,6 +127,61 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
// Run the morphological opening
|
// Run the morphological opening
|
||||||
MorphOpen(SignDist, id, Dm, SW);
|
MorphOpen(SignDist, id, Dm, SW);
|
||||||
|
|
||||||
|
// calculate distance to non-wetting fluid
|
||||||
|
if (domain_db->keyExists( "HistoryLabels" )){
|
||||||
|
if (rank==0) printf("Relabel solid components that touch fluid 1 \n");
|
||||||
|
auto LabelList = domain_db->getVector<char>( "ComponentLabels" );
|
||||||
|
auto HistoryLabels = domain_db->getVector<char>( "HistoryLabels" );
|
||||||
|
size_t NLABELS=LabelList.size();
|
||||||
|
if (rank==0){
|
||||||
|
for (unsigned int idx=0; idx < NLABELS; idx++){
|
||||||
|
char VALUE = LabelList[idx];
|
||||||
|
char NEWVAL = HistoryLabels[idx];
|
||||||
|
printf(" Relabel component %d as %d \n", VALUE, NEWVAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int k=0;k<nz;k++){
|
||||||
|
for (int j=0;j<ny;j++){
|
||||||
|
for (int i=0;i<nx;i++){
|
||||||
|
int n = k*nx*ny+j*nx+i;
|
||||||
|
// Initialize the solid phase
|
||||||
|
if (id[n] == 1) id_solid(i,j,k) = 0;
|
||||||
|
else id_solid(i,j,k) = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Initialize the signed distance function
|
||||||
|
for (int k=0;k<nz;k++){
|
||||||
|
for (int j=0;j<ny;j++){
|
||||||
|
for (int i=0;i<nx;i++){
|
||||||
|
int n = k*nx*ny+j*nx+i;
|
||||||
|
// Initialize distance to +/- 1
|
||||||
|
SignDist(i,j,k) = 2.0*double(id_solid(i,j,k))-1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CalcDist(SignDist,id_solid,*Dm);
|
||||||
|
// re-label IDs near the non-wetting fluid
|
||||||
|
for (int k=0;k<nz;k++){
|
||||||
|
for (int j=0;j<ny;j++){
|
||||||
|
for (int i=0;i<nx;i++){
|
||||||
|
int n = k*nx*ny+j*nx+i;
|
||||||
|
signed char LOCVAL = id[n];
|
||||||
|
for (unsigned int idx=0; idx < NLABELS; idx++){
|
||||||
|
char VALUE=LabelList[idx];
|
||||||
|
char NEWVALUE=HistoryLabels[idx];
|
||||||
|
if (LOCVAL == VALUE){
|
||||||
|
idx = NLABELS;
|
||||||
|
if (SignDist(i,j,k) < 1.0){
|
||||||
|
id[n] = NEWVALUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (rank==0) printf("Writing ID file \n");
|
if (rank==0) printf("Writing ID file \n");
|
||||||
sprintf(LocalRankFilename,"ID.%05i",rank);
|
sprintf(LocalRankFilename,"ID.%05i",rank);
|
||||||
|
Loading…
Reference in New Issue
Block a user