From 00b4ca7ff0dd1d54d4857c87557fe3171d58e280 Mon Sep 17 00:00:00 2001 From: Keurfon Luu Date: Sat, 11 Jun 2022 18:56:23 -0700 Subject: [PATCH] invoke format --- test/helpers.py | 2 +- test/test_input.py | 43 +++++-------------- test/test_mesh_methods.py | 23 +++------- test/test_meshio.py | 4 +- test/test_output.py | 7 +-- test/test_react.py | 15 ++----- toughio/_cli/_co2tab.py | 4 +- toughio/_cli/_export.py | 29 +++---------- toughio/_cli/_extract.py | 8 +--- toughio/_cli/_merge.py | 4 +- toughio/_cli/_save2incon.py | 14 ++---- toughio/_common.py | 22 ++-------- toughio/_io/input/tough/_helpers.py | 10 +---- toughio/_io/input/tough/_read.py | 6 +-- .../_io/input/toughreact_chemical/_read.py | 5 +-- toughio/_mesh/_common.py | 2 +- toughio/_mesh/_helpers.py | 7 +-- toughio/_mesh/_mesh.py | 11 +---- toughio/_mesh/_properties.py | 4 +- toughio/_mesh/flac3d/_flac3d.py | 14 +----- toughio/_mesh/tough/_tough.py | 13 ++---- toughio/capillarity/_pickens.py | 2 +- toughio/meshmaker/_cylindric_grid.py | 7 +-- toughio/meshmaker/_helpers.py | 7 +-- toughio/relative_permeability/_corey.py | 4 +- .../relative_permeability/_fatt_klikoff.py | 2 +- toughio/relative_permeability/_grant.py | 2 +- toughio/relative_permeability/_pickens.py | 2 +- .../_van_genuchten_mualem.py | 4 +- toughio/relative_permeability/_verma.py | 4 +- 30 files changed, 66 insertions(+), 215 deletions(-) diff --git a/test/helpers.py b/test/helpers.py index c81f2a83..702a8373 100644 --- a/test/helpers.py +++ b/test/helpers.py @@ -134,7 +134,7 @@ def random_label(label_length): n = label_length - 3 fmt = "{{:0{}d}}".format(n) - return random_string(3) + fmt.format(np.random.randint(10**n)) + return random_string(3) + fmt.format(np.random.randint(10 ** n)) def allclose_dict(a, b, atol=1.0e-8): diff --git a/test/test_input.py b/test/test_input.py index b843becf..a7baa2bc 100644 --- a/test/test_input.py +++ b/test/test_input.py @@ -9,15 +9,11 @@ ) write_read_tough = lambda x: write_read( - x, - writer_kws={"file_format": "tough"}, - reader_kws={"file_format": "tough"}, + x, writer_kws={"file_format": "tough"}, reader_kws={"file_format": "tough"}, ) write_read_json = lambda x: write_read( - x, - writer_kws={"file_format": "json"}, - reader_kws={"file_format": "json"}, + x, writer_kws={"file_format": "json"}, reader_kws={"file_format": "json"}, ) @@ -244,8 +240,7 @@ def test_ncgas(write_read): @pytest.mark.parametrize( - "write_read, isothermal", - [(write_read_tough, True), (write_read_tough, False)], + "write_read, isothermal", [(write_read_tough, True), (write_read_tough, False)], ) def test_multi(write_read, isothermal): import random @@ -409,9 +404,7 @@ def test_indom(write_read, num_pvars, num_items): num_items = num_items if num_items else np.random.randint(10) + 1 parameters_ref = { "rocks": { - helpers.random_string(5): { - "initial_condition": np.random.rand(num_pvars), - } + helpers.random_string(5): {"initial_condition": np.random.rand(num_pvars),} for _ in range(num_items) }, } @@ -785,18 +778,9 @@ def test_meshm_xyz(): "n_increment": np.random.randint(100) + 1, "sizes": np.random.rand(), }, - { - "type": "ny", - "sizes": np.random.rand(np.random.randint(100) + 1), - }, - { - "type": "nz", - "sizes": np.random.rand(np.random.randint(100) + 1), - }, - { - "type": "nx", - "sizes": np.random.rand(np.random.randint(100) + 1), - }, + {"type": "ny", "sizes": np.random.rand(np.random.randint(100) + 1),}, + {"type": "nz", "sizes": np.random.rand(np.random.randint(100) + 1),}, + {"type": "nx", "sizes": np.random.rand(np.random.randint(100) + 1),}, ], "angle": np.random.rand(), } @@ -830,10 +814,7 @@ def test_meshm_rz2d(layer): "meshmaker": { "type": "rz2dl" if layer else "rz2d", "parameters": [ - { - "type": "radii", - "radii": np.random.rand(np.random.randint(100) + 1), - }, + {"type": "radii", "radii": np.random.rand(np.random.randint(100) + 1),}, { "type": "equid", "n_increment": np.random.randint(100) + 1, @@ -875,9 +856,7 @@ def test_tmvoc(): "eos": "tmvoc", "n_component": 1, "n_phase": 1, - "default": { - "phase_composition": np.random.randint(10), - }, + "default": {"phase_composition": np.random.randint(10),}, "rocks": { helpers.random_string(5): { "initial_condition": np.random.rand(4), @@ -894,9 +873,7 @@ def test_tmvoc(): }, } parameters = write_read( - parameters_ref, - writer_kws={"eos": "tmvoc"}, - reader_kws={"eos": "tmvoc"}, + parameters_ref, writer_kws={"eos": "tmvoc"}, reader_kws={"eos": "tmvoc"}, ) helpers.allclose_dict(parameters_ref["default"], parameters["default"]) diff --git a/test/test_mesh_methods.py b/test/test_mesh_methods.py index 5ef194fd..80fcfdac 100644 --- a/test/test_mesh_methods.py +++ b/test/test_mesh_methods.py @@ -10,24 +10,12 @@ output_ref = { "element": { - 0: { - "PRES": 9641264.130638, - "TEMP": 149.62999493, - }, - -1: { - "PRES": 635804.12294844, - "TEMP": 142.89449866, - }, + 0: {"PRES": 9641264.130638, "TEMP": 149.62999493,}, + -1: {"PRES": 635804.12294844, "TEMP": 142.89449866,}, }, "connection": { - 0: { - "HEAT": -1.64908253e-07, - "FLOW": -2.85760551e-13, - }, - -1: { - "HEAT": -5.54750914e-08, - "FLOW": -4.68234504e-14, - }, + 0: {"HEAT": -1.64908253e-07, "FLOW": -2.85760551e-13,}, + -1: {"HEAT": -5.54750914e-08, "FLOW": -4.68234504e-14,}, }, } @@ -227,8 +215,7 @@ def test_near(): @pytest.mark.skipif(sys.version_info < (3, 6), reason="Order of keys in dictionary") @pytest.mark.parametrize( - "num_pvars, eos", - [(4, None), (6, None), (4, "tmvoc")], + "num_pvars, eos", [(4, None), (6, None), (4, "tmvoc")], ) def test_write_tough(num_pvars, eos): this_dir = os.path.dirname(os.path.abspath(__file__)) diff --git a/test/test_meshio.py b/test/test_meshio.py index 0f59555c..d3625b1b 100644 --- a/test/test_meshio.py +++ b/test/test_meshio.py @@ -41,9 +41,7 @@ def test_meshio(mesh_ref, file_format, binary): writer_kws["binary"] = binary mesh = write_read( - mesh=mesh_ref, - writer_kws=writer_kws, - reader_kws={"file_format": file_format}, + mesh=mesh_ref, writer_kws=writer_kws, reader_kws={"file_format": file_format}, ) if file_format == "flac3d": mesh_ref.cell_data.pop("c", None) diff --git a/test/test_output.py b/test/test_output.py index c7848a0b..c6cf387b 100644 --- a/test/test_output.py +++ b/test/test_output.py @@ -101,8 +101,7 @@ def test_output_eleme(filename, filename_ref): @pytest.mark.parametrize( - "filename", - ["OUTPUT_CONNE.csv", "OUTPUT.out", "OUTPUT_6.out"], + "filename", ["OUTPUT_CONNE.csv", "OUTPUT.out", "OUTPUT_6.out"], ) def test_output_conne(filename): this_dir = os.path.dirname(os.path.abspath(__file__)) @@ -147,9 +146,7 @@ def test_output_conne(filename): ) def test_output(output_ref, file_format): output = write_read( - output=output_ref, - writer_kws={"file_format": file_format}, - reader_kws={}, + output=output_ref, writer_kws={"file_format": file_format}, reader_kws={}, ) output_ref = output_ref if isinstance(output_ref, list) else [output_ref] diff --git a/test/test_react.py b/test/test_react.py index 5f0d5909..7f04feed 100644 --- a/test/test_react.py +++ b/test/test_react.py @@ -359,10 +359,7 @@ def write_read(x): parameters_ref = { "title": helpers.random_string(80), "primary_species": [ - { - "name": helpers.random_string(20), - "transport": np.random.randint(2), - } + {"name": helpers.random_string(20), "transport": np.random.randint(2),} for _ in range(np.random.randint(5) + 1) ], "aqueous_kinetics": [ @@ -513,10 +510,7 @@ def write_read(x): }, ], "gaseous_species": [ - { - "name": helpers.random_string(20), - "fugacity": np.random.randint(2), - } + {"name": helpers.random_string(20), "fugacity": np.random.randint(2),} for _ in range(np.random.randint(5) + 1) ], "surface_complexes": [ @@ -673,10 +667,7 @@ def write_read(x): pp = "partial_pressure" if key == "initial_gases" else "mole_fraction" parameters_ref["zones"][key] = [ [ - { - "name": helpers.random_string(20), - pp: np.random.rand(), - } + {"name": helpers.random_string(20), pp: np.random.rand(),} for _ in range(np.random.randint(5) + 1) ] for _ in range(np.random.randint(5) + 1) diff --git a/toughio/_cli/_co2tab.py b/toughio/_cli/_co2tab.py index 1d20d6a4..c261ea93 100644 --- a/toughio/_cli/_co2tab.py +++ b/toughio/_cli/_co2tab.py @@ -33,9 +33,7 @@ def _get_parser(): # Output path parser.add_argument( - "path", - type=str, - help="directory path", + "path", type=str, help="directory path", ) return parser diff --git a/toughio/_cli/_export.py b/toughio/_cli/_export.py index 5db0843a..4f2e73f6 100644 --- a/toughio/_cli/_export.py +++ b/toughio/_cli/_export.py @@ -84,8 +84,7 @@ def export(argv=None): print("{} ...".format(msg), end="") sys.stdout.flush() points, axis = _get_points( - output if args.file_format != "xdmf" else output[0], - args.ignore_elements, + output if args.file_format != "xdmf" else output[0], args.ignore_elements, ) ndim = len(axis) print(" Done!") @@ -131,7 +130,7 @@ def export(argv=None): if args.ignore_elements: data = data[mask] - + mesh.add_cell_data(label, data[idx]) voxelized = True @@ -149,7 +148,7 @@ def export(argv=None): for label, data in output.data.items(): if label in {"X", "Y", "Z"}: continue - + if args.ignore_elements: data = data[mask] @@ -233,36 +232,22 @@ def _get_parser(): # Input file parser.add_argument( - "infile", - type=str, - help="TOUGH output file", + "infile", type=str, help="TOUGH output file", ) # Mesh file parser.add_argument( - "--mesh", - "-m", - type=str, - default=None, - help="pickled toughio.Mesh", + "--mesh", "-m", type=str, default=None, help="pickled toughio.Mesh", ) # Time step parser.add_argument( - "--time-step", - "-t", - type=int, - default=None, - help="time step to export", + "--time-step", "-t", type=int, default=None, help="time step to export", ) # Output file parser.add_argument( - "--output-file", - "-o", - type=str, - default=None, - help="exported file", + "--output-file", "-o", type=str, default=None, help="exported file", ) # File format diff --git a/toughio/_cli/_extract.py b/toughio/_cli/_extract.py index f8df551f..f1e9b90e 100644 --- a/toughio/_cli/_extract.py +++ b/toughio/_cli/_extract.py @@ -101,16 +101,12 @@ def _get_parser(): # Input file parser.add_argument( - "infile", - type=str, - help="TOUGH output file", + "infile", type=str, help="TOUGH output file", ) # Mesh file parser.add_argument( - "mesh", - type=str, - help="TOUGH MESH file (can be INFILE)", + "mesh", type=str, help="TOUGH MESH file (can be INFILE)", ) # Output file diff --git a/toughio/_cli/_merge.py b/toughio/_cli/_merge.py index dceffa51..a5ff5b62 100644 --- a/toughio/_cli/_merge.py +++ b/toughio/_cli/_merge.py @@ -76,9 +76,7 @@ def _get_parser(): # Input file parser.add_argument( - "infile", - type=str, - help="TOUGH input file", + "infile", type=str, help="TOUGH input file", ) # Output file diff --git a/toughio/_cli/_save2incon.py b/toughio/_cli/_save2incon.py index bfc54c83..b78bb1c0 100644 --- a/toughio/_cli/_save2incon.py +++ b/toughio/_cli/_save2incon.py @@ -42,25 +42,17 @@ def _get_parser(): # Input file parser.add_argument( - "infile", - type=str, - help="SAVE file to convert", + "infile", type=str, help="SAVE file to convert", ) # Output file parser.add_argument( - "outfile", - type=str, - help="converted INCON file", + "outfile", type=str, help="converted INCON file", ) # Reset parser.add_argument( - "--reset", - "-r", - default=False, - action="store_true", - help="reset all counters", + "--reset", "-r", default=False, action="store_true", help="reset all counters", ) return parser diff --git a/toughio/_common.py b/toughio/_common.py index 1687255d..d66096ca 100644 --- a/toughio/_common.py +++ b/toughio/_common.py @@ -15,11 +15,7 @@ 2: "10d,10.3e,10.3e,10.3e,10.3e,10.3e,10.3e,10.3e", 3: "5d,5s,10.3e,10.3e,10.3e,10.3e,10.3e,10.3e,10.3e", }, - "CHEMP": { - 1: "5d", - 2: "20s", - 3: ",".join(5 * ["10.3e"]), - }, + "CHEMP": {1: "5d", 2: "20s", 3: ",".join(5 * ["10.3e"]),}, "NCGAS": {1: "5d", 2: "10s"}, "MULTI": ",".join(5 * ["5d"]), "SELEC": {1: ",".join(16 * ["5d"]), 2: ",".join(8 * ["10.3e"])}, @@ -89,23 +85,13 @@ }, "MESHM": { 1: "5s", - "XYZ": { - 1: "10.3e", - 2: "5s,5d,10.4e", - 3: ",".join(8 * ["10.4e"]), - }, + "XYZ": {1: "10.3e", 2: "5s,5d,10.4e", 3: ",".join(8 * ["10.4e"]),}, "RZ2D": { 1: "5s", - "RADII": { - 1: "5d", - 2: ",".join(8 * ["10.3e"]), - }, + "RADII": {1: "5d", 2: ",".join(8 * ["10.3e"]),}, "EQUID": "5d,5s,10.4e", "LOGAR": "5d,5s,10.4e,10.4e", - "LAYER": { - 1: "5d", - 2: ",".join(8 * ["10.4e"]), - }, + "LAYER": {1: "5d", 2: ",".join(8 * ["10.4e"]),}, }, }, "REACT": "25S", diff --git a/toughio/_io/input/tough/_helpers.py b/toughio/_io/input/tough/_helpers.py index 32f45cdb..8f8ca394 100644 --- a/toughio/_io/input/tough/_helpers.py +++ b/toughio/_io/input/tough/_helpers.py @@ -183,11 +183,7 @@ "permeability": "scalar_array_like", }, "MESHM": {"type": "str", "parameters": "array_like", "angle": "scalar"}, - "POISE": { - "start": "array_like", - "end": "array_like", - "aperture": "scalar", - }, + "POISE": {"start": "array_like", "end": "array_like", "aperture": "scalar",}, } @@ -255,9 +251,7 @@ def _check_parameters(params, keys=None): if not (v is None or isinstance(v, input_type)): raise TypeError( "Invalid type for parameter '{}' {}(expected {}).".format( - k, - "in {} ".format(keys) if keys else "", - input_types[k], + k, "in {} ".format(keys) if keys else "", input_types[k], ) ) diff --git a/toughio/_io/input/tough/_read.py b/toughio/_io/input/tough/_read.py index ffef51dd..0eb9cc80 100644 --- a/toughio/_io/input/tough/_read.py +++ b/toughio/_io/input/tough/_read.py @@ -753,11 +753,7 @@ def read_table(f, n, fmt): else: tmp.update( - { - "times": None, - "rates": data[9], - "specific_enthalpy": data[10], - } + {"times": None, "rates": data[9], "specific_enthalpy": data[10],} ) if ltab and tmp["type"] == "DELV": diff --git a/toughio/_io/input/toughreact_chemical/_read.py b/toughio/_io/input/toughreact_chemical/_read.py index 9db1ba88..a3ac25bf 100644 --- a/toughio/_io/input/toughreact_chemical/_read.py +++ b/toughio/_io/input/toughreact_chemical/_read.py @@ -124,10 +124,7 @@ def _read_akin(f): coeffs = data[1 : 2 * ncp + 1 : 2] tmp = { "species": [ - { - "name": name, - "stoichiometric_coeff": to_float(coeff), - } + {"name": name, "stoichiometric_coeff": to_float(coeff),} for name, coeff in zip(names, coeffs) ] } diff --git a/toughio/_mesh/_common.py b/toughio/_mesh/_common.py index 1bbbfe8e..d6851a49 100644 --- a/toughio/_mesh/_common.py +++ b/toughio/_mesh/_common.py @@ -210,7 +210,7 @@ def labeler(n_cells, label_length=None): n = label_length - 3 fmt = "{{: >{}}}".format(n) alpha = np.array(list(ascii_uppercase)) - numer = np.array([fmt.format(i) for i in range(10**n)]) + numer = np.array([fmt.format(i) for i in range(10 ** n)]) nomen = np.concatenate((["{:1}".format(i + 1) for i in range(9)], alpha)) q1, r1 = np.divmod(np.arange(n_cells), numer.size) diff --git a/toughio/_mesh/_helpers.py b/toughio/_mesh/_helpers.py index 9ee39fc7..b16aea95 100644 --- a/toughio/_mesh/_helpers.py +++ b/toughio/_mesh/_helpers.py @@ -237,12 +237,7 @@ def read_time_series(filename): def write_time_series( - filename, - points, - cells, - point_data=None, - cell_data=None, - time_steps=None, + filename, points, cells, point_data=None, cell_data=None, time_steps=None, ): """ Write time series given points and cells data. diff --git a/toughio/_mesh/_mesh.py b/toughio/_mesh/_mesh.py index 6fb4f5da..40ab4f7d 100644 --- a/toughio/_mesh/_mesh.py +++ b/toughio/_mesh/_mesh.py @@ -195,10 +195,7 @@ def prune_duplicates(self, inplace=True): # Prune duplicate points unique_points, pind, pinv = np.unique( - mesh.points, - axis=0, - return_index=True, - return_inverse=True, + mesh.points, axis=0, return_index=True, return_inverse=True, ) if len(unique_points) < len(mesh.points): mesh.points = unique_points @@ -269,11 +266,7 @@ def to_meshio(self): else: cells, cell_data = get_old_meshio_cells(self.cells, cell_data) kwargs.update( - { - "cells": cells, - "cell_data": cell_data, - "node_sets": self.point_sets, - } + {"cells": cells, "cell_data": cell_data, "node_sets": self.point_sets,} ) return meshio.Mesh(**kwargs) diff --git a/toughio/_mesh/_properties.py b/toughio/_mesh/_properties.py index 65f73aac..cde423e1 100644 --- a/toughio/_mesh/_properties.py +++ b/toughio/_mesh/_properties.py @@ -31,9 +31,7 @@ def _materials(mesh): def _faces(mesh): """Return connectivity of faces of cell in mesh.""" meshio_type_to_faces = { - "tetra": { - "triangle": np.array([[1, 2, 3], [0, 3, 2], [0, 1, 3], [0, 2, 1]]), - }, + "tetra": {"triangle": np.array([[1, 2, 3], [0, 3, 2], [0, 1, 3], [0, 2, 1]]),}, "pyramid": { "triangle": np.array([[0, 1, 4], [1, 2, 4], [2, 3, 4], [3, 0, 4]]), "quad": np.array([[0, 3, 2, 1]]), diff --git a/toughio/_mesh/flac3d/_flac3d.py b/toughio/_mesh/flac3d/_flac3d.py index 086e04ba..8d622e7e 100644 --- a/toughio/_mesh/flac3d/_flac3d.py +++ b/toughio/_mesh/flac3d/_flac3d.py @@ -152,12 +152,7 @@ def read_buffer(f, binary): for _ in range(num_groups): name, slot, data = _read_group(f, binary) field_data, mapper[flag] = _update_field_data( - field_data, - mapper[flag], - data, - name, - gidx + 1, - flag, + field_data, mapper[flag], data, name, gidx + 1, flag, ) slots[flag] = _update_slots(slots[flag], slot) gidx += 1 @@ -179,12 +174,7 @@ def read_buffer(f, binary): flag = flags[line[0]] name, slot, data = _read_group(f, binary, line) field_data, mapper[flag] = _update_field_data( - field_data, - mapper[flag], - data, - name, - gidx + 1, - flag, + field_data, mapper[flag], data, name, gidx + 1, flag, ) slots[flag] = _update_slots(slots[flag], slot) gidx += 1 diff --git a/toughio/_mesh/tough/_tough.py b/toughio/_mesh/tough/_tough.py index 45061d50..439af782 100644 --- a/toughio/_mesh/tough/_tough.py +++ b/toughio/_mesh/tough/_tough.py @@ -141,8 +141,7 @@ def check_incon( do_incon = False cond = np.logical_and( - primary_variables[:, 0] > -1.0e9, - primary_variables[:, 0] < 0.0, + primary_variables[:, 0] > -1.0e9, primary_variables[:, 0] < 0.0, ) if cond.any(): logging.warning("Negative pore pressures found in 'INCON'.") @@ -224,10 +223,7 @@ def write_mesh( if coord: _write_coord( - f, - nodes, - materials, - material_end, + f, nodes, materials, material_end, ) _write_conne( @@ -301,10 +297,7 @@ def _write_eleme( @block("COORD") def _write_coord( - f, - nodes, - materials, - material_end, + f, nodes, materials, material_end, ): """Write COORD block.""" from ._helpers import _write_coord as writer diff --git a/toughio/capillarity/_pickens.py b/toughio/capillarity/_pickens.py index d6b5ff9a..74e12ffa 100644 --- a/toughio/capillarity/_pickens.py +++ b/toughio/capillarity/_pickens.py @@ -46,7 +46,7 @@ def _eval(self, sl, *args): A = (1.0 + sl / sl0) * (sl0 - slr) / (sl0 + slr) B = 1.0 - sl / sl0 - return -p0 * (np.log(A / B * (1.0 + (1.0 - B**2 / A**2) ** 0.5))) ** ( + return -p0 * (np.log(A / B * (1.0 + (1.0 - B ** 2 / A ** 2) ** 0.5))) ** ( 1.0 / x ) diff --git a/toughio/meshmaker/_cylindric_grid.py b/toughio/meshmaker/_cylindric_grid.py index 3e691e6c..27877dcf 100644 --- a/toughio/meshmaker/_cylindric_grid.py +++ b/toughio/meshmaker/_cylindric_grid.py @@ -112,12 +112,7 @@ def cylindric_grid(dr, dz, origin_z=None, layer=False, material="dfalt"): origin_z = origin_z if origin_z is not None else -dz.sum() mesh = structured_grid( - dr, - [1.0], - dz, - origin=[0.0, -0.5, origin_z], - layer=layer, - material=material, + dr, [1.0], dz, origin=[0.0, -0.5, origin_z], layer=layer, material=material, ) return CylindricMesh( diff --git a/toughio/meshmaker/_helpers.py b/toughio/meshmaker/_helpers.py index eb4869fa..dc341702 100644 --- a/toughio/meshmaker/_helpers.py +++ b/toughio/meshmaker/_helpers.py @@ -160,12 +160,7 @@ def parse_rz2d(parameters): rmax += n * size dr.append( - { - "n_increment": n, - "size": size, - "type": "uniform", - "radius_ref": None, - } + {"n_increment": n, "size": size, "type": "uniform", "radius_ref": None,} ) elif parameter["type"] == "logar": diff --git a/toughio/relative_permeability/_corey.py b/toughio/relative_permeability/_corey.py index 39935cf7..6cb04b4b 100644 --- a/toughio/relative_permeability/_corey.py +++ b/toughio/relative_permeability/_corey.py @@ -40,8 +40,8 @@ def _eval(self, sl, *args): kg = 1.0 else: Shat = (sl - slr) / (1.0 - slr - sgr) - kl = Shat**4 - kg = (1.0 - Shat**2) * (1.0 - Shat) ** 2 + kl = Shat ** 4 + kg = (1.0 - Shat ** 2) * (1.0 - Shat) ** 2 return kl, kg @property diff --git a/toughio/relative_permeability/_fatt_klikoff.py b/toughio/relative_permeability/_fatt_klikoff.py index bab0131b..b3f9498e 100644 --- a/toughio/relative_permeability/_fatt_klikoff.py +++ b/toughio/relative_permeability/_fatt_klikoff.py @@ -30,7 +30,7 @@ def _eval(self, sl, *args): """Fatt and Klikoff's function.""" (slr,) = args Seff = (sl - slr) / (1.0 - slr) if sl > slr else 0.0 - kl = Seff**3 + kl = Seff ** 3 kg = (1.0 - Seff) ** 3 return kl, kg diff --git a/toughio/relative_permeability/_grant.py b/toughio/relative_permeability/_grant.py index acfe388d..a28694a9 100644 --- a/toughio/relative_permeability/_grant.py +++ b/toughio/relative_permeability/_grant.py @@ -40,7 +40,7 @@ def _eval(self, sl, *args): kg = 1.0 else: Shat = (sl - slr) / (1.0 - slr - sgr) - kl = Shat**4 + kl = Shat ** 4 kg = 1.0 - kl return kl, kg diff --git a/toughio/relative_permeability/_pickens.py b/toughio/relative_permeability/_pickens.py index ee03a727..bf549ba5 100644 --- a/toughio/relative_permeability/_pickens.py +++ b/toughio/relative_permeability/_pickens.py @@ -25,7 +25,7 @@ def __init__(self, x): def _eval(self, sl, *args): """Gas perfect mobile function.""" (x,) = args - return sl**x, 1.0 + return sl ** x, 1.0 @property def parameters(self): diff --git a/toughio/relative_permeability/_van_genuchten_mualem.py b/toughio/relative_permeability/_van_genuchten_mualem.py index e6715d7d..0231280a 100644 --- a/toughio/relative_permeability/_van_genuchten_mualem.py +++ b/toughio/relative_permeability/_van_genuchten_mualem.py @@ -40,7 +40,7 @@ def _eval(self, sl, *args): else: Seff = (sl - slr) / (sls - slr) kl = ( - Seff**0.5 * (1.0 - (1.0 - Seff ** (1.0 / m)) ** m) ** 2 + Seff ** 0.5 * (1.0 - (1.0 - Seff ** (1.0 / m)) ** m) ** 2 if Seff > 0.0 else 0.0 ) @@ -48,7 +48,7 @@ def _eval(self, sl, *args): Shat = (sl - slr) / (1.0 - slr - sgr) Shat = max(Shat, 0.0) Shat = min(Shat, 1.0) - kg = 1.0 - kl if sgr <= 0.0 else (1.0 - Shat**2) * (1.0 - Shat) ** 2 + kg = 1.0 - kl if sgr <= 0.0 else (1.0 - Shat ** 2) * (1.0 - Shat) ** 2 return kl, kg diff --git a/toughio/relative_permeability/_verma.py b/toughio/relative_permeability/_verma.py index 37bfa635..86e705a4 100644 --- a/toughio/relative_permeability/_verma.py +++ b/toughio/relative_permeability/_verma.py @@ -38,8 +38,8 @@ def _eval(self, sl, *args): Shat = (sl - slr) / (sls - slr) Shat = max(Shat, 0.0) Shat = min(Shat, 1.0) - kl = Shat**3 - kg = a + b * Shat + c * Shat**2 + kl = Shat ** 3 + kg = a + b * Shat + c * Shat ** 2 kg = max(kg, 0.0) kg = min(kg, 1.0) return kl, kg