Skip to content

Commit 0f74d44

Browse files
committed
Test for computation with topography.
1 parent 1c9500e commit 0f74d44

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import numpy as np
2+
3+
import gempy as gp
4+
import time
5+
6+
PLOT = True
7+
8+
9+
def test_compute_at_computation_time():
10+
11+
# Define the path to data
12+
data_path = 'https://raw.githubusercontent.com/cgre-aachen/gempy_data/master/'
13+
path_to_data = data_path + "/data/input_data/jan_models/"
14+
15+
# Create a GeoModel instance
16+
geo_model = gp.create_geomodel(
17+
project_name='EGU_example',
18+
extent=[0, 2500, 0, 1000, 0, 1000],
19+
resolution=[125, 50, 50],
20+
importer_helper=gp.data.ImporterHelper(
21+
path_to_orientations=path_to_data + "model7_orientations.csv",
22+
path_to_surface_points=path_to_data + "model7_surface_points.csv"
23+
)
24+
)
25+
26+
# Map geological series to surfaces
27+
gp.map_stack_to_surfaces(
28+
gempy_model=geo_model,
29+
mapping_object={
30+
"Fault_Series": ('fault'),
31+
"Strat_Series1": ('rock3'),
32+
"Strat_Series2": ('rock2', 'rock1'),
33+
}
34+
)
35+
36+
# Define youngest structural group as fault
37+
gp.set_is_fault(geo_model, ["Fault_Series"])
38+
39+
# Compute a solution for the model
40+
start_time = time.perf_counter()
41+
gp.compute_model(geo_model)
42+
end_time = time.perf_counter()
43+
computation_time_model = end_time - start_time
44+
45+
# Setting a randomly generated topography
46+
gp.set_topography_from_random(
47+
grid=geo_model.grid,
48+
fractal_dimension=2,
49+
d_z=np.array([700, 950]),
50+
topography_resolution=np.array([125, 50])
51+
)
52+
53+
# Recompute model as a new grid was added
54+
start_time = time.perf_counter()
55+
gp.compute_model(geo_model)
56+
end_time = time.perf_counter()
57+
computation_time_topo = end_time - start_time
58+
59+
print(f"Computation time without topography: {computation_time_model:.2f} seconds")
60+
print(f"Computation time with topography: {computation_time_topo:.2f} seconds")

0 commit comments

Comments
 (0)