Merge branch 'master' of github.com:JamesEMcClure/LBPM-WIA

This commit is contained in:
James E McClure 2022-01-26 05:05:15 -05:00
commit e68e1f4dfa
6 changed files with 25 additions and 20 deletions

View File

@ -137,8 +137,7 @@ void Morphology::Initialize(std::shared_ptr<Domain> Dm, DoubleArray &Distance) {
morphRadius.resize(recvLoc);
//..............................
/* send the morphological radius */
Dm->Comm.Irecv(&morphRadius[recvOffset_x], recvCount, Dm->rank_x(),
recvtag + 0);
Dm->Comm.Irecv(&morphRadius[recvOffset_x], recvCount, Dm->rank_x(), recvtag + 0);
Dm->Comm.send(&tmpDistance[0], sendCount, Dm->rank_X(), sendtag + 0);
/* send the shift values */
Dm->Comm.Irecv(&xShift[recvOffset_x], recvCount, Dm->rank_x(), recvtag + 1);
@ -502,7 +501,7 @@ double MorphOpen(DoubleArray &SignDist, signed char *id,
if (rank == 0)
printf("Maximum pore size: %f \n", maxdistGlobal);
final_void_fraction = volume_fraction; //initialize
int ii, jj, kk;
int imin, jmin, kmin, imax, jmax, kmax;
int Nx = nx;
@ -524,27 +523,28 @@ double MorphOpen(DoubleArray &SignDist, signed char *id,
int numTry = 0;
int maxTry = 100;
while (void_fraction_new > VoidFraction && numTry < maxTry) {
while ( !(void_fraction_new < VoidFraction) && numTry < maxTry) {
numTry++;
void_fraction_diff_old = void_fraction_diff_new;
void_fraction_old = void_fraction_new;
Rcrit_old = Rcrit_new;
Rcrit_new -= deltaR * Rcrit_old;
if (rank==0) printf("Try %i with radius %f \n", numTry, Rcrit_new);
if (Rcrit_new < 0.5) {
numTry = maxTry;
}
int Window = round(Rcrit_new);
if (Window == 0)
Window =
1; // If Window = 0 at the begining, after the following process will have sw=1.0
Window = 1; // If Window = 0 at the begining, after the following process will have sw=1.0
// and sw<Sw will be immediately broken
double LocalNumber = 0.f;
for (int k = 0; k < Nz; k++) {
for (int j = 0; j < Ny; j++) {
for (int i = 0; i < Nx; i++) {
for (int k = 1; k < Nz-1; k++) {
for (int j = 1; j < Ny-1; j++) {
for (int i = 1; i < Nx-1; i++) {
n = k * nx * ny + j * nx + i;
if (SignDist(i, j, k) > Rcrit_new) {
// loop over the window and update
//printf("Distance(%i %i %i) = %f \n",i,j,k, SignDist(i,j,k));
imin = max(1, i - Window);
jmin = max(1, j - Window);
kmin = max(1, k - Window);
@ -571,7 +571,7 @@ double MorphOpen(DoubleArray &SignDist, signed char *id,
}
}
}
LocalNumber += Structure.GetOverlaps(Dm, id, ErodeLabel, NewLabel);
//LocalNumber += Structure.GetOverlaps(Dm, id, ErodeLabel, NewLabel);
count = 0.f;
for (int k = 1; k < Nz - 1; k++) {

View File

@ -6,7 +6,9 @@ LBPM includes specialized data analysis capabilities for two-fluid systems. Whil
components are generally designed for in situ analysis of simulation data, they can also
be applied independently to analyze 3D image data. In this example we consider applying
the analysis tools implemented in ``lbpm_TwoPhase_analysis``, which are designed to
analyze two-fluid configurations in porous media.
analyze two-fluid configurations in porous media. The numerical implementation used to
construct the common line are described in ( https://doi.org/10.1016/j.advwatres.2006.06.010 ).
Methods used to measure the contact angle are described in ( https://doi.org/10.1017/jfm.2016.212 ).
Source files for the example are included in the LBPM repository
in the directory ``examples/Droplet``. A simple python code is included

View File

@ -1,13 +1,15 @@
============
\============
Publications
============
* James E McClure, Zhe Li, Mark Berrill, Thomas Ramstad, "The LBPM software package for simulating multiphase flow on digital images of porous rocks" Computational Geosciences (25) 871895 (2021) https://doi.org/10.1007/s10596-020-10028-9
* J.E. McClure, Z. Li, M. Berrill, T. Ramstad, "The LBPM software package for simulating multiphase flow on digital images of porous rocks" Computational Geosciences (25) 871895 (2021) https://doi.org/10.1007/s10596-020-10028-9
* James E. McClure, Zhe Li, Adrian P. Sheppard, Cass T. Miller, "An adaptive volumetric flux boundary condition for lattice Boltzmann methods" Computers & Fluids (210) (2020) https://doi.org/10.1016/j.compfluid.2020.104670
* J. E. McClure, Z. Li, A.P. Sheppard, C.T. Miller, "An adaptive volumetric flux boundary condition for lattice Boltzmann methods" Computers & Fluids (210) (2020) https://doi.org/10.1016/j.compfluid.2020.104670
* Y.D. Wang, T. Chung, R.T. Armstrong, J. McClure, T. Ramstad, P. Mostaghimi, "Accelerated Computation of Relative Permeability by Coupled Morphological and Direct Multiphase Flow Simulation" Journal of Computational Physics (401) (2020) https://doi.org/10.1016/j.jcp.2019.108966
* J.E. McClure, M. Berrill, W. Gray, C.T. Miller, C.T. "Tracking interface and common curve dynamics for two-fluid flow in porous media. Journal of Fluid Mechanics, 796, 211-232 (2016) https://doi.org/10.1017/jfm.2016.212
* J.E.McClure, D.Adalsteinsson, C.Pan, W.G.Gray, C.T.Miller "Approximation of interfacial properties in multiphase porous medium systems" Advances in Water Resources, 30 (3): 354-365 (2007) https://doi.org/10.1016/j.advwatres.2006.06.010

View File

@ -120,7 +120,7 @@ two fluids are permitted to freely mix between the endpoints. Beyond the endpoin
term is used to drive spontaneous imbibition into the grey voxels
..math::
.. math::
:nowrap:
$$

View File

@ -81,7 +81,7 @@ int main(int argc, char **argv)
id = new signed char [N];
Mask->Decomp(READFILE);
Mask->CommInit();
// Generate the NWP configuration
//if (rank==0) printf("Initializing morphological distribution with critical radius %f \n", Rcrit);
if (rank==0) printf("Performing morphological opening with target saturation %f \n", SW);

View File

@ -94,10 +94,11 @@ int main(int argc, char **argv)
printf(" Measure the opening \n");
sphere.MeasureObject();
//sphere.ComputeScalar(Distance,0.f);
printf(" Volume = %f (analytical = %f) \n", sphere.Vi,0.256*0.33333333333333*3.14159*double((Nx-2)*(Nx-2)*(Nx-2)));
double error = fabs(sphere.Vi - 0.256*0.33333333333333*3.14159*double((Nx-2)*(Nx-2)*(Nx-2)))/ (0.256*0.33333333333333*3.14159*double((Nx-2)*(Nx-2)*(Nx-2)));
/* Note 0.856 = (0.95)^3 */
printf(" Volume = %f (analytical = %f) \n", sphere.Vi,0.256*0.33333333333333*0.856*3.14159*double((Nx-2)*(Nx-2)*(Nx-2)));
double error = fabs(sphere.Vi - 0.256*0.856*0.33333333333333*3.14159*double((Nx-2)*(Nx-2)*(Nx-2)))/ (0.256*0.33333333333333*3.14159*double((Nx-2)*(Nx-2)*(Nx-2)));
printf(" Relative error %f \n", error);
if (error > 0.03){
if (error > 0.05){
toReturn = 10;
printf("ERROR (test_morph): difference from analytical volume is too large\n");