Replies: 3 comments
-
see also #742 and the newly added test: felupe/tests/test_constitution_newton.py Lines 42 to 66 in bd2d6fc |
Beta Was this translation helpful? Give feedback.
-
Now that the local Newton-iterations are working as expected, let's try to implement the viscoelastic microsphere model. This is really nice because the evolution equation is derived by the constraint equation. Newton's method is applied independently on the affine micro-stretches. Hence, the nd-solver is called with import felupe as fem
import tensortrax.math as tm
import tensortrax as tr
from functools import partial
def visco(C, statevars, **kwargs):
def W(λ, ζn, μ, τ, δ, Δt):
εn = tm.array(ζn[:21], like=λ)
def evolution(ε, εn, λ):
ψ = μ / 2 * (tm.log(λ) - ε) ** 2
ϕ = δ / (τ * μ * (1 + δ)) * (τ * μ * tm.abs(ε - εn) / Δt) ** ((1 + δ) / δ)
return ψ + ϕ
ε = fem.newtonrhapson(
x0=εn.x,
fun=tr.jacobian(evolution, ntrax=1 + λ.ntrax),
jac=tr.hessian(evolution, ntrax=1 + λ.ntrax),
solve=partial(fem.math.solve_nd, n=0),
args=(εn.x, λ.x),
verbose=0,
).x
ψ = μ / 2 * (tm.log(λ) - ε) ** 2
return ψ, ε
ψf, statevars1 = (
fem.constitution.hyperelasticity.models.microsphere.affine_stretch_statevars(
C, statevars[:21], f=W, kwargs=kwargs
)
)
ψc, statevars2 = (
fem.constitution.hyperelasticity.models.microsphere.affine_tube_statevars(
C, statevars[21:], f=W, kwargs=kwargs
)
)
return ψf + ψc, tm.stack([*statevars1, *statevars2])
umat = fem.MaterialAD(
visco,
**{"μ": 6, "τ": 0.1, "δ": 1, "Δt": 10.0},
nstatevars=42,
parallel=True,
)
ux = fem.math.linsteps(
[1, 1.5, 1],
num=20,
)
ax = umat.plot(
incompressible=True,
ux=ux,
ps=ux,
bx=(ux - 1) / 2 + 1,
) |
Beta Was this translation helpful? Give feedback.
-
Sadly, with the parameters from the paper, Newton's method fails. import felupe as fem
import tensortrax.math as tm
import tensortrax as tr
import pypardiso
from functools import partial
def visco(C, statevars, **kwargs):
def W(λ, ζn, μ, τ, δ, Δt):
εn = tm.array(ζn, like=λ)
def evolution(ε, εn, λ):
ψ = μ / 2 * (tm.log(λ) - ε) ** 2
ϕ = δ / (τ * μ * (1 + δ)) * (τ * μ * tm.abs(ε - εn) / Δt) ** ((1 + δ) / δ)
return ψ + ϕ * Δt
ε = fem.newtonrhapson(
x0=εn.x,
fun=tr.jacobian(evolution, ntrax=1 + λ.ntrax),
jac=tr.hessian(evolution, ntrax=1 + λ.ntrax),
solve=partial(fem.math.solve_nd, n=0),
args=(εn.x, λ.x),
verbose=0,
tol=1e-2,
).x
ψ = μ / 2 * (tm.log(λ) - ε) ** 2
return ψ, ε
w1 = fem.constitution.hyperelasticity.models.microsphere.affine_stretch_statevars
w2 = fem.constitution.hyperelasticity.models.microsphere.affine_tube_statevars
dt = 0.1
ψf1, sv1 = w1(
C, statevars[:21], f=W, kwargs={"μ": 6.16, "τ": 0.1, "δ": 2.97, "Δt": dt}
)
ψf2, sv2 = w1(
C, statevars[21:42], f=W, kwargs={"μ": 1.35, "τ": 1e1, "δ": 2.46, "Δt": dt}
)
ψf3, sv3 = w1(
C, statevars[42:63], f=W, kwargs={"μ": 1.76, "τ": 1e3, "δ": 24.46, "Δt": dt}
)
ψc1, sv4 = w2(
C, statevars[63:84], f=W, kwargs={"μ": 7.19, "τ": 0.1, "δ": 1.02, "Δt": dt}
)
ψc2, sv5 = w2(
C, statevars[84:105], f=W, kwargs={"μ": 1.13, "τ": 1e1, "δ": 2.05, "Δt": dt}
)
ψc3, sv6 = w2(
C, statevars[105:126], f=W, kwargs={"μ": 1.63, "τ": 1e3, "δ": 16.47, "Δt": dt}
)
return ψf1 + ψf2 + ψf3 + ψc1 + ψc2 + ψc3, tm.stack(
[*sv1, *sv2, *sv3, *sv4, *sv5, *sv6]
)
umat = fem.MaterialAD(
visco,
nstatevars=126,
parallel=True,
)
ux = fem.math.linsteps(
[1.01, 1.5, 1],
num=100,
)
ax = umat.plot(
incompressible=True,
ux=ux,
ps=ux,
bx=(ux - 1) / 2 + 1,
) |
Beta Was this translation helpful? Give feedback.
-
As a follow-up on #666, this is finite-strain viscoelasticity (probably the most simple model formulation) with local Newton-iterations to solve the evolution equation
using matadi.This could enable e.g. an implementation of the Bergstrom-Boyce model?
It's basically straigh-forward
Beta Was this translation helpful? Give feedback.
All reactions