Example #1
0
def ComputeEnergy(P, S, Eps, Sig, dV, Eps_s, Sig_s, Eps_p, Sig_p):

    dE = np.empty(P.size)

    for i, (p, s) in enumerate(zip(P.ravel(), S.ravel())):
        dE[i] = np.sum(gtens.A2_ddot_B2(Sig + p * Sig_p + s * Sig_s, p * Eps_p + s * Eps_s) * dV)

    return dE.reshape(P.shape)
Example #2
0
# Find which (s, p) lie on the yield surface, and to which energy change those perturbations lead
Py, Sy = GetYieldSurface(E, gamma, Epsstar_p[0, 0], Epsstar_s[0, 1])
Ey = ComputeEnergy(Py, Sy, Eps, Sig, quad.dV(), Eps_s, Sig_s, Eps_p, Sig_p)

# --------------------------------
# Explore different configurations
# --------------------------------

dV = quad.dV()
sig = np.zeros((201, 201))
eps = np.zeros(sig.shape)
energy = np.zeros(sig.shape)
P = np.linspace(-3, 3, sig.shape[0])
S = np.linspace(-3, 3, sig.shape[1])
E0 = np.average(0.5 * gtens.A2_ddot_B2(Sig, Eps), weights=dV) * np.sum(dV)

for i, p in enumerate(P):
    for j, s in enumerate(S):

        Eps_n = Eps + s * Eps_s + p * Eps_p
        Sig_n = Sig + s * Sig_s + p * Sig_p

        sig[i, j] = GMat.Sigd(Sig_n[trigger, 0])
        eps[i, j] = GMat.Epsd(Eps_n[trigger, 0])
        energy[i, j] = (
            np.average(0.5 * gtens.A2_ddot_B2(Sig_n, Eps_n), weights=dV) *
            np.sum(dV) - E0)

# Plot phase diagram - stress