je-santos / MPLBM-UT

Library for performing multiphase simulations (based on the Shan-Chen model) in complicated geometries (i.e. porous media 3D images)
GNU General Public License v3.0
154 stars 59 forks source link

Steady state rel perm initial conditions #60

Closed alexgigliotti closed 2 years ago

alexgigliotti commented 2 years ago

Generating an initial non-wetting/invading fluid configuration for steady state simulations would be great. Ideally this would exist as a python utility that automatically generates .dat files that ShanChen.cpp can read in.

Options:

jgostick commented 2 years ago

Hi @je-santos, we'd be happy to chip in! Can you clarify what sort of initial conditions you're looking for? You can probably generate your own MIO as you suggest above...it's about 4 steps, the hardest part is trimming the disconnected clusters to mimic the access limitations. You can either use ours or I can contribute a version to your code.

However, you can also use our new invasion percolation algorithm...which is probably more like LBM. On a related note, I have cooked up a MUCH faster version of this algorithm.

je-santos commented 2 years ago

Hi Jeff,

We are trying to come up with something that has the ability to generate realizations of fluid configurations with the same saturation.

This could be good for (1) different applications where primary drainage does not necessarily represent the initial fluid configuration; and (2) investigating the distribution and hysteresis of relative permeability values.

James McClure has a workflow where he "seeds" large-pore regions with NW fluid, but this could be problematic in some pathological cases. It seems that it works well for spherepacks and nice sandstones.

This is more of a research-ey project than a well established workflow, so we would like to hear what you think.

jgostick commented 2 years ago

Hi Javier I'm excited to share this movie. It's a 2D "ibip" simulation on an 800x800 image with a new algorithm behind the scenes. The end result is exactly the same, but it's about 10x faster. It took 30 seconds to run the simulation below, and then about 2 minutes to generate the movie! Totally worth the wait.

ibip1

The color corresponds to the saturation, so given the final image you can apply a threshold of s<=0.5 to get the fluid configuration at s_nwp=0.5. The inlets in this picture are at the bottom, but they can be placed anywhere, including inside the domain. This mimics quasi-static invasion, not viscous effects, so that could be a decent starting point I guess. I have not extended this new version to 3D, but I expect it to be an even bigger speed improvement.

Regarding your point about about applications where primary drainage is NOT representative, then I'm not sure the above will help. Maybe you could use a local thickness map, and threshold that? That sounds a bit like James McClure's approach though.

local_thickness

The above was generated using:


import porespy as ps
import numpy as np
import matplotlib.pyplot as plt
im = ps.generators.blobs(shape=[800, 800], porosity=0.7, blobiness=1.5)
lt = ps.filters.local_thickness(im=im, sizes=100)
satn = ps.filters.size_to_satn(size=lt)
plt.imshow(satn, origin='lower', interpolation='none')

It is also possible to simulate imbibition using these image based approaches, but I don't think it's as convincing at the drainage. You basically run the algorithm backwards, but invading the the smallest pore regions first. The fluid path is slightly different than the drainage since the connectivity of the phases is different. I have a working draft of an image-based imbibition algorithm I can share if that is of interest.

Anyway, sorry for my ramblings, just throwing out some ideas.

je-santos commented 2 years ago

Jeff,

This is really neat! Thanks a lot for sharing.

How do you think the 3D run times will scale? i.e. in a 800^3?

@alexgigliotti what do you think?

jgostick commented 2 years ago

Hi @je-santos, 800^3 would take quite a while with the implementation in porespy at this time, but would still be a LOT faster than LBM. I will try to get my new approach working on 3D in the near future (probably mid-late april) and I'll let you know how that migth do RE speed.

je-santos commented 2 years ago

Hi @jgostick ,

Alex coded a nice example using PoreSpy. In the following weeks we would like to explore the effect of different ways of initializing the nw fluid wrt the energy landscape and convergence.

Summary: https://github.com/je-santos/MPLBM-UT/pull/65 Example: https://github.com/je-santos/MPLBM-UT/tree/master/examples/steady_state_relperm