Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MaterialStrain.plot() #755

Merged
merged 2 commits into from
May 8, 2024
Merged

Fix MaterialStrain.plot() #755

merged 2 commits into from
May 8, 2024

Conversation

adtzlr
Copy link
Owner

@adtzlr adtzlr commented May 8, 2024

for materials with state variables. The state variables are now correctly handled during the Newton iterations for the transversal stretches.

Fixes #752

def fun(λ3):
    λ2 = λ3
    F = eye * np.array([λ1, λ2, λ3]).reshape(1, 3, 1, -1)
    if self.statevars_included:
        statevars = self.statevars
        if statevars is None:
            statevars = np.zeros((*self.umat.x[-1].shape, 1, 1))
        P = np.zeros_like(F)
        for increment, defgrad in enumerate(F.T):
            P[..., [increment]], statevars = self.umat.gradient(
                [F[..., [increment]], statevars]
            )
    else:
        P, statevars = self.umat.gradient([F, None])
    return P[2, 2].ravel()

@adtzlr adtzlr added the bug Something isn't working label May 8, 2024
@adtzlr adtzlr self-assigned this May 8, 2024
@adtzlr adtzlr merged commit d62ce7c into main May 8, 2024
6 of 7 checks passed
@adtzlr adtzlr deleted the fix-umat-view-statevars branch May 8, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MaterialStrain.plot() shows wrong preview
1 participant