autopdex.models.ModelContext
- class autopdex.models.ModelContext(mode: str, x_int: Any, trial_ansatz: Dict[str, Callable], test_ansatz: Dict[str, Callable] | None = None, internal_vars: Dict[str, Any] | None = None, local_solvers: Dict[str, Callable] | None = None, settings: Dict[str, Any] | None = None, static_settings: Any = None, elem_number: Any = None, int_point_number: Any = None, set: Any = None, t: Any = None, dt: Any = None)[source]
Argument passed to every high-level model function registered via
SimState.add_model().A single model function can serve several purposes; the requested one is signalled by
modeand determines what has to be returned:"weak form"or"potential": return a scalar integrand."internal variables": return the dict of updated internal variables."output": return{name: value, ...}for postprocessing.
- mode
Requested evaluation mode (see above).
- Type:
str
- x_int
Coordinates of the current integration point in the reference domain; the ansatz callables are evaluated here. Derivatives w.r.t. x_int are computed w.r.t. initial configuration via a custom jvp rule.
- Type:
Any
- trial_ansatz
Dict
field name -> ansatz(x_int, t)returning the trial field. The reserved key"physical coor"maps a reference point to its physical position, e.g.x = ctx.trial_ansatz["physical coor"](ctx.x_int).- Type:
Dict[str, Callable]
- test_ansatz
Dict
field name -> test(x_int)used to build the weak-form residual;Nonein"potential"/"output"mode.- Type:
Dict[str, Callable] | None
- internal_vars
Internal variables at the integration point (e.g. plastic strain), read in
"output"mode and forwarded to the local solvers.- Type:
Dict[str, Any] | None
- local_solvers
Registered local subsystems; can be invoked through
solve_local().- Type:
Dict[str, Callable] | None
- settings, static_settings
Runtime and compile-time settings dicts (material parameters,user key words …).
- elem_number, int_point_number, set
Index of the current element, integration point and domain/set.
- t, dt
Current time and time increment.
- __init__(mode: str, x_int: Any, trial_ansatz: Dict[str, Callable], test_ansatz: Dict[str, Callable] | None = None, internal_vars: Dict[str, Any] | None = None, local_solvers: Dict[str, Callable] | None = None, settings: Dict[str, Any] | None = None, static_settings: Any = None, elem_number: Any = None, int_point_number: Any = None, set: Any = None, t: Any = None, dt: Any = None) None
Methods
__delattr__(name)Implement delattr(self, name).
__dir__()Default dir() implementation.
__eq__(other)Return self==value.
__format__(format_spec, /)Default object formatter.
__ge__(value, /)Return self>=value.
__getattribute__(name, /)Return getattr(self, name).
__getstate__()Helper for pickle.
__gt__(value, /)Return self>value.
__hash__()Return hash(self).
__init_subclass__This method is called when a class is subclassed.
__le__(value, /)Return self<=value.
__lt__(value, /)Return self<value.
__ne__(value, /)Return self!=value.
__new__(*args, **kwargs)__post_init__()__reduce__()Helper for pickle.
__reduce_ex__(protocol, /)Helper for pickle.
__repr__()Return repr(self).
__setattr__(name, value)Implement setattr(self, name, value).
__sizeof__()Size of object in memory, in bytes.
__str__()Return str(self).
__subclasshook__Abstract classes can override this to customize issubclass().
solve_local(key[, inputs])Attributes
__annotations____dataclass_fields____dataclass_params____dict____doc____match_args____module____weakref__list of weak references to the object
dtelem_numberint_point_numbersetsettingsstatic_settingst