pastas.model.Model.add_stressmodel#

Model.add_stressmodel(stressmodel, replace=False)[source]#

Add a stressmodel to the main model.

Parameters
  • stressmodel (pastas.stressmodel or list of pastas.stressmodel) – instance of a pastas.stressmodel class. Multiple stress models can be provided (e.g., ml.add_stressmodel([sm1, sm2]) in one call.

  • replace (bool, optional) – force replace the stressmodel if a stressmodel with the same name already exists. Not recommended but useful at times. Default is False.

Return type

None

Notes

To obtain a list of the stressmodel names, type:

>>> ml.get_stressmodel_names()

Examples

>>> sm = ps.StressModel(stress, rfunc=ps.Gamma(), name="stress")
>>> ml.add_stressmodel(sm)

To add multiple stress models at once you can do the following:

>>> sm1 = ps.StressModel(stress, rfunc=ps.Gamma(), name="stress1")
>>> sm2 = ps.StressModel(stress, rfunc=ps.Gamma(), name="stress2")
>>> ml.add_stressmodel([sm1, sm2])