Skip to content

Commit 3d3f2a4

Browse files
committed
Merge branch 'python310' into 'master'
[py] Bump minimum Python to 3.10. See merge request ogs/ogs!5408
2 parents f18fe28 + 875ffe2 commit 3d3f2a4

File tree

27 files changed

+3905
-79
lines changed

27 files changed

+3905
-79
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
exclude: "^Tests/Data/.*|^Tests/Python/res/test_docu_scripts/|^web/static|^Documentation/.vale/.*|.*\\.patch"
1010
- id: check-added-large-files
1111
args: [--maxkb 1024]
12-
exclude: "^Tests/Data/uv.lock"
12+
exclude: "uv.lock"
1313
- id: check-merge-conflict
1414
- id: check-xml
1515
exclude: '^Tests/Data/.*\.xml'

Applications/Python/ogs/dev/ogs_log_summary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def parse_ogs_log(log_fh):
118118
except KeyError:
119119
continue
120120
assert len(abs_norm) == len(rel_norm)
121-
for comp, (a, r) in enumerate(zip(abs_norm, rel_norm)):
121+
for comp, (a, r) in enumerate(zip(abs_norm, rel_norm, strict=False)):
122122
new_rec = dict(rec)
123123
new_rec["abs_maximum_norm"] = a
124124
new_rec["rel_maximum_norm"] = r

Tests/Data/HMPhaseField/GreatCell/GreatCellHM_VPF.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,9 @@ def truncated_cmap(name, minval=0.3, maxval=0.9, n=6):
317317

318318
top_points_x, top_points_y = [], []
319319

320-
for i, (x, y, value) in enumerate(zip(circle_x, circle_y, scaled_values)):
320+
for i, (x, y, value) in enumerate(
321+
zip(circle_x, circle_y, scaled_values, strict=False)
322+
):
321323
unit_vector = np.array([x, y]) / circle_radius
322324
line_end = np.array([x, y]) + unit_vector * value / 1e6
323325

Tests/Data/LIE/HydroMechanics/GreatCelljupyterNotebook/GreatCellHM.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def truncated_cmap(name, minval=0.3, maxval=0.9, n=6):
7676
# # Great cell
7777
#
7878
# The GREAT cell is a poly-axial rock-testing device that reproduces subsurface conditions down to 3.5 km depth on 200 mm-diameter samples. It imposes a rotating stress field, injects fluid through a central borehole, and records both fiber-optic strain and pore-pressure data—providing a rich dataset for validating coupled hydro-mechanical models. For full details, see the GREAT cell benchmark docs:
79-
# [https://www.opengeosys.org/docs/benchmarks/small-deformation/greatcell/](https://www.opengeosys.org/docs/benchmarks/small-deformation/greatcell/)
79+
# [www.opengeosys.org/docs/benchmarks/small-deformations/greatcell/](https://www.opengeosys.org/docs/benchmarks/small-deformations/greatcell/)
8080
#
8181
#
8282
# Here, in our 2D, small-deformation benchmark suite, we employ the LIE (lower-dimensional interface element) hydro-mechanical process to model fractures as interfaces. The cases are:
@@ -282,7 +282,9 @@ def truncated_cmap(name, minval=0.3, maxval=0.9, n=6):
282282

283283
top_points_x, top_points_y = [], []
284284

285-
for i, (x, y, value) in enumerate(zip(circle_x, circle_y, scaled_values)):
285+
for i, (x, y, value) in enumerate(
286+
zip(circle_x, circle_y, scaled_values, strict=False)
287+
):
286288
unit_vector = np.array([x, y]) / circle_radius
287289
line_end = np.array([x, y]) + unit_vector * value / 1e6
288290

Tests/Data/LIE/Mechanics/GreatCelljupyterNotebook/GreatCellM.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,9 @@ def truncated_cmap(name, minval=0.3, maxval=0.9, n=6):
370370

371371
top_points_x, top_points_y = [], []
372372

373-
for i, (x, y, value) in enumerate(zip(circle_x, circle_y, scaled_values)):
373+
for i, (x, y, value) in enumerate(
374+
zip(circle_x, circle_y, scaled_values, strict=False)
375+
):
374376
unit_vector = np.array([x, y]) / circle_radius
375377
line_end = np.array([x, y]) + unit_vector * value / 1e6
376378

Tests/Data/LIE/Mechanics/GreatCelljupyterNotebook/Plotter.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import colorsys
22
import math
33
from pathlib import Path
4-
from typing import ClassVar, Optional
4+
from typing import ClassVar
55

66
import matplotlib.pyplot as plt
77
import numpy as np
@@ -222,7 +222,7 @@ def plot_volumetric_strain_vs_angle(
222222
ylim_range=None,
223223
layout="single",
224224
downsample: int = 1,
225-
markevery: Optional[int] = None,
225+
markevery: int | None = None,
226226
external_data=None,
227227
):
228228
self.setup_plot_style()
@@ -455,7 +455,7 @@ def extract_lie_aperture_from_list(
455455
self, file_list: list[str], material_names: list[str], fracture_mat_id=3
456456
) -> dict[str, tuple[np.ndarray, np.ndarray]]:
457457
by_material: dict[str, tuple[np.ndarray, np.ndarray]] = {}
458-
for vtu_file, mat_name in zip(file_list, material_names):
458+
for vtu_file, mat_name in zip(file_list, material_names, strict=False):
459459
mesh = ot.MeshSeries(self.output_dir / vtu_file)[-1]
460460
sub = self.get_sub_mesh_by_material(mesh, fracture_mat_id)
461461
coords = sub.points
@@ -484,7 +484,7 @@ def extract_vpf_width_from_list(
484484
self, file_list: list[str], material_names: list[str]
485485
) -> dict[str, tuple[np.ndarray, np.ndarray]]:
486486
width_by_material: dict[str, tuple[np.ndarray, np.ndarray]] = {}
487-
for vtu_file, material_name in zip(file_list, material_names):
487+
for vtu_file, material_name in zip(file_list, material_names, strict=False):
488488
mesh = ot.MeshSeries(self.output_dir / vtu_file)[-1]
489489
cell_data = mesh.cell_data
490490

@@ -513,7 +513,7 @@ def extract_vpf_stress_from_list(
513513
stress_type: str = "normal",
514514
) -> dict[str, tuple[np.ndarray, np.ndarray]]:
515515
stress_by_material: dict[str, tuple[np.ndarray, np.ndarray]] = {}
516-
for vtu_file, material_name in zip(file_list, material_names):
516+
for vtu_file, material_name in zip(file_list, material_names, strict=False):
517517
mesh = ot.MeshSeries(self.output_dir / vtu_file)[-1]
518518
cell_data = mesh.cell_data
519519
point_data = mesh.point_data
@@ -662,10 +662,10 @@ def plot_avg_width_vs_stress(
662662
self,
663663
pee_load_values: dict[str, list[float]],
664664
metric: str = "width",
665-
methods_to_include: Optional[list[str]] = None,
666-
ylim_range: Optional[tuple[float, float]] = None,
667-
external_data: Optional[dict[str, dict[str, dict[str, list[float]]]]] = None,
668-
benchmark_tag: Optional[str] = None,
665+
methods_to_include: list[str] | None = None,
666+
ylim_range: tuple[float, float] | None = None,
667+
external_data: dict[str, dict[str, dict[str, list[float]]]] | None = None,
668+
benchmark_tag: str | None = None,
669669
) -> np.ndarray:
670670
if methods_to_include is None:
671671
methods_to_include = ["VPF", "LIE"]
@@ -836,12 +836,11 @@ def plot_fracture_aperture_profiles(
836836
widthProfile: dict[str, dict[str, tuple[np.ndarray, np.ndarray]]],
837837
benchmark_tag: str,
838838
downsample: int = 1,
839-
markevery: Optional[int] = None,
840-
ylim: Optional[tuple[float, float]] = None,
839+
markevery: int | None = None,
840+
ylim: tuple[float, float] | None = None,
841841
method_label: str = "FEM",
842-
external_data: Optional[
843-
dict[str, dict[str, dict[str, dict[str, list[float]]]]]
844-
] = None,
842+
external_data: dict[str, dict[str, dict[str, dict[str, list[float]]]]]
843+
| None = None,
845844
) -> None:
846845
self.setup_plot_style()
847846
for load_case, mat_prof in widthProfile.items():
@@ -974,7 +973,7 @@ def plot_fracture_aperture_profiles(
974973

975974
@staticmethod
976975
def load_external_data(
977-
ext_dir: str | Path, benchmark_tag: Optional[str] = None
976+
ext_dir: str | Path, benchmark_tag: str | None = None
978977
) -> dict[str, dict]:
979978
"""
980979
Scans ext_dir for extracted_*.npz and returns dicts:

Tests/Data/LargeDeformation/CooksMembrane/CooksMembraneFbar.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def run_single_test(mesh_name, output_prefix, use_fbar=False, use_load_increment
121121

122122
uys_at_top_fbar = []
123123
for mesh_name, load_increment_label, output_prefix in zip(
124-
mesh_names, load_increment_labels, output_prefices
124+
mesh_names, load_increment_labels, output_prefices, strict=False
125125
):
126126
uy_at_top = run_single_test(
127127
mesh_name,
@@ -154,7 +154,7 @@ def run_single_test(mesh_name, output_prefix, use_fbar=False, use_load_increment
154154

155155
uys_at_top_non_fbar = []
156156
for mesh_name, load_increment_label, output_prefix in zip(
157-
mesh_names, load_increment_labels, output_prefices_non_fbar
157+
mesh_names, load_increment_labels, output_prefices_non_fbar, strict=False
158158
):
159159
uy_at_top = run_single_test(
160160
mesh_name,
@@ -233,7 +233,7 @@ def contour_plot(pvd_file_name, title, fig_name=None):
233233
# #### 2.1. Non F-bar: Vertical displacement (left column) and vertical stress (right column):
234234

235235
# %%
236-
for nedge, output_prefix in zip(nedges, output_prefices_non_fbar):
236+
for nedge, output_prefix in zip(nedges, output_prefices_non_fbar, strict=False):
237237
contour_plot(
238238
output_prefix + ".pvd",
239239
f"Number of elements per side: {nedge}",
@@ -244,7 +244,7 @@ def contour_plot(pvd_file_name, title, fig_name=None):
244244
# #### 2.1. F-bar: Vertical displacement (left column) and vertical stress (right column):
245245

246246
# %%
247-
for nedge, output_prefix in zip(nedges, output_prefices):
247+
for nedge, output_prefix in zip(nedges, output_prefices, strict=False):
248248
contour_plot(
249249
output_prefix + ".pvd",
250250
f"Number of elements per side: {nedge}",

Tests/Data/Mechanics/CooksMembrane/CooksMembraneBbar.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def run_single_test(mesh_name, output_prefix, use_bbar="false"):
140140
]
141141

142142
uys_at_top_non_bbar = []
143-
for mesh_name, output_prefix in zip(mesh_names, output_prefices_non_bbar):
143+
for mesh_name, output_prefix in zip(mesh_names, output_prefices_non_bbar, strict=False):
144144
uy_at_top = run_single_test(mesh_name, output_prefix)
145145
uys_at_top_non_bbar.append(uy_at_top)
146146

@@ -169,7 +169,7 @@ def run_single_test(mesh_name, output_prefix, use_bbar="false"):
169169
]
170170

171171
uys_at_top_bbar = []
172-
for mesh_name, output_prefix in zip(mesh_names, output_prefices):
172+
for mesh_name, output_prefix in zip(mesh_names, output_prefices, strict=False):
173173
uy_at_top = run_single_test(mesh_name, output_prefix, "true")
174174
uys_at_top_bbar.append(uy_at_top)
175175

@@ -262,14 +262,14 @@ def contour_plot(pvd_file_name, title):
262262
# #### Results obtained without the B bar method:
263263

264264
# %%
265-
for nedge, output_prefix in zip(nedges, output_prefices_non_bbar):
265+
for nedge, output_prefix in zip(nedges, output_prefices_non_bbar, strict=False):
266266
contour_plot(output_prefix + ".pvd", "Number of elements per side: " + nedge)
267267

268268
# %% [markdown]
269269
# #### Results obtained with the B bar method:
270270

271271
# %%
272-
for nedge, output_prefix in zip(nedges, output_prefices):
272+
for nedge, output_prefix in zip(nedges, output_prefices, strict=False):
273273
contour_plot(output_prefix + ".pvd", "Number of elements per side: " + nedge)
274274

275275
# %% [markdown]

Tests/Data/Mechanics/Linear/PythonHertzContact/post.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def get_y_top(t):
121121
add_leg = True
122122

123123

124-
for t, fn in zip(ts, fns):
124+
for t, fn in zip(ts, fns, strict=False):
125125
print("###### time", t)
126126
reader.SetFileName(fn)
127127
reader.Update()

Tests/Data/Mechanics/Linear/PythonPiston/post.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def read_pvd_file(fn):
7070
uys = np.zeros(len(ts))
7171
ps = np.zeros(len(ts))
7272

73-
for i, (t, fn) in enumerate(zip(ts, fns)):
73+
for i, (t, fn) in enumerate(zip(ts, fns, strict=False)):
7474
print("###### time", t)
7575
reader.SetFileName(fn)
7676
probe.Update()

0 commit comments

Comments
 (0)