Skip to content

Inactive cells in Porepy? #532

Answered by keileg
rafaelmarch3 asked this question in Q&A
Discussion options

You must be logged in to vote

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 wo…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rafaelmarch3
Comment options

Answer selected by rafaelmarch3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants