The following shows running a simple steady-state diffusion benchmark running on 2 cores.
import os
…
(click to toggle)
import os
from datetime import datetime
from pathlib import Path
from subprocess import run
import matplotlib.pyplot as plt
import vtuIO
prj_name = "square_1e1_neumann"
…
(click to toggle)
prj_name = "square_1e1_neumann"
data_dir = os.environ.get("OGS_DATA_DIR", "../../../Data")
prj_file = f"{data_dir}/EllipticPETSc/{prj_name}.prj"
out_dir = Path(os.environ.get("OGS_TESTRUNNER_OUT_DIR", "_out"))
…
(click to toggle)
out_dir = Path(os.environ.get("OGS_TESTRUNNER_OUT_DIR", "_out"))
if not out_dir.exists():
out_dir.mkdir(parents=True)
print(f"mpirun --bind-to none -np 2 ogs {prj_file} > out.txt")
run(f"mpirun --bind-to none -np 2 ogs {prj_file} > out.txt", shell=True, check=True)
print(datetime.now())
mpirun --bind-to none -np 2 ogs /var/lib/gitlab-runner/builds/vZ6vnZiU/1/ogs/ogs/Tests/Data/EllipticPETSc/square_1e1_neumann.prj > out.txt
2024-12-20 13:06:15.480236
pvdfile = vtuIO.PVDIO(f"{prj_name}.pvd", dim=2)
…
(click to toggle)
pvdfile = vtuIO.PVDIO(f"{prj_name}.pvd", dim=2)
time = pvdfile.timesteps
points = {"pt0": (0.3, 0.5, 0.0), "pt1": (0.24, 0.21, 0.0)}
pressure_linear = pvdfile.read_time_series("pressure", points)
plt.plot(time, pressure_linear["pt0"], "b-", label="pt0 linear interpolated")
…
(click to toggle)
plt.plot(time, pressure_linear["pt0"], "b-", label="pt0 linear interpolated")
plt.plot(time, pressure_linear["pt1"], "r-", label="pt1 linear interpolated")
plt.legend()
plt.xlabel("t")
plt.ylabel("p")
Text(0, 0.5, 'p')
This article was written by Lars Bilke. If you are missing something or you find an error please let us know.
Generated with Hugo 0.122.0
in CI job 504124
|
Last revision: November 9, 2021