Skip to content

Commit c7c3ec9

Browse files
committed
reposition plate to bottom of overburden is the plate elevation (depth) is less that the overburden thickness
1 parent 93d48b9 commit c7c3ec9

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

simpeg_drivers/plate_simulation/models/options.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
# '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
1010

1111

12+
from logging import getLogger
13+
1214
import numpy as np
1315
from geoapps_utils.modelling.plates import PlateModel
1416
from geoapps_utils.utils.locations import topo_drape_elevation
@@ -18,13 +20,15 @@
1820
BaseModel,
1921
ConfigDict,
2022
Field,
21-
field_validator,
2223
model_validator,
2324
)
2425

2526
from simpeg_drivers.options import Deprecated
2627

2728

29+
logger = getLogger(__name__)
30+
31+
2832
class PlateOptions(BaseModel):
2933
"""
3034
Parameters describing an anomalous plate.
@@ -112,3 +116,14 @@ class ModelOptions(BaseModel):
112116
background: float
113117
overburden_options: OverburdenOptions
114118
plate_options: PlateOptions
119+
120+
@model_validator(mode="after")
121+
def plate_top_below_overburden(self):
122+
if self.plate_options.geometry.elevation < self.overburden_options.thickness:
123+
logger.warning(
124+
"Overburden thickness exceeds the plate depth. Adjusting"
125+
"plate to bottom of overburden to preserve plate's geometry."
126+
)
127+
self.plate_options.geometry.elevation = self.overburden_options.thickness
128+
129+
return self

tests/plate_simulation/runtest/driver_test.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
# '
99
# '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
1010

11+
import logging
12+
1113
from geoh5py.groups import SimPEGGroup
1214
from geoh5py.ui_json import InputFile
1315

@@ -33,7 +35,7 @@
3335

3436

3537
# pylint: disable=too-many-statements
36-
def test_plate_simulation_params_from_input_file(tmp_path):
38+
def test_plate_simulation_params_from_input_file(tmp_path, caplog):
3739
opts = SyntheticsComponentsOptions(
3840
method="gravity",
3941
survey=SurveyOptions(n_stations=8, n_lines=8),
@@ -87,7 +89,9 @@ def test_plate_simulation_params_from_input_file(tmp_path):
8789
ifile.data["spacing"] = 10.0
8890
ifile.data["elevation"] = 20
8991

90-
params = PlateSimulationOptions.build(ifile)
92+
with caplog.at_level(logging.WARNING):
93+
params = PlateSimulationOptions.build(ifile)
94+
assert "Overburden thickness exceeds the plate depth" in caplog.text
9195
assert isinstance(params.simulation, SimPEGGroup)
9296

9397
simulation_parameters = params.simulation_parameters()
@@ -124,4 +128,5 @@ def test_plate_simulation_params_from_input_file(tmp_path):
124128

125129
assert params.model.plate_options.number == 9
126130
assert params.model.plate_options.spacing == 10.0
127-
assert params.model.plate_options.geometry.elevation == 20.0
131+
# reset by validator
132+
assert params.model.plate_options.geometry.elevation == 50.0

0 commit comments

Comments
 (0)