Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[ENH] Make geophysics input optional
  • Loading branch information
Leguark committed May 25, 2025
commit 61ae4668d32b6313eacc04836096a8e74c13acc9
2 changes: 1 addition & 1 deletion gempy/core/data/geo_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class GeoModel(BaseModel):
# region GemPy engine data types
_interpolation_options: InterpolationOptions #: The interpolation options provided by the user.

geophysics_input: GeophysicsInput = Field(default=None, exclude=False) #: The geophysics input of the geological model.
geophysics_input: GeophysicsInput | None = Field(default=None, exclude=False) #: The geophysics input of the geological model.
input_transform: Transform = Field(default=None, exclude=False) #: The transformation used in the geological model for input points.

interpolation_grid: EngineGrid = Field(default=None, exclude=True) #: ptional grid used for interpolation. Can be seen as a cache field.
Expand Down
11 changes: 8 additions & 3 deletions test/test_modules/test_faults/test_finite_faults.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import gempy as gp
import gempy_viewer as gpv
from gempy.core.data.enumerators import ExampleModel
from gempy.modules.serialization.save_load import verify_model_serialization
from gempy_viewer.optional_dependencies import require_pyvista
from test.conftest import TEST_SPEED, TestSpeed

Expand Down Expand Up @@ -32,13 +33,11 @@ def test_finite_fault_scalar_field_on_fault():
radius=scaled_radius,
max_slope=k # * This controls the speed of the transition
)

transform = gp.data.Transform(
position=np.array([0, 0, 0]),
rotation=np.array([0, 60, 0]),
scale=np.ones(3)
)

faults_data = gp.data.FaultsData(
fault_values_everywhere=np.zeros(0),
fault_values_on_sp=np.zeros(0),
Expand All @@ -53,10 +52,16 @@ def test_finite_fault_scalar_field_on_fault():
)

geo_model.structural_frame.structural_groups[0].faults_input_data = faults_data

verify_model_serialization(
model=geo_model,
verify_moment="after",
file_name=f"verify/{geo_model.meta.name}"
)

gp.compute_model(geo_model)

# TODO: Try to do this afterwards
# scalar_fault = scalar_funtion(regular_grid.values)

if plot_pyvista := True:
plot3d = gpv.plot_3d(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
{
"meta": {
"name": "fault",
"creation_date": "<DATE_IGNORED>",
"last_modification_date": null,
"owner": null
},
"structural_frame": {
"structural_groups": [
{
"name": "Fault_Series",
"elements": [
{
"name": "fault",
"is_active": true,
"_color": "#527682",
"surface_points": {
"name_id_map": {
"fault": 65970106,
"rock1": 167239155,
"rock2": 217776925
},
"_model_transform": null
},
"orientations": {
"name_id_map": {
"fault": 65970106,
"rock1": 167239155,
"rock2": 217776925
},
"_model_transform": null
},
"scalar_field_at_interface": null,
"_id": 65970106
}
],
"structural_relation": 3,
"fault_relations": 1,
"faults_input_data": {
"fault_values_everywhere": [],
"fault_values_on_sp": [],
"fault_values_ref": [],
"fault_values_rest": [],
"thickness": null,
"finite_fault_data": {
"implicit_function_transform": {
"position": [
0,
0,
0
],
"rotation": [
0,
60,
0
],
"scale": [
1.0,
1.0,
1.0
],
"_is_default_transform": false,
"_cached_pivot": null
},
"pivot": [
0.0,
0.0,
0.0
]
}
},
"solution": null
},
{
"name": "Strat_Series",
"elements": [
{
"name": "rock2",
"is_active": true,
"_color": "#ffbe00",
"surface_points": {
"name_id_map": {
"fault": 65970106,
"rock1": 167239155,
"rock2": 217776925
},
"_model_transform": null
},
"orientations": {
"name_id_map": {
"fault": 65970106,
"rock1": 167239155,
"rock2": 217776925
},
"_model_transform": null
},
"scalar_field_at_interface": null,
"_id": 217776925
},
{
"name": "rock1",
"is_active": true,
"_color": "#9f0052",
"surface_points": {
"name_id_map": {
"fault": 65970106,
"rock1": 167239155,
"rock2": 217776925
},
"_model_transform": null
},
"orientations": {
"name_id_map": {
"fault": 65970106,
"rock1": 167239155,
"rock2": 217776925
},
"_model_transform": null
},
"scalar_field_at_interface": null,
"_id": 167239155
}
],
"structural_relation": 1,
"fault_relations": 3,
"faults_input_data": null,
"solution": null
}
],
"is_dirty": true,
"basement_color": "#728f02",
"binary_meta_data": {
"sp_binary_length": 792
}
},
"grid": {
"_octree_grid": {
"resolution": [
64,
64,
64
],
"extent": [
0.0,
1000.0,
0.0,
1000.0,
0.0,
1000.0
],
"_transform": null
},
"_dense_grid": null,
"_custom_grid": null,
"_topography": null,
"_sections": null,
"_centered_grid": null,
"_transform": null,
"_octree_levels": -1,
"active_grids": 1025
},
"geophysics_input": null,
"input_transform": {
"position": [
-500.0,
-500.0,
-500.0
],
"rotation": [
0.0,
0.0,
0.0
],
"scale": [
0.0005,
0.0005,
0.0005
],
"_is_default_transform": false,
"_cached_pivot": null
},
"_interpolation_options": {
"kernel_options": {
"range": 1.7,
"c_o": 10.0,
"uni_degree": 1,
"i_res": 4.0,
"gi_res": 2.0,
"number_dimensions": 3,
"kernel_function": "cubic",
"kernel_solver": 1,
"compute_condition_number": false,
"optimizing_condition_number": false,
"condition_number": null
},
"evaluation_options": {
"_number_octree_levels": 6,
"_number_octree_levels_surface": 4,
"octree_curvature_threshold": -1.0,
"octree_error_threshold": 1.0,
"octree_min_level": 2,
"mesh_extraction": true,
"mesh_extraction_masking_options": 3,
"mesh_extraction_fancy": true,
"evaluation_chunk_size": 500000,
"compute_scalar_gradient": false,
"verbose": false
},
"debug": true,
"cache_mode": 3,
"cache_model_name": "fault",
"block_solutions_type": 1,
"sigmoid_slope": 5000000,
"debug_water_tight": false
}
}