jaxmat.materials.multiphysics module#
Generic multiphysics behaviors.
A multiphysics behavior declares its variables once, as a Physics
built by make_physics(), and implements a single response method. The
state class, the packing of inputs and outputs, the recording of every variable in the new
state, and the consistent tangent blocks are all derived from that declaration:
POROELASTICITY = make_physics(
"Poroelasticity",
gradients={"strain": SymmetricTensor2, "p": 0.0},
fluxes={"stress": SymmetricTensor2, "zeta": 0.0},
)
class LinearBiot(MultiphysicsBehavior):
physics = POROELASTICITY
elasticity: AbstractLinearElastic
b: float = parameter()
M: float = parameter()
def response(self, x, state, dt):
sig = self.elasticity.C @ x.strain - self.b * x.p * Id
zeta = self.b * x.strain.tr + x.p / self.M
return (sig, zeta), state.internal
The library does not fix any multiphysics declaration: each behavior declares the variables
it exchanges, with the names and conventions of its own formulation. Coupled physics are
declared as a whole rather than composed: thermo-poromechanics, for instance, is one physics
with gradients (strain, p), fluxes (stress, zeta) and the external variable T.
Material parameters may depend on any declared external variable (see
jaxmat.parameters): they are resolved at the current values before response.
- class MultiphysicsBehavior[source]#
Bases:
AbstractBehaviorBehavior whose variables are declared by a
Physics.Subclasses set the class attribute
physicsand implementresponse(). They write no state class and nostate.updateboilerplate.constitutive_update(inputs, state, dt)takes the gradients followed by the external variables, as a tuple in declaration order, a dict, or the physics’Inputsnamed tuple, even when there is a single input. It always returns the fluxes as the physics’Fluxesnamed tuple, together with the new state in which every input and flux has been recorded.Variable-dependent parameters (
jaxmat.parameters) of the behavior, including those of its sub-modules, are resolved at the current values of the declared external variables beforeresponse()is called. A parameter depending on an undeclared variable raises an error.- abstract response(x, state, dt)[source]#
Compute the fluxes and the new internal state.
- Parameters:
x (Inputs) – Named tuple of the current gradients and external variables, e.g.
x.strain,x.p,x.T.state (AbstractState) – State at the beginning of the step: previous values are
state.strain,state.stress…, internal variables arestate.internal.dt (float) – Time increment.
- Returns:
fluxes (tuple, dict or Fluxes) – Fluxes in declaration order.
internal (AbstractState or None) – New internal state.
- tangent(inputs, state, dt)[source]#
Consistent tangent blocks
d flux / d gradient, by forward-mode autodiff.Returns a dict keyed by
(flux_name, gradient_name). Tensors are differentiated in their stored (Mandel) representation, so the strain-stress block of a small-strain behavior is the usual(6, 6)Mandel tangent; a block involving a scalar drops the corresponding dimension.