Exemple #1
0
def get_model_syntest1_prem_vshvsv():
    types = [ParameterType.VSH, ParameterType.VSV]
    radii = np.array([3480. + 20 * i for i in range(21)])
    model_params = ModelParameters(types, radii, mesh_type='boxcar')
    model = SeismicModel.prem().boxcar_mesh(model_params)
    values_vsh = np.array(
        [0.2 * (-1)**(i//5) if i <= 9 else 0.
         for i in range(model_params.get_n_grd_params())])
    values_vsv = np.array(
        [-0.2 * (-1) ** (i // 5) if i <= 4 else 0.
         for i in range(model_params.get_n_grd_params())]
    )
    values_dict = {
        ParameterType.VSH: values_vsh,
        ParameterType.VSV: values_vsv
    }
    values_mat = model_params.get_values_matrix(values_dict)
    model_updated = model.multiply(values_mat)

    return model_updated
Exemple #2
0
def get_model_syntest1_prem():
    types = [ParameterType.VSH]
    radii = np.array([3480. + 100 * i for i in range(5)])
    model_params = ModelParameters(types, radii, mesh_type='boxcar')
    model = SeismicModel.prem().boxcar_mesh(model_params)
    values = np.array(
        [.2 * (-1)**i if i < 2 else 0.
         for i in range(model_params.get_n_grd_params())])
    values_dict = {param_type: values for param_type in types}
    values_mat = model_params.get_values_matrix(values_dict)
    model_updated = model.multiply(values_mat)

    return model_updated
Exemple #3
0
def get_model_syntest1():
    model_ref = SeismicModel.ak135()
    types = [ParameterType.VSH]
    radii = np.array([3479.5, 3680., 3880.], dtype='float')
    model_params = ModelParameters(types, radii, mesh_type='boxcar')
    model, mesh = model_ref.boxcar_mesh(model_params)
    values = np.array(
        [.2 * (-1)**i for i in range(model_params.get_n_grd_params())])
    values_dict = {param_type: values for param_type in types}
    values_mat = model_params.get_values_matrix(values_dict)
    model_updated = mesh.multiply(values_mat)

    return model_updated
Exemple #4
0
def get_model_syntest_vshvsv_4():
    model_ref = SeismicModel.prem()
    types = [ParameterType.VSH, ParameterType.VSV]
    radii = np.linspace(3480., 3980., 3, endpoint=True)
    model_params = ModelParameters(
        types, radii, mesh_type='lininterp')
    model = model_ref.lininterp_mesh(
        model_params)

    values = np.zeros(model_params.get_n_grd_params())
    values[2] = model_ref.get_value_at(radii[1], ParameterType.VSH) * 0.03
    value_dict = {
        ParameterType.VSH: values,
        ParameterType.VSV: -values
    }
    model_updated = model.build_model(
        model, model_params, value_dict)

    return model_updated
Exemple #5
0
model_params = ModelParameters(types, radii, mesh_type='lininterp')
model = SeismicModel.prem().lininterp_mesh(model_params)

# set D'' layer to constant velocity and density
for r in radii[:-1]:
    izone = model.get_zone(r)
    for p_type in ParameterType.structure_types():
        v_dpp = model.get_value_at(radii[-1], p_type)
        model.set_value(
            izone, p_type, np.array([v_dpp, 0., 0., 0.]))

# constraints to parameters
mask_dict = dict()
for p_type in ParameterType.structure_types():
    mask_dict[p_type] = np.zeros(
        model_params.get_n_grd_params(), dtype='bool')
for p_type in types:
    mask_dict[p_type] = np.ones(
        model_params.get_n_grd_params(), dtype='bool')
# fix VSH and VSV for the shallowest node (grd_param index -2 and -1)
for p_type in [ParameterType.VSH, ParameterType.VSV]:
    mask_dict[p_type][[-2, -1]] = False
# fix the radius of the deepest node (grd_param index 0 and 1)
# (the CMB radius)
mask_dict[ParameterType.RADIUS][[0, 1]] = False

discon_arr = np.zeros(
    model_params.get_n_nodes(), dtype='bool')
# allows discontinuity at the middle node (node index 1)
# this represent the D" discontinuity
discon_arr[1] = True