Print initial wetting phase volume fraction

This commit is contained in:
James E McClure 2018-06-29 15:13:35 -04:00
parent 1129d7eae5
commit 66bf045b07

View File

@ -357,9 +357,10 @@ void ScaLBL_ColorModel::Initialize(){
* This function initializes model
*/
AssignSolidPotential();
AssignSolidPotential();
int rank=Dm->rank();
double count_wet=0.f;
double count_wet_global;
double *PhaseLabel;
PhaseLabel=new double [Nx*Ny*Nz];
for (int k=1; k<Nz-1; k++){
@ -378,7 +379,8 @@ void ScaLBL_ColorModel::Initialize(){
}
}
}
//printf("sw=%f \n",count_wet/double(Np));
MPI_Allreduce(&count_wet,&count_wet_global,1,MPI_DOUBLE,MPI_SUM,comm);
if (rank==0) printf("Wetting phase volume fraction =%f \n",count_wet_global/double(Nx*Ny*Nz*nprocs));
// initialize phi based on PhaseLabel (include solid component labels)
ScaLBL_CopyToDevice(Phi, PhaseLabel, Np*sizeof(double));
//...........................................................................
@ -403,18 +405,18 @@ void ScaLBL_ColorModel::Initialize(){
// Read in the restart file to CPU buffers
double *cPhi = new double[Np];
double *cDist = new double[19*Np];
ifstream File(LocalRestartFile,ios::binary);
double value;
for (int n=0; n<Np; n++){
File.read((char*) &value, sizeof(value));
cPhi[n] = value;
// Read the distributions
for (int q=0; q<19; q++){
File.read((char*) &value, sizeof(value));
cDist[q*Np+n] = value;
}
}
File.close();
ifstream File(LocalRestartFile,ios::binary);
double value;
for (int n=0; n<Np; n++){
File.read((char*) &value, sizeof(value));
cPhi[n] = value;
// Read the distributions
for (int q=0; q<19; q++){
File.read((char*) &value, sizeof(value));
cDist[q*Np+n] = value;
}
}
File.close();
// Copy the restart data to the GPU
ScaLBL_CopyToDevice(fq,cDist,19*Np*sizeof(double));
ScaLBL_CopyToDevice(Phi,cPhi,Np*sizeof(double));