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

@ -356,10 +356,11 @@ void ScaLBL_ColorModel::Initialize(){
/* /*
* This function initializes model * This function initializes model
*/ */
AssignSolidPotential(); AssignSolidPotential();
int rank=Dm->rank(); int rank=Dm->rank();
double count_wet=0.f; double count_wet=0.f;
double count_wet_global;
double *PhaseLabel; double *PhaseLabel;
PhaseLabel=new double [Nx*Ny*Nz]; PhaseLabel=new double [Nx*Ny*Nz];
for (int k=1; k<Nz-1; k++){ for (int k=1; k<Nz-1; k++){
@ -378,14 +379,15 @@ 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) // initialize phi based on PhaseLabel (include solid component labels)
ScaLBL_CopyToDevice(Phi, PhaseLabel, Np*sizeof(double)); ScaLBL_CopyToDevice(Phi, PhaseLabel, Np*sizeof(double));
//........................................................................... //...........................................................................
if (rank==0) printf ("Initializing distributions \n"); if (rank==0) printf ("Initializing distributions \n");
ScaLBL_D3Q19_Init(fq, Np); ScaLBL_D3Q19_Init(fq, Np);
if (Restart == true){ if (Restart == true){
if (rank==0){ if (rank==0){
printf("Reading restart file! \n"); printf("Reading restart file! \n");
@ -403,18 +405,18 @@ void ScaLBL_ColorModel::Initialize(){
// Read in the restart file to CPU buffers // Read in the restart file to CPU buffers
double *cPhi = new double[Np]; double *cPhi = new double[Np];
double *cDist = new double[19*Np]; double *cDist = new double[19*Np];
ifstream File(LocalRestartFile,ios::binary); ifstream File(LocalRestartFile,ios::binary);
double value; double value;
for (int n=0; n<Np; n++){ for (int n=0; n<Np; n++){
File.read((char*) &value, sizeof(value)); File.read((char*) &value, sizeof(value));
cPhi[n] = value; cPhi[n] = value;
// Read the distributions // Read the distributions
for (int q=0; q<19; q++){ for (int q=0; q<19; q++){
File.read((char*) &value, sizeof(value)); File.read((char*) &value, sizeof(value));
cDist[q*Np+n] = value; cDist[q*Np+n] = value;
} }
} }
File.close(); File.close();
// Copy the restart data to the GPU // Copy the restart data to the GPU
ScaLBL_CopyToDevice(fq,cDist,19*Np*sizeof(double)); ScaLBL_CopyToDevice(fq,cDist,19*Np*sizeof(double));
ScaLBL_CopyToDevice(Phi,cPhi,Np*sizeof(double)); ScaLBL_CopyToDevice(Phi,cPhi,Np*sizeof(double));
@ -423,7 +425,7 @@ void ScaLBL_ColorModel::Initialize(){
delete [] cDist; delete [] cDist;
MPI_Barrier(comm); MPI_Barrier(comm);
} }
if (rank==0) printf ("Initializing phase field \n"); if (rank==0) printf ("Initializing phase field \n");
ScaLBL_DFH_Init(Phi, Den, Aq, Bq, 0, ScaLBL_Comm->LastExterior(), Np); ScaLBL_DFH_Init(Phi, Den, Aq, Bq, 0, ScaLBL_Comm->LastExterior(), Np);
ScaLBL_DFH_Init(Phi, Den, Aq, Bq, ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np); ScaLBL_DFH_Init(Phi, Den, Aq, Bq, ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);