Skip to content

Commit

Permalink
fixing import
Browse files Browse the repository at this point in the history
  • Loading branch information
Olender committed Jul 25, 2023
1 parent 60951ae commit 16cf7fc
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
57 changes: 57 additions & 0 deletions test/inputfiles/model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@


dictionary = {}
dictionary["options"] = {
"cell_type": "Q", # simplexes such as triangles or tetrahedra (T) or quadrilaterals (Q)
"variant": 'lumped', # lumped, equispaced or DG, default is lumped "method":"MLT", # (MLT/spectral_quadrilateral/DG_triangle/DG_quadrilateral) You can either specify a cell_type+variant or a method
"degree": 4, # p order
"dimension": 2, # dimension
}

# Number of cores for the shot. For simplicity, we keep things serial.
# spyro however supports both spatial parallelism and "shot" parallelism.
dictionary["parallelism"] = {
"type": "automatic", # options: automatic (same number of cores for evey processor) or spatial
}

# Define the domain size without the PML. Here we'll assume a 1.00 x 1.00 km
# domain and reserve the remaining 250 m for the Perfectly Matched Layer (PML) to absorb
# outgoing waves on three sides (eg., -z, +-x sides) of the domain.
dictionary["mesh"] = {
"Lz": 1.0, # depth in km - always positive
"Lx": 1.0, # width in km - always positive
"Ly": 0.0, # thickness in km - always positive
"mesh_type": "firedrake_mesh", # options: firedrake_mesh or user_mesh
"mesh_file": None, # specify the mesh file
}

# Create a source injection operator. Here we use a single source with a
# Ricker wavelet that has a peak frequency of 5 Hz injected at the center of the mesh.
# We also specify to record the solution at a microphone near the top of the domain.
# This transect of receivers is created with the helper function `create_transect`.
dictionary["acquisition"] = {
"source_type": "ricker",
"source_locations": [(-1.0, 1.0)],#, (-0.605, 1.7), (-0.61, 1.7), (-0.615, 1.7)],#, (-0.1, 1.5), (-0.1, 2.0), (-0.1, 2.5), (-0.1, 3.0)],
"frequency": 5.0,
"delay": 1.5,
"receiver_locations": [(-0.0, 0.5)],
}

# Simulate for 2.0 seconds.
dictionary["time_axis"] = {
"initial_time": 0.0, # Initial time for event
"final_time": 1.0, # Final time for event
"dt": 0.0005, # timestep size
"amplitude": 1, # the Ricker has an amplitude of 1.
"output_frequency": 100, # how frequently to output solution to pvds
"gradient_sampling_frequency": 1, # how frequently to save solution to RAM
}

dictionary["visualization"] = {
"forward_output" : False,
"output_filename": "results/forward_output.pvd",
"fwi_velocity_model_output": False,
"velocity_model_filename": None,
"gradient_output": False,
"gradient_filename": None,
}
4 changes: 2 additions & 2 deletions test/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_read_and_write_segy():


def test_saving_shot_record():
from model import dictionary
from .inputfiles.model import dictionary
dictionary["time_axis"]["final_time"] = 0.5
Wave_obj = spyro.AcousticWave(dictionary=dictionary)
Wave_obj.set_mesh(dx=0.02)
Expand All @@ -93,7 +93,7 @@ def test_saving_shot_record():


def test_loading_shot_record():
from model import dictionary
from .inputfiles.model import dictionary
dictionary["time_axis"]["final_time"] = 0.5
Wave_obj = spyro.AcousticWave(dictionary=dictionary)
Wave_obj.set_mesh(dx=0.02)
Expand Down

0 comments on commit 16cf7fc

Please sign in to comment.