File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
include/neml2/userobjects Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ class NEML2ModelExecutor : public NEML2ModelInterface<GeneralUserObject>
4141 void finalize () override ;
4242
4343 void initialSetup () override ;
44+ void timestepSetup () override ;
4445
4546 // / Get the batch index for the given element ID
4647 std::size_t getBatchIndex (dof_id_type elem_id) const ;
Original file line number Diff line number Diff line change @@ -31,6 +31,12 @@ NEML2ModelExecutor::actionParams()
3131 "List of NEML2 variables to skip error checking when setting up the model input. If an "
3232 "input variable is skipped, its value will stay zero. If a required input variable is "
3333 "not skipped, an error will be raised." );
34+ params .addParam < bool > (
35+ "advance_step_on_device" ,
36+ false,
37+ "Keep state and forces on the device and advance it to old_state and old_forces without a "
38+ "roundtrip through MOOSE materials. This is only recommended for explicit time integration "
39+ "or when absolutely no restepping occurs (e.g. failed timesteps)." );
3440 return params ;
3541}
3642
@@ -167,6 +173,20 @@ NEML2ModelExecutor::initialSetup()
167173 "those called `NEML2To*MOOSEMaterialProperty`." );
168174}
169175
176+ void
177+ NEML2ModelExecutor ::timestepSetup ()
178+ {
179+ if (_advance_step_on_device && _t_step > 0 )
180+ {
181+ // Set old state variables and old forces
182+ if (model ().input_axis ().has_subaxis ("old_state" ) && model ().output_axis ().has_subaxis ("state" ))
183+ _in .slice ("old_state" ).fill (_out .slice ("state" ));
184+ if (model ().input_axis ().has_subaxis ("old_forces" ) &&
185+ model ().input_axis ().has_subaxis ("forces" ))
186+ _in .slice ("old_forces" ).fill (_in .slice ("forces" ));
187+ }
188+ }
189+
170190std ::size_t
171191NEML2ModelExecutor ::getBatchIndex (dof_id_type elem_id ) const
172192{
You can’t perform that action at this time.
0 commit comments