Skip to content

Commit 2ee7b1c

Browse files
move main function from run_simulation.py to solifluction.py
add permafrost flag and model for heat_transfer
1 parent d1821ec commit 2ee7b1c

File tree

4 files changed

+237
-145
lines changed

4 files changed

+237
-145
lines changed

source/package/soli3d/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
interpolation,
88
io_data_process,
99
layer,
10-
mass_conservation,
1110
momentum,
1211
phase_detect,
1312
solifluction,
@@ -29,7 +28,6 @@
2928
"interpolation",
3029
"io_data_process",
3130
"layer",
32-
"mass_conservation",
3331
"momentum",
3432
"phase_detect",
3533
"solifluction",

source/package/soli3d/io_data_process.py

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,29 @@ def load_daily_temperatures(csv_path: str) -> tuple[list[float], list[float]]:
200200
return days, temps
201201

202202

203+
def clean_bool(val: str, name: str = "unknown") -> bool:
204+
value = val.split("#")[0].strip().lower()
205+
true_values = ("true", "1", "yes", "y")
206+
false_values = ("false", "0", "no", "n")
207+
208+
if value in true_values:
209+
return True
210+
if value in false_values:
211+
return False
212+
213+
raise ValueError(
214+
f"Invalid boolean value for '{name}': '{val}'. "
215+
f"Expected one of {true_values + false_values}."
216+
)
217+
218+
203219
def read_config_file(param_path: Path) -> tuple[
204220
int, # number_of_iterations
205221
float, # dt_momentum
206222
int, # momentum_iteration_threshold
207223
float, # dt_global_model
208224
float, # dt_heat_transfer
209225
float, # dt_mass_conservation
210-
float, # time_end_simulation
211226
float, # write_intervals_time
212227
int, # partition_shape_size
213228
float, # h_mesh_step_value
@@ -247,11 +262,13 @@ def clean_int(val: str) -> int:
247262
input_variables["simulation"]["momentum_iteration_threshold"]
248263
)
249264

250-
time_end_simulation = clean_float(
251-
input_variables["simulation"]["time_end_simulation"]
252-
)
265+
permafrost = clean_bool(input_variables["simulation"]["permafrost"], "permafrost")
266+
267+
# time_end_simulation = clean_float(
268+
# input_variables["simulation"]["time_end_simulation"]
269+
# )
253270

254-
write_intervals_time = clean_float(
271+
write_intervals_time: float = clean_float(
255272
input_variables["simulation"]["write_intervals_time"]
256273
)
257274

@@ -301,7 +318,6 @@ def clean_int(val: str) -> int:
301318
dt_global_model,
302319
dt_heat_transfer,
303320
dt_mass_conservation,
304-
time_end_simulation,
305321
write_intervals_time,
306322
partition_shape_size,
307323
h_mesh_step_value,
@@ -316,6 +332,7 @@ def clean_int(val: str) -> int:
316332
temps_temperature_file,
317333
results_pathname,
318334
slope_radian,
335+
permafrost,
319336
)
320337

321338

0 commit comments

Comments
 (0)