diff --git a/tests/lbpm_permeability_simulator.cpp b/tests/lbpm_permeability_simulator.cpp index 9d624b1c..7d2a607f 100644 --- a/tests/lbpm_permeability_simulator.cpp +++ b/tests/lbpm_permeability_simulator.cpp @@ -238,7 +238,7 @@ int main(int argc, char **argv) printf("********************************************************\n"); } - // Initialized domain and averaging framework for Two-Phase Flow + double viscosity=(tau-0.5)/3.0; // Initialized domain and averaging framework for Two-Phase Flow int BC=pBC; Domain Dm(Nx,Ny,Nz,rank,nprocx,nprocy,nprocz,Lx,Ly,Lz,BC); @@ -249,7 +249,7 @@ int main(int argc, char **argv) rank_xy, rank_XY, rank_xY, rank_Xy, rank_xz, rank_XZ, rank_xZ, rank_Xz, rank_yz, rank_YZ, rank_yZ, rank_Yz ); - MPI_Barrier(MPI_COMM_WORLD); + MPI_Barrier(MPI_COMM_WORLD); Nz += 2; Nx = Ny = Nz; // Cubic domain @@ -906,6 +906,8 @@ int main(int argc, char **argv) AllocateDeviceMemory((void **) &dvcSignDist, dist_mem_size); AllocateDeviceMemory((void **) &Velocity, 3*dist_mem_size); //........................................................................... + double *Vel; + Vel = new double [N]; // Copy signed distance for device initialization CopyToDevice(dvcSignDist, Averages.SDs.get(), dist_mem_size); @@ -926,6 +928,24 @@ int main(int argc, char **argv) // Finalize setup for averaging domain Averages.SetupCubes(Dm); Averages.UpdateSolid(); + // Initialize two phase flow variables (all wetting phase) + for (k=0;k0){ + vawx+=Vel[n]; + vawy+=Vel[N+n]; + vawz+=Vel[2*N+n]; + Vw+=1.0; + } + } + } + } + // Reduce to get the global averages + MPI_Barrier(MPI_COMM_WORLD); + MPI_Allreduce(&vawx,&vawx_global,1,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD); + MPI_Allreduce(&vawy,&vawy_global,1,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD); + MPI_Allreduce(&vawz,&vawz_global,1,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD); + MPI_Allreduce(&Vw,&Vw_global,1,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD); + MPI_Barrier(MPI_COMM_WORLD); + // Compute volume averaged velocity + vawx = vawx_global/Vw_global; + vawy = vawy_global/Vw_global; + vawz = vawz_global/Vw_global; + + // Way more work than necessary -- this is just to get the solid interfacial area!! + Averages.Initialize(); + Averages.UpdateMeshValues(); + Averages.ComputeLocal(); + Averages.Reduce(); + + if (rank==0){ + // ************* DIMENSIONLESS FORCHEIMER EQUATION ************************* + // Dye, A.L., McClure, J.E., Gray, W.G. and C.T. Miller + // Description of Non-Darcy Flows in Porous Medium Systems + // Physical Review E 87 (3), 033012 + // Fo := density*reference_length^3*(density*force) / (viscosity^2) + // Re := density*reference_length*velocity / viscosity + // Fo = a*Re + b*Re^2 + // ************************************************************************* + //viscosity = (tau-0.5)*0.333333333333333333; + double D32 = 6.0*(Dm.Volume-Vw_global)/Averages.As_global; + printf("Sauter Mean Diameter = %f \n",D32); + double mag_force = sqrt(Fx*Fx+Fy*Fy+Fz*Fz); + double Fo = reference_length*D32*D32*mag_force/viscosity/viscosity; + // .... 1-D flow should be aligned with force ... + double velocity = vawx*Fx/mag_force + vawy*Fy/mag_force + + vawz*Fz/mag_force; + double err1D = fabs((velocity-sqrt(vawx*vawx+vawy*vawy+vawz*vawz))/velocity; + //.......... Computation of the Reynolds number Re .............. + double Re = D32*velocity/viscosity; + printf("Relative error for 1D representation: %f \n",err1D); + printf("Dimensionless force: %f \n", Fo); + printf("Reynolds number: %f \n", Re); + printf("Permeability: %f \n", Re/Fo); + } } } //************************************************************************/