Repository: PMEAL/OpenPNM

Issue:
Add a contrib folder to the top level of openpnm for "works in progress"
After we move to V3.0, we want things to be VERY stable.  This however prevents us from adding new and experimental stuff.  If we had a contrib folder for new things we could warn people that anything in there is subject to change or removal. Candidates for this folder would have been MixedPercolation and the NernstPlanck stuff. 

Discussion:

Patch:
diff --git a/example.py b/example.py
index 13c9ad382..58325a466 100644
--- a/example.py
+++ b/example.py
@@ -18,7 +18,7 @@ phys_water = op.physics.Standard(network=pn, phase=water, geometry=geo)
 phys_hg = op.physics.Standard(network=pn, phase=hg, geometry=geo)
 
 # %% Perform porosimetry simulation
-mip = op.algorithms.Porosimetry(network=pn, phase=hg)
+mip = op.metrics.Porosimetry(network=pn, phase=hg)
 mip.set_inlets(pores=pn.pores(['top', 'bottom']))
 mip.run()
 hg.update(mip.results(Pc=70000))
diff --git a/openpnm/algorithms/__init__.py b/openpnm/algorithms/__init__.py
index 4876ca7e2..b3a36810d 100644
--- a/openpnm/algorithms/__init__.py
+++ b/openpnm/algorithms/__init__.py
@@ -26,10 +26,9 @@ from ._ohmic_conduction import *
 
 from ._ordinary_percolation import *
 from ._invasion_percolation import *
-from ._mixed_invasion_percolation import *
-from ._mixed_invasion_percolation_coop import *
 
-from ._porosimetry import *
+from ._mixed_ip import *
+from ._mixed_ip_coop import *
 
 from ._ionic_conduction import *
 from ._transient_ionic_conduction import *
diff --git a/openpnm/algorithms/_mixed_invasion_percolation.py b/openpnm/algorithms/_mixed_ip.py
similarity index 99%
rename from openpnm/algorithms/_mixed_invasion_percolation.py
rename to openpnm/algorithms/_mixed_ip.py
index 0a7c29f33..17b56b381 100644
--- a/openpnm/algorithms/_mixed_invasion_percolation.py
+++ b/openpnm/algorithms/_mixed_ip.py
@@ -2,6 +2,7 @@ r"""
 ========================
 MixedInvasionPercolation
 ========================
+
 IP allowing pores and throats to invade separately.
 
 """
@@ -14,6 +15,7 @@ from openpnm.utils import logging, SettingsAttr, Docorator
 docstr = Docorator()
 logger = logging.getLogger(__name__)
 
+
 __all__ = ['MixedInvasionPercolation']
 
 
diff --git a/openpnm/algorithms/_mixed_invasion_percolation_coop.py b/openpnm/algorithms/_mixed_ip_coop.py
similarity index 99%
rename from openpnm/algorithms/_mixed_invasion_percolation_coop.py
rename to openpnm/algorithms/_mixed_ip_coop.py
index 83fd22172..1171e8521 100644
--- a/openpnm/algorithms/_mixed_invasion_percolation_coop.py
+++ b/openpnm/algorithms/_mixed_ip_coop.py
@@ -2,6 +2,7 @@ r"""
 ============================
 MixedInvasionPercolationCoop
 ============================
+
 IP allowing pores and throats to invade separately with added cooperative
 filling algorithms.
 
@@ -16,6 +17,7 @@ from openpnm.utils import logging, SettingsAttr, Docorator
 docstr = Docorator()
 logger = logging.getLogger(__name__)
 
+
 __all__ = ['MixedInvasionPercolationCoop']
 
 
diff --git a/openpnm/contrib/__init__.py b/openpnm/contrib/__init__.py
new file mode 100644
index 000000000..73d27b4c6
--- /dev/null
+++ b/openpnm/contrib/__init__.py
@@ -0,0 +1,12 @@
+r"""
+contrib
+-------
+
+This module contains contributions to OpenPNM, both from the developers as
+well as users that are not ready to be officially included but are worth
+sharing. These are subject to api changes, being moved, and potentially
+removed.
+
+"""
+
+pass
diff --git a/openpnm/metrics/__init__.py b/openpnm/metrics/__init__.py
index 4cb85f026..7f1b74d29 100644
--- a/openpnm/metrics/__init__.py
+++ b/openpnm/metrics/__init__.py
@@ -8,6 +8,7 @@ This module provides a library of preconfigured algorithms.
 
 from ._generic_metric import GenericMetric
 from ._generic_transport_metrics import GenericTransportMetrics
+from ._porosimetry import Porosimetry
 from ._mercury_intrusion import MercuryIntrusion
 from ._formation_factor import FormationFactor
 from ._pnflow import PNFlow
diff --git a/openpnm/metrics/_mercury_intrusion.py b/openpnm/metrics/_mercury_intrusion.py
index 6b9a8dd0c..d2afc3889 100644
--- a/openpnm/metrics/_mercury_intrusion.py
+++ b/openpnm/metrics/_mercury_intrusion.py
@@ -2,7 +2,7 @@ import numpy as np
 from openpnm.utils import logging
 from openpnm.phases import Mercury
 from openpnm.physics import GenericPhysics
-from openpnm.algorithms import Porosimetry
+from openpnm.metrics import Porosimetry
 from openpnm import models
 from openpnm import topotools
 logger = logging.getLogger(__name__)
diff --git a/openpnm/algorithms/_porosimetry.py b/openpnm/metrics/_porosimetry.py
similarity index 100%
rename from openpnm/algorithms/_porosimetry.py
rename to openpnm/metrics/_porosimetry.py
diff --git a/setup.py b/setup.py
index 44a188f5b..d84c862f0 100644
--- a/setup.py
+++ b/setup.py
@@ -66,7 +66,10 @@ setup(
         'openpnm.models.geometry',
         'openpnm.models.phases',
         'openpnm.models.physics',
+        'openpnm.contrib',
         'openpnm.algorithms',
+        'openpnm.solvers',
+        'openpnm.integrators',
         'openpnm.metrics',
         'openpnm.topotools',
         'openpnm.topotools.generators',


Test patch:
diff --git a/tests/unit/algorithms/MixedPercolationCoopTest.py b/tests/unit/algorithms/MixedPercolationCoopTest.py
index bb7ccc548..bcbe2dc99 100644
--- a/tests/unit/algorithms/MixedPercolationCoopTest.py
+++ b/tests/unit/algorithms/MixedPercolationCoopTest.py
@@ -101,6 +101,7 @@ class MixedPercolationCoopTest:
 
 if __name__ == '__main__':
     t = MixedPercolationCoopTest()
+    self = t
     t.setup_class()
     for item in t.__dir__():
         if item.startswith('test'):
diff --git a/tests/unit/algorithms/MixedPercolationTest.py b/tests/unit/algorithms/MixedPercolationTest.py
index 0dfbc9bc6..59c6b6840 100644
--- a/tests/unit/algorithms/MixedPercolationTest.py
+++ b/tests/unit/algorithms/MixedPercolationTest.py
@@ -460,6 +460,7 @@ class MixedPercolationTest:
 
 if __name__ == '__main__':
     t = MixedPercolationTest()
+    self = t
     t.setup_class()
     for item in t.__dir__():
         if item.startswith('test'):
diff --git a/tests/unit/algorithms/PorosimetryTest.py b/tests/unit/metrics/PorosimetryTest.py
similarity index 95%
rename from tests/unit/algorithms/PorosimetryTest.py
rename to tests/unit/metrics/PorosimetryTest.py
index 4b466d1bc..d27072d5e 100644
--- a/tests/unit/algorithms/PorosimetryTest.py
+++ b/tests/unit/metrics/PorosimetryTest.py
@@ -20,7 +20,7 @@ class PorosimetryTest:
                             model=mod)
 
     def test_no_late_filling(self):
-        mip = op.algorithms.Porosimetry(network=self.net, phase=self.hg)
+        mip = op.metrics.Porosimetry(network=self.net, phase=self.hg)
         mip.set_inlets(pores=self.net.pores('left'))
         mip.run()
         assert len(np.unique(mip['pore.invasion_pressure'])) > 1
@@ -29,7 +29,7 @@ class PorosimetryTest:
         assert len(np.unique(mip['throat.invasion_sequence'])) > 1
 
     def test_late_pore_and_throat_filling(self):
-        mip = op.algorithms.Porosimetry(network=self.net, phase=self.hg)
+        mip = op.metrics.Porosimetry(network=self.net, phase=self.hg)
         mip.set_inlets(pores=self.net.pores('left'))
         # Run without late pore filling
         mip.run()