Skip to content

Commit 9222ef2

Browse files
authored
Merge pull request #919 from KratosMultiphysics/mpm/restart_implementation
MPM Restart Update
2 parents 79b88ac + 45c9075 commit 9222ef2

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

kratos.gid/apps/MPM/write/writeProjectParameters.tcl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ proc ::MPM::write::getParametersDict { } {
3232
# add _Body to model_import_settings
3333
set model_import_settings_dict [dict get $project_parameters_dict solver_settings model_import_settings]
3434
dict append model_import_settings_dict input_filename _Body
35+
if {[write::isBooleanTrue [write::getValue EnableRestartOutput]]} {dict set model_import_settings_dict restart_load_file_label " "}
3536
dict set project_parameters_dict solver_settings model_import_settings $model_import_settings_dict
3637

38+
3739
# materials file
3840
dict set project_parameters_dict solver_settings material_import_settings materials_filename [GetAttribute materials_file]
3941

@@ -224,6 +226,24 @@ proc ::MPM::write::GetOutputProcessesList { } {
224226

225227
}
226228

229+
# Restart
230+
set need_restart [write::getValue EnableRestartOutput]
231+
if {[write::isBooleanTrue $need_restart]} {
232+
set restart_dict [dict create ]
233+
dict set restart_dict python_module save_restart_process
234+
dict set restart_dict kratos_module KratosMultiphysics
235+
dict set restart_dict process_name SaveRestartProcess
236+
set restart_parameters_dict [dict create ]
237+
dict set restart_parameters_dict model_part_name MPM_Material
238+
dict set restart_parameters_dict echo_level 0
239+
set restOutputCT [write::getValue RestartOptions OutputControlType]
240+
dict set restart_parameters_dict restart_control_type $restOutputCT
241+
if {$restOutputCT eq "time"} {dict set restart_parameters_dict restart_save_frequency [write::getValue RestartOptions OutputDeltaTime]} {dict set restart_parameters_dict restart_save_frequency [write::getValue RestartOptions OutputDeltaStep]}
242+
dict set restart_dict Parameters $restart_parameters_dict
243+
dict set output_process save_restart_process [list $restart_dict]
244+
245+
}
246+
227247
return $output_process
228248
}
229249

kratos.gid/apps/MPM/xml/Results.spd

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,16 @@
4949

5050
</container>
5151
</container>
52+
<container n="RestartOutput" pn="Restart-Output" un="RestartOutput" state="normal" open="1" open_window="0" icon="results">
53+
<value n="EnableRestartOutput" pn="Enable output" v="Yes" values="Yes,No" un="EnableRestartOutput" help="Writing output for Restart or not" />
54+
<container n="RestartOptions" pn="Options" un="RestartOptions" help="Restart postprocess options" open_window="1" icon="options" state="[checkStateByUniqueName EnableRestartOutput Yes]">
55+
<value n="OutputControlType" pn="Units used for output frequency" v="step" values="time,step" dict="time,Time (s),step,Steps" help="" update_proc="spdAux::RequestRefresh">
56+
<dependencies node="../value" actualize="1"/>
57+
</value>
58+
<value n="OutputDeltaTime" pn="Time between outputs (s)" v="1.0" help="Output will be printed in intervals of this time" state="[getStateFromXPathValue {string(../value[@n='OutputControlType']/@v)} time]"/>
59+
<value n="OutputDeltaStep" pn="Time steps between outputs" v="1" help="Output will be printed in intervals of this number of steps" state="[getStateFromXPathValue {string(../value[@n='OutputControlType']/@v)} step]"/>
60+
61+
</container>
62+
</container>
5263

5364
</container>

0 commit comments

Comments
 (0)