Example #1
0
# # Parabola
# y1 = amplitude * x1 ** 2
# y2 = amplitude * x2 ** 2

# # Kinked
# y1[x1<0] = amplitude * x1[x1<0]
# y2[x2<0] = amplitude * x2[x2<0]

for i in range(0, x1.size):
    element["x1"] = x1[i]
    element["y1"] = y1[i]
    element["x2"] = x2[i]
    element["y2"] = y2[i]
    elements.append(element.copy())
elements = bem2d.standardize_elements(elements)
partials_displacement, partials_stress, _ = bem2d.quadratic_partials_all(
    elements, elements, mu, nu)

partials_displacement_constant, partials_stress_constant, _ = bem2d.constant_partials_all(
    elements, elements, mu, nu)

x_eval = np.array([_["x_integration_points"] for _ in elements]).flatten()
y_eval = np.array([_["y_integration_points"] for _ in elements]).flatten()
slip_quadratic = np.zeros(6 * n_elements)
slip_constant = np.zeros(2 * n_elements)

# # Constant slip
# slip_quadratic[0::2] = 1  # constant strike-slip only
# slip_constant = np.ones(slip_constant.size)
# suptitle = "Constant slip"

# Linear slip
ELEMENTS_FAULT_ARRAYS = {}
ELEMENTS_FAULT_ARRAYS["a"] = np.array(
    [np.tile(_["a"], 3) for _ in ELEMENTS_FAULT]).flatten()
ELEMENTS_FAULT_ARRAYS["b"] = np.array(
    [np.tile(_["b"], 3) for _ in ELEMENTS_FAULT]).flatten()
ELEMENTS_FAULT_ARRAYS["additional_normal_stress"] = np.array(
    [np.tile(_["sigma_n"], 3) for _ in ELEMENTS_FAULT]).flatten()
ELEMENTS_FAULT_ARRAYS["element_normals"] = np.empty((N_ELEMENTS, 2))
ELEMENTS_FAULT_ARRAYS["element_normals"][:, 0] = np.array(
    [_["x_normal"] for _ in ELEMENTS_FAULT]).flatten()
ELEMENTS_FAULT_ARRAYS["element_normals"][:, 1] = np.array(
    [_["y_normal"] for _ in ELEMENTS_FAULT]).flatten()

# Calculate slip to traction partials on the fault
START_TIME = time.time()
_, SLIP_TO_STRESS, SLIP_TO_TRACTION = bem2d.quadratic_partials_all(
    ELEMENTS_FAULT, ELEMENTS_FAULT, PARAMETERS["mu"], PARAMETERS["nu"])
PARTIALS_TIME = time.time() - START_TIME


def calc_state(state, velocity):
    """ State evolution law : aging law """
    dstate_dt = (
        ELEMENTS_FAULT_ARRAYS["b"] * PARAMETERS["v_0"] / PARAMETERS["d_c"] *
        (np.exp((PARAMETERS["f_0"] - state) / ELEMENTS_FAULT_ARRAYS["b"]) -
         (velocity / PARAMETERS["v_0"])))
    return dstate_dt


def steady_state(
        velocities):  # Should I eliminate this since its only called once?
    """ Steady-state state for initial condition """
for i in range(0, x1.size):
    element["x1"] = x1[i]
    element["y1"] = y1[i]
    element["x2"] = x2[i]
    element["y2"] = y2[i]
    element["name"] = "fault"
    # element["ux_local"] = 1  # strike-slip forcing
    # element["uy_local"] = 0  # tensile-forcing
    element["ux_global_quadratic"] = np.array([1, 1, 1])  # strike-slip forcing
    element["uy_global_quadratic"] = np.array([0, 0, 0])  # tensile-forcing

    elements_fault.append(element.copy())
elements_fault = bem2d.standardize_elements(elements_fault)

# Calculate partial derivative matrices
_, _, traction_partials_surface_from_fault = bem2d.quadratic_partials_all(
    elements_surface, elements_fault, mu, nu)
_, _, traction_partials_surface_from_surface = bem2d.quadratic_partials_all(
    elements_surface, elements_surface, mu, nu)

# Solve the BEM problem
fault_slip = np.zeros(6 * len(elements_fault))
fault_slip[0::2] = np.array([_["ux_global_quadratic"]
                             for _ in elements_fault]).flatten()
fault_slip[1::2] = np.array([_["uy_global_quadratic"]
                             for _ in elements_fault]).flatten()
displacement_free_surface = np.linalg.inv(
    traction_partials_surface_from_surface) @ (
        traction_partials_surface_from_fault @ fault_slip)

# Observation points for internal evaluation and visualization
n_pts = 50
for i in range(0, x1.size):
    element["x1"] = x1[i]
    element["y1"] = y1[i]
    element["x2"] = x2[i]
    element["y2"] = y2[i]
    elements_fault.append(element.copy())
elements_fault = bem2d.standardize_elements(elements_fault)
n_elements = len(elements_fault)

# Constant slip partial derivatives
slip_to_displacement, slip_to_traction = bem2d.constant_linear_partials(
    elements_fault, elements_fault, "slip", mu, nu)

# Quadratic slip partial derivative
slip_to_displacement_quadratic, slip_to_stress_quadratic, slip_to_traction_quadratic = bem2d.quadratic_partials_all(
    elements_fault, elements_fault, mu, nu)

sm = 3e10  # Shear modulus (Pa)
density = 2700  # rock density (kg/m^3)
cs = np.sqrt(sm / density)  # Shear wave speed (m/s)
eta = sm / (2 * cs)  # The radiation damping coefficient (kg / (m^2 * s))
Vp = 1e-9  # Rate of plate motion
sigma_n = 50e6  # Normal stress (Pa)
a = 0.015  # direct velocity strengthening effect
b = 0.02  # state-based velocity weakening effect
Dc = 0.05  # state evolution length scale (m)
f0 = 0.6  # baseline coefficient of friction
V0 = 1e-6  # when V = V0, f = f0, V is (m/s)
secs_per_year = 365 * 24 * 60 * 60
time_interval_yrs = np.linspace(0.0, 600.0, 5001)
time_interval = time_interval_yrs * secs_per_year
Example #5
0
# Constant slip fault
x1, y1, x2, y2 = bem2d.discretized_line(-1, -1, 0, 0, 1)
for i in range(0, x1.size):
    element["x1"] = x1[i]
    element["y1"] = y1[i]
    element["x2"] = x2[i]
    element["y2"] = y2[i]
    element["name"] = "fault"
    elements_fault.append(element.copy())
elements_fault = bem2d.standardize_elements(elements_fault)

d1, s1, t1 = bem2d.constant_partials_all(elements_surface, elements_fault, mu,
                                         nu)
d2, s2, t2 = bem2d.constant_partials_all(elements_surface, elements_surface,
                                         mu, nu)
d1_quadratic, s1_quadratic, t1_quadratic = bem2d.quadratic_partials_all(
    elements_surface, elements_fault, mu, nu)
d2_quadratic, s2_quadratic, t2_quadratic = bem2d.quadratic_partials_all(
    elements_surface, elements_surface, mu, nu)

# Constant case: Predict surface displacements from unit strike slip forcing
x_center = np.array([_["x_center"] for _ in elements_surface])
fault_slip = np.zeros(2 * len(elements_fault))
fault_slip[0::2] = np.sqrt(2) / 2
fault_slip[1::2] = np.sqrt(2) / 2
disp_full_space = d1 @ fault_slip
disp_free_surface = np.linalg.inv(t2) @ (t1 @ fault_slip)

# Quadratic case: Predict surface displacements from unit strike slip forcing
x_center_quadratic = np.array(
    [_["x_integration_points"] for _ in elements_surface]).flatten()
fault_slip_quadratic = np.zeros(6 * len(elements_fault))
Example #6
0
    element["y1"] = y1[i]
    element["x2"] = x2[i]
    element["y2"] = y2[i]
    elements.append(element.copy())
elements = bem2d.standardize_elements(elements)

# Convert to dictionary of lists
elements_DL = pd.DataFrame(elements).to_dict("list")
# Convert back to list of dictionaries
elements_LD = pd.DataFrame(elements_DL).to_dict("records")
print(elements == elements_LD)

partials_displacement_constant, partials_stress_constant, partials_traction_constant = bem2d.constant_partials_all(
    elements, elements, mu, nu)

partials_displacement_quadratic, partials_stress_quadratic, partials_traction_quadratic = bem2d.quadratic_partials_all(
    elements, elements, mu, nu)

# Create fault elements
N_ELEMENTS = 10
N_NODES = 3 * N_ELEMENTS
ELEMENTS_FAULT = []
ELEMENT = {}
L = 10000
x1, y1, x2, y2 = bem2d.discretized_line(-L, 0, L, 0, N_ELEMENTS)

for i in range(0, x1.size):
    ELEMENT["x1"] = x1[i]
    ELEMENT["y1"] = y1[i]
    ELEMENT["x2"] = x2[i]
    ELEMENT["y2"] = y2[i]
    ELEMENT["a"] = 0.015  # frictional a parameter ()