PMEAL / OpenPNM

A Python package for performing pore network modeling of porous media
http://openpnm.org
MIT License
453 stars 174 forks source link

Add a Reaction class to Algorithms #726

Closed jgostick closed 6 years ago

jgostick commented 7 years ago

At present, the 'source/sink' functionality is embedded deep in the GenericLinearTransport class. This means it cannot be used by new classes, such as transient, stefan-maxwell, or advection. We need to find a way to pluck this code out of GenericLinearTransport and into some sort of general class that others can hook into.

My first idea is this: create a Reactions class, that gets associated with any transport class using a add_source_term function, then in the given transport class have it check to see if a Reaction class has been registered...if so then upon run it will pass the current values of A, b and x to it, the Reaction class will insert S1x and S2 into the A and b matrix, then call the transport classes run again, which will trigger the same process. Eventually the Reaction class will be happy that x has converged and will not call run again.

Anyway, this is a major urgent need for V2, so we need to think about it.

jgostick commented 6 years ago

After too much debating and discussing, we finally decided that reactions will be part of the Generic Transport family, and algorithms wanting to use it should just inherit properly.