diff --git a/Tests/Data/Mechanics/Linear/DiscWithHole/Linear_Disc_with_hole_convergence_analysis.ipynb b/Tests/Data/Mechanics/Linear/DiscWithHole/Linear_Disc_with_hole_convergence_analysis.ipynb index e6e9b6e1a495f622ef63d8fb5cc01e2fae8967c8..4233098faaed73728dd595a9d58801eeae75f07f 100644 --- a/Tests/Data/Mechanics/Linear/DiscWithHole/Linear_Disc_with_hole_convergence_analysis.ipynb +++ b/Tests/Data/Mechanics/Linear/DiscWithHole/Linear_Disc_with_hole_convergence_analysis.ipynb @@ -114,12 +114,11 @@ "outputs": [], "source": [ "import os\n", + "from pathlib import Path\n", "\n", - "# All files produced by this notebook will be put there.\n", - "# ATTENTION: We assume that this notebook is executed in the directory where\n", - "# it is stored. Otherwise this notebook might not work!\n", - "out_dir = os.environ.get(\"OGS_TESTRUNNER_OUT_DIR\", \"out\")\n", - "os.makedirs(out_dir, exist_ok=True)" + "out_dir = Path(os.environ.get(\"OGS_TESTRUNNER_OUT_DIR\", \"_out\"))\n", + "if not out_dir.exists():\n", + " out_dir.mkdir(parents=True)" ] }, { @@ -259,7 +258,7 @@ " return f_abs_tt, f_rel_tt\n", "\n", "\n", - "def compute_cell_size(idx, mesh):\n", + "def compute_cell_size(_idx, mesh):\n", " pt1 = (19.999, 0, 0)\n", " pt2 = (19.999, 20, 0)\n", " line_mesh = slice_along_line(mesh, pt1, pt2)\n", @@ -719,7 +718,7 @@ "\n", " shutil.copy2(prj_file, out_dir)\n", "\n", - " prj_path = os.path.join(out_dir, prj_file)\n", + " prj_path = out_dir / prj_file\n", "\n", " model = ogs.OGS(INPUT_FILE=prj_path, PROJECT_FILE=prj_path)\n", " model.run_model(logfile=f\"{out_dir}/out.txt\", args=f\"-o {out_dir}\")" @@ -914,8 +913,7 @@ " if len(vec4.shape) == 1:\n", " # only a single 4-vector will be converted\n", " return vec4_to_mat3x3polar_single(vec4, xs, ys)\n", - " else:\n", - " return vec4_to_mat3x3polar_multi(vec4, xs, ys)" + " return vec4_to_mat3x3polar_multi(vec4, xs, ys)" ] }, { @@ -1374,7 +1372,7 @@ }, "outputs": [], "source": [ - "def compute_ell_2_norm_sigma(idx, sigmas_test, sigmas_reference):\n", + "def compute_ell_2_norm_sigma(_idx, sigmas_test, sigmas_reference):\n", " sig_rr, sig_tt, sig_rt = sigmas_test\n", " sig_rr_240, sig_tt_240, sig_rt_240 = sigmas_reference\n", "\n", @@ -1401,7 +1399,7 @@ }, "outputs": [], "source": [ - "def compute_ell_2_norm_displacement(idx, mesh_resampled_to_240_resolution, mesh_fine):\n", + "def compute_ell_2_norm_displacement(_idx, mesh_resampled_to_240_resolution, mesh_fine):\n", " dis = mesh_resampled_to_240_resolution.point_data[\"displacement\"]\n", " dis_x = dis[:, 0]\n", " dis_y = dis[:, 1]\n", @@ -1431,7 +1429,7 @@ }, "outputs": [], "source": [ - "def compute_root_mean_square_sigma(idx, sigmas_test, sigmas_reference):\n", + "def compute_root_mean_square_sigma(_idx, sigmas_test, sigmas_reference):\n", " sig_rr, sig_tt, sig_rt = sigmas_test\n", " sig_rr_240, sig_tt_240, sig_rt_240 = sigmas_reference\n", "\n", @@ -1456,7 +1454,7 @@ "outputs": [], "source": [ "def compute_root_mean_square_displacement(\n", - " idx, mesh_resampled_to_240_resolution, mesh_fine\n", + " _idx, mesh_resampled_to_240_resolution, mesh_fine\n", "):\n", " points = mesh_resampled_to_240_resolution.point_data[\"sigma\"].shape[0]\n", "\n", @@ -1487,7 +1485,7 @@ "outputs": [], "source": [ "def compute_Ell_2_norm_sigma(\n", - " idx, mesh_resampled_to_240_resolution, sigmas_test, sigmas_reference\n", + " _idx, mesh_resampled_to_240_resolution, sigmas_test, sigmas_reference\n", "):\n", " sig_rr, sig_tt, sig_rt = sigmas_test\n", " sig_rr_240, sig_tt_240, sig_rt_240 = sigmas_reference\n", @@ -1526,7 +1524,7 @@ }, "outputs": [], "source": [ - "def compute_Ell_2_norm_displacement(idx, mesh_resampled_to_240_resolution, mesh_fine):\n", + "def compute_Ell_2_norm_displacement(_idx, mesh_resampled_to_240_resolution, mesh_fine):\n", " dis = mesh_resampled_to_240_resolution.point_data[\"displacement\"]\n", " dis_x = dis[:, 0]\n", " dis_y = dis[:, 1]\n",