jaxmat.config module

jaxmat.config module#

Global configuration options of jaxmat.

Options are read as module attributes and set like JAX’s own configuration:

import jaxmat

jaxmat.config.update("check_max_traces", True)
jaxmat.config.check_max_traces  # True

with jaxmat.config.override(check_max_traces=True):  # temporarily
    ...

Each option can also be set before importing jaxmat with an environment variable named JAXMAT_<OPTION> in upper case, e.g. JAXMAT_CHECK_MAX_TRACES=1 (accepted values: 1/0, true/false, yes/no, on/off).

check_max_traces: bool = False#

Assert that the constitutive_update of jaxmat behaviors is traced (compiled) at most once, to catch unintended retracing while developing. Off by default: the trace counter is shared by all instances of a behavior class, so legitimate uses also retrace, e.g. two materials of the same class with different hardening laws, or a behavior wrapped by another one. Only traces happening while the option is on are counted. Environment variable: JAXMAT_CHECK_MAX_TRACES.

update(name, value)[source]#

Set the option name to value.

Parameters:
  • name (str)

  • value (bool)

override(**options)[source]#

Context manager setting options temporarily, e.g. override(check_max_traces=True).

Parameters:

options (bool)