Inactive cells in Porepy? #532
-
Hello all, I have one quick question, does PorePy support "active cells", as usual in typical reservoir simulators? I have cartesian grids that are relatively large for the typical scipy sparse solvers, but in some cases many cells do not contribute to fluid flow (k~=0). I would like to assemble a smaller system that leave out these cells. In reservoir simulators you usually do this with active/inactive cells. Any way to achieve this in PorePy? Also, any suggestions of sparse solvers that go a bit beyond spsolve? It's in my todo list to try pyamg and PETSC for Python... Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
We have not implemented an active cell concept; the kind of problems we have been interested in has not called for such tricks. However, If you have the indices of the cells to be eliminated, making a restriction matrix is not difficult; the code will roughly be A = matrix with too many rows and columns
inds = indices_of_active_cells # assumed to be a numpy array
sz = inds.size
R = sps.coo_matrix((np.ones(sz), (np.arange(sz), inds), shape=(sz, A.shape[1]))
A_smaller = R.T * A * R
b_smaller = R * b
x_smaller = spsolve(A_smaller, b_smaller)
x_full = R.T * x_smaller # This will have zeros for the inactive cells There surely is a typo or two in the snippet, but it should not be far from working. As for the solvers, some suggestions:
I hope this is of some help Cheers, |
Beta Was this translation helpful? Give feedback.
We have not implemented an active cell concept; the kind of problems we have been interested in has not called for such tricks. However, If you have the indices of the cells to be eliminated, making a restriction matrix is not difficult; the code will roughly be
There surely is a typo or two in the snippet, but it should not be far from wo…