Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

scrollbar

Create a region for running the model. The SOBEK 3 flow model is now ready to be run. We can do this by simply adding the RunModel statement :

Code Block
languagepy
titleRun the model
RunModel(flowModel, showDialog = True)

This command will run the whole model from start time to end time time.

If you want to have more control on how your model is run, you can use this alternative way.

Code Block
titleRun model with your own control flow
numberOfTimeSteps = int((flowModel.StopTime - flowModel.StartTime).TotalSeconds  / flowModel.TimeStep.TotalSeconds)

flowModel.Initialize()

for i in range(numberOfTimeSteps):
    flowModel.Execute()

flowModel.Finish()
flowModel.Cleanup()

With this last method, you can fully control the run by calling yourself separately the different sub-functions which compose a model run. This gives you the freedom to insert any additional logic you wish after running each time step.

 

scrollbar