From f8270967422bc0caf855f0f704c4e604d5448a72 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Fri, 26 Jul 2024 10:40:48 +0200
Subject: [PATCH] [py] Some pytest fixes for PETSc config.

---
 .../aniso_expansion.prj                         | 17 +++++++++++++----
 Tests/Python/test_matrix_debug_output.py        |  5 +++++
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/Tests/Data/ThermoRichardsMechanics/anisotropic_thermal_expansion/aniso_expansion.prj b/Tests/Data/ThermoRichardsMechanics/anisotropic_thermal_expansion/aniso_expansion.prj
index 47ce3430c0d..a8810ce04a7 100644
--- a/Tests/Data/ThermoRichardsMechanics/anisotropic_thermal_expansion/aniso_expansion.prj
+++ b/Tests/Data/ThermoRichardsMechanics/anisotropic_thermal_expansion/aniso_expansion.prj
@@ -37,10 +37,10 @@
                             <type>Constant</type>
                             <value>1e-3</value>
                         </property>
-                         <property>
-                             <name>density</name>
-                             <type>Constant</type>
-                             <value>1000</value>
+                        <property>
+                            <name>density</name>
+                            <type>Constant</type>
+                            <value>1000</value>
                         </property>
                         <property>
                             <name>specific_heat_capacity</name>
@@ -335,6 +335,15 @@
             <eigen>
                 <solver_type>SparseLU</solver_type>
             </eigen>
+            <petsc>
+                <parameters>
+                    -ksp_type bcgs
+                    -pc_type lu
+                    -ksp_rtol 1e-8
+                    -ksp_atol 1e-12
+                    -ksp_max_it 4000
+                </parameters>
+            </petsc>
         </linear_solver>
     </linear_solvers>
 </OpenGeoSysProject>
diff --git a/Tests/Python/test_matrix_debug_output.py b/Tests/Python/test_matrix_debug_output.py
index dad4970179d..9a218ecb21d 100644
--- a/Tests/Python/test_matrix_debug_output.py
+++ b/Tests/Python/test_matrix_debug_output.py
@@ -3,6 +3,7 @@ import platform
 import tempfile
 from pathlib import Path
 
+import ogs
 import pytest
 from ogs import cli
 
@@ -154,6 +155,10 @@ def test_local_matrix_debug_output(monkeypatch, prefix_parameter, elements_param
         ("", True, True),  # set env var to an empty string
     ],
 )
+@pytest.mark.skipif(
+    ogs.OGS_USE_PETSC == "ON",
+    reason="global matrix output is not implemented for PETSc matrices",
+)
 def test_global_matrix_debug_output(monkeypatch, prefix_parameter):
     srcdir = Path(__file__).parent.parent.parent
     prjpath = srcdir / "Tests/Data/Mechanics/Linear/square_1e2.prj"
-- 
GitLab