def test_ricker(): """ Tests Ricker wavelet. """ vals = functional.ricker(x=np.array([1.]), f=1.) assert vals.size == 1
def rho(x): return 8.0 def modulus(x): return rho(x) * (target_vp ** 2) def eta(x): return 2.0 * modulus(x) * target_vp * target_law_coef # Creating left dirichlet boundary condition. left_bc = configuration.BoundaryCondition(boundary_condition_type=configuration.BoundaryConditionType.DIRICHLET, value=lambda t: functional.ricker(t - src_offset, central_frequency)) absorbing_param = np.sqrt(rho(0.) * modulus(0.)) right_bc = configuration.BoundaryCondition(boundary_condition_type=configuration.BoundaryConditionType.ABSORBING, value=lambda t: 0, param=absorbing_param) # Creating configuration. config = configuration.ViscoElasticKelvinVoigt(density=rho, modulus=modulus, eta=eta, left_bc=left_bc, right_bc=right_bc) # Creating finite element space. fe_space = fe_sp.FiniteElementSpace(mesh=mesh.make_mesh_from_npt(0.0, 10.0, 300), fe_order=5, quad_order=5) # Creating propagator. propag = visco_elastic_kelvin_voigt_propagator.ViscoElasticKelvinVoigt(config=config, fe_space=fe_space)
D = 0.1 VP = np.sqrt(C / rho) # definition of material parameters for Zener model. k1, k2, eta = kelvin_voigt_to_zener(C, D, target_w) # Creating finite element space. fe_space = fe_sp.FiniteElementSpace(mesh=mesh.make_mesh_from_npt(0.0, 30.0, 900), fe_order=5, quad_order=5) # Creating boundary conditions. if wide_band_src is False: left_bc = configuration.BoundaryCondition(boundary_condition_type=configuration.BoundaryConditionType.DIRICHLET, value=lambda t: functional.gated_cosine(t - narrow_band_offset, central_frequency, narrow_band_std_dev)) elif wide_band_src is True: left_bc = configuration.BoundaryCondition(boundary_condition_type=configuration.BoundaryConditionType.DIRICHLET, value=lambda t: functional.ricker(t - wide_band_offset, central_frequency)) absorbing_param = np.sqrt(rho * C) right_bc = configuration.BoundaryCondition(boundary_condition_type=configuration.BoundaryConditionType.ABSORBING, value=lambda t: 0, param=absorbing_param) # Creating configurations. config_KV = configuration.ViscoElasticKelvinVoigt(density=lambda x: rho, modulus=lambda x: C, eta=lambda x: D, left_bc=left_bc, right_bc=right_bc) config_Z = configuration.ViscoElasticZener(density=lambda x: rho, modulus1=lambda x: k1, modulus2=lambda x: k2, eta=lambda x: eta, left_bc=left_bc, right_bc=right_bc) # Creating propagators. propag_KV = visco_elastic_kelvin_voigt_propagator.ViscoElasticKelvinVoigt(config=config_KV, fe_space=fe_space, scheme_type=visco_elastic_kelvin_voigt_propagator.SchemeType.EXPLICIT_ORDERONE)
def alpha(x): c = celerity(x) c2 = c * c return 1.0 / c2 def beta(x): return 2.0 # Creating left robin boundary condition. left_bc = configuration.BoundaryCondition( boundary_condition_type=configuration.BoundaryConditionType.DIRICHLET, value=lambda t: functional.ricker(t - 0.4, 25.0)) absorbing_param = np.sqrt(beta(1.5) * alpha(1.5)) right_bc = configuration.BoundaryCondition( boundary_condition_type=configuration.BoundaryConditionType.ABSORBING, value=lambda t: 0, param=absorbing_param) # Creating configuration. config = configuration.Elastic(alpha=alpha, beta=beta, left_bc=left_bc, right_bc=right_bc) # Creating finite element space. fe_space = fe_sp.FiniteElementSpace(mesh=mesh.make_mesh_from_npt(
return 1.0 def beta(x, theta): return theta true_beta = partial(beta, theta=THETA_BAR) # Creating configuration. # We don't need to specify a right boundary condition since the natural boundary condition is zero derivative, # which is what we want. left_bc = configuration.BoundaryCondition( boundary_condition_type=configuration.BoundaryConditionType.ROBIN, param=0.0, value=lambda t: ricker(t - 2.4, 2.0)) config_theta_bar = configuration.Elastic(alpha=alpha, beta=true_beta, left_bc=left_bc) fe_space = fe_sp.FiniteElementSpace(mesh=mesh.make_mesh_from_npt( 0.0, 1.5, 200), fe_order=5, quad_order=5) propag = elastic_propagator.Elastic( config=config_theta_bar, fe_space=fe_space, mass_assembly_type=fe_op.AssemblyType.LUMPED, stiffness_assembly_type=fe_op.AssemblyType.ASSEMBLED)