Skip to content

Commit 255e76d

Browse files
committed
Tohoku: make date-aware
1 parent 34d3b4b commit 255e76d

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

examples/tohoku_inversion/model_config.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
import scipy.interpolate as si
1010

1111

12-
# Setup UTM zone
12+
# Setup zones
13+
sim_tz = timezone.pytz.timezone("Japan")
1314
coord_system = coordsys.UTMCoordinateSystem(utm_zone=54)
1415

1516
# Earthquake epicentre in longitude-latitude coordinates
@@ -117,12 +118,19 @@ def construct_solver(elev_init, store_station_time_series=True, **model_options)
117118
"""
118119
mesh2d = elev_init.function_space().mesh()
119120

120-
t_end = 2 * 3600.0
121+
# Setup temporal discretisation
121122
u_mag = Constant(5.0)
123+
default_start_date = datetime.datetime(2011, 3, 11, 14, 46, tzinfo=sim_tz)
124+
default_end_date = datetime.datetime(2011, 3, 11, 16, 46, tzinfo=sim_tz)
122125
t_export = 60.0
123126
dt = 60.0
124127
if os.getenv("THETIS_REGRESSION_TEST") is not None:
125-
t_end = 5 * t_export
128+
model_options["simulation_initial_date"] = default_start_date
129+
model_options["simulation_end_date"] = datetime.datetime(2011, 3, 11, 14, 51, tzinfo=sim_tz)
130+
if "simulation_initial_date" not in model_options:
131+
model_options["simulation_initial_date"] = default_start_date
132+
if "simulation_end_date" not in model_options:
133+
model_options["simulation_end_date"] = default_end_date
126134

127135
# Bathymetry
128136
P1_2d = get_functionspace(mesh2d, "CG", 1)
@@ -141,7 +149,6 @@ def construct_solver(elev_init, store_station_time_series=True, **model_options)
141149
options.element_family = "dg-dg"
142150
options.simulation_export_time = t_export
143151
options.fields_to_export = ["elev_2d"]
144-
options.simulation_end_time = t_end
145152
options.horizontal_velocity_scale = u_mag
146153
options.swe_timestepper_type = "CrankNicolson"
147154
if not hasattr(options.swe_timestepper_options, "use_automatic_timestep"):

0 commit comments

Comments
 (0)