PMEAL / porespy

A set of tools for characterizing and analying 3D images of porous materials
https://porespy.org
MIT License
301 stars 98 forks source link

Add flux tolerance as argument to `tortuosity_fd` (and possibly other effective solvers in the future) #850

Open ma-sadeghi opened 1 year ago

ma-sadeghi commented 1 year ago

Currently, tortuosity_fd accepts residual tolerance, but internally once the solve phase finishes it checks whether the inlet and outlet fluxes match within a hardcoded tolerance of 1e-4. I think it makes sense for our effective property solvers (tortuosity for now, but permeability in the future) to accept flux tolerance rather than residual tolerance. Here's how I think it can be implemented:

  1. Choose an initial residual tolerance tol0=1e-1 that's not very stringent
  2. Pass tol=tol0 to PyAMG solver and solve Ax = b
  3. Calculate rate at inlet and outlet, i.e., fd.rate(...)
  4. Check convergence based on flux tolerance (user-defined)
  5. If satisfied, end, if not halve the residual tolerance and go to Step 2.
jgostick commented 3 months ago

This is actually a good idea...like a physically meaningful tolerance rather than an abstract mathematical one. Given this wrapper is meant to be helpful, this seems a step in that direction.