pyyeti.cla.DR_Event.add¶
- DR_Event.add(nas, drdefs, uf_reds=None, method='replace')[source]¶
Add data recovery definitions for an event or set of modes.
- Parameters:
nas (dictionary) – This is the nas2cam dictionary:
nas = pyyeti.nastran.op2.rdnas2cam(). Only used if at least one category in drdefs is for an upstream superelement (se != 0) and has a data recovery matrix. Can be anything (like None) if not needed.drdefs (
DR_Definstance or None) – Contains the data recovery definitions for, typically, one superelement. SeeDR_Def. If None, this routine does nothing.uf_reds (4-element tuple or None; optional) – If not None, this is the uncertainty factors in “reds” order: [rigid, elastic, dynamic, static]. The values in uf_reds either replace or multiply the original values (see method). Use a value of None for a particular uncertainty value to retain the original value unmodified. This uf_reds option can be useful when uncertainty factors are event specific rather than data recovery category specific or you need to add in a forcing function uncertainty factor.
For example, to reset the dynamic uncertainty factor to 1.1 while leaving the other values unchanged:
uf_reds=(None, None, 1.1, None) DR.add(nas, drdefs, uf_reds)
For another example, to increase the rigid-body and elastic uncertainty factors by a factor of 1.05 while leaving the other two values unchanged:
uf_reds=(1.05, 1.05, None, None) DR.add(nas, drdefs, uf_reds, method='multiply')
method (string or function (callable); optional) –
Specifies how to update the “uf_reds” settings:
method
Description
‘replace’
Values in uf_reds (that are not None) replace old values.
‘multiply’
Values in uf_reds (that are not None) multiply the old values.
callable
Values are computed by function (or any callable). The function is only called for entries where uf_reds is not None. The call is:
method(old_value, new_value). See examples below.
Notes
Typically called once for each superelement where data recovery is requested. The attributes Info, UF_reds and Vars are all updated on each call to this routine.
See
DR_Deffor a discussion about how the order of data recovery is determined. In summary:DR_Event.add()determines the order ofDR_Definstances, andDR_Def.add()determines the order of data recovery categories within eachDR_Definstance.DR_Event.set_dr_order()can be used to modify the final order.Following are some examples of providing a function for the method parameter. Note that the function is only called when the uf_reds value is not None.
These two calls are equivalent:
DR.add(nas, drdefs, uf_reds, 'replace') DR.add(nas, drdefs, uf_reds, lambda old, new: new)
These are also equivalent:
DR.add(nas, drdefs, uf_reds, 'multiply') DR.add(nas, drdefs, uf_reds, lambda old, new: old*new)
As a final example, if you wanted to add values onto the previous settings instead of multiply, you could do this:
DR.add(nas, drdefs, uf_reds, lambda old, new: old+new)
- Raises:
ValueError – When the there are duplicate category names.