Skip to content

Commit

Permalink
doctstring
Browse files Browse the repository at this point in the history
  • Loading branch information
srosenbu committed Jan 22, 2024
1 parent 5fac4ef commit 8db5459
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/fenics_constitutive/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
__all__ = ["strain_from_grad_u"]

def strain_from_grad_u(grad_u: np.ndarray, constraint: Constraint) -> np.ndarray:
"""Compute the Mandel-strain from the gradient of displacement.
"""
Compute the Mandel-strain from the gradient of displacement (or increments of both
quantities).
Parameters:
grad_u: Gradient of displacement field.
constraint: Constraint that the model is implemented for.
Returns:
Strain tensor.
Numpy array containing the strain for all IPs.
"""
strain_dim = constraint.stress_strain_dim()
n_gauss = int(grad_u.size / (constraint.geometric_dim()**2))
Expand Down Expand Up @@ -72,6 +75,6 @@ def strain_from_grad_u(grad_u: np.ndarray, constraint: Constraint) -> np.ndarray
strain_view[:,4] = 1/2**0.5 * (grad_u_view[:,5] + grad_u_view[:,7])
strain_view[:,5] = 1/2**0.5 * (grad_u_view[:,2] + grad_u_view[:,6])
case _:
raise NotImplementedError("Only full constraint implemented")
raise NotImplementedError("Constraint not supported.")
return strain

0 comments on commit 8db5459

Please sign in to comment.