diff --git a/Tests/Data/Elliptic/square_1x1_SteadyStateDiffusion_Python/bcs_laplace_eq.py b/Tests/Data/Elliptic/square_1x1_SteadyStateDiffusion_Python/bcs_laplace_eq.py index ca7c2f7211cf0c8924aae3b7816512737e6ca184..9dbe9aac181e47980e512e1b17126bc2331dab3f 100644 --- a/Tests/Data/Elliptic/square_1x1_SteadyStateDiffusion_Python/bcs_laplace_eq.py +++ b/Tests/Data/Elliptic/square_1x1_SteadyStateDiffusion_Python/bcs_laplace_eq.py @@ -1,6 +1,9 @@ from math import cos, cosh, pi, sin, sinh -import OpenGeoSys +try: + import ogs.callbacks as OpenGeoSys +except ModuleNotFoundError: + import OpenGeoSys a = 2.0 * pi / 3.0 diff --git a/Tests/Data/Elliptic/square_1x1_SteadyStateDiffusion_Python/sin_x_sin_y_source_term.py b/Tests/Data/Elliptic/square_1x1_SteadyStateDiffusion_Python/sin_x_sin_y_source_term.py index e441394b693f62cdcf2d89c6e0859890f9eab939..c8b05010782c2ee869edd297dc270edff91c9375 100644 --- a/Tests/Data/Elliptic/square_1x1_SteadyStateDiffusion_Python/sin_x_sin_y_source_term.py +++ b/Tests/Data/Elliptic/square_1x1_SteadyStateDiffusion_Python/sin_x_sin_y_source_term.py @@ -1,6 +1,9 @@ from math import pi, sin -import OpenGeoSys +try: + import ogs.callbacks as OpenGeoSys +except ModuleNotFoundError: + import OpenGeoSys a = 2.0 * pi b = 2.0 * pi diff --git a/Tests/Data/HydroMechanics/IdealGas/flow_pressure_boundary/python_boundary.py b/Tests/Data/HydroMechanics/IdealGas/flow_pressure_boundary/python_boundary.py index dbff37df9cee27e02d5edf1081c042fe9cd3a24d..7889b8fd670be31ff070cd22c4d6c707a5685a01 100644 --- a/Tests/Data/HydroMechanics/IdealGas/flow_pressure_boundary/python_boundary.py +++ b/Tests/Data/HydroMechanics/IdealGas/flow_pressure_boundary/python_boundary.py @@ -1,4 +1,7 @@ -import OpenGeoSys +try: + import ogs.callbacks as OpenGeoSys +except ModuleNotFoundError: + import OpenGeoSys p_flux_in = 1e-2 p_0 = 1e5 diff --git a/Tests/Data/HydroMechanics/Linear/Unconfined_Compression_early/python_boundary.py b/Tests/Data/HydroMechanics/Linear/Unconfined_Compression_early/python_boundary.py index 8a484407730e394bd018193e06e8a5abe48ff603..b676a7a79df09c208ff0f6a122f24d7420c526ad 100644 --- a/Tests/Data/HydroMechanics/Linear/Unconfined_Compression_early/python_boundary.py +++ b/Tests/Data/HydroMechanics/Linear/Unconfined_Compression_early/python_boundary.py @@ -1,4 +1,7 @@ -import OpenGeoSys +try: + import ogs.callbacks as OpenGeoSys +except ModuleNotFoundError: + import OpenGeoSys dirichlet_displacement_top = -0.05 dirichlet_displacement_0 = 0 diff --git a/Tests/Data/HydroMechanics/StaggeredScheme/InjectionProduction1D/python_boundary.py b/Tests/Data/HydroMechanics/StaggeredScheme/InjectionProduction1D/python_boundary.py index 10a393606fa938e9a3a04ab26b930b7e9b2bdcda..703478d3f35967057e71437511641a1fc6d91e0e 100644 --- a/Tests/Data/HydroMechanics/StaggeredScheme/InjectionProduction1D/python_boundary.py +++ b/Tests/Data/HydroMechanics/StaggeredScheme/InjectionProduction1D/python_boundary.py @@ -1,4 +1,7 @@ -import OpenGeoSys +try: + import ogs.callbacks as OpenGeoSys +except ModuleNotFoundError: + import OpenGeoSys dirichlet_displacement_0 = 0 neumann_displacement_overburden = -2.125e6 diff --git a/Tests/Data/HydroMechanics/StaggeredScheme/InjectionProduction1D/python_boundary_staggered.py b/Tests/Data/HydroMechanics/StaggeredScheme/InjectionProduction1D/python_boundary_staggered.py index b4740b7686c9c40da90a782f86e946bc2002adf3..bc9f209eeb8cc6f49b6ab2fc87bd0d0655e813b4 100644 --- a/Tests/Data/HydroMechanics/StaggeredScheme/InjectionProduction1D/python_boundary_staggered.py +++ b/Tests/Data/HydroMechanics/StaggeredScheme/InjectionProduction1D/python_boundary_staggered.py @@ -1,4 +1,7 @@ -import OpenGeoSys +try: + import ogs.callbacks as OpenGeoSys +except ModuleNotFoundError: + import OpenGeoSys dirichlet_displacement_0 = 0 neumann_displacement_overburden = -2.125e6 diff --git a/Tests/Data/Mechanics/Linear/PythonHertzContact/hertz_contact_bc.py b/Tests/Data/Mechanics/Linear/PythonHertzContact/hertz_contact_bc.py index 6dddb584465301c1c55f4e632bc75384f9e5753d..36583ee1a82b7067fc693a65e5beb7297fa29a8f 100644 --- a/Tests/Data/Mechanics/Linear/PythonHertzContact/hertz_contact_bc.py +++ b/Tests/Data/Mechanics/Linear/PythonHertzContact/hertz_contact_bc.py @@ -1,4 +1,7 @@ -import OpenGeoSys +try: + import ogs.callbacks as OpenGeoSys +except ModuleNotFoundError: + import OpenGeoSys SPHERE_RADIUS = 1.0 START_TIME = 0.0 diff --git a/Tests/Data/Mechanics/Linear/PythonPiston/piston_bc.py b/Tests/Data/Mechanics/Linear/PythonPiston/piston_bc.py index b7437e06bc58c272d80d9a8c6ee5f837cfa8cfd9..66d9f1dbcde4befa7f338cd2b634116b57441fcb 100644 --- a/Tests/Data/Mechanics/Linear/PythonPiston/piston_bc.py +++ b/Tests/Data/Mechanics/Linear/PythonPiston/piston_bc.py @@ -1,4 +1,7 @@ -import OpenGeoSys +try: + import ogs.callbacks as OpenGeoSys +except ModuleNotFoundError: + import OpenGeoSys from chamber import * diff --git a/Tests/Data/Parabolic/ComponentTransport/elder/elder-python-bcs.py b/Tests/Data/Parabolic/ComponentTransport/elder/elder-python-bcs.py index 3d815d21b7bc5486b97ffaf7c6e9bb7c147cf67d..487aa5419938d1e4ee3317e8cf92ea4f767a752a 100644 --- a/Tests/Data/Parabolic/ComponentTransport/elder/elder-python-bcs.py +++ b/Tests/Data/Parabolic/ComponentTransport/elder/elder-python-bcs.py @@ -1,4 +1,7 @@ -import OpenGeoSys +try: + import ogs.callbacks as OpenGeoSys +except ModuleNotFoundError: + import OpenGeoSys class BCPressure(OpenGeoSys.BoundaryCondition): diff --git a/Tests/Data/Parabolic/T/3D_3BHEs_array/bcs_tespy.py b/Tests/Data/Parabolic/T/3D_3BHEs_array/bcs_tespy.py index f9af119c09dcf5640e90dfefd2156ba448ecf6f9..e0b87b5a866f8c40b8b83031fafbe305e993bbc8 100644 --- a/Tests/Data/Parabolic/T/3D_3BHEs_array/bcs_tespy.py +++ b/Tests/Data/Parabolic/T/3D_3BHEs_array/bcs_tespy.py @@ -11,7 +11,11 @@ print(sys.version) import os import numpy as np -import OpenGeoSys + +try: + import ogs.callbacks as OpenGeoSys +except ModuleNotFoundError: + import OpenGeoSys from pandas import read_csv from tespy.networks import load_network diff --git a/Tests/Data/Parabolic/T/3D_3BHEs_array/bcs_tespy_closedloop.py b/Tests/Data/Parabolic/T/3D_3BHEs_array/bcs_tespy_closedloop.py index 9af36c6c5118c4dcb1cb92fad2da643e0b070111..3d41bf42d46fe514b407a2b6d59c83e303dbe710 100644 --- a/Tests/Data/Parabolic/T/3D_3BHEs_array/bcs_tespy_closedloop.py +++ b/Tests/Data/Parabolic/T/3D_3BHEs_array/bcs_tespy_closedloop.py @@ -11,7 +11,11 @@ print(sys.version) import os import numpy as np -import OpenGeoSys + +try: + import ogs.callbacks as OpenGeoSys +except ModuleNotFoundError: + import OpenGeoSys from pandas import read_csv from tespy.networks import load_network diff --git a/Tests/Data/Parabolic/T/3D_3BHEs_array_python_interface/bcs_tespy_and_serverCommunication.py b/Tests/Data/Parabolic/T/3D_3BHEs_array_python_interface/bcs_tespy_and_serverCommunication.py index 520254b3b12c6b9f070628171962cb18f03c2117..6591d9fd59535dbba26e4fb23ca1e355cbf1457f 100644 --- a/Tests/Data/Parabolic/T/3D_3BHEs_array_python_interface/bcs_tespy_and_serverCommunication.py +++ b/Tests/Data/Parabolic/T/3D_3BHEs_array_python_interface/bcs_tespy_and_serverCommunication.py @@ -11,7 +11,11 @@ print(sys.version) import os import numpy as np -import OpenGeoSys + +try: + import ogs.callbacks as OpenGeoSys +except ModuleNotFoundError: + import OpenGeoSys from pandas import read_csv from tespy.networks import load_network diff --git a/Tests/Data/Parabolic/T/3D_Beier_sandbox_python_interface/simulationX_test.py b/Tests/Data/Parabolic/T/3D_Beier_sandbox_python_interface/simulationX_test.py index c366bd6346be9c143bf6ce2e208c75573a3639d5..2656742335b27c03567a6369892b148e0cf32fa0 100644 --- a/Tests/Data/Parabolic/T/3D_Beier_sandbox_python_interface/simulationX_test.py +++ b/Tests/Data/Parabolic/T/3D_Beier_sandbox_python_interface/simulationX_test.py @@ -8,7 +8,10 @@ import sys print(sys.version) -import OpenGeoSys +try: + import ogs.callbacks as OpenGeoSys +except ModuleNotFoundError: + import OpenGeoSys from pandas import read_csv df_server = read_csv( diff --git a/web/content/docs/benchmarks/elliptic/poisson_equation/index.md b/web/content/docs/benchmarks/elliptic/poisson_equation/index.md index 7d1542c0bcad3814bb6b8435d57e833103aa217a..29ae58f81d35f850ef7158e34ccecf3209806799 100644 --- a/web/content/docs/benchmarks/elliptic/poisson_equation/index.md +++ b/web/content/docs/benchmarks/elliptic/poisson_equation/index.md @@ -105,7 +105,11 @@ Python object `sinx_sinx_source_term` that is created in the last line of the Python script: ```python -import OpenGeoSys +try: + import ogs.callbacks as OpenGeoSys +except ModuleNotFoundError: + import OpenGeoSys + from math import pi, sin a = 2.0*pi diff --git a/web/content/docs/userguide/features/python_bc.md b/web/content/docs/userguide/features/python_bc.md index 86b1ff598dfe14baf335f239161bd16f364bc679..49beca78657772bfc258dd4ce9c2dcb50605745c 100644 --- a/web/content/docs/userguide/features/python_bc.md +++ b/web/content/docs/userguide/features/python_bc.md @@ -48,7 +48,10 @@ The path to the file can be defined in relative or absolute terms. For example: First, the OpenGeoSys module has to be imported: ```python -import OpenGeoSys +try: + import ogs.callbacks as OpenGeoSys +except ModuleNotFoundError: + import OpenGeoSys ``` This module doesn't need to be installed, if OpenGeoSys is compiled with Python support, then it is part of the Python @@ -127,7 +130,10 @@ Examples of the application of Python boundary conditions can be found in [this ## Full example of a Python boundary condition ```python -import OpenGeoSys +try: + import ogs.callbacks as OpenGeoSys +except ModuleNotFoundError: + import OpenGeoSys class BoundaryCondition(OpenGeoSys):