From ecb3ab33fde0db2faec395313eef483a2bd240c0 Mon Sep 17 00:00:00 2001
From: Feliks Kiszkurno <feliks-kuba.kiszkurno@ufz.de>
Date: Tue, 10 Dec 2024 09:11:27 +0100
Subject: [PATCH] Fix errors from CI

---
 Tests/Data/Notebooks/SimplePETSc.py           |  2 +-
 .../Kregime_Propagating_jupyter.py            |  6 ++++-
 .../sen_shear.py                              | 17 ++++++++++--
 .../Kregime_Static_jupyter.py                 |  1 +
 .../surfing_pyvista.py                        |  3 +++
 .../PhaseField/tpb_jupyter_notebook/TPB.py    | 27 ++++++++++++++++---
 6 files changed, 48 insertions(+), 8 deletions(-)

diff --git a/Tests/Data/Notebooks/SimplePETSc.py b/Tests/Data/Notebooks/SimplePETSc.py
index 22a47b305d1..43f3999f95f 100644
--- a/Tests/Data/Notebooks/SimplePETSc.py
+++ b/Tests/Data/Notebooks/SimplePETSc.py
@@ -44,7 +44,7 @@ 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", check=True)
+run(f"mpirun --bind-to none -np 2 ogs {prj_file} > out.txt", shell=True, check=True)
 
 print(datetime.now())
 
diff --git a/Tests/Data/PhaseField/Kregime_Propagating_jupyter_notebook/Kregime_Propagating_jupyter.py b/Tests/Data/PhaseField/Kregime_Propagating_jupyter_notebook/Kregime_Propagating_jupyter.py
index c3bf01ee690..d436f331f88 100644
--- a/Tests/Data/PhaseField/Kregime_Propagating_jupyter_notebook/Kregime_Propagating_jupyter.py
+++ b/Tests/Data/PhaseField/Kregime_Propagating_jupyter_notebook/Kregime_Propagating_jupyter.py
@@ -310,7 +310,11 @@ def Hydraulic_Fracturing_Toughness_Dominated_numerical(h, phasefield_model):
     # run simulation with ogs
     t0 = time.time()
     print(">>> OGS started execution ... <<<")
-    run(f"ogs {out_dir}/{prj_name} -o {out_dir} > {out_dir}/log.txt", check=True)
+    run(
+        f"ogs {out_dir}/{prj_name} -o {out_dir} > {out_dir}/log.txt",
+        shell=True,
+        check=True,
+    )
     tf = time.time()
     print(">>> OGS terminated execution  <<< Elapsed time: ", round(tf - t0, 2), " s.")
 
diff --git a/Tests/Data/PhaseField/PForthotropy_jupyter_notebook/sen_shear.py b/Tests/Data/PhaseField/PForthotropy_jupyter_notebook/sen_shear.py
index 94af9e238d7..0c521b63360 100644
--- a/Tests/Data/PhaseField/PForthotropy_jupyter_notebook/sen_shear.py
+++ b/Tests/Data/PhaseField/PForthotropy_jupyter_notebook/sen_shear.py
@@ -133,10 +133,12 @@ def ogs_ortho(
         # partition mesh
         run(
             f"NodeReordering -i shear.vtu -o {out_dir}/shear.vtu >> {logfile}",
+            shell=True,
             check=True,
         )
         run(
             f"constructMeshesFromGeometry -m {out_dir}/shear.vtu -g shear.gml >> {logfile}",
+            shell=True,
             check=True,
         )
         shutil.move("shear_top.vtu", f"{out_dir}/shear_top.vtu")
@@ -149,14 +151,20 @@ def ogs_ortho(
         shutil.move("shear_p_2.vtu", f"{out_dir}/shear_p_2.vtu")
         shutil.move("shear_p_3.vtu", f"{out_dir}/shear_p_3.vtu")
 
-        run(f"partmesh -s -o {out_dir} -i {out_dir}/shear.vtu >> {logfile}", check=True)
+        run(
+            f"partmesh -s -o {out_dir} -i {out_dir}/shear.vtu >> {logfile}",
+            shell=True,
+            check=True,
+        )
         run(
             f"partmesh -m -n {ncores} -o {out_dir} -i {out_dir}/shear.vtu -- {out_dir}/shear_top.vtu {out_dir}/shear_bottom.vtu {out_dir}/shear_left.vtu {out_dir}/shear_right.vtu >> {logfile}",
+            shell=True,
             check=True,
         )
     else:
         run(
             f"NodeReordering -i shear.vtu -o {out_dir}/shear.vtu >> {logfile}",
+            shell=True,
             check=True,
         )
 
@@ -199,11 +207,16 @@ def ogs_ortho(
         print(f"  > OGS started execution with MPI - {ncores} cores...")
         run(
             f"mpirun --bind-to none -np {ncores} ogs {out_dir}/{prj_name} -o {output_dir} >> {logfile}",
+            shell=True,
             check=True,
         )
     else:
         print("  > OGS started execution - ")
-        run(f"ogs {out_dir}/{prj_name} -o {output_dir} >> {logfile}", check=True)
+        run(
+            f"ogs {out_dir}/{prj_name} -o {output_dir} >> {logfile}",
+            shell=True,
+            check=True,
+        )
     tf = time.time()
     print("  > OGS terminated execution. Elapsed time: ", round(tf - t0, 2), " s.")
 
diff --git a/Tests/Data/PhaseField/kregime_jupyter_notebook/Kregime_Static_jupyter.py b/Tests/Data/PhaseField/kregime_jupyter_notebook/Kregime_Static_jupyter.py
index e0df462d951..4b3d48982db 100644
--- a/Tests/Data/PhaseField/kregime_jupyter_notebook/Kregime_Static_jupyter.py
+++ b/Tests/Data/PhaseField/kregime_jupyter_notebook/Kregime_Static_jupyter.py
@@ -267,6 +267,7 @@ def sneddon_numerical(h):
     print(">>> OGS started execution ... <<<")
     run(
         f"ogs {out_dir}/{prj_name} -o {out_dir} -m {out_dir} > {out_dir}/ogs-out.txt",
+        shell=True,
         check=True,
     )
     tf = time.time()
diff --git a/Tests/Data/PhaseField/surfing_jupyter_notebook/surfing_pyvista.py b/Tests/Data/PhaseField/surfing_jupyter_notebook/surfing_pyvista.py
index ff66ae38243..d8ec72da54f 100644
--- a/Tests/Data/PhaseField/surfing_jupyter_notebook/surfing_pyvista.py
+++ b/Tests/Data/PhaseField/surfing_jupyter_notebook/surfing_pyvista.py
@@ -186,10 +186,12 @@ if not out_dir.exists():
 # https://www.opengeosys.org/docs/tools/meshing/structured-mesh-generation/
 run(
     f"generateStructuredMesh -o {out_dir}/surfing_quad_1x2.vtu -e quad --lx 2 --nx {round(2/h)+1} --ly 1 --ny {round(1/h)+1}",
+    shell=True,
     check=True,
 )
 run(
     f"NodeReordering -i {out_dir}/surfing_quad_1x2.vtu -o {out_dir}/surfing_quad_1x2_NR.vtu",
+    shell=True,
     check=True,
 )
 
@@ -269,6 +271,7 @@ t0 = time.time()
 print(">>> OGS started execution ... <<<")
 run(
     f"ogs {out_dir}/{prj_name} -o {out_dir} -m {out_dir} > {out_dir}/ogs-out.txt",
+    shell=True,
     check=True,
 )
 
diff --git a/Tests/Data/PhaseField/tpb_jupyter_notebook/TPB.py b/Tests/Data/PhaseField/tpb_jupyter_notebook/TPB.py
index 8a3a5b409da..110560133da 100644
--- a/Tests/Data/PhaseField/tpb_jupyter_notebook/TPB.py
+++ b/Tests/Data/PhaseField/tpb_jupyter_notebook/TPB.py
@@ -139,22 +139,36 @@ def ogs_TPB(
 
     if MPI:
         # partition mesh
-        run(f"NodeReordering -i TPB.vtu -o {out_dir}/TPB.vtu >> {logfile}", check=True)
+        run(
+            f"NodeReordering -i TPB.vtu -o {out_dir}/TPB.vtu >> {logfile}",
+            shell=True,
+            check=True,
+        )
         run(
             f"constructMeshesFromGeometry -m {out_dir}/TPB.vtu -g TPB.gml >> {logfile}",
+            shell=True,
             check=True,
         )
         shutil.move("TPB_left.vtu", f"{out_dir}/TPB_left.vtu")
         shutil.move("TPB_right.vtu", f"{out_dir}/TPB_right.vtu")
         shutil.move("TPB_top.vtu", f"{out_dir}/TPB_top.vtu")
         shutil.copy("TPB.gml", f"{out_dir}/TPB.gml")
-        run(f"partmesh -s -o {out_dir} -i {out_dir}/TPB.vtu >> {logfile}", check=True)
+        run(
+            f"partmesh -s -o {out_dir} -i {out_dir}/TPB.vtu >> {logfile}",
+            shell=True,
+            check=True,
+        )
         run(
             f"partmesh -m -n {ncores} -o {out_dir} -i {out_dir}/TPB.vtu -- {out_dir}/TPB_right.vtu {out_dir}/TPB_left.vtu {out_dir}/TPB_top.vtu >> {logfile}",
+            shell=True,
             check=True,
         )
     else:
-        run(f"NodeReordering -i TPB.vtu -o {out_dir}/TPB.vtu >> {logfile}", check=True)
+        run(
+            f"NodeReordering -i TPB.vtu -o {out_dir}/TPB.vtu >> {logfile}",
+            shell=True,
+            check=True,
+        )
 
     # change properties in prj file
     model = ot.Project(
@@ -194,11 +208,16 @@ def ogs_TPB(
         print(f"  > OGS started execution with MPI - {ncores} cores...")
         run(
             f"mpirun --bind-to none -np {ncores} ogs {out_dir}/{prj_name} -o {output_dir} >> {logfile}",
+            shell=True,
             check=True,
         )
     else:
         print("  > OGS started execution ...")
-        run(f"ogs {out_dir}/{prj_name} -o {output_dir} >> {logfile}", check=True)
+        run(
+            f"ogs {out_dir}/{prj_name} -o {output_dir} >> {logfile}",
+            shell=True,
+            check=True,
+        )
     tf = time.time()
     print("  > OGS terminated execution. Elapsed time: ", round(tf - t0, 2), " s.")
 
-- 
GitLab