File tree 1 file changed +17
-0
lines changed
tests/unit/models/geometry
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 2
2
import openpnm .models .geometry .pore_surface_area as mods
3
3
import numpy as np
4
4
from numpy .testing import assert_allclose
5
+ import pytest
5
6
6
7
7
8
class PoreSurfaceAreaTest :
@@ -69,6 +70,22 @@ def test_circle_multi_geom(self):
69
70
assert_allclose (a , b )
70
71
assert_allclose (c , d )
71
72
73
+ def test_negative_surface_area (self ):
74
+ pn = op .network .Cubic ([2 , 1 , 1 ])
75
+ pn .add_model_collection (op .models .collections .geometry .circles_and_rectangles )
76
+ pn .regenerate_models ()
77
+ pn .add_model (propname = 'pore.surface_area' , model = op .models .geometry .pore_surface_area .circle )
78
+ pn ['throat.cross_sectional_area' ] = 100
79
+ pn .regenerate_models ('pore.surface_area@all' )
80
+ assert np .all (pn ['pore.surface_area' ] == 0 )
81
+ with pytest .warns ():
82
+ pn .add_model (
83
+ propname = 'pore.surface_area' ,
84
+ model = op .models .geometry .pore_surface_area .circle ,
85
+ amin = None ,
86
+ )
87
+ assert np .all (pn ['pore.surface_area' ] < 0 )
88
+
72
89
73
90
if __name__ == '__main__' :
74
91
You can’t perform that action at this time.
0 commit comments