OpenPNM icon indicating copy to clipboard operation
OpenPNM copied to clipboard

Pore-scale model factory

Open ma-sadeghi opened this issue 5 years ago • 2 comments

The idea is to write a method that serves as a factory for pore-scale models. For instance, let's say you want to use a peculiar rate equation as source term, but don't want to bother writing an actual OpenPNM-compatible pore-scale model. Here's the API that I had in mind:

def my_peculiar_rate_eqn(c_A, c_B, T):
    return (c_A + c_B)**2 * np.exp(T/500)

from openpnm.models.misc import model_builder
custom_rate_model = model_builder(func=my_peculiar_rate_eqn,
                                  c_A="pore.c_A",
                                  c_B="pore.c_B",
                                  T="pore.temperature")
phys.add_model(propname="pore.rxn", model=custom_rate_model)

This is sort of related to issue #653. Although it only seems like a wrapper, I think it makes it easier for writing custom pore-scale models, especially for those less experienced in OpenPNM.

ma-sadeghi avatar Dec 19 '19 20:12 ma-sadeghi

Another convenience that could come with this model factory is doing proper mapping based on which object on which the model is added, which is usually something that most beginners.

ma-sadeghi avatar Feb 19 '20 20:02 ma-sadeghi

I think I see some value here. I'm going to reopen it and add it to future enhancements.

jgostick avatar Jun 06 '22 14:06 jgostick

Given that our new philosophy is the keep things simple and stop adding frills just for the thrills, I think we should forget about this. There is ample instruction on how to create a pore-scale model in the docs now.

jgostick avatar Jun 21 '23 12:06 jgostick