コード例 #1
0
ファイル: derivatives.py プロジェクト: pinebai/phd
def dEdρ(ρ, p, A, MP):
    """ Returns the partial derivative of E by ρ (holding p,A constant)
    """
    G = gram(A)
    dC0dρ = dC_0dρ(ρ, MP)
    ret = mg.dedρ(ρ, p, MP) + dC0dρ / 4 * L2_2D(dev(G))
    return ret
コード例 #2
0
ファイル: eigendecomp.py プロジェクト: pinebai/phd
def f_vectors(y, t):
    λ1 = y[0]
    λ2 = y[1]
    λ3 = y[2]
    v1 = y[3:6]
    v2 = y[6:9]
    v3 = y[9:12]

    b1 = -dot(v3, dot(λ3 * ε + λ2 * ε.T, v2)) / lim(λ2 - λ3)
    b2 = -dot(v1, dot(λ1 * ε + λ3 * ε.T, v3)) / lim(λ3 - λ1)
    b3 = -dot(v2, dot(λ2 * ε + λ1 * ε.T, v1)) / lim(λ1 - λ2)

    #b1 = -dot(v3, dot(ε + ε.T, v2)) / lim(λ2-λ3)
    #b2 = -dot(v1, dot(ε + ε.T, v3)) / lim(λ3-λ1)
    #b3 = -dot(v2, dot(ε + ε.T, v1)) / lim(λ1-λ2)

    ret = zeros(12)
    ret[0] = -2 * dot(v1, dot(ε, v1))
    ret[1] = -2 * dot(v2, dot(ε, v2))
    ret[2] = -2 * dot(v3, dot(ε, v3))
    ret[3:6] = b3 * v2 - b2 * v3
    ret[6:9] = b1 * v3 - b3 * v1
    ret[9:12] = b2 * v1 - b1 * v2

    if includeSources:
        Λ = diag(y[:3])
        ret[:3] -= 2 / τ * diag(dot(Λ, dev(Λ)))

    return ret
コード例 #3
0
ファイル: eigendecomp.py プロジェクト: pinebai/phd
def f_quaternions(y0, t):
    λ1 = y0[0]
    λ2 = y0[1]
    λ3 = y0[2]
    x = y0[3]
    y = y0[4]
    z = y0[5]

    S_SIGN = 1

    V = rotmat_quaternions(x, y, z, S_SIGN)
    v1 = V[:, 0]
    v2 = V[:, 1]
    v3 = V[:, 2]
    s = -S_SIGN * sqrt(1 - x * x - y * y - z * z)

    M = -0.5 * array([[s, -z, y], [z, s, -x], [-y, x, s]])

    ret = zeros(6)
    ret[0] = -2 * λ1 * dot(v1, dot(ε, v1))
    ret[1] = -2 * λ2 * dot(v2, dot(ε, v2))
    ret[2] = -2 * λ3 * dot(v3, dot(ε, v3))
    ret[3:] = -b_quaternions(V, y0[:3])
    ret[3] /= lim(λ2 - λ3)
    ret[4] /= lim(λ3 - λ1)
    ret[5] /= lim(λ1 - λ2)
    ret[3:] = dot(M, ret[3:])

    if includeSources:
        Λ = diag(y0[:3])
        ret[:3] -= 2 / τ * diag(dot(Λ, dev(Λ)))

    return ret
コード例 #4
0
ファイル: eigendecomp.py プロジェクト: pinebai/phd
def f_angles(y0, t):
    λ1 = y0[0]
    λ2 = y0[1]
    λ3 = y0[2]
    x = y0[3]
    y = y0[4]
    z = y0[5]

    V = rotmat_angles(x, y, z)
    v1 = V[:, 0]
    v2 = V[:, 1]
    v3 = V[:, 2]

    ret = zeros(6)
    ret[0] = -2 * λ1 * dot(v1, dot(ε, v1))
    ret[1] = -2 * λ2 * dot(v2, dot(ε, v2))
    ret[2] = -2 * λ3 * dot(v3, dot(ε, v3))
    ret[3:] = dot(Minv(x, y, z, λ1, λ2, λ3), b_angles(x, y, z, λ1, λ2, λ3))

    if includeSources:
        Λ = diag(y0[:3])
        ret[:3] -= 2 / τ * diag(dot(Λ, dev(Λ)))

    return ret
コード例 #5
0
def E_2A(ρ, A, MP):
    """ Returns the mesoscale energy dependent on the distortion
    """
    C0 = C_0(ρ, MP)
    G = gram(A)
    return C0 / 4 * L2_2D(dev(G))
コード例 #6
0
ファイル: split_plasticity.py プロジェクト: pinebai/phd
from numpy.linalg import det, eigvals
from numpy.random import rand
from scipy.integrate import quad
from scipy.optimize import newton_krylov

from gpr.misc.functions import dev
from gpr.misc.objects import material_params
from gpr.misc.structures import Cvec
from gpr.vars.eos import E_2A
from plot import plot_energy, plot_distortion, plot_sigma, colors


A = rand(3, 3)
A *= sign(det(A))
G = dot(A.T, A)
σ = dot(G, dev(G))

x1, x2, x3 = eigvals(G) / det(A)**(2 / 3)

a = x1 + x2 + x3
b = x1**2 + x2**2 + x3**2
c = x1**3 + x2**3 + x3**3

norm0 = sqrt(1 / 2 * ((σ[0, 0] - σ[1, 1])**2 + (σ[1, 1] - σ[2, 2])**2 +
                      (σ[2, 2] - σ[0, 0])**2 + 6 * (σ[0, 1]**2 + σ[1, 2]**2 + σ[2, 0]**2)))

norm1 = sqrt(3 / 2) * norm(dev(σ))

print(norm0 - norm1)

tmp = sqrt(7 / 54 * a**4 - 2 / 3 * a**2 * b + b**2 / 6 + 2 / 3 * a * c)