EcohydrologyTeam / ClearWater-riverine

A 2D water quality transporter model to calculate conservative advection and diffusion of constituents from an unstructured grid of flows
MIT License
6 stars 0 forks source link

reduce matrix size when there are dry cells #68

Open sjordan29 opened 4 months ago

sjordan29 commented 4 months ago

Matrices can be reduced in size when there are dry cells to potentially reduce memory and solve time.

Currently, if there is a dry cell, a placeholder value is placed in the diagonal of the matrix so that the matrix can be inverted. However, a more elegant solution would be to remove dry (unnecessary) rows/columns from the matrix entirely. We would need to assign the matrix row and column indices to their corresponding cell indices in the mesh and reassign the solved concentration values to the proper cells after solving.

Furthermore, if a cell is dry over the entire simulation horizon, we could potentially remove it from the simulation entirely and free up memory (both in the matrix and in the model mesh itself) to help with #61.