Skip to content

Commit

Permalink
formatting test_unstructured_grid
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchengtkc committed Jun 15, 2023
1 parent d59c4d7 commit b8f043b
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions tests/unit_tests/property/test_unstructured_grid_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
from resqpy.crs import Crs
# from resqpy.property import property_kind_and_facet_from_keyword, guess_uom


# ---- Test writing properties on Tetra grids, per-cell and per-node ---


def add_tetra_mesh(model):
# add a tetra mesh to the model:
# the "star" mesh definition is copied from unit_tests/unstructured/test_unstructured.py
#
#
tetra = rug.TetraGrid(model, title = 'star')
assert tetra.cell_shape == 'tetrahedral'
crs = Crs(model)
Expand Down Expand Up @@ -83,6 +83,7 @@ def add_tetra_mesh(model):
tetra.check_tetra()
return tetra


def test_properties_on_tetra_grid(tmp_path):

epc = os.path.join(tmp_path, 'tetra_test_prop.epc')
Expand Down Expand Up @@ -117,8 +118,6 @@ def test_properties_on_tetra_grid(tmp_path):

model.store_epc()



model = rq.Model(epc)
assert model is not None

Expand All @@ -130,7 +129,7 @@ def test_properties_on_tetra_grid(tmp_path):
tetra = rug.TetraGrid(model, uuid = tetra_uuid)
assert tetra is not None
assert tetra.cell_shape == 'tetrahedral'

# cells = np.array( [ tetra.distinct_node_indices_for_cell(i) for i in range(tetra.cell_count) ] ) # cell indices are read using this function(?)
tetra.check_tetra()

Expand All @@ -144,14 +143,12 @@ def test_properties_on_tetra_grid(tmp_path):
assert temp_prop.array_ref().shape[0] == tetra.node_count
assert temp_prop.uom() == 'degC'
assert temp_prop.indexable_element() == 'nodes'
assert_array_almost_equal(temp_prop.array_ref(), temp_per_vertex )
assert_array_almost_equal(temp_prop.array_ref(), temp_per_vertex)

poro_uuid = model.uuid(title = 'Porosity')
assert poro_uuid is not None
poro_prop = rqp.Property(model, uuid = poro_uuid)
assert poro_prop.array_ref().shape[0] == tetra.cell_count
assert poro_prop.uom() == 'm3/m3'
assert poro_prop.indexable_element() == 'cells'
assert_array_almost_equal(poro_prop.array_ref(), poro_per_cell )


assert_array_almost_equal(poro_prop.array_ref(), poro_per_cell)

0 comments on commit b8f043b

Please sign in to comment.