Skip to content
Snippets Groups Projects
Commit 07f521de authored by Lars Bilke's avatar Lars Bilke
Browse files

Merge branch 'ogs-import' into 'master'

[py] Import OpenGeoSys module properly

See merge request ogs/ogs!4843
parents 1a158942 1f802e3c
No related branches found
No related tags found
No related merge requests found
Showing
with 69 additions and 17 deletions
from math import cos, cosh, pi, sin, sinh 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 a = 2.0 * pi / 3.0
......
from math import pi, sin from math import pi, sin
import OpenGeoSys try:
import ogs.callbacks as OpenGeoSys
except ModuleNotFoundError:
import OpenGeoSys
a = 2.0 * pi a = 2.0 * pi
b = 2.0 * pi b = 2.0 * pi
......
import OpenGeoSys try:
import ogs.callbacks as OpenGeoSys
except ModuleNotFoundError:
import OpenGeoSys
p_flux_in = 1e-2 p_flux_in = 1e-2
p_0 = 1e5 p_0 = 1e5
......
import OpenGeoSys try:
import ogs.callbacks as OpenGeoSys
except ModuleNotFoundError:
import OpenGeoSys
dirichlet_displacement_top = -0.05 dirichlet_displacement_top = -0.05
dirichlet_displacement_0 = 0 dirichlet_displacement_0 = 0
......
import OpenGeoSys try:
import ogs.callbacks as OpenGeoSys
except ModuleNotFoundError:
import OpenGeoSys
dirichlet_displacement_0 = 0 dirichlet_displacement_0 = 0
neumann_displacement_overburden = -2.125e6 neumann_displacement_overburden = -2.125e6
......
import OpenGeoSys try:
import ogs.callbacks as OpenGeoSys
except ModuleNotFoundError:
import OpenGeoSys
dirichlet_displacement_0 = 0 dirichlet_displacement_0 = 0
neumann_displacement_overburden = -2.125e6 neumann_displacement_overburden = -2.125e6
......
import OpenGeoSys try:
import ogs.callbacks as OpenGeoSys
except ModuleNotFoundError:
import OpenGeoSys
SPHERE_RADIUS = 1.0 SPHERE_RADIUS = 1.0
START_TIME = 0.0 START_TIME = 0.0
......
import OpenGeoSys try:
import ogs.callbacks as OpenGeoSys
except ModuleNotFoundError:
import OpenGeoSys
from chamber import * from chamber import *
......
import OpenGeoSys try:
import ogs.callbacks as OpenGeoSys
except ModuleNotFoundError:
import OpenGeoSys
class BCPressure(OpenGeoSys.BoundaryCondition): class BCPressure(OpenGeoSys.BoundaryCondition):
......
...@@ -11,7 +11,11 @@ print(sys.version) ...@@ -11,7 +11,11 @@ print(sys.version)
import os import os
import numpy as np import numpy as np
import OpenGeoSys
try:
import ogs.callbacks as OpenGeoSys
except ModuleNotFoundError:
import OpenGeoSys
from pandas import read_csv from pandas import read_csv
from tespy.networks import load_network from tespy.networks import load_network
......
...@@ -11,7 +11,11 @@ print(sys.version) ...@@ -11,7 +11,11 @@ print(sys.version)
import os import os
import numpy as np import numpy as np
import OpenGeoSys
try:
import ogs.callbacks as OpenGeoSys
except ModuleNotFoundError:
import OpenGeoSys
from pandas import read_csv from pandas import read_csv
from tespy.networks import load_network from tespy.networks import load_network
......
...@@ -11,7 +11,11 @@ print(sys.version) ...@@ -11,7 +11,11 @@ print(sys.version)
import os import os
import numpy as np import numpy as np
import OpenGeoSys
try:
import ogs.callbacks as OpenGeoSys
except ModuleNotFoundError:
import OpenGeoSys
from pandas import read_csv from pandas import read_csv
from tespy.networks import load_network from tespy.networks import load_network
......
...@@ -8,7 +8,10 @@ ...@@ -8,7 +8,10 @@
import sys import sys
print(sys.version) print(sys.version)
import OpenGeoSys try:
import ogs.callbacks as OpenGeoSys
except ModuleNotFoundError:
import OpenGeoSys
from pandas import read_csv from pandas import read_csv
df_server = read_csv( df_server = read_csv(
......
...@@ -30,7 +30,7 @@ test notebooks via wheel: ...@@ -30,7 +30,7 @@ test notebooks via wheel:
# status file and sh -c to workaround xvfb-run problems: # status file and sh -c to workaround xvfb-run problems:
# /usr/bin/xvfb-run: line 186: kill: (<PID>) - No such process" # /usr/bin/xvfb-run: line 186: kill: (<PID>) - No such process"
find . -type f -iname '*.ipynb' \ find . -type f -iname '*.ipynb' \
| grep -vP '\.ipynb_checkpoints|\.ci-skip\.ipynb$|_out|\.venv|PhaseField' \ | grep -vP '\.ipynb_checkpoints|\.ci-skip\.ipynb$|_out|\.venv|PhaseField|mtest' \
| xargs xvfb-run -a \ | xargs xvfb-run -a \
sh -c 'statf="$1"; shift; "$@" || echo "$?" >"$statf"' \ sh -c 'statf="$1"; shift; "$@" || echo "$?" >"$statf"' \
-- "$status_file" \ -- "$status_file" \
......
...@@ -105,7 +105,11 @@ Python object `sinx_sinx_source_term` that is created in the last line of the ...@@ -105,7 +105,11 @@ Python object `sinx_sinx_source_term` that is created in the last line of the
Python script: Python script:
```python ```python
import OpenGeoSys try:
import ogs.callbacks as OpenGeoSys
except ModuleNotFoundError:
import OpenGeoSys
from math import pi, sin from math import pi, sin
a = 2.0*pi a = 2.0*pi
......
...@@ -48,7 +48,10 @@ The path to the file can be defined in relative or absolute terms. For example: ...@@ -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: First, the OpenGeoSys module has to be imported:
```python ```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 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 ...@@ -127,7 +130,10 @@ Examples of the application of Python boundary conditions can be found in [this
## Full example of a Python boundary condition ## Full example of a Python boundary condition
```python ```python
import OpenGeoSys try:
import ogs.callbacks as OpenGeoSys
except ModuleNotFoundError:
import OpenGeoSys
class BoundaryCondition(OpenGeoSys): class BoundaryCondition(OpenGeoSys):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment